From 273a861ec446aafeac5dfa252d52374d870854c1 Mon Sep 17 00:00:00 2001 From: thednp Date: Sun, 12 Dec 2021 22:13:07 +0200 Subject: [PATCH] Work in progress: * added JSDoc for all files * added strong TypeScript definitions * Fixed some issue with `Offcanvas` not removing the overlay * fixed an issue with `Dropdown`, focusing in after hiding the dropdown menu * added an `Component.getInstance` static method to all components * added components data like the original, requires doc updates * added `defaults`, `name` and `version` methods to all components * reworked the `initCallback` and `removeDataApi` * all components expose an initialization method * code cleanup @fmasa please take a minute and check the TypeScript definitions whenever you get some time, report back anything wrong, this commit is dedicated to YOU! --- .gitignore | 1 + .npmignore | 1 + assets/js/scripts-v4.js | 4 +- assets/js/scripts.js | 39 +- dist/bootstrap-native-v4-esm.js | 139 +- dist/bootstrap-native-v4-esm.min.js | 4 +- dist/bootstrap-native-v4.js | 139 +- dist/bootstrap-native-v4.min.js | 4 +- dist/bootstrap-native.esm.js | 1976 ++++++++++++++--- dist/bootstrap-native.esm.min.js | 4 +- dist/bootstrap-native.js | 1976 ++++++++++++++--- dist/bootstrap-native.min.js | 4 +- dist/components/alert-native.esm.js | 335 ++- dist/components/alert-native.js | 335 ++- dist/components/button-native.esm.js | 243 +- dist/components/button-native.js | 243 +- dist/components/carousel-native.esm.js | 492 +++- dist/components/carousel-native.js | 492 +++- dist/components/collapse-native.esm.js | 393 +++- dist/components/collapse-native.js | 393 +++- dist/components/dropdown-native.esm.js | 389 +++- dist/components/dropdown-native.js | 389 +++- dist/components/modal-native.esm.js | 527 ++++- dist/components/modal-native.js | 527 ++++- dist/components/offcanvas-native.esm.js | 545 ++++- dist/components/offcanvas-native.js | 545 ++++- dist/components/popover-native.esm.js | 521 ++++- dist/components/popover-native.js | 521 ++++- dist/components/scrollspy-native.esm.js | 297 ++- dist/components/scrollspy-native.js | 297 ++- dist/components/tab-native.esm.js | 383 +++- dist/components/tab-native.js | 383 +++- dist/components/toast-native.esm.js | 376 +++- dist/components/toast-native.js | 376 +++- dist/components/tooltip-native.esm.js | 507 ++++- dist/components/tooltip-native.js | 507 ++++- dist/polyfill.js | 19 +- dist/polyfill.min.js | 4 +- index.html | 77 +- package.json | 8 +- rollup.config.js | 8 +- src/components-v4/alert-native.js | 8 +- src/components-v4/button-native.js | 6 +- src/components-v4/carousel-native.js | 20 +- src/components-v4/collapse-native.js | 10 +- src/components-v4/dropdown-native.js | 8 +- src/components-v4/modal-native.js | 18 +- src/components-v4/popover-native.js | 18 +- src/components-v4/scrollspy-native.js | 10 +- src/components-v4/tab-native.js | 12 +- src/components-v4/toast-native.js | 10 +- src/components-v4/tooltip-native.js | 18 +- src/components/alert-native.js | 86 +- src/components/base-component.js | 49 +- src/components/button-native.js | 61 +- src/components/carousel-native.js | 230 +- src/components/collapse-native.js | 121 +- src/components/dropdown-native.js | 188 +- src/components/modal-native.js | 180 +- src/components/offcanvas-native.js | 191 +- src/components/popover-native.js | 212 +- src/components/scrollspy-native.js | 104 +- src/components/tab-native.js | 123 +- src/components/toast-native.js | 116 +- src/components/tooltip-native.js | 203 +- src/index-v4.js | 32 +- src/index.js | 29 +- src/strings/activeClass.js | 3 + src/strings/collapsingClass.js | 5 +- src/strings/dataBsAnimation.js | 3 + src/strings/dataBsContainer.js | 3 + src/strings/dataBsContent.js | 3 + src/strings/dataBsDelay.js | 3 + src/strings/dataBsDismiss.js | 3 + src/strings/dataBsKeyboard.js | 3 + src/strings/dataBsParent.js | 3 + src/strings/dataBsPlacement.js | 3 + src/strings/dataBsTarget.js | 3 + src/strings/dataBsTitle.js | 3 + src/strings/dataBsToggle.js | 3 + src/strings/dataOriginalTitle.js | 3 + src/strings/dropdownClasses.js | 3 + src/strings/dropdownMenuClass.js | 3 + src/strings/fadeClass.js | 3 + src/strings/fixedBottomClass.js | 3 + src/strings/fixedTopClass.js | 3 + src/strings/showClass.js | 3 + src/strings/stickyTopClass.js | 3 + src/util/backdrop.js | 40 +- src/util/bootstrapCustomEvent-v4.js | 1 + src/util/bootstrapCustomEvent.js | 12 +- src/util/closestRelative.js | 5 + src/util/componentsInit-v4.js | 2 + src/util/componentsInit.js | 1 - src/util/dispatchCustomEvent.js | 4 + src/util/getElementFromTarget.js | 11 +- src/util/getScroll.js | 7 +- src/util/getTargetElement.js | 15 +- src/util/getTipContainer.js | 12 +- src/util/getUID.js | 8 +- src/util/init-v4.js | 26 +- src/util/init.js | 97 +- .../{initCallback.js => initCallback-v4.js} | 4 +- src/util/isEmptyAnchor.js | 7 + src/util/isMedia.js | 6 + src/util/isRTL.js | 2 - src/util/polyfill.js | 25 +- .../{removeDataAPI.js => removeDataAPI-v4.js} | 4 +- src/util/scrollbar.js | 38 +- src/util/setFocus.js | 4 + src/util/setHtml.js | 15 +- src/util/styleTip-back.js | 4 +- src/util/styleTip-v4.js | 2 +- src/util/styleTip.js | 11 +- src/util/util.js | 10 +- src/{util => }/version.js | 2 +- tsconfig.json | 13 +- types/bsn.d.ts | 690 ++++++ types/components-v4/alert-native.d.ts | 7 - types/components-v4/button-native.d.ts | 5 - types/components-v4/carousel-native.d.ts | 8 - types/components-v4/collapse-native.d.ts | 8 - types/components-v4/dropdown-native.d.ts | 8 - types/components-v4/modal-native.d.ts | 10 - types/components-v4/popover-native.d.ts | 8 - types/components-v4/scrollspy-native.d.ts | 6 - types/components-v4/tab-native.d.ts | 6 - types/components-v4/toast-native.d.ts | 7 - types/components-v4/tooltip-native.d.ts | 8 - types/components/alert-native.d.ts | 17 - types/components/base-component.d.ts | 5 - types/components/button-native.d.ts | 16 - types/components/carousel-native.d.ts | 29 - types/components/collapse-native.d.ts | 20 - types/components/dropdown-native.d.ts | 22 - types/components/modal-native.d.ts | 25 - types/components/offcanvas-native.d.ts | 20 - types/components/popover-native.d.ts | 33 - types/components/scrollspy-native.d.ts | 24 - types/components/tab-native.d.ts | 18 - types/components/toast-native.d.ts | 17 - types/components/tooltip-native.d.ts | 32 - types/index-v4.d.ts | 33 - types/index.d.ts | 81 +- types/more/bsn.ts | 14 + types/more/types.d.ts | 397 ++++ types/strings/activeClass.d.ts | 2 - types/strings/ariaDescribedBy.d.ts | 2 - types/strings/ariaExpanded.d.ts | 2 - types/strings/ariaHidden.d.ts | 2 - types/strings/ariaModal.d.ts | 2 - types/strings/ariaSelected.d.ts | 2 - types/strings/collapsingClass.d.ts | 2 - types/strings/dataBsAnimation.d.ts | 2 - types/strings/dataBsContainer.d.ts | 2 - types/strings/dataBsContent.d.ts | 2 - types/strings/dataBsDelay.d.ts | 2 - types/strings/dataBsDismiss.d.ts | 2 - types/strings/dataBsKeyboard.d.ts | 2 - types/strings/dataBsParent.d.ts | 2 - types/strings/dataBsPlacement.d.ts | 2 - types/strings/dataBsTarget.d.ts | 2 - types/strings/dataBsTitle.d.ts | 2 - types/strings/dataBsToggle.d.ts | 2 - types/strings/dataOriginalTitle.d.ts | 2 - types/strings/dropdownClasses.d.ts | 2 - types/strings/dropdownMenuClass.d.ts | 2 - types/strings/fadeClass.d.ts | 2 - types/strings/fixedBottomClass.d.ts | 2 - types/strings/fixedTopClass.d.ts | 2 - types/strings/showClass.d.ts | 2 - types/strings/stickyTopClass.d.ts | 2 - types/util/backdrop.d.ts | 11 - types/util/bootstrapCustomEvent-v4.d.ts | 1 - types/util/bootstrapCustomEvent.d.ts | 1 - types/util/closestRelative.d.ts | 1 - types/util/componentsInit.d.ts | 2 - types/util/dispatchCustomEvent.d.ts | 1 - types/util/getElementFromTarget.d.ts | 1 - types/util/getScroll.d.ts | 4 - types/util/getTargetElement.d.ts | 1 - types/util/getTipContainer.d.ts | 1 - types/util/getUID.d.ts | 1 - types/util/init-v4.d.ts | 1 - types/util/init.d.ts | 2 - types/util/initCallback.d.ts | 1 - types/util/isEmptyAnchor.d.ts | 1 - types/util/isMedia.d.ts | 1 - types/util/isRTL.d.ts | 2 - types/util/isVisible.d.ts | 1 - types/util/isVisibleTip.d.ts | 1 - types/util/polyfill.d.ts | 1 - types/util/removeDataAPI.d.ts | 1 - types/util/scrollbar.d.ts | 3 - types/util/setFocus.d.ts | 1 - types/util/setHtml.d.ts | 1 - types/util/styleTip-back.d.ts | 1 - types/util/styleTip-v4.d.ts | 1 - types/util/styleTip.d.ts | 1 - types/util/tipClassPositions.d.ts | 7 - types/util/util.d.ts | 19 - types/util/version.d.ts | 2 - 202 files changed, 15673 insertions(+), 2965 deletions(-) create mode 100644 src/util/componentsInit-v4.js delete mode 100644 src/util/componentsInit.js rename src/util/{initCallback.js => initCallback-v4.js} (80%) delete mode 100644 src/util/isRTL.js rename src/util/{removeDataAPI.js => removeDataAPI-v4.js} (81%) rename src/{util => }/version.js (52%) create mode 100644 types/bsn.d.ts delete mode 100644 types/components-v4/alert-native.d.ts delete mode 100644 types/components-v4/button-native.d.ts delete mode 100644 types/components-v4/carousel-native.d.ts delete mode 100644 types/components-v4/collapse-native.d.ts delete mode 100644 types/components-v4/dropdown-native.d.ts delete mode 100644 types/components-v4/modal-native.d.ts delete mode 100644 types/components-v4/popover-native.d.ts delete mode 100644 types/components-v4/scrollspy-native.d.ts delete mode 100644 types/components-v4/tab-native.d.ts delete mode 100644 types/components-v4/toast-native.d.ts delete mode 100644 types/components-v4/tooltip-native.d.ts delete mode 100644 types/components/alert-native.d.ts delete mode 100644 types/components/base-component.d.ts delete mode 100644 types/components/button-native.d.ts delete mode 100644 types/components/carousel-native.d.ts delete mode 100644 types/components/collapse-native.d.ts delete mode 100644 types/components/dropdown-native.d.ts delete mode 100644 types/components/modal-native.d.ts delete mode 100644 types/components/offcanvas-native.d.ts delete mode 100644 types/components/popover-native.d.ts delete mode 100644 types/components/scrollspy-native.d.ts delete mode 100644 types/components/tab-native.d.ts delete mode 100644 types/components/toast-native.d.ts delete mode 100644 types/components/tooltip-native.d.ts delete mode 100644 types/index-v4.d.ts create mode 100644 types/more/bsn.ts create mode 100644 types/more/types.d.ts delete mode 100644 types/strings/activeClass.d.ts delete mode 100644 types/strings/ariaDescribedBy.d.ts delete mode 100644 types/strings/ariaExpanded.d.ts delete mode 100644 types/strings/ariaHidden.d.ts delete mode 100644 types/strings/ariaModal.d.ts delete mode 100644 types/strings/ariaSelected.d.ts delete mode 100644 types/strings/collapsingClass.d.ts delete mode 100644 types/strings/dataBsAnimation.d.ts delete mode 100644 types/strings/dataBsContainer.d.ts delete mode 100644 types/strings/dataBsContent.d.ts delete mode 100644 types/strings/dataBsDelay.d.ts delete mode 100644 types/strings/dataBsDismiss.d.ts delete mode 100644 types/strings/dataBsKeyboard.d.ts delete mode 100644 types/strings/dataBsParent.d.ts delete mode 100644 types/strings/dataBsPlacement.d.ts delete mode 100644 types/strings/dataBsTarget.d.ts delete mode 100644 types/strings/dataBsTitle.d.ts delete mode 100644 types/strings/dataBsToggle.d.ts delete mode 100644 types/strings/dataOriginalTitle.d.ts delete mode 100644 types/strings/dropdownClasses.d.ts delete mode 100644 types/strings/dropdownMenuClass.d.ts delete mode 100644 types/strings/fadeClass.d.ts delete mode 100644 types/strings/fixedBottomClass.d.ts delete mode 100644 types/strings/fixedTopClass.d.ts delete mode 100644 types/strings/showClass.d.ts delete mode 100644 types/strings/stickyTopClass.d.ts delete mode 100644 types/util/backdrop.d.ts delete mode 100644 types/util/bootstrapCustomEvent-v4.d.ts delete mode 100644 types/util/bootstrapCustomEvent.d.ts delete mode 100644 types/util/closestRelative.d.ts delete mode 100644 types/util/componentsInit.d.ts delete mode 100644 types/util/dispatchCustomEvent.d.ts delete mode 100644 types/util/getElementFromTarget.d.ts delete mode 100644 types/util/getScroll.d.ts delete mode 100644 types/util/getTargetElement.d.ts delete mode 100644 types/util/getTipContainer.d.ts delete mode 100644 types/util/getUID.d.ts delete mode 100644 types/util/init-v4.d.ts delete mode 100644 types/util/init.d.ts delete mode 100644 types/util/initCallback.d.ts delete mode 100644 types/util/isEmptyAnchor.d.ts delete mode 100644 types/util/isMedia.d.ts delete mode 100644 types/util/isRTL.d.ts delete mode 100644 types/util/isVisible.d.ts delete mode 100644 types/util/isVisibleTip.d.ts delete mode 100644 types/util/polyfill.d.ts delete mode 100644 types/util/removeDataAPI.d.ts delete mode 100644 types/util/scrollbar.d.ts delete mode 100644 types/util/setFocus.d.ts delete mode 100644 types/util/setHtml.d.ts delete mode 100644 types/util/styleTip-back.d.ts delete mode 100644 types/util/styleTip-v4.d.ts delete mode 100644 types/util/styleTip.d.ts delete mode 100644 types/util/tipClassPositions.d.ts delete mode 100644 types/util/util.d.ts delete mode 100644 types/util/version.d.ts diff --git a/.gitignore b/.gitignore index 53b38cb1..fce99854 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ package-lock.json .npmignore .vscode/ node_modules/ +local/ demo.html \ No newline at end of file diff --git a/.npmignore b/.npmignore index 5a5d0bb5..a94d67ea 100644 --- a/.npmignore +++ b/.npmignore @@ -2,6 +2,7 @@ .vscode/ assets/ node_modules/ +local/ CONTRIBUTING.md package-lock.json index.html diff --git a/assets/js/scripts-v4.js b/assets/js/scripts-v4.js index 0f876cc2..84b4cd1a 100644 --- a/assets/js/scripts-v4.js +++ b/assets/js/scripts-v4.js @@ -7,12 +7,12 @@ var offCanvasCollapse = document.getElementsByClassName('offcanvas-collapse')[0] // scrollTarget = /(EDGE|Mac)/i.test(navigator.userAgent) ? document.body : document.documentElement; scrollTarget = document.documentElement; -sideLinks.map((x,i) => x.addEventListener('click', (e) => { +sideLinks.map(function(x,i) { x.addEventListener('click', function(e) { var target = document.getElementById(x.getAttribute('href').replace('#', '')); e.preventDefault(); scrollTarget.scrollTop = target.getBoundingClientRect().top + (window.pageYOffset || document.documentElement.scrollTop) - 70; topNav.contains(x) && offCanvasCollapse.classList.toggle('open') -})) +})}) // offcanvas document.querySelector('[data-toggle="offcanvas"]').addEventListener('click', function () { offCanvasCollapse.classList.toggle('open') diff --git a/assets/js/scripts.js b/assets/js/scripts.js index b3994183..7907d090 100644 --- a/assets/js/scripts.js +++ b/assets/js/scripts.js @@ -16,11 +16,11 @@ function setOffset() { mobileNavOffcanvas.style.top = ''; } } -mobileNavOffcanvas.addEventListener('show.bs.offcanvas', () => { +mobileNavOffcanvas.addEventListener('show.bs.offcanvas', function(){ setOffset(); window.addEventListener('scroll', setOffset); }); -mobileNavOffcanvas.addEventListener('hidden.bs.offcanvas', () => { +mobileNavOffcanvas.addEventListener('hidden.bs.offcanvas', function(){ mobileNavOffcanvas.style.top = ''; window.removeEventListener('scroll', setOffset) @@ -31,7 +31,7 @@ sideLinks.forEach( function(x,i) {x.addEventListener('click', function(e){ const offset = document.body.offsetWidth <= 768 ? 70 : 0; e.preventDefault(); scrollTarget.scrollTop = target.getBoundingClientRect().top + (window.pageYOffset || document.documentElement.scrollTop) - offset; - if (mobileNav.contains(e.target)) mobileNavOffcanvas.Offcanvas.hide(); + if (mobileNav.contains(e.target)) BSN.Offcanvas.getInstance(mobileNavOffcanvas).hide(); })}) // COMPONENTS @@ -83,13 +83,13 @@ myModal.addEventListener('hidden.bs.modal', function (e) { // Modal initialized with JavaScript // wrap -document.addEventListener('DOMContentLoaded', () => { +document.addEventListener('DOMContentLoaded', function(){ var btnModal = document.getElementById('openModalViaJS'); var myModalJS = document.getElementById('myModalJS'); var modalInitJS = new BSN.Modal(myModalJS, { backdrop: 'static' }); - btnModal.addEventListener('click', () => { + btnModal.addEventListener('click', function(){ modalInitJS.show(); }, false); }, {once: true}) @@ -166,15 +166,17 @@ toastElement.addEventListener('hidden.bs.toast',function(e){ },false) showToastBTN.addEventListener('click',function(){ - toastElement.Toast ? toastElement.Toast.show() : console.log( 'DISPOSED!' ) -},false) + const inst = BSN.Toast.getInstance(toastElement); + inst ? inst.show() : console.log( 'DISPOSED!' ) +}, false) // ScrollSpy function toggleScrollSpy(){ - var disposableSpy = document.getElementById('disposableSpy') + var disposableSpy = document.getElementById('disposableSpy'); + var spyInstance = BSN.ScrollSpy.getInstance(disposableSpy); - if ( disposableSpy.ScrollSpy ){ - disposableSpy.ScrollSpy.dispose() + if ( spyInstance ){ + spyInstance.dispose() this.innerHTML = 'Init' this.classList.remove( 'btn-outline-danger' ) this.classList.add( 'btn-outline-primary' ) @@ -207,4 +209,21 @@ offcanvasExample.addEventListener('hidden.bs.offcanvas', function(e){ var related = e.relatedTarget; var relatedTarget = '\nevent.relatedTarget is: ' + (related ? related.tagName + '.' + related.className.replace(/\s/,'.') : 'null'); console.log('The hidden.bs.offcanvas event fired for #' + offcanvasExample.id + relatedTarget); +}, false); + +// carousel +const carouselGenericExample = document.getElementById('carouselGenericExample'); +carouselGenericExample.addEventListener('slide.bs.carousel', function(e) { + var related = `\n> relatedTarget
\n`; + var from = `\n> from index ${e.from}`; + var to = `\n> to index ${e.to}`; + var direction = `\n> with direction ${e.direction}`; + console.log('The "slide.bs.carousel" event fired for
' + direction + from + to + related); +}, false); +carouselGenericExample.addEventListener('slid.bs.carousel', function(e) { + var related = `\n> relatedTarget
\n`; + var from = `\n> from index ${e.from}`; + var to = `\n> to index ${e.to}`; + var direction = `\n> with direction ${e.direction}`; + console.log('The "slid.bs.carousel" event fired for
' + direction + from + to + related); }, false); \ No newline at end of file diff --git a/dist/bootstrap-native-v4-esm.js b/dist/bootstrap-native-v4-esm.js index fe4bf5d3..cfb93827 100644 --- a/dist/bootstrap-native-v4-esm.js +++ b/dist/bootstrap-native-v4-esm.js @@ -1,16 +1,63 @@ /*! - * Native JavaScript for Bootstrap v4.0.8 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap v4.1.0 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2021 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ +/** + * A global namespace for 'transitionend' string. + * @type {string} + */ var transitionEndEvent = 'webkitTransition' in document.head.style ? 'webkitTransitionEnd' : 'transitionend'; +/** + * A global namespace for CSS3 transition support. + * @type {boolean} + */ var supportTransition = 'webkitTransition' in document.head.style || 'transition' in document.head.style; -var transitionDuration = 'webkitTransition' in document.head.style ? 'webkitTransitionDuration' : 'transitionDuration'; +/** + * A global namespace for 'transitionDelay' string. + * @type {string} + */ +var transitionDelay = 'webkitTransition' in document.head.style ? 'webkitTransitionDelay' : 'transitionDelay'; +/** + * A global namespace for 'transitionProperty' string. + * @type {string} + */ var transitionProperty = 'webkitTransition' in document.head.style ? 'webkitTransitionProperty' : 'transitionProperty'; +/** + * Utility to get the computed transitionDelay + * from Element in miliseconds. + * + * @param {Element} element target + * @return {number} the value in miliseconds + */ +function getElementTransitionDelay(element) { + var computedStyle = getComputedStyle(element); + var propertyValue = computedStyle[transitionProperty]; + var delayValue = computedStyle[transitionDelay]; + var delayScale = delayValue.includes('ms') ? 1 : 1000; + var duration = supportTransition && propertyValue && propertyValue !== 'none' + ? parseFloat(delayValue) * delayScale : 0; + + return !Number.isNaN(duration) ? duration : 0; +} + +/** + * A global namespace for 'transitionDuration' string. + * @type {string} + */ +var transitionDuration = 'webkitTransition' in document.head.style ? 'webkitTransitionDuration' : 'transitionDuration'; + +/** + * Utility to get the computed transitionDuration + * from Element in miliseconds. + * + * @param {Element} element target + * @return {number} the value in miliseconds + */ function getElementTransitionDuration(element) { var computedStyle = getComputedStyle(element); var propertyValue = computedStyle[transitionProperty]; @@ -22,32 +69,55 @@ function getElementTransitionDuration(element) { return !Number.isNaN(duration) ? duration : 0; } +/** + * Utility to make sure callbacks are consistently + * called when transition ends. + * + * @param {Element} element target + * @param {function} handler `transitionend` callback + */ function emulateTransitionEnd(element, handler) { var called = 0; var endEvent = new Event(transitionEndEvent); var duration = getElementTransitionDuration(element); + var delay = getElementTransitionDelay(element); if (duration) { - element.addEventListener(transitionEndEvent, function transitionEndWrapper(e) { + /** + * Wrap the handler in on -> off callback + * @param {Event} e Event object + * @callback + */ + var transitionEndWrapper = function (e) { if (e.target === element) { handler.apply(element, [e]); element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } - }); + }; + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(function () { if (!called) { element.dispatchEvent(endEvent); } - }, duration + 17); + }, duration + delay + 17); } else { handler.apply(element, [endEvent]); } } +/** + * Utility to check if target is typeof Element + * or find one that matches a selector. + * + * @param {Element | string} selector the input selector or target element + * @param {Element | null} parent optional Element to look into + * @return {Element | null} the Element or result of the querySelector + */ function queryElement(selector, parent) { var lookUp = parent && parent instanceof Element ? parent : document; return selector instanceof Element ? selector : lookUp.querySelector(selector); } +/** BSN v4 custom event */ function bootstrapCustomEvent(eventType, componentName, eventProperties) { var OriginalCustomEvent = new CustomEvent((eventType + ".bs." + componentName), { cancelable: true }); @@ -61,6 +131,10 @@ function bootstrapCustomEvent(eventType, componentName, eventProperties) { return OriginalCustomEvent; } +/** + * A quick shortcut for `dispatchEvent` v4. + * @param {CustomEvent} customEvent the event object + */ function dispatchCustomEvent(customEvent) { if (this) { this.dispatchEvent(customEvent); } } @@ -288,12 +362,28 @@ function Button(elem) { }); } +/** + * A global namespace for mouse hover events. + * @type {[string, string]} + */ var mouseHoverEvents = ('onmouseleave' in document) ? ['mouseenter', 'mouseleave'] : ['mouseover', 'mouseout']; +/** + * A global namespace for 'addEventListener' string. + * @type {string} + */ var addEventListener = 'addEventListener'; +/** + * A global namespace for 'removeEventListener' string. + * @type {string} + */ var removeEventListener = 'removeEventListener'; +/** + * A global namespace for passive events support. + * @type {boolean} + */ var supportPassive = (function () { var result = false; try { @@ -315,15 +405,32 @@ var supportPassive = (function () { // general event options +/** + * A global namespace for most scroll event listeners. + */ var passiveHandler = supportPassive ? { passive: true } : false; +/** + * Utility to determine if an `Element` + * is partially visible in viewport. + * + * @param {Element} element target + * @return {boolean} Boolean + */ function isElementInScrollRange(element) { var bcr = element.getBoundingClientRect(); var viewportHeight = window.innerHeight || document.documentElement.clientHeight; return bcr.top <= viewportHeight && bcr.bottom >= 0; // bottom && top } +/** + * Utility to force re-paint of an Element + * + * @param {Element | HTMLElement} element is the target + * @return {number} the Element.offsetHeight value + */ function reflow(element) { + // @ts-ignore return element.offsetHeight; } @@ -824,6 +931,10 @@ function Collapse(elem, opsInput) { element.Collapse = self; } +/** + * Points the focus to a specific element. + * @param {Element} element target + */ function setFocus(element) { element.focus(); } @@ -1292,9 +1403,18 @@ function Modal(elem, opsInput) { // element can be the modal/triggering button } } +/** + * A global namespace for mouse click events. + * @type {{down: string, up: string}} + */ var mouseClickEvents = { down: 'mousedown', up: 'mouseup' }; -// Popover, Tooltip & ScrollSpy +/** + * Returns the `Window` / `HTML` scroll position. + * Popover, Tooltip & ScrollSpy need it. + * + * @returns {{x: number, y: number}} the scroll `{x,y}` values + */ function getScroll() { return { y: window.pageYOffset || document.documentElement.scrollTop, @@ -2344,9 +2464,10 @@ function Tooltip(elem, opsInput) { element.Tooltip = self; } +/** BSN v4 componentsInit */ var componentsInit = {}; -/* Native JavaScript for Bootstrap | Initialize Data API +/* Native JavaScript for Bootstrap v4 | Initialize Data API -------------------------------------------------------- */ function initializeDataAPI(Constructor, collection) { Array.from(collection).map(function (x) { return new Constructor(x); }); @@ -2380,7 +2501,7 @@ else { }, false); } -/* Native JavaScript for Bootstrap | Remove Data API +/* Native JavaScript for Bootstrap v4 | Remove Data API ---------------------------------------------------- */ function removeElementDataAPI(ConstructorName, collection) { Array.from(collection).map(function (x) { return x[ConstructorName].dispose(); }); @@ -2392,7 +2513,7 @@ function removeDataAPI(context) { }); } -var version = "4.0.8"; +var version = "4.1.0"; var Version = version; diff --git a/dist/bootstrap-native-v4-esm.min.js b/dist/bootstrap-native-v4-esm.min.js index e4aee77d..bbccdae5 100644 --- a/dist/bootstrap-native-v4-esm.min.js +++ b/dist/bootstrap-native-v4-esm.min.js @@ -1,2 +1,2 @@ -// Native JavaScript for Bootstrap v4.0.8 | 2021 © dnp_theme | MIT-License -var t="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",e="webkitTransition"in document.head.style||"transition"in document.head.style,i="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration",n="webkitTransition"in document.head.style?"webkitTransitionProperty":"transitionProperty";function a(t){var a=getComputedStyle(t),o=a[n],s=a[i],l=s.includes("ms")?1:1e3,c=e&&o&&"none"!==o?parseFloat(s)*l:0;return Number.isNaN(c)?0:c}function o(e,i){var n=0,o=new Event(t),s=a(e);s?(e.addEventListener(t,(function a(o){o.target===e&&(i.apply(e,[o]),e.removeEventListener(t,a),n=1)})),setTimeout((function(){n||e.dispatchEvent(o)}),s+17)):i.apply(e,[o])}function s(t,e){var i=e&&e instanceof Element?e:document;return t instanceof Element?t:i.querySelector(t)}function l(t,e,i){var n=new CustomEvent(t+".bs."+e,{cancelable:!0});return void 0!==i&&Object.keys(i).forEach((function(t){Object.defineProperty(n,t,{value:i[t]})})),n}function c(t){this&&this.dispatchEvent(t)}function r(t){var e,i,n=this,a=l("close","alert"),r=l("closed","alert");function d(t){e[t?"addEventListener":"removeEventListener"]("click",u,!1)}function u(t){i=t&&t.target.closest(".alert"),(e=s('[data-dismiss="alert"]',i))&&i&&(e===t.target||e.contains(t.target))&&n.close()}function m(){d(),i.parentNode.removeChild(i),c.call(i,r)}n.close=function(){if(i&&e&&i.classList.contains("show")){if(c.call(i,a),a.defaultPrevented)return;n.dispose(),i.classList.remove("show"),i.classList.contains("fade")?o(i,m):m()}},n.dispose=function(){d(),delete e.Alert},e=s(t),i=e.closest(".alert"),e.Alert&&e.Alert.dispose(),e.Alert||d(1),n.element=e,e.Alert=n}function d(t){var e,i,n=l("change","button");function a(t){var a=t.target,o=a.closest("LABEL"),s=null;"LABEL"===a.tagName?s=a:o&&(s=o);var l=s&&s.getElementsByTagName("INPUT")[0];if(l){if(c.call(l,n),c.call(e,n),"checkbox"===l.type){if(n.defaultPrevented)return;l.checked?(s.classList.remove("active"),l.getAttribute("checked"),l.removeAttribute("checked"),l.checked=!1):(s.classList.add("active"),l.getAttribute("checked"),l.setAttribute("checked","checked"),l.checked=!0),e.toggled||(e.toggled=!0)}if("radio"===l.type&&!e.toggled){if(n.defaultPrevented)return;(!l.checked||0===t.screenX&&0===t.screenY)&&(s.classList.add("active"),s.classList.add("focus"),l.setAttribute("checked","checked"),l.checked=!0,e.toggled=!0,Array.from(i).forEach((function(t){var e=t.getElementsByTagName("INPUT")[0];t!==s&&t.classList.contains("active")&&(c.call(e,n),t.classList.remove("active"),e.removeAttribute("checked"),e.checked=!1)})))}setTimeout((function(){e.toggled=!1}),50)}}function o(t){32===(t.which||t.keyCode)&&t.target===document.activeElement&&a(t)}function r(t){32===(t.which||t.keyCode)&&t.preventDefault()}function d(t){if("INPUT"===t.target.tagName){var e="focusin"===t.type?"add":"remove";t.target.closest(".btn").classList[e]("focus")}}function u(t){var i=t?"addEventListener":"removeEventListener";e[i]("click",a,!1),e[i]("keyup",o,!1),e[i]("keydown",r,!1),e[i]("focusin",d,!1),e[i]("focusout",d,!1)}this.dispose=function(){u(),delete e.Button},(e=s(t)).Button&&e.Button.dispose(),(i=e.getElementsByClassName("btn")).length&&(e.Button||u(1),e.toggled=!1,e.Button=this,Array.from(i).forEach((function(t){var e=s("input:checked",t);!t.classList.contains("active")&&e&&t.classList.add("active"),t.classList.contains("active")&&!e&&t.classList.remove("active")})))}var u="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],m=!!function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){return t=!0}});document.addEventListener("DOMContentLoaded",(function t(){document.removeEventListener("DOMContentLoaded",t,e)}),e)}catch(t){throw Error("Passive events are not supported")}return t}()&&{passive:!0};function f(t){return t.offsetHeight}function h(t,e){var i,n,r,d,h,g,p,v,L,b,y,w,A,T=e||{},E=this;function k(){!1===g.interval||d.classList.contains("paused")||(d.classList.add("paused"),h.isSliding||(clearInterval(h.timer),h.timer=null))}function x(){!1!==g.interval&&d.classList.contains("paused")&&(d.classList.remove("paused"),h.isSliding||(clearInterval(h.timer),h.timer=null,E.cycle()))}function C(t){if(t.preventDefault(),!h.isSliding){var e=t.target;e&&!e.classList.contains("active")&&e.getAttribute("data-slide-to")&&(h.index=+e.getAttribute("data-slide-to"),E.slideTo(h.index))}}function N(t){if(t.preventDefault(),!h.isSliding){var e=t.currentTarget||t.srcElement;e===y?h.index+=1:e===b&&(h.index-=1),E.slideTo(h.index)}}function P(t){var e=t.which;if(!h.isSliding){switch(e){case 39:h.index+=1;break;case 37:h.index-=1;break;default:return}E.slideTo(h.index)}}function H(t){var e=t?"addEventListener":"removeEventListener";g.pause&&g.interval&&(d[e](u[0],k,!1),d[e](u[1],x,!1),d[e]("touchstart",k,m),d[e]("touchend",x,m)),g.touch&&L.length>1&&d[e]("touchstart",B,m),y&&y[e]("click",N,!1),b&&b[e]("click",N,!1),w&&w[e]("click",C,!1),g.keyboard&&window[e]("keydown",P,!1)}function S(t){var e=t?"addEventListener":"removeEventListener";d[e]("touchmove",M,m),d[e]("touchend",I,m)}function B(t){h.isTouch||(h.touchPosition.startX=t.changedTouches[0].pageX,d.contains(t.target)&&(h.isTouch=!0,S(1)))}function M(t){h.isTouch?(h.touchPosition.currentX=t.changedTouches[0].pageX,"touchmove"===t.type&&t.changedTouches.length>1&&t.preventDefault()):t.preventDefault()}function I(t){if(h.isTouch&&!h.isSliding&&(h.touchPosition.endX=h.touchPosition.currentX||t.changedTouches[0].pageX,h.isTouch)){if((!d.contains(t.target)||!d.contains(t.relatedTarget))&&Math.abs(h.touchPosition.startX-h.touchPosition.endX)<75)return;h.touchPosition.currentXh.touchPosition.startX&&(h.index-=1),h.isTouch=!1,E.slideTo(h.index),S()}}function D(t){Array.from(A).forEach((function(t){return t.classList.remove("active")})),A[t]&&A[t].classList.add("active")}function X(t){if(h.touchPosition){var e=h.index,i=t&&t.target!==L[e]?1e3*t.elapsedTime+100:20,n=E.getActiveIndex(),a="left"===h.direction?"next":"prev";h.isSliding&&setTimeout((function(){h.touchPosition&&(h.isSliding=!1,L[e].classList.add("active"),L[n].classList.remove("active"),L[e].classList.remove("carousel-item-"+a),L[e].classList.remove("carousel-item-"+h.direction),L[n].classList.remove("carousel-item-"+h.direction),c.call(d,v),document.hidden||!g.interval||d.classList.contains("paused")||E.cycle())}),i)}}if(E.cycle=function(){h.timer&&(clearInterval(h.timer),h.timer=null),h.timer=setInterval((function(){var t=h.index||E.getActiveIndex();(function(t){var e=t.getBoundingClientRect(),i=window.innerHeight||document.documentElement.clientHeight;return e.top<=i&&e.bottom>=0})(d)&&(t+=1,E.slideTo(t))}),g.interval)},E.slideTo=function(t){if(!h.isSliding){var e=E.getActiveIndex(),i=t;if(e!==i){ei||e===L.length-1&&0===i)&&(h.direction="right"),i<0?i=L.length-1:i>=L.length&&(i=0);var n="left"===h.direction?"next":"prev",s={relatedTarget:L[i],direction:h.direction,from:e,to:i};p=l("slide","carousel",s),v=l("slid","carousel",s),c.call(d,p),p.defaultPrevented||(h.index=i,h.isSliding=!0,clearInterval(h.timer),h.timer=null,D(i),a(L[i])&&d.classList.contains("slide")?(L[i].classList.add("carousel-item-"+n),f(L[i]),L[i].classList.add("carousel-item-"+h.direction),L[e].classList.add("carousel-item-"+h.direction),o(L[i],X)):(L[i].classList.add("active"),f(L[i]),L[e].classList.remove("active"),setTimeout((function(){h.isSliding=!1,g.interval&&d&&!d.classList.contains("paused")&&E.cycle(),c.call(d,v)}),100)))}}},E.getActiveIndex=function(){return Array.from(L).indexOf(d.getElementsByClassName("carousel-item active")[0])||0},E.dispose=function(){var t=["left","right","prev","next"];Array.from(L).forEach((function(e,i){e.classList.contains("active")&&D(i),t.forEach((function(t){return e.classList.remove("carousel-item-"+t)}))})),clearInterval(h.timer),H(),h={},g={},delete d.Carousel},(d=s(t)).Carousel&&d.Carousel.dispose(),L=d.getElementsByClassName("carousel-item"),i=d.getElementsByClassName("carousel-control-prev"),b=i[0],n=d.getElementsByClassName("carousel-control-next"),y=n[0],r=d.getElementsByClassName("carousel-indicators"),w=r[0],A=w&&w.getElementsByTagName("LI")||[],!(L.length<2)){var O=d.getAttribute("data-interval"),R="false"===O?0:+O,W="false"===d.getAttribute("data-touch")?0:1,j="hover"===d.getAttribute("data-pause")||!1,z="true"===d.getAttribute("data-keyboard")||!1,U=T.interval,q=T.touch;(g={}).keyboard=!0===T.keyboard||z,g.pause=!("hover"!==T.pause&&!j)&&"hover",g.touch=q||W,g.interval=5e3,"number"==typeof U?g.interval=U:!1===U||0===R||!1===R?g.interval=0:Number.isNaN(R)||(g.interval=R),E.getActiveIndex()<0&&(L.length&&L[0].classList.add("active"),A.length&&D(0)),(h={}).direction="left",h.index=0,h.timer=null,h.isSliding=!1,h.isTouch=!1,h.touchPosition={startX:0,currentX:0,endX:0},H(1),g.interval&&E.cycle(),d.Carousel=E}}function g(t,e){var i,n,a,r,d,u,m,h=e||{},g=this,p=null,v=null;function L(t,e){c.call(t,u),u.defaultPrevented||(t.isAnimating=!0,t.style.height=t.scrollHeight+"px",t.classList.remove("collapse"),t.classList.remove("show"),t.classList.add("collapsing"),f(t),t.style.height="0px",o(t,(function(){t.isAnimating=!1,t.setAttribute("aria-expanded","false"),e.setAttribute("aria-expanded","false"),t.classList.remove("collapsing"),t.classList.add("collapse"),t.style.height="",c.call(t,m)})))}g.toggle=function(t){(t&&"A"===t.target.tagName||"A"===i.tagName)&&t.preventDefault(),(i.contains(t.target)||t.target===i)&&(v.classList.contains("show")?g.hide():g.show())},g.hide=function(){v.isAnimating||(L(v,i),i.classList.add("collapsed"))},g.show=function(){var t,e,l;p&&(t=p.getElementsByClassName("collapse show"),n=t[0],a=n&&(s('[data-target="#'+n.id+'"]',p)||s('[href="#'+n.id+'"]',p))),v.isAnimating||(a&&n!==v&&(L(n,a),a.classList.add("collapsed")),e=v,l=i,c.call(e,r),r.defaultPrevented||(e.isAnimating=!0,e.classList.add("collapsing"),e.classList.remove("collapse"),e.style.height=e.scrollHeight+"px",o(e,(function(){e.isAnimating=!1,e.setAttribute("aria-expanded","true"),l.setAttribute("aria-expanded","true"),e.classList.remove("collapsing"),e.classList.add("collapse"),e.classList.add("show"),e.style.height="",c.call(e,d)}))),i.classList.remove("collapsed"))},g.dispose=function(){i.removeEventListener("click",g.toggle,!1),delete i.Collapse},(i=s(t)).Collapse&&i.Collapse.dispose();var b=i.getAttribute("data-parent");r=l("show","collapse"),d=l("shown","collapse"),u=l("hide","collapse"),m=l("hidden","collapse"),null!==(v=s(h.target||i.getAttribute("data-target")||i.getAttribute("href")))&&(v.isAnimating=!1);var y=h.parent||b;p=y?i.closest(y):null,i.Collapse||i.addEventListener("click",g.toggle,!1),i.Collapse=g}function p(t){t.focus()}function v(t,e){var i,n,a,o,r,d,u,m,f=this,h=null,g=[];function v(t){(t.hasAttribute("href")&&"#"===t.href.slice(-1)||t.parentNode&&t.hasAttribute("href")&&"#"===t.parentNode.href.slice(-1))&&this.preventDefault()}function L(){var t=i.open?"addEventListener":"removeEventListener";document[t]("click",b,!1),document[t]("keydown",w,!1),document[t]("keyup",A,!1),document[t]("focus",b,!1)}function b(t){var e=t.target;if(e.getAttribute){var n=e&&e.getAttribute("data-toggle")||e.parentNode&&e.parentNode.getAttribute&&e.parentNode.getAttribute("data-toggle");("focus"!==t.type||e!==i&&e!==u&&!u.contains(e))&&(e!==u&&!u.contains(e)||!m&&!n)&&(h=e===i||i.contains(e)?i:null,f.hide(),v.call(t,e))}}function y(t){h=i,f.show(),v.call(t,t.target)}function w(t){var e=t.which||t.keyCode;38!==e&&40!==e||t.preventDefault()}function A(t){var e=t.which||t.keyCode,n=document.activeElement,a=n===i,o=u.contains(n),s=n.parentNode===u||n.parentNode.parentNode===u,l=g.indexOf(n);s&&(a?l=0:38===e?l=l>1?l-1:0:40===e&&(l=l=d,A=m.top+r/2+g/2>=u,T=m.top-r<0,E=m.left-c<0,k=m.top+r+g>=u,x=m.left+c+h>=d,C=i;C="right"===(C="left"===(C="bottom"===(C="top"===(C=("left"===C||"right"===C)&&E&&x?"top":C)&&T?"bottom":C)&&k?"top":C)&&E?"right":C)&&x?"left":C,-1===e.className.indexOf(C)&&(e.className=e.className.replace(/\b(top|bottom|left|right)+/,C));var N=v.offsetWidth,P=v.offsetHeight;"left"===C||"right"===C?(o="left"===C?m.left+f.x-c-(p?N:0):m.left+f.x+h,L?(a=m.top+f.y,s=g/2-N):A?(a=m.top+f.y-r+g,s=r-g/2-N):(a=m.top+f.y-r/2+g/2,s=r/2-(p?.9*P:P/2))):"top"!==C&&"bottom"!==C||(a="top"===C?m.top+f.y-r-(p?P:0):m.top+f.y+g,b?(o=0,l=m.left+h/2-N):w?(o=d-1.01*c,l=c-(d-m.left)+h/2-N/2):(o=m.left+f.x-c/2+h/2,l=c/2-(p?N:N/2))),e.style.top=a+"px",e.style.left=o+"px",s&&(v.style.top=s+"px"),l&&(v.style.left=l+"px")}function A(t,e){var i,n,a,r,d,f,h,g,p,v=e||{},L=this,y=null,A=0,T=/(iPhone|iPod|iPad)/.test(navigator.userAgent),E={};function k(t){null!==y&&t.target===s(".close",y)&&L.hide()}function x(t){return v[t]||i.dataset[t]||null}function C(){return x("title")}function N(){return x("content")}function P(){null===y&&i.focus()}function H(t){var e=t?"addEventListener":"removeEventListener";"hover"===E.trigger?(i[e](b,L.show),i[e](u[0],L.show),E.dismissible||i[e](u[1],L.hide)):"click"===E.trigger?i[e](E.trigger,L.toggle):"focus"===E.trigger&&(T&&i[e]("click",P,!1),i[e](E.trigger,L.toggle))}function S(t){y&&y.contains(t.target)||t.target===i||i.contains(t.target)||L.hide()}function B(t){var e=t?"addEventListener":"removeEventListener";E.dismissible?document[e]("click",k,!1):("focus"===E.trigger&&i[e]("blur",L.hide),"hover"===E.trigger&&document[e]("touchstart",S,m)),window[e]("resize",L.hide,m)}function M(){B(1),c.call(i,h)}function I(){B(),E.container.removeChild(y),A=null,y=null,c.call(i,p)}L.toggle=function(){null===y?L.show():L.hide()},L.show=function(){clearTimeout(A),A=setTimeout((function(){if(null===y){if(c.call(i,f),f.defaultPrevented)return;!function(){n=C(),a=(a=N())?a.trim():null,y=document.createElement("div");var t=document.createElement("div");if(t.classList.add("arrow"),y.appendChild(t),null!==a&&null===E.template){if(y.setAttribute("role","tooltip"),null!==n){var e=document.createElement("h3");e.classList.add("popover-header"),e.innerHTML=E.dismissible?n+d:n,y.appendChild(e)}var i=document.createElement("div");i.classList.add("popover-body"),i.innerHTML=E.dismissible&&null===n?a+d:a,y.appendChild(i)}else{var o=document.createElement("div");o.innerHTML=E.template.trim(),y.className=o.firstChild.className,y.innerHTML=o.firstChild.innerHTML;var l=s(".popover-header",y),c=s(".popover-body",y);n&&l&&(l.innerHTML=n.trim()),a&&c&&(c.innerHTML=a.trim())}E.container.appendChild(y),y.style.display="block",y.classList.contains("popover")||y.classList.add("popover"),y.classList.contains(E.animation)||y.classList.add(E.animation),y.classList.contains(r)||y.classList.add(r)}(),w(i,y,E.placement,E.container),y.classList.contains("show")||y.classList.add("show"),E.animation?o(y,M):M()}}),20)},L.hide=function(){clearTimeout(A),A=setTimeout((function(){if(y&&null!==y&&y.classList.contains("show")){if(c.call(i,g),g.defaultPrevented)return;y.classList.remove("show"),E.animation?o(y,I):I()}}),E.delay)},L.dispose=function(){L.hide(),H(),delete i.Popover},(i=s(t)).Popover&&i.Popover.dispose();var D=i.getAttribute("data-trigger"),X=i.getAttribute("data-animation"),O=i.getAttribute("data-placement"),R=i.getAttribute("data-dismissible"),W=i.getAttribute("data-delay"),j=i.getAttribute("data-container");d='',f=l("show","popover"),h=l("shown","popover"),g=l("hide","popover"),p=l("hidden","popover");var z=s(v.container),U=s(j),q=i.closest(".modal"),Y=i.closest(".fixed-top"),F=i.closest(".fixed-bottom");E.template=v.template?v.template:null,E.trigger=v.trigger?v.trigger:D||"hover",E.animation=v.animation&&"fade"!==v.animation?v.animation:X||"fade",E.placement=v.placement?v.placement:O||"top",E.delay=parseInt(v.delay||W,10)||200,E.dismissible=!(!v.dismissible&&"true"!==R),E.container=z||U||Y||F||q||document.body,r="bs-popover-"+E.placement,n=C(),((a=N())||E.template)&&(i.Popover||H(1),i.Popover=L)}function T(t,e){var i,n,a,o,r,d=e||{},u=this,f={};function h(){var t,e,l;(a=o.getElementsByTagName("A"),n.scrollTop=n.isWindow?y().y:i.scrollTop,n.length!==a.length||p()!==n.scrollHeight)&&(n.items=[],n.offsets=[],n.scrollHeight=p(),n.maxScroll=n.scrollHeight-(n.isWindow?window.innerHeight:i.getBoundingClientRect().height),Array.from(a).forEach((function(i){t=i.getAttribute("href"),(e=t&&"#"===t.charAt(0)&&"#"!==t.slice(-1)&&s(t))&&(n.items.push(i),l=e.getBoundingClientRect(),n.offsets.push((n.isWindow?l.top+n.scrollTop:e.offsetTop)-f.offset))})),n.length=n.items.length)}function g(t){var e=t?"addEventListener":"removeEventListener";r[e]("scroll",u.refresh,m),window[e]("resize",u.refresh,m)}function p(){return r.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}function v(){Array.from(a).map((function(t){return t.classList.contains("active")&&t.classList.remove("active")}))}function L(t){var e,a=t;v(),n.activeItem=a,a.classList.add("active");for(var o=[];a.parentNode!==document.body;)((e=(a=a.parentNode).classList).contains("dropdown-menu")||e.contains("nav"))&&o.push(a);o.forEach((function(t){var e=t.previousElementSibling;e&&!e.classList.contains("active")&&e.classList.add("active")})),c.call(i,l("activate","scrollspy",{relatedTarget:n.activeItem}))}u.refresh=function(){if(h(),n.scrollTop>=n.maxScroll){var t=n.items[n.length-1];n.activeItem!==t&&L(t)}else{if(n.activeItem&&n.scrollTop0)return n.activeItem=null,void v();for(var e=n.length;e>-1;)n.activeItem!==n.items[e]&&n.scrollTop>=n.offsets[e]&&(void 0===n.offsets[e+1]||n.scrollTop1&&(p=t[t.length-1]):p=t[0],p}function P(){return s(N().getAttribute("href"))}function H(t){t.preventDefault(),g=t.currentTarget,a.isAnimating||T.show()}T.show=function(){if(!(g=g||n).classList.contains("active")){if(L=s(g.getAttribute("href")),p=N(),v=P(),m=l("hide","tab",{relatedTarget:g}),c.call(p,m),m.defaultPrevented)return;a.isAnimating=!0,p.classList.remove("active"),p.setAttribute("aria-selected","false"),g.classList.add("active"),g.setAttribute("aria-selected","true"),r&&(n.parentNode.classList.contains("dropdown-menu")?r.classList.contains("active")||r.classList.add("active"):r.classList.contains("active")&&r.classList.remove("active")),v.classList.contains("fade")?(v.classList.remove("show"),o(v,C)):C()}},T.dispose=function(){n.removeEventListener("click",H,!1),delete n.Tab},(n=s(t)).Tab&&n.Tab.dispose();var S=n.getAttribute("data-height");a=n.closest(".nav"),r=a&&s(".dropdown-toggle",a);var B=!(!e||!1===A.height||"false"===S);a.isAnimating=!1,n.Tab||n.addEventListener("click",H,!1),B&&(E=P().parentNode),n.Tab=T}function k(t,e){var i,n,a,r,d,u,m=e||{},h=this,g=0,p={};function v(){n.classList.remove("showing"),n.classList.add("show"),c.call(n,d),p.autohide&&h.hide()}function L(){n.classList.add("hide"),c.call(n,u)}function b(){n.classList.remove("show"),p.animation?o(n,L):L()}function y(){clearTimeout(g),i.removeEventListener("click",h.hide,!1),delete i.Toast}h.show=function(){if(n&&!n.classList.contains("show")){if(c.call(n,a),a.defaultPrevented)return;p.animation&&n.classList.add("fade"),n.classList.remove("hide"),f(n),n.classList.add("showing"),p.animation?o(n,v):v()}},h.hide=function(t){if(n&&n.classList.contains("show")){if(c.call(n,r),r.defaultPrevented)return;t?b():g=setTimeout(b,p.delay)}},h.dispose=function(){p.animation?o(n,y):y()},(i=s(t)).Toast&&i.Toast.dispose(),n=i.closest(".toast");var w=i.getAttribute("data-animation"),A=i.getAttribute("data-autohide"),T=i.getAttribute("data-delay");a=l("show","toast"),r=l("hide","toast"),d=l("shown","toast"),u=l("hidden","toast"),p.animation=!1===m.animation||"false"===w?0:1,p.autohide=!1===m.autohide||"false"===A?0:1,p.delay=parseInt(m.delay||T,10)||500,i.Toast||i.addEventListener("click",h.hide,!1),i.Toast=h}function x(t,e){var i,n,a,r,d,f,h,g=e||{},p=this,v=null,L=0,y={};function A(){return i.getAttribute("title")||i.getAttribute("data-title")||i.getAttribute("data-original-title")}function T(t){v&&v.contains(t.target)||t.target===i||i.contains(t.target)||p.hide()}function E(t){var e=t?"addEventListener":"removeEventListener";document[e]("touchstart",T,m),window[e]("resize",p.hide,m)}function k(){E(1),c.call(i,d)}function x(){E(),y.container.removeChild(v),v=null,L=null,c.call(i,h)}function C(t){var e=t?"addEventListener":"removeEventListener";i[e](b,p.show,!1),i[e](u[0],p.show,!1),i[e](u[1],p.hide,!1)}p.show=function(){clearTimeout(L),L=setTimeout((function(){if(null===v){if(c.call(i,r),r.defaultPrevented)return;!1!==function(){if(n=A()){if(v=document.createElement("div"),y.template){var t=document.createElement("div");t.innerHTML=y.template.trim(),v.className=t.firstChild.className,v.innerHTML=t.firstChild.innerHTML,s(".tooltip-inner",v).innerHTML=n.trim()}else{var e=document.createElement("div");e.classList.add("arrow"),v.appendChild(e);var i=document.createElement("div");i.classList.add("tooltip-inner"),v.appendChild(i),i.innerHTML=n}v.style.left="0",v.style.top="0",v.setAttribute("role","tooltip"),v.classList.contains("tooltip")||v.classList.add("tooltip"),v.classList.contains(y.animation)||v.classList.add(y.animation),v.classList.contains(a)||v.classList.add(a),y.container.appendChild(v)}}()&&(w(i,v,y.placement,y.container),v.classList.contains("show")||v.classList.add("show"),y.animation?o(v,k):k())}}),20)},p.hide=function(){clearTimeout(L),L=setTimeout((function(){if(v&&v.classList.contains("show")){if(c.call(i,f),f.defaultPrevented)return;v.classList.remove("show"),y.animation?o(v,x):x()}}),y.delay)},p.toggle=function(){v?p.hide():p.show()},p.dispose=function(){C(),p.hide(),i.setAttribute("title",i.getAttribute("data-original-title")),i.removeAttribute("data-original-title"),delete i.Tooltip},(i=s(t)).Tooltip&&i.Tooltip.dispose();var N=i.getAttribute("data-animation"),P=i.getAttribute("data-placement"),H=i.getAttribute("data-delay"),S=i.getAttribute("data-container"),B=s(g.container),M=s(S),I=i.closest(".modal");r=l("show","tooltip"),d=l("shown","tooltip"),f=l("hide","tooltip"),h=l("hidden","tooltip");var D=i.closest(".fixed-top"),X=i.closest(".fixed-bottom");y.animation=g.animation&&"fade"!==g.animation?g.animation:N||"fade",y.placement=g.placement?g.placement:P||"top",y.template=g.template?g.template:null,y.delay=parseInt(g.delay||H,10)||200,y.container=B||M||D||X||I||document.body,a="bs-tooltip-"+y.placement,(n=A())&&(i.Tooltip||(i.setAttribute("data-original-title",n),i.removeAttribute("title"),C(1)),i.Tooltip=p)}var C={};function N(t){var e=t instanceof Element?t:document;Object.keys(C).forEach((function(t){var i,n;i=C[t][0],n=e.querySelectorAll(C[t][1]),Array.from(n).map((function(t){return new i(t)}))}))}C.Alert=[r,'[data-dismiss="alert"]'],C.Button=[d,'[data-toggle="buttons"]'],C.Carousel=[h,'[data-ride="carousel"]'],C.Collapse=[g,'[data-toggle="collapse"]'],C.Dropdown=[v,'[data-toggle="dropdown"]'],C.Modal=[L,'[data-toggle="modal"]'],C.Popover=[A,'[data-toggle="popover"],[data-tip="popover"]'],C.ScrollSpy=[T,'[data-spy="scroll"]'],C.Tab=[E,'[data-toggle="tab"]'],C.Toast=[k,'[data-dismiss="toast"]'],C.Tooltip=[x,'[data-toggle="tooltip"],[data-tip="tooltip"]'],document.body?N():document.addEventListener("DOMContentLoaded",(function t(){N(),document.removeEventListener("DOMContentLoaded",t,!1)}),!1);var P={Alert:r,Button:d,Carousel:h,Collapse:g,Dropdown:v,Modal:L,Popover:A,ScrollSpy:T,Tab:E,Toast:k,Tooltip:x,initCallback:N,removeDataAPI:function(t){var e=t instanceof Element?t:document;Object.keys(C).forEach((function(t){var i,n;i=t,n=e.querySelectorAll(C[t][1]),Array.from(n).map((function(t){return t[i].dispose()}))}))},componentsInit:C,Version:"4.0.8"};export{P as default}; +// Native JavaScript for Bootstrap v4.1.0 | 2021 © dnp_theme | MIT-License +var t="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",e="webkitTransition"in document.head.style||"transition"in document.head.style,i="webkitTransition"in document.head.style?"webkitTransitionDelay":"transitionDelay",n="webkitTransition"in document.head.style?"webkitTransitionProperty":"transitionProperty";var a="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration";function o(t){var i=getComputedStyle(t),o=i[n],s=i[a],l=s.includes("ms")?1:1e3,r=e&&o&&"none"!==o?parseFloat(s)*l:0;return Number.isNaN(r)?0:r}function s(a,s){var l=0,r=new Event(t),c=o(a),d=function(t){var a=getComputedStyle(t),o=a[n],s=a[i],l=s.includes("ms")?1:1e3,r=e&&o&&"none"!==o?parseFloat(s)*l:0;return Number.isNaN(r)?0:r}(a);if(c){var u=function(e){e.target===a&&(s.apply(a,[e]),a.removeEventListener(t,u),l=1)};a.addEventListener(t,u),setTimeout((function(){l||a.dispatchEvent(r)}),c+d+17)}else s.apply(a,[r])}function l(t,e){var i=e&&e instanceof Element?e:document;return t instanceof Element?t:i.querySelector(t)}function r(t,e,i){var n=new CustomEvent(t+".bs."+e,{cancelable:!0});return void 0!==i&&Object.keys(i).forEach((function(t){Object.defineProperty(n,t,{value:i[t]})})),n}function c(t){this&&this.dispatchEvent(t)}function d(t){var e,i,n=this,a=r("close","alert"),o=r("closed","alert");function d(t){e[t?"addEventListener":"removeEventListener"]("click",u,!1)}function u(t){i=t&&t.target.closest(".alert"),(e=l('[data-dismiss="alert"]',i))&&i&&(e===t.target||e.contains(t.target))&&n.close()}function m(){d(),i.parentNode.removeChild(i),c.call(i,o)}n.close=function(){if(i&&e&&i.classList.contains("show")){if(c.call(i,a),a.defaultPrevented)return;n.dispose(),i.classList.remove("show"),i.classList.contains("fade")?s(i,m):m()}},n.dispose=function(){d(),delete e.Alert},e=l(t),i=e.closest(".alert"),e.Alert&&e.Alert.dispose(),e.Alert||d(1),n.element=e,e.Alert=n}function u(t){var e,i,n=r("change","button");function a(t){var a=t.target,o=a.closest("LABEL"),s=null;"LABEL"===a.tagName?s=a:o&&(s=o);var l=s&&s.getElementsByTagName("INPUT")[0];if(l){if(c.call(l,n),c.call(e,n),"checkbox"===l.type){if(n.defaultPrevented)return;l.checked?(s.classList.remove("active"),l.getAttribute("checked"),l.removeAttribute("checked"),l.checked=!1):(s.classList.add("active"),l.getAttribute("checked"),l.setAttribute("checked","checked"),l.checked=!0),e.toggled||(e.toggled=!0)}if("radio"===l.type&&!e.toggled){if(n.defaultPrevented)return;(!l.checked||0===t.screenX&&0===t.screenY)&&(s.classList.add("active"),s.classList.add("focus"),l.setAttribute("checked","checked"),l.checked=!0,e.toggled=!0,Array.from(i).forEach((function(t){var e=t.getElementsByTagName("INPUT")[0];t!==s&&t.classList.contains("active")&&(c.call(e,n),t.classList.remove("active"),e.removeAttribute("checked"),e.checked=!1)})))}setTimeout((function(){e.toggled=!1}),50)}}function o(t){32===(t.which||t.keyCode)&&t.target===document.activeElement&&a(t)}function s(t){32===(t.which||t.keyCode)&&t.preventDefault()}function d(t){if("INPUT"===t.target.tagName){var e="focusin"===t.type?"add":"remove";t.target.closest(".btn").classList[e]("focus")}}function u(t){var i=t?"addEventListener":"removeEventListener";e[i]("click",a,!1),e[i]("keyup",o,!1),e[i]("keydown",s,!1),e[i]("focusin",d,!1),e[i]("focusout",d,!1)}this.dispose=function(){u(),delete e.Button},(e=l(t)).Button&&e.Button.dispose(),(i=e.getElementsByClassName("btn")).length&&(e.Button||u(1),e.toggled=!1,e.Button=this,Array.from(i).forEach((function(t){var e=l("input:checked",t);!t.classList.contains("active")&&e&&t.classList.add("active"),t.classList.contains("active")&&!e&&t.classList.remove("active")})))}var m="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],f=!!function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){return t=!0}});document.addEventListener("DOMContentLoaded",(function t(){document.removeEventListener("DOMContentLoaded",t,e)}),e)}catch(t){throw Error("Passive events are not supported")}return t}()&&{passive:!0};function h(t){return t.offsetHeight}function g(t,e){var i,n,a,d,u,g,p,v,L,b,y,w,A,T=e||{},E=this;function k(){!1===g.interval||d.classList.contains("paused")||(d.classList.add("paused"),u.isSliding||(clearInterval(u.timer),u.timer=null))}function C(){!1!==g.interval&&d.classList.contains("paused")&&(d.classList.remove("paused"),u.isSliding||(clearInterval(u.timer),u.timer=null,E.cycle()))}function x(t){if(t.preventDefault(),!u.isSliding){var e=t.target;e&&!e.classList.contains("active")&&e.getAttribute("data-slide-to")&&(u.index=+e.getAttribute("data-slide-to"),E.slideTo(u.index))}}function N(t){if(t.preventDefault(),!u.isSliding){var e=t.currentTarget||t.srcElement;e===y?u.index+=1:e===b&&(u.index-=1),E.slideTo(u.index)}}function P(t){var e=t.which;if(!u.isSliding){switch(e){case 39:u.index+=1;break;case 37:u.index-=1;break;default:return}E.slideTo(u.index)}}function H(t){var e=t?"addEventListener":"removeEventListener";g.pause&&g.interval&&(d[e](m[0],k,!1),d[e](m[1],C,!1),d[e]("touchstart",k,f),d[e]("touchend",C,f)),g.touch&&L.length>1&&d[e]("touchstart",B,f),y&&y[e]("click",N,!1),b&&b[e]("click",N,!1),w&&w[e]("click",x,!1),g.keyboard&&window[e]("keydown",P,!1)}function S(t){var e=t?"addEventListener":"removeEventListener";d[e]("touchmove",M,f),d[e]("touchend",I,f)}function B(t){u.isTouch||(u.touchPosition.startX=t.changedTouches[0].pageX,d.contains(t.target)&&(u.isTouch=!0,S(1)))}function M(t){u.isTouch?(u.touchPosition.currentX=t.changedTouches[0].pageX,"touchmove"===t.type&&t.changedTouches.length>1&&t.preventDefault()):t.preventDefault()}function I(t){if(u.isTouch&&!u.isSliding&&(u.touchPosition.endX=u.touchPosition.currentX||t.changedTouches[0].pageX,u.isTouch)){if((!d.contains(t.target)||!d.contains(t.relatedTarget))&&Math.abs(u.touchPosition.startX-u.touchPosition.endX)<75)return;u.touchPosition.currentXu.touchPosition.startX&&(u.index-=1),u.isTouch=!1,E.slideTo(u.index),S()}}function D(t){Array.from(A).forEach((function(t){return t.classList.remove("active")})),A[t]&&A[t].classList.add("active")}function X(t){if(u.touchPosition){var e=u.index,i=t&&t.target!==L[e]?1e3*t.elapsedTime+100:20,n=E.getActiveIndex(),a="left"===u.direction?"next":"prev";u.isSliding&&setTimeout((function(){u.touchPosition&&(u.isSliding=!1,L[e].classList.add("active"),L[n].classList.remove("active"),L[e].classList.remove("carousel-item-"+a),L[e].classList.remove("carousel-item-"+u.direction),L[n].classList.remove("carousel-item-"+u.direction),c.call(d,v),document.hidden||!g.interval||d.classList.contains("paused")||E.cycle())}),i)}}if(E.cycle=function(){u.timer&&(clearInterval(u.timer),u.timer=null),u.timer=setInterval((function(){var t=u.index||E.getActiveIndex();(function(t){var e=t.getBoundingClientRect(),i=window.innerHeight||document.documentElement.clientHeight;return e.top<=i&&e.bottom>=0})(d)&&(t+=1,E.slideTo(t))}),g.interval)},E.slideTo=function(t){if(!u.isSliding){var e=E.getActiveIndex(),i=t;if(e!==i){ei||e===L.length-1&&0===i)&&(u.direction="right"),i<0?i=L.length-1:i>=L.length&&(i=0);var n="left"===u.direction?"next":"prev",a={relatedTarget:L[i],direction:u.direction,from:e,to:i};p=r("slide","carousel",a),v=r("slid","carousel",a),c.call(d,p),p.defaultPrevented||(u.index=i,u.isSliding=!0,clearInterval(u.timer),u.timer=null,D(i),o(L[i])&&d.classList.contains("slide")?(L[i].classList.add("carousel-item-"+n),h(L[i]),L[i].classList.add("carousel-item-"+u.direction),L[e].classList.add("carousel-item-"+u.direction),s(L[i],X)):(L[i].classList.add("active"),h(L[i]),L[e].classList.remove("active"),setTimeout((function(){u.isSliding=!1,g.interval&&d&&!d.classList.contains("paused")&&E.cycle(),c.call(d,v)}),100)))}}},E.getActiveIndex=function(){return Array.from(L).indexOf(d.getElementsByClassName("carousel-item active")[0])||0},E.dispose=function(){var t=["left","right","prev","next"];Array.from(L).forEach((function(e,i){e.classList.contains("active")&&D(i),t.forEach((function(t){return e.classList.remove("carousel-item-"+t)}))})),clearInterval(u.timer),H(),u={},g={},delete d.Carousel},(d=l(t)).Carousel&&d.Carousel.dispose(),L=d.getElementsByClassName("carousel-item"),i=d.getElementsByClassName("carousel-control-prev"),b=i[0],n=d.getElementsByClassName("carousel-control-next"),y=n[0],a=d.getElementsByClassName("carousel-indicators"),w=a[0],A=w&&w.getElementsByTagName("LI")||[],!(L.length<2)){var O=d.getAttribute("data-interval"),R="false"===O?0:+O,W="false"===d.getAttribute("data-touch")?0:1,j="hover"===d.getAttribute("data-pause")||!1,z="true"===d.getAttribute("data-keyboard")||!1,U=T.interval,q=T.touch;(g={}).keyboard=!0===T.keyboard||z,g.pause=!("hover"!==T.pause&&!j)&&"hover",g.touch=q||W,g.interval=5e3,"number"==typeof U?g.interval=U:!1===U||0===R||!1===R?g.interval=0:Number.isNaN(R)||(g.interval=R),E.getActiveIndex()<0&&(L.length&&L[0].classList.add("active"),A.length&&D(0)),(u={}).direction="left",u.index=0,u.timer=null,u.isSliding=!1,u.isTouch=!1,u.touchPosition={startX:0,currentX:0,endX:0},H(1),g.interval&&E.cycle(),d.Carousel=E}}function p(t,e){var i,n,a,o,d,u,m,f=e||{},g=this,p=null,v=null;function L(t,e){c.call(t,u),u.defaultPrevented||(t.isAnimating=!0,t.style.height=t.scrollHeight+"px",t.classList.remove("collapse"),t.classList.remove("show"),t.classList.add("collapsing"),h(t),t.style.height="0px",s(t,(function(){t.isAnimating=!1,t.setAttribute("aria-expanded","false"),e.setAttribute("aria-expanded","false"),t.classList.remove("collapsing"),t.classList.add("collapse"),t.style.height="",c.call(t,m)})))}g.toggle=function(t){(t&&"A"===t.target.tagName||"A"===i.tagName)&&t.preventDefault(),(i.contains(t.target)||t.target===i)&&(v.classList.contains("show")?g.hide():g.show())},g.hide=function(){v.isAnimating||(L(v,i),i.classList.add("collapsed"))},g.show=function(){var t,e,r;p&&(t=p.getElementsByClassName("collapse show"),n=t[0],a=n&&(l('[data-target="#'+n.id+'"]',p)||l('[href="#'+n.id+'"]',p))),v.isAnimating||(a&&n!==v&&(L(n,a),a.classList.add("collapsed")),e=v,r=i,c.call(e,o),o.defaultPrevented||(e.isAnimating=!0,e.classList.add("collapsing"),e.classList.remove("collapse"),e.style.height=e.scrollHeight+"px",s(e,(function(){e.isAnimating=!1,e.setAttribute("aria-expanded","true"),r.setAttribute("aria-expanded","true"),e.classList.remove("collapsing"),e.classList.add("collapse"),e.classList.add("show"),e.style.height="",c.call(e,d)}))),i.classList.remove("collapsed"))},g.dispose=function(){i.removeEventListener("click",g.toggle,!1),delete i.Collapse},(i=l(t)).Collapse&&i.Collapse.dispose();var b=i.getAttribute("data-parent");o=r("show","collapse"),d=r("shown","collapse"),u=r("hide","collapse"),m=r("hidden","collapse"),null!==(v=l(f.target||i.getAttribute("data-target")||i.getAttribute("href")))&&(v.isAnimating=!1);var y=f.parent||b;p=y?i.closest(y):null,i.Collapse||i.addEventListener("click",g.toggle,!1),i.Collapse=g}function v(t){t.focus()}function L(t,e){var i,n,a,o,s,d,u,m,f=this,h=null,g=[];function p(t){(t.hasAttribute("href")&&"#"===t.href.slice(-1)||t.parentNode&&t.hasAttribute("href")&&"#"===t.parentNode.href.slice(-1))&&this.preventDefault()}function L(){var t=i.open?"addEventListener":"removeEventListener";document[t]("click",b,!1),document[t]("keydown",w,!1),document[t]("keyup",A,!1),document[t]("focus",b,!1)}function b(t){var e=t.target;if(e.getAttribute){var n=e&&e.getAttribute("data-toggle")||e.parentNode&&e.parentNode.getAttribute&&e.parentNode.getAttribute("data-toggle");("focus"!==t.type||e!==i&&e!==u&&!u.contains(e))&&(e!==u&&!u.contains(e)||!m&&!n)&&(h=e===i||i.contains(e)?i:null,f.hide(),p.call(t,e))}}function y(t){h=i,f.show(),p.call(t,t.target)}function w(t){var e=t.which||t.keyCode;38!==e&&40!==e||t.preventDefault()}function A(t){var e=t.which||t.keyCode,n=document.activeElement,a=n===i,o=u.contains(n),s=n.parentNode===u||n.parentNode.parentNode===u,l=g.indexOf(n);s&&(a?l=0:38===e?l=l>1?l-1:0:40===e&&(l=l=d,A=m.top+c/2+g/2>=u,T=m.top-c<0,E=m.left-r<0,k=m.top+c+g>=u,C=m.left+r+h>=d,x=i;x="right"===(x="left"===(x="bottom"===(x="top"===(x=("left"===x||"right"===x)&&E&&C?"top":x)&&T?"bottom":x)&&k?"top":x)&&E?"right":x)&&C?"left":x,-1===e.className.indexOf(x)&&(e.className=e.className.replace(/\b(top|bottom|left|right)+/,x));var N=v.offsetWidth,P=v.offsetHeight;"left"===x||"right"===x?(o="left"===x?m.left+f.x-r-(p?N:0):m.left+f.x+h,L?(a=m.top+f.y,s=g/2-N):A?(a=m.top+f.y-c+g,s=c-g/2-N):(a=m.top+f.y-c/2+g/2,s=c/2-(p?.9*P:P/2))):"top"!==x&&"bottom"!==x||(a="top"===x?m.top+f.y-c-(p?P:0):m.top+f.y+g,b?(o=0,l=m.left+h/2-N):y?(o=d-1.01*r,l=r-(d-m.left)+h/2-N/2):(o=m.left+f.x-r/2+h/2,l=r/2-(p?N:N/2))),e.style.top=a+"px",e.style.left=o+"px",s&&(v.style.top=s+"px"),l&&(v.style.left=l+"px")}function T(t,e){var i,n,a,o,d,u,h,g,p,v=e||{},L=this,b=null,w=0,T=/(iPhone|iPod|iPad)/.test(navigator.userAgent),E={};function k(t){null!==b&&t.target===l(".close",b)&&L.hide()}function C(t){return v[t]||i.dataset[t]||null}function x(){return C("title")}function N(){return C("content")}function P(){null===b&&i.focus()}function H(t){var e=t?"addEventListener":"removeEventListener";"hover"===E.trigger?(i[e](y,L.show),i[e](m[0],L.show),E.dismissible||i[e](m[1],L.hide)):"click"===E.trigger?i[e](E.trigger,L.toggle):"focus"===E.trigger&&(T&&i[e]("click",P,!1),i[e](E.trigger,L.toggle))}function S(t){b&&b.contains(t.target)||t.target===i||i.contains(t.target)||L.hide()}function B(t){var e=t?"addEventListener":"removeEventListener";E.dismissible?document[e]("click",k,!1):("focus"===E.trigger&&i[e]("blur",L.hide),"hover"===E.trigger&&document[e]("touchstart",S,f)),window[e]("resize",L.hide,f)}function M(){B(1),c.call(i,h)}function I(){B(),E.container.removeChild(b),w=null,b=null,c.call(i,p)}L.toggle=function(){null===b?L.show():L.hide()},L.show=function(){clearTimeout(w),w=setTimeout((function(){if(null===b){if(c.call(i,u),u.defaultPrevented)return;!function(){n=x(),a=(a=N())?a.trim():null,b=document.createElement("div");var t=document.createElement("div");if(t.classList.add("arrow"),b.appendChild(t),null!==a&&null===E.template){if(b.setAttribute("role","tooltip"),null!==n){var e=document.createElement("h3");e.classList.add("popover-header"),e.innerHTML=E.dismissible?n+d:n,b.appendChild(e)}var i=document.createElement("div");i.classList.add("popover-body"),i.innerHTML=E.dismissible&&null===n?a+d:a,b.appendChild(i)}else{var s=document.createElement("div");s.innerHTML=E.template.trim(),b.className=s.firstChild.className,b.innerHTML=s.firstChild.innerHTML;var r=l(".popover-header",b),c=l(".popover-body",b);n&&r&&(r.innerHTML=n.trim()),a&&c&&(c.innerHTML=a.trim())}E.container.appendChild(b),b.style.display="block",b.classList.contains("popover")||b.classList.add("popover"),b.classList.contains(E.animation)||b.classList.add(E.animation),b.classList.contains(o)||b.classList.add(o)}(),A(i,b,E.placement,E.container),b.classList.contains("show")||b.classList.add("show"),E.animation?s(b,M):M()}}),20)},L.hide=function(){clearTimeout(w),w=setTimeout((function(){if(b&&null!==b&&b.classList.contains("show")){if(c.call(i,g),g.defaultPrevented)return;b.classList.remove("show"),E.animation?s(b,I):I()}}),E.delay)},L.dispose=function(){L.hide(),H(),delete i.Popover},(i=l(t)).Popover&&i.Popover.dispose();var D=i.getAttribute("data-trigger"),X=i.getAttribute("data-animation"),O=i.getAttribute("data-placement"),R=i.getAttribute("data-dismissible"),W=i.getAttribute("data-delay"),j=i.getAttribute("data-container");d='',u=r("show","popover"),h=r("shown","popover"),g=r("hide","popover"),p=r("hidden","popover");var z=l(v.container),U=l(j),q=i.closest(".modal"),F=i.closest(".fixed-top"),Y=i.closest(".fixed-bottom");E.template=v.template?v.template:null,E.trigger=v.trigger?v.trigger:D||"hover",E.animation=v.animation&&"fade"!==v.animation?v.animation:X||"fade",E.placement=v.placement?v.placement:O||"top",E.delay=parseInt(v.delay||W,10)||200,E.dismissible=!(!v.dismissible&&"true"!==R),E.container=z||U||F||Y||q||document.body,o="bs-popover-"+E.placement,n=x(),((a=N())||E.template)&&(i.Popover||H(1),i.Popover=L)}function E(t,e){var i,n,a,o,s,d=e||{},u=this,m={};function h(){var t,e,s;(a=o.getElementsByTagName("A"),n.scrollTop=n.isWindow?w().y:i.scrollTop,n.length!==a.length||p()!==n.scrollHeight)&&(n.items=[],n.offsets=[],n.scrollHeight=p(),n.maxScroll=n.scrollHeight-(n.isWindow?window.innerHeight:i.getBoundingClientRect().height),Array.from(a).forEach((function(i){t=i.getAttribute("href"),(e=t&&"#"===t.charAt(0)&&"#"!==t.slice(-1)&&l(t))&&(n.items.push(i),s=e.getBoundingClientRect(),n.offsets.push((n.isWindow?s.top+n.scrollTop:e.offsetTop)-m.offset))})),n.length=n.items.length)}function g(t){var e=t?"addEventListener":"removeEventListener";s[e]("scroll",u.refresh,f),window[e]("resize",u.refresh,f)}function p(){return s.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}function v(){Array.from(a).map((function(t){return t.classList.contains("active")&&t.classList.remove("active")}))}function L(t){var e,a=t;v(),n.activeItem=a,a.classList.add("active");for(var o=[];a.parentNode!==document.body;)((e=(a=a.parentNode).classList).contains("dropdown-menu")||e.contains("nav"))&&o.push(a);o.forEach((function(t){var e=t.previousElementSibling;e&&!e.classList.contains("active")&&e.classList.add("active")})),c.call(i,r("activate","scrollspy",{relatedTarget:n.activeItem}))}u.refresh=function(){if(h(),n.scrollTop>=n.maxScroll){var t=n.items[n.length-1];n.activeItem!==t&&L(t)}else{if(n.activeItem&&n.scrollTop0)return n.activeItem=null,void v();for(var e=n.length;e>-1;)n.activeItem!==n.items[e]&&n.scrollTop>=n.offsets[e]&&(void 0===n.offsets[e+1]||n.scrollTop1&&(p=t[t.length-1]):p=t[0],p}function P(){return l(N().getAttribute("href"))}function H(t){t.preventDefault(),g=t.currentTarget,a.isAnimating||T.show()}T.show=function(){if(!(g=g||n).classList.contains("active")){if(L=l(g.getAttribute("href")),p=N(),v=P(),m=r("hide","tab",{relatedTarget:g}),c.call(p,m),m.defaultPrevented)return;a.isAnimating=!0,p.classList.remove("active"),p.setAttribute("aria-selected","false"),g.classList.add("active"),g.setAttribute("aria-selected","true"),o&&(n.parentNode.classList.contains("dropdown-menu")?o.classList.contains("active")||o.classList.add("active"):o.classList.contains("active")&&o.classList.remove("active")),v.classList.contains("fade")?(v.classList.remove("show"),s(v,x)):x()}},T.dispose=function(){n.removeEventListener("click",H,!1),delete n.Tab},(n=l(t)).Tab&&n.Tab.dispose();var S=n.getAttribute("data-height");a=n.closest(".nav"),o=a&&l(".dropdown-toggle",a);var B=!(!e||!1===A.height||"false"===S);a.isAnimating=!1,n.Tab||n.addEventListener("click",H,!1),B&&(E=P().parentNode),n.Tab=T}function C(t,e){var i,n,a,o,d,u,m=e||{},f=this,g=0,p={};function v(){n.classList.remove("showing"),n.classList.add("show"),c.call(n,d),p.autohide&&f.hide()}function L(){n.classList.add("hide"),c.call(n,u)}function b(){n.classList.remove("show"),p.animation?s(n,L):L()}function y(){clearTimeout(g),i.removeEventListener("click",f.hide,!1),delete i.Toast}f.show=function(){if(n&&!n.classList.contains("show")){if(c.call(n,a),a.defaultPrevented)return;p.animation&&n.classList.add("fade"),n.classList.remove("hide"),h(n),n.classList.add("showing"),p.animation?s(n,v):v()}},f.hide=function(t){if(n&&n.classList.contains("show")){if(c.call(n,o),o.defaultPrevented)return;t?b():g=setTimeout(b,p.delay)}},f.dispose=function(){p.animation?s(n,y):y()},(i=l(t)).Toast&&i.Toast.dispose(),n=i.closest(".toast");var w=i.getAttribute("data-animation"),A=i.getAttribute("data-autohide"),T=i.getAttribute("data-delay");a=r("show","toast"),o=r("hide","toast"),d=r("shown","toast"),u=r("hidden","toast"),p.animation=!1===m.animation||"false"===w?0:1,p.autohide=!1===m.autohide||"false"===A?0:1,p.delay=parseInt(m.delay||T,10)||500,i.Toast||i.addEventListener("click",f.hide,!1),i.Toast=f}function x(t,e){var i,n,a,o,d,u,h,g=e||{},p=this,v=null,L=0,b={};function w(){return i.getAttribute("title")||i.getAttribute("data-title")||i.getAttribute("data-original-title")}function T(t){v&&v.contains(t.target)||t.target===i||i.contains(t.target)||p.hide()}function E(t){var e=t?"addEventListener":"removeEventListener";document[e]("touchstart",T,f),window[e]("resize",p.hide,f)}function k(){E(1),c.call(i,d)}function C(){E(),b.container.removeChild(v),v=null,L=null,c.call(i,h)}function x(t){var e=t?"addEventListener":"removeEventListener";i[e](y,p.show,!1),i[e](m[0],p.show,!1),i[e](m[1],p.hide,!1)}p.show=function(){clearTimeout(L),L=setTimeout((function(){if(null===v){if(c.call(i,o),o.defaultPrevented)return;!1!==function(){if(n=w()){if(v=document.createElement("div"),b.template){var t=document.createElement("div");t.innerHTML=b.template.trim(),v.className=t.firstChild.className,v.innerHTML=t.firstChild.innerHTML,l(".tooltip-inner",v).innerHTML=n.trim()}else{var e=document.createElement("div");e.classList.add("arrow"),v.appendChild(e);var i=document.createElement("div");i.classList.add("tooltip-inner"),v.appendChild(i),i.innerHTML=n}v.style.left="0",v.style.top="0",v.setAttribute("role","tooltip"),v.classList.contains("tooltip")||v.classList.add("tooltip"),v.classList.contains(b.animation)||v.classList.add(b.animation),v.classList.contains(a)||v.classList.add(a),b.container.appendChild(v)}}()&&(A(i,v,b.placement,b.container),v.classList.contains("show")||v.classList.add("show"),b.animation?s(v,k):k())}}),20)},p.hide=function(){clearTimeout(L),L=setTimeout((function(){if(v&&v.classList.contains("show")){if(c.call(i,u),u.defaultPrevented)return;v.classList.remove("show"),b.animation?s(v,C):C()}}),b.delay)},p.toggle=function(){v?p.hide():p.show()},p.dispose=function(){x(),p.hide(),i.setAttribute("title",i.getAttribute("data-original-title")),i.removeAttribute("data-original-title"),delete i.Tooltip},(i=l(t)).Tooltip&&i.Tooltip.dispose();var N=i.getAttribute("data-animation"),P=i.getAttribute("data-placement"),H=i.getAttribute("data-delay"),S=i.getAttribute("data-container"),B=l(g.container),M=l(S),I=i.closest(".modal");o=r("show","tooltip"),d=r("shown","tooltip"),u=r("hide","tooltip"),h=r("hidden","tooltip");var D=i.closest(".fixed-top"),X=i.closest(".fixed-bottom");b.animation=g.animation&&"fade"!==g.animation?g.animation:N||"fade",b.placement=g.placement?g.placement:P||"top",b.template=g.template?g.template:null,b.delay=parseInt(g.delay||H,10)||200,b.container=B||M||D||X||I||document.body,a="bs-tooltip-"+b.placement,(n=w())&&(i.Tooltip||(i.setAttribute("data-original-title",n),i.removeAttribute("title"),x(1)),i.Tooltip=p)}var N={};function P(t){var e=t instanceof Element?t:document;Object.keys(N).forEach((function(t){var i,n;i=N[t][0],n=e.querySelectorAll(N[t][1]),Array.from(n).map((function(t){return new i(t)}))}))}N.Alert=[d,'[data-dismiss="alert"]'],N.Button=[u,'[data-toggle="buttons"]'],N.Carousel=[g,'[data-ride="carousel"]'],N.Collapse=[p,'[data-toggle="collapse"]'],N.Dropdown=[L,'[data-toggle="dropdown"]'],N.Modal=[b,'[data-toggle="modal"]'],N.Popover=[T,'[data-toggle="popover"],[data-tip="popover"]'],N.ScrollSpy=[E,'[data-spy="scroll"]'],N.Tab=[k,'[data-toggle="tab"]'],N.Toast=[C,'[data-dismiss="toast"]'],N.Tooltip=[x,'[data-toggle="tooltip"],[data-tip="tooltip"]'],document.body?P():document.addEventListener("DOMContentLoaded",(function t(){P(),document.removeEventListener("DOMContentLoaded",t,!1)}),!1);var H={Alert:d,Button:u,Carousel:g,Collapse:p,Dropdown:L,Modal:b,Popover:T,ScrollSpy:E,Tab:k,Toast:C,Tooltip:x,initCallback:P,removeDataAPI:function(t){var e=t instanceof Element?t:document;Object.keys(N).forEach((function(t){var i,n;i=t,n=e.querySelectorAll(N[t][1]),Array.from(n).map((function(t){return t[i].dispose()}))}))},componentsInit:N,Version:"4.1.0"};export{H as default}; diff --git a/dist/bootstrap-native-v4.js b/dist/bootstrap-native-v4.js index 9cce56f9..248b35df 100644 --- a/dist/bootstrap-native-v4.js +++ b/dist/bootstrap-native-v4.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap v4.0.8 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap v4.1.0 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2021 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -9,14 +9,61 @@ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.BSN = factory()); })(this, (function () { 'use strict'; + /** + * A global namespace for 'transitionend' string. + * @type {string} + */ var transitionEndEvent = 'webkitTransition' in document.head.style ? 'webkitTransitionEnd' : 'transitionend'; + /** + * A global namespace for CSS3 transition support. + * @type {boolean} + */ var supportTransition = 'webkitTransition' in document.head.style || 'transition' in document.head.style; - var transitionDuration = 'webkitTransition' in document.head.style ? 'webkitTransitionDuration' : 'transitionDuration'; + /** + * A global namespace for 'transitionDelay' string. + * @type {string} + */ + var transitionDelay = 'webkitTransition' in document.head.style ? 'webkitTransitionDelay' : 'transitionDelay'; + /** + * A global namespace for 'transitionProperty' string. + * @type {string} + */ var transitionProperty = 'webkitTransition' in document.head.style ? 'webkitTransitionProperty' : 'transitionProperty'; + /** + * Utility to get the computed transitionDelay + * from Element in miliseconds. + * + * @param {Element} element target + * @return {number} the value in miliseconds + */ + function getElementTransitionDelay(element) { + var computedStyle = getComputedStyle(element); + var propertyValue = computedStyle[transitionProperty]; + var delayValue = computedStyle[transitionDelay]; + var delayScale = delayValue.includes('ms') ? 1 : 1000; + var duration = supportTransition && propertyValue && propertyValue !== 'none' + ? parseFloat(delayValue) * delayScale : 0; + + return !Number.isNaN(duration) ? duration : 0; + } + + /** + * A global namespace for 'transitionDuration' string. + * @type {string} + */ + var transitionDuration = 'webkitTransition' in document.head.style ? 'webkitTransitionDuration' : 'transitionDuration'; + + /** + * Utility to get the computed transitionDuration + * from Element in miliseconds. + * + * @param {Element} element target + * @return {number} the value in miliseconds + */ function getElementTransitionDuration(element) { var computedStyle = getComputedStyle(element); var propertyValue = computedStyle[transitionProperty]; @@ -28,32 +75,55 @@ return !Number.isNaN(duration) ? duration : 0; } + /** + * Utility to make sure callbacks are consistently + * called when transition ends. + * + * @param {Element} element target + * @param {function} handler `transitionend` callback + */ function emulateTransitionEnd(element, handler) { var called = 0; var endEvent = new Event(transitionEndEvent); var duration = getElementTransitionDuration(element); + var delay = getElementTransitionDelay(element); if (duration) { - element.addEventListener(transitionEndEvent, function transitionEndWrapper(e) { + /** + * Wrap the handler in on -> off callback + * @param {Event} e Event object + * @callback + */ + var transitionEndWrapper = function (e) { if (e.target === element) { handler.apply(element, [e]); element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } - }); + }; + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(function () { if (!called) { element.dispatchEvent(endEvent); } - }, duration + 17); + }, duration + delay + 17); } else { handler.apply(element, [endEvent]); } } + /** + * Utility to check if target is typeof Element + * or find one that matches a selector. + * + * @param {Element | string} selector the input selector or target element + * @param {Element | null} parent optional Element to look into + * @return {Element | null} the Element or result of the querySelector + */ function queryElement(selector, parent) { var lookUp = parent && parent instanceof Element ? parent : document; return selector instanceof Element ? selector : lookUp.querySelector(selector); } + /** BSN v4 custom event */ function bootstrapCustomEvent(eventType, componentName, eventProperties) { var OriginalCustomEvent = new CustomEvent((eventType + ".bs." + componentName), { cancelable: true }); @@ -67,6 +137,10 @@ return OriginalCustomEvent; } + /** + * A quick shortcut for `dispatchEvent` v4. + * @param {CustomEvent} customEvent the event object + */ function dispatchCustomEvent(customEvent) { if (this) { this.dispatchEvent(customEvent); } } @@ -294,12 +368,28 @@ }); } + /** + * A global namespace for mouse hover events. + * @type {[string, string]} + */ var mouseHoverEvents = ('onmouseleave' in document) ? ['mouseenter', 'mouseleave'] : ['mouseover', 'mouseout']; + /** + * A global namespace for 'addEventListener' string. + * @type {string} + */ var addEventListener = 'addEventListener'; + /** + * A global namespace for 'removeEventListener' string. + * @type {string} + */ var removeEventListener = 'removeEventListener'; + /** + * A global namespace for passive events support. + * @type {boolean} + */ var supportPassive = (function () { var result = false; try { @@ -321,15 +411,32 @@ // general event options + /** + * A global namespace for most scroll event listeners. + */ var passiveHandler = supportPassive ? { passive: true } : false; + /** + * Utility to determine if an `Element` + * is partially visible in viewport. + * + * @param {Element} element target + * @return {boolean} Boolean + */ function isElementInScrollRange(element) { var bcr = element.getBoundingClientRect(); var viewportHeight = window.innerHeight || document.documentElement.clientHeight; return bcr.top <= viewportHeight && bcr.bottom >= 0; // bottom && top } + /** + * Utility to force re-paint of an Element + * + * @param {Element | HTMLElement} element is the target + * @return {number} the Element.offsetHeight value + */ function reflow(element) { + // @ts-ignore return element.offsetHeight; } @@ -830,6 +937,10 @@ element.Collapse = self; } + /** + * Points the focus to a specific element. + * @param {Element} element target + */ function setFocus(element) { element.focus(); } @@ -1298,9 +1409,18 @@ } } + /** + * A global namespace for mouse click events. + * @type {{down: string, up: string}} + */ var mouseClickEvents = { down: 'mousedown', up: 'mouseup' }; - // Popover, Tooltip & ScrollSpy + /** + * Returns the `Window` / `HTML` scroll position. + * Popover, Tooltip & ScrollSpy need it. + * + * @returns {{x: number, y: number}} the scroll `{x,y}` values + */ function getScroll() { return { y: window.pageYOffset || document.documentElement.scrollTop, @@ -2350,9 +2470,10 @@ element.Tooltip = self; } + /** BSN v4 componentsInit */ var componentsInit = {}; - /* Native JavaScript for Bootstrap | Initialize Data API + /* Native JavaScript for Bootstrap v4 | Initialize Data API -------------------------------------------------------- */ function initializeDataAPI(Constructor, collection) { Array.from(collection).map(function (x) { return new Constructor(x); }); @@ -2386,7 +2507,7 @@ }, false); } - /* Native JavaScript for Bootstrap | Remove Data API + /* Native JavaScript for Bootstrap v4 | Remove Data API ---------------------------------------------------- */ function removeElementDataAPI(ConstructorName, collection) { Array.from(collection).map(function (x) { return x[ConstructorName].dispose(); }); @@ -2398,7 +2519,7 @@ }); } - var version = "4.0.8"; + var version = "4.1.0"; var Version = version; diff --git a/dist/bootstrap-native-v4.min.js b/dist/bootstrap-native-v4.min.js index 74d7e6a9..b923de7d 100644 --- a/dist/bootstrap-native-v4.min.js +++ b/dist/bootstrap-native-v4.min.js @@ -1,2 +1,2 @@ -// Native JavaScript for Bootstrap v4.0.8 | 2021 © dnp_theme | MIT-License -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).BSN=e()}(this,(function(){"use strict";var t="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",e="webkitTransition"in document.head.style||"transition"in document.head.style,i="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration",n="webkitTransition"in document.head.style?"webkitTransitionProperty":"transitionProperty";function a(t){var a=getComputedStyle(t),o=a[n],s=a[i],l=s.includes("ms")?1:1e3,c=e&&o&&"none"!==o?parseFloat(s)*l:0;return Number.isNaN(c)?0:c}function o(e,i){var n=0,o=new Event(t),s=a(e);s?(e.addEventListener(t,(function a(o){o.target===e&&(i.apply(e,[o]),e.removeEventListener(t,a),n=1)})),setTimeout((function(){n||e.dispatchEvent(o)}),s+17)):i.apply(e,[o])}function s(t,e){var i=e&&e instanceof Element?e:document;return t instanceof Element?t:i.querySelector(t)}function l(t,e,i){var n=new CustomEvent(t+".bs."+e,{cancelable:!0});return void 0!==i&&Object.keys(i).forEach((function(t){Object.defineProperty(n,t,{value:i[t]})})),n}function c(t){this&&this.dispatchEvent(t)}function r(t){var e,i,n=this,a=l("close","alert"),r=l("closed","alert");function d(t){e[t?"addEventListener":"removeEventListener"]("click",u,!1)}function u(t){i=t&&t.target.closest(".alert"),(e=s('[data-dismiss="alert"]',i))&&i&&(e===t.target||e.contains(t.target))&&n.close()}function m(){d(),i.parentNode.removeChild(i),c.call(i,r)}n.close=function(){if(i&&e&&i.classList.contains("show")){if(c.call(i,a),a.defaultPrevented)return;n.dispose(),i.classList.remove("show"),i.classList.contains("fade")?o(i,m):m()}},n.dispose=function(){d(),delete e.Alert},e=s(t),i=e.closest(".alert"),e.Alert&&e.Alert.dispose(),e.Alert||d(1),n.element=e,e.Alert=n}function d(t){var e,i,n=l("change","button");function a(t){var a=t.target,o=a.closest("LABEL"),s=null;"LABEL"===a.tagName?s=a:o&&(s=o);var l=s&&s.getElementsByTagName("INPUT")[0];if(l){if(c.call(l,n),c.call(e,n),"checkbox"===l.type){if(n.defaultPrevented)return;l.checked?(s.classList.remove("active"),l.getAttribute("checked"),l.removeAttribute("checked"),l.checked=!1):(s.classList.add("active"),l.getAttribute("checked"),l.setAttribute("checked","checked"),l.checked=!0),e.toggled||(e.toggled=!0)}if("radio"===l.type&&!e.toggled){if(n.defaultPrevented)return;(!l.checked||0===t.screenX&&0===t.screenY)&&(s.classList.add("active"),s.classList.add("focus"),l.setAttribute("checked","checked"),l.checked=!0,e.toggled=!0,Array.from(i).forEach((function(t){var e=t.getElementsByTagName("INPUT")[0];t!==s&&t.classList.contains("active")&&(c.call(e,n),t.classList.remove("active"),e.removeAttribute("checked"),e.checked=!1)})))}setTimeout((function(){e.toggled=!1}),50)}}function o(t){32===(t.which||t.keyCode)&&t.target===document.activeElement&&a(t)}function r(t){32===(t.which||t.keyCode)&&t.preventDefault()}function d(t){if("INPUT"===t.target.tagName){var e="focusin"===t.type?"add":"remove";t.target.closest(".btn").classList[e]("focus")}}function u(t){var i=t?"addEventListener":"removeEventListener";e[i]("click",a,!1),e[i]("keyup",o,!1),e[i]("keydown",r,!1),e[i]("focusin",d,!1),e[i]("focusout",d,!1)}this.dispose=function(){u(),delete e.Button},(e=s(t)).Button&&e.Button.dispose(),(i=e.getElementsByClassName("btn")).length&&(e.Button||u(1),e.toggled=!1,e.Button=this,Array.from(i).forEach((function(t){var e=s("input:checked",t);!t.classList.contains("active")&&e&&t.classList.add("active"),t.classList.contains("active")&&!e&&t.classList.remove("active")})))}var u="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],m=!!function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){return t=!0}});document.addEventListener("DOMContentLoaded",(function t(){document.removeEventListener("DOMContentLoaded",t,e)}),e)}catch(t){throw Error("Passive events are not supported")}return t}()&&{passive:!0};function f(t){return t.offsetHeight}function h(t,e){var i,n,r,d,h,g,p,v,L,b,y,w,A,T=e||{},E=this;function k(){!1===g.interval||d.classList.contains("paused")||(d.classList.add("paused"),h.isSliding||(clearInterval(h.timer),h.timer=null))}function x(){!1!==g.interval&&d.classList.contains("paused")&&(d.classList.remove("paused"),h.isSliding||(clearInterval(h.timer),h.timer=null,E.cycle()))}function C(t){if(t.preventDefault(),!h.isSliding){var e=t.target;e&&!e.classList.contains("active")&&e.getAttribute("data-slide-to")&&(h.index=+e.getAttribute("data-slide-to"),E.slideTo(h.index))}}function N(t){if(t.preventDefault(),!h.isSliding){var e=t.currentTarget||t.srcElement;e===y?h.index+=1:e===b&&(h.index-=1),E.slideTo(h.index)}}function P(t){var e=t.which;if(!h.isSliding){switch(e){case 39:h.index+=1;break;case 37:h.index-=1;break;default:return}E.slideTo(h.index)}}function H(t){var e=t?"addEventListener":"removeEventListener";g.pause&&g.interval&&(d[e](u[0],k,!1),d[e](u[1],x,!1),d[e]("touchstart",k,m),d[e]("touchend",x,m)),g.touch&&L.length>1&&d[e]("touchstart",B,m),y&&y[e]("click",N,!1),b&&b[e]("click",N,!1),w&&w[e]("click",C,!1),g.keyboard&&window[e]("keydown",P,!1)}function S(t){var e=t?"addEventListener":"removeEventListener";d[e]("touchmove",M,m),d[e]("touchend",I,m)}function B(t){h.isTouch||(h.touchPosition.startX=t.changedTouches[0].pageX,d.contains(t.target)&&(h.isTouch=!0,S(1)))}function M(t){h.isTouch?(h.touchPosition.currentX=t.changedTouches[0].pageX,"touchmove"===t.type&&t.changedTouches.length>1&&t.preventDefault()):t.preventDefault()}function I(t){if(h.isTouch&&!h.isSliding&&(h.touchPosition.endX=h.touchPosition.currentX||t.changedTouches[0].pageX,h.isTouch)){if((!d.contains(t.target)||!d.contains(t.relatedTarget))&&Math.abs(h.touchPosition.startX-h.touchPosition.endX)<75)return;h.touchPosition.currentXh.touchPosition.startX&&(h.index-=1),h.isTouch=!1,E.slideTo(h.index),S()}}function D(t){Array.from(A).forEach((function(t){return t.classList.remove("active")})),A[t]&&A[t].classList.add("active")}function X(t){if(h.touchPosition){var e=h.index,i=t&&t.target!==L[e]?1e3*t.elapsedTime+100:20,n=E.getActiveIndex(),a="left"===h.direction?"next":"prev";h.isSliding&&setTimeout((function(){h.touchPosition&&(h.isSliding=!1,L[e].classList.add("active"),L[n].classList.remove("active"),L[e].classList.remove("carousel-item-"+a),L[e].classList.remove("carousel-item-"+h.direction),L[n].classList.remove("carousel-item-"+h.direction),c.call(d,v),document.hidden||!g.interval||d.classList.contains("paused")||E.cycle())}),i)}}if(E.cycle=function(){h.timer&&(clearInterval(h.timer),h.timer=null),h.timer=setInterval((function(){var t=h.index||E.getActiveIndex();(function(t){var e=t.getBoundingClientRect(),i=window.innerHeight||document.documentElement.clientHeight;return e.top<=i&&e.bottom>=0})(d)&&(t+=1,E.slideTo(t))}),g.interval)},E.slideTo=function(t){if(!h.isSliding){var e=E.getActiveIndex(),i=t;if(e!==i){ei||e===L.length-1&&0===i)&&(h.direction="right"),i<0?i=L.length-1:i>=L.length&&(i=0);var n="left"===h.direction?"next":"prev",s={relatedTarget:L[i],direction:h.direction,from:e,to:i};p=l("slide","carousel",s),v=l("slid","carousel",s),c.call(d,p),p.defaultPrevented||(h.index=i,h.isSliding=!0,clearInterval(h.timer),h.timer=null,D(i),a(L[i])&&d.classList.contains("slide")?(L[i].classList.add("carousel-item-"+n),f(L[i]),L[i].classList.add("carousel-item-"+h.direction),L[e].classList.add("carousel-item-"+h.direction),o(L[i],X)):(L[i].classList.add("active"),f(L[i]),L[e].classList.remove("active"),setTimeout((function(){h.isSliding=!1,g.interval&&d&&!d.classList.contains("paused")&&E.cycle(),c.call(d,v)}),100)))}}},E.getActiveIndex=function(){return Array.from(L).indexOf(d.getElementsByClassName("carousel-item active")[0])||0},E.dispose=function(){var t=["left","right","prev","next"];Array.from(L).forEach((function(e,i){e.classList.contains("active")&&D(i),t.forEach((function(t){return e.classList.remove("carousel-item-"+t)}))})),clearInterval(h.timer),H(),h={},g={},delete d.Carousel},(d=s(t)).Carousel&&d.Carousel.dispose(),L=d.getElementsByClassName("carousel-item"),i=d.getElementsByClassName("carousel-control-prev"),b=i[0],n=d.getElementsByClassName("carousel-control-next"),y=n[0],r=d.getElementsByClassName("carousel-indicators"),w=r[0],A=w&&w.getElementsByTagName("LI")||[],!(L.length<2)){var O=d.getAttribute("data-interval"),R="false"===O?0:+O,W="false"===d.getAttribute("data-touch")?0:1,j="hover"===d.getAttribute("data-pause")||!1,z="true"===d.getAttribute("data-keyboard")||!1,U=T.interval,q=T.touch;(g={}).keyboard=!0===T.keyboard||z,g.pause=!("hover"!==T.pause&&!j)&&"hover",g.touch=q||W,g.interval=5e3,"number"==typeof U?g.interval=U:!1===U||0===R||!1===R?g.interval=0:Number.isNaN(R)||(g.interval=R),E.getActiveIndex()<0&&(L.length&&L[0].classList.add("active"),A.length&&D(0)),(h={}).direction="left",h.index=0,h.timer=null,h.isSliding=!1,h.isTouch=!1,h.touchPosition={startX:0,currentX:0,endX:0},H(1),g.interval&&E.cycle(),d.Carousel=E}}function g(t,e){var i,n,a,r,d,u,m,h=e||{},g=this,p=null,v=null;function L(t,e){c.call(t,u),u.defaultPrevented||(t.isAnimating=!0,t.style.height=t.scrollHeight+"px",t.classList.remove("collapse"),t.classList.remove("show"),t.classList.add("collapsing"),f(t),t.style.height="0px",o(t,(function(){t.isAnimating=!1,t.setAttribute("aria-expanded","false"),e.setAttribute("aria-expanded","false"),t.classList.remove("collapsing"),t.classList.add("collapse"),t.style.height="",c.call(t,m)})))}g.toggle=function(t){(t&&"A"===t.target.tagName||"A"===i.tagName)&&t.preventDefault(),(i.contains(t.target)||t.target===i)&&(v.classList.contains("show")?g.hide():g.show())},g.hide=function(){v.isAnimating||(L(v,i),i.classList.add("collapsed"))},g.show=function(){var t,e,l;p&&(t=p.getElementsByClassName("collapse show"),n=t[0],a=n&&(s('[data-target="#'+n.id+'"]',p)||s('[href="#'+n.id+'"]',p))),v.isAnimating||(a&&n!==v&&(L(n,a),a.classList.add("collapsed")),e=v,l=i,c.call(e,r),r.defaultPrevented||(e.isAnimating=!0,e.classList.add("collapsing"),e.classList.remove("collapse"),e.style.height=e.scrollHeight+"px",o(e,(function(){e.isAnimating=!1,e.setAttribute("aria-expanded","true"),l.setAttribute("aria-expanded","true"),e.classList.remove("collapsing"),e.classList.add("collapse"),e.classList.add("show"),e.style.height="",c.call(e,d)}))),i.classList.remove("collapsed"))},g.dispose=function(){i.removeEventListener("click",g.toggle,!1),delete i.Collapse},(i=s(t)).Collapse&&i.Collapse.dispose();var b=i.getAttribute("data-parent");r=l("show","collapse"),d=l("shown","collapse"),u=l("hide","collapse"),m=l("hidden","collapse"),null!==(v=s(h.target||i.getAttribute("data-target")||i.getAttribute("href")))&&(v.isAnimating=!1);var y=h.parent||b;p=y?i.closest(y):null,i.Collapse||i.addEventListener("click",g.toggle,!1),i.Collapse=g}function p(t){t.focus()}function v(t,e){var i,n,a,o,r,d,u,m,f=this,h=null,g=[];function v(t){(t.hasAttribute("href")&&"#"===t.href.slice(-1)||t.parentNode&&t.hasAttribute("href")&&"#"===t.parentNode.href.slice(-1))&&this.preventDefault()}function L(){var t=i.open?"addEventListener":"removeEventListener";document[t]("click",b,!1),document[t]("keydown",w,!1),document[t]("keyup",A,!1),document[t]("focus",b,!1)}function b(t){var e=t.target;if(e.getAttribute){var n=e&&e.getAttribute("data-toggle")||e.parentNode&&e.parentNode.getAttribute&&e.parentNode.getAttribute("data-toggle");("focus"!==t.type||e!==i&&e!==u&&!u.contains(e))&&(e!==u&&!u.contains(e)||!m&&!n)&&(h=e===i||i.contains(e)?i:null,f.hide(),v.call(t,e))}}function y(t){h=i,f.show(),v.call(t,t.target)}function w(t){var e=t.which||t.keyCode;38!==e&&40!==e||t.preventDefault()}function A(t){var e=t.which||t.keyCode,n=document.activeElement,a=n===i,o=u.contains(n),s=n.parentNode===u||n.parentNode.parentNode===u,l=g.indexOf(n);s&&(a?l=0:38===e?l=l>1?l-1:0:40===e&&(l=l=d,A=m.top+r/2+g/2>=u,T=m.top-r<0,E=m.left-c<0,k=m.top+r+g>=u,x=m.left+c+h>=d,C=i;C="right"===(C="left"===(C="bottom"===(C="top"===(C=("left"===C||"right"===C)&&E&&x?"top":C)&&T?"bottom":C)&&k?"top":C)&&E?"right":C)&&x?"left":C,-1===e.className.indexOf(C)&&(e.className=e.className.replace(/\b(top|bottom|left|right)+/,C));var N=v.offsetWidth,P=v.offsetHeight;"left"===C||"right"===C?(o="left"===C?m.left+f.x-c-(p?N:0):m.left+f.x+h,L?(a=m.top+f.y,s=g/2-N):A?(a=m.top+f.y-r+g,s=r-g/2-N):(a=m.top+f.y-r/2+g/2,s=r/2-(p?.9*P:P/2))):"top"!==C&&"bottom"!==C||(a="top"===C?m.top+f.y-r-(p?P:0):m.top+f.y+g,b?(o=0,l=m.left+h/2-N):w?(o=d-1.01*c,l=c-(d-m.left)+h/2-N/2):(o=m.left+f.x-c/2+h/2,l=c/2-(p?N:N/2))),e.style.top=a+"px",e.style.left=o+"px",s&&(v.style.top=s+"px"),l&&(v.style.left=l+"px")}function A(t,e){var i,n,a,r,d,f,h,g,p,v=e||{},L=this,y=null,A=0,T=/(iPhone|iPod|iPad)/.test(navigator.userAgent),E={};function k(t){null!==y&&t.target===s(".close",y)&&L.hide()}function x(t){return v[t]||i.dataset[t]||null}function C(){return x("title")}function N(){return x("content")}function P(){null===y&&i.focus()}function H(t){var e=t?"addEventListener":"removeEventListener";"hover"===E.trigger?(i[e](b,L.show),i[e](u[0],L.show),E.dismissible||i[e](u[1],L.hide)):"click"===E.trigger?i[e](E.trigger,L.toggle):"focus"===E.trigger&&(T&&i[e]("click",P,!1),i[e](E.trigger,L.toggle))}function S(t){y&&y.contains(t.target)||t.target===i||i.contains(t.target)||L.hide()}function B(t){var e=t?"addEventListener":"removeEventListener";E.dismissible?document[e]("click",k,!1):("focus"===E.trigger&&i[e]("blur",L.hide),"hover"===E.trigger&&document[e]("touchstart",S,m)),window[e]("resize",L.hide,m)}function M(){B(1),c.call(i,h)}function I(){B(),E.container.removeChild(y),A=null,y=null,c.call(i,p)}L.toggle=function(){null===y?L.show():L.hide()},L.show=function(){clearTimeout(A),A=setTimeout((function(){if(null===y){if(c.call(i,f),f.defaultPrevented)return;!function(){n=C(),a=(a=N())?a.trim():null,y=document.createElement("div");var t=document.createElement("div");if(t.classList.add("arrow"),y.appendChild(t),null!==a&&null===E.template){if(y.setAttribute("role","tooltip"),null!==n){var e=document.createElement("h3");e.classList.add("popover-header"),e.innerHTML=E.dismissible?n+d:n,y.appendChild(e)}var i=document.createElement("div");i.classList.add("popover-body"),i.innerHTML=E.dismissible&&null===n?a+d:a,y.appendChild(i)}else{var o=document.createElement("div");o.innerHTML=E.template.trim(),y.className=o.firstChild.className,y.innerHTML=o.firstChild.innerHTML;var l=s(".popover-header",y),c=s(".popover-body",y);n&&l&&(l.innerHTML=n.trim()),a&&c&&(c.innerHTML=a.trim())}E.container.appendChild(y),y.style.display="block",y.classList.contains("popover")||y.classList.add("popover"),y.classList.contains(E.animation)||y.classList.add(E.animation),y.classList.contains(r)||y.classList.add(r)}(),w(i,y,E.placement,E.container),y.classList.contains("show")||y.classList.add("show"),E.animation?o(y,M):M()}}),20)},L.hide=function(){clearTimeout(A),A=setTimeout((function(){if(y&&null!==y&&y.classList.contains("show")){if(c.call(i,g),g.defaultPrevented)return;y.classList.remove("show"),E.animation?o(y,I):I()}}),E.delay)},L.dispose=function(){L.hide(),H(),delete i.Popover},(i=s(t)).Popover&&i.Popover.dispose();var D=i.getAttribute("data-trigger"),X=i.getAttribute("data-animation"),O=i.getAttribute("data-placement"),R=i.getAttribute("data-dismissible"),W=i.getAttribute("data-delay"),j=i.getAttribute("data-container");d='',f=l("show","popover"),h=l("shown","popover"),g=l("hide","popover"),p=l("hidden","popover");var z=s(v.container),U=s(j),q=i.closest(".modal"),Y=i.closest(".fixed-top"),F=i.closest(".fixed-bottom");E.template=v.template?v.template:null,E.trigger=v.trigger?v.trigger:D||"hover",E.animation=v.animation&&"fade"!==v.animation?v.animation:X||"fade",E.placement=v.placement?v.placement:O||"top",E.delay=parseInt(v.delay||W,10)||200,E.dismissible=!(!v.dismissible&&"true"!==R),E.container=z||U||Y||F||q||document.body,r="bs-popover-"+E.placement,n=C(),((a=N())||E.template)&&(i.Popover||H(1),i.Popover=L)}function T(t,e){var i,n,a,o,r,d=e||{},u=this,f={};function h(){var t,e,l;(a=o.getElementsByTagName("A"),n.scrollTop=n.isWindow?y().y:i.scrollTop,n.length!==a.length||p()!==n.scrollHeight)&&(n.items=[],n.offsets=[],n.scrollHeight=p(),n.maxScroll=n.scrollHeight-(n.isWindow?window.innerHeight:i.getBoundingClientRect().height),Array.from(a).forEach((function(i){t=i.getAttribute("href"),(e=t&&"#"===t.charAt(0)&&"#"!==t.slice(-1)&&s(t))&&(n.items.push(i),l=e.getBoundingClientRect(),n.offsets.push((n.isWindow?l.top+n.scrollTop:e.offsetTop)-f.offset))})),n.length=n.items.length)}function g(t){var e=t?"addEventListener":"removeEventListener";r[e]("scroll",u.refresh,m),window[e]("resize",u.refresh,m)}function p(){return r.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}function v(){Array.from(a).map((function(t){return t.classList.contains("active")&&t.classList.remove("active")}))}function L(t){var e,a=t;v(),n.activeItem=a,a.classList.add("active");for(var o=[];a.parentNode!==document.body;)((e=(a=a.parentNode).classList).contains("dropdown-menu")||e.contains("nav"))&&o.push(a);o.forEach((function(t){var e=t.previousElementSibling;e&&!e.classList.contains("active")&&e.classList.add("active")})),c.call(i,l("activate","scrollspy",{relatedTarget:n.activeItem}))}u.refresh=function(){if(h(),n.scrollTop>=n.maxScroll){var t=n.items[n.length-1];n.activeItem!==t&&L(t)}else{if(n.activeItem&&n.scrollTop0)return n.activeItem=null,void v();for(var e=n.length;e>-1;)n.activeItem!==n.items[e]&&n.scrollTop>=n.offsets[e]&&(void 0===n.offsets[e+1]||n.scrollTop1&&(p=t[t.length-1]):p=t[0],p}function P(){return s(N().getAttribute("href"))}function H(t){t.preventDefault(),g=t.currentTarget,a.isAnimating||T.show()}T.show=function(){if(!(g=g||n).classList.contains("active")){if(L=s(g.getAttribute("href")),p=N(),v=P(),m=l("hide","tab",{relatedTarget:g}),c.call(p,m),m.defaultPrevented)return;a.isAnimating=!0,p.classList.remove("active"),p.setAttribute("aria-selected","false"),g.classList.add("active"),g.setAttribute("aria-selected","true"),r&&(n.parentNode.classList.contains("dropdown-menu")?r.classList.contains("active")||r.classList.add("active"):r.classList.contains("active")&&r.classList.remove("active")),v.classList.contains("fade")?(v.classList.remove("show"),o(v,C)):C()}},T.dispose=function(){n.removeEventListener("click",H,!1),delete n.Tab},(n=s(t)).Tab&&n.Tab.dispose();var S=n.getAttribute("data-height");a=n.closest(".nav"),r=a&&s(".dropdown-toggle",a);var B=!(!e||!1===A.height||"false"===S);a.isAnimating=!1,n.Tab||n.addEventListener("click",H,!1),B&&(E=P().parentNode),n.Tab=T}function k(t,e){var i,n,a,r,d,u,m=e||{},h=this,g=0,p={};function v(){n.classList.remove("showing"),n.classList.add("show"),c.call(n,d),p.autohide&&h.hide()}function L(){n.classList.add("hide"),c.call(n,u)}function b(){n.classList.remove("show"),p.animation?o(n,L):L()}function y(){clearTimeout(g),i.removeEventListener("click",h.hide,!1),delete i.Toast}h.show=function(){if(n&&!n.classList.contains("show")){if(c.call(n,a),a.defaultPrevented)return;p.animation&&n.classList.add("fade"),n.classList.remove("hide"),f(n),n.classList.add("showing"),p.animation?o(n,v):v()}},h.hide=function(t){if(n&&n.classList.contains("show")){if(c.call(n,r),r.defaultPrevented)return;t?b():g=setTimeout(b,p.delay)}},h.dispose=function(){p.animation?o(n,y):y()},(i=s(t)).Toast&&i.Toast.dispose(),n=i.closest(".toast");var w=i.getAttribute("data-animation"),A=i.getAttribute("data-autohide"),T=i.getAttribute("data-delay");a=l("show","toast"),r=l("hide","toast"),d=l("shown","toast"),u=l("hidden","toast"),p.animation=!1===m.animation||"false"===w?0:1,p.autohide=!1===m.autohide||"false"===A?0:1,p.delay=parseInt(m.delay||T,10)||500,i.Toast||i.addEventListener("click",h.hide,!1),i.Toast=h}function x(t,e){var i,n,a,r,d,f,h,g=e||{},p=this,v=null,L=0,y={};function A(){return i.getAttribute("title")||i.getAttribute("data-title")||i.getAttribute("data-original-title")}function T(t){v&&v.contains(t.target)||t.target===i||i.contains(t.target)||p.hide()}function E(t){var e=t?"addEventListener":"removeEventListener";document[e]("touchstart",T,m),window[e]("resize",p.hide,m)}function k(){E(1),c.call(i,d)}function x(){E(),y.container.removeChild(v),v=null,L=null,c.call(i,h)}function C(t){var e=t?"addEventListener":"removeEventListener";i[e](b,p.show,!1),i[e](u[0],p.show,!1),i[e](u[1],p.hide,!1)}p.show=function(){clearTimeout(L),L=setTimeout((function(){if(null===v){if(c.call(i,r),r.defaultPrevented)return;!1!==function(){if(n=A()){if(v=document.createElement("div"),y.template){var t=document.createElement("div");t.innerHTML=y.template.trim(),v.className=t.firstChild.className,v.innerHTML=t.firstChild.innerHTML,s(".tooltip-inner",v).innerHTML=n.trim()}else{var e=document.createElement("div");e.classList.add("arrow"),v.appendChild(e);var i=document.createElement("div");i.classList.add("tooltip-inner"),v.appendChild(i),i.innerHTML=n}v.style.left="0",v.style.top="0",v.setAttribute("role","tooltip"),v.classList.contains("tooltip")||v.classList.add("tooltip"),v.classList.contains(y.animation)||v.classList.add(y.animation),v.classList.contains(a)||v.classList.add(a),y.container.appendChild(v)}}()&&(w(i,v,y.placement,y.container),v.classList.contains("show")||v.classList.add("show"),y.animation?o(v,k):k())}}),20)},p.hide=function(){clearTimeout(L),L=setTimeout((function(){if(v&&v.classList.contains("show")){if(c.call(i,f),f.defaultPrevented)return;v.classList.remove("show"),y.animation?o(v,x):x()}}),y.delay)},p.toggle=function(){v?p.hide():p.show()},p.dispose=function(){C(),p.hide(),i.setAttribute("title",i.getAttribute("data-original-title")),i.removeAttribute("data-original-title"),delete i.Tooltip},(i=s(t)).Tooltip&&i.Tooltip.dispose();var N=i.getAttribute("data-animation"),P=i.getAttribute("data-placement"),H=i.getAttribute("data-delay"),S=i.getAttribute("data-container"),B=s(g.container),M=s(S),I=i.closest(".modal");r=l("show","tooltip"),d=l("shown","tooltip"),f=l("hide","tooltip"),h=l("hidden","tooltip");var D=i.closest(".fixed-top"),X=i.closest(".fixed-bottom");y.animation=g.animation&&"fade"!==g.animation?g.animation:N||"fade",y.placement=g.placement?g.placement:P||"top",y.template=g.template?g.template:null,y.delay=parseInt(g.delay||H,10)||200,y.container=B||M||D||X||I||document.body,a="bs-tooltip-"+y.placement,(n=A())&&(i.Tooltip||(i.setAttribute("data-original-title",n),i.removeAttribute("title"),C(1)),i.Tooltip=p)}var C={};function N(t){var e=t instanceof Element?t:document;Object.keys(C).forEach((function(t){var i,n;i=C[t][0],n=e.querySelectorAll(C[t][1]),Array.from(n).map((function(t){return new i(t)}))}))}C.Alert=[r,'[data-dismiss="alert"]'],C.Button=[d,'[data-toggle="buttons"]'],C.Carousel=[h,'[data-ride="carousel"]'],C.Collapse=[g,'[data-toggle="collapse"]'],C.Dropdown=[v,'[data-toggle="dropdown"]'],C.Modal=[L,'[data-toggle="modal"]'],C.Popover=[A,'[data-toggle="popover"],[data-tip="popover"]'],C.ScrollSpy=[T,'[data-spy="scroll"]'],C.Tab=[E,'[data-toggle="tab"]'],C.Toast=[k,'[data-dismiss="toast"]'],C.Tooltip=[x,'[data-toggle="tooltip"],[data-tip="tooltip"]'],document.body?N():document.addEventListener("DOMContentLoaded",(function t(){N(),document.removeEventListener("DOMContentLoaded",t,!1)}),!1);return{Alert:r,Button:d,Carousel:h,Collapse:g,Dropdown:v,Modal:L,Popover:A,ScrollSpy:T,Tab:E,Toast:k,Tooltip:x,initCallback:N,removeDataAPI:function(t){var e=t instanceof Element?t:document;Object.keys(C).forEach((function(t){var i,n;i=t,n=e.querySelectorAll(C[t][1]),Array.from(n).map((function(t){return t[i].dispose()}))}))},componentsInit:C,Version:"4.0.8"}})); +// Native JavaScript for Bootstrap v4.1.0 | 2021 © dnp_theme | MIT-License +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).BSN=e()}(this,(function(){"use strict";var t="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",e="webkitTransition"in document.head.style||"transition"in document.head.style,i="webkitTransition"in document.head.style?"webkitTransitionDelay":"transitionDelay",n="webkitTransition"in document.head.style?"webkitTransitionProperty":"transitionProperty";var a="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration";function o(t){var i=getComputedStyle(t),o=i[n],s=i[a],l=s.includes("ms")?1:1e3,c=e&&o&&"none"!==o?parseFloat(s)*l:0;return Number.isNaN(c)?0:c}function s(a,s){var l=0,c=new Event(t),r=o(a),d=function(t){var a=getComputedStyle(t),o=a[n],s=a[i],l=s.includes("ms")?1:1e3,c=e&&o&&"none"!==o?parseFloat(s)*l:0;return Number.isNaN(c)?0:c}(a);if(r){var u=function(e){e.target===a&&(s.apply(a,[e]),a.removeEventListener(t,u),l=1)};a.addEventListener(t,u),setTimeout((function(){l||a.dispatchEvent(c)}),r+d+17)}else s.apply(a,[c])}function l(t,e){var i=e&&e instanceof Element?e:document;return t instanceof Element?t:i.querySelector(t)}function c(t,e,i){var n=new CustomEvent(t+".bs."+e,{cancelable:!0});return void 0!==i&&Object.keys(i).forEach((function(t){Object.defineProperty(n,t,{value:i[t]})})),n}function r(t){this&&this.dispatchEvent(t)}function d(t){var e,i,n=this,a=c("close","alert"),o=c("closed","alert");function d(t){e[t?"addEventListener":"removeEventListener"]("click",u,!1)}function u(t){i=t&&t.target.closest(".alert"),(e=l('[data-dismiss="alert"]',i))&&i&&(e===t.target||e.contains(t.target))&&n.close()}function m(){d(),i.parentNode.removeChild(i),r.call(i,o)}n.close=function(){if(i&&e&&i.classList.contains("show")){if(r.call(i,a),a.defaultPrevented)return;n.dispose(),i.classList.remove("show"),i.classList.contains("fade")?s(i,m):m()}},n.dispose=function(){d(),delete e.Alert},e=l(t),i=e.closest(".alert"),e.Alert&&e.Alert.dispose(),e.Alert||d(1),n.element=e,e.Alert=n}function u(t){var e,i,n=c("change","button");function a(t){var a=t.target,o=a.closest("LABEL"),s=null;"LABEL"===a.tagName?s=a:o&&(s=o);var l=s&&s.getElementsByTagName("INPUT")[0];if(l){if(r.call(l,n),r.call(e,n),"checkbox"===l.type){if(n.defaultPrevented)return;l.checked?(s.classList.remove("active"),l.getAttribute("checked"),l.removeAttribute("checked"),l.checked=!1):(s.classList.add("active"),l.getAttribute("checked"),l.setAttribute("checked","checked"),l.checked=!0),e.toggled||(e.toggled=!0)}if("radio"===l.type&&!e.toggled){if(n.defaultPrevented)return;(!l.checked||0===t.screenX&&0===t.screenY)&&(s.classList.add("active"),s.classList.add("focus"),l.setAttribute("checked","checked"),l.checked=!0,e.toggled=!0,Array.from(i).forEach((function(t){var e=t.getElementsByTagName("INPUT")[0];t!==s&&t.classList.contains("active")&&(r.call(e,n),t.classList.remove("active"),e.removeAttribute("checked"),e.checked=!1)})))}setTimeout((function(){e.toggled=!1}),50)}}function o(t){32===(t.which||t.keyCode)&&t.target===document.activeElement&&a(t)}function s(t){32===(t.which||t.keyCode)&&t.preventDefault()}function d(t){if("INPUT"===t.target.tagName){var e="focusin"===t.type?"add":"remove";t.target.closest(".btn").classList[e]("focus")}}function u(t){var i=t?"addEventListener":"removeEventListener";e[i]("click",a,!1),e[i]("keyup",o,!1),e[i]("keydown",s,!1),e[i]("focusin",d,!1),e[i]("focusout",d,!1)}this.dispose=function(){u(),delete e.Button},(e=l(t)).Button&&e.Button.dispose(),(i=e.getElementsByClassName("btn")).length&&(e.Button||u(1),e.toggled=!1,e.Button=this,Array.from(i).forEach((function(t){var e=l("input:checked",t);!t.classList.contains("active")&&e&&t.classList.add("active"),t.classList.contains("active")&&!e&&t.classList.remove("active")})))}var m="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],f=!!function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){return t=!0}});document.addEventListener("DOMContentLoaded",(function t(){document.removeEventListener("DOMContentLoaded",t,e)}),e)}catch(t){throw Error("Passive events are not supported")}return t}()&&{passive:!0};function h(t){return t.offsetHeight}function g(t,e){var i,n,a,d,u,g,p,v,L,b,y,w,A,T=e||{},E=this;function k(){!1===g.interval||d.classList.contains("paused")||(d.classList.add("paused"),u.isSliding||(clearInterval(u.timer),u.timer=null))}function x(){!1!==g.interval&&d.classList.contains("paused")&&(d.classList.remove("paused"),u.isSliding||(clearInterval(u.timer),u.timer=null,E.cycle()))}function C(t){if(t.preventDefault(),!u.isSliding){var e=t.target;e&&!e.classList.contains("active")&&e.getAttribute("data-slide-to")&&(u.index=+e.getAttribute("data-slide-to"),E.slideTo(u.index))}}function N(t){if(t.preventDefault(),!u.isSliding){var e=t.currentTarget||t.srcElement;e===y?u.index+=1:e===b&&(u.index-=1),E.slideTo(u.index)}}function P(t){var e=t.which;if(!u.isSliding){switch(e){case 39:u.index+=1;break;case 37:u.index-=1;break;default:return}E.slideTo(u.index)}}function H(t){var e=t?"addEventListener":"removeEventListener";g.pause&&g.interval&&(d[e](m[0],k,!1),d[e](m[1],x,!1),d[e]("touchstart",k,f),d[e]("touchend",x,f)),g.touch&&L.length>1&&d[e]("touchstart",B,f),y&&y[e]("click",N,!1),b&&b[e]("click",N,!1),w&&w[e]("click",C,!1),g.keyboard&&window[e]("keydown",P,!1)}function S(t){var e=t?"addEventListener":"removeEventListener";d[e]("touchmove",M,f),d[e]("touchend",I,f)}function B(t){u.isTouch||(u.touchPosition.startX=t.changedTouches[0].pageX,d.contains(t.target)&&(u.isTouch=!0,S(1)))}function M(t){u.isTouch?(u.touchPosition.currentX=t.changedTouches[0].pageX,"touchmove"===t.type&&t.changedTouches.length>1&&t.preventDefault()):t.preventDefault()}function I(t){if(u.isTouch&&!u.isSliding&&(u.touchPosition.endX=u.touchPosition.currentX||t.changedTouches[0].pageX,u.isTouch)){if((!d.contains(t.target)||!d.contains(t.relatedTarget))&&Math.abs(u.touchPosition.startX-u.touchPosition.endX)<75)return;u.touchPosition.currentXu.touchPosition.startX&&(u.index-=1),u.isTouch=!1,E.slideTo(u.index),S()}}function D(t){Array.from(A).forEach((function(t){return t.classList.remove("active")})),A[t]&&A[t].classList.add("active")}function X(t){if(u.touchPosition){var e=u.index,i=t&&t.target!==L[e]?1e3*t.elapsedTime+100:20,n=E.getActiveIndex(),a="left"===u.direction?"next":"prev";u.isSliding&&setTimeout((function(){u.touchPosition&&(u.isSliding=!1,L[e].classList.add("active"),L[n].classList.remove("active"),L[e].classList.remove("carousel-item-"+a),L[e].classList.remove("carousel-item-"+u.direction),L[n].classList.remove("carousel-item-"+u.direction),r.call(d,v),document.hidden||!g.interval||d.classList.contains("paused")||E.cycle())}),i)}}if(E.cycle=function(){u.timer&&(clearInterval(u.timer),u.timer=null),u.timer=setInterval((function(){var t=u.index||E.getActiveIndex();(function(t){var e=t.getBoundingClientRect(),i=window.innerHeight||document.documentElement.clientHeight;return e.top<=i&&e.bottom>=0})(d)&&(t+=1,E.slideTo(t))}),g.interval)},E.slideTo=function(t){if(!u.isSliding){var e=E.getActiveIndex(),i=t;if(e!==i){ei||e===L.length-1&&0===i)&&(u.direction="right"),i<0?i=L.length-1:i>=L.length&&(i=0);var n="left"===u.direction?"next":"prev",a={relatedTarget:L[i],direction:u.direction,from:e,to:i};p=c("slide","carousel",a),v=c("slid","carousel",a),r.call(d,p),p.defaultPrevented||(u.index=i,u.isSliding=!0,clearInterval(u.timer),u.timer=null,D(i),o(L[i])&&d.classList.contains("slide")?(L[i].classList.add("carousel-item-"+n),h(L[i]),L[i].classList.add("carousel-item-"+u.direction),L[e].classList.add("carousel-item-"+u.direction),s(L[i],X)):(L[i].classList.add("active"),h(L[i]),L[e].classList.remove("active"),setTimeout((function(){u.isSliding=!1,g.interval&&d&&!d.classList.contains("paused")&&E.cycle(),r.call(d,v)}),100)))}}},E.getActiveIndex=function(){return Array.from(L).indexOf(d.getElementsByClassName("carousel-item active")[0])||0},E.dispose=function(){var t=["left","right","prev","next"];Array.from(L).forEach((function(e,i){e.classList.contains("active")&&D(i),t.forEach((function(t){return e.classList.remove("carousel-item-"+t)}))})),clearInterval(u.timer),H(),u={},g={},delete d.Carousel},(d=l(t)).Carousel&&d.Carousel.dispose(),L=d.getElementsByClassName("carousel-item"),i=d.getElementsByClassName("carousel-control-prev"),b=i[0],n=d.getElementsByClassName("carousel-control-next"),y=n[0],a=d.getElementsByClassName("carousel-indicators"),w=a[0],A=w&&w.getElementsByTagName("LI")||[],!(L.length<2)){var O=d.getAttribute("data-interval"),R="false"===O?0:+O,W="false"===d.getAttribute("data-touch")?0:1,j="hover"===d.getAttribute("data-pause")||!1,z="true"===d.getAttribute("data-keyboard")||!1,U=T.interval,q=T.touch;(g={}).keyboard=!0===T.keyboard||z,g.pause=!("hover"!==T.pause&&!j)&&"hover",g.touch=q||W,g.interval=5e3,"number"==typeof U?g.interval=U:!1===U||0===R||!1===R?g.interval=0:Number.isNaN(R)||(g.interval=R),E.getActiveIndex()<0&&(L.length&&L[0].classList.add("active"),A.length&&D(0)),(u={}).direction="left",u.index=0,u.timer=null,u.isSliding=!1,u.isTouch=!1,u.touchPosition={startX:0,currentX:0,endX:0},H(1),g.interval&&E.cycle(),d.Carousel=E}}function p(t,e){var i,n,a,o,d,u,m,f=e||{},g=this,p=null,v=null;function L(t,e){r.call(t,u),u.defaultPrevented||(t.isAnimating=!0,t.style.height=t.scrollHeight+"px",t.classList.remove("collapse"),t.classList.remove("show"),t.classList.add("collapsing"),h(t),t.style.height="0px",s(t,(function(){t.isAnimating=!1,t.setAttribute("aria-expanded","false"),e.setAttribute("aria-expanded","false"),t.classList.remove("collapsing"),t.classList.add("collapse"),t.style.height="",r.call(t,m)})))}g.toggle=function(t){(t&&"A"===t.target.tagName||"A"===i.tagName)&&t.preventDefault(),(i.contains(t.target)||t.target===i)&&(v.classList.contains("show")?g.hide():g.show())},g.hide=function(){v.isAnimating||(L(v,i),i.classList.add("collapsed"))},g.show=function(){var t,e,c;p&&(t=p.getElementsByClassName("collapse show"),n=t[0],a=n&&(l('[data-target="#'+n.id+'"]',p)||l('[href="#'+n.id+'"]',p))),v.isAnimating||(a&&n!==v&&(L(n,a),a.classList.add("collapsed")),e=v,c=i,r.call(e,o),o.defaultPrevented||(e.isAnimating=!0,e.classList.add("collapsing"),e.classList.remove("collapse"),e.style.height=e.scrollHeight+"px",s(e,(function(){e.isAnimating=!1,e.setAttribute("aria-expanded","true"),c.setAttribute("aria-expanded","true"),e.classList.remove("collapsing"),e.classList.add("collapse"),e.classList.add("show"),e.style.height="",r.call(e,d)}))),i.classList.remove("collapsed"))},g.dispose=function(){i.removeEventListener("click",g.toggle,!1),delete i.Collapse},(i=l(t)).Collapse&&i.Collapse.dispose();var b=i.getAttribute("data-parent");o=c("show","collapse"),d=c("shown","collapse"),u=c("hide","collapse"),m=c("hidden","collapse"),null!==(v=l(f.target||i.getAttribute("data-target")||i.getAttribute("href")))&&(v.isAnimating=!1);var y=f.parent||b;p=y?i.closest(y):null,i.Collapse||i.addEventListener("click",g.toggle,!1),i.Collapse=g}function v(t){t.focus()}function L(t,e){var i,n,a,o,s,d,u,m,f=this,h=null,g=[];function p(t){(t.hasAttribute("href")&&"#"===t.href.slice(-1)||t.parentNode&&t.hasAttribute("href")&&"#"===t.parentNode.href.slice(-1))&&this.preventDefault()}function L(){var t=i.open?"addEventListener":"removeEventListener";document[t]("click",b,!1),document[t]("keydown",w,!1),document[t]("keyup",A,!1),document[t]("focus",b,!1)}function b(t){var e=t.target;if(e.getAttribute){var n=e&&e.getAttribute("data-toggle")||e.parentNode&&e.parentNode.getAttribute&&e.parentNode.getAttribute("data-toggle");("focus"!==t.type||e!==i&&e!==u&&!u.contains(e))&&(e!==u&&!u.contains(e)||!m&&!n)&&(h=e===i||i.contains(e)?i:null,f.hide(),p.call(t,e))}}function y(t){h=i,f.show(),p.call(t,t.target)}function w(t){var e=t.which||t.keyCode;38!==e&&40!==e||t.preventDefault()}function A(t){var e=t.which||t.keyCode,n=document.activeElement,a=n===i,o=u.contains(n),s=n.parentNode===u||n.parentNode.parentNode===u,l=g.indexOf(n);s&&(a?l=0:38===e?l=l>1?l-1:0:40===e&&(l=l=d,A=m.top+r/2+g/2>=u,T=m.top-r<0,E=m.left-c<0,k=m.top+r+g>=u,x=m.left+c+h>=d,C=i;C="right"===(C="left"===(C="bottom"===(C="top"===(C=("left"===C||"right"===C)&&E&&x?"top":C)&&T?"bottom":C)&&k?"top":C)&&E?"right":C)&&x?"left":C,-1===e.className.indexOf(C)&&(e.className=e.className.replace(/\b(top|bottom|left|right)+/,C));var N=v.offsetWidth,P=v.offsetHeight;"left"===C||"right"===C?(o="left"===C?m.left+f.x-c-(p?N:0):m.left+f.x+h,L?(a=m.top+f.y,s=g/2-N):A?(a=m.top+f.y-r+g,s=r-g/2-N):(a=m.top+f.y-r/2+g/2,s=r/2-(p?.9*P:P/2))):"top"!==C&&"bottom"!==C||(a="top"===C?m.top+f.y-r-(p?P:0):m.top+f.y+g,b?(o=0,l=m.left+h/2-N):y?(o=d-1.01*c,l=c-(d-m.left)+h/2-N/2):(o=m.left+f.x-c/2+h/2,l=c/2-(p?N:N/2))),e.style.top=a+"px",e.style.left=o+"px",s&&(v.style.top=s+"px"),l&&(v.style.left=l+"px")}function T(t,e){var i,n,a,o,d,u,h,g,p,v=e||{},L=this,b=null,w=0,T=/(iPhone|iPod|iPad)/.test(navigator.userAgent),E={};function k(t){null!==b&&t.target===l(".close",b)&&L.hide()}function x(t){return v[t]||i.dataset[t]||null}function C(){return x("title")}function N(){return x("content")}function P(){null===b&&i.focus()}function H(t){var e=t?"addEventListener":"removeEventListener";"hover"===E.trigger?(i[e](y,L.show),i[e](m[0],L.show),E.dismissible||i[e](m[1],L.hide)):"click"===E.trigger?i[e](E.trigger,L.toggle):"focus"===E.trigger&&(T&&i[e]("click",P,!1),i[e](E.trigger,L.toggle))}function S(t){b&&b.contains(t.target)||t.target===i||i.contains(t.target)||L.hide()}function B(t){var e=t?"addEventListener":"removeEventListener";E.dismissible?document[e]("click",k,!1):("focus"===E.trigger&&i[e]("blur",L.hide),"hover"===E.trigger&&document[e]("touchstart",S,f)),window[e]("resize",L.hide,f)}function M(){B(1),r.call(i,h)}function I(){B(),E.container.removeChild(b),w=null,b=null,r.call(i,p)}L.toggle=function(){null===b?L.show():L.hide()},L.show=function(){clearTimeout(w),w=setTimeout((function(){if(null===b){if(r.call(i,u),u.defaultPrevented)return;!function(){n=C(),a=(a=N())?a.trim():null,b=document.createElement("div");var t=document.createElement("div");if(t.classList.add("arrow"),b.appendChild(t),null!==a&&null===E.template){if(b.setAttribute("role","tooltip"),null!==n){var e=document.createElement("h3");e.classList.add("popover-header"),e.innerHTML=E.dismissible?n+d:n,b.appendChild(e)}var i=document.createElement("div");i.classList.add("popover-body"),i.innerHTML=E.dismissible&&null===n?a+d:a,b.appendChild(i)}else{var s=document.createElement("div");s.innerHTML=E.template.trim(),b.className=s.firstChild.className,b.innerHTML=s.firstChild.innerHTML;var c=l(".popover-header",b),r=l(".popover-body",b);n&&c&&(c.innerHTML=n.trim()),a&&r&&(r.innerHTML=a.trim())}E.container.appendChild(b),b.style.display="block",b.classList.contains("popover")||b.classList.add("popover"),b.classList.contains(E.animation)||b.classList.add(E.animation),b.classList.contains(o)||b.classList.add(o)}(),A(i,b,E.placement,E.container),b.classList.contains("show")||b.classList.add("show"),E.animation?s(b,M):M()}}),20)},L.hide=function(){clearTimeout(w),w=setTimeout((function(){if(b&&null!==b&&b.classList.contains("show")){if(r.call(i,g),g.defaultPrevented)return;b.classList.remove("show"),E.animation?s(b,I):I()}}),E.delay)},L.dispose=function(){L.hide(),H(),delete i.Popover},(i=l(t)).Popover&&i.Popover.dispose();var D=i.getAttribute("data-trigger"),X=i.getAttribute("data-animation"),O=i.getAttribute("data-placement"),R=i.getAttribute("data-dismissible"),W=i.getAttribute("data-delay"),j=i.getAttribute("data-container");d='',u=c("show","popover"),h=c("shown","popover"),g=c("hide","popover"),p=c("hidden","popover");var z=l(v.container),U=l(j),q=i.closest(".modal"),F=i.closest(".fixed-top"),Y=i.closest(".fixed-bottom");E.template=v.template?v.template:null,E.trigger=v.trigger?v.trigger:D||"hover",E.animation=v.animation&&"fade"!==v.animation?v.animation:X||"fade",E.placement=v.placement?v.placement:O||"top",E.delay=parseInt(v.delay||W,10)||200,E.dismissible=!(!v.dismissible&&"true"!==R),E.container=z||U||F||Y||q||document.body,o="bs-popover-"+E.placement,n=C(),((a=N())||E.template)&&(i.Popover||H(1),i.Popover=L)}function E(t,e){var i,n,a,o,s,d=e||{},u=this,m={};function h(){var t,e,s;(a=o.getElementsByTagName("A"),n.scrollTop=n.isWindow?w().y:i.scrollTop,n.length!==a.length||p()!==n.scrollHeight)&&(n.items=[],n.offsets=[],n.scrollHeight=p(),n.maxScroll=n.scrollHeight-(n.isWindow?window.innerHeight:i.getBoundingClientRect().height),Array.from(a).forEach((function(i){t=i.getAttribute("href"),(e=t&&"#"===t.charAt(0)&&"#"!==t.slice(-1)&&l(t))&&(n.items.push(i),s=e.getBoundingClientRect(),n.offsets.push((n.isWindow?s.top+n.scrollTop:e.offsetTop)-m.offset))})),n.length=n.items.length)}function g(t){var e=t?"addEventListener":"removeEventListener";s[e]("scroll",u.refresh,f),window[e]("resize",u.refresh,f)}function p(){return s.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}function v(){Array.from(a).map((function(t){return t.classList.contains("active")&&t.classList.remove("active")}))}function L(t){var e,a=t;v(),n.activeItem=a,a.classList.add("active");for(var o=[];a.parentNode!==document.body;)((e=(a=a.parentNode).classList).contains("dropdown-menu")||e.contains("nav"))&&o.push(a);o.forEach((function(t){var e=t.previousElementSibling;e&&!e.classList.contains("active")&&e.classList.add("active")})),r.call(i,c("activate","scrollspy",{relatedTarget:n.activeItem}))}u.refresh=function(){if(h(),n.scrollTop>=n.maxScroll){var t=n.items[n.length-1];n.activeItem!==t&&L(t)}else{if(n.activeItem&&n.scrollTop0)return n.activeItem=null,void v();for(var e=n.length;e>-1;)n.activeItem!==n.items[e]&&n.scrollTop>=n.offsets[e]&&(void 0===n.offsets[e+1]||n.scrollTop1&&(p=t[t.length-1]):p=t[0],p}function P(){return l(N().getAttribute("href"))}function H(t){t.preventDefault(),g=t.currentTarget,a.isAnimating||T.show()}T.show=function(){if(!(g=g||n).classList.contains("active")){if(L=l(g.getAttribute("href")),p=N(),v=P(),m=c("hide","tab",{relatedTarget:g}),r.call(p,m),m.defaultPrevented)return;a.isAnimating=!0,p.classList.remove("active"),p.setAttribute("aria-selected","false"),g.classList.add("active"),g.setAttribute("aria-selected","true"),o&&(n.parentNode.classList.contains("dropdown-menu")?o.classList.contains("active")||o.classList.add("active"):o.classList.contains("active")&&o.classList.remove("active")),v.classList.contains("fade")?(v.classList.remove("show"),s(v,C)):C()}},T.dispose=function(){n.removeEventListener("click",H,!1),delete n.Tab},(n=l(t)).Tab&&n.Tab.dispose();var S=n.getAttribute("data-height");a=n.closest(".nav"),o=a&&l(".dropdown-toggle",a);var B=!(!e||!1===A.height||"false"===S);a.isAnimating=!1,n.Tab||n.addEventListener("click",H,!1),B&&(E=P().parentNode),n.Tab=T}function x(t,e){var i,n,a,o,d,u,m=e||{},f=this,g=0,p={};function v(){n.classList.remove("showing"),n.classList.add("show"),r.call(n,d),p.autohide&&f.hide()}function L(){n.classList.add("hide"),r.call(n,u)}function b(){n.classList.remove("show"),p.animation?s(n,L):L()}function y(){clearTimeout(g),i.removeEventListener("click",f.hide,!1),delete i.Toast}f.show=function(){if(n&&!n.classList.contains("show")){if(r.call(n,a),a.defaultPrevented)return;p.animation&&n.classList.add("fade"),n.classList.remove("hide"),h(n),n.classList.add("showing"),p.animation?s(n,v):v()}},f.hide=function(t){if(n&&n.classList.contains("show")){if(r.call(n,o),o.defaultPrevented)return;t?b():g=setTimeout(b,p.delay)}},f.dispose=function(){p.animation?s(n,y):y()},(i=l(t)).Toast&&i.Toast.dispose(),n=i.closest(".toast");var w=i.getAttribute("data-animation"),A=i.getAttribute("data-autohide"),T=i.getAttribute("data-delay");a=c("show","toast"),o=c("hide","toast"),d=c("shown","toast"),u=c("hidden","toast"),p.animation=!1===m.animation||"false"===w?0:1,p.autohide=!1===m.autohide||"false"===A?0:1,p.delay=parseInt(m.delay||T,10)||500,i.Toast||i.addEventListener("click",f.hide,!1),i.Toast=f}function C(t,e){var i,n,a,o,d,u,h,g=e||{},p=this,v=null,L=0,b={};function w(){return i.getAttribute("title")||i.getAttribute("data-title")||i.getAttribute("data-original-title")}function T(t){v&&v.contains(t.target)||t.target===i||i.contains(t.target)||p.hide()}function E(t){var e=t?"addEventListener":"removeEventListener";document[e]("touchstart",T,f),window[e]("resize",p.hide,f)}function k(){E(1),r.call(i,d)}function x(){E(),b.container.removeChild(v),v=null,L=null,r.call(i,h)}function C(t){var e=t?"addEventListener":"removeEventListener";i[e](y,p.show,!1),i[e](m[0],p.show,!1),i[e](m[1],p.hide,!1)}p.show=function(){clearTimeout(L),L=setTimeout((function(){if(null===v){if(r.call(i,o),o.defaultPrevented)return;!1!==function(){if(n=w()){if(v=document.createElement("div"),b.template){var t=document.createElement("div");t.innerHTML=b.template.trim(),v.className=t.firstChild.className,v.innerHTML=t.firstChild.innerHTML,l(".tooltip-inner",v).innerHTML=n.trim()}else{var e=document.createElement("div");e.classList.add("arrow"),v.appendChild(e);var i=document.createElement("div");i.classList.add("tooltip-inner"),v.appendChild(i),i.innerHTML=n}v.style.left="0",v.style.top="0",v.setAttribute("role","tooltip"),v.classList.contains("tooltip")||v.classList.add("tooltip"),v.classList.contains(b.animation)||v.classList.add(b.animation),v.classList.contains(a)||v.classList.add(a),b.container.appendChild(v)}}()&&(A(i,v,b.placement,b.container),v.classList.contains("show")||v.classList.add("show"),b.animation?s(v,k):k())}}),20)},p.hide=function(){clearTimeout(L),L=setTimeout((function(){if(v&&v.classList.contains("show")){if(r.call(i,u),u.defaultPrevented)return;v.classList.remove("show"),b.animation?s(v,x):x()}}),b.delay)},p.toggle=function(){v?p.hide():p.show()},p.dispose=function(){C(),p.hide(),i.setAttribute("title",i.getAttribute("data-original-title")),i.removeAttribute("data-original-title"),delete i.Tooltip},(i=l(t)).Tooltip&&i.Tooltip.dispose();var N=i.getAttribute("data-animation"),P=i.getAttribute("data-placement"),H=i.getAttribute("data-delay"),S=i.getAttribute("data-container"),B=l(g.container),M=l(S),I=i.closest(".modal");o=c("show","tooltip"),d=c("shown","tooltip"),u=c("hide","tooltip"),h=c("hidden","tooltip");var D=i.closest(".fixed-top"),X=i.closest(".fixed-bottom");b.animation=g.animation&&"fade"!==g.animation?g.animation:N||"fade",b.placement=g.placement?g.placement:P||"top",b.template=g.template?g.template:null,b.delay=parseInt(g.delay||H,10)||200,b.container=B||M||D||X||I||document.body,a="bs-tooltip-"+b.placement,(n=w())&&(i.Tooltip||(i.setAttribute("data-original-title",n),i.removeAttribute("title"),C(1)),i.Tooltip=p)}var N={};function P(t){var e=t instanceof Element?t:document;Object.keys(N).forEach((function(t){var i,n;i=N[t][0],n=e.querySelectorAll(N[t][1]),Array.from(n).map((function(t){return new i(t)}))}))}N.Alert=[d,'[data-dismiss="alert"]'],N.Button=[u,'[data-toggle="buttons"]'],N.Carousel=[g,'[data-ride="carousel"]'],N.Collapse=[p,'[data-toggle="collapse"]'],N.Dropdown=[L,'[data-toggle="dropdown"]'],N.Modal=[b,'[data-toggle="modal"]'],N.Popover=[T,'[data-toggle="popover"],[data-tip="popover"]'],N.ScrollSpy=[E,'[data-spy="scroll"]'],N.Tab=[k,'[data-toggle="tab"]'],N.Toast=[x,'[data-dismiss="toast"]'],N.Tooltip=[C,'[data-toggle="tooltip"],[data-tip="tooltip"]'],document.body?P():document.addEventListener("DOMContentLoaded",(function t(){P(),document.removeEventListener("DOMContentLoaded",t,!1)}),!1);return{Alert:d,Button:u,Carousel:g,Collapse:p,Dropdown:L,Modal:b,Popover:T,ScrollSpy:E,Tab:k,Toast:x,Tooltip:C,initCallback:P,removeDataAPI:function(t){var e=t instanceof Element?t:document;Object.keys(N).forEach((function(t){var i,n;i=t,n=e.querySelectorAll(N[t][1]),Array.from(n).map((function(t){return t[i].dispose()}))}))},componentsInit:N,Version:"4.1.0"}})); diff --git a/dist/bootstrap-native.esm.js b/dist/bootstrap-native.esm.js index 1cd4baa9..ee7adb62 100644 --- a/dist/bootstrap-native.esm.js +++ b/dist/bootstrap-native.esm.js @@ -1,16 +1,63 @@ /*! - * Native JavaScript for Bootstrap v4.0.8 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap v4.1.0 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2021 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ +/** + * A global namespace for 'transitionend' string. + * @type {string} + */ const transitionEndEvent = 'webkitTransition' in document.head.style ? 'webkitTransitionEnd' : 'transitionend'; +/** + * A global namespace for CSS3 transition support. + * @type {boolean} + */ const supportTransition = 'webkitTransition' in document.head.style || 'transition' in document.head.style; -const transitionDuration = 'webkitTransition' in document.head.style ? 'webkitTransitionDuration' : 'transitionDuration'; +/** + * A global namespace for 'transitionDelay' string. + * @type {string} + */ +const transitionDelay = 'webkitTransition' in document.head.style ? 'webkitTransitionDelay' : 'transitionDelay'; +/** + * A global namespace for 'transitionProperty' string. + * @type {string} + */ const transitionProperty = 'webkitTransition' in document.head.style ? 'webkitTransitionProperty' : 'transitionProperty'; +/** + * Utility to get the computed transitionDelay + * from Element in miliseconds. + * + * @param {Element} element target + * @return {number} the value in miliseconds + */ +function getElementTransitionDelay(element) { + const computedStyle = getComputedStyle(element); + const propertyValue = computedStyle[transitionProperty]; + const delayValue = computedStyle[transitionDelay]; + const delayScale = delayValue.includes('ms') ? 1 : 1000; + const duration = supportTransition && propertyValue && propertyValue !== 'none' + ? parseFloat(delayValue) * delayScale : 0; + + return !Number.isNaN(duration) ? duration : 0; +} + +/** + * A global namespace for 'transitionDuration' string. + * @type {string} + */ +const transitionDuration = 'webkitTransition' in document.head.style ? 'webkitTransitionDuration' : 'transitionDuration'; + +/** + * Utility to get the computed transitionDuration + * from Element in miliseconds. + * + * @param {Element} element target + * @return {number} the value in miliseconds + */ function getElementTransitionDuration(element) { const computedStyle = getComputedStyle(element); const propertyValue = computedStyle[transitionProperty]; @@ -22,88 +69,235 @@ function getElementTransitionDuration(element) { return !Number.isNaN(duration) ? duration : 0; } +/** + * Utility to make sure callbacks are consistently + * called when transition ends. + * + * @param {Element} element target + * @param {function} handler `transitionend` callback + */ function emulateTransitionEnd(element, handler) { let called = 0; const endEvent = new Event(transitionEndEvent); const duration = getElementTransitionDuration(element); + const delay = getElementTransitionDelay(element); if (duration) { - element.addEventListener(transitionEndEvent, function transitionEndWrapper(e) { + /** + * Wrap the handler in on -> off callback + * @param {Event} e Event object + * @callback + */ + const transitionEndWrapper = (e) => { if (e.target === element) { handler.apply(element, [e]); element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } - }); + }; + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); - }, duration + 17); + }, duration + delay + 17); } else { handler.apply(element, [endEvent]); } } +/** + * Utility to check if target is typeof Element + * or find one that matches a selector. + * + * @param {Element | string} selector the input selector or target element + * @param {Element | null} parent optional Element to look into + * @return {Element | null} the Element or result of the querySelector + */ function queryElement(selector, parent) { const lookUp = parent && parent instanceof Element ? parent : document; return selector instanceof Element ? selector : lookUp.querySelector(selector); } +/** + * Check class in Element.classList + * + * @param {Element} element target + * @param {string} classNAME to check + * @return {boolean} + */ function hasClass(element, classNAME) { return element.classList.contains(classNAME); } +/** + * Remove class from Element.classList + * + * @param {Element} element target + * @param {string} classNAME to remove + */ function removeClass(element, classNAME) { element.classList.remove(classNAME); } +/** + * A global namespace for 'addEventListener' string. + * @type {string} + */ const addEventListener = 'addEventListener'; +/** + * A global namespace for 'removeEventListener' string. + * @type {string} + */ const removeEventListener = 'removeEventListener'; +const componentData = new Map(); +/** + * An interface for web components background data. + * @see https://github.com/thednp/bootstrap.native/blob/master/src/components/base-component.js + */ +const Data = { + /** + * Sets web components data. + * @param {Element} element target element + * @param {string} component the component's name or a unique key + * @param {any} instance the component instance + */ + set: (element, component, instance) => { + if (!componentData.has(component)) { + componentData.set(component, new Map()); + } + + const instanceMap = componentData.get(component); + instanceMap.set(element, instance); + }, + + /** + * Returns all instances for specified component. + * @param {string} component the component's name or a unique key + * @returns {?any} all the component instances + */ + getAllFor: (component) => { + if (componentData.has(component)) { + return componentData.get(component) || null; + } + return null; + }, + + /** + * Returns the instance associated with the target. + * @param {Element} element target element + * @param {string} component the component's name or a unique key + * @returns {?any} the instance + */ + get: (element, component) => { + const allForC = Data.getAllFor(component); + if (allForC && allForC.has(element)) { + return allForC.get(element) || null; + } + return null; + }, + + /** + * Removes web components data. + * @param {Element} element target element + * @param {string} component the component's name or a unique key + * @param {any} instance the component instance + */ + remove: (element, component) => { + if (!componentData.has(component)) return; + + const instanceMap = componentData.get(component); + instanceMap.delete(element); + + if (instanceMap.size === 0) { + componentData.delete(component); + } + }, +}; + +/** + * Shortcut for `Data.get(a, b)` to setup usable component static method. + * @type {SHORTER.getInstance} + */ +const getInstance = (element, component) => Data.get(element, component); + +/** + * Global namespace for most components `fade` class. + */ const fadeClass = 'fade'; +/** + * Global namespace for most components `show` class. + */ const showClass = 'show'; +/** + * Global namespace for most components `dismiss` option. + */ const dataBsDismiss = 'data-bs-dismiss'; +/** + * Returns a namespaced `CustomEvent` specific to each component. + * @param {string} namespacedEventType Event.type + * @param {AddEventListenerOptions | boolean} eventProperties Event.options | Event.properties + * @returns {CustomEvent} a new namespaced event + */ function bootstrapCustomEvent(namespacedEventType, eventProperties) { const OriginalCustomEvent = new CustomEvent(namespacedEventType, { cancelable: true }); if (eventProperties instanceof Object) { - Object.keys(eventProperties).forEach((key) => { - Object.defineProperty(OriginalCustomEvent, key, { - value: eventProperties[key], - }); - }); + Object.assign(OriginalCustomEvent, eventProperties); } return OriginalCustomEvent; } +/** + * The raw value or a given component option. + * + * @typedef {string | Element | Function | number | boolean | null} niceValue + */ + +/** + * Utility to normalize component options + * + * @param {any} value the input value + * @return {niceValue} the normalized value + */ function normalizeValue(value) { - if (value === 'true') { + if (value === 'true') { // boolean return true; } - if (value === 'false') { + if (value === 'false') { // boolean return false; } - if (!Number.isNaN(+value)) { + if (!Number.isNaN(+value)) { // number return +value; } - if (value === '' || value === 'null') { + if (value === '' || value === 'null') { // null return null; } - // string / function / Element / Object + // string / function / Element / object return value; } +/** + * Utility to normalize component options + * + * @param {Element} element target + * @param {object} defaultOps component default options + * @param {object} inputOps component instance options + * @param {string} ns component namespace + * @return {object} normalized component options object + */ function normalizeOptions(element, defaultOps, inputOps, ns) { + // @ts-ignore + const data = { ...element.dataset }; const normalOps = {}; const dataOps = {}; - const data = { ...element.dataset }; Object.keys(data) .forEach((k) => { @@ -133,26 +327,58 @@ function normalizeOptions(element, defaultOps, inputOps, ns) { return normalOps; } +var version = "4.1.0"; + +const Version = version; + /* Native JavaScript for Bootstrap 5 | Base Component ----------------------------------------------------- */ +/** + * Returns a new `BaseComponent` instance. + */ class BaseComponent { - constructor(name, target, defaults, config) { + /** + * @param {Element | string} target Element or selector string + * @param {BSN.ComponentOptions?} config + */ + constructor(target, config) { const self = this; const element = queryElement(target); - if (element[name]) element[name].dispose(); + if (!element) return; + + const prevInstance = getInstance(element, self.name); + if (prevInstance) prevInstance.dispose(); + + /** @private */ self.element = element; - if (defaults && Object.keys(defaults).length) { - self.options = normalizeOptions(element, defaults, (config || {}), 'bs'); + if (self.defaults && Object.keys(self.defaults).length) { + /** @private */ + self.options = normalizeOptions(element, self.defaults, (config || {}), 'bs'); } - element[name] = self; + + Data.set(element, self.name, self); } - dispose(name) { + /* eslint-disable */ + /** @static */ + get version() { return Version; } + /* eslint-enable */ + + /** @static */ + get name() { return this.constructor.name; } + + /** @static */ + get defaults() { return this.constructor.defaults; } + + /** + * Removes component from target element; + */ + dispose() { const self = this; - self.element[name] = null; + Data.remove(self.element, self.name); Object.keys(self).forEach((prop) => { self[prop] = null; }); } } @@ -167,13 +393,27 @@ const alertComponent = 'Alert'; const alertSelector = `.${alertString}`; const alertDismissSelector = `[${dataBsDismiss}="${alertString}"]`; +/** + * Static method which returns an existing `Alert` instance associated + * to a target `Element`. + * + * @type {BSN.GetInstance} + */ +const getAlertInstance = (element) => getInstance(element, alertComponent); + // ALERT CUSTOM EVENTS // =================== +/** @type {BSN.AlertEvent.close} */ const closeAlertEvent = bootstrapCustomEvent(`close.bs.${alertString}`); +/** @type {BSN.AlertEvent.closed} */ const closedAlertEvent = bootstrapCustomEvent(`closed.bs.${alertString}`); -// ALERT EVENT HANDLERS -// ==================== +// ALERT EVENT HANDLER +// =================== +/** + * Alert `transitionend` callback. + * @param {Alert} self target Alert instance + */ function alertTransitionEnd(self) { const { element, relatedTarget } = self; toggleAlertHandler(self); @@ -187,6 +427,11 @@ function alertTransitionEnd(self) { // ALERT PRIVATE METHOD // ==================== +/** + * Toggle on / off the `click` event listener. + * @param {Alert} self the target alert instance + * @param {boolean | number} add + */ function toggleAlertHandler(self, add) { const action = add ? addEventListener : removeEventListener; if (self.dismiss) self.dismiss[action]('click', self.close); @@ -194,9 +439,11 @@ function toggleAlertHandler(self, add) { // ALERT DEFINITION // ================ +/** Creates a new Alert instance. */ class Alert extends BaseComponent { + /** @param {Element | string} target element or selector */ constructor(target) { - super(alertComponent, target); + super(target); // bind const self = this; @@ -204,19 +451,38 @@ class Alert extends BaseComponent { const { element } = self; // the dismiss button + /** @private */ self.dismiss = queryElement(alertDismissSelector, element); + /** @private */ self.relatedTarget = null; // add event listener toggleAlertHandler(self, 1); } + /* eslint-disable */ + /** + * Returns component name string. + * @readonly @static + */ + get name() { return alertComponent; } + /* eslint-enable */ + // ALERT PUBLIC METHODS // ==================== + /** + * Private method that: + * * Hides the `.alert` element from the user, + * * Destroy the instance once animation is complete, + * * Removes the element from the DOM. + * + * @param {Event} e most likely the `click` event + * @returns {void} + */ close(e) { const target = e ? e.target : null; const self = e - ? e.target.closest(alertSelector)[alertComponent] + ? getAlertInstance(e.target.closest(alertSelector)) : this; const { element } = self; @@ -236,24 +502,47 @@ class Alert extends BaseComponent { } } + /** Remove the component from target element. */ dispose() { toggleAlertHandler(this); - super.dispose(alertComponent); + super.dispose(); } } -Alert.init = { - component: alertComponent, +Object.assign(Alert, { selector: alertSelector, - constructor: Alert, -}; - + /** + * An `Alert` initialization callback. + * @type {BSN.InitCallback} + */ + callback: (element) => new Alert(element), + getInstance: getAlertInstance, +}); + +/** + * Add class to Element.classList + * + * @param {Element} element target + * @param {string} classNAME to add + */ function addClass(element, classNAME) { element.classList.add(classNAME); } +/** + * A global namespace for aria-pressed. + * @type {string} + */ +const ariaPressed = 'aria-pressed'; + +/** + * Global namespace for most components active class. + */ const activeClass = 'active'; +/** + * Global namespace for most components `toggle` option. + */ const dataBsToggle = 'data-bs-toggle'; /* Native JavaScript for Bootstrap 5 | Button @@ -264,7 +553,14 @@ const dataBsToggle = 'data-bs-toggle'; const buttonString = 'button'; const buttonComponent = 'Button'; const buttonSelector = `[${dataBsToggle}="${buttonString}"]`; -const ariaPressed = 'aria-pressed'; + +/** + * Static method which returns an existing `Button` instance associated + * to a target `Element`. + * + * @type {BSN.GetInstance',sanitizeFn:null,dismissible:!1,animation:!0,delay:200},ke=/(iPhone|iPod|iPad)/,Pe=navigator.userAgentData?navigator.userAgentData.brands.some(t=>ke.test(t.brand)):ke.test(navigator.userAgent),Ne=d("show.bs.popover"),He=d("shown.bs.popover"),Le=d("hide.bs.popover"),Se=d("hidden.bs.popover");function Oe(){nt(this)}function De({target:t}){const e=this,{popover:n,element:o}=e;n&&n.contains(t)||t===o||o.contains(t)||e.hide()}function Ie(t,e){const n=e?c:"removeEventListener",{element:o,options:i}=t,{trigger:s,dismissible:a}=i;t.enabled=!!e,"hover"===s?(o[n]("mousedown",t.show),o[n]("mouseenter",t.show),be(o)&&o[n]("mousemove",t.update,A),a||o[n]("mouseleave",t.hide)):"click"===s?o[n](s,t.toggle):"focus"===s&&(Pe&&o[n]("click",Oe),o[n]("focusin",t.show))}function Be(t,e){const n=e?c:"removeEventListener",{options:o,element:i,btn:s}=t,{trigger:a,dismissible:r}=o;r?s&&s[n]("click",t.hide):("focus"===a&&i[n]("focusout",t.hide),"hover"===a&&document[n]("touchstart",De,A)),be(i)||(window[n]("scroll",t.update,A),window[n]("resize",t.update,A))}function Me(t){t.element.dispatchEvent(He)}function Re(t){!function(t){const{element:e,popover:n}=t;e.removeAttribute("aria-describedby"),n.remove(),t.timer=null}(t),t.element.dispatchEvent(Se)}class je extends u{constructor(t,e){Ce.container=Ae(a(t)),super("Popover",t,Ce,e);const{element:n}=this;this.timer=null,this.popover=null,this.arrow=null,this.btn=null,this.enabled=!1,this.id="popover-"+Ee(n);const{options:o}=this;if(this.options.container=be(n)?Ce.container:a(o.container),Ce.container=null,!o.content)return;!function(t){const{id:e,options:n}=t,{animation:o,customClass:i,sanitizeFn:s,placement:l,dismissible:c}=n;let{title:d,content:h}=n;const{template:u,btnClose:p}=n,m="bs-popover-"+ge[l];let f;if("object"==typeof u)f=u;else{const t=document.createElement("div");xe(t,u,s),f=t.firstChild}t.popover=f.cloneNode(!0);const{popover:g}=t;g.setAttribute("id",e),g.setAttribute("role","tooltip");const v=a(".popover-header",g),w=a(".popover-body",g);t.arrow=a(".popover-arrow",g),c&&(d?d instanceof Element?xe(d,p,s):d+=p:(v&&v.remove(),h instanceof Element?xe(h,p,s):h+=p)),d&&v&&xe(v,d,s),h&&w&&xe(w,h,s),[t.btn]=g.getElementsByClassName("btn-close"),r(g,"popover")||b(g,"popover"),o&&!r(g,"fade")&&b(g,"fade"),i&&!r(g,i)&&b(g,i),r(g,m)||b(g,m)}(this);const{container:i}=this.options,s=getComputedStyle(n).position,l=getComputedStyle(i).position,c=i===document.body,d=!c&&"static"===l,h=!c&&"relative"===l,u=d&&Te(i);this.positions={elementPosition:s,containerIsRelative:h,containerIsStatic:d,relContainer:u},this.update=this.update.bind(this),Ie(this,1)}update(t){we(this,t)}toggle(t){const e=t?this.Popover:this,{popover:n,options:o}=e;ve(n,o.container)?e.hide():e.show()}show(t){const e=t?this.Popover:this,{element:n,popover:o,options:i,id:a}=e,{container:l}=i;if(clearTimeout(e.timer),!ve(o,l)){if(n.dispatchEvent(Ne),Ne.defaultPrevented)return;l.append(o),n.setAttribute("aria-describedby",a),e.update(t),r(o,"show")||b(o,"show"),Be(e,1),i.animation?s(o,()=>Me(e)):Me(e)}}hide(t){let e;if(t&&this.Popover)e=this.Popover;else if(t){const t=this.closest(".popover"),n=t&&a(`[aria-describedby="${t.id}"]`);e=n.Popover}else e=this;const{element:n,popover:o,options:i}=e;clearTimeout(e.timer),e.timer=setTimeout(()=>{if(ve(o,i.container)){if(n.dispatchEvent(Le),Le.defaultPrevented)return;l(o,"show"),Be(e),i.animation?s(o,()=>Re(e)):Re(e)}},i.delay+17)}enable(){const t=this,{enabled:e}=t;e||(Ie(t,1),t.enabled=!e)}disable(){const t=this,{enabled:e,popover:n,options:o}=t;e&&(ve(n,o.container)&&o.animation?(t.hide(),setTimeout(()=>Ie(t),i(n)+o.delay+17)):Ie(t),t.enabled=!e)}toggleEnabled(){this.enabled?this.disable():this.enable()}dispose(){const t=this,{popover:e,options:n}=t,{container:o,animation:i}=n;i&&ve(e,o)?(t.options.delay=0,t.hide(),s(e,()=>Ie(t))):Ie(t),super.dispose("Popover")}}je.init={component:"Popover",selector:'[data-bs-toggle="popover"],[data-tip="popover"]',constructor:je};const We={offset:10,target:null},Fe=d("activate.bs.scrollspy");function qe(t){const{target:e,scrollTarget:n,isWindow:o,options:i,itemsLength:s,scrollHeight:r}=t,{offset:l}=i,c=e.getElementsByTagName("A");if(t.scrollTop=o?n.pageYOffset:n.scrollTop,s!==c.length||ze(n)!==r){let e,i,s;t.items=[],t.offsets=[],t.scrollHeight=ze(n),t.maxScroll=t.scrollHeight-function({element:t,isWindow:e}){return e?window.innerHeight:t.getBoundingClientRect().height}(t),Array.from(c).forEach(n=>{e=n.getAttribute("href"),i=e&&"#"===e.charAt(0)&&"#"!==e.slice(-1)&&a(e),i&&(t.items.push(n),s=i.getBoundingClientRect(),t.offsets.push((o?s.top+t.scrollTop:i.offsetTop)-l))}),t.itemsLength=t.items.length}}function ze(t){return t.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}function Xe(t){Array.from(t.getElementsByTagName("A")).forEach(t=>{r(t,"active")&&l(t,"active")})}function $e(t,e){const{target:n,element:o}=t;Xe(n),t.activeItem=e,b(e,"active");const i=[];let s=e;for(;s!==document.body;)s=s.parentNode,(r(s,"nav")||r(s,"dropdown-menu"))&&i.push(s);i.forEach(t=>{const e=t.previousElementSibling;e&&!r(e,"active")&&b(e,"active")}),Fe.relatedTarget=e,o.dispatchEvent(Fe)}function Ye(t,e){const n=e?c:"removeEventListener";t.scrollTarget[n]("scroll",t.refresh,A)}class Ve extends u{constructor(t,e){super("ScrollSpy",t,We,e);const{element:n,options:o}=this;this.target=a(o.target),this.target&&(this.scrollTarget=n.clientHeight=o){const e=s[i-1];return void(a!==e&&$e(t,e))}const{offsets:r}=t;if(a&&n0)return t.activeItem=null,void Xe(e);s.forEach((e,o)=>{a!==e&&n>=r[o]&&(void 0===r[o+1]||n{e.style.height=_e+"px",T(e),s(e,()=>sn(t))},50):n.isAnimating=!1,Ue.relatedTarget=tn,Ke.dispatchEvent(Ue)}function rn(t){const{tabContent:e}=t;e&&(en.style.float="left",Qe.style.float="left",nn=en.scrollHeight),Ge.relatedTarget=tn,Je.relatedTarget=Ke,Ke.dispatchEvent(Ge),Ge.defaultPrevented||(b(Qe,"active"),l(en,"active"),e&&(_e=Qe.scrollHeight,on=_e===nn,b(e,"collapsing"),e.style.height=nn+"px",T(e),en.style.float="",Qe.style.float=""),r(Qe,"fade")?setTimeout(()=>{b(Qe,"show"),s(Qe,()=>{an(t)})},20):an(t),tn.dispatchEvent(Je))}function ln({nav:t}){const e=t.getElementsByClassName("active");return 1!==e.length||tt.some(t=>r(e[0].parentNode,t))?e.length>1&&(tn=e[e.length-1]):[tn]=e,tn}function cn(t){return a(ln(t).getAttribute("href"))}function dn(t,e){const n=e?c:"removeEventListener";t.element[n]("click",hn)}function hn(t){const e=this.Tab;t.preventDefault(),e.nav.isAnimating||e.show()}class un extends u{constructor(t){super("Tab",t);const{element:n}=this;this.nav=n.closest(".nav");const{nav:o}=this;this.dropdown=o&&a(`.${tt[0]}-toggle`,o),en=cn(this),this.tabContent=e&&en.closest(".tab-content"),nn=en.scrollHeight,o.isAnimating=!1,dn(this,1)}show(){const t=this,{element:e,nav:n,dropdown:o}=t;if(Ke=e,!r(Ke,"active")){if(Qe=a(Ke.getAttribute("href")),tn=ln({nav:n}),en=cn({nav:n}),Ze.relatedTarget=Ke,tn.dispatchEvent(Ze),Ze.defaultPrevented)return;n.isAnimating=!0,l(tn,"active"),tn.setAttribute("aria-selected","false"),b(Ke,"active"),Ke.setAttribute("aria-selected","true"),o&&(r(e.parentNode,"dropdown-menu")?r(o,"active")||b(o,"active"):r(o,"active")&&l(o,"active")),r(en,"fade")?(l(en,"show"),s(en,()=>rn(t))):rn(t)}}dispose(){dn(this),super.dispose("Tab")}}un.init={component:"Tab",selector:'[data-bs-toggle="tab"]',constructor:un};const pn={animation:!0,autohide:!0,delay:500},mn=d("show.bs.toast"),fn=d("hide.bs.toast"),gn=d("shown.bs.toast"),vn=d("hidden.bs.toast");function bn(t){const{element:e,options:n}=t;l(e,"showing"),e.dispatchEvent(gn),n.autohide&&t.hide()}function wn(t){const{element:e}=t;l(e,"showing"),l(e,"show"),b(e,"hide"),e.dispatchEvent(vn)}function yn(t,e){const n=e?c:"removeEventListener";t.dismiss&&t.dismiss[n]("click",t.hide)}function En(t){clearTimeout(t.timer),yn(t)}class An extends u{constructor(t,e){super("Toast",t,pn,e);const{element:n,options:o}=this;o.animation&&!r(n,"fade")?b(n,"fade"):!o.animation&&r(n,"fade")&&l(n,"fade"),this.dismiss=a('[data-bs-dismiss="toast"]',n),this.show=this.show.bind(this),this.hide=this.hide.bind(this),yn(this,1)}show(){const t=this,{element:e}=t;if(e&&!r(e,"show")){if(e.dispatchEvent(mn),mn.defaultPrevented)return;clearTimeout(t.timer),t.timer=setTimeout(()=>function(t){const{element:e,options:n}=t;l(e,"hide"),T(e),b(e,"show"),b(e,"showing"),n.animation?s(e,()=>bn(t)):bn(t)}(t),10)}}hide(t){const e=this,{element:n,options:o}=e;if(n&&r(n,"show")){if(n.dispatchEvent(fn),fn.defaultPrevented)return;clearTimeout(e.timer),e.timer=setTimeout(()=>function(t){const{element:e,options:n}=t;b(e,"showing"),n.animation?(T(e),s(e,()=>wn(t))):wn(t)}(e),t?10:o.delay)}}dispose(){const t=this,{element:e,options:n}=t;t.hide(1),n.animation?s(e,()=>En(t)):En(t),super.dispose("Toast")}}An.init={component:"Toast",selector:".toast",constructor:An};const Tn={template:'',title:null,customClass:null,placement:"top",sanitizeFn:null,animation:!0,html:!1,delay:200},xn=d("show.bs.tooltip"),Cn=d("shown.bs.tooltip"),kn=d("hide.bs.tooltip"),Pn=d("hidden.bs.tooltip");function Nn(t){const{element:e}=t;On(t),e.hasAttribute("data-original-title")&&Dn(t)}function Hn(t,e){const n=e?c:"removeEventListener";document[n]("touchstart",In,A),be(t.element)||(window[n]("scroll",t.update,A),window[n]("resize",t.update,A))}function Ln(t){Hn(t,1),t.element.dispatchEvent(Cn)}function Sn(t){Hn(t),function(t){const{element:e,tooltip:n}=t;e.removeAttribute("aria-describedby"),n.remove(),t.timer=null}(t),t.element.dispatchEvent(Pn)}function On(t,e){const n=e?c:"removeEventListener",{element:o}=t;be(o)&&o[n]("mousemove",t.update,A),o[n]("mousedown",t.show),o[n]("mouseenter",t.show),o[n]("mouseleave",t.hide)}function Dn(t,e){const n=["data-original-title","title"],{element:o}=t;o.setAttribute(n[e?0:1],e||o.getAttribute(n[0])),o.removeAttribute(n[e?1:0])}function In({target:t}){const{tooltip:e,element:n}=this;e.contains(t)||t===n||n.contains(t)||this.hide()}class Bn extends u{constructor(t,e){const n=a(t);Tn.title=n.getAttribute("title"),Tn.container=Ae(n),super("Tooltip",n,Tn,e);this.tooltip=null,this.arrow=null,this.timer=null,this.enabled=!1;const{options:o}=this;if(this.options.container=be(n)?Tn.container:a(o.container),Tn.container=null,Tn.title=null,!o.title)return;In.bind(this),this.update=this.update.bind(this),n.hasAttribute("title")&&Dn(this,o.title),this.id="tooltip-"+Ee(n),function(t){const{options:e,id:n}=t,{title:o,template:i,customClass:s,animation:l,placement:c,sanitizeFn:d}=e,h="bs-tooltip-"+ge[c];if(!o)return;let u;if("object"==typeof i)u=i;else{const t=document.createElement("div");xe(t,i,d),u=t.firstChild}t.tooltip=u.cloneNode(!0);const{tooltip:p}=t;xe(a(".tooltip-inner",p),o,d),p.setAttribute("id",n),p.setAttribute("role","tooltip"),t.arrow=a(".tooltip-arrow",p),r(p,"tooltip")||b(p,"tooltip"),l&&!r(p,"fade")&&b(p,"fade"),s&&!r(p,s)&&b(p,s),r(p,h)||b(p,h)}(this);const{container:i}=this.options,s=getComputedStyle(n).position,l=getComputedStyle(i).position,c=i===document.body,d=!c&&"static"===l,h=!c&&"relative"===l,u=d&&Te(i);this.positions={elementPosition:s,containerIsRelative:h,containerIsStatic:d,relContainer:u},On(this,1)}show(t){const e=t?this.Tooltip:this,{options:n,tooltip:o,element:i,id:a}=e,{container:l,animation:c}=n;if(clearTimeout(e.timer),!ve(o,l)){if(i.dispatchEvent(xn),xn.defaultPrevented)return;l.append(o),i.setAttribute("aria-describedby",a),e.update(t),r(o,"show")||b(o,"show"),c?s(o,()=>Ln(e)):Ln(e)}}hide(t){const e=t?this.Tooltip:this,{options:n,tooltip:o,element:i}=e;clearTimeout(e.timer),e.timer=setTimeout(()=>{if(ve(o,n.container)){if(i.dispatchEvent(kn),kn.defaultPrevented)return;l(o,"show"),n.animation?s(o,()=>Sn(e)):Sn(e)}},n.delay)}update(t){we(this,t)}toggle(){const{tooltip:t,options:e}=this;ve(t,e.container)?this.hide():this.show()}enable(){const t=this,{enabled:e}=t;e||(On(t,1),t.enabled=!e)}disable(){const t=this,{tooltip:e,options:n,enabled:o}=t;o&&(!ve(e,n.container)&&n.animation?(t.hide(),setTimeout(()=>On(t),i(e)+n.delay+17)):On(t),t.enabled=!o)}toggleEnabled(){this.enabled?this.disable():this.enable()}dispose(){const t=this,{tooltip:e,options:n}=t;n.animation&&ve(e,n.container)?(n.delay=0,t.hide(),s(e,()=>Nn(t))):Nn(t),super.dispose("Tooltip")}}Bn.init={component:"Tooltip",selector:'[data-bs-toggle="tooltip"],[data-tip="tooltip"]',constructor:Bn};const Mn={Alert:v.init,Button:E.init,Carousel:$.init,Collapse:_.init,Dropdown:Ct.init,Modal:ee.init,Offcanvas:fe.init,Popover:je.init,ScrollSpy:Ve.init,Tab:un.init,Toast:An.init,Tooltip:Bn.init};function Rn(t){const e=t instanceof Element?t:document;Object.keys(Mn).forEach(t=>{const{constructor:n,selector:o}=Mn[t];var i,s;i=n,s=e.querySelectorAll(o),Array.from(s).forEach(t=>new i(t))})}document.body?Rn():document.addEventListener("DOMContentLoaded",()=>Rn(),{once:!0});const jn={Alert:v,Button:E,Carousel:$,Collapse:_,Dropdown:Ct,Modal:ee,Offcanvas:fe,Popover:je,ScrollSpy:Ve,Tab:un,Toast:An,Tooltip:Bn,initCallback:Rn,Version:"4.0.8"};export{jn as default}; +// Native JavaScript for Bootstrap v4.1.0 | 2021 © dnp_theme | MIT-License +const t="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",e="webkitTransition"in document.head.style||"transition"in document.head.style,n="webkitTransition"in document.head.style?"webkitTransitionDelay":"transitionDelay",o="webkitTransition"in document.head.style?"webkitTransitionProperty":"transitionProperty";const s="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration";function i(t){const n=getComputedStyle(t),i=n[o],a=n[s],r=a.includes("ms")?1:1e3,l=e&&i&&"none"!==i?parseFloat(a)*r:0;return Number.isNaN(l)?0:l}function a(s,a){let r=0;const l=new Event(t),c=i(s),d=function(t){const s=getComputedStyle(t),i=s[o],a=s[n],r=a.includes("ms")?1:1e3,l=e&&i&&"none"!==i?parseFloat(a)*r:0;return Number.isNaN(l)?0:l}(s);if(c){const e=n=>{n.target===s&&(a.apply(s,[n]),s.removeEventListener(t,e),r=1)};s.addEventListener(t,e),setTimeout(()=>{r||s.dispatchEvent(l)},c+d+17)}else a.apply(s,[l])}function r(t,e){const n=e&&e instanceof Element?e:document;return t instanceof Element?t:n.querySelector(t)}function l(t,e){return t.classList.contains(e)}function c(t,e){t.classList.remove(e)}const d="addEventListener",u=new Map,h={set:(t,e,n)=>{u.has(e)||u.set(e,new Map);u.get(e).set(t,n)},getAllFor:t=>u.has(t)&&u.get(t)||null,get:(t,e)=>{const n=h.getAllFor(e);return n&&n.has(t)&&n.get(t)||null},remove:(t,e)=>{if(!u.has(e))return;const n=u.get(e);n.delete(t),0===n.size&&u.delete(e)}},m=(t,e)=>h.get(t,e);function p(t,e){const n=new CustomEvent(t,{cancelable:!0});return e instanceof Object&&Object.assign(n,e),n}function f(t){return"true"===t||"false"!==t&&(Number.isNaN(+t)?""===t||"null"===t?null:t:+t)}class g{constructor(t,e){const n=this,o=r(t);if(!o)return;const s=m(o,n.name);s&&s.dispose(),n.element=o,n.defaults&&Object.keys(n.defaults).length&&(n.options=function(t,e,n,o){const s={...t.dataset},i={},a={};return Object.keys(s).forEach(t=>{const e=t.includes(o)?t.replace(o,"").replace(/[A-Z]/,t=>t.toLowerCase()):t;a[e]=f(s[t])}),Object.keys(n).forEach(t=>{n[t]=f(n[t])}),Object.keys(e).forEach(t=>{i[t]=t in n?n[t]:t in a?a[t]:e[t]}),i}(o,n.defaults,e||{},"bs")),h.set(o,n.name,n)}get version(){return"4.1.0"}get name(){return this.constructor.name}get defaults(){return this.constructor.defaults}dispose(){const t=this;h.remove(t.element,t.name),Object.keys(t).forEach(e=>{t[e]=null})}}const v=t=>m(t,"Alert"),b=p("close.bs.alert"),w=p("closed.bs.alert");function y(t){const{element:e,relatedTarget:n}=t;E(t),n&&(w.relatedTarget=n),e.dispatchEvent(w),t.dispose(),e.remove()}function E(t,e){const n=e?d:"removeEventListener";t.dismiss&&t.dismiss[n]("click",t.close)}class A extends g{constructor(t){super(t);const{element:e}=this;this.dismiss=r('[data-bs-dismiss="alert"]',e),this.relatedTarget=null,E(this,1)}get name(){return"Alert"}close(t){const e=t?t.target:null,n=t?v(t.target.closest(".alert")):this,{element:o}=n;if(n&&o&&l(o,"show")){if(e&&(b.relatedTarget=e,n.relatedTarget=e),o.dispatchEvent(b),b.defaultPrevented)return;c(o,"show"),l(o,"fade")?a(o,()=>y(n)):y(n)}}dispose(){E(this),super.dispose()}}function T(t,e){t.classList.add(e)}Object.assign(A,{selector:".alert",callback:t=>new A(t),getInstance:v});const k="data-bs-toggle",x=t=>m(t,"Button");function C(t,e){const n=e?d:"removeEventListener";t.element[n]("click",t.toggle)}class N extends g{constructor(t){super(t);const{element:e}=this;this.isActive=l(e,"active"),e.setAttribute("aria-pressed",!!this.isActive),C(this,1)}get name(){return"Button"}toggle(t){t&&t.preventDefault();const e=t?x(this):this,{element:n}=e;if(l(n,"disabled"))return;e.isActive=l(n,"active");const{isActive:o}=e,s=o?"false":"true";(o?c:T)(n,"active"),n.setAttribute("aria-pressed",s)}dispose(){C(this),super.dispose("Button")}}Object.assign(N,{selector:'[data-bs-toggle="button"]',callback:t=>new N(t),getInstance:x});const H=!!(()=>{let t=!1;try{const e=Object.defineProperty({},"passive",{get:()=>(t=!0,t)});document.addEventListener("DOMContentLoaded",(function t(){document.removeEventListener("DOMContentLoaded",t,e)}),e)}catch(t){throw Error("Passive events are not supported")}return t})()&&{passive:!0};function S(t){return t.offsetHeight}function L(t){const e=t.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight;return e.top<=n&&e.bottom>=0}const P='[data-bs-ride="carousel"]',O={pause:"hover",keyboard:!1,touch:!0,interval:5e3},I={relatedTarget:null,direction:"left",from:0,to:1},D=t=>m(t,"Carousel");let j=0,B=0,R=0;const W=p("slide.bs.carousel",I),M=p("slid.bs.carousel",I);function F(t){const e=t.target,n=D(e.closest(P)),{element:o,isAnimating:s}=n;l(o,"paused")||(T(o,"paused"),s||(clearInterval(n.timer),n.timer=null))}function z(t){const{target:e}=t,n=D(e.closest(P)),{isPaused:o,isAnimating:s,element:i}=n;!o&&l(i,"paused")&&(c(i,"paused"),s||(clearInterval(n.timer),n.timer=null,n.cycle()))}function q(t){t.preventDefault();const{target:e}=t,n=D(e.closest(P));if(n.isAnimating)return;const o=e.getAttribute("data-bs-slide-to");e&&!l(e,"active")&&o&&n.to(+o)}function X(t){t.preventDefault();const e=D(this.closest(P)),{controls:n}=e;n[1]&&this===n[1]?e.next():n[1]&&this===n[0]&&e.prev()}function $({which:t}){const[e]=Array.from(document.querySelectorAll(P)).filter(t=>L(t));if(!e)return;const n=D(e);switch(t){case 39:n.next();break;case 37:n.prev()}}function Y(t){const e=D(this);e&&!e.isTouch&&(j=t.changedTouches[0].pageX,this.contains(t.target)&&(e.isTouch=!0,J(e,1)))}function V(t){const{changedTouches:e,type:n}=t,o=D(this);o&&o.isTouch&&(B=e[0].pageX,"touchmove"===n&&e.length>1&&t.preventDefault())}function G(t){const e=this,n=D(e);if(n&&n.isTouch&&(R=B||t.changedTouches[0].pageX,n.isTouch)){if((!e.contains(t.target)||!e.contains(t.relatedTarget))&&Math.abs(j-R)<75)return;Bj&&(n.index-=1),n.isTouch=!1,n.to(n.index),J(n)}}function Z(t,e){const{indicators:n}=t;Array.from(n).forEach(t=>c(t,"active")),t.indicators[e]&&T(n[e],"active")}function J(t,e){const{element:n}=t,o=e?d:"removeEventListener";n[o]("touchmove",V,H),n[o]("touchend",G,H)}function K(t,e){const{element:n,options:o,slides:s,controls:i,indicator:a}=t,{touch:r,pause:l,interval:c,keyboard:u}=o,h=e?d:"removeEventListener";l&&c&&(n[h]("mouseenter",F),n[h]("mouseleave",z),n[h]("touchstart",F,H),n[h]("touchend",z,H)),r&&s.length>1&&n[h]("touchstart",Y,H),i.forEach(t=>{t&&t[h]("click",X)}),a&&a[h]("click",q),u&&window[h]("keydown",$)}function Q(t){const{slides:e,element:n}=t;return Array.from(e).indexOf(n.getElementsByClassName("carousel-item active")[0])||0}class U extends g{constructor(t,e){super(t,e);const n=this;n.timer=null,n.direction="left",n.isPaused=!1,n.isAnimating=!1,n.index=0,n.isTouch=!1;const{element:o}=n;n.slides=o.getElementsByClassName("carousel-item");const{slides:s}=n;if(s.length<2)return;n.controls=[r(".carousel-control-prev",o),r(".carousel-control-next",o)],n.indicator=r(".carousel-indicators",o),n.indicators=n.indicator&&n.indicator.querySelectorAll("[data-bs-slide-to]")||[];const{options:i}=n;n.options.interval=!0===i.interval?O.interval:i.interval,Q(n)<0&&(s.length&&T(s[0],"active"),n.indicators.length&&Z(n,0)),K(n,1),i.interval&&n.cycle()}get name(){return"Carousel"}get defaults(){return O}cycle(){const t=this,{isPaused:e,element:n,options:o}=t;t.timer&&(clearInterval(t.timer),t.timer=null),e&&(c(n,"paused"),t.isPaused=!e),t.timer=setInterval(()=>{L(n)&&(t.index+=1,t.to(t.index))},o.interval)}pause(){const t=this,{element:e,options:n,isPaused:o}=t;n.interval&&!o&&(clearInterval(t.timer),t.timer=null,T(e,"paused"),t.isPaused=!o)}next(){const t=this;t.isAnimating||(t.index+=1,t.to(t.index))}prev(){const t=this;t.isAnimating||(t.index-=1,t.to(t.index))}to(t){const e=this,{element:n,isAnimating:o,slides:s,options:r}=e,d=Q(e);let u=t;if(o||d===u)return;du||d===s.length-1&&0===u)&&(e.direction="right");const{direction:h}=e;u<0?u=s.length-1:u>=s.length&&(u=0);const m="left"===h?"next":"prev",p="left"===h?"start":"end",f={relatedTarget:s[u],from:d,to:u,direction:h};Object.assign(W,f),Object.assign(M,f),n.dispatchEvent(W),W.defaultPrevented||(e.index=u,clearInterval(e.timer),e.timer=null,e.isAnimating=!0,Z(e,u),i(s[u])&&l(n,"slide")?(T(s[u],"carousel-item-"+m),S(s[u]),T(s[u],"carousel-item-"+p),T(s[d],"carousel-item-"+p),a(s[u],()=>function(t){const{index:e,direction:n,element:o,slides:s,options:i,isAnimating:a}=t;if(a&&D(o)){const a=Q(t),r="left"===n?"next":"prev",d="left"===n?"start":"end";t.isAnimating=!1,T(s[e],"active"),c(s[a],"active"),c(s[e],"carousel-item-"+r),c(s[e],"carousel-item-"+d),c(s[a],"carousel-item-"+d),o.dispatchEvent(M),document.hidden||!i.interval||l(o,"paused")||t.cycle()}}(e))):(T(s[u],"active"),c(s[d],"active"),setTimeout(()=>{e.isAnimating=!1,n&&r.interval&&!l(n,"paused")&&e.cycle(),n.dispatchEvent(M)},17)))}dispose(){const t=this,{slides:e}=t,n=["start","end","prev","next"];Array.from(e).forEach((e,o)=>{l(e,"active")&&Z(t,o),n.forEach(t=>c(e,"carousel-item-"+t))}),K(t),clearInterval(t.timer),super.dispose()}}Object.assign(U,{selector:P,callback:t=>new U(t),getInstance:D});function _(t){return r(t.getAttribute("data-bs-target")||t.getAttribute("href"))||t.closest(t.getAttribute("data-bs-parent"))||r(t.getAttribute("data-bs-container"))}const tt={parent:null},et=t=>m(t,"Collapse"),nt=p("show.bs.collapse"),ot=p("shown.bs.collapse"),st=p("hide.bs.collapse"),it=p("hidden.bs.collapse");function at(t){const{element:e,parent:n,triggers:o}=t;e.dispatchEvent(st),st.defaultPrevented||(t.isAnimating=!0,n&&(n.isAnimating=!0),e.style.height=e.scrollHeight+"px",c(e,"collapse"),c(e,"show"),T(e,"collapsing"),S(e),e.style.height="0px",a(e,()=>{t.isAnimating=!1,n&&(n.isAnimating=!1),o.forEach(t=>t.setAttribute("aria-expanded","false")),c(e,"collapsing"),T(e,"collapse"),e.style.height="",e.dispatchEvent(it)}))}function rt(t,e){const n=e?d:"removeEventListener",{triggers:o}=t;o.length&&o.forEach(t=>t[n]("click",lt))}function lt(t){const{target:e}=t,n=e.closest('[data-bs-toggle="collapse"]'),o=_(n),s=o&&et(o);s&&s.toggle(),n&&"A"===n.tagName&&t.preventDefault()}class ct extends g{constructor(t,e){super(t,e);const{element:n,options:o}=this;this.triggers=Array.from(document.querySelectorAll('[data-bs-toggle="collapse"]')).filter(t=>_(t)===n),this.parent=r(o.parent);const{parent:s}=this;this.isAnimating=!1,s&&(s.isAnimating=!1),rt(this,1)}get name(){return"Collapse"}get defaults(){return tt}toggle(){l(this.element,"show")?this.hide():this.show()}hide(){const{triggers:t,isAnimating:e}=this;e||(at(this),t.length&&t.forEach(t=>T(t,"collapsed")))}show(){const t=this,{element:e,parent:n,triggers:o,isAnimating:s}=t;let i,r;n&&(i=Array.from(n.querySelectorAll(".collapse.show")).find(t=>et(t)),r=i&&et(i)),n&&(!n||n.isAnimating)||s||(r&&i!==e&&(at(r),r.triggers.forEach(t=>{T(t,"collapsed")})),function(t){const{element:e,parent:n,triggers:o}=t;e.dispatchEvent(nt),nt.defaultPrevented||(t.isAnimating=!0,n&&(n.isAnimating=!0),T(e,"collapsing"),c(e,"collapse"),e.style.height=e.scrollHeight+"px",a(e,()=>{t.isAnimating=!1,n&&(n.isAnimating=!1),o.forEach(t=>t.setAttribute("aria-expanded","true")),c(e,"collapsing"),T(e,"collapse"),T(e,"show"),e.style.height="",e.dispatchEvent(ot)}))}(t),o.length&&o.forEach(t=>c(t,"collapsed")))}dispose(){const{parent:t}=this;rt(this),t&&delete t.isAnimating,super.dispose()}}Object.assign(ct,{selector:".collapse",callback:t=>new ct(t),getInstance:et});const dt=["dropdown","dropup","dropstart","dropend"];function ut(t){const e=t.closest("A");return t&&(t.hasAttribute("href")&&"#"===t.href.slice(-1)||e&&e.hasAttribute("href")&&"#"===e.href.slice(-1))}function ht(t){t.focus()}const[mt]=dt,pt=`[data-bs-toggle="${mt}"]`,ft=t=>m(t,"Dropdown"),gt=dt[1],vt=dt[2],bt=dt[3],wt=["d-block","invisible"],yt=[mt,gt],Et=[vt,bt],At={offset:5,display:"dynamic"},Tt=p("show.bs."+mt),kt=p("shown.bs."+mt),xt=p("hide.bs."+mt),Ct=p("hidden.bs."+mt);function Nt(t,e){const{element:n,menu:o,originalClass:s,menuEnd:i,options:a}=t,{offset:r}=a,d=n.parentElement;if(["margin","top","bottom","left","right"].forEach(t=>{o.style[t]=""}),c(d,"position-static"),!e){const t=l(o,"dropdown-menu-end");return d.className=s.join(" "),void(t&&!i?c(o,"dropdown-menu-end"):!t&&i&&T(o,"dropdown-menu-end"))}let u=dt.find(t=>s.includes(t))||mt,h={dropdown:[r,0,0],dropup:[0,0,r],dropstart:[-1,r,0],dropend:[-1,0,0,r]};const m={dropdown:{top:"100%"},dropup:{top:"auto",bottom:"100%"},dropstart:{left:"auto",right:"100%"},dropend:{left:"100%",right:"auto"},menuEnd:{right:0,left:"auto"}};wt.forEach(t=>T(o,t));const p=new RegExp(`\\b(${mt}|${gt}|${vt}|${bt})+`),f=n.offsetWidth,g=n.offsetHeight,v=o.offsetWidth,b=o.offsetHeight,w=document.documentElement,y=document.body,E=w.clientWidth||y.clientWidth,A=w.clientHeight||y.clientHeight,k=n.getBoundingClientRect(),x=k.left+f-v<0,C=k.left-v<0,N=k.left+v>=E,H=k.left+v+f>=E,S=k.top+b>=A,L=k.top+b+g>=A,P=k.top-b<0;Et.includes(u)&&C&&H&&(u=mt),Et.includes(u)&&S&&(u=gt),u===vt&&C&&!S&&(u=bt),u===bt&&H&&!S&&(u=vt),u===gt&&P&&!L&&(u=mt),u===mt&&L&&!P&&(u=gt),h=h[u],o.style.margin=""+h.map(t=>t?t+"px":t).join(" "),Object.keys(m[u]).forEach(t=>{o.style[t]=m[u][t]}),l(d,u)||(d.className=d.className.replace(p,u)),yt.includes(u)&&(!i&&N?T(o,"dropdown-menu-end"):i&&x&&c(o,"dropdown-menu-end"),l(o,"dropdown-menu-end")&&Object.keys(m.menuEnd).forEach(t=>{o.style[t]=m.menuEnd[t]})),wt.forEach(t=>c(o,t))}function Ht(t){const e=t.open?d:"removeEventListener";document[e]("click",Pt),document[e]("focus",Pt),document[e]("keydown",It),document[e]("keyup",Dt),"dynamic"===t.options.display&&(window[e]("scroll",jt,H),window[e]("resize",jt,H))}function St(t,e){const n=e?d:"removeEventListener";t.element[n]("click",Ot)}function Lt(){const t=[...dt,"btn-group","input-group"].map(t=>document.getElementsByClassName(t+" show")).find(t=>t.length);return t&&t.length?Array.from(t[0].children).find(t=>t.hasAttribute(k)):null}function Pt(t){const{target:e,type:n}=t;if(!e.closest)return;const o=Lt();if(!o)return;const s=ft(o),i=o.parentNode,a=s&&s.menu,r=null!==e.closest(pt),l=i&&i.contains(e)&&("form"===e.tagName||null!==e.closest("form"));"click"===n&&ut(e)&&t.preventDefault(),("focus"!==n||e!==o&&e!==a&&!a.contains(e))&&(l||r||s&&s.hide(o))}function Ot(t){ft(this).toggle(this),ut(t.target)&&t.preventDefault()}function It(t){38!==t.which&&40!==t.which||t.preventDefault()}function Dt({which:t}){const e=Lt(),n=ft(e),{menu:o,menuItems:s,open:i}=n,a=document.activeElement,r=a===e,l=o.contains(a),c=a.parentNode===o||a.parentNode.parentNode===o;let d=s.indexOf(a);c&&(r?d=0:38===t?d=d>1?d-1:0:40===t&&(d=d{t.children.length&&"A"===t.children[0].tagName&&n.menuItems.push(t.children[0]),"A"===t.tagName&&n.menuItems.push(t)}),n.open=!1,St(n,1)}get name(){return"Dropdown"}get defaults(){return At}toggle(){const{open:t}=this;t?this.hide():this.show()}show(){const t=this,e=r(dt.concat("btn-group","input-group").map(t=>`.${t}.show`).join(",")),n=e&&r(pt,e);n&&ft(n).hide();const{element:o,menu:s,open:i}=t,a=o.parentNode;a.dispatchEvent(Tt),Tt.defaultPrevented||(Nt(t,1),T(s,"show"),T(a,"show"),o.setAttribute("aria-expanded",!0),t.open=!i,setTimeout(()=>{ht(o),Ht(t),a.dispatchEvent(kt)},1))}hide(){const t=this,{element:e,menu:n,open:o}=t,s=e.parentNode;s.dispatchEvent(xt),xt.defaultPrevented||(c(n,"show"),c(s,"show"),Nt(t),e.setAttribute("aria-expanded",!1),t.open=!o,setTimeout(()=>Ht(t),1),s.dispatchEvent(Ct))}dispose(){const{element:t}=this;l(t.parentNode,"show")&&this.open&&this.hide(),St(this),super.dispose()}}Object.assign(Bt,{selector:pt,callback:t=>new Bt(t),getInstance:ft});const Rt=[...document.getElementsByClassName("fixed-top"),...document.getElementsByClassName("fixed-bottom"),...document.getElementsByClassName("sticky-top"),...document.getElementsByClassName("is-fixed")];function Wt(){const{clientWidth:t}=document.documentElement;return Math.abs(window.innerWidth-t)}function Mt(t,e){const n=document.body,o=getComputedStyle(n),s=parseInt(o.paddingRight,10),i="hidden"===o.overflow&&s?0:t;e&&(n.style.overflow="hidden",n.style.paddingRight=s+i+"px",Rt.length&&Rt.forEach(t=>{const e=l(t,"sticky-top"),n=getComputedStyle(t).paddingRight;if(t.style.paddingRight=parseInt(n,10)+i+"px",e){const e=getComputedStyle(t).marginRight;t.style.marginRight=parseInt(e,10)-i+"px"}}))}const Ft="modal-backdrop",zt="offcanvas-backdrop",qt=document.createElement("div");function Xt(){return r(".modal.show,.offcanvas.show")}function $t(t){const e=t?Ft:zt;[Ft,zt].forEach(t=>{c(qt,t)}),T(qt,e)}function Yt(t,e){$t(e),document.body.append(qt),t&&T(qt,"fade")}function Vt(){T(qt,"show"),S(qt)}function Gt(){c(qt,"show")}function Zt(){Xt()||(c(qt,"fade"),qt.remove(),function(){const t=document.body;t.style.paddingRight="",t.style.overflow="",Rt.length&&Rt.forEach(t=>{t.style.paddingRight="",t.style.marginRight=""})}())}function Jt(t){return"hidden"!==getComputedStyle(t).visibility&&null!==t.offsetParent}const Kt=t=>m(t,"Modal"),Qt={backdrop:!0,keyboard:!0},Ut=p("show.bs.modal"),_t=p("shown.bs.modal"),te=p("hide.bs.modal"),ee=p("hidden.bs.modal");function ne(t){const{element:e,scrollbarWidth:n}=t,o=document.body,s=document.documentElement,i=s.clientHeight!==s.scrollHeight||o.clientHeight!==o.scrollHeight,a=e.clientHeight!==e.scrollHeight;!a&&n&&(e.style.paddingRight=n+"px"),Mt(n,a||i)}function oe(t,e){const n=e?d:"removeEventListener";window[n]("resize",t.update,H),t.element[n]("click",ue),document[n]("keydown",de)}function se(t,e){const n=e?d:"removeEventListener",{triggers:o}=t;o.length&&o.forEach(t=>t[n]("click",ce))}function ie(t){const{triggers:e}=t;if(Zt(),t.element.style.paddingRight="",t.isAnimating=!1,e.length){const t=e.find(t=>Jt(t));t&&ht(t)}}function ae(t){const{element:e,relatedTarget:n}=t;ht(e),t.isAnimating=!1,oe(t,1),_t.relatedTarget=n,e.dispatchEvent(_t)}function re(t){const{element:e,hasFade:n}=t;e.style.display="block",ne(t),Xt()||(document.body.style.overflow="hidden"),T(e,"show"),e.removeAttribute("aria-hidden"),e.setAttribute("aria-modal",!0),n?a(e,()=>ae(t)):ae(t)}function le(t,e){const{element:n,options:o,relatedTarget:s,hasFade:i}=t;n.style.display="",o.backdrop&&!e&&i&&l(qt,"show")&&!Xt()?(Gt(),a(qt,()=>ie(t))):ie(t),oe(t),ee.relatedTarget=s,n.dispatchEvent(ee)}function ce(t){const{target:e}=t,n=e.closest('[data-bs-toggle="modal"]'),o=_(n),s=o&&Kt(o);"A"===n.tagName&&t.preventDefault(),s.isAnimating||(s.relatedTarget=n,s.toggle())}function de({which:t}){const e=r(".modal.show"),n=Kt(e),{options:o,isAnimating:s}=n;!s&&o.keyboard&&27===t&&l(e,"show")&&(n.relatedTarget=null,n.hide())}function ue(t){const e=this,n=Kt(e);if(n.isAnimating)return;const{options:o,isStatic:s,modalDialog:r}=n,{backdrop:l}=o,{target:d}=t,u=document.getSelection().toString().length,h=r.contains(d),m=d.closest('[data-bs-dismiss="modal"]');s&&!h?(T(e,"modal-static"),n.isAnimating=!0,a(r,()=>function(t){const e=i(t.modalDialog)+17;c(t.element,"modal-static"),setTimeout(()=>{t.isAnimating=!1},e)}(n))):(m||!u&&!s&&!h&&l)&&(n.relatedTarget=m||null,n.hide(),t.preventDefault())}class he extends g{constructor(t,e){super(t,e);const{element:n}=this;this.modalDialog=r(".modal-dialog",n),this.triggers=Array.from(document.querySelectorAll('[data-bs-toggle="modal"]')).filter(t=>_(t)===n),this.isStatic="static"===this.options.backdrop,this.hasFade=l(n,"fade"),this.isAnimating=!1,this.scrollbarWidth=Wt(),this.relatedTarget=null,se(this,1),this.update=this.update.bind(this)}get name(){return"Modal"}get defaults(){return Qt}toggle(){l(this.element,"show")?this.hide():this.show()}show(){const t=this,{element:e,options:n,isAnimating:o,hasFade:s,relatedTarget:a}=t,{backdrop:r}=n;let c=0;if(l(e,"show")&&!o)return;if(Ut.relatedTarget=a||null,e.dispatchEvent(Ut),Ut.defaultPrevented)return;const d=Xt();if(d&&d!==e){(Kt(d)||m(d,"Offcanvas")).hide()}t.isAnimating=!0,r?(d||l(qt,"show")?$t(1):Yt(s,1),c=i(qt),l(qt,"show")||Vt(),setTimeout(()=>re(t),c)):(re(t),d&&l(qt,"show")&&Gt())}hide(t){const e=this,{element:n,isAnimating:o,hasFade:s,relatedTarget:i}=e;(l(n,"show")||o)&&(te.relatedTarget=i||null,n.dispatchEvent(te),te.defaultPrevented||(e.isAnimating=!0,c(n,"show"),n.setAttribute("aria-hidden",!0),n.removeAttribute("aria-modal"),s&&1!==t?a(n,()=>le(e)):le(e,t)))}update(){l(this.element,"show")&&ne(this)}dispose(){this.hide(1),se(this),super.dispose()}}Object.assign(he,{selector:".modal",callback:t=>new he(t),getInstance:Kt});const me=t=>m(t,"Offcanvas"),pe={backdrop:!0,keyboard:!0,scroll:!1},fe=p("show.bs.offcanvas"),ge=p("shown.bs.offcanvas"),ve=p("hide.bs.offcanvas"),be=p("hidden.bs.offcanvas");function we(t,e){const n=e?d:"removeEventListener";t.triggers.forEach(t=>t[n]("click",Te))}function ye(t){const e=t?d:"removeEventListener";document[e]("keydown",xe),document[e]("click",ke)}function Ee(t){const{element:e,options:n}=t;n.scroll||(document.body.style.overflow="hidden",function(t){const e=document.body,n=document.documentElement,o=n.clientHeight!==n.scrollHeight||e.clientHeight!==e.scrollHeight;Mt(t.scrollbarWidth,o)}(t)),T(e,"offcanvas-toggling"),T(e,"show"),e.style.visibility="visible",a(e,()=>function(t){const{element:e,triggers:n}=t;c(e,"offcanvas-toggling"),e.removeAttribute("aria-hidden"),e.setAttribute("aria-modal",!0),e.setAttribute("role","dialog"),t.isAnimating=!1,n.length&&n.forEach(t=>t.setAttribute("aria-expanded",!0));e.dispatchEvent(ge),ye(1),ht(e)}(t))}function Ae(t){const{element:e,options:n}=t,o=Xt();e.blur(),!o&&n.backdrop&&l(qt,"show")?(Gt(),a(qt,()=>Ce(t))):Ce(t)}function Te(t){const e=this.closest('[data-bs-toggle="offcanvas"]'),n=_(e),o=n&&me(n);"A"===e.tagName&&t.preventDefault(),o&&o.toggle()}function ke(t){const e=r(".offcanvas.show");if(!e)return;const n=r('[data-bs-dismiss="offcanvas"]',e),o=me(e);if(!o)return;const{options:s,triggers:i}=o,{target:a}=t,l=a.closest('[data-bs-toggle="offcanvas"]');l&&"A"===l.tagName&&t.preventDefault(),(!e.contains(a)&&s.backdrop&&(!l||l&&!i.includes(l))||n&&n.contains(a))&&o.hide()}function xe({which:t}){const e=r(".offcanvas.show");if(!e)return;const n=me(e);n&&n.options.keyboard&&27===t&&n.hide()}function Ce(t){const{element:e,triggers:n}=t;if(e.setAttribute("aria-hidden",!0),e.removeAttribute("aria-modal"),e.removeAttribute("role"),e.style.visibility="",t.isAnimating=!1,n.length){n.forEach(t=>t.setAttribute("aria-expanded",!1));const t=n.find(t=>Jt(t));t&&ht(t)}Zt(),e.dispatchEvent(be),c(e,"offcanvas-toggling"),ye()}class Ne extends g{constructor(t,e){super(t,e);const{element:n}=this;this.triggers=Array.from(document.querySelectorAll('[data-bs-toggle="offcanvas"]')).filter(t=>_(t)===n),this.isAnimating=!1,this.scrollbarWidth=Wt(),we(this,1)}get name(){return"Offcanvas"}get defaults(){return pe}toggle(){l(this.element,"show")?this.hide():this.show()}show(){const t=me(this)||this,{element:e,options:n,isAnimating:o}=t;let s=0;if(l(e,"show")||o)return;if(e.dispatchEvent(fe),fe.defaultPrevented)return;const a=Xt();if(a&&a!==e){(me(a)||m(a,"Modal")).hide()}t.isAnimating=!0,n.backdrop?(a?$t():Yt(1),s=i(qt),l(qt,"show")||Vt(),setTimeout(()=>Ee(t),s)):(Ee(t),a&&l(qt,"show")&&Gt())}hide(t){const e=this,{element:n,isAnimating:o}=e;l(n,"show")&&!o&&(n.dispatchEvent(ve),ve.defaultPrevented||(e.isAnimating=!0,T(n,"offcanvas-toggling"),c(n,"show"),t?Ae(e):a(n,()=>Ae(e))))}dispose(){this.hide(1),we(this),super.dispose()}}Object.assign(Ne,{selector:".offcanvas",callback:t=>new Ne(t),getInstance:me});function He(t){return[SVGElement,HTMLImageElement,HTMLVideoElement].some(e=>t instanceof e)}var Se={top:"top",bottom:"bottom",left:"start",right:"end"};function Le(t,e){return e.contains(t)}function Pe(t,e){const n=/\b(top|bottom|start|end)+/,o=t.tooltip||t.popover;o.style.top="",o.style.left="",o.style.right="";const s=!!t.popover;let i={w:o.offsetWidth,h:o.offsetHeight};const a=document.documentElement.clientWidth||document.body.clientWidth,r=document.documentElement.clientHeight||document.body.clientHeight,{element:l,options:c,arrow:d,positions:u}=t;let{container:h,placement:m}=c,p=h===document.body;const{elementPosition:f,containerIsStatic:g,relContainer:v}=u;let{containerIsRelative:b}=u;h=v||h,b=g&&v?1:b,p=h===document.body;const w=h.getBoundingClientRect(),y=b?w.left:0,E=b?w.right:a,A="absolute"===f,T=l.getBoundingClientRect(),k=p?{x:window.pageXOffset,y:window.pageYOffset}:{x:h.scrollLeft,y:h.scrollTop},x=l.offsetWidth,C=l.offsetHeight,N=b?l.offsetTop:T.top,H=b?l.offsetLeft:T.left;let S,L,P,O,I,D;d.style.top="",d.style.left="",d.style.right="";let j=T.top-i.h<0,B=T.top+i.h+C>=r,R=T.left-i.w=E;j=["left","right"].includes(m)?T.top+C/2-i.h/2<0:j,B=["left","right"].includes(m)?T.top+i.h/2+C/2>=r:B,R=["top","bottom"].includes(m)?T.left+x/2-i.w/2=E:W,m=["left","right"].includes(m)&&R&&W?"top":m,m="top"===m&&j?"bottom":m,m="bottom"===m&&B?"top":m,m="left"===m&&R?"right":m,m="right"===m&&W?"left":m,o.className.includes(m)||(o.className=o.className.replace(n,Se[m])),i={w:o.offsetWidth,h:o.offsetHeight};const M=d.offsetWidth||0,F=d.offsetHeight||0,z=M/2;if(["left","right"].includes(m))L="left"===m?H+k.x-i.w-(s?M:0):H+k.x+x+(s?M:0),j?(S=N+k.y,O=C/2-M):B?(S=N+k.y-i.h+C,O=i.h-C/2-M):(S=N+k.y-i.h/2+C/2,O=i.h/2-F/2);else if(["top","bottom"].includes(m))if(e&&He(l)){const t=b?e.layerX+(A?l.offsetLeft:0):e.pageX,n=b?e.layerY+(A?l.offsetTop:0):e.pageY;S="top"===m?n-i.h-(s?M:F):n+F,e.clientX-i.w/2=E?(L="auto",P=0,I=i.w-(E-t)-z):(L=t-i.w/2,I=i.w/2-z)}else S="top"===m?N+k.y-i.h-(s?F:0):N+k.y+C+(s?F:0),R?(L=0,I=H+x/2-z):W?(L="auto",P=0,D=x/2+(w.right-T.right)-z):(L=H+k.x-i.w/2+x/2,I=i.w/2-z);o.style.top=S+"px",o.style.left="auto"===L?L:L+"px",o.style.right=void 0!==P?P+"px":"",void 0!==O&&(d.style.top=O+"px"),void 0!==I?d.style.left=I+"px":void 0!==D&&(d.style.right=D+"px")}let Oe=1;function Ie(t,e){return Oe+=1,t[e]||Oe}function De(t){const e=t.closest(".modal"),n=t.closest(".fixed-top,.fixed-bottom");return e||n||document.body}function je(t){let e=null,n=t;for(;n!==document.body;)if(n=n.parentElement,"relative"===getComputedStyle(n).position){e=n;break}return e}function Be(t,e,n){if("string"!=typeof e||e.length)if(e instanceof Element)t.append(e);else{let o=e.trim();"function"==typeof n&&(o=n(o));const s=(new DOMParser).parseFromString(o,"text/html"),{body:i}=s,a=i.children.length?"innerHTML":"innerText";t[a]=i[a]}}const Re=t=>m(t,"Popover"),We={template:'',title:null,content:null,customClass:null,trigger:"hover",placement:"top",btnClose:'',sanitizeFn:null,dismissible:!1,animation:!0,delay:200,container:null},Me=/(iPhone|iPod|iPad)/,Fe=navigator.userAgentData?navigator.userAgentData.brands.some(t=>Me.test(t.brand)):Me.test(navigator.userAgent),ze=p("show.bs.popover"),qe=p("shown.bs.popover"),Xe=p("hide.bs.popover"),$e=p("hidden.bs.popover");function Ye({target:t}){const e=this,{popover:n,element:o}=e;n&&n.contains(t)||t===o||o.contains(t)||e.hide()}function Ve(t,e){const n=e?d:"removeEventListener",{element:o,options:s}=t,{trigger:i,dismissible:a}=s;t.enabled=!!e,"hover"===i?(o[n]("mousedown",t.show),o[n]("mouseenter",t.show),He(o)&&o[n]("mousemove",t.update,H),a||o[n]("mouseleave",t.hide)):"click"===i?o[n](i,t.toggle):"focus"===i&&(Fe&&o[n]("click",()=>ht(o)),o[n]("focusin",t.show))}function Ge(t,e){const n=e?d:"removeEventListener",{options:o,element:s,btn:i}=t,{trigger:a,dismissible:r}=o;r?i&&i[n]("click",t.hide):("focus"===a&&s[n]("focusout",t.hide),"hover"===a&&document[n]("touchstart",Ye,H)),He(s)||(window[n]("scroll",t.update,H),window[n]("resize",t.update,H))}function Ze(t){t.element.dispatchEvent(qe)}function Je(t){!function(t){const{element:e,popover:n}=t;e.removeAttribute("aria-describedby"),n.remove(),t.timer=null}(t),t.element.dispatchEvent($e)}class Ke extends g{constructor(t,e){const n=r(t);We.container=De(n),super(t,e);this.timer=null,this.popover=null,this.arrow=null,this.btn=null,this.enabled=!1,this.id="popover-"+Ie(n);const{options:o}=this;if(this.options.container=He(n)?We.container:r(o.container),We.container=null,!o.content)return;!function(t){const{id:e,options:n}=t,{animation:o,customClass:s,sanitizeFn:i,placement:a,dismissible:c}=n;let{title:d,content:u}=n;const{template:h,btnClose:m}=n,p="bs-popover-"+Se[a];let f;if("object"==typeof h)f=h;else{const t=document.createElement("div");Be(t,h,i),f=t.firstChild}t.popover=f.cloneNode(!0);const{popover:g}=t;g.setAttribute("id",e),g.setAttribute("role","tooltip");const v=r(".popover-header",g),b=r(".popover-body",g);t.arrow=r(".popover-arrow",g),c&&(d?d instanceof Element?Be(d,m,i):d+=m:(v&&v.remove(),u instanceof Element?Be(u,m,i):u+=m)),d&&v&&Be(v,d,i),u&&b&&Be(b,u,i),[t.btn]=g.getElementsByClassName("btn-close"),l(g,"popover")||T(g,"popover"),o&&!l(g,"fade")&&T(g,"fade"),s&&!l(g,s)&&T(g,s),l(g,p)||T(g,p)}(this);const{container:s}=this.options,i=getComputedStyle(n).position,a=getComputedStyle(s).position,c=s===document.body,d=!c&&"static"===a,u=!c&&"relative"===a,h=d&&je(s);this.positions={elementPosition:i,containerIsRelative:u,containerIsStatic:d,relContainer:h},this.update=this.update.bind(this),Ve(this,1)}get name(){return"Popover"}get defaults(){return We}update(t){Pe(this,t)}toggle(t){const e=t?Re(this):this,{popover:n,options:o}=e;Le(n,o.container)?e.hide():e.show()}show(t){const e=t?Re(this):this,{element:n,popover:o,options:s,id:i}=e,{container:r}=s;if(clearTimeout(e.timer),!Le(o,r)){if(n.dispatchEvent(ze),ze.defaultPrevented)return;r.append(o),n.setAttribute("aria-describedby",i),e.update(t),l(o,"show")||T(o,"show"),Ge(e,1),s.animation?a(o,()=>Ze(e)):Ze(e)}}hide(t){let e;if(t){if(e=Re(this),!e){const t=this.closest(".popover"),n=t&&r(`[aria-describedby="${t.id}"]`);e=Re(n)}}else e=this;const{element:n,popover:o,options:s}=e;clearTimeout(e.timer),e.timer=setTimeout(()=>{if(Le(o,s.container)){if(n.dispatchEvent(Xe),Xe.defaultPrevented)return;c(o,"show"),Ge(e),s.animation?a(o,()=>Je(e)):Je(e)}},s.delay+17)}enable(){const t=this,{enabled:e}=t;e||(Ve(t,1),t.enabled=!e)}disable(){const t=this,{enabled:e,popover:n,options:o}=t;e&&(Le(n,o.container)&&o.animation?(t.hide(),setTimeout(()=>Ve(t),i(n)+o.delay+17)):Ve(t),t.enabled=!e)}toggleEnabled(){this.enabled?this.disable():this.enable()}dispose(){const t=this,{popover:e,options:n}=t,{container:o,animation:s}=n;s&&Le(e,o)?(t.options.delay=0,t.hide(),a(e,()=>Ve(t))):Ve(t),super.dispose()}}Object.assign(Ke,{selector:'[data-bs-toggle="popover"],[data-tip="popover"]',callback:t=>new Ke(t),getInstance:Re});const Qe={offset:10,target:null},Ue=p("activate.bs.scrollspy");function _e(t){const{target:e,scrollTarget:n,isWindow:o,options:s,itemsLength:i,scrollHeight:a}=t,{offset:l}=s,c=e.getElementsByTagName("A");if(t.scrollTop=o?n.pageYOffset:n.scrollTop,i!==c.length||tn(n)!==a){let e,s,i;t.items=[],t.offsets=[],t.scrollHeight=tn(n),t.maxScroll=t.scrollHeight-function({element:t,isWindow:e}){return e?window.innerHeight:t.getBoundingClientRect().height}(t),Array.from(c).forEach(n=>{e=n.getAttribute("href"),s=e&&"#"===e.charAt(0)&&"#"!==e.slice(-1)&&r(e),s&&(t.items.push(n),i=s.getBoundingClientRect(),t.offsets.push((o?i.top+t.scrollTop:s.offsetTop)-l))}),t.itemsLength=t.items.length}}function tn(t){return t.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}function en(t){Array.from(t.getElementsByTagName("A")).forEach(t=>{l(t,"active")&&c(t,"active")})}function nn(t,e){const{target:n,element:o}=t;en(n),t.activeItem=e,T(e,"active");const s=[];let i=e;for(;i!==document.body;)i=i.parentNode,(l(i,"nav")||l(i,"dropdown-menu"))&&s.push(i);s.forEach(t=>{const e=t.previousElementSibling;e&&!l(e,"active")&&T(e,"active")}),Ue.relatedTarget=e,o.dispatchEvent(Ue)}function on(t,e){const n=e?d:"removeEventListener";t.scrollTarget[n]("scroll",t.refresh,H)}class sn extends g{constructor(t,e){super(t,e);const{element:n,options:o}=this;this.target=r(o.target),this.target&&(this.scrollTarget=n.clientHeight=o){const e=i[s-1];return void(a!==e&&nn(t,e))}const{offsets:r}=t;if(a&&n0)return t.activeItem=null,void en(e);i.forEach((e,o)=>{a!==e&&n>=r[o]&&(void 0===r[o+1]||nnew sn(t),getInstance:t=>m(t,"ScrollSpy")});const an=t=>m(t,"Tab"),rn=p("show.bs.tab"),ln=p("shown.bs.tab"),cn=p("hide.bs.tab"),dn=p("hidden.bs.tab");let un,hn,mn,pn,fn,gn,vn;function bn(t){const{tabContent:e,nav:n}=t;e.style.height="",c(e,"collapsing"),n.isAnimating=!1}function wn(t){const{tabContent:e,nav:n}=t;e?vn?bn(t):setTimeout(()=>{e.style.height=mn+"px",S(e),a(e,()=>bn(t))},50):n.isAnimating=!1,ln.relatedTarget=pn,un.dispatchEvent(ln)}function yn(t){const{tabContent:e}=t;e&&(fn.style.float="left",hn.style.float="left",gn=fn.scrollHeight),rn.relatedTarget=pn,dn.relatedTarget=un,un.dispatchEvent(rn),rn.defaultPrevented||(T(hn,"active"),c(fn,"active"),e&&(mn=hn.scrollHeight,vn=mn===gn,T(e,"collapsing"),e.style.height=gn+"px",S(e),fn.style.float="",hn.style.float=""),l(hn,"fade")?setTimeout(()=>{T(hn,"show"),a(hn,()=>{wn(t)})},20):wn(t),pn.dispatchEvent(dn))}function En({nav:t}){const e=t.getElementsByClassName("active");return 1!==e.length||dt.some(t=>l(e[0].parentNode,t))?e.length>1&&(pn=e[e.length-1]):[pn]=e,pn}function An(t){return r(En(t).getAttribute("href")||En(t).getAttribute(k))}function Tn(t,e){const n=e?d:"removeEventListener";t.element[n]("click",kn)}function kn(t){const e=an(this);t.preventDefault(),e.nav.isAnimating||e.show()}class xn extends g{constructor(t){super(t);const{element:n}=this;this.nav=n.closest(".nav");const{nav:o}=this;this.dropdown=o&&r(`.${dt[0]}-toggle`,o),fn=An(this),this.tabContent=e&&fn.closest(".tab-content"),gn=fn.scrollHeight,o.isAnimating=!1,Tn(this,1)}get name(){return"Tab"}show(){const t=this,{element:e,nav:n,dropdown:o}=t;if(un=e,!l(un,"active")){if(hn=r(un.getAttribute("href")),pn=En({nav:n}),fn=An({nav:n}),cn.relatedTarget=un,pn.dispatchEvent(cn),cn.defaultPrevented)return;n.isAnimating=!0,c(pn,"active"),pn.setAttribute("aria-selected","false"),T(un,"active"),un.setAttribute("aria-selected","true"),o&&(l(e.parentNode,"dropdown-menu")?l(o,"active")||T(o,"active"):l(o,"active")&&c(o,"active")),l(fn,"fade")?(c(fn,"show"),a(fn,()=>yn(t))):yn(t)}}dispose(){Tn(this),super.dispose()}}Object.assign(xn,{selector:'[data-bs-toggle="tab"]',callback:t=>new xn(t),getInstance:an});const Cn={animation:!0,autohide:!0,delay:500},Nn=p("show.bs.toast"),Hn=p("hide.bs.toast"),Sn=p("shown.bs.toast"),Ln=p("hidden.bs.toast");function Pn(t){const{element:e,options:n}=t;c(e,"showing"),e.dispatchEvent(Sn),n.autohide&&t.hide()}function On(t){const{element:e}=t;c(e,"showing"),c(e,"show"),T(e,"hide"),e.dispatchEvent(Ln)}function In(t,e){const n=e?d:"removeEventListener";t.dismiss&&t.dismiss[n]("click",t.hide)}class Dn extends g{constructor(t,e){super(t,e);const{element:n,options:o}=this;o.animation&&!l(n,"fade")?T(n,"fade"):!o.animation&&l(n,"fade")&&c(n,"fade"),this.dismiss=r('[data-bs-dismiss="toast"]',n),this.show=this.show.bind(this),this.hide=this.hide.bind(this),In(this,1)}get name(){return"Toast"}get defaults(){return Cn}show(){const t=this,{element:e}=t;if(e&&!l(e,"show")){if(e.dispatchEvent(Nn),Nn.defaultPrevented)return;clearTimeout(t.timer),t.timer=setTimeout(()=>function(t){const{element:e,options:n}=t;c(e,"hide"),S(e),T(e,"show"),T(e,"showing"),n.animation?a(e,()=>Pn(t)):Pn(t)}(t),10)}}hide(t){const e=this,{element:n,options:o}=e;if(n&&l(n,"show")){if(n.dispatchEvent(Hn),Hn.defaultPrevented)return;clearTimeout(e.timer),e.timer=setTimeout(()=>function(t){const{element:e,options:n}=t;T(e,"showing"),n.animation?(S(e),a(e,()=>On(t))):On(t)}(e),t?10:o.delay)}}dispose(){const{element:t}=this;l(t,"show")&&c(t,"show"),function(t){clearTimeout(t.timer),In(t)}(this),super.dispose()}}Object.assign(Dn,{selector:".toast",callback:t=>new Dn(t),getInstance:t=>m(t,"Toast")});const jn={template:'',title:null,customClass:null,placement:"top",sanitizeFn:null,animation:!0,delay:200,container:null},Bn=t=>m(t,"Tooltip"),Rn=p("show.bs.tooltip"),Wn=p("shown.bs.tooltip"),Mn=p("hide.bs.tooltip"),Fn=p("hidden.bs.tooltip");function zn(t){const{element:e}=t;Yn(t),e.hasAttribute("data-original-title")&&Vn(t)}function qn(t,e){const n=e?d:"removeEventListener";document[n]("touchstart",Gn,H),He(t.element)||(window[n]("scroll",t.update,H),window[n]("resize",t.update,H))}function Xn(t){qn(t,1),t.element.dispatchEvent(Wn)}function $n(t){qn(t),function(t){const{element:e,tooltip:n}=t;e.removeAttribute("aria-describedby"),n.remove(),t.timer=null}(t),t.element.dispatchEvent(Fn)}function Yn(t,e){const n=e?d:"removeEventListener",{element:o}=t;He(o)&&o[n]("mousemove",t.update,H),o[n]("mousedown",t.show),o[n]("mouseenter",t.show),o[n]("mouseleave",t.hide)}function Vn(t,e){const n=["data-original-title","title"],{element:o}=t;o.setAttribute(n[e?0:1],e||o.getAttribute(n[0])),o.removeAttribute(n[e?1:0])}function Gn({target:t}){const{tooltip:e,element:n}=this;e.contains(t)||t===n||n.contains(t)||this.hide()}class Zn extends g{constructor(t,e){const n=r(t);jn.title=n.getAttribute("title"),jn.container=De(n),super(n,e);this.tooltip=null,this.arrow=null,this.timer=null,this.enabled=!1;const{options:o}=this;if(this.options.container=He(n)?jn.container:r(o.container),jn.container=null,jn.title=null,!o.title)return;Gn.bind(this),this.update=this.update.bind(this),n.hasAttribute("title")&&Vn(this,o.title),this.id="tooltip-"+Ie(n),function(t){const{options:e,id:n}=t,{title:o,template:s,customClass:i,animation:a,placement:c,sanitizeFn:d}=e,u="bs-tooltip-"+Se[c];if(!o)return;let h;if("object"==typeof s)h=s;else{const t=document.createElement("div");Be(t,s,d),h=t.firstChild}t.tooltip=h.cloneNode(!0);const{tooltip:m}=t;Be(r(".tooltip-inner",m),o,d),m.setAttribute("id",n),m.setAttribute("role","tooltip"),t.arrow=r(".tooltip-arrow",m),l(m,"tooltip")||T(m,"tooltip"),a&&!l(m,"fade")&&T(m,"fade"),i&&!l(m,i)&&T(m,i),l(m,u)||T(m,u)}(this);const{container:s}=this.options,i=getComputedStyle(n).position,a=getComputedStyle(s).position,c=s===document.body,d=!c&&"static"===a,u=!c&&"relative"===a,h=d&&je(s);this.positions={elementPosition:i,containerIsRelative:u,containerIsStatic:d,relContainer:h},Yn(this,1)}get name(){return"Tooltip"}get defaults(){return jn}show(t){const e=t?Bn(this):this,{options:n,tooltip:o,element:s,id:i}=e,{container:r,animation:c}=n;if(clearTimeout(e.timer),!Le(o,r)){if(s.dispatchEvent(Rn),Rn.defaultPrevented)return;r.append(o),s.setAttribute("aria-describedby",i),e.update(t),l(o,"show")||T(o,"show"),c?a(o,()=>Xn(e)):Xn(e)}}hide(t){const e=t?Bn(this):this,{options:n,tooltip:o,element:s}=e;clearTimeout(e.timer),e.timer=setTimeout(()=>{if(Le(o,n.container)){if(s.dispatchEvent(Mn),Mn.defaultPrevented)return;c(o,"show"),n.animation?a(o,()=>$n(e)):$n(e)}},n.delay)}update(t){Pe(this,t)}toggle(t){const e=t?Bn(this):this,{tooltip:n,options:o}=e;Le(n,o.container)?e.hide():e.show()}enable(){const t=this,{enabled:e}=t;e||(Yn(t,1),t.enabled=!e)}disable(){const t=this,{tooltip:e,options:n,enabled:o}=t;o&&(!Le(e,n.container)&&n.animation?(t.hide(),setTimeout(()=>Yn(t),i(e)+n.delay+17)):Yn(t),t.enabled=!o)}toggleEnabled(){this.enabled?this.disable():this.enable()}dispose(){const t=this,{tooltip:e,options:n}=t;n.animation&&Le(e,n.container)?(n.delay=0,t.hide(),a(e,()=>zn(t))):zn(t),super.dispose()}}Object.assign(Zn,{selector:'[data-bs-toggle="tooltip"],[data-tip="tooltip"]',callback:t=>new Zn(t),getInstance:Bn});const Jn={Alert:A,Button:N,Carousel:U,Collapse:ct,Dropdown:Bt,Modal:he,Offcanvas:Ne,Popover:Ke,ScrollSpy:sn,Tab:xn,Toast:Dn,Tooltip:Zn},Kn=Object.keys(Jn);function Qn(t){const e=t instanceof Element?t:document;Kn.forEach(t=>{const{callback:n,selector:o}=Jn[t];!function(t,e){Array.from(e).forEach(e=>t(e))}(n,e.querySelectorAll(o))})}document.body?Qn():document.addEventListener("DOMContentLoaded",()=>Qn(),{once:!0});const Un={Alert:A,Button:N,Carousel:U,Collapse:ct,Dropdown:Bt,Modal:he,Offcanvas:Ne,Popover:Ke,ScrollSpy:sn,Tab:xn,Toast:Dn,Tooltip:Zn,initCallback:Qn,removeDataAPI:function(t){const e=t instanceof Element?t:document;Kn.forEach(t=>{!function(t,e){Array.from(h.getAllFor(t)).forEach(t=>{const[n,o]=t;e.contains(n)&&o.dispose()})}(t,e)})},Version:"4.1.0"};export{Un as default}; diff --git a/dist/bootstrap-native.js b/dist/bootstrap-native.js index e54017bd..22fad513 100644 --- a/dist/bootstrap-native.js +++ b/dist/bootstrap-native.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap v4.0.8 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap v4.1.0 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2021 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -9,14 +9,61 @@ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.BSN = factory()); })(this, (function () { 'use strict'; + /** + * A global namespace for 'transitionend' string. + * @type {string} + */ const transitionEndEvent = 'webkitTransition' in document.head.style ? 'webkitTransitionEnd' : 'transitionend'; + /** + * A global namespace for CSS3 transition support. + * @type {boolean} + */ const supportTransition = 'webkitTransition' in document.head.style || 'transition' in document.head.style; - const transitionDuration = 'webkitTransition' in document.head.style ? 'webkitTransitionDuration' : 'transitionDuration'; + /** + * A global namespace for 'transitionDelay' string. + * @type {string} + */ + const transitionDelay = 'webkitTransition' in document.head.style ? 'webkitTransitionDelay' : 'transitionDelay'; + /** + * A global namespace for 'transitionProperty' string. + * @type {string} + */ const transitionProperty = 'webkitTransition' in document.head.style ? 'webkitTransitionProperty' : 'transitionProperty'; + /** + * Utility to get the computed transitionDelay + * from Element in miliseconds. + * + * @param {Element} element target + * @return {number} the value in miliseconds + */ + function getElementTransitionDelay(element) { + const computedStyle = getComputedStyle(element); + const propertyValue = computedStyle[transitionProperty]; + const delayValue = computedStyle[transitionDelay]; + const delayScale = delayValue.includes('ms') ? 1 : 1000; + const duration = supportTransition && propertyValue && propertyValue !== 'none' + ? parseFloat(delayValue) * delayScale : 0; + + return !Number.isNaN(duration) ? duration : 0; + } + + /** + * A global namespace for 'transitionDuration' string. + * @type {string} + */ + const transitionDuration = 'webkitTransition' in document.head.style ? 'webkitTransitionDuration' : 'transitionDuration'; + + /** + * Utility to get the computed transitionDuration + * from Element in miliseconds. + * + * @param {Element} element target + * @return {number} the value in miliseconds + */ function getElementTransitionDuration(element) { const computedStyle = getComputedStyle(element); const propertyValue = computedStyle[transitionProperty]; @@ -28,88 +75,235 @@ return !Number.isNaN(duration) ? duration : 0; } + /** + * Utility to make sure callbacks are consistently + * called when transition ends. + * + * @param {Element} element target + * @param {function} handler `transitionend` callback + */ function emulateTransitionEnd(element, handler) { let called = 0; const endEvent = new Event(transitionEndEvent); const duration = getElementTransitionDuration(element); + const delay = getElementTransitionDelay(element); if (duration) { - element.addEventListener(transitionEndEvent, function transitionEndWrapper(e) { + /** + * Wrap the handler in on -> off callback + * @param {Event} e Event object + * @callback + */ + const transitionEndWrapper = (e) => { if (e.target === element) { handler.apply(element, [e]); element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } - }); + }; + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); - }, duration + 17); + }, duration + delay + 17); } else { handler.apply(element, [endEvent]); } } + /** + * Utility to check if target is typeof Element + * or find one that matches a selector. + * + * @param {Element | string} selector the input selector or target element + * @param {Element | null} parent optional Element to look into + * @return {Element | null} the Element or result of the querySelector + */ function queryElement(selector, parent) { const lookUp = parent && parent instanceof Element ? parent : document; return selector instanceof Element ? selector : lookUp.querySelector(selector); } + /** + * Check class in Element.classList + * + * @param {Element} element target + * @param {string} classNAME to check + * @return {boolean} + */ function hasClass(element, classNAME) { return element.classList.contains(classNAME); } + /** + * Remove class from Element.classList + * + * @param {Element} element target + * @param {string} classNAME to remove + */ function removeClass(element, classNAME) { element.classList.remove(classNAME); } + /** + * A global namespace for 'addEventListener' string. + * @type {string} + */ const addEventListener = 'addEventListener'; + /** + * A global namespace for 'removeEventListener' string. + * @type {string} + */ const removeEventListener = 'removeEventListener'; + const componentData = new Map(); + /** + * An interface for web components background data. + * @see https://github.com/thednp/bootstrap.native/blob/master/src/components/base-component.js + */ + const Data = { + /** + * Sets web components data. + * @param {Element} element target element + * @param {string} component the component's name or a unique key + * @param {any} instance the component instance + */ + set: (element, component, instance) => { + if (!componentData.has(component)) { + componentData.set(component, new Map()); + } + + const instanceMap = componentData.get(component); + instanceMap.set(element, instance); + }, + + /** + * Returns all instances for specified component. + * @param {string} component the component's name or a unique key + * @returns {?any} all the component instances + */ + getAllFor: (component) => { + if (componentData.has(component)) { + return componentData.get(component) || null; + } + return null; + }, + + /** + * Returns the instance associated with the target. + * @param {Element} element target element + * @param {string} component the component's name or a unique key + * @returns {?any} the instance + */ + get: (element, component) => { + const allForC = Data.getAllFor(component); + if (allForC && allForC.has(element)) { + return allForC.get(element) || null; + } + return null; + }, + + /** + * Removes web components data. + * @param {Element} element target element + * @param {string} component the component's name or a unique key + * @param {any} instance the component instance + */ + remove: (element, component) => { + if (!componentData.has(component)) return; + + const instanceMap = componentData.get(component); + instanceMap.delete(element); + + if (instanceMap.size === 0) { + componentData.delete(component); + } + }, + }; + + /** + * Shortcut for `Data.get(a, b)` to setup usable component static method. + * @type {SHORTER.getInstance} + */ + const getInstance = (element, component) => Data.get(element, component); + + /** + * Global namespace for most components `fade` class. + */ const fadeClass = 'fade'; + /** + * Global namespace for most components `show` class. + */ const showClass = 'show'; + /** + * Global namespace for most components `dismiss` option. + */ const dataBsDismiss = 'data-bs-dismiss'; + /** + * Returns a namespaced `CustomEvent` specific to each component. + * @param {string} namespacedEventType Event.type + * @param {AddEventListenerOptions | boolean} eventProperties Event.options | Event.properties + * @returns {CustomEvent} a new namespaced event + */ function bootstrapCustomEvent(namespacedEventType, eventProperties) { const OriginalCustomEvent = new CustomEvent(namespacedEventType, { cancelable: true }); if (eventProperties instanceof Object) { - Object.keys(eventProperties).forEach((key) => { - Object.defineProperty(OriginalCustomEvent, key, { - value: eventProperties[key], - }); - }); + Object.assign(OriginalCustomEvent, eventProperties); } return OriginalCustomEvent; } + /** + * The raw value or a given component option. + * + * @typedef {string | Element | Function | number | boolean | null} niceValue + */ + + /** + * Utility to normalize component options + * + * @param {any} value the input value + * @return {niceValue} the normalized value + */ function normalizeValue(value) { - if (value === 'true') { + if (value === 'true') { // boolean return true; } - if (value === 'false') { + if (value === 'false') { // boolean return false; } - if (!Number.isNaN(+value)) { + if (!Number.isNaN(+value)) { // number return +value; } - if (value === '' || value === 'null') { + if (value === '' || value === 'null') { // null return null; } - // string / function / Element / Object + // string / function / Element / object return value; } + /** + * Utility to normalize component options + * + * @param {Element} element target + * @param {object} defaultOps component default options + * @param {object} inputOps component instance options + * @param {string} ns component namespace + * @return {object} normalized component options object + */ function normalizeOptions(element, defaultOps, inputOps, ns) { + // @ts-ignore + const data = { ...element.dataset }; const normalOps = {}; const dataOps = {}; - const data = { ...element.dataset }; Object.keys(data) .forEach((k) => { @@ -139,26 +333,58 @@ return normalOps; } + var version = "4.1.0"; + + const Version = version; + /* Native JavaScript for Bootstrap 5 | Base Component ----------------------------------------------------- */ + /** + * Returns a new `BaseComponent` instance. + */ class BaseComponent { - constructor(name, target, defaults, config) { + /** + * @param {Element | string} target Element or selector string + * @param {BSN.ComponentOptions?} config + */ + constructor(target, config) { const self = this; const element = queryElement(target); - if (element[name]) element[name].dispose(); + if (!element) return; + + const prevInstance = getInstance(element, self.name); + if (prevInstance) prevInstance.dispose(); + + /** @private */ self.element = element; - if (defaults && Object.keys(defaults).length) { - self.options = normalizeOptions(element, defaults, (config || {}), 'bs'); + if (self.defaults && Object.keys(self.defaults).length) { + /** @private */ + self.options = normalizeOptions(element, self.defaults, (config || {}), 'bs'); } - element[name] = self; + + Data.set(element, self.name, self); } - dispose(name) { + /* eslint-disable */ + /** @static */ + get version() { return Version; } + /* eslint-enable */ + + /** @static */ + get name() { return this.constructor.name; } + + /** @static */ + get defaults() { return this.constructor.defaults; } + + /** + * Removes component from target element; + */ + dispose() { const self = this; - self.element[name] = null; + Data.remove(self.element, self.name); Object.keys(self).forEach((prop) => { self[prop] = null; }); } } @@ -173,13 +399,27 @@ const alertSelector = `.${alertString}`; const alertDismissSelector = `[${dataBsDismiss}="${alertString}"]`; + /** + * Static method which returns an existing `Alert` instance associated + * to a target `Element`. + * + * @type {BSN.GetInstance} + */ + const getAlertInstance = (element) => getInstance(element, alertComponent); + // ALERT CUSTOM EVENTS // =================== + /** @type {BSN.AlertEvent.close} */ const closeAlertEvent = bootstrapCustomEvent(`close.bs.${alertString}`); + /** @type {BSN.AlertEvent.closed} */ const closedAlertEvent = bootstrapCustomEvent(`closed.bs.${alertString}`); - // ALERT EVENT HANDLERS - // ==================== + // ALERT EVENT HANDLER + // =================== + /** + * Alert `transitionend` callback. + * @param {Alert} self target Alert instance + */ function alertTransitionEnd(self) { const { element, relatedTarget } = self; toggleAlertHandler(self); @@ -193,6 +433,11 @@ // ALERT PRIVATE METHOD // ==================== + /** + * Toggle on / off the `click` event listener. + * @param {Alert} self the target alert instance + * @param {boolean | number} add + */ function toggleAlertHandler(self, add) { const action = add ? addEventListener : removeEventListener; if (self.dismiss) self.dismiss[action]('click', self.close); @@ -200,9 +445,11 @@ // ALERT DEFINITION // ================ + /** Creates a new Alert instance. */ class Alert extends BaseComponent { + /** @param {Element | string} target element or selector */ constructor(target) { - super(alertComponent, target); + super(target); // bind const self = this; @@ -210,19 +457,38 @@ const { element } = self; // the dismiss button + /** @private */ self.dismiss = queryElement(alertDismissSelector, element); + /** @private */ self.relatedTarget = null; // add event listener toggleAlertHandler(self, 1); } + /* eslint-disable */ + /** + * Returns component name string. + * @readonly @static + */ + get name() { return alertComponent; } + /* eslint-enable */ + // ALERT PUBLIC METHODS // ==================== + /** + * Private method that: + * * Hides the `.alert` element from the user, + * * Destroy the instance once animation is complete, + * * Removes the element from the DOM. + * + * @param {Event} e most likely the `click` event + * @returns {void} + */ close(e) { const target = e ? e.target : null; const self = e - ? e.target.closest(alertSelector)[alertComponent] + ? getAlertInstance(e.target.closest(alertSelector)) : this; const { element } = self; @@ -242,24 +508,47 @@ } } + /** Remove the component from target element. */ dispose() { toggleAlertHandler(this); - super.dispose(alertComponent); + super.dispose(); } } - Alert.init = { - component: alertComponent, + Object.assign(Alert, { selector: alertSelector, - constructor: Alert, - }; - + /** + * An `Alert` initialization callback. + * @type {BSN.InitCallback} + */ + callback: (element) => new Alert(element), + getInstance: getAlertInstance, + }); + + /** + * Add class to Element.classList + * + * @param {Element} element target + * @param {string} classNAME to add + */ function addClass(element, classNAME) { element.classList.add(classNAME); } + /** + * A global namespace for aria-pressed. + * @type {string} + */ + const ariaPressed = 'aria-pressed'; + + /** + * Global namespace for most components active class. + */ const activeClass = 'active'; + /** + * Global namespace for most components `toggle` option. + */ const dataBsToggle = 'data-bs-toggle'; /* Native JavaScript for Bootstrap 5 | Button @@ -270,7 +559,14 @@ const buttonString = 'button'; const buttonComponent = 'Button'; const buttonSelector = `[${dataBsToggle}="${buttonString}"]`; - const ariaPressed = 'aria-pressed'; + + /** + * Static method which returns an existing `Button` instance associated + * to a target `Element`. + * + * @type {BSN.GetInstance',sanitizeFn:null,dismissible:!1,animation:!0,delay:200},Le=/(iPhone|iPod|iPad)/,Oe=navigator.userAgentData?navigator.userAgentData.brands.some(t=>Le.test(t.brand)):Le.test(navigator.userAgent),De=d("show.bs.popover"),Ie=d("shown.bs.popover"),Be=d("hide.bs.popover"),Me=d("hidden.bs.popover");function Re(){it(this)}function je({target:t}){const e=this,{popover:n,element:o}=e;n&&n.contains(t)||t===o||o.contains(t)||e.hide()}function We(t,e){const n=e?c:"removeEventListener",{element:o,options:i}=t,{trigger:s,dismissible:a}=i;t.enabled=!!e,"hover"===s?(o[n]("mousedown",t.show),o[n]("mouseenter",t.show),Ae(o)&&o[n]("mousemove",t.update,T),a||o[n]("mouseleave",t.hide)):"click"===s?o[n](s,t.toggle):"focus"===s&&(Oe&&o[n]("click",Re),o[n]("focusin",t.show))}function $e(t,e){const n=e?c:"removeEventListener",{options:o,element:i,btn:s}=t,{trigger:a,dismissible:r}=o;r?s&&s[n]("click",t.hide):("focus"===a&&i[n]("focusout",t.hide),"hover"===a&&document[n]("touchstart",je,T)),Ae(i)||(window[n]("scroll",t.update,T),window[n]("resize",t.update,T))}function Fe(t){t.element.dispatchEvent(Ie)}function qe(t){!function(t){const{element:e,popover:n}=t;e.removeAttribute("aria-describedby"),n.remove(),t.timer=null}(t),t.element.dispatchEvent(Me)}class ze extends u{constructor(t,e){Se.container=ke(a(t)),super("Popover",t,Se,e);const{element:n}=this;this.timer=null,this.popover=null,this.arrow=null,this.btn=null,this.enabled=!1,this.id="popover-"+Ce(n);const{options:o}=this;if(this.options.container=Ae(n)?Se.container:a(o.container),Se.container=null,!o.content)return;!function(t){const{id:e,options:n}=t,{animation:o,customClass:i,sanitizeFn:s,placement:l,dismissible:c}=n;let{title:d,content:h}=n;const{template:u,btnClose:p}=n,m="bs-popover-"+ye[l];let f;if("object"==typeof u)f=u;else{const t=document.createElement("div");Ne(t,u,s),f=t.firstChild}t.popover=f.cloneNode(!0);const{popover:g}=t;g.setAttribute("id",e),g.setAttribute("role","tooltip");const v=a(".popover-header",g),w=a(".popover-body",g);t.arrow=a(".popover-arrow",g),c&&(d?d instanceof Element?Ne(d,p,s):d+=p:(v&&v.remove(),h instanceof Element?Ne(h,p,s):h+=p)),d&&v&&Ne(v,d,s),h&&w&&Ne(w,h,s),[t.btn]=g.getElementsByClassName("btn-close"),r(g,"popover")||b(g,"popover"),o&&!r(g,"fade")&&b(g,"fade"),i&&!r(g,i)&&b(g,i),r(g,m)||b(g,m)}(this);const{container:i}=this.options,s=getComputedStyle(n).position,l=getComputedStyle(i).position,c=i===document.body,d=!c&&"static"===l,h=!c&&"relative"===l,u=d&&Pe(i);this.positions={elementPosition:s,containerIsRelative:h,containerIsStatic:d,relContainer:u},this.update=this.update.bind(this),We(this,1)}update(t){Te(this,t)}toggle(t){const e=t?this.Popover:this,{popover:n,options:o}=e;Ee(n,o.container)?e.hide():e.show()}show(t){const e=t?this.Popover:this,{element:n,popover:o,options:i,id:a}=e,{container:l}=i;if(clearTimeout(e.timer),!Ee(o,l)){if(n.dispatchEvent(De),De.defaultPrevented)return;l.append(o),n.setAttribute("aria-describedby",a),e.update(t),r(o,"show")||b(o,"show"),$e(e,1),i.animation?s(o,()=>Fe(e)):Fe(e)}}hide(t){let e;if(t&&this.Popover)e=this.Popover;else if(t){const t=this.closest(".popover"),n=t&&a(`[aria-describedby="${t.id}"]`);e=n.Popover}else e=this;const{element:n,popover:o,options:i}=e;clearTimeout(e.timer),e.timer=setTimeout(()=>{if(Ee(o,i.container)){if(n.dispatchEvent(Be),Be.defaultPrevented)return;l(o,"show"),$e(e),i.animation?s(o,()=>qe(e)):qe(e)}},i.delay+17)}enable(){const t=this,{enabled:e}=t;e||(We(t,1),t.enabled=!e)}disable(){const t=this,{enabled:e,popover:n,options:o}=t;e&&(Ee(n,o.container)&&o.animation?(t.hide(),setTimeout(()=>We(t),i(n)+o.delay+17)):We(t),t.enabled=!e)}toggleEnabled(){this.enabled?this.disable():this.enable()}dispose(){const t=this,{popover:e,options:n}=t,{container:o,animation:i}=n;i&&Ee(e,o)?(t.options.delay=0,t.hide(),s(e,()=>We(t))):We(t),super.dispose("Popover")}}ze.init={component:"Popover",selector:He,constructor:ze};const Xe={offset:10,target:null},Ye=d("activate.bs.scrollspy");function Ve(t){const{target:e,scrollTarget:n,isWindow:o,options:i,itemsLength:s,scrollHeight:r}=t,{offset:l}=i,c=e.getElementsByTagName("A");if(t.scrollTop=o?n.pageYOffset:n.scrollTop,s!==c.length||Ge(n)!==r){let e,i,s;t.items=[],t.offsets=[],t.scrollHeight=Ge(n),t.maxScroll=t.scrollHeight-function({element:t,isWindow:e}){return e?window.innerHeight:t.getBoundingClientRect().height}(t),Array.from(c).forEach(n=>{e=n.getAttribute("href"),i=e&&"#"===e.charAt(0)&&"#"!==e.slice(-1)&&a(e),i&&(t.items.push(n),s=i.getBoundingClientRect(),t.offsets.push((o?s.top+t.scrollTop:i.offsetTop)-l))}),t.itemsLength=t.items.length}}function Ge(t){return t.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}function Ue(t){Array.from(t.getElementsByTagName("A")).forEach(t=>{r(t,"active")&&l(t,"active")})}function Ze(t,e){const{target:n,element:o}=t;Ue(n),t.activeItem=e,b(e,"active");const i=[];let s=e;for(;s!==document.body;)s=s.parentNode,(r(s,"nav")||r(s,"dropdown-menu"))&&i.push(s);i.forEach(t=>{const e=t.previousElementSibling;e&&!r(e,"active")&&b(e,"active")}),Ye.relatedTarget=e,o.dispatchEvent(Ye)}function Je(t,e){const n=e?c:"removeEventListener";t.scrollTarget[n]("scroll",t.refresh,T)}class Ke extends u{constructor(t,e){super("ScrollSpy",t,Xe,e);const{element:n,options:o}=this;this.target=a(o.target),this.target&&(this.scrollTarget=n.clientHeight=o){const e=s[i-1];return void(a!==e&&Ze(t,e))}const{offsets:r}=t;if(a&&n0)return t.activeItem=null,void Ue(e);s.forEach((e,o)=>{a!==e&&n>=r[o]&&(void 0===r[o+1]||n{e.style.height=an+"px",x(e),s(e,()=>hn(t))},50):n.isAnimating=!1,tn.relatedTarget=rn,on.dispatchEvent(tn)}function pn(t){const{tabContent:e}=t;e&&(ln.style.float="left",sn.style.float="left",cn=ln.scrollHeight),_e.relatedTarget=rn,nn.relatedTarget=on,on.dispatchEvent(_e),_e.defaultPrevented||(b(sn,"active"),l(ln,"active"),e&&(an=sn.scrollHeight,dn=an===cn,b(e,"collapsing"),e.style.height=cn+"px",x(e),ln.style.float="",sn.style.float=""),r(sn,"fade")?setTimeout(()=>{b(sn,"show"),s(sn,()=>{un(t)})},20):un(t),rn.dispatchEvent(nn))}function mn({nav:t}){const e=t.getElementsByClassName("active");return 1!==e.length||nt.some(t=>r(e[0].parentNode,t))?e.length>1&&(rn=e[e.length-1]):[rn]=e,rn}function fn(t){return a(mn(t).getAttribute("href"))}function gn(t,e){const n=e?c:"removeEventListener";t.element[n]("click",vn)}function vn(t){const e=this.Tab;t.preventDefault(),e.nav.isAnimating||e.show()}class bn extends u{constructor(t){super("Tab",t);const{element:n}=this;this.nav=n.closest(".nav");const{nav:o}=this;this.dropdown=o&&a(`.${nt[0]}-toggle`,o),ln=fn(this),this.tabContent=e&&ln.closest(".tab-content"),cn=ln.scrollHeight,o.isAnimating=!1,gn(this,1)}show(){const t=this,{element:e,nav:n,dropdown:o}=t;if(on=e,!r(on,"active")){if(sn=a(on.getAttribute("href")),rn=mn({nav:n}),ln=fn({nav:n}),en.relatedTarget=on,rn.dispatchEvent(en),en.defaultPrevented)return;n.isAnimating=!0,l(rn,"active"),rn.setAttribute("aria-selected","false"),b(on,"active"),on.setAttribute("aria-selected","true"),o&&(r(e.parentNode,"dropdown-menu")?r(o,"active")||b(o,"active"):r(o,"active")&&l(o,"active")),r(ln,"fade")?(l(ln,"show"),s(ln,()=>pn(t))):pn(t)}}dispose(){gn(this),super.dispose("Tab")}}bn.init={component:"Tab",selector:Qe,constructor:bn};const wn={animation:!0,autohide:!0,delay:500},yn=d("show.bs.toast"),En=d("hide.bs.toast"),An=d("shown.bs.toast"),Tn=d("hidden.bs.toast");function xn(t){const{element:e,options:n}=t;l(e,"showing"),e.dispatchEvent(An),n.autohide&&t.hide()}function Cn(t){const{element:e}=t;l(e,"showing"),l(e,"show"),b(e,"hide"),e.dispatchEvent(Tn)}function kn(t,e){const n=e?c:"removeEventListener";t.dismiss&&t.dismiss[n]("click",t.hide)}function Pn(t){clearTimeout(t.timer),kn(t)}class Nn extends u{constructor(t,e){super("Toast",t,wn,e);const{element:n,options:o}=this;o.animation&&!r(n,"fade")?b(n,"fade"):!o.animation&&r(n,"fade")&&l(n,"fade"),this.dismiss=a('[data-bs-dismiss="toast"]',n),this.show=this.show.bind(this),this.hide=this.hide.bind(this),kn(this,1)}show(){const t=this,{element:e}=t;if(e&&!r(e,"show")){if(e.dispatchEvent(yn),yn.defaultPrevented)return;clearTimeout(t.timer),t.timer=setTimeout(()=>function(t){const{element:e,options:n}=t;l(e,"hide"),x(e),b(e,"show"),b(e,"showing"),n.animation?s(e,()=>xn(t)):xn(t)}(t),10)}}hide(t){const e=this,{element:n,options:o}=e;if(n&&r(n,"show")){if(n.dispatchEvent(En),En.defaultPrevented)return;clearTimeout(e.timer),e.timer=setTimeout(()=>function(t){const{element:e,options:n}=t;b(e,"showing"),n.animation?(x(e),s(e,()=>Cn(t))):Cn(t)}(e),t?10:o.delay)}}dispose(){const t=this,{element:e,options:n}=t;t.hide(1),n.animation?s(e,()=>Pn(t)):Pn(t),super.dispose("Toast")}}Nn.init={component:"Toast",selector:".toast",constructor:Nn};const Hn=`[${w}="tooltip"],[data-tip="tooltip"]`,Sn={template:'',title:null,customClass:null,placement:"top",sanitizeFn:null,animation:!0,html:!1,delay:200},Ln=d("show.bs.tooltip"),On=d("shown.bs.tooltip"),Dn=d("hide.bs.tooltip"),In=d("hidden.bs.tooltip");function Bn(t){const{element:e}=t;Wn(t),e.hasAttribute("data-original-title")&&$n(t)}function Mn(t,e){const n=e?c:"removeEventListener";document[n]("touchstart",Fn,T),Ae(t.element)||(window[n]("scroll",t.update,T),window[n]("resize",t.update,T))}function Rn(t){Mn(t,1),t.element.dispatchEvent(On)}function jn(t){Mn(t),function(t){const{element:e,tooltip:n}=t;e.removeAttribute("aria-describedby"),n.remove(),t.timer=null}(t),t.element.dispatchEvent(In)}function Wn(t,e){const n=e?c:"removeEventListener",{element:o}=t;Ae(o)&&o[n]("mousemove",t.update,T),o[n]("mousedown",t.show),o[n]("mouseenter",t.show),o[n]("mouseleave",t.hide)}function $n(t,e){const n=["data-original-title","title"],{element:o}=t;o.setAttribute(n[e?0:1],e||o.getAttribute(n[0])),o.removeAttribute(n[e?1:0])}function Fn({target:t}){const{tooltip:e,element:n}=this;e.contains(t)||t===n||n.contains(t)||this.hide()}class qn extends u{constructor(t,e){const n=a(t);Sn.title=n.getAttribute("title"),Sn.container=ke(n),super("Tooltip",n,Sn,e);this.tooltip=null,this.arrow=null,this.timer=null,this.enabled=!1;const{options:o}=this;if(this.options.container=Ae(n)?Sn.container:a(o.container),Sn.container=null,Sn.title=null,!o.title)return;Fn.bind(this),this.update=this.update.bind(this),n.hasAttribute("title")&&$n(this,o.title),this.id="tooltip-"+Ce(n),function(t){const{options:e,id:n}=t,{title:o,template:i,customClass:s,animation:l,placement:c,sanitizeFn:d}=e,h="bs-tooltip-"+ye[c];if(!o)return;let u;if("object"==typeof i)u=i;else{const t=document.createElement("div");Ne(t,i,d),u=t.firstChild}t.tooltip=u.cloneNode(!0);const{tooltip:p}=t;Ne(a(".tooltip-inner",p),o,d),p.setAttribute("id",n),p.setAttribute("role","tooltip"),t.arrow=a(".tooltip-arrow",p),r(p,"tooltip")||b(p,"tooltip"),l&&!r(p,"fade")&&b(p,"fade"),s&&!r(p,s)&&b(p,s),r(p,h)||b(p,h)}(this);const{container:i}=this.options,s=getComputedStyle(n).position,l=getComputedStyle(i).position,c=i===document.body,d=!c&&"static"===l,h=!c&&"relative"===l,u=d&&Pe(i);this.positions={elementPosition:s,containerIsRelative:h,containerIsStatic:d,relContainer:u},Wn(this,1)}show(t){const e=t?this.Tooltip:this,{options:n,tooltip:o,element:i,id:a}=e,{container:l,animation:c}=n;if(clearTimeout(e.timer),!Ee(o,l)){if(i.dispatchEvent(Ln),Ln.defaultPrevented)return;l.append(o),i.setAttribute("aria-describedby",a),e.update(t),r(o,"show")||b(o,"show"),c?s(o,()=>Rn(e)):Rn(e)}}hide(t){const e=t?this.Tooltip:this,{options:n,tooltip:o,element:i}=e;clearTimeout(e.timer),e.timer=setTimeout(()=>{if(Ee(o,n.container)){if(i.dispatchEvent(Dn),Dn.defaultPrevented)return;l(o,"show"),n.animation?s(o,()=>jn(e)):jn(e)}},n.delay)}update(t){Te(this,t)}toggle(){const{tooltip:t,options:e}=this;Ee(t,e.container)?this.hide():this.show()}enable(){const t=this,{enabled:e}=t;e||(Wn(t,1),t.enabled=!e)}disable(){const t=this,{tooltip:e,options:n,enabled:o}=t;o&&(!Ee(e,n.container)&&n.animation?(t.hide(),setTimeout(()=>Wn(t),i(e)+n.delay+17)):Wn(t),t.enabled=!o)}toggleEnabled(){this.enabled?this.disable():this.enable()}dispose(){const t=this,{tooltip:e,options:n}=t;n.animation&&Ee(e,n.container)?(n.delay=0,t.hide(),s(e,()=>Bn(t))):Bn(t),super.dispose("Tooltip")}}qn.init={component:"Tooltip",selector:Hn,constructor:qn};const zn={Alert:v.init,Button:A.init,Carousel:Y.init,Collapse:et.init,Dropdown:Pt.init,Modal:ie.init,Offcanvas:we.init,Popover:ze.init,ScrollSpy:Ke.init,Tab:bn.init,Toast:Nn.init,Tooltip:qn.init};function Xn(t){const e=t instanceof Element?t:document;Object.keys(zn).forEach(t=>{const{constructor:n,selector:o}=zn[t];var i,s;i=n,s=e.querySelectorAll(o),Array.from(s).forEach(t=>new i(t))})}document.body?Xn():document.addEventListener("DOMContentLoaded",()=>Xn(),{once:!0});return{Alert:v,Button:A,Carousel:Y,Collapse:et,Dropdown:Pt,Modal:ie,Offcanvas:we,Popover:ze,ScrollSpy:Ke,Tab:bn,Toast:Nn,Tooltip:qn,initCallback:Xn,Version:"4.0.8"}})); +// Native JavaScript for Bootstrap v4.1.0 | 2021 © dnp_theme | MIT-License +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).BSN=e()}(this,(function(){"use strict";const t="webkitTransition"in document.head.style?"webkitTransitionEnd":"transitionend",e="webkitTransition"in document.head.style||"transition"in document.head.style,n="webkitTransition"in document.head.style?"webkitTransitionDelay":"transitionDelay",o="webkitTransition"in document.head.style?"webkitTransitionProperty":"transitionProperty";const i="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration";function s(t){const n=getComputedStyle(t),s=n[o],a=n[i],r=a.includes("ms")?1:1e3,l=e&&s&&"none"!==s?parseFloat(a)*r:0;return Number.isNaN(l)?0:l}function a(i,a){let r=0;const l=new Event(t),c=s(i),d=function(t){const i=getComputedStyle(t),s=i[o],a=i[n],r=a.includes("ms")?1:1e3,l=e&&s&&"none"!==s?parseFloat(a)*r:0;return Number.isNaN(l)?0:l}(i);if(c){const e=n=>{n.target===i&&(a.apply(i,[n]),i.removeEventListener(t,e),r=1)};i.addEventListener(t,e),setTimeout(()=>{r||i.dispatchEvent(l)},c+d+17)}else a.apply(i,[l])}function r(t,e){const n=e&&e instanceof Element?e:document;return t instanceof Element?t:n.querySelector(t)}function l(t,e){return t.classList.contains(e)}function c(t,e){t.classList.remove(e)}const d="addEventListener",u=new Map,h={set:(t,e,n)=>{u.has(e)||u.set(e,new Map);u.get(e).set(t,n)},getAllFor:t=>u.has(t)&&u.get(t)||null,get:(t,e)=>{const n=h.getAllFor(e);return n&&n.has(t)&&n.get(t)||null},remove:(t,e)=>{if(!u.has(e))return;const n=u.get(e);n.delete(t),0===n.size&&u.delete(e)}},m=(t,e)=>h.get(t,e);function p(t,e){const n=new CustomEvent(t,{cancelable:!0});return e instanceof Object&&Object.assign(n,e),n}function f(t){return"true"===t||"false"!==t&&(Number.isNaN(+t)?""===t||"null"===t?null:t:+t)}class g{constructor(t,e){const n=this,o=r(t);if(!o)return;const i=m(o,n.name);i&&i.dispose(),n.element=o,n.defaults&&Object.keys(n.defaults).length&&(n.options=function(t,e,n,o){const i={...t.dataset},s={},a={};return Object.keys(i).forEach(t=>{const e=t.includes(o)?t.replace(o,"").replace(/[A-Z]/,t=>t.toLowerCase()):t;a[e]=f(i[t])}),Object.keys(n).forEach(t=>{n[t]=f(n[t])}),Object.keys(e).forEach(t=>{s[t]=t in n?n[t]:t in a?a[t]:e[t]}),s}(o,n.defaults,e||{},"bs")),h.set(o,n.name,n)}get version(){return"4.1.0"}get name(){return this.constructor.name}get defaults(){return this.constructor.defaults}dispose(){const t=this;h.remove(t.element,t.name),Object.keys(t).forEach(e=>{t[e]=null})}}const v=t=>m(t,"Alert"),b=p("close.bs.alert"),w=p("closed.bs.alert");function y(t){const{element:e,relatedTarget:n}=t;E(t),n&&(w.relatedTarget=n),e.dispatchEvent(w),t.dispose(),e.remove()}function E(t,e){const n=e?d:"removeEventListener";t.dismiss&&t.dismiss[n]("click",t.close)}class A extends g{constructor(t){super(t);const{element:e}=this;this.dismiss=r('[data-bs-dismiss="alert"]',e),this.relatedTarget=null,E(this,1)}get name(){return"Alert"}close(t){const e=t?t.target:null,n=t?v(t.target.closest(".alert")):this,{element:o}=n;if(n&&o&&l(o,"show")){if(e&&(b.relatedTarget=e,n.relatedTarget=e),o.dispatchEvent(b),b.defaultPrevented)return;c(o,"show"),l(o,"fade")?a(o,()=>y(n)):y(n)}}dispose(){E(this),super.dispose()}}function T(t,e){t.classList.add(e)}Object.assign(A,{selector:".alert",callback:t=>new A(t),getInstance:v});const k="data-bs-toggle",x=`[${k}="button"]`,C=t=>m(t,"Button");function N(t,e){const n=e?d:"removeEventListener";t.element[n]("click",t.toggle)}class S extends g{constructor(t){super(t);const{element:e}=this;this.isActive=l(e,"active"),e.setAttribute("aria-pressed",!!this.isActive),N(this,1)}get name(){return"Button"}toggle(t){t&&t.preventDefault();const e=t?C(this):this,{element:n}=e;if(l(n,"disabled"))return;e.isActive=l(n,"active");const{isActive:o}=e,i=o?"false":"true";(o?c:T)(n,"active"),n.setAttribute("aria-pressed",i)}dispose(){N(this),super.dispose("Button")}}Object.assign(S,{selector:x,callback:t=>new S(t),getInstance:C});const H=!!(()=>{let t=!1;try{const e=Object.defineProperty({},"passive",{get:()=>(t=!0,t)});document[d]("DOMContentLoaded",(function t(){document.removeEventListener("DOMContentLoaded",t,e)}),e)}catch(t){throw Error("Passive events are not supported")}return t})()&&{passive:!0};function P(t){return t.offsetHeight}function L(t){const e=t.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight;return e.top<=n&&e.bottom>=0}const O='[data-bs-ride="carousel"]',I={pause:"hover",keyboard:!1,touch:!0,interval:5e3},j={relatedTarget:null,direction:"left",from:0,to:1},D=t=>m(t,"Carousel");let B=0,R=0,W=0;const M=p("slide.bs.carousel",j),$=p("slid.bs.carousel",j);function F(t){const e=t.target,n=D(e.closest(O)),{element:o,isAnimating:i}=n;l(o,"paused")||(T(o,"paused"),i||(clearInterval(n.timer),n.timer=null))}function z(t){const{target:e}=t,n=D(e.closest(O)),{isPaused:o,isAnimating:i,element:s}=n;!o&&l(s,"paused")&&(c(s,"paused"),i||(clearInterval(n.timer),n.timer=null,n.cycle()))}function q(t){t.preventDefault();const{target:e}=t,n=D(e.closest(O));if(n.isAnimating)return;const o=e.getAttribute("data-bs-slide-to");e&&!l(e,"active")&&o&&n.to(+o)}function X(t){t.preventDefault();const e=D(this.closest(O)),{controls:n}=e;n[1]&&this===n[1]?e.next():n[1]&&this===n[0]&&e.prev()}function Y({which:t}){const[e]=Array.from(document.querySelectorAll(O)).filter(t=>L(t));if(!e)return;const n=D(e);switch(t){case 39:n.next();break;case 37:n.prev()}}function V(t){const e=D(this);e&&!e.isTouch&&(B=t.changedTouches[0].pageX,this.contains(t.target)&&(e.isTouch=!0,K(e,1)))}function G(t){const{changedTouches:e,type:n}=t,o=D(this);o&&o.isTouch&&(R=e[0].pageX,"touchmove"===n&&e.length>1&&t.preventDefault())}function Z(t){const e=this,n=D(e);if(n&&n.isTouch&&(W=R||t.changedTouches[0].pageX,n.isTouch)){if((!e.contains(t.target)||!e.contains(t.relatedTarget))&&Math.abs(B-W)<75)return;RB&&(n.index-=1),n.isTouch=!1,n.to(n.index),K(n)}}function J(t,e){const{indicators:n}=t;Array.from(n).forEach(t=>c(t,"active")),t.indicators[e]&&T(n[e],"active")}function K(t,e){const{element:n}=t,o=e?d:"removeEventListener";n[o]("touchmove",G,H),n[o]("touchend",Z,H)}function Q(t,e){const{element:n,options:o,slides:i,controls:s,indicator:a}=t,{touch:r,pause:l,interval:c,keyboard:u}=o,h=e?d:"removeEventListener";l&&c&&(n[h]("mouseenter",F),n[h]("mouseleave",z),n[h]("touchstart",F,H),n[h]("touchend",z,H)),r&&i.length>1&&n[h]("touchstart",V,H),s.forEach(t=>{t&&t[h]("click",X)}),a&&a[h]("click",q),u&&window[h]("keydown",Y)}function U(t){const{slides:e,element:n}=t;return Array.from(e).indexOf(n.getElementsByClassName("carousel-item active")[0])||0}class _ extends g{constructor(t,e){super(t,e);const n=this;n.timer=null,n.direction="left",n.isPaused=!1,n.isAnimating=!1,n.index=0,n.isTouch=!1;const{element:o}=n;n.slides=o.getElementsByClassName("carousel-item");const{slides:i}=n;if(i.length<2)return;n.controls=[r(".carousel-control-prev",o),r(".carousel-control-next",o)],n.indicator=r(".carousel-indicators",o),n.indicators=n.indicator&&n.indicator.querySelectorAll("[data-bs-slide-to]")||[];const{options:s}=n;n.options.interval=!0===s.interval?I.interval:s.interval,U(n)<0&&(i.length&&T(i[0],"active"),n.indicators.length&&J(n,0)),Q(n,1),s.interval&&n.cycle()}get name(){return"Carousel"}get defaults(){return I}cycle(){const t=this,{isPaused:e,element:n,options:o}=t;t.timer&&(clearInterval(t.timer),t.timer=null),e&&(c(n,"paused"),t.isPaused=!e),t.timer=setInterval(()=>{L(n)&&(t.index+=1,t.to(t.index))},o.interval)}pause(){const t=this,{element:e,options:n,isPaused:o}=t;n.interval&&!o&&(clearInterval(t.timer),t.timer=null,T(e,"paused"),t.isPaused=!o)}next(){const t=this;t.isAnimating||(t.index+=1,t.to(t.index))}prev(){const t=this;t.isAnimating||(t.index-=1,t.to(t.index))}to(t){const e=this,{element:n,isAnimating:o,slides:i,options:r}=e,d=U(e);let u=t;if(o||d===u)return;du||d===i.length-1&&0===u)&&(e.direction="right");const{direction:h}=e;u<0?u=i.length-1:u>=i.length&&(u=0);const m="left"===h?"next":"prev",p="left"===h?"start":"end",f={relatedTarget:i[u],from:d,to:u,direction:h};Object.assign(M,f),Object.assign($,f),n.dispatchEvent(M),M.defaultPrevented||(e.index=u,clearInterval(e.timer),e.timer=null,e.isAnimating=!0,J(e,u),s(i[u])&&l(n,"slide")?(T(i[u],"carousel-item-"+m),P(i[u]),T(i[u],"carousel-item-"+p),T(i[d],"carousel-item-"+p),a(i[u],()=>function(t){const{index:e,direction:n,element:o,slides:i,options:s,isAnimating:a}=t;if(a&&D(o)){const a=U(t),r="left"===n?"next":"prev",d="left"===n?"start":"end";t.isAnimating=!1,T(i[e],"active"),c(i[a],"active"),c(i[e],"carousel-item-"+r),c(i[e],"carousel-item-"+d),c(i[a],"carousel-item-"+d),o.dispatchEvent($),document.hidden||!s.interval||l(o,"paused")||t.cycle()}}(e))):(T(i[u],"active"),c(i[d],"active"),setTimeout(()=>{e.isAnimating=!1,n&&r.interval&&!l(n,"paused")&&e.cycle(),n.dispatchEvent($)},17)))}dispose(){const t=this,{slides:e}=t,n=["start","end","prev","next"];Array.from(e).forEach((e,o)=>{l(e,"active")&&J(t,o),n.forEach(t=>c(e,"carousel-item-"+t))}),Q(t),clearInterval(t.timer),super.dispose()}}Object.assign(_,{selector:O,callback:t=>new _(t),getInstance:D});function tt(t){return r(t.getAttribute("data-bs-target")||t.getAttribute("href"))||t.closest(t.getAttribute("data-bs-parent"))||r(t.getAttribute("data-bs-container"))}const et=`[${k}="collapse"]`,nt={parent:null},ot=t=>m(t,"Collapse"),it=p("show.bs.collapse"),st=p("shown.bs.collapse"),at=p("hide.bs.collapse"),rt=p("hidden.bs.collapse");function lt(t){const{element:e,parent:n,triggers:o}=t;e.dispatchEvent(at),at.defaultPrevented||(t.isAnimating=!0,n&&(n.isAnimating=!0),e.style.height=e.scrollHeight+"px",c(e,"collapse"),c(e,"show"),T(e,"collapsing"),P(e),e.style.height="0px",a(e,()=>{t.isAnimating=!1,n&&(n.isAnimating=!1),o.forEach(t=>t.setAttribute("aria-expanded","false")),c(e,"collapsing"),T(e,"collapse"),e.style.height="",e.dispatchEvent(rt)}))}function ct(t,e){const n=e?d:"removeEventListener",{triggers:o}=t;o.length&&o.forEach(t=>t[n]("click",dt))}function dt(t){const{target:e}=t,n=e.closest(et),o=tt(n),i=o&&ot(o);i&&i.toggle(),n&&"A"===n.tagName&&t.preventDefault()}class ut extends g{constructor(t,e){super(t,e);const{element:n,options:o}=this;this.triggers=Array.from(document.querySelectorAll(et)).filter(t=>tt(t)===n),this.parent=r(o.parent);const{parent:i}=this;this.isAnimating=!1,i&&(i.isAnimating=!1),ct(this,1)}get name(){return"Collapse"}get defaults(){return nt}toggle(){l(this.element,"show")?this.hide():this.show()}hide(){const{triggers:t,isAnimating:e}=this;e||(lt(this),t.length&&t.forEach(t=>T(t,"collapsed")))}show(){const t=this,{element:e,parent:n,triggers:o,isAnimating:i}=t;let s,r;n&&(s=Array.from(n.querySelectorAll(".collapse.show")).find(t=>ot(t)),r=s&&ot(s)),n&&(!n||n.isAnimating)||i||(r&&s!==e&&(lt(r),r.triggers.forEach(t=>{T(t,"collapsed")})),function(t){const{element:e,parent:n,triggers:o}=t;e.dispatchEvent(it),it.defaultPrevented||(t.isAnimating=!0,n&&(n.isAnimating=!0),T(e,"collapsing"),c(e,"collapse"),e.style.height=e.scrollHeight+"px",a(e,()=>{t.isAnimating=!1,n&&(n.isAnimating=!1),o.forEach(t=>t.setAttribute("aria-expanded","true")),c(e,"collapsing"),T(e,"collapse"),T(e,"show"),e.style.height="",e.dispatchEvent(st)}))}(t),o.length&&o.forEach(t=>c(t,"collapsed")))}dispose(){const{parent:t}=this;ct(this),t&&delete t.isAnimating,super.dispose()}}Object.assign(ut,{selector:".collapse",callback:t=>new ut(t),getInstance:ot});const ht=["dropdown","dropup","dropstart","dropend"];function mt(t){const e=t.closest("A");return t&&(t.hasAttribute("href")&&"#"===t.href.slice(-1)||e&&e.hasAttribute("href")&&"#"===e.href.slice(-1))}function pt(t){t.focus()}const[ft]=ht,gt=`[${k}="${ft}"]`,vt=t=>m(t,"Dropdown"),bt=ht[1],wt=ht[2],yt=ht[3],Et=["d-block","invisible"],At=[ft,bt],Tt=[wt,yt],kt={offset:5,display:"dynamic"},xt=p("show.bs."+ft),Ct=p("shown.bs."+ft),Nt=p("hide.bs."+ft),St=p("hidden.bs."+ft);function Ht(t,e){const{element:n,menu:o,originalClass:i,menuEnd:s,options:a}=t,{offset:r}=a,d=n.parentElement;if(["margin","top","bottom","left","right"].forEach(t=>{o.style[t]=""}),c(d,"position-static"),!e){const t=l(o,"dropdown-menu-end");return d.className=i.join(" "),void(t&&!s?c(o,"dropdown-menu-end"):!t&&s&&T(o,"dropdown-menu-end"))}let u=ht.find(t=>i.includes(t))||ft,h={dropdown:[r,0,0],dropup:[0,0,r],dropstart:[-1,r,0],dropend:[-1,0,0,r]};const m={dropdown:{top:"100%"},dropup:{top:"auto",bottom:"100%"},dropstart:{left:"auto",right:"100%"},dropend:{left:"100%",right:"auto"},menuEnd:{right:0,left:"auto"}};Et.forEach(t=>T(o,t));const p=new RegExp(`\\b(${ft}|${bt}|${wt}|${yt})+`),f=n.offsetWidth,g=n.offsetHeight,v=o.offsetWidth,b=o.offsetHeight,w=document.documentElement,y=document.body,E=w.clientWidth||y.clientWidth,A=w.clientHeight||y.clientHeight,k=n.getBoundingClientRect(),x=k.left+f-v<0,C=k.left-v<0,N=k.left+v>=E,S=k.left+v+f>=E,H=k.top+b>=A,P=k.top+b+g>=A,L=k.top-b<0;Tt.includes(u)&&C&&S&&(u=ft),Tt.includes(u)&&H&&(u=bt),u===wt&&C&&!H&&(u=yt),u===yt&&S&&!H&&(u=wt),u===bt&&L&&!P&&(u=ft),u===ft&&P&&!L&&(u=bt),h=h[u],o.style.margin=""+h.map(t=>t?t+"px":t).join(" "),Object.keys(m[u]).forEach(t=>{o.style[t]=m[u][t]}),l(d,u)||(d.className=d.className.replace(p,u)),At.includes(u)&&(!s&&N?T(o,"dropdown-menu-end"):s&&x&&c(o,"dropdown-menu-end"),l(o,"dropdown-menu-end")&&Object.keys(m.menuEnd).forEach(t=>{o.style[t]=m.menuEnd[t]})),Et.forEach(t=>c(o,t))}function Pt(t){const e=t.open?d:"removeEventListener";document[e]("click",It),document[e]("focus",It),document[e]("keydown",Dt),document[e]("keyup",Bt),"dynamic"===t.options.display&&(window[e]("scroll",Rt,H),window[e]("resize",Rt,H))}function Lt(t,e){const n=e?d:"removeEventListener";t.element[n]("click",jt)}function Ot(){const t=[...ht,"btn-group","input-group"].map(t=>document.getElementsByClassName(t+" show")).find(t=>t.length);return t&&t.length?Array.from(t[0].children).find(t=>t.hasAttribute(k)):null}function It(t){const{target:e,type:n}=t;if(!e.closest)return;const o=Ot();if(!o)return;const i=vt(o),s=o.parentNode,a=i&&i.menu,r=null!==e.closest(gt),l=s&&s.contains(e)&&("form"===e.tagName||null!==e.closest("form"));"click"===n&&mt(e)&&t.preventDefault(),("focus"!==n||e!==o&&e!==a&&!a.contains(e))&&(l||r||i&&i.hide(o))}function jt(t){vt(this).toggle(this),mt(t.target)&&t.preventDefault()}function Dt(t){38!==t.which&&40!==t.which||t.preventDefault()}function Bt({which:t}){const e=Ot(),n=vt(e),{menu:o,menuItems:i,open:s}=n,a=document.activeElement,r=a===e,l=o.contains(a),c=a.parentNode===o||a.parentNode.parentNode===o;let d=i.indexOf(a);c&&(r?d=0:38===t?d=d>1?d-1:0:40===t&&(d=d{t.children.length&&"A"===t.children[0].tagName&&n.menuItems.push(t.children[0]),"A"===t.tagName&&n.menuItems.push(t)}),n.open=!1,Lt(n,1)}get name(){return"Dropdown"}get defaults(){return kt}toggle(){const{open:t}=this;t?this.hide():this.show()}show(){const t=this,e=r(ht.concat("btn-group","input-group").map(t=>`.${t}.show`).join(",")),n=e&&r(gt,e);n&&vt(n).hide();const{element:o,menu:i,open:s}=t,a=o.parentNode;a.dispatchEvent(xt),xt.defaultPrevented||(Ht(t,1),T(i,"show"),T(a,"show"),o.setAttribute("aria-expanded",!0),t.open=!s,setTimeout(()=>{pt(o),Pt(t),a.dispatchEvent(Ct)},1))}hide(){const t=this,{element:e,menu:n,open:o}=t,i=e.parentNode;i.dispatchEvent(Nt),Nt.defaultPrevented||(c(n,"show"),c(i,"show"),Ht(t),e.setAttribute("aria-expanded",!1),t.open=!o,setTimeout(()=>Pt(t),1),i.dispatchEvent(St))}dispose(){const{element:t}=this;l(t.parentNode,"show")&&this.open&&this.hide(),Lt(this),super.dispose()}}Object.assign(Wt,{selector:gt,callback:t=>new Wt(t),getInstance:vt});const Mt=[...document.getElementsByClassName("fixed-top"),...document.getElementsByClassName("fixed-bottom"),...document.getElementsByClassName("sticky-top"),...document.getElementsByClassName("is-fixed")];function $t(){const{clientWidth:t}=document.documentElement;return Math.abs(window.innerWidth-t)}function Ft(t,e){const n=document.body,o=getComputedStyle(n),i=parseInt(o.paddingRight,10),s="hidden"===o.overflow&&i?0:t;e&&(n.style.overflow="hidden",n.style.paddingRight=i+s+"px",Mt.length&&Mt.forEach(t=>{const e=l(t,"sticky-top"),n=getComputedStyle(t).paddingRight;if(t.style.paddingRight=parseInt(n,10)+s+"px",e){const e=getComputedStyle(t).marginRight;t.style.marginRight=parseInt(e,10)-s+"px"}}))}const zt="modal-backdrop",qt="offcanvas-backdrop",Xt=document.createElement("div");function Yt(){return r(".modal.show,.offcanvas.show")}function Vt(t){const e=t?zt:qt;[zt,qt].forEach(t=>{c(Xt,t)}),T(Xt,e)}function Gt(t,e){Vt(e),document.body.append(Xt),t&&T(Xt,"fade")}function Zt(){T(Xt,"show"),P(Xt)}function Jt(){c(Xt,"show")}function Kt(){Yt()||(c(Xt,"fade"),Xt.remove(),function(){const t=document.body;t.style.paddingRight="",t.style.overflow="",Mt.length&&Mt.forEach(t=>{t.style.paddingRight="",t.style.marginRight=""})}())}function Qt(t){return"hidden"!==getComputedStyle(t).visibility&&null!==t.offsetParent}const Ut=`[${k}="modal"]`,_t=t=>m(t,"Modal"),te={backdrop:!0,keyboard:!0},ee=p("show.bs.modal"),ne=p("shown.bs.modal"),oe=p("hide.bs.modal"),ie=p("hidden.bs.modal");function se(t){const{element:e,scrollbarWidth:n}=t,o=document.body,i=document.documentElement,s=i.clientHeight!==i.scrollHeight||o.clientHeight!==o.scrollHeight,a=e.clientHeight!==e.scrollHeight;!a&&n&&(e.style.paddingRight=n+"px"),Ft(n,a||s)}function ae(t,e){const n=e?d:"removeEventListener";window[n]("resize",t.update,H),t.element[n]("click",pe),document[n]("keydown",me)}function re(t,e){const n=e?d:"removeEventListener",{triggers:o}=t;o.length&&o.forEach(t=>t[n]("click",he))}function le(t){const{triggers:e}=t;if(Kt(),t.element.style.paddingRight="",t.isAnimating=!1,e.length){const t=e.find(t=>Qt(t));t&&pt(t)}}function ce(t){const{element:e,relatedTarget:n}=t;pt(e),t.isAnimating=!1,ae(t,1),ne.relatedTarget=n,e.dispatchEvent(ne)}function de(t){const{element:e,hasFade:n}=t;e.style.display="block",se(t),Yt()||(document.body.style.overflow="hidden"),T(e,"show"),e.removeAttribute("aria-hidden"),e.setAttribute("aria-modal",!0),n?a(e,()=>ce(t)):ce(t)}function ue(t,e){const{element:n,options:o,relatedTarget:i,hasFade:s}=t;n.style.display="",o.backdrop&&!e&&s&&l(Xt,"show")&&!Yt()?(Jt(),a(Xt,()=>le(t))):le(t),ae(t),ie.relatedTarget=i,n.dispatchEvent(ie)}function he(t){const{target:e}=t,n=e.closest(Ut),o=tt(n),i=o&&_t(o);"A"===n.tagName&&t.preventDefault(),i.isAnimating||(i.relatedTarget=n,i.toggle())}function me({which:t}){const e=r(".modal.show"),n=_t(e),{options:o,isAnimating:i}=n;!i&&o.keyboard&&27===t&&l(e,"show")&&(n.relatedTarget=null,n.hide())}function pe(t){const e=this,n=_t(e);if(n.isAnimating)return;const{options:o,isStatic:i,modalDialog:r}=n,{backdrop:l}=o,{target:d}=t,u=document.getSelection().toString().length,h=r.contains(d),m=d.closest('[data-bs-dismiss="modal"]');i&&!h?(T(e,"modal-static"),n.isAnimating=!0,a(r,()=>function(t){const e=s(t.modalDialog)+17;c(t.element,"modal-static"),setTimeout(()=>{t.isAnimating=!1},e)}(n))):(m||!u&&!i&&!h&&l)&&(n.relatedTarget=m||null,n.hide(),t.preventDefault())}class fe extends g{constructor(t,e){super(t,e);const{element:n}=this;this.modalDialog=r(".modal-dialog",n),this.triggers=Array.from(document.querySelectorAll(Ut)).filter(t=>tt(t)===n),this.isStatic="static"===this.options.backdrop,this.hasFade=l(n,"fade"),this.isAnimating=!1,this.scrollbarWidth=$t(),this.relatedTarget=null,re(this,1),this.update=this.update.bind(this)}get name(){return"Modal"}get defaults(){return te}toggle(){l(this.element,"show")?this.hide():this.show()}show(){const t=this,{element:e,options:n,isAnimating:o,hasFade:i,relatedTarget:a}=t,{backdrop:r}=n;let c=0;if(l(e,"show")&&!o)return;if(ee.relatedTarget=a||null,e.dispatchEvent(ee),ee.defaultPrevented)return;const d=Yt();if(d&&d!==e){(_t(d)||m(d,"Offcanvas")).hide()}t.isAnimating=!0,r?(d||l(Xt,"show")?Vt(1):Gt(i,1),c=s(Xt),l(Xt,"show")||Zt(),setTimeout(()=>de(t),c)):(de(t),d&&l(Xt,"show")&&Jt())}hide(t){const e=this,{element:n,isAnimating:o,hasFade:i,relatedTarget:s}=e;(l(n,"show")||o)&&(oe.relatedTarget=s||null,n.dispatchEvent(oe),oe.defaultPrevented||(e.isAnimating=!0,c(n,"show"),n.setAttribute("aria-hidden",!0),n.removeAttribute("aria-modal"),i&&1!==t?a(n,()=>ue(e)):ue(e,t)))}update(){l(this.element,"show")&&se(this)}dispose(){this.hide(1),re(this),super.dispose()}}Object.assign(fe,{selector:".modal",callback:t=>new fe(t),getInstance:_t});const ge=`[${k}="offcanvas"]`,ve=t=>m(t,"Offcanvas"),be={backdrop:!0,keyboard:!0,scroll:!1},we=p("show.bs.offcanvas"),ye=p("shown.bs.offcanvas"),Ee=p("hide.bs.offcanvas"),Ae=p("hidden.bs.offcanvas");function Te(t,e){const n=e?d:"removeEventListener";t.triggers.forEach(t=>t[n]("click",Ne))}function ke(t){const e=t?d:"removeEventListener";document[e]("keydown",He),document[e]("click",Se)}function xe(t){const{element:e,options:n}=t;n.scroll||(document.body.style.overflow="hidden",function(t){const e=document.body,n=document.documentElement,o=n.clientHeight!==n.scrollHeight||e.clientHeight!==e.scrollHeight;Ft(t.scrollbarWidth,o)}(t)),T(e,"offcanvas-toggling"),T(e,"show"),e.style.visibility="visible",a(e,()=>function(t){const{element:e,triggers:n}=t;c(e,"offcanvas-toggling"),e.removeAttribute("aria-hidden"),e.setAttribute("aria-modal",!0),e.setAttribute("role","dialog"),t.isAnimating=!1,n.length&&n.forEach(t=>t.setAttribute("aria-expanded",!0));e.dispatchEvent(ye),ke(1),pt(e)}(t))}function Ce(t){const{element:e,options:n}=t,o=Yt();e.blur(),!o&&n.backdrop&&l(Xt,"show")?(Jt(),a(Xt,()=>Pe(t))):Pe(t)}function Ne(t){const e=this.closest(ge),n=tt(e),o=n&&ve(n);"A"===e.tagName&&t.preventDefault(),o&&o.toggle()}function Se(t){const e=r(".offcanvas.show");if(!e)return;const n=r('[data-bs-dismiss="offcanvas"]',e),o=ve(e);if(!o)return;const{options:i,triggers:s}=o,{target:a}=t,l=a.closest(ge);l&&"A"===l.tagName&&t.preventDefault(),(!e.contains(a)&&i.backdrop&&(!l||l&&!s.includes(l))||n&&n.contains(a))&&o.hide()}function He({which:t}){const e=r(".offcanvas.show");if(!e)return;const n=ve(e);n&&n.options.keyboard&&27===t&&n.hide()}function Pe(t){const{element:e,triggers:n}=t;if(e.setAttribute("aria-hidden",!0),e.removeAttribute("aria-modal"),e.removeAttribute("role"),e.style.visibility="",t.isAnimating=!1,n.length){n.forEach(t=>t.setAttribute("aria-expanded",!1));const t=n.find(t=>Qt(t));t&&pt(t)}Kt(),e.dispatchEvent(Ae),c(e,"offcanvas-toggling"),ke()}class Le extends g{constructor(t,e){super(t,e);const{element:n}=this;this.triggers=Array.from(document.querySelectorAll(ge)).filter(t=>tt(t)===n),this.isAnimating=!1,this.scrollbarWidth=$t(),Te(this,1)}get name(){return"Offcanvas"}get defaults(){return be}toggle(){l(this.element,"show")?this.hide():this.show()}show(){const t=ve(this)||this,{element:e,options:n,isAnimating:o}=t;let i=0;if(l(e,"show")||o)return;if(e.dispatchEvent(we),we.defaultPrevented)return;const a=Yt();if(a&&a!==e){(ve(a)||m(a,"Modal")).hide()}t.isAnimating=!0,n.backdrop?(a?Vt():Gt(1),i=s(Xt),l(Xt,"show")||Zt(),setTimeout(()=>xe(t),i)):(xe(t),a&&l(Xt,"show")&&Jt())}hide(t){const e=this,{element:n,isAnimating:o}=e;l(n,"show")&&!o&&(n.dispatchEvent(Ee),Ee.defaultPrevented||(e.isAnimating=!0,T(n,"offcanvas-toggling"),c(n,"show"),t?Ce(e):a(n,()=>Ce(e))))}dispose(){this.hide(1),Te(this),super.dispose()}}Object.assign(Le,{selector:".offcanvas",callback:t=>new Le(t),getInstance:ve});function Oe(t){return[SVGElement,HTMLImageElement,HTMLVideoElement].some(e=>t instanceof e)}var Ie={top:"top",bottom:"bottom",left:"start",right:"end"};function je(t,e){return e.contains(t)}function De(t,e){const n=/\b(top|bottom|start|end)+/,o=t.tooltip||t.popover;o.style.top="",o.style.left="",o.style.right="";const i=!!t.popover;let s={w:o.offsetWidth,h:o.offsetHeight};const a=document.documentElement.clientWidth||document.body.clientWidth,r=document.documentElement.clientHeight||document.body.clientHeight,{element:l,options:c,arrow:d,positions:u}=t;let{container:h,placement:m}=c,p=h===document.body;const{elementPosition:f,containerIsStatic:g,relContainer:v}=u;let{containerIsRelative:b}=u;h=v||h,b=g&&v?1:b,p=h===document.body;const w=h.getBoundingClientRect(),y=b?w.left:0,E=b?w.right:a,A="absolute"===f,T=l.getBoundingClientRect(),k=p?{x:window.pageXOffset,y:window.pageYOffset}:{x:h.scrollLeft,y:h.scrollTop},x=l.offsetWidth,C=l.offsetHeight,N=b?l.offsetTop:T.top,S=b?l.offsetLeft:T.left;let H,P,L,O,I,j;d.style.top="",d.style.left="",d.style.right="";let D=T.top-s.h<0,B=T.top+s.h+C>=r,R=T.left-s.w=E;D=["left","right"].includes(m)?T.top+C/2-s.h/2<0:D,B=["left","right"].includes(m)?T.top+s.h/2+C/2>=r:B,R=["top","bottom"].includes(m)?T.left+x/2-s.w/2=E:W,m=["left","right"].includes(m)&&R&&W?"top":m,m="top"===m&&D?"bottom":m,m="bottom"===m&&B?"top":m,m="left"===m&&R?"right":m,m="right"===m&&W?"left":m,o.className.includes(m)||(o.className=o.className.replace(n,Ie[m])),s={w:o.offsetWidth,h:o.offsetHeight};const M=d.offsetWidth||0,$=d.offsetHeight||0,F=M/2;if(["left","right"].includes(m))P="left"===m?S+k.x-s.w-(i?M:0):S+k.x+x+(i?M:0),D?(H=N+k.y,O=C/2-M):B?(H=N+k.y-s.h+C,O=s.h-C/2-M):(H=N+k.y-s.h/2+C/2,O=s.h/2-$/2);else if(["top","bottom"].includes(m))if(e&&Oe(l)){const t=b?e.layerX+(A?l.offsetLeft:0):e.pageX,n=b?e.layerY+(A?l.offsetTop:0):e.pageY;H="top"===m?n-s.h-(i?M:$):n+$,e.clientX-s.w/2=E?(P="auto",L=0,I=s.w-(E-t)-F):(P=t-s.w/2,I=s.w/2-F)}else H="top"===m?N+k.y-s.h-(i?$:0):N+k.y+C+(i?$:0),R?(P=0,I=S+x/2-F):W?(P="auto",L=0,j=x/2+(w.right-T.right)-F):(P=S+k.x-s.w/2+x/2,I=s.w/2-F);o.style.top=H+"px",o.style.left="auto"===P?P:P+"px",o.style.right=void 0!==L?L+"px":"",void 0!==O&&(d.style.top=O+"px"),void 0!==I?d.style.left=I+"px":void 0!==j&&(d.style.right=j+"px")}let Be=1;function Re(t,e){return Be+=1,t[e]||Be}function We(t){const e=t.closest(".modal"),n=t.closest(".fixed-top,.fixed-bottom");return e||n||document.body}function Me(t){let e=null,n=t;for(;n!==document.body;)if(n=n.parentElement,"relative"===getComputedStyle(n).position){e=n;break}return e}function $e(t,e,n){if("string"!=typeof e||e.length)if(e instanceof Element)t.append(e);else{let o=e.trim();"function"==typeof n&&(o=n(o));const i=(new DOMParser).parseFromString(o,"text/html"),{body:s}=i,a=s.children.length?"innerHTML":"innerText";t[a]=s[a]}}const Fe=`[${k}="popover"],[data-tip="popover"]`,ze=t=>m(t,"Popover"),qe={template:'',title:null,content:null,customClass:null,trigger:"hover",placement:"top",btnClose:'',sanitizeFn:null,dismissible:!1,animation:!0,delay:200,container:null},Xe=/(iPhone|iPod|iPad)/,Ye=navigator.userAgentData?navigator.userAgentData.brands.some(t=>Xe.test(t.brand)):Xe.test(navigator.userAgent),Ve=p("show.bs.popover"),Ge=p("shown.bs.popover"),Ze=p("hide.bs.popover"),Je=p("hidden.bs.popover");function Ke({target:t}){const e=this,{popover:n,element:o}=e;n&&n.contains(t)||t===o||o.contains(t)||e.hide()}function Qe(t,e){const n=e?d:"removeEventListener",{element:o,options:i}=t,{trigger:s,dismissible:a}=i;t.enabled=!!e,"hover"===s?(o[n]("mousedown",t.show),o[n]("mouseenter",t.show),Oe(o)&&o[n]("mousemove",t.update,H),a||o[n]("mouseleave",t.hide)):"click"===s?o[n](s,t.toggle):"focus"===s&&(Ye&&o[n]("click",()=>pt(o)),o[n]("focusin",t.show))}function Ue(t,e){const n=e?d:"removeEventListener",{options:o,element:i,btn:s}=t,{trigger:a,dismissible:r}=o;r?s&&s[n]("click",t.hide):("focus"===a&&i[n]("focusout",t.hide),"hover"===a&&document[n]("touchstart",Ke,H)),Oe(i)||(window[n]("scroll",t.update,H),window[n]("resize",t.update,H))}function _e(t){t.element.dispatchEvent(Ge)}function tn(t){!function(t){const{element:e,popover:n}=t;e.removeAttribute("aria-describedby"),n.remove(),t.timer=null}(t),t.element.dispatchEvent(Je)}class en extends g{constructor(t,e){const n=r(t);qe.container=We(n),super(t,e);this.timer=null,this.popover=null,this.arrow=null,this.btn=null,this.enabled=!1,this.id="popover-"+Re(n);const{options:o}=this;if(this.options.container=Oe(n)?qe.container:r(o.container),qe.container=null,!o.content)return;!function(t){const{id:e,options:n}=t,{animation:o,customClass:i,sanitizeFn:s,placement:a,dismissible:c}=n;let{title:d,content:u}=n;const{template:h,btnClose:m}=n,p="bs-popover-"+Ie[a];let f;if("object"==typeof h)f=h;else{const t=document.createElement("div");$e(t,h,s),f=t.firstChild}t.popover=f.cloneNode(!0);const{popover:g}=t;g.setAttribute("id",e),g.setAttribute("role","tooltip");const v=r(".popover-header",g),b=r(".popover-body",g);t.arrow=r(".popover-arrow",g),c&&(d?d instanceof Element?$e(d,m,s):d+=m:(v&&v.remove(),u instanceof Element?$e(u,m,s):u+=m)),d&&v&&$e(v,d,s),u&&b&&$e(b,u,s),[t.btn]=g.getElementsByClassName("btn-close"),l(g,"popover")||T(g,"popover"),o&&!l(g,"fade")&&T(g,"fade"),i&&!l(g,i)&&T(g,i),l(g,p)||T(g,p)}(this);const{container:i}=this.options,s=getComputedStyle(n).position,a=getComputedStyle(i).position,c=i===document.body,d=!c&&"static"===a,u=!c&&"relative"===a,h=d&&Me(i);this.positions={elementPosition:s,containerIsRelative:u,containerIsStatic:d,relContainer:h},this.update=this.update.bind(this),Qe(this,1)}get name(){return"Popover"}get defaults(){return qe}update(t){De(this,t)}toggle(t){const e=t?ze(this):this,{popover:n,options:o}=e;je(n,o.container)?e.hide():e.show()}show(t){const e=t?ze(this):this,{element:n,popover:o,options:i,id:s}=e,{container:r}=i;if(clearTimeout(e.timer),!je(o,r)){if(n.dispatchEvent(Ve),Ve.defaultPrevented)return;r.append(o),n.setAttribute("aria-describedby",s),e.update(t),l(o,"show")||T(o,"show"),Ue(e,1),i.animation?a(o,()=>_e(e)):_e(e)}}hide(t){let e;if(t){if(e=ze(this),!e){const t=this.closest(".popover"),n=t&&r(`[aria-describedby="${t.id}"]`);e=ze(n)}}else e=this;const{element:n,popover:o,options:i}=e;clearTimeout(e.timer),e.timer=setTimeout(()=>{if(je(o,i.container)){if(n.dispatchEvent(Ze),Ze.defaultPrevented)return;c(o,"show"),Ue(e),i.animation?a(o,()=>tn(e)):tn(e)}},i.delay+17)}enable(){const t=this,{enabled:e}=t;e||(Qe(t,1),t.enabled=!e)}disable(){const t=this,{enabled:e,popover:n,options:o}=t;e&&(je(n,o.container)&&o.animation?(t.hide(),setTimeout(()=>Qe(t),s(n)+o.delay+17)):Qe(t),t.enabled=!e)}toggleEnabled(){this.enabled?this.disable():this.enable()}dispose(){const t=this,{popover:e,options:n}=t,{container:o,animation:i}=n;i&&je(e,o)?(t.options.delay=0,t.hide(),a(e,()=>Qe(t))):Qe(t),super.dispose()}}Object.assign(en,{selector:Fe,callback:t=>new en(t),getInstance:ze});const nn={offset:10,target:null},on=p("activate.bs.scrollspy");function sn(t){const{target:e,scrollTarget:n,isWindow:o,options:i,itemsLength:s,scrollHeight:a}=t,{offset:l}=i,c=e.getElementsByTagName("A");if(t.scrollTop=o?n.pageYOffset:n.scrollTop,s!==c.length||an(n)!==a){let e,i,s;t.items=[],t.offsets=[],t.scrollHeight=an(n),t.maxScroll=t.scrollHeight-function({element:t,isWindow:e}){return e?window.innerHeight:t.getBoundingClientRect().height}(t),Array.from(c).forEach(n=>{e=n.getAttribute("href"),i=e&&"#"===e.charAt(0)&&"#"!==e.slice(-1)&&r(e),i&&(t.items.push(n),s=i.getBoundingClientRect(),t.offsets.push((o?s.top+t.scrollTop:i.offsetTop)-l))}),t.itemsLength=t.items.length}}function an(t){return t.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)}function rn(t){Array.from(t.getElementsByTagName("A")).forEach(t=>{l(t,"active")&&c(t,"active")})}function ln(t,e){const{target:n,element:o}=t;rn(n),t.activeItem=e,T(e,"active");const i=[];let s=e;for(;s!==document.body;)s=s.parentNode,(l(s,"nav")||l(s,"dropdown-menu"))&&i.push(s);i.forEach(t=>{const e=t.previousElementSibling;e&&!l(e,"active")&&T(e,"active")}),on.relatedTarget=e,o.dispatchEvent(on)}function cn(t,e){const n=e?d:"removeEventListener";t.scrollTarget[n]("scroll",t.refresh,H)}class dn extends g{constructor(t,e){super(t,e);const{element:n,options:o}=this;this.target=r(o.target),this.target&&(this.scrollTarget=n.clientHeight=o){const e=s[i-1];return void(a!==e&&ln(t,e))}const{offsets:r}=t;if(a&&n0)return t.activeItem=null,void rn(e);s.forEach((e,o)=>{a!==e&&n>=r[o]&&(void 0===r[o+1]||nnew dn(t),getInstance:t=>m(t,"ScrollSpy")});const un=`[${k}="tab"]`,hn=t=>m(t,"Tab"),mn=p("show.bs.tab"),pn=p("shown.bs.tab"),fn=p("hide.bs.tab"),gn=p("hidden.bs.tab");let vn,bn,wn,yn,En,An,Tn;function kn(t){const{tabContent:e,nav:n}=t;e.style.height="",c(e,"collapsing"),n.isAnimating=!1}function xn(t){const{tabContent:e,nav:n}=t;e?Tn?kn(t):setTimeout(()=>{e.style.height=wn+"px",P(e),a(e,()=>kn(t))},50):n.isAnimating=!1,pn.relatedTarget=yn,vn.dispatchEvent(pn)}function Cn(t){const{tabContent:e}=t;e&&(En.style.float="left",bn.style.float="left",An=En.scrollHeight),mn.relatedTarget=yn,gn.relatedTarget=vn,vn.dispatchEvent(mn),mn.defaultPrevented||(T(bn,"active"),c(En,"active"),e&&(wn=bn.scrollHeight,Tn=wn===An,T(e,"collapsing"),e.style.height=An+"px",P(e),En.style.float="",bn.style.float=""),l(bn,"fade")?setTimeout(()=>{T(bn,"show"),a(bn,()=>{xn(t)})},20):xn(t),yn.dispatchEvent(gn))}function Nn({nav:t}){const e=t.getElementsByClassName("active");return 1!==e.length||ht.some(t=>l(e[0].parentNode,t))?e.length>1&&(yn=e[e.length-1]):[yn]=e,yn}function Sn(t){return r(Nn(t).getAttribute("href")||Nn(t).getAttribute(k))}function Hn(t,e){const n=e?d:"removeEventListener";t.element[n]("click",Pn)}function Pn(t){const e=hn(this);t.preventDefault(),e.nav.isAnimating||e.show()}class Ln extends g{constructor(t){super(t);const{element:n}=this;this.nav=n.closest(".nav");const{nav:o}=this;this.dropdown=o&&r(`.${ht[0]}-toggle`,o),En=Sn(this),this.tabContent=e&&En.closest(".tab-content"),An=En.scrollHeight,o.isAnimating=!1,Hn(this,1)}get name(){return"Tab"}show(){const t=this,{element:e,nav:n,dropdown:o}=t;if(vn=e,!l(vn,"active")){if(bn=r(vn.getAttribute("href")),yn=Nn({nav:n}),En=Sn({nav:n}),fn.relatedTarget=vn,yn.dispatchEvent(fn),fn.defaultPrevented)return;n.isAnimating=!0,c(yn,"active"),yn.setAttribute("aria-selected","false"),T(vn,"active"),vn.setAttribute("aria-selected","true"),o&&(l(e.parentNode,"dropdown-menu")?l(o,"active")||T(o,"active"):l(o,"active")&&c(o,"active")),l(En,"fade")?(c(En,"show"),a(En,()=>Cn(t))):Cn(t)}}dispose(){Hn(this),super.dispose()}}Object.assign(Ln,{selector:un,callback:t=>new Ln(t),getInstance:hn});const On={animation:!0,autohide:!0,delay:500},In=p("show.bs.toast"),jn=p("hide.bs.toast"),Dn=p("shown.bs.toast"),Bn=p("hidden.bs.toast");function Rn(t){const{element:e,options:n}=t;c(e,"showing"),e.dispatchEvent(Dn),n.autohide&&t.hide()}function Wn(t){const{element:e}=t;c(e,"showing"),c(e,"show"),T(e,"hide"),e.dispatchEvent(Bn)}function Mn(t,e){const n=e?d:"removeEventListener";t.dismiss&&t.dismiss[n]("click",t.hide)}class $n extends g{constructor(t,e){super(t,e);const{element:n,options:o}=this;o.animation&&!l(n,"fade")?T(n,"fade"):!o.animation&&l(n,"fade")&&c(n,"fade"),this.dismiss=r('[data-bs-dismiss="toast"]',n),this.show=this.show.bind(this),this.hide=this.hide.bind(this),Mn(this,1)}get name(){return"Toast"}get defaults(){return On}show(){const t=this,{element:e}=t;if(e&&!l(e,"show")){if(e.dispatchEvent(In),In.defaultPrevented)return;clearTimeout(t.timer),t.timer=setTimeout(()=>function(t){const{element:e,options:n}=t;c(e,"hide"),P(e),T(e,"show"),T(e,"showing"),n.animation?a(e,()=>Rn(t)):Rn(t)}(t),10)}}hide(t){const e=this,{element:n,options:o}=e;if(n&&l(n,"show")){if(n.dispatchEvent(jn),jn.defaultPrevented)return;clearTimeout(e.timer),e.timer=setTimeout(()=>function(t){const{element:e,options:n}=t;T(e,"showing"),n.animation?(P(e),a(e,()=>Wn(t))):Wn(t)}(e),t?10:o.delay)}}dispose(){const{element:t}=this;l(t,"show")&&c(t,"show"),function(t){clearTimeout(t.timer),Mn(t)}(this),super.dispose()}}Object.assign($n,{selector:".toast",callback:t=>new $n(t),getInstance:t=>m(t,"Toast")});const Fn=`[${k}="tooltip"],[data-tip="tooltip"]`,zn={template:'',title:null,customClass:null,placement:"top",sanitizeFn:null,animation:!0,delay:200,container:null},qn=t=>m(t,"Tooltip"),Xn=p("show.bs.tooltip"),Yn=p("shown.bs.tooltip"),Vn=p("hide.bs.tooltip"),Gn=p("hidden.bs.tooltip");function Zn(t){const{element:e}=t;Un(t),e.hasAttribute("data-original-title")&&_n(t)}function Jn(t,e){const n=e?d:"removeEventListener";document[n]("touchstart",to,H),Oe(t.element)||(window[n]("scroll",t.update,H),window[n]("resize",t.update,H))}function Kn(t){Jn(t,1),t.element.dispatchEvent(Yn)}function Qn(t){Jn(t),function(t){const{element:e,tooltip:n}=t;e.removeAttribute("aria-describedby"),n.remove(),t.timer=null}(t),t.element.dispatchEvent(Gn)}function Un(t,e){const n=e?d:"removeEventListener",{element:o}=t;Oe(o)&&o[n]("mousemove",t.update,H),o[n]("mousedown",t.show),o[n]("mouseenter",t.show),o[n]("mouseleave",t.hide)}function _n(t,e){const n=["data-original-title","title"],{element:o}=t;o.setAttribute(n[e?0:1],e||o.getAttribute(n[0])),o.removeAttribute(n[e?1:0])}function to({target:t}){const{tooltip:e,element:n}=this;e.contains(t)||t===n||n.contains(t)||this.hide()}class eo extends g{constructor(t,e){const n=r(t);zn.title=n.getAttribute("title"),zn.container=We(n),super(n,e);this.tooltip=null,this.arrow=null,this.timer=null,this.enabled=!1;const{options:o}=this;if(this.options.container=Oe(n)?zn.container:r(o.container),zn.container=null,zn.title=null,!o.title)return;to.bind(this),this.update=this.update.bind(this),n.hasAttribute("title")&&_n(this,o.title),this.id="tooltip-"+Re(n),function(t){const{options:e,id:n}=t,{title:o,template:i,customClass:s,animation:a,placement:c,sanitizeFn:d}=e,u="bs-tooltip-"+Ie[c];if(!o)return;let h;if("object"==typeof i)h=i;else{const t=document.createElement("div");$e(t,i,d),h=t.firstChild}t.tooltip=h.cloneNode(!0);const{tooltip:m}=t;$e(r(".tooltip-inner",m),o,d),m.setAttribute("id",n),m.setAttribute("role","tooltip"),t.arrow=r(".tooltip-arrow",m),l(m,"tooltip")||T(m,"tooltip"),a&&!l(m,"fade")&&T(m,"fade"),s&&!l(m,s)&&T(m,s),l(m,u)||T(m,u)}(this);const{container:i}=this.options,s=getComputedStyle(n).position,a=getComputedStyle(i).position,c=i===document.body,d=!c&&"static"===a,u=!c&&"relative"===a,h=d&&Me(i);this.positions={elementPosition:s,containerIsRelative:u,containerIsStatic:d,relContainer:h},Un(this,1)}get name(){return"Tooltip"}get defaults(){return zn}show(t){const e=t?qn(this):this,{options:n,tooltip:o,element:i,id:s}=e,{container:r,animation:c}=n;if(clearTimeout(e.timer),!je(o,r)){if(i.dispatchEvent(Xn),Xn.defaultPrevented)return;r.append(o),i.setAttribute("aria-describedby",s),e.update(t),l(o,"show")||T(o,"show"),c?a(o,()=>Kn(e)):Kn(e)}}hide(t){const e=t?qn(this):this,{options:n,tooltip:o,element:i}=e;clearTimeout(e.timer),e.timer=setTimeout(()=>{if(je(o,n.container)){if(i.dispatchEvent(Vn),Vn.defaultPrevented)return;c(o,"show"),n.animation?a(o,()=>Qn(e)):Qn(e)}},n.delay)}update(t){De(this,t)}toggle(t){const e=t?qn(this):this,{tooltip:n,options:o}=e;je(n,o.container)?e.hide():e.show()}enable(){const t=this,{enabled:e}=t;e||(Un(t,1),t.enabled=!e)}disable(){const t=this,{tooltip:e,options:n,enabled:o}=t;o&&(!je(e,n.container)&&n.animation?(t.hide(),setTimeout(()=>Un(t),s(e)+n.delay+17)):Un(t),t.enabled=!o)}toggleEnabled(){this.enabled?this.disable():this.enable()}dispose(){const t=this,{tooltip:e,options:n}=t;n.animation&&je(e,n.container)?(n.delay=0,t.hide(),a(e,()=>Zn(t))):Zn(t),super.dispose()}}Object.assign(eo,{selector:Fn,callback:t=>new eo(t),getInstance:qn});const no={Alert:A,Button:S,Carousel:_,Collapse:ut,Dropdown:Wt,Modal:fe,Offcanvas:Le,Popover:en,ScrollSpy:dn,Tab:Ln,Toast:$n,Tooltip:eo},oo=Object.keys(no);function io(t){const e=t instanceof Element?t:document;oo.forEach(t=>{const{callback:n,selector:o}=no[t];!function(t,e){Array.from(e).forEach(e=>t(e))}(n,e.querySelectorAll(o))})}document.body?io():document.addEventListener("DOMContentLoaded",()=>io(),{once:!0});return{Alert:A,Button:S,Carousel:_,Collapse:ut,Dropdown:Wt,Modal:fe,Offcanvas:Le,Popover:en,ScrollSpy:dn,Tab:Ln,Toast:$n,Tooltip:eo,initCallback:io,removeDataAPI:function(t){const e=t instanceof Element?t:document;oo.forEach(t=>{!function(t,e){Array.from(h.getAllFor(t)).forEach(t=>{const[n,o]=t;e.contains(n)&&o.dispose()})}(t,e)})},Version:"4.1.0"}})); diff --git a/dist/components/alert-native.esm.js b/dist/components/alert-native.esm.js index 0d72eca6..2cfc6373 100644 --- a/dist/components/alert-native.esm.js +++ b/dist/components/alert-native.esm.js @@ -1,16 +1,63 @@ /*! - * Native JavaScript for Bootstrap Alert v4.0.8 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap Alert v4.1.0 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2021 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ +/** + * A global namespace for 'transitionend' string. + * @type {string} + */ const transitionEndEvent = 'webkitTransition' in document.head.style ? 'webkitTransitionEnd' : 'transitionend'; +/** + * A global namespace for CSS3 transition support. + * @type {boolean} + */ const supportTransition = 'webkitTransition' in document.head.style || 'transition' in document.head.style; -const transitionDuration = 'webkitTransition' in document.head.style ? 'webkitTransitionDuration' : 'transitionDuration'; +/** + * A global namespace for 'transitionDelay' string. + * @type {string} + */ +const transitionDelay = 'webkitTransition' in document.head.style ? 'webkitTransitionDelay' : 'transitionDelay'; +/** + * A global namespace for 'transitionProperty' string. + * @type {string} + */ const transitionProperty = 'webkitTransition' in document.head.style ? 'webkitTransitionProperty' : 'transitionProperty'; +/** + * Utility to get the computed transitionDelay + * from Element in miliseconds. + * + * @param {Element} element target + * @return {number} the value in miliseconds + */ +function getElementTransitionDelay(element) { + const computedStyle = getComputedStyle(element); + const propertyValue = computedStyle[transitionProperty]; + const delayValue = computedStyle[transitionDelay]; + const delayScale = delayValue.includes('ms') ? 1 : 1000; + const duration = supportTransition && propertyValue && propertyValue !== 'none' + ? parseFloat(delayValue) * delayScale : 0; + + return !Number.isNaN(duration) ? duration : 0; +} + +/** + * A global namespace for 'transitionDuration' string. + * @type {string} + */ +const transitionDuration = 'webkitTransition' in document.head.style ? 'webkitTransitionDuration' : 'transitionDuration'; + +/** + * Utility to get the computed transitionDuration + * from Element in miliseconds. + * + * @param {Element} element target + * @return {number} the value in miliseconds + */ function getElementTransitionDuration(element) { const computedStyle = getComputedStyle(element); const propertyValue = computedStyle[transitionProperty]; @@ -22,88 +69,235 @@ function getElementTransitionDuration(element) { return !Number.isNaN(duration) ? duration : 0; } +/** + * Utility to make sure callbacks are consistently + * called when transition ends. + * + * @param {Element} element target + * @param {function} handler `transitionend` callback + */ function emulateTransitionEnd(element, handler) { let called = 0; const endEvent = new Event(transitionEndEvent); const duration = getElementTransitionDuration(element); + const delay = getElementTransitionDelay(element); if (duration) { - element.addEventListener(transitionEndEvent, function transitionEndWrapper(e) { + /** + * Wrap the handler in on -> off callback + * @param {Event} e Event object + * @callback + */ + const transitionEndWrapper = (e) => { if (e.target === element) { handler.apply(element, [e]); element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } - }); + }; + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); - }, duration + 17); + }, duration + delay + 17); } else { handler.apply(element, [endEvent]); } } +/** + * Utility to check if target is typeof Element + * or find one that matches a selector. + * + * @param {Element | string} selector the input selector or target element + * @param {Element | null} parent optional Element to look into + * @return {Element | null} the Element or result of the querySelector + */ function queryElement(selector, parent) { const lookUp = parent && parent instanceof Element ? parent : document; return selector instanceof Element ? selector : lookUp.querySelector(selector); } +/** + * Check class in Element.classList + * + * @param {Element} element target + * @param {string} classNAME to check + * @return {boolean} + */ function hasClass(element, classNAME) { return element.classList.contains(classNAME); } +/** + * Remove class from Element.classList + * + * @param {Element} element target + * @param {string} classNAME to remove + */ function removeClass(element, classNAME) { element.classList.remove(classNAME); } +/** + * A global namespace for 'addEventListener' string. + * @type {string} + */ const addEventListener = 'addEventListener'; +/** + * A global namespace for 'removeEventListener' string. + * @type {string} + */ const removeEventListener = 'removeEventListener'; +const componentData = new Map(); +/** + * An interface for web components background data. + * @see https://github.com/thednp/bootstrap.native/blob/master/src/components/base-component.js + */ +const Data = { + /** + * Sets web components data. + * @param {Element} element target element + * @param {string} component the component's name or a unique key + * @param {any} instance the component instance + */ + set: (element, component, instance) => { + if (!componentData.has(component)) { + componentData.set(component, new Map()); + } + + const instanceMap = componentData.get(component); + instanceMap.set(element, instance); + }, + + /** + * Returns all instances for specified component. + * @param {string} component the component's name or a unique key + * @returns {?any} all the component instances + */ + getAllFor: (component) => { + if (componentData.has(component)) { + return componentData.get(component) || null; + } + return null; + }, + + /** + * Returns the instance associated with the target. + * @param {Element} element target element + * @param {string} component the component's name or a unique key + * @returns {?any} the instance + */ + get: (element, component) => { + const allForC = Data.getAllFor(component); + if (allForC && allForC.has(element)) { + return allForC.get(element) || null; + } + return null; + }, + + /** + * Removes web components data. + * @param {Element} element target element + * @param {string} component the component's name or a unique key + * @param {any} instance the component instance + */ + remove: (element, component) => { + if (!componentData.has(component)) return; + + const instanceMap = componentData.get(component); + instanceMap.delete(element); + + if (instanceMap.size === 0) { + componentData.delete(component); + } + }, +}; + +/** + * Shortcut for `Data.get(a, b)` to setup usable component static method. + * @type {SHORTER.getInstance} + */ +const getInstance = (element, component) => Data.get(element, component); + +/** + * Global namespace for most components `fade` class. + */ const fadeClass = 'fade'; +/** + * Global namespace for most components `show` class. + */ const showClass = 'show'; +/** + * Global namespace for most components `dismiss` option. + */ const dataBsDismiss = 'data-bs-dismiss'; +/** + * Returns a namespaced `CustomEvent` specific to each component. + * @param {string} namespacedEventType Event.type + * @param {AddEventListenerOptions | boolean} eventProperties Event.options | Event.properties + * @returns {CustomEvent} a new namespaced event + */ function bootstrapCustomEvent(namespacedEventType, eventProperties) { const OriginalCustomEvent = new CustomEvent(namespacedEventType, { cancelable: true }); if (eventProperties instanceof Object) { - Object.keys(eventProperties).forEach((key) => { - Object.defineProperty(OriginalCustomEvent, key, { - value: eventProperties[key], - }); - }); + Object.assign(OriginalCustomEvent, eventProperties); } return OriginalCustomEvent; } +/** + * The raw value or a given component option. + * + * @typedef {string | Element | Function | number | boolean | null} niceValue + */ + +/** + * Utility to normalize component options + * + * @param {any} value the input value + * @return {niceValue} the normalized value + */ function normalizeValue(value) { - if (value === 'true') { + if (value === 'true') { // boolean return true; } - if (value === 'false') { + if (value === 'false') { // boolean return false; } - if (!Number.isNaN(+value)) { + if (!Number.isNaN(+value)) { // number return +value; } - if (value === '' || value === 'null') { + if (value === '' || value === 'null') { // null return null; } - // string / function / Element / Object + // string / function / Element / object return value; } +/** + * Utility to normalize component options + * + * @param {Element} element target + * @param {object} defaultOps component default options + * @param {object} inputOps component instance options + * @param {string} ns component namespace + * @return {object} normalized component options object + */ function normalizeOptions(element, defaultOps, inputOps, ns) { + // @ts-ignore + const data = { ...element.dataset }; const normalOps = {}; const dataOps = {}; - const data = { ...element.dataset }; Object.keys(data) .forEach((k) => { @@ -133,26 +327,58 @@ function normalizeOptions(element, defaultOps, inputOps, ns) { return normalOps; } +var version = "4.1.0"; + +const Version = version; + /* Native JavaScript for Bootstrap 5 | Base Component ----------------------------------------------------- */ +/** + * Returns a new `BaseComponent` instance. + */ class BaseComponent { - constructor(name, target, defaults, config) { + /** + * @param {Element | string} target Element or selector string + * @param {BSN.ComponentOptions?} config + */ + constructor(target, config) { const self = this; const element = queryElement(target); - if (element[name]) element[name].dispose(); + if (!element) return; + + const prevInstance = getInstance(element, self.name); + if (prevInstance) prevInstance.dispose(); + + /** @private */ self.element = element; - if (defaults && Object.keys(defaults).length) { - self.options = normalizeOptions(element, defaults, (config || {}), 'bs'); + if (self.defaults && Object.keys(self.defaults).length) { + /** @private */ + self.options = normalizeOptions(element, self.defaults, (config || {}), 'bs'); } - element[name] = self; + + Data.set(element, self.name, self); } - dispose(name) { + /* eslint-disable */ + /** @static */ + get version() { return Version; } + /* eslint-enable */ + + /** @static */ + get name() { return this.constructor.name; } + + /** @static */ + get defaults() { return this.constructor.defaults; } + + /** + * Removes component from target element; + */ + dispose() { const self = this; - self.element[name] = null; + Data.remove(self.element, self.name); Object.keys(self).forEach((prop) => { self[prop] = null; }); } } @@ -167,13 +393,27 @@ const alertComponent = 'Alert'; const alertSelector = `.${alertString}`; const alertDismissSelector = `[${dataBsDismiss}="${alertString}"]`; +/** + * Static method which returns an existing `Alert` instance associated + * to a target `Element`. + * + * @type {BSN.GetInstance} + */ +const getAlertInstance = (element) => getInstance(element, alertComponent); + // ALERT CUSTOM EVENTS // =================== +/** @type {BSN.AlertEvent.close} */ const closeAlertEvent = bootstrapCustomEvent(`close.bs.${alertString}`); +/** @type {BSN.AlertEvent.closed} */ const closedAlertEvent = bootstrapCustomEvent(`closed.bs.${alertString}`); -// ALERT EVENT HANDLERS -// ==================== +// ALERT EVENT HANDLER +// =================== +/** + * Alert `transitionend` callback. + * @param {Alert} self target Alert instance + */ function alertTransitionEnd(self) { const { element, relatedTarget } = self; toggleAlertHandler(self); @@ -187,6 +427,11 @@ function alertTransitionEnd(self) { // ALERT PRIVATE METHOD // ==================== +/** + * Toggle on / off the `click` event listener. + * @param {Alert} self the target alert instance + * @param {boolean | number} add + */ function toggleAlertHandler(self, add) { const action = add ? addEventListener : removeEventListener; if (self.dismiss) self.dismiss[action]('click', self.close); @@ -194,9 +439,11 @@ function toggleAlertHandler(self, add) { // ALERT DEFINITION // ================ +/** Creates a new Alert instance. */ class Alert extends BaseComponent { + /** @param {Element | string} target element or selector */ constructor(target) { - super(alertComponent, target); + super(target); // bind const self = this; @@ -204,19 +451,38 @@ class Alert extends BaseComponent { const { element } = self; // the dismiss button + /** @private */ self.dismiss = queryElement(alertDismissSelector, element); + /** @private */ self.relatedTarget = null; // add event listener toggleAlertHandler(self, 1); } + /* eslint-disable */ + /** + * Returns component name string. + * @readonly @static + */ + get name() { return alertComponent; } + /* eslint-enable */ + // ALERT PUBLIC METHODS // ==================== + /** + * Private method that: + * * Hides the `.alert` element from the user, + * * Destroy the instance once animation is complete, + * * Removes the element from the DOM. + * + * @param {Event} e most likely the `click` event + * @returns {void} + */ close(e) { const target = e ? e.target : null; const self = e - ? e.target.closest(alertSelector)[alertComponent] + ? getAlertInstance(e.target.closest(alertSelector)) : this; const { element } = self; @@ -236,16 +502,21 @@ class Alert extends BaseComponent { } } + /** Remove the component from target element. */ dispose() { toggleAlertHandler(this); - super.dispose(alertComponent); + super.dispose(); } } -Alert.init = { - component: alertComponent, +Object.assign(Alert, { selector: alertSelector, - constructor: Alert, -}; + /** + * An `Alert` initialization callback. + * @type {BSN.InitCallback} + */ + callback: (element) => new Alert(element), + getInstance: getAlertInstance, +}); export { Alert as default }; diff --git a/dist/components/alert-native.js b/dist/components/alert-native.js index 45fddabd..b49ca3f4 100644 --- a/dist/components/alert-native.js +++ b/dist/components/alert-native.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap Alert v4.0.8 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap Alert v4.1.0 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2021 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -9,14 +9,61 @@ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory()); })(this, (function () { 'use strict'; + /** + * A global namespace for 'transitionend' string. + * @type {string} + */ const transitionEndEvent = 'webkitTransition' in document.head.style ? 'webkitTransitionEnd' : 'transitionend'; + /** + * A global namespace for CSS3 transition support. + * @type {boolean} + */ const supportTransition = 'webkitTransition' in document.head.style || 'transition' in document.head.style; - const transitionDuration = 'webkitTransition' in document.head.style ? 'webkitTransitionDuration' : 'transitionDuration'; + /** + * A global namespace for 'transitionDelay' string. + * @type {string} + */ + const transitionDelay = 'webkitTransition' in document.head.style ? 'webkitTransitionDelay' : 'transitionDelay'; + /** + * A global namespace for 'transitionProperty' string. + * @type {string} + */ const transitionProperty = 'webkitTransition' in document.head.style ? 'webkitTransitionProperty' : 'transitionProperty'; + /** + * Utility to get the computed transitionDelay + * from Element in miliseconds. + * + * @param {Element} element target + * @return {number} the value in miliseconds + */ + function getElementTransitionDelay(element) { + const computedStyle = getComputedStyle(element); + const propertyValue = computedStyle[transitionProperty]; + const delayValue = computedStyle[transitionDelay]; + const delayScale = delayValue.includes('ms') ? 1 : 1000; + const duration = supportTransition && propertyValue && propertyValue !== 'none' + ? parseFloat(delayValue) * delayScale : 0; + + return !Number.isNaN(duration) ? duration : 0; + } + + /** + * A global namespace for 'transitionDuration' string. + * @type {string} + */ + const transitionDuration = 'webkitTransition' in document.head.style ? 'webkitTransitionDuration' : 'transitionDuration'; + + /** + * Utility to get the computed transitionDuration + * from Element in miliseconds. + * + * @param {Element} element target + * @return {number} the value in miliseconds + */ function getElementTransitionDuration(element) { const computedStyle = getComputedStyle(element); const propertyValue = computedStyle[transitionProperty]; @@ -28,88 +75,235 @@ return !Number.isNaN(duration) ? duration : 0; } + /** + * Utility to make sure callbacks are consistently + * called when transition ends. + * + * @param {Element} element target + * @param {function} handler `transitionend` callback + */ function emulateTransitionEnd(element, handler) { let called = 0; const endEvent = new Event(transitionEndEvent); const duration = getElementTransitionDuration(element); + const delay = getElementTransitionDelay(element); if (duration) { - element.addEventListener(transitionEndEvent, function transitionEndWrapper(e) { + /** + * Wrap the handler in on -> off callback + * @param {Event} e Event object + * @callback + */ + const transitionEndWrapper = (e) => { if (e.target === element) { handler.apply(element, [e]); element.removeEventListener(transitionEndEvent, transitionEndWrapper); called = 1; } - }); + }; + element.addEventListener(transitionEndEvent, transitionEndWrapper); setTimeout(() => { if (!called) element.dispatchEvent(endEvent); - }, duration + 17); + }, duration + delay + 17); } else { handler.apply(element, [endEvent]); } } + /** + * Utility to check if target is typeof Element + * or find one that matches a selector. + * + * @param {Element | string} selector the input selector or target element + * @param {Element | null} parent optional Element to look into + * @return {Element | null} the Element or result of the querySelector + */ function queryElement(selector, parent) { const lookUp = parent && parent instanceof Element ? parent : document; return selector instanceof Element ? selector : lookUp.querySelector(selector); } + /** + * Check class in Element.classList + * + * @param {Element} element target + * @param {string} classNAME to check + * @return {boolean} + */ function hasClass(element, classNAME) { return element.classList.contains(classNAME); } + /** + * Remove class from Element.classList + * + * @param {Element} element target + * @param {string} classNAME to remove + */ function removeClass(element, classNAME) { element.classList.remove(classNAME); } + /** + * A global namespace for 'addEventListener' string. + * @type {string} + */ const addEventListener = 'addEventListener'; + /** + * A global namespace for 'removeEventListener' string. + * @type {string} + */ const removeEventListener = 'removeEventListener'; + const componentData = new Map(); + /** + * An interface for web components background data. + * @see https://github.com/thednp/bootstrap.native/blob/master/src/components/base-component.js + */ + const Data = { + /** + * Sets web components data. + * @param {Element} element target element + * @param {string} component the component's name or a unique key + * @param {any} instance the component instance + */ + set: (element, component, instance) => { + if (!componentData.has(component)) { + componentData.set(component, new Map()); + } + + const instanceMap = componentData.get(component); + instanceMap.set(element, instance); + }, + + /** + * Returns all instances for specified component. + * @param {string} component the component's name or a unique key + * @returns {?any} all the component instances + */ + getAllFor: (component) => { + if (componentData.has(component)) { + return componentData.get(component) || null; + } + return null; + }, + + /** + * Returns the instance associated with the target. + * @param {Element} element target element + * @param {string} component the component's name or a unique key + * @returns {?any} the instance + */ + get: (element, component) => { + const allForC = Data.getAllFor(component); + if (allForC && allForC.has(element)) { + return allForC.get(element) || null; + } + return null; + }, + + /** + * Removes web components data. + * @param {Element} element target element + * @param {string} component the component's name or a unique key + * @param {any} instance the component instance + */ + remove: (element, component) => { + if (!componentData.has(component)) return; + + const instanceMap = componentData.get(component); + instanceMap.delete(element); + + if (instanceMap.size === 0) { + componentData.delete(component); + } + }, + }; + + /** + * Shortcut for `Data.get(a, b)` to setup usable component static method. + * @type {SHORTER.getInstance} + */ + const getInstance = (element, component) => Data.get(element, component); + + /** + * Global namespace for most components `fade` class. + */ const fadeClass = 'fade'; + /** + * Global namespace for most components `show` class. + */ const showClass = 'show'; + /** + * Global namespace for most components `dismiss` option. + */ const dataBsDismiss = 'data-bs-dismiss'; + /** + * Returns a namespaced `CustomEvent` specific to each component. + * @param {string} namespacedEventType Event.type + * @param {AddEventListenerOptions | boolean} eventProperties Event.options | Event.properties + * @returns {CustomEvent} a new namespaced event + */ function bootstrapCustomEvent(namespacedEventType, eventProperties) { const OriginalCustomEvent = new CustomEvent(namespacedEventType, { cancelable: true }); if (eventProperties instanceof Object) { - Object.keys(eventProperties).forEach((key) => { - Object.defineProperty(OriginalCustomEvent, key, { - value: eventProperties[key], - }); - }); + Object.assign(OriginalCustomEvent, eventProperties); } return OriginalCustomEvent; } + /** + * The raw value or a given component option. + * + * @typedef {string | Element | Function | number | boolean | null} niceValue + */ + + /** + * Utility to normalize component options + * + * @param {any} value the input value + * @return {niceValue} the normalized value + */ function normalizeValue(value) { - if (value === 'true') { + if (value === 'true') { // boolean return true; } - if (value === 'false') { + if (value === 'false') { // boolean return false; } - if (!Number.isNaN(+value)) { + if (!Number.isNaN(+value)) { // number return +value; } - if (value === '' || value === 'null') { + if (value === '' || value === 'null') { // null return null; } - // string / function / Element / Object + // string / function / Element / object return value; } + /** + * Utility to normalize component options + * + * @param {Element} element target + * @param {object} defaultOps component default options + * @param {object} inputOps component instance options + * @param {string} ns component namespace + * @return {object} normalized component options object + */ function normalizeOptions(element, defaultOps, inputOps, ns) { + // @ts-ignore + const data = { ...element.dataset }; const normalOps = {}; const dataOps = {}; - const data = { ...element.dataset }; Object.keys(data) .forEach((k) => { @@ -139,26 +333,58 @@ return normalOps; } + var version = "4.1.0"; + + const Version = version; + /* Native JavaScript for Bootstrap 5 | Base Component ----------------------------------------------------- */ + /** + * Returns a new `BaseComponent` instance. + */ class BaseComponent { - constructor(name, target, defaults, config) { + /** + * @param {Element | string} target Element or selector string + * @param {BSN.ComponentOptions?} config + */ + constructor(target, config) { const self = this; const element = queryElement(target); - if (element[name]) element[name].dispose(); + if (!element) return; + + const prevInstance = getInstance(element, self.name); + if (prevInstance) prevInstance.dispose(); + + /** @private */ self.element = element; - if (defaults && Object.keys(defaults).length) { - self.options = normalizeOptions(element, defaults, (config || {}), 'bs'); + if (self.defaults && Object.keys(self.defaults).length) { + /** @private */ + self.options = normalizeOptions(element, self.defaults, (config || {}), 'bs'); } - element[name] = self; + + Data.set(element, self.name, self); } - dispose(name) { + /* eslint-disable */ + /** @static */ + get version() { return Version; } + /* eslint-enable */ + + /** @static */ + get name() { return this.constructor.name; } + + /** @static */ + get defaults() { return this.constructor.defaults; } + + /** + * Removes component from target element; + */ + dispose() { const self = this; - self.element[name] = null; + Data.remove(self.element, self.name); Object.keys(self).forEach((prop) => { self[prop] = null; }); } } @@ -173,13 +399,27 @@ const alertSelector = `.${alertString}`; const alertDismissSelector = `[${dataBsDismiss}="${alertString}"]`; + /** + * Static method which returns an existing `Alert` instance associated + * to a target `Element`. + * + * @type {BSN.GetInstance} + */ + const getAlertInstance = (element) => getInstance(element, alertComponent); + // ALERT CUSTOM EVENTS // =================== + /** @type {BSN.AlertEvent.close} */ const closeAlertEvent = bootstrapCustomEvent(`close.bs.${alertString}`); + /** @type {BSN.AlertEvent.closed} */ const closedAlertEvent = bootstrapCustomEvent(`closed.bs.${alertString}`); - // ALERT EVENT HANDLERS - // ==================== + // ALERT EVENT HANDLER + // =================== + /** + * Alert `transitionend` callback. + * @param {Alert} self target Alert instance + */ function alertTransitionEnd(self) { const { element, relatedTarget } = self; toggleAlertHandler(self); @@ -193,6 +433,11 @@ // ALERT PRIVATE METHOD // ==================== + /** + * Toggle on / off the `click` event listener. + * @param {Alert} self the target alert instance + * @param {boolean | number} add + */ function toggleAlertHandler(self, add) { const action = add ? addEventListener : removeEventListener; if (self.dismiss) self.dismiss[action]('click', self.close); @@ -200,9 +445,11 @@ // ALERT DEFINITION // ================ + /** Creates a new Alert instance. */ class Alert extends BaseComponent { + /** @param {Element | string} target element or selector */ constructor(target) { - super(alertComponent, target); + super(target); // bind const self = this; @@ -210,19 +457,38 @@ const { element } = self; // the dismiss button + /** @private */ self.dismiss = queryElement(alertDismissSelector, element); + /** @private */ self.relatedTarget = null; // add event listener toggleAlertHandler(self, 1); } + /* eslint-disable */ + /** + * Returns component name string. + * @readonly @static + */ + get name() { return alertComponent; } + /* eslint-enable */ + // ALERT PUBLIC METHODS // ==================== + /** + * Private method that: + * * Hides the `.alert` element from the user, + * * Destroy the instance once animation is complete, + * * Removes the element from the DOM. + * + * @param {Event} e most likely the `click` event + * @returns {void} + */ close(e) { const target = e ? e.target : null; const self = e - ? e.target.closest(alertSelector)[alertComponent] + ? getAlertInstance(e.target.closest(alertSelector)) : this; const { element } = self; @@ -242,17 +508,22 @@ } } + /** Remove the component from target element. */ dispose() { toggleAlertHandler(this); - super.dispose(alertComponent); + super.dispose(); } } - Alert.init = { - component: alertComponent, + Object.assign(Alert, { selector: alertSelector, - constructor: Alert, - }; + /** + * An `Alert` initialization callback. + * @type {BSN.InitCallback} + */ + callback: (element) => new Alert(element), + getInstance: getAlertInstance, + }); return Alert; diff --git a/dist/components/button-native.esm.js b/dist/components/button-native.esm.js index c007341c..31c21c63 100644 --- a/dist/components/button-native.esm.js +++ b/dist/components/button-native.esm.js @@ -1,58 +1,198 @@ /*! - * Native JavaScript for Bootstrap Button v4.0.8 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap Button v4.1.0 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2021 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ +/** + * Add class to Element.classList + * + * @param {Element} element target + * @param {string} classNAME to add + */ function addClass(element, classNAME) { element.classList.add(classNAME); } +/** + * Check class in Element.classList + * + * @param {Element} element target + * @param {string} classNAME to check + * @return {boolean} + */ function hasClass(element, classNAME) { return element.classList.contains(classNAME); } +/** + * Remove class from Element.classList + * + * @param {Element} element target + * @param {string} classNAME to remove + */ function removeClass(element, classNAME) { element.classList.remove(classNAME); } +/** + * A global namespace for 'addEventListener' string. + * @type {string} + */ const addEventListener = 'addEventListener'; +/** + * A global namespace for 'removeEventListener' string. + * @type {string} + */ const removeEventListener = 'removeEventListener'; +/** + * A global namespace for aria-pressed. + * @type {string} + */ +const ariaPressed = 'aria-pressed'; + +const componentData = new Map(); +/** + * An interface for web components background data. + * @see https://github.com/thednp/bootstrap.native/blob/master/src/components/base-component.js + */ +const Data = { + /** + * Sets web components data. + * @param {Element} element target element + * @param {string} component the component's name or a unique key + * @param {any} instance the component instance + */ + set: (element, component, instance) => { + if (!componentData.has(component)) { + componentData.set(component, new Map()); + } + + const instanceMap = componentData.get(component); + instanceMap.set(element, instance); + }, + + /** + * Returns all instances for specified component. + * @param {string} component the component's name or a unique key + * @returns {?any} all the component instances + */ + getAllFor: (component) => { + if (componentData.has(component)) { + return componentData.get(component) || null; + } + return null; + }, + + /** + * Returns the instance associated with the target. + * @param {Element} element target element + * @param {string} component the component's name or a unique key + * @returns {?any} the instance + */ + get: (element, component) => { + const allForC = Data.getAllFor(component); + if (allForC && allForC.has(element)) { + return allForC.get(element) || null; + } + return null; + }, + + /** + * Removes web components data. + * @param {Element} element target element + * @param {string} component the component's name or a unique key + * @param {any} instance the component instance + */ + remove: (element, component) => { + if (!componentData.has(component)) return; + + const instanceMap = componentData.get(component); + instanceMap.delete(element); + + if (instanceMap.size === 0) { + componentData.delete(component); + } + }, +}; + +/** + * Shortcut for `Data.get(a, b)` to setup usable component static method. + * @type {SHORTER.getInstance} + */ +const getInstance = (element, component) => Data.get(element, component); + +/** + * Global namespace for most components active class. + */ const activeClass = 'active'; +/** + * Global namespace for most components `toggle` option. + */ const dataBsToggle = 'data-bs-toggle'; +/** + * Utility to check if target is typeof Element + * or find one that matches a selector. + * + * @param {Element | string} selector the input selector or target element + * @param {Element | null} parent optional Element to look into + * @return {Element | null} the Element or result of the querySelector + */ function queryElement(selector, parent) { const lookUp = parent && parent instanceof Element ? parent : document; return selector instanceof Element ? selector : lookUp.querySelector(selector); } +/** + * The raw value or a given component option. + * + * @typedef {string | Element | Function | number | boolean | null} niceValue + */ + +/** + * Utility to normalize component options + * + * @param {any} value the input value + * @return {niceValue} the normalized value + */ function normalizeValue(value) { - if (value === 'true') { + if (value === 'true') { // boolean return true; } - if (value === 'false') { + if (value === 'false') { // boolean return false; } - if (!Number.isNaN(+value)) { + if (!Number.isNaN(+value)) { // number return +value; } - if (value === '' || value === 'null') { + if (value === '' || value === 'null') { // null return null; } - // string / function / Element / Object + // string / function / Element / object return value; } +/** + * Utility to normalize component options + * + * @param {Element} element target + * @param {object} defaultOps component default options + * @param {object} inputOps component instance options + * @param {string} ns component namespace + * @return {object} normalized component options object + */ function normalizeOptions(element, defaultOps, inputOps, ns) { + // @ts-ignore + const data = { ...element.dataset }; const normalOps = {}; const dataOps = {}; - const data = { ...element.dataset }; Object.keys(data) .forEach((k) => { @@ -82,26 +222,58 @@ function normalizeOptions(element, defaultOps, inputOps, ns) { return normalOps; } +var version = "4.1.0"; + +const Version = version; + /* Native JavaScript for Bootstrap 5 | Base Component ----------------------------------------------------- */ +/** + * Returns a new `BaseComponent` instance. + */ class BaseComponent { - constructor(name, target, defaults, config) { + /** + * @param {Element | string} target Element or selector string + * @param {BSN.ComponentOptions?} config + */ + constructor(target, config) { const self = this; const element = queryElement(target); - if (element[name]) element[name].dispose(); + if (!element) return; + + const prevInstance = getInstance(element, self.name); + if (prevInstance) prevInstance.dispose(); + + /** @private */ self.element = element; - if (defaults && Object.keys(defaults).length) { - self.options = normalizeOptions(element, defaults, (config || {}), 'bs'); + if (self.defaults && Object.keys(self.defaults).length) { + /** @private */ + self.options = normalizeOptions(element, self.defaults, (config || {}), 'bs'); } - element[name] = self; + + Data.set(element, self.name, self); } - dispose(name) { + /* eslint-disable */ + /** @static */ + get version() { return Version; } + /* eslint-enable */ + + /** @static */ + get name() { return this.constructor.name; } + + /** @static */ + get defaults() { return this.constructor.defaults; } + + /** + * Removes component from target element; + */ + dispose() { const self = this; - self.element[name] = null; + Data.remove(self.element, self.name); Object.keys(self).forEach((prop) => { self[prop] = null; }); } } @@ -114,7 +286,14 @@ class BaseComponent { const buttonString = 'button'; const buttonComponent = 'Button'; const buttonSelector = `[${dataBsToggle}="${buttonString}"]`; -const ariaPressed = 'aria-pressed'; + +/** + * Static method which returns an existing `Button` instance associated + * to a target `Element`. + * + * @type {BSN.GetInstance - - + + +

Toggle link Active toggle link - Disabled toggle link + Disabled toggle link

Checkboxes and Radio

@@ -388,18 +388,18 @@

Checkboxes and Radio

The following examples are purely for demo and only require the proper markup, no script is required.

- + - -

Checkboxes and Radio

- + - + - + @@ -428,18 +428,18 @@

Checkboxes and Radio

- + - + - + @@ -795,29 +795,29 @@

This is another caption

+ onclick="BSN.Carousel.getInstance(carouselGenericExample).to(0)">START + onclick="BSN.Carousel.getInstance(carouselGenericExample).prev()">PREV + onclick="BSN.Carousel.getInstance(carouselGenericExample).next()">NEXT

These three independent buttons use some inline JavaScript to control the carousel:

<button class="btn btn-secondary" 
-  onclick="myCarousel.Carousel.to(0)">
+  onclick="BSN.Carousel.getInstance(carouselGenericExample).to(0)">
   START
-</button>
+</button>
 
-<button 
+<button 
   class="btn btn-secondary"
-  onclick="myCarousel.Carousel.prev()">
+  onclick="BSN.Carousel.getInstance(carouselGenericExample).prev()">
   PREV
-</button>
+</button>
 
-<button 
+<button 
   class="btn btn-secondary"
-  onclick="myCarousel.Carousel.next()">
+  onclick="BSN.Carousel.getInstance(carouselGenericExample).next()">
   NEXT
-</button>
+</button>
 

This highlights the fact that we don't need to use href="#myCarousel" @@ -1476,6 +1476,19 @@

Dropdown Examples

The original plugin doesn't support nesting nor recommend using it, and due to the implementation of automatic repositioning we decided to deprecate nesting functionality from our component.

+ + +

Input groups also work.

Be sure to check the markup of the above examples and the original plugin documentation page.

@@ -2889,14 +2902,14 @@

ScrollSpy Examples

@@ -3210,7 +3223,7 @@

Tab Examples