Socket
Socket
Sign inDemoInstall

@vrembem/drawer

Package Overview
Dependencies
2
Maintainers
1
Versions
93
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0 to 3.0.1

17

dev/scripts.esm.js

@@ -863,4 +863,8 @@ function _defineProperties(target, props) {

function L() {
return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim();
}
function getBreakpoint(drawer) {
var prefix = getVariablePrefix();
var prefix = L();
var bp = drawer.getAttribute("data-" + this.settings.dataBreakpoint);

@@ -870,4 +874,4 @@

return this.settings.breakpoints[bp];
} else if (getComputedStyle(document.body).getPropertyValue(prefix + bp)) {
return getComputedStyle(document.body).getPropertyValue(prefix + bp);
} else if (getComputedStyle(document.body).getPropertyValue("--" + prefix + "breakpoint-" + bp).trim()) {
return getComputedStyle(document.body).getPropertyValue("--" + prefix + "breakpoint-" + bp).trim();
} else {

@@ -878,9 +882,2 @@ return bp;

function getVariablePrefix() {
var prefix = '--';
prefix += getComputedStyle(document.body).getPropertyValue('--vrembem-variable-prefix');
prefix += 'breakpoint-';
return prefix;
}
function getDrawer(query) {

@@ -887,0 +884,0 @@ // Get the entry from collection.

@@ -863,4 +863,8 @@ function _defineProperties(target, props) {

function L() {
return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim();
}
function getBreakpoint(drawer) {
var prefix = getVariablePrefix();
var prefix = L();
var bp = drawer.getAttribute("data-" + this.settings.dataBreakpoint);

@@ -870,4 +874,4 @@

return this.settings.breakpoints[bp];
} else if (getComputedStyle(document.body).getPropertyValue(prefix + bp)) {
return getComputedStyle(document.body).getPropertyValue(prefix + bp);
} else if (getComputedStyle(document.body).getPropertyValue("--" + prefix + "breakpoint-" + bp).trim()) {
return getComputedStyle(document.body).getPropertyValue("--" + prefix + "breakpoint-" + bp).trim();
} else {

@@ -878,9 +882,2 @@ return bp;

function getVariablePrefix() {
var prefix = '--';
prefix += getComputedStyle(document.body).getPropertyValue('--vrembem-variable-prefix');
prefix += 'breakpoint-';
return prefix;
}
function getDrawer(query) {

@@ -887,0 +884,0 @@ // Get the entry from collection.

@@ -528,4 +528,8 @@ function _extends() {

function L() {
return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim();
}
function getBreakpoint(drawer) {
const prefix = getVariablePrefix();
const prefix = L();
const bp = drawer.getAttribute(`data-${this.settings.dataBreakpoint}`);

@@ -535,4 +539,4 @@

return this.settings.breakpoints[bp];
} else if (getComputedStyle(document.body).getPropertyValue(prefix + bp)) {
return getComputedStyle(document.body).getPropertyValue(prefix + bp);
} else if (getComputedStyle(document.body).getPropertyValue(`--${prefix}breakpoint-${bp}`).trim()) {
return getComputedStyle(document.body).getPropertyValue(`--${prefix}breakpoint-${bp}`).trim();
} else {

@@ -543,9 +547,2 @@ return bp;

function getVariablePrefix() {
let prefix = '--';
prefix += getComputedStyle(document.body).getPropertyValue('--vrembem-variable-prefix');
prefix += 'breakpoint-';
return prefix;
}
function getDrawer(query) {

@@ -552,0 +549,0 @@ // Get the entry from collection.

@@ -868,4 +868,8 @@ (function (global, factory) {

function L() {
return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim();
}
function getBreakpoint(drawer) {
var prefix = getVariablePrefix();
var prefix = L();
var bp = drawer.getAttribute("data-" + this.settings.dataBreakpoint);

@@ -875,4 +879,4 @@

return this.settings.breakpoints[bp];
} else if (getComputedStyle(document.body).getPropertyValue(prefix + bp)) {
return getComputedStyle(document.body).getPropertyValue(prefix + bp);
} else if (getComputedStyle(document.body).getPropertyValue("--" + prefix + "breakpoint-" + bp).trim()) {
return getComputedStyle(document.body).getPropertyValue("--" + prefix + "breakpoint-" + bp).trim();
} else {

@@ -883,9 +887,2 @@ return bp;

function getVariablePrefix() {
var prefix = '--';
prefix += getComputedStyle(document.body).getPropertyValue('--vrembem-variable-prefix');
prefix += 'breakpoint-';
return prefix;
}
function getDrawer(query) {

@@ -892,0 +889,0 @@ // Get the entry from collection.

@@ -1,2 +0,2 @@

function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function e(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(){return(n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function r(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var o=0;function s(t){return"__private_"+o+++"_"+t}function a(t,e){if(!Object.prototype.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var c=/*#__PURE__*/s("handler"),l=/*#__PURE__*/function(){function t(t,e){Object.defineProperty(this,c,{writable:!0,value:void 0}),this.value=t,a(this,c)[c]=e,this.mql=null}var n=t.prototype;return n.mount=function(t,e){return t&&(this.value=t),e&&(a(this,c)[c]=e),this.value?(this.mql=window.matchMedia("(min-width: "+this.value+")"),"function"==typeof this.mql.addEventListener?this.mql.addEventListener("change",a(this,c)[c]):this.mql.addListener(a(this,c)[c]),a(this,c)[c](this.mql),this):this},n.unmount=function(){return this.mql?("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",a(this,c)[c]):this.mql.removeListener(a(this,c)[c]),this.value=null,a(this,c)[c]=null,this.mql=null,this):this},e(t,[{key:"handler",get:function(){return a(this,c)[c]},set:function(t){this.mql&&("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",a(this,c)[c]):this.mql.removeListener(a(this,c)[c])),a(this,c)[c]=t}}]),t}();function u(t,e,n){if(!t.s){if(n instanceof d){if(!n.s)return void(n.o=u.bind(null,t,e));1&e&&(e=n.s),n=n.v}if(n&&n.then)return void n.then(u.bind(null,t,e),u.bind(null,t,2));t.s=e,t.v=n;var i=t.o;i&&i(t)}}var d=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(e,n){var i=new t,r=this.s;if(r){var o=1&r?e:n;if(o){try{u(i,1,o(this.v))}catch(t){u(i,2,t)}return i}return this}return this.o=function(t){try{var r=t.v;1&t.s?u(i,1,e?e(r):r):n?u(i,1,n(r)):u(i,2,r)}catch(t){u(i,2,t)}},i},t}();function h(t){return t instanceof d&&1&t.s}var f=/*#__PURE__*/function(){function t(){this.collection=[]}var e=t.prototype;return e.register=function(t){try{var e=this;return Promise.resolve(e.deregister(t)).then(function(){return e.collection.push(t),e.collection})}catch(t){return Promise.reject(t)}},e.deregister=function(t){try{var e=this,n=e.collection.findIndex(function(e){return e===t});if(n>=0){var i=e.collection[n];Object.getOwnPropertyNames(i).forEach(function(t){delete i[t]}),e.collection.splice(n,1)}return Promise.resolve(e.collection)}catch(t){return Promise.reject(t)}},e.registerCollection=function(t){try{var e=this;return Promise.resolve(Promise.all(Array.from(t,function(t){e.register(t)}))).then(function(){return e.collection})}catch(t){return Promise.reject(t)}},e.deregisterCollection=function(){try{var t=function(){return e.collection},e=this,n=function(t,e,n){for(var i;;){var r=t();if(h(r)&&(r=r.v),!r)return o;if(r.then){i=0;break}var o=n();if(o&&o.then){if(!h(o)){i=1;break}o=o.s}}var s=new d,a=u.bind(null,s,2);return(0===i?r.then(l):1===i?o.then(c):(void 0).then(function(){(r=t())?r.then?r.then(l).then(void 0,a):l(r):u(s,1,o)})).then(void 0,a),s;function c(e){o=e;do{if(!(r=t())||h(r)&&!r.v)return void u(s,1,o);if(r.then)return void r.then(l).then(void 0,a);h(o=n())&&(o=o.v)}while(!o||!o.then);o.then(c).then(void 0,a)}function l(t){t?(o=n())&&o.then?o.then(c).then(void 0,a):c(o):u(s,1,o)}}(function(){return e.collection.length>0},0,function(){return Promise.resolve(e.deregister(e.collection[0])).then(function(){})});return Promise.resolve(n&&n.then?n.then(t):t())}catch(t){return Promise.reject(t)}},e.get=function(t,e){return void 0===e&&(e="id"),this.collection.find(function(n){return n[e]===t})},t}(),v=['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^="-"])'],g=/*#__PURE__*/s("focusable"),m=/*#__PURE__*/s("handleFocusTrap"),p=/*#__PURE__*/s("handleFocusLock"),b=/*#__PURE__*/function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e="[data-focus]"),Object.defineProperty(this,g,{writable:!0,value:void 0}),Object.defineProperty(this,m,{writable:!0,value:void 0}),Object.defineProperty(this,p,{writable:!0,value:void 0}),this.el=t,this.selectorFocus=e,a(this,m)[m]=y.bind(this),a(this,p)[p]=w.bind(this)}var n=t.prototype;return n.mount=function(t,e){t&&(this.el=t),e&&(this.selectorFocus=e),this.focusable=this.getFocusable(),this.focus()},n.unmount=function(){this.el=null,this.focusable=[],document.removeEventListener("keydown",a(this,m)[m]),document.removeEventListener("keydown",a(this,p)[p])},n.focus=function(t,e){void 0===t&&(t=this.el),void 0===e&&(e=this.selectorFocus),(t.querySelector(e)||t).focus()},n.getFocusable=function(t){void 0===t&&(t=this.el);var e=[],n=document.activeElement,i=t.scrollTop;return t.querySelectorAll(v.join(",")).forEach(function(t){t.focus(),document.activeElement===t&&e.push(t)}),t.scrollTop=i,n.focus(),e},e(t,[{key:"focusable",get:function(){return a(this,g)[g]},set:function(t){a(this,g)[g]=t,a(this,g)[g].length?(document.removeEventListener("keydown",a(this,p)[p]),document.addEventListener("keydown",a(this,m)[m])):(document.removeEventListener("keydown",a(this,m)[m]),document.addEventListener("keydown",a(this,p)[p]))}},{key:"focusableFirst",get:function(){return this.focusable[0]}},{key:"focusableLast",get:function(){return this.focusable[this.focusable.length-1]}}]),t}();function y(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 w(t){("Tab"===t.key||9===t.keyCode)&&t.preventDefault()}function P(t,e){var n=(t.getAttribute("data-"+e)||"").replace(/'/g,'"');return n?JSON.parse(n):{}}function E(t,e){var n,i;n=!!t,(i=e.selectorInert)&&document.querySelectorAll(i).forEach(function(t){n?(t.inert=!0,t.setAttribute("aria-hidden",!0)):(t.inert=null,t.removeAttribute("aria-hidden"))}),function(t,e){e&&document.querySelectorAll(e).forEach(function(e){t?e.style.overflow="hidden":e.style.removeProperty("overflow")})}(!!t,e.selectorOverflow)}var L={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 O(t){var e=this,n=t.target.closest("\n [data-"+this.settings.dataOpen+"],\n [data-"+this.settings.dataToggle+"],\n [data-"+this.settings.dataClose+"]\n ");n?(t.preventDefault(),n.matches("[data-"+this.settings.dataToggle+"]")&&n.getAttribute("data-"+this.settings.dataToggle).trim().split(" ").forEach(function(t){var i=e.get(t);i.trigger=n,i.toggle()}),n.matches("[data-"+this.settings.dataOpen+"]")&&n.getAttribute("data-"+this.settings.dataOpen).trim().split(" ").forEach(function(t){var i=e.get(t);i.trigger=n,i.open()}),n.matches("[data-"+this.settings.dataClose+"]")&&n.getAttribute("data-"+this.settings.dataClose).trim().split(" ").forEach(function(i){if(i){var r=e.get(i);r.trigger=n,r.close()}else{var o=t.target.closest(e.settings.selectorDrawer);o&&e.close(o)}})):t.target.matches(this.settings.selectorDrawer)&&this.close(t.target.id)}function k(t){if("Escape"===t.key){var e=this.activeModal;e&&this.close(e)}}var C=function(t,e){void 0===e&&(e=!0);try{var n=function(){return i.collection},i=this;if(!t)return Promise.resolve(i.collection);var r=i.collection.findIndex(function(e){return e.id===t.id}),o=function(){if(r>=0){var t=function(){delete i.store[n.id],n.unmountBreakpoint(),Object.getOwnPropertyNames(n).forEach(function(t){delete n[t]}),i.collection.splice(r,1)},n=i.collection[r],o=function(){if(e&&"opened"===n.state)return Promise.resolve(n.close(!1)).then(function(){})}();return o&&o.then?o.then(t):t()}}();return Promise.resolve(o&&o.then?o.then(n):n())}catch(t){return Promise.reject(t)}};function j(t){var e=function(){var t="--";return(t+=getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix"))+"breakpoint-"}(),n=t.getAttribute("data-"+this.settings.dataBreakpoint);return this.settings.breakpoints&&this.settings.breakpoints[n]?this.settings.breakpoints[n]:getComputedStyle(document.body).getPropertyValue(e+n)?getComputedStyle(document.body).getPropertyValue(e+n):n}function x(t){var 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 S(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 A(t){var e=S.call(this,t);if(e){var n=document.querySelector("#"+e),i=n?n.querySelector(this.settings.selectorDialog):null;return n||i?i?{drawer:n,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.")}}var q=function(t){try{var e=this,n=function(){if(e.store[t.id]){var n="opened"===e.store[t.id]?Promise.resolve(t.open(!1,!1)).then(function(){}):Promise.resolve(t.close(!1,!1)).then(function(){});if(n&&n.then)return n.then(function(){})}else t.el.classList.contains(e.settings.stateOpened)?t.state="opened":(t.el.classList.remove(e.settings.stateOpening),t.el.classList.remove(e.settings.stateClosing),t.el.classList.add(e.settings.stateClosed))}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(t){return Promise.reject(t)}};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())}var D=function(t,e,i){void 0===i&&(i=!0);try{var r=function(){return i&&T.call(o,s),s.el.dispatchEvent(new CustomEvent(a.customEventPrefix+"opened",{detail:o,bubbles:!0})),s},o=this,s=x.call(o,t),a=n({},o.settings,s.settings);void 0!==e&&(a.transition=e);var c=function(){if("closed"===s.state)return s.state="opening",Promise.resolve((t=s.el,e=a,new Promise(function(n){e.transition?(t.classList.remove(e.stateClosed),t.classList.add(e.stateOpening),t.addEventListener("transitionend",function i(){t.classList.add(e.stateOpened),t.classList.remove(e.stateOpening),n(t),this.removeEventListener("transitionend",i)})):(t.classList.add(e.stateOpened),t.classList.remove(e.stateClosed),n(t))}))).then(function(){"modal"===s.mode&&E(!0,a),s.state="opened"});var t,e}();return Promise.resolve(c&&c.then?c.then(r):r())}catch(t){return Promise.reject(t)}},F=function(t,e,i){void 0===i&&(i=!0);try{var r=this,o=x.call(r,t),s=n({},r.settings,o.settings);void 0!==e&&(s.transition=e);var a=function(){if("opened"===o.state)return o.state="closing",document.activeElement.blur(),Promise.resolve((t=o.el,e=s,new Promise(function(n){e.transition?(t.classList.add(e.stateClosing),t.classList.remove(e.stateOpened),t.addEventListener("transitionend",function i(){t.classList.remove(e.stateClosing),t.classList.add(e.stateClosed),n(t),this.removeEventListener("transitionend",i)})):(t.classList.add(e.stateClosed),t.classList.remove(e.stateOpened),n(t))}))).then(function(){"modal"===o.mode&&E(!1,s),i&&T.call(r,o),o.state="closed",o.el.dispatchEvent(new CustomEvent(s.customEventPrefix+"closed",{detail:r,bubbles:!0}))});var t,e}();return Promise.resolve(a&&a.then?a.then(function(){return o}):o)}catch(t){return Promise.reject(t)}},_=function(t,e,n){try{var i=this,r=x.call(i,t);return Promise.resolve("closed"===r.state?D.call(i,r,e,n):F.call(i,r,e,n))}catch(t){return Promise.reject(t)}},I=function(t){try{var e=this;return t.el.classList.add(t.getSetting("classModal")),t.dialog.setAttribute("aria-modal","true"),!e.store[t.id]&&t.el.classList.contains(t.getSetting("stateOpened"))&&(e.store[t.id]="opened"),Promise.resolve(F.call(e,t,!1,!1)).then(function(){return t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:e,bubbles:!0})),t})}catch(t){return Promise.reject(t)}},B=function(t){try{var e=this;return t.el.classList.remove(t.getSetting("classModal")),t.dialog.removeAttribute("aria-modal"),E(!1,n({},e.settings,t.settings)),e.focusTrap.unmount(),Promise.resolve(q.call(e,t)).then(function(){return t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:e,bubbles:!0})),t})}catch(t){return Promise.reject(t)}};function M(t){switch(t.mode){case"inline":return B.call(this,t);case"modal":return I.call(this,t);default:throw new Error('"'+t.mode+'" is not a valid drawer mode.')}}var N=function(t,e){try{var i=this;return Promise.resolve(C.call(i,t,!1)).then(function(){var r=i,o=new l,s={open:function(t,e){return D.call(r,this,t,e)},close:function(t,e){return F.call(r,this,t,e)},toggle:function(t,e){return _.call(r,this,t,e)},deregister:function(){return C.call(r,this)},mountBreakpoint:function(){var t=this.breakpoint,e=this.handleBreakpoint.bind(this);return o.mount(t,e),this},unmountBreakpoint:function(){return o.unmount(),this},handleBreakpoint:function(t){return this.mode=t.matches?"inline":"modal",this},getSetting:function(t){return t in this.settings?this.settings[t]:r.settings[t]}},a=n({id:t.id,el:t,dialog:e,trigger:null,settings:P(t,i.settings.dataConfig),get breakpoint(){return j.call(r,t)},get state(){return c},set state(t){c=t,"opened"!==t&&"closed"!==t||"inline"===this.mode&&(r.store[this.id]=this.state)},get mode(){return u},set mode(t){u=t,M.call(r,this)}},s),c=t.classList.contains(a.getSetting("stateOpened"))?"opened":"closed",u=t.classList.contains(a.getSetting("classModal"))?"modal":"inline";"modal"===a.mode?a.dialog.setAttribute("aria-modal","true"):a.dialog.removeAttribute("aria-modal"),a.getSetting("setTabindex")&&a.dialog.setAttribute("tabindex","-1"),i.collection.push(a);var d=function(){if(!a.breakpoint)return Promise.resolve(q.call(i,a)).then(function(){});a.mountBreakpoint()}();return d&&d.then?d.then(function(){return a}):a})}catch(t){return Promise.reject(t)}},K=/*#__PURE__*/s("handleClick"),V=/*#__PURE__*/s("handleKeydown"),J=/*#__PURE__*/function(t){var o,s;function c(e){var i;return i=t.call(this)||this,Object.defineProperty(r(i),K,{writable:!0,value:void 0}),Object.defineProperty(r(i),V,{writable:!0,value:void 0}),i.defaults=L,i.settings=n({},i.defaults,e),i.focusTrap=new b,i.store=function(t,e){function n(e){localStorage.setItem(t,JSON.stringify(e))}return void 0===e&&(e=!0),new Proxy((i=localStorage.getItem(t))?JSON.parse(i):{},{set:function(t,i,r){return t[i]=r,e&&n(t),!0},deleteProperty:function(t,i){return delete t[i],e&&n(t),!0}});var i}(i.settings.storeKey,i.settings.store),a(r(i),K)[K]=O.bind(r(i)),a(r(i),V)[V]=k.bind(r(i)),i.settings.autoInit&&i.init(),i}s=t,(o=c).prototype=Object.create(s.prototype),o.prototype.constructor=o,i(o,s);var l=c.prototype;return l.init=function(t){void 0===t&&(t=null);try{var e=this;t&&(e.settings=n({},e.settings,t));var i=document.querySelectorAll(e.settings.selectorDrawer);return Promise.resolve(e.registerCollection(i)).then(function(){return e.settings.eventListeners&&e.initEventListeners(),e})}catch(t){return Promise.reject(t)}},l.destroy=function(){try{var t=this;return Promise.resolve(t.deregisterCollection()).then(function(){return t.settings.eventListeners&&t.destroyEventListeners(),t})}catch(t){return Promise.reject(t)}},l.initEventListeners=function(){document.addEventListener("click",a(this,K)[K],!1),document.addEventListener("touchend",a(this,K)[K],!1),document.addEventListener("keydown",a(this,V)[V],!1)},l.destroyEventListeners=function(){document.removeEventListener("click",a(this,K)[K],!1),document.removeEventListener("touchend",a(this,K)[K],!1),document.removeEventListener("keydown",a(this,V)[V],!1)},l.register=function(t){var e=A.call(this,t);return e.error?Promise.reject(e.error):N.call(this,e.drawer,e.dialog)},l.deregister=function(t){var e=this.get(S.call(this,t));return C.call(this,e)},l.open=function(t,e,n){return D.call(this,t,e,n)},l.close=function(t,e,n){return F.call(this,t,e,n)},l.toggle=function(t,e,n){return _.call(this,t,e,n)},e(c,[{key:"activeModal",get:function(){return this.collection.find(function(t){return"opened"===t.state&&"modal"===t.mode})}}]),c}(f);export default J;
function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function e(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(){return(n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function r(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var o=0;function s(t){return"__private_"+o+++"_"+t}function a(t,e){if(!Object.prototype.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var c=/*#__PURE__*/s("handler"),l=/*#__PURE__*/function(){function t(t,e){Object.defineProperty(this,c,{writable:!0,value:void 0}),this.value=t,a(this,c)[c]=e,this.mql=null}var n=t.prototype;return n.mount=function(t,e){return t&&(this.value=t),e&&(a(this,c)[c]=e),this.value?(this.mql=window.matchMedia("(min-width: "+this.value+")"),"function"==typeof this.mql.addEventListener?this.mql.addEventListener("change",a(this,c)[c]):this.mql.addListener(a(this,c)[c]),a(this,c)[c](this.mql),this):this},n.unmount=function(){return this.mql?("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",a(this,c)[c]):this.mql.removeListener(a(this,c)[c]),this.value=null,a(this,c)[c]=null,this.mql=null,this):this},e(t,[{key:"handler",get:function(){return a(this,c)[c]},set:function(t){this.mql&&("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",a(this,c)[c]):this.mql.removeListener(a(this,c)[c])),a(this,c)[c]=t}}]),t}();function u(t,e,n){if(!t.s){if(n instanceof d){if(!n.s)return void(n.o=u.bind(null,t,e));1&e&&(e=n.s),n=n.v}if(n&&n.then)return void n.then(u.bind(null,t,e),u.bind(null,t,2));t.s=e,t.v=n;var i=t.o;i&&i(t)}}var d=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(e,n){var i=new t,r=this.s;if(r){var o=1&r?e:n;if(o){try{u(i,1,o(this.v))}catch(t){u(i,2,t)}return i}return this}return this.o=function(t){try{var r=t.v;1&t.s?u(i,1,e?e(r):r):n?u(i,1,n(r)):u(i,2,r)}catch(t){u(i,2,t)}},i},t}();function h(t){return t instanceof d&&1&t.s}var f=/*#__PURE__*/function(){function t(){this.collection=[]}var e=t.prototype;return e.register=function(t){try{var e=this;return Promise.resolve(e.deregister(t)).then(function(){return e.collection.push(t),e.collection})}catch(t){return Promise.reject(t)}},e.deregister=function(t){try{var e=this,n=e.collection.findIndex(function(e){return e===t});if(n>=0){var i=e.collection[n];Object.getOwnPropertyNames(i).forEach(function(t){delete i[t]}),e.collection.splice(n,1)}return Promise.resolve(e.collection)}catch(t){return Promise.reject(t)}},e.registerCollection=function(t){try{var e=this;return Promise.resolve(Promise.all(Array.from(t,function(t){e.register(t)}))).then(function(){return e.collection})}catch(t){return Promise.reject(t)}},e.deregisterCollection=function(){try{var t=function(){return e.collection},e=this,n=function(t,e,n){for(var i;;){var r=t();if(h(r)&&(r=r.v),!r)return o;if(r.then){i=0;break}var o=n();if(o&&o.then){if(!h(o)){i=1;break}o=o.s}}var s=new d,a=u.bind(null,s,2);return(0===i?r.then(l):1===i?o.then(c):(void 0).then(function(){(r=t())?r.then?r.then(l).then(void 0,a):l(r):u(s,1,o)})).then(void 0,a),s;function c(e){o=e;do{if(!(r=t())||h(r)&&!r.v)return void u(s,1,o);if(r.then)return void r.then(l).then(void 0,a);h(o=n())&&(o=o.v)}while(!o||!o.then);o.then(c).then(void 0,a)}function l(t){t?(o=n())&&o.then?o.then(c).then(void 0,a):c(o):u(s,1,o)}}(function(){return e.collection.length>0},0,function(){return Promise.resolve(e.deregister(e.collection[0])).then(function(){})});return Promise.resolve(n&&n.then?n.then(t):t())}catch(t){return Promise.reject(t)}},e.get=function(t,e){return void 0===e&&(e="id"),this.collection.find(function(n){return n[e]===t})},t}(),v=['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^="-"])'],g=/*#__PURE__*/s("focusable"),m=/*#__PURE__*/s("handleFocusTrap"),p=/*#__PURE__*/s("handleFocusLock"),b=/*#__PURE__*/function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e="[data-focus]"),Object.defineProperty(this,g,{writable:!0,value:void 0}),Object.defineProperty(this,m,{writable:!0,value:void 0}),Object.defineProperty(this,p,{writable:!0,value:void 0}),this.el=t,this.selectorFocus=e,a(this,m)[m]=y.bind(this),a(this,p)[p]=w.bind(this)}var n=t.prototype;return n.mount=function(t,e){t&&(this.el=t),e&&(this.selectorFocus=e),this.focusable=this.getFocusable(),this.focus()},n.unmount=function(){this.el=null,this.focusable=[],document.removeEventListener("keydown",a(this,m)[m]),document.removeEventListener("keydown",a(this,p)[p])},n.focus=function(t,e){void 0===t&&(t=this.el),void 0===e&&(e=this.selectorFocus),(t.querySelector(e)||t).focus()},n.getFocusable=function(t){void 0===t&&(t=this.el);var e=[],n=document.activeElement,i=t.scrollTop;return t.querySelectorAll(v.join(",")).forEach(function(t){t.focus(),document.activeElement===t&&e.push(t)}),t.scrollTop=i,n.focus(),e},e(t,[{key:"focusable",get:function(){return a(this,g)[g]},set:function(t){a(this,g)[g]=t,a(this,g)[g].length?(document.removeEventListener("keydown",a(this,p)[p]),document.addEventListener("keydown",a(this,m)[m])):(document.removeEventListener("keydown",a(this,m)[m]),document.addEventListener("keydown",a(this,p)[p]))}},{key:"focusableFirst",get:function(){return this.focusable[0]}},{key:"focusableLast",get:function(){return this.focusable[this.focusable.length-1]}}]),t}();function y(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 w(t){("Tab"===t.key||9===t.keyCode)&&t.preventDefault()}function P(t,e){var n=(t.getAttribute("data-"+e)||"").replace(/'/g,'"');return n?JSON.parse(n):{}}function E(t,e){var n,i;n=!!t,(i=e.selectorInert)&&document.querySelectorAll(i).forEach(function(t){n?(t.inert=!0,t.setAttribute("aria-hidden",!0)):(t.inert=null,t.removeAttribute("aria-hidden"))}),function(t,e){e&&document.querySelectorAll(e).forEach(function(e){t?e.style.overflow="hidden":e.style.removeProperty("overflow")})}(!!t,e.selectorOverflow)}var L={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){var e=this,n=t.target.closest("\n [data-"+this.settings.dataOpen+"],\n [data-"+this.settings.dataToggle+"],\n [data-"+this.settings.dataClose+"]\n ");n?(t.preventDefault(),n.matches("[data-"+this.settings.dataToggle+"]")&&n.getAttribute("data-"+this.settings.dataToggle).trim().split(" ").forEach(function(t){var i=e.get(t);i.trigger=n,i.toggle()}),n.matches("[data-"+this.settings.dataOpen+"]")&&n.getAttribute("data-"+this.settings.dataOpen).trim().split(" ").forEach(function(t){var i=e.get(t);i.trigger=n,i.open()}),n.matches("[data-"+this.settings.dataClose+"]")&&n.getAttribute("data-"+this.settings.dataClose).trim().split(" ").forEach(function(i){if(i){var r=e.get(i);r.trigger=n,r.close()}else{var o=t.target.closest(e.settings.selectorDrawer);o&&e.close(o)}})):t.target.matches(this.settings.selectorDrawer)&&this.close(t.target.id)}function O(t){if("Escape"===t.key){var e=this.activeModal;e&&this.close(e)}}var C=function(t,e){void 0===e&&(e=!0);try{var n=function(){return i.collection},i=this;if(!t)return Promise.resolve(i.collection);var r=i.collection.findIndex(function(e){return e.id===t.id}),o=function(){if(r>=0){var t=function(){delete i.store[n.id],n.unmountBreakpoint(),Object.getOwnPropertyNames(n).forEach(function(t){delete n[t]}),i.collection.splice(r,1)},n=i.collection[r],o=function(){if(e&&"opened"===n.state)return Promise.resolve(n.close(!1)).then(function(){})}();return o&&o.then?o.then(t):t()}}();return Promise.resolve(o&&o.then?o.then(n):n())}catch(t){return Promise.reject(t)}};function j(t){var e=getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim(),n=t.getAttribute("data-"+this.settings.dataBreakpoint);return this.settings.breakpoints&&this.settings.breakpoints[n]?this.settings.breakpoints[n]:getComputedStyle(document.body).getPropertyValue("--"+e+"breakpoint-"+n).trim()?getComputedStyle(document.body).getPropertyValue("--"+e+"breakpoint-"+n).trim():n}function x(t){var 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 S(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 A(t){var e=S.call(this,t);if(e){var n=document.querySelector("#"+e),i=n?n.querySelector(this.settings.selectorDialog):null;return n||i?i?{drawer:n,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.")}}var q=function(t){try{var e=this,n=function(){if(e.store[t.id]){var n="opened"===e.store[t.id]?Promise.resolve(t.open(!1,!1)).then(function(){}):Promise.resolve(t.close(!1,!1)).then(function(){});if(n&&n.then)return n.then(function(){})}else t.el.classList.contains(e.settings.stateOpened)?t.state="opened":(t.el.classList.remove(e.settings.stateOpening),t.el.classList.remove(e.settings.stateClosing),t.el.classList.add(e.settings.stateClosed))}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(t){return Promise.reject(t)}};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())}var D=function(t,e,i){void 0===i&&(i=!0);try{var r=function(){return i&&T.call(o,s),s.el.dispatchEvent(new CustomEvent(a.customEventPrefix+"opened",{detail:o,bubbles:!0})),s},o=this,s=x.call(o,t),a=n({},o.settings,s.settings);void 0!==e&&(a.transition=e);var c=function(){if("closed"===s.state)return s.state="opening",Promise.resolve((t=s.el,e=a,new Promise(function(n){e.transition?(t.classList.remove(e.stateClosed),t.classList.add(e.stateOpening),t.addEventListener("transitionend",function i(){t.classList.add(e.stateOpened),t.classList.remove(e.stateOpening),n(t),this.removeEventListener("transitionend",i)})):(t.classList.add(e.stateOpened),t.classList.remove(e.stateClosed),n(t))}))).then(function(){"modal"===s.mode&&E(!0,a),s.state="opened"});var t,e}();return Promise.resolve(c&&c.then?c.then(r):r())}catch(t){return Promise.reject(t)}},F=function(t,e,i){void 0===i&&(i=!0);try{var r=this,o=x.call(r,t),s=n({},r.settings,o.settings);void 0!==e&&(s.transition=e);var a=function(){if("opened"===o.state)return o.state="closing",document.activeElement.blur(),Promise.resolve((t=o.el,e=s,new Promise(function(n){e.transition?(t.classList.add(e.stateClosing),t.classList.remove(e.stateOpened),t.addEventListener("transitionend",function i(){t.classList.remove(e.stateClosing),t.classList.add(e.stateClosed),n(t),this.removeEventListener("transitionend",i)})):(t.classList.add(e.stateClosed),t.classList.remove(e.stateOpened),n(t))}))).then(function(){"modal"===o.mode&&E(!1,s),i&&T.call(r,o),o.state="closed",o.el.dispatchEvent(new CustomEvent(s.customEventPrefix+"closed",{detail:r,bubbles:!0}))});var t,e}();return Promise.resolve(a&&a.then?a.then(function(){return o}):o)}catch(t){return Promise.reject(t)}},_=function(t,e,n){try{var i=this,r=x.call(i,t);return Promise.resolve("closed"===r.state?D.call(i,r,e,n):F.call(i,r,e,n))}catch(t){return Promise.reject(t)}},I=function(t){try{var e=this;return t.el.classList.add(t.getSetting("classModal")),t.dialog.setAttribute("aria-modal","true"),!e.store[t.id]&&t.el.classList.contains(t.getSetting("stateOpened"))&&(e.store[t.id]="opened"),Promise.resolve(F.call(e,t,!1,!1)).then(function(){return t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:e,bubbles:!0})),t})}catch(t){return Promise.reject(t)}},B=function(t){try{var e=this;return t.el.classList.remove(t.getSetting("classModal")),t.dialog.removeAttribute("aria-modal"),E(!1,n({},e.settings,t.settings)),e.focusTrap.unmount(),Promise.resolve(q.call(e,t)).then(function(){return t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:e,bubbles:!0})),t})}catch(t){return Promise.reject(t)}};function M(t){switch(t.mode){case"inline":return B.call(this,t);case"modal":return I.call(this,t);default:throw new Error('"'+t.mode+'" is not a valid drawer mode.')}}var N=function(t,e){try{var i=this;return Promise.resolve(C.call(i,t,!1)).then(function(){var r=i,o=new l,s={open:function(t,e){return D.call(r,this,t,e)},close:function(t,e){return F.call(r,this,t,e)},toggle:function(t,e){return _.call(r,this,t,e)},deregister:function(){return C.call(r,this)},mountBreakpoint:function(){var t=this.breakpoint,e=this.handleBreakpoint.bind(this);return o.mount(t,e),this},unmountBreakpoint:function(){return o.unmount(),this},handleBreakpoint:function(t){return this.mode=t.matches?"inline":"modal",this},getSetting:function(t){return t in this.settings?this.settings[t]:r.settings[t]}},a=n({id:t.id,el:t,dialog:e,trigger:null,settings:P(t,i.settings.dataConfig),get breakpoint(){return j.call(r,t)},get state(){return c},set state(t){c=t,"opened"!==t&&"closed"!==t||"inline"===this.mode&&(r.store[this.id]=this.state)},get mode(){return u},set mode(t){u=t,M.call(r,this)}},s),c=t.classList.contains(a.getSetting("stateOpened"))?"opened":"closed",u=t.classList.contains(a.getSetting("classModal"))?"modal":"inline";"modal"===a.mode?a.dialog.setAttribute("aria-modal","true"):a.dialog.removeAttribute("aria-modal"),a.getSetting("setTabindex")&&a.dialog.setAttribute("tabindex","-1"),i.collection.push(a);var d=function(){if(!a.breakpoint)return Promise.resolve(q.call(i,a)).then(function(){});a.mountBreakpoint()}();return d&&d.then?d.then(function(){return a}):a})}catch(t){return Promise.reject(t)}},K=/*#__PURE__*/s("handleClick"),V=/*#__PURE__*/s("handleKeydown"),J=/*#__PURE__*/function(t){var o,s;function c(e){var i;return i=t.call(this)||this,Object.defineProperty(r(i),K,{writable:!0,value:void 0}),Object.defineProperty(r(i),V,{writable:!0,value:void 0}),i.defaults=L,i.settings=n({},i.defaults,e),i.focusTrap=new b,i.store=function(t,e){function n(e){localStorage.setItem(t,JSON.stringify(e))}return void 0===e&&(e=!0),new Proxy((i=localStorage.getItem(t))?JSON.parse(i):{},{set:function(t,i,r){return t[i]=r,e&&n(t),!0},deleteProperty:function(t,i){return delete t[i],e&&n(t),!0}});var i}(i.settings.storeKey,i.settings.store),a(r(i),K)[K]=k.bind(r(i)),a(r(i),V)[V]=O.bind(r(i)),i.settings.autoInit&&i.init(),i}s=t,(o=c).prototype=Object.create(s.prototype),o.prototype.constructor=o,i(o,s);var l=c.prototype;return l.init=function(t){void 0===t&&(t=null);try{var e=this;t&&(e.settings=n({},e.settings,t));var i=document.querySelectorAll(e.settings.selectorDrawer);return Promise.resolve(e.registerCollection(i)).then(function(){return e.settings.eventListeners&&e.initEventListeners(),e})}catch(t){return Promise.reject(t)}},l.destroy=function(){try{var t=this;return Promise.resolve(t.deregisterCollection()).then(function(){return t.settings.eventListeners&&t.destroyEventListeners(),t})}catch(t){return Promise.reject(t)}},l.initEventListeners=function(){document.addEventListener("click",a(this,K)[K],!1),document.addEventListener("touchend",a(this,K)[K],!1),document.addEventListener("keydown",a(this,V)[V],!1)},l.destroyEventListeners=function(){document.removeEventListener("click",a(this,K)[K],!1),document.removeEventListener("touchend",a(this,K)[K],!1),document.removeEventListener("keydown",a(this,V)[V],!1)},l.register=function(t){var e=A.call(this,t);return e.error?Promise.reject(e.error):N.call(this,e.drawer,e.dialog)},l.deregister=function(t){var e=this.get(S.call(this,t));return C.call(this,e)},l.open=function(t,e,n){return D.call(this,t,e,n)},l.close=function(t,e,n){return F.call(this,t,e,n)},l.toggle=function(t,e,n){return _.call(this,t,e,n)},e(c,[{key:"activeModal",get:function(){return this.collection.find(function(t){return"opened"===t.state&&"modal"===t.mode})}}]),c}(f);export default J;
//# sourceMappingURL=scripts.esm.js.map

@@ -1,2 +0,2 @@

function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function e(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(){return(n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function r(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var o=0;function s(t){return"__private_"+o+++"_"+t}function a(t,e){if(!Object.prototype.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var c=/*#__PURE__*/s("handler"),l=/*#__PURE__*/function(){function t(t,e){Object.defineProperty(this,c,{writable:!0,value:void 0}),this.value=t,a(this,c)[c]=e,this.mql=null}var n=t.prototype;return n.mount=function(t,e){return t&&(this.value=t),e&&(a(this,c)[c]=e),this.value?(this.mql=window.matchMedia("(min-width: "+this.value+")"),"function"==typeof this.mql.addEventListener?this.mql.addEventListener("change",a(this,c)[c]):this.mql.addListener(a(this,c)[c]),a(this,c)[c](this.mql),this):this},n.unmount=function(){return this.mql?("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",a(this,c)[c]):this.mql.removeListener(a(this,c)[c]),this.value=null,a(this,c)[c]=null,this.mql=null,this):this},e(t,[{key:"handler",get:function(){return a(this,c)[c]},set:function(t){this.mql&&("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",a(this,c)[c]):this.mql.removeListener(a(this,c)[c])),a(this,c)[c]=t}}]),t}();function u(t,e,n){if(!t.s){if(n instanceof d){if(!n.s)return void(n.o=u.bind(null,t,e));1&e&&(e=n.s),n=n.v}if(n&&n.then)return void n.then(u.bind(null,t,e),u.bind(null,t,2));t.s=e,t.v=n;var i=t.o;i&&i(t)}}var d=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(e,n){var i=new t,r=this.s;if(r){var o=1&r?e:n;if(o){try{u(i,1,o(this.v))}catch(t){u(i,2,t)}return i}return this}return this.o=function(t){try{var r=t.v;1&t.s?u(i,1,e?e(r):r):n?u(i,1,n(r)):u(i,2,r)}catch(t){u(i,2,t)}},i},t}();function h(t){return t instanceof d&&1&t.s}var f=/*#__PURE__*/function(){function t(){this.collection=[]}var e=t.prototype;return e.register=function(t){try{var e=this;return Promise.resolve(e.deregister(t)).then(function(){return e.collection.push(t),e.collection})}catch(t){return Promise.reject(t)}},e.deregister=function(t){try{var e=this,n=e.collection.findIndex(function(e){return e===t});if(n>=0){var i=e.collection[n];Object.getOwnPropertyNames(i).forEach(function(t){delete i[t]}),e.collection.splice(n,1)}return Promise.resolve(e.collection)}catch(t){return Promise.reject(t)}},e.registerCollection=function(t){try{var e=this;return Promise.resolve(Promise.all(Array.from(t,function(t){e.register(t)}))).then(function(){return e.collection})}catch(t){return Promise.reject(t)}},e.deregisterCollection=function(){try{var t=function(){return e.collection},e=this,n=function(t,e,n){for(var i;;){var r=t();if(h(r)&&(r=r.v),!r)return o;if(r.then){i=0;break}var o=n();if(o&&o.then){if(!h(o)){i=1;break}o=o.s}}var s=new d,a=u.bind(null,s,2);return(0===i?r.then(l):1===i?o.then(c):(void 0).then(function(){(r=t())?r.then?r.then(l).then(void 0,a):l(r):u(s,1,o)})).then(void 0,a),s;function c(e){o=e;do{if(!(r=t())||h(r)&&!r.v)return void u(s,1,o);if(r.then)return void r.then(l).then(void 0,a);h(o=n())&&(o=o.v)}while(!o||!o.then);o.then(c).then(void 0,a)}function l(t){t?(o=n())&&o.then?o.then(c).then(void 0,a):c(o):u(s,1,o)}}(function(){return e.collection.length>0},0,function(){return Promise.resolve(e.deregister(e.collection[0])).then(function(){})});return Promise.resolve(n&&n.then?n.then(t):t())}catch(t){return Promise.reject(t)}},e.get=function(t,e){return void 0===e&&(e="id"),this.collection.find(function(n){return n[e]===t})},t}(),v=['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^="-"])'],g=/*#__PURE__*/s("focusable"),m=/*#__PURE__*/s("handleFocusTrap"),p=/*#__PURE__*/s("handleFocusLock"),b=/*#__PURE__*/function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e="[data-focus]"),Object.defineProperty(this,g,{writable:!0,value:void 0}),Object.defineProperty(this,m,{writable:!0,value:void 0}),Object.defineProperty(this,p,{writable:!0,value:void 0}),this.el=t,this.selectorFocus=e,a(this,m)[m]=y.bind(this),a(this,p)[p]=w.bind(this)}var n=t.prototype;return n.mount=function(t,e){t&&(this.el=t),e&&(this.selectorFocus=e),this.focusable=this.getFocusable(),this.focus()},n.unmount=function(){this.el=null,this.focusable=[],document.removeEventListener("keydown",a(this,m)[m]),document.removeEventListener("keydown",a(this,p)[p])},n.focus=function(t,e){void 0===t&&(t=this.el),void 0===e&&(e=this.selectorFocus),(t.querySelector(e)||t).focus()},n.getFocusable=function(t){void 0===t&&(t=this.el);var e=[],n=document.activeElement,i=t.scrollTop;return t.querySelectorAll(v.join(",")).forEach(function(t){t.focus(),document.activeElement===t&&e.push(t)}),t.scrollTop=i,n.focus(),e},e(t,[{key:"focusable",get:function(){return a(this,g)[g]},set:function(t){a(this,g)[g]=t,a(this,g)[g].length?(document.removeEventListener("keydown",a(this,p)[p]),document.addEventListener("keydown",a(this,m)[m])):(document.removeEventListener("keydown",a(this,m)[m]),document.addEventListener("keydown",a(this,p)[p]))}},{key:"focusableFirst",get:function(){return this.focusable[0]}},{key:"focusableLast",get:function(){return this.focusable[this.focusable.length-1]}}]),t}();function y(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 w(t){("Tab"===t.key||9===t.keyCode)&&t.preventDefault()}function P(t,e){var n=(t.getAttribute("data-"+e)||"").replace(/'/g,'"');return n?JSON.parse(n):{}}function E(t,e){var n,i;n=!!t,(i=e.selectorInert)&&document.querySelectorAll(i).forEach(function(t){n?(t.inert=!0,t.setAttribute("aria-hidden",!0)):(t.inert=null,t.removeAttribute("aria-hidden"))}),function(t,e){e&&document.querySelectorAll(e).forEach(function(e){t?e.style.overflow="hidden":e.style.removeProperty("overflow")})}(!!t,e.selectorOverflow)}var L={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 O(t){var e=this,n=t.target.closest("\n [data-"+this.settings.dataOpen+"],\n [data-"+this.settings.dataToggle+"],\n [data-"+this.settings.dataClose+"]\n ");n?(t.preventDefault(),n.matches("[data-"+this.settings.dataToggle+"]")&&n.getAttribute("data-"+this.settings.dataToggle).trim().split(" ").forEach(function(t){var i=e.get(t);i.trigger=n,i.toggle()}),n.matches("[data-"+this.settings.dataOpen+"]")&&n.getAttribute("data-"+this.settings.dataOpen).trim().split(" ").forEach(function(t){var i=e.get(t);i.trigger=n,i.open()}),n.matches("[data-"+this.settings.dataClose+"]")&&n.getAttribute("data-"+this.settings.dataClose).trim().split(" ").forEach(function(i){if(i){var r=e.get(i);r.trigger=n,r.close()}else{var o=t.target.closest(e.settings.selectorDrawer);o&&e.close(o)}})):t.target.matches(this.settings.selectorDrawer)&&this.close(t.target.id)}function k(t){if("Escape"===t.key){var e=this.activeModal;e&&this.close(e)}}var C=function(t,e){void 0===e&&(e=!0);try{var n=function(){return i.collection},i=this;if(!t)return Promise.resolve(i.collection);var r=i.collection.findIndex(function(e){return e.id===t.id}),o=function(){if(r>=0){var t=function(){delete i.store[n.id],n.unmountBreakpoint(),Object.getOwnPropertyNames(n).forEach(function(t){delete n[t]}),i.collection.splice(r,1)},n=i.collection[r],o=function(){if(e&&"opened"===n.state)return Promise.resolve(n.close(!1)).then(function(){})}();return o&&o.then?o.then(t):t()}}();return Promise.resolve(o&&o.then?o.then(n):n())}catch(t){return Promise.reject(t)}};function j(t){var e=function(){var t="--";return(t+=getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix"))+"breakpoint-"}(),n=t.getAttribute("data-"+this.settings.dataBreakpoint);return this.settings.breakpoints&&this.settings.breakpoints[n]?this.settings.breakpoints[n]:getComputedStyle(document.body).getPropertyValue(e+n)?getComputedStyle(document.body).getPropertyValue(e+n):n}function x(t){var 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 S(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 A(t){var e=S.call(this,t);if(e){var n=document.querySelector("#"+e),i=n?n.querySelector(this.settings.selectorDialog):null;return n||i?i?{drawer:n,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.")}}var q=function(t){try{var e=this,n=function(){if(e.store[t.id]){var n="opened"===e.store[t.id]?Promise.resolve(t.open(!1,!1)).then(function(){}):Promise.resolve(t.close(!1,!1)).then(function(){});if(n&&n.then)return n.then(function(){})}else t.el.classList.contains(e.settings.stateOpened)?t.state="opened":(t.el.classList.remove(e.settings.stateOpening),t.el.classList.remove(e.settings.stateClosing),t.el.classList.add(e.settings.stateClosed))}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(t){return Promise.reject(t)}};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())}var D=function(t,e,i){void 0===i&&(i=!0);try{var r=function(){return i&&T.call(o,s),s.el.dispatchEvent(new CustomEvent(a.customEventPrefix+"opened",{detail:o,bubbles:!0})),s},o=this,s=x.call(o,t),a=n({},o.settings,s.settings);void 0!==e&&(a.transition=e);var c=function(){if("closed"===s.state)return s.state="opening",Promise.resolve((t=s.el,e=a,new Promise(function(n){e.transition?(t.classList.remove(e.stateClosed),t.classList.add(e.stateOpening),t.addEventListener("transitionend",function i(){t.classList.add(e.stateOpened),t.classList.remove(e.stateOpening),n(t),this.removeEventListener("transitionend",i)})):(t.classList.add(e.stateOpened),t.classList.remove(e.stateClosed),n(t))}))).then(function(){"modal"===s.mode&&E(!0,a),s.state="opened"});var t,e}();return Promise.resolve(c&&c.then?c.then(r):r())}catch(t){return Promise.reject(t)}},F=function(t,e,i){void 0===i&&(i=!0);try{var r=this,o=x.call(r,t),s=n({},r.settings,o.settings);void 0!==e&&(s.transition=e);var a=function(){if("opened"===o.state)return o.state="closing",document.activeElement.blur(),Promise.resolve((t=o.el,e=s,new Promise(function(n){e.transition?(t.classList.add(e.stateClosing),t.classList.remove(e.stateOpened),t.addEventListener("transitionend",function i(){t.classList.remove(e.stateClosing),t.classList.add(e.stateClosed),n(t),this.removeEventListener("transitionend",i)})):(t.classList.add(e.stateClosed),t.classList.remove(e.stateOpened),n(t))}))).then(function(){"modal"===o.mode&&E(!1,s),i&&T.call(r,o),o.state="closed",o.el.dispatchEvent(new CustomEvent(s.customEventPrefix+"closed",{detail:r,bubbles:!0}))});var t,e}();return Promise.resolve(a&&a.then?a.then(function(){return o}):o)}catch(t){return Promise.reject(t)}},_=function(t,e,n){try{var i=this,r=x.call(i,t);return Promise.resolve("closed"===r.state?D.call(i,r,e,n):F.call(i,r,e,n))}catch(t){return Promise.reject(t)}},I=function(t){try{var e=this;return t.el.classList.add(t.getSetting("classModal")),t.dialog.setAttribute("aria-modal","true"),!e.store[t.id]&&t.el.classList.contains(t.getSetting("stateOpened"))&&(e.store[t.id]="opened"),Promise.resolve(F.call(e,t,!1,!1)).then(function(){return t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:e,bubbles:!0})),t})}catch(t){return Promise.reject(t)}},B=function(t){try{var e=this;return t.el.classList.remove(t.getSetting("classModal")),t.dialog.removeAttribute("aria-modal"),E(!1,n({},e.settings,t.settings)),e.focusTrap.unmount(),Promise.resolve(q.call(e,t)).then(function(){return t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:e,bubbles:!0})),t})}catch(t){return Promise.reject(t)}};function M(t){switch(t.mode){case"inline":return B.call(this,t);case"modal":return I.call(this,t);default:throw new Error('"'+t.mode+'" is not a valid drawer mode.')}}var N=function(t,e){try{var i=this;return Promise.resolve(C.call(i,t,!1)).then(function(){var r=i,o=new l,s={open:function(t,e){return D.call(r,this,t,e)},close:function(t,e){return F.call(r,this,t,e)},toggle:function(t,e){return _.call(r,this,t,e)},deregister:function(){return C.call(r,this)},mountBreakpoint:function(){var t=this.breakpoint,e=this.handleBreakpoint.bind(this);return o.mount(t,e),this},unmountBreakpoint:function(){return o.unmount(),this},handleBreakpoint:function(t){return this.mode=t.matches?"inline":"modal",this},getSetting:function(t){return t in this.settings?this.settings[t]:r.settings[t]}},a=n({id:t.id,el:t,dialog:e,trigger:null,settings:P(t,i.settings.dataConfig),get breakpoint(){return j.call(r,t)},get state(){return c},set state(t){c=t,"opened"!==t&&"closed"!==t||"inline"===this.mode&&(r.store[this.id]=this.state)},get mode(){return u},set mode(t){u=t,M.call(r,this)}},s),c=t.classList.contains(a.getSetting("stateOpened"))?"opened":"closed",u=t.classList.contains(a.getSetting("classModal"))?"modal":"inline";"modal"===a.mode?a.dialog.setAttribute("aria-modal","true"):a.dialog.removeAttribute("aria-modal"),a.getSetting("setTabindex")&&a.dialog.setAttribute("tabindex","-1"),i.collection.push(a);var d=function(){if(!a.breakpoint)return Promise.resolve(q.call(i,a)).then(function(){});a.mountBreakpoint()}();return d&&d.then?d.then(function(){return a}):a})}catch(t){return Promise.reject(t)}},K=/*#__PURE__*/s("handleClick"),V=/*#__PURE__*/s("handleKeydown");module.exports=/*#__PURE__*/function(t){var o,s;function c(e){var i;return i=t.call(this)||this,Object.defineProperty(r(i),K,{writable:!0,value:void 0}),Object.defineProperty(r(i),V,{writable:!0,value:void 0}),i.defaults=L,i.settings=n({},i.defaults,e),i.focusTrap=new b,i.store=function(t,e){function n(e){localStorage.setItem(t,JSON.stringify(e))}return void 0===e&&(e=!0),new Proxy((i=localStorage.getItem(t))?JSON.parse(i):{},{set:function(t,i,r){return t[i]=r,e&&n(t),!0},deleteProperty:function(t,i){return delete t[i],e&&n(t),!0}});var i}(i.settings.storeKey,i.settings.store),a(r(i),K)[K]=O.bind(r(i)),a(r(i),V)[V]=k.bind(r(i)),i.settings.autoInit&&i.init(),i}s=t,(o=c).prototype=Object.create(s.prototype),o.prototype.constructor=o,i(o,s);var l=c.prototype;return l.init=function(t){void 0===t&&(t=null);try{var e=this;t&&(e.settings=n({},e.settings,t));var i=document.querySelectorAll(e.settings.selectorDrawer);return Promise.resolve(e.registerCollection(i)).then(function(){return e.settings.eventListeners&&e.initEventListeners(),e})}catch(t){return Promise.reject(t)}},l.destroy=function(){try{var t=this;return Promise.resolve(t.deregisterCollection()).then(function(){return t.settings.eventListeners&&t.destroyEventListeners(),t})}catch(t){return Promise.reject(t)}},l.initEventListeners=function(){document.addEventListener("click",a(this,K)[K],!1),document.addEventListener("touchend",a(this,K)[K],!1),document.addEventListener("keydown",a(this,V)[V],!1)},l.destroyEventListeners=function(){document.removeEventListener("click",a(this,K)[K],!1),document.removeEventListener("touchend",a(this,K)[K],!1),document.removeEventListener("keydown",a(this,V)[V],!1)},l.register=function(t){var e=A.call(this,t);return e.error?Promise.reject(e.error):N.call(this,e.drawer,e.dialog)},l.deregister=function(t){var e=this.get(S.call(this,t));return C.call(this,e)},l.open=function(t,e,n){return D.call(this,t,e,n)},l.close=function(t,e,n){return F.call(this,t,e,n)},l.toggle=function(t,e,n){return _.call(this,t,e,n)},e(c,[{key:"activeModal",get:function(){return this.collection.find(function(t){return"opened"===t.state&&"modal"===t.mode})}}]),c}(f);
function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function e(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(){return(n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function r(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var o=0;function s(t){return"__private_"+o+++"_"+t}function a(t,e){if(!Object.prototype.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var c=/*#__PURE__*/s("handler"),l=/*#__PURE__*/function(){function t(t,e){Object.defineProperty(this,c,{writable:!0,value:void 0}),this.value=t,a(this,c)[c]=e,this.mql=null}var n=t.prototype;return n.mount=function(t,e){return t&&(this.value=t),e&&(a(this,c)[c]=e),this.value?(this.mql=window.matchMedia("(min-width: "+this.value+")"),"function"==typeof this.mql.addEventListener?this.mql.addEventListener("change",a(this,c)[c]):this.mql.addListener(a(this,c)[c]),a(this,c)[c](this.mql),this):this},n.unmount=function(){return this.mql?("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",a(this,c)[c]):this.mql.removeListener(a(this,c)[c]),this.value=null,a(this,c)[c]=null,this.mql=null,this):this},e(t,[{key:"handler",get:function(){return a(this,c)[c]},set:function(t){this.mql&&("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",a(this,c)[c]):this.mql.removeListener(a(this,c)[c])),a(this,c)[c]=t}}]),t}();function u(t,e,n){if(!t.s){if(n instanceof d){if(!n.s)return void(n.o=u.bind(null,t,e));1&e&&(e=n.s),n=n.v}if(n&&n.then)return void n.then(u.bind(null,t,e),u.bind(null,t,2));t.s=e,t.v=n;var i=t.o;i&&i(t)}}var d=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(e,n){var i=new t,r=this.s;if(r){var o=1&r?e:n;if(o){try{u(i,1,o(this.v))}catch(t){u(i,2,t)}return i}return this}return this.o=function(t){try{var r=t.v;1&t.s?u(i,1,e?e(r):r):n?u(i,1,n(r)):u(i,2,r)}catch(t){u(i,2,t)}},i},t}();function h(t){return t instanceof d&&1&t.s}var f=/*#__PURE__*/function(){function t(){this.collection=[]}var e=t.prototype;return e.register=function(t){try{var e=this;return Promise.resolve(e.deregister(t)).then(function(){return e.collection.push(t),e.collection})}catch(t){return Promise.reject(t)}},e.deregister=function(t){try{var e=this,n=e.collection.findIndex(function(e){return e===t});if(n>=0){var i=e.collection[n];Object.getOwnPropertyNames(i).forEach(function(t){delete i[t]}),e.collection.splice(n,1)}return Promise.resolve(e.collection)}catch(t){return Promise.reject(t)}},e.registerCollection=function(t){try{var e=this;return Promise.resolve(Promise.all(Array.from(t,function(t){e.register(t)}))).then(function(){return e.collection})}catch(t){return Promise.reject(t)}},e.deregisterCollection=function(){try{var t=function(){return e.collection},e=this,n=function(t,e,n){for(var i;;){var r=t();if(h(r)&&(r=r.v),!r)return o;if(r.then){i=0;break}var o=n();if(o&&o.then){if(!h(o)){i=1;break}o=o.s}}var s=new d,a=u.bind(null,s,2);return(0===i?r.then(l):1===i?o.then(c):(void 0).then(function(){(r=t())?r.then?r.then(l).then(void 0,a):l(r):u(s,1,o)})).then(void 0,a),s;function c(e){o=e;do{if(!(r=t())||h(r)&&!r.v)return void u(s,1,o);if(r.then)return void r.then(l).then(void 0,a);h(o=n())&&(o=o.v)}while(!o||!o.then);o.then(c).then(void 0,a)}function l(t){t?(o=n())&&o.then?o.then(c).then(void 0,a):c(o):u(s,1,o)}}(function(){return e.collection.length>0},0,function(){return Promise.resolve(e.deregister(e.collection[0])).then(function(){})});return Promise.resolve(n&&n.then?n.then(t):t())}catch(t){return Promise.reject(t)}},e.get=function(t,e){return void 0===e&&(e="id"),this.collection.find(function(n){return n[e]===t})},t}(),v=['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^="-"])'],g=/*#__PURE__*/s("focusable"),m=/*#__PURE__*/s("handleFocusTrap"),p=/*#__PURE__*/s("handleFocusLock"),b=/*#__PURE__*/function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e="[data-focus]"),Object.defineProperty(this,g,{writable:!0,value:void 0}),Object.defineProperty(this,m,{writable:!0,value:void 0}),Object.defineProperty(this,p,{writable:!0,value:void 0}),this.el=t,this.selectorFocus=e,a(this,m)[m]=y.bind(this),a(this,p)[p]=w.bind(this)}var n=t.prototype;return n.mount=function(t,e){t&&(this.el=t),e&&(this.selectorFocus=e),this.focusable=this.getFocusable(),this.focus()},n.unmount=function(){this.el=null,this.focusable=[],document.removeEventListener("keydown",a(this,m)[m]),document.removeEventListener("keydown",a(this,p)[p])},n.focus=function(t,e){void 0===t&&(t=this.el),void 0===e&&(e=this.selectorFocus),(t.querySelector(e)||t).focus()},n.getFocusable=function(t){void 0===t&&(t=this.el);var e=[],n=document.activeElement,i=t.scrollTop;return t.querySelectorAll(v.join(",")).forEach(function(t){t.focus(),document.activeElement===t&&e.push(t)}),t.scrollTop=i,n.focus(),e},e(t,[{key:"focusable",get:function(){return a(this,g)[g]},set:function(t){a(this,g)[g]=t,a(this,g)[g].length?(document.removeEventListener("keydown",a(this,p)[p]),document.addEventListener("keydown",a(this,m)[m])):(document.removeEventListener("keydown",a(this,m)[m]),document.addEventListener("keydown",a(this,p)[p]))}},{key:"focusableFirst",get:function(){return this.focusable[0]}},{key:"focusableLast",get:function(){return this.focusable[this.focusable.length-1]}}]),t}();function y(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 w(t){("Tab"===t.key||9===t.keyCode)&&t.preventDefault()}function P(t,e){var n=(t.getAttribute("data-"+e)||"").replace(/'/g,'"');return n?JSON.parse(n):{}}function E(t,e){var n,i;n=!!t,(i=e.selectorInert)&&document.querySelectorAll(i).forEach(function(t){n?(t.inert=!0,t.setAttribute("aria-hidden",!0)):(t.inert=null,t.removeAttribute("aria-hidden"))}),function(t,e){e&&document.querySelectorAll(e).forEach(function(e){t?e.style.overflow="hidden":e.style.removeProperty("overflow")})}(!!t,e.selectorOverflow)}var L={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){var e=this,n=t.target.closest("\n [data-"+this.settings.dataOpen+"],\n [data-"+this.settings.dataToggle+"],\n [data-"+this.settings.dataClose+"]\n ");n?(t.preventDefault(),n.matches("[data-"+this.settings.dataToggle+"]")&&n.getAttribute("data-"+this.settings.dataToggle).trim().split(" ").forEach(function(t){var i=e.get(t);i.trigger=n,i.toggle()}),n.matches("[data-"+this.settings.dataOpen+"]")&&n.getAttribute("data-"+this.settings.dataOpen).trim().split(" ").forEach(function(t){var i=e.get(t);i.trigger=n,i.open()}),n.matches("[data-"+this.settings.dataClose+"]")&&n.getAttribute("data-"+this.settings.dataClose).trim().split(" ").forEach(function(i){if(i){var r=e.get(i);r.trigger=n,r.close()}else{var o=t.target.closest(e.settings.selectorDrawer);o&&e.close(o)}})):t.target.matches(this.settings.selectorDrawer)&&this.close(t.target.id)}function O(t){if("Escape"===t.key){var e=this.activeModal;e&&this.close(e)}}var C=function(t,e){void 0===e&&(e=!0);try{var n=function(){return i.collection},i=this;if(!t)return Promise.resolve(i.collection);var r=i.collection.findIndex(function(e){return e.id===t.id}),o=function(){if(r>=0){var t=function(){delete i.store[n.id],n.unmountBreakpoint(),Object.getOwnPropertyNames(n).forEach(function(t){delete n[t]}),i.collection.splice(r,1)},n=i.collection[r],o=function(){if(e&&"opened"===n.state)return Promise.resolve(n.close(!1)).then(function(){})}();return o&&o.then?o.then(t):t()}}();return Promise.resolve(o&&o.then?o.then(n):n())}catch(t){return Promise.reject(t)}};function j(t){var e=getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim(),n=t.getAttribute("data-"+this.settings.dataBreakpoint);return this.settings.breakpoints&&this.settings.breakpoints[n]?this.settings.breakpoints[n]:getComputedStyle(document.body).getPropertyValue("--"+e+"breakpoint-"+n).trim()?getComputedStyle(document.body).getPropertyValue("--"+e+"breakpoint-"+n).trim():n}function x(t){var 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 S(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 A(t){var e=S.call(this,t);if(e){var n=document.querySelector("#"+e),i=n?n.querySelector(this.settings.selectorDialog):null;return n||i?i?{drawer:n,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.")}}var q=function(t){try{var e=this,n=function(){if(e.store[t.id]){var n="opened"===e.store[t.id]?Promise.resolve(t.open(!1,!1)).then(function(){}):Promise.resolve(t.close(!1,!1)).then(function(){});if(n&&n.then)return n.then(function(){})}else t.el.classList.contains(e.settings.stateOpened)?t.state="opened":(t.el.classList.remove(e.settings.stateOpening),t.el.classList.remove(e.settings.stateClosing),t.el.classList.add(e.settings.stateClosed))}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(t){return Promise.reject(t)}};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())}var D=function(t,e,i){void 0===i&&(i=!0);try{var r=function(){return i&&T.call(o,s),s.el.dispatchEvent(new CustomEvent(a.customEventPrefix+"opened",{detail:o,bubbles:!0})),s},o=this,s=x.call(o,t),a=n({},o.settings,s.settings);void 0!==e&&(a.transition=e);var c=function(){if("closed"===s.state)return s.state="opening",Promise.resolve((t=s.el,e=a,new Promise(function(n){e.transition?(t.classList.remove(e.stateClosed),t.classList.add(e.stateOpening),t.addEventListener("transitionend",function i(){t.classList.add(e.stateOpened),t.classList.remove(e.stateOpening),n(t),this.removeEventListener("transitionend",i)})):(t.classList.add(e.stateOpened),t.classList.remove(e.stateClosed),n(t))}))).then(function(){"modal"===s.mode&&E(!0,a),s.state="opened"});var t,e}();return Promise.resolve(c&&c.then?c.then(r):r())}catch(t){return Promise.reject(t)}},F=function(t,e,i){void 0===i&&(i=!0);try{var r=this,o=x.call(r,t),s=n({},r.settings,o.settings);void 0!==e&&(s.transition=e);var a=function(){if("opened"===o.state)return o.state="closing",document.activeElement.blur(),Promise.resolve((t=o.el,e=s,new Promise(function(n){e.transition?(t.classList.add(e.stateClosing),t.classList.remove(e.stateOpened),t.addEventListener("transitionend",function i(){t.classList.remove(e.stateClosing),t.classList.add(e.stateClosed),n(t),this.removeEventListener("transitionend",i)})):(t.classList.add(e.stateClosed),t.classList.remove(e.stateOpened),n(t))}))).then(function(){"modal"===o.mode&&E(!1,s),i&&T.call(r,o),o.state="closed",o.el.dispatchEvent(new CustomEvent(s.customEventPrefix+"closed",{detail:r,bubbles:!0}))});var t,e}();return Promise.resolve(a&&a.then?a.then(function(){return o}):o)}catch(t){return Promise.reject(t)}},_=function(t,e,n){try{var i=this,r=x.call(i,t);return Promise.resolve("closed"===r.state?D.call(i,r,e,n):F.call(i,r,e,n))}catch(t){return Promise.reject(t)}},I=function(t){try{var e=this;return t.el.classList.add(t.getSetting("classModal")),t.dialog.setAttribute("aria-modal","true"),!e.store[t.id]&&t.el.classList.contains(t.getSetting("stateOpened"))&&(e.store[t.id]="opened"),Promise.resolve(F.call(e,t,!1,!1)).then(function(){return t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:e,bubbles:!0})),t})}catch(t){return Promise.reject(t)}},B=function(t){try{var e=this;return t.el.classList.remove(t.getSetting("classModal")),t.dialog.removeAttribute("aria-modal"),E(!1,n({},e.settings,t.settings)),e.focusTrap.unmount(),Promise.resolve(q.call(e,t)).then(function(){return t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:e,bubbles:!0})),t})}catch(t){return Promise.reject(t)}};function M(t){switch(t.mode){case"inline":return B.call(this,t);case"modal":return I.call(this,t);default:throw new Error('"'+t.mode+'" is not a valid drawer mode.')}}var N=function(t,e){try{var i=this;return Promise.resolve(C.call(i,t,!1)).then(function(){var r=i,o=new l,s={open:function(t,e){return D.call(r,this,t,e)},close:function(t,e){return F.call(r,this,t,e)},toggle:function(t,e){return _.call(r,this,t,e)},deregister:function(){return C.call(r,this)},mountBreakpoint:function(){var t=this.breakpoint,e=this.handleBreakpoint.bind(this);return o.mount(t,e),this},unmountBreakpoint:function(){return o.unmount(),this},handleBreakpoint:function(t){return this.mode=t.matches?"inline":"modal",this},getSetting:function(t){return t in this.settings?this.settings[t]:r.settings[t]}},a=n({id:t.id,el:t,dialog:e,trigger:null,settings:P(t,i.settings.dataConfig),get breakpoint(){return j.call(r,t)},get state(){return c},set state(t){c=t,"opened"!==t&&"closed"!==t||"inline"===this.mode&&(r.store[this.id]=this.state)},get mode(){return u},set mode(t){u=t,M.call(r,this)}},s),c=t.classList.contains(a.getSetting("stateOpened"))?"opened":"closed",u=t.classList.contains(a.getSetting("classModal"))?"modal":"inline";"modal"===a.mode?a.dialog.setAttribute("aria-modal","true"):a.dialog.removeAttribute("aria-modal"),a.getSetting("setTabindex")&&a.dialog.setAttribute("tabindex","-1"),i.collection.push(a);var d=function(){if(!a.breakpoint)return Promise.resolve(q.call(i,a)).then(function(){});a.mountBreakpoint()}();return d&&d.then?d.then(function(){return a}):a})}catch(t){return Promise.reject(t)}},K=/*#__PURE__*/s("handleClick"),V=/*#__PURE__*/s("handleKeydown");module.exports=/*#__PURE__*/function(t){var o,s;function c(e){var i;return i=t.call(this)||this,Object.defineProperty(r(i),K,{writable:!0,value:void 0}),Object.defineProperty(r(i),V,{writable:!0,value:void 0}),i.defaults=L,i.settings=n({},i.defaults,e),i.focusTrap=new b,i.store=function(t,e){function n(e){localStorage.setItem(t,JSON.stringify(e))}return void 0===e&&(e=!0),new Proxy((i=localStorage.getItem(t))?JSON.parse(i):{},{set:function(t,i,r){return t[i]=r,e&&n(t),!0},deleteProperty:function(t,i){return delete t[i],e&&n(t),!0}});var i}(i.settings.storeKey,i.settings.store),a(r(i),K)[K]=k.bind(r(i)),a(r(i),V)[V]=O.bind(r(i)),i.settings.autoInit&&i.init(),i}s=t,(o=c).prototype=Object.create(s.prototype),o.prototype.constructor=o,i(o,s);var l=c.prototype;return l.init=function(t){void 0===t&&(t=null);try{var e=this;t&&(e.settings=n({},e.settings,t));var i=document.querySelectorAll(e.settings.selectorDrawer);return Promise.resolve(e.registerCollection(i)).then(function(){return e.settings.eventListeners&&e.initEventListeners(),e})}catch(t){return Promise.reject(t)}},l.destroy=function(){try{var t=this;return Promise.resolve(t.deregisterCollection()).then(function(){return t.settings.eventListeners&&t.destroyEventListeners(),t})}catch(t){return Promise.reject(t)}},l.initEventListeners=function(){document.addEventListener("click",a(this,K)[K],!1),document.addEventListener("touchend",a(this,K)[K],!1),document.addEventListener("keydown",a(this,V)[V],!1)},l.destroyEventListeners=function(){document.removeEventListener("click",a(this,K)[K],!1),document.removeEventListener("touchend",a(this,K)[K],!1),document.removeEventListener("keydown",a(this,V)[V],!1)},l.register=function(t){var e=A.call(this,t);return e.error?Promise.reject(e.error):N.call(this,e.drawer,e.dialog)},l.deregister=function(t){var e=this.get(S.call(this,t));return C.call(this,e)},l.open=function(t,e,n){return D.call(this,t,e,n)},l.close=function(t,e,n){return F.call(this,t,e,n)},l.toggle=function(t,e,n){return _.call(this,t,e,n)},e(c,[{key:"activeModal",get:function(){return this.collection.find(function(t){return"opened"===t.state&&"modal"===t.mode})}}]),c}(f);
//# sourceMappingURL=scripts.js.map

@@ -1,2 +0,2 @@

function t(){return(t=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(t[i]=s[i])}return t}).apply(this,arguments)}var e=0;function s(t){return"__private_"+e+++"_"+t}function i(t,e){if(!Object.prototype.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var n=/*#__PURE__*/s("handler");class o{constructor(t,e){Object.defineProperty(this,n,{writable:!0,value:void 0}),this.value=t,i(this,n)[n]=e,this.mql=null}get handler(){return i(this,n)[n]}set handler(t){this.mql&&("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",i(this,n)[n]):this.mql.removeListener(i(this,n)[n])),i(this,n)[n]=t}mount(t,e){return t&&(this.value=t),e&&(i(this,n)[n]=e),this.value?(this.mql=window.matchMedia(`(min-width: ${this.value})`),"function"==typeof this.mql.addEventListener?this.mql.addEventListener("change",i(this,n)[n]):this.mql.addListener(i(this,n)[n]),i(this,n)[n](this.mql),this):this}unmount(){return this.mql?("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",i(this,n)[n]):this.mql.removeListener(i(this,n)[n]),this.value=null,i(this,n)[n]=null,this.mql=null,this):this}}var r=['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^="-"])'],a=/*#__PURE__*/s("focusable"),l=/*#__PURE__*/s("handleFocusTrap"),c=/*#__PURE__*/s("handleFocusLock");class d{constructor(t=null,e="[data-focus]"){Object.defineProperty(this,a,{writable:!0,value:void 0}),Object.defineProperty(this,l,{writable:!0,value:void 0}),Object.defineProperty(this,c,{writable:!0,value:void 0}),this.el=t,this.selectorFocus=e,i(this,l)[l]=h.bind(this),i(this,c)[c]=u.bind(this)}get focusable(){return i(this,a)[a]}set focusable(t){i(this,a)[a]=t,i(this,a)[a].length?(document.removeEventListener("keydown",i(this,c)[c]),document.addEventListener("keydown",i(this,l)[l])):(document.removeEventListener("keydown",i(this,l)[l]),document.addEventListener("keydown",i(this,c)[c]))}get focusableFirst(){return this.focusable[0]}get focusableLast(){return this.focusable[this.focusable.length-1]}mount(t,e){t&&(this.el=t),e&&(this.selectorFocus=e),this.focusable=this.getFocusable(),this.focus()}unmount(){this.el=null,this.focusable=[],document.removeEventListener("keydown",i(this,l)[l]),document.removeEventListener("keydown",i(this,c)[c])}focus(t=this.el,e=this.selectorFocus){(t.querySelector(e)||t).focus()}getFocusable(t=this.el){const e=[],s=document.activeElement,i=t.scrollTop;return t.querySelectorAll(r.join(",")).forEach(t=>{t.focus(),document.activeElement===t&&e.push(t)}),t.scrollTop=i,s.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 u(t){("Tab"===t.key||9===t.keyCode)&&t.preventDefault()}function g(t,e){const s=(t.getAttribute(`data-${e}`)||"").replace(/'/g,'"');return s?JSON.parse(s):{}}const m=(t,e)=>new Promise(s=>{e.transition?(t.classList.remove(e.stateClosed),t.classList.add(e.stateOpening),t.addEventListener("transitionend",function i(){t.classList.add(e.stateOpened),t.classList.remove(e.stateOpening),s(t),this.removeEventListener("transitionend",i)})):(t.classList.add(e.stateOpened),t.classList.remove(e.stateClosed),s(t))}),f=(t,e)=>new Promise(s=>{e.transition?(t.classList.add(e.stateClosing),t.classList.remove(e.stateOpened),t.addEventListener("transitionend",function i(){t.classList.remove(e.stateClosing),t.classList.add(e.stateClosed),s(t),this.removeEventListener("transitionend",i)})):(t.classList.add(e.stateClosed),t.classList.remove(e.stateOpened),s(t))});function p(t,e){var s,i;s=!!t,(i=e.selectorInert)&&document.querySelectorAll(i).forEach(t=>{s?(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 v={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 b(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 s=this.get(t);s.trigger=e,s.toggle()}),e.matches(`[data-${this.settings.dataOpen}]`)&&e.getAttribute(`data-${this.settings.dataOpen}`).trim().split(" ").forEach(t=>{const s=this.get(t);s.trigger=e,s.open()}),e.matches(`[data-${this.settings.dataClose}]`)&&e.getAttribute(`data-${this.settings.dataClose}`).trim().split(" ").forEach(s=>{if(s){const t=this.get(s);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 w(t){if("Escape"===t.key){const t=this.activeModal;t&&this.close(t)}}async function y(t,e=!0){if(!t)return this.collection;const s=this.collection.findIndex(e=>e.id===t.id);if(s>=0){const t=this.collection[s];e&&"opened"===t.state&&await t.close(!1),delete this.store[t.id],t.unmountBreakpoint(),Object.getOwnPropertyNames(t).forEach(e=>{delete t[e]}),this.collection.splice(s,1)}return this.collection}function E(t){const e=function(){let t="--";return t+=getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix"),t+="breakpoint-",t}(),s=t.getAttribute(`data-${this.settings.dataBreakpoint}`);return this.settings.breakpoints&&this.settings.breakpoints[s]?this.settings.breakpoints[s]:getComputedStyle(document.body).getPropertyValue(e+s)?getComputedStyle(document.body).getPropertyValue(e+s):s}function L(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 O(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 k(t){const e=O.call(this,t);if(e){const t=document.querySelector(`#${e}`),s=t?t.querySelector(this.settings.selectorDialog):null;return t||s?s?{drawer:t,dialog:s}:{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 C(t){this.store[t.id]?"opened"===this.store[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 x(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 P(e,s,i=!0){const n=L.call(this,e),o=t({},this.settings,n.settings);return void 0!==s&&(o.transition=s),"closed"===n.state&&(n.state="opening",await m(n.el,o),"modal"===n.mode&&p(!0,o),n.state="opened"),i&&x.call(this,n),n.el.dispatchEvent(new CustomEvent(o.customEventPrefix+"opened",{detail:this,bubbles:!0})),n}async function S(e,s,i=!0){const n=L.call(this,e),o=t({},this.settings,n.settings);return void 0!==s&&(o.transition=s),"opened"===n.state&&(n.state="closing",document.activeElement.blur(),await f(n.el,o),"modal"===n.mode&&p(!1,o),i&&x.call(this,n),n.state="closed",n.el.dispatchEvent(new CustomEvent(o.customEventPrefix+"closed",{detail:this,bubbles:!0}))),n}async function A(t,e,s){const i=L.call(this,t);return"closed"===i.state?P.call(this,i,e,s):S.call(this,i,e,s)}function q(t){switch(t.mode){case"inline":return $.call(this,t);case"modal":return T.call(this,t);default:throw new Error(`"${t.mode}" is not a valid drawer mode.`)}}async function $(e){return e.el.classList.remove(e.getSetting("classModal")),e.dialog.removeAttribute("aria-modal"),p(!1,t({},this.settings,e.settings)),this.focusTrap.unmount(),await C.call(this,e),e.el.dispatchEvent(new CustomEvent(e.getSetting("customEventPrefix")+"switchMode",{detail:this,bubbles:!0})),e}async function T(t){return t.el.classList.add(t.getSetting("classModal")),t.dialog.setAttribute("aria-modal","true"),!this.store[t.id]&&t.el.classList.contains(t.getSetting("stateOpened"))&&(this.store[t.id]="opened"),await S.call(this,t,!1,!1),t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:this,bubbles:!0})),t}async function D(e,s){await y.call(this,e,!1);const i=this,n=new o,r={open(t,e){return P.call(i,this,t,e)},close(t,e){return S.call(i,this,t,e)},toggle(t,e){return A.call(i,this,t,e)},deregister(){return y.call(i,this)},mountBreakpoint(){const t=this.breakpoint,e=this.handleBreakpoint.bind(this);return n.mount(t,e),this},unmountBreakpoint(){return n.unmount(),this},handleBreakpoint(t){return this.mode=t.matches?"inline":"modal",this},getSetting(t){return t in this.settings?this.settings[t]:i.settings[t]}},a=t({id:e.id,el:e,dialog:s,trigger:null,settings:g(e,this.settings.dataConfig),get breakpoint(){return E.call(i,e)},get state(){return l},set state(t){l=t,"opened"!==t&&"closed"!==t||"inline"===this.mode&&(i.store[this.id]=this.state)},get mode(){return c},set mode(t){c=t,q.call(i,this)}},r);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 C.call(this,a),a}var j=/*#__PURE__*/s("handleClick"),F=/*#__PURE__*/s("handleKeydown");export default class extends class{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(s=>s[e]===t)}}{constructor(e){super(),Object.defineProperty(this,j,{writable:!0,value:void 0}),Object.defineProperty(this,F,{writable:!0,value:void 0}),this.defaults=v,this.settings=t({},this.defaults,e),this.focusTrap=new d,this.store=function(t,e=!0){function s(e){localStorage.setItem(t,JSON.stringify(e))}return new Proxy(function(){const e=localStorage.getItem(t);return e?JSON.parse(e):{}}(),{set:(t,i,n)=>(t[i]=n,e&&s(t),!0),deleteProperty:(t,i)=>(delete t[i],e&&s(t),!0)})}(this.settings.storeKey,this.settings.store),i(this,j)[j]=b.bind(this),i(this,F)[F]=w.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 s=document.querySelectorAll(this.settings.selectorDrawer);return await this.registerCollection(s),this.settings.eventListeners&&this.initEventListeners(),this}async destroy(){return await this.deregisterCollection(),this.settings.eventListeners&&this.destroyEventListeners(),this}initEventListeners(){document.addEventListener("click",i(this,j)[j],!1),document.addEventListener("touchend",i(this,j)[j],!1),document.addEventListener("keydown",i(this,F)[F],!1)}destroyEventListeners(){document.removeEventListener("click",i(this,j)[j],!1),document.removeEventListener("touchend",i(this,j)[j],!1),document.removeEventListener("keydown",i(this,F)[F],!1)}register(t){const e=k.call(this,t);return e.error?Promise.reject(e.error):D.call(this,e.drawer,e.dialog)}deregister(t){const e=this.get(O.call(this,t));return y.call(this,e)}open(t,e,s){return P.call(this,t,e,s)}close(t,e,s){return S.call(this,t,e,s)}toggle(t,e,s){return A.call(this,t,e,s)}}
function t(){return(t=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(t[i]=s[i])}return t}).apply(this,arguments)}var e=0;function s(t){return"__private_"+e+++"_"+t}function i(t,e){if(!Object.prototype.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var n=/*#__PURE__*/s("handler");class o{constructor(t,e){Object.defineProperty(this,n,{writable:!0,value:void 0}),this.value=t,i(this,n)[n]=e,this.mql=null}get handler(){return i(this,n)[n]}set handler(t){this.mql&&("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",i(this,n)[n]):this.mql.removeListener(i(this,n)[n])),i(this,n)[n]=t}mount(t,e){return t&&(this.value=t),e&&(i(this,n)[n]=e),this.value?(this.mql=window.matchMedia(`(min-width: ${this.value})`),"function"==typeof this.mql.addEventListener?this.mql.addEventListener("change",i(this,n)[n]):this.mql.addListener(i(this,n)[n]),i(this,n)[n](this.mql),this):this}unmount(){return this.mql?("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",i(this,n)[n]):this.mql.removeListener(i(this,n)[n]),this.value=null,i(this,n)[n]=null,this.mql=null,this):this}}var r=['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^="-"])'],a=/*#__PURE__*/s("focusable"),l=/*#__PURE__*/s("handleFocusTrap"),c=/*#__PURE__*/s("handleFocusLock");class d{constructor(t=null,e="[data-focus]"){Object.defineProperty(this,a,{writable:!0,value:void 0}),Object.defineProperty(this,l,{writable:!0,value:void 0}),Object.defineProperty(this,c,{writable:!0,value:void 0}),this.el=t,this.selectorFocus=e,i(this,l)[l]=h.bind(this),i(this,c)[c]=u.bind(this)}get focusable(){return i(this,a)[a]}set focusable(t){i(this,a)[a]=t,i(this,a)[a].length?(document.removeEventListener("keydown",i(this,c)[c]),document.addEventListener("keydown",i(this,l)[l])):(document.removeEventListener("keydown",i(this,l)[l]),document.addEventListener("keydown",i(this,c)[c]))}get focusableFirst(){return this.focusable[0]}get focusableLast(){return this.focusable[this.focusable.length-1]}mount(t,e){t&&(this.el=t),e&&(this.selectorFocus=e),this.focusable=this.getFocusable(),this.focus()}unmount(){this.el=null,this.focusable=[],document.removeEventListener("keydown",i(this,l)[l]),document.removeEventListener("keydown",i(this,c)[c])}focus(t=this.el,e=this.selectorFocus){(t.querySelector(e)||t).focus()}getFocusable(t=this.el){const e=[],s=document.activeElement,i=t.scrollTop;return t.querySelectorAll(r.join(",")).forEach(t=>{t.focus(),document.activeElement===t&&e.push(t)}),t.scrollTop=i,s.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 u(t){("Tab"===t.key||9===t.keyCode)&&t.preventDefault()}function g(t,e){const s=(t.getAttribute(`data-${e}`)||"").replace(/'/g,'"');return s?JSON.parse(s):{}}const m=(t,e)=>new Promise(s=>{e.transition?(t.classList.remove(e.stateClosed),t.classList.add(e.stateOpening),t.addEventListener("transitionend",function i(){t.classList.add(e.stateOpened),t.classList.remove(e.stateOpening),s(t),this.removeEventListener("transitionend",i)})):(t.classList.add(e.stateOpened),t.classList.remove(e.stateClosed),s(t))}),f=(t,e)=>new Promise(s=>{e.transition?(t.classList.add(e.stateClosing),t.classList.remove(e.stateOpened),t.addEventListener("transitionend",function i(){t.classList.remove(e.stateClosing),t.classList.add(e.stateClosed),s(t),this.removeEventListener("transitionend",i)})):(t.classList.add(e.stateClosed),t.classList.remove(e.stateOpened),s(t))});function p(t,e){var s,i;s=!!t,(i=e.selectorInert)&&document.querySelectorAll(i).forEach(t=>{s?(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 v={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 b(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 s=this.get(t);s.trigger=e,s.toggle()}),e.matches(`[data-${this.settings.dataOpen}]`)&&e.getAttribute(`data-${this.settings.dataOpen}`).trim().split(" ").forEach(t=>{const s=this.get(t);s.trigger=e,s.open()}),e.matches(`[data-${this.settings.dataClose}]`)&&e.getAttribute(`data-${this.settings.dataClose}`).trim().split(" ").forEach(s=>{if(s){const t=this.get(s);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 w(t){if("Escape"===t.key){const t=this.activeModal;t&&this.close(t)}}async function y(t,e=!0){if(!t)return this.collection;const s=this.collection.findIndex(e=>e.id===t.id);if(s>=0){const t=this.collection[s];e&&"opened"===t.state&&await t.close(!1),delete this.store[t.id],t.unmountBreakpoint(),Object.getOwnPropertyNames(t).forEach(e=>{delete t[e]}),this.collection.splice(s,1)}return this.collection}function E(t){const e=getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim(),s=t.getAttribute(`data-${this.settings.dataBreakpoint}`);return this.settings.breakpoints&&this.settings.breakpoints[s]?this.settings.breakpoints[s]:getComputedStyle(document.body).getPropertyValue(`--${e}breakpoint-${s}`).trim()?getComputedStyle(document.body).getPropertyValue(`--${e}breakpoint-${s}`).trim():s}function L(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 O(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 k(t){const e=O.call(this,t);if(e){const t=document.querySelector(`#${e}`),s=t?t.querySelector(this.settings.selectorDialog):null;return t||s?s?{drawer:t,dialog:s}:{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 C(t){this.store[t.id]?"opened"===this.store[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 x(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,s,i=!0){const n=L.call(this,e),o=t({},this.settings,n.settings);return void 0!==s&&(o.transition=s),"closed"===n.state&&(n.state="opening",await m(n.el,o),"modal"===n.mode&&p(!0,o),n.state="opened"),i&&x.call(this,n),n.el.dispatchEvent(new CustomEvent(o.customEventPrefix+"opened",{detail:this,bubbles:!0})),n}async function P(e,s,i=!0){const n=L.call(this,e),o=t({},this.settings,n.settings);return void 0!==s&&(o.transition=s),"opened"===n.state&&(n.state="closing",document.activeElement.blur(),await f(n.el,o),"modal"===n.mode&&p(!1,o),i&&x.call(this,n),n.state="closed",n.el.dispatchEvent(new CustomEvent(o.customEventPrefix+"closed",{detail:this,bubbles:!0}))),n}async function S(t,e,s){const i=L.call(this,t);return"closed"===i.state?$.call(this,i,e,s):P.call(this,i,e,s)}function A(t){switch(t.mode){case"inline":return q.call(this,t);case"modal":return T.call(this,t);default:throw new Error(`"${t.mode}" is not a valid drawer mode.`)}}async function q(e){return e.el.classList.remove(e.getSetting("classModal")),e.dialog.removeAttribute("aria-modal"),p(!1,t({},this.settings,e.settings)),this.focusTrap.unmount(),await C.call(this,e),e.el.dispatchEvent(new CustomEvent(e.getSetting("customEventPrefix")+"switchMode",{detail:this,bubbles:!0})),e}async function T(t){return t.el.classList.add(t.getSetting("classModal")),t.dialog.setAttribute("aria-modal","true"),!this.store[t.id]&&t.el.classList.contains(t.getSetting("stateOpened"))&&(this.store[t.id]="opened"),await P.call(this,t,!1,!1),t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:this,bubbles:!0})),t}async function D(e,s){await y.call(this,e,!1);const i=this,n=new o,r={open(t,e){return $.call(i,this,t,e)},close(t,e){return P.call(i,this,t,e)},toggle(t,e){return S.call(i,this,t,e)},deregister(){return y.call(i,this)},mountBreakpoint(){const t=this.breakpoint,e=this.handleBreakpoint.bind(this);return n.mount(t,e),this},unmountBreakpoint(){return n.unmount(),this},handleBreakpoint(t){return this.mode=t.matches?"inline":"modal",this},getSetting(t){return t in this.settings?this.settings[t]:i.settings[t]}},a=t({id:e.id,el:e,dialog:s,trigger:null,settings:g(e,this.settings.dataConfig),get breakpoint(){return E.call(i,e)},get state(){return l},set state(t){l=t,"opened"!==t&&"closed"!==t||"inline"===this.mode&&(i.store[this.id]=this.state)},get mode(){return c},set mode(t){c=t,A.call(i,this)}},r);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 C.call(this,a),a}var j=/*#__PURE__*/s("handleClick"),F=/*#__PURE__*/s("handleKeydown");export default class extends class{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(s=>s[e]===t)}}{constructor(e){super(),Object.defineProperty(this,j,{writable:!0,value:void 0}),Object.defineProperty(this,F,{writable:!0,value:void 0}),this.defaults=v,this.settings=t({},this.defaults,e),this.focusTrap=new d,this.store=function(t,e=!0){function s(e){localStorage.setItem(t,JSON.stringify(e))}return new Proxy(function(){const e=localStorage.getItem(t);return e?JSON.parse(e):{}}(),{set:(t,i,n)=>(t[i]=n,e&&s(t),!0),deleteProperty:(t,i)=>(delete t[i],e&&s(t),!0)})}(this.settings.storeKey,this.settings.store),i(this,j)[j]=b.bind(this),i(this,F)[F]=w.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 s=document.querySelectorAll(this.settings.selectorDrawer);return await this.registerCollection(s),this.settings.eventListeners&&this.initEventListeners(),this}async destroy(){return await this.deregisterCollection(),this.settings.eventListeners&&this.destroyEventListeners(),this}initEventListeners(){document.addEventListener("click",i(this,j)[j],!1),document.addEventListener("touchend",i(this,j)[j],!1),document.addEventListener("keydown",i(this,F)[F],!1)}destroyEventListeners(){document.removeEventListener("click",i(this,j)[j],!1),document.removeEventListener("touchend",i(this,j)[j],!1),document.removeEventListener("keydown",i(this,F)[F],!1)}register(t){const e=k.call(this,t);return e.error?Promise.reject(e.error):D.call(this,e.drawer,e.dialog)}deregister(t){const e=this.get(O.call(this,t));return y.call(this,e)}open(t,e,s){return $.call(this,t,e,s)}close(t,e,s){return P.call(this,t,e,s)}toggle(t,e,s){return S.call(this,t,e,s)}}
//# sourceMappingURL=scripts.modern.js.map

@@ -1,3 +0,3 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):((t||self).vrembem=t.vrembem||{},t.vrembem.Drawer=e())}(this,function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function e(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(){return(n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function r(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var o=0;function s(t){return"__private_"+o+++"_"+t}function a(t,e){if(!Object.prototype.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var c=/*#__PURE__*/s("handler"),l=/*#__PURE__*/function(){function t(t,e){Object.defineProperty(this,c,{writable:!0,value:void 0}),this.value=t,a(this,c)[c]=e,this.mql=null}var n=t.prototype;return n.mount=function(t,e){return t&&(this.value=t),e&&(a(this,c)[c]=e),this.value?(this.mql=window.matchMedia("(min-width: "+this.value+")"),"function"==typeof this.mql.addEventListener?this.mql.addEventListener("change",a(this,c)[c]):this.mql.addListener(a(this,c)[c]),a(this,c)[c](this.mql),this):this},n.unmount=function(){return this.mql?("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",a(this,c)[c]):this.mql.removeListener(a(this,c)[c]),this.value=null,a(this,c)[c]=null,this.mql=null,this):this},e(t,[{key:"handler",get:function(){return a(this,c)[c]},set:function(t){this.mql&&("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",a(this,c)[c]):this.mql.removeListener(a(this,c)[c])),a(this,c)[c]=t}}]),t}();function u(t,e,n){if(!t.s){if(n instanceof d){if(!n.s)return void(n.o=u.bind(null,t,e));1&e&&(e=n.s),n=n.v}if(n&&n.then)return void n.then(u.bind(null,t,e),u.bind(null,t,2));t.s=e,t.v=n;var i=t.o;i&&i(t)}}var d=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(e,n){var i=new t,r=this.s;if(r){var o=1&r?e:n;if(o){try{u(i,1,o(this.v))}catch(t){u(i,2,t)}return i}return this}return this.o=function(t){try{var r=t.v;1&t.s?u(i,1,e?e(r):r):n?u(i,1,n(r)):u(i,2,r)}catch(t){u(i,2,t)}},i},t}();function h(t){return t instanceof d&&1&t.s}var f=/*#__PURE__*/function(){function t(){this.collection=[]}var e=t.prototype;return e.register=function(t){try{var e=this;return Promise.resolve(e.deregister(t)).then(function(){return e.collection.push(t),e.collection})}catch(t){return Promise.reject(t)}},e.deregister=function(t){try{var e=this,n=e.collection.findIndex(function(e){return e===t});if(n>=0){var i=e.collection[n];Object.getOwnPropertyNames(i).forEach(function(t){delete i[t]}),e.collection.splice(n,1)}return Promise.resolve(e.collection)}catch(t){return Promise.reject(t)}},e.registerCollection=function(t){try{var e=this;return Promise.resolve(Promise.all(Array.from(t,function(t){e.register(t)}))).then(function(){return e.collection})}catch(t){return Promise.reject(t)}},e.deregisterCollection=function(){try{var t=function(){return e.collection},e=this,n=function(t,e,n){for(var i;;){var r=t();if(h(r)&&(r=r.v),!r)return o;if(r.then){i=0;break}var o=n();if(o&&o.then){if(!h(o)){i=1;break}o=o.s}}var s=new d,a=u.bind(null,s,2);return(0===i?r.then(l):1===i?o.then(c):(void 0).then(function(){(r=t())?r.then?r.then(l).then(void 0,a):l(r):u(s,1,o)})).then(void 0,a),s;function c(e){o=e;do{if(!(r=t())||h(r)&&!r.v)return void u(s,1,o);if(r.then)return void r.then(l).then(void 0,a);h(o=n())&&(o=o.v)}while(!o||!o.then);o.then(c).then(void 0,a)}function l(t){t?(o=n())&&o.then?o.then(c).then(void 0,a):c(o):u(s,1,o)}}(function(){return e.collection.length>0},0,function(){return Promise.resolve(e.deregister(e.collection[0])).then(function(){})});return Promise.resolve(n&&n.then?n.then(t):t())}catch(t){return Promise.reject(t)}},e.get=function(t,e){return void 0===e&&(e="id"),this.collection.find(function(n){return n[e]===t})},t}(),v=['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^="-"])'],g=/*#__PURE__*/s("focusable"),m=/*#__PURE__*/s("handleFocusTrap"),p=/*#__PURE__*/s("handleFocusLock"),b=/*#__PURE__*/function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e="[data-focus]"),Object.defineProperty(this,g,{writable:!0,value:void 0}),Object.defineProperty(this,m,{writable:!0,value:void 0}),Object.defineProperty(this,p,{writable:!0,value:void 0}),this.el=t,this.selectorFocus=e,a(this,m)[m]=y.bind(this),a(this,p)[p]=w.bind(this)}var n=t.prototype;return n.mount=function(t,e){t&&(this.el=t),e&&(this.selectorFocus=e),this.focusable=this.getFocusable(),this.focus()},n.unmount=function(){this.el=null,this.focusable=[],document.removeEventListener("keydown",a(this,m)[m]),document.removeEventListener("keydown",a(this,p)[p])},n.focus=function(t,e){void 0===t&&(t=this.el),void 0===e&&(e=this.selectorFocus),(t.querySelector(e)||t).focus()},n.getFocusable=function(t){void 0===t&&(t=this.el);var e=[],n=document.activeElement,i=t.scrollTop;return t.querySelectorAll(v.join(",")).forEach(function(t){t.focus(),document.activeElement===t&&e.push(t)}),t.scrollTop=i,n.focus(),e},e(t,[{key:"focusable",get:function(){return a(this,g)[g]},set:function(t){a(this,g)[g]=t,a(this,g)[g].length?(document.removeEventListener("keydown",a(this,p)[p]),document.addEventListener("keydown",a(this,m)[m])):(document.removeEventListener("keydown",a(this,m)[m]),document.addEventListener("keydown",a(this,p)[p]))}},{key:"focusableFirst",get:function(){return this.focusable[0]}},{key:"focusableLast",get:function(){return this.focusable[this.focusable.length-1]}}]),t}();function y(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 w(t){("Tab"===t.key||9===t.keyCode)&&t.preventDefault()}function P(t,e){var n=(t.getAttribute("data-"+e)||"").replace(/'/g,'"');return n?JSON.parse(n):{}}function E(t,e){var n,i;n=!!t,(i=e.selectorInert)&&document.querySelectorAll(i).forEach(function(t){n?(t.inert=!0,t.setAttribute("aria-hidden",!0)):(t.inert=null,t.removeAttribute("aria-hidden"))}),function(t,e){e&&document.querySelectorAll(e).forEach(function(e){t?e.style.overflow="hidden":e.style.removeProperty("overflow")})}(!!t,e.selectorOverflow)}var L={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 O(t){var e=this,n=t.target.closest("\n [data-"+this.settings.dataOpen+"],\n [data-"+this.settings.dataToggle+"],\n [data-"+this.settings.dataClose+"]\n ");n?(t.preventDefault(),n.matches("[data-"+this.settings.dataToggle+"]")&&n.getAttribute("data-"+this.settings.dataToggle).trim().split(" ").forEach(function(t){var i=e.get(t);i.trigger=n,i.toggle()}),n.matches("[data-"+this.settings.dataOpen+"]")&&n.getAttribute("data-"+this.settings.dataOpen).trim().split(" ").forEach(function(t){var i=e.get(t);i.trigger=n,i.open()}),n.matches("[data-"+this.settings.dataClose+"]")&&n.getAttribute("data-"+this.settings.dataClose).trim().split(" ").forEach(function(i){if(i){var r=e.get(i);r.trigger=n,r.close()}else{var o=t.target.closest(e.settings.selectorDrawer);o&&e.close(o)}})):t.target.matches(this.settings.selectorDrawer)&&this.close(t.target.id)}function k(t){if("Escape"===t.key){var e=this.activeModal;e&&this.close(e)}}var C=function(t,e){void 0===e&&(e=!0);try{var n=function(){return i.collection},i=this;if(!t)return Promise.resolve(i.collection);var r=i.collection.findIndex(function(e){return e.id===t.id}),o=function(){if(r>=0){var t=function(){delete i.store[n.id],n.unmountBreakpoint(),Object.getOwnPropertyNames(n).forEach(function(t){delete n[t]}),i.collection.splice(r,1)},n=i.collection[r],o=function(){if(e&&"opened"===n.state)return Promise.resolve(n.close(!1)).then(function(){})}();return o&&o.then?o.then(t):t()}}();return Promise.resolve(o&&o.then?o.then(n):n())}catch(t){return Promise.reject(t)}};function j(t){var e=function(){var t="--";return(t+=getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix"))+"breakpoint-"}(),n=t.getAttribute("data-"+this.settings.dataBreakpoint);return this.settings.breakpoints&&this.settings.breakpoints[n]?this.settings.breakpoints[n]:getComputedStyle(document.body).getPropertyValue(e+n)?getComputedStyle(document.body).getPropertyValue(e+n):n}function x(t){var 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 S(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 A(t){var e=S.call(this,t);if(e){var n=document.querySelector("#"+e),i=n?n.querySelector(this.settings.selectorDialog):null;return n||i?i?{drawer:n,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.")}}var q=function(t){try{var e=this,n=function(){if(e.store[t.id]){var n="opened"===e.store[t.id]?Promise.resolve(t.open(!1,!1)).then(function(){}):Promise.resolve(t.close(!1,!1)).then(function(){});if(n&&n.then)return n.then(function(){})}else t.el.classList.contains(e.settings.stateOpened)?t.state="opened":(t.el.classList.remove(e.settings.stateOpening),t.el.classList.remove(e.settings.stateClosing),t.el.classList.add(e.settings.stateClosed))}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(t){return Promise.reject(t)}};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())}var D=function(t,e,i){void 0===i&&(i=!0);try{var r=function(){return i&&T.call(o,s),s.el.dispatchEvent(new CustomEvent(a.customEventPrefix+"opened",{detail:o,bubbles:!0})),s},o=this,s=x.call(o,t),a=n({},o.settings,s.settings);void 0!==e&&(a.transition=e);var c=function(){if("closed"===s.state)return s.state="opening",Promise.resolve((t=s.el,e=a,new Promise(function(n){e.transition?(t.classList.remove(e.stateClosed),t.classList.add(e.stateOpening),t.addEventListener("transitionend",function i(){t.classList.add(e.stateOpened),t.classList.remove(e.stateOpening),n(t),this.removeEventListener("transitionend",i)})):(t.classList.add(e.stateOpened),t.classList.remove(e.stateClosed),n(t))}))).then(function(){"modal"===s.mode&&E(!0,a),s.state="opened"});var t,e}();return Promise.resolve(c&&c.then?c.then(r):r())}catch(t){return Promise.reject(t)}},F=function(t,e,i){void 0===i&&(i=!0);try{var r=this,o=x.call(r,t),s=n({},r.settings,o.settings);void 0!==e&&(s.transition=e);var a=function(){if("opened"===o.state)return o.state="closing",document.activeElement.blur(),Promise.resolve((t=o.el,e=s,new Promise(function(n){e.transition?(t.classList.add(e.stateClosing),t.classList.remove(e.stateOpened),t.addEventListener("transitionend",function i(){t.classList.remove(e.stateClosing),t.classList.add(e.stateClosed),n(t),this.removeEventListener("transitionend",i)})):(t.classList.add(e.stateClosed),t.classList.remove(e.stateOpened),n(t))}))).then(function(){"modal"===o.mode&&E(!1,s),i&&T.call(r,o),o.state="closed",o.el.dispatchEvent(new CustomEvent(s.customEventPrefix+"closed",{detail:r,bubbles:!0}))});var t,e}();return Promise.resolve(a&&a.then?a.then(function(){return o}):o)}catch(t){return Promise.reject(t)}},_=function(t,e,n){try{var i=this,r=x.call(i,t);return Promise.resolve("closed"===r.state?D.call(i,r,e,n):F.call(i,r,e,n))}catch(t){return Promise.reject(t)}},I=function(t){try{var e=this;return t.el.classList.add(t.getSetting("classModal")),t.dialog.setAttribute("aria-modal","true"),!e.store[t.id]&&t.el.classList.contains(t.getSetting("stateOpened"))&&(e.store[t.id]="opened"),Promise.resolve(F.call(e,t,!1,!1)).then(function(){return t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:e,bubbles:!0})),t})}catch(t){return Promise.reject(t)}},B=function(t){try{var e=this;return t.el.classList.remove(t.getSetting("classModal")),t.dialog.removeAttribute("aria-modal"),E(!1,n({},e.settings,t.settings)),e.focusTrap.unmount(),Promise.resolve(q.call(e,t)).then(function(){return t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:e,bubbles:!0})),t})}catch(t){return Promise.reject(t)}};function M(t){switch(t.mode){case"inline":return B.call(this,t);case"modal":return I.call(this,t);default:throw new Error('"'+t.mode+'" is not a valid drawer mode.')}}var N=function(t,e){try{var i=this;return Promise.resolve(C.call(i,t,!1)).then(function(){var r=i,o=new l,s={open:function(t,e){return D.call(r,this,t,e)},close:function(t,e){return F.call(r,this,t,e)},toggle:function(t,e){return _.call(r,this,t,e)},deregister:function(){return C.call(r,this)},mountBreakpoint:function(){var t=this.breakpoint,e=this.handleBreakpoint.bind(this);return o.mount(t,e),this},unmountBreakpoint:function(){return o.unmount(),this},handleBreakpoint:function(t){return this.mode=t.matches?"inline":"modal",this},getSetting:function(t){return t in this.settings?this.settings[t]:r.settings[t]}},a=n({id:t.id,el:t,dialog:e,trigger:null,settings:P(t,i.settings.dataConfig),get breakpoint(){return j.call(r,t)},get state(){return c},set state(t){c=t,"opened"!==t&&"closed"!==t||"inline"===this.mode&&(r.store[this.id]=this.state)},get mode(){return u},set mode(t){u=t,M.call(r,this)}},s),c=t.classList.contains(a.getSetting("stateOpened"))?"opened":"closed",u=t.classList.contains(a.getSetting("classModal"))?"modal":"inline";"modal"===a.mode?a.dialog.setAttribute("aria-modal","true"):a.dialog.removeAttribute("aria-modal"),a.getSetting("setTabindex")&&a.dialog.setAttribute("tabindex","-1"),i.collection.push(a);var d=function(){if(!a.breakpoint)return Promise.resolve(q.call(i,a)).then(function(){});a.mountBreakpoint()}();return d&&d.then?d.then(function(){return a}):a})}catch(t){return Promise.reject(t)}},K=/*#__PURE__*/s("handleClick"),V=/*#__PURE__*/s("handleKeydown");/*#__PURE__*/
return function(t){var o,s;function c(e){var i;return i=t.call(this)||this,Object.defineProperty(r(i),K,{writable:!0,value:void 0}),Object.defineProperty(r(i),V,{writable:!0,value:void 0}),i.defaults=L,i.settings=n({},i.defaults,e),i.focusTrap=new b,i.store=function(t,e){function n(e){localStorage.setItem(t,JSON.stringify(e))}return void 0===e&&(e=!0),new Proxy((i=localStorage.getItem(t))?JSON.parse(i):{},{set:function(t,i,r){return t[i]=r,e&&n(t),!0},deleteProperty:function(t,i){return delete t[i],e&&n(t),!0}});var i}(i.settings.storeKey,i.settings.store),a(r(i),K)[K]=O.bind(r(i)),a(r(i),V)[V]=k.bind(r(i)),i.settings.autoInit&&i.init(),i}s=t,(o=c).prototype=Object.create(s.prototype),o.prototype.constructor=o,i(o,s);var l=c.prototype;return l.init=function(t){void 0===t&&(t=null);try{var e=this;t&&(e.settings=n({},e.settings,t));var i=document.querySelectorAll(e.settings.selectorDrawer);return Promise.resolve(e.registerCollection(i)).then(function(){return e.settings.eventListeners&&e.initEventListeners(),e})}catch(t){return Promise.reject(t)}},l.destroy=function(){try{var t=this;return Promise.resolve(t.deregisterCollection()).then(function(){return t.settings.eventListeners&&t.destroyEventListeners(),t})}catch(t){return Promise.reject(t)}},l.initEventListeners=function(){document.addEventListener("click",a(this,K)[K],!1),document.addEventListener("touchend",a(this,K)[K],!1),document.addEventListener("keydown",a(this,V)[V],!1)},l.destroyEventListeners=function(){document.removeEventListener("click",a(this,K)[K],!1),document.removeEventListener("touchend",a(this,K)[K],!1),document.removeEventListener("keydown",a(this,V)[V],!1)},l.register=function(t){var e=A.call(this,t);return e.error?Promise.reject(e.error):N.call(this,e.drawer,e.dialog)},l.deregister=function(t){var e=this.get(S.call(this,t));return C.call(this,e)},l.open=function(t,e,n){return D.call(this,t,e,n)},l.close=function(t,e,n){return F.call(this,t,e,n)},l.toggle=function(t,e,n){return _.call(this,t,e,n)},e(c,[{key:"activeModal",get:function(){return this.collection.find(function(t){return"opened"===t.state&&"modal"===t.mode})}}]),c}(f)});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):((t||self).vrembem=t.vrembem||{},t.vrembem.Drawer=e())}(this,function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function e(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(){return(n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function r(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var o=0;function s(t){return"__private_"+o+++"_"+t}function a(t,e){if(!Object.prototype.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var c=/*#__PURE__*/s("handler"),l=/*#__PURE__*/function(){function t(t,e){Object.defineProperty(this,c,{writable:!0,value:void 0}),this.value=t,a(this,c)[c]=e,this.mql=null}var n=t.prototype;return n.mount=function(t,e){return t&&(this.value=t),e&&(a(this,c)[c]=e),this.value?(this.mql=window.matchMedia("(min-width: "+this.value+")"),"function"==typeof this.mql.addEventListener?this.mql.addEventListener("change",a(this,c)[c]):this.mql.addListener(a(this,c)[c]),a(this,c)[c](this.mql),this):this},n.unmount=function(){return this.mql?("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",a(this,c)[c]):this.mql.removeListener(a(this,c)[c]),this.value=null,a(this,c)[c]=null,this.mql=null,this):this},e(t,[{key:"handler",get:function(){return a(this,c)[c]},set:function(t){this.mql&&("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",a(this,c)[c]):this.mql.removeListener(a(this,c)[c])),a(this,c)[c]=t}}]),t}();function u(t,e,n){if(!t.s){if(n instanceof d){if(!n.s)return void(n.o=u.bind(null,t,e));1&e&&(e=n.s),n=n.v}if(n&&n.then)return void n.then(u.bind(null,t,e),u.bind(null,t,2));t.s=e,t.v=n;var i=t.o;i&&i(t)}}var d=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(e,n){var i=new t,r=this.s;if(r){var o=1&r?e:n;if(o){try{u(i,1,o(this.v))}catch(t){u(i,2,t)}return i}return this}return this.o=function(t){try{var r=t.v;1&t.s?u(i,1,e?e(r):r):n?u(i,1,n(r)):u(i,2,r)}catch(t){u(i,2,t)}},i},t}();function h(t){return t instanceof d&&1&t.s}var f=/*#__PURE__*/function(){function t(){this.collection=[]}var e=t.prototype;return e.register=function(t){try{var e=this;return Promise.resolve(e.deregister(t)).then(function(){return e.collection.push(t),e.collection})}catch(t){return Promise.reject(t)}},e.deregister=function(t){try{var e=this,n=e.collection.findIndex(function(e){return e===t});if(n>=0){var i=e.collection[n];Object.getOwnPropertyNames(i).forEach(function(t){delete i[t]}),e.collection.splice(n,1)}return Promise.resolve(e.collection)}catch(t){return Promise.reject(t)}},e.registerCollection=function(t){try{var e=this;return Promise.resolve(Promise.all(Array.from(t,function(t){e.register(t)}))).then(function(){return e.collection})}catch(t){return Promise.reject(t)}},e.deregisterCollection=function(){try{var t=function(){return e.collection},e=this,n=function(t,e,n){for(var i;;){var r=t();if(h(r)&&(r=r.v),!r)return o;if(r.then){i=0;break}var o=n();if(o&&o.then){if(!h(o)){i=1;break}o=o.s}}var s=new d,a=u.bind(null,s,2);return(0===i?r.then(l):1===i?o.then(c):(void 0).then(function(){(r=t())?r.then?r.then(l).then(void 0,a):l(r):u(s,1,o)})).then(void 0,a),s;function c(e){o=e;do{if(!(r=t())||h(r)&&!r.v)return void u(s,1,o);if(r.then)return void r.then(l).then(void 0,a);h(o=n())&&(o=o.v)}while(!o||!o.then);o.then(c).then(void 0,a)}function l(t){t?(o=n())&&o.then?o.then(c).then(void 0,a):c(o):u(s,1,o)}}(function(){return e.collection.length>0},0,function(){return Promise.resolve(e.deregister(e.collection[0])).then(function(){})});return Promise.resolve(n&&n.then?n.then(t):t())}catch(t){return Promise.reject(t)}},e.get=function(t,e){return void 0===e&&(e="id"),this.collection.find(function(n){return n[e]===t})},t}(),v=['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^="-"])'],m=/*#__PURE__*/s("focusable"),g=/*#__PURE__*/s("handleFocusTrap"),p=/*#__PURE__*/s("handleFocusLock"),b=/*#__PURE__*/function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e="[data-focus]"),Object.defineProperty(this,m,{writable:!0,value:void 0}),Object.defineProperty(this,g,{writable:!0,value:void 0}),Object.defineProperty(this,p,{writable:!0,value:void 0}),this.el=t,this.selectorFocus=e,a(this,g)[g]=y.bind(this),a(this,p)[p]=w.bind(this)}var n=t.prototype;return n.mount=function(t,e){t&&(this.el=t),e&&(this.selectorFocus=e),this.focusable=this.getFocusable(),this.focus()},n.unmount=function(){this.el=null,this.focusable=[],document.removeEventListener("keydown",a(this,g)[g]),document.removeEventListener("keydown",a(this,p)[p])},n.focus=function(t,e){void 0===t&&(t=this.el),void 0===e&&(e=this.selectorFocus),(t.querySelector(e)||t).focus()},n.getFocusable=function(t){void 0===t&&(t=this.el);var e=[],n=document.activeElement,i=t.scrollTop;return t.querySelectorAll(v.join(",")).forEach(function(t){t.focus(),document.activeElement===t&&e.push(t)}),t.scrollTop=i,n.focus(),e},e(t,[{key:"focusable",get:function(){return a(this,m)[m]},set:function(t){a(this,m)[m]=t,a(this,m)[m].length?(document.removeEventListener("keydown",a(this,p)[p]),document.addEventListener("keydown",a(this,g)[g])):(document.removeEventListener("keydown",a(this,g)[g]),document.addEventListener("keydown",a(this,p)[p]))}},{key:"focusableFirst",get:function(){return this.focusable[0]}},{key:"focusableLast",get:function(){return this.focusable[this.focusable.length-1]}}]),t}();function y(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 w(t){("Tab"===t.key||9===t.keyCode)&&t.preventDefault()}function P(t,e){var n=(t.getAttribute("data-"+e)||"").replace(/'/g,'"');return n?JSON.parse(n):{}}function E(t,e){var n,i;n=!!t,(i=e.selectorInert)&&document.querySelectorAll(i).forEach(function(t){n?(t.inert=!0,t.setAttribute("aria-hidden",!0)):(t.inert=null,t.removeAttribute("aria-hidden"))}),function(t,e){e&&document.querySelectorAll(e).forEach(function(e){t?e.style.overflow="hidden":e.style.removeProperty("overflow")})}(!!t,e.selectorOverflow)}var L={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){var e=this,n=t.target.closest("\n [data-"+this.settings.dataOpen+"],\n [data-"+this.settings.dataToggle+"],\n [data-"+this.settings.dataClose+"]\n ");n?(t.preventDefault(),n.matches("[data-"+this.settings.dataToggle+"]")&&n.getAttribute("data-"+this.settings.dataToggle).trim().split(" ").forEach(function(t){var i=e.get(t);i.trigger=n,i.toggle()}),n.matches("[data-"+this.settings.dataOpen+"]")&&n.getAttribute("data-"+this.settings.dataOpen).trim().split(" ").forEach(function(t){var i=e.get(t);i.trigger=n,i.open()}),n.matches("[data-"+this.settings.dataClose+"]")&&n.getAttribute("data-"+this.settings.dataClose).trim().split(" ").forEach(function(i){if(i){var r=e.get(i);r.trigger=n,r.close()}else{var o=t.target.closest(e.settings.selectorDrawer);o&&e.close(o)}})):t.target.matches(this.settings.selectorDrawer)&&this.close(t.target.id)}function O(t){if("Escape"===t.key){var e=this.activeModal;e&&this.close(e)}}var C=function(t,e){void 0===e&&(e=!0);try{var n=function(){return i.collection},i=this;if(!t)return Promise.resolve(i.collection);var r=i.collection.findIndex(function(e){return e.id===t.id}),o=function(){if(r>=0){var t=function(){delete i.store[n.id],n.unmountBreakpoint(),Object.getOwnPropertyNames(n).forEach(function(t){delete n[t]}),i.collection.splice(r,1)},n=i.collection[r],o=function(){if(e&&"opened"===n.state)return Promise.resolve(n.close(!1)).then(function(){})}();return o&&o.then?o.then(t):t()}}();return Promise.resolve(o&&o.then?o.then(n):n())}catch(t){return Promise.reject(t)}};function j(t){var e=getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim(),n=t.getAttribute("data-"+this.settings.dataBreakpoint);return this.settings.breakpoints&&this.settings.breakpoints[n]?this.settings.breakpoints[n]:getComputedStyle(document.body).getPropertyValue("--"+e+"breakpoint-"+n).trim()?getComputedStyle(document.body).getPropertyValue("--"+e+"breakpoint-"+n).trim():n}function x(t){var 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 S(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 A(t){var e=S.call(this,t);if(e){var n=document.querySelector("#"+e),i=n?n.querySelector(this.settings.selectorDialog):null;return n||i?i?{drawer:n,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.")}}var q=function(t){try{var e=this,n=function(){if(e.store[t.id]){var n="opened"===e.store[t.id]?Promise.resolve(t.open(!1,!1)).then(function(){}):Promise.resolve(t.close(!1,!1)).then(function(){});if(n&&n.then)return n.then(function(){})}else t.el.classList.contains(e.settings.stateOpened)?t.state="opened":(t.el.classList.remove(e.settings.stateOpening),t.el.classList.remove(e.settings.stateClosing),t.el.classList.add(e.settings.stateClosed))}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(t){return Promise.reject(t)}};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())}var D=function(t,e,i){void 0===i&&(i=!0);try{var r=function(){return i&&T.call(o,s),s.el.dispatchEvent(new CustomEvent(a.customEventPrefix+"opened",{detail:o,bubbles:!0})),s},o=this,s=x.call(o,t),a=n({},o.settings,s.settings);void 0!==e&&(a.transition=e);var c=function(){if("closed"===s.state)return s.state="opening",Promise.resolve((t=s.el,e=a,new Promise(function(n){e.transition?(t.classList.remove(e.stateClosed),t.classList.add(e.stateOpening),t.addEventListener("transitionend",function i(){t.classList.add(e.stateOpened),t.classList.remove(e.stateOpening),n(t),this.removeEventListener("transitionend",i)})):(t.classList.add(e.stateOpened),t.classList.remove(e.stateClosed),n(t))}))).then(function(){"modal"===s.mode&&E(!0,a),s.state="opened"});var t,e}();return Promise.resolve(c&&c.then?c.then(r):r())}catch(t){return Promise.reject(t)}},F=function(t,e,i){void 0===i&&(i=!0);try{var r=this,o=x.call(r,t),s=n({},r.settings,o.settings);void 0!==e&&(s.transition=e);var a=function(){if("opened"===o.state)return o.state="closing",document.activeElement.blur(),Promise.resolve((t=o.el,e=s,new Promise(function(n){e.transition?(t.classList.add(e.stateClosing),t.classList.remove(e.stateOpened),t.addEventListener("transitionend",function i(){t.classList.remove(e.stateClosing),t.classList.add(e.stateClosed),n(t),this.removeEventListener("transitionend",i)})):(t.classList.add(e.stateClosed),t.classList.remove(e.stateOpened),n(t))}))).then(function(){"modal"===o.mode&&E(!1,s),i&&T.call(r,o),o.state="closed",o.el.dispatchEvent(new CustomEvent(s.customEventPrefix+"closed",{detail:r,bubbles:!0}))});var t,e}();return Promise.resolve(a&&a.then?a.then(function(){return o}):o)}catch(t){return Promise.reject(t)}},_=function(t,e,n){try{var i=this,r=x.call(i,t);return Promise.resolve("closed"===r.state?D.call(i,r,e,n):F.call(i,r,e,n))}catch(t){return Promise.reject(t)}},I=function(t){try{var e=this;return t.el.classList.add(t.getSetting("classModal")),t.dialog.setAttribute("aria-modal","true"),!e.store[t.id]&&t.el.classList.contains(t.getSetting("stateOpened"))&&(e.store[t.id]="opened"),Promise.resolve(F.call(e,t,!1,!1)).then(function(){return t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:e,bubbles:!0})),t})}catch(t){return Promise.reject(t)}},B=function(t){try{var e=this;return t.el.classList.remove(t.getSetting("classModal")),t.dialog.removeAttribute("aria-modal"),E(!1,n({},e.settings,t.settings)),e.focusTrap.unmount(),Promise.resolve(q.call(e,t)).then(function(){return t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix")+"switchMode",{detail:e,bubbles:!0})),t})}catch(t){return Promise.reject(t)}};function M(t){switch(t.mode){case"inline":return B.call(this,t);case"modal":return I.call(this,t);default:throw new Error('"'+t.mode+'" is not a valid drawer mode.')}}var N=function(t,e){try{var i=this;return Promise.resolve(C.call(i,t,!1)).then(function(){var r=i,o=new l,s={open:function(t,e){return D.call(r,this,t,e)},close:function(t,e){return F.call(r,this,t,e)},toggle:function(t,e){return _.call(r,this,t,e)},deregister:function(){return C.call(r,this)},mountBreakpoint:function(){var t=this.breakpoint,e=this.handleBreakpoint.bind(this);return o.mount(t,e),this},unmountBreakpoint:function(){return o.unmount(),this},handleBreakpoint:function(t){return this.mode=t.matches?"inline":"modal",this},getSetting:function(t){return t in this.settings?this.settings[t]:r.settings[t]}},a=n({id:t.id,el:t,dialog:e,trigger:null,settings:P(t,i.settings.dataConfig),get breakpoint(){return j.call(r,t)},get state(){return c},set state(t){c=t,"opened"!==t&&"closed"!==t||"inline"===this.mode&&(r.store[this.id]=this.state)},get mode(){return u},set mode(t){u=t,M.call(r,this)}},s),c=t.classList.contains(a.getSetting("stateOpened"))?"opened":"closed",u=t.classList.contains(a.getSetting("classModal"))?"modal":"inline";"modal"===a.mode?a.dialog.setAttribute("aria-modal","true"):a.dialog.removeAttribute("aria-modal"),a.getSetting("setTabindex")&&a.dialog.setAttribute("tabindex","-1"),i.collection.push(a);var d=function(){if(!a.breakpoint)return Promise.resolve(q.call(i,a)).then(function(){});a.mountBreakpoint()}();return d&&d.then?d.then(function(){return a}):a})}catch(t){return Promise.reject(t)}},K=/*#__PURE__*/s("handleClick"),V=/*#__PURE__*/s("handleKeydown");/*#__PURE__*/
return function(t){var o,s;function c(e){var i;return i=t.call(this)||this,Object.defineProperty(r(i),K,{writable:!0,value:void 0}),Object.defineProperty(r(i),V,{writable:!0,value:void 0}),i.defaults=L,i.settings=n({},i.defaults,e),i.focusTrap=new b,i.store=function(t,e){function n(e){localStorage.setItem(t,JSON.stringify(e))}return void 0===e&&(e=!0),new Proxy((i=localStorage.getItem(t))?JSON.parse(i):{},{set:function(t,i,r){return t[i]=r,e&&n(t),!0},deleteProperty:function(t,i){return delete t[i],e&&n(t),!0}});var i}(i.settings.storeKey,i.settings.store),a(r(i),K)[K]=k.bind(r(i)),a(r(i),V)[V]=O.bind(r(i)),i.settings.autoInit&&i.init(),i}s=t,(o=c).prototype=Object.create(s.prototype),o.prototype.constructor=o,i(o,s);var l=c.prototype;return l.init=function(t){void 0===t&&(t=null);try{var e=this;t&&(e.settings=n({},e.settings,t));var i=document.querySelectorAll(e.settings.selectorDrawer);return Promise.resolve(e.registerCollection(i)).then(function(){return e.settings.eventListeners&&e.initEventListeners(),e})}catch(t){return Promise.reject(t)}},l.destroy=function(){try{var t=this;return Promise.resolve(t.deregisterCollection()).then(function(){return t.settings.eventListeners&&t.destroyEventListeners(),t})}catch(t){return Promise.reject(t)}},l.initEventListeners=function(){document.addEventListener("click",a(this,K)[K],!1),document.addEventListener("touchend",a(this,K)[K],!1),document.addEventListener("keydown",a(this,V)[V],!1)},l.destroyEventListeners=function(){document.removeEventListener("click",a(this,K)[K],!1),document.removeEventListener("touchend",a(this,K)[K],!1),document.removeEventListener("keydown",a(this,V)[V],!1)},l.register=function(t){var e=A.call(this,t);return e.error?Promise.reject(e.error):N.call(this,e.drawer,e.dialog)},l.deregister=function(t){var e=this.get(S.call(this,t));return C.call(this,e)},l.open=function(t,e,n){return D.call(this,t,e,n)},l.close=function(t,e,n){return F.call(this,t,e,n)},l.toggle=function(t,e,n){return _.call(this,t,e,n)},e(c,[{key:"activeModal",get:function(){return this.collection.find(function(t){return"opened"===t.state&&"modal"===t.mode})}}]),c}(f)});
//# sourceMappingURL=scripts.umd.js.map
{
"name": "@vrembem/drawer",
"description": "A container component that slides in from the left or right. Typically containing menus, search or other content.",
"version": "3.0.0",
"version": "3.0.1",
"license": "MIT",

@@ -45,3 +45,3 @@ "keywords": [

"dependencies": {
"@vrembem/core": "^3.0.0"
"@vrembem/core": "^3.0.1"
},

@@ -51,3 +51,3 @@ "publishConfig": {

},
"gitHead": "aa95775dec9ac438fb6a4cdc58a3a9d2772510eb"
"gitHead": "cf849fda753ca79c9179f9c6ab5c763c3b1ed7ad"
}

@@ -309,3 +309,3 @@ # Drawer

deregister: Function // Method to deregister this drawer.
mountBreakpoint: Function // Method to mount the breakpoint feature on.
mountBreakpoint: Function // Method to mount the breakpoint feature.
unmountBreakpoint: Function // Method to unmount the breakpoint feature.

@@ -312,0 +312,0 @@ handleBreakpoint: Function // The function that runs whenever the breakpoint media match property is changed. Receives the event parameter.

@@ -0,8 +1,10 @@

import { getPrefix } from '@vrembem/core';
export function getBreakpoint(drawer) {
const prefix = getVariablePrefix();
const prefix = getPrefix();
const bp = drawer.getAttribute(`data-${this.settings.dataBreakpoint}`);
if (this.settings.breakpoints && this.settings.breakpoints[bp]) {
return this.settings.breakpoints[bp];
} else if (getComputedStyle(document.body).getPropertyValue(prefix + bp)) {
return getComputedStyle(document.body).getPropertyValue(prefix + bp);
} else if (getComputedStyle(document.body).getPropertyValue(`--${prefix}breakpoint-${bp}`).trim()) {
return getComputedStyle(document.body).getPropertyValue(`--${prefix}breakpoint-${bp}`).trim();
} else {

@@ -12,8 +14,1 @@ return bp;

}
function getVariablePrefix() {
let prefix = '--';
prefix += getComputedStyle(document.body).getPropertyValue('--vrembem-variable-prefix');
prefix += 'breakpoint-';
return prefix;
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc