vrembem 4.0.0-next.32 → 4.0.0-next.34

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.
@@ -1,10 +1,10 @@
1
- (function(D,x){typeof exports=="object"&&typeof module<"u"?x(exports):typeof define=="function"&&define.amd?define(["exports"],x):(D=typeof globalThis<"u"?globalThis:D||self,x(D.vrembem={}))})(this,function(D){"use strict";const x=":not([inert])",C=':not([tabindex^="-"])',at=":not(:disabled)",Vt=[`a[href]${x}${C}`,`area[href]${x}${C}`,`input:not([type="hidden"]):not([type="radio"])${x}${C}${at}`,`input[type="radio"]${x}${C}${at}`,`select${x}${C}${at}`,`textarea${x}${C}${at}`,`button${x}${C}${at}`,`details${x} > summary:first-of-type${C}`,`iframe${x}${C}`,`audio[controls]${x}${C}`,`video[controls]${x}${C}`,`[contenteditable]${x}${C}`,`[tabindex]${x}${C}`];function _t(t,e="config"){const n=(t.getAttribute(`data-${e}`)||"").replace(/'/g,'"');return n?JSON.parse(n):{}}function St(t){if(typeof t=="string"){const e=document.getElementById(t);if(e)return e;throw new Error(`Element not found with ID: "${t}"`)}else if(t instanceof HTMLElement){if(!t.id)throw new Error("HTMLElement must have an ID");return t}else throw new Error("Invalid argument: query must be a string or HTMLElement")}async function j(t,e,...n){e in t&&typeof t[e]=="function"&&await t[e](...n)}function Wt(t,e,n){if(typeof e=="string"){const r=document.querySelector(e);if(!r)throw new Error(`No teleport reference found for selector: ${e}`);e=r}else if(!(e instanceof HTMLElement))throw new Error(`Not a valid teleport reference: '${e}'`);if(typeof e[n]!="function")throw new Error(`Not a valid teleport method: '${n}'`);let s=document.createComment("teleported #"+t.id);return t.before(s),e[n](t),()=>{s&&(s.after(t),s.remove(),s=null)}}function Qt(t){return t.split("-").map((e,n)=>n===0?e:e.charAt(0).toUpperCase()+e.slice(1)).join("")}function Ct(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Jt(t){if(typeof t=="number")return t;const e=parseFloat(t);if(!Number.isNaN(e)){const n=t.includes("ms");return e*(n?1:1e3)}throw new Error(`Could not convert value to milliseconds: ${t}`)}function ze(t,e,n,s,r=0){return new Promise(i=>{t.classList.remove(e),t.classList.add(n),setTimeout(()=>{t.classList.add(s),t.classList.remove(n),i(t)},Jt(r))})}function Zt(t,e={}){const n={fallback:null,element:document.body,...e};if(!t.startsWith("--")){const r=pt();r&&(t=`${r}${t}`),t=`--${t}`}const s=getComputedStyle(n.element).getPropertyValue(t).trim();if(s)return s;if(n.fallback)return n.fallback;throw new Error(`CSS variable "${t}" was not found!`)}async function M(t,e,n){await j(e,t,n),n&&await j(n,t);for(const s of e.plugins)await j(s,t,{plugin:s,parent:e,entry:n});await e.emit(t,n)}function Kt(t){const e=getComputedStyle(t.el),n={},s=t.getSetting("customProps");for(let r=0;r<s.length;r++){const i=pt(),o=t.parent.module.toLowerCase(),a=Ct(s[r]),l=e.getPropertyValue(`--${i}${o}-${a}`).trim();l&&(n[a]=l)}return n}function pt(){return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim()}function Be(t,e,n="camel"){return e=n==="camel"?Qt(e):Ct(e),t.split(".").concat(e).reduce((s,r)=>s?.[r],this)}function Yt(t,e={}){const{fallback:n,props:s=["dataConfig","customProps","settings","parent.settings"]}=e;for(const r of s){const i=r!=="customProps"?"camel":"kebab",o=Be.call(this,r,t,i);if(o!==void 0)return o}if(n!==void 0)return n;throw new Error(`${this.parent.module} setting does not exist: ${t}`)}function Ve(t,e){e&&document.querySelectorAll(e).forEach(n=>{t?n.style.overflow="hidden":n.style.removeProperty("overflow")})}function _e(t,e){e&&document.querySelectorAll(e).forEach(n=>{t?(n.inert=!0,n.setAttribute("aria-hidden","true")):(n.inert=!1,n.removeAttribute("aria-hidden"))})}function We(t,e,n){_e(!!t,e),Ve(!!t,n)}const Gt={events:{},on(t,e,...n){this.events[t]||(this.events[t]=[]),this.events[t].some(s=>s.listener===e)||this.events[t].push({listener:e,args:n})},off(t,e){this.events[t]&&(this.events[t]=this.events[t].filter(n=>n.listener!==e))},async emit(t,e){if(t=t.startsWith("on")?t.slice(2,3).toLowerCase()+t.slice(3):t,!!this.events[t])for(const{listener:n,args:s}of this.events[t])await n(e,...s)}};let Xt=class extends Array{constructor(e=null){super(),this.el=e,this.el&&this.set()}get first(){return this[0]}get last(){return this[this.length-1]}set(e=this.el){this.length=0,e&&this.push(...e.querySelectorAll(Vt.join(",")))}clear(){this.length=0}},te=class{constructor(e=null){this.el=e,this.focusable=new Xt,this.handleFocusTrap=Qe.bind(this)}on(e=this.el){this.focusable.set(e),this.focusable.length?document.addEventListener("keydown",this.handleFocusTrap):document.addEventListener("keydown",ee)}off(){this.focusable.clear(),document.removeEventListener("keydown",this.handleFocusTrap),document.removeEventListener("keydown",ee)}};function ee(t){(t.key==="Tab"||t.keyCode===9)&&t.preventDefault()}function Qe(t){if(t.key!=="Tab"&&t.keyCode!==9)return;const{activeElement:e}=document,{el:n,focusable:s}=this,r=t.shiftKey,i=e===s.first||e===n,o=e===s.last||e===n;if(r&&i||!r&&o){t.preventDefault();const a=r?s.last:s.first;a&&typeof a.focus=="function"&&a.focus()}}function At(t,e=!0){const n=localStorage.getItem(t),s=n?JSON.parse(n):{};return{get(r,i){return r?r in s?s[r]:i:s},set(r,i){return i?s[r]=i:delete s[r],e&&localStorage.setItem(t,JSON.stringify(s)),s}}}let ne=class extends Array{constructor(e={}){super(),this.presets=e}applySettings(e){const n=e?.defaults||{},s=this.presets?.[e.name]||{},r=e?.options||{};e.settings={...n,...s,...r}}validate(e){return!("name"in e)||typeof e.name!="string"?(console.error("Plugin requires a name!"),!1):!0}get(e){return this.find(n=>n.name===e)}add(e){if(Array.isArray(e))e.forEach(n=>this.add(n));else if(this.applySettings(e),this.validate(e)){const n=this.findIndex(s=>s.name===e.name);~n?this[n]=e:this.push(e)}}remove(e){const n=this.findIndex(s=>s.name===e);~n&&this.splice(n,1)}};class Je extends Array{constructor(e={}){super(),this.settings=e}get copy(){return[...this]}get top(){return this[this.length-1]||null}updateIndex(){this.forEach((e,n)=>{e.el.style.zIndex="";const s=getComputedStyle(e.el)["z-index"];e.el.style.zIndex=String(parseInt(s,10)+n+1)})}onChange(){this.updateIndex(),typeof this.settings.onChange=="function"&&this.settings.onChange()}add(e){this.push(e),this.onChange()}remove(e){const n=this.findIndex(s=>s.id===e.id);~n&&(e.el.style.zIndex="",this.splice(n,1),this.onChange())}moveToTop(e){const n=this.findIndex(s=>s.id===e.id);~n&&(this.splice(n,1),this.add(e))}}const Ze={condition:!0},Ke={primary:"hsl(152deg 60% 50%)",secondary:"hsl(214deg 50% 50%)",neutral:"hsl(214deg 20% 50%)",important:"hsl(0deg 80% 50%)"};function Ye(t={}){const e={name:"debug",defaults:Ze,options:t};function n(i,o=[],a=["primary","secondary"]){const l=a.map(c=>`color: ${Ke[c]}`);console.log(`%c📡 DEBUG: %c${i}`,...l,...o)}function s(i,...o){return typeof i=="function"?i(...o):i}const r={beforeMountRef:n.bind(null,"Event > beforeMount()"),afterMountRef:n.bind(null,"Event > afterMount()"),beforeUnmountRef:n.bind(null,"Event > beforeUnmount()",[],["important","neutral"]),afterUnmountRef:n.bind(null,"Event > afterUnmount()",[],["important","neutral"]),createEntryRef:(i,{parent:o,plugin:a})=>{if(s(a.settings.condition,i)){const l=o.collection.length;n(`Event > createEntry() > [${l}] #${i.id}`)}},registerEntryRef:(i,{parent:o,plugin:a})=>{if(s(a.settings.condition,i)){const l=o.collection.length;n(`Event > registerEntry() > [${l}] #${i.id}`)}},destroyEntryRef:(i,{parent:o,plugin:a})=>{if(s(a.settings.condition,i)){const l=o.collection.length;n(`Event > destroyEntry() > [${l}] #${i.id}`,[],["important","neutral"])}},deregisterEntryRef:(i,{parent:o,plugin:a})=>{if(s(a.settings.condition,i)){const l=o.collection.length;n(`Event > deregisterEntry() > [${l}]`,[],["important","neutral"])}}};return{...e,setup({parent:i}){n("Plugin > setup()",Array.from(arguments),["secondary","neutral"]),i.on("beforeMount",r.beforeMountRef),i.on("createEntry",r.createEntryRef,{parent:i,plugin:this}),i.on("registerEntry",r.registerEntryRef,{parent:i,plugin:this}),i.on("afterMount",r.afterMountRef),i.on("beforeUnmount",r.beforeUnmountRef),i.on("destroyEntry",r.destroyEntryRef,{parent:i,plugin:this}),i.on("deregisterEntry",r.deregisterEntryRef,{parent:i,plugin:this}),i.on("afterUnmount",r.afterUnmountRef)},teardown({parent:i}){n("Plugin > teardown()",Array.from(arguments),["secondary","neutral"]),i.off("beforeMount",r.beforeMountRef),i.off("createEntry",r.createEntryRef),i.off("registerEntry",r.registerEntryRef),i.off("afterMount",r.afterMountRef),i.off("beforeUnmount",r.beforeUnmountRef),i.off("destroyEntry",r.destroyEntryRef),i.off("deregisterEntry",r.deregisterEntryRef),i.off("afterUnmount",r.afterUnmountRef)},beforeMount(){n("Hook > beforeMount()",Array.from(arguments))},onCreateEntry({parent:i,entry:o}){if(s(this.settings.condition,o)){const a=i.collection.length;n(`Hook > onCreateEntry() > [${a}] #${o.id}`,Array.from(arguments))}},onRegisterEntry({parent:i,entry:o}){if(s(this.settings.condition,o)){const a=i.collection.length-1;n(`Hook > onRegisterEntry() > [${a}] #${o.id}`,Array.from(arguments))}},afterMount(){n("Hook > afterMount()",Array.from(arguments))},beforeUnmount(){n("Hook > beforeUnmount()",Array.from(arguments),["important","neutral"])},onDestroyEntry({parent:i,entry:o}){if(s(this.settings.condition,o)){const a=i.collection.length-1;n(`Hook > onDestroyEntry() > [${a}] #${o.id}`,Array.from(arguments),["important","neutral"])}},onDeregisterEntry({parent:i,entry:o}){if(s(this.settings.condition,o)){const a=i.collection.length;n(`Hook > onDeregisterEntry() > [${a}]`,Array.from(arguments),["important","neutral"])}},afterUnmount(){n("Hook > afterUnmount()",Array.from(arguments),["important","neutral"])}}}const Ge={condition:!0};function Xe(t={}){const e={name:"focusTrap",defaults:Ge,options:t},n={setup({parent:o}){o.on("opened",r,this),o.on("closed",i,this)},teardown({parent:o}){o.off("opened",r),o.off("closed",i)},onCreateEntry({entry:o}){o.focusTrap=new te}};function s(o,...a){return typeof o=="function"?o(...a):o}function r(o,a){const l={plugin:a,parent:o.parent,entry:o};s(a.settings.condition,l)&&o.focusTrap?.on(o.dialog)}function i(o,a){const l={plugin:a,parent:o.parent,entry:o};s(a.settings.condition,l)&&o.focusTrap?.off()}return{...e,...n}}const tn={dataBreakpoint:"breakpoint",dataMediaQuery:"media-query",token:"{{BP}}",breakpoint:null,mediaQuery:"(min-width: {{BP}})",breakpoints:{},mediaQueries:{},onChange:()=>{}};function en(t={}){const e={name:"mediaQuery",defaults:tn,options:t},n={onCreateEntry({entry:a}){i.call(this,a)},onDestroyEntry({entry:a}){o(a)}};function s(a){const l=a.el.getAttribute(`data-${this.settings.dataMediaQuery}`);return!l&&a.id in this.settings.mediaQueries?this.settings.mediaQueries[a.id]:l||void 0}function r(a){let l=a.el.getAttribute(`data-${this.settings.dataBreakpoint}`);return!l&&a.id in this.settings.breakpoints&&(l=this.settings.breakpoints[a.id]),l&&l in this.settings.breakpoints&&(l=this.settings.breakpoints[l]),l&&(l=getComputedStyle(document.body).getPropertyValue(`--${pt()}breakpoint-${l}`).trim()||l),l||this.settings.breakpoint}function i(a){let l=s.call(this,a);const c=r.call(this,a);if(!c&&!l)return;c&&!l&&(l=this.settings.mediaQuery);const h=l.replace(new RegExp(`${this.settings.token}`,"g"),c);a.mql=window.matchMedia(h),a.mql.onchange=f=>{this.settings.onChange(f,a)},this.settings.onChange(a.mql,a)}function o(a){a.mql&&(a.mql.onchange=null,a.mql=null)}return{...e,...n}}const nn={prop:"state",value:null,keyPrefix:"VB:",key:null,condition:!1,onChange(){}};function sn(t={}){const e={name:"propStore",defaults:nn,options:t,store:null},n={setup({parent:a}){this.store=At(o.call(this,a.module))},async onCreateEntry({entry:a}){await s.call(this,a)},onDestroyEntry({entry:a}){i.call(this,a)}};async function s(a){let l=a[this.settings.prop]||null;const c={plugin:this,parent:a.parent,entry:a};Object.defineProperty(a,this.settings.prop,{configurable:!0,get(){return l},set:async h=>{if(l===h)return;const f=l;l=h,r(this.settings.condition,c,h,f)&&this.store.set(a.id,h),await this.settings.onChange(c,h,f)}}),Object.defineProperty(a,"store",{configurable:!0,get:()=>this.store.get(a.id),set:h=>{a[this.settings.prop]=h}}),a[this.settings.prop]=await r(this.settings.value,c)||a[this.settings.prop]}function r(a,...l){return typeof a=="function"?a(...l):a}async function i(a){const l=a[this.settings.prop];delete a[this.settings.prop],a[this.settings.prop]=l,this.store.set(a.id,null)}function o(a){const l=this.settings.prop.charAt(0).toUpperCase()+this.settings.prop.slice(1),c=this.settings.key||a+l;return this.settings.keyPrefix+c}return{...e,...n}}const rn={where:null,how:"append"};function on(t={}){const e={name:"teleport",defaults:rn,options:t},n={onCreateEntry({plugin:i,entry:o}){s(i,o)},onDestroyEntry({plugin:i,entry:o}){r(i,o)}};function s(i,o){o.teleport=()=>{typeof o.teleportReturn=="function"&&o.teleportReturn(),o.teleportReturn=Wt(o.el,o.getSetting("teleport",{fallback:i.settings.where}),o.getSetting("teleportMethod",{fallback:i.settings.how}))},o.teleport(),o.parent.emit("teleport",{plugin:i,parent:o.parent,entry:o})}function r(i,o){typeof o.teleportReturn=="function"&&o.teleportReturn(),o.parent.emit("teleportReturn",{plugin:i,parent:o.parent,entry:o})}return{...e,...n}}const an={dataConfig:"config",customProps:[]};let se=class{constructor(e,n,s={}){this.parent=e,this.el=St(n),this.settings={...s},this.dataConfig={},this.customProps={}}get id(){return this.el.id}applySettings(e){return Object.assign(this.settings,e)}getSetting(e,n){return Yt.call(this,e,n)}buildDataConfig(){return Object.assign(this.dataConfig,_t(this.el,this.getSetting("dataConfig")))}buildCustomProps(){return Object.assign(this.customProps,Kt(this))}async init(e={}){this.applySettings(e),this.buildDataConfig(),this.buildCustomProps()}async destroy(){Object.getOwnPropertyNames(this).forEach(e=>{delete this[e]})}},ln=class{constructor(e={}){this.module=this.constructor.name,this.collection=[],this.entryClass=se,this.settings={...an,...e},this.plugins=new ne(this.settings.presets),this.events={},Object.assign(this,Gt)}get(e,n="id"){return this.collection.find(s=>s[n]===e)}applySettings(e){return Object.assign(this.settings,e)}async createEntry(e,n){const s=new this.entryClass(this,e,n);return await j(s,"init"),await M("onCreateEntry",this,s),s}async destroyEntry(e){return await M("onDestroyEntry",this,e),await j(e,"destroy"),e}async register(e,n={}){const s=St(e),r=this.collection.findIndex(i=>i.id===s.id);if(~r){const i=this.collection[r];return i.el=s,typeof i.init=="function"&&await i.init(n),i}else{const i=await this.createEntry(s,n);return this.collection.push(i),await M("onRegisterEntry",this,i),i}}async deregister(e){const n=this.collection.findIndex(s=>s.id===e);if(~n){const s=await this.destroyEntry(this.collection[n]);return await M("onDeregisterEntry",this,this.collection[n]),this.collection.splice(n,1),s}return null}async mount(e={}){this.applySettings(e);for(const s of this.settings?.plugins||[])this.plugins.add(s);for(const s of this.plugins)await j(s,"setup",{plugin:s,parent:this});await M("beforeMount",this);const n=document.querySelectorAll(this.settings.selector);for(const s of n)await this.register(s);return await M("afterMount",this),this}async unmount(){for(await M("beforeUnmount",this);this.collection.length>0;)await this.deregister(this.collection[0].id);await M("afterUnmount",this);for(const e of this.plugins)await j(e,"teardown",{plugin:e,parent:this});for(const e of[...this.plugins])this.plugins.remove(e.name);return this}};function cn(t={}){const e={prefix:Zt("prefix-themes",{fallback:"vb-theme-"}),themes:["root","light","dark"],storeKey:"VB:Profile"};for(const[i]of Object.entries(e))t&&t[i]&&(e[i]=t[i]);const n={onInit(){},onChange(){}};for(const[i]of Object.entries(n))t&&t[i]&&(n[i]=t[i]);const s=At(e.storeKey),r={settings:e,add(i){e.themes.push(i)},remove(i){const o=e.themes.indexOf(i);~o&&e.themes.splice(o,1)},callback(i){n[i].call(this)},get class(){return`${e.prefix}${this.theme}`},get classes(){return e.themes.map(i=>`${e.prefix}${i}`)},get themes(){return e.themes},get theme(){return s.get("theme")||"root"},set theme(i){e.themes.includes(i)?this.theme!=i&&(s.set("theme",i),document.documentElement.classList.remove(...this.classes),document.documentElement.classList.add(`${e.prefix}${i}`),this.callback("onChange")):console.error(`Not a valid theme value: "${i}"`)}};return r.callback("onInit"),r}const un=Object.freeze(Object.defineProperty({__proto__:null,Collection:ln,CollectionEntry:se,FocusTrap:te,FocusableArray:Xt,PluginsArray:ne,StackArray:Je,cssVar:Zt,debug:Ye,dispatchLifecycleHook:M,eventEmitter:Gt,focusTrap:Xe,focusableSelectors:Vt,getCustomProps:Kt,getDataConfig:_t,getElement:St,getPrefix:pt,getSetting:Yt,localStore:At,maybeRunMethod:j,mediaQuery:en,propStore:sn,setGlobalState:We,teleport:on,teleportElement:Wt,themeStore:cn,toCamel:Qt,toKebab:Ct,toMilliseconds:Jt,transition:ze},Symbol.toStringTag,{value:"Module"}));function fn(t,e="config"){const n=(t.getAttribute(`data-${e}`)||"").replace(/'/g,'"');return n?JSON.parse(n):{}}function ie(t){if(typeof t=="string"){const e=document.getElementById(t);if(e)return e;throw new Error(`Element not found with ID: "${t}"`)}else if(t instanceof HTMLElement){if(!t.id)throw new Error("HTMLElement must have an ID");return t}else throw new Error("Invalid argument: query must be a string or HTMLElement")}async function W(t,e,...n){e in t&&typeof t[e]=="function"&&await t[e](...n)}function hn(t){return t.split("-").map((e,n)=>n===0?e:e.charAt(0).toUpperCase()+e.slice(1)).join("")}function re(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function dn(t){if(typeof t=="number")return t;const e=parseFloat(t);if(!Number.isNaN(e)){const n=t.includes("ms");return e*(n?1:1e3)}throw new Error(`Could not convert value to milliseconds: ${t}`)}function oe(t,e,n,s,r=0){return new Promise(i=>{t.classList.remove(e),t.classList.add(n),setTimeout(()=>{t.classList.add(s),t.classList.remove(n),i(t)},dn(r))})}async function N(t,e,n){await W(e,t,n),n&&await W(n,t);for(const s of e.plugins)await W(s,t,{plugin:s,parent:e,entry:n});await e.emit(t,n)}function gn(t){const e=getComputedStyle(t.el),n={},s=t.getSetting("customProps");for(let r=0;r<s.length;r++){const i=pn(),o=t.parent.module.toLowerCase(),a=re(s[r]),l=e.getPropertyValue(`--${i}${o}-${a}`).trim();l&&(n[a]=l)}return n}function pn(){return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim()}function mn(t,e,n="camel"){return e=n==="camel"?hn(e):re(e),t.split(".").concat(e).reduce((s,r)=>s?.[r],this)}function yn(t,e={}){const{fallback:n,props:s=["dataConfig","customProps","settings","parent.settings"]}=e;for(const r of s){const i=r!=="customProps"?"camel":"kebab",o=mn.call(this,r,t,i);if(o!==void 0)return o}if(n!==void 0)return n;throw new Error(`${this.parent.module} setting does not exist: ${t}`)}function wn(t,e){e&&document.querySelectorAll(e).forEach(n=>{t?n.style.overflow="hidden":n.style.removeProperty("overflow")})}function vn(t,e){e&&document.querySelectorAll(e).forEach(n=>{t?(n.inert=!0,n.setAttribute("aria-hidden","true")):(n.inert=!1,n.removeAttribute("aria-hidden"))})}function Lt(t,e,n){vn(!!t,e),wn(!!t,n)}const bn={events:{},on(t,e,...n){this.events[t]||(this.events[t]=[]),this.events[t].some(s=>s.listener===e)||this.events[t].push({listener:e,args:n})},off(t,e){this.events[t]&&(this.events[t]=this.events[t].filter(n=>n.listener!==e))},async emit(t,e){if(t=t.startsWith("on")?t.slice(2,3).toLowerCase()+t.slice(3):t,!!this.events[t])for(const{listener:n,args:s}of this.events[t])await n(e,...s)}};let En=class extends Array{constructor(e={}){super(),this.presets=e}applySettings(e){const n=e?.defaults||{},s=this.presets?.[e.name]||{},r=e?.options||{};e.settings={...n,...s,...r}}validate(e){return!("name"in e)||typeof e.name!="string"?(console.error("Plugin requires a name!"),!1):!0}get(e){return this.find(n=>n.name===e)}add(e){if(Array.isArray(e))e.forEach(n=>this.add(n));else if(this.applySettings(e),this.validate(e)){const n=this.findIndex(s=>s.name===e.name);~n?this[n]=e:this.push(e)}}remove(e){const n=this.findIndex(s=>s.name===e);~n&&this.splice(n,1)}};const xn={dataConfig:"config",customProps:[]};let ae=class{constructor(e,n,s={}){this.parent=e,this.el=ie(n),this.settings={...s},this.dataConfig={},this.customProps={}}get id(){return this.el.id}applySettings(e){return Object.assign(this.settings,e)}getSetting(e,n){return yn.call(this,e,n)}buildDataConfig(){return Object.assign(this.dataConfig,fn(this.el,this.getSetting("dataConfig")))}buildCustomProps(){return Object.assign(this.customProps,gn(this))}async init(e={}){this.applySettings(e),this.buildDataConfig(),this.buildCustomProps()}async destroy(){Object.getOwnPropertyNames(this).forEach(e=>{delete this[e]})}},$n=class{constructor(e={}){this.module=this.constructor.name,this.collection=[],this.entryClass=ae,this.settings={...xn,...e},this.plugins=new En(this.settings.presets),this.events={},Object.assign(this,bn)}get(e,n="id"){return this.collection.find(s=>s[n]===e)}applySettings(e){return Object.assign(this.settings,e)}async createEntry(e,n){const s=new this.entryClass(this,e,n);return await W(s,"init"),await N("onCreateEntry",this,s),s}async destroyEntry(e){return await N("onDestroyEntry",this,e),await W(e,"destroy"),e}async register(e,n={}){const s=ie(e),r=this.collection.findIndex(i=>i.id===s.id);if(~r){const i=this.collection[r];return i.el=s,typeof i.init=="function"&&await i.init(n),i}else{const i=await this.createEntry(s,n);return this.collection.push(i),await N("onRegisterEntry",this,i),i}}async deregister(e){const n=this.collection.findIndex(s=>s.id===e);if(~n){const s=await this.destroyEntry(this.collection[n]);return await N("onDeregisterEntry",this,this.collection[n]),this.collection.splice(n,1),s}return null}async mount(e={}){this.applySettings(e);for(const s of this.settings?.plugins||[])this.plugins.add(s);for(const s of this.plugins)await W(s,"setup",{plugin:s,parent:this});await N("beforeMount",this);const n=document.querySelectorAll(this.settings.selector);for(const s of n)await this.register(s);return await N("afterMount",this),this}async unmount(){for(await N("beforeUnmount",this);this.collection.length>0;)await this.deregister(this.collection[0].id);await N("afterUnmount",this);for(const e of this.plugins)await W(e,"teardown",{plugin:e,parent:this});for(const e of[...this.plugins])this.plugins.remove(e.name);return this}};const Sn={focusTrap:{condition:({entry:t})=>t.state==="closed"||t.state==="opened"&&t.mode==="modal"},mediaQuery:{onChange(t,e){e.mode=t.matches?"inline":"modal"}},propStore:{prop:"inlineState",value:({entry:t})=>t.store,condition:({entry:t})=>["opened","closed","indeterminate"].includes(t.state),onChange:({entry:t})=>t.applyState()}},Cn={presets:Sn,dataOpen:"drawer-open",dataClose:"drawer-close",dataToggle:"drawer-toggle",selector:".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",customProps:["transition-duration"],breakpoints:null,customEventPrefix:"drawer:",setTabindex:!0,transition:!0,transitionDuration:300};function An(t){switch(t.mode){case"inline":return Ln(t);case"modal":return Pn(t);default:throw new Error(`"${t.mode}" is not a valid drawer mode.`)}}async function Ln(t){return t.el.classList.remove(t.getSetting("classModal")),t.dialog.removeAttribute("aria-modal"),Lt(!1,t.getSetting("selectorInert"),t.getSetting("selectorOverflow")),t.applyState(),t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:t.parent,bubbles:!0})),await t.parent.emit("switchMode",t),t}async function Pn(t){return t.el.classList.add(t.getSetting("classModal")),t.dialog.setAttribute("aria-modal","true"),await t.close(!1,!1),t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:t.parent,bubbles:!0})),await t.parent.emit("switchMode",t),t}function le(t){t.dialog&&t.state==="opened"?(t.dialog.querySelector(t.parent.settings.selectorFocus)||t.dialog).focus():t.trigger&&(t.trigger.focus(),t.trigger=null)}async function Pt(t,e,n=!0){return(t.state==="closed"||t.state==="indeterminate"||t.state===null)&&(t.setState("opening"),e??t.getSetting("transition")?await oe(t.el,t.getSetting("stateClosed"),t.getSetting("stateOpening"),t.getSetting("stateOpened"),t.getSetting("transitionDuration")):(t.el.classList.add(t.getSetting("stateOpened")),t.el.classList.remove(t.getSetting("stateClosed"))),t.setState("opened"),t.mode==="modal"&&Lt(!0,t.getSetting("selectorInert"),t.getSetting("selectorOverflow")),n&&le(t),t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"opened",{detail:t.parent,bubbles:!0})),await t.parent.emit("opened",t)),t}async function kt(t,e,n=!0){return(t.state==="opened"||t.state==="indeterminate"||t.state===null)&&(t.setState("closing"),document.activeElement&&document.activeElement instanceof HTMLElement&&document.activeElement.blur(),e??t.getSetting("transition")?await oe(t.el,t.getSetting("stateOpened"),t.getSetting("stateClosing"),t.getSetting("stateClosed"),t.getSetting("transitionDuration")):(t.el.classList.add(t.getSetting("stateClosed")),t.el.classList.remove(t.getSetting("stateOpened"))),t.setState("closed"),t.mode==="modal"&&Lt(!1,t.getSetting("selectorInert"),t.getSetting("selectorOverflow")),n&&le(t),t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"closed",{detail:t.parent,bubbles:!0})),await t.parent.emit("closed",t)),t}async function ce(t,e,n){return t.state==="closed"?Pt(t,e,n):kt(t,e,n)}class kn extends ae{#t;constructor(e,n,s={}){super(e,n,s),this.#t="indeterminate",this.dialog=this.el.querySelector(this.getSetting("selectorDialog"))||this.el,this.trigger=null,this.state=null,this.inlineState=null}get mode(){return this.#t}set mode(e){this.#t!==e&&(this.#t=e,An(this))}setState(e){this.state=e;const n=["opening","closing"];this.mode==="inline"&&!n.includes(e)&&(this.inlineState=e),e==="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")))}async applyState(){if(this.mode==="modal")return this;if(this.inlineState==="opened")return await this.open(!1,!1);if(this.inlineState==="closed")return await this.close(!1,!1);if(this.state===null){if(this.el.classList.contains(this.getSetting("stateOpened")))return await this.open(!1,!1);if(this.el.classList.contains(this.getSetting("stateClosed")))return await this.close(!1,!1)}return this.setState("indeterminate"),this}async open(e,n){return Pt(this,e,n)}async close(e,n){return kt(this,e,n)}async toggle(e,n){return ce(this,e,n)}async deregister(){return this.parent.deregister(this.id)}async onCreateEntry(){this.getSetting("setTabindex")&&this.dialog&&this.dialog.setAttribute("tabindex","-1"),await this.applyState(),this.inlineState=this.state,this.mode=this.el&&this.el.classList.contains(this.getSetting("classModal"))?"modal":"inline"}async onDestroyEntry(){this.mode==="modal"&&this.state==="opened"&&await this.close(!1)}}function nt(t){const e=this.get(t);if(e)return e;throw new Error(`Drawer not found in collection with id of "${t}"`)}async function Tn(t){const e=t.target;if(e){const n=e.closest(`
2
- [data-${this.settings.dataOpen}],
3
- [data-${this.settings.dataToggle}],
4
- [data-${this.settings.dataClose}]
5
- `);if(n){t.preventDefault(),n.matches(`[data-${this.settings.dataToggle}]`)&&n.getAttribute(`data-${this.settings.dataToggle}`)?.trim().split(" ")?.forEach(s=>{const r=nt.call(this,s);return r.trigger=n,r.toggle()}),n.matches(`[data-${this.settings.dataOpen}]`)&&n.getAttribute(`data-${this.settings.dataOpen}`)?.trim().split(" ")?.forEach(s=>{const r=nt.call(this,s);return r.trigger=n,r.open()}),n.matches(`[data-${this.settings.dataClose}]`)&&n.getAttribute(`data-${this.settings.dataClose}`)?.trim().split(" ")?.forEach(s=>{if(s){const r=nt.call(this,s);return r.trigger=n,r.close()}else{const r=e.closest(this.settings.selector);if(r)return this.close(r.id)}});return}if(this.activeModal&&e.matches(this.settings.selectorScreen))return this.close(this.activeModal.id)}}function On(t){if(t.key==="Escape"&&this.activeModal)return this.close(this.activeModal.id)}let Rn=class extends $n{#t;#e;constructor(e){super({...Cn,...e}),this.module="Drawer",this.entryClass=kn,this.#t=Tn.bind(this),this.#e=On.bind(this)}get activeModal(){return this.collection.find(e=>e.state==="opened"&&e.mode==="modal")}async open(e,n,s){const r=nt.call(this,e);return Pt(r,n,s)}async close(e,n,s){const r=nt.call(this,e);return kt(r,n,s)}async toggle(e,n,s){const r=nt.call(this,e);return ce(r,n,s)}async afterMount(){document.addEventListener("click",this.#t,!1),document.addEventListener("keydown",this.#e,!1)}async afterUnmount(){document.removeEventListener("click",this.#t,!1),document.removeEventListener("keydown",this.#e,!1)}};function Dn(t,e="config"){const n=(t.getAttribute(`data-${e}`)||"").replace(/'/g,'"');return n?JSON.parse(n):{}}function ue(t){if(typeof t=="string"){const e=document.getElementById(t);if(e)return e;throw new Error(`Element not found with ID: "${t}"`)}else if(t instanceof HTMLElement){if(!t.id)throw new Error("HTMLElement must have an ID");return t}else throw new Error("Invalid argument: query must be a string or HTMLElement")}async function Q(t,e,...n){e in t&&typeof t[e]=="function"&&await t[e](...n)}function Mn(t){return t.split("-").map((e,n)=>n===0?e:e.charAt(0).toUpperCase()+e.slice(1)).join("")}function fe(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function In(t){if(typeof t=="number")return t;const e=parseFloat(t);if(!Number.isNaN(e)){const n=t.includes("ms");return e*(n?1:1e3)}throw new Error(`Could not convert value to milliseconds: ${t}`)}function he(t,e,n,s,r=0){return new Promise(i=>{t.classList.remove(e),t.classList.add(n),setTimeout(()=>{t.classList.add(s),t.classList.remove(n),i(t)},In(r))})}async function U(t,e,n){await Q(e,t,n),n&&await Q(n,t);for(const s of e.plugins)await Q(s,t,{plugin:s,parent:e,entry:n});await e.emit(t,n)}function Hn(t){const e=getComputedStyle(t.el),n={},s=t.getSetting("customProps");for(let r=0;r<s.length;r++){const i=qn(),o=t.parent.module.toLowerCase(),a=fe(s[r]),l=e.getPropertyValue(`--${i}${o}-${a}`).trim();l&&(n[a]=l)}return n}function qn(){return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim()}function jn(t,e,n="camel"){return e=n==="camel"?Mn(e):fe(e),t.split(".").concat(e).reduce((s,r)=>s?.[r],this)}function Nn(t,e={}){const{fallback:n,props:s=["dataConfig","customProps","settings","parent.settings"]}=e;for(const r of s){const i=r!=="customProps"?"camel":"kebab",o=jn.call(this,r,t,i);if(o!==void 0)return o}if(n!==void 0)return n;throw new Error(`${this.parent.module} setting does not exist: ${t}`)}function Un(t,e){e&&document.querySelectorAll(e).forEach(n=>{t?n.style.overflow="hidden":n.style.removeProperty("overflow")})}function Fn(t,e){e&&document.querySelectorAll(e).forEach(n=>{t?(n.inert=!0,n.setAttribute("aria-hidden","true")):(n.inert=!1,n.removeAttribute("aria-hidden"))})}function zn(t,e,n){Fn(!!t,e),Un(!!t,n)}const Bn={events:{},on(t,e,...n){this.events[t]||(this.events[t]=[]),this.events[t].some(s=>s.listener===e)||this.events[t].push({listener:e,args:n})},off(t,e){this.events[t]&&(this.events[t]=this.events[t].filter(n=>n.listener!==e))},async emit(t,e){if(t=t.startsWith("on")?t.slice(2,3).toLowerCase()+t.slice(3):t,!!this.events[t])for(const{listener:n,args:s}of this.events[t])await n(e,...s)}};class Vn extends Array{constructor(e={}){super(),this.presets=e}applySettings(e){const n=e?.defaults||{},s=this.presets?.[e.name]||{},r=e?.options||{};e.settings={...n,...s,...r}}validate(e){return!("name"in e)||typeof e.name!="string"?(console.error("Plugin requires a name!"),!1):!0}get(e){return this.find(n=>n.name===e)}add(e){if(Array.isArray(e))e.forEach(n=>this.add(n));else if(this.applySettings(e),this.validate(e)){const n=this.findIndex(s=>s.name===e.name);~n?this[n]=e:this.push(e)}}remove(e){const n=this.findIndex(s=>s.name===e);~n&&this.splice(n,1)}}let _n=class extends Array{constructor(e={}){super(),this.settings=e}get copy(){return[...this]}get top(){return this[this.length-1]||null}updateIndex(){this.forEach((e,n)=>{e.el.style.zIndex="";const s=getComputedStyle(e.el)["z-index"];e.el.style.zIndex=String(parseInt(s,10)+n+1)})}onChange(){this.updateIndex(),typeof this.settings.onChange=="function"&&this.settings.onChange()}add(e){this.push(e),this.onChange()}remove(e){const n=this.findIndex(s=>s.id===e.id);~n&&(e.el.style.zIndex="",this.splice(n,1),this.onChange())}moveToTop(e){const n=this.findIndex(s=>s.id===e.id);~n&&(this.splice(n,1),this.add(e))}};const Wn={dataConfig:"config",customProps:[]};class de{constructor(e,n,s={}){this.parent=e,this.el=ue(n),this.settings={...s},this.dataConfig={},this.customProps={}}get id(){return this.el.id}applySettings(e){return Object.assign(this.settings,e)}getSetting(e,n){return Nn.call(this,e,n)}buildDataConfig(){return Object.assign(this.dataConfig,Dn(this.el,this.getSetting("dataConfig")))}buildCustomProps(){return Object.assign(this.customProps,Hn(this))}async init(e={}){this.applySettings(e),this.buildDataConfig(),this.buildCustomProps()}async destroy(){Object.getOwnPropertyNames(this).forEach(e=>{delete this[e]})}}let Qn=class{constructor(e={}){this.module=this.constructor.name,this.collection=[],this.entryClass=de,this.settings={...Wn,...e},this.plugins=new Vn(this.settings.presets),this.events={},Object.assign(this,Bn)}get(e,n="id"){return this.collection.find(s=>s[n]===e)}applySettings(e){return Object.assign(this.settings,e)}async createEntry(e,n){const s=new this.entryClass(this,e,n);return await Q(s,"init"),await U("onCreateEntry",this,s),s}async destroyEntry(e){return await U("onDestroyEntry",this,e),await Q(e,"destroy"),e}async register(e,n={}){const s=ue(e),r=this.collection.findIndex(i=>i.id===s.id);if(~r){const i=this.collection[r];return i.el=s,typeof i.init=="function"&&await i.init(n),i}else{const i=await this.createEntry(s,n);return this.collection.push(i),await U("onRegisterEntry",this,i),i}}async deregister(e){const n=this.collection.findIndex(s=>s.id===e);if(~n){const s=await this.destroyEntry(this.collection[n]);return await U("onDeregisterEntry",this,this.collection[n]),this.collection.splice(n,1),s}return null}async mount(e={}){this.applySettings(e);for(const s of this.settings?.plugins||[])this.plugins.add(s);for(const s of this.plugins)await Q(s,"setup",{plugin:s,parent:this});await U("beforeMount",this);const n=document.querySelectorAll(this.settings.selector);for(const s of n)await this.register(s);return await U("afterMount",this),this}async unmount(){for(await U("beforeUnmount",this);this.collection.length>0;)await this.deregister(this.collection[0].id);await U("afterUnmount",this);for(const e of this.plugins)await Q(e,"teardown",{plugin:e,parent:this});for(const e of[...this.plugins])this.plugins.remove(e.name);return this}};const Jn={dataOpen:"modal-open",dataClose:"modal-close",dataReplace:"modal-replace",selector:".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",customProps:["transition-duration"],customEventPrefix:"modal:",setTabindex:!0,transition:!0,transitionDuration:300};function mt(t){t.active?(t.active.dialog.querySelector(t.settings.selectorFocus)||t.active.dialog).focus():t.trigger&&(t.trigger.focus(),t.trigger=null)}async function Tt(t,e,n=!0){return t.parent.stack.moveToTop(t),t.state==="closed"&&(t.state="opening",t.parent.stack.add(t),e??t.getSetting("transition")?await he(t.el,t.getSetting("stateClosed"),t.getSetting("stateOpening"),t.getSetting("stateOpened"),t.getSetting("transitionDuration")):(t.el.classList.add(t.getSetting("stateOpened")),t.el.classList.remove(t.getSetting("stateClosed"))),t.state="opened"),n&&mt(t.parent),t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"opened",{detail:t.parent,bubbles:!0})),await t.parent.emit("opened",t),t}async function Ot(t,e,n=!0){return t&&t.state==="opened"&&(t.state="closing",document.activeElement&&document.activeElement instanceof HTMLElement&&document.activeElement.blur(),e??t.getSetting("transition")?await he(t.el,t.getSetting("stateOpened"),t.getSetting("stateClosing"),t.getSetting("stateClosed"),t.getSetting("transitionDuration")):(t.el.classList.add(t.getSetting("stateClosed")),t.el.classList.remove(t.getSetting("stateOpened"))),t.parent.stack.remove(t),t.state="closed",n&&mt(t.parent),t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"closed",{detail:t.parent,bubbles:!0})),await t.parent.emit("closed",t)),t}async function ge(t,e,n=!0){let s,r;return t.state==="opened"?(s=t,r=await t.parent.closeAll(t.id,e)):[r,s]=await Promise.all([t.parent.closeAll("",e),Tt(t,e,!1)]),n&&mt(t.parent),{opened:s,closed:r}}let Zn=class extends de{constructor(e,n,s={}){super(e,n,s),this.state="closed",this.dialog=this.el.querySelector(this.getSetting("selectorDialog"))||this.el}get isRequired(){return this.dialog.matches(this.getSetting("selectorRequired"))}async open(e,n){return Tt(this,e,n)}async close(e,n){return Ot(this,e,n)}async replace(e,n){return ge(this,e,n)}async deregister(){return this.parent.deregister(this.id)}async onCreateEntry(){this.dialog.setAttribute("aria-modal","true"),this.dialog.hasAttribute("role")||this.dialog.setAttribute("role","dialog"),this.getSetting("setTabindex")&&this.dialog.setAttribute("tabindex","-1")}async onRegisterEntry(){this.el.classList.contains(this.getSetting("stateOpened"))?await this.open(!1):(this.el.classList.remove(this.getSetting("stateOpening")),this.el.classList.remove(this.getSetting("stateClosing")),this.el.classList.add(this.getSetting("stateClosed")))}async onDestroyEntry(){this.state==="opened"&&await this.close(!1)}};function lt(t){const e=this.get(t);if(e)return e;throw new Error(`Modal not found in collection with id of "${t}".`)}async function Kn(t){const e=t.target;if(e){const n=e.closest(`
6
- [data-${this.settings.dataOpen}],
7
- [data-${this.settings.dataReplace}],
8
- [data-${this.settings.dataClose}]
9
- `);if(n){if(t.preventDefault(),n.matches(`[data-${this.settings.dataOpen}]`)){const s=n.getAttribute(`data-${this.settings.dataOpen}`)?.trim(),r=lt.call(this,s);return e.closest(this.settings.selector)||(this.trigger=n),r.open()}if(n.matches(`[data-${this.settings.dataReplace}]`)){const s=n.getAttribute(`data-${this.settings.dataReplace}`)?.trim(),r=lt.call(this,s);return e.closest(this.settings.selector)||(this.trigger=n),r.replace()}if(n.matches(`[data-${this.settings.dataClose}]`)){const s=n.getAttribute(`data-${this.settings.dataClose}`)?.trim();return s==="*"?this.closeAll():this.close(s||"")}}if(this.active&&e.matches(this.settings.selectorScreen)&&!this.active.isRequired)return this.close()}}function Yn(t){if(t.key==="Escape"&&this.active&&!this.active.dialog.matches(this.settings.selectorRequired))return this.close()}async function Gn(t="",e){const n=[];return await Promise.all(this.stack.copy.map(async s=>{t&&t===s.id||n.push(await Ot(s,e,!1))})),n}let Xn=class extends Qn{#t;#e;constructor(e){super({...Jn,...e}),this.module="Modal",this.entryClass=Zn,this.trigger=null,this.#t=Kn.bind(this),this.#e=Yn.bind(this),this.stack=new _n({onChange:()=>{zn(!!this.stack.top,this.settings.selectorInert,this.settings.selectorOverflow)}})}get active(){return this.stack.top}async open(e,n,s){const r=lt.call(this,e);return Tt(r,n,s)}async close(e,n,s){const r=e?lt.call(this,e):this.active;return Ot(r,n,s)}async replace(e,n,s){const r=lt.call(this,e);return ge(r,n,s)}async closeAll(e,n,s=!0){const r=await Gn.call(this,e,n);return s&&mt(this),r}async afterMount(){document.addEventListener("click",this.#t,!1),document.addEventListener("keydown",this.#e,!1)}async beforeUnmount(){this.trigger=null}async afterUnmount(){document.removeEventListener("click",this.#t,!1),document.removeEventListener("keydown",this.#e,!1)}};function ts(t,e="config"){const n=(t.getAttribute(`data-${e}`)||"").replace(/'/g,'"');return n?JSON.parse(n):{}}function pe(t){if(typeof t=="string"){const e=document.getElementById(t);if(e)return e;throw new Error(`Element not found with ID: "${t}"`)}else if(t instanceof HTMLElement){if(!t.id)throw new Error("HTMLElement must have an ID");return t}else throw new Error("Invalid argument: query must be a string or HTMLElement")}async function J(t,e,...n){e in t&&typeof t[e]=="function"&&await t[e](...n)}function es(t){return t.split("-").map((e,n)=>n===0?e:e.charAt(0).toUpperCase()+e.slice(1)).join("")}function me(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}async function F(t,e,n){await J(e,t,n),n&&await J(n,t);for(const s of e.plugins)await J(s,t,{plugin:s,parent:e,entry:n});await e.emit(t,n)}function ns(t){const e=getComputedStyle(t.el),n={},s=t.getSetting("customProps");for(let r=0;r<s.length;r++){const i=ss(),o=t.parent.module.toLowerCase(),a=me(s[r]),l=e.getPropertyValue(`--${i}${o}-${a}`).trim();l&&(n[a]=l)}return n}function ss(){return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim()}function is(t,e,n="camel"){return e=n==="camel"?es(e):me(e),t.split(".").concat(e).reduce((s,r)=>s?.[r],this)}function rs(t,e={}){const{fallback:n,props:s=["dataConfig","customProps","settings","parent.settings"]}=e;for(const r of s){const i=r!=="customProps"?"camel":"kebab",o=is.call(this,r,t,i);if(o!==void 0)return o}if(n!==void 0)return n;throw new Error(`${this.parent.module} setting does not exist: ${t}`)}const os={events:{},on(t,e,...n){this.events[t]||(this.events[t]=[]),this.events[t].some(s=>s.listener===e)||this.events[t].push({listener:e,args:n})},off(t,e){this.events[t]&&(this.events[t]=this.events[t].filter(n=>n.listener!==e))},async emit(t,e){if(t=t.startsWith("on")?t.slice(2,3).toLowerCase()+t.slice(3):t,!!this.events[t])for(const{listener:n,args:s}of this.events[t])await n(e,...s)}};class as extends Array{constructor(e={}){super(),this.presets=e}applySettings(e){const n=e?.defaults||{},s=this.presets?.[e.name]||{},r=e?.options||{};e.settings={...n,...s,...r}}validate(e){return!("name"in e)||typeof e.name!="string"?(console.error("Plugin requires a name!"),!1):!0}get(e){return this.find(n=>n.name===e)}add(e){if(Array.isArray(e))e.forEach(n=>this.add(n));else if(this.applySettings(e),this.validate(e)){const n=this.findIndex(s=>s.name===e.name);~n?this[n]=e:this.push(e)}}remove(e){const n=this.findIndex(s=>s.name===e);~n&&this.splice(n,1)}}const ls={dataConfig:"config",customProps:[]};class ye{constructor(e,n,s={}){this.parent=e,this.el=pe(n),this.settings={...s},this.dataConfig={},this.customProps={}}get id(){return this.el.id}applySettings(e){return Object.assign(this.settings,e)}getSetting(e,n){return rs.call(this,e,n)}buildDataConfig(){return Object.assign(this.dataConfig,ts(this.el,this.getSetting("dataConfig")))}buildCustomProps(){return Object.assign(this.customProps,ns(this))}async init(e={}){this.applySettings(e),this.buildDataConfig(),this.buildCustomProps()}async destroy(){Object.getOwnPropertyNames(this).forEach(e=>{delete this[e]})}}class cs{constructor(e={}){this.module=this.constructor.name,this.collection=[],this.entryClass=ye,this.settings={...ls,...e},this.plugins=new as(this.settings.presets),this.events={},Object.assign(this,os)}get(e,n="id"){return this.collection.find(s=>s[n]===e)}applySettings(e){return Object.assign(this.settings,e)}async createEntry(e,n){const s=new this.entryClass(this,e,n);return await J(s,"init"),await F("onCreateEntry",this,s),s}async destroyEntry(e){return await F("onDestroyEntry",this,e),await J(e,"destroy"),e}async register(e,n={}){const s=pe(e),r=this.collection.findIndex(i=>i.id===s.id);if(~r){const i=this.collection[r];return i.el=s,typeof i.init=="function"&&await i.init(n),i}else{const i=await this.createEntry(s,n);return this.collection.push(i),await F("onRegisterEntry",this,i),i}}async deregister(e){const n=this.collection.findIndex(s=>s.id===e);if(~n){const s=await this.destroyEntry(this.collection[n]);return await F("onDeregisterEntry",this,this.collection[n]),this.collection.splice(n,1),s}return null}async mount(e={}){this.applySettings(e);for(const s of this.settings?.plugins||[])this.plugins.add(s);for(const s of this.plugins)await J(s,"setup",{plugin:s,parent:this});await F("beforeMount",this);const n=document.querySelectorAll(this.settings.selector);for(const s of n)await this.register(s);return await F("afterMount",this),this}async unmount(){for(await F("beforeUnmount",this);this.collection.length>0;)await this.deregister(this.collection[0].id);await F("afterUnmount",this);for(const e of this.plugins)await J(e,"teardown",{plugin:e,parent:this});for(const e of[...this.plugins])this.plugins.remove(e.name);return this}}const us={selector:".popover",selectorTooltip:".popover_tooltip",selectorArrow:".popover__arrow",stateActive:"is-active",customProps:["placement","event","offset","flip-padding","shift-padding","arrow-padding","toggle-delay"],customEventPrefix:"popover:",placement:"bottom",event:"click",offset:0,flipPadding:0,shiftPadding:0,arrowPadding:0,toggleDelay:0},st=Math.min,Z=Math.max,yt=Math.round,wt=Math.floor,T=t=>({x:t,y:t}),fs={left:"right",right:"left",bottom:"top",top:"bottom"},hs={start:"end",end:"start"};function Rt(t,e,n){return Z(t,st(e,n))}function K(t,e){return typeof t=="function"?t(e):t}function z(t){return t.split("-")[0]}function ct(t){return t.split("-")[1]}function Dt(t){return t==="x"?"y":"x"}function Mt(t){return t==="y"?"height":"width"}const ds=new Set(["top","bottom"]);function I(t){return ds.has(z(t))?"y":"x"}function It(t){return Dt(I(t))}function gs(t,e,n){n===void 0&&(n=!1);const s=ct(t),r=It(t),i=Mt(r);let o=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=vt(o)),[o,vt(o)]}function ps(t){const e=vt(t);return[Ht(t),e,Ht(e)]}function Ht(t){return t.replace(/start|end/g,e=>hs[e])}const we=["left","right"],ve=["right","left"],ms=["top","bottom"],ys=["bottom","top"];function ws(t,e,n){switch(t){case"top":case"bottom":return n?e?ve:we:e?we:ve;case"left":case"right":return e?ms:ys;default:return[]}}function vs(t,e,n,s){const r=ct(t);let i=ws(z(t),n==="start",s);return r&&(i=i.map(o=>o+"-"+r),e&&(i=i.concat(i.map(Ht)))),i}function vt(t){return t.replace(/left|right|bottom|top/g,e=>fs[e])}function bs(t){return{top:0,right:0,bottom:0,left:0,...t}}function be(t){return typeof t!="number"?bs(t):{top:t,right:t,bottom:t,left:t}}function bt(t){const{x:e,y:n,width:s,height:r}=t;return{width:s,height:r,top:n,left:e,right:e+s,bottom:n+r,x:e,y:n}}function Ee(t,e,n){let{reference:s,floating:r}=t;const i=I(e),o=It(e),a=Mt(o),l=z(e),c=i==="y",h=s.x+s.width/2-r.width/2,f=s.y+s.height/2-r.height/2,d=s[a]/2-r[a]/2;let u;switch(l){case"top":u={x:h,y:s.y-r.height};break;case"bottom":u={x:h,y:s.y+s.height};break;case"right":u={x:s.x+s.width,y:f};break;case"left":u={x:s.x-r.width,y:f};break;default:u={x:s.x,y:s.y}}switch(ct(e)){case"start":u[o]-=d*(n&&c?-1:1);break;case"end":u[o]+=d*(n&&c?-1:1);break}return u}const Es=async(t,e,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:i=[],platform:o}=n,a=i.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:t,floating:e,strategy:r}),{x:h,y:f}=Ee(c,s,l),d=s,u={},g=0;for(let p=0;p<a.length;p++){const{name:m,fn:y}=a[p],{x:w,y:v,data:b,reset:E}=await y({x:h,y:f,initialPlacement:s,placement:d,strategy:r,middlewareData:u,rects:c,platform:o,elements:{reference:t,floating:e}});h=w??h,f=v??f,u={...u,[m]:{...u[m],...b}},E&&g<=50&&(g++,typeof E=="object"&&(E.placement&&(d=E.placement),E.rects&&(c=E.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:r}):E.rects),{x:h,y:f}=Ee(c,d,l)),p=-1)}return{x:h,y:f,placement:d,strategy:r,middlewareData:u}};async function xe(t,e){var n;e===void 0&&(e={});const{x:s,y:r,platform:i,rects:o,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:h="viewport",elementContext:f="floating",altBoundary:d=!1,padding:u=0}=K(e,t),g=be(u),p=a[d?f==="floating"?"reference":"floating":f],m=bt(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(p)))==null||n?p:p.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:h,strategy:l})),y=f==="floating"?{x:s,y:r,width:o.floating.width,height:o.floating.height}:o.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),v=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},b=bt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:w,strategy:l}):y);return{top:(m.top-b.top+g.top)/v.y,bottom:(b.bottom-m.bottom+g.bottom)/v.y,left:(m.left-b.left+g.left)/v.x,right:(b.right-m.right+g.right)/v.x}}const xs=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:s,placement:r,rects:i,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:h=0}=K(t,e)||{};if(c==null)return{};const f=be(h),d={x:n,y:s},u=It(r),g=Mt(u),p=await o.getDimensions(c),m=u==="y",y=m?"top":"left",w=m?"bottom":"right",v=m?"clientHeight":"clientWidth",b=i.reference[g]+i.reference[u]-d[u]-i.floating[g],E=d[u]-i.reference[u],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let G=S?S[v]:0;(!G||!await(o.isElement==null?void 0:o.isElement(S)))&&(G=a.floating[v]||i.floating[g]);const ht=b/2-E/2,X=G/2-p[g]/2-1,H=st(f[y],X),dt=st(f[w],X),tt=H,gt=G-p[g]-dt,$=G/2-p[g]/2+ht,et=Rt(tt,$,gt),q=!l.arrow&&ct(r)!=null&&$!==et&&i.reference[g]/2-($<tt?H:dt)-p[g]/2<0,L=q?$<tt?$-tt:$-gt:0;return{[u]:d[u]+L,data:{[u]:et,centerOffset:$-et-L,...q&&{alignmentOffset:L}},reset:q}}}),$s=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,s;const{placement:r,middlewareData:i,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:h=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:p=!0,...m}=K(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=z(r),w=I(a),v=z(a)===a,b=await(l.isRTL==null?void 0:l.isRTL(c.floating)),E=d||(v||!p?[vt(a)]:ps(a)),S=g!=="none";!d&&S&&E.push(...vs(a,p,g,b));const G=[a,...E],ht=await xe(e,m),X=[];let H=((s=i.flip)==null?void 0:s.overflows)||[];if(h&&X.push(ht[y]),f){const $=gs(r,o,b);X.push(ht[$[0]],ht[$[1]])}if(H=[...H,{placement:r,overflows:X}],!X.every($=>$<=0)){var dt,tt;const $=(((dt=i.flip)==null?void 0:dt.index)||0)+1,et=G[$];if(et&&(!(f==="alignment"&&w!==I(et))||H.every(L=>L.overflows[0]>0&&I(L.placement)===w)))return{data:{index:$,overflows:H},reset:{placement:et}};let q=(tt=H.filter(L=>L.overflows[0]<=0).sort((L,V)=>L.overflows[1]-V.overflows[1])[0])==null?void 0:tt.placement;if(!q)switch(u){case"bestFit":{var gt;const L=(gt=H.filter(V=>{if(S){const _=I(V.placement);return _===w||_==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(_=>_>0).reduce((_,pi)=>_+pi,0)]).sort((V,_)=>V[1]-_[1])[0])==null?void 0:gt[0];L&&(q=L);break}case"initialPlacement":q=a;break}if(r!==q)return{reset:{placement:q}}}return{}}}},$e=new Set(["left","top"]);async function Ss(t,e){const{placement:n,platform:s,elements:r}=t,i=await(s.isRTL==null?void 0:s.isRTL(r.floating)),o=z(n),a=ct(n),l=I(n)==="y",c=$e.has(o)?-1:1,h=i&&l?-1:1,f=K(e,t);let{mainAxis:d,crossAxis:u,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof g=="number"&&(u=a==="end"?g*-1:g),l?{x:u*h,y:d*c}:{x:d*c,y:u*h}}const Cs=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,s;const{x:r,y:i,placement:o,middlewareData:a}=e,l=await Ss(e,t);return o===((n=a.offset)==null?void 0:n.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:r+l.x,y:i+l.y,data:{...l,placement:o}}}}},As=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:s,placement:r}=e,{mainAxis:i=!0,crossAxis:o=!1,limiter:a={fn:m=>{let{x:y,y:w}=m;return{x:y,y:w}}},...l}=K(t,e),c={x:n,y:s},h=await xe(e,l),f=I(z(r)),d=Dt(f);let u=c[d],g=c[f];if(i){const m=d==="y"?"top":"left",y=d==="y"?"bottom":"right",w=u+h[m],v=u-h[y];u=Rt(w,u,v)}if(o){const m=f==="y"?"top":"left",y=f==="y"?"bottom":"right",w=g+h[m],v=g-h[y];g=Rt(w,g,v)}const p=a.fn({...e,[d]:u,[f]:g});return{...p,data:{x:p.x-n,y:p.y-s,enabled:{[d]:i,[f]:o}}}}}},Ls=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:s,placement:r,rects:i,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=K(t,e),h={x:n,y:s},f=I(r),d=Dt(f);let u=h[d],g=h[f];const p=K(a,e),m=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(l){const v=d==="y"?"height":"width",b=i.reference[d]-i.floating[v]+m.mainAxis,E=i.reference[d]+i.reference[v]-m.mainAxis;u<b?u=b:u>E&&(u=E)}if(c){var y,w;const v=d==="y"?"width":"height",b=$e.has(z(r)),E=i.reference[f]-i.floating[v]+(b&&((y=o.offset)==null?void 0:y[f])||0)+(b?0:m.crossAxis),S=i.reference[f]+i.reference[v]+(b?0:((w=o.offset)==null?void 0:w[f])||0)-(b?m.crossAxis:0);g<E?g=E:g>S&&(g=S)}return{[d]:u,[f]:g}}}};function Et(){return typeof window<"u"}function it(t){return Se(t)?(t.nodeName||"").toLowerCase():"#document"}function A(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function O(t){var e;return(e=(Se(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Se(t){return Et()?t instanceof Node||t instanceof A(t).Node:!1}function P(t){return Et()?t instanceof Element||t instanceof A(t).Element:!1}function R(t){return Et()?t instanceof HTMLElement||t instanceof A(t).HTMLElement:!1}function Ce(t){return!Et()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof A(t).ShadowRoot}const Ps=new Set(["inline","contents"]);function ut(t){const{overflow:e,overflowX:n,overflowY:s,display:r}=k(t);return/auto|scroll|overlay|hidden|clip/.test(e+s+n)&&!Ps.has(r)}const ks=new Set(["table","td","th"]);function Ts(t){return ks.has(it(t))}const Os=[":popover-open",":modal"];function xt(t){return Os.some(e=>{try{return t.matches(e)}catch{return!1}})}const Rs=["transform","translate","scale","rotate","perspective"],Ds=["transform","translate","scale","rotate","perspective","filter"],Ms=["paint","layout","strict","content"];function qt(t){const e=jt(),n=P(t)?k(t):t;return Rs.some(s=>n[s]?n[s]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||Ds.some(s=>(n.willChange||"").includes(s))||Ms.some(s=>(n.contain||"").includes(s))}function Is(t){let e=B(t);for(;R(e)&&!rt(e);){if(qt(e))return e;if(xt(e))return null;e=B(e)}return null}function jt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Hs=new Set(["html","body","#document"]);function rt(t){return Hs.has(it(t))}function k(t){return A(t).getComputedStyle(t)}function $t(t){return P(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function B(t){if(it(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Ce(t)&&t.host||O(t);return Ce(e)?e.host:e}function Ae(t){const e=B(t);return rt(e)?t.ownerDocument?t.ownerDocument.body:t.body:R(e)&&ut(e)?e:Ae(e)}function ft(t,e,n){var s;e===void 0&&(e=[]),n===void 0&&(n=!0);const r=Ae(t),i=r===((s=t.ownerDocument)==null?void 0:s.body),o=A(r);if(i){const a=Nt(o);return e.concat(o,o.visualViewport||[],ut(r)?r:[],a&&n?ft(a):[])}return e.concat(r,ft(r,[],n))}function Nt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Le(t){const e=k(t);let n=parseFloat(e.width)||0,s=parseFloat(e.height)||0;const r=R(t),i=r?t.offsetWidth:n,o=r?t.offsetHeight:s,a=yt(n)!==i||yt(s)!==o;return a&&(n=i,s=o),{width:n,height:s,$:a}}function Ut(t){return P(t)?t:t.contextElement}function ot(t){const e=Ut(t);if(!R(e))return T(1);const n=e.getBoundingClientRect(),{width:s,height:r,$:i}=Le(e);let o=(i?yt(n.width):n.width)/s,a=(i?yt(n.height):n.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const qs=T(0);function Pe(t){const e=A(t);return!jt()||!e.visualViewport?qs:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function js(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==A(t)?!1:e}function Y(t,e,n,s){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=t.getBoundingClientRect(),i=Ut(t);let o=T(1);e&&(s?P(s)&&(o=ot(s)):o=ot(t));const a=js(i,n,s)?Pe(i):T(0);let l=(r.left+a.x)/o.x,c=(r.top+a.y)/o.y,h=r.width/o.x,f=r.height/o.y;if(i){const d=A(i),u=s&&P(s)?A(s):s;let g=d,p=Nt(g);for(;p&&s&&u!==g;){const m=ot(p),y=p.getBoundingClientRect(),w=k(p),v=y.left+(p.clientLeft+parseFloat(w.paddingLeft))*m.x,b=y.top+(p.clientTop+parseFloat(w.paddingTop))*m.y;l*=m.x,c*=m.y,h*=m.x,f*=m.y,l+=v,c+=b,g=A(p),p=Nt(g)}}return bt({width:h,height:f,x:l,y:c})}function Ft(t,e){const n=$t(t).scrollLeft;return e?e.left+n:Y(O(t)).left+n}function ke(t,e,n){n===void 0&&(n=!1);const s=t.getBoundingClientRect(),r=s.left+e.scrollLeft-(n?0:Ft(t,s)),i=s.top+e.scrollTop;return{x:r,y:i}}function Ns(t){let{elements:e,rect:n,offsetParent:s,strategy:r}=t;const i=r==="fixed",o=O(s),a=e?xt(e.floating):!1;if(s===o||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=T(1);const h=T(0),f=R(s);if((f||!f&&!i)&&((it(s)!=="body"||ut(o))&&(l=$t(s)),R(s))){const u=Y(s);c=ot(s),h.x=u.x+s.clientLeft,h.y=u.y+s.clientTop}const d=o&&!f&&!i?ke(o,l,!0):T(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+h.x+d.x,y:n.y*c.y-l.scrollTop*c.y+h.y+d.y}}function Us(t){return Array.from(t.getClientRects())}function Fs(t){const e=O(t),n=$t(t),s=t.ownerDocument.body,r=Z(e.scrollWidth,e.clientWidth,s.scrollWidth,s.clientWidth),i=Z(e.scrollHeight,e.clientHeight,s.scrollHeight,s.clientHeight);let o=-n.scrollLeft+Ft(t);const a=-n.scrollTop;return k(s).direction==="rtl"&&(o+=Z(e.clientWidth,s.clientWidth)-r),{width:r,height:i,x:o,y:a}}function zs(t,e){const n=A(t),s=O(t),r=n.visualViewport;let i=s.clientWidth,o=s.clientHeight,a=0,l=0;if(r){i=r.width,o=r.height;const c=jt();(!c||c&&e==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}return{width:i,height:o,x:a,y:l}}const Bs=new Set(["absolute","fixed"]);function Vs(t,e){const n=Y(t,!0,e==="fixed"),s=n.top+t.clientTop,r=n.left+t.clientLeft,i=R(t)?ot(t):T(1),o=t.clientWidth*i.x,a=t.clientHeight*i.y,l=r*i.x,c=s*i.y;return{width:o,height:a,x:l,y:c}}function Te(t,e,n){let s;if(e==="viewport")s=zs(t,n);else if(e==="document")s=Fs(O(t));else if(P(e))s=Vs(e,n);else{const r=Pe(t);s={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return bt(s)}function Oe(t,e){const n=B(t);return n===e||!P(n)||rt(n)?!1:k(n).position==="fixed"||Oe(n,e)}function _s(t,e){const n=e.get(t);if(n)return n;let s=ft(t,[],!1).filter(a=>P(a)&&it(a)!=="body"),r=null;const i=k(t).position==="fixed";let o=i?B(t):t;for(;P(o)&&!rt(o);){const a=k(o),l=qt(o);!l&&a.position==="fixed"&&(r=null),(i?!l&&!r:!l&&a.position==="static"&&r&&Bs.has(r.position)||ut(o)&&!l&&Oe(t,o))?s=s.filter(c=>c!==o):r=a,o=B(o)}return e.set(t,s),s}function Ws(t){let{element:e,boundary:n,rootBoundary:s,strategy:r}=t;const i=[...n==="clippingAncestors"?xt(e)?[]:_s(e,this._c):[].concat(n),s],o=i[0],a=i.reduce((l,c)=>{const h=Te(e,c,r);return l.top=Z(h.top,l.top),l.right=st(h.right,l.right),l.bottom=st(h.bottom,l.bottom),l.left=Z(h.left,l.left),l},Te(e,o,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Qs(t){const{width:e,height:n}=Le(t);return{width:e,height:n}}function Js(t,e,n){const s=R(e),r=O(e),i=n==="fixed",o=Y(t,!0,i,e);let a={scrollLeft:0,scrollTop:0};const l=T(0);function c(){l.x=Ft(r)}if(s||!s&&!i)if((it(e)!=="body"||ut(r))&&(a=$t(e)),s){const u=Y(e,!0,i,e);l.x=u.x+e.clientLeft,l.y=u.y+e.clientTop}else r&&c();i&&!s&&r&&c();const h=r&&!s&&!i?ke(r,a):T(0),f=o.left+a.scrollLeft-l.x-h.x,d=o.top+a.scrollTop-l.y-h.y;return{x:f,y:d,width:o.width,height:o.height}}function zt(t){return k(t).position==="static"}function Re(t,e){if(!R(t)||k(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return O(t)===n&&(n=n.ownerDocument.body),n}function De(t,e){const n=A(t);if(xt(t))return n;if(!R(t)){let r=B(t);for(;r&&!rt(r);){if(P(r)&&!zt(r))return r;r=B(r)}return n}let s=Re(t,e);for(;s&&Ts(s)&&zt(s);)s=Re(s,e);return s&&rt(s)&&zt(s)&&!qt(s)?n:s||Is(t)||n}const Zs=async function(t){const e=this.getOffsetParent||De,n=this.getDimensions,s=await n(t.floating);return{reference:Js(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function Ks(t){return k(t).direction==="rtl"}const Ys={convertOffsetParentRelativeRectToViewportRelativeRect:Ns,getDocumentElement:O,getClippingRect:Ws,getOffsetParent:De,getElementRects:Zs,getClientRects:Us,getDimensions:Qs,getScale:ot,isElement:P,isRTL:Ks};function Me(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Gs(t,e){let n=null,s;const r=O(t);function i(){var a;clearTimeout(s),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const c=t.getBoundingClientRect(),{left:h,top:f,width:d,height:u}=c;if(a||e(),!d||!u)return;const g=wt(f),p=wt(r.clientWidth-(h+d)),m=wt(r.clientHeight-(f+u)),y=wt(h),w={rootMargin:-g+"px "+-p+"px "+-m+"px "+-y+"px",threshold:Z(0,st(1,l))||1};let v=!0;function b(E){const S=E[0].intersectionRatio;if(S!==l){if(!v)return o();S?o(!1,S):s=setTimeout(()=>{o(!1,1e-7)},1e3)}S===1&&!Me(c,t.getBoundingClientRect())&&o(),v=!1}try{n=new IntersectionObserver(b,{...w,root:r.ownerDocument})}catch{n=new IntersectionObserver(b,w)}n.observe(t)}return o(!0),i}function Xs(t,e,n,s){s===void 0&&(s={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=s,c=Ut(t),h=r||i?[...c?ft(c):[],...ft(e)]:[];h.forEach(y=>{r&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const f=c&&a?Gs(c,n):null;let d=-1,u=null;o&&(u=new ResizeObserver(y=>{let[w]=y;w&&w.target===c&&u&&(u.unobserve(e),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var v;(v=u)==null||v.observe(e)})),n()}),c&&!l&&u.observe(c),u.observe(e));let g,p=l?Y(t):null;l&&m();function m(){const y=Y(t);p&&!Me(p,y)&&n(),p=y,g=requestAnimationFrame(m)}return n(),()=>{var y;h.forEach(w=>{r&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),f?.(),(y=u)==null||y.disconnect(),u=null,l&&cancelAnimationFrame(g)}}const ti=Cs,ei=As,ni=$s,si=xs,ii=Ls,ri=(t,e,n)=>{const s=new Map,r={platform:Ys,...n},i={...r.platform,_c:s};return Es(t,e,{...r,platform:i})};function Ie(t,e,n){Object.assign(t.style,{left:e!=null?`${e}px`:"",top:n!=null?`${n}px`:""})}function He(t,e){let n=t.getSetting("toggle-delay");typeof n=="string"&&(n.indexOf(",")>-1&&(n=n.split(",")),n.indexOf(" ")>-1&&(n=n.split(" "))),Array.isArray(n)&&(n=n[e]);const s=Number(n);if(Number.isNaN(s))throw new Error(`Provided delay value is not a number: "${n}"`);return s}function Bt(t){let e;const n=typeof t=="string"?t.trim().split(" ").map(s=>parseFloat(s)).filter(s=>!isNaN(s)):[t];for(let s=0;s<n.length;s++)n[s]=Number(n[s]);switch(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=void 0;break}return e}function oi(t){return{offset:Number(t.getSetting("offset")),flip:{padding:Bt(t.getSetting("flip-padding"))},shift:{padding:Bt(t.getSetting("shift-padding"))},arrow:{selector:t.getSetting("selectorArrow"),element:null,padding:Bt(t.getSetting("arrow-padding"))}}}function qe(t){const e=this.get(t);if(e)return e;throw new Error(`Popover not found in collection with id of "${t}".`)}async function je(t){return t&&t.state==="opened"&&(t.el.inert=!0,t.el.classList.remove(t.parent.settings.stateActive),t.isTooltip||t.trigger?.setAttribute("aria-expanded","false"),t.floatingCleanup(),t.state="closed",t.trigger===t.parent.trigger&&(t.parent.trigger=null),t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"closed",{detail:t.parent,bubbles:!0})),await t.parent.emit("closed",t)),t}async function Ne(t){const e=[];for(const n of t.collection)n.state==="opened"&&e.push(await n.close());return e}function Ue(t){t.state=="opened"&&setTimeout(()=>(document.activeElement?.closest(`#${t.id}, [aria-controls="${t.id}"], [aria-describedby="${t.id}"]`)||t.close(),t),1)}function ai(t){t.state==="opened"?t.close():(this.trigger=t.trigger,t.open())}function li(t){t.isTooltip&&(t.toggleDelayId&&clearTimeout(t.toggleDelayId),t.close())}function ci(t,e){if(t.isHovered=e,e.type=="focus"&&t.trigger&&!t.trigger.matches(":focus-visible"))return;t.toggleDelayId&&clearTimeout(t.toggleDelayId);const n=t.trigger?.getAttribute("aria-expanded");if(n&&n=="true")return;const s=this.activeHover?0:He(t,0);this.activeHover&&this.activeHover.close(),t.toggleDelayId=setTimeout(()=>{t.id&&t.open()},s)}function ui(t,e){setTimeout(()=>{t.isHovered=e,!t.isHovered&&(t.toggleDelayId&&clearTimeout(t.toggleDelayId),t.toggleDelayId=setTimeout(()=>Ue(t),He(t,1)))},1)}function fi(t){switch(t.key){case"Escape":this.trigger&&this.trigger.focus(),Ne(this);return;case"Tab":this.collection.forEach(e=>{Ue(e)});return;default:return}}function hi(t){const e=this;document.addEventListener("click",function n(s){const r=s.target;r&&(r.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)))})}async function Fe(t){t.el.inert=!1,t.el.classList.add(t.parent.settings.stateActive),t.isTooltip||t.trigger?.setAttribute("aria-expanded","true"),t.buildCustomProps();const e=oi(t),n=t.el.querySelector(e.arrow.selector);return e.arrow.element=n||null,t.trigger instanceof HTMLElement&&(t.floatingCleanup=Xs(t.trigger,t.el,()=>{const s=[ni(e.flip),ei({...e.shift,limiter:ii()}),ti(e.offset)];e.arrow.element&&s.push(si({...e.arrow,element:e.arrow.element})),ri(t.trigger,t.el,{placement:t.getSetting("placement"),middleware:s}).then(({x:r,y:i,placement:o,middlewareData:a})=>{if(t.el){if(Ie(t.el,r,i),e.arrow.element&&a.arrow){const{x:l,y:c}=a.arrow;Ie(e.arrow.element,l,c)}t.el.setAttribute("data-floating-placement",o)}})})),t.state="opened",t.getSetting("event")==="click"&&hi.call(t.parent,t),t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"opened",{detail:t.parent,bubbles:!0})),await t.parent.emit("opened",t),t}class di extends ye{#t;#e;constructor(e,n,s={}){super(e,n,s),this.state="closed",this.toggleDelayId=null,this.trigger=null,this.#t=null,this.#e={el:!1,trigger:!1},this.floatingCleanup=()=>{}}get isTooltip(){return!!this.el.closest(this.getSetting("selectorTooltip"))||this.el.getAttribute("role")=="tooltip"}get isHovered(){return this.#e.el||this.#e.trigger}set isHovered(e){const n=e.type=="mouseenter"?!0:e.type=="mouseleave"?!1:void 0;if(n!=null)switch(e.target){case this.el:this.#e.el=n;break;case this.trigger:this.#e.trigger=n;break}}async open(){return Fe(this)}async close(){return je(this)}async deregister(){return this.parent.deregister(this.id)}registerEventListeners(){this.#t||(this.getSetting("event")==="hover"?(this.#t=[{el:["el","trigger"],type:["mouseenter","focus"],listener:ci.bind(this.parent,this)},{el:["el","trigger"],type:["mouseleave","focusout"],listener:ui.bind(this.parent,this)},{el:["trigger"],type:["click"],listener:li.bind(this.parent,this)}],this.#t.forEach(e=>{e.el.forEach(n=>{e.type.forEach(s=>{this[n].addEventListener(s,e.listener,!1)})})})):(this.#t=[{el:["trigger"],type:["click"],listener:ai.bind(this.parent,this)}],this.#t.forEach(e=>{e.el.forEach(n=>{e.type.forEach(s=>{this[n].addEventListener(s,e.listener,!1)})})})))}deregisterEventListeners(){this.#t&&(this.#t.forEach(e=>{e.el.forEach(n=>{e.type.forEach(s=>{this[n].removeEventListener(s,e.listener,!1)})})}),this.#t=null)}async onCreateEntry(){this.trigger=document.querySelector(`[aria-controls="${this.id}"], [aria-describedby="${this.id}"]`),this.isTooltip?(this.settings.event="hover",this.el.setAttribute("role","tooltip")):this.trigger&&this.trigger instanceof HTMLElement&&this.trigger.setAttribute("aria-expanded","false"),this.registerEventListeners()}async onRegisterEntry(){this.el.classList.contains(this.getSetting("stateActive"))?await this.open():this.el.inert=!0}async onDestroyEntry(){this.state==="opened"&&await this.close(),this.floatingCleanup(),this.deregisterEventListeners()}}class gi extends cs{#t;constructor(e){super({...us,...e}),this.module="Popover",this.entryClass=di,this.trigger=null,this.#t=fi.bind(this)}get active(){return this.get("opened","state")}get activeHover(){return this.collection.find(e=>e.state=="opened"&&e.getSetting("event")=="hover")}async open(e){const n=qe.call(this,e);return Fe(n)}async close(e){const n=e?qe.call(this,e):void 0;return n?je(n):Ne(this)}async afterMount(){document.addEventListener("keydown",this.#t,!1)}async beforeUnmount(){this.trigger=null}async afterUnmount(){document.removeEventListener("keydown",this.#t,!1)}}D.Drawer=Rn,D.Modal=Xn,D.Popover=gi,D.core=un,Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})});
1
+ (function(D,x){typeof exports=="object"&&typeof module<"u"?x(exports):typeof define=="function"&&define.amd?define(["exports"],x):(D=typeof globalThis<"u"?globalThis:D||self,x(D.vrembem={}))})(this,(function(D){"use strict";const x=":not([inert])",L=':not([tabindex^="-"])',at=":not(:disabled)",jt=[`a[href]${x}${L}`,`area[href]${x}${L}`,`input:not([type="hidden"]):not([type="radio"])${x}${L}${at}`,`input[type="radio"]${x}${L}${at}`,`select${x}${L}${at}`,`textarea${x}${L}${at}`,`button${x}${L}${at}`,`details${x} > summary:first-of-type${L}`,`iframe${x}${L}`,`audio[controls]${x}${L}`,`video[controls]${x}${L}`,`[contenteditable]${x}${L}`,`[tabindex]${x}${L}`];function Bt(e,t="config"){const n=(e.getAttribute(`data-${t}`)||"").replace(/'/g,'"');return n?JSON.parse(n):{}}function Wt(e){if(typeof e=="string"){const t=document.getElementById(e);if(t)return t;throw new Error(`Element not found with ID: "${e}"`)}else if(e instanceof HTMLElement){if(!e.id)throw new Error("HTMLElement must have an ID");return e}else throw new Error("Invalid argument: query must be a string or HTMLElement")}function A(e,...t){return typeof e=="function"?e(...t):e}async function U(e,t,...n){t in e&&typeof e[t]=="function"&&await e[t](...n)}function zt(e,t,n){if(typeof t=="string"){const o=document.querySelector(t);if(!o)throw new Error(`No teleport reference found for selector: ${t}`);t=o}else if(!(t instanceof HTMLElement))throw new Error(`Not a valid teleport reference: '${t}'`);if(typeof t[n]!="function")throw new Error(`Not a valid teleport method: '${n}'`);let i=document.createComment("teleported #"+e.id);return e.before(i),t[n](e),()=>{i&&(i.after(e),i.remove(),i=null)}}function _t(e){return e.split("-").map((t,n)=>n===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function Kt(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Qt(e){if(typeof e=="number")return e;const t=parseFloat(e);if(!Number.isNaN(t)){const n=e.includes("ms");return t*(n?1:1e3)}throw new Error(`Could not convert value to milliseconds: ${e}`)}function Ie(e,t,n,i,o=0){return new Promise(s=>{e.classList.remove(t),e.classList.add(n),setTimeout(()=>{e.classList.add(i),e.classList.remove(n),s(e)},Qt(o))})}function Gt(e,t={}){const n={fallback:null,element:document.body,...t};if(!e.startsWith("--")){const o=gt();o&&(e=`${o}${e}`),e=`--${e}`}const i=getComputedStyle(n.element).getPropertyValue(e).trim();if(i)return i;if(n.fallback)return n.fallback;throw new Error(`CSS variable "${e}" was not found!`)}async function I(e,t,n){await U(t,e,n),n&&await U(n,e);for(const i of t.plugins)await U(i,e,{parent:t,entry:n});await t.emit(e,{parent:t,entry:n})}function Ct(e){const t=getComputedStyle(e.el),n={},i=e.config.get("customProps");for(let o=0;o<i.length;o++){const s=gt(),r=e.parent.name.toLowerCase(),a=Kt(i[o]),c=t.getPropertyValue(`--${s}${r}-${a}`).trim();c&&(n[_t(a)]=c)}return n}function gt(){return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim()}function He(e,t){t&&document.querySelectorAll(t).forEach(n=>{e?n.style.overflow="hidden":n.style.removeProperty("overflow")})}function qe(e,t){t&&document.querySelectorAll(t).forEach(n=>{n.inert=e})}function Ne(e,t,n){qe(!!e,t),He(!!e,n)}let Jt=class{#t;#e;constructor(){this.#t={},this.#e=[]}get(t,n){const{fallback:i,source:o}=n??{};if(o){const s=this.#t?.[o]?.[t];if(s!==void 0)return s}else for(const s of this.#e){const r=this.#t?.[s]?.[t];if(r!==void 0)return r}if(i!==void 0)return i;throw new Error(`Config does not exist: ${t}`)}set(t,n={}){let i,o;return typeof t=="string"?(i=t,o=n):(i="entry",o=t),this.#t[i]?Object.assign(this.#t[i],o):(this.#e.unshift(i),this.#t[i]=o),this.#t[i]}remove(t){const n=this.#e.indexOf(t);n!==-1&&this.#e.splice(n,1),delete this.#t[t]}setSourceOrder(t){const n=Object.keys(this.#t).reverse(),i=t.filter(o=>n.includes(o));for(const o of n)i.includes(o)||i.push(o);return this.#e=i}},Xt=class{constructor(){this.events={}}on(t,n,...i){this.events[t]||(this.events[t]=[]),this.events[t].some(o=>o.listener===n)||this.events[t].push({listener:n,args:i})}off(t,n){this.events[t]&&(this.events[t]=this.events[t].filter(i=>i.listener!==n))}async emit(t,...n){if(t=t.startsWith("on")?t.slice(2,3).toLowerCase()+t.slice(3):t,!!this.events[t])for(const{listener:i,args:o}of this.events[t])await i(...n,...o)}},Yt=class extends Array{constructor(t=null){super(),this.el=t,this.el&&this.set()}get first(){return this[0]}get last(){return this[this.length-1]}set(t=this.el){this.length=0,t&&this.push(...t.querySelectorAll(jt.join(",")))}clear(){this.length=0}},Zt=class{constructor(t=null){this.el=t,this.focusable=new Yt,this.handleFocusTrap=Ue.bind(this)}on(t=this.el){this.focusable.set(t),this.focusable.length?document.addEventListener("keydown",this.handleFocusTrap):document.addEventListener("keydown",te)}off(){this.focusable.clear(),document.removeEventListener("keydown",this.handleFocusTrap),document.removeEventListener("keydown",te)}};function te(e){(e.key==="Tab"||e.keyCode===9)&&e.preventDefault()}function Ue(e){if(e.key!=="Tab"&&e.keyCode!==9)return;const{activeElement:t}=document,{el:n,focusable:i}=this,o=e.shiftKey,s=t===i.first||t===n,r=t===i.last||t===n;if(o&&s||!o&&r){e.preventDefault();const a=o?i.last:i.first;a&&typeof a.focus=="function"&&a.focus()}}function Lt(e,t=!0){const n=localStorage.getItem(e),i=n?JSON.parse(n):{};return{get(o,s){return o?o in i?i[o]:s:i},set(o,s){return s?i[o]=s:delete i[o],t&&localStorage.setItem(e,JSON.stringify(i)),i}}}class ee extends Array{constructor(t={}){super(),this.presets=t}#t(t){const n=this.presets?.[t.name]||{},i=t?.options||{};t.config={...t.config,...n,...i}}#e(t){return!("name"in t)||typeof t.name!="string"?(console.error("Plugin requires a name!"),!1):!0}get(t){return this.find(n=>n.name===t)||null}add(t){if(Array.isArray(t))t.forEach(n=>this.add(n));else if(this.#t(t),this.#e(t)){const n=this.findIndex(i=>i.name===t.name);~n?this[n]=t:this.push(t)}}remove(t){const n=this.findIndex(i=>i.name===t);~n&&this.splice(n,1)}}class Fe extends Array{constructor(t={}){super(),this.config=t}get copy(){return[...this]}get top(){return this[this.length-1]||null}updateIndex(){this.forEach((t,n)=>{t.el.style.zIndex="";const i=getComputedStyle(t.el).getPropertyValue("z-index"),o=parseInt(i,10),s=String((Number.isNaN(o)?0:o)+n+1);t.el.style.zIndex=s})}onChange(){this.updateIndex(),typeof this.config.onChange=="function"&&this.config.onChange()}add(t){this.push(t),this.onChange()}remove(t){const n=this.findIndex(i=>i.id===t.id);~n&&(t.el.style.zIndex="",this.splice(n,1),this.onChange())}moveToTop(t){const n=this.findIndex(i=>i.id===t.id);~n&&(this.splice(n,1),this.add(t))}}const Ve={attr:"config",sourceKey:"attr"};function je(e={}){return{name:"attrConfig",config:Ve,options:e,onCreateEntry({entry:t}){const n=Bt(t.el,this.config.attr);t.config.set(this.config.sourceKey,n)},onDestroyEntry({entry:t}){t.config.remove(this.config.sourceKey)}}}const Be={sourceKey:"css"};function We(e={}){const t={name:"cssConfig",config:Be,options:e},n={setup(o){o.on("updateCustomProps",i,this)},teardown(o){o.off("updateCustomProps",i)},onCreateEntry({entry:o}){const s=Ct(o);o.config.set(this.config.sourceKey,s)},onDestroyEntry({entry:o}){o.config.remove(this.config.sourceKey)}};function i(o,s){const r=Ct(o);o.config.set(s.config.sourceKey,r)}return{...t,...n}}const ze={condition:!0},_e={primary:"hsl(152deg 60% 50%)",secondary:"hsl(214deg 50% 50%)",neutral:"hsl(214deg 20% 50%)",important:"hsl(0deg 80% 50%)"};function Ke(e={}){const t={name:"debug",config:ze,options:e};function n(o,s=[],r=["primary","secondary"]){const a=r.map(c=>`color: ${_e[c]}`);console.log(`%c📡 DEBUG: %c${o}`,...a,...s)}const i={beforeMountRef:n.bind(null,"Event > beforeMount()",[],["primary","secondary"]),afterMountRef:n.bind(null,"Event > afterMount()",[],["primary","secondary"]),beforeUnmountRef:n.bind(null,"Event > beforeUnmount()",[],["important","neutral"]),afterUnmountRef:n.bind(null,"Event > afterUnmount()",[],["important","neutral"]),createEntryRef:({parent:o,entry:s},r)=>{if(A(r.config.condition,s)){const a=o.collection.length;n(`Event > createEntry() > [${a}] #${s.id}`)}},registerEntryRef:({parent:o,entry:s},r)=>{if(A(r.config.condition,s)){const a=o.collection.length;n(`Event > registerEntry() > [${a}] #${s.id}`)}},destroyEntryRef:({parent:o,entry:s},r)=>{if(A(r.config.condition,s)){const a=o.collection.length;n(`Event > destroyEntry() > [${a}] #${s.id}`,[],["important","neutral"])}},deregisterEntryRef:({parent:o,entry:s},r)=>{if(A(r.config.condition,s)){const a=o.collection.length;n(`Event > deregisterEntry() > [${a}]`,[],["important","neutral"])}}};return{...t,setup(o){n("Plugin > setup()",Array.from(arguments),["secondary","neutral"]),o.on("beforeMount",i.beforeMountRef),o.on("createEntry",i.createEntryRef,this),o.on("registerEntry",i.registerEntryRef,this),o.on("afterMount",i.afterMountRef),o.on("beforeUnmount",i.beforeUnmountRef),o.on("destroyEntry",i.destroyEntryRef,this),o.on("deregisterEntry",i.deregisterEntryRef,this),o.on("afterUnmount",i.afterUnmountRef)},teardown(o){n("Plugin > teardown()",Array.from(arguments),["secondary","neutral"]),o.off("beforeMount",i.beforeMountRef),o.off("createEntry",i.createEntryRef),o.off("registerEntry",i.registerEntryRef),o.off("afterMount",i.afterMountRef),o.off("beforeUnmount",i.beforeUnmountRef),o.off("destroyEntry",i.destroyEntryRef),o.off("deregisterEntry",i.deregisterEntryRef),o.off("afterUnmount",i.afterUnmountRef)},beforeMount(){n("Hook > beforeMount()",Array.from(arguments))},onCreateEntry({parent:o,entry:s}){if(A(this.config.condition,s)){const r=o.collection.length;n(`Hook > onCreateEntry() > [${r}] #${s.id}`,Array.from(arguments))}},onRegisterEntry({parent:o,entry:s}){if(A(this.config.condition,s)){const r=o.collection.length-1;n(`Hook > onRegisterEntry() > [${r}] #${s.id}`,Array.from(arguments))}},afterMount(){n("Hook > afterMount()",Array.from(arguments))},beforeUnmount(){n("Hook > beforeUnmount()",Array.from(arguments),["important","neutral"])},onDestroyEntry({parent:o,entry:s}){if(A(this.config.condition,s)){const r=o.collection.length-1;n(`Hook > onDestroyEntry() > [${r}] #${s.id}`,Array.from(arguments),["important","neutral"])}},onDeregisterEntry({parent:o,entry:s}){if(A(this.config.condition,s)){const r=o.collection.length;n(`Hook > onDeregisterEntry() > [${r}]`,Array.from(arguments),["important","neutral"])}},afterUnmount(){n("Hook > afterUnmount()",Array.from(arguments),["important","neutral"])}}}const Qe={condition:!0};function Ge(e={}){const t={name:"focusTrap",config:Qe,options:e},n={setup(s){s.on("opened",i,this),s.on("closed",o,this)},teardown(s){s.off("opened",i),s.off("closed",o)},onCreateEntry({entry:s}){s.focusTrap=new Zt}};function i(s,r){const a={plugin:r,parent:s.parent,entry:s};s.focusTrap&&A(r.config.condition,a)&&s.focusTrap.on(s.dialog)}function o(s,r){const a={plugin:r,parent:s.parent,entry:s};s.focusTrap&&A(r.config.condition,a)&&s.focusTrap.off()}return{...t,...n}}const Je={attrBreakpoint:"breakpoint",attrMediaQuery:"media-query",token:"{{BP}}",breakpoint:null,mediaQuery:"(min-width: {{BP}})",breakpoints:{},mediaQueries:{},onChange:()=>{}};function Xe(e={}){const t={name:"mediaQuery",config:Je,options:e},n={onCreateEntry({entry:a}){s.call(this,a)},onDestroyEntry({entry:a}){r(a)}};function i(a){const c=a.el.getAttribute(`data-${this.config.attrMediaQuery}`);return!c&&a.id in this.config.mediaQueries?this.config.mediaQueries[a.id]:c||void 0}function o(a){let c=a.el.getAttribute(`data-${this.config.attrBreakpoint}`);return!c&&a.id in this.config.breakpoints&&(c=this.config.breakpoints[a.id]),c&&c in this.config.breakpoints&&(c=this.config.breakpoints[c]),c&&(c=getComputedStyle(document.body).getPropertyValue(`--${gt()}breakpoint-${c}`).trim()||c),c||this.config.breakpoint}function s(a){const c=o.call(this,a);if(!c)return;let l=i.call(this,a)||this.config.mediaQuery;if(!l)return;const u=l.replace(new RegExp(`${this.config.token}`,"g"),c);a.mql=window.matchMedia(u),a.mql.onchange=h=>{this.config.onChange(h,a)},this.config.onChange(a.mql,a)}function r(a){a.mql&&(a.mql.onchange=null,a.mql=null)}return{...t,...n}}const Ye={prop:"state",value:null,keyPrefix:"VB:",key:null,condition:!1,onChange(){}};function Ze(e={}){const t={name:"propStore",config:Ye,options:e,store:null},n={setup(r){this.store=Lt(s.call(this,r.name))},async onCreateEntry({entry:r}){await i.call(this,r)},onDestroyEntry({entry:r}){o.call(this,r)}};async function i(r){let a=r[this.config.prop]||null;const c={plugin:this,parent:r.parent,entry:r};Object.defineProperty(r,this.config.prop,{configurable:!0,get(){return a},set:async l=>{if(a===l)return;const u=a;a=l,A(this.config.condition,c,l,u)&&this.store?.set(r.id,l),await this.config.onChange(c,l,u)}}),Object.defineProperty(r,"store",{configurable:!0,get:()=>this.store?.get(r.id),set:l=>{r[this.config.prop]=l}}),r[this.config.prop]=await A(this.config.value,c)||r[this.config.prop]}async function o(r){const a=r[this.config.prop];delete r[this.config.prop],r[this.config.prop]=a,this.store?.set(r.id,null)}function s(r){const a=this.config.prop.charAt(0).toUpperCase()+this.config.prop.slice(1),c=this.config.key||r+a;return this.config.keyPrefix+c}return{...t,...n}}const tn={where:null,how:"append"};function en(e={}){const t={name:"teleport",config:tn,options:e},n={onCreateEntry({entry:s}){i(this,s)},onDestroyEntry({entry:s}){o(this,s)}};function i(s,r){r.teleport=()=>{typeof r.teleportReturn=="function"&&r.teleportReturn(),r.teleportReturn=zt(r.el,r.config.get("teleport",{fallback:s.config.where}),r.config.get("teleportMethod",{fallback:s.config.how}))},r.teleport(),r.parent.emit("teleport",{plugin:s,parent:r.parent,entry:r})}function o(s,r){typeof r.teleportReturn=="function"&&r.teleportReturn(),r.parent.emit("teleportReturn",{plugin:s,parent:r.parent,entry:r})}return{...t,...n}}let ne=class{constructor(t,n){this.config=new Jt,this.parent=t,this.el=Wt(n),this.id=this.el.id,this.config.set("parent",this.parent.config),this.config.set("entry",{})}};const nn={selector:"",plugins:[],presets:{}};let on=class{constructor(t={}){this.#t=new Xt,this.events=this.#t.events,this.on=this.#t.on.bind(this.#t),this.off=this.#t.off.bind(this.#t),this.emit=this.#t.emit.bind(this.#t),this.collection=[],this.entryClass=ne,this.name=this.constructor.name,this.config={...nn,...t},this.plugins=new ee(this.config.presets)}#t;get(t,n="id"){return this.collection.find(i=>i[n]===t)}getOrThrow(t,n="id"){const i=this.get(t,n);if(i)return i;throw new Error(`${this.name} entry not found in collection with ${String(n)} of "${t}"`)}updateConfig(t={}){return Object.assign(this.config,t)}async createEntry(t){const n=new this.entryClass(this,t);return await U(n,"init"),await I("onCreateEntry",this,n),n}async destroyEntry(t){return await I("onDestroyEntry",this,t),await U(t,"destroy"),t}async register(t){const n=this.collection.findIndex(i=>i.id===t.id);return~n?this.collection[n]=t:this.collection.push(t),await I("onRegisterEntry",this,t),t}async deregister(t){const n=this.collection.findIndex(i=>i.id===t.id);if(~n){await I("onDeregisterEntry",this,this.collection[n]);const[i]=this.collection.splice(n,1)}return t}async mount(t=n=>n){for(const n of this.config?.plugins||[])this.plugins.add(n);for(const n of this.plugins)await U(n,"setup",this);if(await I("beforeMount",this),this.config.selector){const n=document.querySelectorAll(this.config.selector);for(const i of n)await this.createEntry(i).then(o=>t(o)).then(o=>this.register(o))}return await I("afterMount",this),this}async unmount(t=n=>n){for(await I("beforeUnmount",this);this.collection.length>0;)await this.destroyEntry(this.collection[0]).then(n=>t(n)).then(n=>this.deregister(n));await I("afterUnmount",this);for(const n of this.plugins)await U(n,"teardown",this);for(const n of[...this.plugins])this.plugins.remove(n.name);return this}};const sn={prefix:Gt("theme-prefix",{fallback:"vb-theme-"}),storeKey:"VB:Profile",fallback:"root",themes:["root","light","dark"],onInit(){},onChange(){}};function rn(e={}){const t={...sn,...e};function n(s){t[s].call(o)}const i=Lt(t.storeKey),o={config:t,add(s){t.themes.push(s)},remove(s){const r=t.themes.indexOf(s);~r&&t.themes.splice(r,1)},get class(){return`${t.prefix}${this.theme}`},get classes(){return t.themes.map(s=>`${t.prefix}${s}`)},get themes(){return t.themes},get theme(){return i.get("theme")||t.fallback},set theme(s){t.themes.includes(s)?this.theme!=s&&(i.set("theme",s),document.documentElement.classList.remove(...this.classes),document.documentElement.classList.add(`${t.prefix}${s}`),n("onChange")):console.error(`Not a valid theme value: "${s}"`)}};return n("onInit"),o}const an=Object.freeze(Object.defineProperty({__proto__:null,Collection:on,CollectionEntry:ne,ConfigManager:Jt,EventEmitter:Xt,FocusTrap:Zt,FocusableArray:Yt,PluginArray:ee,StackArray:Fe,attrConfig:je,cssConfig:We,cssVar:Gt,debug:Ke,dispatchLifecycleHook:I,focusTrap:Ge,focusableSelectors:jt,getAttrData:Bt,getCustomProps:Ct,getElement:Wt,getPrefix:gt,getValue:A,localStore:Lt,maybeRunMethod:U,mediaQuery:Xe,propStore:Ze,setGlobalState:Ne,teleport:en,teleportElement:zt,themeStore:rn,toCamel:_t,toKebab:Kt,toMilliseconds:Qt,transition:Ie},Symbol.toStringTag,{value:"Module"}));function cn(e){if(typeof e=="string"){const t=document.getElementById(e);if(t)return t;throw new Error(`Element not found with ID: "${e}"`)}else if(e instanceof HTMLElement){if(!e.id)throw new Error("HTMLElement must have an ID");return e}else throw new Error("Invalid argument: query must be a string or HTMLElement")}async function K(e,t,...n){t in e&&typeof e[t]=="function"&&await e[t](...n)}function ln(e){if(typeof e=="number")return e;const t=parseFloat(e);if(!Number.isNaN(t)){const n=e.includes("ms");return t*(n?1:1e3)}throw new Error(`Could not convert value to milliseconds: ${e}`)}function ie(e,t,n,i,o=0){return new Promise(s=>{e.classList.remove(t),e.classList.add(n),setTimeout(()=>{e.classList.add(i),e.classList.remove(n),s(e)},ln(o))})}function fn(e,t={}){const n={fallback:null,element:document.body,...t};if(!e.startsWith("--")){const o=un();o&&(e=`${o}${e}`),e=`--${e}`}const i=getComputedStyle(n.element).getPropertyValue(e).trim();if(i)return i;if(n.fallback)return n.fallback;throw new Error(`CSS variable "${e}" was not found!`)}async function F(e,t,n){await K(t,e,n),n&&await K(n,e);for(const i of t.plugins)await K(i,e,{parent:t,entry:n});await t.emit(e,{parent:t,entry:n})}function un(){return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim()}function hn(e,t){t&&document.querySelectorAll(t).forEach(n=>{e?n.style.overflow="hidden":n.style.removeProperty("overflow")})}function dn(e,t){t&&document.querySelectorAll(t).forEach(n=>{n.inert=e})}function At(e,t,n){dn(!!e,t),hn(!!e,n)}let gn=class{#t;#e;constructor(){this.#t={},this.#e=[]}get(t,n){const{fallback:i,source:o}=n??{};if(o){const s=this.#t?.[o]?.[t];if(s!==void 0)return s}else for(const s of this.#e){const r=this.#t?.[s]?.[t];if(r!==void 0)return r}if(i!==void 0)return i;throw new Error(`Config does not exist: ${t}`)}set(t,n={}){let i,o;return typeof t=="string"?(i=t,o=n):(i="entry",o=t),this.#t[i]?Object.assign(this.#t[i],o):(this.#e.unshift(i),this.#t[i]=o),this.#t[i]}remove(t){const n=this.#e.indexOf(t);n!==-1&&this.#e.splice(n,1),delete this.#t[t]}setSourceOrder(t){const n=Object.keys(this.#t).reverse(),i=t.filter(o=>n.includes(o));for(const o of n)i.includes(o)||i.push(o);return this.#e=i}},pn=class{constructor(){this.events={}}on(t,n,...i){this.events[t]||(this.events[t]=[]),this.events[t].some(o=>o.listener===n)||this.events[t].push({listener:n,args:i})}off(t,n){this.events[t]&&(this.events[t]=this.events[t].filter(i=>i.listener!==n))}async emit(t,...n){if(t=t.startsWith("on")?t.slice(2,3).toLowerCase()+t.slice(3):t,!!this.events[t])for(const{listener:i,args:o}of this.events[t])await i(...n,...o)}},mn=class extends Array{constructor(t={}){super(),this.presets=t}#t(t){const n=this.presets?.[t.name]||{},i=t?.options||{};t.config={...t.config,...n,...i}}#e(t){return!("name"in t)||typeof t.name!="string"?(console.error("Plugin requires a name!"),!1):!0}get(t){return this.find(n=>n.name===t)||null}add(t){if(Array.isArray(t))t.forEach(n=>this.add(n));else if(this.#t(t),this.#e(t)){const n=this.findIndex(i=>i.name===t.name);~n?this[n]=t:this.push(t)}}remove(t){const n=this.findIndex(i=>i.name===t);~n&&this.splice(n,1)}},oe=class{constructor(t,n){this.config=new gn,this.parent=t,this.el=cn(n),this.id=this.el.id,this.config.set("parent",this.parent.config),this.config.set("entry",{})}};const yn={selector:"",plugins:[],presets:{}};let wn=class{constructor(t={}){this.#t=new pn,this.events=this.#t.events,this.on=this.#t.on.bind(this.#t),this.off=this.#t.off.bind(this.#t),this.emit=this.#t.emit.bind(this.#t),this.collection=[],this.entryClass=oe,this.name=this.constructor.name,this.config={...yn,...t},this.plugins=new mn(this.config.presets)}#t;get(t,n="id"){return this.collection.find(i=>i[n]===t)}getOrThrow(t,n="id"){const i=this.get(t,n);if(i)return i;throw new Error(`${this.name} entry not found in collection with ${String(n)} of "${t}"`)}updateConfig(t={}){return Object.assign(this.config,t)}async createEntry(t){const n=new this.entryClass(this,t);return await K(n,"init"),await F("onCreateEntry",this,n),n}async destroyEntry(t){return await F("onDestroyEntry",this,t),await K(t,"destroy"),t}async register(t){const n=this.collection.findIndex(i=>i.id===t.id);return~n?this.collection[n]=t:this.collection.push(t),await F("onRegisterEntry",this,t),t}async deregister(t){const n=this.collection.findIndex(i=>i.id===t.id);if(~n){await F("onDeregisterEntry",this,this.collection[n]);const[i]=this.collection.splice(n,1)}return t}async mount(t=n=>n){for(const n of this.config?.plugins||[])this.plugins.add(n);for(const n of this.plugins)await K(n,"setup",this);if(await F("beforeMount",this),this.config.selector){const n=document.querySelectorAll(this.config.selector);for(const i of n)await this.createEntry(i).then(o=>t(o)).then(o=>this.register(o))}return await F("afterMount",this),this}async unmount(t=n=>n){for(await F("beforeUnmount",this);this.collection.length>0;)await this.destroyEntry(this.collection[0]).then(n=>t(n)).then(n=>this.deregister(n));await F("afterUnmount",this);for(const n of this.plugins)await K(n,"teardown",this);for(const n of[...this.plugins])this.plugins.remove(n.name);return this}};fn("theme-prefix",{fallback:"vb-theme-"});const vn={focusTrap:{condition:({entry:e})=>e.state==="closed"||e.state==="opened"&&e.mode==="modal"},mediaQuery:{onChange(e,t){t.mode=e.matches?"inline":"modal"}},propStore:{prop:"inlineState",value:({entry:e})=>e.store,condition:({entry:e})=>["opened","closed","indeterminate"].includes(e.state),onChange:({entry:e})=>e.applyState()}},bn={presets:vn,attrOpen:"drawer-open",attrClose:"drawer-close",attrToggle:"drawer-toggle",selector:".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",customProps:["transition-duration"],breakpoints:null,customEventPrefix:"drawer:",setTabindex:!0,transition:!0,transitionDuration:300};function En(e){switch(e.mode){case"inline":return xn(e);case"modal":return $n(e);default:throw new Error(`"${e.mode}" is not a valid drawer mode.`)}}async function xn(e){return e.el.classList.remove(e.config.get("classModal")),e.dialog.removeAttribute("aria-modal"),At(!1,e.config.get("selectorInert"),e.config.get("selectorOverflow")),e.applyState(),e.el.dispatchEvent(new CustomEvent(e.config.get("customEventPrefix")+"switchMode",{detail:e.parent,bubbles:!0})),await e.parent.emit("switchMode",e),e}async function $n(e){return e.el.classList.add(e.config.get("classModal")),e.dialog.setAttribute("aria-modal","true"),await e.close(!1,!1),e.el.dispatchEvent(new CustomEvent(e.config.get("customEventPrefix")+"switchMode",{detail:e.parent,bubbles:!0})),await e.parent.emit("switchMode",e),e}function se(e){e.dialog&&e.state==="opened"?(e.dialog.querySelector(e.config.get("selectorFocus"))||e.dialog).focus():e.trigger&&(e.trigger.focus(),e.trigger=null)}async function kt(e,t,n=!0){return(e.state==="closed"||e.state==="indeterminate"||e.state===null)&&(e.setState("opening"),t??e.config.get("transition")?await ie(e.el,e.config.get("stateClosed"),e.config.get("stateOpening"),e.config.get("stateOpened"),e.config.get("transitionDuration")):(e.el.classList.add(e.config.get("stateOpened")),e.el.classList.remove(e.config.get("stateClosed"))),e.setState("opened"),e.mode==="modal"&&At(!0,e.config.get("selectorInert"),e.config.get("selectorOverflow")),n&&se(e),e.el.dispatchEvent(new CustomEvent(e.config.get("customEventPrefix")+"opened",{detail:e.parent,bubbles:!0})),await e.parent.emit("opened",e)),e}async function St(e,t,n=!0){return(e.state==="opened"||e.state==="indeterminate"||e.state===null)&&(e.setState("closing"),document.activeElement&&document.activeElement instanceof HTMLElement&&document.activeElement.blur(),t??e.config.get("transition")?await ie(e.el,e.config.get("stateOpened"),e.config.get("stateClosing"),e.config.get("stateClosed"),e.config.get("transitionDuration")):(e.el.classList.add(e.config.get("stateClosed")),e.el.classList.remove(e.config.get("stateOpened"))),e.setState("closed"),e.mode==="modal"&&At(!1,e.config.get("selectorInert"),e.config.get("selectorOverflow")),n&&se(e),e.el.dispatchEvent(new CustomEvent(e.config.get("customEventPrefix")+"closed",{detail:e.parent,bubbles:!0})),await e.parent.emit("closed",e)),e}async function re(e,t,n){return e.state==="closed"?kt(e,t,n):St(e,t,n)}let Cn=class extends oe{#t;constructor(t,n){super(t,n),this.#t="indeterminate",this.dialog=this.el.querySelector(this.config.get("selectorDialog"))||this.el,this.trigger=null,this.state=null,this.inlineState=null}get mode(){return this.#t}set mode(t){this.#t!==t&&(this.#t=t,En(this))}setState(t){this.state=t;const n=["opening","closing"];this.mode==="inline"&&!n.includes(t)&&(this.inlineState=t),t==="indeterminate"&&(this.el.classList.remove(this.config.get("stateOpened")),this.el.classList.remove(this.config.get("stateOpening")),this.el.classList.remove(this.config.get("stateClosed")),this.el.classList.remove(this.config.get("stateClosing")))}async applyState(){if(this.mode==="modal")return this;if(this.inlineState==="opened")return await this.open(!1,!1);if(this.inlineState==="closed")return await this.close(!1,!1);if(this.state===null){if(this.el.classList.contains(this.config.get("stateOpened")))return await this.open(!1,!1);if(this.el.classList.contains(this.config.get("stateClosed")))return await this.close(!1,!1)}return this.setState("indeterminate"),this}async open(t,n){return kt(this,t,n)}async close(t,n){return St(this,t,n)}async toggle(t,n){return re(this,t,n)}async deregister(){return this.parent.deregister(this)}async onCreateEntry(){this.config.get("setTabindex")&&this.dialog&&this.dialog.setAttribute("tabindex","-1"),await this.applyState(),this.inlineState=this.state,this.mode=this.el&&this.el.classList.contains(this.config.get("classModal"))?"modal":"inline"}async onDestroyEntry(){this.mode==="modal"&&this.state==="opened"&&await this.close(!1)}};async function Ln(e){const t=e.target;if(t){const n=t.closest(`
2
+ [data-${this.config.attrOpen}],
3
+ [data-${this.config.attrToggle}],
4
+ [data-${this.config.attrClose}]
5
+ `);if(n){e.preventDefault(),n.matches(`[data-${this.config.attrToggle}]`)&&n.getAttribute(`data-${this.config.attrToggle}`)?.trim().split(" ")?.forEach(i=>{const o=this.getOrThrow(i);return o.trigger=n,o.toggle()}),n.matches(`[data-${this.config.attrOpen}]`)&&n.getAttribute(`data-${this.config.attrOpen}`)?.trim().split(" ")?.forEach(i=>{const o=this.getOrThrow(i);return o.trigger=n,o.open()}),n.matches(`[data-${this.config.attrClose}]`)&&n.getAttribute(`data-${this.config.attrClose}`)?.trim().split(" ")?.forEach(i=>{if(i){const o=this.getOrThrow(i);return o.trigger=n,o.close()}else{const o=t.closest(this.config.selector);if(o)return this.close(o.id)}});return}if(this.activeModal&&t.matches(this.config.selectorScreen))return this.close(this.activeModal.id)}}function An(e){if(e.key==="Escape"&&this.activeModal)return this.close(this.activeModal.id)}let kn=class extends wn{constructor(t){super({...bn,...t}),this.entryClass=Cn,this.name="Drawer",this.#t=Ln.bind(this),this.#e=An.bind(this)}#t;#e;get activeModal(){return this.collection.find(t=>t.state==="opened"&&t.mode==="modal")}async open(t,n,i){const o=this.getOrThrow(t);return kt(o,n,i)}async close(t,n,i){const o=this.getOrThrow(t);return St(o,n,i)}async toggle(t,n,i){const o=this.getOrThrow(t);return re(o,n,i)}async afterMount(){document.addEventListener("click",this.#t,!1),document.addEventListener("keydown",this.#e,!1)}async afterUnmount(){document.removeEventListener("click",this.#t,!1),document.removeEventListener("keydown",this.#e,!1)}};function Sn(e){if(typeof e=="string"){const t=document.getElementById(e);if(t)return t;throw new Error(`Element not found with ID: "${e}"`)}else if(e instanceof HTMLElement){if(!e.id)throw new Error("HTMLElement must have an ID");return e}else throw new Error("Invalid argument: query must be a string or HTMLElement")}async function Q(e,t,...n){t in e&&typeof e[t]=="function"&&await e[t](...n)}function Tn(e){if(typeof e=="number")return e;const t=parseFloat(e);if(!Number.isNaN(t)){const n=e.includes("ms");return t*(n?1:1e3)}throw new Error(`Could not convert value to milliseconds: ${e}`)}function ae(e,t,n,i,o=0){return new Promise(s=>{e.classList.remove(t),e.classList.add(n),setTimeout(()=>{e.classList.add(i),e.classList.remove(n),s(e)},Tn(o))})}function On(e,t={}){const n={fallback:null,element:document.body,...t};if(!e.startsWith("--")){const o=Rn();o&&(e=`${o}${e}`),e=`--${e}`}const i=getComputedStyle(n.element).getPropertyValue(e).trim();if(i)return i;if(n.fallback)return n.fallback;throw new Error(`CSS variable "${e}" was not found!`)}async function V(e,t,n){await Q(t,e,n),n&&await Q(n,e);for(const i of t.plugins)await Q(i,e,{parent:t,entry:n});await t.emit(e,{parent:t,entry:n})}function Rn(){return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim()}function Pn(e,t){t&&document.querySelectorAll(t).forEach(n=>{e?n.style.overflow="hidden":n.style.removeProperty("overflow")})}function Mn(e,t){t&&document.querySelectorAll(t).forEach(n=>{n.inert=e})}function Dn(e,t,n){Mn(!!e,t),Pn(!!e,n)}class In{#t;#e;constructor(){this.#t={},this.#e=[]}get(t,n){const{fallback:i,source:o}=n??{};if(o){const s=this.#t?.[o]?.[t];if(s!==void 0)return s}else for(const s of this.#e){const r=this.#t?.[s]?.[t];if(r!==void 0)return r}if(i!==void 0)return i;throw new Error(`Config does not exist: ${t}`)}set(t,n={}){let i,o;return typeof t=="string"?(i=t,o=n):(i="entry",o=t),this.#t[i]?Object.assign(this.#t[i],o):(this.#e.unshift(i),this.#t[i]=o),this.#t[i]}remove(t){const n=this.#e.indexOf(t);n!==-1&&this.#e.splice(n,1),delete this.#t[t]}setSourceOrder(t){const n=Object.keys(this.#t).reverse(),i=t.filter(o=>n.includes(o));for(const o of n)i.includes(o)||i.push(o);return this.#e=i}}class Hn{constructor(){this.events={}}on(t,n,...i){this.events[t]||(this.events[t]=[]),this.events[t].some(o=>o.listener===n)||this.events[t].push({listener:n,args:i})}off(t,n){this.events[t]&&(this.events[t]=this.events[t].filter(i=>i.listener!==n))}async emit(t,...n){if(t=t.startsWith("on")?t.slice(2,3).toLowerCase()+t.slice(3):t,!!this.events[t])for(const{listener:i,args:o}of this.events[t])await i(...n,...o)}}class qn extends Array{constructor(t={}){super(),this.presets=t}#t(t){const n=this.presets?.[t.name]||{},i=t?.options||{};t.config={...t.config,...n,...i}}#e(t){return!("name"in t)||typeof t.name!="string"?(console.error("Plugin requires a name!"),!1):!0}get(t){return this.find(n=>n.name===t)||null}add(t){if(Array.isArray(t))t.forEach(n=>this.add(n));else if(this.#t(t),this.#e(t)){const n=this.findIndex(i=>i.name===t.name);~n?this[n]=t:this.push(t)}}remove(t){const n=this.findIndex(i=>i.name===t);~n&&this.splice(n,1)}}class Nn extends Array{constructor(t={}){super(),this.config=t}get copy(){return[...this]}get top(){return this[this.length-1]||null}updateIndex(){this.forEach((t,n)=>{t.el.style.zIndex="";const i=getComputedStyle(t.el).getPropertyValue("z-index"),o=parseInt(i,10),s=String((Number.isNaN(o)?0:o)+n+1);t.el.style.zIndex=s})}onChange(){this.updateIndex(),typeof this.config.onChange=="function"&&this.config.onChange()}add(t){this.push(t),this.onChange()}remove(t){const n=this.findIndex(i=>i.id===t.id);~n&&(t.el.style.zIndex="",this.splice(n,1),this.onChange())}moveToTop(t){const n=this.findIndex(i=>i.id===t.id);~n&&(this.splice(n,1),this.add(t))}}class ce{constructor(t,n){this.config=new In,this.parent=t,this.el=Sn(n),this.id=this.el.id,this.config.set("parent",this.parent.config),this.config.set("entry",{})}}const Un={selector:"",plugins:[],presets:{}};let Fn=class{constructor(t={}){this.#t=new Hn,this.events=this.#t.events,this.on=this.#t.on.bind(this.#t),this.off=this.#t.off.bind(this.#t),this.emit=this.#t.emit.bind(this.#t),this.collection=[],this.entryClass=ce,this.name=this.constructor.name,this.config={...Un,...t},this.plugins=new qn(this.config.presets)}#t;get(t,n="id"){return this.collection.find(i=>i[n]===t)}getOrThrow(t,n="id"){const i=this.get(t,n);if(i)return i;throw new Error(`${this.name} entry not found in collection with ${String(n)} of "${t}"`)}updateConfig(t={}){return Object.assign(this.config,t)}async createEntry(t){const n=new this.entryClass(this,t);return await Q(n,"init"),await V("onCreateEntry",this,n),n}async destroyEntry(t){return await V("onDestroyEntry",this,t),await Q(t,"destroy"),t}async register(t){const n=this.collection.findIndex(i=>i.id===t.id);return~n?this.collection[n]=t:this.collection.push(t),await V("onRegisterEntry",this,t),t}async deregister(t){const n=this.collection.findIndex(i=>i.id===t.id);if(~n){await V("onDeregisterEntry",this,this.collection[n]);const[i]=this.collection.splice(n,1)}return t}async mount(t=n=>n){for(const n of this.config?.plugins||[])this.plugins.add(n);for(const n of this.plugins)await Q(n,"setup",this);if(await V("beforeMount",this),this.config.selector){const n=document.querySelectorAll(this.config.selector);for(const i of n)await this.createEntry(i).then(o=>t(o)).then(o=>this.register(o))}return await V("afterMount",this),this}async unmount(t=n=>n){for(await V("beforeUnmount",this);this.collection.length>0;)await this.destroyEntry(this.collection[0]).then(n=>t(n)).then(n=>this.deregister(n));await V("afterUnmount",this);for(const n of this.plugins)await Q(n,"teardown",this);for(const n of[...this.plugins])this.plugins.remove(n.name);return this}};On("theme-prefix",{fallback:"vb-theme-"});const Vn={attrOpen:"modal-open",attrClose:"modal-close",attrReplace:"modal-replace",selector:".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",customProps:["transition-duration"],customEventPrefix:"modal:",setTabindex:!0,transition:!0,transitionDuration:300};function pt(e){if(e.active){const t=e.active.dialog.querySelector(e.config.selectorFocus)||e.active.dialog;"focus"in t&&typeof t.focus=="function"&&t.focus()}else e.trigger&&(e.trigger.focus(),e.trigger=null)}async function Tt(e,t,n=!0){return e.parent.stack.moveToTop(e),e.state==="closed"&&(e.state="opening",e.parent.stack.add(e),t??e.config.get("transition")?await ae(e.el,e.config.get("stateClosed"),e.config.get("stateOpening"),e.config.get("stateOpened"),e.config.get("transitionDuration")):(e.el.classList.add(e.config.get("stateOpened")),e.el.classList.remove(e.config.get("stateClosed"))),e.state="opened"),n&&pt(e.parent),e.el.dispatchEvent(new CustomEvent(e.config.get("customEventPrefix")+"opened",{detail:e.parent,bubbles:!0})),await e.parent.emit("opened",e),e}async function Ot(e,t,n=!0){return e&&e.state==="opened"&&(e.state="closing",document.activeElement&&document.activeElement instanceof HTMLElement&&document.activeElement.blur(),t??e.config.get("transition")?await ae(e.el,e.config.get("stateOpened"),e.config.get("stateClosing"),e.config.get("stateClosed"),e.config.get("transitionDuration")):(e.el.classList.add(e.config.get("stateClosed")),e.el.classList.remove(e.config.get("stateOpened"))),e.parent.stack.remove(e),e.state="closed",n&&pt(e.parent),e.el.dispatchEvent(new CustomEvent(e.config.get("customEventPrefix")+"closed",{detail:e.parent,bubbles:!0})),await e.parent.emit("closed",e)),e}async function le(e,t,n=!0){let i,o;return e.state==="opened"?(i=e,o=await e.parent.closeAll(e.id,t)):[o,i]=await Promise.all([e.parent.closeAll("",t),Tt(e,t,!1)]),n&&pt(e.parent),{opened:i,closed:o}}class jn extends ce{constructor(t,n){super(t,n),this.state="closed",this.dialog=this.el.querySelector(this.config.get("selectorDialog"))||this.el}get isRequired(){return this.dialog.matches(this.config.get("selectorRequired"))}async open(t,n){return Tt(this,t,n)}async close(t,n){return Ot(this,t,n)}async replace(t,n){return le(this,t,n)}async deregister(){return this.parent.deregister(this)}async onCreateEntry(){this.dialog.setAttribute("aria-modal","true"),this.dialog.hasAttribute("role")||this.dialog.setAttribute("role","dialog"),this.config.get("setTabindex")&&this.dialog.setAttribute("tabindex","-1")}async onRegisterEntry(){this.el.classList.contains(this.config.get("stateOpened"))?await this.open(!1):(this.el.classList.remove(this.config.get("stateOpening")),this.el.classList.remove(this.config.get("stateClosing")),this.el.classList.add(this.config.get("stateClosed")))}async onDestroyEntry(){this.state==="opened"&&await this.close(!1)}}async function Bn(e){const t=e.target;if(t){const n=t.closest(`
6
+ [data-${this.config.attrOpen}],
7
+ [data-${this.config.attrReplace}],
8
+ [data-${this.config.attrClose}]
9
+ `);if(n){if(e.preventDefault(),n.matches(`[data-${this.config.attrOpen}]`)){const i=n.getAttribute(`data-${this.config.attrOpen}`)?.trim(),o=this.getOrThrow(i);return t.closest(this.config.selector)||(this.trigger=n),o.open()}if(n.matches(`[data-${this.config.attrReplace}]`)){const i=n.getAttribute(`data-${this.config.attrReplace}`)?.trim(),o=this.getOrThrow(i);return t.closest(this.config.selector)||(this.trigger=n),o.replace()}if(n.matches(`[data-${this.config.attrClose}]`)){const i=n.getAttribute(`data-${this.config.attrClose}`)?.trim();return i==="*"?this.closeAll():this.close(i||"")}}if(this.active&&t.matches(this.config.selectorScreen)&&!this.active.isRequired)return this.close()}}function Wn(e){if(e.key==="Escape"&&this.active&&!this.active.dialog.matches(this.config.selectorRequired))return this.close()}async function zn(e="",t){const n=[];return await Promise.all(this.stack.copy.map(async i=>{e&&e===i.id||n.push(await Ot(i,t,!1))})),n}let _n=class extends Fn{constructor(t){super({...Vn,...t}),this.entryClass=jn,this.name="Modal",this.trigger=null,this.#t=Bn.bind(this),this.#e=Wn.bind(this),this.stack=new Nn({onChange:()=>{Dn(!!this.stack.top,this.config.selectorInert,this.config.selectorOverflow)}})}#t;#e;get active(){return this.stack.top}async open(t,n,i){const o=this.getOrThrow(t);return Tt(o,n,i)}async close(t,n,i){const o=t?this.getOrThrow(t):this.active;return Ot(o,n,i)}async replace(t,n,i){const o=this.getOrThrow(t);return le(o,n,i)}async closeAll(t,n,i=!0){const o=await zn.call(this,t,n);return i&&pt(this),o}async afterMount(){document.addEventListener("click",this.#t,!1),document.addEventListener("keydown",this.#e,!1)}async beforeUnmount(){this.trigger=null}async afterUnmount(){document.removeEventListener("click",this.#t,!1),document.removeEventListener("keydown",this.#e,!1)}};function Kn(e){if(typeof e=="string"){const t=document.getElementById(e);if(t)return t;throw new Error(`Element not found with ID: "${e}"`)}else if(e instanceof HTMLElement){if(!e.id)throw new Error("HTMLElement must have an ID");return e}else throw new Error("Invalid argument: query must be a string or HTMLElement")}async function G(e,t,...n){t in e&&typeof e[t]=="function"&&await e[t](...n)}function Qn(e,t={}){const n={fallback:null,element:document.body,...t};if(!e.startsWith("--")){const o=Gn();o&&(e=`${o}${e}`),e=`--${e}`}const i=getComputedStyle(n.element).getPropertyValue(e).trim();if(i)return i;if(n.fallback)return n.fallback;throw new Error(`CSS variable "${e}" was not found!`)}async function j(e,t,n){await G(t,e,n),n&&await G(n,e);for(const i of t.plugins)await G(i,e,{parent:t,entry:n});await t.emit(e,{parent:t,entry:n})}function Gn(){return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim()}class Jn{#t;#e;constructor(){this.#t={},this.#e=[]}get(t,n){const{fallback:i,source:o}=n??{};if(o){const s=this.#t?.[o]?.[t];if(s!==void 0)return s}else for(const s of this.#e){const r=this.#t?.[s]?.[t];if(r!==void 0)return r}if(i!==void 0)return i;throw new Error(`Config does not exist: ${t}`)}set(t,n={}){let i,o;return typeof t=="string"?(i=t,o=n):(i="entry",o=t),this.#t[i]?Object.assign(this.#t[i],o):(this.#e.unshift(i),this.#t[i]=o),this.#t[i]}remove(t){const n=this.#e.indexOf(t);n!==-1&&this.#e.splice(n,1),delete this.#t[t]}setSourceOrder(t){const n=Object.keys(this.#t).reverse(),i=t.filter(o=>n.includes(o));for(const o of n)i.includes(o)||i.push(o);return this.#e=i}}class Xn{constructor(){this.events={}}on(t,n,...i){this.events[t]||(this.events[t]=[]),this.events[t].some(o=>o.listener===n)||this.events[t].push({listener:n,args:i})}off(t,n){this.events[t]&&(this.events[t]=this.events[t].filter(i=>i.listener!==n))}async emit(t,...n){if(t=t.startsWith("on")?t.slice(2,3).toLowerCase()+t.slice(3):t,!!this.events[t])for(const{listener:i,args:o}of this.events[t])await i(...n,...o)}}class Yn extends Array{constructor(t={}){super(),this.presets=t}#t(t){const n=this.presets?.[t.name]||{},i=t?.options||{};t.config={...t.config,...n,...i}}#e(t){return!("name"in t)||typeof t.name!="string"?(console.error("Plugin requires a name!"),!1):!0}get(t){return this.find(n=>n.name===t)||null}add(t){if(Array.isArray(t))t.forEach(n=>this.add(n));else if(this.#t(t),this.#e(t)){const n=this.findIndex(i=>i.name===t.name);~n?this[n]=t:this.push(t)}}remove(t){const n=this.findIndex(i=>i.name===t);~n&&this.splice(n,1)}}class fe{constructor(t,n){this.config=new Jn,this.parent=t,this.el=Kn(n),this.id=this.el.id,this.config.set("parent",this.parent.config),this.config.set("entry",{})}}const Zn={selector:"",plugins:[],presets:{}};class ti{constructor(t={}){this.#t=new Xn,this.events=this.#t.events,this.on=this.#t.on.bind(this.#t),this.off=this.#t.off.bind(this.#t),this.emit=this.#t.emit.bind(this.#t),this.collection=[],this.entryClass=fe,this.name=this.constructor.name,this.config={...Zn,...t},this.plugins=new Yn(this.config.presets)}#t;get(t,n="id"){return this.collection.find(i=>i[n]===t)}getOrThrow(t,n="id"){const i=this.get(t,n);if(i)return i;throw new Error(`${this.name} entry not found in collection with ${String(n)} of "${t}"`)}updateConfig(t={}){return Object.assign(this.config,t)}async createEntry(t){const n=new this.entryClass(this,t);return await G(n,"init"),await j("onCreateEntry",this,n),n}async destroyEntry(t){return await j("onDestroyEntry",this,t),await G(t,"destroy"),t}async register(t){const n=this.collection.findIndex(i=>i.id===t.id);return~n?this.collection[n]=t:this.collection.push(t),await j("onRegisterEntry",this,t),t}async deregister(t){const n=this.collection.findIndex(i=>i.id===t.id);if(~n){await j("onDeregisterEntry",this,this.collection[n]);const[i]=this.collection.splice(n,1)}return t}async mount(t=n=>n){for(const n of this.config?.plugins||[])this.plugins.add(n);for(const n of this.plugins)await G(n,"setup",this);if(await j("beforeMount",this),this.config.selector){const n=document.querySelectorAll(this.config.selector);for(const i of n)await this.createEntry(i).then(o=>t(o)).then(o=>this.register(o))}return await j("afterMount",this),this}async unmount(t=n=>n){for(await j("beforeUnmount",this);this.collection.length>0;)await this.destroyEntry(this.collection[0]).then(n=>t(n)).then(n=>this.deregister(n));await j("afterUnmount",this);for(const n of this.plugins)await G(n,"teardown",this);for(const n of[...this.plugins])this.plugins.remove(n.name);return this}}Qn("theme-prefix",{fallback:"vb-theme-"});const ei={selector:".popover",selectorTooltip:".popover_tooltip",selectorArrow:".popover__arrow",stateActive:"is-active",customProps:["placement","event","offset","flip-padding","shift-padding","arrow-padding","toggle-delay"],customEventPrefix:"popover:",placement:"bottom",event:"click",offset:0,flipPadding:0,shiftPadding:0,arrowPadding:0,toggleDelay:0},it=Math.min,J=Math.max,mt=Math.round,yt=Math.floor,R=e=>({x:e,y:e}),ni={left:"right",right:"left",bottom:"top",top:"bottom"},ii={start:"end",end:"start"};function Rt(e,t,n){return J(e,it(t,n))}function X(e,t){return typeof e=="function"?e(t):e}function B(e){return e.split("-")[0]}function ct(e){return e.split("-")[1]}function Pt(e){return e==="x"?"y":"x"}function Mt(e){return e==="y"?"height":"width"}const oi=new Set(["top","bottom"]);function H(e){return oi.has(B(e))?"y":"x"}function Dt(e){return Pt(H(e))}function si(e,t,n){n===void 0&&(n=!1);const i=ct(e),o=Dt(e),s=Mt(o);let r=o==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(r=wt(r)),[r,wt(r)]}function ri(e){const t=wt(e);return[It(e),t,It(t)]}function It(e){return e.replace(/start|end/g,t=>ii[t])}const ue=["left","right"],he=["right","left"],ai=["top","bottom"],ci=["bottom","top"];function li(e,t,n){switch(e){case"top":case"bottom":return n?t?he:ue:t?ue:he;case"left":case"right":return t?ai:ci;default:return[]}}function fi(e,t,n,i){const o=ct(e);let s=li(B(e),n==="start",i);return o&&(s=s.map(r=>r+"-"+o),t&&(s=s.concat(s.map(It)))),s}function wt(e){return e.replace(/left|right|bottom|top/g,t=>ni[t])}function ui(e){return{top:0,right:0,bottom:0,left:0,...e}}function de(e){return typeof e!="number"?ui(e):{top:e,right:e,bottom:e,left:e}}function vt(e){const{x:t,y:n,width:i,height:o}=e;return{width:i,height:o,top:n,left:t,right:t+i,bottom:n+o,x:t,y:n}}function ge(e,t,n){let{reference:i,floating:o}=e;const s=H(t),r=Dt(t),a=Mt(r),c=B(t),l=s==="y",u=i.x+i.width/2-o.width/2,h=i.y+i.height/2-o.height/2,d=i[a]/2-o[a]/2;let f;switch(c){case"top":f={x:u,y:i.y-o.height};break;case"bottom":f={x:u,y:i.y+i.height};break;case"right":f={x:i.x+i.width,y:h};break;case"left":f={x:i.x-o.width,y:h};break;default:f={x:i.x,y:i.y}}switch(ct(t)){case"start":f[r]-=d*(n&&l?-1:1);break;case"end":f[r]+=d*(n&&l?-1:1);break}return f}const hi=async(e,t,n)=>{const{placement:i="bottom",strategy:o="absolute",middleware:s=[],platform:r}=n,a=s.filter(Boolean),c=await(r.isRTL==null?void 0:r.isRTL(t));let l=await r.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:h}=ge(l,i,c),d=i,f={},g=0;for(let p=0;p<a.length;p++){const{name:m,fn:y}=a[p],{x:w,y:v,data:b,reset:E}=await y({x:u,y:h,initialPlacement:i,placement:d,strategy:o,middlewareData:f,rects:l,platform:r,elements:{reference:e,floating:t}});u=w??u,h=v??h,f={...f,[m]:{...f[m],...b}},E&&g<=50&&(g++,typeof E=="object"&&(E.placement&&(d=E.placement),E.rects&&(l=E.rects===!0?await r.getElementRects({reference:e,floating:t,strategy:o}):E.rects),{x:u,y:h}=ge(l,d,c)),p=-1)}return{x:u,y:h,placement:d,strategy:o,middlewareData:f}};async function pe(e,t){var n;t===void 0&&(t={});const{x:i,y:o,platform:s,rects:r,elements:a,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:d=!1,padding:f=0}=X(t,e),g=de(f),p=a[d?h==="floating"?"reference":"floating":h],m=vt(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(p)))==null||n?p:p.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:l,rootBoundary:u,strategy:c})),y=h==="floating"?{x:i,y:o,width:r.floating.width,height:r.floating.height}:r.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),v=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},b=vt(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:w,strategy:c}):y);return{top:(m.top-b.top+g.top)/v.y,bottom:(b.bottom-m.bottom+g.bottom)/v.y,left:(m.left-b.left+g.left)/v.x,right:(b.right-m.right+g.right)/v.x}}const di=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:i,placement:o,rects:s,platform:r,elements:a,middlewareData:c}=t,{element:l,padding:u=0}=X(e,t)||{};if(l==null)return{};const h=de(u),d={x:n,y:i},f=Dt(o),g=Mt(f),p=await r.getDimensions(l),m=f==="y",y=m?"top":"left",w=m?"bottom":"right",v=m?"clientHeight":"clientWidth",b=s.reference[g]+s.reference[f]-d[f]-s.floating[g],E=d[f]-s.reference[f],C=await(r.getOffsetParent==null?void 0:r.getOffsetParent(l));let Z=C?C[v]:0;(!Z||!await(r.isElement==null?void 0:r.isElement(C)))&&(Z=a.floating[v]||s.floating[g]);const ut=b/2-E/2,tt=Z/2-p[g]/2-1,q=it(h[y],tt),ht=it(h[w],tt),et=q,dt=Z-p[g]-ht,$=Z/2-p[g]/2+ut,nt=Rt(et,$,dt),N=!c.arrow&&ct(o)!=null&&$!==nt&&s.reference[g]/2-($<et?q:ht)-p[g]/2<0,S=N?$<et?$-et:$-dt:0;return{[f]:d[f]+S,data:{[f]:nt,centerOffset:$-nt-S,...N&&{alignmentOffset:S}},reset:N}}}),gi=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,i;const{placement:o,middlewareData:s,rects:r,initialPlacement:a,platform:c,elements:l}=t,{mainAxis:u=!0,crossAxis:h=!0,fallbackPlacements:d,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:p=!0,...m}=X(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=B(o),w=H(a),v=B(a)===a,b=await(c.isRTL==null?void 0:c.isRTL(l.floating)),E=d||(v||!p?[wt(a)]:ri(a)),C=g!=="none";!d&&C&&E.push(...fi(a,p,g,b));const Z=[a,...E],ut=await pe(t,m),tt=[];let q=((i=s.flip)==null?void 0:i.overflows)||[];if(u&&tt.push(ut[y]),h){const $=si(o,r,b);tt.push(ut[$[0]],ut[$[1]])}if(q=[...q,{placement:o,overflows:tt}],!tt.every($=>$<=0)){var ht,et;const $=(((ht=s.flip)==null?void 0:ht.index)||0)+1,nt=Z[$];if(nt&&(!(h==="alignment"&&w!==H(nt))||q.every(S=>H(S.placement)===w?S.overflows[0]>0:!0)))return{data:{index:$,overflows:q},reset:{placement:nt}};let N=(et=q.filter(S=>S.overflows[0]<=0).sort((S,z)=>S.overflows[1]-z.overflows[1])[0])==null?void 0:et.placement;if(!N)switch(f){case"bestFit":{var dt;const S=(dt=q.filter(z=>{if(C){const _=H(z.placement);return _===w||_==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(_=>_>0).reduce((_,ro)=>_+ro,0)]).sort((z,_)=>z[1]-_[1])[0])==null?void 0:dt[0];S&&(N=S);break}case"initialPlacement":N=a;break}if(o!==N)return{reset:{placement:N}}}return{}}}},me=new Set(["left","top"]);async function pi(e,t){const{placement:n,platform:i,elements:o}=e,s=await(i.isRTL==null?void 0:i.isRTL(o.floating)),r=B(n),a=ct(n),c=H(n)==="y",l=me.has(r)?-1:1,u=s&&c?-1:1,h=X(t,e);let{mainAxis:d,crossAxis:f,alignmentAxis:g}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof g=="number"&&(f=a==="end"?g*-1:g),c?{x:f*u,y:d*l}:{x:d*l,y:f*u}}const mi=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,i;const{x:o,y:s,placement:r,middlewareData:a}=t,c=await pi(t,e);return r===((n=a.offset)==null?void 0:n.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:{...c,placement:r}}}}},yi=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:i,placement:o}=t,{mainAxis:s=!0,crossAxis:r=!1,limiter:a={fn:m=>{let{x:y,y:w}=m;return{x:y,y:w}}},...c}=X(e,t),l={x:n,y:i},u=await pe(t,c),h=H(B(o)),d=Pt(h);let f=l[d],g=l[h];if(s){const m=d==="y"?"top":"left",y=d==="y"?"bottom":"right",w=f+u[m],v=f-u[y];f=Rt(w,f,v)}if(r){const m=h==="y"?"top":"left",y=h==="y"?"bottom":"right",w=g+u[m],v=g-u[y];g=Rt(w,g,v)}const p=a.fn({...t,[d]:f,[h]:g});return{...p,data:{x:p.x-n,y:p.y-i,enabled:{[d]:s,[h]:r}}}}}},wi=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:i,placement:o,rects:s,middlewareData:r}=t,{offset:a=0,mainAxis:c=!0,crossAxis:l=!0}=X(e,t),u={x:n,y:i},h=H(o),d=Pt(h);let f=u[d],g=u[h];const p=X(a,t),m=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(c){const v=d==="y"?"height":"width",b=s.reference[d]-s.floating[v]+m.mainAxis,E=s.reference[d]+s.reference[v]-m.mainAxis;f<b?f=b:f>E&&(f=E)}if(l){var y,w;const v=d==="y"?"width":"height",b=me.has(B(o)),E=s.reference[h]-s.floating[v]+(b&&((y=r.offset)==null?void 0:y[h])||0)+(b?0:m.crossAxis),C=s.reference[h]+s.reference[v]+(b?0:((w=r.offset)==null?void 0:w[h])||0)-(b?m.crossAxis:0);g<E?g=E:g>C&&(g=C)}return{[d]:f,[h]:g}}}};function bt(){return typeof window<"u"}function ot(e){return ye(e)?(e.nodeName||"").toLowerCase():"#document"}function k(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function P(e){var t;return(t=(ye(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ye(e){return bt()?e instanceof Node||e instanceof k(e).Node:!1}function T(e){return bt()?e instanceof Element||e instanceof k(e).Element:!1}function M(e){return bt()?e instanceof HTMLElement||e instanceof k(e).HTMLElement:!1}function we(e){return!bt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof k(e).ShadowRoot}const vi=new Set(["inline","contents"]);function lt(e){const{overflow:t,overflowX:n,overflowY:i,display:o}=O(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&!vi.has(o)}const bi=new Set(["table","td","th"]);function Ei(e){return bi.has(ot(e))}const xi=[":popover-open",":modal"];function Et(e){return xi.some(t=>{try{return e.matches(t)}catch{return!1}})}const $i=["transform","translate","scale","rotate","perspective"],Ci=["transform","translate","scale","rotate","perspective","filter"],Li=["paint","layout","strict","content"];function Ht(e){const t=qt(),n=T(e)?O(e):e;return $i.some(i=>n[i]?n[i]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Ci.some(i=>(n.willChange||"").includes(i))||Li.some(i=>(n.contain||"").includes(i))}function Ai(e){let t=W(e);for(;M(t)&&!st(t);){if(Ht(t))return t;if(Et(t))return null;t=W(t)}return null}function qt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const ki=new Set(["html","body","#document"]);function st(e){return ki.has(ot(e))}function O(e){return k(e).getComputedStyle(e)}function xt(e){return T(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function W(e){if(ot(e)==="html")return e;const t=e.assignedSlot||e.parentNode||we(e)&&e.host||P(e);return we(t)?t.host:t}function ve(e){const t=W(e);return st(t)?e.ownerDocument?e.ownerDocument.body:e.body:M(t)&&lt(t)?t:ve(t)}function ft(e,t,n){var i;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=ve(e),s=o===((i=e.ownerDocument)==null?void 0:i.body),r=k(o);if(s){const a=Nt(r);return t.concat(r,r.visualViewport||[],lt(o)?o:[],a&&n?ft(a):[])}return t.concat(o,ft(o,[],n))}function Nt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function be(e){const t=O(e);let n=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const o=M(e),s=o?e.offsetWidth:n,r=o?e.offsetHeight:i,a=mt(n)!==s||mt(i)!==r;return a&&(n=s,i=r),{width:n,height:i,$:a}}function Ut(e){return T(e)?e:e.contextElement}function rt(e){const t=Ut(e);if(!M(t))return R(1);const n=t.getBoundingClientRect(),{width:i,height:o,$:s}=be(t);let r=(s?mt(n.width):n.width)/i,a=(s?mt(n.height):n.height)/o;return(!r||!Number.isFinite(r))&&(r=1),(!a||!Number.isFinite(a))&&(a=1),{x:r,y:a}}const Si=R(0);function Ee(e){const t=k(e);return!qt()||!t.visualViewport?Si:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ti(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==k(e)?!1:t}function Y(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Ut(e);let r=R(1);t&&(i?T(i)&&(r=rt(i)):r=rt(e));const a=Ti(s,n,i)?Ee(s):R(0);let c=(o.left+a.x)/r.x,l=(o.top+a.y)/r.y,u=o.width/r.x,h=o.height/r.y;if(s){const d=k(s),f=i&&T(i)?k(i):i;let g=d,p=Nt(g);for(;p&&i&&f!==g;){const m=rt(p),y=p.getBoundingClientRect(),w=O(p),v=y.left+(p.clientLeft+parseFloat(w.paddingLeft))*m.x,b=y.top+(p.clientTop+parseFloat(w.paddingTop))*m.y;c*=m.x,l*=m.y,u*=m.x,h*=m.y,c+=v,l+=b,g=k(p),p=Nt(g)}}return vt({width:u,height:h,x:c,y:l})}function $t(e,t){const n=xt(e).scrollLeft;return t?t.left+n:Y(P(e)).left+n}function xe(e,t){const n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-$t(e,n),o=n.top+t.scrollTop;return{x:i,y:o}}function Oi(e){let{elements:t,rect:n,offsetParent:i,strategy:o}=e;const s=o==="fixed",r=P(i),a=t?Et(t.floating):!1;if(i===r||a&&s)return n;let c={scrollLeft:0,scrollTop:0},l=R(1);const u=R(0),h=M(i);if((h||!h&&!s)&&((ot(i)!=="body"||lt(r))&&(c=xt(i)),M(i))){const f=Y(i);l=rt(i),u.x=f.x+i.clientLeft,u.y=f.y+i.clientTop}const d=r&&!h&&!s?xe(r,c):R(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+d.x,y:n.y*l.y-c.scrollTop*l.y+u.y+d.y}}function Ri(e){return Array.from(e.getClientRects())}function Pi(e){const t=P(e),n=xt(e),i=e.ownerDocument.body,o=J(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),s=J(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let r=-n.scrollLeft+$t(e);const a=-n.scrollTop;return O(i).direction==="rtl"&&(r+=J(t.clientWidth,i.clientWidth)-o),{width:o,height:s,x:r,y:a}}const $e=25;function Mi(e,t){const n=k(e),i=P(e),o=n.visualViewport;let s=i.clientWidth,r=i.clientHeight,a=0,c=0;if(o){s=o.width,r=o.height;const u=qt();(!u||u&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}const l=$t(i);if(l<=0){const u=i.ownerDocument,h=u.body,d=getComputedStyle(h),f=u.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,g=Math.abs(i.clientWidth-h.clientWidth-f);g<=$e&&(s-=g)}else l<=$e&&(s+=l);return{width:s,height:r,x:a,y:c}}const Di=new Set(["absolute","fixed"]);function Ii(e,t){const n=Y(e,!0,t==="fixed"),i=n.top+e.clientTop,o=n.left+e.clientLeft,s=M(e)?rt(e):R(1),r=e.clientWidth*s.x,a=e.clientHeight*s.y,c=o*s.x,l=i*s.y;return{width:r,height:a,x:c,y:l}}function Ce(e,t,n){let i;if(t==="viewport")i=Mi(e,n);else if(t==="document")i=Pi(P(e));else if(T(t))i=Ii(t,n);else{const o=Ee(e);i={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return vt(i)}function Le(e,t){const n=W(e);return n===t||!T(n)||st(n)?!1:O(n).position==="fixed"||Le(n,t)}function Hi(e,t){const n=t.get(e);if(n)return n;let i=ft(e,[],!1).filter(a=>T(a)&&ot(a)!=="body"),o=null;const s=O(e).position==="fixed";let r=s?W(e):e;for(;T(r)&&!st(r);){const a=O(r),c=Ht(r);!c&&a.position==="fixed"&&(o=null),(s?!c&&!o:!c&&a.position==="static"&&o&&Di.has(o.position)||lt(r)&&!c&&Le(e,r))?i=i.filter(l=>l!==r):o=a,r=W(r)}return t.set(e,i),i}function qi(e){let{element:t,boundary:n,rootBoundary:i,strategy:o}=e;const s=[...n==="clippingAncestors"?Et(t)?[]:Hi(t,this._c):[].concat(n),i],r=s[0],a=s.reduce((c,l)=>{const u=Ce(t,l,o);return c.top=J(u.top,c.top),c.right=it(u.right,c.right),c.bottom=it(u.bottom,c.bottom),c.left=J(u.left,c.left),c},Ce(t,r,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Ni(e){const{width:t,height:n}=be(e);return{width:t,height:n}}function Ui(e,t,n){const i=M(t),o=P(t),s=n==="fixed",r=Y(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=R(0);function l(){c.x=$t(o)}if(i||!i&&!s)if((ot(t)!=="body"||lt(o))&&(a=xt(t)),i){const f=Y(t,!0,s,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else o&&l();s&&!i&&o&&l();const u=o&&!i&&!s?xe(o,a):R(0),h=r.left+a.scrollLeft-c.x-u.x,d=r.top+a.scrollTop-c.y-u.y;return{x:h,y:d,width:r.width,height:r.height}}function Ft(e){return O(e).position==="static"}function Ae(e,t){if(!M(e)||O(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return P(e)===n&&(n=n.ownerDocument.body),n}function ke(e,t){const n=k(e);if(Et(e))return n;if(!M(e)){let o=W(e);for(;o&&!st(o);){if(T(o)&&!Ft(o))return o;o=W(o)}return n}let i=Ae(e,t);for(;i&&Ei(i)&&Ft(i);)i=Ae(i,t);return i&&st(i)&&Ft(i)&&!Ht(i)?n:i||Ai(e)||n}const Fi=async function(e){const t=this.getOffsetParent||ke,n=this.getDimensions,i=await n(e.floating);return{reference:Ui(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function Vi(e){return O(e).direction==="rtl"}const ji={convertOffsetParentRelativeRectToViewportRelativeRect:Oi,getDocumentElement:P,getClippingRect:qi,getOffsetParent:ke,getElementRects:Fi,getClientRects:Ri,getDimensions:Ni,getScale:rt,isElement:T,isRTL:Vi};function Se(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Bi(e,t){let n=null,i;const o=P(e);function s(){var a;clearTimeout(i),(a=n)==null||a.disconnect(),n=null}function r(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),s();const l=e.getBoundingClientRect(),{left:u,top:h,width:d,height:f}=l;if(a||t(),!d||!f)return;const g=yt(h),p=yt(o.clientWidth-(u+d)),m=yt(o.clientHeight-(h+f)),y=yt(u),w={rootMargin:-g+"px "+-p+"px "+-m+"px "+-y+"px",threshold:J(0,it(1,c))||1};let v=!0;function b(E){const C=E[0].intersectionRatio;if(C!==c){if(!v)return r();C?r(!1,C):i=setTimeout(()=>{r(!1,1e-7)},1e3)}C===1&&!Se(l,e.getBoundingClientRect())&&r(),v=!1}try{n=new IntersectionObserver(b,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(b,w)}n.observe(e)}return r(!0),s}function Wi(e,t,n,i){i===void 0&&(i={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=i,l=Ut(e),u=o||s?[...l?ft(l):[],...ft(t)]:[];u.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const h=l&&a?Bi(l,n):null;let d=-1,f=null;r&&(f=new ResizeObserver(y=>{let[w]=y;w&&w.target===l&&f&&(f.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var v;(v=f)==null||v.observe(t)})),n()}),l&&!c&&f.observe(l),f.observe(t));let g,p=c?Y(e):null;c&&m();function m(){const y=Y(e);p&&!Se(p,y)&&n(),p=y,g=requestAnimationFrame(m)}return n(),()=>{var y;u.forEach(w=>{o&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),h?.(),(y=f)==null||y.disconnect(),f=null,c&&cancelAnimationFrame(g)}}const zi=mi,_i=yi,Ki=gi,Qi=di,Gi=wi,Ji=(e,t,n)=>{const i=new Map,o={platform:ji,...n},s={...o.platform,_c:i};return hi(e,t,{...o,platform:s})};function Te(e,t,n){Object.assign(e.style,{left:t!=null?`${t}px`:"",top:n!=null?`${n}px`:""})}function Oe(e,t){let n=e.config.get("toggleDelay");typeof n=="string"&&(n.indexOf(",")>-1&&(n=n.split(",")),n.indexOf(" ")>-1&&(n=n.split(" "))),Array.isArray(n)&&(n=n[t]);const i=Number(n);if(Number.isNaN(i))throw new Error(`Provided delay value is not a number: "${n}"`);return i}function Vt(e){let t;const n=typeof e=="string"?e.trim().split(" ").map(i=>parseFloat(i)).filter(i=>!isNaN(i)):[e];for(let i=0;i<n.length;i++)n[i]=Number(n[i]);switch(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=void 0;break}return t}function Xi(e){return{offset:Number(e.config.get("offset")),flip:{padding:Vt(e.config.get("flipPadding"))},shift:{padding:Vt(e.config.get("shiftPadding"))},arrow:{selector:e.config.get("selectorArrow"),element:null,padding:Vt(e.config.get("arrowPadding"))}}}async function Re(e){return e&&e.state==="opened"&&(e.el.inert=!0,e.el.classList.remove(e.config.get("stateActive")),e.isTooltip||e.trigger?.setAttribute("aria-expanded","false"),e.floatingCleanup(),e.state="closed",e.trigger===e.parent.trigger&&(e.parent.trigger=null),e.el.dispatchEvent(new CustomEvent(e.config.get("customEventPrefix")+"closed",{detail:e.parent,bubbles:!0})),await e.parent.emit("closed",e)),e}async function Pe(e){const t=[];for(const n of e.collection)n.state==="opened"&&t.push(await n.close());return t}function Me(e){e.state=="opened"&&setTimeout(()=>(document.activeElement?.closest(`#${e.id}, [aria-controls="${e.id}"], [aria-describedby="${e.id}"]`)||e.close(),e),1)}function Yi(e){e.state==="opened"?e.close():(this.trigger=e.trigger,e.open())}function Zi(e){e.isTooltip&&(e.toggleDelayId&&clearTimeout(e.toggleDelayId),e.close())}function to(e,t){if(!(t instanceof MouseEvent)||(e.isHovered=t,t.type=="focus"&&e.trigger&&!e.trigger.matches(":focus-visible")))return;e.toggleDelayId&&clearTimeout(e.toggleDelayId);const n=e.trigger?.getAttribute("aria-expanded");if(n&&n=="true")return;const i=this.activeHover?0:Oe(e,0);this.activeHover&&this.activeHover.close(),e.toggleDelayId=setTimeout(()=>{e.id&&e.open()},i)}function eo(e,t){t instanceof MouseEvent&&setTimeout(()=>{e.isHovered=t,!e.isHovered&&(e.toggleDelayId&&clearTimeout(e.toggleDelayId),e.toggleDelayId=setTimeout(()=>Me(e),Oe(e,1)))},1)}function no(e){switch(e.key){case"Escape":this.trigger&&this.trigger.focus(),Pe(this);return;case"Tab":this.collection.forEach(t=>{Me(t)});return;default:return}}function io(e){document.addEventListener("click",function t(n){const i=n.target;i&&(i.closest(`#${e.id}, [aria-controls="${e.id}"], [aria-describedby="${e.id}"]`)?e.el&&!e.el.classList.contains(e.config.get("stateActive"))&&this.removeEventListener("click",t):(e.el&&e.el.classList.contains(e.config.get("stateActive"))&&e.close(),this.removeEventListener("click",t)))})}async function De(e){e.el.inert=!1,e.el.classList.add(e.config.get("stateActive")),e.isTooltip||e.trigger?.setAttribute("aria-expanded","true"),await e.parent.emit("updateCustomProps",e);const t=Xi(e),n=e.el.querySelector(t.arrow.selector);return t.arrow.element=n||null,e.trigger instanceof HTMLElement&&(e.floatingCleanup=Wi(e.trigger,e.el,()=>{const i=[Ki(t.flip),_i({...t.shift,limiter:Gi()}),zi(t.offset)];t.arrow.element&&i.push(Qi({...t.arrow,element:t.arrow.element})),Ji(e.trigger,e.el,{placement:e.config.get("placement"),middleware:i}).then(({x:o,y:s,placement:r,middlewareData:a})=>{if(e.el){if(Te(e.el,o,s),t.arrow.element&&a.arrow){const{x:c,y:l}=a.arrow;Te(t.arrow.element,c,l)}e.el.setAttribute("data-floating-placement",r)}})})),e.state="opened",e.config.get("event")==="click"&&io.call(e.parent,e),e.el.dispatchEvent(new CustomEvent(e.config.get("customEventPrefix")+"opened",{detail:e.parent,bubbles:!0})),await e.parent.emit("opened",e),e}class oo extends fe{constructor(t,n){super(t,n),this.#t=[],this.#e={el:!1,trigger:!1},this.state="closed",this.trigger=null,this.toggleDelayId=null,this.floatingCleanup=()=>{}}#t;#e;get isTooltip(){return!!this.el.closest(this.config.get("selectorTooltip"))||this.el.getAttribute("role")=="tooltip"}get isHovered(){return this.#e.el||this.#e.trigger}set isHovered(t){const n=t.type=="mouseenter"?!0:t.type=="mouseleave"?!1:void 0;if(n!=null)switch(t.target){case this.el:this.#e.el=n;break;case this.trigger:this.#e.trigger=n;break}}async open(){return De(this)}async close(){return Re(this)}async deregister(){return this.parent.deregister(this)}registerEventListeners(){this.#t.length||(this.config.get("event")==="hover"?(this.#t=[{el:["el","trigger"],type:["mouseenter","focus"],listener:to.bind(this.parent,this)},{el:["el","trigger"],type:["mouseleave","focusout"],listener:eo.bind(this.parent,this)},{el:["trigger"],type:["click"],listener:Zi.bind(this.parent,this)}],this.#t.forEach(t=>{t.el.forEach(n=>{t.type.forEach(i=>{this[n].addEventListener(i,t.listener,!1)})})})):(this.#t=[{el:["trigger"],type:["click"],listener:Yi.bind(this.parent,this)}],this.#t.forEach(t=>{t.el.forEach(n=>{t.type.forEach(i=>{this[n].addEventListener(i,t.listener,!1)})})})))}deregisterEventListeners(){this.#t&&(this.#t.forEach(t=>{t.el.forEach(n=>{t.type.forEach(i=>{this[n].removeEventListener(i,t.listener,!1)})})}),this.#t=[])}async onCreateEntry(){this.trigger=document.querySelector(`[aria-controls="${this.id}"], [aria-describedby="${this.id}"]`),this.isTooltip?(this.config.set({event:"hover"}),this.el.setAttribute("role","tooltip")):this.trigger&&this.trigger instanceof HTMLElement&&this.trigger.setAttribute("aria-expanded","false")}async onRegisterEntry(){this.registerEventListeners(),this.el.classList.contains(this.config.get("stateActive"))?await this.open():this.el.inert=!0}async onDestroyEntry(){this.state==="opened"&&await this.close(),this.floatingCleanup(),this.deregisterEventListeners()}}class so extends ti{constructor(t){super({...ei,...t}),this.entryClass=oo,this.name="Popover",this.trigger=null,this.#t=no.bind(this)}#t;get active(){return this.get("opened","state")}get activeHover(){return this.collection.find(t=>t.state=="opened"&&t.config.get("event")=="hover")}async open(t){const n=this.getOrThrow(t);return De(n)}async close(t){const n=t?this.getOrThrow(t):void 0;return n?Re(n):Pe(this)}async afterMount(){document.addEventListener("keydown",this.#t,!1)}async beforeUnmount(){this.trigger=null}async afterUnmount(){document.removeEventListener("keydown",this.#t,!1)}}D.Drawer=kn,D.Modal=_n,D.Popover=so,D.core=an,Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})}));
10
10
  //# sourceMappingURL=index.umd.cjs.map