vrembem 4.0.0-next.8 → 4.0.0-next.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dev/index.css +3673 -2154
- package/dev/index.css.map +1 -1
- package/dev/index.js +458 -490
- package/dev/index.js.map +1 -1
- package/dev/index.umd.cjs +408 -440
- package/dev/index.umd.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +953 -989
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +3 -3
- package/dist/index.umd.cjs.map +1 -1
- package/index.scss +2 -3
- package/package.json +22 -23
package/dist/index.umd.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
(function(K,at){typeof exports=="object"&&typeof module<"u"?at(exports):typeof define=="function"&&define.amd?define(["exports"],at):(K=typeof globalThis<"u"?globalThis:K||self,at(K.vrembem={}))})(this,function(K){"use strict";var at=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},D=(e,t,n)=>(at(e,t,"read from private field"),n?n.call(e):t.get(e)),Nt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Y=(e,t,n,i)=>(at(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),B;let On=class{constructor(t,n){Nt(this,B,void 0),this.value=t,Y(this,B,n),this.mql=null}get handler(){return D(this,B)}set handler(t){this.mql&&this.mql.removeEventListener("change",D(this,B)),Y(this,B,t)}mount(t,n){return t&&(this.value=t),n&&Y(this,B,n),this.value?(this.mql=window.matchMedia(`(min-width: ${this.value})`),this.mql.addEventListener("change",D(this,B)),D(this,B).call(this,this.mql),this):this}unmount(){return this.mql?(this.mql.removeEventListener("change",D(this,B)),this.value=null,Y(this,B,null),this.mql=null,this):this}};B=new WeakMap;let Ln=class{constructor(){this.collection=[]}async register(t){return await this.deregister(t),this.collection.push(t),this.collection}async deregister(t){const n=this.collection.findIndex(i=>i===t);if(n>=0){const i=this.collection[n];Object.getOwnPropertyNames(i).forEach(r=>{delete i[r]}),this.collection.splice(n,1)}return this.collection}async registerCollection(t){return await Promise.all(Array.from(t,n=>{this.register(n)})),this.collection}async deregisterCollection(){for(;this.collection.length>0;)await this.deregister(this.collection[0]);return this.collection}get(t,n="id"){return this.collection.find(i=>i[n]===t)}};const f={inert:":not([inert]):not([inert] *)",negTabIndex:':not([tabindex^="-"])',disabled:":not(:disabled)"},kn=[`a[href]${f.inert}${f.negTabIndex}`,`area[href]${f.inert}${f.negTabIndex}`,`input:not([type="hidden"]):not([type="radio"])${f.inert}${f.negTabIndex}${f.disabled}`,`input[type="radio"]${f.inert}${f.negTabIndex}${f.disabled}`,`select${f.inert}${f.negTabIndex}${f.disabled}`,`textarea${f.inert}${f.negTabIndex}${f.disabled}`,`button${f.inert}${f.negTabIndex}${f.disabled}`,`details${f.inert} > summary:first-of-type${f.negTabIndex}`,`iframe${f.inert}${f.negTabIndex}`,`audio[controls]${f.inert}${f.negTabIndex}`,`video[controls]${f.inert}${f.negTabIndex}`,`[contenteditable]${f.inert}${f.negTabIndex}`,`[tabindex]${f.inert}${f.negTabIndex}`];var wt,lt,ct;let Tn=class{constructor(t=null,n="[data-focus]"){Nt(this,wt,void 0),Nt(this,lt,void 0),Nt(this,ct,void 0),this.el=t,this.selectorFocus=n,Y(this,lt,Sn.bind(this)),Y(this,ct,Cn.bind(this))}get focusable(){return D(this,wt)}set focusable(t){Y(this,wt,t),D(this,wt).length?(document.removeEventListener("keydown",D(this,ct)),document.addEventListener("keydown",D(this,lt))):(document.removeEventListener("keydown",D(this,lt)),document.addEventListener("keydown",D(this,ct)))}get focusableFirst(){return this.focusable[0]}get focusableLast(){return this.focusable[this.focusable.length-1]}mount(t,n){t&&(this.el=t),n&&(this.selectorFocus=n),this.focusable=this.getFocusable(),this.focus()}unmount(){this.el=null,this.focusable=[],document.removeEventListener("keydown",D(this,lt)),document.removeEventListener("keydown",D(this,ct))}focus(t=this.el,n=this.selectorFocus){(t.querySelector(n)||t).focus()}getFocusable(t=this.el){const n=[],i=document.activeElement,r=t.scrollTop;return t.querySelectorAll(kn.join(",")).forEach(s=>{s.focus(),document.activeElement===s&&n.push(s)}),t.scrollTop=r,i.focus(),n}};wt=new WeakMap,lt=new WeakMap,ct=new WeakMap;function Sn(e){(e.key==="Tab"||e.keyCode===9)&&(e.shiftKey?(document.activeElement===this.focusableFirst||document.activeElement===this.el)&&(e.preventDefault(),this.focusableLast.focus()):(document.activeElement===this.focusableLast||document.activeElement===this.el)&&(e.preventDefault(),this.focusableFirst.focus()))}function Cn(e){(e.key==="Tab"||e.keyCode===9)&&e.preventDefault()}function Oe(){return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim()}function Le(e,t=document.body){if(e.slice(0,2)!=="--"){const i=Oe();i&&(e=`${i}${e}`),e=`--${e}`}const n=getComputedStyle(t).getPropertyValue(e).trim();if(n)return n;throw new Error(`CSS variable "${e}" was not found!`)}function An(e,t){const n=(e.getAttribute(`data-${t}`)||"").replace(/'/g,'"');return n?JSON.parse(n):{}}function In(e,t=!0){const n=localStorage.getItem(e),i=n?JSON.parse(n):{};return{get(r){return r?i[r]:i},set(r,s){return s?i[r]=s:delete i[r],t&&localStorage.setItem(e,JSON.stringify(i)),i}}}function Pn(e,t,n){const i=t.nodeType===Node.COMMENT_NODE,r=t.nodeType===Node.ELEMENT_NODE;if(t=i||r?t:document.querySelector(t),i&&(n="after"),!t)throw new Error(`Not a valid teleport reference: '${t}'`);if(typeof t[n]!="function")throw new Error(`Not a valid teleport method: '${n}'`);let s=null;return i||(s=document.createComment("teleported #"+e.id),e.before(s)),t[n](e),i&&t.remove(),s}function Mn(e,t,n,i="transition-duration"){return new Promise(r=>{if(typeof i=="string"){const s=Le(i,e),a=!!s.includes("ms");i=parseFloat(s)*(a?1:1e3)}e.classList.remove(t.finish),e.classList.add(n.start),setTimeout(()=>{e.classList.add(n.finish),e.classList.remove(n.start),r(e)},i)})}function Dn(e,t){t&&document.querySelectorAll(t).forEach(n=>{e?n.style.overflow="hidden":n.style.removeProperty("overflow")})}function jn(e,t){t&&document.querySelectorAll(t).forEach(n=>{e?(n.inert=!0,n.setAttribute("aria-hidden",!0)):(n.inert=null,n.removeAttribute("aria-hidden"))})}function qn(e,t){jn(!!e,t.selectorInert),Dn(!!e,t.selectorOverflow)}const Fn=Object.freeze(Object.defineProperty({__proto__:null,Breakpoint:On,Collection:Ln,FocusTrap:Tn,cssVar:Le,getConfig:An,getPrefix:Oe,localStore:In,teleport:Pn,transition:Mn,updateGlobalState:qn},Symbol.toStringTag,{value:"Module"}));var ke=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Wt=(e,t,n)=>(ke(e,t,"read from private field"),n?n.call(e):t.get(e)),Te=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Se=(e,t,n,i)=>(ke(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),Ce=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},j=(e,t,n)=>(Ce(e,t,"read from private field"),n?n.call(e):t.get(e)),_t=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},U=(e,t,n,i)=>(Ce(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),V;let Nn=class{constructor(t,n){_t(this,V,void 0),this.value=t,U(this,V,n),this.mql=null}get handler(){return j(this,V)}set handler(t){this.mql&&this.mql.removeEventListener("change",j(this,V)),U(this,V,t)}mount(t,n){return t&&(this.value=t),n&&U(this,V,n),this.value?(this.mql=window.matchMedia(`(min-width: ${this.value})`),this.mql.addEventListener("change",j(this,V)),j(this,V).call(this,this.mql),this):this}unmount(){return this.mql?(this.mql.removeEventListener("change",j(this,V)),this.value=null,U(this,V,null),this.mql=null,this):this}};V=new WeakMap;let Wn=class{constructor(){this.collection=[]}async register(t){return await this.deregister(t),this.collection.push(t),this.collection}async deregister(t){const n=this.collection.findIndex(i=>i===t);if(n>=0){const i=this.collection[n];Object.getOwnPropertyNames(i).forEach(r=>{delete i[r]}),this.collection.splice(n,1)}return this.collection}async registerCollection(t){return await Promise.all(Array.from(t,n=>{this.register(n)})),this.collection}async deregisterCollection(){for(;this.collection.length>0;)await this.deregister(this.collection[0]);return this.collection}get(t,n="id"){return this.collection.find(i=>i[n]===t)}};const p={inert:":not([inert]):not([inert] *)",negTabIndex:':not([tabindex^="-"])',disabled:":not(:disabled)"},_n=[`a[href]${p.inert}${p.negTabIndex}`,`area[href]${p.inert}${p.negTabIndex}`,`input:not([type="hidden"]):not([type="radio"])${p.inert}${p.negTabIndex}${p.disabled}`,`input[type="radio"]${p.inert}${p.negTabIndex}${p.disabled}`,`select${p.inert}${p.negTabIndex}${p.disabled}`,`textarea${p.inert}${p.negTabIndex}${p.disabled}`,`button${p.inert}${p.negTabIndex}${p.disabled}`,`details${p.inert} > summary:first-of-type${p.negTabIndex}`,`iframe${p.inert}${p.negTabIndex}`,`audio[controls]${p.inert}${p.negTabIndex}`,`video[controls]${p.inert}${p.negTabIndex}`,`[contenteditable]${p.inert}${p.negTabIndex}`,`[tabindex]${p.inert}${p.negTabIndex}`];var $t,dt,ut;let Bn=class{constructor(t=null,n="[data-focus]"){_t(this,$t,void 0),_t(this,dt,void 0),_t(this,ut,void 0),this.el=t,this.selectorFocus=n,U(this,dt,Vn.bind(this)),U(this,ut,Rn.bind(this))}get focusable(){return j(this,$t)}set focusable(t){U(this,$t,t),j(this,$t).length?(document.removeEventListener("keydown",j(this,ut)),document.addEventListener("keydown",j(this,dt))):(document.removeEventListener("keydown",j(this,dt)),document.addEventListener("keydown",j(this,ut)))}get focusableFirst(){return this.focusable[0]}get focusableLast(){return this.focusable[this.focusable.length-1]}mount(t,n){t&&(this.el=t),n&&(this.selectorFocus=n),this.focusable=this.getFocusable(),this.focus()}unmount(){this.el=null,this.focusable=[],document.removeEventListener("keydown",j(this,dt)),document.removeEventListener("keydown",j(this,ut))}focus(t=this.el,n=this.selectorFocus){(t.querySelector(n)||t).focus()}getFocusable(t=this.el){const n=[],i=document.activeElement,r=t.scrollTop;return t.querySelectorAll(_n.join(",")).forEach(s=>{s.focus(),document.activeElement===s&&n.push(s)}),t.scrollTop=r,i.focus(),n}};$t=new WeakMap,dt=new WeakMap,ut=new WeakMap;function Vn(e){(e.key==="Tab"||e.keyCode===9)&&(e.shiftKey?(document.activeElement===this.focusableFirst||document.activeElement===this.el)&&(e.preventDefault(),this.focusableLast.focus()):(document.activeElement===this.focusableLast||document.activeElement===this.el)&&(e.preventDefault(),this.focusableFirst.focus()))}function Rn(e){(e.key==="Tab"||e.keyCode===9)&&e.preventDefault()}function Ae(){return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim()}function Hn(e,t=document.body){if(e.slice(0,2)!=="--"){const i=Ae();i&&(e=`${i}${e}`),e=`--${e}`}const n=getComputedStyle(t).getPropertyValue(e).trim();if(n)return n;throw new Error(`CSS variable "${e}" was not found!`)}function Jn(e,t){const n=(e.getAttribute(`data-${t}`)||"").replace(/'/g,'"');return n?JSON.parse(n):{}}function zn(e,t=!0){const n=localStorage.getItem(e),i=n?JSON.parse(n):{};return{get(r){return r?i[r]:i},set(r,s){return s?i[r]=s:delete i[r],t&&localStorage.setItem(e,JSON.stringify(i)),i}}}function Ie(e,t,n,i="transition-duration"){return new Promise(r=>{if(typeof i=="string"){const s=Hn(i,e),a=!!s.includes("ms");i=parseFloat(s)*(a?1:1e3)}e.classList.remove(t.finish),e.classList.add(n.start),setTimeout(()=>{e.classList.add(n.finish),e.classList.remove(n.start),r(e)},i)})}function Kn(e,t){t&&document.querySelectorAll(t).forEach(n=>{e?n.style.overflow="hidden":n.style.removeProperty("overflow")})}function Gn(e,t){t&&document.querySelectorAll(t).forEach(n=>{e?(n.inert=!0,n.setAttribute("aria-hidden",!0)):(n.inert=null,n.removeAttribute("aria-hidden"))})}function Ut(e,t){Gn(!!e,t.selectorInert),Kn(!!e,t.selectorOverflow)}const Qn={autoMount:!1,dataOpen:"drawer-open",dataClose:"drawer-close",dataToggle:"drawer-toggle",dataBreakpoint:"drawer-breakpoint",dataConfig:"drawer-config",selectorDrawer:".drawer",selectorDialog:".drawer__dialog",selectorScreen:".drawer",selectorFocus:"[data-focus]",selectorInert:null,selectorOverflow:"body",stateOpened:"is-opened",stateOpening:"is-opening",stateClosing:"is-closing",stateClosed:"is-closed",classModal:"drawer_modal",breakpoints:null,customEventPrefix:"drawer:",eventListeners:!0,store:!0,storeKey:"VB:DrawerState",setTabindex:!0,transition:!0,transitionDuration:"drawer-transition-duration"};function Zn(e){e.store==="opened"?e.open(!1,!1):e.store==="closed"?e.close(!1,!1):e.store==="indeterminate"?e.state="indeterminate":e.el.classList.contains(e.getSetting("stateOpened"))?e.open(!1,!1):e.el.classList.contains(e.getSetting("stateClosed"))?e.close(!1,!1):e.state="indeterminate"}async function Xn(e){e.store==="opened"?await e.open(!1,!1):e.store==="closed"?await e.close(!1,!1):e.store==="indeterminate"?e.state!="indeterminate"&&(e.state="indeterminate"):(e.state!=e.inlineState&&(e.state=e.inlineState),e.inlineState==="opened"?await e.open(!1,!1):e.inlineState==="closed"&&await e.close(!1,!1))}function Yn(e){const t=Ae(),n=e.getAttribute(`data-${this.settings.dataBreakpoint}`);return this.settings.breakpoints&&this.settings.breakpoints[n]?this.settings.breakpoints[n]:getComputedStyle(document.body).getPropertyValue(`--${t}breakpoint-${n}`).trim()?getComputedStyle(document.body).getPropertyValue(`--${t}breakpoint-${n}`).trim():n}function ht(e){const t=typeof e=="string"?this.get(e):this.get(e.id);if(t)return t;throw new Error(`Drawer not found in collection with id of "${e.id||e}".`)}function Pe(e){e.state==="opened"?e.mode==="modal"?this.focusTrap.mount(e.dialog,this.settings.selectorFocus):this.focusTrap.focus(e.dialog,this.settings.selectorFocus):(e.trigger&&(e.trigger.focus(),e.trigger=null),this.focusTrap.unmount())}async function Un(e){const t=e.target.closest(`
|
|
1
|
+
(function(K,at){typeof exports=="object"&&typeof module<"u"?at(exports):typeof define=="function"&&define.amd?define(["exports"],at):(K=typeof globalThis<"u"?globalThis:K||self,at(K.vrembem={}))})(this,function(K){"use strict";var at=t=>{throw TypeError(t)},Oe=(t,e,n)=>e.has(t)||at("Cannot "+n),D=(t,e,n)=>(Oe(t,e,"read from private field"),n?n.call(t):e.get(t)),Nt=(t,e,n)=>e.has(t)?at("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),X=(t,e,n,i)=>(Oe(t,e,"write to private field"),e.set(t,n),n),B;let An=class{constructor(e,n){Nt(this,B),this.value=e,X(this,B,n),this.mql=null}get handler(){return D(this,B)}set handler(e){this.mql&&this.mql.removeEventListener("change",D(this,B)),X(this,B,e)}mount(e,n){return e&&(this.value=e),n&&X(this,B,n),this.value?(this.mql=window.matchMedia(`(min-width: ${this.value})`),this.mql.addEventListener("change",D(this,B)),D(this,B).call(this,this.mql),this):this}unmount(){return this.mql?(this.mql.removeEventListener("change",D(this,B)),this.value=null,X(this,B,null),this.mql=null,this):this}};B=new WeakMap;let In=class{constructor(){this.collection=[]}async register(e){return await this.deregister(e),this.collection.push(e),this.collection}async deregister(e){const n=this.collection.findIndex(i=>i===e);if(n>=0){const i=this.collection[n];Object.getOwnPropertyNames(i).forEach(s=>{delete i[s]}),this.collection.splice(n,1)}return this.collection}async registerCollection(e){return await Promise.all(Array.from(e,n=>{this.register(n)})),this.collection}async deregisterCollection(){for(;this.collection.length>0;)await this.deregister(this.collection[0]);return this.collection}get(e,n="id"){return this.collection.find(i=>i[n]===e)}};const f={inert:":not([inert]):not([inert] *)",negTabIndex:':not([tabindex^="-"])',disabled:":not(:disabled)"},Mn=[`a[href]${f.inert}${f.negTabIndex}`,`area[href]${f.inert}${f.negTabIndex}`,`input:not([type="hidden"]):not([type="radio"])${f.inert}${f.negTabIndex}${f.disabled}`,`input[type="radio"]${f.inert}${f.negTabIndex}${f.disabled}`,`select${f.inert}${f.negTabIndex}${f.disabled}`,`textarea${f.inert}${f.negTabIndex}${f.disabled}`,`button${f.inert}${f.negTabIndex}${f.disabled}`,`details${f.inert} > summary:first-of-type${f.negTabIndex}`,`iframe${f.inert}${f.negTabIndex}`,`audio[controls]${f.inert}${f.negTabIndex}`,`video[controls]${f.inert}${f.negTabIndex}`,`[contenteditable]${f.inert}${f.negTabIndex}`,`[tabindex]${f.inert}${f.negTabIndex}`];var wt,lt,ct;let Pn=class{constructor(e=null,n="[data-focus]"){Nt(this,wt),Nt(this,lt),Nt(this,ct),this.el=e,this.selectorFocus=n,X(this,lt,Dn.bind(this)),X(this,ct,jn.bind(this))}get focusable(){return D(this,wt)}set focusable(e){X(this,wt,e),D(this,wt).length?(document.removeEventListener("keydown",D(this,ct)),document.addEventListener("keydown",D(this,lt))):(document.removeEventListener("keydown",D(this,lt)),document.addEventListener("keydown",D(this,ct)))}get focusableFirst(){return this.focusable[0]}get focusableLast(){return this.focusable[this.focusable.length-1]}mount(e,n){e&&(this.el=e),n&&(this.selectorFocus=n),this.focusable=this.getFocusable(),this.focus()}unmount(){this.el=null,this.focusable=[],document.removeEventListener("keydown",D(this,lt)),document.removeEventListener("keydown",D(this,ct))}focus(e=this.el,n=this.selectorFocus){(e.querySelector(n)||e).focus()}getFocusable(e=this.el){const n=[],i=document.activeElement,s=e.scrollTop;return e.querySelectorAll(Mn.join(",")).forEach(r=>{r.focus(),document.activeElement===r&&n.push(r)}),e.scrollTop=s,i.focus(),n}};wt=new WeakMap,lt=new WeakMap,ct=new WeakMap;function Dn(t){(t.key==="Tab"||t.keyCode===9)&&(t.shiftKey?(document.activeElement===this.focusableFirst||document.activeElement===this.el)&&(t.preventDefault(),this.focusableLast.focus()):(document.activeElement===this.focusableLast||document.activeElement===this.el)&&(t.preventDefault(),this.focusableFirst.focus()))}function jn(t){(t.key==="Tab"||t.keyCode===9)&&t.preventDefault()}function Le(){return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim()}function ke(t,e=document.body){if(t.slice(0,2)!=="--"){const i=Le();i&&(t=`${i}${t}`),t=`--${t}`}const n=getComputedStyle(e).getPropertyValue(t).trim();if(n)return n;throw new Error(`CSS variable "${t}" was not found!`)}function qn(t,e){const n=(t.getAttribute(`data-${e}`)||"").replace(/'/g,'"');return n?JSON.parse(n):{}}function Fn(t,e=!0){const n=localStorage.getItem(t),i=n?JSON.parse(n):{};return{get(s){return s?i[s]:i},set(s,r){return r?i[s]=r:delete i[s],e&&localStorage.setItem(t,JSON.stringify(i)),i}}}function Nn(t,e,n){const i=e.nodeType===Node.COMMENT_NODE,s=e.nodeType===Node.ELEMENT_NODE;if(e=i||s?e:document.querySelector(e),i&&(n="after"),!e)throw new Error(`Not a valid teleport reference: '${e}'`);if(typeof e[n]!="function")throw new Error(`Not a valid teleport method: '${n}'`);let r=null;return i||(r=document.createComment("teleported #"+t.id),t.before(r)),e[n](t),i&&e.remove(),r}function Wn(t,e,n,i="transition-duration"){return new Promise(s=>{if(typeof i=="string"){const r=ke(i,t),a=!!r.includes("ms");i=parseFloat(r)*(a?1:1e3)}t.classList.remove(e.finish),t.classList.add(n.start),setTimeout(()=>{t.classList.add(n.finish),t.classList.remove(n.start),s(t)},i)})}function _n(t,e){e&&document.querySelectorAll(e).forEach(n=>{t?n.style.overflow="hidden":n.style.removeProperty("overflow")})}function Bn(t,e){e&&document.querySelectorAll(e).forEach(n=>{t?(n.inert=!0,n.setAttribute("aria-hidden",!0)):(n.inert=null,n.removeAttribute("aria-hidden"))})}function Vn(t,e){Bn(!!t,e.selectorInert),_n(!!t,e.selectorOverflow)}const Rn=Object.freeze(Object.defineProperty({__proto__:null,Breakpoint:An,Collection:In,FocusTrap:Pn,cssVar:ke,getConfig:qn,getPrefix:Le,localStore:Fn,teleport:Nn,transition:Wn,updateGlobalState:Vn},Symbol.toStringTag,{value:"Module"}));var Te=t=>{throw TypeError(t)},Se=(t,e,n)=>e.has(t)||Te("Cannot "+n),Wt=(t,e,n)=>(Se(t,e,"read from private field"),n?n.call(t):e.get(t)),Ce=(t,e,n)=>e.has(t)?Te("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Ae=(t,e,n,i)=>(Se(t,e,"write to private field"),e.set(t,n),n),Ie=t=>{throw TypeError(t)},Me=(t,e,n)=>e.has(t)||Ie("Cannot "+n),j=(t,e,n)=>(Me(t,e,"read from private field"),n?n.call(t):e.get(t)),_t=(t,e,n)=>e.has(t)?Ie("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),U=(t,e,n,i)=>(Me(t,e,"write to private field"),e.set(t,n),n),V;let Hn=class{constructor(e,n){_t(this,V),this.value=e,U(this,V,n),this.mql=null}get handler(){return j(this,V)}set handler(e){this.mql&&this.mql.removeEventListener("change",j(this,V)),U(this,V,e)}mount(e,n){return e&&(this.value=e),n&&U(this,V,n),this.value?(this.mql=window.matchMedia(`(min-width: ${this.value})`),this.mql.addEventListener("change",j(this,V)),j(this,V).call(this,this.mql),this):this}unmount(){return this.mql?(this.mql.removeEventListener("change",j(this,V)),this.value=null,U(this,V,null),this.mql=null,this):this}};V=new WeakMap;let Jn=class{constructor(){this.collection=[]}async register(e){return await this.deregister(e),this.collection.push(e),this.collection}async deregister(e){const n=this.collection.findIndex(i=>i===e);if(n>=0){const i=this.collection[n];Object.getOwnPropertyNames(i).forEach(s=>{delete i[s]}),this.collection.splice(n,1)}return this.collection}async registerCollection(e){return await Promise.all(Array.from(e,n=>{this.register(n)})),this.collection}async deregisterCollection(){for(;this.collection.length>0;)await this.deregister(this.collection[0]);return this.collection}get(e,n="id"){return this.collection.find(i=>i[n]===e)}};const p={inert:":not([inert]):not([inert] *)",negTabIndex:':not([tabindex^="-"])',disabled:":not(:disabled)"},zn=[`a[href]${p.inert}${p.negTabIndex}`,`area[href]${p.inert}${p.negTabIndex}`,`input:not([type="hidden"]):not([type="radio"])${p.inert}${p.negTabIndex}${p.disabled}`,`input[type="radio"]${p.inert}${p.negTabIndex}${p.disabled}`,`select${p.inert}${p.negTabIndex}${p.disabled}`,`textarea${p.inert}${p.negTabIndex}${p.disabled}`,`button${p.inert}${p.negTabIndex}${p.disabled}`,`details${p.inert} > summary:first-of-type${p.negTabIndex}`,`iframe${p.inert}${p.negTabIndex}`,`audio[controls]${p.inert}${p.negTabIndex}`,`video[controls]${p.inert}${p.negTabIndex}`,`[contenteditable]${p.inert}${p.negTabIndex}`,`[tabindex]${p.inert}${p.negTabIndex}`];var $t,dt,ut;let Kn=class{constructor(e=null,n="[data-focus]"){_t(this,$t),_t(this,dt),_t(this,ut),this.el=e,this.selectorFocus=n,U(this,dt,Gn.bind(this)),U(this,ut,Qn.bind(this))}get focusable(){return j(this,$t)}set focusable(e){U(this,$t,e),j(this,$t).length?(document.removeEventListener("keydown",j(this,ut)),document.addEventListener("keydown",j(this,dt))):(document.removeEventListener("keydown",j(this,dt)),document.addEventListener("keydown",j(this,ut)))}get focusableFirst(){return this.focusable[0]}get focusableLast(){return this.focusable[this.focusable.length-1]}mount(e,n){e&&(this.el=e),n&&(this.selectorFocus=n),this.focusable=this.getFocusable(),this.focus()}unmount(){this.el=null,this.focusable=[],document.removeEventListener("keydown",j(this,dt)),document.removeEventListener("keydown",j(this,ut))}focus(e=this.el,n=this.selectorFocus){(e.querySelector(n)||e).focus()}getFocusable(e=this.el){const n=[],i=document.activeElement,s=e.scrollTop;return e.querySelectorAll(zn.join(",")).forEach(r=>{r.focus(),document.activeElement===r&&n.push(r)}),e.scrollTop=s,i.focus(),n}};$t=new WeakMap,dt=new WeakMap,ut=new WeakMap;function Gn(t){(t.key==="Tab"||t.keyCode===9)&&(t.shiftKey?(document.activeElement===this.focusableFirst||document.activeElement===this.el)&&(t.preventDefault(),this.focusableLast.focus()):(document.activeElement===this.focusableLast||document.activeElement===this.el)&&(t.preventDefault(),this.focusableFirst.focus()))}function Qn(t){(t.key==="Tab"||t.keyCode===9)&&t.preventDefault()}function Pe(){return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim()}function Zn(t,e=document.body){if(t.slice(0,2)!=="--"){const i=Pe();i&&(t=`${i}${t}`),t=`--${t}`}const n=getComputedStyle(e).getPropertyValue(t).trim();if(n)return n;throw new Error(`CSS variable "${t}" was not found!`)}function Yn(t,e){const n=(t.getAttribute(`data-${e}`)||"").replace(/'/g,'"');return n?JSON.parse(n):{}}function Xn(t,e=!0){const n=localStorage.getItem(t),i=n?JSON.parse(n):{};return{get(s){return s?i[s]:i},set(s,r){return r?i[s]=r:delete i[s],e&&localStorage.setItem(t,JSON.stringify(i)),i}}}function De(t,e,n,i="transition-duration"){return new Promise(s=>{if(typeof i=="string"){const r=Zn(i,t),a=!!r.includes("ms");i=parseFloat(r)*(a?1:1e3)}t.classList.remove(e.finish),t.classList.add(n.start),setTimeout(()=>{t.classList.add(n.finish),t.classList.remove(n.start),s(t)},i)})}function Un(t,e){e&&document.querySelectorAll(e).forEach(n=>{t?n.style.overflow="hidden":n.style.removeProperty("overflow")})}function ti(t,e){e&&document.querySelectorAll(e).forEach(n=>{t?(n.inert=!0,n.setAttribute("aria-hidden",!0)):(n.inert=null,n.removeAttribute("aria-hidden"))})}function Ut(t,e){ti(!!t,e.selectorInert),Un(!!t,e.selectorOverflow)}const ei={autoMount:!1,dataOpen:"drawer-open",dataClose:"drawer-close",dataToggle:"drawer-toggle",dataBreakpoint:"drawer-breakpoint",dataConfig:"drawer-config",selectorDrawer:".drawer",selectorDialog:".drawer__dialog",selectorScreen:".drawer",selectorFocus:"[data-focus]",selectorInert:null,selectorOverflow:"body",stateOpened:"is-opened",stateOpening:"is-opening",stateClosing:"is-closing",stateClosed:"is-closed",classModal:"drawer_modal",breakpoints:null,customEventPrefix:"drawer:",eventListeners:!0,store:!0,storeKey:"VB:DrawerState",setTabindex:!0,transition:!0,transitionDuration:"drawer-transition-duration"};function ni(t){t.store==="opened"?t.open(!1,!1):t.store==="closed"?t.close(!1,!1):t.store==="indeterminate"?t.state="indeterminate":t.el.classList.contains(t.getSetting("stateOpened"))?t.open(!1,!1):t.el.classList.contains(t.getSetting("stateClosed"))?t.close(!1,!1):t.state="indeterminate"}async function ii(t){t.store==="opened"?await t.open(!1,!1):t.store==="closed"?await t.close(!1,!1):t.store==="indeterminate"?t.state!="indeterminate"&&(t.state="indeterminate"):(t.state!=t.inlineState&&(t.state=t.inlineState),t.inlineState==="opened"?await t.open(!1,!1):t.inlineState==="closed"&&await t.close(!1,!1))}function si(t){const e=Pe(),n=t.getAttribute(`data-${this.settings.dataBreakpoint}`);return this.settings.breakpoints&&this.settings.breakpoints[n]?this.settings.breakpoints[n]:getComputedStyle(document.body).getPropertyValue(`--${e}breakpoint-${n}`).trim()?getComputedStyle(document.body).getPropertyValue(`--${e}breakpoint-${n}`).trim():n}function ht(t){const e=typeof t=="string"?this.get(t):this.get(t.id);if(e)return e;throw new Error(`Drawer not found in collection with id of "${t.id||t}".`)}function je(t){t.state==="opened"?t.mode==="modal"?this.focusTrap.mount(t.dialog,this.settings.selectorFocus):this.focusTrap.focus(t.dialog,this.settings.selectorFocus):(t.trigger&&(t.trigger.focus(),t.trigger=null),this.focusTrap.unmount())}async function ri(t){const e=t.target.closest(`
|
|
2
2
|
[data-${this.settings.dataOpen}],
|
|
3
3
|
[data-${this.settings.dataToggle}],
|
|
4
4
|
[data-${this.settings.dataClose}]
|
|
5
|
-
`);if(t){e.preventDefault(),t.matches(`[data-${this.settings.dataToggle}]`)&&t.getAttribute(`data-${this.settings.dataToggle}`).trim().split(" ").forEach(n=>{const i=ht.call(this,n);return i.trigger=t,i.toggle()}),t.matches(`[data-${this.settings.dataOpen}]`)&&t.getAttribute(`data-${this.settings.dataOpen}`).trim().split(" ").forEach(n=>{const i=ht.call(this,n);return i.trigger=t,i.open()}),t.matches(`[data-${this.settings.dataClose}]`)&&t.getAttribute(`data-${this.settings.dataClose}`).trim().split(" ").forEach(n=>{if(n){const i=ht.call(this,n);return i.trigger=t,i.close()}else{const i=e.target.closest(this.settings.selectorDrawer);if(i)return this.close(i)}});return}if(this.activeModal&&e.target.matches(this.settings.selectorScreen))return this.close(this.activeModal.id)}function ti(e){if(e.key==="Escape"&&this.activeModal)return this.close(this.activeModal)}async function te(e,t=!0){const n=this.collection.findIndex(i=>i.id===e.id);if(n>=0){const i=this.collection[n];t&&i.state==="opened"&&await i.close(!1),this.store.set(i.id),i.unmountBreakpoint(),Object.getOwnPropertyNames(i).forEach(r=>{delete i[r]}),this.collection.splice(n,1)}return this.collection}async function ee(e,t,n=!0){const i=ht.call(this,e),r={...this.settings,...i.settings};return t!==void 0&&(r.transition=t),(i.state==="closed"||i.state==="indeterminate")&&(i.state="opening",r.transition?await Ie(i.el,{start:r.stateClosing,finish:r.stateClosed},{start:r.stateOpening,finish:r.stateOpened},r.transitionDuration):(i.el.classList.add(r.stateOpened),i.el.classList.remove(r.stateClosed)),i.state="opened",i.mode==="modal"&&Ut(!0,r),n&&Pe.call(this,i),i.el.dispatchEvent(new CustomEvent(r.customEventPrefix+"opened",{detail:this,bubbles:!0}))),i}async function Bt(e,t,n=!0){const i=ht.call(this,e),r={...this.settings,...i.settings};return t!==void 0&&(r.transition=t),(i.state==="opened"||i.state==="indeterminate")&&(i.state="closing",document.activeElement.blur(),r.transition?await Ie(i.el,{start:r.stateOpening,finish:r.stateOpened},{start:r.stateClosing,finish:r.stateClosed},r.transitionDuration):(i.el.classList.add(r.stateClosed),i.el.classList.remove(r.stateOpened)),i.state="closed",i.mode==="modal"&&Ut(!1,r),n&&Pe.call(this,i),i.el.dispatchEvent(new CustomEvent(r.customEventPrefix+"closed",{detail:this,bubbles:!0}))),i}async function Me(e,t,n){const i=ht.call(this,e);return i.state==="closed"?ee.call(this,i,t,n):Bt.call(this,i,t,n)}function ei(e){switch(e.mode){case"inline":return ni.call(this,e);case"modal":return ii.call(this,e);default:throw new Error(`"${e.mode}" is not a valid drawer mode.`)}}async function ni(e){return e.el.classList.remove(e.getSetting("classModal")),e.dialog.removeAttribute("aria-modal"),Ut(!1,{...this.settings,...e.settings}),this.focusTrap.unmount(),await Xn(e),e.el.dispatchEvent(new CustomEvent(e.getSetting("customEventPrefix")+"switchMode",{detail:this,bubbles:!0})),e}async function ii(e){return e.el.classList.add(e.getSetting("classModal")),e.dialog.setAttribute("aria-modal","true"),await Bt.call(this,e,!1,!1),e.el.dispatchEvent(new CustomEvent(e.getSetting("customEventPrefix")+"switchMode",{detail:this,bubbles:!0})),e}async function ri(e,t={}){await te.call(this,e,!1);const n=this,i=new Nn;let r,s="indeterminate";const a={id:e.id,el:e,dialog:null,trigger:null,settings:{...Jn(e,this.settings.dataConfig),...t},inlineState:"indeterminate",get breakpoint(){return Yn.call(n,e)},get store(){return n.store.get(this.id)},get mode(){return r},set mode(o){r=o,ei.call(n,this)},get state(){return s},set state(o){s=o,this.mode==="inline"&&o!="opening"&&o!="closing"&&(this.inlineState=o,this.getSetting("store")&&n.store.set(this.id,o)),o==="indeterminate"&&(this.el.classList.remove(this.getSetting("stateOpened")),this.el.classList.remove(this.getSetting("stateOpening")),this.el.classList.remove(this.getSetting("stateClosed")),this.el.classList.remove(this.getSetting("stateClosing")))},open(o,l){return ee.call(n,this,o,l)},close(o,l){return Bt.call(n,this,o,l)},toggle(o,l){return Me.call(n,this,o,l)},deregister(){return te.call(n,this)},mountBreakpoint(){const o=this.breakpoint,l=this.handleBreakpoint.bind(this);return i.mount(o,l),this},unmountBreakpoint(){return i.unmount(),this},handleBreakpoint(o){const l=o.matches?"inline":"modal";return this.mode!=l&&(this.mode=l),this},getSetting(o){return o in this.settings?this.settings[o]:n.settings[o]}};this.collection.push(a);const c=e.querySelector(a.getSetting("selectorDialog"));return a.dialog=c||e,a.getSetting("setTabindex")&&a.dialog.setAttribute("tabindex","-1"),await Zn(a),a.inlineState=a.state,a.mode=e.classList.contains(a.getSetting("classModal"))?"modal":"inline",a.breakpoint&&a.mountBreakpoint(),a}var Et,xt;let si=class extends Wn{constructor(t){super(),Te(this,Et,void 0),Te(this,xt,void 0),this.defaults=Qn,this.settings={...this.defaults,...t},this.focusTrap=new Bn,this.store=zn(this.settings.storeKey,this.settings.store),Se(this,Et,Un.bind(this)),Se(this,xt,ti.bind(this)),this.settings.autoMount&&this.mount()}get activeModal(){return this.collection.find(t=>t.state==="opened"&&t.mode==="modal")}async mount(t=null){t&&(this.settings={...this.settings,...t});const n=document.querySelectorAll(this.settings.selectorDrawer);return await this.registerCollection(n),this.settings.eventListeners&&this.mountEventListeners(),this}async unmount(){return await this.deregisterCollection(),this.settings.eventListeners&&this.unmountEventListeners(),this}mountEventListeners(){document.addEventListener("click",Wt(this,Et),!1),document.addEventListener("keydown",Wt(this,xt),!1)}unmountEventListeners(){document.removeEventListener("click",Wt(this,Et),!1),document.removeEventListener("keydown",Wt(this,xt),!1)}register(t,n={}){let i=typeof t=="string"?document.getElementById(t):t;return i?ri.call(this,i,n):Promise.reject(new Error(`Failed to register; drawer not found with ID of: "${t.id||t}".`))}deregister(t){let n=this.get(t.id||t);return n?te.call(this,n):Promise.reject(new Error(`Failed to deregister; drawer does not exist in collection with ID of: "${t.id||t}".`))}open(t,n,i){return ee.call(this,t,n,i)}close(t,n,i){return Bt.call(this,t,n,i)}toggle(t,n,i){return Me.call(this,t,n,i)}};Et=new WeakMap,xt=new WeakMap;var De=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Vt=(e,t,n)=>(De(e,t,"read from private field"),n?n.call(e):t.get(e)),je=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},qe=(e,t,n,i)=>(De(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),Fe=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Z=(e,t,n)=>(Fe(e,t,"read from private field"),n?n.call(e):t.get(e)),ne=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},ie=(e,t,n,i)=>(Fe(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n);class oi{constructor(){this.collection=[]}async register(t){return await this.deregister(t),this.collection.push(t),this.collection}async deregister(t){const n=this.collection.findIndex(i=>i===t);if(n>=0){const i=this.collection[n];Object.getOwnPropertyNames(i).forEach(r=>{delete i[r]}),this.collection.splice(n,1)}return this.collection}async registerCollection(t){return await Promise.all(Array.from(t,n=>{this.register(n)})),this.collection}async deregisterCollection(){for(;this.collection.length>0;)await this.deregister(this.collection[0]);return this.collection}get(t,n="id"){return this.collection.find(i=>i[n]===t)}}const g={inert:":not([inert]):not([inert] *)",negTabIndex:':not([tabindex^="-"])',disabled:":not(:disabled)"},ai=[`a[href]${g.inert}${g.negTabIndex}`,`area[href]${g.inert}${g.negTabIndex}`,`input:not([type="hidden"]):not([type="radio"])${g.inert}${g.negTabIndex}${g.disabled}`,`input[type="radio"]${g.inert}${g.negTabIndex}${g.disabled}`,`select${g.inert}${g.negTabIndex}${g.disabled}`,`textarea${g.inert}${g.negTabIndex}${g.disabled}`,`button${g.inert}${g.negTabIndex}${g.disabled}`,`details${g.inert} > summary:first-of-type${g.negTabIndex}`,`iframe${g.inert}${g.negTabIndex}`,`audio[controls]${g.inert}${g.negTabIndex}`,`video[controls]${g.inert}${g.negTabIndex}`,`[contenteditable]${g.inert}${g.negTabIndex}`,`[tabindex]${g.inert}${g.negTabIndex}`];var Ot,ft,pt;class li{constructor(t=null,n="[data-focus]"){ne(this,Ot,void 0),ne(this,ft,void 0),ne(this,pt,void 0),this.el=t,this.selectorFocus=n,ie(this,ft,ci.bind(this)),ie(this,pt,di.bind(this))}get focusable(){return Z(this,Ot)}set focusable(t){ie(this,Ot,t),Z(this,Ot).length?(document.removeEventListener("keydown",Z(this,pt)),document.addEventListener("keydown",Z(this,ft))):(document.removeEventListener("keydown",Z(this,ft)),document.addEventListener("keydown",Z(this,pt)))}get focusableFirst(){return this.focusable[0]}get focusableLast(){return this.focusable[this.focusable.length-1]}mount(t,n){t&&(this.el=t),n&&(this.selectorFocus=n),this.focusable=this.getFocusable(),this.focus()}unmount(){this.el=null,this.focusable=[],document.removeEventListener("keydown",Z(this,ft)),document.removeEventListener("keydown",Z(this,pt))}focus(t=this.el,n=this.selectorFocus){(t.querySelector(n)||t).focus()}getFocusable(t=this.el){const n=[],i=document.activeElement,r=t.scrollTop;return t.querySelectorAll(ai.join(",")).forEach(s=>{s.focus(),document.activeElement===s&&n.push(s)}),t.scrollTop=r,i.focus(),n}}Ot=new WeakMap,ft=new WeakMap,pt=new WeakMap;function ci(e){(e.key==="Tab"||e.keyCode===9)&&(e.shiftKey?(document.activeElement===this.focusableFirst||document.activeElement===this.el)&&(e.preventDefault(),this.focusableLast.focus()):(document.activeElement===this.focusableLast||document.activeElement===this.el)&&(e.preventDefault(),this.focusableFirst.focus()))}function di(e){(e.key==="Tab"||e.keyCode===9)&&e.preventDefault()}function ui(){return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim()}function hi(e,t=document.body){if(e.slice(0,2)!=="--"){const i=ui();i&&(e=`${i}${e}`),e=`--${e}`}const n=getComputedStyle(t).getPropertyValue(e).trim();if(n)return n;throw new Error(`CSS variable "${e}" was not found!`)}function fi(e,t){const n=(e.getAttribute(`data-${t}`)||"").replace(/'/g,'"');return n?JSON.parse(n):{}}function Ne(e,t,n){const i=t.nodeType===Node.COMMENT_NODE,r=t.nodeType===Node.ELEMENT_NODE;if(t=i||r?t:document.querySelector(t),i&&(n="after"),!t)throw new Error(`Not a valid teleport reference: '${t}'`);if(typeof t[n]!="function")throw new Error(`Not a valid teleport method: '${n}'`);let s=null;return i||(s=document.createComment("teleported #"+e.id),e.before(s)),t[n](e),i&&t.remove(),s}function We(e,t,n,i="transition-duration"){return new Promise(r=>{if(typeof i=="string"){const s=hi(i,e),a=!!s.includes("ms");i=parseFloat(s)*(a?1:1e3)}e.classList.remove(t.finish),e.classList.add(n.start),setTimeout(()=>{e.classList.add(n.finish),e.classList.remove(n.start),r(e)},i)})}function pi(e,t){t&&document.querySelectorAll(t).forEach(n=>{e?n.style.overflow="hidden":n.style.removeProperty("overflow")})}function gi(e,t){t&&document.querySelectorAll(t).forEach(n=>{e?(n.inert=!0,n.setAttribute("aria-hidden",!0)):(n.inert=null,n.removeAttribute("aria-hidden"))})}function mi(e,t){gi(!!e,t.selectorInert),pi(!!e,t.selectorOverflow)}const vi={autoMount:!1,dataOpen:"modal-open",dataClose:"modal-close",dataReplace:"modal-replace",dataConfig:"modal-config",selectorModal:".modal",selectorDialog:".modal__dialog",selectorScreen:".modal",selectorRequired:'[role="alertdialog"]',selectorFocus:"[data-focus]",selectorInert:null,selectorOverflow:"body",stateOpened:"is-opened",stateOpening:"is-opening",stateClosing:"is-closing",stateClosed:"is-closed",customEventPrefix:"modal:",eventListeners:!0,teleport:null,teleportMethod:"append",setTabindex:!0,transition:!0,transitionDuration:"modal-transition-duration"};function Lt(e){const t=typeof e=="string"?this.get(e):this.get(e.id);if(t)return t;throw new Error(`Modal not found in collection with id of "${e.id||e}".`)}function Rt(){this.active?this.focusTrap.mount(this.active.dialog,this.settings.selectorFocus):(this.trigger&&(this.trigger.focus(),this.trigger=null),this.focusTrap.unmount())}async function bi(e){const t=e.target.closest(`
|
|
5
|
+
`);if(e){t.preventDefault(),e.matches(`[data-${this.settings.dataToggle}]`)&&e.getAttribute(`data-${this.settings.dataToggle}`).trim().split(" ").forEach(n=>{const i=ht.call(this,n);return i.trigger=e,i.toggle()}),e.matches(`[data-${this.settings.dataOpen}]`)&&e.getAttribute(`data-${this.settings.dataOpen}`).trim().split(" ").forEach(n=>{const i=ht.call(this,n);return i.trigger=e,i.open()}),e.matches(`[data-${this.settings.dataClose}]`)&&e.getAttribute(`data-${this.settings.dataClose}`).trim().split(" ").forEach(n=>{if(n){const i=ht.call(this,n);return i.trigger=e,i.close()}else{const i=t.target.closest(this.settings.selectorDrawer);if(i)return this.close(i)}});return}if(this.activeModal&&t.target.matches(this.settings.selectorScreen))return this.close(this.activeModal.id)}function oi(t){if(t.key==="Escape"&&this.activeModal)return this.close(this.activeModal)}async function te(t,e=!0){const n=this.collection.findIndex(i=>i.id===t.id);if(n>=0){const i=this.collection[n];e&&i.state==="opened"&&await i.close(!1),this.store.set(i.id),i.unmountBreakpoint(),Object.getOwnPropertyNames(i).forEach(s=>{delete i[s]}),this.collection.splice(n,1)}return this.collection}async function ee(t,e,n=!0){const i=ht.call(this,t),s={...this.settings,...i.settings};return e!==void 0&&(s.transition=e),(i.state==="closed"||i.state==="indeterminate")&&(i.state="opening",s.transition?await De(i.el,{start:s.stateClosing,finish:s.stateClosed},{start:s.stateOpening,finish:s.stateOpened},s.transitionDuration):(i.el.classList.add(s.stateOpened),i.el.classList.remove(s.stateClosed)),i.state="opened",i.mode==="modal"&&Ut(!0,s),n&&je.call(this,i),i.el.dispatchEvent(new CustomEvent(s.customEventPrefix+"opened",{detail:this,bubbles:!0}))),i}async function Bt(t,e,n=!0){const i=ht.call(this,t),s={...this.settings,...i.settings};return e!==void 0&&(s.transition=e),(i.state==="opened"||i.state==="indeterminate")&&(i.state="closing",document.activeElement.blur(),s.transition?await De(i.el,{start:s.stateOpening,finish:s.stateOpened},{start:s.stateClosing,finish:s.stateClosed},s.transitionDuration):(i.el.classList.add(s.stateClosed),i.el.classList.remove(s.stateOpened)),i.state="closed",i.mode==="modal"&&Ut(!1,s),n&&je.call(this,i),i.el.dispatchEvent(new CustomEvent(s.customEventPrefix+"closed",{detail:this,bubbles:!0}))),i}async function qe(t,e,n){const i=ht.call(this,t);return i.state==="closed"?ee.call(this,i,e,n):Bt.call(this,i,e,n)}function ai(t){switch(t.mode){case"inline":return li.call(this,t);case"modal":return ci.call(this,t);default:throw new Error(`"${t.mode}" is not a valid drawer mode.`)}}async function li(t){return t.el.classList.remove(t.getSetting("classModal")),t.dialog.removeAttribute("aria-modal"),Ut(!1,{...this.settings,...t.settings}),this.focusTrap.unmount(),await ii(t),t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:this,bubbles:!0})),t}async function ci(t){return t.el.classList.add(t.getSetting("classModal")),t.dialog.setAttribute("aria-modal","true"),await Bt.call(this,t,!1,!1),t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:this,bubbles:!0})),t}async function di(t,e={}){await te.call(this,t,!1);const n=this,i=new Hn;let s,r="indeterminate";const a={id:t.id,el:t,dialog:null,trigger:null,settings:{...Yn(t,this.settings.dataConfig),...e},inlineState:"indeterminate",get breakpoint(){return si.call(n,t)},get store(){return n.store.get(this.id)},get mode(){return s},set mode(o){s=o,ai.call(n,this)},get state(){return r},set state(o){r=o,this.mode==="inline"&&o!="opening"&&o!="closing"&&(this.inlineState=o,this.getSetting("store")&&n.store.set(this.id,o)),o==="indeterminate"&&(this.el.classList.remove(this.getSetting("stateOpened")),this.el.classList.remove(this.getSetting("stateOpening")),this.el.classList.remove(this.getSetting("stateClosed")),this.el.classList.remove(this.getSetting("stateClosing")))},open(o,l){return ee.call(n,this,o,l)},close(o,l){return Bt.call(n,this,o,l)},toggle(o,l){return qe.call(n,this,o,l)},deregister(){return te.call(n,this)},mountBreakpoint(){const o=this.breakpoint,l=this.handleBreakpoint.bind(this);return i.mount(o,l),this},unmountBreakpoint(){return i.unmount(),this},handleBreakpoint(o){const l=o.matches?"inline":"modal";return this.mode!=l&&(this.mode=l),this},getSetting(o){return o in this.settings?this.settings[o]:n.settings[o]}};this.collection.push(a);const c=t.querySelector(a.getSetting("selectorDialog"));return a.dialog=c||t,a.getSetting("setTabindex")&&a.dialog.setAttribute("tabindex","-1"),await ni(a),a.inlineState=a.state,a.mode=t.classList.contains(a.getSetting("classModal"))?"modal":"inline",a.breakpoint&&a.mountBreakpoint(),a}var Et,xt;let ui=class extends Jn{constructor(e){super(),Ce(this,Et),Ce(this,xt),this.defaults=ei,this.settings={...this.defaults,...e},this.focusTrap=new Kn,this.store=Xn(this.settings.storeKey,this.settings.store),Ae(this,Et,ri.bind(this)),Ae(this,xt,oi.bind(this)),this.settings.autoMount&&this.mount()}get activeModal(){return this.collection.find(e=>e.state==="opened"&&e.mode==="modal")}async mount(e=null){e&&(this.settings={...this.settings,...e});const n=document.querySelectorAll(this.settings.selectorDrawer);return await this.registerCollection(n),this.settings.eventListeners&&this.mountEventListeners(),this}async unmount(){return await this.deregisterCollection(),this.settings.eventListeners&&this.unmountEventListeners(),this}mountEventListeners(){document.addEventListener("click",Wt(this,Et),!1),document.addEventListener("keydown",Wt(this,xt),!1)}unmountEventListeners(){document.removeEventListener("click",Wt(this,Et),!1),document.removeEventListener("keydown",Wt(this,xt),!1)}register(e,n={}){let i=typeof e=="string"?document.getElementById(e):e;return i?di.call(this,i,n):Promise.reject(new Error(`Failed to register; drawer not found with ID of: "${e.id||e}".`))}deregister(e){let n=this.get(e.id||e);return n?te.call(this,n):Promise.reject(new Error(`Failed to deregister; drawer does not exist in collection with ID of: "${e.id||e}".`))}open(e,n,i){return ee.call(this,e,n,i)}close(e,n,i){return Bt.call(this,e,n,i)}toggle(e,n,i){return qe.call(this,e,n,i)}};Et=new WeakMap,xt=new WeakMap;var Fe=t=>{throw TypeError(t)},Ne=(t,e,n)=>e.has(t)||Fe("Cannot "+n),Vt=(t,e,n)=>(Ne(t,e,"read from private field"),n?n.call(t):e.get(t)),We=(t,e,n)=>e.has(t)?Fe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),_e=(t,e,n,i)=>(Ne(t,e,"write to private field"),e.set(t,n),n),Be=t=>{throw TypeError(t)},Ve=(t,e,n)=>e.has(t)||Be("Cannot "+n),Z=(t,e,n)=>(Ve(t,e,"read from private field"),n?n.call(t):e.get(t)),ne=(t,e,n)=>e.has(t)?Be("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),ie=(t,e,n,i)=>(Ve(t,e,"write to private field"),e.set(t,n),n);class hi{constructor(){this.collection=[]}async register(e){return await this.deregister(e),this.collection.push(e),this.collection}async deregister(e){const n=this.collection.findIndex(i=>i===e);if(n>=0){const i=this.collection[n];Object.getOwnPropertyNames(i).forEach(s=>{delete i[s]}),this.collection.splice(n,1)}return this.collection}async registerCollection(e){return await Promise.all(Array.from(e,n=>{this.register(n)})),this.collection}async deregisterCollection(){for(;this.collection.length>0;)await this.deregister(this.collection[0]);return this.collection}get(e,n="id"){return this.collection.find(i=>i[n]===e)}}const g={inert:":not([inert]):not([inert] *)",negTabIndex:':not([tabindex^="-"])',disabled:":not(:disabled)"},fi=[`a[href]${g.inert}${g.negTabIndex}`,`area[href]${g.inert}${g.negTabIndex}`,`input:not([type="hidden"]):not([type="radio"])${g.inert}${g.negTabIndex}${g.disabled}`,`input[type="radio"]${g.inert}${g.negTabIndex}${g.disabled}`,`select${g.inert}${g.negTabIndex}${g.disabled}`,`textarea${g.inert}${g.negTabIndex}${g.disabled}`,`button${g.inert}${g.negTabIndex}${g.disabled}`,`details${g.inert} > summary:first-of-type${g.negTabIndex}`,`iframe${g.inert}${g.negTabIndex}`,`audio[controls]${g.inert}${g.negTabIndex}`,`video[controls]${g.inert}${g.negTabIndex}`,`[contenteditable]${g.inert}${g.negTabIndex}`,`[tabindex]${g.inert}${g.negTabIndex}`];var Ot,ft,pt;class pi{constructor(e=null,n="[data-focus]"){ne(this,Ot),ne(this,ft),ne(this,pt),this.el=e,this.selectorFocus=n,ie(this,ft,gi.bind(this)),ie(this,pt,mi.bind(this))}get focusable(){return Z(this,Ot)}set focusable(e){ie(this,Ot,e),Z(this,Ot).length?(document.removeEventListener("keydown",Z(this,pt)),document.addEventListener("keydown",Z(this,ft))):(document.removeEventListener("keydown",Z(this,ft)),document.addEventListener("keydown",Z(this,pt)))}get focusableFirst(){return this.focusable[0]}get focusableLast(){return this.focusable[this.focusable.length-1]}mount(e,n){e&&(this.el=e),n&&(this.selectorFocus=n),this.focusable=this.getFocusable(),this.focus()}unmount(){this.el=null,this.focusable=[],document.removeEventListener("keydown",Z(this,ft)),document.removeEventListener("keydown",Z(this,pt))}focus(e=this.el,n=this.selectorFocus){(e.querySelector(n)||e).focus()}getFocusable(e=this.el){const n=[],i=document.activeElement,s=e.scrollTop;return e.querySelectorAll(fi.join(",")).forEach(r=>{r.focus(),document.activeElement===r&&n.push(r)}),e.scrollTop=s,i.focus(),n}}Ot=new WeakMap,ft=new WeakMap,pt=new WeakMap;function gi(t){(t.key==="Tab"||t.keyCode===9)&&(t.shiftKey?(document.activeElement===this.focusableFirst||document.activeElement===this.el)&&(t.preventDefault(),this.focusableLast.focus()):(document.activeElement===this.focusableLast||document.activeElement===this.el)&&(t.preventDefault(),this.focusableFirst.focus()))}function mi(t){(t.key==="Tab"||t.keyCode===9)&&t.preventDefault()}function vi(){return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim()}function bi(t,e=document.body){if(t.slice(0,2)!=="--"){const i=vi();i&&(t=`${i}${t}`),t=`--${t}`}const n=getComputedStyle(e).getPropertyValue(t).trim();if(n)return n;throw new Error(`CSS variable "${t}" was not found!`)}function yi(t,e){const n=(t.getAttribute(`data-${e}`)||"").replace(/'/g,'"');return n?JSON.parse(n):{}}function Re(t,e,n){const i=e.nodeType===Node.COMMENT_NODE,s=e.nodeType===Node.ELEMENT_NODE;if(e=i||s?e:document.querySelector(e),i&&(n="after"),!e)throw new Error(`Not a valid teleport reference: '${e}'`);if(typeof e[n]!="function")throw new Error(`Not a valid teleport method: '${n}'`);let r=null;return i||(r=document.createComment("teleported #"+t.id),t.before(r)),e[n](t),i&&e.remove(),r}function He(t,e,n,i="transition-duration"){return new Promise(s=>{if(typeof i=="string"){const r=bi(i,t),a=!!r.includes("ms");i=parseFloat(r)*(a?1:1e3)}t.classList.remove(e.finish),t.classList.add(n.start),setTimeout(()=>{t.classList.add(n.finish),t.classList.remove(n.start),s(t)},i)})}function wi(t,e){e&&document.querySelectorAll(e).forEach(n=>{t?n.style.overflow="hidden":n.style.removeProperty("overflow")})}function $i(t,e){e&&document.querySelectorAll(e).forEach(n=>{t?(n.inert=!0,n.setAttribute("aria-hidden",!0)):(n.inert=null,n.removeAttribute("aria-hidden"))})}function Ei(t,e){$i(!!t,e.selectorInert),wi(!!t,e.selectorOverflow)}const xi={autoMount:!1,dataOpen:"modal-open",dataClose:"modal-close",dataReplace:"modal-replace",dataConfig:"modal-config",selectorModal:".modal",selectorDialog:".modal__dialog",selectorScreen:".modal",selectorRequired:'[role="alertdialog"]',selectorFocus:"[data-focus]",selectorInert:null,selectorOverflow:"body",stateOpened:"is-opened",stateOpening:"is-opening",stateClosing:"is-closing",stateClosed:"is-closed",customEventPrefix:"modal:",eventListeners:!0,teleport:null,teleportMethod:"append",setTabindex:!0,transition:!0,transitionDuration:"modal-transition-duration"};function Lt(t){const e=typeof t=="string"?this.get(t):this.get(t.id);if(e)return e;throw new Error(`Modal not found in collection with id of "${t.id||t}".`)}function Rt(){this.active?this.focusTrap.mount(this.active.dialog,this.settings.selectorFocus):(this.trigger&&(this.trigger.focus(),this.trigger=null),this.focusTrap.unmount())}async function Oi(t){const e=t.target.closest(`
|
|
6
6
|
[data-${this.settings.dataOpen}],
|
|
7
7
|
[data-${this.settings.dataReplace}],
|
|
8
8
|
[data-${this.settings.dataClose}]
|
|
9
|
-
`);if(t){if(e.preventDefault(),t.matches(`[data-${this.settings.dataOpen}]`)){const n=t.getAttribute(`data-${this.settings.dataOpen}`).trim(),i=Lt.call(this,n);return e.target.closest(this.settings.selectorModal)||(this.trigger=t),i.open()}if(t.matches(`[data-${this.settings.dataReplace}]`)){const n=t.getAttribute(`data-${this.settings.dataReplace}`).trim(),i=Lt.call(this,n);return e.target.closest(this.settings.selectorModal)||(this.trigger=t),i.replace()}if(t.matches(`[data-${this.settings.dataClose}]`)){const n=t.getAttribute(`data-${this.settings.dataClose}`).trim();return n==="*"?this.closeAll():this.close(n)}}if(this.active&&e.target.matches(this.settings.selectorScreen)&&!this.active.required)return this.close(this.active.id)}function yi(e){if(e.key==="Escape"&&this.active&&!this.active.dialog.matches(this.settings.selectorRequired))return this.close()}async function re(e,t=!0){const n=this.collection.findIndex(i=>i.id===e.id);if(n>=0){const i=this.collection[n];t&&i.state==="opened"?await i.close(!1):this.stack.remove(i),i.getSetting("teleport")&&i.teleportReturn(),Object.getOwnPropertyNames(i).forEach(r=>{delete i[r]}),this.collection.splice(n,1)}return this.collection}async function se(e,t,n=!0){const i=Lt.call(this,e),r={...this.settings,...i.settings};return t!==void 0&&(r.transition=t),this.stack.moveToTop(i),i.state==="closed"&&(i.state="opening",this.stack.add(i),r.transition?await We(i.el,{start:r.stateClosing,finish:r.stateClosed},{start:r.stateOpening,finish:r.stateOpened},r.transitionDuration):(i.el.classList.add(r.stateOpened),i.el.classList.remove(r.stateClosed)),i.state="opened"),n&&Rt.call(this),i.el.dispatchEvent(new CustomEvent(r.customEventPrefix+"opened",{detail:this,bubbles:!0})),i}async function oe(e,t,n=!0){const i=e?Lt.call(this,e):this.active;if(i&&i.state==="opened"){i.state="closing";const r={...this.settings,...i.settings};t!==void 0&&(r.transition=t),document.activeElement.blur(),r.transition?await We(i.el,{start:r.stateOpening,finish:r.stateOpened},{start:r.stateClosing,finish:r.stateClosed},r.transitionDuration):(i.el.classList.add(r.stateClosed),i.el.classList.remove(r.stateOpened)),this.stack.remove(i),i.state="closed",n&&Rt.call(this),i.el.dispatchEvent(new CustomEvent(r.customEventPrefix+"closed",{detail:this,bubbles:!0}))}return i}async function ae(e,t){const n=[];return await Promise.all(this.stack.value.map(async i=>{e&&e===i.id?Promise.resolve():n.push(await oe.call(this,i,t,!1)),i.trigger=null})),n}async function _e(e,t,n=!0){const i=Lt.call(this,e);let r,s;return i.state==="opened"?(r=i,s=await ae.call(this,i.id,t)):(s=ae.call(this,!1,t),r=se.call(this,i,t,!1),await Promise.all([r,s])),n&&Rt.call(this),{opened:r,closed:s}}async function wi(e,t={}){await re.call(this,e,!1);const n=this,i={id:e.id,state:"closed",el:e,dialog:null,get required(){return this.dialog.matches(this.getSetting("selectorRequired"))},returnRef:null,settings:{...fi(e,this.settings.dataConfig),...t},open(s,a){return se.call(n,this,s,a)},close(s,a){return oe.call(n,this,s,a)},replace(s,a){return _e.call(n,this,s,a)},deregister(){return re.call(n,this)},teleport(s=this.getSetting("teleport"),a=this.getSetting("teleportMethod")){return this.returnRef?(console.error("Element has already been teleported:",this.el),!1):(this.returnRef=Ne(this.el,s,a),this.el)},teleportReturn(){return this.returnRef?(this.returnRef=Ne(this.el,this.returnRef),this.el):(console.error("No return reference found:",this.el),!1)},getSetting(s){return s in this.settings?this.settings[s]:n.settings[s]}},r=e.querySelector(i.getSetting("selectorDialog"));return i.dialog=r||e,i.dialog.setAttribute("aria-modal","true"),i.dialog.hasAttribute("role")||i.dialog.setAttribute("role","dialog"),i.getSetting("setTabindex")&&i.dialog.setAttribute("tabindex","-1"),i.getSetting("teleport")&&i.teleport(),this.collection.push(i),i.el.classList.contains(this.settings.stateOpened)?await i.open(!1):(i.el.classList.remove(this.settings.stateOpening),i.el.classList.remove(this.settings.stateClosing),i.el.classList.add(this.settings.stateClosed)),i}function $i(e){const t=[];return{get value(){return[...t]},get top(){return t[t.length-1]},updateIndex(){t.forEach((n,i)=>{n.el.style.zIndex=null;const r=getComputedStyle(n.el)["z-index"];n.el.style.zIndex=parseInt(r)+i+1})},updateGlobalState(){mi(this.top,e),this.updateIndex()},add(n){n.el.style.zIndex=null;const i=getComputedStyle(n.el)["z-index"];n.el.style.zIndex=parseInt(i)+t.length+1,t.push(n),this.updateGlobalState()},remove(n){const i=t.findIndex(r=>r.id===n.id);i>=0&&(n.el.style.zIndex=null,t.splice(i,1),this.updateGlobalState())},moveToTop(n){const i=t.findIndex(r=>r.id===n.id);i>=0&&(t.splice(i,1),this.add(n))}}}var kt,Tt;let Ei=class extends oi{constructor(t){super(),je(this,kt,void 0),je(this,Tt,void 0),this.defaults=vi,this.settings={...this.defaults,...t},this.trigger=null,this.focusTrap=new li,this.stack=$i(this.settings),qe(this,kt,bi.bind(this)),qe(this,Tt,yi.bind(this)),this.settings.autoMount&&this.mount()}get active(){return this.stack.top}async mount(t){t&&(this.settings={...this.settings,...t});const n=document.querySelectorAll(this.settings.selectorModal);return await this.registerCollection(n),this.settings.eventListeners&&this.mountEventListeners(),this}async unmount(){return this.trigger=null,await this.deregisterCollection(),this.settings.eventListeners&&this.unmountEventListeners(),this}mountEventListeners(){document.addEventListener("click",Vt(this,kt),!1),document.addEventListener("keydown",Vt(this,Tt),!1)}unmountEventListeners(){document.removeEventListener("click",Vt(this,kt),!1),document.removeEventListener("keydown",Vt(this,Tt),!1)}register(t,n={}){let i=typeof t=="string"?document.getElementById(t):t;return i?wi.call(this,i,n):Promise.reject(new Error(`Failed to register; modal not found with ID of: "${t.id||t}".`))}deregister(t){let n=this.get(t.id||t);return n?re.call(this,n):Promise.reject(new Error(`Failed to deregister; modal does not exist in collection with ID of: "${t.id||t}".`))}open(t,n,i){return se.call(this,t,n,i)}close(t,n,i){return oe.call(this,t,n,i)}replace(t,n,i){return _e.call(this,t,n,i)}async closeAll(t=!1,n,i=!0){const r=await ae.call(this,t,n);return i&&Rt.call(this),r}};kt=new WeakMap,Tt=new WeakMap;var Be=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Ve=(e,t,n)=>(Be(e,t,"read from private field"),n?n.call(e):t.get(e)),xi=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Oi=(e,t,n,i)=>(Be(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n);class Li{constructor(){this.collection=[]}async register(t){return await this.deregister(t),this.collection.push(t),this.collection}async deregister(t){const n=this.collection.findIndex(i=>i===t);if(n>=0){const i=this.collection[n];Object.getOwnPropertyNames(i).forEach(r=>{delete i[r]}),this.collection.splice(n,1)}return this.collection}async registerCollection(t){return await Promise.all(Array.from(t,n=>{this.register(n)})),this.collection}async deregisterCollection(){for(;this.collection.length>0;)await this.deregister(this.collection[0]);return this.collection}get(t,n="id"){return this.collection.find(i=>i[n]===t)}}function ki(){return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim()}const Ti={autoMount:!1,selectorPopover:".popover",selectorArrow:".popover__arrow",stateActive:"is-active",eventListeners:!0,eventType:"click",placement:"bottom"};function Re(e,t){const n=getComputedStyle(e),i={placement:t.placement,event:t.eventType,offset:0,"overflow-padding":0,"flip-padding":0,"arrow-element":t.selectorArrow,"arrow-padding":0};for(const r in i){const s=ki(),a=n.getPropertyValue(`--${s}popover-${r}`).trim();a&&(i[r]=a)}return i}function le(e){let t;const n=typeof e=="string"?e.trim().split(" "):[e];switch(n.forEach(function(i,r){n[r]=parseInt(i,10)}),n.length){case 1:t=n[0];break;case 2:t={top:n[0],right:n[1],bottom:n[0],left:n[1]};break;case 3:t={top:n[0],right:n[1],bottom:n[2],left:n[1]};break;case 4:t={top:n[0],right:n[1],bottom:n[2],left:n[3]};break;default:t=!1;break}return t}function Si(e){return[{name:"offset",options:{offset:[0,parseInt(e.offset,10)]}},{name:"preventOverflow",options:{padding:le(e["overflow-padding"])}},{name:"flip",options:{padding:le(e["flip-padding"])}},{name:"arrow",options:{element:e["arrow-element"],padding:le(e["arrow-padding"])}}]}function He(e){const t=typeof e=="string"?this.get(e):this.get(e.id);if(t)return t;throw new Error(`Popover not found in collection with id of "${e}".`)}function Ci(e){return typeof e=="string"?e:typeof e.hasAttribute=="function"?e.closest(this.settings.selectorPopover)?(e=e.closest(this.settings.selectorPopover),e.id):e.hasAttribute("aria-controls")?e.getAttribute("aria-controls"):e.hasAttribute("aria-describedby")?e.getAttribute("aria-describedby"):!1:!1}function Ai(e){const t=Ci.call(this,e);if(t){const n=document.querySelector(`#${t}`),i=document.querySelector(`[aria-controls="${t}"]`)||document.querySelector(`[aria-describedby="${t}"]`);return!i&&!n?{error:new Error(`No popover elements found using the ID: "${t}".`)}:i?n?{popover:n,trigger:i}:{error:new Error("No popover associated with the provided popover trigger.")}:{error:new Error("No popover trigger associated with the provided popover.")}}else return{error:new Error("Could not resolve the popover ID.")}}async function ce(e){const t=e?He.call(this,e):await Je.call(this);return t&&t.state==="opened"&&(t.el.classList.remove(this.settings.stateActive),t.trigger.hasAttribute("aria-controls")&&t.trigger.setAttribute("aria-expanded","false"),t.popper.setOptions({modifiers:[{name:"eventListeners",enabled:!1}]}),t.state="closed",t.trigger===this.trigger&&(this.trigger=null)),t}async function Je(){const e=[];return await Promise.all(this.collection.map(async t=>{t.state==="opened"&&e.push(await ce.call(this,t))})),e}function ze(e){e.state=="opened"&&setTimeout(()=>{const t=e.el.closest(":hover")===e.el||e.trigger.closest(":hover")===e.trigger,n=document.activeElement.closest(`#${e.id}, [aria-controls="${e.id}"], [aria-describedby="${e.id}"]`);return!t&&!n&&e.close(),e},1)}function Ii(e){e.state==="opened"?e.close():(this.trigger=e.trigger,e.open(),Ke.call(this,e))}function Pi(e){switch(e.key){case"Escape":this.trigger&&this.trigger.focus(),Je.call(this);return;case"Tab":this.collection.forEach(t=>{ze.call(this,t)});return;default:return}}function Ke(e){const t=this;document.addEventListener("click",function n(i){i.target.closest(`#${e.id}, [aria-controls="${e.id}"], [aria-describedby="${e.id}"]`)?e.el&&!e.el.classList.contains(t.settings.stateActive)&&this.removeEventListener("click",n):(e.el&&e.el.classList.contains(t.settings.stateActive)&&e.close(),this.removeEventListener("click",n))})}var P="top",N="bottom",W="right",M="left",de="auto",St=[P,N,W,M],gt="start",Ct="end",Mi="clippingParents",Ge="viewport",At="popper",Di="reference",Qe=St.reduce(function(e,t){return e.concat([t+"-"+gt,t+"-"+Ct])},[]),Ze=[].concat(St,[de]).reduce(function(e,t){return e.concat([t,t+"-"+gt,t+"-"+Ct])},[]),ji="beforeRead",qi="read",Fi="afterRead",Ni="beforeMain",Wi="main",_i="afterMain",Bi="beforeWrite",Vi="write",Ri="afterWrite",Hi=[ji,qi,Fi,Ni,Wi,_i,Bi,Vi,Ri];function J(e){return e?(e.nodeName||"").toLowerCase():null}function q(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function tt(e){var t=q(e).Element;return e instanceof t||e instanceof Element}function _(e){var t=q(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function ue(e){if(typeof ShadowRoot>"u")return!1;var t=q(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function Ji(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var i=t.styles[n]||{},r=t.attributes[n]||{},s=t.elements[n];!_(s)||!J(s)||(Object.assign(s.style,i),Object.keys(r).forEach(function(a){var c=r[a];c===!1?s.removeAttribute(a):s.setAttribute(a,c===!0?"":c)}))})}function zi(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(i){var r=t.elements[i],s=t.attributes[i]||{},a=Object.keys(t.styles.hasOwnProperty(i)?t.styles[i]:n[i]),c=a.reduce(function(o,l){return o[l]="",o},{});!_(r)||!J(r)||(Object.assign(r.style,c),Object.keys(s).forEach(function(o){r.removeAttribute(o)}))})}}const Ki={name:"applyStyles",enabled:!0,phase:"write",fn:Ji,effect:zi,requires:["computeStyles"]};function z(e){return e.split("-")[0]}var et=Math.max,Ht=Math.min,mt=Math.round;function he(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function Xe(){return!/^((?!chrome|android).)*safari/i.test(he())}function vt(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var i=e.getBoundingClientRect(),r=1,s=1;t&&_(e)&&(r=e.offsetWidth>0&&mt(i.width)/e.offsetWidth||1,s=e.offsetHeight>0&&mt(i.height)/e.offsetHeight||1);var a=tt(e)?q(e):window,c=a.visualViewport,o=!Xe()&&n,l=(i.left+(o&&c?c.offsetLeft:0))/r,d=(i.top+(o&&c?c.offsetTop:0))/s,b=i.width/r,v=i.height/s;return{width:b,height:v,top:d,right:l+b,bottom:d+v,left:l,x:l,y:d}}function fe(e){var t=vt(e),n=e.offsetWidth,i=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:i}}function Ye(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&ue(n)){var i=t;do{if(i&&e.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function G(e){return q(e).getComputedStyle(e)}function Gi(e){return["table","td","th"].indexOf(J(e))>=0}function X(e){return((tt(e)?e.ownerDocument:e.document)||window.document).documentElement}function Jt(e){return J(e)==="html"?e:e.assignedSlot||e.parentNode||(ue(e)?e.host:null)||X(e)}function Ue(e){return!_(e)||G(e).position==="fixed"?null:e.offsetParent}function Qi(e){var t=/firefox/i.test(he()),n=/Trident/i.test(he());if(n&&_(e)){var i=G(e);if(i.position==="fixed")return null}var r=Jt(e);for(ue(r)&&(r=r.host);_(r)&&["html","body"].indexOf(J(r))<0;){var s=G(r);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||t&&s.willChange==="filter"||t&&s.filter&&s.filter!=="none")return r;r=r.parentNode}return null}function It(e){for(var t=q(e),n=Ue(e);n&&Gi(n)&&G(n).position==="static";)n=Ue(n);return n&&(J(n)==="html"||J(n)==="body"&&G(n).position==="static")?t:n||Qi(e)||t}function pe(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Pt(e,t,n){return et(e,Ht(t,n))}function Zi(e,t,n){var i=Pt(e,t,n);return i>n?n:i}function tn(){return{top:0,right:0,bottom:0,left:0}}function en(e){return Object.assign({},tn(),e)}function nn(e,t){return t.reduce(function(n,i){return n[i]=e,n},{})}var Xi=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,en(typeof e!="number"?e:nn(e,St))};function Yi(e){var t,n=e.state,i=e.name,r=e.options,s=n.elements.arrow,a=n.modifiersData.popperOffsets,c=z(n.placement),o=pe(c),l=[M,W].indexOf(c)>=0,d=l?"height":"width";if(!(!s||!a)){var b=Xi(r.padding,n),v=fe(s),h=o==="y"?P:M,$=o==="y"?N:W,u=n.rects.reference[d]+n.rects.reference[o]-a[o]-n.rects.popper[d],w=a[o]-n.rects.reference[o],E=It(s),O=E?o==="y"?E.clientHeight||0:E.clientWidth||0:0,L=u/2-w/2,m=b[h],y=O-v[d]-b[$],x=O/2-v[d]/2+L,k=Pt(m,x,y),T=o;n.modifiersData[i]=(t={},t[T]=k,t.centerOffset=k-x,t)}}function Ui(e){var t=e.state,n=e.options,i=n.element,r=i===void 0?"[data-popper-arrow]":i;r!=null&&(typeof r=="string"&&(r=t.elements.popper.querySelector(r),!r)||Ye(t.elements.popper,r)&&(t.elements.arrow=r))}const tr={name:"arrow",enabled:!0,phase:"main",fn:Yi,effect:Ui,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function bt(e){return e.split("-")[1]}var er={top:"auto",right:"auto",bottom:"auto",left:"auto"};function nr(e,t){var n=e.x,i=e.y,r=t.devicePixelRatio||1;return{x:mt(n*r)/r||0,y:mt(i*r)/r||0}}function rn(e){var t,n=e.popper,i=e.popperRect,r=e.placement,s=e.variation,a=e.offsets,c=e.position,o=e.gpuAcceleration,l=e.adaptive,d=e.roundOffsets,b=e.isFixed,v=a.x,h=v===void 0?0:v,$=a.y,u=$===void 0?0:$,w=typeof d=="function"?d({x:h,y:u}):{x:h,y:u};h=w.x,u=w.y;var E=a.hasOwnProperty("x"),O=a.hasOwnProperty("y"),L=M,m=P,y=window;if(l){var x=It(n),k="clientHeight",T="clientWidth";if(x===q(n)&&(x=X(n),G(x).position!=="static"&&c==="absolute"&&(k="scrollHeight",T="scrollWidth")),x=x,r===P||(r===M||r===W)&&s===Ct){m=N;var S=b&&x===y&&y.visualViewport?y.visualViewport.height:x[k];u-=S-i.height,u*=o?1:-1}if(r===M||(r===P||r===N)&&s===Ct){L=W;var C=b&&x===y&&y.visualViewport?y.visualViewport.width:x[T];h-=C-i.width,h*=o?1:-1}}var A=Object.assign({position:c},l&&er),R=d===!0?nr({x:h,y:u},q(n)):{x:h,y:u};if(h=R.x,u=R.y,o){var I;return Object.assign({},A,(I={},I[m]=O?"0":"",I[L]=E?"0":"",I.transform=(y.devicePixelRatio||1)<=1?"translate("+h+"px, "+u+"px)":"translate3d("+h+"px, "+u+"px, 0)",I))}return Object.assign({},A,(t={},t[m]=O?u+"px":"",t[L]=E?h+"px":"",t.transform="",t))}function ir(e){var t=e.state,n=e.options,i=n.gpuAcceleration,r=i===void 0?!0:i,s=n.adaptive,a=s===void 0?!0:s,c=n.roundOffsets,o=c===void 0?!0:c,l={placement:z(t.placement),variation:bt(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:r,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,rn(Object.assign({},l,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:o})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,rn(Object.assign({},l,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:o})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const rr={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:ir,data:{}};var zt={passive:!0};function sr(e){var t=e.state,n=e.instance,i=e.options,r=i.scroll,s=r===void 0?!0:r,a=i.resize,c=a===void 0?!0:a,o=q(t.elements.popper),l=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&l.forEach(function(d){d.addEventListener("scroll",n.update,zt)}),c&&o.addEventListener("resize",n.update,zt),function(){s&&l.forEach(function(d){d.removeEventListener("scroll",n.update,zt)}),c&&o.removeEventListener("resize",n.update,zt)}}const or={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:sr,data:{}};var ar={left:"right",right:"left",bottom:"top",top:"bottom"};function Kt(e){return e.replace(/left|right|bottom|top/g,function(t){return ar[t]})}var lr={start:"end",end:"start"};function sn(e){return e.replace(/start|end/g,function(t){return lr[t]})}function ge(e){var t=q(e),n=t.pageXOffset,i=t.pageYOffset;return{scrollLeft:n,scrollTop:i}}function me(e){return vt(X(e)).left+ge(e).scrollLeft}function cr(e,t){var n=q(e),i=X(e),r=n.visualViewport,s=i.clientWidth,a=i.clientHeight,c=0,o=0;if(r){s=r.width,a=r.height;var l=Xe();(l||!l&&t==="fixed")&&(c=r.offsetLeft,o=r.offsetTop)}return{width:s,height:a,x:c+me(e),y:o}}function dr(e){var t,n=X(e),i=ge(e),r=(t=e.ownerDocument)==null?void 0:t.body,s=et(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),a=et(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),c=-i.scrollLeft+me(e),o=-i.scrollTop;return G(r||n).direction==="rtl"&&(c+=et(n.clientWidth,r?r.clientWidth:0)-s),{width:s,height:a,x:c,y:o}}function ve(e){var t=G(e),n=t.overflow,i=t.overflowX,r=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+i)}function on(e){return["html","body","#document"].indexOf(J(e))>=0?e.ownerDocument.body:_(e)&&ve(e)?e:on(Jt(e))}function Mt(e,t){var n;t===void 0&&(t=[]);var i=on(e),r=i===((n=e.ownerDocument)==null?void 0:n.body),s=q(i),a=r?[s].concat(s.visualViewport||[],ve(i)?i:[]):i,c=t.concat(a);return r?c:c.concat(Mt(Jt(a)))}function be(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function ur(e,t){var n=vt(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function an(e,t,n){return t===Ge?be(cr(e,n)):tt(t)?ur(t,n):be(dr(X(e)))}function hr(e){var t=Mt(Jt(e)),n=["absolute","fixed"].indexOf(G(e).position)>=0,i=n&&_(e)?It(e):e;return tt(i)?t.filter(function(r){return tt(r)&&Ye(r,i)&&J(r)!=="body"}):[]}function fr(e,t,n,i){var r=t==="clippingParents"?hr(e):[].concat(t),s=[].concat(r,[n]),a=s[0],c=s.reduce(function(o,l){var d=an(e,l,i);return o.top=et(d.top,o.top),o.right=Ht(d.right,o.right),o.bottom=Ht(d.bottom,o.bottom),o.left=et(d.left,o.left),o},an(e,a,i));return c.width=c.right-c.left,c.height=c.bottom-c.top,c.x=c.left,c.y=c.top,c}function ln(e){var t=e.reference,n=e.element,i=e.placement,r=i?z(i):null,s=i?bt(i):null,a=t.x+t.width/2-n.width/2,c=t.y+t.height/2-n.height/2,o;switch(r){case P:o={x:a,y:t.y-n.height};break;case N:o={x:a,y:t.y+t.height};break;case W:o={x:t.x+t.width,y:c};break;case M:o={x:t.x-n.width,y:c};break;default:o={x:t.x,y:t.y}}var l=r?pe(r):null;if(l!=null){var d=l==="y"?"height":"width";switch(s){case gt:o[l]=o[l]-(t[d]/2-n[d]/2);break;case Ct:o[l]=o[l]+(t[d]/2-n[d]/2);break}}return o}function Dt(e,t){t===void 0&&(t={});var n=t,i=n.placement,r=i===void 0?e.placement:i,s=n.strategy,a=s===void 0?e.strategy:s,c=n.boundary,o=c===void 0?Mi:c,l=n.rootBoundary,d=l===void 0?Ge:l,b=n.elementContext,v=b===void 0?At:b,h=n.altBoundary,$=h===void 0?!1:h,u=n.padding,w=u===void 0?0:u,E=en(typeof w!="number"?w:nn(w,St)),O=v===At?Di:At,L=e.rects.popper,m=e.elements[$?O:v],y=fr(tt(m)?m:m.contextElement||X(e.elements.popper),o,d,a),x=vt(e.elements.reference),k=ln({reference:x,element:L,strategy:"absolute",placement:r}),T=be(Object.assign({},L,k)),S=v===At?T:x,C={top:y.top-S.top+E.top,bottom:S.bottom-y.bottom+E.bottom,left:y.left-S.left+E.left,right:S.right-y.right+E.right},A=e.modifiersData.offset;if(v===At&&A){var R=A[r];Object.keys(C).forEach(function(I){var nt=[W,N].indexOf(I)>=0?1:-1,it=[P,N].indexOf(I)>=0?"y":"x";C[I]+=R[it]*nt})}return C}function pr(e,t){t===void 0&&(t={});var n=t,i=n.placement,r=n.boundary,s=n.rootBoundary,a=n.padding,c=n.flipVariations,o=n.allowedAutoPlacements,l=o===void 0?Ze:o,d=bt(i),b=d?c?Qe:Qe.filter(function($){return bt($)===d}):St,v=b.filter(function($){return l.indexOf($)>=0});v.length===0&&(v=b);var h=v.reduce(function($,u){return $[u]=Dt(e,{placement:u,boundary:r,rootBoundary:s,padding:a})[z(u)],$},{});return Object.keys(h).sort(function($,u){return h[$]-h[u]})}function gr(e){if(z(e)===de)return[];var t=Kt(e);return[sn(e),t,sn(t)]}function mr(e){var t=e.state,n=e.options,i=e.name;if(!t.modifiersData[i]._skip){for(var r=n.mainAxis,s=r===void 0?!0:r,a=n.altAxis,c=a===void 0?!0:a,o=n.fallbackPlacements,l=n.padding,d=n.boundary,b=n.rootBoundary,v=n.altBoundary,h=n.flipVariations,$=h===void 0?!0:h,u=n.allowedAutoPlacements,w=t.options.placement,E=z(w),O=E===w,L=o||(O||!$?[Kt(w)]:gr(w)),m=[w].concat(L).reduce(function(st,Q){return st.concat(z(Q)===de?pr(t,{placement:Q,boundary:d,rootBoundary:b,padding:l,flipVariations:$,allowedAutoPlacements:u}):Q)},[]),y=t.rects.reference,x=t.rects.popper,k=new Map,T=!0,S=m[0],C=0;C<m.length;C++){var A=m[C],R=z(A),I=bt(A)===gt,nt=[P,N].indexOf(R)>=0,it=nt?"width":"height",F=Dt(t,{placement:A,boundary:d,rootBoundary:b,altBoundary:v,padding:l}),H=nt?I?W:M:I?N:P;y[it]>x[it]&&(H=Kt(H));var Gt=Kt(H),rt=[];if(s&&rt.push(F[R]<=0),c&&rt.push(F[H]<=0,F[Gt]<=0),rt.every(function(st){return st})){S=A,T=!1;break}k.set(A,rt)}if(T)for(var Qt=$?3:1,$e=function(st){var Q=m.find(function(Xt){var Ft=k.get(Xt);if(Ft)return Ft.slice(0,st).every(function(yt){return yt})});if(Q)return S=Q,"break"},qt=Qt;qt>0;qt--){var Zt=$e(qt);if(Zt==="break")break}t.placement!==S&&(t.modifiersData[i]._skip=!0,t.placement=S,t.reset=!0)}}const vr={name:"flip",enabled:!0,phase:"main",fn:mr,requiresIfExists:["offset"],data:{_skip:!1}};function cn(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function dn(e){return[P,W,N,M].some(function(t){return e[t]>=0})}function br(e){var t=e.state,n=e.name,i=t.rects.reference,r=t.rects.popper,s=t.modifiersData.preventOverflow,a=Dt(t,{elementContext:"reference"}),c=Dt(t,{altBoundary:!0}),o=cn(a,i),l=cn(c,r,s),d=dn(o),b=dn(l);t.modifiersData[n]={referenceClippingOffsets:o,popperEscapeOffsets:l,isReferenceHidden:d,hasPopperEscaped:b},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":b})}const yr={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:br};function wr(e,t,n){var i=z(e),r=[M,P].indexOf(i)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,a=s[0],c=s[1];return a=a||0,c=(c||0)*r,[M,W].indexOf(i)>=0?{x:c,y:a}:{x:a,y:c}}function $r(e){var t=e.state,n=e.options,i=e.name,r=n.offset,s=r===void 0?[0,0]:r,a=Ze.reduce(function(d,b){return d[b]=wr(b,t.rects,s),d},{}),c=a[t.placement],o=c.x,l=c.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=o,t.modifiersData.popperOffsets.y+=l),t.modifiersData[i]=a}const Er={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:$r};function xr(e){var t=e.state,n=e.name;t.modifiersData[n]=ln({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const Or={name:"popperOffsets",enabled:!0,phase:"read",fn:xr,data:{}};function Lr(e){return e==="x"?"y":"x"}function kr(e){var t=e.state,n=e.options,i=e.name,r=n.mainAxis,s=r===void 0?!0:r,a=n.altAxis,c=a===void 0?!1:a,o=n.boundary,l=n.rootBoundary,d=n.altBoundary,b=n.padding,v=n.tether,h=v===void 0?!0:v,$=n.tetherOffset,u=$===void 0?0:$,w=Dt(t,{boundary:o,rootBoundary:l,padding:b,altBoundary:d}),E=z(t.placement),O=bt(t.placement),L=!O,m=pe(E),y=Lr(m),x=t.modifiersData.popperOffsets,k=t.rects.reference,T=t.rects.popper,S=typeof u=="function"?u(Object.assign({},t.rects,{placement:t.placement})):u,C=typeof S=="number"?{mainAxis:S,altAxis:S}:Object.assign({mainAxis:0,altAxis:0},S),A=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,R={x:0,y:0};if(x){if(s){var I,nt=m==="y"?P:M,it=m==="y"?N:W,F=m==="y"?"height":"width",H=x[m],Gt=H+w[nt],rt=H-w[it],Qt=h?-T[F]/2:0,$e=O===gt?k[F]:T[F],qt=O===gt?-T[F]:-k[F],Zt=t.elements.arrow,st=h&&Zt?fe(Zt):{width:0,height:0},Q=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:tn(),Xt=Q[nt],Ft=Q[it],yt=Pt(0,k[F],st[F]),Br=L?k[F]/2-Qt-yt-Xt-C.mainAxis:$e-yt-Xt-C.mainAxis,Vr=L?-k[F]/2+Qt+yt+Ft+C.mainAxis:qt+yt+Ft+C.mainAxis,Ee=t.elements.arrow&&It(t.elements.arrow),Rr=Ee?m==="y"?Ee.clientTop||0:Ee.clientLeft||0:0,gn=(I=A==null?void 0:A[m])!=null?I:0,Hr=H+Br-gn-Rr,Jr=H+Vr-gn,mn=Pt(h?Ht(Gt,Hr):Gt,H,h?et(rt,Jr):rt);x[m]=mn,R[m]=mn-H}if(c){var vn,zr=m==="x"?P:M,Kr=m==="x"?N:W,ot=x[y],Yt=y==="y"?"height":"width",bn=ot+w[zr],yn=ot-w[Kr],xe=[P,M].indexOf(E)!==-1,wn=(vn=A==null?void 0:A[y])!=null?vn:0,$n=xe?bn:ot-k[Yt]-T[Yt]-wn+C.altAxis,En=xe?ot+k[Yt]+T[Yt]-wn-C.altAxis:yn,xn=h&&xe?Zi($n,ot,En):Pt(h?$n:bn,ot,h?En:yn);x[y]=xn,R[y]=xn-ot}t.modifiersData[i]=R}}const Tr={name:"preventOverflow",enabled:!0,phase:"main",fn:kr,requiresIfExists:["offset"]};function Sr(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function Cr(e){return e===q(e)||!_(e)?ge(e):Sr(e)}function Ar(e){var t=e.getBoundingClientRect(),n=mt(t.width)/e.offsetWidth||1,i=mt(t.height)/e.offsetHeight||1;return n!==1||i!==1}function Ir(e,t,n){n===void 0&&(n=!1);var i=_(t),r=_(t)&&Ar(t),s=X(t),a=vt(e,r,n),c={scrollLeft:0,scrollTop:0},o={x:0,y:0};return(i||!i&&!n)&&((J(t)!=="body"||ve(s))&&(c=Cr(t)),_(t)?(o=vt(t,!0),o.x+=t.clientLeft,o.y+=t.clientTop):s&&(o.x=me(s))),{x:a.left+c.scrollLeft-o.x,y:a.top+c.scrollTop-o.y,width:a.width,height:a.height}}function Pr(e){var t=new Map,n=new Set,i=[];e.forEach(function(s){t.set(s.name,s)});function r(s){n.add(s.name);var a=[].concat(s.requires||[],s.requiresIfExists||[]);a.forEach(function(c){if(!n.has(c)){var o=t.get(c);o&&r(o)}}),i.push(s)}return e.forEach(function(s){n.has(s.name)||r(s)}),i}function Mr(e){var t=Pr(e);return Hi.reduce(function(n,i){return n.concat(t.filter(function(r){return r.phase===i}))},[])}function Dr(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function jr(e){var t=e.reduce(function(n,i){var r=n[i.name];return n[i.name]=r?Object.assign({},r,i,{options:Object.assign({},r.options,i.options),data:Object.assign({},r.data,i.data)}):i,n},{});return Object.keys(t).map(function(n){return t[n]})}var un={placement:"bottom",modifiers:[],strategy:"absolute"};function hn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(i){return!(i&&typeof i.getBoundingClientRect=="function")})}function qr(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,i=n===void 0?[]:n,r=t.defaultOptions,s=r===void 0?un:r;return function(a,c,o){o===void 0&&(o=s);var l={placement:"bottom",orderedModifiers:[],options:Object.assign({},un,s),modifiersData:{},elements:{reference:a,popper:c},attributes:{},styles:{}},d=[],b=!1,v={state:l,setOptions:function(u){var w=typeof u=="function"?u(l.options):u;$(),l.options=Object.assign({},s,l.options,w),l.scrollParents={reference:tt(a)?Mt(a):a.contextElement?Mt(a.contextElement):[],popper:Mt(c)};var E=Mr(jr([].concat(i,l.options.modifiers)));return l.orderedModifiers=E.filter(function(O){return O.enabled}),h(),v.update()},forceUpdate:function(){if(!b){var u=l.elements,w=u.reference,E=u.popper;if(hn(w,E)){l.rects={reference:Ir(w,It(E),l.options.strategy==="fixed"),popper:fe(E)},l.reset=!1,l.placement=l.options.placement,l.orderedModifiers.forEach(function(T){return l.modifiersData[T.name]=Object.assign({},T.data)});for(var O=0;O<l.orderedModifiers.length;O++){if(l.reset===!0){l.reset=!1,O=-1;continue}var L=l.orderedModifiers[O],m=L.fn,y=L.options,x=y===void 0?{}:y,k=L.name;typeof m=="function"&&(l=m({state:l,options:x,name:k,instance:v})||l)}}}},update:Dr(function(){return new Promise(function(u){v.forceUpdate(),u(l)})}),destroy:function(){$(),b=!0}};if(!hn(a,c))return v;v.setOptions(o).then(function(u){!b&&o.onFirstUpdate&&o.onFirstUpdate(u)});function h(){l.orderedModifiers.forEach(function(u){var w=u.name,E=u.options,O=E===void 0?{}:E,L=u.effect;if(typeof L=="function"){var m=L({state:l,name:w,instance:v,options:O}),y=function(){};d.push(m||y)}})}function $(){d.forEach(function(u){return u()}),d=[]}return v}}var Fr=[or,Or,rr,Ki,Er,vr,Tr,tr,yr],Nr=qr({defaultModifiers:Fr});async function ye(e){const t=this.collection.findIndex(n=>n.id===e.id);if(t>=0){const n=this.collection[t];n.state==="opened"&&n.close(),n.popper.destroy(),fn(n),Object.getOwnPropertyNames(n).forEach(i=>{delete n[i]}),this.collection.splice(t,1)}return this.collection}function fn(e){return e.__eventListeners&&(e.__eventListeners.forEach(t=>{t.el.forEach(n=>{t.type.forEach(i=>{e[n].removeEventListener(i,t.listener,!1)})})}),delete e.__eventListeners),e}async function we(e){const t=He.call(this,e);return t.el.classList.add(this.settings.stateActive),t.trigger.hasAttribute("aria-controls")&&t.trigger.setAttribute("aria-expanded","true"),t.config=Re(t.el,this.settings),t.popper.setOptions({placement:t.config.placement,modifiers:[{name:"eventListeners",enabled:!0},...Si(t.config)]}),t.popper.update(),t.state="opened",t}async function Wr(e,t){ye.call(this,e);const n=this,i={id:e.id,state:"closed",el:e,trigger:t,popper:Nr(t,e),config:Re(e,this.settings),open(){return we.call(n,this)},close(){return ce.call(n,this)},deregister(){return ye.call(n,this)}};return i.trigger.hasAttribute("aria-controls")&&i.trigger.setAttribute("aria-expanded","false"),pn.call(this,i),this.collection.push(i),i.el.classList.contains(this.settings.stateActive)&&(await i.open(),Ke.call(this,i)),i}function pn(e){return e.__eventListeners||(e.config.event==="hover"?(e.__eventListeners=[{el:["trigger"],type:["mouseenter","focus"],listener:we.bind(this,e)},{el:["el","trigger"],type:["mouseleave","focusout"],listener:ze.bind(this,e)}],e.__eventListeners.forEach(t=>{t.el.forEach(n=>{t.type.forEach(i=>{e[n].addEventListener(i,t.listener,!1)})})})):(e.__eventListeners=[{el:["trigger"],type:["click"],listener:Ii.bind(this,e)}],e.__eventListeners.forEach(t=>{t.el.forEach(n=>{t.type.forEach(i=>{e[n].addEventListener(i,t.listener,!1)})})}))),e}var jt;class _r extends Li{constructor(t){super(),xi(this,jt,void 0),this.defaults=Ti,this.settings={...this.defaults,...t},this.trigger=null,Oi(this,jt,Pi.bind(this)),this.settings.autoMount&&this.mount()}async mount(t){t&&(this.settings={...this.settings,...t});const n=document.querySelectorAll(this.settings.selectorPopover);return await this.registerCollection(n),this.settings.eventListeners&&this.mountEventListeners(!1),this}async unmount(){return this.trigger=null,await this.deregisterCollection(),this.settings.eventListeners&&this.unmountEventListeners(!1),this}mountEventListeners(t=!0){t&&this.collection.forEach(n=>{pn.call(this,n)}),document.addEventListener("keydown",Ve(this,jt),!1)}unmountEventListeners(t=!0){t&&this.collection.forEach(n=>{fn(n)}),document.removeEventListener("keydown",Ve(this,jt),!1)}register(t){const n=Ai.call(this,t);return n.error?Promise.reject(n.error):Wr.call(this,n.popover,n.trigger)}deregister(t){let n=this.get(t.id||t);return n?ye.call(this,n):Promise.reject(new Error(`Failed to deregister; popover does not exist in collection with ID of: "${t.id||t}".`))}open(t){return we.call(this,t)}close(t){return ce.call(this,t)}}jt=new WeakMap,K.Drawer=si,K.Modal=Ei,K.Popover=_r,K.core=Fn,Object.defineProperty(K,Symbol.toStringTag,{value:"Module"})});
|
|
9
|
+
`);if(e){if(t.preventDefault(),e.matches(`[data-${this.settings.dataOpen}]`)){const n=e.getAttribute(`data-${this.settings.dataOpen}`).trim(),i=Lt.call(this,n);return t.target.closest(this.settings.selectorModal)||(this.trigger=e),i.open()}if(e.matches(`[data-${this.settings.dataReplace}]`)){const n=e.getAttribute(`data-${this.settings.dataReplace}`).trim(),i=Lt.call(this,n);return t.target.closest(this.settings.selectorModal)||(this.trigger=e),i.replace()}if(e.matches(`[data-${this.settings.dataClose}]`)){const n=e.getAttribute(`data-${this.settings.dataClose}`).trim();return n==="*"?this.closeAll():this.close(n)}}if(this.active&&t.target.matches(this.settings.selectorScreen)&&!this.active.required)return this.close(this.active.id)}function Li(t){if(t.key==="Escape"&&this.active&&!this.active.dialog.matches(this.settings.selectorRequired))return this.close()}async function se(t,e=!0){const n=this.collection.findIndex(i=>i.id===t.id);if(n>=0){const i=this.collection[n];e&&i.state==="opened"?await i.close(!1):this.stack.remove(i),i.getSetting("teleport")&&i.teleportReturn(),Object.getOwnPropertyNames(i).forEach(s=>{delete i[s]}),this.collection.splice(n,1)}return this.collection}async function re(t,e,n=!0){const i=Lt.call(this,t),s={...this.settings,...i.settings};return e!==void 0&&(s.transition=e),this.stack.moveToTop(i),i.state==="closed"&&(i.state="opening",this.stack.add(i),s.transition?await He(i.el,{start:s.stateClosing,finish:s.stateClosed},{start:s.stateOpening,finish:s.stateOpened},s.transitionDuration):(i.el.classList.add(s.stateOpened),i.el.classList.remove(s.stateClosed)),i.state="opened"),n&&Rt.call(this),i.el.dispatchEvent(new CustomEvent(s.customEventPrefix+"opened",{detail:this,bubbles:!0})),i}async function oe(t,e,n=!0){const i=t?Lt.call(this,t):this.active;if(i&&i.state==="opened"){i.state="closing";const s={...this.settings,...i.settings};e!==void 0&&(s.transition=e),document.activeElement.blur(),s.transition?await He(i.el,{start:s.stateOpening,finish:s.stateOpened},{start:s.stateClosing,finish:s.stateClosed},s.transitionDuration):(i.el.classList.add(s.stateClosed),i.el.classList.remove(s.stateOpened)),this.stack.remove(i),i.state="closed",n&&Rt.call(this),i.el.dispatchEvent(new CustomEvent(s.customEventPrefix+"closed",{detail:this,bubbles:!0}))}return i}async function ae(t,e){const n=[];return await Promise.all(this.stack.value.map(async i=>{t&&t===i.id?Promise.resolve():n.push(await oe.call(this,i,e,!1)),i.trigger=null})),n}async function Je(t,e,n=!0){const i=Lt.call(this,t);let s,r;return i.state==="opened"?(s=i,r=await ae.call(this,i.id,e)):(r=ae.call(this,!1,e),s=re.call(this,i,e,!1),await Promise.all([s,r])),n&&Rt.call(this),{opened:s,closed:r}}async function ki(t,e={}){await se.call(this,t,!1);const n=this,i={id:t.id,state:"closed",el:t,dialog:null,get required(){return this.dialog.matches(this.getSetting("selectorRequired"))},returnRef:null,settings:{...yi(t,this.settings.dataConfig),...e},open(r,a){return re.call(n,this,r,a)},close(r,a){return oe.call(n,this,r,a)},replace(r,a){return Je.call(n,this,r,a)},deregister(){return se.call(n,this)},teleport(r=this.getSetting("teleport"),a=this.getSetting("teleportMethod")){return this.returnRef?(console.error("Element has already been teleported:",this.el),!1):(this.returnRef=Re(this.el,r,a),this.el)},teleportReturn(){return this.returnRef?(this.returnRef=Re(this.el,this.returnRef),this.el):(console.error("No return reference found:",this.el),!1)},getSetting(r){return r in this.settings?this.settings[r]:n.settings[r]}},s=t.querySelector(i.getSetting("selectorDialog"));return i.dialog=s||t,i.dialog.setAttribute("aria-modal","true"),i.dialog.hasAttribute("role")||i.dialog.setAttribute("role","dialog"),i.getSetting("setTabindex")&&i.dialog.setAttribute("tabindex","-1"),i.getSetting("teleport")&&i.teleport(),this.collection.push(i),i.el.classList.contains(this.settings.stateOpened)?await i.open(!1):(i.el.classList.remove(this.settings.stateOpening),i.el.classList.remove(this.settings.stateClosing),i.el.classList.add(this.settings.stateClosed)),i}function Ti(t){const e=[];return{get value(){return[...e]},get top(){return e[e.length-1]},updateIndex(){e.forEach((n,i)=>{n.el.style.zIndex=null;const s=getComputedStyle(n.el)["z-index"];n.el.style.zIndex=parseInt(s)+i+1})},updateGlobalState(){Ei(this.top,t),this.updateIndex()},add(n){n.el.style.zIndex=null;const i=getComputedStyle(n.el)["z-index"];n.el.style.zIndex=parseInt(i)+e.length+1,e.push(n),this.updateGlobalState()},remove(n){const i=e.findIndex(s=>s.id===n.id);i>=0&&(n.el.style.zIndex=null,e.splice(i,1),this.updateGlobalState())},moveToTop(n){const i=e.findIndex(s=>s.id===n.id);i>=0&&(e.splice(i,1),this.add(n))}}}var kt,Tt;let Si=class extends hi{constructor(e){super(),We(this,kt),We(this,Tt),this.defaults=xi,this.settings={...this.defaults,...e},this.trigger=null,this.focusTrap=new pi,this.stack=Ti(this.settings),_e(this,kt,Oi.bind(this)),_e(this,Tt,Li.bind(this)),this.settings.autoMount&&this.mount()}get active(){return this.stack.top}async mount(e){e&&(this.settings={...this.settings,...e});const n=document.querySelectorAll(this.settings.selectorModal);return await this.registerCollection(n),this.settings.eventListeners&&this.mountEventListeners(),this}async unmount(){return this.trigger=null,await this.deregisterCollection(),this.settings.eventListeners&&this.unmountEventListeners(),this}mountEventListeners(){document.addEventListener("click",Vt(this,kt),!1),document.addEventListener("keydown",Vt(this,Tt),!1)}unmountEventListeners(){document.removeEventListener("click",Vt(this,kt),!1),document.removeEventListener("keydown",Vt(this,Tt),!1)}register(e,n={}){let i=typeof e=="string"?document.getElementById(e):e;return i?ki.call(this,i,n):Promise.reject(new Error(`Failed to register; modal not found with ID of: "${e.id||e}".`))}deregister(e){let n=this.get(e.id||e);return n?se.call(this,n):Promise.reject(new Error(`Failed to deregister; modal does not exist in collection with ID of: "${e.id||e}".`))}open(e,n,i){return re.call(this,e,n,i)}close(e,n,i){return oe.call(this,e,n,i)}replace(e,n,i){return Je.call(this,e,n,i)}async closeAll(e=!1,n,i=!0){const s=await ae.call(this,e,n);return i&&Rt.call(this),s}};kt=new WeakMap,Tt=new WeakMap;var ze=t=>{throw TypeError(t)},Ke=(t,e,n)=>e.has(t)||ze("Cannot "+n),Ge=(t,e,n)=>(Ke(t,e,"read from private field"),n?n.call(t):e.get(t)),Ci=(t,e,n)=>e.has(t)?ze("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Ai=(t,e,n,i)=>(Ke(t,e,"write to private field"),e.set(t,n),n);class Ii{constructor(){this.collection=[]}async register(e){return await this.deregister(e),this.collection.push(e),this.collection}async deregister(e){const n=this.collection.findIndex(i=>i===e);if(n>=0){const i=this.collection[n];Object.getOwnPropertyNames(i).forEach(s=>{delete i[s]}),this.collection.splice(n,1)}return this.collection}async registerCollection(e){return await Promise.all(Array.from(e,n=>{this.register(n)})),this.collection}async deregisterCollection(){for(;this.collection.length>0;)await this.deregister(this.collection[0]);return this.collection}get(e,n="id"){return this.collection.find(i=>i[n]===e)}}function Mi(){return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim()}const Pi={autoMount:!1,selectorPopover:".popover",selectorArrow:".popover__arrow",stateActive:"is-active",eventListeners:!0,eventType:"click",placement:"bottom"};function Qe(t,e){const n=getComputedStyle(t),i={placement:e.placement,event:e.eventType,offset:0,"overflow-padding":0,"flip-padding":0,"arrow-element":e.selectorArrow,"arrow-padding":0};for(const s in i){const r=Mi(),a=n.getPropertyValue(`--${r}popover-${s}`).trim();a&&(i[s]=a)}return i}function le(t){let e;const n=typeof t=="string"?t.trim().split(" "):[t];switch(n.forEach(function(i,s){n[s]=parseInt(i,10)}),n.length){case 1:e=n[0];break;case 2:e={top:n[0],right:n[1],bottom:n[0],left:n[1]};break;case 3:e={top:n[0],right:n[1],bottom:n[2],left:n[1]};break;case 4:e={top:n[0],right:n[1],bottom:n[2],left:n[3]};break;default:e=!1;break}return e}function Di(t){return[{name:"offset",options:{offset:[0,parseInt(t.offset,10)]}},{name:"preventOverflow",options:{padding:le(t["overflow-padding"])}},{name:"flip",options:{padding:le(t["flip-padding"])}},{name:"arrow",options:{element:t["arrow-element"],padding:le(t["arrow-padding"])}}]}function Ze(t){const e=typeof t=="string"?this.get(t):this.get(t.id);if(e)return e;throw new Error(`Popover not found in collection with id of "${t}".`)}function ji(t){return typeof t=="string"?t:typeof t.hasAttribute=="function"?t.closest(this.settings.selectorPopover)?(t=t.closest(this.settings.selectorPopover),t.id):t.hasAttribute("aria-controls")?t.getAttribute("aria-controls"):t.hasAttribute("aria-describedby")?t.getAttribute("aria-describedby"):!1:!1}function qi(t){const e=ji.call(this,t);if(e){const n=document.querySelector(`#${e}`),i=document.querySelector(`[aria-controls="${e}"]`)||document.querySelector(`[aria-describedby="${e}"]`);return!i&&!n?{error:new Error(`No popover elements found using the ID: "${e}".`)}:i?n?{popover:n,trigger:i}:{error:new Error("No popover associated with the provided popover trigger.")}:{error:new Error("No popover trigger associated with the provided popover.")}}else return{error:new Error("Could not resolve the popover ID.")}}async function ce(t){const e=t?Ze.call(this,t):await Ye.call(this);return e&&e.state==="opened"&&(e.el.classList.remove(this.settings.stateActive),e.trigger.hasAttribute("aria-controls")&&e.trigger.setAttribute("aria-expanded","false"),e.popper.setOptions({modifiers:[{name:"eventListeners",enabled:!1}]}),e.state="closed",e.trigger===this.trigger&&(this.trigger=null)),e}async function Ye(){const t=[];return await Promise.all(this.collection.map(async e=>{e.state==="opened"&&t.push(await ce.call(this,e))})),t}function Xe(t){t.state=="opened"&&setTimeout(()=>{const e=t.el.closest(":hover")===t.el||t.trigger.closest(":hover")===t.trigger,n=document.activeElement.closest(`#${t.id}, [aria-controls="${t.id}"], [aria-describedby="${t.id}"]`);return!e&&!n&&t.close(),t},1)}function Fi(t){t.state==="opened"?t.close():(this.trigger=t.trigger,t.open(),Ue.call(this,t))}function Ni(t){switch(t.key){case"Escape":this.trigger&&this.trigger.focus(),Ye.call(this);return;case"Tab":this.collection.forEach(e=>{Xe.call(this,e)});return;default:return}}function Ue(t){const e=this;document.addEventListener("click",function n(i){i.target.closest(`#${t.id}, [aria-controls="${t.id}"], [aria-describedby="${t.id}"]`)?t.el&&!t.el.classList.contains(e.settings.stateActive)&&this.removeEventListener("click",n):(t.el&&t.el.classList.contains(e.settings.stateActive)&&t.close(),this.removeEventListener("click",n))})}var M="top",N="bottom",W="right",P="left",de="auto",St=[M,N,W,P],gt="start",Ct="end",Wi="clippingParents",tn="viewport",At="popper",_i="reference",en=St.reduce(function(t,e){return t.concat([e+"-"+gt,e+"-"+Ct])},[]),nn=[].concat(St,[de]).reduce(function(t,e){return t.concat([e,e+"-"+gt,e+"-"+Ct])},[]),Bi="beforeRead",Vi="read",Ri="afterRead",Hi="beforeMain",Ji="main",zi="afterMain",Ki="beforeWrite",Gi="write",Qi="afterWrite",Zi=[Bi,Vi,Ri,Hi,Ji,zi,Ki,Gi,Qi];function J(t){return t?(t.nodeName||"").toLowerCase():null}function q(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function tt(t){var e=q(t).Element;return t instanceof e||t instanceof Element}function _(t){var e=q(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function ue(t){if(typeof ShadowRoot>"u")return!1;var e=q(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function Yi(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var i=e.styles[n]||{},s=e.attributes[n]||{},r=e.elements[n];!_(r)||!J(r)||(Object.assign(r.style,i),Object.keys(s).forEach(function(a){var c=s[a];c===!1?r.removeAttribute(a):r.setAttribute(a,c===!0?"":c)}))})}function Xi(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(i){var s=e.elements[i],r=e.attributes[i]||{},a=Object.keys(e.styles.hasOwnProperty(i)?e.styles[i]:n[i]),c=a.reduce(function(o,l){return o[l]="",o},{});!_(s)||!J(s)||(Object.assign(s.style,c),Object.keys(r).forEach(function(o){s.removeAttribute(o)}))})}}const Ui={name:"applyStyles",enabled:!0,phase:"write",fn:Yi,effect:Xi,requires:["computeStyles"]};function z(t){return t.split("-")[0]}var et=Math.max,Ht=Math.min,mt=Math.round;function he(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function sn(){return!/^((?!chrome|android).)*safari/i.test(he())}function vt(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var i=t.getBoundingClientRect(),s=1,r=1;e&&_(t)&&(s=t.offsetWidth>0&&mt(i.width)/t.offsetWidth||1,r=t.offsetHeight>0&&mt(i.height)/t.offsetHeight||1);var a=tt(t)?q(t):window,c=a.visualViewport,o=!sn()&&n,l=(i.left+(o&&c?c.offsetLeft:0))/s,d=(i.top+(o&&c?c.offsetTop:0))/r,b=i.width/s,v=i.height/r;return{width:b,height:v,top:d,right:l+b,bottom:d+v,left:l,x:l,y:d}}function fe(t){var e=vt(t),n=t.offsetWidth,i=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-i)<=1&&(i=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:i}}function rn(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&ue(n)){var i=e;do{if(i&&t.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function G(t){return q(t).getComputedStyle(t)}function ts(t){return["table","td","th"].indexOf(J(t))>=0}function Y(t){return((tt(t)?t.ownerDocument:t.document)||window.document).documentElement}function Jt(t){return J(t)==="html"?t:t.assignedSlot||t.parentNode||(ue(t)?t.host:null)||Y(t)}function on(t){return!_(t)||G(t).position==="fixed"?null:t.offsetParent}function es(t){var e=/firefox/i.test(he()),n=/Trident/i.test(he());if(n&&_(t)){var i=G(t);if(i.position==="fixed")return null}var s=Jt(t);for(ue(s)&&(s=s.host);_(s)&&["html","body"].indexOf(J(s))<0;){var r=G(s);if(r.transform!=="none"||r.perspective!=="none"||r.contain==="paint"||["transform","perspective"].indexOf(r.willChange)!==-1||e&&r.willChange==="filter"||e&&r.filter&&r.filter!=="none")return s;s=s.parentNode}return null}function It(t){for(var e=q(t),n=on(t);n&&ts(n)&&G(n).position==="static";)n=on(n);return n&&(J(n)==="html"||J(n)==="body"&&G(n).position==="static")?e:n||es(t)||e}function pe(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Mt(t,e,n){return et(t,Ht(e,n))}function ns(t,e,n){var i=Mt(t,e,n);return i>n?n:i}function an(){return{top:0,right:0,bottom:0,left:0}}function ln(t){return Object.assign({},an(),t)}function cn(t,e){return e.reduce(function(n,i){return n[i]=t,n},{})}var is=function(t,e){return t=typeof t=="function"?t(Object.assign({},e.rects,{placement:e.placement})):t,ln(typeof t!="number"?t:cn(t,St))};function ss(t){var e,n=t.state,i=t.name,s=t.options,r=n.elements.arrow,a=n.modifiersData.popperOffsets,c=z(n.placement),o=pe(c),l=[P,W].indexOf(c)>=0,d=l?"height":"width";if(!(!r||!a)){var b=is(s.padding,n),v=fe(r),h=o==="y"?M:P,$=o==="y"?N:W,u=n.rects.reference[d]+n.rects.reference[o]-a[o]-n.rects.popper[d],w=a[o]-n.rects.reference[o],E=It(r),O=E?o==="y"?E.clientHeight||0:E.clientWidth||0:0,L=u/2-w/2,m=b[h],y=O-v[d]-b[$],x=O/2-v[d]/2+L,k=Mt(m,x,y),T=o;n.modifiersData[i]=(e={},e[T]=k,e.centerOffset=k-x,e)}}function rs(t){var e=t.state,n=t.options,i=n.element,s=i===void 0?"[data-popper-arrow]":i;s!=null&&(typeof s=="string"&&(s=e.elements.popper.querySelector(s),!s)||rn(e.elements.popper,s)&&(e.elements.arrow=s))}const os={name:"arrow",enabled:!0,phase:"main",fn:ss,effect:rs,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function bt(t){return t.split("-")[1]}var as={top:"auto",right:"auto",bottom:"auto",left:"auto"};function ls(t,e){var n=t.x,i=t.y,s=e.devicePixelRatio||1;return{x:mt(n*s)/s||0,y:mt(i*s)/s||0}}function dn(t){var e,n=t.popper,i=t.popperRect,s=t.placement,r=t.variation,a=t.offsets,c=t.position,o=t.gpuAcceleration,l=t.adaptive,d=t.roundOffsets,b=t.isFixed,v=a.x,h=v===void 0?0:v,$=a.y,u=$===void 0?0:$,w=typeof d=="function"?d({x:h,y:u}):{x:h,y:u};h=w.x,u=w.y;var E=a.hasOwnProperty("x"),O=a.hasOwnProperty("y"),L=P,m=M,y=window;if(l){var x=It(n),k="clientHeight",T="clientWidth";if(x===q(n)&&(x=Y(n),G(x).position!=="static"&&c==="absolute"&&(k="scrollHeight",T="scrollWidth")),x=x,s===M||(s===P||s===W)&&r===Ct){m=N;var S=b&&x===y&&y.visualViewport?y.visualViewport.height:x[k];u-=S-i.height,u*=o?1:-1}if(s===P||(s===M||s===N)&&r===Ct){L=W;var C=b&&x===y&&y.visualViewport?y.visualViewport.width:x[T];h-=C-i.width,h*=o?1:-1}}var A=Object.assign({position:c},l&&as),R=d===!0?ls({x:h,y:u},q(n)):{x:h,y:u};if(h=R.x,u=R.y,o){var I;return Object.assign({},A,(I={},I[m]=O?"0":"",I[L]=E?"0":"",I.transform=(y.devicePixelRatio||1)<=1?"translate("+h+"px, "+u+"px)":"translate3d("+h+"px, "+u+"px, 0)",I))}return Object.assign({},A,(e={},e[m]=O?u+"px":"",e[L]=E?h+"px":"",e.transform="",e))}function cs(t){var e=t.state,n=t.options,i=n.gpuAcceleration,s=i===void 0?!0:i,r=n.adaptive,a=r===void 0?!0:r,c=n.roundOffsets,o=c===void 0?!0:c,l={placement:z(e.placement),variation:bt(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,dn(Object.assign({},l,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:a,roundOffsets:o})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,dn(Object.assign({},l,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:o})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const ds={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:cs,data:{}};var zt={passive:!0};function us(t){var e=t.state,n=t.instance,i=t.options,s=i.scroll,r=s===void 0?!0:s,a=i.resize,c=a===void 0?!0:a,o=q(e.elements.popper),l=[].concat(e.scrollParents.reference,e.scrollParents.popper);return r&&l.forEach(function(d){d.addEventListener("scroll",n.update,zt)}),c&&o.addEventListener("resize",n.update,zt),function(){r&&l.forEach(function(d){d.removeEventListener("scroll",n.update,zt)}),c&&o.removeEventListener("resize",n.update,zt)}}const hs={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:us,data:{}};var fs={left:"right",right:"left",bottom:"top",top:"bottom"};function Kt(t){return t.replace(/left|right|bottom|top/g,function(e){return fs[e]})}var ps={start:"end",end:"start"};function un(t){return t.replace(/start|end/g,function(e){return ps[e]})}function ge(t){var e=q(t),n=e.pageXOffset,i=e.pageYOffset;return{scrollLeft:n,scrollTop:i}}function me(t){return vt(Y(t)).left+ge(t).scrollLeft}function gs(t,e){var n=q(t),i=Y(t),s=n.visualViewport,r=i.clientWidth,a=i.clientHeight,c=0,o=0;if(s){r=s.width,a=s.height;var l=sn();(l||!l&&e==="fixed")&&(c=s.offsetLeft,o=s.offsetTop)}return{width:r,height:a,x:c+me(t),y:o}}function ms(t){var e,n=Y(t),i=ge(t),s=(e=t.ownerDocument)==null?void 0:e.body,r=et(n.scrollWidth,n.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),a=et(n.scrollHeight,n.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),c=-i.scrollLeft+me(t),o=-i.scrollTop;return G(s||n).direction==="rtl"&&(c+=et(n.clientWidth,s?s.clientWidth:0)-r),{width:r,height:a,x:c,y:o}}function ve(t){var e=G(t),n=e.overflow,i=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+s+i)}function hn(t){return["html","body","#document"].indexOf(J(t))>=0?t.ownerDocument.body:_(t)&&ve(t)?t:hn(Jt(t))}function Pt(t,e){var n;e===void 0&&(e=[]);var i=hn(t),s=i===((n=t.ownerDocument)==null?void 0:n.body),r=q(i),a=s?[r].concat(r.visualViewport||[],ve(i)?i:[]):i,c=e.concat(a);return s?c:c.concat(Pt(Jt(a)))}function be(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function vs(t,e){var n=vt(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function fn(t,e,n){return e===tn?be(gs(t,n)):tt(e)?vs(e,n):be(ms(Y(t)))}function bs(t){var e=Pt(Jt(t)),n=["absolute","fixed"].indexOf(G(t).position)>=0,i=n&&_(t)?It(t):t;return tt(i)?e.filter(function(s){return tt(s)&&rn(s,i)&&J(s)!=="body"}):[]}function ys(t,e,n,i){var s=e==="clippingParents"?bs(t):[].concat(e),r=[].concat(s,[n]),a=r[0],c=r.reduce(function(o,l){var d=fn(t,l,i);return o.top=et(d.top,o.top),o.right=Ht(d.right,o.right),o.bottom=Ht(d.bottom,o.bottom),o.left=et(d.left,o.left),o},fn(t,a,i));return c.width=c.right-c.left,c.height=c.bottom-c.top,c.x=c.left,c.y=c.top,c}function pn(t){var e=t.reference,n=t.element,i=t.placement,s=i?z(i):null,r=i?bt(i):null,a=e.x+e.width/2-n.width/2,c=e.y+e.height/2-n.height/2,o;switch(s){case M:o={x:a,y:e.y-n.height};break;case N:o={x:a,y:e.y+e.height};break;case W:o={x:e.x+e.width,y:c};break;case P:o={x:e.x-n.width,y:c};break;default:o={x:e.x,y:e.y}}var l=s?pe(s):null;if(l!=null){var d=l==="y"?"height":"width";switch(r){case gt:o[l]=o[l]-(e[d]/2-n[d]/2);break;case Ct:o[l]=o[l]+(e[d]/2-n[d]/2);break}}return o}function Dt(t,e){e===void 0&&(e={});var n=e,i=n.placement,s=i===void 0?t.placement:i,r=n.strategy,a=r===void 0?t.strategy:r,c=n.boundary,o=c===void 0?Wi:c,l=n.rootBoundary,d=l===void 0?tn:l,b=n.elementContext,v=b===void 0?At:b,h=n.altBoundary,$=h===void 0?!1:h,u=n.padding,w=u===void 0?0:u,E=ln(typeof w!="number"?w:cn(w,St)),O=v===At?_i:At,L=t.rects.popper,m=t.elements[$?O:v],y=ys(tt(m)?m:m.contextElement||Y(t.elements.popper),o,d,a),x=vt(t.elements.reference),k=pn({reference:x,element:L,strategy:"absolute",placement:s}),T=be(Object.assign({},L,k)),S=v===At?T:x,C={top:y.top-S.top+E.top,bottom:S.bottom-y.bottom+E.bottom,left:y.left-S.left+E.left,right:S.right-y.right+E.right},A=t.modifiersData.offset;if(v===At&&A){var R=A[s];Object.keys(C).forEach(function(I){var nt=[W,N].indexOf(I)>=0?1:-1,it=[M,N].indexOf(I)>=0?"y":"x";C[I]+=R[it]*nt})}return C}function ws(t,e){e===void 0&&(e={});var n=e,i=n.placement,s=n.boundary,r=n.rootBoundary,a=n.padding,c=n.flipVariations,o=n.allowedAutoPlacements,l=o===void 0?nn:o,d=bt(i),b=d?c?en:en.filter(function($){return bt($)===d}):St,v=b.filter(function($){return l.indexOf($)>=0});v.length===0&&(v=b);var h=v.reduce(function($,u){return $[u]=Dt(t,{placement:u,boundary:s,rootBoundary:r,padding:a})[z(u)],$},{});return Object.keys(h).sort(function($,u){return h[$]-h[u]})}function $s(t){if(z(t)===de)return[];var e=Kt(t);return[un(t),e,un(e)]}function Es(t){var e=t.state,n=t.options,i=t.name;if(!e.modifiersData[i]._skip){for(var s=n.mainAxis,r=s===void 0?!0:s,a=n.altAxis,c=a===void 0?!0:a,o=n.fallbackPlacements,l=n.padding,d=n.boundary,b=n.rootBoundary,v=n.altBoundary,h=n.flipVariations,$=h===void 0?!0:h,u=n.allowedAutoPlacements,w=e.options.placement,E=z(w),O=E===w,L=o||(O||!$?[Kt(w)]:$s(w)),m=[w].concat(L).reduce(function(rt,Q){return rt.concat(z(Q)===de?ws(e,{placement:Q,boundary:d,rootBoundary:b,padding:l,flipVariations:$,allowedAutoPlacements:u}):Q)},[]),y=e.rects.reference,x=e.rects.popper,k=new Map,T=!0,S=m[0],C=0;C<m.length;C++){var A=m[C],R=z(A),I=bt(A)===gt,nt=[M,N].indexOf(R)>=0,it=nt?"width":"height",F=Dt(e,{placement:A,boundary:d,rootBoundary:b,altBoundary:v,padding:l}),H=nt?I?W:P:I?N:M;y[it]>x[it]&&(H=Kt(H));var Gt=Kt(H),st=[];if(r&&st.push(F[R]<=0),c&&st.push(F[H]<=0,F[Gt]<=0),st.every(function(rt){return rt})){S=A,T=!1;break}k.set(A,st)}if(T)for(var Qt=$?3:1,$e=function(rt){var Q=m.find(function(Yt){var Ft=k.get(Yt);if(Ft)return Ft.slice(0,rt).every(function(yt){return yt})});if(Q)return S=Q,"break"},qt=Qt;qt>0;qt--){var Zt=$e(qt);if(Zt==="break")break}e.placement!==S&&(e.modifiersData[i]._skip=!0,e.placement=S,e.reset=!0)}}const xs={name:"flip",enabled:!0,phase:"main",fn:Es,requiresIfExists:["offset"],data:{_skip:!1}};function gn(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function mn(t){return[M,W,N,P].some(function(e){return t[e]>=0})}function Os(t){var e=t.state,n=t.name,i=e.rects.reference,s=e.rects.popper,r=e.modifiersData.preventOverflow,a=Dt(e,{elementContext:"reference"}),c=Dt(e,{altBoundary:!0}),o=gn(a,i),l=gn(c,s,r),d=mn(o),b=mn(l);e.modifiersData[n]={referenceClippingOffsets:o,popperEscapeOffsets:l,isReferenceHidden:d,hasPopperEscaped:b},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":b})}const Ls={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Os};function ks(t,e,n){var i=z(t),s=[P,M].indexOf(i)>=0?-1:1,r=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,a=r[0],c=r[1];return a=a||0,c=(c||0)*s,[P,W].indexOf(i)>=0?{x:c,y:a}:{x:a,y:c}}function Ts(t){var e=t.state,n=t.options,i=t.name,s=n.offset,r=s===void 0?[0,0]:s,a=nn.reduce(function(d,b){return d[b]=ks(b,e.rects,r),d},{}),c=a[e.placement],o=c.x,l=c.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=o,e.modifiersData.popperOffsets.y+=l),e.modifiersData[i]=a}const Ss={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Ts};function Cs(t){var e=t.state,n=t.name;e.modifiersData[n]=pn({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const As={name:"popperOffsets",enabled:!0,phase:"read",fn:Cs,data:{}};function Is(t){return t==="x"?"y":"x"}function Ms(t){var e=t.state,n=t.options,i=t.name,s=n.mainAxis,r=s===void 0?!0:s,a=n.altAxis,c=a===void 0?!1:a,o=n.boundary,l=n.rootBoundary,d=n.altBoundary,b=n.padding,v=n.tether,h=v===void 0?!0:v,$=n.tetherOffset,u=$===void 0?0:$,w=Dt(e,{boundary:o,rootBoundary:l,padding:b,altBoundary:d}),E=z(e.placement),O=bt(e.placement),L=!O,m=pe(E),y=Is(m),x=e.modifiersData.popperOffsets,k=e.rects.reference,T=e.rects.popper,S=typeof u=="function"?u(Object.assign({},e.rects,{placement:e.placement})):u,C=typeof S=="number"?{mainAxis:S,altAxis:S}:Object.assign({mainAxis:0,altAxis:0},S),A=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,R={x:0,y:0};if(x){if(r){var I,nt=m==="y"?M:P,it=m==="y"?N:W,F=m==="y"?"height":"width",H=x[m],Gt=H+w[nt],st=H-w[it],Qt=h?-T[F]/2:0,$e=O===gt?k[F]:T[F],qt=O===gt?-T[F]:-k[F],Zt=e.elements.arrow,rt=h&&Zt?fe(Zt):{width:0,height:0},Q=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:an(),Yt=Q[nt],Ft=Q[it],yt=Mt(0,k[F],rt[F]),Ks=L?k[F]/2-Qt-yt-Yt-C.mainAxis:$e-yt-Yt-C.mainAxis,Gs=L?-k[F]/2+Qt+yt+Ft+C.mainAxis:qt+yt+Ft+C.mainAxis,Ee=e.elements.arrow&&It(e.elements.arrow),Qs=Ee?m==="y"?Ee.clientTop||0:Ee.clientLeft||0:0,$n=(I=A==null?void 0:A[m])!=null?I:0,Zs=H+Ks-$n-Qs,Ys=H+Gs-$n,En=Mt(h?Ht(Gt,Zs):Gt,H,h?et(st,Ys):st);x[m]=En,R[m]=En-H}if(c){var xn,Xs=m==="x"?M:P,Us=m==="x"?N:W,ot=x[y],Xt=y==="y"?"height":"width",On=ot+w[Xs],Ln=ot-w[Us],xe=[M,P].indexOf(E)!==-1,kn=(xn=A==null?void 0:A[y])!=null?xn:0,Tn=xe?On:ot-k[Xt]-T[Xt]-kn+C.altAxis,Sn=xe?ot+k[Xt]+T[Xt]-kn-C.altAxis:Ln,Cn=h&&xe?ns(Tn,ot,Sn):Mt(h?Tn:On,ot,h?Sn:Ln);x[y]=Cn,R[y]=Cn-ot}e.modifiersData[i]=R}}const Ps={name:"preventOverflow",enabled:!0,phase:"main",fn:Ms,requiresIfExists:["offset"]};function Ds(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function js(t){return t===q(t)||!_(t)?ge(t):Ds(t)}function qs(t){var e=t.getBoundingClientRect(),n=mt(e.width)/t.offsetWidth||1,i=mt(e.height)/t.offsetHeight||1;return n!==1||i!==1}function Fs(t,e,n){n===void 0&&(n=!1);var i=_(e),s=_(e)&&qs(e),r=Y(e),a=vt(t,s,n),c={scrollLeft:0,scrollTop:0},o={x:0,y:0};return(i||!i&&!n)&&((J(e)!=="body"||ve(r))&&(c=js(e)),_(e)?(o=vt(e,!0),o.x+=e.clientLeft,o.y+=e.clientTop):r&&(o.x=me(r))),{x:a.left+c.scrollLeft-o.x,y:a.top+c.scrollTop-o.y,width:a.width,height:a.height}}function Ns(t){var e=new Map,n=new Set,i=[];t.forEach(function(r){e.set(r.name,r)});function s(r){n.add(r.name);var a=[].concat(r.requires||[],r.requiresIfExists||[]);a.forEach(function(c){if(!n.has(c)){var o=e.get(c);o&&s(o)}}),i.push(r)}return t.forEach(function(r){n.has(r.name)||s(r)}),i}function Ws(t){var e=Ns(t);return Zi.reduce(function(n,i){return n.concat(e.filter(function(s){return s.phase===i}))},[])}function _s(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function Bs(t){var e=t.reduce(function(n,i){var s=n[i.name];return n[i.name]=s?Object.assign({},s,i,{options:Object.assign({},s.options,i.options),data:Object.assign({},s.data,i.data)}):i,n},{});return Object.keys(e).map(function(n){return e[n]})}var vn={placement:"bottom",modifiers:[],strategy:"absolute"};function bn(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some(function(i){return!(i&&typeof i.getBoundingClientRect=="function")})}function Vs(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,i=n===void 0?[]:n,s=e.defaultOptions,r=s===void 0?vn:s;return function(a,c,o){o===void 0&&(o=r);var l={placement:"bottom",orderedModifiers:[],options:Object.assign({},vn,r),modifiersData:{},elements:{reference:a,popper:c},attributes:{},styles:{}},d=[],b=!1,v={state:l,setOptions:function(u){var w=typeof u=="function"?u(l.options):u;$(),l.options=Object.assign({},r,l.options,w),l.scrollParents={reference:tt(a)?Pt(a):a.contextElement?Pt(a.contextElement):[],popper:Pt(c)};var E=Ws(Bs([].concat(i,l.options.modifiers)));return l.orderedModifiers=E.filter(function(O){return O.enabled}),h(),v.update()},forceUpdate:function(){if(!b){var u=l.elements,w=u.reference,E=u.popper;if(bn(w,E)){l.rects={reference:Fs(w,It(E),l.options.strategy==="fixed"),popper:fe(E)},l.reset=!1,l.placement=l.options.placement,l.orderedModifiers.forEach(function(T){return l.modifiersData[T.name]=Object.assign({},T.data)});for(var O=0;O<l.orderedModifiers.length;O++){if(l.reset===!0){l.reset=!1,O=-1;continue}var L=l.orderedModifiers[O],m=L.fn,y=L.options,x=y===void 0?{}:y,k=L.name;typeof m=="function"&&(l=m({state:l,options:x,name:k,instance:v})||l)}}}},update:_s(function(){return new Promise(function(u){v.forceUpdate(),u(l)})}),destroy:function(){$(),b=!0}};if(!bn(a,c))return v;v.setOptions(o).then(function(u){!b&&o.onFirstUpdate&&o.onFirstUpdate(u)});function h(){l.orderedModifiers.forEach(function(u){var w=u.name,E=u.options,O=E===void 0?{}:E,L=u.effect;if(typeof L=="function"){var m=L({state:l,name:w,instance:v,options:O}),y=function(){};d.push(m||y)}})}function $(){d.forEach(function(u){return u()}),d=[]}return v}}var Rs=[hs,As,ds,Ui,Ss,xs,Ps,os,Ls],Hs=Vs({defaultModifiers:Rs});async function ye(t){const e=this.collection.findIndex(n=>n.id===t.id);if(e>=0){const n=this.collection[e];n.state==="opened"&&n.close(),n.popper.destroy(),yn(n),Object.getOwnPropertyNames(n).forEach(i=>{delete n[i]}),this.collection.splice(e,1)}return this.collection}function yn(t){return t.__eventListeners&&(t.__eventListeners.forEach(e=>{e.el.forEach(n=>{e.type.forEach(i=>{t[n].removeEventListener(i,e.listener,!1)})})}),delete t.__eventListeners),t}async function we(t){const e=Ze.call(this,t);return e.el.classList.add(this.settings.stateActive),e.trigger.hasAttribute("aria-controls")&&e.trigger.setAttribute("aria-expanded","true"),e.config=Qe(e.el,this.settings),e.popper.setOptions({placement:e.config.placement,modifiers:[{name:"eventListeners",enabled:!0},...Di(e.config)]}),e.popper.update(),e.state="opened",e}async function Js(t,e){ye.call(this,t);const n=this,i={id:t.id,state:"closed",el:t,trigger:e,popper:Hs(e,t),config:Qe(t,this.settings),open(){return we.call(n,this)},close(){return ce.call(n,this)},deregister(){return ye.call(n,this)}};return i.trigger.hasAttribute("aria-controls")&&i.trigger.setAttribute("aria-expanded","false"),wn.call(this,i),this.collection.push(i),i.el.classList.contains(this.settings.stateActive)&&(await i.open(),Ue.call(this,i)),i}function wn(t){return t.__eventListeners||(t.config.event==="hover"?(t.__eventListeners=[{el:["trigger"],type:["mouseenter","focus"],listener:we.bind(this,t)},{el:["el","trigger"],type:["mouseleave","focusout"],listener:Xe.bind(this,t)}],t.__eventListeners.forEach(e=>{e.el.forEach(n=>{e.type.forEach(i=>{t[n].addEventListener(i,e.listener,!1)})})})):(t.__eventListeners=[{el:["trigger"],type:["click"],listener:Fi.bind(this,t)}],t.__eventListeners.forEach(e=>{e.el.forEach(n=>{e.type.forEach(i=>{t[n].addEventListener(i,e.listener,!1)})})}))),t}var jt;class zs extends Ii{constructor(e){super(),Ci(this,jt),this.defaults=Pi,this.settings={...this.defaults,...e},this.trigger=null,Ai(this,jt,Ni.bind(this)),this.settings.autoMount&&this.mount()}async mount(e){e&&(this.settings={...this.settings,...e});const n=document.querySelectorAll(this.settings.selectorPopover);return await this.registerCollection(n),this.settings.eventListeners&&this.mountEventListeners(!1),this}async unmount(){return this.trigger=null,await this.deregisterCollection(),this.settings.eventListeners&&this.unmountEventListeners(!1),this}mountEventListeners(e=!0){e&&this.collection.forEach(n=>{wn.call(this,n)}),document.addEventListener("keydown",Ge(this,jt),!1)}unmountEventListeners(e=!0){e&&this.collection.forEach(n=>{yn(n)}),document.removeEventListener("keydown",Ge(this,jt),!1)}register(e){const n=qi.call(this,e);return n.error?Promise.reject(n.error):Js.call(this,n.popover,n.trigger)}deregister(e){let n=this.get(e.id||e);return n?ye.call(this,n):Promise.reject(new Error(`Failed to deregister; popover does not exist in collection with ID of: "${e.id||e}".`))}open(e){return we.call(this,e)}close(e){return ce.call(this,e)}}jt=new WeakMap,K.Drawer=ui,K.Modal=Si,K.Popover=zs,K.core=Rn,Object.defineProperty(K,Symbol.toStringTag,{value:"Module"})});
|
|
10
10
|
//# sourceMappingURL=index.umd.cjs.map
|