1document.addEventListener("DOMContentLoaded",()=>{const storeHeader=document.querySelector("store-header[transparent]"),headerElement=document.querySelector("store-header"),headerWrapperEl=headerElement&&headerElement.closest(".shopify-section"),headerFlowSpacer=headerWrapperEl&&document.createElement("div");headerFlowSpacer&&(headerFlowSpacer.className="js-scroll-lock-flow-spacer",headerFlowSpacer.style.height="0px",headerFlowSpacer.setAttribute("aria-hidden","true"),headerWrapperEl.insertAdjacentElement("beforebegin",headerFlowSpacer));const SCROLL_LOCK_STICKY_SELECTORS=[".alt-product__info.product__info"],searchBars=[];document.querySelectorAll(".header--drawer-search-bar").forEach(bar=>{const input=bar.querySelector('[name="q"]'),clearInputBtn=bar.querySelector(".predictive-search__clear"),resultsEl=bar.querySelector(".drawer-search-results");if(!input||!resultsEl)return;let abortController=null,debounceTimer=null;function closeResults(){resultsEl.hidden=!0,resultsEl.innerHTML=""}async function onInput(){const term=input.value.trim();if(abortController&&abortController.abort(),!term){closeResults();return}abortController=new AbortController;try{const url=`${window.themeVariables.routes.predictiveSearchUrl}?q=${encodeURIComponent(term)}&resources[limit]=10&resources[limit_scope]=each§ion_id=predictive-search`,response=await fetch(url,{signal:abortController.signal}),wrapper2=document.createElement("div");wrapper2.innerHTML=await response.text();const html=wrapper2.firstElementChild&&wrapper2.firstElementChild.innerHTML;html&&(resultsEl.innerHTML=html,resultsEl.hidden=!1)}catch(e){if(e.name!=="AbortError")throw e}}function syncClearButton(){clearInputBtn&&(clearInputBtn.hidden=input.value.trim().length===0)}syncClearButton(),input.addEventListener("input",()=>{syncClearButton(),clearTimeout(debounceTimer),debounceTimer=setTimeout(onInput,200)});function clearSearchBarInput(){clearTimeout(debounceTimer),abortController&&abortController.abort(),closeResults(),input.value="",syncClearButton()}clearInputBtn&&clearInputBtn.addEventListener("click",()=>{clearSearchBarInput()}),searchBars.push({bar,clear:clearSearchBarInput})}),searchBars.length&&document.addEventListener("click",event=>{const path=event.composedPath();searchBars.forEach(({bar,clear})=>{path.includes(bar)||clear()})});const topLevelNavItems=document.querySelectorAll('[id^="toplevel-nav-item--"]'),firstLevelNavItems=document.querySelectorAll('[id^="tier-one-item--"]'),tierTwoItems=document.querySelectorAll('[id^="tier-two-item--"]'),tierOneDrawers=document.querySelectorAll('[id^="tier-one-drawer--"]'),tierTwoDrawer=document.querySelectorAll('[id^="tier-two-drawer--"]');function createDrawerSwitcher(){let pendingFinish=null,pendingSwitchingReset=null;function switchTo(drawerGroup,targetDrawer){pendingFinish&&(pendingFinish(),pendingFinish=null),pendingSwitchingReset&&pendingSwitchingReset();const previouslyActiveDrawer=Array.from(drawerGroup).find(drawer=>drawer.classList.contains("is-active"))||null;if(!previouslyActiveDrawer||!targetDrawer||previouslyActiveDrawer===targetDrawer)return!1;previouslyActiveDrawer.classList.add("is-switching"),targetDrawer.classList.add("is-switching");const targetFadeContent=targetDrawer.querySelector(".drawer--fade-content")||targetDrawer;targetDrawer.style.zIndex="150",targetDrawer.classList.add("is-active"),targetFadeContent.style.opacity="0",targetFadeContent.offsetHeight,targetFadeContent.style.opacity="";let settled=!1,timeoutId;const finish=()=>{if(settled)return;settled=!0,previouslyActiveDrawer.classList.remove("is-active"),targetDrawer.classList.remove("is-switching"),targetDrawer.style.zIndex="",targetFadeContent.removeEventListener("transitionend",onTransitionEnd),clearTimeout(timeoutId),pendingFinish===finish&&(pendingFinish=null);let switchingResetId;const resetSwitching=()=>{clearTimeout(switchingResetId),previouslyActiveDrawer.classList.remove("is-switching"),pendingSwitchingReset===resetSwitching&&(pendingSwitchingReset=null)};switchingResetId=setTimeout(resetSwitching,50),pendingSwitchingReset=resetSwitching};function onTransitionEnd(event){event.target===targetFadeContent&&event.propertyName==="opacity"&&finish()}return targetFadeContent.addEventListener("transitionend",onTransitionEnd),timeoutId=setTimeout(finish,300),pendingFinish=finish,!0}return{switchTo}}function swapInPlace(outgoing,incoming){outgoing.style.transition="none",incoming.style.transition="none",outgoing.classList.remove("is-active"),incoming.classList.add("is-active"),incoming.offsetWidth,outgoing.style.transition="",incoming.style.transition=""}function toggleTieredMenuDisplays(navItems,nextTierNavItems,topLevelIdString,nextTierItemIdString,activeButtonSelector,switcher){function findMatchingDrawer(navItem){const navId=navItem.id.replace(topLevelIdString,"");return Array.from(nextTierNavItems).find(nextTierNavItem=>nextTierNavItem.id.replace(nextTierItemIdString,"")===navId)||null}function activate(navItem){document.dispatchEvent(new CustomEvent("nav-drawer:item-click",{detail:{tier:topLevelIdString==="toplevel-nav-item--"?"top-level":"second-tier",label:navItem.dataset.drawerContent||navItem.getAttribute("aria-label")||navItem.id}}));
1const targetDrawer=findMatchingDrawer(navItem);nextTierNavItems!==tierTwoDrawer&&tierTwoDrawer.forEach(drawer=>{drawer.classList.remove("is-active")});let handled=!1;if(switcher)handled=switcher.switchTo(nextTierNavItems,targetDrawer);else if(targetDrawer){const openSibling=Array.from(nextTierNavItems).find(drawer=>drawer.classList.contains("is-active"));openSibling&&openSibling!==targetDrawer&&(swapInPlace(openSibling,targetDrawer),handled=!0)}handled||nextTierNavItems.forEach(nextTierNavItem=>{nextTierNavItem.classList.toggle("is-active",nextTierNavItem===targetDrawer)});const openedDrawer=targetDrawer&&targetDrawer.classList.contains("is-active")?targetDrawer:null;if(activeButtonSelector&&navItems.forEach(item=>{const btn=item.querySelector(activeButtonSelector);btn&&btn.classList.toggle("is-active",item===navItem)}),openedDrawer){const firstItemLink=openedDrawer.querySelector(".header--drawer-items a");firstItemLink&&firstItemLink.focus({preventScroll:!0})}}navItems.forEach(navItem=>{const hasSubmenu=!!findMatchingDrawer(navItem);navItem.addEventListener("click",event=>{hasSubmenu&&event.preventDefault(),activate(navItem)}),hasSubmenu&&navItem.tagName!=="BUTTON"&&navItem.addEventListener("keydown",event=>{(event.key==="Enter"||event.key===" ")&&(event.preventDefault(),activate(navItem))})})}const tierOneSwitcher=createDrawerSwitcher();toggleTieredMenuDisplays(topLevelNavItems,tierOneDrawers,"toplevel-nav-item--","tier-one-drawer--",".toplevel-item--btn-wrapper button",tierOneSwitcher),toggleTieredMenuDisplays(firstLevelNavItems,tierTwoDrawer,"tier-one-item--","tier-two-drawer--",null,null);const wrapper=document.querySelector(".drawer--header-wrapper"),overlay=wrapper&&wrapper.querySelector("[data-drawer-overlay]");if(overlay){let syncDrawerFocusability2=function(){drawers.forEach(drawer=>{const isOpen=drawer.classList.contains("is-active");drawerFocusableState.get(drawer)!==isOpen&&(drawerFocusableState.set(drawer,isOpen),[drawer,...drawer.querySelectorAll("a[href], button, input, select, textarea")].forEach(el=>{isOpen?el.removeAttribute("tabindex"):el.setAttribute("tabindex","-1")}))})},syncDrawerAriaExpanded2=function(){wrapper.querySelectorAll("[aria-controls][aria-expanded]").forEach(trigger=>{const controlled=document.getElementById(trigger.getAttribute("aria-controls"));controlled&&controlled.classList.contains("header--drawer")&&trigger.setAttribute("aria-expanded",controlled.classList.contains("is-active"))})},pinElement2=function(el,{isHeader}){const rect=el.getBoundingClientRect();if(isHeader&&(document.documentElement.style.setProperty("--drawer-header-offset",`${rect.bottom}px`),headerFlowSpacer)){const marginBottom=parseFloat(getComputedStyle(el).marginBottom)||0;headerFlowSpacer.style.height=`${Math.max(0,rect.height+marginBottom)}px`}el.classList.add("js-scroll-lock-pinned"),el.style.setProperty("position","fixed","important"),el.style.setProperty("top",`${rect.top}px`,"important"),el.style.setProperty("left",`${rect.left}px`,"important"),el.style.setProperty("width",`${rect.width}px`,"important")},pinStickyElements2=function(){headerWrapperEl&&pinElement2(headerWrapperEl,{isHeader:!0}),SCROLL_LOCK_STICKY_SELECTORS.forEach(selector=>{document.querySelectorAll(selector).forEach(el=>{getComputedStyle(el).position==="sticky"&&pinElement2(el,{})})})},unpinStickyElements2=function(){document.querySelectorAll(".js-scroll-lock-pinned").forEach(el=>{el.classList.remove("js-scroll-lock-pinned"),el.style.removeProperty("position"),el.style.removeProperty("top"),el.style.removeProperty("left"),el.style.removeProperty("width")}),headerFlowSpacer&&(headerFlowSpacer.style.height="0px"),document.documentElement.style.removeProperty("--drawer-header-offset")},removeActiveState2=function(elementsList,removeConditionCase){elementsList.forEach(el=>{el.classList.contains("is-active")&&removeConditionCase==!1&&el.classList.remove("is-active")})},syncOverlay2=function(){const anyOpen=Array.from(drawers).some(drawer=>drawer.classList.contains("is-active"));anyOpen&&!wasOpen?document.dispatchEvent(new CustomEvent("nav-drawer:open")):!anyOpen&&wasOpen&&(document.dispatchEvent(new CustomEvent("nav-drawer:close",{detail:{method:lastCloseMethod}})),lastCloseMethod="unknown"),wasOpen=anyOpen,overlay.classList.toggle("is-active",anyOpen),syncDrawerFocusability2(),syncDrawerAriaExpanded2(),storeHeader&&(anyOpen?(storeHeader.setAttribute("header-drawer","open"),storeHeader.classList.add("header--trans
1parent")):(storeHeader.removeAttribute("header-drawer"),typeof storeHeader._checkTransparentHeader=="function"&&storeHeader._checkTransparentHeader())),anyOpen!==scrollLocked&&(anyOpen?(pinStickyElements2(),scrollYBeforeLock=window.scrollY,document.body.style.top=`-${scrollYBeforeLock}px`,document.body.classList.add("overflow-hidden")):(document.body.classList.remove("overflow-hidden"),document.body.style.top="",window.scrollTo({top:scrollYBeforeLock,left:0,behavior:"instant"}),unpinStickyElements2()),scrollLocked=anyOpen),removeActiveState2(toplevelStripBtns,anyOpen),removeActiveState2(desktoTpoplevelStripBtns,anyOpen)};var syncDrawerFocusability=syncDrawerFocusability2,syncDrawerAriaExpanded=syncDrawerAriaExpanded2,pinElement=pinElement2,pinStickyElements=pinStickyElements2,unpinStickyElements=unpinStickyElements2,removeActiveState=removeActiveState2,syncOverlay=syncOverlay2;const drawers=wrapper.querySelectorAll(".header--drawer"),toplevelStripBtns=wrapper.querySelectorAll(".drawer-toplevel-strip__btn"),desktoTpoplevelStripBtns=wrapper.querySelectorAll(".toplevel-item--btn-wrapper button"),drawerFocusableState=new WeakMap;let scrollYBeforeLock=0,scrollLocked=!1,wasOpen=!1,lastCloseMethod="unknown";const observer=new MutationObserver(syncOverlay2);drawers.forEach(drawer=>{observer.observe(drawer,{attributes:!0,attributeFilter:["class"]})}),overlay.addEventListener("click",()=>{lastCloseMethod="overlay",drawers.forEach(drawer=>drawer.classList.remove("is-active"))}),wrapper.querySelectorAll(".drawer-toplevel-strip__close").forEach(btn=>{btn.addEventListener("click",()=>{lastCloseMethod="close_button",drawers.forEach(drawer=>drawer.classList.remove("is-active"))})}),wrapper.querySelectorAll(".drawer--title-with-icon").forEach(backBtn=>{backBtn.addEventListener("click",()=>{const drawer=backBtn.closest(".header--drawer");drawer&&(lastCloseMethod="back_button",drawer.classList.remove("is-active"))})}),toplevelStripBtns.forEach(btn=>{btn.addEventListener("click",()=>{const targetId=btn.dataset.target,targetDrawer=Array.from(tierOneDrawers).find(drawer=>drawer.id===targetId)||null;tierOneSwitcher.switchTo(tierOneDrawers,targetDrawer)||tierOneDrawers.forEach(drawer=>{drawer.classList.toggle("is-active",drawer.id===targetId)}),toplevelStripBtns.forEach(stripBtn=>{stripBtn.classList.toggle("is-active",stripBtn.dataset.target===targetId)}),tierTwoDrawer.forEach(drawer=>drawer.classList.remove("is-active"))})});const hamburger=document.querySelector('button[is="toggle-button"][aria-controls="mobile-alt-drawer-navigation"]'),firstWrapper=document.getElementById("mobile-alt-drawer-navigation"),firstTierDrawer=firstWrapper&&firstWrapper.querySelector(".tier-one--items.header--drawer");hamburger&&firstTierDrawer&&hamburger.addEventListener("click",()=>{firstTierDrawer.classList.add("is-active"),toplevelStripBtns.forEach(stripBtn=>{stripBtn.classList.toggle("is-active",stripBtn.dataset.target===firstTierDrawer.id)})}),document.addEventListener("keydown",event=>{if(event.key!=="Tab"&&event.key!=="Escape"||!Array.from(drawers).some(drawer=>drawer.classList.contains("is-active"))||event.target.closest("popover-content[open]"))return;if(event.key==="Escape"){const trigger=[wrapper.querySelector(".toplevel-item--btn-wrapper button.is-active"),hamburger].find(el=>el&&el.checkVisibility({checkVisibilityCSS:!0}));lastCloseMethod="escape",drawers.forEach(drawer=>drawer.classList.remove("is-active")),trigger&&trigger.focus({preventScroll:!0});return}const tabbable=Array.from(wrapper.querySelectorAll("a[href], button, input, select, textarea")).filter(el=>!el.disabled&&el.getAttribute("tabindex")!=="-1"&&el.checkVisibility({checkVisibilityCSS:!0}));if(!tabbable.length)return;const first=tabbable[0],last=tabbable[tabbable.length-1];!event.shiftKey&&document.activeElement===last?(event.preventDefault(),first.focus({preventScroll:!0})):event.shiftKey&&document.activeElement===first&&(event.preventDefault(),last.focus({preventScroll:!0}))}),syncOverlay2()}}); 2//# sourceMappingURL=/cdn/shop/t/683/assets/header-drawer.js.map?v=181898235998098717131789047731
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.