1import{prepareTransition}from"@archetype-themes/utils/utils";import{trapFocus,removeTrapFocus,lockScroll,unlockScroll}from"@archetype-themes/utils/a11y";import{EVENTS}from"@archetype-themes/utils/events";class HeaderDrawer extends HTMLElement{constructor(){super(),this.isOpen=!1,this.abortController=new AbortController}connectedCallback(){!this.getAttribute("open")||!this.getAttribute("close")||(document.addEventListener(this.getAttribute("open"),this.open.bind(this),{signal:this.abortController.signal}),document.addEventListener(this.getAttribute("close"),this.close.bind(this),{signal:this.abortController.signal}))}open(evt){this.activeElement=evt.target,this.dispatchEvent(new CustomEvent(EVENTS.sizeDrawer,{bubbles:!0})),prepareTransition(this,function(){this.classList.add("is-active")}.bind(this)),trapFocus(this),lockScroll(),window.addEventListener("keyup",this.handleWindowKeyup,{signal:this.abortController.signal}),this.dispatchEvent(new CustomEvent(EVENTS.headerOverlayRemoveClass,{bubbles:!0})),this.dispatchEvent(new CustomEvent(EVENTS.headerDrawerOpened,{bubbles:!0})),this.dispatchEvent(new CustomEvent("drawerOpen",{bubbles:!0})),this.isOpen=!0,setTimeout(()=>{window.addEventListener("click",this.handleWindowClick,{signal:this.abortController.signal})},0)}close(evt,noAnimate){evt&&evt.target.closest&&evt.target.closest(".site-header__drawer")||this.isOpen&&(noAnimate?this.classList.remove("is-active"):prepareTransition(this,function(){this.classList.remove("is-active")}.bind(this)),this.dispatchEvent(new CustomEvent(EVENTS.headerDrawerClosed,{bubbles:!0})),window.removeEventListener("keyup",this.handleWindowKeyup),window.removeEventListener("click",this.handleWindowClick),this.isOpen=!1,this.activeElement&&removeTrapFocus(this.activeElement),unlockScroll())}handleWindowKeyup=evt=>{evt.keyCode===27&&this.close()};handleWindowClick=evt=>{this.close(evt)};disconnectedCallback(){this.abortController.abort()}}customElements.define("header-drawer",HeaderDrawer); 2//# sourceMappingURL=/cdn/shop/t/13/assets/header-drawer.js.map?v=12194218155632391321756144066
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.