@coreui/coreui-pro
Version:
The most popular front-end framework for developing responsive, mobile-first projects on the web rewritten by the CoreUI Team
6 lines • 203 kB
JavaScript
/*!
* CoreUI v5.23.0 (https://coreui.io)
* Copyright 2025 The CoreUI Team (https://github.com/orgs/coreui/people)
* Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("@popperjs/core")):"function"==typeof define&&define.amd?define(["@popperjs/core"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).bootstrap=t(e.Popper)}(this,function(e){"use strict";function t(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const i in e)if("default"!==i){const n=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:()=>e[i]})}return t.default=e,Object.freeze(t)}const i=t(e),n=new Map,s={set(e,t,i){n.has(e)||n.set(e,new Map);const s=n.get(e);s.has(t)||0===s.size?s.set(t,i):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(s.keys())[0]}.`)},get:(e,t)=>n.has(e)&&n.get(e).get(t)||null,remove(e,t){if(!n.has(e))return;const i=n.get(e);i.delete(t),0===i.size&&n.delete(e)}},a="transitionend",o=e=>(e&&window.CSS&&window.CSS.escape&&(e=e.replace(/#([^\s"#']+)/g,(e,t)=>`#${CSS.escape(t)}`)),e),r=e=>null==e?`${e}`:Object.prototype.toString.call(e).match(/\s([a-z]+)/i)[1].toLowerCase(),l=e=>{do{e+=Math.floor(1e6*Math.random())}while(document.getElementById(e));return e},c=e=>{e.dispatchEvent(new Event(a))},h=e=>!(!e||"object"!=typeof e)&&(void 0!==e.jquery&&(e=e[0]),void 0!==e.nodeType),d=e=>h(e)?e.jquery?e[0]:e:"string"==typeof e&&e.length>0?document.querySelector(o(e)):null,u=e=>{if(!h(e)||0===e.getClientRects().length)return!1;const t="visible"===getComputedStyle(e).getPropertyValue("visibility"),i=e.closest("details:not([open])");if(!i)return t;if(i!==e){const t=e.closest("summary");if(t&&t.parentNode!==i)return!1;if(null===t)return!1}return t},_=e=>!e||e.nodeType!==Node.ELEMENT_NODE||!!e.classList.contains("disabled")||(void 0!==e.disabled?e.disabled:e.hasAttribute("disabled")&&"false"!==e.getAttribute("disabled")),g=e=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof e.getRootNode){const t=e.getRootNode();return t instanceof ShadowRoot?t:null}return e instanceof ShadowRoot?e:e.parentNode?g(e.parentNode):null},p=()=>{},m=e=>{e.offsetHeight},f=()=>window.jQuery&&!document.body.hasAttribute("data-bs-no-jquery")?window.jQuery:null,b=[],v=()=>"rtl"===document.documentElement.dir,y=e=>{var t;t=()=>{const t=f();if(t){const i=e.NAME,n=t.fn[i];t.fn[i]=e.jQueryInterface,t.fn[i].Constructor=e,t.fn[i].noConflict=()=>(t.fn[i]=n,e.jQueryInterface)}},"loading"===document.readyState?(b.length||document.addEventListener("DOMContentLoaded",()=>{for(const e of b)e()}),b.push(t)):t()},w=(e,t=[],i=e)=>"function"==typeof e?e.call(...t):i,D=(e,t,i=!0)=>{if(!i)return void w(e);const n=(e=>{if(!e)return 0;let{transitionDuration:t,transitionDelay:i}=window.getComputedStyle(e);const n=Number.parseFloat(t),s=Number.parseFloat(i);return n||s?(t=t.split(",")[0],i=i.split(",")[0],1e3*(Number.parseFloat(t)+Number.parseFloat(i))):0})(t)+5;let s=!1;const o=({target:i})=>{i===t&&(s=!0,t.removeEventListener(a,o),w(e))};t.addEventListener(a,o),setTimeout(()=>{s||c(t)},n)},E=(e,t,i,n)=>{const s=e.length;let a=e.indexOf(t);return-1===a?!i&&n?e[s-1]:e[0]:(a+=i?1:-1,n&&(a=(a+s)%s),e[Math.max(0,Math.min(a,s-1))])},k=/[^.]*(?=\..*)\.|.*/,L=/\..*/,T=/::\d+$/,A={};let C=1;const S={mouseenter:"mouseover",mouseleave:"mouseout"},I=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","input","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function $(e,t){return t&&`${t}::${C++}`||e.uidEvent||C++}function O(e){const t=$(e);return e.uidEvent=t,A[t]=A[t]||{},A[t]}function x(e,t,i=null){return Object.values(e).find(e=>e.callable===t&&e.delegationSelector===i)}function N(e,t,i){const n="string"==typeof t,s=n?i:t||i;let a=F(e);return I.has(a)||(a=e),[n,s,a]}function P(e,t,i,n,s){if("string"!=typeof t||!e)return;let[a,o,r]=N(t,i,n);if(t in S){const e=e=>function(t){if(!t.relatedTarget||t.relatedTarget!==t.delegateTarget&&!t.delegateTarget.contains(t.relatedTarget))return e.call(this,t)};o=e(o)}const l=O(e),c=l[r]||(l[r]={}),h=x(c,o,a?i:null);if(h)return void(h.oneOff=h.oneOff&&s);const d=$(o,t.replace(k,"")),u=a?function(e,t,i){return function n(s){const a=e.querySelectorAll(t);for(let{target:o}=s;o&&o!==this;o=o.parentNode)for(const r of a)if(r===o)return j(s,{delegateTarget:o}),n.oneOff&&H.off(e,s.type,t,i),i.apply(o,[s])}}(e,i,o):function(e,t){return function i(n){return j(n,{delegateTarget:e}),i.oneOff&&H.off(e,n.type,t),t.apply(e,[n])}}(e,o);u.delegationSelector=a?i:null,u.callable=o,u.oneOff=s,u.uidEvent=d,c[d]=u,e.addEventListener(r,u,a)}function M(e,t,i,n,s){const a=x(t[i],n,s);a&&(e.removeEventListener(i,a,Boolean(s)),delete t[i][a.uidEvent])}function B(e,t,i,n){const s=t[i]||{};for(const[a,o]of Object.entries(s))a.includes(n)&&M(e,t,i,o.callable,o.delegationSelector)}function F(e){return e=e.replace(L,""),S[e]||e}const H={on(e,t,i,n){P(e,t,i,n,!1)},one(e,t,i,n){P(e,t,i,n,!0)},off(e,t,i,n){if("string"!=typeof t||!e)return;const[s,a,o]=N(t,i,n),r=o!==t,l=O(e),c=l[o]||{},h=t.startsWith(".");if(void 0===a){if(h)for(const i of Object.keys(l))B(e,l,i,t.slice(1));for(const[i,n]of Object.entries(c)){const s=i.replace(T,"");r&&!t.includes(s)||M(e,l,o,n.callable,n.delegationSelector)}}else{if(!Object.keys(c).length)return;M(e,l,o,a,s?i:null)}},trigger(e,t,i){if("string"!=typeof t||!e)return null;const n=f();let s=null,a=!0,o=!0,r=!1;t!==F(t)&&n&&(s=n.Event(t,i),n(e).trigger(s),a=!s.isPropagationStopped(),o=!s.isImmediatePropagationStopped(),r=s.isDefaultPrevented());const l=j(new Event(t,{bubbles:a,cancelable:!0}),i);return r&&l.preventDefault(),o&&e.dispatchEvent(l),l.defaultPrevented&&s&&s.preventDefault(),l}};function j(e,t={}){for(const[i,n]of Object.entries(t))try{e[i]=n}catch(t){Object.defineProperty(e,i,{configurable:!0,get:()=>n})}return e}function z(e){if("true"===e)return!0;if("false"===e)return!1;if(e===Number(e).toString())return Number(e);if(""===e||"null"===e)return null;if("string"!=typeof e)return e;try{return JSON.parse(decodeURIComponent(e))}catch(t){return e}}function V(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}const R={setDataAttribute(e,t,i){e.setAttribute(`data-bs-${V(t)}`,i)},removeDataAttribute(e,t){e.removeAttribute(`data-bs-${V(t)}`)},getDataAttributes(e){if(!e)return{};const t={},i=Object.keys(e.dataset).filter(e=>e.startsWith("bs")&&!e.startsWith("bsConfig"));for(const n of i){let i=n.replace(/^bs/,"");i=i.charAt(0).toLowerCase()+i.slice(1),t[i]=z(e.dataset[n])}return t},getDataAttribute:(e,t)=>z(e.getAttribute(`data-bs-${V(t)}`))};class q{static get Default(){return{}}static get DefaultType(){return{}}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}_getConfig(e){return e=this._mergeConfigObj(e),e=this._configAfterMerge(e),this._typeCheckConfig(e),e}_configAfterMerge(e){return e}_mergeConfigObj(e,t){const i=h(t)?R.getDataAttribute(t,"config"):{};return{...this.constructor.Default,..."object"==typeof i?i:{},...h(t)?R.getDataAttributes(t):{},..."object"==typeof e?e:{}}}_typeCheckConfig(e,t=this.constructor.DefaultType){for(const[i,n]of Object.entries(t)){const t=e[i],s=h(t)?"element":r(t);if(!new RegExp(n).test(s))throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${i}" provided type "${s}" but expected type "${n}".`)}}}class W extends q{constructor(e,t){super(),(e=d(e))&&(this._element=e,this._config=this._getConfig(t),s.set(this._element,this.constructor.DATA_KEY,this))}dispose(){s.remove(this._element,this.constructor.DATA_KEY),H.off(this._element,this.constructor.EVENT_KEY);for(const e of Object.getOwnPropertyNames(this))this[e]=null}_queueCallback(e,t,i=!0){D(e,t,i)}_getConfig(e){return e=this._mergeConfigObj(e,this._element),e=this._configAfterMerge(e),this._typeCheckConfig(e),e}static getInstance(e){return s.get(d(e),this.DATA_KEY)}static getOrCreateInstance(e,t={}){return this.getInstance(e)||new this(e,"object"==typeof t?t:null)}static get VERSION(){return"5.23.0"}static get DATA_KEY(){return`bs.${this.NAME}`}static get EVENT_KEY(){return`.${this.DATA_KEY}`}static eventName(e){return`${e}${this.EVENT_KEY}`}}const Y=e=>{let t=e.getAttribute("data-bs-target");if(!t||"#"===t){let i=e.getAttribute("href");if(!i||!i.includes("#")&&!i.startsWith("."))return null;i.includes("#")&&!i.startsWith("#")&&(i=`#${i.split("#")[1]}`),t=i&&"#"!==i?i.trim():null}return t?t.split(",").map(e=>o(e)).join(","):null},U={find:(e,t=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(t,e)),findOne:(e,t=document.documentElement)=>Element.prototype.querySelector.call(t,e),children:(e,t)=>[].concat(...e.children).filter(e=>e.matches(t)),parents(e,t){const i=[];let n=e.parentNode.closest(t);for(;n;)i.push(n),n=n.parentNode.closest(t);return i},prev(e,t){let i=e.previousElementSibling;for(;i;){if(i.matches(t))return[i];i=i.previousElementSibling}return[]},next(e,t){let i=e.nextElementSibling;for(;i;){if(i.matches(t))return[i];i=i.nextElementSibling}return[]},focusableChildren(e){const t=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map(e=>`${e}:not([tabindex^="-"])`).join(",");return this.find(t,e).filter(e=>!_(e)&&u(e))},getSelectorFromElement(e){const t=Y(e);return t&&U.findOne(t)?t:null},getElementFromSelector(e){const t=Y(e);return t?U.findOne(t):null},getMultipleElementsFromSelector(e){const t=Y(e);return t?U.find(t):[]}},K=(e,t="hide")=>{const i=`click.dismiss${e.EVENT_KEY}`,n=e.NAME;H.on(document,i,`[data-bs-dismiss="${n}"]`,function(i){if(["A","AREA"].includes(this.tagName)&&i.preventDefault(),_(this))return;const s=U.getElementFromSelector(this)||this.closest(`.${n}`);e.getOrCreateInstance(s)[t]()})},Q=".bs.alert",G=`close${Q}`,X=`closed${Q}`;class J extends W{static get NAME(){return"alert"}close(){if(H.trigger(this._element,G).defaultPrevented)return;this._element.classList.remove("show");const e=this._element.classList.contains("fade");this._queueCallback(()=>this._destroyElement(),this._element,e)}_destroyElement(){this._element.remove(),H.trigger(this._element,X),this.dispose()}static jQueryInterface(e){return this.each(function(){const t=J.getOrCreateInstance(this);if("string"==typeof e){if(void 0===t[e]||e.startsWith("_")||"constructor"===e)throw new TypeError(`No method named "${e}"`);t[e](this)}})}}K(J,"close"),y(J);const Z={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],dd:[],div:[],dl:[],dt:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},ee=new Set(["background","cite","href","itemtype","longdesc","poster","src","xlink:href"]),te=/^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i,ie=(e,t)=>{const i=e.nodeName.toLowerCase();return t.includes(i)?!ee.has(i)||Boolean(te.test(e.nodeValue)):t.filter(e=>e instanceof RegExp).some(e=>e.test(i))};function ne(e,t,i){if(!e.length)return e;if(i&&"function"==typeof i)return i(e);const n=(new window.DOMParser).parseFromString(e,"text/html"),s=[].concat(...n.body.querySelectorAll("*"));for(const e of s){const i=e.nodeName.toLowerCase();if(!Object.keys(t).includes(i)){e.remove();continue}const n=[].concat(...e.attributes),s=[].concat(t["*"]||[],t[i]||[]);for(const t of n)ie(t,s)||e.removeAttribute(t.nodeName)}return n.body.innerHTML}const se="bs.autocomplete",ae=`.${se}`,oe=".data-api",re="ArrowUp",le="ArrowDown",ce="Backspace",he="Delete",de="Enter",ue="Tab",_e=`blur${ae}`,ge=`changed${ae}`,pe=`click${ae}`,me=`hide${ae}`,fe=`hidden${ae}`,be=`input${ae}`,ve=`keydown${ae}`,ye=`keyup${ae}`,we=`show${ae}`,De=`shown${ae}`,Ee=`click${ae}${oe}`,ke=`keyup${ae}${oe}`,Le=`load${ae}${oe}`,Te="disabled",Ae="autocomplete-input",Ce="autocomplete-option",Se="selected",Ie="show",$e=`.autocomplete:not(.disabled).${Ie}`,Oe=".autocomplete-option",xe=".autocomplete-options-empty",Ne={allowList:Z,allowOnlyDefinedOptions:!1,ariaCleanerLabel:"Clear selection",ariaIndicatorLabel:"Toggle visibility of options menu",cleaner:!1,clearSearchOnSelect:!0,container:!1,disabled:!1,highlightOptionsOnSearch:!1,id:null,indicator:!1,invalid:!1,name:null,options:!1,optionsGroupsTemplate:null,optionsMaxHeight:"auto",optionsTemplate:null,placeholder:null,required:!1,sanitize:!0,sanitizeFn:null,search:null,searchNoResultsLabel:!1,showHints:!1,valid:!1,value:null},Pe={allowList:"object",allowOnlyDefinedOptions:"boolean",ariaCleanerLabel:"string",ariaIndicatorLabel:"string",cleaner:"boolean",clearSearchOnSelect:"boolean",container:"(string|element|boolean)",disabled:"boolean",highlightOptionsOnSearch:"boolean",id:"(string|null)",indicator:"boolean",invalid:"boolean",name:"(string|null)",options:"(array|null)",optionsGroupsTemplate:"(function|null)",optionsMaxHeight:"(number|string)",optionsTemplate:"(function|null)",placeholder:"(string|null)",required:"boolean",sanitize:"boolean",sanitizeFn:"(null|function)",search:"(array|string|null)",searchNoResultsLabel:"boolean|string",showHints:"boolean",valid:"boolean",value:"(number|string|null)"};class Me extends W{constructor(e,t){var i;super(e,t),this._uniqueId=null!=(i=this._config.id)?i:l(`${this.constructor.NAME}`),this._indicatorElement=null,this._inputElement=null,this._inputHintElement=null,this._togglerElement=null,this._optionsElement=null,this._menu=null,this._selected=[],this._options=this._getOptionsFromConfig(),this._popper=null,this._search="",this._createAutocomplete(),this._addEventListeners(),s.set(this._element,se,this)}static get Default(){return Ne}static get DefaultType(){return Pe}static get NAME(){return"autocomplete"}toggle(){return this._isShown()?this.hide():this.show()}show(){this._config.disabled||this._isShown()||(this._config.searchNoResultsLabel||0!==this._flattenOptions().filter(e=>e.label.toLowerCase().includes(this._search.toLowerCase())).length)&&(H.trigger(this._element,we),this._element.classList.add(Ie),this._inputElement.setAttribute("aria-expanded","true"),this._config.container&&(this._menu.style.minWidth=`${this._element.offsetWidth}px`,this._menu.classList.add(Ie)),H.trigger(this._element,De),this._createPopper())}hide(){H.trigger(this._element,me),this._popper&&this._popper.destroy(),this._element.classList.remove(Ie),this._inputElement.setAttribute("aria-expanded","false"),this._config.container&&this._menu.classList.remove(Ie),this._inputHintElement&&(this._inputHintElement.value=""),H.trigger(this._element,fe)}dispose(){this._popper&&this._popper.destroy(),super.dispose()}clear(){this.deselectAll(),this.search(""),this._filterOptionsList(),this._inputElement.value="",H.trigger(this._element,ge,{value:this._selected})}search(e){this._search=e.length>0?e.toLowerCase():"",this._isExternalSearch()||this._filterOptionsList(),H.trigger(this._element,be,{value:e})}update(e){e.value&&this.deselectAll(),this._config={...this._config,...this._configAfterMerge(e)},this._options=this._getOptionsFromConfig(),this._optionsElement.innerHTML="",this._createOptions(this._optionsElement,this._options)}deselectAll(e=this._selected){if(0!==this._selected.length)for(const t of e)t.disabled||(Array.isArray(t.options)?this.deselectAll(t.options):(this._deselectOption(t.value),this._updateCleaner()))}_flattenOptions(e=this._options,t=[]){for(const i of e)i&&Array.isArray(i.options)?this._flattenOptions(i.options,t):t.push(i);return t}_getClassNames(){return this._element.classList.value.split(" ")}_highlightOption(e){const t=new RegExp(this._search,"gi");return e.replace(t,e=>`<strong>${e}</strong>`)}_isExternalSearch(){return Array.isArray(this._config.search)&&this._config.search.includes("external")}_isGlobalSearch(){return Array.isArray(this._config.search)&&this._config.search.includes("global")}_isVisible(e){return"none"!==window.getComputedStyle(e).display}_isShown(){return this._element.classList.contains(Ie)}_addEventListeners(){H.on(this._element,pe,e=>{this._config.disabled||e.target.closest(".autocomplete-indicator")||this.show()}),H.on(this._element,ve,e=>{if("Escape"===e.key)return this.hide(),void(this._config.allowOnlyDefinedOptions&&0===this._selected.length&&(this.search(""),this._inputElement.value=""));!this._isGlobalSearch()||1!==e.key.length&&e.key!==ce&&e.key!==he||this._inputElement.focus()}),H.on(this._menu,ve,e=>{!this._isGlobalSearch()||1!==e.key.length&&e.key!==ce&&e.key!==he||this._inputElement.focus()}),H.on(this._togglerElement,ve,e=>{if(!this._isShown()&&(e.key===de||e.key===le))return e.preventDefault(),void this.show();this._isShown()&&e.key===le&&(e.preventDefault(),this._selectMenuItem(e))}),H.on(this._indicatorElement,pe,e=>{e.preventDefault(),this.toggle()}),H.on(this._inputElement,_e,()=>{const e=this._flattenOptions().filter(e=>e.label.toLowerCase().startsWith(this._inputElement.value.toLowerCase()));this._config.allowOnlyDefinedOptions&&0===this._selected.length&&0===e.length&&this.clear()}),H.on(this._inputElement,ve,e=>{if(this._isShown()||e.key===ue||this.show(),e.key!==le||this._inputElement.value.length!==this._inputElement.selectionStart){if(e.key===ue&&this._config.showHints&&this._inputElement.value.length>0){this._inputHintElement.value&&(e.preventDefault(),e.stopPropagation());const t=this._flattenOptions().filter(e=>e.label.toLowerCase().startsWith(this._inputElement.value.toLowerCase()));t.length>0&&this._selectOption(t[0])}if(e.key===de){if(e.preventDefault(),e.stopPropagation(),0===this._inputElement.value.length)return;const t=this._flattenOptions().filter(e=>e.label.toLowerCase()===this._inputElement.value.toLowerCase());t.length>0&&this._selectOption(t[0]),0!==t.length||this._config.allowOnlyDefinedOptions||(H.trigger(this._element,ge,{value:this._inputElement.value}),this.hide(),this._config.clearSearchOnSelect&&this.search(""))}}else this._selectMenuItem(e)}),H.on(this._inputElement,ye,e=>{if(1===e.key.length||e.key===ce||e.key===he){const{value:t}=e.target;if(this.search(t),this._config.showHints){const e=t?this._flattenOptions().filter(e=>e.label.toLowerCase().startsWith(t.toLowerCase())):[];this._inputHintElement.value=e.length>0?`${t}${e[0].label.slice(t.length)}`:""}this._selected.length>0&&(this.deselectAll(),H.trigger(this._element,ge,{value:this._selected}))}}),H.on(this._optionsElement,pe,e=>{e.preventDefault(),e.stopPropagation(),this._onOptionsClick(e.target)}),H.on(this._cleanerElement,pe,e=>{this._config.disabled||(e.preventDefault(),e.stopPropagation(),this.clear())}),H.on(this._cleanerElement,ve,e=>{this._config.disabled||e.key!==de||(e.preventDefault(),e.stopPropagation(),this.clear())}),H.on(this._optionsElement,ve,e=>{e.key===de&&this._onOptionsClick(e.target),[re,le].includes(e.key)&&(e.preventDefault(),this._selectMenuItem(e))})}_getOptionsFromConfig(e=this._config.options){if(!e||!Array.isArray(e))return[];const t=[];for(const n of e){var i;if(n.options&&Array.isArray(n.options)){const e={...n};delete e.label,delete e.options,t.push({...e,label:n.label,options:this._getOptionsFromConfig(n.options)});continue}const e="string"==typeof n?n:n.label,s=null!=(i=n.value)?i:"string"==typeof n?n:n.label,a=n.selected||this._config.value&&this._config.value===s,o="object"==typeof n?{...n}:{};delete o.label,delete o.value,delete o.selected,delete o.disabled,t.push({...o,label:e,value:String(s),...a&&{selected:!0},...n.disabled&&{disabled:!0}}),a&&this._selected.push({label:n.label,value:String(s)})}return t}_createAutocomplete(){this._element.classList.add("autocomplete"),this._element.classList.toggle("is-invalid",this._config.invalid),this._element.classList.toggle("is-valid",this._config.valid),this._config.disabled&&this._element.classList.add(Te);for(const e of this._getClassNames())this._element.classList.add(e);this._createInputGroup(),this._createButtons(),this._createOptionsContainer(),this._updateOptionsList()}_createInputGroup(){var e;const t=document.createElement("div");if(t.classList.add("autocomplete-input-group"),this._togglerElement=t,this._config.search||this._config.disabled||(t.tabIndex=-1),!this._config.disabled&&this._config.showHints){const e=document.createElement("input");e.classList.add(Ae,"autocomplete-input-hint"),e.setAttribute("name",(this._config.name||`${this._uniqueId}-hint`).toString()),e.autocomplete="off",e.readOnly=!0,e.tabIndex=-1,e.setAttribute("aria-hidden",!0),t.append(e),this._inputHintElement=e}const i=document.createElement("input");i.classList.add(Ae),i.id=this._uniqueId,i.setAttribute("name",(this._config.name||this._uniqueId).toString()),i.autocomplete="off",i.placeholder=null!=(e=this._config.placeholder)?e:"",i.role="combobox",i.setAttribute("aria-autocomplete","list"),i.setAttribute("aria-expanded","false"),i.setAttribute("aria-haspopup","listbox"),this._config.disabled&&(i.setAttribute("disabled",!0),i.tabIndex=-1),this._config.required&&i.setAttribute("required",!0),t.append(i),this._inputElement=i,this._element.append(t)}_createButtons(){if(!this._config.cleaner&&!this._config.indicator)return;const e=document.createElement("div");if(e.classList.add("autocomplete-buttons"),!this._config.disabled&&this._config.cleaner){const t=document.createElement("button");t.type="button",t.classList.add("autocomplete-cleaner"),t.style.display="none",t.setAttribute("aria-label",this._config.ariaCleanerLabel),e.append(t),this._cleanerElement=t}if(this._config.indicator){const t=document.createElement("button");t.type="button",t.classList.add("autocomplete-indicator"),t.setAttribute("aria-label",this._config.ariaIndicatorLabel),this._config.disabled&&(t.tabIndex=-1),e.append(t),this._indicatorElement=t,this._indicatorElement=t}this._togglerElement.append(e),this._updateCleaner()}_createPopper(){if(void 0===i)throw new TypeError("CoreUI's Auto Complete component require Popper (https://popper.js.org)");const e={modifiers:[{name:"preventOverflow",options:{boundary:"clippingParents"}},{name:"offset",options:{offset:[0,2]}}],placement:v()?"bottom-end":"bottom-start"};this._popper=i.createPopper(this._togglerElement,this._menu,e)}_createOptionsContainer(){const e=document.createElement("div");e.classList.add("autocomplete-dropdown"),e.role="listbox",e.setAttribute("aria-labelledby",this._uniqueId),e.setAttribute("id",`${this._uniqueId}-listbox`);const t=document.createElement("div");t.classList.add("autocomplete-options"),"auto"!==this._config.optionsMaxHeight&&(t.style.maxHeight=`${this._config.optionsMaxHeight}px`,t.style.overflow="auto"),e.append(t);const{container:i}=this._config;i?(this._inputElement.setAttribute("aria-owns",`${this._uniqueId}-listbox`),e.id=`${this._uniqueId}-listbox`,i.append(e)):this._element.append(e),this._createOptions(t,this._options),this._optionsElement=t,this._menu=e}_createOptions(e,t){for(const i of t){if(Array.isArray(i.options)){const t=document.createElement("div");t.classList.add("autocomplete-optgroup"),t.setAttribute("role","group");const n=document.createElement("div");this._config.optionsGroupsTemplate&&"function"==typeof this._config.optionsGroupsTemplate?n.innerHTML=this._config.sanitize?ne(this._config.optionsGroupsTemplate(i),this._config.allowList,this._config.sanitizeFn):this._config.optionsGroupsTemplate(i):n.textContent=i.label,n.classList.add("autocomplete-optgroup-label"),t.append(n),this._createOptions(t,i.options),e.append(t);continue}const t=document.createElement("div");t.classList.add(Ce),i.disabled&&(t.classList.add(Te),t.setAttribute("aria-disabled","true")),t.dataset.value=i.value,t.tabIndex=0,this._isExternalSearch()&&this._config.highlightOptionsOnSearch&&this._search?t.innerHTML=this._highlightOption(i.label):this._config.optionsTemplate&&"function"==typeof this._config.optionsTemplate?t.innerHTML=this._config.sanitize?ne(this._config.optionsTemplate(i),this._config.allowList,this._config.sanitizeFn):this._config.optionsTemplate(i):t.textContent=i.label,e.append(t)}}_onOptionsClick(e){if(e.classList.contains("label"))return;if(!e.classList.contains(Ce)&&!(e=e.closest(Oe)))return;const{value:t}=e.dataset,i=this._findOptionByValue(t);i&&(this._selectOption(i),this._inputElement.focus())}_findOptionByValue(e,t=this._options){for(const i of t){if(i.value===e)return i;if(i.options&&Array.isArray(i.options)){const t=this._findOptionByValue(e,i.options);if(t)return t}}return null}_selectOption(e){this.deselectAll(),0===this._selected.filter(t=>t.value===e.value).length&&this._selected.push(e);const t=U.findOne(`[data-value="${e.value}"]`,this._optionsElement);t&&(t.classList.add(Se),t.setAttribute("aria-selected",!0)),H.trigger(this._element,ge,{value:e}),this._inputElement.value=e.label,this._config.showHints&&(this._inputHintElement.value=""),this.hide(),this._config.clearSearchOnSelect&&this.search(""),this._updateCleaner()}_deselectOption(e){this._selected=this._selected.filter(t=>t.value!==e);const t=U.findOne(`[data-value="${e}"]`,this._optionsElement);t&&(t.classList.remove(Se),t.setAttribute("aria-selected",!1))}_updateCleaner(){this._config.cleaner&&null!==this._cleanerElement&&(this._selected.length>0?this._cleanerElement.style.removeProperty("display"):this._cleanerElement.style.display="none")}_updateOptionsList(e=this._options){for(const t of e)Array.isArray(t.options)?this._updateOptionsList(t.options):t.selected&&this._selectOption(t)}_filterOptionsList(){const e=U.find(Oe,this._menu);let t=0;for(const i of e){-1===i.textContent.toLowerCase().indexOf(this._search)?i.style.display="none":(this._config.highlightOptionsOnSearch&&!this._config.optionsTemplate&&(i.innerHTML=this._highlightOption(i.textContent)),i.style.removeProperty("display"),t++);const e=i.closest(".autocomplete-optgroup");e&&(U.children(e,Oe).filter(e=>this._isVisible(e)).length>0?e.style.removeProperty("display"):e.style.display="none")}if(t>0)U.findOne(xe,this._menu)&&U.findOne(xe,this._menu).remove();else if(0===t){if(this._config.searchNoResultsLabel){const e=document.createElement("div");return e.classList.add("autocomplete-options-empty"),e.innerHTML=this._config.searchNoResultsLabel,void(U.findOne(xe,this._menu)||U.findOne(".autocomplete-options",this._menu).append(e))}this.hide()}}_selectMenuItem({key:e,target:t}){const i=U.find(".autocomplete-options .autocomplete-option:not(.disabled):not(:disabled)",this._menu).filter(e=>u(e));i.length&&E(i,t,e===le,!i.includes(t)).focus()}_configAfterMerge(e){return!0===e.container&&(e.container=document.body),"object"!=typeof e.container&&"string"!=typeof e.container||(e.container=d(e.container)),"string"==typeof e.options&&(e.options=e.options.split(/,\s*/).map(String)),"string"==typeof e.search&&(e.search=e.search.split(/,\s*/).map(String)),e}static autocompleteInterface(e,t){const i=Me.getOrCreateInstance(e,t);if("string"==typeof t){if(void 0===i[t])throw new TypeError(`No method named "${t}"`);i[t]()}}static jQueryInterface(e){return this.each(function(){Me.autocompleteInterface(this,e)})}static clearMenus(e){if(2===e.button||"keyup"===e.type&&e.key!==ue)return;const t=U.find($e);for(const i of t){const t=Me.getInstance(i);t&&(e.composedPath().includes(t._element)||(t._element,e.type,t.hide(),t.search(""),t._config.allowOnlyDefinedOptions&&0===t._selected.length&&(t._inputElement.value="")))}}}H.on(window,Le,()=>{for(const e of U.find('[data-bs-toggle="autocomplete"]:not(.disabled)'))Me.autocompleteInterface(e)}),H.on(document,Ee,Me.clearMenus),H.on(document,ke,Me.clearMenus),y(Me);const Be='[data-bs-toggle="button"]';class Fe extends W{static get NAME(){return"button"}toggle(){this._element.setAttribute("aria-pressed",this._element.classList.toggle("active"))}static jQueryInterface(e){return this.each(function(){const t=Fe.getOrCreateInstance(this);"toggle"===e&&t[e]()})}}H.on(document,"click.bs.button.data-api",Be,e=>{e.preventDefault();const t=e.target.closest(Be);Fe.getOrCreateInstance(t).toggle()}),y(Fe);let He,je,ze,Ve,Re,qe,We,Ye=e=>e;const Ue=(e,t)=>{const i=(e=>{const t=new Date(e,0,4),i=t.getDay(),n=0===i?6:i-1,s=new Date(t);return s.setDate(t.getDate()-n),s})(e),n=new Date(i);return n.setDate(i.getDate()+7*(t-1)),n},Ke=e=>12*e.getFullYear()+e.getMonth(),Qe=(e,t,i)=>null!==t&&e<t||null!==i&&e>i,Ge=(e,t)=>{let i=e.replaceAll(/[.*+?^${}()|[\\]\\]/g,"\\$&");return i=i.replace("2013",String.raw(je||(je=Ye`(?<year>\d{2,4})`))).replace("12",String.raw(ze||(ze=Ye`(?<month>\d{1,2})`))).replace("31",String.raw(Ve||(Ve=Ye`(?<day>\d{1,2})`))),t&&(i=i.replaceAll(/17|5/g,String.raw(Re||(Re=Ye`(?<hour>\d{1,2})`))).replace("19",String.raw(qe||(qe=Ye`(?<minute>\d{1,2})`))).replace("22",String.raw(We||(We=Ye`(?<second>\d{1,2})`))).replaceAll(/AM|PM/gi,"(?<ampm>[APap][Mm])")),i},Xe=(e,t)=>{const i=Number.parseInt(e,10)-1,n=Number.parseInt(t,10);return i>=0&&i<=11&&n>=1&&n<=31},Je=(e,t,i)=>{const n=((e,t)=>{const i=new Date(2013,11,31,17,19,22),n=[];try{const s=t?i.toLocaleString(e):i.toLocaleDateString(e);n.push(s)}catch(e){const s=t?i.toLocaleString("en-US"):i.toLocaleDateString("en-US");n.push(s)}const s=["/","-","."," "],a=n[0];let o="/";a.includes("/")?o="/":a.includes("-")?o="-":a.includes(".")&&(o=".");for(const e of s)if(e!==o){const t=o.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw(He||(He=Ye`\$&`))),i=a.replaceAll(new RegExp(t,"g"),e);n.push(i)}return n})(t,i),s=((e,t,i)=>{for(const n of t){const t=Ge(n,i),s=new RegExp(`^${t}$`),a=e.trim().match(s);if(null!=a&&a.groups)return a.groups}return null})(e,n,i);if(!s){const t=e.trim(),i=/[-/.:]/.test(t),s=t.split(/[-/.\s:]+/).filter(e=>e.length>0),a=(e=>0===e.length?3:e[0].split(/[-/.\s:]+/).filter(e=>e.length>0).length)(n),o=s.length>=a;return i&&o?Ze(e):null}if(!("year"in s&&"month"in s&&"day"in s))return null;{const{month:e,day:t,year:i}=s;if(!Xe(e,t))return null}return i?(e=>{const{year:t,month:i,day:n,hour:s,minute:a,second:o,ampm:r}=e,l=_t(t),c=Number.parseInt(i,10)-1,h=Number.parseInt(n,10),d=((e,t)=>{const i=Number.parseInt(e,10);if(!t)return i;const n="pm"===t.toLowerCase();return n&&12!==i?i+12:n||12!==i?i:0})(s,r),u=Number.parseInt(null!=a?a:"0",10)||0,_=Number.parseInt(null!=o?o:"0",10)||0;return((e,t,i)=>e>=0&&e<=23&&t>=0&&t<=59&&i>=0&&i<=59)(d,u,_)?new Date(l,c,h,d,u,_):null})(s):(e=>{const{year:t,month:i,day:n}=e;if(!Xe(i,n))return null;const s=_t(t),a=Number.parseInt(i,10)-1,o=Number.parseInt(n,10);return new Date(s,a,o)})(s)},Ze=e=>{const t=new Date(Date.parse(e));return Number.isNaN(t.getTime())?null:t},et=(e,t,i="en-US",n=!1)=>{if(null===e)return null;if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;const s=e;switch(t){case"week":return(e=>{const t=[/^(\d{4})-W(\d{1,2})$/,/^(\d{4})W(\d{1,2})$/,/^(\d{4})\s+W(\d{1,2})$/];for(const i of t){const t=e.trim().match(i);if(t){const e=_t(t[1]),i=Number.parseInt(t[2],10);return Ue(e,i)}}return(e=>{const[t,i]=e.split(/[Ww]/),n=_t(t),s=Number.parseInt(i,10);return Ue(n,s)})(e)})(s);case"month":return(e=>{const t=[/^(\d{2,4})[-/.\s](\d{1,2})$/,/^(\d{1,2})[-/.\s](\d{2,4})$/];for(const i of t){const t=e.trim().match(i);if(t){const e=t[1],i=t[2],n=Number.parseInt(e,10),s=Number.parseInt(i,10);let a,o;if(e.length>=3||n>=100?(a=_t(e),o=s-1):i.length>=3||s>=100?(a=_t(i),o=n-1):s>=1&&s<=12&&(n>12||n<1)?(a=_t(e),o=s-1):(a=_t(i),o=n-1),o>=0&&o<=11)return new Date(a,o,1)}}return null})(s);case"year":return(e=>{const t=String(e),i=t.trim().match(/^(\d{2,4})$/);if(i){const e={year:i[1]};return gt(e)}return Ze(t)})(s);default:return Je(s,i,n)}},tt=(e,t)=>{const i=Math.ceil(e.length/t);return Array.from({length:t}).fill("").map((t,n)=>e.slice(n*i,(n+1)*i))},it=(e,t)=>{if(null===e)return null;if("week"===t){const{year:t,weekNumber:i}=nt(e);return`${t}W${i.toString().padStart(2,"0")}`}if("month"===t){const t=`0${e.getMonth()+1}`.slice(-2);return`${e.getFullYear()}-${t}`}return"year"===t?`${e.getFullYear()}`:e},nt=e=>{const t=new Date(e);t.setHours(0,0,0,0),t.setDate(t.getDate()+3-(t.getDay()+6)%7);const i=new Date(t.getFullYear(),0,4);return{weekNumber:1+Math.round((t.getTime()-i.getTime())/6048e5),year:t.getFullYear()}},st=(e,t,i,n)=>{if(t&&e<t)return!0;if(i&&e>i)return!0;if(void 0===n)return!1;if("function"==typeof n)return n(e);if(n instanceof Date&&ct(e,n))return!0;if(Array.isArray(n)&&n)for(const t of n){if("function"==typeof t&&t(e))return!0;if(Array.isArray(t)&&at(e,t[0],t[1]))return!0;if(t instanceof Date&&ct(e,t))return!0}return!1},at=(e,t,i)=>{const n=dt(e),s=t?dt(t):null,a=i?dt(i):null;return Boolean(s&&a&&s<=n&&n<=a)},ot=(e,t,i)=>!(null===t||!ct(t,e))||!(null===i||!ct(i,e)),rt=(e,t,i)=>{if(e&&t){const n=new Date(e);let s=!1;for(;n<t;)if(n.setDate(n.getDate()+1),st(n,null,null,i)){s=!0;break}return s}return!1},lt=(e,t,i)=>{const n=t?Ke(t):null,s=i?Ke(i):null,a=Ke(e);return Boolean(n&&s&&n<=a&&a<=s)},ct=(e,t)=>e instanceof Date&&t instanceof Date?e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear():null===e&&null===t,ht=(e,t,i)=>{const n=e.getFullYear(),s=t?t.getFullYear():null,a=i?i.getFullYear():null;return Boolean(s&&a&&s<=n&&n<=a)},dt=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t},ut=(e,t)=>{if(null===e)return null;if(!(t instanceof Date))return e;const i=new Date(e);return i.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()),i},_t=e=>{let t=Number.parseInt(e,10);if(t<100){const e=(new Date).getFullYear();t=100*Math.floor(e/100)+t,t>e+50&&(t-=100)}return t},gt=e=>{const{year:t}=e,i=_t(t);return new Date(i,0,1)},pt=".bs.calendar",mt=".data-api",ft="ArrowUp",bt="ArrowRight",vt="ArrowDown",yt="ArrowLeft",wt=`blur${pt}`,Dt=`calendarDateChange${pt}`,Et=`calendarMouseleave${pt}`,kt=`cellHover${pt}`,Lt=`endDateChange${pt}`,Tt=`focus${pt}`,At=`keydown${pt}`,Ct=`selectEndChange${pt}`,St=`startDateChange${pt}`,It=`mouseenter${pt}`,$t=`mouseleave${pt}`,Ot=`load${pt}${mt}`,xt=`click${pt}${mt}`,Nt="calendar-cell",Pt="calendar-cell-inner",Mt="calendar-row",Bt=".btn-double-next",Ft=".btn-double-prev",Ht=".btn-month",jt=".btn-next",zt=".btn-prev",Vt=".btn-year",Rt=".calendar-cell",qt=`${Rt}[tabindex="0"]`,Wt=".calendar-row",Yt=`${Wt}[tabindex="0"]`,Ut={ariaNavNextMonthLabel:"Next month",ariaNavNextYearLabel:"Next year",ariaNavPrevMonthLabel:"Previous month",ariaNavPrevYearLabel:"Previous year",calendarDate:null,calendars:1,disabledDates:null,endDate:null,firstDayOfWeek:1,locale:"default",maxDate:null,minDate:null,range:!1,selectAdjacementDays:!1,selectEndDate:!1,selectionType:"day",showAdjacementDays:!0,showWeekNumber:!1,startDate:null,weekdayFormat:2,weekNumbersLabel:null},Kt={ariaNavNextMonthLabel:"string",ariaNavNextYearLabel:"string",ariaNavPrevMonthLabel:"string",ariaNavPrevYearLabel:"string",calendarDate:"(date|number|string|null)",calendars:"number",disabledDates:"(array|date|function|null)",endDate:"(date|number|string|null)",firstDayOfWeek:"number",locale:"string",maxDate:"(date|number|string|null)",minDate:"(date|number|string|null)",range:"boolean",selectAdjacementDays:"boolean",selectEndDate:"boolean",selectionType:"string",showAdjacementDays:"boolean",showWeekNumber:"boolean",startDate:"(date|number|string|null)",weekdayFormat:"(number|string)",weekNumbersLabel:"(string|null)"};class Qt extends W{constructor(e,t){super(e),this._config=this._getConfig(t),this._initializeDates(),this._initializeView(),this._createCalendar(),this._addEventListeners()}static get Default(){return Ut}static get DefaultType(){return Kt}static get NAME(){return"calendar"}update(e){this._config=this._getConfig(e),this._initializeDates(),this._initializeView(),this._element.innerHTML="",this._createCalendar()}_focusOnFirstAvailableCell(){const e=U.findOne(qt,this._element);e&&e.focus()}_getDate(e){if("week"===this._config.selectionType){const t=U.findOne(Rt,e.closest(Wt));return new Date(R.getDataAttribute(t,"date"))}return new Date(R.getDataAttribute(e,"date"))}_handleCalendarClick(e){const t=e.target.classList.contains(Pt)?e.target.parentElement:e.target,i=this._getDate(t),n=new Date(i),s=R.getDataAttribute(t.closest(".calendar"),"calendar-index");return"days"===this._view&&this._setCalendarDate(s?new Date(n.setMonth(n.getMonth()-s)):i),"months"===this._view&&"month"!==this._config.selectionType?(this._setCalendarDate(s?new Date(n.setMonth(n.getMonth()-s)):i),this._view="days",void this._updateCalendar(this._focusOnFirstAvailableCell.bind(this))):"years"===this._view&&"year"!==this._config.selectionType?(this._setCalendarDate(s?new Date(n.setFullYear(n.getFullYear()-s)):i),this._view="months",void this._updateCalendar(this._focusOnFirstAvailableCell.bind(this))):void(st(i,this._minDate,this._maxDate,this._config.disabledDates)||(this._hoverDate=null,this._selectDate(i),this._updateClassNamesAndAriaLabels()))}_handleCalendarKeydown(e){const t=this._getDate(e.target);if("Space"!==e.code&&"Enter"!==e.key||(e.preventDefault(),this._handleCalendarClick(e)),e.key===bt||e.key===yt||e.key===ft||e.key===vt){if(e.preventDefault(),this._maxDate&&t>=et(this._maxDate,this._config.selectionType)&&(e.key===bt||e.key===vt))return;if(this._minDate&&t<=et(this._minDate,this._config.selectionType)&&(e.key===yt||e.key===ft))return;let i=e.target;"week"===this._config.selectionType&&-1===i.tabIndex&&(i=i.closest(Yt));const n=U.find("week"===this._config.selectionType?Yt:qt,this._element),s=n.indexOf(i),a=0===s,o=s===n.length-1,r={start:s,end:n.length-(s+1)},l={ArrowRight:1,ArrowLeft:-1,ArrowUp:"week"===this._config.selectionType&&"days"===this._view?-1:"days"===this._view?-7:-3,ArrowDown:"week"===this._config.selectionType&&"days"===this._view?1:"days"===this._view?7:3};if(e.key===bt&&o||e.key===vt&&r.end<l.ArrowDown||e.key===yt&&a||e.key===ft&&r.start<Math.abs(l.ArrowUp)){const t=e=>{const t=U.find(`${qt}, ${Yt}`,this._element);t.length&&e===bt&&t[0].focus(),t.length&&e===yt&&t[t.length-1].focus(),t.length&&e===vt&&t[l.ArrowDown-(n.length-s)].focus(),t.length&&e===ft&&t[t.length-(Math.abs(l.ArrowUp)+1-(s+1))].focus()};return"days"===this._view&&this._modifyCalendarDate(0,e.key===bt||e.key===vt?1:-1,t.bind(this,e.key)),"months"===this._view&&this._modifyCalendarDate(e.key===bt||e.key===vt?1:-1,0,t.bind(this,e.key)),void("years"===this._view&&this._modifyCalendarDate(e.key===bt||e.key===vt?10:-10,0,t.bind(this,e.key)))}if(0===n[s+l[e.key]].tabIndex)return void n[s+l[e.key]].focus();for(let t=s;t<n.length;e.key===bt||e.key===vt?t++:t--)if(0===n[t+l[e.key]].tabIndex){n[t+l[e.key]].focus();break}}}_handleCalendarMouseEnter(e){const t=e.target.classList.contains(Pt)?e.target.parentElement:e.target,i=this._getDate(t);st(i,this._minDate,this._maxDate,this._config.disabledDates)||(this._hoverDate=ut(i,this._selectEndDate?this._endDate:this._startDate),H.trigger(this._element,kt,{date:it(this._hoverDate,this._config.selectionType)}),this._updateClassNamesAndAriaLabels())}_handleCalendarMouseLeave(){this._hoverDate=null,H.trigger(this._element,kt,{date:null}),this._updateClassNamesAndAriaLabels()}_addEventListeners(){H.on(this._element,xt,qt,e=>{this._handleCalendarClick(e)}),H.on(this._element,At,qt,e=>{this._handleCalendarKeydown(e)}),H.on(this._element,It,qt,e=>{this._handleCalendarMouseEnter(e)}),H.on(this._element,$t,qt,()=>{this._handleCalendarMouseLeave()}),H.on(this._element,Tt,qt,e=>{this._handleCalendarMouseEnter(e)}),H.on(this._element,wt,qt,()=>{this._handleCalendarMouseLeave()}),H.on(this._element,xt,Yt,e=>{this._handleCalendarClick(e)}),H.on(this._element,At,Yt,e=>{this._handleCalendarKeydown(e)}),H.on(this._element,It,Yt,e=>{this._handleCalendarMouseEnter(e)}),H.on(this._element,$t,Yt,()=>{this._handleCalendarMouseLeave()}),H.on(this._element,Tt,Yt,e=>{this._handleCalendarMouseEnter(e)}),H.on(this._element,wt,Yt,()=>{this._handleCalendarMouseLeave()}),this._addNavigationEventListeners(),H.on(this._element,$t,"table",()=>{H.trigger(this._element,Et)})}_addNavigationEventListeners(){const e={[zt]:()=>this._modifyCalendarDate(0,-1),[Ft]:()=>this._modifyCalendarDate("years"===this._view?-10:-1),[jt]:()=>this._modifyCalendarDate(0,1),[Bt]:()=>this._modifyCalendarDate("years"===this._view?10:1),[Ht]:()=>{this._view="months",this._updateCalendar()},[Vt]:()=>{this._view="years",this._updateCalendar()}};for(const[t,i]of Object.entries(e))H.on(this._element,xt,t,e=>{e.preventDefault();const n=U.find(t,this._element).indexOf(e.target.closest(t));i();const s=U.find(t,this._element);s&&s[n]&&s[n].focus()})}_setCalendarDate(e){this._calendarDate=e,H.trigger(this._element,Dt,{date:e})}_modifyCalendarDate(e,t=0,i){const n=this._calendarDate.getFullYear(),s=this._calendarDate.getMonth(),a=new Date(n,s,1);e&&a.setFullYear(a.getFullYear()+e),t&&a.setMonth(a.getMonth()+t),this._calendarDate=a,"days"===this._view&&H.trigger(this._element,Dt,{date:a}),this._updateCalendar(i)}_setEndDate(e){this._endDate=ut(e,this._endDate),H.trigger(this._element,Lt,{date:it(this._endDate,this._config.selectionType)})}_setStartDate(e){this._startDate=ut(e,this._startDate),H.trigger(this._element,St,{date:it(this._startDate,this._config.selectionType)})}_setSelectEndDate(e){this._selectEndDate=e,H.trigger(this._element,Ct,{value:e})}_selectDate(e){if(!st(e,this._minDate,this._maxDate,this._config.disabledDates))return this._config.range?this._selectEndDate?(this._setSelectEndDate(!1),this._startDate&&this._startDate>e||rt(this._startDate,e,this._config.disabledDates)?(this._setStartDate(null),void this._setEndDate(null)):void this._setEndDate(e)):this._endDate&&this._endDate<e||rt(e,this._endDate,this._config.disabledDates)?(this._setStartDate(null),void this._setEndDate(null)):(this._setSelectEndDate(!0),void this._setStartDate(e)):void this._setStartDate(e)}_createCalendarPanel(e){var t;const i=((e,t,i)=>0!==t&&"days"===i?new Date(e.getFullYear(),e.getMonth()+t,1):0!==t&&"months"===i?new Date(e.getFullYear()+t,e.getMonth(),1):0!==t&&"years"===i?new Date(e.getFullYear()+12*t,e.getMonth(),1):e)(this._calendarDate,e,this._view),n=i.getFullYear(),s=i.getMonth(),a=document.createElement("div");a.classList.add("calendar"),R.setDataAttribute(a,"calendar-index",e);const o=document.createElement("div");o.classList.add("calendar-nav"),o.innerHTML=`\n <div class="calendar-nav-prev">\n <button type="button" class="calendar-nav-btn btn-double-prev" aria-label="${this._config.ariaNavPrevYearLabel}">\n <span class="calendar-nav-icon calendar-nav-icon-double-prev"></span>\n </button>\n ${"days"===this._view?`<button type="button" class="calendar-nav-btn btn-prev" aria-label="${this._config.ariaNavPrevMonthLabel}">\n <span class="calendar-nav-icon calendar-nav-icon-prev"></span>\n </button>`:""}\n </div>\n <div class="calendar-nav-date" aria-live="polite">\n ${"days"===this._view?`<button type="button" class="calendar-nav-btn btn-sm btn-month">\n ${i.toLocaleDateString(this._config.locale,{month:"long"})}\n </button>`:""}\n <button type="button" class="calendar-nav-btn btn-year">\n ${i.toLocaleDateString(this._config.locale,{year:"numeric"})}\n </button>\n </div>\n <div class="calendar-nav-next">\n ${"days"===this._view?`<button type="button" class="calendar-nav-btn btn-next" aria-label="${this._config.ariaNavNextMonthLabel}">\n <span class="calendar-nav-icon calendar-nav-icon-next"></span>\n </button>`:""}\n <button type="button" class="calendar-nav-btn btn-double-next" aria-label="${this._config.ariaNavNextYearLabel}">\n <span class="calendar-nav-icon calendar-nav-icon-double-next"></span>\n </button>\n </div>\n `;const r=((e,t,i)=>{const n=((e,t,i)=>{const n=[],s=new Date(e,t),a=s.getFullYear(),o=s.getMonth();let r=6-(6-new Date(a,o,1).getDay())-i;i&&(r=r<0?7+r:r);for(let e=-1*r;e<0;e++)n.push({date:new Date(a,o,e+1),month:"previous"});return n})(e,t,i),s=((e,t)=>{const i=[],n=new Date(e,t+1,0).getDate();for(let s=1;s<=n;s++)i.push({date:new Date(e,t,s),month:"current"});return i})(e,t),a=((e,t,i,n)=>{const s=[],a=42-(i.length+n.length);for(let i=1;i<=a;i++)s.push({date:new Date(e,t+1,i),month:"next"});return s})(e,t,n,s),o=[...n,...s,...a],r=[];for(const[e,t]of o.entries()){if(e%7!=0&&0!==r.length||r.push({week:{number:0,year:0},days:[]}),(e+1)%7==0){const{weekNumber:e,year:i}=nt(t.date),n=r.at(-1);n&&(n.week={number:e,year:i})}const i=r.at(-1);i&&i.days.push(t)}return r})(n,s,this._config.firstDayOfWeek),l=tt(((e,t="short")=>Array.from({length:12},(i,n)=>new Date(2e3,n,1).toLocaleString(e,{month:t})))(this._config.locale),4),c=tt(((e,t=6)=>Array.from({length:2*t},(i,n)=>e-t+n))(i.getFullYear()),4),h=r[0].days,d=document.createElement("table");return d.innerHTML=`\n ${"days"===this._view?`\n <thead>\n <tr>\n ${this._config.showWeekNumber?`<th class="${Nt}">\n <div class="calendar-header-cell-inner">\n ${null!=(t=this._config.weekNumbersLabel)?t:""}\n </div>\n </th>`:""}\n ${h.map(({date:e})=>`<th class="${Nt}" abbr="${e.toLocaleDateString(this._config.locale,{weekday:"long"})}">\n <div class="calendar-header-cell-inner">\n ${"string"==typeof this._config.weekdayFormat?e.toLocaleDateString(this._config.locale,{weekday:this._config.weekdayFormat}):e.toLocaleDateString(this._config.locale,{weekday:"long"}).slice(0,this._config.weekdayFormat)}\n </div>\n </th>`).join("")}\n </tr>\n </thead>`:""}\n <tbody>\n ${"days"===this._view?r.map(({week:e,days:t})=>{const{date:i}=t[0],n=this._rowWeekAttributes(i);return`<tr \n class="${n.className}"\n tabindex="${n.tabIndex}"\n ${n.ariaSelected?'aria-selected="true"':""}\n >\n ${this._config.showWeekNumber?`<th class="calendar-cell-week-number">${e.number}</td>`:""}\n ${t.map(({date:e,month:t})=>{const i=this._cellDayAttributes(e,t);return"current"===t||this._config.showAdjacementDays?`<td \n class="${i.className}"\n tabindex="${i.tabIndex}"\n ${i.ariaSelected?'aria-selected="true"':""}\n data-bs-date="${e}"\n >\n <div class="calendar-cell-inner day">\n ${e.toLocaleDateString(this._config.locale,{day:"numeric"})}\n </div>\n </td>`:"<td></td>"}).join("")}</tr>`}).join(""):""}\n ${"months"===this._view?l.map((e,t)=>`<tr>\n ${e.map((e,n)=>{const s=new Date(i.getFullYear(),3*t+n,1),a=this._cellMonthAttributes(s);return`<td\n class="${a.className}"\n tabindex="${a.tabIndex}"\n ${a.ariaSelected?'aria-selected="true"':""}\n data-bs-date="${s.toDateString()}"\n >\n <div class="calendar-cell-inner month">\n ${e}\n </div>\n </td>`}).join("")}\n </tr>`).join(""):""}\n ${"years"===this._view?c.map(e=>`<tr>\n ${e.map(e=>{const t=new Date(e,0,1),i=this._cellYearAttributes(t);return`<td\n class="${i.className}"\n tabindex="${i.tabIndex}"\n ${i.ariaSelected?'aria-selected="true"':""}\n data-bs-date="${t.toDateString()}"\n >\n <div class="calendar-cell-inner year">\n ${e}\n </div>\n </td>`}).join("")}\n </tr>`).join(""):""}\n </tbody>\n `,a.append(o,d),a}_createCalendar(){this._config.selectionType&&"days"===this._view&&this._element.classList.add(`select-${this._config.selectionType}`),this._config.showWeekNumber&&this._element.classList.add("show-week-numbers");for(const[e,t]of Array.from({length:this._config.calendars}).entries())this._element.append(this._createCalendarPanel(e));this._element.classList.add("calendars")}_initializeDates(){this._calendarDate=et(this._config.calendarDate||this._config.startDate||this._config.endDate,this._config.selectionType)||new Date,this._startDate=et(this._config.startDate,this._config.selectionType),this._endDate=et(this._config.endDate,this._config.selectionType),this._minDate=et(this._config.minDate,this._config.selectionType),this._maxDate=et(this._config.maxDate,this._config.selectionType),this._hoverDate=null,this._selectEndDate=this._config.selectEndDate}_initializeView(){this._view={day:"days",week:"days",month:"months",year:"years"}[this._config.selectionType]||"days"}_updateCalendar(e){this._element.innerHTML="",this._createCalendar(),e&&setTimeout(e,1)}_updateClassNamesAndAriaLabels(){if("week"===this._config.selectionType){const e=U.find(Wt,this._element);for(const t of e){const e=U.findOne(Rt,t),i=new Date(R.getDataAttribute(e,"date")),n=this._rowWeekAttributes(i);t.className=n.className,t.tabIndex=n.tabIndex,n.ariaSelected?t.setAttribute("aria-selected",!0):t.removeAttribute("aria-selected")}return}const e=U.find(qt,this._element);for(const t of e){const e=new Date(R.getDataAttribute(t,"date"));let i;i="days"===this._view?this._cellDayAttributes(e,"current"):"months"===this._view?this._cellMonthAttributes(e):this._cellYearAttributes(e),t.className=i.className,t.tabIndex=i.tabIndex,i.ariaSelected?t.setAttribute("aria-selected",!0):t.removeAttribute("aria-selected")}}_classNames(e){return Object.entries(e).filter(([e,t])=>Boolean(t)).map(([e])=>e).join(" ")}_cellDayAttributes(e,t){const i="current"===t,n=st(e,this._minDate,this._maxDate,this._config.disabledDates),s=o