function debounce(e,t,r){var n;return function(){var l=this,o=arguments,a=function(){n=null,r||e.apply(l,o)},u=r&&!n;clearTimeout(n),n=setTimeout(a,t),u&&e.apply(l,o)}}function getRandomInt(e,t){return Math.floor(Math.random()*(t-e+1)+e)}function closeModal(e,t=!1){t||(t=e.currentTarget.closest("[data-bstr-modal]")||e.currentTarget.closest(".modal")),t.style.display="none"}const isUndefined=e=>typeof e=="undefined";Element.prototype.closestEl=function(e){for(var t=this.parentElement;t;){if(t.matches(e))return t;var r=t.querySelectorAll(e);for(let n=0,l=r.length;n{try{let n=new URL(c.url);n.origin==window.location.origin&&["/cart/add.js","/cart/update.js","/cart/change.js","/cart/clear.js"].includes(n.pathname)&&t.dispatchListeners({change:!0})}catch(n){console.log("[BOOSTER THEME] Invalid URL format caught in fetch.")}}),r})}(window,window.fetch),window.addEventListener("storage",s=>{s.key=="bstr:cart:update"&&bstore.get("bstr:cart:update",0)>t.minicart.lastUpdate&&this.dispatchListeners()})}open(){if(document.querySelectorAll("[data-minicart-input]:checked").length)return;let a=document.querySelectorAll("[data-minicart-input]");for(let e of a){let s=e.closestEl(".minicart__label");if(s&&s.clientHeight>0&&s.clientWidth>0)return e.checked=!0}}close(){let t=document.querySelectorAll("[data-minicart-input]:checked");for(let a of t)a.checked=!1}async clear(){!(await fetch("/cart/clear.js")).ok||this.events.trigger("booster:cart:clear")}addListener(t,a){let e=t.dataset.cartSettings.split(","),s={};for(let i=0,r=e.length;it)&&!(typeof events!="undefined"&&events.indexOf(n)==-1)){switch(n){case"count":s.settings[n].innerText=this.minicart.data.item_count;break;case"product-list":s.settings[n].innerHTML=this.minicart.data.html;break;case"total":s.settings[n].innerText=this.minicart.data.total;break}s.settings[n].dataset.lastUpdate=t}}}}async dispatchListeners({change:t=!1}={}){let a=this,e=Date.now();if(e>a.minicart.lastUpdate){let s=await(await fetch("/?section_id=api__minicart",{headers:{Pragma:"no-cache","Cache-Control":"no-cache, no-store, must-revalidate",Expires:0}})).text(),i=document.createElement("div");i.innerHTML=s,this.minicart={lastUpdate:e,data:JSON.parse(i.innerText)},this.minicart.data.items=JSON.parse(this.minicart.data.items),this.events.trigger("booster:cart:update",this.minicart,!0)}for(this.minicartHandler(e),t&&localStorage.setItem("bstr:cart:update",e),this.events.trigger("booster:content:update",{trigger:"minicart"});this.awaitingSuccess.length;)this.success(this.awaitingSuccess.pop())}quantityHandler(t,a,e=!0){t.preventDefault();let s=t.target.parentElement.querySelector("[data-qty-input]");if(a){if(!isNaN(parseInt(s.max))&&parseInt(s.value)>=s.max)return this.error({description:"Seems like there are no more items in stock."});s.value++}else{if(parseInt(s.value)<=0||!e&&parseInt(s.value)==1)return!1;--s.value}return e?s.onchange({target:s}):!0}addToQueue(t){this.queue.push(t),!(this.queue.length>1)&&this.checkQueue()}addToCartIU(){let t=document.querySelectorAll("input.inline-upsell__toggle:checked"),a={items:[]};for(let e=0,s=t.length;e1?"s":"");t.product_has_only_default_variant||(n=t.variant_title);let m=s.querySelector(".add-to-cart__success--single");const l=o=>m.querySelector(o);let u=l(".add-to-cart__success--single-img");r!=null?(u.src=r,u.style.display="block"):u.style.display="none",l(".add-to-cart__success--single-title").innerText=c,l(".add-to-cart__success--single-variation").innerText=n;let y=this.cartSuccessInfoTemplate.replace("%total%",p).replace("%itemCount%",g);l(".add-to-cart__success--single-current").innerHTML=y;let b=this.events.trigger("booster:cart:b*upsell",{item:t,cart:this.minicart});if(a&&!b.prevent){let o=await this.basync.getUpsell(t.url),d=s.querySelector(".add-to-cart__success--upsell");if(d.style.display="none",o.trim()!=""){let f=document.getElementById("quickbuy__modal");f&&(f.style.display="none"),d.innerHTML=o,d.style.display="flex",this.events.trigger("booster:cart:upsell",{html:d,items:!1,item:t,cart:this.minicart})}}i.style.display="block",this.events.trigger("booster:content:update",{trigger:"upsell"})}success(t){let a=this.cartSuccessConfig,e=t.items&&t.items[0]||t;if(this.events.trigger("booster:cart:add",{item:e}),a.action=="cart")return window.location="/cart";if(a.action=="checkout")return window.location="/checkout";if(a.action=="message")return this.events.trigger("booster:notify",{type:"success",message:"Product added to cart successfully."});if(a.action=="minicart")return this.open();this.renderModal(e,a.action=="upsell")}error(t){return console.error(`Error trying to add product: `,t),this.events.trigger("booster:notify",{type:"error",message:t})}} class BstrLazy{constructor({events:a,cname:e="lazyload"}){this.events=a,this.class=e,this.images=!0,"loading"in HTMLImageElement.prototype&&_settings.nativeLazyLoad&&(this.images=!1),this.init()}init(){this.images||this.convertNative(),this.observer=new IntersectionObserver(function(e,l){for(let s=0,c=e.length;s=g||i+1==o.length){t.style.backgroundImage=`url(${n})`;break}}break}t.src=t.dataset.src;break;case"VIDEO":let d=t.querySelector("source");d.src=d.dataset.src;break;default:t.src=t.dataset.src;break}l.unobserve(r.target)}}},{threshold:.05});let a=this.images?document.querySelectorAll(".lazyload"):document.querySelectorAll('.lazyload:not([loading="lazy"])');for(let e=0,l=a.length;ethis.update())}convertNative(){var a=document.querySelectorAll('img[loading="lazy"]:not([data-bstr-initd])');for(let e=0,l=a.length;ethis.convertAll(m)),this.events.on("booster:price:update",this.priceUpdate.bind(this))}formatMoney(o,m){typeof o=="string"&&(o=o.replace(".",""));var n="",e=/\{\{\s*(\w+)\s*\}\}/,r=m||"${{amount}}";function t(a,u){return a===void 0?u:a}function _(a,u,y,c){if(u=t(u,2),y=t(y,","),c=t(c,"."),isNaN(a)||a==null)return 0;var f=(a=(a/100).toFixed(u)).split(".");return f[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+y)+(f[1]?c+f[1]:"")}switch(r.match(e)[1]){case"amount":n=_(o,2);break;case"amount_no_decimals":n=_(o,0);break;case"amount_with_comma_separator":n=_(o,2,".",",");break;case"amount_no_decimals_with_comma_separator":n=_(o,0,".",",")}return r.replace(e,n)}priceUpdate({elements:o}){let m=Shopify.currency.active,n=bstore.get("currentCurrency"),e=this.getFormat(n),r=this.getFormat(m);if(m!=n)for(let t of o)this.elemConvert({element:t,oldCurrency:m,newCurrency:n,oldFormat:r,newFormat:e})}elemConvert({element:o,oldCurrency:m=!1,newCurrency:n=!1,newFormat:e=!1,oldFormat:r=!1}){let t=o.innerText;if(!t||t.trim()=="")return;let _=m||Shopify.currency.active;if(!_)return;let a=n||bstore.get("currentCurrency");if(!a)return;let u=e||this.getFormat(a),y=r||this.getFormat(_),c;c=y.indexOf("amount_no_decimals")!==-1?Currency.convert(100*parseInt(t.replace(/[^0-9]/g,""),10),_,a):_==="JOD"||_=="KWD"||_=="BHD"?Currency.convert(parseInt(t.replace(/[^0-9]/g,""),10)/10,_,a):Currency.convert(parseInt(t.replace(/[^0-9]/g,""),10),_,a),o.innerHTML=this.formatMoney(c,u),o.dataset.currency=a}convert({amount:o=!1,oldc:m=!1,newc:n=!1}){if(!o||(m=m||Shopify.currency.active,!m)||(n=n||bstore.get("currentCurrency"),!n))return o;let e=this.getFormat(n),r=this.getFormat(m),t;return t=r.indexOf("amount_no_decimals")!==-1?Currency.convert(100*parseInt(o.replace(/[^0-9]/g,""),10),m,n):m==="JOD"||m=="KWD"||m=="BHD"?Currency.convert(parseInt(o.replace(/[^0-9]/g,""),10)/10,m,n):Currency.convert(parseInt(o.replace(/[^0-9]/g,""),10),m,n),this.formatMoney(t,e)}convertAll({oldCurrency:o=!1,newCurrency:m=!1,selector:n=".jsPrice",format:e=this.format}){let r=o||Shopify.currency.active;if(!r)return;let t=m||bstore.get("currentCurrency");if(!t||t==r)return;let _=this.moneyFormats[r][e]||"{{amount}}",a=this.moneyFormats[t][e]||"{{amount}}",u=document.querySelectorAll(n);for(let y=0,c=u.length;y{i.tagName=="SELECT"&&i.value!=r&&(i.value=r)}),this.toggleVariantIU()}toggleVariantIU(e=!1){let a=document.getElementById("inline-upsell__total");if(!a)return;let r=document.getElementById("inline-upsell__discount");if(e&&e.tagName=="SELECT"){let s=e.dataset.upsellId,p=e.value;this.swatches.setProductVariant(s,p)}let i=document.querySelectorAll("input.inline-upsell__toggle:checked"),o=0,d=0,n=[],c=this.cfx.getFormat(Shopify.currency.active);for(let s=0,p=i.length;su?(l.parentElement.classList.add("card__price--sale"),l.innerHTML=this.cfx.formatMoney(f,c),n.push(l)):(l.parentElement.classList.remove("card__price--sale"),l.innerHTML=""),o+=u,d+=f}a.innerHTML=this.cfx.formatMoney(o,c),r.innerHTML=d>o?this.cfx.formatMoney(d,c):"",n.push(a,r),this.events.trigger("booster:price:update",{currency:Shopify.currency.active,elements:n})}} class BstrSlider{constructor({events:e,selector:t,breakpoints:r}={}){this._selector=t||"[data-bstr-slider]",this._idSelector=this._selector.replace(/(\[data-|\])/g,"").replace(/-(\w)/g,s=>s[1].toUpperCase()),this._breakpoints=r||{sm:768,md:1024},this._sliders={},this._currentIndex=0,this._resize=!1,this.init(),e.on("booster:content:update",()=>this.init())}_isVisible(e,t,r){return r?t.top-e.top<=0&&t.bottom-e.bottom>=0:t.left-e.left<=0&&t.right-e.right>=0}async _parentMoveCallback(e){let t=parseInt(e.dataset.bstrSliderCurrent);const r=e.dataset.bstrSliderOrientation.toLowerCase()=="vertical";if(!e.querySelector("[data-bstr-slide]"))return;let s=Math.round(r?e.scrollTop/e.querySelector("[data-bstr-slide]").offsetHeight:e.scrollLeft/e.querySelector("[data-bstr-slide]").offsetWidth);e.dataset.bstrSliderCurrent=s;let i=t-s>0?"+":"-",l=e.querySelectorAll("[data-bstr-slide]"),o=[],a=[];const c=e.closest("[data-bstr-slide-holder]").getBoundingClientRect();for(let n=0;n{c.preventDefault(),c.stopImmediatePropagation(),this._move({slider:s,direction:a.dataset.bstrSliderButton||"+"})});this._parentMoveCallback(s),s.addEventListener("scroll",debounce(()=>this._parentMoveCallback(s),100),{passive:!0})}this._resize||(this._resizeHandler(),window.addEventListener("resize",debounce(this._resizeHandler.bind(this),250),{passive:!0}),this._resize=!0)}_resizeHandler(){window.innerWidththis._moveTo({slider:s,index:i})),t.getAttribute("data-bstr-slider-thumb-hover")!=null&&t.addEventListener("mouseover",()=>this._moveTo({slider:s,index:i}))}}_moveCallback({slider:e,current:t}){if(!t.length)return;let r=e.dataset.bstrSliderId;for(let s of document.querySelectorAll(`.bstrSlider__thumb--active[data-bstr-slider-for="${r}"]`))s.classList.remove("bstrSlider__thumb--active");if(window.innerWidth<790){let s=0;for(let i of t){let l=i.target.children[0];!l||l.clientHeight>s&&(s=l.clientHeight)}s&&(e.closest("[data-bstr-ppslider]").style.maxHeight=`${s}px`)}else e.closest("[data-bstr-ppslider]").style.maxHeight=null;document.querySelector(`[data-bstr-slider-thumb="${t[0].index}"][data-bstr-slider-for="${r}"]`).classList.add("bstrSlider__thumb--active")}}class BstrSectionSlider extends BstrSlider{constructor(e){super(e)}_moveCallback(e){for(let{target:t}of e.previous){let r=t.dataset.type=="bannerSlider"?t.querySelector("div"):t;r.dataset.type=="video"&&r.querySelector("video").pause(),r.classList.remove("slide__animation")}for(let{target:t}of e.current){let r=t.dataset.type=="bannerSlider"?t.querySelector("div"):t;r.dataset.type=="video"&&r.querySelector("video").play(),r.classList.add("slide__animation")}e.slider.dataset.sliderHolder=="adaptive"&&(e.slider.style.height=`${e.current[0].target.offsetHeight}px`)}} class BstrSwatchesTheme{constructor({swatches:t,events:i,slider:c,cfx:l}){this.sw=t,this.cfx=l,this.slider=c,this.events=i,this.initEvents()}initEvents(){this.events.on("booster:variant:select",this.selectSwatch.bind(this)),this.events.on("booster:variant:deselect",this.deselectSwatch.bind(this)),_settings.variantShowImage&&this.events.on("booster:swatch:update",this.scrollToImage.bind(this)),this.events.on("booster:swatch:render",this.renderSwatches.bind(this))}renderSwatches({pid:t,options:i,aOptions:c}){for(let e=0;er.innerText=""),document.querySelectorAll(`select[data-swatch-index="${t}-${e}"]`).forEach(r=>r.value="bstrSelectNill")):document.querySelectorAll(`span[data-swatch-selected-name="${t}-${e}"]`).forEach(r=>r.innerText=" - "+i[e]);let l=[];for(let e=0;er!==!1)){if(t.currentOptions.includes(!1))for(let a=0;a{s.innerText=c,r?s.classList.add("product__price--sale"):s.classList.remove("product__price--sale")}),document.querySelectorAll(`[data-tag-product="${i}"]`).forEach(s=>{let n=r?s.dataset.tagType:!1;switch(n){case"percent":{s.innerText=Math.floor((l.price_raw-l.sale_raw)/l.sale_raw*100)+"% "+_bstrLocale.tags.off;break}case"amount":{s.innerText=this.cfx.formatMoney(l.sale_raw-l.price_raw,this.cfx.getFormat());break}case"text":{s.innerText=_bstrLocale.tags.sale.toUpperCase();break}default:{s.classList.add("hide");break}}n&&s.classList.remove("hide")}),document.querySelectorAll(`[data-product-price-sale="${i}"]`).forEach(s=>{if(!r)return s.classList.add("hide");s.innerText=l.sale,s.classList.remove("hide")});let a=document.querySelectorAll(`input[data-bstr-variant-input="${t.product.id}"]`);for(let s of a)s.setAttribute("value",t.selectedVariant.id);let o=document.querySelectorAll(`[data-buy-button="${t.product.id}"]`);for(let s of o)l.available?(s.querySelector("[data-button-text]").innerText=s.dataset.originalText,s.removeAttribute("disabled")):(s.querySelector("[data-button-text]").innerText=_bstrLocale.buttons.sold_out,s.setAttribute("disabled","true"));let u=document.querySelectorAll(`[data-dynamic-button="${t.product.id}"]`);for(let s of u){let n=s.querySelector("button");!n||(l.available?n.removeAttribute("disabled"):n.setAttribute("disabled","true"))}let d=new URL(document.URL);d.searchParams.set("variant",t.selectedVariant.id),history.replaceState({},"",d),this.events.trigger("booster:price:update",{elements:e})}deselectSwatch(t){let i=document.querySelectorAll(`input[data-bstr-variant-input="${t.product.id}"]`);for(let r of i)r.setAttribute("value",-1);let c=document.querySelectorAll(`[data-buy-button="${t.product.id}"]`);for(let r of c)r.setAttribute("disabled","true"),r.querySelector("[data-button-text]").innerText=_bstrLocale.buttons.select;let l=document.querySelectorAll(`[data-dynamic-button="${t.product.id}"]`);for(let r of l){let a=r.querySelector("button");!a||a.setAttribute("disabled","true")}let e=new URL(document.URL);e.searchParams.delete("variant"),history.replaceState({},"",e)}} class BstrSwatches{constructor({events:t,slider:r,cfx:e}){this.events=t,this.current={},this.variants={},this.THEME_UTILS=new BstrSwatchesTheme({swatches:this,events:t,slider:r,cfx:e}),this.initListeners(),this.events.on("booster:content:update",()=>{this.initListeners();for(let s of Object.keys(this.current))this.filterSwatches(s)})}initListeners(){const t=this;let r=document.querySelectorAll("[data-swatch-index]:not([data-booster-initd])");for(let e of r)e.tagName!="OPTION"&&(e.tagName==="SELECT"?e.addEventListener("change",s=>{let a=s.currentTarget,n=a.value,i=a.dataset.swatchIndex.trim().split("-"),o;n==="bstrSelectNill"?o=!1:o=n,t.setOption(i[0],parseInt(i[1]),o)}):e.addEventListener("click",s=>{let a=s.currentTarget;if(_settings.swatchLogic!="amazon"&&a.classList.contains("swatch--disabled")||_settings.disableSOSwatch&&a.dataset.swatchSoldout)return;let n=a.dataset.swatchIndex.trim().split("-"),i;a.classList.contains("swatch--active")?i=!1:i=e.dataset.swatchOption,t.setOption(n[0],parseInt(n[1]),i)}),e.dataset.boosterInitd="true");if(_settings.preselectSwatch!="false"){let e=document.querySelectorAll("noscript[data-bstr-preselect]:not(data-bstr-initd)");if(_settings.preselectSwatch=="firstOptionIndex")for(let s of e)s.dataset.bstrInitd="true",!Object.keys(this.current).includes(s.dataset.bstrSwatch)&&this.setOption(s.dataset.bstrSwatch,0,this.getVariant(s.dataset.bstrSwatch,s.dataset.bstrPreselect).options[0]);else for(let s of e)s.dataset.bstrInitd="true",!Object.keys(this.current).includes(s.dataset.bstrSwatch)&&this.setProductVariant(s.dataset.bstrSwatch,s.dataset.bstrPreselect)}}getVariants(t){return this.variants[t]||(this.variants[t]=JSON.parse(document.querySelector(`noscript[data-bstr-swatch="${t}"]`).innerText)),this.variants[t]}getVariant(t,r){return this.getVariants(t)[r]}findVariant(t){const r=this.current[t],e=this.getVariants(t);for(let[s,a]of Object.entries(e)){let n=!0;for(let i=0;i[],0,a.length),i;for(let o=0;onew Set,0,s);for(let n of Object.values(r))for(let i=0;inew Set,0,s),o=[...e];o[n]=!1;for(let{options:c}of Object.values(r))if(this.matchesOptions(o,c))for(let l=0;li[n].has(c)))}return this.events.trigger("booster:swatch:render",{pid:t,options:e,aOptions:a})}} class BstrCntr{constructor(t="[data-bstr-cntr]"){this.id=t,this.counters=[],this.interval=!1,this.initCounters()}initCounters(){let t=document.querySelectorAll(`${this.id}:not([data-bstr-initd])`);if(!t.length)return;let n=parseInt(t[0].dataset.bstrCntrInterval)*1e3;this.interval&&clearInterval(this.interval);for(let r of t)this.counters.push(r),r.dataset.bstrInitd="true";this.interval=setInterval(this.countManagement.bind(this),n)}countManagement(){let t={};for(let n=0,r=this.counters.length;nthis.initListeners())}initListeners(){for(let t of document.querySelectorAll("input[data-filter-href]:not([data-bstr-initd])"))t.dataset.bstrInitd="true",t.addEventListener("change",this.modifyFilters.bind(this));for(let t of document.querySelectorAll("[data-filter-href]:not([data-bstr-initd]):not(input)"))t.dataset.bstrInitd="true",t.addEventListener("click",this.modifyFilters.bind(this))}modifyFilters(t){this.renderChangePage(t.target.dataset.filterHref)}setInputState(t){for(let i of document.querySelectorAll("[data-filter-href]"))i.disabled=!t}async renderChangePage(t){let i=document.querySelector(".shopify-section.row--product.product__list");i.style.opacity="0.4",this.setInputState(!1);let n=new URL(window.location.origin+t),{html:e,json:r}=await this.basync.load({url:n,section:"product-list",selector:"#shopify-section-product-list",json:"noscript"});if(!e){this.setInputState(!0),i.style.opacity="1";return}i.innerHTML=e,history.pushState({},"",window.location.origin+t),this.events.trigger("booster:content:update"),i.style.opacity="1",this.renderFilters(r);for(let s of document.querySelectorAll(".collection__total-items"))s.innerText=r.count}renderFilters(t){this.setInputState(!0);for(let[i,n]of Object.entries(t.filters))for(let e of n){let r=document.querySelector(`[data-filter="${i}-${e.value}"]`),s=r.nextElementSibling.querySelector("[data-filter-count]");s&&(s.innerText=e.count),r.disabled=!e.count,r.checked=e.active,r.dataset.filterHref=e.active?e.urls.remove:e.urls.add,e.count?r.closest("div").classList.remove("filter--disabled"):r.closest("div").classList.add("filter--disabled")}}} class BstrInsta{constructor({events:t}){this.events=t,this.init()}async init(){let t=document.querySelectorAll("[data-instagram-section]");for(let e=0,s=t.length;e4&&"1-5"||"3";for(let n=0;n
Likes: ${h}
Comments: ${c}
`}t.innerHTML=e,this.events.trigger("booster:content:update")}catch(e){console.log(e),t.closest(".shopify-section").style.display="none"}}} class BstrVisitor{constructor({events:e,geo:t=!0}){this.events=e,this.geo=t,this.customer=!1,this.map={"%country%":{k:"country",sk:"name"},"%city%":{k:"city",sk:"name"},"%zip%":{k:"city",sk:"zip"},"%flag_svg%":{k:"flag",sk:"svg"},"%flag_emoji%":{k:"flag",sk:"emoji"},"%language_name%":{k:"language",sk:"name"},"%language_native%":{k:"language",sk:"nativeName"},"%language_code%":{k:"language",sk:"code"},"%currency_code%":{k:"currency",sk:"code"},"%currency_name%":{k:"currency",sk:"name"},"%currency_symbol%":{k:"currency",sk:"symbol"}},this.init()}replaceContent(e){let t=e.dataset.bstrGeoBlock==""?e.innerHTML:e.dataset.bstrGeoBlock;for(let[r,s]of Object.entries(this.map))t=t.replace(new RegExp(r,"gi"),s.sk?this.customer[s.k][s.sk]:this.customer[s.k]);e.innerHTML=t}embedGeo(){let e=document.querySelectorAll("[data-bstr-geo-block]:not([data-bstr-initd])");for(let t of e)this.replaceContent(t),t.dataset.bstrInitd="true",t.removeAttribute("data-bstr-geo-block")}async init(){if(bstore.get("bstr:visitor_info"))return this.customer=bstore.get("bstr:visitor_info"),this.embedGeo(),this.events.on("booster:content:update",this.embedGeo.bind(this)),this.events.trigger("booster:geo:visitor",this.customer,!0);let e=await fetch("https://countries.boostertheme.co/?visitor="+Math.floor(Math.random()*1e7));if(!e.ok)return this.events.trigger("booster:geo:error");let{ip:t,countryCode:r,city:s,zip:c,capital:a,region:g,name:u,nativeName:m,currency:l,languages:h,flag:b,emoji:k}=await e.json();const o=h[0];let i=o.iso639_1.toLowerCase();switch(r){case"BR":{i="pt-br";break}case"PT":{i="pt-pt";break}}return this.customer={ip:t,country:{code:r,name:u,nativeName:m,capital:a},region:g,city:{name:s,zip:c,capital:a.toLowerCase()==s.toLowerCase()},language:{code:i,name:o.name,nativeName:o.nativeName},currency:l,flag:{svg:``,emoji:k.split(" ").reduce((n,d)=>(n+=String.fromCodePoint(parseInt(d,16)),n),"")}},bstore.set("bstr:visitor_info",this.customer,180),this.embedGeo(),this.events.on("booster:content:update",this.embedGeo.bind(this)),this.events.trigger("booster:geo:visitor",this.customer,!0)}get(){return this.customer}} class BstrCountdown{constructor({events:e}){this.events=e,this.init(),this.events.on("booster:content:update",()=>this.init())}async init(e=document){let n=e.querySelectorAll("[data-countdown]");this.bstrCts?this.bstrCts.push(...n):this.bstrCts=[...n];let i=bstore.get("bstrCts");i||(i={});let o=new Date().getTime(),l=parseInt(_settings.countdownRandom);function c(s){switch(s){case"days":return 864e5;case"hours":return 36e5;case"minutes":return 6e4;case"seconds":return 1e3;default:return 864e5}}let d,u,a;if(_settings.countdownTime.includes("/"))d=new Date(_settings.countdownTime).getTime(),u=d-l*864e5,a=d+l*864e5;else{let s=parseInt(_settings.countdownTime),h=c(_settings.countdownTimeFormat);u=o+Math.abs(s-l)*h,a=o+Math.abs(s+l)*h}function p(s,h,r=!0){if(h=="app"){let t=getRandomInt(u,a);return s.dataset.expiryTime=t,t}else{let t,m=s.dataset.duration;return m.includes("/")?t=new Date(m).getTime():t=o+parseInt(m)*c(s.dataset.durationFormat),r&&(s.dataset.expiryTime=t),t}}for(let s=0,h=n.length;sa){let f=getRandomInt(u,a);i[t]=f,r.dataset.expiryTime=f}else r.dataset.expiryTime=i[t];else{let f=p(r,m,!1);i[t]>f?(r.dataset.expiryTime=d,i[t]=f):r.dataset.expiryTime=i[t]}}bstore.set("bstrCts",i,1440),this.countdownStarted||(setInterval(this.tickCountdowns.bind(this),1e3),this.countdownStarted=!0)}tickCountdowns(){for(let e=0,n=this.bstrCts.length;e=10&&d||"0"+d),n-=d*86400;let u=Math.floor(n/3600)%24;n-=u*3600,o&&(o.innerText=u>=10&&u||"0"+u);let a=Math.floor(n/60)%60;n-=a*60,l&&(l.innerText=a>=10&&a||"0"+a);let p=n%60;c&&(c.innerText=p>=10&&Math.floor(p)||"0"+Math.floor(p))}} class BstrStock{constructor({events:e}){this.events=e,this.stockInterval,this.initStock(),this.events.on("booster:content:update",this.initStock.bind(this))}async initStock(){this.stockInterval&&clearInterval(this.stockInterval);let e=document.querySelectorAll("[data-stock-type]");if(!e.length)return;let s=bstore.get("bstrStock")||{},a=[],l=parseInt(e[0].dataset.reduce);(e[0].dataset.stockType=="inventory"||s.stockInfo!=e[0].dataset.stockType)&&(s={stockInfo:e[0].dataset.stockType});for(let o=0,i=e.length;o0){var n=this;this.stockInterval=setInterval(()=>{n.stockManagement(a)},l*1e3)}}stockManagement(e){let s=bstore.get("bstrStock")||{};for(let a=0,l=e.length;a1&&--o,s[n.dataset.product]=o;let i=Math.floor(o/n.dataset.stockLeft*100*.25);i<5&&(i=5),n.closestEl(".amount--left").style.width=i+"%",n.innerText=o}bstore.set("bstrStock",s,1440)}} class BstrElements{constructor({events:e,basync:t,cfx:r,cart:s}){this.events=e,this.cfx=r,this.cart=s,this.basync=t,this.stock=new BstrStock({events:e}),this.marqueeIntervals={},this.cardTemplate=document.getElementById("productCardTemplate"),this.checkPagination(),this.initMarquees(),this.initElements(),this.events.on("booster:content:update",this.initElements.bind(this)),this.events.on("booster:currency:changed",()=>this.cfxInput())}initElements(){this.quantityHandlers(),this.cfxInput(),this.initSearch(),this.boosterRevert(),this.localizeDates()}async initMarquees(){let e=document.querySelectorAll('[data-blocktype="barTextMarquee"]');for(let r=0,s=e.length;r=e.dataset.messagescount){e.dataset.currentmessage=0,e.style.transform="translateY(0%)";return}e.dataset.currentmessage++,e.style.transform=`translateY(-${e.dataset.currentmessage*100}%)`}checkPagination(){if(_settings.pagination=="infinite"){let e=document.querySelector(".row--product.product__list");if(!e)return;self=this,window.addEventListener("scroll",debounce(()=>{if(window.innerHeight+window.scrollY>=e.offsetHeight){let t=document.querySelector(".pagination--hidden");if(!t)return;self.renderChangePage(!1,t,!1)}},250))}}boosterRevert(){let e=document.querySelectorAll(".booster--revert div:not(.booster--revert)");for(let t=0,r=e.length;t{t.value=e})}}quantityHandlers(){let e=document.querySelectorAll("[data-qty-int-input]:not([data-bstr-initd])");for(let t of e)t.dataset.bstrInitd="true",t.oninput=debounce(r=>{t.onchange(r)},500,!1)}convertCurrencyChange(e){let t=e.value;t!=bstore.get("currentCurrency")&&this.cfx.convertAll({oldCurrency:bstore.get("currentCurrency")||Shopify.currency.active,newCurrency:t})}submitCurrencyChange(e){return e.closest("form").submit()}languageChange(e){return window.location=e.value}stickyBuy(e,t){if(e.dataset.productId){let r=e.closestEl(".sticky--mobile");if(r.classList.contains("sticky--closed"))return r.classList.remove("sticky--closed")}else{let r=e.dataset.buyButton,s=document.getElementById("product_form_"+r);s&&this.cart.addToCart(t,s)}}closeSticky(e){e.closest(".sticky--mobile").classList.add("sticky--closed")}async renderSort(e){let t=new URL(document.URL);t.searchParams.set("sort_by",e.value),t.searchParams.delete("page");let r=t.href,s=document.querySelector(".shopify-section.row--product.product__list");s.style.opacity="0.5";let{html:a}=await this.basync.load({url:t,section:"product-list",selector:"#shopify-section-product-list"});if(!a)return s.style.opacity="1";s.innerHTML=a,history.replaceState({},"",r),this.events.trigger("booster:content:update",{trigger:"sort"}),s.style.opacity="1"}submitSearch(e){e.closestEl("form").submit()}openSearch(e){e?(e.closestEl("[data-search-container]").classList.add("focused"),e.tagName!="input"&&(e=e.closestEl("input"))):(e=document.querySelector(".search__container--abs"),e.classList.add("focused"),e=e.querySelector("input")),e.focus();let t=e.closestEl("[data-search-suggest]");e.value.length||boosterTheme.handleEmptySearch(t)}closeSearch(e){e.closestEl("[data-search-container]").classList.remove("focused")}renderProductCard(e){let t=this.cardTemplate.cloneNode(!0).content.children[0];const r=a=>t.querySelector(a);r(".card__img--container").href=e.url,r(".card__title").href=e.url,r("[data-product-image]").src=e.featured_image.url,r(".card__title").innerText=e.title,r(".card__price").innerText=e.price;let s=r("[data-countdown]");return s.classList.add("hide"),s.removeAttribute("data-countdown"),e.available||t.classList.add("card--soldout"),t.classList.add("col-md-1-5"),t}createSearchSuggestResult(e){return this.renderProductCard(e)}populateSearchSuggest(e,t){for(var r=t.resources.results.products,s=document.createDocumentFragment(),a=0,o=r.length;a0){let o=`/search/suggest.json?q=${r}&resources[type]=product&resources[limit]=5&resources[options][unavailable_products]=last`;fetch(o).then(c=>c.json()).then(c=>t.populateSearchSuggest(a,c))}else return this.handleEmptySearch(a)}handleEmptySearch(e){return e.innerHTML=emptySearch,this.events.trigger("booster:content:update")}async quickBuy(e){if(window.innerWidth<768)return;e.preventDefault();const t='",r=(c,n)=>c.querySelector(n);let s=new URL(e.target.closest("a").href),{parser:a}=await this.basync.load({url:s,section:"product-page__product"});if(r(a,".product__row").classList.contains("product__row--marketplace")){let c=r(a,".product__row");c.classList.remove("product__row--marketplace");let n=r(c,".product__page--info"),l=r(n,".product__title"),u=r(n,".product__price--holder");c.removeChild(n);let i=r(c,".product__page--info");r(i,".product__title")||i.insertBefore(l,i.firstChild),r(i,".product__price")||r(i,".product__title").insertAdjacentElement("afterend",u)}let o=document.getElementById("quickbuy__modal");r(o,".content").innerHTML=t+r(a,"body").innerHTML,o.style.display="flex",this.events.trigger("booster:content:update",{trigger:"quickbuy"})}toggleTab(e,t){let s=e.closest(".tab__container");s.querySelector(".tab--show").classList.remove("tab--show"),s.querySelector(`#${t}`).classList.add("tab--show"),s.querySelector(".tab__holder").querySelector(".tab--active").classList.remove("tab--active"),e.classList.add("tab--active")}toggleCollectionView(e,t){if(t.classList.contains("view--active"))return;t.closestEl(".view--active").classList.remove("view--active"),t.classList.add("view--active");let r=document.querySelectorAll(".row--product");if(e=="card")for(var s=0,a=r.length;s{}}}),__bstrInitClass=(s,...e)=>{try{return new s(...e)}catch(t){console.debug("[Booster Class Init] ",t)}};class BstrFreeShipping{constructor({events:e,cfx:t}){this.events=e,this.cfx=t,this.goal=parseFloat(_settings.freeShippingAmount.trim())*100,this.current=0,this.format=this.cfx.getFormat(Shopify.currency.active),this.events.on("booster:cart:update",this.updateBars.bind(this)),this.events.on("booster:content:update",this.updateBars.bind(this))}updateBars(e={}){let t=e.data&&e.data.total_raw||this.current;this.current=t;let n=Math.min(t/this.goal*100,100),r=this.cfx.convert({amount:this.cfx.formatMoney(this.goal-t,this.format)}),o=document.querySelectorAll("[data-free-shipping-bar]"),a=document.querySelectorAll("[data-free-shipping-text]");for(let i of o)i.style.width=n+"%";for(let i of a)i.innerHTML=n==100?i.dataset.gotFreeShipping:i.dataset.freeShippingText.replace("%AMOUNT%",`${r}`)}}class BstrLocalize{constructor({events:e,cfx:t}){this.events=e,this.cfx=t,_settings.geolocation&&this.events.on("booster:geo:visitor",this.localize.bind(this))}async localize(e){if(bstore.get("bstrLocalized"))return;bstore.set("bstrLocalized",!0,1440);let t=e.currency.code,n=e.language.code,r=window.location.pathname,o=!1;if(n!=Shopify.locale&&Object.keys(bstri18n.locales).includes(n)){let c=bstri18n.locales[n],h=bstri18n.locales[Shopify.locale];h.primary||(r=r.replace(`${h.url}`,"")),c.primary||(r=`${c.url}${r}`),o=!0}let a=bstri18n.currency_mode,i=bstri18n.currencies;if(a!="none"&&i.includes(t)){if(a=="convert"&&bstore.get("currentCurrency")!=t)this.cfx.convertAll({oldCurrency:bstore.get("currentCurrency")||Shopify.currency.active,newCurrency:t}),this.events.trigger("booster:currency:changed");else if(Shopify.currency.active!=t){let c=new FormData;if(c.append("form_type","currency"),c.append("currency",t),await fetch("/cart/update",{body:c,method:"POST"}),!o)return window.location.reload()}}if(o)return window.location=r}}class BstrTheme{constructor(){this.events=new BstrEvents,this.basync=new BstrAsync({events:this.events}),this.initFeaturedProducts(),document.dispatchEvent(new CustomEvent("booster:initialized",{detail:{BoosterTheme:this}})),this.notify=new BstrNotify({events:this.events}),this.cart=new BstrCart({events:this.events,basync:this.basync}),this.lazy=new BstrLazy({events:this.events}),this.defaultSlider=new BstrSlider({events:this.events}),this.PPSlider=new ProductSlider({events:this.events,selector:"[data-bstr-ppslider]"}),this.sectionSlider=new BstrSectionSlider({events:this.events,selector:"[data-bstr-section-slider]"}),this.cfx=new BstrCurrency({events:this.events}),this.swatches=new BstrSwatches({events:this.events,slider:this.PPSlider,cfx:this.cfx}),this.counters={cart:new BstrCntr('[data-bstr-cntr-id^="c-"]'),watching:new BstrCntr('[data-bstr-cntr-id^="w-"]')},this.countdown=new BstrCountdown({events:this.events}),this.filters=new BstrFilters({events:this.events,basync:this.basync}),this.insta=typeof BstrInsta=="function"?__bstrInitClass(BstrInsta,{events:this.events}):BstrDummyClass,this.visitor=new BstrVisitor({events:this.events}),this.localize=new BstrLocalize({events:this.events,cfx:this.cfx}),this.freeShippingBar=new BstrFreeShipping({events:this.events,cfx:this.cfx}),this.inlineUpsell=new BstrIU({events:this.events,cfx:this.cfx,swatches:this.swatches}),this.ELEMENTS=new BstrElements({events:this.events,basync:this.basync,cart:this.cart,cfx:this.cfx}),typeof BstrDynTitle!="undefined"&&(this.dynt=new BstrDynTitle),typeof BstrCopycat!="undefined"&&(this.copycat=new BstrCopycat),typeof BstrGDPR!="undefined"&&(this.gdpr=new BstrGDPR),typeof BstrRecentlyBought!="undefined"&&(this.recentlyBought=new BstrRecentlyBought),this.events.trigger("booster:loaded",{BoosterTheme:this})}async initFeaturedProducts(){try{let e=document.querySelectorAll("[data-featured-product]");for(let t=0,n=e.length;t{if(Shopify.designMode){let s=document.createElement("script");s.type="text/javascript",s.src="https://static.boostertheme.co/?files=6.0/admin.6.0.0",document.body.appendChild(s)}})();