(function(){var __sections__={};(function(){for(var i=0,s=document.getElementById("sections-script").getAttribute("data-sections").split(",");i{element.classList.remove("active")});const activeMedia=this.querySelector(`[data-media-id="${this.openedBy.getAttribute("data-media-id")}"]`),activeMediaTemplate=activeMedia.querySelector("template"),activeMediaContent=activeMediaTemplate?activeMediaTemplate.content:null;activeMedia.classList.add("active"),activeMedia.scrollIntoView();const container=this.querySelector('[role="document"]');container.scrollLeft=(activeMedia.width-container.clientWidth)/2,activeMedia.nodeName=="DEFERRED-MEDIA"&&activeMediaContent&&activeMediaContent.querySelector(".js-youtube")&&activeMedia.loadContent()}})}catch(e){console.error(e)}}(),function(){if(__sections__.footer)try{class LocalizationForm extends HTMLElement{constructor(){super(),this.elements={input:this.querySelector('input[name="locale_code"], input[name="country_code"]'),button:this.querySelector("button"),panel:this.querySelector("ul")},this.elements.button.addEventListener("click",this.openSelector.bind(this)),this.elements.button.addEventListener("focusout",this.closeSelector.bind(this)),this.addEventListener("keyup",this.onContainerKeyUp.bind(this)),this.querySelectorAll("a").forEach(item=>item.addEventListener("click",this.onItemClick.bind(this)))}hidePanel(){this.elements.button.setAttribute("aria-expanded","false"),this.elements.panel.setAttribute("hidden",!0)}onContainerKeyUp(event){event.code.toUpperCase()==="ESCAPE"&&(this.hidePanel(),this.elements.button.focus())}onItemClick(event){event.preventDefault();const form=this.querySelector("form");this.elements.input.value=event.currentTarget.dataset.value,form&&form.submit()}openSelector(){this.elements.button.focus(),this.elements.panel.toggleAttribute("hidden"),this.elements.button.setAttribute("aria-expanded",(this.elements.button.getAttribute("aria-expanded")==="false").toString())}closeSelector(event){const shouldClose=event.relatedTarget&&event.relatedTarget.nodeName==="BUTTON";(event.relatedTarget===null||shouldClose)&&this.hidePanel()}}customElements.define("localization-form",LocalizationForm)}catch(e){console.error(e)}}(),function(){if(__sections__.header)try{class StickyHeader extends HTMLElement{constructor(){super()}connectedCallback(){this.header=document.getElementById("shopify-section-header"),this.headerBounds={},this.currentScrollTop=0,this.preventReveal=!1,this.onScrollHandler=this.onScroll.bind(this),this.hideHeaderOnScrollUp=()=>this.preventReveal=!0,this.addEventListener("preventHeaderReveal",this.hideHeaderOnScrollUp),window.addEventListener("scroll",this.onScrollHandler,!1),this.createObserver()}disconnectedCallback(){this.removeEventListener("preventHeaderReveal",this.hideHeaderOnScrollUp),window.removeEventListener("scroll",this.onScrollHandler)}createObserver(){new IntersectionObserver((entries,observer2)=>{this.headerBounds=entries[0].intersectionRect,observer2.disconnect()}).observe(this.header)}onScroll(){const scrollTop=window.pageYOffset||document.documentElement.scrollTop;scrollTop>this.currentScrollTop&&scrollTop>this.headerBounds.bottom?requestAnimationFrame(this.hide.bind(this)):scrollTopthis.headerBounds.bottom?this.preventReveal?(window.clearTimeout(this.isScrolling),this.isScrolling=setTimeout(()=>{this.preventReveal=!1},66),requestAnimationFrame(this.hide.bind(this))):requestAnimationFrame(this.reveal.bind(this)):scrollTop<=this.headerBounds.top&&requestAnimationFrame(this.reset.bind(this)),this.currentScrollTop=scrollTop}hide(){this.header.classList.add("shopify-section-header-hidden","shopify-section-header-sticky"),this.closeMenuDisclosure(),this.closeSearchModal()}reveal(){this.header.classList.add("shopify-section-header-sticky","animate"),this.header.classList.remove("shopify-section-header-hidden")}reset(){this.header.classList.remove("shopify-section-header-hidden","shopify-section-header-sticky","animate")}closeMenuDisclosure(){this.disclosures=this.disclosures||this.header.querySelectorAll("details-disclosure"),this.disclosures.forEach(disclosure=>disclosure.close())}closeSearchModal(){this.searchModal=this.searchModal||this.header.querySelector("details-modal"),this.searchModal.close(!1)}}customElements.define("sticky-header",StickyHeader)}catch(e){console.error(e)}}(),function(){if(__sections__["main-cart-footer"])try{class CartNote extends HTMLElement{constructor(){super(),this.addEventListener("change",debounce(event=>{const body=JSON.stringify({note:event.target.value});fetch(`${routes.cart_update_url}`,{...fetchConfig(),body})},300))}}customElements.define("cart-note",CartNote)}catch(e){console.error(e)}}(),function(){if(__sections__["main-product"])try{class ProductModal extends ModalDialog{constructor(){super()}hide(){super.hide()}show(opener){super.show(opener),this.showActiveMedia()}showActiveMedia(){this.querySelectorAll(`[data-media-id]:not([data-media-id="${this.openedBy.getAttribute("data-media-id")}"])`).forEach(element=>{element.classList.remove("active")});const activeMedia=this.querySelector(`[data-media-id="${this.openedBy.getAttribute("data-media-id")}"]`),activeMediaTemplate=activeMedia.querySelector("template"),activeMediaContent=activeMediaTemplate?activeMediaTemplate.content:null;activeMedia.classList.add("active"),activeMedia.scrollIntoView();const container=this.querySelector('[role="document"]');container.scrollLeft=(activeMedia.width-container.clientWidth)/2,activeMedia.nodeName=="DEFERRED-MEDIA"&&activeMediaContent&&activeMediaContent.querySelector(".js-youtube")&&activeMedia.loadContent()}}customElements.define("product-modal",ProductModal)}catch(e){console.error(e)}}(),function(){if(__sections__["product-recommendations"])try{class ProductRecommendations extends HTMLElement{constructor(){super();const handleIntersection=(entries,observer)=>{entries[0].isIntersecting&&(observer.unobserve(this),fetch(this.dataset.url).then(response=>response.text()).then(text=>{const html=document.createElement("div");html.innerHTML=text;const recommendations=html.querySelector("product-recommendations");recommendations&&recommendations.innerHTML.trim().length&&(this.innerHTML=recommendations.innerHTML)}).catch(e=>{console.error(e)}))};new IntersectionObserver(handleIntersection.bind(this),{rootMargin:"0px 0px 200px 0px"}).observe(this)}}customElements.define("product-recommendations",ProductRecommendations)}catch(e){console.error(e)}}(),function(){if(!(!__sections__.product_13_taste_information&&!window.DesignMode))try{let fruitTasteObj=document.getElementById("fruit-taste"),complexityObj=document.getElementById("complexity"),acidityObj=document.getElementById("acidity");tanninsObj=document.getElementById("tannins");let boxArr=[fruitTasteObj,complexityObj,acidityObj,tanninsObj].filter(Boolean),scrollFun=function(e){let scrollTop=document.documentElement.scrollTop||document.body.scrollTop,winHeight=document.documentElement.clientHeight||document.body.clientHeight;for(let i=0;i<=boxArr.length-1;i++){let oTop=boxArr[i].offsetTop,bH=boxArr[i].offsetHeight;if(oTop-scrollTop>=0&&scrollTop+winHeight-oTop>100||(oTop+bH-scrollTop)/winHeight>.6&&oTop-scrollTop<=0){var obj=document.getElementById(boxArr[i].id);obj.setAttribute("class","karte__spec__item io on")}}};window.addEventListener("scroll",scrollFun),scrollFun()}catch(e){console.error(e)}}()})(); //# sourceMappingURL=/cdn/shop/t/49/compiled_assets/scripts.js.map