1(function(){function fixNavLocaleLinks(){var match=window.location.pathname.match(/^\/([a-z]{2}(?:-[a-z]{2})?)\//);if(match){var prefix="/"+match[1];document.querySelectorAll("a[data-top-link], a[data-stagger], a[data-stagger-first], a[data-stagger-second], .sliderow__title[href]").forEach(function(link){var href=link.getAttribute("href");href&&href.charAt(0)==="/"&&href.indexOf(prefix)!==0&&link.setAttribute("href",prefix+href)})}}document.addEventListener("DOMContentLoaded",fixNavLocaleLinks),document.addEventListener("theme:variant:change",function(event){var variant=event.detail.variant,container=event.target}),document.addEventListener("theme:cart:change",function(event){var cart=event.detail&&event.detail.cart;cart&&translateShippingCalculator()}),document.addEventListener("theme:cart:init",e=>{translateShippingCalculator()}),window.onload=function(){$("#estimate_address_country, #estimate_address_zip, #estimate_address_province").change(function(){translateShippingCalculator()})},window.onscroll=function(){var footerHeight=$("#shopify-section-footer").height(),scrollPosition=window.pageYOffset+$(window).height();window.pageYOffset>$(".product-section").height()?$(".product-cta-bar").addClass("active"):$(".product-cta-bar").removeClass("active"),scrollPosition==$(document).height()?$(".product-cta-bar").addClass("scroll--lock").css("bottom",footerHeight):$(".product-cta-bar").removeClass("scroll--lock").css("bottom",0)};function getUrlVars(){var vars={},parts=window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi,function(m,key,value){vars[key]=value});return vars}const date=new Date,startDate=new Date("2024-11-15"),endDate=new Date("2024-12-03");date.getTime()>=startDate.getTime()&&date.getTime()<=endDate.getTime()?($(".visible--gr-bf2023").addClass("active"),$("body").addClass("GR_BF2023")):($(".visible--gr-bf2023").removeClass("active"),$("body").removeClass("GR_BF2023"));var bf2023Param=decodeURIComponent(getUrlVars().utm_campaign),bf2023Param2=decodeURIComponent(getUrlVars().bf);(bf2023Param=="1+1"||bf2023Param=="bf=gr_2023"||bf2023Param2=="gr_2023"||bf2023Param2=="1+1")&&(localStorage.setItem("GR_BF2023",!0),$(".visible--gr-bf2023").addClass("active"),$("body").addClass("GR_BF2023")),localStorage.getItem("GR_BF2023")=="true"&&($(".visible--gr-bf2023").addClass("active"),$("body").addClass("GR_BF2023"));function productCardAddtoCartButton(){$(".button--add-to-cart").unbind("click"),$(".button--add-to-cart").click(function(e){e.preventDefault();var variantID=$(this).data("variant-id");jQuery.post("/cart/add.js",{items:[{quantity:1,id:variantID}]}).done(function(){jQuery.getJSON("/cart.js",function(cart){document.dispatchEvent(new CustomEvent("theme:cart:change",{detail:{cart},bubbles:!0}));var cartDrawer=document.querySelector('[data-drawer="drawer-cart"]');cartDrawer&&cartDrawer.dispatchEvent(new CustomEvent("theme:drawer:open",{bubbles:!1}))})})})}productCardAddtoCartButton(),$(".item__pin").click(function(){$(this).parent().hasClass("active")?$(this).parent().removeClass("active"):($(".item__pin").parent().removeClass("active"),$(this).parent().addClass("active"))});function translateShippingCalculator(){$("label[data-trans-pl]").each(function(){$(this).empty().html($(this).data("trans-pl"))})}var contactMapWidth=$(".contact-map").width(),pinWidth=52,pinCenter=contactMapWidth/2-pinWidth/2;$(".contact-map > .item").each(function(){var pinPositionLeft=$(this).position().left;console.log(pinPositionLeft),pinPositionLeft>pinCenter?$(this).children(".item__meta").addClass("align--right"):$(this).children(".item__meta").removeClass("align--right")}),$(".collection__grid-toggle").click(function(){$(this).siblings().removeClass("active"),$(this).addClass("active")}),$(".sidebar__heading").click(function(){$(this).parent().hasClass("active")?$(this).parent().removeClass("active"):$(this).parent().addClass("active")}),$(".sidebar__item").each(function(){$(this).hasClass("sidebar__item--active")&&$(this).closest(".collection__filter__group").addClass("active")}),$(".filter__button").each(function(){$(this).children("input").is(":checked")==!0&&$(this).closest(".collection__filter__group").addClass("active")}),$(".trigger--popup-pack").click(function(){$(".product-popup--pack").fadeIn()}),$(".trigger--popup-subscription").click(function(){$(".product-popup--subscription").fadeIn()}),$(".product-popup__close").click(function(){$(this).parent().parent().fadeOut()}),$(".collection-grid__slider").slick({prevArrow:'<div class="slick-prev slick-arrow" aria-label="Prev"><svg width="12px" height="14px" viewBox="0 0 12 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>D692C634-35FA-4041-B1FE-33F03BE20C1B</title> <g id="UI" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"> <g id="Blog_Pojedynczy-wpis" transform="translate(-320.000000, -1854.000000)" stroke="#4C4C4C" stroke-width="1.4"> <g id="Group" transform="translate(320.000000, 1852.000000)"> <g id="icon/arrrow/small/riight" transform="translate(0.000000, 3.000000)"> <polyline id="Path" transform="translate(6.000000, 6.000000) scale(-1, 1) translate(-6.000000, -6.000000) " points="3 0 9 6 3 12"></polyline> </g> </g> </g> </g> </svg></div>',nextArrow:'<div class="slick-next slick-arrow" aria-label="Next"><svg width="12px" height="14px" viewBox="0 0 12 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>EB6605F5-CC64-4E1F-AB01-9DA0980BA57A</title> <g id="UI" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"> <g id="Blog_Pojedynczy-wpis" transform="translate(-1148.000000, -1854.000000)" stroke="#4C4C4C" stroke-width="1.4"> <g id="Group-2" transform="translate(994.000000, 1852.000000)"> <g id="icon/arrrow/small/riight" transform="translate(154.000000, 3.000000)"> <polyline id="Path" points="3 0 9 6 3 12"></polyline> </g> </g> </g> </g> </svg></div>',slidesToShow:4,slidesToScroll:1,arrows:!0,dots:!0,responsive:[{breakpoint:1270,settings:{slidesToShow:3}},{breakpoint:1e3,settings:{slidesToShow:2}},{breakpoint:767,settings:{slidesToShow:1}}]}),homepagecategoryslidersettings={prevArrow:'<div class="slick-prev slick-arrow" aria-label="Prev"><svg width="12px" height="14px" viewBox="0 0 12 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>D692C634-35FA-4041-B1FE-33F03BE20C1B</title> <g id="UI" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"> <g id="Blog_Pojedynczy-wpis" transform="translate(-320.000000, -1854.000000)" stroke="#4C4C4C" stroke-width="1.4"> <g id="Group" transform="translate(320.000000, 1852.000000)"> <g id="icon/arrrow/small/riight" transform="translate(0.000000, 3.000000)"> <polyline id="Path" transform="translate(6.000000, 6.000000) scale(-1, 1) translate(-6.000000, -6.000000) " points="3 0 9 6 3 12"></polyline> </g> </g> </g> </g> </svg></div>',nextArrow:'<div class="slick-next slick-arrow" aria-label="Next"><svg width="12px" height="14px" viewBox="0 0 12 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>EB6605F5-CC64-4E1F-AB01-9DA0980BA57A</title> <g id="UI" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"> <g id="Blog_Pojedynczy-wpis" transform="translate(-1148.000000, -1854.000000)" stroke="#4C4C4C" stroke-width="1.4"> <g id="Group-2" transform="translate(994.000000, 1852.000000)"> <g id="icon/arrrow/small/riight" transform="translate(154.000000, 3.000000)"> <polyline id="Path" points="3 0 9 6 3 12"></polyline> </g> </g> </g> </g> </svg></div>',slidesToShow:4,slidesToScroll:1,arrows:!0,dots:!0,responsive:[{breakpoint:1270,settings:{slidesToShow:3}},{breakpoint:992,settings:{slidesToShow:2,arrows:!1}
1}]},homepagecategoryslider=$("#homepagecategory").slick(homepagecategoryslidersettings),$(window).on("resize",function(){$(window).width()<992&&!homepagecategoryslider.hasClass("slick-initialized")&&$("#homepagecategory").slick(homepagecategoryslidersettings)}),$(".homepage-collection__slider").slick({prevArrow:'<div class="slick-prev slick-arrow" aria-label="Prev"><svg width="12px" height="14px" viewBox="0 0 12 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>D692C634-35FA-4041-B1FE-33F03BE20C1B</title> <g id="UI" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"> <g id="Blog_Pojedynczy-wpis" transform="translate(-320.000000, -1854.000000)" stroke="#4C4C4C" stroke-width="1.4"> <g id="Group" transform="translate(320.000000, 1852.000000)"> <g id="icon/arrrow/small/riight" transform="translate(0.000000, 3.000000)"> <polyline id="Path" transform="translate(6.000000, 6.000000) scale(-1, 1) translate(-6.000000, -6.000000) " points="3 0 9 6 3 12"></polyline> </g> </g> </g> </g> </svg></div>',nextArrow:'<div class="slick-next slick-arrow" aria-label="Next"><svg width="12px" height="14px" viewBox="0 0 12 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>EB6605F5-CC64-4E1F-AB01-9DA0980BA57A</title> <g id="UI" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"> <g id="Blog_Pojedynczy-wpis" transform="translate(-1148.000000, -1854.000000)" stroke="#4C4C4C" stroke-width="1.4"> <g id="Group-2" transform="translate(994.000000, 1852.000000)"> <g id="icon/arrrow/small/riight" transform="translate(154.000000, 3.000000)"> <polyline id="Path" points="3 0 9 6 3 12"></polyline> </g> </g> </g> </g> </svg></div>',slidesToShow:4,slidesToScroll:1,arrows:!0,dots:!1,responsive:[{breakpoint:1270,settings:{slidesToShow:3}},{breakpoint:1e3,settings:{slidesToShow:2}},{breakpoint:479,settings:{slidesToShow:1}}]}),$(".homepage-columns__slider").slick({prevArrow:'<div class="slick-prev slick-arrow" aria-label="Prev"><svg width="12px" height="14px" viewBox="0 0 12 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>D692C634-35FA-4041-B1FE-33F03BE20C1B</title> <g id="UI" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"> <g id="Blog_Pojedynczy-wpis" transform="translate(-320.000000, -1854.000000)" stroke="#4C4C4C" stroke-width="1.4"> <g id="Group" transform="translate(320.000000, 1852.000000)"> <g id="icon/arrrow/small/riight" transform="translate(0.000000, 3.000000)"> <polyline id="Path" transform="translate(6.000000, 6.000000) scale(-1, 1) translate(-6.000000, -6.000000) " points="3 0 9 6 3 12"></polyline> </g> </g> </g> </g> </svg></div>',nextArrow:'<div class="slick-next slick-arrow" aria-label="Next"><svg width="12px" height="14px" viewBox="0 0 12 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>EB6605F5-CC64-4E1F-AB01-9DA0980BA57A</title> <g id="UI" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"> <g id="Blog_Pojedynczy-wpis" transform="translate(-1148.000000, -1854.000000)" stroke="#4C4C4C" stroke-width="1.4"> <g id="Group-2" transform="translate(994.000000, 1852.000000)"> <g id="icon/arrrow/small/riight" transform="translate(154.000000, 3.000000)"> <polyline id="Path" points="3 0 9 6 3 12"></polyline> </g> </g> </g> </g> </svg></div>',slidesToShow:3,slidesToScroll:1,arrows:!0,dots:!0,responsive:[{breakpoint:1e3,settings:{slidesToShow:2,arrows:!1}},{breakpoint:767,settings:{slidesToShow:1,arrows:!1}}]}),$(".accordion-content__read-more").click(function(){$(this).css("display","none"),$(this).siblings(".accordion-content__ext-desc").removeClass("accordion-content__ext-desc--hide")}),$(".button--scroll-to-header").click(function(e){$("html, body").animate({scrollTop:$("#MainContent").offset().top-1},1e3)});function safariCartDrawerFix(){$(".drawer__bottom__shipping").click(function(){$(this).children(".drawer__accordion__button").hasClass("is-visible")?$(".checkout__button").addClass("scroll-spacing"):$(".checkout__button").removeClass("scroll-spacing")})}safariCartDrawerFix();function setCookie(key,value,days){var expires=new Date;expires.setTime(expires.getTime()+days*24*60*60*1e3),document.cookie=key+"="+value+";expires="+expires.toUTCString()}function getCookie(key){var keyValue=document.cookie.match("(^|;) ?"+key+"=([^;]*)(;|$)");
1return keyValue?keyValue[2]:null}function delete_cookie(name){document.cookie=name+"=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;"}var promoPopupCookie=getCookie("promoPopupCookie");promoPopupCookie!=="fired"&&($(".promo-popup").addClass("active"),setCookie("promoPopupCookie","fired",360)),$(".promo-popup__close").click(function(){$(".promo-popup").removeClass("active")});var drawerClose=document.querySelectorAll(".drawer__close");if(drawerClose.forEach(function(button){button.addEventListener("click",function(){setTimeout(function(){document.querySelector("body").style.overflow="visible",document.querySelector("body").style.pointerEvents="all"},1e3)})}),$(".language-selector.mobile").click(function(){$(this).hasClass("active")?$(this).removeClass("active"):$(this).addClass("active")}),$(".gift-wrap-module").length>0){let cartGiftWrap2=function(){$(".gift-wrap__title-bar").unbind("click"),$(".gift-wrap__title-bar").click(function(e){e.preventDefault(),$(this).parent().hasClass("active")?$(this).parent().removeClass("active"):$(this).parent().addClass("active")}),$(".gift-wrap-add-to-cart").unbind("click"),$(".gift-wrap-add-to-cart").click(function(e){e.preventDefault();var variantID=$(this).data("variant-id"),variantQuantity=$(this).siblings(".item__meta").find("input").val();jQuery.post("/cart/add.js",{items:[{quantity:variantQuantity,id:variantID}]}).done(function(){window.location.reload()})})};var cartGiftWrap=cartGiftWrap2;cartGiftWrap2()}if(0)var cartFreeGifts,target,observer;setTimeout(function(){$("#grchat-button").click(function(){$(this).hasClass("active")?$(this).removeClass("active"):$(this).addClass("active")});var target2=document.querySelector("#grchat-button"),observer2=new MutationObserver(mutations=>{$("#grchat-button").height()==82?$("#grchat-button").removeClass("active"):$("#grchat-button").addClass("active")});observer2.observe(target2,{attributes:!0})},3e3);function microscopePhotoZoom(data){console.log(data);const PhotoSwipe=window.themePhotoswipe.PhotoSwipe.default,PhotoSwipeUI=window.themePhotoswipe.PhotoSwipeUI.default,el=document.querySelector(".zoomMicroscope");console.log(el);var items=[{src:data.attr("href"),w:1e3,h:1e3}];console.log(items);const options={index:0,showHideOpacity:!0,showAnimationDuration:150,hideAnimationDuration:250,bgOpacity:1,spacing:0,allowPanToNext:!1,maxSpreadZoom:3,history:!1,loop:!0,pinchToClose:!1,modal:!1,closeOnScroll:!1,closeOnVerticalDrag:!0,getDoubleTapZoom:function(isMouseClick,item){return isMouseClick?1.67:item.initialZoomLevel<.7?1:1.3}},gallery=new PhotoSwipe(el,PhotoSwipeUI,items,options);gallery.init(),gallery.listen("close",function(){gallery.destroy()}),console.log("clicked")}$(".img_zoom").on("click",function(e){e.preventDefault(),microscopePhotoZoom($(this))}),(async()=>{const stickyElm=await waitForElement("#shopify-section-header",document,5e3);new IntersectionObserver(([e])=>e.target.classList.toggle("isSticky",e.intersectionRatio<1),{rootMargin:"-10px 0px 0px 0px",threshold:[1]}).observe(stickyElm)})(),(()=>{const trigger=document.querySelector('[data-drawer-toggle-on-click="true"]');trigger&&trigger.addEventListener("click",function(e){const cartDrawer=document.querySelector('[data-drawer="drawer-cart"]');if(!cartDrawer){console.error("Cart drawer not found");return}e.preventDefault(),cartDrawer.dispatchEvent(new CustomEvent("theme:drawer:open",{bubbles:!1}))})})();function waitForElement(selector,root=document,timeout){return new Promise((resolve,reject)=>{const existing=root.querySelector(selector);if(existing){resolve(existing);return}const observer2=new MutationObserver(()=>{const element=root.querySelector(selector);element&&(cleanup(),resolve(element))});let timeoutId;const cleanup=()=>{observer2.disconnect(),timeoutId&&clearTimeout(timeoutId)};observer2.observe(root===document?document.documentElement:root,{childList:!0,subtree:!0}),typeof timeout=="number"&&(timeoutId=setTimeout(()=>{cleanup(),reject(new Error(`waitForElement timeout (${timeout}ms): ${selector}`))},timeout))})}const rerenderCartItems=async()=>{try{const cartData=await(await fetch("/cart.js")).json();document.dispatchEvent(new CustomEvent("theme:cart:change",{detail:{cart:cartData},bubbles:!0})),document.dispatchEvent(new CustomEvent("theme:cart:reload",{bubbles:!0}))}catch(error){console.error("Error rerendering cart items:",error)}};(async()=>{const root=document.querySelector(".order-value-booster-side-cart");if(!root)return;const upsellsContainer=await waitForElement(".upsell_products",root),styleUpsellButtons=()=>{upsellsContainer.querySelectorAll("a").forEach(button=>{button.dataset.giftGlovStyled!=="1"&&(button.dataset.giftGlovStyled="1",button.textContent="Dodaj",button.classList.add("button--add-to-cart","cart
1-progress-add"),button.setAttribute("aria-label",(button.getAttribute("aria-label")||"").replace(/^Dobierz/,"Dodaj")||"Dodaj"),button.addEventListener("click",()=>{setTimeout(rerenderCartItems,1e3)}))})};new MutationObserver(styleUpsellButtons).observe(upsellsContainer,{childList:!0,subtree:!0}),styleUpsellButtons()})(),(()=>{if(!document.body.classList.contains("template-cart"))return;const cartTemplate=document.querySelector(".cart__template");if(!cartTemplate)return;const heading=cartTemplate.querySelector("h3.h3--body"),styleButtons=()=>{if(document.querySelectorAll('a[class*="free_shipping_card_product_cta"]').forEach(button=>{button.dataset.giftGlovStyled!=="1"&&(button.dataset.giftGlovStyled="1",button.textContent="Dodaj",button.classList.add("button--add-to-cart","cart-progress-add"),button.setAttribute("aria-label",(button.getAttribute("aria-label")||"").replace(/^Dobierz/,"Dodaj")||"Dodaj"))}),heading){const wrapper=document.querySelector('[class*="free_shipping_card_wrapper"]');wrapper&&wrapper!==heading.nextElementSibling&&heading.compareDocumentPosition(wrapper)&Node.DOCUMENT_POSITION_PRECEDING&&wrapper.parentNode.insertBefore(heading,wrapper)}};new MutationObserver(styleButtons).observe(document.body,{childList:!0,subtree:!0}),styleButtons()})();const positionCartPageDiscount=()=>{if(!document.body.classList.contains("template-cart")||!window.matchMedia("(min-width: 768px)").matches)return;const footer=document.querySelector(".template-cart .template__cart__footer"),discount=[...document.querySelectorAll(".template-cart .gfgCustomDiscountWrapper")].find(wrapper=>wrapper.querySelector(".gfgBuyXGetYCustomDiscountParentContainer_CART_PAGE"));footer&&discount&&discount.nextElementSibling!==footer&&footer.parentNode.insertBefore(discount,footer)};document.body.classList.contains("template-cart")&&(new MutationObserver(positionCartPageDiscount).observe(document.body,{childList:!0,subtree:!0}),positionCartPageDiscount());const giftContainers=()=>[...document.querySelectorAll(".template-cart .cart__template [data-free-gifts], #drawer-cart [data-free-gifts]")];if(document.querySelector(".template-cart .cart__template, #drawer-cart")){const selectedGiftKey="cart-selected-free-gift";let giftCheckoutPending=!1,giftMutationPromise=Promise.resolve(),currentCart=null;const checkoutButtonLabels=new WeakMap,formatGiftAmount=amount=>new Intl.NumberFormat(document.documentElement.lang||"pl-PL",{style:"currency",currency:window.Shopify&&Shopify.currency&&Shopify.currency.active||"PLN"}).format(amount/100),getGiftButtons=()=>giftContainers().flatMap(c=>[...c.querySelectorAll("[data-gift-select]")]),getConfiguredGiftIds=()=>new Set(getGiftButtons().map(button=>Number(button.dataset.variantId))),getCartGiftItems=cart=>{const configuredGiftIds=getConfiguredGiftIds();return cart.items.filter(item=>configuredGiftIds.has(item.variant_id)||item.properties&&item.properties.type==="free gift")},lockGiftQuantities=cart=>{const giftKeys=new Set(getCartGiftItems(cart).map(item=>item.key));document.querySelectorAll("[data-cart-item]").forEach(row=>{const input=row.querySelector("[data-update-cart]"),isGift=input&&giftKeys.has(input.dataset.updateCart);row.classList.toggle("cart__items__row--free-gift",!!isGift),isGift&&(input.max="1",input.readOnly=!0,row.querySelectorAll("[data-decrease-quantity], [data-increase-quantity]").forEach(button=>{button.disabled=!0}))})},setGiftStatus=(message,isError=!1)=>{giftContainers().forEach(container=>{let status=container.querySelector("[data-gift-status]");if(!status){status=document.createElement("div"),status.dataset.giftStatus="",status.setAttribute("role","status"),status.setAttribute("aria-live","polite");const titleBar=container.querySelector(".gift-wrap__title-bar");titleBar&&titleBar.appendChild(status)}status.textContent=message,status.classList.toggle("is-error",isError)})},fetchCart=async()=>{const response=await fetch("/cart.js",{credentials:"same-origin"});if(!response.ok)throw new Error(`Cart request failed: ${response.status}`);return currentCart=await response.json(),currentCart},setCheckoutPending=pending=>{document.querySelectorAll(".checkout__button").forEach(button=>{pending?(checkoutButtonLabels.has(button)||checkoutButtonLabels.set(button,button.innerHTML),button.disabled=!0,button.setAttribute("aria-busy","true"),button.textContent="Dodaj\u0119 prezent..."):checkoutButtonLabels.has(button)&&(button.disabled=!1,button.removeAttribute("aria-busy"),button.innerHTML=checkoutButtonLabels.get(button),checkoutButtonLabels.delete(button))})},updateFreeGifts=cart=>{currentCart=cart,lockGiftQuantities(cart);const selectedVariantId=localStorage.getItem(selectedGiftKey);let stillEligible=!1;
1getGiftButtons().forEach(button=>{const item=button.closest(".item"),tier=Number(item&&item.dataset.tier)*100,enabled=cart.total_price>=tier,isSelected=enabled&&button.dataset.variantId===selectedVariantId;button.disabled=!enabled,button.classList.toggle("disabled",!enabled),button.classList.toggle("selected",isSelected),button.setAttribute("aria-pressed",String(isSelected)),button.textContent=enabled?isSelected?"Wybrano":button.dataset.enabledLabel:`Brakuje Ci: ${formatGiftAmount(tier-cart.total_price)}`,isSelected&&(stillEligible=!0)}),selectedVariantId&&!stillEligible&&localStorage.removeItem(selectedGiftKey)},refreshFreeGifts=()=>{if(getGiftButtons().length)return fetchCart().then(cart=>{updateFreeGifts(cart),enforceGiftLimit(cart)}).catch(()=>{})},syncGiftInCart=async selectedVariantId=>{let cart=currentCart||await fetchCart();const giftItems=getCartGiftItems(cart),selectedGifts=giftItems.filter(item=>item.variant_id===selectedVariantId),updates={};if(giftItems.forEach(item=>{updates[item.key]=0}),selectedVariantId&&(selectedGifts.length?updates[selectedGifts[0].key]=1:updates[selectedVariantId]=1),Object.keys(updates).some(id=>{const item=cart.items.find(cartItem=>cartItem.key===id||String(cartItem.variant_id)===id);return!item||item.quantity!==updates[id]})){const response=await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",keepalive:!0,body:JSON.stringify({updates})});if(!response.ok)throw new Error(`Gift removal failed: ${response.status}`);cart=await response.json(),currentCart=cart}return document.dispatchEvent(new CustomEvent("theme:cart:change",{detail:{cart},bubbles:!0})),cart},queueGiftSync=selectedVariantId=>(giftMutationPromise=giftMutationPromise.catch(()=>{}).then(()=>syncGiftInCart(selectedVariantId)),giftMutationPromise),enforceGiftLimit=cart=>{const selectedVariantId=Number(localStorage.getItem(selectedGiftKey)),giftItems=getCartGiftItems(cart);(selectedVariantId?giftItems.length===1&&giftItems[0].variant_id===selectedVariantId&&giftItems[0].quantity===1:giftItems.length===0)||queueGiftSync(selectedVariantId||null).catch(error=>{console.error("Free gift quantity enforcement error:",error)})};document.addEventListener("theme:cart:change",event=>{event.detail&&event.detail.cart?(updateFreeGifts(event.detail.cart),enforceGiftLimit(event.detail.cart)):refreshFreeGifts()}),document.addEventListener("theme:cart:reload",refreshFreeGifts);const handleGiftClick=event=>{const button=event.target.closest("[data-gift-select]");if(!button||button.disabled||!button.closest(".template-cart .cart__template, #drawer-cart"))return;const variantId=button.dataset.variantId,shouldDeselect=button.classList.contains("selected");shouldDeselect?localStorage.removeItem(selectedGiftKey):localStorage.setItem(selectedGiftKey,variantId),getGiftButtons().forEach(other=>{other.classList.toggle("selected",!shouldDeselect&&other.dataset.variantId===variantId),other.setAttribute("aria-pressed",String(!shouldDeselect&&other.dataset.variantId===variantId)),other.disabled||(other.textContent=!shouldDeselect&&other.dataset.variantId===variantId?"Dodaj\u0119 prezent...":other.dataset.enabledLabel)}),setGiftStatus(shouldDeselect?"Usuwam prezent...":"Dodaj\u0119 prezent..."),queueGiftSync(shouldDeselect?null:Number(variantId)).then(cart=>{updateFreeGifts(cart),setGiftStatus(shouldDeselect?"Prezent usuni\u0119ty.":"Prezent dodany do koszyka.")}).catch(error=>{localStorage.getItem(selectedGiftKey)===variantId&&localStorage.removeItem(selectedGiftKey),button.classList.remove("selected"),button.setAttribute("aria-pressed","false"),button.textContent="Spr\xF3buj ponownie",setGiftStatus("Nie uda\u0142o si\u0119 zmieni\u0107 prezentu. Spr\xF3buj ponownie.",!0),console.error("Free gift selection error:",error)})},handleCheckoutWithGift=async event=>{const checkoutButton=event.target.closest(".checkout__button");if(!(!checkoutButton||!checkoutButton.closest(".template-cart .cart__template, #drawer-cart"))&&(event.preventDefault(),event.stopImmediatePropagation(),!giftCheckoutPending)){giftCheckoutPending=!0,setCheckoutPending(!0);try{await giftMutationPromise.catch(()=>{});const selectedVariantId=Number(localStorage.getItem(selectedGiftKey));if(!selectedVariantId){window.location.href="/checkout";return}const cart=await fetchCart(),button=document.querySelector(`[data-gift-select][data-variant-id="${selectedVariantId}"]`),tier=Number(button&&button.closest(".item")&&button.closest(".item").dataset.tier)*100;if(!button||cart.total_price<tier){localStorage.removeItem(selectedGiftKey),window.location.href="/checkout";return}await syncGiftInCart(selectedVariantId),window.location.href="/checkout"}catch(err){giftCheckoutPending=!1,setCheckoutPending(!1),setGiftStatus("Nie uda\u0142o si\u0119 doda\u0107 prezentu. Spr\xF3buj ponownie.",!0),console.error("Free gift checkout error:",err)}}};document.addEventListener("click",handleGiftClick),document.addEventListener("click",handleCheckoutWithGift,!0);const cartDrawer=document.querySelector("#drawer-cart");if(cartDrawer){const sync=()=>document.body.classList.toggle("cart-drawer-visible",cartDrawer.classList.contains("drawer
1--visible"));new MutationObserver(sync).observe(cartDrawer,{attributes:!0,attributeFilter:["class"]}),sync()}refreshFreeGifts()}})(); 2//# sourceMappingURL=/cdn/shop/t/37/assets/custom.js.map?enable_js_minification=1&v=25618521204160553771789143722
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.