1import{c as createFocusTrap}from"./focus-trap.esm-C-N_-G0z.js";import{P as PubSub}from"./pubsub-CoPYzvVm.js";import"./notyf-DIw0RvBj.js";function bodyScrollLock(boolean=!0){const verticalScrollbarWidth=window.innerWidth-document.documentElement.clientWidth;verticalScrollbarWidth<=0&&boolean||(document.body.style.paddingRight=boolean?`${verticalScrollbarWidth}px`:"",document.documentElement.style.setProperty("--scrollbar-width",boolean?`${verticalScrollbarWidth}px`:""),document.body.style.overflow=boolean?"hidden":"")}class DialogExt extends HTMLElement{#focusDelay=this.dataset.focusDelay||300;#preventFocusScroll=this.dataset.preventFocusScroll==="true";#bodyElement=this.querySelector("[data-body]");#focusContainer=this.querySelector("[data-focus-container]")||this;#trapFocus=createFocusTrap(this.#focusContainer,{allowOutsideClick:!0,clickOutsideDeactivates:event=>this.#clickOutsideDeactivates(event),checkCanFocusTrap:()=>this.#checkCanFocusTrap(),onActivate:()=>this.#onActivate(),onDeactivate:()=>this.#onDeactivate(),onPostDeactivate:()=>this.#onPostDeactivate(),preventScroll:this.#preventFocusScroll});#lockedByThemeEditor=!1;controllers=[...document.querySelectorAll(`[aria-controls="${this.id}"]`)];target=this.controllers?.[0]?.ariaControlsElements?.[0];constructor(){super(),this.#teleport(),this.#handleConstructorErrors(),this.#handlePubSubEvents(),this.#handleShopifyEvents(),this.controllers.forEach(controller=>{controller.addEventListener("click",event=>{event.preventDefault(),this.ariaHidden==="true"?this.open():this.close()})})}open(){this.ariaHidden!=="false"&&this.#trapFocus.activate()}close(){this.ariaHidden!=="true"&&this.#trapFocus.deactivate()}#checkCanFocusTrap(){return new Promise(resolve=>setTimeout(()=>resolve(),this.#focusDelay))}#clickOutsideDeactivates({target}){return this.dataset.preventDismiss==="true"?!1:!this.controllers.some(controller=>controller.contains(target))}#handleConstructorErrors(){this.id||console.error("DialogExt must have an id"),this.controllers.length||console.error("DialogExt must have at least one controller"),this.target||console.error("DialogExt must have a target")}#onActivate(){bodyScrollLock(),this.ariaHidden="false",this.controllers.forEach(controller=>controller.ariaExpanded="true")}#onDeactivate(){this.ariaHidden="true",this.controllers.forEach(controller=>controller.ariaExpanded="false")}#onPostDeactivate(){const onTransitionEnd=({target})=>{target===this.#bodyElement&&(bodyScrollLock(!1),this.#bodyElement.removeEventListener("transitionend",onTransitionEnd))};this.#bodyElement.addEventListener("transitionend",onTransitionEnd)}#teleport(){this.dataset.teleport==="true"&&(this.removeAttribute("data-teleport"),document.body.insertBefore(this,document.body.firstChild))}#handlePubSubEvents(){PubSub.subscribe("dialog:open",({id})=>{id===this.id&&this.open()}),PubSub.subscribe("dialog:close",({id})=>{id===this.id&&this.close()})}#handleShopifyEvents(){["shopify:section:load","shopify:section:select","shopify:section:unload","shopify:section:deselect"].forEach(eventName=>{document.addEventListener(eventName,({detail,type})=>{const{sectionId}=detail;if(sectionId!==this.id)return;const openActions=["shopify:section:load","shopify:section:select"];this.#lockedByThemeEditor=openActions.includes(type),this.#lockedByThemeEditor?this.open():this.close()})})}}export{DialogExt as D}; 2//# sourceMappingURL=/cdn/shop/t/129/assets/dialog-BxVV6X1H.js.map
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.