"use strict";(function(){this.ajaxCartSuccess=function(e,t,o="add"){window.omegaCallBackAddToCart&&"function"==typeof window.omegaCallBackAddToCart&&window.omegaCallBackAddToCart(),window.fetch(this.routes.cart_url+"?section_id=ecom-ajax-cart"+(e&&e.key?"&key="+e.key:""),{method:"GET",headers:{"Content-Type":"text/html"}}).then((e=>e.text())).then((t=>{let n=document.querySelector(".ecom-cart-popup"),r=document.createElement("div");r.classList.add("ecom-cart-popup");const i=(new DOMParser).parseFromString(t,"text/html").querySelector("#shopify-section-ecom-ajax-cart");if(!i)return window.location.href=this.routes.cart_url,!1;if(r.appendChild(i),document.body.appendChild(r),this.handleCartPopup(r),e&&e.key){let t=r.querySelector('.ecom-ajax-cart-line-item[data-key="'+e.key+'"]');if(t){let e=document.querySelector(".ecom-ajax-cart-body");if(e){const o=e.querySelector(".ecom-ajax-cart-line-item");if(o){const n=e.getBoundingClientRect().top-o.getBoundingClientRect().top;e=t.closest(".ecom-ajax-cart-body"),e.scrollTop=n}}}}if(n&&n.remove(),"update"==o){var a=document.querySelector(".ecom-ajax-cart-status span");a&&(a.innerHTML=a.dataset.textUpdate)}this.onAjaxPopupLoaded()})).catch((e=>{console.log(e),alert(e.message)}))},this.onAjaxPopupLoaded=()=>{var e=document.querySelector(".ecom-ajax-cart-checkout-button"),t=document.querySelector("#terms"),o=document.querySelector(".terms-error");e&&t&&o&&(e.removeAttribute("name"),e.addEventListener("click",(function(e){0==t.checked?(e.preventDefault(),o.classList.remove("terms-dn")):o.classList.add("terms-dn")})),t.addEventListener("change",(function(){o.classList.add("terms-dn"),t.checked?e.setAttribute("name","checkout"):e.removeAttribute("name")})))},this.handleCartPopup=function(e){var t=this;function o(e){"minus"===this.name?(this.nextElementSibling.stepDown(),this.nextElementSibling.dispatchEvent(new window.Event("change"))):"plus"===this.name&&(this.previousElementSibling.stepUp(),this.previousElementSibling.dispatchEvent(new window.Event("change")))}function n(){let e=this.value,o=this.dataset.key,n=this.dataset.index,r=this.closest(".ecom-ajax-cart-line-item");r&&r.classList.add("ecom-item-loading"),t.cartItemChange(o,parseInt(e),n).then((e=>{let n=null;if(e.items&&(n=e.items.find((e=>e.key===o))),n)t.ajaxCartSuccess(n,null,"update");else{if(e.errors){t.showToast(e.errors,"error");let o=r.closest(".ecom-ajax-cart-body");if(o){const e=o.querySelector(".ecom-ajax-cart-line-item");if(e){const t=o.getBoundingClientRect().top-e.getBoundingClientRect().top;setTimeout((function(){o=document.querySelector(".ecom-ajax-cart-body"),o.scrollTo({top:t,behavior:"smooth"})}),450)}}}t.ajaxCartSuccess(null,null,"update")}r&&r.classList.remove("ecom-item-loading")})).catch((e=>{console.error(e),t.ajaxCartError(e)}))}e.addEventListener("click",(function(t){if(t.target===e)e.remove();else{t.target.closest('[data-ecom-action="close"]')&&e.remove()}})),e.querySelectorAll(".ecom-ajax-cart-line-item-quantity-button").forEach((e=>{e.addEventListener("click",o)})),e.querySelectorAll(".ecom-ajax-cart-line-item-quantity-input").forEach((e=>{e.addEventListener("change",n)})),e.querySelector("#ecom-ajax-cart-note")&&e.querySelector("#ecom-ajax-cart-note").addEventListener("change",(function(){let e=this.value;t.cartUpdate({note:e})})),e.querySelectorAll(".ecom-ajax-cart-line-item-button-remove").forEach((e=>{e.addEventListener("click",(function(e){e.preventDefault(),this.value=0,n.bind(this)(e)}))}))},this.ajaxCartError=function(e,t){alert("Error"+e.message)},this.beforeAjaxCartSend=function(e){},this.checkProperties=function(e){let t=!0;return e.querySelectorAll("input[required], .hulkapps_option.required input").forEach((e=>{e.value||(t=!1)})),t},this.ajaxCart=function(){var e=this,t=t=>{if(!t.querySelector('[name="id"]'))return!!window.document.querySelector("#admin-bar-iframe")&&(alert('Please drag Variant picker element to this section to allow the "Add to cart" feature working. This message only show for owner\'s store'),!1);var o=t.querySelector(".ecom-product-single__add-to-cart--submit.ecom-clicked");o||(o=t.querySelector(".ecom-product-single__add-to-cart--submit")),o&&(o.style.cursor="not-allowed",o.style.pointerEvents="none",o.classList.add("ecom-ajax-loading","ecom-loading")),this.beforeAjaxCartSend(t);let n=new FormData(t);return n.append("sections","cart-notification-product,cart-notification-button,cart-icon-bubble,cart-drawer"),window.fetch(this.routes.cart_add_url,{method:"POST",headers:{Accept:"application/javascript","X-Requested-With":"XMLHttpRequest"},body:n}).then((e=>e.json())).then((n=>{if(n.errors)throw new Error(n.errors);if(n.status>200)return e.showToast(n.description,"error"),void(o&&(o.style.cursor="pointer",o.style.pointerEvents="auto",o.classList.remove("ecom-ajax-loading","ecom-loading")));let{action:r,href:i,textAddedCart:a,target:c,messageAddedCart:s}=o.dataset;o&&(o.style.cursor="pointer",o.style.pointerEvents="auto",o.classList.remove("ecom-ajax-loading","ecom-loading"),o.querySelector(".ecom-add-to-cart-text")&&(o.setAttribute("data-added-to-cart",""),a&&""!=a&&(o.querySelector(".ecom-add-to-cart-text").innerHTML=a))),document.dispatchEvent(new CustomEvent("ec-cart-added",{detail:n}));let l=this.routes;switch(r){case"cart":return setTimeout((function(){window.location.href=l.cart_url}),500);case"reload":return setTimeout((function(){return window.location.reload()}),500);case"checkout":return setTimeout((function(){return window.location.href=l.root_url+("/"===l.root_url?"":"/")+"checkout"}),500);case"message":this.showToast(s);break;case"link":i&&setTimeout((function(){return"_blank"===c?window.open(i):window.location.href=i}),500);break;default:this.ajaxCartSuccess(n,t)}})).catch((e=>{o&&(o.style.cursor="pointer",o.style.pointerEvents="auto",o.classList.remove("ecom-ajax-loading","ecom-loading")),this.ajaxCartError(e,t)})),!1};const o=document.querySelectorAll(".ecom-product-single__add-to-cart--submit:not(.ecom-initialized)");o.length&&o.forEach((function(n){n.addEventListener("click",(function(r){o.forEach((function(e){e.classList.remove("ecom-clicked")}));const i=this.closest("form.ecom-product-form");e.checkProperties(i)&&(r.preventDefault(),n.classList.add("ecom-clicked"),i.addEventListener("submit",(function(e){e.preventDefault()})),t.bind(document.body)(i))})),n.classList.add("ecom-initialized")})),this.handleATCList();let n=document.querySelectorAll(".ecom-ajax-cart-simple[data-id]");e=this;n.forEach((function(t){t.addEventListener("click",(function(t){e.handleClickEvent(this,t)}))}))},this.handleClickEvent=function(e,t,o=!1){t.preventDefault();const n=e.closest(".ecom-collection__product-form__actions");let r=1,i=null;n&&(i=n.querySelector(".ecom-collection__product-quantity-input")),i&&(r=i.value);const a=e,c=this;a&&(a.style.cursor="pointer",a.style.pointerEvents="auto",a.classList.add("ecom-ajax-loading")),c.beforeAjaxCartSend(t.target),window.fetch(c.routes.cart_add_url,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/javascript","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({id:a.dataset.id,quantity:r,sections:"cart-notification-product,cart-notification-button,cart-icon-bubble,cart-drawer"})}).then((e=>e.json())).then((e=>{if(e.errors)throw new Error(e.errors);if(e.status>200)return c.showToast(e.description,"error"),void(a&&(a.style.cursor="pointer",a.style.pointerEvents="auto",a.classList.remove("ecom-ajax-loading","ecom-loading")));let{action:n,href:r,textAddedCart:i,target:s,messageAddedCart:l}=a.dataset;if(a&&(a.style.cursor="pointer",a.style.pointerEvents="auto",a.classList.remove("ecom-ajax-loading","ecom-loading"),a.setAttribute("data-added-to-cart",""),i&&""!=i&&(a.querySelector(".ecom-add-to-cart-text").innerHTML=i)),c.onAjaxCartSuccess&&c.onAjaxCartSuccess(e,t.target),o&&!c.configs.ajax_cart.enable)return setTimeout((function(){return window.location.href=c.routes.cart_url}),500);switch(document.dispatchEvent(new CustomEvent("ec-cart-added",{detail:e})),n){case"cart":return setTimeout((function(){return window.location.href=c.routes.cart_url}),500);case"reload":return setTimeout((function(){return window.location.reload()}),500);case"checkout":return setTimeout((function(){return window.location.href=c.routes.root_url+"checkout"}),500);case"message":c.showToast(l);break;case"link":if(r)return setTimeout((function(){return"_blank"===s?window.open(r):window.location.href=r}),500);break;default:c.ajaxCartSuccess(e,t.target)}})).catch((e=>{window.alert(e.message),console.error(e),a&&(a.style.cursor="pointer",a.style.pointerEvents="auto",a.classList.remove("ecom-ajax-loading","ecom-loading")),c.ajaxCartError(e,t.target)}))},this.cartItemChange=function(e,t,o=null){return window.fetch(this.routes.cart_change_url,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({quantity:t,line:o})}).then((e=>e.json()))},this.handleATCList=function(){let e=document.querySelectorAll(".ecom-collection__product-item .ecom-product-form");var t=this;e.forEach((function(e){let o=e.querySelector(".ecom-ajax-cart-submit"),n=e.querySelector('[name="variant_id"]');o&&n&&o.addEventListener("click",(function(e){e.preventDefault(),this.dataset.id=n.value,t.handleClickEvent(this,e,!0)})),e.classList.add("ecom-ajax-cart")}))},this.cartUpdate=function(e,t){return window.fetch(this.routes.cart_update_url,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e)}).then((e=>e.json()))},this.showToast=function(e,t){let o=document.querySelector("#ecom-toast-desc"),n=document.querySelector("#ecom-toast"),r=document.querySelector("#ecom-toast-icon");"error"===t?(n.style.cssText="background-color: red;overflow: hidden; z-index: 10000000;",r.style.cssText="background-color: red;",n.classList.add("ecom-toast-error")):(n.classList.remove("ecom-toast-error"),n.style.cssText="background-color: #333;overflow: hidden; z-index: 10000000;",r.style.cssText="background-color: #333; border-radius: 2px;"),n&&o&&r&&(o.innerHTML=e,n.classList.add("ecom-toast-show"),n.style.setProperty("--ecom-max-width",o.clientWidth+50+"px"),setTimeout((()=>{n.classList.remove("ecom-toast-show")}),5e3))},this.initToastTemplate=function(){let e=document.querySelector("#ecom-template-html");if(e){let t=document.createElement("div");t.innerHTML=e.innerHTML,document.body.appendChild(t)}},this.isAdmin=function(){return document.querySelector("#admin-bar-iframe")||window.Shopify.designMode},this.init=function(){if(this.initToastTemplate(),window.Shopify&&!this.isAdmin()){let n=window.EComposer.PAGE||window.EComposer.TEMPLATE||window.EComposer.SECTION||window.EComposer.BLOCK||{};if(n){if(n.type&&(n.layout_type=n.type,delete n.type),n.template_id&&(n.layout_id=n.template_id,delete n.template_id),window.Shopify.analytics)Shopify.analytics.publish("ec_page_viewed",n);else{var e=0;let t=setInterval((function(){window.Shopify.analytics&&(Shopify.analytics.publish("ec_page_viewed",n),clearInterval(t)),++e>200&&clearInterval(t)}),100)}var t=(new Date).getTime(),o=!1;document.addEventListener("click",(function(e){o=!0}),{once:!0}),window.addEventListener("beforeunload",(function(e){if(!o){var r=(new Date).getTime()-t;window.Shopify.analytics&&Shopify.analytics.publish("ec_bounce_rate",{...n,elapsed_time:(r/1e3).toFixed(2)})}}))}}this.configs&&this.configs.ajax_cart&&this.configs.ajax_cart.enable?this.ajaxCart():(this.handleATCList(),document.body.addEventListener("submit",(function(e){e.target.classList.contains("ecom-product-form")&&"FORM"===e.target.nodeName&&window.omegaCallBackAddToCart&&"function"==typeof window.omegaCallBackAddToCart&&window.omegaCallBackAddToCart()})))},this.init()}).bind(window.EComposer||{})(),function(){var e;function t(){document.querySelectorAll(".ecom-sections .ecom-video-background").forEach((function(e){"true"===e.dataset.playPauseInview&&(!function(e){const{top:t,bottom:o}=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight;return(t>0||o>0)&&t{let e=document.querySelectorAll(".ecom-core.ecom-section"),t=document.querySelectorAll(".ecom-swiper-container"),o=document.querySelectorAll(".ecom-sections"),n=window.innerWidth;if(e.length>0){o.forEach((e=>{e.style.width=""}));let t=(n-o[0].offsetWidth)/2;e.forEach((e=>{e.classList.contains("ecom-section__stretched")?(e.style.width=n+"px",e.style.marginLeft=-t+"px"):(e.style.width="",e.style.marginLeft="")}))}t.length>0&&t.forEach((e=>{e.EComSwiper&&e.EComSwiper.update()}))}),50))}window.addEventListener("scroll",(function(){clearTimeout(e),e=setTimeout(t,500)})),o(),window.addEventListener("resize",o),window.addEventListener("load",o),document.addEventListener("DOMContentLoaded",(function(){"function"==typeof window.EComposer.initQuickview&&window.EComposer.initQuickview()})),function(e,t={}){let o=document.querySelectorAll(e);o=Array.from(o),o.forEach((e=>{!function(e,t){let o=new IntersectionObserver(((o,n)=>{o.forEach((o=>{o.isIntersecting&&(t.cb?t.cb(e):(o.target.classList.add("ecom-animated"),o.target.classList.add("animated")),n.unobserve(o.target))}))}),t);o.observe(e)}(e,t)}))}(".ecom-animation");(function(){const e=this;this.defaultValue=[],this.init=function(){const t=document.querySelectorAll("[ecom-scrolling-animation]");t.length&&window.addEventListener("scroll",(()=>{e.handleScrollAnimation(t)}))},this.handleScrollAnimation=function(t){t.forEach((function(t,o){e.animation(t,o)}))},this.animation=function(e,t){const o=e.getAttribute("ecom-scrolling-animation")?JSON.parse(e.getAttribute("ecom-scrolling-animation")):null;if(!o)return;const n=this.getViewPercentage(e),r=n>0&&n<100,i=this.getOptions(o,n,e,t);if(r){var a="",c="",s="";if(Object.keys(i).forEach((function(e){["translateX","translateY"].includes(e)?(a+=`${e}(${i[e]})`,delete i[e]):["blur"].includes(e)?(s+=`${e}(${i[e]})`,delete i[e]):["rotate"].includes(e)&&(c=`${e}(${i[e]})`,delete i[e])})),Object.keys(i).length&&Object.assign(e.style,i),a&&(e.style.transform=a,e.ecomCSSTransform||(e.ecomCSSTransform=!0)),s&&(e.style.filter=s,e.ecomCSSFilter||(e.ecomCSSFilter=!0)),c){const t=e.querySelector(":first-child");t&&(t.style.transform=c),e.ecomCSSRotate||(e.ecomCSSRotate=!0)}}else if(e.ecomCSSTransform&&(e.style.transform="",a="",e.ecomCSSTransform=!1),e.ecomCSSFilter&&(e.style.filter="",s="",e.ecomCSSFilter=!1),e.ecomCSSRotate){const t=e.firstElementChild;t&&(t.style.transform="",c=""),e.ecomCSSRotate=!1}},this.getStyleValue=function(e,t){if(!t)return"";const o=new RegExp(`${e}\\(([\\d\\-.a-z]+)\\)`);return t.match(o)[1]||""},this.getOptions=function(t,o,n,r){var i={};return t.forEach((function(t){const a=t.value;if(!a)return;const c=0n){let e=t;t=n,n=e}if(t>o)l=0;else if(no&&n0&&(document.addEventListener("scroll",r),window.addEventListener("load",r)),document.addEventListener("shopify:section:load",(e=>{let t=JSON.parse(unescape(e.target.dataset.shopifyEditorSection)),o=null;if(t.type&&t.type.includes("ecom-")&&(o=e.target),!o)return;let n=o.querySelectorAll("script");n.length&&n.forEach((function(e){if(e.src){o.removeChild(e);let t=document.createElement("script");t.src=e.src,o.prepend(t)}}))}))}();