1class MCBDialogElement extends HTMLElement{constructor(){if(super(),this.shadowDomTemplate){const shadowDomElement=document.getElementById(this.shadowDomTemplate);this.attachShadow({mode:"open"}).appendChild(shadowDomElement.content.cloneNode(!0))}}static get observedAttributes(){return["open"]}connectedCallback(){this.setAttribute("role","dialog"),this.shadowDomTemplate&&(this.getShadowPartByName("overlay")?.addEventListener("click",this.hide.bind(this)),this.getShadowPartByName("close-button tap-area")?.addEventListener("click",this.hide.bind(this))),document.addEventListener("click",this.handleOutsideClick.bind(this)),this.controls.forEach(control=>{control.addEventListener("click",this.handleControlClick.bind(this))})}disconnectedCallback(){document.removeEventListener("click",this.handleOutsideClick.bind(this)),this.controls.forEach(control=>{control.removeEventListener("click",this.handleControlClick.bind(this))})}lockScroll(){document.body.classList.contains("overflow-hidden")?document.body.classList.remove("overflow-hidden"):document.body.classList.add("overflow-hidden")}handleOutsideClick(event){this.open&&!this.contains(event.target)&&!this.controls.includes(event.target)&&this.hide()}handleControlClick(){this.open?this.hide():this.show()}show(){this.setAttribute("open",""),document.body.classList.add("mcb-dialog-open"),this.isSmallScreen.matches&&this.lockScroll()}hide(){this.removeAttribute("open"),document.body.classList.remove("mcb-dialog-open"),this.isSmallScreen.matches&&this.lockScroll()}get shadowDomTemplate(){return this.getAttribute("template")}get controls(){return[...document.querySelectorAll(`[aria-controls='${this.id}']`)]}get open(){return this.hasAttribute("open")}get isSmallScreen(){return window.matchMedia("(max-width: 999px)")}getShadowPartByName(name){return this.shadowRoot?.querySelector(`[part='${name}']`)}attributeChangedCallback(name,oldValue,newValue){name==="open"&&(oldValue===null&&newValue===""?(this.style.display="block",document.body.classList.add("mcb-dialog-open"),this.animateEnter()):oldValue!==null&&newValue===null&&this.animateLeave().finished.then(()=>{this.style.display="none",document.body.classList.remove("mcb-dialog-open")}))}animateEnter(){return this.animate({opacity:[0,1]},{duration:200})}animateLeave(){return this.animate({opacity:[1,0]},{duration:200})}}window.customElements.get("mcb-dialog-element")||window.customElements.define("mcb-dialog-element",MCBDialogElement);export default MCBDialogElement; 2//# sourceMappingURL=/cdn/shop/t/15/assets/mcb-dialog.js.map?v=126257231233632346001726821387
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.