vrembem 3.0.20 → 3.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dev/scripts.esm.js +17 -24
- package/dev/scripts.esm.js.map +1 -1
- package/dev/scripts.js +17 -24
- package/dev/scripts.js.map +1 -1
- package/dev/scripts.modern.mjs +2 -9
- package/dev/scripts.modern.mjs.map +1 -1
- package/dev/scripts.umd.js +17 -24
- package/dev/scripts.umd.js.map +1 -1
- package/dev/styles.css +58 -52
- package/dev/styles.css.map +1 -1
- package/dist/scripts.esm.js +1 -1
- package/dist/scripts.esm.js.map +1 -1
- package/dist/scripts.js +1 -1
- package/dist/scripts.js.map +1 -1
- package/dist/scripts.modern.mjs +1 -1
- package/dist/scripts.modern.mjs.map +1 -1
- package/dist/scripts.umd.js +1 -1
- package/dist/scripts.umd.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +26 -26
package/dist/scripts.modern.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function t(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var e=0;function i(t){return"__private_"+e+++"_"+t}function n(){return n=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)({}).hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},n.apply(null,arguments)}var s=/*#__PURE__*/i("handler");class r{constructor(e,i){Object.defineProperty(this,s,{writable:!0,value:void 0}),this.value=e,t(this,s)[s]=i,this.mql=null}get handler(){return t(this,s)[s]}set handler(e){this.mql&&("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",t(this,s)[s]):this.mql.removeListener(t(this,s)[s])),t(this,s)[s]=e}mount(e,i){return e&&(this.value=e),i&&(t(this,s)[s]=i),this.value?(this.mql=window.matchMedia(`(min-width: ${this.value})`),"function"==typeof this.mql.addEventListener?this.mql.addEventListener("change",t(this,s)[s]):this.mql.addListener(t(this,s)[s]),t(this,s)[s](this.mql),this):this}unmount(){return this.mql?("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",t(this,s)[s]):this.mql.removeListener(t(this,s)[s]),this.value=null,t(this,s)[s]=null,this.mql=null,this):this}}class o{constructor(){this.collection=[]}async register(t){return await this.deregister(t),this.collection.push(t),this.collection}async deregister(t){const e=this.collection.findIndex(e=>e===t);if(e>=0){const t=this.collection[e];Object.getOwnPropertyNames(t).forEach(e=>{delete t[e]}),this.collection.splice(e,1)}return this.collection}async registerCollection(t){return await Promise.all(Array.from(t,t=>{this.register(t)})),this.collection}async deregisterCollection(){for(;this.collection.length>0;)await this.deregister(this.collection[0]);return this.collection}get(t,e="id"){return this.collection.find(i=>i[e]===t)}}var a=/*#__PURE__*/i("focusable"),l=/*#__PURE__*/i("handleFocusTrap"),c=/*#__PURE__*/i("handleFocusLock");class d{constructor(e=null,i="[data-focus]"){Object.defineProperty(this,a,{writable:!0,value:void 0}),Object.defineProperty(this,l,{writable:!0,value:void 0}),Object.defineProperty(this,c,{writable:!0,value:void 0}),this.el=e,this.selectorFocus=i,t(this,l)[l]=g.bind(this),t(this,c)[c]=m.bind(this)}get focusable(){return t(this,a)[a]}set focusable(e){t(this,a)[a]=e,t(this,a)[a].length?(document.removeEventListener("keydown",t(this,c)[c]),document.addEventListener("keydown",t(this,l)[l])):(document.removeEventListener("keydown",t(this,l)[l]),document.addEventListener("keydown",t(this,c)[c]))}get focusableFirst(){return this.focusable[0]}get focusableLast(){return this.focusable[this.focusable.length-1]}mount(t,e){t&&(this.el=t),e&&(this.selectorFocus=e),this.focusable=this.getFocusable(),this.focus()}unmount(){this.el=null,this.focusable=[],document.removeEventListener("keydown",t(this,l)[l]),document.removeEventListener("keydown",t(this,c)[c])}focus(t=this.el,e=this.selectorFocus){(t.querySelector(e)||t).focus()}getFocusable(t=this.el){const e=[],i=document.activeElement,n=t.scrollTop,s=p.join(",");return t.querySelectorAll(s).forEach(t=>{t.focus(),document.activeElement===t&&e.push(t)}),t.scrollTop=n,i.focus(),e}}const u=":not([inert])",h=':not([tabindex^="-"])',f=":not(:disabled)",p=[`a[href]${u}${h}`,`area[href]${u}${h}`,`input:not([type="hidden"]):not([type="radio"])${u}${h}${f}`,`input[type="radio"]${u}${h}${f}`,`select${u}${h}${f}`,`textarea${u}${h}${f}`,`button${u}${h}${f}`,`details${u} > summary:first-of-type${h}`,`iframe${u}${h}`,`audio[controls]${u}${h}`,`video[controls]${u}${h}`,`[contenteditable]${u}${h}`,`[tabindex]${u}${h}`];function g(t){("Tab"===t.key||9===t.keyCode)&&(t.shiftKey?document.activeElement!==this.focusableFirst&&document.activeElement!==this.el||(t.preventDefault(),this.focusableLast.focus()):document.activeElement!==this.focusableLast&&document.activeElement!==this.el||(t.preventDefault(),this.focusableFirst.focus()))}function m(t){("Tab"===t.key||9===t.keyCode)&&t.preventDefault()}function v(t,e){const i=(t.getAttribute(`data-${e}`)||"").replace(/'/g,'"');return i?JSON.parse(i):{}}function y(t,e=!0){const i=localStorage.getItem(t),n=i?JSON.parse(i):{};return{get:t=>t?n[t]:n,set:(i,s)=>(s?n[i]=s:delete n[i],e&&localStorage.setItem(t,JSON.stringify(n)),n)}}function b(t,e,i){const n=e.nodeType===Node.COMMENT_NODE,s=e.nodeType===Node.ELEMENT_NODE;if(n&&(i="after"),!(e=n||s?e:document.querySelector(e)))throw new Error(`Not a valid teleport reference: '${e}'`);if("function"!=typeof e[i])throw new Error(`Not a valid teleport method: '${i}'`);let r=null;return n||(r=document.createComment("teleported #"+t.id),t.before(r)),e[i](t),n&&e.remove(),r}const w=(t,e)=>new Promise(i=>{e.transition?(t.classList.remove(e.stateClosed),t.classList.add(e.stateOpening),t.addEventListener("transitionend",function n(s){s.target==t&&(t.classList.add(e.stateOpened),t.classList.remove(e.stateOpening),i(t),this.removeEventListener("transitionend",n))})):(t.classList.add(e.stateOpened),t.classList.remove(e.stateClosed),i(t))}),E=(t,e)=>new Promise(i=>{e.transition?(t.classList.add(e.stateClosing),t.classList.remove(e.stateOpened),t.addEventListener("transitionend",function n(s){s.target==t&&(t.classList.remove(e.stateClosing),t.classList.add(e.stateClosed),i(t),this.removeEventListener("transitionend",n))})):(t.classList.add(e.stateClosed),t.classList.remove(e.stateOpened),i(t))});function x(t,e){var i,n;i=!!t,(n=e.selectorInert)&&document.querySelectorAll(n).forEach(t=>{i?(t.inert=!0,t.setAttribute("aria-hidden",!0)):(t.inert=null,t.removeAttribute("aria-hidden"))}),function(t,e){e&&document.querySelectorAll(e).forEach(e=>{t?e.style.overflow="hidden":e.style.removeProperty("overflow")})}(!!t,e.selectorOverflow)}var O={__proto__:null,Breakpoint:r,Collection:o,FocusTrap:d,getConfig:v,getPrefix:function(){return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim()},localStore:y,teleport:b,openTransition:w,closeTransition:E,updateGlobalState:x},L={autoInit:!1,stateAttr:"aria-checked",stateValue:"mixed"};class A{constructor(t){this.defaults=L,this.settings=n({},this.defaults,t),this.__handlerClick=this.handlerClick.bind(this),this.settings.autoInit&&this.init()}init(t=null){t&&(this.settings=n({},this.settings,t));const e=document.querySelectorAll(`[${this.settings.stateAttr}="${this.settings.stateValue}"]`);this.setIndeterminate(e),document.addEventListener("click",this.__handlerClick,!1)}destroy(){document.removeEventListener("click",this.__handlerClick,!1)}handlerClick(t){const e=t.target.closest(`[${this.settings.stateAttr}="${this.settings.stateValue}"]`);e&&(this.removeAriaState(e),this.setIndeterminate(e))}setAriaState(t,e=this.settings.stateValue){(t=t.forEach?t:[t]).forEach(t=>{t.setAttribute(this.settings.stateAttr,e)})}removeAriaState(t){(t=t.forEach?t:[t]).forEach(t=>{t.removeAttribute(this.settings.stateAttr)})}setIndeterminate(t){(t=t.forEach?t:[t]).forEach(t=>{t.indeterminate=!!t.hasAttribute(this.settings.stateAttr)})}}var $={autoInit:!1,dataOpen:"drawer-open",dataClose:"drawer-close",dataToggle:"drawer-toggle",dataBreakpoint:"drawer-breakpoint",dataConfig:"drawer-config",selectorDrawer:".drawer",selectorDialog:".drawer__dialog",selectorFocus:"[data-focus]",selectorInert:null,selectorOverflow:"body",stateOpened:"is-opened",stateOpening:"is-opening",stateClosing:"is-closing",stateClosed:"is-closed",classModal:"drawer_modal",breakpoints:null,customEventPrefix:"drawer:",eventListeners:!0,store:!0,storeKey:"VB:DrawerState",setTabindex:!0,transition:!0};function k(t){const e=t.target.closest(`\n [data-${this.settings.dataOpen}],\n [data-${this.settings.dataToggle}],\n [data-${this.settings.dataClose}]\n `);e?(t.preventDefault(),e.matches(`[data-${this.settings.dataToggle}]`)&&e.getAttribute(`data-${this.settings.dataToggle}`).trim().split(" ").forEach(t=>{const i=this.get(t);i.trigger=e,i.toggle()}),e.matches(`[data-${this.settings.dataOpen}]`)&&e.getAttribute(`data-${this.settings.dataOpen}`).trim().split(" ").forEach(t=>{const i=this.get(t);i.trigger=e,i.open()}),e.matches(`[data-${this.settings.dataClose}]`)&&e.getAttribute(`data-${this.settings.dataClose}`).trim().split(" ").forEach(i=>{if(i){const t=this.get(i);t.trigger=e,t.close()}else{const e=t.target.closest(this.settings.selectorDrawer);e&&this.close(e)}})):t.target.matches(this.settings.selectorDrawer)&&this.close(t.target.id)}function C(t){if("Escape"===t.key){const t=this.activeModal;t&&this.close(t)}}async function S(t,e=!0){if(!t)return this.collection;const i=this.collection.findIndex(e=>e.id===t.id);if(i>=0){const t=this.collection[i];e&&"opened"===t.state&&await t.close(!1),this.store.set(t.id),t.unmountBreakpoint(),Object.getOwnPropertyNames(t).forEach(e=>{delete t[e]}),this.collection.splice(i,1)}return this.collection}function P(){return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim()}function D(t){const e=P(),i=t.getAttribute(`data-${this.settings.dataBreakpoint}`);return this.settings.breakpoints&&this.settings.breakpoints[i]?this.settings.breakpoints[i]:getComputedStyle(document.body).getPropertyValue(`--${e}breakpoint-${i}`).trim()?getComputedStyle(document.body).getPropertyValue(`--${e}breakpoint-${i}`).trim():i}function j(t){const e=this.get("string"==typeof t?t:t.id);if(e)return e;throw new Error(`Drawer not found in collection with id of "${t.id||t}".`)}function T(t){return"string"==typeof t?t:"function"==typeof t.hasAttribute?t.hasAttribute(`data-${this.settings.dataOpen}`)?t.getAttribute(`data-${this.settings.dataOpen}`):t.hasAttribute(`data-${this.settings.dataClose}`)?t.getAttribute(`data-${this.settings.dataClose}`)||!1:t.hasAttribute(`data-${this.settings.dataToggle}`)?t.getAttribute(`data-${this.settings.dataToggle}`):t.closest(this.settings.selectorDrawer)&&(t=t.closest(this.settings.selectorDrawer)).id||!1:!!t.id&&t.id}function q(t){const e=T.call(this,t);if(e){const t=document.querySelector(`#${e}`),i=t?t.querySelector(this.settings.selectorDialog):null;return t||i?i?{drawer:t,dialog:i}:{error:new Error("Drawer is missing dialog element.")}:{error:new Error(`No drawer elements found using the ID: "${e}".`)}}return{error:new Error("Could not resolve the drawer ID.")}}async function I(t){this.store.get(t.id)?"opened"===this.store.get(t.id)?await t.open(!1,!1):await t.close(!1,!1):t.el.classList.contains(this.settings.stateOpened)?t.state="opened":(t.el.classList.remove(this.settings.stateOpening),t.el.classList.remove(this.settings.stateClosing),t.el.classList.add(this.settings.stateClosed))}function _(t){"opened"===t.state?"modal"===t.mode?this.focusTrap.mount(t.dialog,this.settings.selectorFocus):this.focusTrap.focus(t.dialog,this.settings.selectorFocus):(t.trigger&&(t.trigger.focus(),t.trigger=null),this.focusTrap.unmount())}async function M(t,e,i=!0){const s=j.call(this,t),r=n({},this.settings,s.settings);return void 0!==e&&(r.transition=e),"closed"===s.state&&(s.state="opening",await w(s.el,r),"modal"===s.mode&&x(!0,r),s.state="opened"),i&&_.call(this,s),s.el.dispatchEvent(new CustomEvent(r.customEventPrefix+"opened",{detail:this,bubbles:!0})),s}async function R(t,e,i=!0){const s=j.call(this,t),r=n({},this.settings,s.settings);return void 0!==e&&(r.transition=e),"opened"===s.state&&(s.state="closing",document.activeElement.blur(),await E(s.el,r),"modal"===s.mode&&x(!1,r),i&&_.call(this,s),s.state="closed",s.el.dispatchEvent(new CustomEvent(r.customEventPrefix+"closed",{detail:this,bubbles:!0}))),s}async function N(t,e,i){const n=j.call(this,t);return"closed"===n.state?M.call(this,n,e,i):R.call(this,n,e,i)}function B(t){switch(t.mode){case"inline":return V.call(this,t);case"modal":return F.call(this,t);default:throw new Error(`"${t.mode}" is not a valid drawer mode.`)}}async function V(t){return t.el.classList.remove(t.getSetting("classModal")),t.dialog.removeAttribute("aria-modal"),x(!1,n({},this.settings,t.settings)),this.focusTrap.unmount(),await I.call(this,t),t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:this,bubbles:!0})),t}async function F(t){return t.el.classList.add(t.getSetting("classModal")),t.dialog.setAttribute("aria-modal","true"),!this.store.get(t.id)&&t.el.classList.contains(t.getSetting("stateOpened"))&&this.store.set(t.id,"opened"),await R.call(this,t,!1,!1),t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:this,bubbles:!0})),t}async function W(t,e){await S.call(this,t,!1);const i=this,s=new r,o={open(t,e){return M.call(i,this,t,e)},close(t,e){return R.call(i,this,t,e)},toggle(t,e){return N.call(i,this,t,e)},deregister(){return S.call(i,this)},mountBreakpoint(){const t=this.breakpoint,e=this.handleBreakpoint.bind(this);return s.mount(t,e),this},unmountBreakpoint(){return s.unmount(),this},handleBreakpoint(t){return this.mode=t.matches?"inline":"modal",this},getSetting(t){return t in this.settings?this.settings[t]:i.settings[t]}},a=n({id:t.id,el:t,dialog:e,trigger:null,settings:v(t,this.settings.dataConfig),get breakpoint(){return D.call(i,t)},get state(){return l},set state(t){l=t,"opened"!==t&&"closed"!==t||"inline"===this.mode&&i.store.set(this.id,this.state)},get mode(){return c},set mode(t){c=t,B.call(i,this)}},o);let l=t.classList.contains(a.getSetting("stateOpened"))?"opened":"closed",c=t.classList.contains(a.getSetting("classModal"))?"modal":"inline";return"modal"===a.mode?a.dialog.setAttribute("aria-modal","true"):a.dialog.removeAttribute("aria-modal"),a.getSetting("setTabindex")&&a.dialog.setAttribute("tabindex","-1"),this.collection.push(a),a.breakpoint?a.mountBreakpoint():await I.call(this,a),a}var H=/*#__PURE__*/i("handleClick"),z=/*#__PURE__*/i("handleKeydown");class K extends o{constructor(e){super(),Object.defineProperty(this,H,{writable:!0,value:void 0}),Object.defineProperty(this,z,{writable:!0,value:void 0}),this.defaults=$,this.settings=n({},this.defaults,e),this.focusTrap=new d,this.store=y(this.settings.storeKey,this.settings.store),t(this,H)[H]=k.bind(this),t(this,z)[z]=C.bind(this),this.settings.autoInit&&this.init()}get activeModal(){return this.collection.find(t=>"opened"===t.state&&"modal"===t.mode)}async init(t=null){t&&(this.settings=n({},this.settings,t));const e=document.querySelectorAll(this.settings.selectorDrawer);return await this.registerCollection(e),this.settings.eventListeners&&this.initEventListeners(),this}async destroy(){return await this.deregisterCollection(),this.settings.eventListeners&&this.destroyEventListeners(),this}initEventListeners(){document.addEventListener("click",t(this,H)[H],!1),document.addEventListener("keydown",t(this,z)[z],!1)}destroyEventListeners(){document.removeEventListener("click",t(this,H)[H],!1),document.removeEventListener("keydown",t(this,z)[z],!1)}register(t){const e=q.call(this,t);return e.error?Promise.reject(e.error):W.call(this,e.drawer,e.dialog)}deregister(t){const e=this.get(T.call(this,t));return S.call(this,e)}open(t,e,i){return M.call(this,t,e,i)}close(t,e,i){return R.call(this,t,e,i)}toggle(t,e,i){return N.call(this,t,e,i)}}var G={autoInit:!1,dataOpen:"modal-open",dataClose:"modal-close",dataReplace:"modal-replace",dataConfig:"modal-config",selectorModal:".modal",selectorDialog:".modal__dialog",selectorRequired:'[role="alertdialog"]',selectorFocus:"[data-focus]",selectorInert:null,selectorOverflow:"body",stateOpened:"is-opened",stateOpening:"is-opening",stateClosing:"is-closing",stateClosed:"is-closed",customEventPrefix:"modal:",eventListeners:!0,teleport:null,teleportMethod:"append",setTabindex:!0,transition:!0};function U(t){const e=this.get("string"==typeof t?t:t.id);if(e)return e;throw new Error(`Modal not found in collection with id of "${t.id||t}".`)}function J(t){return"string"==typeof t?t:"function"==typeof t.hasAttribute?t.hasAttribute(`data-${this.settings.dataOpen}`)?t.getAttribute(`data-${this.settings.dataOpen}`):t.hasAttribute(`data-${this.settings.dataClose}`)?t.getAttribute(`data-${this.settings.dataClose}`)||!1:t.hasAttribute(`data-${this.settings.dataReplace}`)?t.getAttribute(`data-${this.settings.dataReplace}`):t.closest(this.settings.selectorModal)&&(t=t.closest(this.settings.selectorModal)).id||!1:!!t.id&&t.id}function X(t){const e=J.call(this,t);if(e){const t=document.querySelector(`#${e}`),i=t?t.querySelector(this.settings.selectorDialog):null;return t||i?i?{modal:t,dialog:i}:{error:new Error("Modal is missing dialog element.")}:{error:new Error(`No modal elements found using the ID: "${e}".`)}}return{error:new Error("Could not resolve the modal ID.")}}function Y(){this.active?this.focusTrap.mount(this.active.dialog,this.settings.selectorFocus):(this.trigger&&(this.trigger.focus(),this.trigger=null),this.focusTrap.unmount())}async function Q(t){let e=t.target.closest(`[data-${this.settings.dataOpen}], [data-${this.settings.dataReplace}]`);if(e){t.preventDefault(),t.target.closest(this.settings.selectorModal)||(this.trigger=e);const i=this.get(J.call(this,e));return e.matches(`[data-${this.settings.dataOpen}]`)?i.open():i.replace()}if(e=t.target.closest(`[data-${this.settings.dataClose}]`),e){t.preventDefault();const i=e.getAttribute(`data-${this.settings.dataClose}`);return"*"===i?this.closeAll():this.close(i)}if(t.target.matches(this.settings.selectorModal)&&!t.target.querySelector(this.settings.selectorRequired))return this.close(J.call(this,t.target))}function Z(t){if("Escape"===t.key&&this.active&&!this.active.dialog.matches(this.settings.selectorRequired))return this.close()}async function tt(t,e=!0){if(!t)return this.collection;const i=this.collection.findIndex(e=>e.id===t.id);if(i>=0){const t=this.collection[i];e&&"opened"===t.state?await t.close(!1):this.stack.remove(t),t.getSetting("teleport")&&t.teleportReturn(),Object.getOwnPropertyNames(t).forEach(e=>{delete t[e]}),this.collection.splice(i,1)}return this.collection}async function et(t,e,i=!0){const s=U.call(this,t),r=n({},this.settings,s.settings);return void 0!==e&&(r.transition=e),this.stack.moveToTop(s),"closed"===s.state&&(s.state="opening",this.stack.add(s),await w(s.el,r),s.state="opened"),i&&Y.call(this),s.el.dispatchEvent(new CustomEvent(r.customEventPrefix+"opened",{detail:this,bubbles:!0})),s}async function it(t,e,i=!0){const s=t?U.call(this,t):this.active;if(s&&"opened"===s.state){s.state="closing";const t=n({},this.settings,s.settings);void 0!==e&&(t.transition=e),document.activeElement.blur(),await E(s.el,t),this.stack.remove(s),i&&Y.call(this),s.state="closed",s.el.dispatchEvent(new CustomEvent(t.customEventPrefix+"closed",{detail:this,bubbles:!0}))}return s}async function nt(t,e){const i=[];return await Promise.all(this.stack.value.map(async n=>{t&&t===n.id?Promise.resolve():i.push(await it.call(this,n,e,!1)),n.trigger=null})),i}async function st(t,e,i=!0){const n=U.call(this,t);let s,r;return"opened"===n.state?(s=n,r=await nt.call(this,n.id,e)):(s=et.call(this,n,e,!1),r=nt.call(this,!1,e),await Promise.all([s,r])),i&&Y.call(this),{opened:s,closed:r}}async function rt(t,e){await tt.call(this,t,!1);const i=this,s={open(t,e){return et.call(i,this,t,e)},close(t,e){return it.call(i,this,t,e)},replace(t,e){return st.call(i,this,t,e)},deregister(){return tt.call(i,this)},teleport(t=this.getSetting("teleport"),e=this.getSetting("teleportMethod")){return this.returnRef?(console.error("Element has already been teleported:",this.el),!1):(this.returnRef=b(this.el,t,e),this.el)},teleportReturn(){return this.returnRef?(this.returnRef=b(this.el,this.returnRef),this.el):(console.error("No return reference found:",this.el),!1)},getSetting(t){return t in this.settings?this.settings[t]:i.settings[t]}},r=n({id:t.id,state:"closed",el:t,dialog:e,returnRef:null,settings:v(t,this.settings.dataConfig)},s);return r.dialog.setAttribute("aria-modal","true"),r.dialog.hasAttribute("role")||r.dialog.setAttribute("role","dialog"),r.getSetting("setTabindex")&&r.dialog.setAttribute("tabindex","-1"),r.getSetting("teleport")&&r.teleport(),this.collection.push(r),r.el.classList.contains(this.settings.stateOpened)?await r.open(!1):(r.el.classList.remove(this.settings.stateOpening),r.el.classList.remove(this.settings.stateClosing),r.el.classList.add(this.settings.stateClosed)),r}var ot=/*#__PURE__*/i("handleClick"),at=/*#__PURE__*/i("handleKeydown");class lt extends o{constructor(e){super(),Object.defineProperty(this,ot,{writable:!0,value:void 0}),Object.defineProperty(this,at,{writable:!0,value:void 0}),this.defaults=G,this.settings=n({},this.defaults,e),this.trigger=null,this.focusTrap=new d,this.stack=function(t){const e=[];return{get value(){return[...e]},get top(){return e[e.length-1]},updateIndex(){e.forEach((t,e)=>{t.el.style.zIndex=null;const i=getComputedStyle(t.el)["z-index"];t.el.style.zIndex=parseInt(i)+e+1})},updateGlobalState(){x(this.top,t),this.updateIndex()},add(t){t.el.style.zIndex=null;const i=getComputedStyle(t.el)["z-index"];t.el.style.zIndex=parseInt(i)+e.length+1,e.push(t),this.updateGlobalState()},remove(t){const i=e.findIndex(e=>e.id===t.id);i>=0&&(t.el.style.zIndex=null,e.splice(i,1),this.updateGlobalState())},moveToTop(t){const i=e.findIndex(e=>e.id===t.id);i>=0&&(e.splice(i,1),this.add(t))}}}(this.settings),t(this,ot)[ot]=Q.bind(this),t(this,at)[at]=Z.bind(this),this.settings.autoInit&&this.init()}get active(){return this.stack.top}async init(t){t&&(this.settings=n({},this.settings,t));const e=document.querySelectorAll(this.settings.selectorModal);return await this.registerCollection(e),this.settings.eventListeners&&this.initEventListeners(),this}async destroy(){return this.trigger=null,await this.deregisterCollection(),this.settings.eventListeners&&this.destroyEventListeners(),this}initEventListeners(){document.addEventListener("click",t(this,ot)[ot],!1),document.addEventListener("keydown",t(this,at)[at],!1)}destroyEventListeners(){document.removeEventListener("click",t(this,ot)[ot],!1),document.removeEventListener("keydown",t(this,at)[at],!1)}register(t){const e=X.call(this,t);return e.error?Promise.reject(e.error):rt.call(this,e.modal,e.dialog)}deregister(t){const e=this.get(J.call(this,t));return tt.call(this,e)}open(t,e,i){return et.call(this,t,e,i)}close(t,e,i){return it.call(this,t,e,i)}replace(t,e,i){return st.call(this,t,e,i)}async closeAll(t=!1,e,i=!0){const n=await nt.call(this,t,e);return i&&Y.call(this),n}}var ct={autoInit:!1,selectorPopover:".popover",selectorArrow:".popover__arrow",stateActive:"is-active",eventListeners:!0,eventType:"click",placement:"bottom"};function dt(t,e){const i=getComputedStyle(t),n={placement:e.placement,event:e.eventType,offset:0,"overflow-padding":0,"flip-padding":0,"arrow-element":e.selectorArrow,"arrow-padding":0};for(const t in n){const e=P(),s=i.getPropertyValue(`--${e}popover-${t}`).trim();s&&(n[t]=s)}return n}function ut(t){let e;const i="string"==typeof t?t.trim().split(" "):[t];switch(i.forEach(function(t,e){i[e]=parseInt(t,10)}),i.length){case 1:e=i[0];break;case 2:e={top:i[0],right:i[1],bottom:i[0],left:i[1]};break;case 3:e={top:i[0],right:i[1],bottom:i[2],left:i[1]};break;case 4:e={top:i[0],right:i[1],bottom:i[2],left:i[3]};break;default:e=!1}return e}function ht(t){const e=this.get("string"==typeof t?t:t.id);if(e)return e;throw new Error(`Popover not found in collection with id of "${t}".`)}function ft(t){return"string"==typeof t?t:"function"==typeof t.hasAttribute?t.closest(this.settings.selectorPopover)?(t=t.closest(this.settings.selectorPopover)).id:t.hasAttribute("aria-controls")?t.getAttribute("aria-controls"):!!t.hasAttribute("aria-describedby")&&t.getAttribute("aria-describedby"):!!t.id&&t.id}function pt(t){const e=ft.call(this,t);if(e){const t=document.querySelector(`#${e}`),i=document.querySelector(`[aria-controls="${e}"]`)||document.querySelector(`[aria-describedby="${e}"]`);return i||t?i?t?{popover:t,trigger:i}:{error:new Error("No popover associated with the provided popover trigger.")}:{error:new Error("No popover trigger associated with the provided popover.")}:{error:new Error(`No popover elements found using the ID: "${e}".`)}}return{error:new Error("Could not resolve the popover ID.")}}async function gt(t){const e=t?ht.call(this,t):await mt.call(this);return e&&"opened"===e.state&&(e.el.classList.remove(this.settings.stateActive),e.trigger.hasAttribute("aria-controls")&&e.trigger.setAttribute("aria-expanded","false"),e.popper.setOptions({modifiers:[{name:"eventListeners",enabled:!1}]}),e.state="closed",e.trigger===this.trigger&&(this.trigger=null)),e}async function mt(){const t=[];return await Promise.all(this.collection.map(async e=>{"opened"===e.state&&t.push(await gt.call(this,e))})),t}function vt(t){"opened"==t.state&&setTimeout(()=>{const e=t.el.closest(":hover")===t.el||t.trigger.closest(":hover")===t.trigger,i=document.activeElement.closest(`#${t.id}, [aria-controls="${t.id}"], [aria-describedby="${t.id}"]`);return e||i||t.close(),t},1)}function yt(t){"opened"===t.state?t.close():(this.trigger=t.trigger,t.open(),wt.call(this,t))}function bt(t){switch(t.key){case"Escape":return this.trigger&&this.trigger.focus(),void mt.call(this);case"Tab":return void this.collection.forEach(t=>{vt.call(this,t)});default:return}}function wt(t){const e=this;document.addEventListener("click",function i(n){n.target.closest(`#${t.id}, [aria-controls="${t.id}"], [aria-describedby="${t.id}"]`)?t.el&&!t.el.classList.contains(e.settings.stateActive)&&this.removeEventListener("click",i):(t.el&&t.el.classList.contains(e.settings.stateActive)&&t.close(),this.removeEventListener("click",i))})}var Et="top",xt="bottom",Ot="right",Lt="left",At="auto",$t=[Et,xt,Ot,Lt],kt="start",Ct="end",St="clippingParents",Pt="viewport",Dt="popper",jt="reference",Tt=/*#__PURE__*/$t.reduce(function(t,e){return t.concat([e+"-"+kt,e+"-"+Ct])},[]),qt=/*#__PURE__*/[].concat($t,[At]).reduce(function(t,e){return t.concat([e,e+"-"+kt,e+"-"+Ct])},[]),It=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function _t(t){return t?(t.nodeName||"").toLowerCase():null}function Mt(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Rt(t){return t instanceof Mt(t).Element||t instanceof Element}function Nt(t){return t instanceof Mt(t).HTMLElement||t instanceof HTMLElement}function Bt(t){return"undefined"!=typeof ShadowRoot&&(t instanceof Mt(t).ShadowRoot||t instanceof ShadowRoot)}function Vt(t){return t.split("-")[0]}var Ft=Math.max,Wt=Math.min,Ht=Math.round;function zt(){var t=navigator.userAgentData;return null!=t&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function Kt(){return!/^((?!chrome|android).)*safari/i.test(zt())}function Gt(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1);var n=t.getBoundingClientRect(),s=1,r=1;e&&Nt(t)&&(s=t.offsetWidth>0&&Ht(n.width)/t.offsetWidth||1,r=t.offsetHeight>0&&Ht(n.height)/t.offsetHeight||1);var o=(Rt(t)?Mt(t):window).visualViewport,a=!Kt()&&i,l=(n.left+(a&&o?o.offsetLeft:0))/s,c=(n.top+(a&&o?o.offsetTop:0))/r,d=n.width/s,u=n.height/r;return{width:d,height:u,top:c,right:l+d,bottom:c+u,left:l,x:l,y:c}}function Ut(t){var e=Gt(t),i=t.offsetWidth,n=t.offsetHeight;return Math.abs(e.width-i)<=1&&(i=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:t.offsetLeft,y:t.offsetTop,width:i,height:n}}function Jt(t,e){var i=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(i&&Bt(i)){var n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function Xt(t){return Mt(t).getComputedStyle(t)}function Yt(t){return["table","td","th"].indexOf(_t(t))>=0}function Qt(t){return((Rt(t)?t.ownerDocument:t.document)||window.document).documentElement}function Zt(t){return"html"===_t(t)?t:t.assignedSlot||t.parentNode||(Bt(t)?t.host:null)||Qt(t)}function te(t){return Nt(t)&&"fixed"!==Xt(t).position?t.offsetParent:null}function ee(t){for(var e=Mt(t),i=te(t);i&&Yt(i)&&"static"===Xt(i).position;)i=te(i);return i&&("html"===_t(i)||"body"===_t(i)&&"static"===Xt(i).position)?e:i||function(t){var e=/firefox/i.test(zt());if(/Trident/i.test(zt())&&Nt(t)&&"fixed"===Xt(t).position)return null;var i=Zt(t);for(Bt(i)&&(i=i.host);Nt(i)&&["html","body"].indexOf(_t(i))<0;){var n=Xt(i);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||e&&"filter"===n.willChange||e&&n.filter&&"none"!==n.filter)return i;i=i.parentNode}return null}(t)||e}function ie(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function ne(t,e,i){return Ft(t,Wt(e,i))}function se(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function re(t,e){return e.reduce(function(e,i){return e[i]=t,e},{})}function oe(t){return t.split("-")[1]}var ae={top:"auto",right:"auto",bottom:"auto",left:"auto"};function le(t){var e,i=t.popper,n=t.popperRect,s=t.placement,r=t.variation,o=t.offsets,a=t.position,l=t.gpuAcceleration,c=t.adaptive,d=t.roundOffsets,u=t.isFixed,h=o.x,f=void 0===h?0:h,p=o.y,g=void 0===p?0:p,m="function"==typeof d?d({x:f,y:g}):{x:f,y:g};f=m.x,g=m.y;var v=o.hasOwnProperty("x"),y=o.hasOwnProperty("y"),b=Lt,w=Et,E=window;if(c){var x=ee(i),O="clientHeight",L="clientWidth";x===Mt(i)&&"static"!==Xt(x=Qt(i)).position&&"absolute"===a&&(O="scrollHeight",L="scrollWidth"),(s===Et||(s===Lt||s===Ot)&&r===Ct)&&(w=xt,g-=(u&&x===E&&E.visualViewport?E.visualViewport.height:x[O])-n.height,g*=l?1:-1),s!==Lt&&(s!==Et&&s!==xt||r!==Ct)||(b=Ot,f-=(u&&x===E&&E.visualViewport?E.visualViewport.width:x[L])-n.width,f*=l?1:-1)}var A,$=Object.assign({position:a},c&&ae),k=!0===d?function(t,e){var i=t.y,n=e.devicePixelRatio||1;return{x:Ht(t.x*n)/n||0,y:Ht(i*n)/n||0}}({x:f,y:g},Mt(i)):{x:f,y:g};return f=k.x,g=k.y,Object.assign({},$,l?((A={})[w]=y?"0":"",A[b]=v?"0":"",A.transform=(E.devicePixelRatio||1)<=1?"translate("+f+"px, "+g+"px)":"translate3d("+f+"px, "+g+"px, 0)",A):((e={})[w]=y?g+"px":"",e[b]=v?f+"px":"",e.transform="",e))}var ce={passive:!0},de={left:"right",right:"left",bottom:"top",top:"bottom"};function ue(t){return t.replace(/left|right|bottom|top/g,function(t){return de[t]})}var he={start:"end",end:"start"};function fe(t){return t.replace(/start|end/g,function(t){return he[t]})}function pe(t){var e=Mt(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function ge(t){return Gt(Qt(t)).left+pe(t).scrollLeft}function me(t){var e=Xt(t);return/auto|scroll|overlay|hidden/.test(e.overflow+e.overflowY+e.overflowX)}function ve(t){return["html","body","#document"].indexOf(_t(t))>=0?t.ownerDocument.body:Nt(t)&&me(t)?t:ve(Zt(t))}function ye(t,e){var i;void 0===e&&(e=[]);var n=ve(t),s=n===(null==(i=t.ownerDocument)?void 0:i.body),r=Mt(n),o=s?[r].concat(r.visualViewport||[],me(n)?n:[]):n,a=e.concat(o);return s?a:a.concat(ye(Zt(o)))}function be(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function we(t,e,i){return e===Pt?be(function(t,e){var i=Mt(t),n=Qt(t),s=i.visualViewport,r=n.clientWidth,o=n.clientHeight,a=0,l=0;if(s){r=s.width,o=s.height;var c=Kt();(c||!c&&"fixed"===e)&&(a=s.offsetLeft,l=s.offsetTop)}return{width:r,height:o,x:a+ge(t),y:l}}(t,i)):Rt(e)?function(t,e){var i=Gt(t,!1,"fixed"===e);return i.top=i.top+t.clientTop,i.left=i.left+t.clientLeft,i.bottom=i.top+t.clientHeight,i.right=i.left+t.clientWidth,i.width=t.clientWidth,i.height=t.clientHeight,i.x=i.left,i.y=i.top,i}(e,i):be(function(t){var e,i=Qt(t),n=pe(t),s=null==(e=t.ownerDocument)?void 0:e.body,r=Ft(i.scrollWidth,i.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=Ft(i.scrollHeight,i.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-n.scrollLeft+ge(t),l=-n.scrollTop;return"rtl"===Xt(s||i).direction&&(a+=Ft(i.clientWidth,s?s.clientWidth:0)-r),{width:r,height:o,x:a,y:l}}(Qt(t)))}function Ee(t){var e,i=t.reference,n=t.element,s=t.placement,r=s?Vt(s):null,o=s?oe(s):null,a=i.x+i.width/2-n.width/2,l=i.y+i.height/2-n.height/2;switch(r){case Et:e={x:a,y:i.y-n.height};break;case xt:e={x:a,y:i.y+i.height};break;case Ot:e={x:i.x+i.width,y:l};break;case Lt:e={x:i.x-n.width,y:l};break;default:e={x:i.x,y:i.y}}var c=r?ie(r):null;if(null!=c){var d="y"===c?"height":"width";switch(o){case kt:e[c]=e[c]-(i[d]/2-n[d]/2);break;case Ct:e[c]=e[c]+(i[d]/2-n[d]/2)}}return e}function xe(t,e){void 0===e&&(e={});var i=e.placement,n=void 0===i?t.placement:i,s=e.strategy,r=void 0===s?t.strategy:s,o=e.boundary,a=void 0===o?St:o,l=e.rootBoundary,c=void 0===l?Pt:l,d=e.elementContext,u=void 0===d?Dt:d,h=e.altBoundary,f=void 0!==h&&h,p=e.padding,g=void 0===p?0:p,m=se("number"!=typeof g?g:re(g,$t)),v=t.rects.popper,y=t.elements[f?u===Dt?jt:Dt:u],b=function(t,e,i,n){var s="clippingParents"===e?function(t){var e=ye(Zt(t)),i=["absolute","fixed"].indexOf(Xt(t).position)>=0&&Nt(t)?ee(t):t;return Rt(i)?e.filter(function(t){return Rt(t)&&Jt(t,i)&&"body"!==_t(t)}):[]}(t):[].concat(e),r=[].concat(s,[i]),o=r.reduce(function(e,i){var s=we(t,i,n);return e.top=Ft(s.top,e.top),e.right=Wt(s.right,e.right),e.bottom=Wt(s.bottom,e.bottom),e.left=Ft(s.left,e.left),e},we(t,r[0],n));return o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}(Rt(y)?y:y.contextElement||Qt(t.elements.popper),a,c,r),w=Gt(t.elements.reference),E=Ee({reference:w,element:v,strategy:"absolute",placement:n}),x=be(Object.assign({},v,E)),O=u===Dt?x:w,L={top:b.top-O.top+m.top,bottom:O.bottom-b.bottom+m.bottom,left:b.left-O.left+m.left,right:O.right-b.right+m.right},A=t.modifiersData.offset;if(u===Dt&&A){var $=A[n];Object.keys(L).forEach(function(t){var e=[Ot,xt].indexOf(t)>=0?1:-1,i=[Et,xt].indexOf(t)>=0?"y":"x";L[t]+=$[i]*e})}return L}function Oe(t,e){void 0===e&&(e={});var i=e.boundary,n=e.rootBoundary,s=e.padding,r=e.flipVariations,o=e.allowedAutoPlacements,a=void 0===o?qt:o,l=oe(e.placement),c=l?r?Tt:Tt.filter(function(t){return oe(t)===l}):$t,d=c.filter(function(t){return a.indexOf(t)>=0});0===d.length&&(d=c);var u=d.reduce(function(e,r){return e[r]=xe(t,{placement:r,boundary:i,rootBoundary:n,padding:s})[Vt(r)],e},{});return Object.keys(u).sort(function(t,e){return u[t]-u[e]})}var Le={name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name;if(!e.modifiersData[n]._skip){for(var s=i.mainAxis,r=void 0===s||s,o=i.altAxis,a=void 0===o||o,l=i.fallbackPlacements,c=i.padding,d=i.boundary,u=i.rootBoundary,h=i.altBoundary,f=i.flipVariations,p=void 0===f||f,g=i.allowedAutoPlacements,m=e.options.placement,v=Vt(m),y=l||(v!==m&&p?function(t){if(Vt(t)===At)return[];var e=ue(t);return[fe(t),e,fe(e)]}(m):[ue(m)]),b=[m].concat(y).reduce(function(t,i){return t.concat(Vt(i)===At?Oe(e,{placement:i,boundary:d,rootBoundary:u,padding:c,flipVariations:p,allowedAutoPlacements:g}):i)},[]),w=e.rects.reference,E=e.rects.popper,x=new Map,O=!0,L=b[0],A=0;A<b.length;A++){var $=b[A],k=Vt($),C=oe($)===kt,S=[Et,xt].indexOf(k)>=0,P=S?"width":"height",D=xe(e,{placement:$,boundary:d,rootBoundary:u,altBoundary:h,padding:c}),j=S?C?Ot:Lt:C?xt:Et;w[P]>E[P]&&(j=ue(j));var T=ue(j),q=[];if(r&&q.push(D[k]<=0),a&&q.push(D[j]<=0,D[T]<=0),q.every(function(t){return t})){L=$,O=!1;break}x.set($,q)}if(O)for(var I=function(t){var e=b.find(function(e){var i=x.get(e);if(i)return i.slice(0,t).every(function(t){return t})});if(e)return L=e,"break"},_=p?3:1;_>0&&"break"!==I(_);_--);e.placement!==L&&(e.modifiersData[n]._skip=!0,e.placement=L,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Ae(t,e,i){return void 0===i&&(i={x:0,y:0}),{top:t.top-e.height-i.y,right:t.right-e.width+i.x,bottom:t.bottom-e.height+i.y,left:t.left-e.width-i.x}}function $e(t){return[Et,Ot,xt,Lt].some(function(e){return t[e]>=0})}function ke(t,e,i){void 0===i&&(i=!1);var n,s,r=Nt(e),o=Nt(e)&&function(t){var e=t.getBoundingClientRect(),i=Ht(e.width)/t.offsetWidth||1,n=Ht(e.height)/t.offsetHeight||1;return 1!==i||1!==n}(e),a=Qt(e),l=Gt(t,o,i),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(r||!r&&!i)&&(("body"!==_t(e)||me(a))&&(c=(n=e)!==Mt(n)&&Nt(n)?{scrollLeft:(s=n).scrollLeft,scrollTop:s.scrollTop}:pe(n)),Nt(e)?((d=Gt(e,!0)).x+=e.clientLeft,d.y+=e.clientTop):a&&(d.x=ge(a))),{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function Ce(t){var e=new Map,i=new Set,n=[];function s(t){i.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach(function(t){if(!i.has(t)){var n=e.get(t);n&&s(n)}}),n.push(t)}return t.forEach(function(t){e.set(t.name,t)}),t.forEach(function(t){i.has(t.name)||s(t)}),n}var Se={placement:"bottom",modifiers:[],strategy:"absolute"};function Pe(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return!e.some(function(t){return!(t&&"function"==typeof t.getBoundingClientRect)})}function De(t){void 0===t&&(t={});var e=t.defaultModifiers,i=void 0===e?[]:e,n=t.defaultOptions,s=void 0===n?Se:n;return function(t,e,n){void 0===n&&(n=s);var r,o,a={placement:"bottom",orderedModifiers:[],options:Object.assign({},Se,s),modifiersData:{},elements:{reference:t,popper:e},attributes:{},styles:{}},l=[],c=!1,d={state:a,setOptions:function(n){var r="function"==typeof n?n(a.options):n;u(),a.options=Object.assign({},s,a.options,r),a.scrollParents={reference:Rt(t)?ye(t):t.contextElement?ye(t.contextElement):[],popper:ye(e)};var o,c,h=function(t){var e=Ce(t);return It.reduce(function(t,i){return t.concat(e.filter(function(t){return t.phase===i}))},[])}((o=[].concat(i,a.options.modifiers),c=o.reduce(function(t,e){var i=t[e.name];return t[e.name]=i?Object.assign({},i,e,{options:Object.assign({},i.options,e.options),data:Object.assign({},i.data,e.data)}):e,t},{}),Object.keys(c).map(function(t){return c[t]})));return a.orderedModifiers=h.filter(function(t){return t.enabled}),a.orderedModifiers.forEach(function(t){var e=t.options,i=t.effect;if("function"==typeof i){var n=i({state:a,name:t.name,instance:d,options:void 0===e?{}:e});l.push(n||function(){})}}),d.update()},forceUpdate:function(){if(!c){var t=a.elements,e=t.reference,i=t.popper;if(Pe(e,i)){a.rects={reference:ke(e,ee(i),"fixed"===a.options.strategy),popper:Ut(i)},a.reset=!1,a.placement=a.options.placement,a.orderedModifiers.forEach(function(t){return a.modifiersData[t.name]=Object.assign({},t.data)});for(var n=0;n<a.orderedModifiers.length;n++)if(!0!==a.reset){var s=a.orderedModifiers[n],r=s.fn,o=s.options;"function"==typeof r&&(a=r({state:a,options:void 0===o?{}:o,name:s.name,instance:d})||a)}else a.reset=!1,n=-1}}},update:(r=function(){return new Promise(function(t){d.forceUpdate(),t(a)})},function(){return o||(o=new Promise(function(t){Promise.resolve().then(function(){o=void 0,t(r())})})),o}),destroy:function(){u(),c=!0}};if(!Pe(t,e))return d;function u(){l.forEach(function(t){return t()}),l=[]}return d.setOptions(n).then(function(t){!c&&n.onFirstUpdate&&n.onFirstUpdate(t)}),d}}var je=/*#__PURE__*/De({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,i=t.instance,n=t.options,s=n.scroll,r=void 0===s||s,o=n.resize,a=void 0===o||o,l=Mt(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return r&&c.forEach(function(t){t.addEventListener("scroll",i.update,ce)}),a&&l.addEventListener("resize",i.update,ce),function(){r&&c.forEach(function(t){t.removeEventListener("scroll",i.update,ce)}),a&&l.removeEventListener("resize",i.update,ce)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state;e.modifiersData[t.name]=Ee({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,i=t.options,n=i.gpuAcceleration,s=void 0===n||n,r=i.adaptive,o=void 0===r||r,a=i.roundOffsets,l=void 0===a||a,c={placement:Vt(e.placement),variation:oe(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,le(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,le(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach(function(t){var i=e.styles[t]||{},n=e.attributes[t]||{},s=e.elements[t];Nt(s)&&_t(s)&&(Object.assign(s.style,i),Object.keys(n).forEach(function(t){var e=n[t];!1===e?s.removeAttribute(t):s.setAttribute(t,!0===e?"":e)}))})},effect:function(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow),function(){Object.keys(e.elements).forEach(function(t){var n=e.elements[t],s=e.attributes[t]||{},r=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:i[t]).reduce(function(t,e){return t[e]="",t},{});Nt(n)&&_t(n)&&(Object.assign(n.style,r),Object.keys(s).forEach(function(t){n.removeAttribute(t)}))})}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,i=t.name,n=t.options.offset,s=void 0===n?[0,0]:n,r=qt.reduce(function(t,i){return t[i]=function(t,e,i){var n=Vt(t),s=[Lt,Et].indexOf(n)>=0?-1:1,r="function"==typeof i?i(Object.assign({},e,{placement:t})):i,o=r[0],a=r[1];return o=o||0,a=(a||0)*s,[Lt,Ot].indexOf(n)>=0?{x:a,y:o}:{x:o,y:a}}(i,e.rects,s),t},{}),o=r[e.placement],a=o.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=o.x,e.modifiersData.popperOffsets.y+=a),e.modifiersData[i]=r}},Le,{name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name,s=i.mainAxis,r=void 0===s||s,o=i.altAxis,a=void 0!==o&&o,l=i.tether,c=void 0===l||l,d=i.tetherOffset,u=void 0===d?0:d,h=xe(e,{boundary:i.boundary,rootBoundary:i.rootBoundary,padding:i.padding,altBoundary:i.altBoundary}),f=Vt(e.placement),p=oe(e.placement),g=!p,m=ie(f),v="x"===m?"y":"x",y=e.modifiersData.popperOffsets,b=e.rects.reference,w=e.rects.popper,E="function"==typeof u?u(Object.assign({},e.rects,{placement:e.placement})):u,x="number"==typeof E?{mainAxis:E,altAxis:E}:Object.assign({mainAxis:0,altAxis:0},E),O=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,L={x:0,y:0};if(y){if(r){var A,$="y"===m?Et:Lt,k="y"===m?xt:Ot,C="y"===m?"height":"width",S=y[m],P=S+h[$],D=S-h[k],j=c?-w[C]/2:0,T=p===kt?b[C]:w[C],q=p===kt?-w[C]:-b[C],I=e.elements.arrow,_=c&&I?Ut(I):{width:0,height:0},M=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},R=M[$],N=M[k],B=ne(0,b[C],_[C]),V=g?b[C]/2-j-B-R-x.mainAxis:T-B-R-x.mainAxis,F=g?-b[C]/2+j+B+N+x.mainAxis:q+B+N+x.mainAxis,W=e.elements.arrow&&ee(e.elements.arrow),H=null!=(A=null==O?void 0:O[m])?A:0,z=S+F-H,K=ne(c?Wt(P,S+V-H-(W?"y"===m?W.clientTop||0:W.clientLeft||0:0)):P,S,c?Ft(D,z):D);y[m]=K,L[m]=K-S}if(a){var G,U=y[v],J="y"===v?"height":"width",X=U+h["x"===m?Et:Lt],Y=U-h["x"===m?xt:Ot],Q=-1!==[Et,Lt].indexOf(f),Z=null!=(G=null==O?void 0:O[v])?G:0,tt=Q?X:U-b[J]-w[J]-Z+x.altAxis,et=Q?U+b[J]+w[J]-Z-x.altAxis:Y,it=c&&Q?function(t,e,i){var n=ne(t,e,i);return n>i?i:n}(tt,U,et):ne(c?tt:X,U,c?et:Y);y[v]=it,L[v]=it-U}e.modifiersData[n]=L}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,i=t.state,n=t.name,s=t.options,r=i.elements.arrow,o=i.modifiersData.popperOffsets,a=Vt(i.placement),l=ie(a),c=[Lt,Ot].indexOf(a)>=0?"height":"width";if(r&&o){var d=function(t,e){return se("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:re(t,$t))}(s.padding,i),u=Ut(r),h="y"===l?Et:Lt,f="y"===l?xt:Ot,p=i.rects.reference[c]+i.rects.reference[l]-o[l]-i.rects.popper[c],g=o[l]-i.rects.reference[l],m=ee(r),v=m?"y"===l?m.clientHeight||0:m.clientWidth||0:0,y=v/2-u[c]/2+(p/2-g/2),b=ne(d[h],y,v-u[c]-d[f]);i.modifiersData[n]=((e={})[l]=b,e.centerOffset=b-y,e)}},effect:function(t){var e=t.state,i=t.options.element,n=void 0===i?"[data-popper-arrow]":i;null!=n&&("string"!=typeof n||(n=e.elements.popper.querySelector(n)))&&Jt(e.elements.popper,n)&&(e.elements.arrow=n)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,i=t.name,n=e.rects.reference,s=e.rects.popper,r=e.modifiersData.preventOverflow,o=xe(e,{elementContext:"reference"}),a=xe(e,{altBoundary:!0}),l=Ae(o,n),c=Ae(a,s,r),d=$e(l),u=$e(c);e.modifiersData[i]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:d,hasPopperEscaped:u},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":u})}}]});async function Te(t){if(!t)return this.collection;const e=this.collection.findIndex(e=>e.id===t.id);if(e>=0){const t=this.collection[e];"opened"===t.state&&t.close(),t.popper.destroy(),qe(t),Object.getOwnPropertyNames(t).forEach(e=>{delete t[e]}),this.collection.splice(e,1)}return this.collection}function qe(t){return t.__eventListeners&&(t.__eventListeners.forEach(e=>{e.el.forEach(i=>{e.type.forEach(n=>{t[i].removeEventListener(n,e.listener,!1)})})}),delete t.__eventListeners),t}async function Ie(t){const e=ht.call(this,t);var i;return e.el.classList.add(this.settings.stateActive),e.trigger.hasAttribute("aria-controls")&&e.trigger.setAttribute("aria-expanded","true"),e.config=dt(e.el,this.settings),e.popper.setOptions({placement:e.config.placement,modifiers:[{name:"eventListeners",enabled:!0},...(i=e.config,[{name:"offset",options:{offset:[0,parseInt(i.offset,10)]}},{name:"preventOverflow",options:{padding:ut(i["overflow-padding"])}},{name:"flip",options:{padding:ut(i["flip-padding"])}},{name:"arrow",options:{element:i["arrow-element"],padding:ut(i["arrow-padding"])}}])]}),e.popper.update(),e.state="opened",e}async function _e(t,e){Te.call(this,t);const i=this,s={open(){return Ie.call(i,this)},close(){return gt.call(i,this)},deregister(){return Te.call(i,this)}},r=n({id:t.id,state:"closed",el:t,trigger:e,popper:je(e,t),config:dt(t,this.settings)},s);return r.trigger.hasAttribute("aria-controls")&&r.trigger.setAttribute("aria-expanded","false"),Me.call(this,r),this.collection.push(r),r.el.classList.contains(this.settings.stateActive)&&(await r.open(),wt.call(this,r)),r}function Me(t){return t.__eventListeners||("hover"===t.config.event?(t.__eventListeners=[{el:["trigger"],type:["mouseenter","focus"],listener:Ie.bind(this,t)},{el:["el","trigger"],type:["mouseleave","focusout"],listener:vt.bind(this,t)}],t.__eventListeners.forEach(e=>{e.el.forEach(i=>{e.type.forEach(n=>{t[i].addEventListener(n,e.listener,!1)})})})):(t.__eventListeners=[{el:["trigger"],type:["click"],listener:yt.bind(this,t)}],t.__eventListeners.forEach(e=>{e.el.forEach(i=>{e.type.forEach(n=>{t[i].addEventListener(n,e.listener,!1)})})}))),t}var Re=/*#__PURE__*/i("handleKeydown");class Ne extends o{constructor(e){super(),Object.defineProperty(this,Re,{writable:!0,value:void 0}),this.defaults=ct,this.settings=n({},this.defaults,e),this.trigger=null,t(this,Re)[Re]=bt.bind(this),this.settings.autoInit&&this.init()}async init(t){t&&(this.settings=n({},this.settings,t));const e=document.querySelectorAll(this.settings.selectorPopover);return await this.registerCollection(e),this.settings.eventListeners&&this.initEventListeners(!1),this}async destroy(){return this.trigger=null,await this.deregisterCollection(),this.settings.eventListeners&&this.destroyEventListeners(!1),this}initEventListeners(e=!0){e&&this.collection.forEach(t=>{Me.call(this,t)}),document.addEventListener("keydown",t(this,Re)[Re],!1)}destroyEventListeners(e=!0){e&&this.collection.forEach(t=>{qe(t)}),document.removeEventListener("keydown",t(this,Re)[Re],!1)}register(t){const e=pt.call(this,t);return e.error?Promise.reject(e.error):_e.call(this,e.popover,e.trigger)}deregister(t){const e=this.get(ft.call(this,t));return Te.call(this,e)}open(t){return Ie.call(this,t)}close(t){return gt.call(this,t)}}export{A as Checkbox,K as Drawer,lt as Modal,Ne as Popover,O as core};
|
|
1
|
+
function t(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var e=0;function i(t){return"__private_"+e+++"_"+t}function n(){return n=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)({}).hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},n.apply(null,arguments)}var s=/*#__PURE__*/i("handler");class r{constructor(e,i){Object.defineProperty(this,s,{writable:!0,value:void 0}),this.value=e,t(this,s)[s]=i,this.mql=null}get handler(){return t(this,s)[s]}set handler(e){this.mql&&("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",t(this,s)[s]):this.mql.removeListener(t(this,s)[s])),t(this,s)[s]=e}mount(e,i){return e&&(this.value=e),i&&(t(this,s)[s]=i),this.value?(this.mql=window.matchMedia(`(min-width: ${this.value})`),"function"==typeof this.mql.addEventListener?this.mql.addEventListener("change",t(this,s)[s]):this.mql.addListener(t(this,s)[s]),t(this,s)[s](this.mql),this):this}unmount(){return this.mql?("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",t(this,s)[s]):this.mql.removeListener(t(this,s)[s]),this.value=null,t(this,s)[s]=null,this.mql=null,this):this}}class o{constructor(){this.collection=[]}async register(t){return await this.deregister(t),this.collection.push(t),this.collection}async deregister(t){const e=this.collection.findIndex(e=>e===t);if(e>=0){const t=this.collection[e];Object.getOwnPropertyNames(t).forEach(e=>{delete t[e]}),this.collection.splice(e,1)}return this.collection}async registerCollection(t){return await Promise.all(Array.from(t,t=>{this.register(t)})),this.collection}async deregisterCollection(){for(;this.collection.length>0;)await this.deregister(this.collection[0]);return this.collection}get(t,e="id"){return this.collection.find(i=>i[e]===t)}}var a=/*#__PURE__*/i("focusable"),l=/*#__PURE__*/i("handleFocusTrap"),c=/*#__PURE__*/i("handleFocusLock");class d{constructor(e=null,i="[data-focus]"){Object.defineProperty(this,a,{writable:!0,value:void 0}),Object.defineProperty(this,l,{writable:!0,value:void 0}),Object.defineProperty(this,c,{writable:!0,value:void 0}),this.el=e,this.selectorFocus=i,t(this,l)[l]=g.bind(this),t(this,c)[c]=m.bind(this)}get focusable(){return t(this,a)[a]}set focusable(e){t(this,a)[a]=e,t(this,a)[a].length?(document.removeEventListener("keydown",t(this,c)[c]),document.addEventListener("keydown",t(this,l)[l])):(document.removeEventListener("keydown",t(this,l)[l]),document.addEventListener("keydown",t(this,c)[c]))}get focusableFirst(){return this.focusable[0]}get focusableLast(){return this.focusable[this.focusable.length-1]}mount(t,e){t&&(this.el=t),e&&(this.selectorFocus=e),this.focusable=this.getFocusable(),this.focus()}unmount(){this.el=null,this.focusable=[],document.removeEventListener("keydown",t(this,l)[l]),document.removeEventListener("keydown",t(this,c)[c])}focus(t=this.el,e=this.selectorFocus){(t.querySelector(e)||t).focus()}getFocusable(t=this.el){const e=[],i=document.activeElement,n=t.scrollTop,s=p.join(",");return t.querySelectorAll(s).forEach(t=>{t.focus(),document.activeElement===t&&e.push(t)}),t.scrollTop=n,i.focus(),e}}const u=":not([inert])",h=':not([tabindex^="-"])',f=":not(:disabled)",p=[`a[href]${u}${h}`,`area[href]${u}${h}`,`input:not([type="hidden"]):not([type="radio"])${u}${h}${f}`,`input[type="radio"]${u}${h}${f}`,`select${u}${h}${f}`,`textarea${u}${h}${f}`,`button${u}${h}${f}`,`details${u} > summary:first-of-type${h}`,`iframe${u}${h}`,`audio[controls]${u}${h}`,`video[controls]${u}${h}`,`[contenteditable]${u}${h}`,`[tabindex]${u}${h}`];function g(t){("Tab"===t.key||9===t.keyCode)&&(t.shiftKey?document.activeElement!==this.focusableFirst&&document.activeElement!==this.el||(t.preventDefault(),this.focusableLast.focus()):document.activeElement!==this.focusableLast&&document.activeElement!==this.el||(t.preventDefault(),this.focusableFirst.focus()))}function m(t){("Tab"===t.key||9===t.keyCode)&&t.preventDefault()}function v(t,e){const i=(t.getAttribute(`data-${e}`)||"").replace(/'/g,'"');return i?JSON.parse(i):{}}function y(t,e=!0){const i=localStorage.getItem(t),n=i?JSON.parse(i):{};return{get:t=>t?n[t]:n,set:(i,s)=>(s?n[i]=s:delete n[i],e&&localStorage.setItem(t,JSON.stringify(n)),n)}}function b(t,e,i){const n=e.nodeType===Node.COMMENT_NODE,s=e.nodeType===Node.ELEMENT_NODE;if(n&&(i="after"),!(e=n||s?e:document.querySelector(e)))throw new Error(`Not a valid teleport reference: '${e}'`);if("function"!=typeof e[i])throw new Error(`Not a valid teleport method: '${i}'`);let r=null;return n||(r=document.createComment("teleported #"+t.id),t.before(r)),e[i](t),n&&e.remove(),r}const w=(t,e)=>new Promise(i=>{e.transition?(t.classList.remove(e.stateClosed),t.classList.add(e.stateOpening),t.addEventListener("transitionend",function n(s){s.target==t&&(t.classList.add(e.stateOpened),t.classList.remove(e.stateOpening),i(t),this.removeEventListener("transitionend",n))})):(t.classList.add(e.stateOpened),t.classList.remove(e.stateClosed),i(t))}),E=(t,e)=>new Promise(i=>{e.transition?(t.classList.add(e.stateClosing),t.classList.remove(e.stateOpened),t.addEventListener("transitionend",function n(s){s.target==t&&(t.classList.remove(e.stateClosing),t.classList.add(e.stateClosed),i(t),this.removeEventListener("transitionend",n))})):(t.classList.add(e.stateClosed),t.classList.remove(e.stateOpened),i(t))});function x(t,e){var i,n;i=!!t,(n=e.selectorInert)&&document.querySelectorAll(n).forEach(t=>{t.inert=i}),function(t,e){e&&document.querySelectorAll(e).forEach(e=>{t?e.style.overflow="hidden":e.style.removeProperty("overflow")})}(!!t,e.selectorOverflow)}var O={__proto__:null,Breakpoint:r,Collection:o,FocusTrap:d,getConfig:v,getPrefix:function(){return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim()},localStore:y,teleport:b,openTransition:w,closeTransition:E,updateGlobalState:x},L={autoInit:!1,stateAttr:"aria-checked",stateValue:"mixed"};class A{constructor(t){this.defaults=L,this.settings=n({},this.defaults,t),this.__handlerClick=this.handlerClick.bind(this),this.settings.autoInit&&this.init()}init(t=null){t&&(this.settings=n({},this.settings,t));const e=document.querySelectorAll(`[${this.settings.stateAttr}="${this.settings.stateValue}"]`);this.setIndeterminate(e),document.addEventListener("click",this.__handlerClick,!1)}destroy(){document.removeEventListener("click",this.__handlerClick,!1)}handlerClick(t){const e=t.target.closest(`[${this.settings.stateAttr}="${this.settings.stateValue}"]`);e&&(this.removeAriaState(e),this.setIndeterminate(e))}setAriaState(t,e=this.settings.stateValue){(t=t.forEach?t:[t]).forEach(t=>{t.setAttribute(this.settings.stateAttr,e)})}removeAriaState(t){(t=t.forEach?t:[t]).forEach(t=>{t.removeAttribute(this.settings.stateAttr)})}setIndeterminate(t){(t=t.forEach?t:[t]).forEach(t=>{t.indeterminate=!!t.hasAttribute(this.settings.stateAttr)})}}var $={autoInit:!1,dataOpen:"drawer-open",dataClose:"drawer-close",dataToggle:"drawer-toggle",dataBreakpoint:"drawer-breakpoint",dataConfig:"drawer-config",selectorDrawer:".drawer",selectorDialog:".drawer__dialog",selectorFocus:"[data-focus]",selectorInert:null,selectorOverflow:"body",stateOpened:"is-opened",stateOpening:"is-opening",stateClosing:"is-closing",stateClosed:"is-closed",classModal:"drawer_modal",breakpoints:null,customEventPrefix:"drawer:",eventListeners:!0,store:!0,storeKey:"VB:DrawerState",setTabindex:!0,transition:!0};function k(t){const e=t.target.closest(`\n [data-${this.settings.dataOpen}],\n [data-${this.settings.dataToggle}],\n [data-${this.settings.dataClose}]\n `);e?(t.preventDefault(),e.matches(`[data-${this.settings.dataToggle}]`)&&e.getAttribute(`data-${this.settings.dataToggle}`).trim().split(" ").forEach(t=>{const i=this.get(t);i.trigger=e,i.toggle()}),e.matches(`[data-${this.settings.dataOpen}]`)&&e.getAttribute(`data-${this.settings.dataOpen}`).trim().split(" ").forEach(t=>{const i=this.get(t);i.trigger=e,i.open()}),e.matches(`[data-${this.settings.dataClose}]`)&&e.getAttribute(`data-${this.settings.dataClose}`).trim().split(" ").forEach(i=>{if(i){const t=this.get(i);t.trigger=e,t.close()}else{const e=t.target.closest(this.settings.selectorDrawer);e&&this.close(e)}})):t.target.matches(this.settings.selectorDrawer)&&this.close(t.target.id)}function C(t){if("Escape"===t.key){const t=this.activeModal;t&&this.close(t)}}async function S(t,e=!0){if(!t)return this.collection;const i=this.collection.findIndex(e=>e.id===t.id);if(i>=0){const t=this.collection[i];e&&"opened"===t.state&&await t.close(!1),this.store.set(t.id),t.unmountBreakpoint(),Object.getOwnPropertyNames(t).forEach(e=>{delete t[e]}),this.collection.splice(i,1)}return this.collection}function P(){return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim()}function D(t){const e=P(),i=t.getAttribute(`data-${this.settings.dataBreakpoint}`);return this.settings.breakpoints&&this.settings.breakpoints[i]?this.settings.breakpoints[i]:getComputedStyle(document.body).getPropertyValue(`--${e}breakpoint-${i}`).trim()?getComputedStyle(document.body).getPropertyValue(`--${e}breakpoint-${i}`).trim():i}function j(t){const e=this.get("string"==typeof t?t:t.id);if(e)return e;throw new Error(`Drawer not found in collection with id of "${t.id||t}".`)}function T(t){return"string"==typeof t?t:"function"==typeof t.hasAttribute?t.hasAttribute(`data-${this.settings.dataOpen}`)?t.getAttribute(`data-${this.settings.dataOpen}`):t.hasAttribute(`data-${this.settings.dataClose}`)?t.getAttribute(`data-${this.settings.dataClose}`)||!1:t.hasAttribute(`data-${this.settings.dataToggle}`)?t.getAttribute(`data-${this.settings.dataToggle}`):t.closest(this.settings.selectorDrawer)&&(t=t.closest(this.settings.selectorDrawer)).id||!1:!!t.id&&t.id}function q(t){const e=T.call(this,t);if(e){const t=document.querySelector(`#${e}`),i=t?t.querySelector(this.settings.selectorDialog):null;return t||i?i?{drawer:t,dialog:i}:{error:new Error("Drawer is missing dialog element.")}:{error:new Error(`No drawer elements found using the ID: "${e}".`)}}return{error:new Error("Could not resolve the drawer ID.")}}async function I(t){this.store.get(t.id)?"opened"===this.store.get(t.id)?await t.open(!1,!1):await t.close(!1,!1):t.el.classList.contains(this.settings.stateOpened)?t.state="opened":(t.el.classList.remove(this.settings.stateOpening),t.el.classList.remove(this.settings.stateClosing),t.el.classList.add(this.settings.stateClosed))}function _(t){"opened"===t.state?"modal"===t.mode?this.focusTrap.mount(t.dialog,this.settings.selectorFocus):this.focusTrap.focus(t.dialog,this.settings.selectorFocus):(t.trigger&&(t.trigger.focus(),t.trigger=null),this.focusTrap.unmount())}async function M(t,e,i=!0){const s=j.call(this,t),r=n({},this.settings,s.settings);return void 0!==e&&(r.transition=e),"closed"===s.state&&(s.state="opening",await w(s.el,r),"modal"===s.mode&&x(!0,r),s.state="opened"),i&&_.call(this,s),s.el.dispatchEvent(new CustomEvent(r.customEventPrefix+"opened",{detail:this,bubbles:!0})),s}async function R(t,e,i=!0){const s=j.call(this,t),r=n({},this.settings,s.settings);return void 0!==e&&(r.transition=e),"opened"===s.state&&(s.state="closing",document.activeElement.blur(),await E(s.el,r),"modal"===s.mode&&x(!1,r),i&&_.call(this,s),s.state="closed",s.el.dispatchEvent(new CustomEvent(r.customEventPrefix+"closed",{detail:this,bubbles:!0}))),s}async function N(t,e,i){const n=j.call(this,t);return"closed"===n.state?M.call(this,n,e,i):R.call(this,n,e,i)}function B(t){switch(t.mode){case"inline":return V.call(this,t);case"modal":return F.call(this,t);default:throw new Error(`"${t.mode}" is not a valid drawer mode.`)}}async function V(t){return t.el.classList.remove(t.getSetting("classModal")),t.dialog.removeAttribute("aria-modal"),x(!1,n({},this.settings,t.settings)),this.focusTrap.unmount(),await I.call(this,t),t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:this,bubbles:!0})),t}async function F(t){return t.el.classList.add(t.getSetting("classModal")),t.dialog.setAttribute("aria-modal","true"),!this.store.get(t.id)&&t.el.classList.contains(t.getSetting("stateOpened"))&&this.store.set(t.id,"opened"),await R.call(this,t,!1,!1),t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:this,bubbles:!0})),t}async function W(t,e){await S.call(this,t,!1);const i=this,s=new r,o={open(t,e){return M.call(i,this,t,e)},close(t,e){return R.call(i,this,t,e)},toggle(t,e){return N.call(i,this,t,e)},deregister(){return S.call(i,this)},mountBreakpoint(){const t=this.breakpoint,e=this.handleBreakpoint.bind(this);return s.mount(t,e),this},unmountBreakpoint(){return s.unmount(),this},handleBreakpoint(t){return this.mode=t.matches?"inline":"modal",this},getSetting(t){return t in this.settings?this.settings[t]:i.settings[t]}},a=n({id:t.id,el:t,dialog:e,trigger:null,settings:v(t,this.settings.dataConfig),get breakpoint(){return D.call(i,t)},get state(){return l},set state(t){l=t,"opened"!==t&&"closed"!==t||"inline"===this.mode&&i.store.set(this.id,this.state)},get mode(){return c},set mode(t){c=t,B.call(i,this)}},o);let l=t.classList.contains(a.getSetting("stateOpened"))?"opened":"closed",c=t.classList.contains(a.getSetting("classModal"))?"modal":"inline";return"modal"===a.mode?a.dialog.setAttribute("aria-modal","true"):a.dialog.removeAttribute("aria-modal"),a.getSetting("setTabindex")&&a.dialog.setAttribute("tabindex","-1"),this.collection.push(a),a.breakpoint?a.mountBreakpoint():await I.call(this,a),a}var H=/*#__PURE__*/i("handleClick"),z=/*#__PURE__*/i("handleKeydown");class K extends o{constructor(e){super(),Object.defineProperty(this,H,{writable:!0,value:void 0}),Object.defineProperty(this,z,{writable:!0,value:void 0}),this.defaults=$,this.settings=n({},this.defaults,e),this.focusTrap=new d,this.store=y(this.settings.storeKey,this.settings.store),t(this,H)[H]=k.bind(this),t(this,z)[z]=C.bind(this),this.settings.autoInit&&this.init()}get activeModal(){return this.collection.find(t=>"opened"===t.state&&"modal"===t.mode)}async init(t=null){t&&(this.settings=n({},this.settings,t));const e=document.querySelectorAll(this.settings.selectorDrawer);return await this.registerCollection(e),this.settings.eventListeners&&this.initEventListeners(),this}async destroy(){return await this.deregisterCollection(),this.settings.eventListeners&&this.destroyEventListeners(),this}initEventListeners(){document.addEventListener("click",t(this,H)[H],!1),document.addEventListener("keydown",t(this,z)[z],!1)}destroyEventListeners(){document.removeEventListener("click",t(this,H)[H],!1),document.removeEventListener("keydown",t(this,z)[z],!1)}register(t){const e=q.call(this,t);return e.error?Promise.reject(e.error):W.call(this,e.drawer,e.dialog)}deregister(t){const e=this.get(T.call(this,t));return S.call(this,e)}open(t,e,i){return M.call(this,t,e,i)}close(t,e,i){return R.call(this,t,e,i)}toggle(t,e,i){return N.call(this,t,e,i)}}var G={autoInit:!1,dataOpen:"modal-open",dataClose:"modal-close",dataReplace:"modal-replace",dataConfig:"modal-config",selectorModal:".modal",selectorDialog:".modal__dialog",selectorRequired:'[role="alertdialog"]',selectorFocus:"[data-focus]",selectorInert:null,selectorOverflow:"body",stateOpened:"is-opened",stateOpening:"is-opening",stateClosing:"is-closing",stateClosed:"is-closed",customEventPrefix:"modal:",eventListeners:!0,teleport:null,teleportMethod:"append",setTabindex:!0,transition:!0};function U(t){const e=this.get("string"==typeof t?t:t.id);if(e)return e;throw new Error(`Modal not found in collection with id of "${t.id||t}".`)}function J(t){return"string"==typeof t?t:"function"==typeof t.hasAttribute?t.hasAttribute(`data-${this.settings.dataOpen}`)?t.getAttribute(`data-${this.settings.dataOpen}`):t.hasAttribute(`data-${this.settings.dataClose}`)?t.getAttribute(`data-${this.settings.dataClose}`)||!1:t.hasAttribute(`data-${this.settings.dataReplace}`)?t.getAttribute(`data-${this.settings.dataReplace}`):t.closest(this.settings.selectorModal)&&(t=t.closest(this.settings.selectorModal)).id||!1:!!t.id&&t.id}function X(t){const e=J.call(this,t);if(e){const t=document.querySelector(`#${e}`),i=t?t.querySelector(this.settings.selectorDialog):null;return t||i?i?{modal:t,dialog:i}:{error:new Error("Modal is missing dialog element.")}:{error:new Error(`No modal elements found using the ID: "${e}".`)}}return{error:new Error("Could not resolve the modal ID.")}}function Y(){this.active?this.focusTrap.mount(this.active.dialog,this.settings.selectorFocus):(this.trigger&&(this.trigger.focus(),this.trigger=null),this.focusTrap.unmount())}async function Q(t){let e=t.target.closest(`[data-${this.settings.dataOpen}], [data-${this.settings.dataReplace}]`);if(e){t.preventDefault(),t.target.closest(this.settings.selectorModal)||(this.trigger=e);const i=this.get(J.call(this,e));return e.matches(`[data-${this.settings.dataOpen}]`)?i.open():i.replace()}if(e=t.target.closest(`[data-${this.settings.dataClose}]`),e){t.preventDefault();const i=e.getAttribute(`data-${this.settings.dataClose}`);return"*"===i?this.closeAll():this.close(i)}if(t.target.matches(this.settings.selectorModal)&&!t.target.querySelector(this.settings.selectorRequired))return this.close(J.call(this,t.target))}function Z(t){if("Escape"===t.key&&this.active&&!this.active.dialog.matches(this.settings.selectorRequired))return this.close()}async function tt(t,e=!0){if(!t)return this.collection;const i=this.collection.findIndex(e=>e.id===t.id);if(i>=0){const t=this.collection[i];e&&"opened"===t.state?await t.close(!1):this.stack.remove(t),t.getSetting("teleport")&&t.teleportReturn(),Object.getOwnPropertyNames(t).forEach(e=>{delete t[e]}),this.collection.splice(i,1)}return this.collection}async function et(t,e,i=!0){const s=U.call(this,t),r=n({},this.settings,s.settings);return void 0!==e&&(r.transition=e),this.stack.moveToTop(s),"closed"===s.state&&(s.state="opening",this.stack.add(s),await w(s.el,r),s.state="opened"),i&&Y.call(this),s.el.dispatchEvent(new CustomEvent(r.customEventPrefix+"opened",{detail:this,bubbles:!0})),s}async function it(t,e,i=!0){const s=t?U.call(this,t):this.active;if(s&&"opened"===s.state){s.state="closing";const t=n({},this.settings,s.settings);void 0!==e&&(t.transition=e),document.activeElement.blur(),await E(s.el,t),this.stack.remove(s),i&&Y.call(this),s.state="closed",s.el.dispatchEvent(new CustomEvent(t.customEventPrefix+"closed",{detail:this,bubbles:!0}))}return s}async function nt(t,e){const i=[];return await Promise.all(this.stack.value.map(async n=>{t&&t===n.id?Promise.resolve():i.push(await it.call(this,n,e,!1)),n.trigger=null})),i}async function st(t,e,i=!0){const n=U.call(this,t);let s,r;return"opened"===n.state?(s=n,r=await nt.call(this,n.id,e)):(s=et.call(this,n,e,!1),r=nt.call(this,!1,e),await Promise.all([s,r])),i&&Y.call(this),{opened:s,closed:r}}async function rt(t,e){await tt.call(this,t,!1);const i=this,s={open(t,e){return et.call(i,this,t,e)},close(t,e){return it.call(i,this,t,e)},replace(t,e){return st.call(i,this,t,e)},deregister(){return tt.call(i,this)},teleport(t=this.getSetting("teleport"),e=this.getSetting("teleportMethod")){return this.returnRef?(console.error("Element has already been teleported:",this.el),!1):(this.returnRef=b(this.el,t,e),this.el)},teleportReturn(){return this.returnRef?(this.returnRef=b(this.el,this.returnRef),this.el):(console.error("No return reference found:",this.el),!1)},getSetting(t){return t in this.settings?this.settings[t]:i.settings[t]}},r=n({id:t.id,state:"closed",el:t,dialog:e,returnRef:null,settings:v(t,this.settings.dataConfig)},s);return r.dialog.setAttribute("aria-modal","true"),r.dialog.hasAttribute("role")||r.dialog.setAttribute("role","dialog"),r.getSetting("setTabindex")&&r.dialog.setAttribute("tabindex","-1"),r.getSetting("teleport")&&r.teleport(),this.collection.push(r),r.el.classList.contains(this.settings.stateOpened)?await r.open(!1):(r.el.classList.remove(this.settings.stateOpening),r.el.classList.remove(this.settings.stateClosing),r.el.classList.add(this.settings.stateClosed)),r}var ot=/*#__PURE__*/i("handleClick"),at=/*#__PURE__*/i("handleKeydown");class lt extends o{constructor(e){super(),Object.defineProperty(this,ot,{writable:!0,value:void 0}),Object.defineProperty(this,at,{writable:!0,value:void 0}),this.defaults=G,this.settings=n({},this.defaults,e),this.trigger=null,this.focusTrap=new d,this.stack=function(t){const e=[];return{get value(){return[...e]},get top(){return e[e.length-1]},updateIndex(){e.forEach((t,e)=>{t.el.style.zIndex=null;const i=getComputedStyle(t.el)["z-index"];t.el.style.zIndex=parseInt(i)+e+1})},updateGlobalState(){x(this.top,t),this.updateIndex()},add(t){t.el.style.zIndex=null;const i=getComputedStyle(t.el)["z-index"];t.el.style.zIndex=parseInt(i)+e.length+1,e.push(t),this.updateGlobalState()},remove(t){const i=e.findIndex(e=>e.id===t.id);i>=0&&(t.el.style.zIndex=null,e.splice(i,1),this.updateGlobalState())},moveToTop(t){const i=e.findIndex(e=>e.id===t.id);i>=0&&(e.splice(i,1),this.add(t))}}}(this.settings),t(this,ot)[ot]=Q.bind(this),t(this,at)[at]=Z.bind(this),this.settings.autoInit&&this.init()}get active(){return this.stack.top}async init(t){t&&(this.settings=n({},this.settings,t));const e=document.querySelectorAll(this.settings.selectorModal);return await this.registerCollection(e),this.settings.eventListeners&&this.initEventListeners(),this}async destroy(){return this.trigger=null,await this.deregisterCollection(),this.settings.eventListeners&&this.destroyEventListeners(),this}initEventListeners(){document.addEventListener("click",t(this,ot)[ot],!1),document.addEventListener("keydown",t(this,at)[at],!1)}destroyEventListeners(){document.removeEventListener("click",t(this,ot)[ot],!1),document.removeEventListener("keydown",t(this,at)[at],!1)}register(t){const e=X.call(this,t);return e.error?Promise.reject(e.error):rt.call(this,e.modal,e.dialog)}deregister(t){const e=this.get(J.call(this,t));return tt.call(this,e)}open(t,e,i){return et.call(this,t,e,i)}close(t,e,i){return it.call(this,t,e,i)}replace(t,e,i){return st.call(this,t,e,i)}async closeAll(t=!1,e,i=!0){const n=await nt.call(this,t,e);return i&&Y.call(this),n}}var ct={autoInit:!1,selectorPopover:".popover",selectorArrow:".popover__arrow",stateActive:"is-active",eventListeners:!0,eventType:"click",placement:"bottom"};function dt(t,e){const i=getComputedStyle(t),n={placement:e.placement,event:e.eventType,offset:0,"overflow-padding":0,"flip-padding":0,"arrow-element":e.selectorArrow,"arrow-padding":0};for(const t in n){const e=P(),s=i.getPropertyValue(`--${e}popover-${t}`).trim();s&&(n[t]=s)}return n}function ut(t){let e;const i="string"==typeof t?t.trim().split(" "):[t];switch(i.forEach(function(t,e){i[e]=parseInt(t,10)}),i.length){case 1:e=i[0];break;case 2:e={top:i[0],right:i[1],bottom:i[0],left:i[1]};break;case 3:e={top:i[0],right:i[1],bottom:i[2],left:i[1]};break;case 4:e={top:i[0],right:i[1],bottom:i[2],left:i[3]};break;default:e=!1}return e}function ht(t){const e=this.get("string"==typeof t?t:t.id);if(e)return e;throw new Error(`Popover not found in collection with id of "${t}".`)}function ft(t){return"string"==typeof t?t:"function"==typeof t.hasAttribute?t.closest(this.settings.selectorPopover)?(t=t.closest(this.settings.selectorPopover)).id:t.hasAttribute("aria-controls")?t.getAttribute("aria-controls"):!!t.hasAttribute("aria-describedby")&&t.getAttribute("aria-describedby"):!!t.id&&t.id}function pt(t){const e=ft.call(this,t);if(e){const t=document.querySelector(`#${e}`),i=document.querySelector(`[aria-controls="${e}"]`)||document.querySelector(`[aria-describedby="${e}"]`);return i||t?i?t?{popover:t,trigger:i}:{error:new Error("No popover associated with the provided popover trigger.")}:{error:new Error("No popover trigger associated with the provided popover.")}:{error:new Error(`No popover elements found using the ID: "${e}".`)}}return{error:new Error("Could not resolve the popover ID.")}}async function gt(t){const e=t?ht.call(this,t):await mt.call(this);return e&&"opened"===e.state&&(e.el.classList.remove(this.settings.stateActive),e.trigger.hasAttribute("aria-controls")&&e.trigger.setAttribute("aria-expanded","false"),e.popper.setOptions({modifiers:[{name:"eventListeners",enabled:!1}]}),e.state="closed",e.trigger===this.trigger&&(this.trigger=null)),e}async function mt(){const t=[];return await Promise.all(this.collection.map(async e=>{"opened"===e.state&&t.push(await gt.call(this,e))})),t}function vt(t){"opened"==t.state&&setTimeout(()=>{const e=t.el.closest(":hover")===t.el||t.trigger.closest(":hover")===t.trigger,i=document.activeElement.closest(`#${t.id}, [aria-controls="${t.id}"], [aria-describedby="${t.id}"]`);return e||i||t.close(),t},1)}function yt(t){"opened"===t.state?t.close():(this.trigger=t.trigger,t.open(),wt.call(this,t))}function bt(t){switch(t.key){case"Escape":return this.trigger&&this.trigger.focus(),void mt.call(this);case"Tab":return void this.collection.forEach(t=>{vt.call(this,t)});default:return}}function wt(t){const e=this;document.addEventListener("click",function i(n){n.target.closest(`#${t.id}, [aria-controls="${t.id}"], [aria-describedby="${t.id}"]`)?t.el&&!t.el.classList.contains(e.settings.stateActive)&&this.removeEventListener("click",i):(t.el&&t.el.classList.contains(e.settings.stateActive)&&t.close(),this.removeEventListener("click",i))})}var Et="top",xt="bottom",Ot="right",Lt="left",At="auto",$t=[Et,xt,Ot,Lt],kt="start",Ct="end",St="clippingParents",Pt="viewport",Dt="popper",jt="reference",Tt=/*#__PURE__*/$t.reduce(function(t,e){return t.concat([e+"-"+kt,e+"-"+Ct])},[]),qt=/*#__PURE__*/[].concat($t,[At]).reduce(function(t,e){return t.concat([e,e+"-"+kt,e+"-"+Ct])},[]),It=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function _t(t){return t?(t.nodeName||"").toLowerCase():null}function Mt(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Rt(t){return t instanceof Mt(t).Element||t instanceof Element}function Nt(t){return t instanceof Mt(t).HTMLElement||t instanceof HTMLElement}function Bt(t){return"undefined"!=typeof ShadowRoot&&(t instanceof Mt(t).ShadowRoot||t instanceof ShadowRoot)}function Vt(t){return t.split("-")[0]}var Ft=Math.max,Wt=Math.min,Ht=Math.round;function zt(){var t=navigator.userAgentData;return null!=t&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function Kt(){return!/^((?!chrome|android).)*safari/i.test(zt())}function Gt(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1);var n=t.getBoundingClientRect(),s=1,r=1;e&&Nt(t)&&(s=t.offsetWidth>0&&Ht(n.width)/t.offsetWidth||1,r=t.offsetHeight>0&&Ht(n.height)/t.offsetHeight||1);var o=(Rt(t)?Mt(t):window).visualViewport,a=!Kt()&&i,l=(n.left+(a&&o?o.offsetLeft:0))/s,c=(n.top+(a&&o?o.offsetTop:0))/r,d=n.width/s,u=n.height/r;return{width:d,height:u,top:c,right:l+d,bottom:c+u,left:l,x:l,y:c}}function Ut(t){var e=Gt(t),i=t.offsetWidth,n=t.offsetHeight;return Math.abs(e.width-i)<=1&&(i=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:t.offsetLeft,y:t.offsetTop,width:i,height:n}}function Jt(t,e){var i=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(i&&Bt(i)){var n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function Xt(t){return Mt(t).getComputedStyle(t)}function Yt(t){return["table","td","th"].indexOf(_t(t))>=0}function Qt(t){return((Rt(t)?t.ownerDocument:t.document)||window.document).documentElement}function Zt(t){return"html"===_t(t)?t:t.assignedSlot||t.parentNode||(Bt(t)?t.host:null)||Qt(t)}function te(t){return Nt(t)&&"fixed"!==Xt(t).position?t.offsetParent:null}function ee(t){for(var e=Mt(t),i=te(t);i&&Yt(i)&&"static"===Xt(i).position;)i=te(i);return i&&("html"===_t(i)||"body"===_t(i)&&"static"===Xt(i).position)?e:i||function(t){var e=/firefox/i.test(zt());if(/Trident/i.test(zt())&&Nt(t)&&"fixed"===Xt(t).position)return null;var i=Zt(t);for(Bt(i)&&(i=i.host);Nt(i)&&["html","body"].indexOf(_t(i))<0;){var n=Xt(i);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||e&&"filter"===n.willChange||e&&n.filter&&"none"!==n.filter)return i;i=i.parentNode}return null}(t)||e}function ie(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function ne(t,e,i){return Ft(t,Wt(e,i))}function se(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function re(t,e){return e.reduce(function(e,i){return e[i]=t,e},{})}function oe(t){return t.split("-")[1]}var ae={top:"auto",right:"auto",bottom:"auto",left:"auto"};function le(t){var e,i=t.popper,n=t.popperRect,s=t.placement,r=t.variation,o=t.offsets,a=t.position,l=t.gpuAcceleration,c=t.adaptive,d=t.roundOffsets,u=t.isFixed,h=o.x,f=void 0===h?0:h,p=o.y,g=void 0===p?0:p,m="function"==typeof d?d({x:f,y:g}):{x:f,y:g};f=m.x,g=m.y;var v=o.hasOwnProperty("x"),y=o.hasOwnProperty("y"),b=Lt,w=Et,E=window;if(c){var x=ee(i),O="clientHeight",L="clientWidth";x===Mt(i)&&"static"!==Xt(x=Qt(i)).position&&"absolute"===a&&(O="scrollHeight",L="scrollWidth"),(s===Et||(s===Lt||s===Ot)&&r===Ct)&&(w=xt,g-=(u&&x===E&&E.visualViewport?E.visualViewport.height:x[O])-n.height,g*=l?1:-1),s!==Lt&&(s!==Et&&s!==xt||r!==Ct)||(b=Ot,f-=(u&&x===E&&E.visualViewport?E.visualViewport.width:x[L])-n.width,f*=l?1:-1)}var A,$=Object.assign({position:a},c&&ae),k=!0===d?function(t,e){var i=t.y,n=e.devicePixelRatio||1;return{x:Ht(t.x*n)/n||0,y:Ht(i*n)/n||0}}({x:f,y:g},Mt(i)):{x:f,y:g};return f=k.x,g=k.y,Object.assign({},$,l?((A={})[w]=y?"0":"",A[b]=v?"0":"",A.transform=(E.devicePixelRatio||1)<=1?"translate("+f+"px, "+g+"px)":"translate3d("+f+"px, "+g+"px, 0)",A):((e={})[w]=y?g+"px":"",e[b]=v?f+"px":"",e.transform="",e))}var ce={passive:!0},de={left:"right",right:"left",bottom:"top",top:"bottom"};function ue(t){return t.replace(/left|right|bottom|top/g,function(t){return de[t]})}var he={start:"end",end:"start"};function fe(t){return t.replace(/start|end/g,function(t){return he[t]})}function pe(t){var e=Mt(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function ge(t){return Gt(Qt(t)).left+pe(t).scrollLeft}function me(t){var e=Xt(t);return/auto|scroll|overlay|hidden/.test(e.overflow+e.overflowY+e.overflowX)}function ve(t){return["html","body","#document"].indexOf(_t(t))>=0?t.ownerDocument.body:Nt(t)&&me(t)?t:ve(Zt(t))}function ye(t,e){var i;void 0===e&&(e=[]);var n=ve(t),s=n===(null==(i=t.ownerDocument)?void 0:i.body),r=Mt(n),o=s?[r].concat(r.visualViewport||[],me(n)?n:[]):n,a=e.concat(o);return s?a:a.concat(ye(Zt(o)))}function be(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function we(t,e,i){return e===Pt?be(function(t,e){var i=Mt(t),n=Qt(t),s=i.visualViewport,r=n.clientWidth,o=n.clientHeight,a=0,l=0;if(s){r=s.width,o=s.height;var c=Kt();(c||!c&&"fixed"===e)&&(a=s.offsetLeft,l=s.offsetTop)}return{width:r,height:o,x:a+ge(t),y:l}}(t,i)):Rt(e)?function(t,e){var i=Gt(t,!1,"fixed"===e);return i.top=i.top+t.clientTop,i.left=i.left+t.clientLeft,i.bottom=i.top+t.clientHeight,i.right=i.left+t.clientWidth,i.width=t.clientWidth,i.height=t.clientHeight,i.x=i.left,i.y=i.top,i}(e,i):be(function(t){var e,i=Qt(t),n=pe(t),s=null==(e=t.ownerDocument)?void 0:e.body,r=Ft(i.scrollWidth,i.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=Ft(i.scrollHeight,i.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-n.scrollLeft+ge(t),l=-n.scrollTop;return"rtl"===Xt(s||i).direction&&(a+=Ft(i.clientWidth,s?s.clientWidth:0)-r),{width:r,height:o,x:a,y:l}}(Qt(t)))}function Ee(t){var e,i=t.reference,n=t.element,s=t.placement,r=s?Vt(s):null,o=s?oe(s):null,a=i.x+i.width/2-n.width/2,l=i.y+i.height/2-n.height/2;switch(r){case Et:e={x:a,y:i.y-n.height};break;case xt:e={x:a,y:i.y+i.height};break;case Ot:e={x:i.x+i.width,y:l};break;case Lt:e={x:i.x-n.width,y:l};break;default:e={x:i.x,y:i.y}}var c=r?ie(r):null;if(null!=c){var d="y"===c?"height":"width";switch(o){case kt:e[c]=e[c]-(i[d]/2-n[d]/2);break;case Ct:e[c]=e[c]+(i[d]/2-n[d]/2)}}return e}function xe(t,e){void 0===e&&(e={});var i=e.placement,n=void 0===i?t.placement:i,s=e.strategy,r=void 0===s?t.strategy:s,o=e.boundary,a=void 0===o?St:o,l=e.rootBoundary,c=void 0===l?Pt:l,d=e.elementContext,u=void 0===d?Dt:d,h=e.altBoundary,f=void 0!==h&&h,p=e.padding,g=void 0===p?0:p,m=se("number"!=typeof g?g:re(g,$t)),v=t.rects.popper,y=t.elements[f?u===Dt?jt:Dt:u],b=function(t,e,i,n){var s="clippingParents"===e?function(t){var e=ye(Zt(t)),i=["absolute","fixed"].indexOf(Xt(t).position)>=0&&Nt(t)?ee(t):t;return Rt(i)?e.filter(function(t){return Rt(t)&&Jt(t,i)&&"body"!==_t(t)}):[]}(t):[].concat(e),r=[].concat(s,[i]),o=r.reduce(function(e,i){var s=we(t,i,n);return e.top=Ft(s.top,e.top),e.right=Wt(s.right,e.right),e.bottom=Wt(s.bottom,e.bottom),e.left=Ft(s.left,e.left),e},we(t,r[0],n));return o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}(Rt(y)?y:y.contextElement||Qt(t.elements.popper),a,c,r),w=Gt(t.elements.reference),E=Ee({reference:w,element:v,strategy:"absolute",placement:n}),x=be(Object.assign({},v,E)),O=u===Dt?x:w,L={top:b.top-O.top+m.top,bottom:O.bottom-b.bottom+m.bottom,left:b.left-O.left+m.left,right:O.right-b.right+m.right},A=t.modifiersData.offset;if(u===Dt&&A){var $=A[n];Object.keys(L).forEach(function(t){var e=[Ot,xt].indexOf(t)>=0?1:-1,i=[Et,xt].indexOf(t)>=0?"y":"x";L[t]+=$[i]*e})}return L}function Oe(t,e){void 0===e&&(e={});var i=e.boundary,n=e.rootBoundary,s=e.padding,r=e.flipVariations,o=e.allowedAutoPlacements,a=void 0===o?qt:o,l=oe(e.placement),c=l?r?Tt:Tt.filter(function(t){return oe(t)===l}):$t,d=c.filter(function(t){return a.indexOf(t)>=0});0===d.length&&(d=c);var u=d.reduce(function(e,r){return e[r]=xe(t,{placement:r,boundary:i,rootBoundary:n,padding:s})[Vt(r)],e},{});return Object.keys(u).sort(function(t,e){return u[t]-u[e]})}var Le={name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name;if(!e.modifiersData[n]._skip){for(var s=i.mainAxis,r=void 0===s||s,o=i.altAxis,a=void 0===o||o,l=i.fallbackPlacements,c=i.padding,d=i.boundary,u=i.rootBoundary,h=i.altBoundary,f=i.flipVariations,p=void 0===f||f,g=i.allowedAutoPlacements,m=e.options.placement,v=Vt(m),y=l||(v!==m&&p?function(t){if(Vt(t)===At)return[];var e=ue(t);return[fe(t),e,fe(e)]}(m):[ue(m)]),b=[m].concat(y).reduce(function(t,i){return t.concat(Vt(i)===At?Oe(e,{placement:i,boundary:d,rootBoundary:u,padding:c,flipVariations:p,allowedAutoPlacements:g}):i)},[]),w=e.rects.reference,E=e.rects.popper,x=new Map,O=!0,L=b[0],A=0;A<b.length;A++){var $=b[A],k=Vt($),C=oe($)===kt,S=[Et,xt].indexOf(k)>=0,P=S?"width":"height",D=xe(e,{placement:$,boundary:d,rootBoundary:u,altBoundary:h,padding:c}),j=S?C?Ot:Lt:C?xt:Et;w[P]>E[P]&&(j=ue(j));var T=ue(j),q=[];if(r&&q.push(D[k]<=0),a&&q.push(D[j]<=0,D[T]<=0),q.every(function(t){return t})){L=$,O=!1;break}x.set($,q)}if(O)for(var I=function(t){var e=b.find(function(e){var i=x.get(e);if(i)return i.slice(0,t).every(function(t){return t})});if(e)return L=e,"break"},_=p?3:1;_>0&&"break"!==I(_);_--);e.placement!==L&&(e.modifiersData[n]._skip=!0,e.placement=L,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Ae(t,e,i){return void 0===i&&(i={x:0,y:0}),{top:t.top-e.height-i.y,right:t.right-e.width+i.x,bottom:t.bottom-e.height+i.y,left:t.left-e.width-i.x}}function $e(t){return[Et,Ot,xt,Lt].some(function(e){return t[e]>=0})}function ke(t,e,i){void 0===i&&(i=!1);var n,s,r=Nt(e),o=Nt(e)&&function(t){var e=t.getBoundingClientRect(),i=Ht(e.width)/t.offsetWidth||1,n=Ht(e.height)/t.offsetHeight||1;return 1!==i||1!==n}(e),a=Qt(e),l=Gt(t,o,i),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(r||!r&&!i)&&(("body"!==_t(e)||me(a))&&(c=(n=e)!==Mt(n)&&Nt(n)?{scrollLeft:(s=n).scrollLeft,scrollTop:s.scrollTop}:pe(n)),Nt(e)?((d=Gt(e,!0)).x+=e.clientLeft,d.y+=e.clientTop):a&&(d.x=ge(a))),{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function Ce(t){var e=new Map,i=new Set,n=[];function s(t){i.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach(function(t){if(!i.has(t)){var n=e.get(t);n&&s(n)}}),n.push(t)}return t.forEach(function(t){e.set(t.name,t)}),t.forEach(function(t){i.has(t.name)||s(t)}),n}var Se={placement:"bottom",modifiers:[],strategy:"absolute"};function Pe(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return!e.some(function(t){return!(t&&"function"==typeof t.getBoundingClientRect)})}function De(t){void 0===t&&(t={});var e=t.defaultModifiers,i=void 0===e?[]:e,n=t.defaultOptions,s=void 0===n?Se:n;return function(t,e,n){void 0===n&&(n=s);var r,o,a={placement:"bottom",orderedModifiers:[],options:Object.assign({},Se,s),modifiersData:{},elements:{reference:t,popper:e},attributes:{},styles:{}},l=[],c=!1,d={state:a,setOptions:function(n){var r="function"==typeof n?n(a.options):n;u(),a.options=Object.assign({},s,a.options,r),a.scrollParents={reference:Rt(t)?ye(t):t.contextElement?ye(t.contextElement):[],popper:ye(e)};var o,c,h=function(t){var e=Ce(t);return It.reduce(function(t,i){return t.concat(e.filter(function(t){return t.phase===i}))},[])}((o=[].concat(i,a.options.modifiers),c=o.reduce(function(t,e){var i=t[e.name];return t[e.name]=i?Object.assign({},i,e,{options:Object.assign({},i.options,e.options),data:Object.assign({},i.data,e.data)}):e,t},{}),Object.keys(c).map(function(t){return c[t]})));return a.orderedModifiers=h.filter(function(t){return t.enabled}),a.orderedModifiers.forEach(function(t){var e=t.options,i=t.effect;if("function"==typeof i){var n=i({state:a,name:t.name,instance:d,options:void 0===e?{}:e});l.push(n||function(){})}}),d.update()},forceUpdate:function(){if(!c){var t=a.elements,e=t.reference,i=t.popper;if(Pe(e,i)){a.rects={reference:ke(e,ee(i),"fixed"===a.options.strategy),popper:Ut(i)},a.reset=!1,a.placement=a.options.placement,a.orderedModifiers.forEach(function(t){return a.modifiersData[t.name]=Object.assign({},t.data)});for(var n=0;n<a.orderedModifiers.length;n++)if(!0!==a.reset){var s=a.orderedModifiers[n],r=s.fn,o=s.options;"function"==typeof r&&(a=r({state:a,options:void 0===o?{}:o,name:s.name,instance:d})||a)}else a.reset=!1,n=-1}}},update:(r=function(){return new Promise(function(t){d.forceUpdate(),t(a)})},function(){return o||(o=new Promise(function(t){Promise.resolve().then(function(){o=void 0,t(r())})})),o}),destroy:function(){u(),c=!0}};if(!Pe(t,e))return d;function u(){l.forEach(function(t){return t()}),l=[]}return d.setOptions(n).then(function(t){!c&&n.onFirstUpdate&&n.onFirstUpdate(t)}),d}}var je=/*#__PURE__*/De({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,i=t.instance,n=t.options,s=n.scroll,r=void 0===s||s,o=n.resize,a=void 0===o||o,l=Mt(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return r&&c.forEach(function(t){t.addEventListener("scroll",i.update,ce)}),a&&l.addEventListener("resize",i.update,ce),function(){r&&c.forEach(function(t){t.removeEventListener("scroll",i.update,ce)}),a&&l.removeEventListener("resize",i.update,ce)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state;e.modifiersData[t.name]=Ee({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,i=t.options,n=i.gpuAcceleration,s=void 0===n||n,r=i.adaptive,o=void 0===r||r,a=i.roundOffsets,l=void 0===a||a,c={placement:Vt(e.placement),variation:oe(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,le(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,le(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach(function(t){var i=e.styles[t]||{},n=e.attributes[t]||{},s=e.elements[t];Nt(s)&&_t(s)&&(Object.assign(s.style,i),Object.keys(n).forEach(function(t){var e=n[t];!1===e?s.removeAttribute(t):s.setAttribute(t,!0===e?"":e)}))})},effect:function(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow),function(){Object.keys(e.elements).forEach(function(t){var n=e.elements[t],s=e.attributes[t]||{},r=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:i[t]).reduce(function(t,e){return t[e]="",t},{});Nt(n)&&_t(n)&&(Object.assign(n.style,r),Object.keys(s).forEach(function(t){n.removeAttribute(t)}))})}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,i=t.name,n=t.options.offset,s=void 0===n?[0,0]:n,r=qt.reduce(function(t,i){return t[i]=function(t,e,i){var n=Vt(t),s=[Lt,Et].indexOf(n)>=0?-1:1,r="function"==typeof i?i(Object.assign({},e,{placement:t})):i,o=r[0],a=r[1];return o=o||0,a=(a||0)*s,[Lt,Ot].indexOf(n)>=0?{x:a,y:o}:{x:o,y:a}}(i,e.rects,s),t},{}),o=r[e.placement],a=o.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=o.x,e.modifiersData.popperOffsets.y+=a),e.modifiersData[i]=r}},Le,{name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name,s=i.mainAxis,r=void 0===s||s,o=i.altAxis,a=void 0!==o&&o,l=i.tether,c=void 0===l||l,d=i.tetherOffset,u=void 0===d?0:d,h=xe(e,{boundary:i.boundary,rootBoundary:i.rootBoundary,padding:i.padding,altBoundary:i.altBoundary}),f=Vt(e.placement),p=oe(e.placement),g=!p,m=ie(f),v="x"===m?"y":"x",y=e.modifiersData.popperOffsets,b=e.rects.reference,w=e.rects.popper,E="function"==typeof u?u(Object.assign({},e.rects,{placement:e.placement})):u,x="number"==typeof E?{mainAxis:E,altAxis:E}:Object.assign({mainAxis:0,altAxis:0},E),O=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,L={x:0,y:0};if(y){if(r){var A,$="y"===m?Et:Lt,k="y"===m?xt:Ot,C="y"===m?"height":"width",S=y[m],P=S+h[$],D=S-h[k],j=c?-w[C]/2:0,T=p===kt?b[C]:w[C],q=p===kt?-w[C]:-b[C],I=e.elements.arrow,_=c&&I?Ut(I):{width:0,height:0},M=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},R=M[$],N=M[k],B=ne(0,b[C],_[C]),V=g?b[C]/2-j-B-R-x.mainAxis:T-B-R-x.mainAxis,F=g?-b[C]/2+j+B+N+x.mainAxis:q+B+N+x.mainAxis,W=e.elements.arrow&&ee(e.elements.arrow),H=null!=(A=null==O?void 0:O[m])?A:0,z=S+F-H,K=ne(c?Wt(P,S+V-H-(W?"y"===m?W.clientTop||0:W.clientLeft||0:0)):P,S,c?Ft(D,z):D);y[m]=K,L[m]=K-S}if(a){var G,U=y[v],J="y"===v?"height":"width",X=U+h["x"===m?Et:Lt],Y=U-h["x"===m?xt:Ot],Q=-1!==[Et,Lt].indexOf(f),Z=null!=(G=null==O?void 0:O[v])?G:0,tt=Q?X:U-b[J]-w[J]-Z+x.altAxis,et=Q?U+b[J]+w[J]-Z-x.altAxis:Y,it=c&&Q?function(t,e,i){var n=ne(t,e,i);return n>i?i:n}(tt,U,et):ne(c?tt:X,U,c?et:Y);y[v]=it,L[v]=it-U}e.modifiersData[n]=L}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,i=t.state,n=t.name,s=t.options,r=i.elements.arrow,o=i.modifiersData.popperOffsets,a=Vt(i.placement),l=ie(a),c=[Lt,Ot].indexOf(a)>=0?"height":"width";if(r&&o){var d=function(t,e){return se("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:re(t,$t))}(s.padding,i),u=Ut(r),h="y"===l?Et:Lt,f="y"===l?xt:Ot,p=i.rects.reference[c]+i.rects.reference[l]-o[l]-i.rects.popper[c],g=o[l]-i.rects.reference[l],m=ee(r),v=m?"y"===l?m.clientHeight||0:m.clientWidth||0:0,y=v/2-u[c]/2+(p/2-g/2),b=ne(d[h],y,v-u[c]-d[f]);i.modifiersData[n]=((e={})[l]=b,e.centerOffset=b-y,e)}},effect:function(t){var e=t.state,i=t.options.element,n=void 0===i?"[data-popper-arrow]":i;null!=n&&("string"!=typeof n||(n=e.elements.popper.querySelector(n)))&&Jt(e.elements.popper,n)&&(e.elements.arrow=n)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,i=t.name,n=e.rects.reference,s=e.rects.popper,r=e.modifiersData.preventOverflow,o=xe(e,{elementContext:"reference"}),a=xe(e,{altBoundary:!0}),l=Ae(o,n),c=Ae(a,s,r),d=$e(l),u=$e(c);e.modifiersData[i]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:d,hasPopperEscaped:u},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":u})}}]});async function Te(t){if(!t)return this.collection;const e=this.collection.findIndex(e=>e.id===t.id);if(e>=0){const t=this.collection[e];"opened"===t.state&&t.close(),t.popper.destroy(),qe(t),Object.getOwnPropertyNames(t).forEach(e=>{delete t[e]}),this.collection.splice(e,1)}return this.collection}function qe(t){return t.__eventListeners&&(t.__eventListeners.forEach(e=>{e.el.forEach(i=>{e.type.forEach(n=>{t[i].removeEventListener(n,e.listener,!1)})})}),delete t.__eventListeners),t}async function Ie(t){const e=ht.call(this,t);var i;return e.el.classList.add(this.settings.stateActive),e.trigger.hasAttribute("aria-controls")&&e.trigger.setAttribute("aria-expanded","true"),e.config=dt(e.el,this.settings),e.popper.setOptions({placement:e.config.placement,modifiers:[{name:"eventListeners",enabled:!0},...(i=e.config,[{name:"offset",options:{offset:[0,parseInt(i.offset,10)]}},{name:"preventOverflow",options:{padding:ut(i["overflow-padding"])}},{name:"flip",options:{padding:ut(i["flip-padding"])}},{name:"arrow",options:{element:i["arrow-element"],padding:ut(i["arrow-padding"])}}])]}),e.popper.update(),e.state="opened",e}async function _e(t,e){Te.call(this,t);const i=this,s={open(){return Ie.call(i,this)},close(){return gt.call(i,this)},deregister(){return Te.call(i,this)}},r=n({id:t.id,state:"closed",el:t,trigger:e,popper:je(e,t),config:dt(t,this.settings)},s);return r.trigger.hasAttribute("aria-controls")&&r.trigger.setAttribute("aria-expanded","false"),Me.call(this,r),this.collection.push(r),r.el.classList.contains(this.settings.stateActive)&&(await r.open(),wt.call(this,r)),r}function Me(t){return t.__eventListeners||("hover"===t.config.event?(t.__eventListeners=[{el:["trigger"],type:["mouseenter","focus"],listener:Ie.bind(this,t)},{el:["el","trigger"],type:["mouseleave","focusout"],listener:vt.bind(this,t)}],t.__eventListeners.forEach(e=>{e.el.forEach(i=>{e.type.forEach(n=>{t[i].addEventListener(n,e.listener,!1)})})})):(t.__eventListeners=[{el:["trigger"],type:["click"],listener:yt.bind(this,t)}],t.__eventListeners.forEach(e=>{e.el.forEach(i=>{e.type.forEach(n=>{t[i].addEventListener(n,e.listener,!1)})})}))),t}var Re=/*#__PURE__*/i("handleKeydown");class Ne extends o{constructor(e){super(),Object.defineProperty(this,Re,{writable:!0,value:void 0}),this.defaults=ct,this.settings=n({},this.defaults,e),this.trigger=null,t(this,Re)[Re]=bt.bind(this),this.settings.autoInit&&this.init()}async init(t){t&&(this.settings=n({},this.settings,t));const e=document.querySelectorAll(this.settings.selectorPopover);return await this.registerCollection(e),this.settings.eventListeners&&this.initEventListeners(!1),this}async destroy(){return this.trigger=null,await this.deregisterCollection(),this.settings.eventListeners&&this.destroyEventListeners(!1),this}initEventListeners(e=!0){e&&this.collection.forEach(t=>{Me.call(this,t)}),document.addEventListener("keydown",t(this,Re)[Re],!1)}destroyEventListeners(e=!0){e&&this.collection.forEach(t=>{qe(t)}),document.removeEventListener("keydown",t(this,Re)[Re],!1)}register(t){const e=pt.call(this,t);return e.error?Promise.reject(e.error):_e.call(this,e.popover,e.trigger)}deregister(t){const e=this.get(ft.call(this,t));return Te.call(this,e)}open(t){return Ie.call(this,t)}close(t){return gt.call(this,t)}}export{A as Checkbox,K as Drawer,lt as Modal,Ne as Popover,O as core};
|
|
2
2
|
//# sourceMappingURL=scripts.modern.mjs.map
|