1document.querySelectorAll("template[data-lazy-popover]").forEach(function(tpl){var container=tpl.closest("[id]");container&&document.querySelectorAll(`[aria-controls="${container.id}"]`).forEach(function(btn){btn.addEventListener("click",()=>tpl.replaceWith(tpl.content),{once:!0})})});const forceModalOpen=function(id){document.getElementById(id)&&(document.querySelectorAll(".Modal[aria-hidden=false] [data-action=close-modal]").forEach(el=>el.click()),setTimeout(function(){const button=document.createElement("button");button.dataset.action="open-modal",button.classList.add("u-visually-hidden"),button.setAttribute("aria-controls",id),document.body.append(button),button.click(),button.remove()},10))};(function(){var query_string=new URLSearchParams(window.location.search),cookie_settings={secure:!0,sameSite:"none"};const delegate=new domDelegate.Delegate(document.body),prefersReducedMotion=window.matchMedia("(prefers-reduced-motion: reduce)").matches===!0;var zone=document.documentElement.dataset.zone,country=Shopify.country||document.documentElement.dataset.country,language=Shopify.locale||document.documentElement.lang;window.Countries=window.Countries||{"United Kingdom":{code:"GB",zip_required:"true"}};const getCountryName=function(code){let country_name=!1;return $.each(Countries,function(name,data){if(data.code==code.toUpperCase())return country_name=name,!1}),country_name},getCountryData=function(country2){return country2&&country2.toUpperCase().match(/^[A-Z]{2}$/)&&(country2=getCountryName(country2)),Countries[country2]||!1};$("body").on("click",".Drawer [data-action=open-modal], .Header__LocalizationForm [aria-haspopup=true], #international-welcome-modal [data-action=open-modal]",function(){$(".Drawer__Close",$(this).closest(".Drawer")).first().trigger("click");var controls=$(this).attr("aria-controls");controls&&$(`#${controls} [data-scrollable]`).each(function(){$(this).has(".is-selected").length&&$(this).scrollTop($(".is-selected",this).offset().top-$(this).height()/2)})});const colourSwatchProductCards={},colourSwatchPendingFetches=new Set,fetchColourSwatchProductCards=handles=>{if(handles=[...handles],handles.length==0)return;handles.forEach(handle=>colourSwatchPendingFetches.add(handle));const handlesToFetch=handles.slice(0,20),url=`${Shopify.routes.root}?section_id=dynamic-search&cache=false&type=${Date.now()}_${Math.random()}&products=${handlesToFetch.join(",")}`;return fetch(url).then(response=>response.text()).then(response=>{new DOMParser().parseFromString(response,"text/html").querySelectorAll(".ProductItem").forEach(function(item){colourSwatchProductCards[item.dataset.productHandle]=item.outerHTML})}).finally(()=>
1(handlesToFetch.forEach(handle=>colourSwatchPendingFetches.delete(handle)),fetchColourSwatchProductCards(handles.slice(20))))},getNewColourSwatchHandles=context=>(context=context||document,new Set([...context.querySelectorAll(".ProductItem[data-product-handle]:has(.ColourSwatchList__Item), .ColourSwatchList__Item[data-product-handle]")].map(item=>item.dataset.productHandle).filter(item=>item!=null&&!colourSwatchProductCards[item]&&!colourSwatchPendingFetches.has(item)))),swapColourSwatchProductCard=(oldProductElement,newProductHandle,onFail)=>{const newProductHTML=colourSwatchProductCards[newProductHandle];if(!newProductHTML)return onFail&&onFail(),!1;const tempDiv=document.createElement("div");tempDiv.innerHTML=newProductHTML;const newProductElement=tempDiv.firstElementChild.cloneNode(!0);return oldProductElement.replaceWith(newProductElement),document.dispatchEvent(new CustomEvent("product_list_loaded",{detail:newProductElement.parentNode})),!0};delegate.on("click",".ProductItem .ColourSwatchList__Item",event2=>{const swatch=event2.target.matches(".ColourSwatchList__Item")?event2.target:event2.target.closest(".ColourSwatchList__Item");event2.preventDefault(),event2.target.closest(".Search")&&event2.stopPropagation();const handleFailure=()=>document.location.assign(swatch.href),oldProductElement=swatch.closest(".ProductItem"),newProductHandle=swatch.dataset.productHandle,swapCard=(i=0)=>{if(!newProductHandle||!oldProductElement||i>=30){handleFailure();return}const image=oldProductElement.querySelector(".Image__Loader")?.previousElementSibling;image&&image.matches(".ProductItem__Image")&&(image.classList.add("Image--lazyLoading"),image.hidden=!0),colourSwatchProductCards[newProductHandle]?swapColourSwatchProductCard(oldProductElement,newProductHandle,handleFailure):(colourSwatchPendingFetches.has(newProductHandle)||fetchColourSwatchProductCards(new Set([newProductHandle])),colourSwatchPendingFetches.has(newProductHandle)&&setTimeout(()=>swapCard(++i),100))};swapCard()});const initColourSwatches=context=>{var handles=new Set;context instanceof jQuery?context.each(function(){getNewColourSwatchHandles(this)?.forEach(handle=>handles.add(handle))}):handles=getNewColourSwatchHandles(context),fetchColourSwatchProductCards(handles)};$(document).on("product_list_loaded",function(event2,children){children||(children=event2.detail),initColourSwatches($(children))}),initColourSwatches(),document.querySelectorAll(".Account__MenuTrigger").forEach(function(trigger){trigger.addEventListener("click",function(e){if(!e.target.closest("shopify-account")){var account=trigger.closest(":has(> shopify-account)")?.querySelector("shopify-account"),btn=account?.shadowRoot?.querySelector("button");btn?btn.click():trigger.dataset.fallbackHref&&window.location.assign(trigger.dataset.fallbackHref)}})}),Cookies.get("account_first_name")&&document.querySelectorAll("[data-welcome-back-template]").forEach(el=>{const tpl=el.dataset.welcomeBackTemplate;tpl&&(el.textContent=tpl.replace("[NAME]",Cookies.get("account_first_name")))});let loyaltyFetchPromise;document.querySelectorAll("button.LoyaltyPoints").forEach(button=>{const customerId=button.dataset.loyaltyCustomer,signature=button.dataset.loyaltySignature,shop=Shopify.shop,count=button.querySelector(".LoyaltyPoints__Count");let points;const updateCount=value=>{count&&(count.textContent=Math.max(0,value).toLocaleString())};loyaltyFetchPromise||(loyaltyFetchPromise=fetch(`https://loyalty.disturbia.app/customer/${customerId}`,{headers:{Accept:"application/json","X-Shop-Domain":shop,"X-Customer-Signature":signature},mode:"cors"}).then(response=>response.ok?response.json():null).then(result=>result?.points_balance).catch(()=>{})),loyaltyFetchPromise.then(newPoints=>{if(!Number.isFinite(newPoints)){button.remove();return}button.querySelector(".LoyaltyPoints__Count").classList.remove("shimmer"),button.removeAttribute("aria-busy"),button.removeAttribute("aria-label"),button.removeAttribute("tabindex"),button.addEventListener("click",()=>{document.dispatchEvent(new CustomEvent("yotpo-loyalty-spotlight-open-drawer"))}),updateCount(newPoints),points=newPoints}),document.addEventListener("yotpo-loyalty-spotlight-discount-changed",event2=>{const reservedPoints=(event2.detail&&event2.detail.appliedDiscounts||[]).filter(discount=>discount.type==="redemption").reduce((total,discount)=>total+discount.amount,0);Number.isFinite(points)&&updateCount(points-reservedPoints)})}),document.querySelectorAll("#header-currency-popover-0, #header-currency-popover-1, #currency-modal").forEach(countrySelector=>{const container=document.createElement("div");container.classList.add("Popover__Filter");const searchIcon=document.createElement("img");searchIcon.src="https://assets.disturbia.co.uk/assets/fa/svgs/solid/search.svg",searchIcon.classList.add("Popover__FilterSearchIcon");const search=document.createElement("input");
1search.type="text",search.placeholder=countrySelector.dataset.filterPlaceholder,search.autocomplete="off",search.classList.add("Form__Input","Popover__FilterInput");const clearButton=document.createElement("button");clearButton.type="button",clearButton.textContent="\u2716",clearButton.classList.add("Popover__FilterClearIcon"),container.appendChild(searchIcon),container.appendChild(search),container.appendChild(clearButton),countrySelector.matches(".Modal")?countrySelector.querySelector(".Modal__Header").append(container):countrySelector.prepend(container);const getValues=()=>countrySelector.querySelectorAll(".Popover__Value"),getFirstVisible=()=>countrySelector.querySelector(".Popover__Value:not([hidden])");clearButton.addEventListener("click",()=>{search.value="",getValues().forEach(country2=>{country2.hidden=!1})}),search.addEventListener("input",event2=>{const inputValue=search.value.toLowerCase();getValues().forEach(country2=>{const currentCountry=country2.textContent.toLowerCase(),currentCountryCode=(country2.matches("[value]")?country2.value:country2.dataset.country).toLowerCase();country2.hidden=!(currentCountry.startsWith(inputValue)||currentCountryCode==inputValue||inputValue=="uk"&¤tCountryCode=="gb")})}),search.addEventListener("keydown",event2=>{switch(event2.key){case"Enter":case"ArrowDown":case"Tab":const item=getFirstVisible();item&&item.focus(),event2.preventDefault();break}})}),$(".Modal [data-action=open-modal]").on("click",function(){forceModalOpen($(this).attr("aria-controls"))});const startTracking=function(){document.dispatchEvent(new Event("trackingLoaded")),$("span.allow_marketing_cookies_checkbox :checkbox").prop("checked",!0),Cookies.set("allow_marketing_tracking","1",cookie_settings)},stopTracking=function(){Cookies.remove("allow_marketing_tracking")};Shopify.loadFeatures([{name:"consent-tracking-api",version:"0.1",onLoad:function(){if(typeof Shopify.customerPrivacy>"u")return;Shopify.customerPrivacy.userCanBeTracked()?startTracking():stopTracking();const cookieBanner=document.getElementById("cookie-banner");if(cookieBanner){Shopify.customerPrivacy.shouldShowGDPRBanner()&&!Shopify.designMode&&(cookieBanner.hidden=!1);const redisplayModal=function(){const existing_modal=document.querySelector(".Modal[aria-hidden=false]");existing_modal&&setTimeout(function(){forceModalOpen(existing_modal.id)},100)};cookieBanner.querySelectorAll(".Button--primary[data-action=close-modal]").forEach(element=>{element.addEventListener("click",function(e){Shopify.customerPrivacy.setTrackingConsent(!0,function(){}),redisplayModal()})}),cookieBanner.querySelectorAll(".Button--secondary[data-action=close-modal]").forEach(element=>{element.addEventListener("click",function(e){Shopify.customerPrivacy.setTrackingConsent(!1,function(){}),redisplayModal()})}),cookieBanner.querySelectorAll("[data-action=close-modal]").forEach(element=>{element.addEventListener("click",function(){cookieBanner.hidden=!0})}),cookieBanner.querySelectorAll("[data-action=show-settings]").forEach(element=>{element.addEventListener("click",function(){for(let el of cookieBanner.children)el.hidden=!el.classList.contains("CookieBanner__Settings")})})}}}]),document.addEventListener("trackingConsentAccepted",startTracking),$("span.allow_marketing_cookies_checkbox").each(function(){var input=$('<input type="checkbox"/>');input.prop("checked",Shopify&&Shopify.customerPrivacy&&Shopify.customerPrivacy.userCanBeTracked()),$(this).empty().append(input),input.on("change",function(){if(Shopify&&Shopify.customerPrivacy)Shopify.customerPrivacy.setTrackingConsent(input.prop("checked"),function(){}),input.prop("checked")||stopTracking();else return alert("Sorry, there was an error changing your cookie preference. Please reload the page and try again."),!1})}),document.addEventListener("filters:refresh",()=>{document.querySelectorAll(".CollectionInner__Products").forEach(collection=>{const productCount=collection.querySelector(".ProductListWrapper")?.dataset.productsCount||0;collection.closest("section")?.querySelectorAll(".CollectionToolbar__ProductsCount").forEach(toolbarCounter=>{toolbarCounter.textContent=productCount})})});const selectPlusSizeInCarousel=function(carousel){const enable=document.body.classList.contains("features--show-plussize-images"),flkty=Flickity.data(carousel);if(!flkty)return;let index=0;
1if(enable){const image=carousel.querySelector(".ProductItem__ImageSlideshowItem--plussize, .Product__SlideItem--plussize");image&&(index=Math.max(-1,Array.from(image.parentElement.children).indexOf(image)))}matchMedia("not all and (hover: hover), not all and (pointer: fine)").matches||index++,flkty.select(index,!1,!0)},togglePlusSize=function(enable=null){typeof enable!="boolean"&&enable!==null&&(enable=!document.body.classList.contains("features--show-plussize-images")),document.body.classList.toggle("features--show-plussize-images",enable),document.querySelectorAll("[data-action=plussize-toggle]").forEach(element=>{element.classList.toggle("is-active",enable),element.blur()}),document.querySelectorAll("[data-action=plussize-show]").forEach(element=>{element.classList.toggle("is-active",enable)}),document.querySelectorAll("[data-action=plussize-hide]").forEach(element=>{element.classList.toggle("is-active",!enable)}),document.querySelectorAll(".ProductItem__ImageSlideshow:has(.ProductItem__ImageSlideshowItem--plussize)").forEach(carousel=>selectPlusSizeInCarousel(carousel)),document.querySelectorAll(".Product__Slideshow:has(.Product__SlideItem--plussize)").forEach(carousel=>selectPlusSizeInCarousel(carousel)),Cookies.set("plussize_images",enable?1:0,cookie_settings)};function removePlusSizeFunctionality(){togglePlusSize(!1);const prodPagePlusSizeCarousel=document.querySelector(".Product__Slideshow:has(.Product__SlideItem--plussize)");prodPagePlusSizeCarousel?(console.log(prodPagePlusSizeCarousel),document.querySelectorAll(".Product__SlideshowNavImage").forEach((el,index)=>{el.matches(".Product__SlideshowNavImage--plussize, .Product__SlideshowNavImage--plussize ~ *")&&document.querySelector(`.Product__SlideshowMobileNav .flickity-page-dots [data-index="${index}"]`)?.remove()}),document.querySelectorAll(".Product__SlideshowNavImage--plussize, .Product__SlideshowNavImage--plussize ~ *").forEach(el=>el.remove()),document.querySelectorAll(".Product__SlideItem--plussize, .Product__SlideItem--plussize ~ *").forEach(el=>el.remove()),document.querySelectorAll(".Product__SlideshowNavDot--plussize, .Product__SlideshowNavDot--plussize ~ *").forEach(el=>el.remove()),Flickity.data(prodPagePlusSizeCarousel).reloadCells()):document.querySelectorAll(".ProductItem__ImageSlideshowItem--plussize, .ProductItem__ImageSlideshowItem--plussize ~ *").forEach(el=>el.remove()),document.querySelector('.Popover__ValueGroup:has([data-action^="plussize-"])')?.remove()}let abid;switch(Shopify.shop){case"disturbia-uk.myshopify.com":abid=window.dfc("CRO-DSUK-501-PLP-PDP-PLUS-SIZE");break;case"disturbia-eu.myshopify.com":abid=window.dfc("CRO-DSEU-501-PLP-PDP-PLUS-SIZE");break}abid!==1&&removePlusSizeFunctionality(),Cookies.get("plussize_images")==1&&togglePlusSize(!0),document.querySelectorAll("[data-action=plussize-toggle]").forEach(element=>{element.addEventListener("click",togglePlusSize)}),document.querySelectorAll("[data-action=plussize-show]").forEach(element=>{element.addEventListener("click",()=>togglePlusSize(!0))}),document.querySelectorAll("[data-action=plussize-hide]").forEach(element=>{element.addEventListener("click",()=>togglePlusSize(!1))});const productFeaturesResizeObserver=new ResizeObserver(entries=>{for(const entry of entries)Flickity.data(entry.target)?.resize()});document.querySelectorAll(".ProductFeatures [data-flickity-options]").forEach(carousel=>{new Flickity(carousel,JSON.parse(carousel.dataset.flickityOptions||{})),productFeaturesResizeObserver.observe(carousel)});const productImageCarousel=function(context){(!context||!context.length)&&(context=$("body"));const carousel=$(".ProductItem__ImageSlideshow",context).flickity({wrapAround:!0,pageDots:!1,dragThreshold:20,initialIndex:!window.matchMedia("(hover: hover)").matches||!window.matchMedia("(pointer: fine)").matches?0:1,setGallerySize:!1});$(".ProductItem__ImageSlideshow",context).each(function(){selectPlusSizeInCarousel(this)}),prefersReducedMotion||carousel.on("cellSelect.flickity",function(){this.querySelectorAll("video").forEach(video=>video.pause()),this.querySelector(".Carousel__Cell.is-selected video")?.play()})};
1prefersReducedMotion||(delegate.on("mouseover",".ProductItem__ImageWrapper",event2=>{const container=event2.target.matches(".ProductItem__ImageWrapper")?event2.target:event2.target.closest(".ProductItem__ImageWrapper"),carousel=container.querySelector(".ProductItem__ImageSlideshow");carousel?carousel.querySelector(".Carousel__Cell.is-selected video")?.play():container.querySelector(".ProductItem__Image--alternate video")?.play()}),delegate.on("mouseout",".ProductItem__ImageWrapper",event2=>{(event2.target.matches(".ProductItem__ImageWrapper")?event2.target:event2.target.closest(".ProductItem__ImageWrapper")).querySelectorAll("video").forEach(video=>video.pause())})),$(".CollectionInner").on("click",".flickity-prev-next-button",function(event2){event2.preventDefault()}),$(window).on("load",function(){matchMedia("not all and (hover: hover), not all and (pointer: fine)").matches&&$("body:not(.features--show-plussize-images) .Grid__Cell:first-of-type .ProductItem__ImageWrapper .flickity-slider").addClass("peek-intro").each(function(){setTimeout(()=>{$(this).removeClass("peek-intro").closest(".ProductItem__ImageSlideshow").flickity("select",0,!1,!0),$(".ProductItem__ImageSlideshow").on("select.flickity",function(){Cookies.set("collection_product_carousel_changed",1,cookie_settings)})},1500)})}),$(document).on("product_list_loaded",function(event2,children){children||(children=event2.detail),$("div.ProductItem",children).css({visibility:"inherit"}),$("div.ProductItem",$(children).closest(".ProductList")).css("opacity",1),productImageCarousel(children)});const collectionInfiniteScroll=function(){var collectionSelectorPrefix=$("body").is(".features--bespoke-search")?"section:not(.search-results-container) ":"";$(collectionSelectorPrefix+"div.CollectionMain div.ProductList").autoload({paginator:"div.Pagination",nextLink:"div.Pagination a[rel=next]",nextContent:"div.CollectionMain div.ProductList",saveContent:"div.CollectionMain",onload:children=>$(document).trigger("product_list_loaded",[children]),loading:'<p class="autoload-loading BouncingSpinner">Loading <br> <span></span><span></span></p>',more:'<p class="autoload-more"><a href="#" class="Button Button--primary">Load More...</a></p>',sequence:[!0,!0,!1],offset:400})};$(document).on("filters:refresh",collectionInfiniteScroll),collectionInfiniteScroll(),productImageCarousel(),$(document).on("filters:refresh",productImageCarousel),$("div.AnnouncementBar").each(function(){var bar=$(this);$("a",bar).length==1&&(bar.addClass("clickable"),bar.on("click",function(){document.location=$("a",bar).attr("href")}));var wrapper=$("div.AnnouncementBar__Wrapper",bar);if(bar.data("display-mode")=="marquee"){var marquee=wrapper,close=$("button.close",bar),always_scroll=bar.data("always-scroll"),continuous_scroll=bar.data("continuous-scroll");close.hide().on("click",function(){return bar.slideUp(function(){$(document).trigger("announcement:resize")}),Cookies.set("hide_marquee",Date.now(),cookie_settings),!1});var marquee_active=!1,scrollBannerStart=function(){for(marquee.css({width:"auto",visibility:"visible"}).marquee("destroy"),marquee_active=!1,marquee.children().each(function(){$(this).data("cloned")&&$(this).detach()});continuous_scroll&&contentsWidth(!0)<marquee.width();)marquee.append(marquee.children().clone(!0).data("cloned",!0));marquee.marquee({speed:parseInt(bar.data("animation-speed")),gap:parseInt(bar.data("animation-delay")),delayBeforeStart:0,pauseOnHover:!0,duplicated:continuous_scroll}),marquee_active=!0,close.show(),initCountdownTimers(wrapper),$(document).trigger("announcement:resize")},scrollBannerStop=function(){marquee_active&&(marquee.marquee("destroy"),marquee_active=!1,close.hide(),$(document).trigger("announcement:resize"),marquee.children().each(function(){$(this).data("cloned")&&$(this).detach()})),initCountdownTimers(wrapper)},contentsWidth=function(include_cloned=!1){var width=0,children=(marquee_active?$("div.js-marquee",marquee):marquee).children(".AnnouncementBar__Item");return children.each(function(){(include_cloned||!$(this).data("cloned"))&&(width+=$(this).outerWidth(!0))}),width};bar.addClass("active"),marquee.css("width","auto"),always_scroll||contentsWidth()>
1=marquee.width()?(marquee.css("width","max-content"),$(window).on("load",scrollBannerStart)):marquee.css("visibility","visible"),$(window).on("resize",function(){always_scroll||contentsWidth()>=marquee.width()?scrollBannerStart():scrollBannerStop()})}else bar.data("display-mode")=="fade"&&($(".AnnouncementBar__Item",wrapper).each(function(i,el){wrapper.prepend(el)}),bar.addClass("active"),setInterval(function(){var children=$(".AnnouncementBar__Item",wrapper);children.length>1&&($(".AnnouncementBar__Item",wrapper).eq(-2).fadeTo(parseInt(bar.data("animation-speed")),1),children.last().fadeTo(parseInt(bar.data("animation-speed")),0,function(){wrapper.prepend(this)}))},parseInt(bar.data("animation-speed"))+parseInt(bar.data("animation-delay"))*1e3));var section=bar.closest("#shopify-section-announcement, #shopify-section-announcement-bottom")[0];if(section){var cssVar=section.id==="shopify-section-announcement"?"--announcement-bar-height":"--announcement-bar-bottom-height";new ResizeObserver(function(entries){document.documentElement.style.setProperty(cssVar,entries[0].contentRect.height)}).observe(section)}});const topAnnouncementBar=document.getElementById("shopify-section-announcement"),bottomAnnouncementBar=document.getElementById("shopify-section-announcement-bottom");bottomAnnouncementBar&&topAnnouncementBar?.querySelector(".AnnouncementBar")&&new IntersectionObserver(entries=>{entries.forEach(entry=>{bottomAnnouncementBar.classList.add("animate"),bottomAnnouncementBar.classList.toggle("show",!entry.isIntersecting)})}).observe(topAnnouncementBar);const setGlobalEFreeShippingMessage=function(message,container){message&&message.length&&(container?[container]:document.querySelectorAll(".Cart__ShippingMessage")).forEach(container2=>{if(container2.textContent.length==0||container2.matches(".globale-shipping-message")){const p=document.createElement("p");p.classList.add("free-delivery-message"),p.textContent=message,container2.replaceChildren(p),container2.classList.add("globale-shipping-message")}})};var globale_shipping_message="";const globaleObserver=new MutationObserver(function(list){for(const mutation of list)if(mutation.type==="childList")for(const node of mutation.addedNodes){globale_shipping_message=$(node).text(),setGlobalEFreeShippingMessage(globale_shipping_message),$(".PromoIcons .globale-replace .PromoIcons__Message > div").empty().append(`<p>${globale_shipping_message}</p>`);const containers=$("div.AnnouncementBar .globale-replace");$(node).wrapInner('<p class="AnnouncementBar__Content globale-shipping-banner"></p>'),containers.length?containers.empty().append($(node).contents()):$("div.AnnouncementBar.globale-append").each(function(){const container=$(".AnnouncementBar__Item").last().clone(!0);container.empty().append($(node).contents().clone()),$(this).data("display-mode")=="fade"?$(this).children().prepend(container):$(this).children().append(container)}),$(document).trigger("announcement:resize")}});window.theme.globaleEnabled&&document.getElementById("globale-banner")&&globaleObserver.observe(document.getElementById("globale-banner"),{childList:!0});var speed=250,target=".Faq__CollapseSections .Faq__Section";$("body").on("faq_open",target,function(){var heading=$(this);heading.closest(".Faq").siblings(".Faq").children(".Faq__Section").trigger("faq_close"),heading.attr("aria-expanded","true"),heading.next(".Faq__SectionWrapper").attr("aria-hidden","false").slideDown(speed)}).on("faq_close",target,function(){var heading=$(this);heading.attr("aria-expanded","false"),heading.next(".Faq__SectionWrapper").attr("aria-hidden","true").slideUp(speed)}).on("blockselect",target,function(){$(this).trigger("faq_open")}).on("blockdeselect",target,function(){$(this).trigger("faq_close")}).on("click",target,function(event2){var heading=$(this);return heading.attr("aria-expanded")=="true"?heading.trigger("faq_close"):heading.trigger("faq_open"),!1});const highlighted_collections_count=$(".HighlightedCollection").length;if(highlighted_collections_count){const highlightedCollectionSpacing=function(){$(".HighlightedCollection").each(function(index){const image=$(".HighlightedCollection__ImageContainer",this),content_height=$(".HighlightedCollection__ContentContainer",this).height(),image_height=image.height(),spacing=Math.max(parseInt(image.css("margin-left")),parseInt(image.css("margin-left"))),overlap=-parseInt($(this).css("margin-bottom")),multiplier=index==0||index==highlighted_collections_count-1?1:2,difference=image_height-multiplier*overlap-(content_height+multiplier*spacing);difference<0?$(this).css({paddingTop:index==0?0:-difference/2+"px",paddingBottom:-difference/2+"px"}):$(this).css({paddingTop:"0px",paddingBottom:"0px"})})};window.addEventListener("resize",highlightedCollectionSpacing,{passive:!0}),$(window).on("load",highlightedCollectionSpacing),$(window).on("lazyloaded",e=>{$(e.target).is(".HighlightedCollection__Image")&&highlightedCollectionSpacing()})}const cartToken=Cookies.get("cart");if(typeof cartToken=="string"&&cartToken.length&&Cookies.set("cart",cartToken,{expires:90,sameSite:"Lax"}),navigator.share&&$(document).on("click","button.native-share",function(){return navigator.share({title:document.title,url:document.querySelector("link[rel=canonical]")?document.querySelector("link[rel=canonical]").href:document.location.href}),!1}),country){const initShippingGuides=container=>{container=container||document.body;const guides=container.querySelectorAll(".ShippingGuide"),button=container.querySelector("button[data-action=shipping-guides-show]"),country_guides=[],zone_guides=[];
1guides.forEach(guide=>{guide.dataset.countries?.toLowerCase().split(",").includes(country?.toLowerCase())&&country_guides.push(guide),guide.dataset.zones?.toLowerCase().split(",").includes(zone?.toLowerCase())&&zone_guides.push(guide)}),button&&(country_guides.length||zone_guides.length)&&(guides.forEach(guide=>guide.hidden=!0),button.hidden=!1,country_guides.length?country_guides.forEach(guide=>guide.hidden=!1):zone_guides.length&&zone_guides.forEach(guide=>guide.hidden=!1),button.addEventListener("click",event2=>{guides.forEach(guide=>guide.hidden=!1),button.hidden=!0,event2.preventDefault()}))};initShippingGuides();const fetchShippingGuides=(onError=()=>{},url=null)=>{const container=document.createElement("div");if(url=url||window.routes.shippingGuideUrl,!url)return;const loading=document.createElement("div");return loading.classList.add("BouncingSpinner"),loading.innerHTML="<span></span><span></span>",container.append(loading),fetch(url).then(response=>{if(!response.ok)throw new Error("Bad response");return response.text()}).then(response=>{new DOMParser().parseFromString(response,"text/html").querySelectorAll(".ShippingGuide, button[data-action=shipping-guides-show]").forEach(guide=>{container.append(guide)}),initShippingGuides(container)}).catch(onError).finally(()=>loading.remove()),container};document.querySelectorAll(".ShippingGuide__Placeholder").forEach(container=>{const new_container=fetchShippingGuides(()=>container.hidden=!1);container.before(new_container),container.hidden=!0});const cartObserver=new MutationObserver(function(list){loop:for(const mutation of list)if(mutation.type==="childList"){for(const node of mutation.addedNodes)if(node.matches(".Cart")){globale_shipping_message.length&&setGlobalEFreeShippingMessage(globale_shipping_message,node.querySelector(".Cart__ShippingMessage"));break loop}}});window.theme.globaleEnabled&&document.querySelector(".Cart")&&cartObserver.observe(document.querySelector(".Cart").parentElement,{childList:!0})}document.querySelectorAll(".Product__PopupLabel[data-handle]").forEach(el=>{const handle=el.dataset.handle;if(!handle)return;const url=`https://sop.disturbia.co.uk/api/stats/${encodeURIComponent(handle)}`;fetch(url).then(response=>response.text()).then(body=>{if(!body.trim())return;const data=JSON.parse(body),count=parseInt(data.count);if(Number.isNaN(count)||count<=0)return;const typeSegment=data.type==="orders"?"Orders":"CartAdds",content=window.languages[`socialProof${typeSegment}${data.window}`];content&&(el.textContent=content.replace(/##/g,count),setTimeout(()=>{el.hidden=!1},1e3),setTimeout(()=>{el.hidden=!0},8e3))}).catch(()=>{})}),$("[data-flickity-options]").each(function(){const el=$(this).flickity($(this).data("flickity-options"));$(document).on("breakpoint:changed",function(){el.flickity("resize"),el.flickity("reloadCells")})}),$('.Carousel--infinite[data-next-link^="/"]').each(function(){let parent=$(this),next_link=parent.data("next-link"),flkty=!1,section_id=parent.closest("[data-section-id]").data("section-id"),block_id=parent.closest("[data-block-id]").data("block-id");$(".flickity-slider",parent).length&&(flkty=Flickity.data(parent.get(0)),parent=$(".flickity-slider",parent));let first_child=parent.children(".Carousel__Cell").first().get(0),observer=new IntersectionObserver(entries=>{entries.forEach(entry=>{entry.isIntersecting&&next_link&&next_link.length&&(next_link+=`§ion_id=${section_id}`,observer.unobserve(first_child),$(".flickity-slider",parent).length&&(flkty=Flickity.data(parent.get(0)),parent=$(".flickity-slider",parent)),$.get(next_link).done(result=>{next_link=$("[data-next-link]",result).data("next-link");let children=$(`#block-${block_id} .Carousel__Cell`,result);children.length&&((flkty||parent).append(children),first_child=children.first().get(0),observer.observe(first_child))}))})},{root:this});observer.observe(first_child)}),document.querySelectorAll(".Search__SearchBar .Search__Input").forEach(element=>{element.addEventListener("keydown",event2=>{if(event2.key=="Enter"){const button=element.closest(".Search")?.querySelector(".Segment__ButtonWrapper a");button&&(button.click(),event2.preventDefault())}})}),$(".Search__Results").on("click",".ProductItem__Wrapper",function(){document.location.assign($("a",this).attr("href"))});const initBackInStockCollectionPageButtons=function(context){context=context||document,context.querySelectorAll(".ProductItem:not(.ProductItem--available, .ProductItem--promo)").forEach(element=>{const link=element.querySelector("a.ProductItem__ImageWrapper"),button=document.createElement("button");button.classList.add("Button","Button--secondary","Button--opaque","klaviyo-bis-button"),button.append("Notify me!"),element.querySelector(".ProductItem__Info")?.before(button),button.addEventListener("click",event2=>{const url=new URL(link.href);
1url.searchParams.append("notify","back-in-stock"),link.href=url,link.click()})})};$(document).on("product_list_loaded",function(event2,children){children||(children=event2.detail),children instanceof jQuery?children.each(function(){initBackInStockCollectionPageButtons(this)}):initBackInStockCollectionPageButtons(children)}),initBackInStockCollectionPageButtons(),query_string.get("notify")=="back-in-stock"&&new MutationObserver(function(list){loop:for(const mutation of list)if(mutation.type==="childList"){for(const node of mutation.addedNodes)if($(node).is("a.klaviyo-bis-trigger")){setTimeout(()=>node.click(),1);break loop}}}).observe($("#klaviyo-bis-container")[0],{childList:!0}),delegate.on("click",".ProductForm__Variants li.no-stock label",event2=>{const trigger=document.querySelector("a.klaviyo-bis-trigger");if(trigger)setTimeout(()=>trigger.click(),10);else{const link=event2.target.closest(".ProductItem").querySelector("a.ProductItem__ImageWrapper");var url=new URL(link.href);url.searchParams.append("notify","back-in-stock"),document.location.assign(url)}}),$("body").on("click",'[data-action="add-to-cart-noform"]',function(){var button=$(this);return button.attr("disabled","disabled"),$(document).trigger("theme:loading:start"),fetch(window.routes.cartAddUrl+".js",{body:JSON.stringify({id:button.attr("data-variant-id"),selling_plan:button.attr("data-selling-plan")}),credentials:"same-origin",method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"}}).then(function(response){button.removeAttr("disabled"),$(document).trigger("theme:loading:end"),response.ok?$("#sidebar-cart").length?button[0].dispatchEvent(new CustomEvent("product:added",{bubbles:!0,detail:{variant:button.attr("data-variant-id"),quantity:1}})):document.location.assign(window.routes.cartUrl):response.json().then(function(content){alert(content.description),document.location.assign(button.attr("href"))})}),!1}),delegate.on("change",'.FreeGift__Form select[name="id"]',e=>{const select=e.target.closest("select"),btn=select?.closest(".FreeGift__Form")?.querySelector('[data-action="add-to-cart-noform"][data-variant-id]');btn&&select.value&&(btn.dataset.variantId=select.value)});function initCountdownTimers(container){container=container||document.body,$.fn.countdown&&$(".CountdownTimer span.timer",container).countdown({onEnd:function(){$(this).closest(".CountdownTimer").addClass("finished")}})}Shopify.designMode&&$.fn.countdown&&$("body").on("shopify:section:load",()=>initCountdownTimers(event.target)),initCountdownTimers(),document.querySelectorAll("[data-store-availability]").forEach(async container=>{const stores=container.dataset.storeAvailability.split(","),query=JSON.stringify({query:"query($handle: String!) { product(handle: $handle) { availableForSale } shop { primaryDomain { host } } }",variables:{handle:container.dataset.productHandle}}),url=new URL(document.location);url.searchParams.set("country",country);const requests=stores.map(store=>fetch(`https://${store}/api/2025-07/graphql.json`,{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":window.theme?.storeTokens[store]},body:query})),results=(await Promise.allSettled(requests)).filter(response=>response.status=="fulfilled"&&response.value.ok).map(response=>response.value.json()),links=(await Promise.allSettled(results)).map(result=>result.value.data).filter(result=>result?.product?.availableForSale).map(result=>result?.shop?.primaryDomain?.host).filter(host=>host.length).map(store=>(url.hostname=store,`<a href="${url}" target="_blank"><u>${window.theme?.storeNames[store]}</u></a>`)).join(" | ");links.length&&(container.innerHTML=container.innerHTML.replace("[STORES]",links),container.hidden=!1)}),document.querySelectorAll(".SidebarMenu").forEach(sidebar=>{sidebar.querySelectorAll("[data-action]:not([data-action=close-drawer])").forEach(element=>element.addEventListener("click",event2=>{event2.preventDefault(),sidebar.querySelector("[data-action=close-drawer]")?.click()})),sidebar.querySelector("[data-action=close-drawer]")?.addEventListener("click",event2=>{setTimeout(()=>sidebar.querySelectorAll(".SidebarMenu__SubMenu.active, .SidebarMenu__SubSubMenu.active").forEach(element=>element.classList.remove("active")),500),document.querySelector(`[data-action=open-drawer][data-drawer-id=${sidebar.id}]`)?.focus()}),sidebar.querySelectorAll(".SidebarMenu__Button:not([data-action])").forEach(button=>button.addEventListener("click",event2=>{button.closest(".SidebarMenu__Nav")?.querySelectorAll(".SidebarMenu__SubMenu, .SidebarMenu__SubSubMenu").forEach(menu=>menu.classList.remove("active")),button.closest("li").querySelector(".SidebarMenu__SubMenu, .SidebarMenu__SubSubMenu")?.classList.add("active")})),sidebar.querySelectorAll(".SidebarMenu__Back").forEach(button=>button.addEventListener("click",event2=>{const active=button.closest(".SidebarMenu__SubMenu.active, .SidebarMenu__SubSubMenu.active");active.classList.remove("active"),active.matches(".SidebarMenu__SubSubMenu")&&active.closest(".SidebarMenu__SubMenu")?.classList.add("active")}))}),window.KlarnaOnsiteService=window.KlarnaOnsiteService||[];const initPaymentProviderFlickity=container=>{if(!container.matches(".flickity-enabled")){const flkty=new Flickity(container,JSON.parse(container.dataset.flickityOptions||{}));flkty.on("cellSelect",()=>flkty.reloadCells())}},initPaymentProviderMessaging=container=>{if(container.querySelectorAll(":scope > .cell").length>1)initPaymentProviderFlickity(container);else{const paymentMessageCellObserver=new MutationObserver(list=>{paymentMessageCellObserver.disconnect(),initPaymentProviderMessaging(container)});
1[...container.children].forEach(element=>paymentMessageCellObserver.observe(element,{childList:!0}))}};document.querySelectorAll(".ProductForm .Product__PaymentProviderMessages[data-flickity-options]").forEach(initPaymentProviderMessaging);const cartPaymentMessageObserver=new MutationObserver(function(list){loop:for(const mutation of list)if(mutation.type==="childList"){for(const node of mutation.addedNodes)if(node.matches(".Cart")){window.Klarna&&Klarna.OnsiteMessaging.refresh(),window.paypal&&paypal.Messages.render("[data-pp-message]");break loop}}}),cart=document.querySelector(".Cart");cart&&cart.parentElement&&cartPaymentMessageObserver.observe(cart.parentElement,{childList:!0});const productFormAddButton=document.querySelector(".Product button.ProductForm__AddToCart");if(productFormAddButton){const productForm=productFormAddButton.closest("form"),stickyButtonContainer=document.createElement("div");stickyButtonContainer.classList.add("Product__StickyContainer");const stickyButtonModal=document.getElementById("variant-modal"),stickyButton=document.createElement("button");if(stickyButton.classList.add("Button","Button--primary","Button--full"),stickyButton.textContent=window.languages.productFormAddToCart,stickyButtonModal){const iconUrl="https://assets.disturbia.co.uk/assets/fa/svgs/solid/angle-down.svg",iconImg=document.createElement("img");iconImg.src=iconUrl,iconImg.classList.add("Icon"),stickyButton.appendChild(iconImg),stickyButton.dataset.action="open-modal",stickyButton.setAttribute("aria-controls","variant-modal"),stickyButtonModal.querySelectorAll("button.Popover__Value").forEach(button=>{button.addEventListener("click",event2=>{stickyButtonModal.querySelector(".Modal__Close").click(),document.querySelector(`[for=${button.dataset.option}]`).click(),setTimeout(()=>productFormAddButton.click(),100)});const variantSelector=document.getElementById(button.dataset.option).closest(".HorizontalList__Item");variantSelector.classList.contains("no-stock")&&button.classList.add("no-stock");const toolTip=variantSelector.querySelector("[data-tooltip]"),newTooltip=document.createElement("span");toolTip&&(newTooltip.classList.add("Text--subdued"),newTooltip.classList.add("HorizontalList__Item"),newTooltip.textContent=toolTip.dataset.tooltip,button.closest(".Popover__ValueList").classList.add("has-tooltips"));const icon=variantSelector.querySelector("img.Icon");icon&&newTooltip.prepend(icon.cloneNode()),newTooltip.textContent.length&&button.append(newTooltip)})}else stickyButton.addEventListener("click",event2=>{productFormAddButton.click(),event2.preventDefault()});stickyButtonContainer.append(stickyButton);const productFormWishlistButton=productForm.querySelector(".cake-wishlist-icon");if(productFormWishlistButton){const wishlistButton=productFormWishlistButton.cloneNode(!0);wishlistButton.querySelectorAll(".wishlist-label").forEach(label=>label.hidden=!0),stickyButtonContainer.appendChild(wishlistButton)}document.body.append(stickyButtonContainer);const stickyButtonObserver=new IntersectionObserver(entries=>{var intersecting=!1;entries.forEach(entry=>{entry.isIntersecting&&(intersecting=!0)}),stickyButtonContainer.hidden=intersecting},{root:null,threshold:.9}),productFormVariants=productForm.querySelector(".ProductForm__Variants");stickyButtonObserver.observe(productFormVariants||productFormAddButton)}const customImageAnimationObserver=new IntersectionObserver(entries=>{entries.forEach(entry=>{entry.isIntersecting&&(entry.target.complete?entry.target.classList.add("Image--lazyLoaded"):entry.target.addEventListener("load",event2=>event2.target.classList.add("Image--lazyLoaded")),customImageAnimationObserver.unobserve(entry.target))})},{threshold:.2});[...document.getElementsByClassName("Image--slideCustom")].forEach(element=>customImageAnimationObserver.observe(element)),$(".CollectionFilters").on("change",'[name="filter.p.m.filter.type"]',function(){$('[name="filter.p.m.filter.subtype"]',$(this).closest("ul")).prop("checked",!1)}),$(".CollectionFilters").on("change",'[name="filter.p.m.filter.subtype"]',function(){$('[name="filter.p.m.filter.type"]',$(this).closest("ul.Linklist")).prop("checked",!1),$('[name="filter.p.m.filter.subtype"]',$(this).closest("li:not(.Linklist__SubItem)").siblings()).prop("checked",!1)});const prepareFilters=function(){$(".CollectionFilters button.show-all").on("click",function(){$(this).prev("ul").children().show(),$(this).remove()})};prepareFilters(),$(document).on("theme:loading:end",prepareFilters),$("div.cf-video[data-video-link]").click(function(){document.location.assign(this.dataset.videoLink)});var lazyVideoObserver=new IntersectionObserver(function(entries,observer){entries.forEac
1h(function(video){video.isIntersecting&&(video.target.play(),observer.unobserve(video.target))})});document.querySelectorAll(".Video--lazy video").forEach(video=>lazyVideoObserver.observe(video)),$(document).on("product_list_loaded",function(){typeof yotpoWidgetsContainer<"u"&&(document.readyState==="complete"?yotpoWidgetsContainer.initWidgets(!1):document.onreadystatechange=()=>{document.readyState==="complete"&&yotpoWidgetsContainer.initWidgets(!1)})}).on("click",".ProductItem__Info .standalone-bottomline",function(){this.closest(".ProductItem__Wrapper").querySelector("a.ProductItem__ImageWrapper").click()}),delegate.on("click","tr:has(.row-action)",function(event2){const avoid=".row-action, a, button, input, select, textarea";if(!event2.target.matches(avoid)&&event2.target.closest(avoid)===null){const action=event2.target.closest("tr").querySelector(".row-action");action&&action.click()}}),document.querySelectorAll(".ProductForm__GiftCardFields--is_a_gift input").forEach(checkbox=>{checkbox.addEventListener("change",event2=>{event2.target.closest(".ProductForm__GiftCardFields").querySelectorAll(".Form__Item").forEach(item=>{item.hidden=!checkbox.checked})}),window.addEventListener("pageshow",event2=>{checkbox.dispatchEvent(new Event("change"))})}),document.querySelectorAll(".ProductForm__GiftCardFields").forEach(giftCardForm=>{const select=giftCardForm.querySelector(".ProductForm__GiftCardCountrySelect");if(!select||!window.theme?.storefrontRedirect)return;const{countryInThisStore,getDomainFromCountry}=window.theme.storefrontRedirect,redirectDiv=giftCardForm.querySelector(".ProductForm__GiftCardRedirect"),tpl=redirectDiv.querySelector("template");tpl.replaceWith(tpl.content);const updateRedirect=function(){const countryName=select.value,country2=Countries[countryName]?.code;if(!country2||countryInThisStore(country2)){redirectDiv.hidden=!0;return}const domain=getDomainFromCountry(country2);if(!domain){redirectDiv.hidden=!0;return}const storeName=window.theme?.storeNames?.[domain]||domain,targetUrl=new URL(document.location);targetUrl.hostname=domain,targetUrl.searchParams.set("country",country2),redirectDiv.querySelectorAll("[data-replace-with]").forEach(el=>{switch(el.dataset.replaceWith){case"country":el.textContent=countryName;break;case"store":el.textContent=storeName;break;case"url":el.href=targetUrl.toString();break}}),redirectDiv.hidden=!1};select.addEventListener("change",updateRedirect),select.value=getCountryName(Shopify.country),window.addEventListener("pageshow",updateRedirect)});const initCartUpsell=upsell=>{const productList=upsell?.querySelector(".CartUpsell__ProductList");productList?.setAttribute("aria-hidden",Cookies.get("cart_upsell_hidden")==="1"?"true":"false"),requestAnimationFrame(()=>{upsell?.classList.add("CartUpsell--ready")}),productList&&!productList.matches(".flickity-enabled")&&typeof productList.dataset.flickityConfig<"u"&&new Flickity(productList,JSON.parse(productList.dataset.flickityConfig||{}))};document.querySelectorAll(".CartUpsell").forEach(initCartUpsell),delegate.on("click",".CartUpsell__Toggle",event2=>{const productList=event2.target.closest(".CartUpsell")?.querySelector(".CartUpsell__ProductList"),hidden=productList?.getAttribute("aria-hidden")==="true";Cookies.set("cart_upsell_hidden",hidden?"0":"1",{...cookie_settings,expires:1}),productList?.setAttribute("aria-hidden",hidden?"false":"true")}),new MutationObserver(list=>{loop:for(const mutation of list)if(mutation.type==="attributes"&&mutation.attributeName==="aria-hidden"&&mutation.target.matches(".Cart")){if(mutation.target.getAttribute("aria-hidden")==="false"){const upsell=mutation.target.querySelector(".CartUpsell");initCartUpsell(upsell);break loop}}else if(mutation.type==="childList"){for(const node of mutation.addedNodes)if(node.nodeType===Node.ELEMENT_NODE&&node.matches(".Cart")){const upsell=node.querySelector(".CartUpsell");initCartUpsell(upsell);break loop}}}).observe(document.querySelector(".Cart")?.parentElement,{attributes:!0,attributeFilter:["aria-hidden"],childList:!0,subtree:!0}),document.addEventListener("theme:loading:start",()=>{document.documentElement.classList.add("is-loading")}),document.addEventListener("theme:loading:end",()=>{document.documentElement.classList.remove("is-loading")}),document.addEventListener("theme:loading:end",async event2=>{const{cart:cart2,quantity,dataset}=event2.detail||{},action=dataset?.action;if(action!=="remove-item"&&!(action==="update-item-quantity"&&quantity===0)||!dataset?.properties)return;let propsArray;try{propsArray=JSON.parse(dataset.properties)}catch(error){console.warn("dataset.properties JSON error",dataset.properties,error);return}const bundleId=Object.fromEntries(propsArray)._bundle_id;if(!bundleId)return;const bundleItems=cart2.items.filter(item=>item.properties?._bundle_id===bundleId);if(bundleItems.length){for(const item of bundleItems){const updatedProps={...item.properties};delete updatedProps.Bundle,delete updatedProps._bundle_id,delete updatedProps._bundle_step,updatedProps._removed_from_bundle=bundleId;try{const res=await fetch(`${window.routes.cartChangeUrl}.js`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:item.key,quantity:item.quantity,properties:updatedProps})});if(!res.ok)throw new Error(`cartChange failed (${res.status})`)}catch(error){console.error(`Error updating cart item ${item.key}:`,error)}}document.documentElement.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0}))}});const initSizeGuideTables=container=>{container=container||document,container.querySelectorAll("table.SizeGuide").forEach(table=>{const hiddenCols=new Set,fixedCols=new Set,optionCols=new Map,options=new Set,cols=new Map,headers=new Map,handle=table.closest("[data-size-guide]")?.dataset.sizeGuide,showColumn=key=>cols.get(key)?.forEach(cell=>cell.hidden=!1),hideColumn=key=>cols.get(key)?.forEach(cell=>cell.hidden=!0);table.querySelectorAll("thead th").forEach((cell,key)=>{const opt=cell.dataset.sizeGuideOpt;if(typeof opt>"u")hiddenCols.add(key);else if(opt=="#")fixedCols.add(key);else{let col=optionCols.get(opt);col||(col=optionCols.set(opt,new Set).get(opt)),col.add(key),options.add(opt)}cols.set(key,new Set([cell]))}),table.querySelectorAll("tr").forEach(row=>
1{row.childNodes.forEach((cell,key)=>{let col=cols.get(key);col||(col=cols.set(key,new Set).get(key)),col.add(cell),cell.nodeName=="TH"&&!headers.get(key)&&headers.set(key,cell.textContent)})});const hiddenColumnsSelector=document.createElement("select");hiddenCols.forEach(key=>{const option=document.createElement("option");option.value=key,option.textContent=headers.get(key),hiddenColumnsSelector.append(option)});let firstHiddenColumn=hiddenCols.values().next().value;const hiddenColumnCookieValue=Cookies.get(`size_guide_hidden_cols_opt--${handle}`);hiddenCols.forEach(key=>{hiddenColumnCookieValue?key!=hiddenColumnCookieValue&&hideColumn(key):key!=firstHiddenColumn&&hideColumn(key);const header=[...cols.get(key)].filter(cell=>cell.nodeName=="TH")[0],selectorCopy=hiddenColumnsSelector.cloneNode(!0);header.replaceChildren(selectorCopy),selectorCopy.addEventListener("change",function(){const newKey=parseInt(this.value);hideColumn(key),showColumn(newKey),this.value=key,Cookies.set(`size_guide_hidden_cols_opt--${handle}`,newKey,cookie_settings)}),selectorCopy.value=key});const optionColumnsSelector=document.createElement("select");options.forEach(opt=>{const option=document.createElement("option");option.value=opt,option.textContent=opt,optionColumnsSelector.append(option)});const switchPrimeAISizeChartUnits=opt=>{if(window.switchSC)try{switch(opt){case"cm":switchSC(0);break;case"in":switchSC(1);break}}catch{}};let firstOption=!0;const optionColumnCookieValue=Cookies.get(`size_guide_option_cols_opt--${handle}`);switchPrimeAISizeChartUnits(optionColumnCookieValue),options.forEach(opt=>{optionColumnCookieValue?opt!=optionColumnCookieValue&&optionCols.get(opt)?.forEach(col=>hideColumn(col)):firstOption?firstOption&&switchPrimeAISizeChartUnits(opt):optionCols.get(opt)?.forEach(col=>hideColumn(col)),firstOption=!1;const header=[...cols.get([...optionCols.get(opt)][0])].filter(cell=>cell.nodeName=="TH")[0];let regex=new RegExp(`[^w-]${opt}[^w-]`);header.innerHTML=header.innerHTML.replace(regex," <span></span> ");const selectorCopy=optionColumnsSelector.cloneNode(!0);header.querySelector("span")?.replaceChildren(selectorCopy),selectorCopy.addEventListener("change",function(){const newOpt=this.value;optionCols.get(opt).forEach(col=>hideColumn(col)),optionCols.get(newOpt).forEach(col=>showColumn(col)),this.value=opt,Cookies.set(`size_guide_option_cols_opt--${handle}`,newOpt,cookie_settings),switchPrimeAISizeChartUnits(newOpt)}),selectorCopy.value=opt})})};initSizeGuideTables(),document.querySelectorAll("a[aria-controls=size-guide-modal]").forEach(link=>{link.addEventListener("click",event2=>{const modal=document.getElementById(link.getAttribute("aria-controls")),container=modal?.querySelector(".Modal__Content"),header=modal?.querySelector(".Modal__Header"),url=new URL(link.href),handle=url.hash.replace("#size-guide-","");if(!container||!link.href||!handle){event2.stopImmediatePropagation();return}event2.preventDefault(),fetch(url).then(response=>{if(!response.ok)throw new Error("Bad response");return response.text()}).then(response=>{const newPage=new DOMParser().parseFromString(response,"text/html"),tableContainer=container.querySelector(".SizeGuide__TableContainer"),contentContainer=container.querySelector(".SizeGuide__ContentContainer");for(;tableContainer.firstChild;)tableContainer.removeChild(tableContainer.firstChild);const guide=newPage.querySelector(`[data-size-guide=${handle}]`),title=header?.querySelector(".Modal__Title");title&&(title.textContent=guide.querySelector("caption").textContent),header?.querySelectorAll(".Modal__HeaderContent a").forEach(link2=>{link2.getAttribute("href")=="#"&&link2.classList.add("primeai_link")});const table=guide.querySelector("table"),tableWrapper=document.createElement("div");if(tableWrapper.classList.add("TableWrapper"),tableWrapper.append(table),tableContainer.append(tableWrapper),tableContainer.dataset.sizeGuide=handle,guide.dataset.showMeasuringGuide){for(;contentContainer.firstChild;)contentContainer.removeChild(contentContainer.firstChild);newPage.querySelectorAll(".FeatureText").forEach(el=>contentContainer.append(el))}initSizeGuideTables(tableContainer);const productFormSizeLabels=new Map;table.closest(".Product")?.querySelector("button.ProductForm__AddToCart")?.closest("form")?.querySelectorAll(".SizeSwatch").forEach(label=>productFormSizeLabels.set(label.textContent.trim(),label)),table.querySelectorAll("th:first-child").forEach(cell=>{const newCell=document.createElement("th");newCell.setAttribute("width","7%"),cell.after(newCell)});let hasButtons=!1;table.querySelectorAll("td:first-child").forEach(cell=>{const newCell=document.createElement("td");cell.after(newCell);const value=cell.textContent.trim();let option=productFormSizeLabels.get(value);if(!option){for(const[key,label]of productFormSizeLabels)if(key.split(" ").includes(value)){option=label;break}}if(option){const button=document.createElement("button");button.classList.add("Button","Button--small"),button.innerText=guide.dataset.addButtonText||"Add",option.closest(".HorizontalList__Item")?.classList.contains("no-stock")?button.classList.add("Button--secondary"):button.classList.add("Button--primary"),button.addEventListener("click",event3=>{option.click(),modal.querySelector(".Modal__Close").click(),setTimeout(()=>productFormAddButton.click(),100)}),newCell.append(button),hasButtons=!0}}),hasButtons||table.querySelectorAll("tr > :nth-child(2)").forEach(cell=>cell.remove())}).catch(error=>{console.error(error),window.open(url,"_blank")})})}),delegate.on("click",".primeai_link",event2=>{event2.preventDefault(),window.OpenWidget?(OpenWidget(),event2.target.closest(".Modal")?.querySelector("[data-action=close-modal]")?.click()):alert(event2.target.closest(".Modal")?.dataset.messageNoPrimeaiWidget)}),delegate.on("click",".primeai_chart_link",event2=>{event2.preventDefault(),window.OpenWidgetSC?(OpenWidgetSC(),event2.target.closest(".Modal")?.querySelector("[data-action=close-modal]")?.click()):alert(event2.target.closest(".Modal")?.dataset.messageNoPrimeaiChart)}),Shopify.designMode&&document.addEventListener("shopify:section:load",event2=>{event2?.target?.querySelectorAll(".HeroCollection__LinkList[data-flickity-options]").forEach(carousel=>{new Flickity(carousel,JSON.parse(carousel.dataset.flickityOptions||{}))})})})(); 2//# sourceMappingURL=/cdn/shop/t/557/assets/custom.js.map?v=164586380999490741321790160821
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.