var currentCollection=window.location.pathname.split("collections/")[1],saleTag="sale-tag-here",altSaleTag="alt-sale-tag-here",altSaleText="Save up to 30% on Lounge & Active",saleSuffix="with code BEST20",salePrefix="",saleDiscountComplement=.8,sale_active=!0;let updatedLimit,paginationType;if(window.location.pathname.includes("/search"))updatedLimit=20,paginationType="default";else{var numCustomCards=$(".custom_card_data").length,total_cards=0;$(".custom_card_data").length>0&&$(".custom_card_data").each(function(i,element){var cardWidth=$(element).attr("data-width");total_cards=total_cards+parseInt(cardWidth)}),numCustomCards>0?updatedLimit=24-total_cards:updatedLimit=24,paginationType="load_more"}var bcSfFilterSettings={general:{limit:updatedLimit,paginationType,paginationTypeAdvanced:!1}};Shopify.handleize=function(str){str=str.toLowerCase();for(var toReplace=['"',"'","\\","(",")","[","]"],i=0;i",$productImagesContainer.append(imagesHtml);var slideIndex;isMasterProduct?slideIndex=0:slideIndex=$('.product-item[data-product-id="'+productId+'"] .product-item__image[data-product-handle="'+productHandle+'"]').index(),$product.find(".js-product-item-gallery").slick({slidesToShow:1,slidesToScroll:1,arrows:!0,dots:!1,infinite:!0,swipe:!1,touchMove:!1,draggable:!1,initialSlide:slideIndex,rows:0}),$(".slick-prev").attr("aria-label","View Previous Product Image"),$(".slick-next").attr("aria-label","View Next Product Image"),$product.find(".js-product-item-gallery").on("afterChange",function(event,slick,currentSlide){var $slider=$(this),activeProductHandle=$slider.find('.slick-slide[data-slick-index="'+currentSlide+'"]').attr("data-product-handle");$product.find('.js-color-link[data-product-handle="'+activeProductHandle+'"]').length&&($product.find(".js-color-link").removeClass("js-active"),$product.find('.js-color-link[data-product-handle="'+activeProductHandle+'"]').addClass("js-active"))})}window.COLLECTIONS={},window.PRODUCTS={};var bcSfFilterTemplate={soldOutClass:"sold-out",saleClass:"on-sale",soldOutLabelHtml:"
"+bcSfFilterConfig.label.sold_out+"
",saleLabelHtml:"
"+bcSfFilterConfig.label.sale+"
",vendorHtml:"
{{itemVendorLabel}}
",productGridItemHtml:'
{{itemBadge}}

{{itemTitle}}

{{itemPrice}}
{{promoText}}
',previousActiveHtml:'
  • ',previousDisabledHtml:'
  • ',nextActiveHtml:'
  • ',nextDisabledHtml:'
  • ',pageItemHtml:'
  • {{itemTitle}}
  • ',pageItemSelectedHtml:'
  • {{itemTitle}}
  • ',pageItemRemainHtml:"
  • {{itemTitle}}
  • ",paginateHtml:'',sortingHtml:''},cardNum=1;BCSfFilter.prototype.buildProductGridItem=function(data,index){var $this=$(this),dataset=document.getElementById("bc-sf-filter-products"),custom_cards=dataset.getAttribute("data-custom-cards"),start_index=dataset.getAttribute("data-start-index"),offset_index=dataset.getAttribute("data-offset-index"),pageNum=this.queryParams.page;bcSfFilterSettings.general.limit=24;const intOffset_index=parseInt(offset_index),intStart_index=parseInt(start_index);var finalHtml="";$(".custom_card_data").length>0&&pageNum==1&&$(".custom_card_data").each(function(i2,element){var cardLocation=parseInt($(element).attr("data-location")),cardBackgroundColor=$(element).attr("data-background-color"),cardWidth=$(element).attr("data-width"),cardBackgroundImage=$(element).attr("data-background-image"),cardHeaderCopy=$(element).attr("data-header-copy"),cardHeaderCta=$(element).attr("data-header-cta"),cardHeaderCtaText=$(element).attr("data-header-cta-text"),cardHeaderTextColor=$(element).attr("data-header-text-color"),cardAdaText=$(element).attr("data-ada-text");if(!isNaN(cardLocation)&&index==cardLocation){if(cardWidth==2)if(cardHeaderCta)var custom_card_html='
    ';else var custom_card_html='
    ';else if(cardHeaderCta)var custom_card_html='
    {{main_text_first}}
    {{card_cta_copy}}
    ';else var custom_card_html='
    {{main_text_first}}
    {{card_cta_copy}}
    ';custom_card_html=custom_card_html.replace(/{{background_color}}/g,cardBackgroundColor),custom_card_html=custom_card_html.replace(/{{main_text_first}}/g,cardHeaderCopy),custom_card_html=custom_card_html.replace(/{{background_image}}/g,cardBackgroundImage),custom_card_html=custom_card_html.replace(/{{main_text_color}}/g,cardHeaderTextColor),custom_card_html=custom_card_html.replace(/{{button_url}}/g,cardHeaderCta),custom_card_html=custom_card_html.replace(/{{card_cta_copy}}/g,cardHeaderCtaText),custom_card_html=custom_card_html.replace(/{{ada_label}}/g,cardAdaText),finalHtml+=custom_card_html}});var images=data.images_info,soldOut=!data.available,onSale=!1,priceVaries=data.price_min!=data.price_max,firstVariant=data.variants[0];if(getParam("variant")!==null&&getParam("variant")!=""){var paramVariant=data.variants.filter(function(e){return e.id==getParam("variant")});typeof paramVariant[0]<"u"&&(firstVariant=paramVariant[0])}else for(var i=0;i{tag.includes("color::master")&&(isMasterProduct=!0)});var itemHtml=bcSfFilterTemplate.productGridItemHtml;if(isMasterProduct){let imageToUse;$(data.tags).each(function(index2,element){if(element.indexOf("master-collection::")!==-1){var $productItem=$('.product-item[data-product-id="'+data.id+'"]'),itemSwatches='
      ',collectionHandle=Shopify.handleize(element.replace("master-collection::","")),jsonUrl="/collections/"+collectionHandle+"?view=ajax";$productItem.attr("data-collection",collectionHandle),$.ajax({type:"get",url:jsonUrl,async:!1,dataType:"html",success:function(response){let allProducts=JSON.parse(response);allProducts.products.map((product,index3)=>{let isMain=!1;if(product.tags.map(tag=>{tag.includes("color::master")&&(isMain=!0)}),allProducts.products.length==1&&isMain)imageToUse=product.images[0];else{if(index3==0&&!isMain)return imageToUse=product.images[0];if(index3==1&&!isMain)return imageToUse=product.images[0]}}),itemHtml=itemHtml.replace(/{{itemThumbUrl}}/g,imageToUse)}})}})}else{var itemThumbUrl=images.length>0?this.optimizeImage(images[0].src):bcSfFilterConfig.general.no_image_url;itemHtml=itemHtml.replace(/{{itemThumbUrl}}/g,itemThumbUrl)}var itemPriceHtml="",priceRange="";if(data.title!="")if(data.product_type=="Gift Cards"?priceRange=this.formatMoney(data.price_min*100).replace(".00","")+" ~ "+this.formatMoney(data.price_max*100).replace(".00",""):priceRange=this.formatMoney(data.price_min*100).replace(".00",""),data.compare_at_price_min&&data.compare_at_price_min!=data.price_min){let compareAtPrice2=this.formatMoney(data.compare_at_price_min*100).replace(".00","");itemPriceHtml=''+priceRange+''+compareAtPrice2}else{let compareAtPrice2=0;itemPriceHtml=''+priceRange+''+compareAtPrice2}itemHtml=itemHtml.replace(/{{itemPrice}}/g,itemPriceHtml);var itemBadge="",isSalePromoItem=!1,isBMSMPromoItem=!1;if(data.tags.length&&($(data.tags).each(function(index2,element){if(element.indexOf("badge::")!==-1){var badgeValue=element.replace("badge::","").toLowerCase();return itemBadge='',!1}}),$(data.tags).each(function(index2,element){if(element.indexOf("deal-of-the-day::")!==-1){var badgeValue=element.replace("deal-of-the-day::","").toLowerCase();return itemBadge='',!1}}),$(data.tags).each(function(index2,element){element.indexOf(saleTag)!==-1&&(isSalePromoItem=!0,isPromoItem=!0)}),$(data.tags).each(function(index2,element){console.log(data.tags),element.indexOf(altSaleTag)!==-1&&(isBMSMPromoItem=!0)})),isSalePromoItem&&sale_active){let discounted_price=data.price_min*saleDiscountComplement,price_to_use=discounted_price%1!=0?discounted_price.toFixed(2):discounted_price;itemHtml=itemHtml.replace(/{{promoText}}/g,`${salePrefix} $${price_to_use} ${saleSuffix}`),itemHtml=itemHtml.replace(/{{promoText}}/g,"")}isBMSMPromoItem&&(itemHtml=itemHtml.replace(/{{promoText}}/g,altSaleText));let compareAtPrice=data.compare_at_price_max,newPrice=data.price_max,calculatedPercentage=Math.floor((1-newPrice/compareAtPrice)*100);calculatedPercentage>0?itemHtml=itemHtml.replace(/{{promoText}}/g,`${calculatedPercentage}% Off`):itemHtml=itemHtml.replace(/{{promoText}}/g,""),itemHtml=itemHtml.replace(/{{itemBadge}}/g,itemBadge);var soldOutClass=soldOut?bcSfFilterTemplate.soldOutClass:"";itemHtml=itemHtml.replace(/{{soldOutClass}}/g,soldOutClass);var saleClass=onSale?bcSfFilterTemplate.saleClass:"";itemHtml=itemHtml.replace(/{{saleClass}}/g,saleClass);var itemSoldOutLabelHtml=soldOut?bcSfFilterTemplate.soldOutLabelHtml:"";itemHtml=itemHtml.replace(/{{itemSoldOutLabel}}/g,itemSoldOutLabelHtml);var itemSaleLabelHtml=onSale?bcSfFilterTemplate.saleLabelHtml:"";itemHtml=itemHtml.replace(/{{itemSaleLabel}}/g,itemSaleLabelHtml);var itemVendorHtml=bcSfFilterConfig.custom.vendor_enable?bcSfFilterTemplate.vendorHtml.replace(/{{itemVendorLabel}}/g,data.vendor):"";itemHtml=itemHtml.replace(/{{itemVendor}}/g,itemVendorHtml),itemHtml=itemHtml.replace(/{{itemDomain}}/g,this.escape(bcSfFilterConfig.shop.domain));var itemDescription=data.description;return itemDescription==null&&(itemDescription=""),itemDescription=itemDescription.substr(0,itemDescription.indexOf("##highlights##")),itemHtml=itemHtml.replace(/{{itemDescription}}/g,itemDescription),itemHtml=itemHtml.replace(/{{itemTags}}/g,this.escape(data.tags.join(";"))),itemHtml=itemHtml.replace(/{{itemId}}/g,data.id),itemHtml=itemHtml.replace(/{{itemHandle}}/g,data.handle),itemHtml=itemHtml.replace(/{{fullTitle}}/g,data.title),itemHtml=itemHtml.replace(/{{itemTitle}}/g,data.title.split(" - ")[0]),itemHtml=itemHtml.replace(/{{itemUrl}}/g,"/products/"+data.handle),itemHtml=itemHtml.replace(/{{itemMaster}}/g,isMasterProduct),finalHtml+=itemHtml,finalHtml},BCSfFilter.prototype.buildProductListItem=function(data){},BCSfFilter.prototype.prepareProductData=function(data){for(var k in data){var optionsArr=[];for(var i in data[k].options_with_values)optionsArr.push(data[k].options_with_values[i].name);data[k].options=optionsArr;for(var i in data[k].variants){var variantOptionArr=[],count=1,variant=data[k].variants[i],variantOptions=variant.merged_options;if(Array.isArray(variantOptions)){for(var j=0;j1?bcSfFilterTemplate.previousActiveHtml:bcSfFilterTemplate.previousDisabledHtml;previousHtml2=previousHtml2.replace(/{{itemUrl}}/g,this.buildToolbarLink("page",currentPage,currentPage-1)),paginationHtml=paginationHtml.replace(/{{previous}}/g,previousHtml2);var nextHtml2=currentPagecurrentPage-3&&iBefore>0;iBefore--)beforeCurrentPageArr.unshift(iBefore);currentPage-4>0&&beforeCurrentPageArr.unshift("..."),currentPage-4>=0&&beforeCurrentPageArr.unshift(1),beforeCurrentPageArr.push(currentPage);for(var afterCurrentPageArr=[],iAfter=currentPage+1;iAfter'+sortingArr[k]+"");var html=bcSfFilterTemplate.sortingHtml.replace(/{{sortingItems}}/g,sortingItemsHtml);jQ(this.selector.topSorting).html(html),jQ(this.selector.topSorting+" select").val(this.queryParams.sort)}}},BCSfFilter.prototype.buildExtrasProductList=function(data,eventType){var filterInstance=this,colorFilter=new URLSearchParams(window.location.search).getAll("pf_t_color").pop();if(typeof Yotpo<"u"&&typeof yotpo<"u")try{var api=new Yotpo.API(yotpo);api.refreshWidgets()}catch(e){console.log("failed to load yotpo",e)}colorFilter===void 0&&(colorFilter="");var pageNum=this.queryParams.page;colorFilter=Shopify.handleize(colorFilter.toString()),colorFilterSingular=colorFilter.slice(0,-1);var isInternational=Summersalt.Global.is_international;data.forEach(function(product,ind){product.tags.length&&$(product.tags).each(function(index,element){if(element.indexOf("master-collection::")!==-1){var $productItem=$('.product-item[data-product-id="'+product.id+'"]'),itemSwatches='
        ',collectionHandle=Shopify.handleize(element.replace("master-collection::","")),jsonUrl="/collections/"+collectionHandle+"?view=ajax";if($productItem.attr("data-collection",collectionHandle),pageNum==1)$productItem.attr("id",ind);else{var numToInc=24*(pageNum-1),updatedIndex=ind+numToInc;$productItem.attr("id",updatedIndex)}$.ajax({type:"get",url:jsonUrl,dataType:"html",success:function(response){window.COLLECTIONS[collectionHandle]=JSON.parse(response);var products=window.COLLECTIONS[collectionHandle].products,hiddenSwatches=!1;products.length>6&&(hiddenSwatches=!0);var counter=0,minPrice=0,maxPrice=0,product_length=products.length-1,hideGlobalCount=0;$(products).each(function(index2,element2){var hiddenClass="",colorTag=element2.tags.filter(function(item){if(item.indexOf("color::")!==-1)return!0})[0];let hideOnFFSaleCount=0,hasFFSaleTag=!1,hasFFCookie=Cookies.get("friends-family-sale");element2.tags.filter(function(item){if(item.indexOf("ff-sale")!==-1)return hasFFSaleTag=!0,hideOnFFSaleCount++,!0})[0];var hideForFFSale=!hasFFCookie&&hasFFSaleTag,url=window.location.href,onFFCollectionPage=url.includes("/collections/friends-family-event");let hideOnGlobal=!1;var hideGlobalTag=element2.tags.filter(function(item){if(isInternational&&item.indexOf("hide-on-global")!==-1)return hideOnGlobal=!0,hideGlobalCount++,!0})[0],colorFilterTag=element2.tags.filter(function(item){if(item.indexOf("color-filter::")!==-1)return!0});onFFCollectionPage&&(minPrice===0&&(minPrice=element2.price_min),element2.price_minmaxPrice&&(maxPrice=element2.price_max)),!hideForFFSale&&!onFFCollectionPage&&(minPrice===0&&(minPrice=element2.price_min),element2.price_minmaxPrice&&(maxPrice=element2.price_max)),ariaColor=colorTag.replace("color::",""),colorTag=Shopify.handleize(colorTag.replace("color::","")),ada_colors[colorTag]!==void 0?ada_color_tag=ariaColor+" similar to "+ada_colors[colorTag]:ada_color_tag=ariaColor;var colorFilterTagsStr="";if($.each(colorFilterTag,function(ind2,el){colorFilterTagsStr+=Shopify.handleize(el),ind23&&hiddenSwatches&&(hiddenClass="hidden"),counter===4&&hiddenSwatches&&(itemSwatches+='
      • '),isSwatchPromoItem=!1,$(element2.tags).each(function(index3,element3){element3.indexOf(saleTag)!==-1&&(isSwatchPromoItem=!0)});var isSwatchBMSMPromoItem=!1;$(element2.tags).each(function(index3,element3){element3.indexOf(altSaleTag)!==-1&&(isSwatchBMSMPromoItem=!0)});let isDotdItem=!1,badgeValue="";if($(element2.tags).each(function(index3,element3){element3.indexOf("deal-of-the-day::")!==-1&&(isDotdItem=!0,badgeValue=element3.replace("deal-of-the-day::","").toLowerCase())}),!hideOnGlobal){var swatch_url=bcSfFilterConfig.general.asset_url.replace("bc-sf-filter.js",colorTag+".png");swatch_url=swatch_url.substr(0,swatch_url.indexOf("?")),swatch_url+="?v=2";var updated_swatch_url=swatch_url.replace("f-te","fete");itemSwatches+='
      • '}counter++}),hideGlobalCount==product_length&&isInternational&&$productItem.addClass("hide"),itemSwatches+="
      ",$productItem.find(".js-swatches").html(itemSwatches),$productItem.find(".js-swatches").find("li").each(function(i,e){var $colorCircle=$(e).find("a");$colorCircle.hasClass("js-active")&&i>=5&&($(this).parents("ul").slick({slidesToShow:9,arrows:!1,dots:!1,infinite:!1,slidesToScroll:3,fullWidth:!0,rows:0,responsive:[{breakpoint:1300,settings:{slidesToShow:5,arrows:!1,dots:!1,infinite:!1,slidesToScroll:3,fullWidth:!0}},{breakpoint:768,settings:{slidesToShow:5,variableWidth:!0,infinite:!1}}]}),$(window).width()>1300?$(this).parents("ul").find("li").length<=9&&$(this).parents("ul").slick("unslick"):$(window).width()<1300&&$(this).parents("ul").find("li").length<=5&&$(this).parents("ul").slick("unslick"),$(this).parents("ul").find("li").each(function(num,elem){$(elem).find("a").hasClass("js-show-swatches")&&$(elem).remove()}))});var $thisItem=$productItem.find('.js-swatches li a[data-product-handle="'+product.handle+'"]'),textMinPrice=minPrice/100,textMaxPrice=maxPrice/100;minPrice=filterInstance.formatMoney(minPrice).replace(".00",""),maxPrice=filterInstance.formatMoney(maxPrice).replace(".00","");var master_product=product.tags.filter(name=>name.includes("master::")),master_product_name=master_product[0].split("::");if(master_product_name[1]==product.handle)$productItem.find(".js-swatches li:first-child a").addClass("js-active");else{$productItem.find('.js-swatches li a[data-product-handle="'+product.handle+'"]').addClass("js-active");var $thisItem=$productItem.find('.js-swatches li a[data-product-handle="'+product.handle+'"]');$thisItem.removeClass("hidden"),$thisItem.parent().insertBefore($thisItem.parent().siblings(":eq(0)"));var $itemToHide=$thisItem.parent().siblings(":eq(4)").find("a");$itemToHide.hasClass("product-item__show-swatches")&&($itemToHide.parent().insertBefore($thisItem.parent().siblings(":eq(3)")),$thisItem.parent().siblings(":eq(4)").find("a").addClass("hidden"))}$productItem.hasClass("js-images-loaded")||$productItem.find(".js-swatches li:first-child a").hasClass("js-active")||($productItem.find(".js-swatches .js-active").hasClass("hidden")&&($productItem.find(".js-swatches .hidden").removeClass("hidden"),$productItem.find(".js-show-swatches").remove()),changeImages($productItem,window.COLLECTIONS[collectionHandle]),$productItem.addClass("js-images-loaded"),$productItem.find(".js-swatches .js-color-link.js-active").trigger("click"))}})}})})},BCSfFilter.prototype.buildAdditionalElements=function(data,eventType){var filterInstance=this;data.total_product==0?($(".no-search-result").removeClass("hide"),$(".has-search-results").addClass("hide")):($(".no-search-result").addClass("hide"),$(".has-search-results").removeClass("hide"));function activeSwatch(){if(eventType==="tag"&&window.location.search.indexOf("color-filter")!==-1){var urlParams=new URLSearchParams(window.location.search),colorFilter=urlParams.getAll("pf_t_color").pop().toString();colorFilter=Shopify.handleize(colorFilter),$(data.products).each(function(index,element){var $product=$('.product-item[data-product-id="'+element.id+'"]');$product.find('.js-color-link[data-color-filter*="'+colorFilter+'"]').length!==0&&$product.find('.js-color-link[data-color-filter*="'+colorFilter+'"]:first').trigger("click")})}}$(".bc-sf-filter-option-swatch-image").each(function(index,element){var $this=$(this),colorValue=Shopify.handleize($this.closest("a").data("title"));$this.addClass("color-"+colorValue)}),$(document).on("mouseenter touchstart",".product-item",function(){var $this=$(this);if(!$this.hasClass("js-images-loaded")){var collectionHandle=$this.attr("data-collection");collectionHandle&&changeImages($this,window.COLLECTIONS[collectionHandle]),$this.addClass("js-images-loaded")}}),$(document).on("click",".product-item",function(e){window.clickedID=$(this).attr("id")});function animate(winST=0){var winH=$(window).height();$(".product-item").each(function(){if(!$(this).hasClass("js-images-loaded")&&winST+winH*.95>$(this).offset().top){var collectionHandle=$(this).attr("data-collection");window.COLLECTIONS[collectionHandle]!==void 0&&($(this).addClass("js-images-loaded"),changeImages($(this),window.COLLECTIONS[collectionHandle]))}})}$(window).on("scroll",function(){var winST=$(window).scrollTop();animate(winST)}),$(document).on("mouseenter",".product-item__image",function(e){$(this).parents(".product-item").find(".product-item__title").find("a").css({color:"#475de6"}),$(this).parents(".product-item").find(".product-item__title").find("a").css({"text-decoration":"underline"})}),$(document).on("mouseleave",".product-item__image",function(e){$(this).parents(".product-item").find(".product-item__title").find("a").css({color:"#2c1504"}),$(this).parents(".product-item").find(".product-item__title").find("a").css({"text-decoration":"none"})}),$(document).on("click",".js-show-swatches",function(e){e.preventDefault();var $this=$(this);$(this).parents(".product-item__swatches").find("ul").slick({slidesToShow:9,arrows:!1,dots:!1,infinite:!1,slidesToScroll:3,fullWidth:!0,rows:0,responsive:[{breakpoint:1600,settings:{slidesToShow:8,arrows:!1,dots:!1,infinite:!1,slidesToScroll:3,fullWidth:!0}},{breakpoint:1500,settings:{slidesToShow:7,arrows:!1,dots:!1,infinite:!1,slidesToScroll:3,fullWidth:!0}},{breakpoint:1300,settings:{slidesToShow:5,arrows:!1,dots:!1,infinite:!1,slidesToScroll:3,fullWidth:!0}},{breakpoint:768,settings:{slidesToShow:5,variableWidth:!0,infinite:!1}}]}),$(window).width()>1300?$this.parents(".product-item__swatches").find("ul").find("li").length<=9&&$this.parents(".product-item__swatches").find("ul").slick("unslick"):$(window).width()<1300&&$this.parents(".product-item__swatches").find("ul").find("li").length<=5&&$this.parents(".product-item__swatches").find("ul").slick("unslick"),$this.closest(".product-item").find(".js-color-link").removeClass("hidden"),$this.closest("li").parents(".slick-slide").length>0&&$this.closest("li").parents(".slick-slide").remove(),$this.closest("li").remove()}),$(document).on("click",".js-color-link",function(e){e.preventDefault();var $this=$(this);if($this.closest(".js-images-loaded").length===0)return;var $product=$this.closest(".product-item"),productHandle=$this.attr("data-product-handle"),$firstSlideImage=$product.find('.js-product-item-gallery [data-product-handle="'+productHandle+'"]:not(.slick-cloned)').first(),firstSlideImageIndex=$firstSlideImage.attr("data-slick-index"),itemUrl="/products/"+productHandle;$product.find(".js-product-item-gallery").slick("slickGoTo",firstSlideImageIndex),$product.find(".product-item__title a").attr("href",itemUrl);let $text=$this.parents(".product-item__content").find(".is-promo-item"),price=$this.attr("data-price"),isPromoItem2=$this.attr("data-is-promo"),isBMSMPromoItem=$this.attr("data-is-bmsm-promo"),compareAtPrice=$this.attr("data-compare-price"),calculatedPercentage=Math.floor((1-price/compareAtPrice)*100);if(isPromoItem2=="true"){let discounted_price=price/100*saleDiscountComplement,price_to_use=discounted_price%1!=0?discounted_price.toFixed(2):discounted_price;$text.html(`${salePrefix} $${price_to_use} ${saleSuffix}`)}else isBMSMPromoItem=="true"&&$text.html(altSaleText),calculatedPercentage>0?$text.html(`${calculatedPercentage}% Off`):$text.html("");let $newPrice=$this.parents(".product-item__content").find(".price__amount-compare").find(".new-price"),$compareAtPrice=$this.parents(".product-item__content").find(".price__amount-compare").find(".compare-price"),comparePrice=$this.attr("data-compare-price");comparePrice!=0&&comparePrice!=price?($compareAtPrice.removeClass("hide"),$compareAtPrice.text("$"+comparePrice/100),$newPrice.text(BCSfFilter.prototype.formatMoney(price).replace(".00",""))):($newPrice.text(BCSfFilter.prototype.formatMoney(price).replace(".00","")),$compareAtPrice.addClass("hide")),$product.find(".js-color-link").removeClass("js-active"),$this.addClass("js-active");let isDotd=$this.attr("data-is-dotd"),isDotdValue=$this.attr("data-dotd-value");isDotd=="true"?($this.parents(".product-item").find(".product-item__badge").length>0?($this.parents(".product-item").find(".product-item__badge").removeClass(function(index,className){return(className.match(/(^|\s)badge-\S+/g)||[]).join(" ")}),$this.parents(".product-item").find(".product-item__badge").addClass(`badge-${isDotdValue}`)):$('').insertAfter($this.parents(".product-item").find(".product-item__image-main")),$this.parents(".product-item").find(".product-item__badge").css({display:"block"})):$this.parents(".product-item").find(".product-item__badge").css({display:"none"})}),$(".collection-sort__input").on("selectric-init",function(event,element,selectric){$(element).parents(".selectric-wrapper").find(".selectric-input").attr("id","sort-by-label")}),$(".collection-sort__input").selectric({disableOnMobile:!1,nativeOnMobile:!1,onChange:function(element){$(element).change(function(b){onChange(b,"sort",filterInstance.queryParams.sort,jQ(this).val());function onChange(a,b2,c,d){a.preventDefault(),filterInstance.internalClick=!0;var e=buildLink(b2,c,d);filterInstance.onChangeData(e,b2)}function buildLink(a,b2,c){var d=window.location.href,e=a+"="+b2,f=a+"="+c;d.indexOf("?"+a+"=")>-1?d=d.replace("?"+e,"?"+f):d.indexOf("&"+a+"=")>-1?d=d.replace("&"+e,"&"+f):window.location.search.length===0?d+="?"+f:d=d.replace("?","?"+f+"&"),a=="page"&&c==1&&(d=d.replace("?page=1&","?").replace("?page=1",""));var g=["display","sort","page","limit"];if(filterInstance.queryParams.hasOwnProperty("page")){var h="&page="+filterInstance.queryParams.page;d=d.replace(h,""),d=d.replace("?page="+filterInstance.queryParams.page+"&","?")}return d}}),$(element).change()}});var $selectedItem=jQ(".bc-sf-filter-selected-items .selected-item"),$list=jQ(".filter-nav ul"),newSelectedItems="";if($(".bc-sf-filter-block-content").hide(),$selectedItem.length?($(".collection__filter").removeClass("hide"),$(".collection-nav-category").css({"border-top":"unset"}),$selectedItem.each(function(){var $this=jQ(this),selectedVal=$this.find(".selected-type").text();let selectedClass="bc-sf-filter-option-block-"+selectedVal.split(":")[0].toLowerCase().replace(/ /g,"-");$("."+selectedClass).find(".bc-sf-filter-block-title").addClass("block-is-active"),$("#"+selectedClass).css({display:"block"}),newSelectedItems+='
    • "})):($(".collection__filter").addClass("hide"),$(".collection-nav-category").css({"border-top":"1px solid #ccc"})),$list.length&&($list.find("li:not(.visible-xs-block)").remove(),$selectedItem.length)){$list.append(newSelectedItems);var clearButton="";$(window).width()>750&&$(".bc-sf-filter-clear-all").length<=1&&(clearButton+='Clear Filters',$(clearButton).insertAfter(".filter-title"))}$(".bc-sf-filter-option-block").each(function(index,element){$(element).find(".bc-sf-filter-block-content").css("display")==="none"?$(element).find(".bc-sf-filter-block-title").removeClass("block-is-active"):$(element).find(".bc-sf-filter-block-title").addClass("block-is-active")});function openAccordions(element){element.siblings(".bc-sf-filter-block-content").slideToggle(),element.hasClass("block-is-active")?(element.removeClass("block-is-active"),element.attr("aria-expanded","false")):(element.addClass("block-is-active"),element.attr("aria-expanded","true"))}$(".bc-sf-filter-block-title").off("click").on("click",function(e){e.preventDefault(),openAccordions($(this))}),$(".bc-sf-filter-block-title").off("keypress").on("keypress",function(e){e.which===13&&openAccordions($(this))}),$(".bc-sf-filter-clear-all").on("click",function(e){e.preventDefault(),$(".bc-sf-filter-clear-all").addClass("hide"),$(".collection__sort").removeClass("hide")}),$(".bc-sf-filter-clear-all").length>1&&$(".bc-sf-filter-clear-all").each(function(index,element){$(element).text()=="Clear All"&&$(element).remove()}),$(".bc-sf-filter-option-item").on("click",function(){window.scrollTo(0,0)}),$(".js-clear-option").on("click",function(){window.scrollTo(0,0)}),$(".filter-btn").on("click",function(e){e.preventDefault(),$(".filter").hasClass("is-active")?($(".collection__sort").addClass("hide"),$(".bc-sf-filter-clear-all").removeClass("hide"),$(".bc-sf-filter-clear-all").each(function(){$(this).hasClass("js-close-filters")||$(this).insertAfter(".collection__filter-mobile")})):($(".collection__sort").removeClass("hide"),$(".bc-sf-filter-clear-all").addClass("hide"))}),$(window).on("load",function(){$(window).width()<750&&($("#bc-sf-filter-tree").insertBefore($(".filter-mobile").find(".collection-nav")),window.location.pathname.includes("/search")&&$(".header-top-banner").hasClass("two-line-header")&&($(".no-search-result").css({paddingTop:"20px"}),$(".has-search-results").css({paddingTop:"20px"}))),$(".bc-sf-filter-block-title").each(function(index,element){if($(element).find("h3").find("span").length>0){var catLabel=$(this).text();$(element).attr("aria-label",catLabel),$(element).attr("role","button")}$(element).hasClass("block-is-active")?$(this).attr("aria-expanded",!0):$(this).attr("aria-expanded",!1)})}),window.getSearchParams=window.location.search},BCSfFilter.prototype.buildPagination=function(totalProduct){var currentPage=parseInt(this.queryParams.page),totalPage=Math.ceil(totalProduct/this.queryParams.limit);if(this.getSettingValue("general.paginationType")=="default"){bcSfFilterSettings.general.limit=12;var paginationHtml=bcSfFilterTemplate.paginateHtml;currentPage-1==0?previousHtml='Next Page':(previousHtml='Next Page',previousHtml=previousHtml.replace(/{{itemUrl}}/g,this.buildToolbarLink("page",currentPage,currentPage-1))),paginationHtml=paginationHtml.replace(/{{previous}}/g,previousHtml),nextHtml='Next Page',nextHtml=nextHtml.replace(/{{itemUrl}}/g,this.buildToolbarLink("page",currentPage,currentPage+1)),paginationHtml=paginationHtml.replace(/{{next}}/g,nextHtml),paginationHtml=paginationHtml.replace(/{{pageItems}}/g,"Page "+currentPage+" of "+totalPage),jQ(this.selector.bottomPagination).html(paginationHtml)}}; //# sourceMappingURL=/cdn/shop/t/140/assets/bc-sf-filter.js.map