1document.addEventListener("DOMContentLoaded",()=>{const cityLinks=document.querySelectorAll(".store-locator-v2__city-item"),cards=[...document.querySelectorAll(".store-card-v2")],countEl=document.getElementById("StoreLocatorCount"),mobileCountEl=document.getElementById("StoreLocatorCountMobile"),mobileCityEl=document.getElementById("StoreLocatorMobileCityName"),mobileTriggerTextEl=document.querySelector(".store-locator-v2__mobile-city-trigger-text"),searchInput=document.getElementById("StoreLocatorCitySearch"),resultsHeaderEl=document.getElementById("StoreLocatorResultsHeader"),paginationEl=document.getElementById("StoreLocatorPagination"),paginationPagesEl=document.getElementById("StoreLocatorPaginationPages"),drawerOverlay=document.getElementById("StoreLocatorDrawerOverlay"),mobileTrigger=document.getElementById("StoreLocatorMobileCityTrigger"),drawerCloseBtn=document.getElementById("StoreLocatorDrawerClose"),drawerSearchInput=document.getElementById("StoreLocatorDrawerSearch"),DESKTOP_PER_PAGE=6,MOBILE_PER_PAGE=4,MOBILE_BREAKPOINT=768;let perPage=window.innerWidth<MOBILE_BREAKPOINT?MOBILE_PER_PAGE:DESKTOP_PER_PAGE,currentCitySlug="",visibleCards=[],totalPages=1,currentPage=1;const getSlugFromURL=()=>{try{const cityParam=new URLSearchParams(window.location.search).get("city");if(cityParam&&cityParam.toLowerCase()!=="all")return cityParam.toLowerCase().trim()}catch{}return""},applyFilter=slug=>{currentCitySlug=slug,cityLinks.forEach(link=>{link.classList.remove("is-active");const linkSlug=(link.getAttribute("data-city-slug")||"").toLowerCase();(slug===""&&linkSlug==="all"||slug!==""&&linkSlug===slug)&&link.classList.add("is-active")}),visibleCards=cards.filter(card=>{const cardSlug=(card.getAttribute("data-city-slug")||"").toLowerCase();return card.getAttribute("data-coming-soon")==="true"?slug!==""&&cardSlug===slug:slug===""||cardSlug===slug});const storeCount=visibleCards.filter(c=>!c.dataset.comingSoon).length;countEl&&(countEl.textContent=storeCount),mobileCountEl&&(mobileCountEl.textContent=`${storeCount} Stores Found`),resultsHeaderEl&&resultsHeaderEl.classList.toggle("is-hidden",storeCount===0);const activeLink=document.querySelector(".store-locator-v2__city-item.is-active"),cityName=activeLink&&activeLink.getAttribute("data-city-name")||"All Stores";mobileCityEl&&(mobileCityEl.textContent=cityName.toUpperCase()),mobileTriggerTextEl&&(mobileTriggerTextEl.textContent=slug===""?"Select Your City":cityName),rebuildPagination(),showPage(1)},rebuildPagination=()=>{if(totalPages=visibleCards.length<=0?1:Math.ceil(visibleCards.length/perPage),!(!paginationEl||!paginationPagesEl)){paginationPagesEl.innerHTML="";for(let p=1;p<=totalPages;p++){const btn=document.createElement("button");btn.type="button",btn.className="store-locator-v2__pagination-page",btn.setAttribute("data-page",p),btn.textContent=p,paginationPagesEl.appendChild(btn)}}},showPage=page=>{if(currentPage=Math.max(1,Math.min(page,totalPages)),cards.forEach(card=>{const idx=visibleCards.indexOf(card),show=idx!==-1&&idx>=(currentPage-1)*perPage&&idx<currentPage*perPage;card.classList.toggle("is-hidden",!show)}),paginationEl){paginationEl.classList.toggle("is-hidden",totalPages<=1);const prevBtn=paginationEl.querySelector(".store-locator-v2__pagination-prev"),nextBtn=paginationEl.querySelector(".store-locator-v2__pagination-next");prevBtn&&(prevBtn.disabled=currentPage<=1),nextBtn&&(nextBtn.disabled=currentPage>=totalPages)}paginationPagesEl&&paginationPagesEl.querySelectorAll("button").forEach(b=>{b.classList.toggle("is-active",parseInt(b.getAttribute("data-page"),10)===currentPage)})};paginationEl&&paginationEl.addEventListener("click",e=>{const target=e.target;let changed=!1;target.classList.contains("store-locator-v2__pagination-page")?(showPage(parseInt(target.getAttribute("data-page"),10)),changed=!0):target.classList.contains("store-locator-v2__pagination-prev")?(showPage(currentPage-1),changed=!0):target.classList.contains("store-locator-v2__pagination-next")&&(showPage(currentPage+1),changed=!0),changed&&window.scrollTo({top:0,behavior:"smooth"})});const resetDrawerSearch=()=>{drawerSearchInput&&(drawerSearchInput.value=""),document.querySelectorAll(".store-locator-v2__drawer
1-city-item").forEach(link=>{link.classList.remove("is-hidden")}),syncDrawerNoResults()},openDrawer=()=>{drawerOverlay&&(drawerOverlay.classList.add("is-open"),drawerOverlay.setAttribute("aria-hidden","false")),mobileTrigger&&mobileTrigger.setAttribute("aria-expanded","true");const scrollY=window.pageYOffset;document.body.dataset.scrollY=scrollY,document.documentElement.style.setProperty("--scroll-y",`-${scrollY}px`),document.body.classList.add("scroll-lock"),resetDrawerSearch()},closeDrawer=()=>{drawerOverlay&&(drawerOverlay.classList.remove("is-open"),drawerOverlay.setAttribute("aria-hidden","true")),mobileTrigger&&mobileTrigger.setAttribute("aria-expanded","false");const scrollY=parseInt(document.body.dataset.scrollY||"0",10);document.body.classList.remove("scroll-lock"),document.documentElement.style.removeProperty("--scroll-y"),delete document.body.dataset.scrollY,window.scrollTo(0,scrollY),resetDrawerSearch()};if(mobileTrigger&&mobileTrigger.addEventListener("click",openDrawer),drawerCloseBtn&&drawerCloseBtn.addEventListener("click",closeDrawer),drawerOverlay&&drawerOverlay.addEventListener("click",e=>{e.target===drawerOverlay&&closeDrawer()}),cityLinks.forEach(link=>{link.addEventListener("click",e=>{e.preventDefault();let slug=(link.getAttribute("data-city-slug")||"").toLowerCase();if(slug==="all"&&(slug=""),slug===currentCitySlug){link.classList.contains("store-locator-v2__drawer-city-item")&&closeDrawer();return}try{const newURL=slug===""?window.location.pathname:`${window.location.pathname}?city=${slug}`;history.pushState({city:slug},"",newURL)}catch{}applyFilter(slug),link.classList.contains("store-locator-v2__drawer-city-item")&&closeDrawer()})}),window.addEventListener("popstate",e=>{const slug=e.state&&e.state.city!=null?e.state.city:getSlugFromURL();applyFilter(slug)}),searchInput){const sidebarNoResults=document.getElementById("StoreLocatorNoResults");searchInput.addEventListener("input",e=>{const query=e.target.value.toLowerCase().trim();let hasMatch=!1;cityLinks.forEach((link,index)=>{if(link.classList.contains("store-locator-v2__drawer-city-item"))return;if(index===0){link.classList.remove("is-hidden");return}const visible=(link.getAttribute("data-city-name")||link.textContent).toLowerCase().includes(query);link.classList.toggle("is-hidden",!visible),visible&&(hasMatch=!0)}),sidebarNoResults&&sidebarNoResults.classList.toggle("is-hidden",hasMatch||query==="")})}const drawerNoResults=document.getElementById("StoreLocatorDrawerNoResults"),syncDrawerNoResults=()=>{if(!drawerNoResults)return;const visibleCount=document.querySelectorAll(".store-locator-v2__drawer-city-item:not(.is-hidden)").length;drawerNoResults.classList.toggle("is-hidden",visibleCount>1)};drawerSearchInput&&drawerSearchInput.addEventListener("input",e=>{const query=e.target.value.toLowerCase().trim();document.querySelectorAll(".store-locator-v2__drawer-city-item").forEach((link,index)=>{if(index===0){link.classList.remove("is-hidden");return}const name=(link.getAttribute("data-city-name")||link.textContent).toLowerCase();link.classList.toggle("is-hidden",!name.includes(query))}),syncDrawerNoResults()});const parseHour=timeText=>{if(!timeText)return null;const match=timeText.trim().match(/^(\d+)(am|pm)$/i);if(!match)return null;let hour=parseInt(match[1],10);const period=match[2].toLowerCase();return period==="pm"&&hour!==12&&(hour+=12),period==="am"&&hour===12&&(hour=0),hour},statusEls=document.querySelectorAll(".store-status");if(statusEls.length){const currentHour=new Date().getHours();statusEls.forEach(el=>{const openTime=el.dataset.openTime,closeTime=el.dataset.closeTime,openHour=parseHour(openTime),closeHour=parseHour(closeTime);if(openHour==null||closeHour==null)return;const isOpen=currentHour>=openHour&¤tHour<closeHour,labelEl=el.previousElementSibling;labelEl&&(labelEl.textContent=isOpen?"Open":"Closed",labelEl.classList.toggle("is-open",isOpen),labelEl.classList.toggle("is-closed",!isOpen),el.textContent=isOpen?`Closes ${closeTime}`:`Opens ${openTime}`)})}const todayIndex=[6,0,1,2,3,4,5][new Date().getDay()];document.querySelectorAll(".store-card-v2__hours-row-detail").forEach(row=>{parseInt(row.getAttribute("data-day-index")||"-1",10)===todayIndex&&row.classList.add("is-today")}),document.querySelectorAll(".store-card-v2__hours-close-wrap").forEach(wrap=>{wrap.addEventListener("click",e=>{if(e.target.closest(".store-card-v2__hours-flyout"))return;const wrapper=wrap.closest(".store-card-v2__hours-wrapper");wrapper&&wrapper.classList.toggle("is-open")})}),cards.forEach(card=>{const url=card.getAttribute("data-store-url");url&&(card.addEventListener("click",event=>{const interactive=event.target.closest("a, button, .store-card-v2__hours-close-wrap");interactive&&interactive!==card||(window.location.href=url)}),card.addEventListener("keydown",event=>{if(event.key==="Enter"||event.key===" "){const activeEl=document.activeElement;if(activeEl&&activeEl!==card&&activeEl.closest("a, button"))return;event.preventDefault(),window.location.href=url}}))});let resizeTimer=0;window.addEventListener("resize",()=>{clearTimeout(resizeTimer),resizeTimer=setTimeout(()=>{const newPerPage=window.innerWidth<MOBILE_BREAKPOINT?MOBILE_PER_PAGE:DESKTOP_PER_PAGE;newPerPage!==perPage&&(perPage=newPerPage,applyFilter(currentCitySlug))},150)});const initialSlug=getSlugFromURL();try{history.replaceState({city:initialSlug},"")}catch{}applyFilter(initialSlug),document.addEventListener("click",e=>{const btn=e.target.closest(".store-card-v2__share-btn");if(!btn)return;e.stopPropagation();const card=btn.closest(".store-card-v2"),storeName=btn.getAttribute("data-store-name")||document.title,storeUrl=card&&card.getAttribute("data-store-url")||window.location.href;navigator.share?navigator.share({title:storeName,url:storeUrl}).catch(()=>{}):navigator.clipboard.writeText(storeUrl).then(()=>{btn.classList.add("is-copied"),setTimeout(()=>btn.classList.remove("is-copied"),1800)})})}); 2//# sourceMappingURL=/cdn/shop/t/571/assets/store-locator-v2.js.map?v=67757591909482887741774619526
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.