vrembem 3.0.11 → 4.0.0-alpha.1
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 +21 -0
- package/dev/scripts.esm.js +244 -234
- package/dev/scripts.esm.js.map +1 -1
- package/dev/scripts.js +244 -234
- package/dev/scripts.js.map +1 -1
- package/dev/scripts.modern.mjs +22 -12
- package/dev/scripts.modern.mjs.map +1 -1
- package/dev/scripts.umd.js +244 -234
- package/dev/scripts.umd.js.map +1 -1
- package/dev/styles.css +768 -1299
- 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/index.scss +1 -4
- package/package.json +24 -26
package/dist/scripts.modern.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function t(){return(t=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t}).apply(this,arguments)}var e=0;function i(t){return"__private_"+e+++"_"+t}function n(t,e){if(!Object.prototype.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var s=/*#__PURE__*/i("handler");class r{constructor(t,e){Object.defineProperty(this,s,{writable:!0,value:void 0}),this.value=t,n(this,s)[s]=e,this.mql=null}get handler(){return n(this,s)[s]}set handler(t){this.mql&&("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",n(this,s)[s]):this.mql.removeListener(n(this,s)[s])),n(this,s)[s]=t}mount(t,e){return t&&(this.value=t),e&&(n(this,s)[s]=e),this.value?(this.mql=window.matchMedia(`(min-width: ${this.value})`),"function"==typeof this.mql.addEventListener?this.mql.addEventListener("change",n(this,s)[s]):this.mql.addListener(n(this,s)[s]),n(this,s)[s](this.mql),this):this}unmount(){return this.mql?("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",n(this,s)[s]):this.mql.removeListener(n(this,s)[s]),this.value=null,n(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=['a[href]:not([tabindex^="-"])','area[href]:not([tabindex^="-"])','input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])','input[type="radio"]:not([disabled]):not([tabindex^="-"])','select:not([disabled]):not([tabindex^="-"])','textarea:not([disabled]):not([tabindex^="-"])','button:not([disabled]):not([tabindex^="-"])','iframe:not([tabindex^="-"])','audio[controls]:not([tabindex^="-"])','video[controls]:not([tabindex^="-"])','[contenteditable]:not([tabindex^="-"])','[tabindex]:not([tabindex^="-"])'],l=/*#__PURE__*/i("focusable"),c=/*#__PURE__*/i("handleFocusTrap"),d=/*#__PURE__*/i("handleFocusLock");class u{constructor(t=null,e="[data-focus]"){Object.defineProperty(this,l,{writable:!0,value:void 0}),Object.defineProperty(this,c,{writable:!0,value:void 0}),Object.defineProperty(this,d,{writable:!0,value:void 0}),this.el=t,this.selectorFocus=e,n(this,c)[c]=h.bind(this),n(this,d)[d]=f.bind(this)}get focusable(){return n(this,l)[l]}set focusable(t){n(this,l)[l]=t,n(this,l)[l].length?(document.removeEventListener("keydown",n(this,d)[d]),document.addEventListener("keydown",n(this,c)[c])):(document.removeEventListener("keydown",n(this,c)[c]),document.addEventListener("keydown",n(this,d)[d]))}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",n(this,c)[c]),document.removeEventListener("keydown",n(this,d)[d])}focus(t=this.el,e=this.selectorFocus){(t.querySelector(e)||t).focus()}getFocusable(t=this.el){const e=[],i=document.activeElement,n=t.scrollTop;return t.querySelectorAll(a.join(",")).forEach(t=>{t.focus(),document.activeElement===t&&e.push(t)}),t.scrollTop=n,i.focus(),e}}function h(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 f(t){("Tab"===t.key||9===t.keyCode)&&t.preventDefault()}function p(t,e){const i=(t.getAttribute(`data-${e}`)||"").replace(/'/g,'"');return i?JSON.parse(i):{}}function g(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 m(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 v=(t,e)=>new Promise(i=>{e.transition?(t.classList.remove(e.stateClosed),t.classList.add(e.stateOpening),t.addEventListener("transitionend",function n(){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))}),b=(t,e)=>new Promise(i=>{e.transition?(t.classList.add(e.stateClosing),t.classList.remove(e.stateOpened),t.addEventListener("transitionend",function n(){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 y(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 w={__proto__:null,Breakpoint:r,Collection:o,FocusTrap:u,getConfig:p,getPrefix:function(){return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim()},localStore:g,teleport:m,openTransition:v,closeTransition:b,updateGlobalState:y},E={autoInit:!1,stateAttr:"aria-checked",stateValue:"mixed"};class x{constructor(e){this.defaults=E,this.settings=t({},this.defaults,e),this.__handlerClick=this.handlerClick.bind(this),this.settings.autoInit&&this.init()}init(e=null){e&&(this.settings=t({},this.settings,e));const i=document.querySelectorAll(`[${this.settings.stateAttr}="${this.settings.stateValue}"]`);this.setIndeterminate(i),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 O={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 L(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 A(t){if("Escape"===t.key){const t=this.activeModal;t&&this.close(t)}}async function k(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 C(){return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim()}function S(t){const e=C(),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 P(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){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 D(t){const e=$.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 j(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(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 q(e,i,n=!0){const s=P.call(this,e),r=t({},this.settings,s.settings);return void 0!==i&&(r.transition=i),"closed"===s.state&&(s.state="opening",await v(s.el,r),"modal"===s.mode&&y(!0,r),s.state="opened"),n&&T.call(this,s),s.el.dispatchEvent(new CustomEvent(r.customEventPrefix+"opened",{detail:this,bubbles:!0})),s}async function I(e,i,n=!0){const s=P.call(this,e),r=t({},this.settings,s.settings);return void 0!==i&&(r.transition=i),"opened"===s.state&&(s.state="closing",document.activeElement.blur(),await b(s.el,r),"modal"===s.mode&&y(!1,r),n&&T.call(this,s),s.state="closed",s.el.dispatchEvent(new CustomEvent(r.customEventPrefix+"closed",{detail:this,bubbles:!0}))),s}async function _(t,e,i){const n=P.call(this,t);return"closed"===n.state?q.call(this,n,e,i):I.call(this,n,e,i)}function M(t){switch(t.mode){case"inline":return R.call(this,t);case"modal":return N.call(this,t);default:throw new Error(`"${t.mode}" is not a valid drawer mode.`)}}async function R(e){return e.el.classList.remove(e.getSetting("classModal")),e.dialog.removeAttribute("aria-modal"),y(!1,t({},this.settings,e.settings)),this.focusTrap.unmount(),await j.call(this,e),e.el.dispatchEvent(new CustomEvent(e.getSetting("customEventPrefix")+"switchMode",{detail:this,bubbles:!0})),e}async function N(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 I.call(this,t,!1,!1),t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:this,bubbles:!0})),t}async function B(e,i){await k.call(this,e,!1);const n=this,s=new r,o={open(t,e){return q.call(n,this,t,e)},close(t,e){return I.call(n,this,t,e)},toggle(t,e){return _.call(n,this,t,e)},deregister(){return k.call(n,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]:n.settings[t]}},a=t({id:e.id,el:e,dialog:i,trigger:null,settings:p(e,this.settings.dataConfig),get breakpoint(){return S.call(n,e)},get state(){return l},set state(t){l=t,"opened"!==t&&"closed"!==t||"inline"===this.mode&&n.store.set(this.id,this.state)},get mode(){return c},set mode(t){c=t,M.call(n,this)}},o);let l=e.classList.contains(a.getSetting("stateOpened"))?"opened":"closed",c=e.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 j.call(this,a),a}var V=/*#__PURE__*/i("handleClick"),F=/*#__PURE__*/i("handleKeydown");class W extends o{constructor(e){super(),Object.defineProperty(this,V,{writable:!0,value:void 0}),Object.defineProperty(this,F,{writable:!0,value:void 0}),this.defaults=O,this.settings=t({},this.defaults,e),this.focusTrap=new u,this.store=g(this.settings.storeKey,this.settings.store),n(this,V)[V]=L.bind(this),n(this,F)[F]=A.bind(this),this.settings.autoInit&&this.init()}get activeModal(){return this.collection.find(t=>"opened"===t.state&&"modal"===t.mode)}async init(e=null){e&&(this.settings=t({},this.settings,e));const i=document.querySelectorAll(this.settings.selectorDrawer);return await this.registerCollection(i),this.settings.eventListeners&&this.initEventListeners(),this}async destroy(){return await this.deregisterCollection(),this.settings.eventListeners&&this.destroyEventListeners(),this}initEventListeners(){document.addEventListener("click",n(this,V)[V],!1),document.addEventListener("keydown",n(this,F)[F],!1)}destroyEventListeners(){document.removeEventListener("click",n(this,V)[V],!1),document.removeEventListener("keydown",n(this,F)[F],!1)}register(t){const e=D.call(this,t);return e.error?Promise.reject(e.error):B.call(this,e.drawer,e.dialog)}deregister(t){const e=this.get($.call(this,t));return k.call(this,e)}open(t,e,i){return q.call(this,t,e,i)}close(t,e,i){return I.call(this,t,e,i)}toggle(t,e,i){return _.call(this,t,e,i)}}var H={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 z(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 K(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 G(t){const e=K.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 U(){this.active?this.focusTrap.mount(this.active.dialog,this.settings.selectorFocus):(this.trigger&&(this.trigger.focus(),this.trigger=null),this.focusTrap.unmount())}async function J(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(K.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(K.call(this,t.target))}function X(t){if("Escape"===t.key&&this.active&&!this.active.dialog.matches(this.settings.selectorRequired))return this.close()}async function Y(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 Q(e,i,n=!0){const s=z.call(this,e),r=t({},this.settings,s.settings);return void 0!==i&&(r.transition=i),this.stack.moveToTop(s),"closed"===s.state&&(s.state="opening",this.stack.add(s),await v(s.el,r),s.state="opened"),n&&U.call(this),s.el.dispatchEvent(new CustomEvent(r.customEventPrefix+"opened",{detail:this,bubbles:!0})),s}async function Z(e,i,n=!0){const s=e?z.call(this,e):this.active;if(s&&"opened"===s.state){s.state="closing";const e=t({},this.settings,s.settings);void 0!==i&&(e.transition=i),document.activeElement.blur(),await b(s.el,e),this.stack.remove(s),n&&U.call(this),s.state="closed",s.el.dispatchEvent(new CustomEvent(e.customEventPrefix+"closed",{detail:this,bubbles:!0}))}return s}async function tt(t,e){const i=[];return await Promise.all(this.stack.value.map(async n=>{t&&t===n.id?Promise.resolve():i.push(await Z.call(this,n,e,!1)),n.trigger=null})),i}async function et(t,e,i=!0){const n=z.call(this,t);let s,r;return"opened"===n.state?(s=n,r=await tt.call(this,n.id,e)):(s=Q.call(this,n,e,!1),r=tt.call(this,!1,e),await Promise.all([s,r])),i&&U.call(this),{opened:s,closed:r}}async function it(e,i){await Y.call(this,e,!1);const n=this,s={open(t,e){return Q.call(n,this,t,e)},close(t,e){return Z.call(n,this,t,e)},replace(t,e){return et.call(n,this,t,e)},deregister(){return Y.call(n,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=m(this.el,t,e),this.el)},teleportReturn(){return this.returnRef?(this.returnRef=m(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]:n.settings[t]}},r=t({id:e.id,state:"closed",el:e,dialog:i,returnRef:null,settings:p(e,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 nt=/*#__PURE__*/i("handleClick"),st=/*#__PURE__*/i("handleKeydown");class rt extends o{constructor(e){super(),Object.defineProperty(this,nt,{writable:!0,value:void 0}),Object.defineProperty(this,st,{writable:!0,value:void 0}),this.defaults=H,this.settings=t({},this.defaults,e),this.trigger=null,this.focusTrap=new u,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(){y(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),n(this,nt)[nt]=J.bind(this),n(this,st)[st]=X.bind(this),this.settings.autoInit&&this.init()}get active(){return this.stack.top}async init(e){e&&(this.settings=t({},this.settings,e));const i=document.querySelectorAll(this.settings.selectorModal);return await this.registerCollection(i),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",n(this,nt)[nt],!1),document.addEventListener("keydown",n(this,st)[st],!1)}destroyEventListeners(){document.removeEventListener("click",n(this,nt)[nt],!1),document.removeEventListener("keydown",n(this,st)[st],!1)}register(t){const e=G.call(this,t);return e.error?Promise.reject(e.error):it.call(this,e.modal,e.dialog)}deregister(t){const e=this.get(K.call(this,t));return Y.call(this,e)}open(t,e,i){return Q.call(this,t,e,i)}close(t,e,i){return Z.call(this,t,e,i)}replace(t,e,i){return et.call(this,t,e,i)}async closeAll(t=!1,e,i=!0){const n=await tt.call(this,t,e);return i&&U.call(this),n}}var ot={autoInit:!1,selectorPopover:".popover",selectorArrow:".popover__arrow",stateActive:"is-active",eventListeners:!0,eventType:"click",placement:"bottom"};function at(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=C(),s=i.getPropertyValue(`--${e}popover-${t}`).trim();s&&(n[t]=s)}return n}function lt(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 ct(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 dt(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 ut(t){const e=dt.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 ht(t){const e=t?ct.call(this,t):await ft.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 ft(){const t=[];return await Promise.all(this.collection.map(async e=>{"opened"===e.state&&t.push(await ht.call(this,e))})),t}function pt(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 gt(t){"opened"===t.state?t.close():(this.trigger=t.trigger,t.open(),vt.call(this,t))}function mt(t){switch(t.key){case"Escape":return this.trigger&&this.trigger.focus(),void ft.call(this);case"Tab":return void this.collection.forEach(t=>{pt.call(this,t)});default:return}}function vt(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 bt="top",yt="bottom",wt="right",Et="left",xt=[bt,yt,wt,Et],Ot=/*#__PURE__*/xt.reduce(function(t,e){return t.concat([e+"-start",e+"-end"])},[]),Lt=/*#__PURE__*/[].concat(xt,["auto"]).reduce(function(t,e){return t.concat([e,e+"-start",e+"-end"])},[]),At=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function kt(t){return t?(t.nodeName||"").toLowerCase():null}function Ct(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function St(t){return t instanceof Ct(t).Element||t instanceof Element}function Pt(t){return t instanceof Ct(t).HTMLElement||t instanceof HTMLElement}function $t(t){return"undefined"!=typeof ShadowRoot&&(t instanceof Ct(t).ShadowRoot||t instanceof ShadowRoot)}function Dt(t){return t.split("-")[0]}var jt=Math.max,Tt=Math.min,qt=Math.round;function It(){var t=navigator.userAgentData;return null!=t&&t.brands?t.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function _t(){return!/^((?!chrome|android).)*safari/i.test(It())}function Mt(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1);var n=t.getBoundingClientRect(),s=1,r=1;e&&Pt(t)&&(s=t.offsetWidth>0&&qt(n.width)/t.offsetWidth||1,r=t.offsetHeight>0&&qt(n.height)/t.offsetHeight||1);var o=(St(t)?Ct(t):window).visualViewport,a=!_t()&&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 Rt(t){var e=Mt(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 Nt(t,e){var i=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(i&&$t(i)){var n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function Bt(t){return Ct(t).getComputedStyle(t)}function Vt(t){return["table","td","th"].indexOf(kt(t))>=0}function Ft(t){return((St(t)?t.ownerDocument:t.document)||window.document).documentElement}function Wt(t){return"html"===kt(t)?t:t.assignedSlot||t.parentNode||($t(t)?t.host:null)||Ft(t)}function Ht(t){return Pt(t)&&"fixed"!==Bt(t).position?t.offsetParent:null}function zt(t){for(var e=Ct(t),i=Ht(t);i&&Vt(i)&&"static"===Bt(i).position;)i=Ht(i);return i&&("html"===kt(i)||"body"===kt(i)&&"static"===Bt(i).position)?e:i||function(t){var e=/firefox/i.test(It());if(/Trident/i.test(It())&&Pt(t)&&"fixed"===Bt(t).position)return null;var i=Wt(t);for($t(i)&&(i=i.host);Pt(i)&&["html","body"].indexOf(kt(i))<0;){var n=Bt(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 Kt(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Gt(t,e,i){return jt(t,Tt(e,i))}function Ut(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function Jt(t,e){return e.reduce(function(e,i){return e[i]=t,e},{})}function Xt(t){return t.split("-")[1]}var Yt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Qt(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"),b=o.hasOwnProperty("y"),y=Et,w=bt,E=window;if(c){var x=zt(i),O="clientHeight",L="clientWidth";x===Ct(i)&&"static"!==Bt(x=Ft(i)).position&&"absolute"===a&&(O="scrollHeight",L="scrollWidth"),x=x,(s===bt||(s===Et||s===wt)&&"end"===r)&&(w=yt,g-=(u&&x===E&&E.visualViewport?E.visualViewport.height:x[O])-n.height,g*=l?1:-1),s!==Et&&(s!==bt&&s!==yt||"end"!==r)||(y=wt,f-=(u&&x===E&&E.visualViewport?E.visualViewport.width:x[L])-n.width,f*=l?1:-1)}var A,k=Object.assign({position:a},c&&Yt),C=!0===d?function(t){var e=t.y,i=window.devicePixelRatio||1;return{x:qt(t.x*i)/i||0,y:qt(e*i)/i||0}}({x:f,y:g}):{x:f,y:g};return f=C.x,g=C.y,Object.assign({},k,l?((A={})[w]=b?"0":"",A[y]=v?"0":"",A.transform=(E.devicePixelRatio||1)<=1?"translate("+f+"px, "+g+"px)":"translate3d("+f+"px, "+g+"px, 0)",A):((e={})[w]=b?g+"px":"",e[y]=v?f+"px":"",e.transform="",e))}var Zt={passive:!0},te={left:"right",right:"left",bottom:"top",top:"bottom"};function ee(t){return t.replace(/left|right|bottom|top/g,function(t){return te[t]})}var ie={start:"end",end:"start"};function ne(t){return t.replace(/start|end/g,function(t){return ie[t]})}function se(t){var e=Ct(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function re(t){return Mt(Ft(t)).left+se(t).scrollLeft}function oe(t){var e=Bt(t);return/auto|scroll|overlay|hidden/.test(e.overflow+e.overflowY+e.overflowX)}function ae(t){return["html","body","#document"].indexOf(kt(t))>=0?t.ownerDocument.body:Pt(t)&&oe(t)?t:ae(Wt(t))}function le(t,e){var i;void 0===e&&(e=[]);var n=ae(t),s=n===(null==(i=t.ownerDocument)?void 0:i.body),r=Ct(n),o=s?[r].concat(r.visualViewport||[],oe(n)?n:[]):n,a=e.concat(o);return s?a:a.concat(le(Wt(o)))}function ce(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function de(t,e,i){return"viewport"===e?ce(function(t,e){var i=Ct(t),n=Ft(t),s=i.visualViewport,r=n.clientWidth,o=n.clientHeight,a=0,l=0;if(s){r=s.width,o=s.height;var c=_t();(c||!c&&"fixed"===e)&&(a=s.offsetLeft,l=s.offsetTop)}return{width:r,height:o,x:a+re(t),y:l}}(t,i)):St(e)?function(t,e){var i=Mt(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):ce(function(t){var e,i=Ft(t),n=se(t),s=null==(e=t.ownerDocument)?void 0:e.body,r=jt(i.scrollWidth,i.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=jt(i.scrollHeight,i.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-n.scrollLeft+re(t),l=-n.scrollTop;return"rtl"===Bt(s||i).direction&&(a+=jt(i.clientWidth,s?s.clientWidth:0)-r),{width:r,height:o,x:a,y:l}}(Ft(t)))}function ue(t){var e,i=t.reference,n=t.element,s=t.placement,r=s?Dt(s):null,o=s?Xt(s):null,a=i.x+i.width/2-n.width/2,l=i.y+i.height/2-n.height/2;switch(r){case bt:e={x:a,y:i.y-n.height};break;case yt:e={x:a,y:i.y+i.height};break;case wt:e={x:i.x+i.width,y:l};break;case Et:e={x:i.x-n.width,y:l};break;default:e={x:i.x,y:i.y}}var c=r?Kt(r):null;if(null!=c){var d="y"===c?"height":"width";switch(o){case"start":e[c]=e[c]-(i[d]/2-n[d]/2);break;case"end":e[c]=e[c]+(i[d]/2-n[d]/2)}}return e}function he(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?"clippingParents":o,l=e.rootBoundary,c=void 0===l?"viewport":l,d=e.elementContext,u=void 0===d?"popper":d,h=e.altBoundary,f=void 0!==h&&h,p=e.padding,g=void 0===p?0:p,m=Ut("number"!=typeof g?g:Jt(g,xt)),v=t.rects.popper,b=t.elements[f?"popper"===u?"reference":"popper":u],y=function(t,e,i,n){var s="clippingParents"===e?function(t){var e=le(Wt(t)),i=["absolute","fixed"].indexOf(Bt(t).position)>=0&&Pt(t)?zt(t):t;return St(i)?e.filter(function(t){return St(t)&&Nt(t,i)&&"body"!==kt(t)}):[]}(t):[].concat(e),r=[].concat(s,[i]),o=r.reduce(function(e,i){var s=de(t,i,n);return e.top=jt(s.top,e.top),e.right=Tt(s.right,e.right),e.bottom=Tt(s.bottom,e.bottom),e.left=jt(s.left,e.left),e},de(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}(St(b)?b:b.contextElement||Ft(t.elements.popper),a,c,r),w=Mt(t.elements.reference),E=ue({reference:w,element:v,strategy:"absolute",placement:n}),x=ce(Object.assign({},v,E)),O="popper"===u?x:w,L={top:y.top-O.top+m.top,bottom:O.bottom-y.bottom+m.bottom,left:y.left-O.left+m.left,right:O.right-y.right+m.right},A=t.modifiersData.offset;if("popper"===u&&A){var k=A[n];Object.keys(L).forEach(function(t){var e=[wt,yt].indexOf(t)>=0?1:-1,i=[bt,yt].indexOf(t)>=0?"y":"x";L[t]+=k[i]*e})}return L}function fe(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?Lt:o,l=Xt(e.placement),c=l?r?Ot:Ot.filter(function(t){return Xt(t)===l}):xt,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]=he(t,{placement:r,boundary:i,rootBoundary:n,padding:s})[Dt(r)],e},{});return Object.keys(u).sort(function(t,e){return u[t]-u[e]})}function pe(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 ge(t){return[bt,wt,yt,Et].some(function(e){return t[e]>=0})}function me(t,e,i){void 0===i&&(i=!1);var n,s,r=Pt(e),o=Pt(e)&&function(t){var e=t.getBoundingClientRect(),i=qt(e.width)/t.offsetWidth||1,n=qt(e.height)/t.offsetHeight||1;return 1!==i||1!==n}(e),a=Ft(e),l=Mt(t,o,i),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(r||!r&&!i)&&(("body"!==kt(e)||oe(a))&&(c=(n=e)!==Ct(n)&&Pt(n)?{scrollLeft:(s=n).scrollLeft,scrollTop:s.scrollTop}:se(n)),Pt(e)?((d=Mt(e,!0)).x+=e.clientLeft,d.y+=e.clientTop):a&&(d.x=re(a))),{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function ve(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 be={placement:"bottom",modifiers:[],strategy:"absolute"};function ye(){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 we(t){void 0===t&&(t={});var e=t.defaultModifiers,i=void 0===e?[]:e,n=t.defaultOptions,s=void 0===n?be:n;return function(t,e,n){void 0===n&&(n=s);var r,o,a={placement:"bottom",orderedModifiers:[],options:Object.assign({},be,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:St(t)?le(t):t.contextElement?le(t.contextElement):[],popper:le(e)};var o,c,h=function(t){var e=ve(t);return At.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(ye(e,i)){a.rects={reference:me(e,zt(i),"fixed"===a.options.strategy),popper:Rt(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(!ye(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 Ee=/*#__PURE__*/we({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=Ct(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return r&&c.forEach(function(t){t.addEventListener("scroll",i.update,Zt)}),a&&l.addEventListener("resize",i.update,Zt),function(){r&&c.forEach(function(t){t.removeEventListener("scroll",i.update,Zt)}),a&&l.removeEventListener("resize",i.update,Zt)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state;e.modifiersData[t.name]=ue({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:Dt(e.placement),variation:Xt(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,Qt(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,Qt(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];Pt(s)&&kt(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},{});Pt(n)&&kt(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=Lt.reduce(function(t,i){return t[i]=function(t,e,i){var n=Dt(t),s=[Et,bt].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,[Et,wt].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}},{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=Dt(m),b=l||(v!==m&&p?function(t){if("auto"===Dt(t))return[];var e=ee(t);return[ne(t),e,ne(e)]}(m):[ee(m)]),y=[m].concat(b).reduce(function(t,i){return t.concat("auto"===Dt(i)?fe(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=y[0],A=0;A<y.length;A++){var k=y[A],C=Dt(k),S="start"===Xt(k),P=[bt,yt].indexOf(C)>=0,$=P?"width":"height",D=he(e,{placement:k,boundary:d,rootBoundary:u,altBoundary:h,padding:c}),j=P?S?wt:Et:S?yt:bt;w[$]>E[$]&&(j=ee(j));var T=ee(j),q=[];if(r&&q.push(D[C]<=0),a&&q.push(D[j]<=0,D[T]<=0),q.every(function(t){return t})){L=k,O=!1;break}x.set(k,q)}if(O)for(var I=function(t){var e=y.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}},{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=he(e,{boundary:i.boundary,rootBoundary:i.rootBoundary,padding:i.padding,altBoundary:i.altBoundary}),f=Dt(e.placement),p=Xt(e.placement),g=!p,m=Kt(f),v="x"===m?"y":"x",b=e.modifiersData.popperOffsets,y=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(b){if(r){var A,k="y"===m?bt:Et,C="y"===m?yt:wt,S="y"===m?"height":"width",P=b[m],$=P+h[k],D=P-h[C],j=c?-w[S]/2:0,T="start"===p?y[S]:w[S],q="start"===p?-w[S]:-y[S],I=e.elements.arrow,_=c&&I?Rt(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[k],N=M[C],B=Gt(0,y[S],_[S]),V=g?y[S]/2-j-B-R-x.mainAxis:T-B-R-x.mainAxis,F=g?-y[S]/2+j+B+N+x.mainAxis:q+B+N+x.mainAxis,W=e.elements.arrow&&zt(e.elements.arrow),H=null!=(A=null==O?void 0:O[m])?A:0,z=P+F-H,K=Gt(c?Tt($,P+V-H-(W?"y"===m?W.clientTop||0:W.clientLeft||0:0)):$,P,c?jt(D,z):D);b[m]=K,L[m]=K-P}if(a){var G,U=b[v],J="y"===v?"height":"width",X=U+h["x"===m?bt:Et],Y=U-h["x"===m?yt:wt],Q=-1!==[bt,Et].indexOf(f),Z=null!=(G=null==O?void 0:O[v])?G:0,tt=Q?X:U-y[J]-w[J]-Z+x.altAxis,et=Q?U+y[J]+w[J]-Z-x.altAxis:Y,it=c&&Q?function(t,e,i){var n=Gt(t,e,i);return n>i?i:n}(tt,U,et):Gt(c?tt:X,U,c?et:Y);b[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=Dt(i.placement),l=Kt(a),c=[Et,wt].indexOf(a)>=0?"height":"width";if(r&&o){var d=function(t,e){return Ut("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:Jt(t,xt))}(s.padding,i),u=Rt(r),h="y"===l?bt:Et,f="y"===l?yt:wt,p=i.rects.reference[c]+i.rects.reference[l]-o[l]-i.rects.popper[c],g=o[l]-i.rects.reference[l],m=zt(r),v=m?"y"===l?m.clientHeight||0:m.clientWidth||0:0,b=v/2-u[c]/2+(p/2-g/2),y=Gt(d[h],b,v-u[c]-d[f]);i.modifiersData[n]=((e={})[l]=y,e.centerOffset=y-b,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)))&&Nt(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=he(e,{elementContext:"reference"}),a=he(e,{altBoundary:!0}),l=pe(o,n),c=pe(a,s,r),d=ge(l),u=ge(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 xe(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(),Oe(t),Object.getOwnPropertyNames(t).forEach(e=>{delete t[e]}),this.collection.splice(e,1)}return this.collection}function Oe(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 Le(t){const e=ct.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=at(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:lt(i["overflow-padding"])}},{name:"flip",options:{padding:lt(i["flip-padding"])}},{name:"arrow",options:{element:i["arrow-element"],padding:lt(i["arrow-padding"])}}])]}),e.popper.update(),e.state="opened",e}async function Ae(e,i){xe.call(this,e);const n=this,s={open(){return Le.call(n,this)},close(){return ht.call(n,this)},deregister(){return xe.call(n,this)}},r=t({id:e.id,state:"closed",el:e,trigger:i,popper:Ee(i,e),config:at(e,this.settings)},s);return r.trigger.hasAttribute("aria-controls")&&r.trigger.setAttribute("aria-expanded","false"),ke.call(this,r),this.collection.push(r),r.el.classList.contains(this.settings.stateActive)&&(await r.open(),vt.call(this,r)),r}function ke(t){return t.__eventListeners||("hover"===t.config.event?(t.__eventListeners=[{el:["trigger"],type:["mouseenter","focus"],listener:Le.bind(this,t)},{el:["el","trigger"],type:["mouseleave","focusout"],listener:pt.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:gt.bind(this,t)}],t.__eventListeners.forEach(e=>{e.el.forEach(i=>{e.type.forEach(n=>{t[i].addEventListener(n,e.listener,!1)})})}))),t}var Ce=/*#__PURE__*/i("handleKeydown");class Se extends o{constructor(e){super(),Object.defineProperty(this,Ce,{writable:!0,value:void 0}),this.defaults=ot,this.settings=t({},this.defaults,e),this.trigger=null,n(this,Ce)[Ce]=mt.bind(this),this.settings.autoInit&&this.init()}async init(e){e&&(this.settings=t({},this.settings,e));const i=document.querySelectorAll(this.settings.selectorPopover);return await this.registerCollection(i),this.settings.eventListeners&&this.initEventListeners(!1),this}async destroy(){return this.trigger=null,await this.deregisterCollection(),this.settings.eventListeners&&this.destroyEventListeners(!1),this}initEventListeners(t=!0){t&&this.collection.forEach(t=>{ke.call(this,t)}),document.addEventListener("keydown",n(this,Ce)[Ce],!1)}destroyEventListeners(t=!0){t&&this.collection.forEach(t=>{Oe(t)}),document.removeEventListener("keydown",n(this,Ce)[Ce],!1)}register(t){const e=ut.call(this,t);return e.error?Promise.reject(e.error):Ae.call(this,e.popover,e.trigger)}deregister(t){const e=this.get(dt.call(this,t));return xe.call(this,e)}open(t){return Le.call(this,t)}close(t){return ht.call(this,t)}}export{x as Checkbox,W as Drawer,rt as Modal,Se as Popover,w as core};
|
|
1
|
+
function t(){return(t=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t}).apply(this,arguments)}var e=0;function i(t){return"__private_"+e+++"_"+t}function n(t,e){if(!Object.prototype.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var s=/*#__PURE__*/i("handler");class r{constructor(t,e){Object.defineProperty(this,s,{writable:!0,value:void 0}),this.value=t,n(this,s)[s]=e,this.mql=null}get handler(){return n(this,s)[s]}set handler(t){this.mql&&("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",n(this,s)[s]):this.mql.removeListener(n(this,s)[s])),n(this,s)[s]=t}mount(t,e){return t&&(this.value=t),e&&(n(this,s)[s]=e),this.value?(this.mql=window.matchMedia(`(min-width: ${this.value})`),"function"==typeof this.mql.addEventListener?this.mql.addEventListener("change",n(this,s)[s]):this.mql.addListener(n(this,s)[s]),n(this,s)[s](this.mql),this):this}unmount(){return this.mql?("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",n(this,s)[s]):this.mql.removeListener(n(this,s)[s]),this.value=null,n(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)}}const a=":not([inert]):not([inert] *)",l=':not([tabindex^="-"])';var c=[`a[href]${a}${l}`,`area[href]${a}${l}`,`input:not([type="hidden"]):not([type="radio"])${a}${l}:not(:disabled)`,`input[type="radio"]${a}${l}:not(:disabled)`,`select${a}${l}:not(:disabled)`,`textarea${a}${l}:not(:disabled)`,`button${a}${l}:not(:disabled)`,`details${a} > summary:first-of-type${l}`,`iframe${a}${l}`,`audio[controls]${a}${l}`,`video[controls]${a}${l}`,`[contenteditable]${a}${l}`,`[tabindex]${a}${l}`],d=/*#__PURE__*/i("focusable"),u=/*#__PURE__*/i("handleFocusTrap"),h=/*#__PURE__*/i("handleFocusLock");class f{constructor(t=null,e="[data-focus]"){Object.defineProperty(this,d,{writable:!0,value:void 0}),Object.defineProperty(this,u,{writable:!0,value:void 0}),Object.defineProperty(this,h,{writable:!0,value:void 0}),this.el=t,this.selectorFocus=e,n(this,u)[u]=p.bind(this),n(this,h)[h]=g.bind(this)}get focusable(){return n(this,d)[d]}set focusable(t){n(this,d)[d]=t,n(this,d)[d].length?(document.removeEventListener("keydown",n(this,h)[h]),document.addEventListener("keydown",n(this,u)[u])):(document.removeEventListener("keydown",n(this,u)[u]),document.addEventListener("keydown",n(this,h)[h]))}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",n(this,u)[u]),document.removeEventListener("keydown",n(this,h)[h])}focus(t=this.el,e=this.selectorFocus){(t.querySelector(e)||t).focus()}getFocusable(t=this.el){const e=[],i=document.activeElement,n=t.scrollTop;return t.querySelectorAll(c.join(",")).forEach(t=>{t.focus(),document.activeElement===t&&e.push(t)}),t.scrollTop=n,i.focus(),e}}function p(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 g(t){("Tab"===t.key||9===t.keyCode)&&t.preventDefault()}function m(t,e){const i=(t.getAttribute(`data-${e}`)||"").replace(/'/g,'"');return i?JSON.parse(i):{}}function v(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 y=(t,e)=>new Promise(i=>{e.transition?(t.classList.remove(e.stateClosed),t.classList.add(e.stateOpening),t.addEventListener("transitionend",function n(){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))}),w=(t,e)=>new Promise(i=>{e.transition?(t.classList.add(e.stateClosing),t.classList.remove(e.stateOpened),t.addEventListener("transitionend",function n(){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 E(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 x={__proto__:null,Breakpoint:r,Collection:o,FocusTrap:f,getConfig:m,getPrefix:function(){return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim()},localStore:v,teleport:b,openTransition:y,closeTransition:w,updateGlobalState:E},O={autoInit:!1,stateAttr:"aria-checked",stateValue:"mixed"};class L{constructor(e){this.defaults=O,this.settings=t({},this.defaults,e),this.__handlerClick=this.handlerClick.bind(this),this.settings.autoInit&&this.init()}init(e=null){e&&(this.settings=t({},this.settings,e));const i=document.querySelectorAll(`[${this.settings.stateAttr}="${this.settings.stateValue}"]`);this.setIndeterminate(i),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 A={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 $(t){if("Escape"===t.key){const t=this.activeModal;t&&this.close(t)}}async function C(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 S(){return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim()}function P(t){const e=S(),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 D(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 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.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 T(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?{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 q(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 I(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 _(e,i,n=!0){const s=D.call(this,e),r=t({},this.settings,s.settings);return void 0!==i&&(r.transition=i),"closed"===s.state&&(s.state="opening",await y(s.el,r),"modal"===s.mode&&E(!0,r),s.state="opened"),n&&I.call(this,s),s.el.dispatchEvent(new CustomEvent(r.customEventPrefix+"opened",{detail:this,bubbles:!0})),s}async function M(e,i,n=!0){const s=D.call(this,e),r=t({},this.settings,s.settings);return void 0!==i&&(r.transition=i),"opened"===s.state&&(s.state="closing",document.activeElement.blur(),await w(s.el,r),"modal"===s.mode&&E(!1,r),n&&I.call(this,s),s.state="closed",s.el.dispatchEvent(new CustomEvent(r.customEventPrefix+"closed",{detail:this,bubbles:!0}))),s}async function R(t,e,i){const n=D.call(this,t);return"closed"===n.state?_.call(this,n,e,i):M.call(this,n,e,i)}function N(t){switch(t.mode){case"inline":return B.call(this,t);case"modal":return V.call(this,t);default:throw new Error(`"${t.mode}" is not a valid drawer mode.`)}}async function B(e){return e.el.classList.remove(e.getSetting("classModal")),e.dialog.removeAttribute("aria-modal"),E(!1,t({},this.settings,e.settings)),this.focusTrap.unmount(),await q.call(this,e),e.el.dispatchEvent(new CustomEvent(e.getSetting("customEventPrefix")+"switchMode",{detail:this,bubbles:!0})),e}async function V(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 M.call(this,t,!1,!1),t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:this,bubbles:!0})),t}async function F(e,i){await C.call(this,e,!1);const n=this,s=new r,o={open(t,e){return _.call(n,this,t,e)},close(t,e){return M.call(n,this,t,e)},toggle(t,e){return R.call(n,this,t,e)},deregister(){return C.call(n,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]:n.settings[t]}},a=t({id:e.id,el:e,dialog:i,trigger:null,settings:m(e,this.settings.dataConfig),get breakpoint(){return P.call(n,e)},get state(){return l},set state(t){l=t,"opened"!==t&&"closed"!==t||"inline"===this.mode&&n.store.set(this.id,this.state)},get mode(){return c},set mode(t){c=t,N.call(n,this)}},o);let l=e.classList.contains(a.getSetting("stateOpened"))?"opened":"closed",c=e.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 q.call(this,a),a}var W=/*#__PURE__*/i("handleClick"),H=/*#__PURE__*/i("handleKeydown");class z extends o{constructor(e){super(),Object.defineProperty(this,W,{writable:!0,value:void 0}),Object.defineProperty(this,H,{writable:!0,value:void 0}),this.defaults=A,this.settings=t({},this.defaults,e),this.focusTrap=new f,this.store=v(this.settings.storeKey,this.settings.store),n(this,W)[W]=k.bind(this),n(this,H)[H]=$.bind(this),this.settings.autoInit&&this.init()}get activeModal(){return this.collection.find(t=>"opened"===t.state&&"modal"===t.mode)}async init(e=null){e&&(this.settings=t({},this.settings,e));const i=document.querySelectorAll(this.settings.selectorDrawer);return await this.registerCollection(i),this.settings.eventListeners&&this.initEventListeners(),this}async destroy(){return await this.deregisterCollection(),this.settings.eventListeners&&this.destroyEventListeners(),this}initEventListeners(){document.addEventListener("click",n(this,W)[W],!1),document.addEventListener("keydown",n(this,H)[H],!1)}destroyEventListeners(){document.removeEventListener("click",n(this,W)[W],!1),document.removeEventListener("keydown",n(this,H)[H],!1)}register(t){const e=T.call(this,t);return e.error?Promise.reject(e.error):F.call(this,e.drawer,e.dialog)}deregister(t){const e=this.get(j.call(this,t));return C.call(this,e)}open(t,e,i){return _.call(this,t,e,i)}close(t,e,i){return M.call(this,t,e,i)}toggle(t,e,i){return R.call(this,t,e,i)}}var K={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 G(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 U(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 J(t){const e=U.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 X(){this.active?this.focusTrap.mount(this.active.dialog,this.settings.selectorFocus):(this.trigger&&(this.trigger.focus(),this.trigger=null),this.focusTrap.unmount())}async function Y(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(U.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(U.call(this,t.target))}function Q(t){if("Escape"===t.key&&this.active&&!this.active.dialog.matches(this.settings.selectorRequired))return this.close()}async function Z(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 tt(e,i,n=!0){const s=G.call(this,e),r=t({},this.settings,s.settings);return void 0!==i&&(r.transition=i),this.stack.moveToTop(s),"closed"===s.state&&(s.state="opening",this.stack.add(s),await y(s.el,r),s.state="opened"),n&&X.call(this),s.el.dispatchEvent(new CustomEvent(r.customEventPrefix+"opened",{detail:this,bubbles:!0})),s}async function et(e,i,n=!0){const s=e?G.call(this,e):this.active;if(s&&"opened"===s.state){s.state="closing";const e=t({},this.settings,s.settings);void 0!==i&&(e.transition=i),document.activeElement.blur(),await w(s.el,e),this.stack.remove(s),n&&X.call(this),s.state="closed",s.el.dispatchEvent(new CustomEvent(e.customEventPrefix+"closed",{detail:this,bubbles:!0}))}return s}async function it(t,e){const i=[];return await Promise.all(this.stack.value.map(async n=>{t&&t===n.id?Promise.resolve():i.push(await et.call(this,n,e,!1)),n.trigger=null})),i}async function nt(t,e,i=!0){const n=G.call(this,t);let s,r;return"opened"===n.state?(s=n,r=await it.call(this,n.id,e)):(s=tt.call(this,n,e,!1),r=it.call(this,!1,e),await Promise.all([s,r])),i&&X.call(this),{opened:s,closed:r}}async function st(e,i){await Z.call(this,e,!1);const n=this,s={open(t,e){return tt.call(n,this,t,e)},close(t,e){return et.call(n,this,t,e)},replace(t,e){return nt.call(n,this,t,e)},deregister(){return Z.call(n,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]:n.settings[t]}},r=t({id:e.id,state:"closed",el:e,dialog:i,returnRef:null,settings:m(e,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 rt=/*#__PURE__*/i("handleClick"),ot=/*#__PURE__*/i("handleKeydown");class at extends o{constructor(e){super(),Object.defineProperty(this,rt,{writable:!0,value:void 0}),Object.defineProperty(this,ot,{writable:!0,value:void 0}),this.defaults=K,this.settings=t({},this.defaults,e),this.trigger=null,this.focusTrap=new f,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(){E(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),n(this,rt)[rt]=Y.bind(this),n(this,ot)[ot]=Q.bind(this),this.settings.autoInit&&this.init()}get active(){return this.stack.top}async init(e){e&&(this.settings=t({},this.settings,e));const i=document.querySelectorAll(this.settings.selectorModal);return await this.registerCollection(i),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",n(this,rt)[rt],!1),document.addEventListener("keydown",n(this,ot)[ot],!1)}destroyEventListeners(){document.removeEventListener("click",n(this,rt)[rt],!1),document.removeEventListener("keydown",n(this,ot)[ot],!1)}register(t){const e=J.call(this,t);return e.error?Promise.reject(e.error):st.call(this,e.modal,e.dialog)}deregister(t){const e=this.get(U.call(this,t));return Z.call(this,e)}open(t,e,i){return tt.call(this,t,e,i)}close(t,e,i){return et.call(this,t,e,i)}replace(t,e,i){return nt.call(this,t,e,i)}async closeAll(t=!1,e,i=!0){const n=await it.call(this,t,e);return i&&X.call(this),n}}var lt={autoInit:!1,selectorPopover:".popover",selectorArrow:".popover__arrow",stateActive:"is-active",eventListeners:!0,eventType:"click",placement:"bottom"};function ct(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=S(),s=i.getPropertyValue(`--${e}popover-${t}`).trim();s&&(n[t]=s)}return n}function dt(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 ut(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 ht(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 ft(t){const e=ht.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 pt(t){const e=t?ut.call(this,t):await gt.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 gt(){const t=[];return await Promise.all(this.collection.map(async e=>{"opened"===e.state&&t.push(await pt.call(this,e))})),t}function mt(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 vt(t){"opened"===t.state?t.close():(this.trigger=t.trigger,t.open(),yt.call(this,t))}function bt(t){switch(t.key){case"Escape":return this.trigger&&this.trigger.focus(),void gt.call(this);case"Tab":return void this.collection.forEach(t=>{mt.call(this,t)});default:return}}function yt(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 wt="top",Et="bottom",xt="right",Ot="left",Lt=[wt,Et,xt,Ot],At=/*#__PURE__*/Lt.reduce(function(t,e){return t.concat([e+"-start",e+"-end"])},[]),kt=/*#__PURE__*/[].concat(Lt,["auto"]).reduce(function(t,e){return t.concat([e,e+"-start",e+"-end"])},[]),$t=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Ct(t){return t?(t.nodeName||"").toLowerCase():null}function St(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Pt(t){return t instanceof St(t).Element||t instanceof Element}function Dt(t){return t instanceof St(t).HTMLElement||t instanceof HTMLElement}function jt(t){return"undefined"!=typeof ShadowRoot&&(t instanceof St(t).ShadowRoot||t instanceof ShadowRoot)}function Tt(t){return t.split("-")[0]}var qt=Math.max,It=Math.min,_t=Math.round;function Mt(){var t=navigator.userAgentData;return null!=t&&t.brands?t.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function Rt(){return!/^((?!chrome|android).)*safari/i.test(Mt())}function Nt(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1);var n=t.getBoundingClientRect(),s=1,r=1;e&&Dt(t)&&(s=t.offsetWidth>0&&_t(n.width)/t.offsetWidth||1,r=t.offsetHeight>0&&_t(n.height)/t.offsetHeight||1);var o=(Pt(t)?St(t):window).visualViewport,a=!Rt()&&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 Bt(t){var e=Nt(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 Vt(t,e){var i=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(i&&jt(i)){var n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function Ft(t){return St(t).getComputedStyle(t)}function Wt(t){return["table","td","th"].indexOf(Ct(t))>=0}function Ht(t){return((Pt(t)?t.ownerDocument:t.document)||window.document).documentElement}function zt(t){return"html"===Ct(t)?t:t.assignedSlot||t.parentNode||(jt(t)?t.host:null)||Ht(t)}function Kt(t){return Dt(t)&&"fixed"!==Ft(t).position?t.offsetParent:null}function Gt(t){for(var e=St(t),i=Kt(t);i&&Wt(i)&&"static"===Ft(i).position;)i=Kt(i);return i&&("html"===Ct(i)||"body"===Ct(i)&&"static"===Ft(i).position)?e:i||function(t){var e=/firefox/i.test(Mt());if(/Trident/i.test(Mt())&&Dt(t)&&"fixed"===Ft(t).position)return null;var i=zt(t);for(jt(i)&&(i=i.host);Dt(i)&&["html","body"].indexOf(Ct(i))<0;){var n=Ft(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 Ut(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Jt(t,e,i){return qt(t,It(e,i))}function Xt(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function Yt(t,e){return e.reduce(function(e,i){return e[i]=t,e},{})}function Qt(t){return t.split("-")[1]}var Zt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function te(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"),b=o.hasOwnProperty("y"),y=Ot,w=wt,E=window;if(c){var x=Gt(i),O="clientHeight",L="clientWidth";x===St(i)&&"static"!==Ft(x=Ht(i)).position&&"absolute"===a&&(O="scrollHeight",L="scrollWidth"),x=x,(s===wt||(s===Ot||s===xt)&&"end"===r)&&(w=Et,g-=(u&&x===E&&E.visualViewport?E.visualViewport.height:x[O])-n.height,g*=l?1:-1),s!==Ot&&(s!==wt&&s!==Et||"end"!==r)||(y=xt,f-=(u&&x===E&&E.visualViewport?E.visualViewport.width:x[L])-n.width,f*=l?1:-1)}var A,k=Object.assign({position:a},c&&Zt),$=!0===d?function(t){var e=t.y,i=window.devicePixelRatio||1;return{x:_t(t.x*i)/i||0,y:_t(e*i)/i||0}}({x:f,y:g}):{x:f,y:g};return f=$.x,g=$.y,Object.assign({},k,l?((A={})[w]=b?"0":"",A[y]=v?"0":"",A.transform=(E.devicePixelRatio||1)<=1?"translate("+f+"px, "+g+"px)":"translate3d("+f+"px, "+g+"px, 0)",A):((e={})[w]=b?g+"px":"",e[y]=v?f+"px":"",e.transform="",e))}var ee={passive:!0},ie={left:"right",right:"left",bottom:"top",top:"bottom"};function ne(t){return t.replace(/left|right|bottom|top/g,function(t){return ie[t]})}var se={start:"end",end:"start"};function re(t){return t.replace(/start|end/g,function(t){return se[t]})}function oe(t){var e=St(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function ae(t){return Nt(Ht(t)).left+oe(t).scrollLeft}function le(t){var e=Ft(t);return/auto|scroll|overlay|hidden/.test(e.overflow+e.overflowY+e.overflowX)}function ce(t){return["html","body","#document"].indexOf(Ct(t))>=0?t.ownerDocument.body:Dt(t)&&le(t)?t:ce(zt(t))}function de(t,e){var i;void 0===e&&(e=[]);var n=ce(t),s=n===(null==(i=t.ownerDocument)?void 0:i.body),r=St(n),o=s?[r].concat(r.visualViewport||[],le(n)?n:[]):n,a=e.concat(o);return s?a:a.concat(de(zt(o)))}function ue(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function he(t,e,i){return"viewport"===e?ue(function(t,e){var i=St(t),n=Ht(t),s=i.visualViewport,r=n.clientWidth,o=n.clientHeight,a=0,l=0;if(s){r=s.width,o=s.height;var c=Rt();(c||!c&&"fixed"===e)&&(a=s.offsetLeft,l=s.offsetTop)}return{width:r,height:o,x:a+ae(t),y:l}}(t,i)):Pt(e)?function(t,e){var i=Nt(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):ue(function(t){var e,i=Ht(t),n=oe(t),s=null==(e=t.ownerDocument)?void 0:e.body,r=qt(i.scrollWidth,i.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=qt(i.scrollHeight,i.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-n.scrollLeft+ae(t),l=-n.scrollTop;return"rtl"===Ft(s||i).direction&&(a+=qt(i.clientWidth,s?s.clientWidth:0)-r),{width:r,height:o,x:a,y:l}}(Ht(t)))}function fe(t){var e,i=t.reference,n=t.element,s=t.placement,r=s?Tt(s):null,o=s?Qt(s):null,a=i.x+i.width/2-n.width/2,l=i.y+i.height/2-n.height/2;switch(r){case wt:e={x:a,y:i.y-n.height};break;case Et:e={x:a,y:i.y+i.height};break;case xt:e={x:i.x+i.width,y:l};break;case Ot:e={x:i.x-n.width,y:l};break;default:e={x:i.x,y:i.y}}var c=r?Ut(r):null;if(null!=c){var d="y"===c?"height":"width";switch(o){case"start":e[c]=e[c]-(i[d]/2-n[d]/2);break;case"end":e[c]=e[c]+(i[d]/2-n[d]/2)}}return e}function pe(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?"clippingParents":o,l=e.rootBoundary,c=void 0===l?"viewport":l,d=e.elementContext,u=void 0===d?"popper":d,h=e.altBoundary,f=void 0!==h&&h,p=e.padding,g=void 0===p?0:p,m=Xt("number"!=typeof g?g:Yt(g,Lt)),v=t.rects.popper,b=t.elements[f?"popper"===u?"reference":"popper":u],y=function(t,e,i,n){var s="clippingParents"===e?function(t){var e=de(zt(t)),i=["absolute","fixed"].indexOf(Ft(t).position)>=0&&Dt(t)?Gt(t):t;return Pt(i)?e.filter(function(t){return Pt(t)&&Vt(t,i)&&"body"!==Ct(t)}):[]}(t):[].concat(e),r=[].concat(s,[i]),o=r.reduce(function(e,i){var s=he(t,i,n);return e.top=qt(s.top,e.top),e.right=It(s.right,e.right),e.bottom=It(s.bottom,e.bottom),e.left=qt(s.left,e.left),e},he(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}(Pt(b)?b:b.contextElement||Ht(t.elements.popper),a,c,r),w=Nt(t.elements.reference),E=fe({reference:w,element:v,strategy:"absolute",placement:n}),x=ue(Object.assign({},v,E)),O="popper"===u?x:w,L={top:y.top-O.top+m.top,bottom:O.bottom-y.bottom+m.bottom,left:y.left-O.left+m.left,right:O.right-y.right+m.right},A=t.modifiersData.offset;if("popper"===u&&A){var k=A[n];Object.keys(L).forEach(function(t){var e=[xt,Et].indexOf(t)>=0?1:-1,i=[wt,Et].indexOf(t)>=0?"y":"x";L[t]+=k[i]*e})}return L}function ge(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?kt:o,l=Qt(e.placement),c=l?r?At:At.filter(function(t){return Qt(t)===l}):Lt,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]=pe(t,{placement:r,boundary:i,rootBoundary:n,padding:s})[Tt(r)],e},{});return Object.keys(u).sort(function(t,e){return u[t]-u[e]})}function me(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 ve(t){return[wt,xt,Et,Ot].some(function(e){return t[e]>=0})}function be(t,e,i){void 0===i&&(i=!1);var n,s,r=Dt(e),o=Dt(e)&&function(t){var e=t.getBoundingClientRect(),i=_t(e.width)/t.offsetWidth||1,n=_t(e.height)/t.offsetHeight||1;return 1!==i||1!==n}(e),a=Ht(e),l=Nt(t,o,i),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(r||!r&&!i)&&(("body"!==Ct(e)||le(a))&&(c=(n=e)!==St(n)&&Dt(n)?{scrollLeft:(s=n).scrollLeft,scrollTop:s.scrollTop}:oe(n)),Dt(e)?((d=Nt(e,!0)).x+=e.clientLeft,d.y+=e.clientTop):a&&(d.x=ae(a))),{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function ye(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 we={placement:"bottom",modifiers:[],strategy:"absolute"};function Ee(){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 xe(t){void 0===t&&(t={});var e=t.defaultModifiers,i=void 0===e?[]:e,n=t.defaultOptions,s=void 0===n?we:n;return function(t,e,n){void 0===n&&(n=s);var r,o,a={placement:"bottom",orderedModifiers:[],options:Object.assign({},we,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:Pt(t)?de(t):t.contextElement?de(t.contextElement):[],popper:de(e)};var o,c,h=function(t){var e=ye(t);return $t.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(Ee(e,i)){a.rects={reference:be(e,Gt(i),"fixed"===a.options.strategy),popper:Bt(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(!Ee(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 Oe=/*#__PURE__*/xe({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=St(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return r&&c.forEach(function(t){t.addEventListener("scroll",i.update,ee)}),a&&l.addEventListener("resize",i.update,ee),function(){r&&c.forEach(function(t){t.removeEventListener("scroll",i.update,ee)}),a&&l.removeEventListener("resize",i.update,ee)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state;e.modifiersData[t.name]=fe({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:Tt(e.placement),variation:Qt(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,te(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,te(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];Dt(s)&&Ct(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},{});Dt(n)&&Ct(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=kt.reduce(function(t,i){return t[i]=function(t,e,i){var n=Tt(t),s=[Ot,wt].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,[Ot,xt].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}},{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=Tt(m),b=l||(v!==m&&p?function(t){if("auto"===Tt(t))return[];var e=ne(t);return[re(t),e,re(e)]}(m):[ne(m)]),y=[m].concat(b).reduce(function(t,i){return t.concat("auto"===Tt(i)?ge(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=y[0],A=0;A<y.length;A++){var k=y[A],$=Tt(k),C="start"===Qt(k),S=[wt,Et].indexOf($)>=0,P=S?"width":"height",D=pe(e,{placement:k,boundary:d,rootBoundary:u,altBoundary:h,padding:c}),j=S?C?xt:Ot:C?Et:wt;w[P]>E[P]&&(j=ne(j));var T=ne(j),q=[];if(r&&q.push(D[$]<=0),a&&q.push(D[j]<=0,D[T]<=0),q.every(function(t){return t})){L=k,O=!1;break}x.set(k,q)}if(O)for(var I=function(t){var e=y.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}},{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=pe(e,{boundary:i.boundary,rootBoundary:i.rootBoundary,padding:i.padding,altBoundary:i.altBoundary}),f=Tt(e.placement),p=Qt(e.placement),g=!p,m=Ut(f),v="x"===m?"y":"x",b=e.modifiersData.popperOffsets,y=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(b){if(r){var A,k="y"===m?wt:Ot,$="y"===m?Et:xt,C="y"===m?"height":"width",S=b[m],P=S+h[k],D=S-h[$],j=c?-w[C]/2:0,T="start"===p?y[C]:w[C],q="start"===p?-w[C]:-y[C],I=e.elements.arrow,_=c&&I?Bt(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[k],N=M[$],B=Jt(0,y[C],_[C]),V=g?y[C]/2-j-B-R-x.mainAxis:T-B-R-x.mainAxis,F=g?-y[C]/2+j+B+N+x.mainAxis:q+B+N+x.mainAxis,W=e.elements.arrow&&Gt(e.elements.arrow),H=null!=(A=null==O?void 0:O[m])?A:0,z=S+F-H,K=Jt(c?It(P,S+V-H-(W?"y"===m?W.clientTop||0:W.clientLeft||0:0)):P,S,c?qt(D,z):D);b[m]=K,L[m]=K-S}if(a){var G,U=b[v],J="y"===v?"height":"width",X=U+h["x"===m?wt:Ot],Y=U-h["x"===m?Et:xt],Q=-1!==[wt,Ot].indexOf(f),Z=null!=(G=null==O?void 0:O[v])?G:0,tt=Q?X:U-y[J]-w[J]-Z+x.altAxis,et=Q?U+y[J]+w[J]-Z-x.altAxis:Y,it=c&&Q?function(t,e,i){var n=Jt(t,e,i);return n>i?i:n}(tt,U,et):Jt(c?tt:X,U,c?et:Y);b[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=Tt(i.placement),l=Ut(a),c=[Ot,xt].indexOf(a)>=0?"height":"width";if(r&&o){var d=function(t,e){return Xt("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:Yt(t,Lt))}(s.padding,i),u=Bt(r),h="y"===l?wt:Ot,f="y"===l?Et:xt,p=i.rects.reference[c]+i.rects.reference[l]-o[l]-i.rects.popper[c],g=o[l]-i.rects.reference[l],m=Gt(r),v=m?"y"===l?m.clientHeight||0:m.clientWidth||0:0,b=v/2-u[c]/2+(p/2-g/2),y=Jt(d[h],b,v-u[c]-d[f]);i.modifiersData[n]=((e={})[l]=y,e.centerOffset=y-b,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)))&&Vt(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=pe(e,{elementContext:"reference"}),a=pe(e,{altBoundary:!0}),l=me(o,n),c=me(a,s,r),d=ve(l),u=ve(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 Le(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(),Ae(t),Object.getOwnPropertyNames(t).forEach(e=>{delete t[e]}),this.collection.splice(e,1)}return this.collection}function Ae(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 ke(t){const e=ut.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=ct(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:dt(i["overflow-padding"])}},{name:"flip",options:{padding:dt(i["flip-padding"])}},{name:"arrow",options:{element:i["arrow-element"],padding:dt(i["arrow-padding"])}}])]}),e.popper.update(),e.state="opened",e}async function $e(e,i){Le.call(this,e);const n=this,s={open(){return ke.call(n,this)},close(){return pt.call(n,this)},deregister(){return Le.call(n,this)}},r=t({id:e.id,state:"closed",el:e,trigger:i,popper:Oe(i,e),config:ct(e,this.settings)},s);return r.trigger.hasAttribute("aria-controls")&&r.trigger.setAttribute("aria-expanded","false"),Ce.call(this,r),this.collection.push(r),r.el.classList.contains(this.settings.stateActive)&&(await r.open(),yt.call(this,r)),r}function Ce(t){return t.__eventListeners||("hover"===t.config.event?(t.__eventListeners=[{el:["trigger"],type:["mouseenter","focus"],listener:ke.bind(this,t)},{el:["el","trigger"],type:["mouseleave","focusout"],listener:mt.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:vt.bind(this,t)}],t.__eventListeners.forEach(e=>{e.el.forEach(i=>{e.type.forEach(n=>{t[i].addEventListener(n,e.listener,!1)})})}))),t}var Se=/*#__PURE__*/i("handleKeydown");class Pe extends o{constructor(e){super(),Object.defineProperty(this,Se,{writable:!0,value:void 0}),this.defaults=lt,this.settings=t({},this.defaults,e),this.trigger=null,n(this,Se)[Se]=bt.bind(this),this.settings.autoInit&&this.init()}async init(e){e&&(this.settings=t({},this.settings,e));const i=document.querySelectorAll(this.settings.selectorPopover);return await this.registerCollection(i),this.settings.eventListeners&&this.initEventListeners(!1),this}async destroy(){return this.trigger=null,await this.deregisterCollection(),this.settings.eventListeners&&this.destroyEventListeners(!1),this}initEventListeners(t=!0){t&&this.collection.forEach(t=>{Ce.call(this,t)}),document.addEventListener("keydown",n(this,Se)[Se],!1)}destroyEventListeners(t=!0){t&&this.collection.forEach(t=>{Ae(t)}),document.removeEventListener("keydown",n(this,Se)[Se],!1)}register(t){const e=ft.call(this,t);return e.error?Promise.reject(e.error):$e.call(this,e.popover,e.trigger)}deregister(t){const e=this.get(ht.call(this,t));return Le.call(this,e)}open(t){return ke.call(this,t)}close(t){return pt.call(this,t)}}export{L as Checkbox,z as Drawer,at as Modal,Pe as Popover,x as core};
|
|
2
2
|
//# sourceMappingURL=scripts.modern.mjs.map
|