"use strict";function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);tt&&(t=e.offsetWidth),e.style.minWidth=t+"px"}},{key:"clickToScroll",value:function(e,t){var a=arguments.length<=2||arguments[2]===undefined||arguments[2],i='[swatch-slider="true"]';this.resSlider(e,i,t,a)}},{key:"resSlider",value:function(e,t,a,i){var n=t+" "+'[navigation="left"]',r=t+" "+'[navigation="right"]',s=JSON.parse(a.dataset.sliderData);(window.matchMedia?window.matchMedia("screen and (max-width: 768px)"):screen.width<=768).matches||"mode_0"!=s.arrowMode||(s.arrowMode="mode_1");var o=".swatch-navigable ul";a.querySelector(t+""+o).style.transition=i?"0.3s ease all":"none";var c=a.querySelector(t+""+o).style.transform.match(/-?[\d\.]+/g),l=-Math.abs(c[0]);if(0==e)"mode_0"!=s.arrowMode&&a.querySelector(r).classList.add("star-show"),a.querySelector(r).classList.remove("star-disabled"),"swatch-pill"==s.swatchType||"button"==s.assocViewType?(l+=.8*s.sliderWidth)>=-s.firstSwatchWidth/2&&(l=0,this.handleLeftEdge(a,n,s)):(l+=this.calculateSlideSwatchesCount(s)*(s.swatchSliderItemWidth+s.marginRight),"half"===s.lastSwatchPreview&&(l+=s.swatchSliderItemWidth-s.lastSwatchWidth),l>=-s.swatchSliderItemWidth/3&&(l=0,this.handleLeftEdge(a,n,s)));else if(1==e)if("mode_0"!=s.arrowMode&&a.querySelector(n).classList.add("star-show"),a.querySelector(n).classList.remove("star-disabled"),"swatch-pill"==s.swatchType||"button"==s.assocViewType){var u=l;l-=.8*s.sliderWidth,s.totalScrollWidth<=-(l-s.sliderWidth)&&(l=u+(-s.totalScrollWidth-(u-s.sliderWidth))-1,this.handleRightEdge(a,r,s))}else{u=l;l-=this.calculateSlideSwatchesCount(s)*(s.swatchSliderItemWidth+s.marginRight),"half"===s.lastSwatchPreview&&(l-=s.swatchSliderItemWidth-s.lastSwatchWidth),Number(s.totalScrollWidth.toFixed(3))<=Number((-(l-s.sliderWidth)).toFixed(3))&&(l=Number((u+(-s.totalScrollWidth-(u-s.sliderWidth))).toFixed(3)),this.handleRightEdge(a,r,s))}a.querySelector(t+""+o).style.transform="translateX("+l+"px)"}},{key:"calculateSlideSwatchesCount",value:function(e){var t=e.visibleSwatches>0?e.visibleSwatches:1;return"mode_1"==e.arrowMode&&(t=e.visibleSwatches>2?e.visibleSwatches-2:1),t}},{key:"handleLeftEdge",value:function(e,t,a){"mode_1"==a.arrowMode?setTimeout(function(){e.querySelector(t).classList.remove("star-show")},500):e.querySelector(t).classList.add("star-disabled")}},{key:"handleRightEdge",value:function(e,t,a){"mode_1"==a.arrowMode?setTimeout(function(){e.querySelector(t).classList.remove("star-show")},500):e.querySelector(t).classList.add("star-disabled")}},{key:"scrollSwatchSlider",value:function(e){var t=e.closest(".swatch-navigable"),a=e.getAttribute("data-navigation");if(t&&t.hasAttribute("data-current-scroll")){var i=Number(t.getAttribute("data-current-scroll")),n=t.querySelectorAll(".swatch-view-item"),r=i;if("right"===a)for(var s=i;sc.left){n[s].scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"}),r=s;break}}else"left"===a&&(r=Math.max(0,i-1));var l=r===n.length-1?"end":"start";return n[r].scrollIntoView({behavior:"smooth",block:"nearest",inline:l}),void t.setAttribute("data-current-scroll",r)}"left"==a?this.clickToScroll(0,t):this.clickToScroll(1,t)}},{key:"getCorrectSwatchRoot",value:function(){var e=this,t=null,a=null,i=!1,n="bottom";if(this.isInstanceTypeProduct()){if(t="products_groups_root",void 0===(a=this.pInformation[t])||!a.parentNode){var r=this.clientSpecs.getSelectors(),s=null;n=r.swatch_root.position;var o="div[data-vkcl-groups-priority]",c=document.querySelector(o),l=this.productInfoTree.getProductInfo().handle,u=null;c&&(u=c.dataset.vkclProductHandle),c&&u==l&&(this.groupsDisplaySelector=o),s=this.groupsDisplaySelector&&this.clientSpecs.getGroupsEnableStatusForProductType()?this.groupsDisplaySelector:r.swatch_root.selector,!(a=c&&u==l&&this.clientSpecs.getGroupsEnableStatusForProductType()?c:this.currentDocument.querySelector(s))&&this.currentDocument.matches&&this.currentDocument.matches(s)&&(a=this.currentDocument),i=!!a}}else this.isInstanceTypeCollection()&&(t="collections_groups_root",void 0!==(a=this.pInformation[t])&&a.parentNode||function(){var t=e.getInstanceConfig(),r="bottom";a=e.currentDocument,n=r;var s=t.swatch_display_options,o=R.swatch_location;if(s){var c=-1;-1!==(c=s.findIndex(function(e){return e.label===o}))?(n=s[c].position,a=e.currentDocument.querySelector(s[c].selector)):-1!==(c=s.findIndex(function(t){return!!e.currentDocument.querySelector(t.selector)}))&&(n=s[c].position,a=e.currentDocument.querySelector(s[c].selector))}a||(n=r,a=e.currentDocument),i=!0}());if(i){var d=document.createElement("variant-king-combined-listing");d.style.maxWidth="100%","before"==n?a.parentNode.insertBefore(d,a):"after"==n?a.parentNode.insertBefore(d,a.nextSibling):"top"==n?a.insertBefore(d,a.firstChild):a.appendChild(d),this.pInformation[t]=d,a=d}return a}},{key:"getLabelWidth",value:function(e,t){var a=e.closest(".swatch-drop-down-label");if(a){var i=a.querySelector(".swatch-label-inside");if(i){t=parseFloat(t.match(/[\d\.]+/g));var n=i.getBoundingClientRect().width;e.style.paddingLeft=t+n+"px"}}}},{key:"getPriceMaxWidth",value:function(e){var t=e.querySelectorAll(".swatch-button-price"),a=0;t.forEach(function(e){var t=e.offsetWidth;t>a&&(a=t)}),t.forEach(function(e){e.style.width=a+"px"})}},{key:"setProductGroupsObject",value:function(){return f||"undefined"==typeof window.starapps_vkcl_data?!f&&["lambda"].includes(this.clientSpecs.getDataUrlSource())&&(m=this.clientSpecs.getLambdaCloudFrontUrl(),f=[],v={}):(f=window.starapps_vkcl_data.product_groups,v=window.starapps_vkcl_data.product_groups_chart),null!=f&&f!=undefined}},{key:"getProductsGroups",value:function(e){for(var t=[],a=0;a=200&&t.status<400){var a=JSON.parse(t.responseText);this.setProductGroupsFromAPI(a,e),i&&i.call(this)}}.bind(a),t.send(null))}},{key:"getProductGroupIndexes",value:function(e){var t=v[e];return void 0!==t?t:m?null:[]}},{key:"getGroupSwatchImageURL",value:function(e,t){return"https://"+this.clientSpecs.getSwatchUrlHost()+"/apps/"+this.swatchDir+"/"+this.storeSlug+"/groups/"+e.split("group")[1]+"/"+t+".media"}},{key:"generateProductGroups",value:function(){var e=this;if("collections"===this.instanceType?this.clientSpecs.getEnableStatusForProductGridType():"products"===this.instanceType&&this.clientSpecs.getGroupsEnableStatusForProductType())if(this.setProductGroupsObject()){var t=this.getMultiLingualInfo().translation_status;if(t&&!this.productInfoTree.getUntranslatedProductHandle())return setTimeout(this.generateProductGroups.bind(this),100),void z("Untranslated handle is not found ... calling generateProductGroups method again!");var a=t?this.productInfoTree.getUntranslatedProductHandle():this.productInfoTree.getProductInfo().handle,i=this.getProductGroupIndexes(a),n=null;if(m&&null==i)this.getProductGroupsByAPI(a,this.generateProductGroups.bind(this));else if(!((n=this.getProductsGroups(i)).length<=0)){var r=this.getCorrectSwatchRoot();this.uiElements.getIsSwatchRootDisplayed()||this.uiElements.renderSwatchRoot(this.uiElements.getSwatchRoot([]),r);var s=r.querySelector(".swatches.swatches-type-"+this.instanceType),o=0,c=[];Object.entries(n).forEach(function(t){var n=_slicedToArray(t,2),r=n[0],l=n[1],u="group"+l.id;if("length"!=r){for(var d=0;d0?function(){for(var t=V,i=Math.ceil(g.length/t),n=0,r=function(t,i){++n===i&&e.generateProductGroupsUI(v,o,s,u,l,a,h)},c=0;c',c){var U="",B="";this.isInstanceTypeProduct()?(V=Object.keys(p).length,O=!V,H=_extends({},p),Object.entries(H).forEach(function(e){var t=_slicedToArray(e,2),a=(t[0],t[1]);a[1]=s.getTranslation(a[1])}),U=s.uiElements.renderGroupCategory(H,u,n.show_all_category,n.all_category_label),B=V&&"label"===u.view_type_preset.categoryPreset.assoc_view_type?Object.entries(p).reduce(function(e,t){var a=_slicedToArray(t,2),n=a[0],r=_slicedToArray(a[1],2),o=r[0],c=r[1],l=_extends({},u);return l.data=l.data.filter(function(e){return e.category_id===o||null==e.category_id&&e.default_group_category_id===o}),l.data.length?(_defineProperty({},n,[o,c]),s.getTranslation(c),e+'
"+s.uiElements.getViewByType(u.view_type_preset).getView(i,l,O)+"
"):e},""):s.uiElements.getViewByType(u.view_type_preset).getView(i,u,O)):B=this.uiElements.getViewByType(u.view_type_preset).getView(i,u,!0),j+=U+B}else j+='';j+="",a.insertBefore(this.uiElements.parseHTML(j)[0],a.children[t]);var G=a.querySelector('[option-target="'+i+'"]'),W=u.view_type_preset;if([W&&W.params&&W.params.button_style,W&&W.params&&W.params.swatch_style].includes("minified")){var z=G.querySelector("ul"),K=z.querySelectorAll(".swatch-view-item"),J=z.querySelector(".minification-btn"),$=J.querySelector(".minification-text"),X=$.textContent,Z=/{{\s*count\s*}}/i.test(X);Z&&($.textContent=X.replace(/{{\s*count\s*}}/gi,String(K.length)));var Y=J.getBoundingClientRect().width;Z&&($.textContent=X);var Q=z.closest(".swatch-navigable").getBoundingClientRect().width,ee=0,te=Y,ae=!0,ie=!1,ne=undefined;try{for(var re,se=K[Symbol.iterator]();!(ae=(re=se.next()).done);ae=!0){var oe=re.value,ce=window.getComputedStyle(oe),le=parseFloat(ce.marginLeft),ue=parseFloat(ce.marginRight) ;if((te+=oe.getBoundingClientRect().width+le+ue)>Q)break;ee++}}catch(be){ie=!0,ne=be}finally{try{!ae&&se["return"]&&se["return"]()}finally{if(ie)throw ne}}var de=Math.min(ee,W.params.swatch_minification_count);z.setAttribute("data-total-visible-swatches",de),z.setAttribute("data-product-handle",this.productInfoTree.productInfo.handle),z.setAttribute("data-minification-action",W.params.minification_action),K.length<=W.params.swatch_minification_count?(z.setAttribute("data-minified","false"),this.removeElement(z.querySelector(".minification-btn"))):z.querySelector(".minification-text").innerText=z.querySelector(".minification-text").innerText.toLowerCase().replace("{{count}}",K.length-de)}var pe,he,ge,fe=G.querySelector("ul"),ve=fe?fe.getAttribute("data-total-visible-swatches"):0,me=fe?fe.getAttribute("data-minified"):"false";if("true"==me&&("swatch"==W.assoc_view_type||"button"==W.assoc_view_type)){var _e=fe.querySelectorAll(".swatch-view-item");Object.entries(_e).forEach(function(e){var t=_slicedToArray(e,2),a=t[0],i=t[1];"length"!=a&&a>=Number(ve)&&"true"==me&&i.classList.add("star-hide")})}if("smart_hide"==this.clientSpecs.hideSingleValueOption(this.instanceType)&&(pe=!1,he=null,ge=a.querySelectorAll("ul.swatch-view-image, ul.swatch-view-custom-image"),Object.entries(ge).forEach(function(e){var t=_slicedToArray(e,2),a=t[0],i=t[1];if("length"!=a){var n=1==i.children.length?i.closest("div[option-target]"):null;n?(n.classList.add("option-single-value"),null==he&&(he=n)):pe=!0,!pe&&he&&a==ge.length-1&&he.classList.remove("option-single-value")}})),c){if("drop_down"==u.view_type_preset.assoc_view_type&&"label_inside"==u.view_type_preset.params.dropdown_type){var ye=a.querySelectorAll("div.swatch-drop-down-inner [type='select']");Object.entries(ye).forEach(function(e){var t=_slicedToArray(e,2),a=t[0],i=t[1];"length"!=a&&s.getLabelWidth(i,u.view_type_preset.params.padding_left)})}if("button"==u.view_type_preset.assoc_view_type&&u.view_type_preset.params.full_width){var we=a.querySelectorAll(".enable-price-alignment");Object.entries(we).forEach(function(e){var t=_slicedToArray(e,2),a=t[0],i=t[1];"length"!=a&&s.getPriceMaxWidth(i)})}this.generateProductGroupsUIHelper(u.view_type_preset,i,a,d,u,p),this.isInstanceTypeCollection()&&R.switch_on_hover&&this.addFeaturedImageDirectlyIntoDOMElementForGroups(a,u)}}},{key:"createFeaturedImageContainer",value:function(e){var t=e.querySelector(".vkcl-product-images-data");if(t)return t;var a=document.createElement("div");return a.className="vkcl-product-images-data",a.style.display="none",e.insertBefore(a,e.firstChild),a}},{key:"addFeaturedImageDirectlyIntoDOMElementForGroups",value:function(e,t){for(var a=this.createFeaturedImageContainer(e),i=0;i'+this.labelSplitSymbol+" "+_)}if(Object.keys(r).length>0&&"label"===n.view_type_preset.categoryPreset.assoc_view_type)Object.entries(r).forEach(function(e){var i=_slicedToArray(e,2),r=(i[0],_slicedToArray(i[1],1)[0]),o=a.querySelector('[option-target="'+t+'"] .category-'+r),c=o?o.querySelector(".swatch-group-selector"):null;if(c){var l=c.closest(".swatch-view-stack, variant-king-combined-listing"),u=c.closest(".swatch-navigable, variant-king-combined-listing");if(u&&"VARIANT-KING-COMBINED-LISTING"!=u.tagName)s.attachSwatchSlider(c,u,n.view_type_preset);else if(l&&"VARIANT-KING-COMBINED-LISTING"!=l.tagName){var d=c.closest(".swatch-view-stack");s.resStackSize(d,n.view_type_preset.params,n.view_type_preset.assoc_view_type)}}});else{var w=o.closest(".swatch-navigable, variant-king-combined-listing"),b=o.closest(".swatch-view-stack, variant-king-combined-listing");if(w&&"VARIANT-KING-COMBINED-LISTING"!=w.tagName)this.attachSwatchSlider(o,w,e);else if(b&&"VARIANT-KING-COMBINED-LISTING"!=b.tagName){var S=o.closest(".swatch-view-stack");this.resStackSize(S,e.params,e.assoc_view_type)}}}}},{key:"attachSwatchSlider",value:function(e,t,a){if(a){var i=e.closest("ul.swatch-view"),n=e.closest("li.swatch-view-item"),r='[data-navigation="left"]',s=!!i&&n.offsetLeft>i.clientWidth;if(s&&(r='[data-navigation="right"]'),t){t.querySelector(".swatch-navigation"+r);var o=e.closest(".swatch-navigable");this.resSliderSize(o,a)}s&&(i.style.scrollBehavior="auto",i.scrollLeft=n.offsetLeft-n.offsetWidth,i.style.scrollBehavior="")}}},{key:"getTranslatedData",value:function(e,t,a){var i='"gid://shopify/Product/'+e.id+'"';if(t&&t[i]){var n=t[i];switch(a){case"title":return n.title;case"handle":return n.handle;case"minPrice":return parseFloat(n.priceRange.minVariantPrice.amount);case"maxPrice":return parseFloat(n.priceRange.maxVariantPrice.amount);case"available":return n.availableForSale;case"featured_img":return n.featuredImage?n.featuredImage.url:this.clientSpecs.getDefaultSwatchImage();case"secondary_img":return n.images.nodes.length>1?n.images.nodes[1].url:this.clientSpecs.getDefaultSwatchImage();case"last_img":var r=n.images.nodes.length;return r?n.images.nodes[r-1].url:this.clientSpecs.getDefaultSwatchImage()}}return e[a]}},{key:"getInstanceConfig",value:function(){return this.clientSpecs.getCollectionConfig()}},{key:"getInstanceSettings",value:function(){return this.clientSpecs.getCollectionSettings()}},{key:"removeElement",value:function(e){e.parentNode.removeChild(e)}},{key:"generateImageURL",value:function(e,t){var a=/\.(?:jpg|png|jpeg|gif|tiff|bmp)(?:\?|\s|$)/gm,i=/(?:_\d*x\d*|_medium|_large|_small)(?:_crop_[a-zA-Z]{3,6}){0,1}(?=\.(?:jpg|png|jpeg|gif|tiff|bmp))/gm.exec(e),n=a.exec(t);return i&&n&&(t=t.replace(n[0],i[0]+n[0])),t}},{key:"updateVariantImage",value:function(e,t,a){var i=!1,n=!1,r=a?"featured_image_src":"secondary_image_src";if(a&&t.featured_image?i=!0:!a&&t.featured_image&&t.featured_image.secondary_src&&(i=!0),e&&"PICTURE"==e.tagName){for(var s=e.querySelectorAll("source"),o=0;o1)c=l[parseInt((l.length-1)/2)].trim().split(" ")[0];else if(1==l.length){c=l[0].trim().split(" ")[0]}}this.pInformation[r]||(this.pInformation[r]=c);var u=null;u=a?this.generateImageURL(c,t.featured_image.src):this.generateImageURL(c,t.featured_image.secondary_src),e.setAttribute("src",u),e.setAttribute("srcset",u),e.setAttribute("data-srcset",u),n=!0}else{var d=/url\((\S*)\)/gm;(c=e.style.backgroundImage)||(c=e.style.background);var p=d.exec(c);if(p){c=(c=p[1]).trim(),this.pInformation[r]||(this.pInformation[r]=c);u=null;u=a?this.generateImageURL(c,t.featured_image.src):this.generateImageURL(c,t.featured_image.secondary_src),e.setAttribute("data-bgset",u),e.style.backgroundImage?e.style.backgroundImage="url("+u+")":e.style.background="url("+u+")",n=!0}}else if(e)if("IMG"==e.tagName&&this.pInformation[r]){u=this.pInformation[r];e.setAttribute("src",u),e.setAttribute("srcset",u),e.setAttribute("data-srcset",u),n=!0}else if(this.pInformation[r]){u=this.pInformation[r];e.setAttribute("data-bgset",u),e.style.backgroundImage?e.style.backgroundImage="url("+u+")":e.style.background="url("+u+")",n=!0}e&&n&&e.className.includes("lazyload")&&(e.classList.remove("lazyload"),e.classList.remove("lazyloading"),e.classList.remove("lazyloaded"),e.classList.add("lazyload"))}},{key:"formatDefaultOption",value:function(e,t){return void 0===e?t:e}},{key:"formatWithDelimiters",value:function(e,t,a,i,n){a=this.formatDefaultOption(a,2),i=this.formatDefaultOption(i,","),n=this.formatDefaultOption(n,".");var r=(t=this.formatDefaultOption(t,!!this.getInstanceSettings().price_trailing_zeroes))?n+"00":"";if(isNaN(e)||null==e)return 0;var s=(e=(e*("storefront"===b?1:.01)).toFixed(a)).split(".");return s[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+i)+(s[1]&&"00"!=s[1]?n+s[1]:r)}},{key:"insertHTMLAt",value:function(e,t,a){if("replace"!=a){var i=this.uiElements.parseHTML(e)[0];"before"==a?t.parentNode.insertBefore(i,t):"after"==a?t.parentNode.insertBefore(i,t.nextSibling):"top"==a?t.insertBefore(i,t.firstChild):t.appendChild(i)}else t.innerHTML=e}},{key:"updateGridElements",value:function(e){var t=this.getInstanceConfig().grid_updates,a=this.getGridUpdateParams(e);a.is_on_sale?this.currentDocument.classList.add("swatch-variant-onsale"):this.currentDocument.classList.remove("swatch-variant-onsale"),"undefined"!=typeof a.available&&a.available?this.currentDocument.classList.remove("swatch-variant-soldout"):this.currentDocument.classList.add("swatch-variant-soldout");for(var i=0;i=1&&(h.featured_image.src=e.images.nodes[0].url,h.featured_image.secondary_src=e.images.nodes[0].url),e.images.nodes&&e.images.nodes.length>=2&&(h.featured_image.secondary_src=e.images.nodes[1].url)):(h={id:e.id,handle:e.handle,title:e.title,url:e.url,price:r.price,compare_at_price:r.compare_at_price,variant_id:r.id,sku:r.sku,available:c,inventory_policy:r.inventory_policy,inventory_quantity:r.inventory_quantity,featured_image:{src:null,secondary_src:null}},e.featured_image?(h.featured_image.src=e.featured_image,h.featured_image.secondary_src=e.featured_image):e.images&&e.images.length>=1&&(h.featured_image.src=e.images[0],h.featured_image.secondary_src=e.images[0]),e.images&&e.images.length>=2&&(h.featured_image.secondary_src=e.images[1])),""!=u.title&&(p=this.currentDocument.querySelectorAll(u.title),Object.entries(p).forEach(function(e){var t=_slicedToArray(e,2),a=t[0],i=t[1];"length"!=a&&(i.innerHTML=h.title)})),this.updateGridElements(h),this.updateGridAttributes(h),this.updateVariantImages(h,u),""!=u.url&&(p=this.currentDocument.querySelectorAll(u.url),Object.entries(p).forEach(function(e){var t=_slicedToArray(e,2),a=t[0],i=t[1];"length"!=a&&(i.hasAttribute("href")&&i.setAttribute("href",h.url),i.hasAttribute("data-href")&&i.setAttribute("data-href",h.url))})),this.updateAttributes({handle:h.handle,url:h.url,product_id:h.id,variant_id:h.variant_id},u),u.form_input&&""!=u.form_input&&(d=this.currentDocument.querySelector(u.form_input))){if("SELECT"==d.tagName&&(d.value=h.variant_id,d.value!=h.variant_id)){var g=document.createElement("option");g.value=h.variant_id,g.text=h.title,d.add(g)}d.value=h.variant_id,this.dispatchEvent("change",d)}}},{key:"getSwatchMinifiedCount",value:function(e){var t=this.clientSpecs.getSwatchPresentation("collections");if("general"==e&&t.minified||"groups"==e&&t.minified_products){var a=t.minified_display_count,i=Math.ceil(1920/a.length),n=Math.floor(window.screen.width/i);return n>=a.length&&(n=a.length-1),a[n]}return null}},{key:"updateVariantImages",value:function(e){var t=arguments.length<=1||arguments[1]===undefined?null:arguments[1],a=t||this.getInstanceConfig().data_selectors,i=null;""!=a.featured_image&&(i=this.currentDocument.querySelector(a.featured_image),this.updateVariantImage(i,e,!0)),""!=a.featured_image&&""!=a.secondary_image&&(i=this.currentDocument.querySelector(a.secondary_image),this.updateVariantImage(i,e,!1))}},{key:"updateAttributes",value:function(e,t){var a=this;t.attributes.length>0&&function(){var i=a.pInformation.attrs_to_update_selectors;if(void 0===i){i="[data-product-id]";for(var n=0;nr;return a.is_on_sale=o,o&&(n=r/s*100,n=Math.round(100-n),a.percentage_difference=n),a}},{key:"updateGridAttributes",value:function(e){var t=this,a=this.getInstanceConfig().attribute_updates,i=this.getGridUpdateParams(e),n=!!window.$&&!!window.$.fn&&!!window.$.fn.data;a&&a.forEach(function(e){var a=e.selector,r=e.attribute,s=e.template;if(""!=a||""!=r){var o="["+r+"]",c=a?t.currentDocument.querySelectorAll(""+a+o):t.currentDocument.querySelectorAll(o);if(c&&c.length>0)Array.from(c).forEach(function(e){var a=t.getModifiedTemplate(s,i);e.setAttribute(r,a),n&&window.$(e).data(r.replace("data-",""),a)})}})}},{key:"generateUIForCollection",value:function(e){var t=this;if(this.clientSpecs.getEnableStatusForProductGridType()){var a=undefined;if(e){if("A"!=(a=e.target).tagName&&(e.preventDefault(),e.stopPropagation()),"LI"==a.tagName&&a.hasAttribute("orig-value")&&a.children&&(a=a.children[0]),"keyup"==e.type&&13!==e.keyCode)return;for(;a.hasAttribute("swatch-inside")||"FONT"==a.tagName||"SVG"==a.tagName||"I"==a.tagName;)a=a.parentNode;if(this.isClickEvent(e.type)&&a.hasAttribute("data-navigation"))return void this.scrollSwatchSlider(a,!1);if(this.isClickEvent(e.type)&&a.hasAttribute("minification-btn")){var i=a.closest("ul"),n=i.getAttribute("data-minification-action");if("enable_slider"==n){i.setAttribute("data-minified","false");var r=i.getAttribute("data-preset-id");i.querySelectorAll("li").forEach(function(e){e.classList.remove("star-hide"),e.style.width="auto"});var s=window.vkcl_data().presets[r];this.resSliderSize(i.closest(".swatch-navigable"),s),a.classList.add("star-hide")}else if("redirect_to_product_page"==n){var o=i.getAttribute("data-product-handle");window.open("/products/"+o,"_blank")}return}var c="mouseover"==e.type,l="mouseout"==e.type,u=c||l;if(!a.hasAttribute("swatch-option")||l){var d=null;if(this.pInformation.image_replaced_by_hover){if((v=a.getAttribute("swatch-url"))&&a.classList.contains("swatch-selected"))(k=this.getFeaturedProductImageFromDOM(a,v,"featured"))&&(d={featured_image:{src:k,secondary_src:k}}),(A=this.getFeaturedProductImageFromDOM(a,v,"secondary"))&&(d.featured_image.secondary_src=A);else if(v){var p=a.closest("ul.swatch-view");if(p){var h=p.querySelector("li.swatch-view-item .swatch-selected");if(h){var g=h.getAttribute("swatch-url");if(g)(k=this.getFeaturedProductImageFromDOM(a,g,"featured"))&&(d={featured_image:{src:k,secondary_src:k}}),(A=this.getFeaturedProductImageFromDOM(a,g,"secondary"))&&(d.featured_image.secondary_src=A)}}}this.updateVariantImages(d||{}),this.pInformation.image_replaced_by_hover=!1}return}if("SELECT"==a.tagName&&"change"!=e.type)return;if(c&&u){var f=null,v=a.getAttribute("swatch-url");if(a.getAttribute("swatch-option"),a.getAttribute("orig-value"),v){var m=a.closest("[data-group-index]").getAttribute("data-group-index"),_=this.getProductsGroups([m])[0],y=v.split("/products/");y=y[y.length-1];for(var S=0;S<_.option_values.length;S++){if(y==_.option_values[S].handle){var k,A;(k=this.getFeaturedProductImageFromDOM(a,v,"featured"))&&(f={featured_image:{src:k,secondary_src:k}}),(A=this.getFeaturedProductImageFromDOM(a,v,"secondary"))&&(f.featured_image.secondary_src=A);break}}}if(!f)return;return this.updateVariantImages(f),void(this.pInformation.image_replaced_by_hover=!0)}if(u)return}if(e&&a.hasAttribute("swatch-url")){var I=function(){if(a.hasAttribute("current-product"))return{v:undefined};if("SELECT"!=a.tagName){var e=a.getAttribute("swatch-option"),i=a.getAttribute("orig-value"),n=a.closest("[option-target]").querySelector("span.swatch-variant-name");n&&"none"!=i&&(n.innerHTML=' '+t.labelSplitSymbol+" "+i),t.uiElements.selectSwatch(e,a,i)}t.resetMultiLingualData();var r=a.closest("[option-target]"),s=t.productInfoTree.getProductInfo().id,o="SELECT"==a.tagName?a.value:a.getAttribute("swatch-url");if(t.selectionAllowed=!1,t.hasOnlyDefaultVariant=!1,t.pInformation.product_switched=!0,t.productInfoTree=new B,"storefront"==b){var c=o.split("/products/")[1],l=window.Shopify.locale;t.executeFetch({handle:c,locale:l,path_name:null,allow_processing:!0,callback:function(e){t.productChangeOperations(e,r,s)},translation_request:!1})}else t.executeFetch({url:o+".js",path_name:null,allow_processing:!0,callback:function(e){t.productChangeOperations(e,r,s)},translation_request:!1});if(a.closest("div.swatch-drop-down-inner")){var u=a.closest("div.swatch-drop-down-inner").querySelector('div[type="select"]');u.setAttribute("aria-expanded",!1),a.parentNode.classList.add("swatch-hide"),u.innerHTML=a.innerHTML,u.setAttribute("aria-label",a.getAttribute("data-original-value"))}return{v:undefined}}();if("object"==typeof I)return I.v}if(!(e&&"SELECT"==a.tagName&&a.options&&a.options.length>1&&this.isClickEvent(e.type))){if(e&&"select"==a.getAttribute("type")){var T=a,L=a.parentNode.querySelector("ul.swatch-drop-down-list"),x="true"==T.getAttribute("aria-expanded");return T.setAttribute("aria-expanded",!x),void L.classList.toggle("swatch-hide")}if(e&&"select_value"==a.getAttribute("type"))(T=a.closest("div.swatch-drop-down-inner").querySelector('div[type="select"]')).style.minWidth&&"0px"!=T.style.minWidth||this.setSelectMinWidth(T),T.innerHTML=a.innerHTML,T.setAttribute("aria-label",a.getAttribute("data-original-value")),T.setAttribute("aria-expanded",!1),a.parentNode.classList.add("swatch-hide");if(this.readyToInit()){this.uiElements.getIsSwatchRootDisplayed()||this.uiElements.renderSwatchRoot(this.uiElements.getSwatchRoot(this.productInfoTree.getOptions()),this.getCorrectSwatchRoot());undefined;w?w.trim():this.multiLingualInfo.money_format.trim()}else this.hasOnlyDefaultVariant||setTimeout(this.generateUIForCollection.bind(this,e),100)}}}},{key:"getFeaturedProductImageFromDOM",value:function(e,t){var a=arguments.length<=2||arguments[2]===undefined?"featured":arguments[2],i=e.closest("[sa-groups-generated]").querySelector(".vkcl-product-images-data");if(!i)return null;var n=i.querySelector('[data-product-handle="'+t+'"]');return n?n.getAttribute("data-"+a+"-image"):null}},{key:"getFirstAvailableVariant",value:function(e){undefined;return"storefront"==b?"undefined"!=typeof e.availableForSale&&e.availableForSale?e.variants.nodes.find(function(e){return!0===e.availableForSale}):e.variants.nodes[0]:"undefined"!=typeof e.available&&e.available?e.variants.find(function(e){return!0===e.available}):e.variants[0]}},{key:"resetMultiLingualData",value:function(){this.multiLingualInfo=null,this.untranslatedData=null,this.untranslatedFetchStatus="none"}},{key:"getMultiLingualInfo",value:function(){if(null==this.multiLingualInfo){var e=g;e&&""!=e&&(e=e.replace(/\/$/,"")),this.multiLingualInfo={default_language:this.clientSpecs.getDefaultLanguage(),money_format:w},this.multiLingualInfo.current_url=e,window.Shopify&&window.Shopify.locale&&(this.multiLingualInfo.current_language=window.Shopify.locale);window.location.pathname.split("/")[1];this.multiLingualInfo.translation_status=this.multiLingualInfo.current_language!=this.multiLingualInfo.default_language,z(["Found language information in DOM",this.multiLingualInfo])}return this.multiLingualInfo}},{key:"fetchUntranslatedOptions",value:function(e){var t=this;if(this.getMultiLingualInfo().translation_status&&e){this.untranslatedFetchStatus="pending";var a=o(this.multiLingualInfo.default_language),i=window.Shopify.country,n=this.getDataFromSessionStorage(this.getSessionStorageKey(e,!1,!0,!0));if(n)return null!==n.id&&(this.untranslatedData={handle:n.handle,options:n.options,variants:n.variants.nodes}),void(this.untranslatedFetchStatus="completed");var r="\n query productDetails @inContext(country: "+i.toUpperCase()+", language: "+a+') {\n product(id: "gid://shopify/Product/'+e+'") {\n id\n handle\n title\n vendor\n availableForSale\n onlineStoreUrl\n tags\n publishedAt\n priceRange{\n maxVariantPrice{\n amount\n }\n minVariantPrice{\n amount\n }\n }\n featuredImage{\n id\n url\n }\n options{\n id\n name\n values\n optionValues{\n id\n name\n }\n }\n images(first: 250){\n nodes{\n id\n url\n altText\n }\n }\n variants(first:250){\n nodes{\n id\n availableForSale\n quantityAvailable\n compareAtPrice{\n currencyCode\n amount\n }\n selectedOptions{\n name\n value\n }\n currentlyNotInStock\n featured_image: image{\n id\n src: url\n altText\n }\n price{\n currencyCode\n amount\n\n }\n title\n sku\n compareAtPrice {\n amount\n }\n }\n }\n compareAtPriceRange {\n maxVariantPrice {\n amount\n }\n minVariantPrice {\n amount\n }\n }\n }\n }\n ';this.executeStorefrontFetch({query:r,callback:function(a,i){var n=a.product,r=i.context,s=r.country,o=r.language;t.setDataToSessionStorage(t.getSessionStorageKey(e,!1,!0,!0,s,o),n),t.setDataToSessionStorage(t.getSessionStorageKey(n.handle,!1,!0,!0,s,o),n),t.untranslatedData={handle:n.handle,options:n.options,variants:n.variants.nodes},t.untranslatedFetchStatus="completed"}})}}},{key:"getUntranslatedFetchStatus",value:function(){return this.untranslatedFetchStatus}},{key:"getUntranslatedData",value:function(){return this.untranslatedData}},{key:"getTranslation",value:function(e){var t=this.getMultiLingualInfo();if(t.translation_status){var a=this.clientSpecs.getLocalizedStrings()[e];if(a&&(a=a[t.current_language])&&a.trim().length>0)return a}return e}},{key:"getHandleFromURL",value:function(e){var t=e.split("/");return(t=(t=t[t.length-1]).split(RegExp("\\?|\\#|\\.js","gi")))[0]}},{key:"getSessionStorageKey",value:function(e,t,a){var i=!(arguments.length<=3||arguments[3]===undefined)&&arguments[3],n=arguments.length<=4||arguments[4]===undefined?null:arguments[4],r=arguments.length<=5||arguments[5]===undefined?null:arguments[5];if(window.sessionStorage){var s=t?this.getHandleFromURL(e):e,c=this.getMultiLingualInfo(),l=n;l||(l=window.Shopify&&window.Shopify.country?window.Shopify.country:"NULL");var u=r;return u||(u=(u=o(a?c.default_language:c.current_language)).toUpperCase()),"storefront"==b?"starapps_storefront_"+s+"_"+u+"_"+l:i?"starapps_storefront_"+s+"_"+u+"_"+l:"starapps_"+s+"_"+u+"_"+l}return null}},{key:"getDataFromSessionStorage",value:function(e){if(window.sessionStorage&&"string"==typeof e){var t=sessionStorage.getItem(e);if(t)return JSON.parse(t)}return null}},{key:"setDataToSessionStorage",value:function(e,t){var a=!(arguments.length<=2||arguments[2]===undefined)&&arguments[2];if(window.sessionStorage&&"string"==typeof e&&"object"==typeof t){var i=function(){var i=(new Date).getTime();null!=t?t.created_at=a?undefined:i:t={id:null,created_at:i};var n=JSON.stringify(t);return setTimeout(function(){try{sessionStorage.setItem(e,n)}catch(t){}},0),{v:!0}}();if("object"==typeof i)return i.v}return!1}},{key:"removeDataToSessionStorage",value:function(e){return!(!window.sessionStorage||"string"!=typeof e)&&(sessionStorage.removeItem(e),!0)}},{key:"storeCategorySelection",value:function(e,t){if(t&&e){var a=this.getSessionStorageKey("selected_group_category_"+e,!1,!1);a&&this.setDataToSessionStorage(a,{categoryId:t},!0)}}},{key:"removeCategorySelection", value:function(e){var t=this.getSessionStorageKey("selected_group_category_"+e,!1,!1);t&&this.removeDataToSessionStorage(t)}},{key:"getSelectedCategory",value:function(e){var t=this.getSessionStorageKey("selected_group_category_"+e,!1,!1);return t?this.getDataFromSessionStorage(t):null}},{key:"generateUISwitch",value:function(){return this.isInstanceTypeCollection()?this.generateUIForCollection.bind(this):this.generateUI.bind(this)}},{key:"generateUI",value:function(e){var t=this,a=undefined,i=undefined,n=undefined,r=undefined,s=undefined,o=undefined;undefined;w?w.trim():this.multiLingualInfo.money_format.trim();var c=["Enter","Space"],l=e&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(e.code),u=e&&c.includes(e.code),d=e&&"Escape"===e.code,p=e&&"Tab"===e.code,h=e&&e.key&&1===e.key.length&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&"Space"!==e.code;if(!e||p||"keydown"!==e.type){if(d){var g=document.querySelector("ul.swatch-drop-down-list:not(.swatch-hide)");if(g)return(N=g.parentNode.querySelector('[role="combobox"]')).setAttribute("aria-expanded","false"),N.setAttribute("aria-activedescendant",""),g.classList.add("swatch-hide"),g.querySelectorAll(".swatch-keyboard-focus").forEach(function(e){e.classList.remove("swatch-keyboard-focus")}),N.focus(),void e.preventDefault()}if(p){var f=e.target.closest(".swatch-drop-down-inner");if(N=f?f.querySelector('[role="combobox"]'):null){var v=N.parentNode.querySelector("ul.swatch-drop-down-list");if(v&&!v.classList.contains("swatch-hide")){var m=v.querySelector(".swatch-keyboard-focus");if(m)(m.querySelector("[swatch-option]")||m).click();N.setAttribute("aria-expanded","false"),N.setAttribute("aria-activedescendant",""),v.classList.add("swatch-hide"),v.querySelectorAll(".swatch-keyboard-focus").forEach(function(e){e.classList.remove("swatch-keyboard-focus")})}}}if(h&&"keyup"===e.type)if(N=e.target.closest('[role="combobox"]')){var _=function(){var t=N.parentNode.querySelector("ul.swatch-drop-down-list");t.classList.contains("swatch-hide")&&(t.classList.remove("swatch-hide"),N.setAttribute("aria-expanded","true"));var a=Array.from(t.querySelectorAll('li[role="option"]')),i=e.key.toLowerCase(),n=a.find(function(e){return(e.getAttribute("aria-label")||e.textContent).toLowerCase().startsWith(i)});if(n){a.forEach(function(e){return e.classList.remove("swatch-keyboard-focus")}),n.classList.add("swatch-keyboard-focus");var r=N.getAttribute("swatch-option")+"-option-"+a.indexOf(n);n.id=r,N.setAttribute("aria-activedescendant",r),n.scrollIntoView({block:"nearest"})}else{if(!t.querySelector(".swatch-keyboard-focus")){var s=t.querySelector(".swatch-selected")||a[0];if(s){s.classList.add("swatch-keyboard-focus");r=N.getAttribute("swatch-option")+"-option-"+a.indexOf(s);s.id=r,N.setAttribute("aria-activedescendant",r),s.scrollIntoView({block:"nearest"})}}}return{v:undefined}}();if("object"==typeof _)return _.v}if(e){var y,b,S,k,A,I=function(){if(o=e.target,(l||u)&&e.preventDefault(),l){var c=function(){var t=o.closest('[role="combobox"]');if(t){var a=t.parentNode.querySelector("ul.swatch-drop-down-list"),i=a.classList.contains("swatch-hide"),n=Array.from(a.querySelectorAll('li[role="option"]'));if(i){a.classList.remove("swatch-hide"),t.setAttribute("aria-expanded","true");var r=a.querySelector(".swatch-selected")||n[0];if(r){r.classList.add("swatch-keyboard-focus");var s=t.getAttribute("swatch-option")+"-option-"+n.indexOf(r);r.id=s,t.setAttribute("aria-activedescendant",s),r.scrollIntoView({block:"nearest"})}return{v:{v:undefined}}}var c=a.querySelector(".swatch-keyboard-focus");c||(c=a.querySelector(".swatch-selected"));var l=c?n.indexOf(c):-1,u=undefined;u="ArrowDown"===e.code||"ArrowRight"===e.code?l0?l-1:n.length-1,n.forEach(function(e){return e.classList.remove("swatch-keyboard-focus")});var d=n[u];d.classList.add("swatch-keyboard-focus");var p=t.getAttribute("swatch-option")+"-option-"+u;return d.id=p,t.setAttribute("aria-activedescendant",p),d.scrollIntoView({block:"nearest"}),{v:{v:undefined}}}if(!o||"LI"!==o.tagName)return{v:{v:undefined}};var h=o.closest('[role="radiogroup"], ul');if(!h)return{v:{v:undefined}};var g=Array.from(h.querySelectorAll("li")),f=g.indexOf(o);if(-1===f)return{v:{v:undefined}};var v=f;switch(e.code){case"ArrowRight":case"ArrowDown":v=(f+1)%g.length;break;case"ArrowLeft":case"ArrowUp":v=(f-1+g.length)%g.length}var m=g[v];o=m,g.forEach(function(e){e.setAttribute("tabindex",e===m?"0":"-1"),e.setAttribute("aria-checked",e===m?"true":"false")}),m.focus()}();if("object"==typeof c)return c.v}if(u){var d=o.closest('[role="combobox"]');if(d){var h=d.parentNode.querySelector("ul.swatch-drop-down-list");if(h&&!h.classList.contains("swatch-hide")){var g=h.querySelector(".swatch-keyboard-focus");if(g||(g=h.querySelector(".swatch-selected")),g){h.querySelectorAll(".swatch-keyboard-focus").forEach(function(e){e.classList.remove("swatch-keyboard-focus")});var f=g.querySelector("[swatch-option]")||g;o=f}}}}"LI"==o.tagName&&o.hasAttribute("orig-value")&&o.children&&(o=o.children[0]);var v=o.closest(".swatch-category-item");if(v&&(o===v||v.contains(o))){var m=function(){var e=v.closest(".swatch-category-container").parentElement;if(!e)return{v:{v:undefined}};v.parentElement.querySelectorAll(".swatch-category-item").forEach(function(e){var t=e===v;e.setAttribute("aria-expanded",t),e.querySelector(".category-name").classList.toggle("swatch-selected",t)});var c=v.getAttribute("aria-controls"),l="category-all"===c,u=null;if(e.hasAttribute("type-group")&&"true"==e.getAttribute("type-group")&&(u=e.getAttribute("option-target").split("group")[1]),u)if(l)t.removeCategorySelection(u);else{var d=c.split("-")[1];t.storeCategorySelection(u,d)}var p=["ul.swatch-view:not(.swatch-category-view)","ul.swatch-drop-down-list"];y=!0,b=!1,S=undefined;try{var h=function(){var t=A.value,a=e.querySelector(t);if(!a)return"continue";var i={length:-1,element:null},n=null;if(a.querySelectorAll("li").forEach(function(e){var a=l||e.classList.contains(c);if(e.hidden=!a,t.includes("drop-down")&&a){var r=e.getAttribute("orig-label-value")||"";"true"===e.getAttribute("aria-selected")&&(n={length:r.length,element:e}),r.length>i.length&&(i={length:r.length,element:e})}}),t.includes("drop-down")&&i.element){var r=a.closest("fieldset").querySelector('div[custom-select="true"]');if(r){r.setAttribute("aria-label",i.element.getAttribute("orig-label-value"));var s=null;(s=null!=n?n.element.querySelector("span.d-flex").cloneNode(!0):i.element.querySelector("span.d-flex").cloneNode(!0))&&r.querySelector("span.d-flex").replaceChildren(s)}}return"break"};e:for(k=p[Symbol.iterator]();!(y=(A=k.next()).done);y=!0){switch(h()){case"continue":continue;case"break":break e}}}catch(m){b=!0,S=m}finally{try{!y&&k["return"]&&k["return"]()}finally{if(b)throw S}}if(a=o.closest('[type-group="true"]')){i=a.querySelector(".swatch-group-selector[current-product]");var g=a.querySelector("[swatch-type='product']");if(g){var f=g.className.match(/swatch-preset-\d+/);f&&f[0]&&(s=f[0].split("-")[2])}r=t.clientSpecs.presets[s]}(n=i?i.closest(".swatch-navigable, variant-king-combined-listing"):undefined)&&"VARIANT-KING-COMBINED-LISTING"!=n.tagName&&t.attachSwatchSlider(i,n,r)}();if("object"==typeof m)return m.v}if("keyup"==e.type&&13!==e.keyCode&&!l&&!u&&!p)return{v:undefined};for(;o.hasAttribute("swatch-inside")||"FONT"==o.tagName||"SVG"==o.tagName||"I"==o.tagName;)o=o.parentNode;return o.classList.contains("swatch-image-wrapper")&&(o=o.querySelector("[swatch-option]")),t.isClickEvent(e.type)&&o.hasAttribute("data-navigation")?(t.scrollSwatchSlider(o,!1),{v:undefined}):o.hasAttribute("swatch-option")?"SELECT"==o.tagName&&"change"!=e.type?{v:undefined}:void 0:{v:undefined}}();if("object"==typeof I)return I.v}if(e&&o.hasAttribute("swatch-url")&&this.isEventTrusted(e,!0)&&window.encodeURIComponent&&((this.isClickEvent(e.type)||l||u||p)&&"SELECT"!=o.tagName||"change"==e.type&&"SELECT"==o.tagName)){if(o.hasAttribute("current-product"))return;var T="",L=o.getAttribute("swatch-url");"SELECT"==o.tagName&&(L=o.value);var x=L+T;this.clientSpecs.getHistoryFreeGroupNavigation()?window.location.replace(x):window.location.assign?window.location.assign(x):window.location.href=x}else if(!e||"select"!=o.getAttribute("type")||p){if(e&&"select_value"==o.getAttribute("type"))(E=o.closest("div.swatch-drop-down-inner").querySelector('div[type="select"]')).style.minWidth&&"0px"!=E.style.minWidth||this.setSelectMinWidth(E),E.innerHTML=o.innerHTML,E.setAttribute("aria-label",o.innerText),E.setAttribute("aria-expanded",!1),E.setAttribute("aria-activedescendant",""),o.parentNode.querySelectorAll(".swatch-keyboard-focus").forEach(function(e){e.classList.remove("swatch-keyboard-focus")}),o.parentNode.classList.add("swatch-hide");if(!(e&&this.uiElements.isDropDown(o.tagName)&&o.options&&o.options.length>1&&this.isClickEvent(e.type))&&this.readyToInit())this.getCorrectSwatchRoot()}else{var E=o,C=o.parentNode.querySelector("ul.swatch-drop-down-list"),D="true"==E.getAttribute("aria-expanded");if(E.setAttribute("aria-expanded",!D),C.classList.toggle("swatch-hide"),D)E.setAttribute("aria-activedescendant",""),C.querySelectorAll(".swatch-keyboard-focus").forEach(function(e){e.classList.remove("swatch-keyboard-focus")});else{C.querySelectorAll(".swatch-keyboard-focus").forEach(function(e){e.classList.remove("swatch-keyboard-focus")});var q=Array.from(C.querySelectorAll('li[role="option"]')),M=C.querySelector(".swatch-selected")||q[0];if(M){"keyup"===e.type&&["Enter","Space"].includes(e.code)&&M.classList.add("swatch-keyboard-focus");var P=E.getAttribute("swatch-option")+"-option-"+q.indexOf(M);M.id=P,E.setAttribute("aria-activedescendant",P),M.scrollIntoView({block:"nearest"})}}}}else{var N;(l||u)&&(N=e.target.closest('[role="combobox"]'))&&e.preventDefault()}}},{key:"resSliderSize",value:function(e,t){var a=this,i=window.matchMedia?window.matchMedia("screen and (max-width: 768px)"):screen.width<=768;i.matches||"mode_0"!=t.params.arrow_mode||(t.params.arrow_mode="mode_1");var n=t.params,r=t.assoc_view_type,s=e.closest(".swatch-navigable-wrapper"),o="li.swatch-view-item:not([hidden])",c=e.querySelector("ul.swatch-view"),l=c.getAttribute("data-minified"),u=c.querySelectorAll(o).length,d=e.querySelector('[navigation="left"]'),p=e.querySelector('[navigation="right"]'),h=e.getBoundingClientRect().width,g=s?s.getBoundingClientRect().width:null,f=undefined,v=undefined,m=(undefined,undefined),_=undefined,y=undefined,w=undefined,b=undefined,S=undefined,k=undefined,A=n.arrow_mode,I=undefined,T=n.adjust_margin_right,L=parseFloat(n.margin_right.match(/[\d\.]+/g)),x=L;"swatch-pill"==n.swatch_type||"button"==r?(y=0,c.querySelectorAll(o).forEach(function(e,t){e.style.width=e.getBoundingClientRect().width+"px",y=y+e.getBoundingClientRect().width+x,e.firstChild instanceof Element&&null!==e.querySelector(".swatch-selected")&&(S=(y-e.getBoundingClientRect().width)/(.8*h),k=t,"mode_4"==A&&(s.querySelector(".swatch-navigable").setAttribute("data-current-scroll",t),e.scrollIntoView({behavior:"auto",block:"nearest",inline:"start"}))),0==t&&(w=e.getBoundingClientRect().width),t==u-1&&(b=e.getBoundingClientRect().width,y-=x)})):function(){f=parseFloat(n.width.match(/[\d\.]+/g)),v=parseFloat(n.border_width.match(/[\d\.]+/g));var e=n.border_space||n.margin_swatch_horizontal;parseFloat(e.match(/[\d\.]+/g)),m=f+2*v;var t=n.last_swatch_preview,a=(h+x)/(m+x);"mode_1"==A&&(a=(g+x)/(m+x));var i=0;if(a>=u&&!T)i=parseInt(a);else{switch(t){case"full":if(a=(h+x)/(m+x),i=parseInt(a),I=h-i*m,(x=Math.max(I/(i>1?i-1:1),L))>I/(i>1?i-1:1)){var r=h-(i-1)*x;i=Math.floor(r/m)}break;case"half":var s=(h-(Math.floor(a)*m+Math.floor(a)*x))/m*100,l=undefined;if((s<20||s>80)&&a>1)if(s<20){l=80,i=Math.floor(a)-1;var d=l/100*m;x=parseFloat(((h-(i*m+d))/i).toFixed(3))}else{d=(l=80)/100*m;var p=Math.floor(a)+d/m;i=Math.floor(p),x=parseFloat(((h-(i*m+d))/i).toFixed(3))}else i=Math.floor(a)}var w=c.querySelector(o+":last-child");w&&(w.style.width=m+"px")}_=i,y=(m+x)*(u-1)+m,c.querySelectorAll(o).forEach(function(e,a){e.firstChild instanceof Element&&null!==e.querySelector(".swatch-selected")&&(S=_>0?(m+x)*a/(_*(m+x)):0,"half"==t?"mode_1"==A&&(S=_>2?(m+x)*a/((_-2)*(m+x)):a-_>=0?a-_+1:0):S=_>2?(m+x)*a/((_-2)*(m+x)):0,k=a),a!=u-1&&(e.style.width=m+"px",e.style.marginRight=x+"px")})}(),c.parentElement.setAttribute("swatch-slider","true");var E={swatchSliderItemWidth:m||0,totalScrollWidth:y,sliderWidth:h,visibleSwatches:_||0,marginRight:x,swatchType:n.swatch_type,firstSwatchWidth:w,lastSwatchWidth:b,assocViewType:r,arrowMode:A};c.style.transform="translateX(0px)",c.style.display="flex";var C=c.closest("[option-name]");if("mode_2"!=A&&"mode_3"!=A&&"mode_4"!=A||(h=g),_>=u||h>=y||"true"===l){if(d.classList.remove("star-show"),p.classList.remove("star-show"),"mode_2"==A||"mode_3"==A)e.classList.add("star-remove-margin"),E.sliderWidth=e.getBoundingClientRect().width;else if("mode_4"==A)return e.closest(".swatch-navigable").style.margin="0px",void(e.closest(".swatch-navigable").style.width="100%");return c.parentElement.setAttribute("data-slider-data",JSON.stringify(E)),!1}if(p.classList.add("star-show"),p.classList.remove("star-disabled"),c.style.setProperty("justify-content","unset"),c.style.setProperty("width",y+"px","important"),"mode_2"==A||"mode_3"==A)d.classList.add("star-show","star-disabled"),e.classList.remove("star-remove-margin"),E.sliderWidth=e.getBoundingClientRect().width;else if("mode_0"==A)d.classList.remove("star-show"),p.classList.remove("star-show");else if("mode_4"==A){e.style.margin="auto",p.classList.add("star-show"),d.classList.add("star-show"),p.classList.remove("star-disabled"),d.classList.remove("star-disabled");var D=d.getBoundingClientRect().width+p.getBoundingClientRect().width;return void(e.closest(".swatch-navigable").style.width="calc(100% - "+D+"px)")}return S=parseInt(S),setTimeout(function(){for(var t=0;t=t.touches[0].clientX?a.clickToScroll(1,e.closest(".swatch-navigable")):a.clickToScroll(0,e.closest(".swatch-navigable")))}),c.addEventListener("touchend",function(){r=0})))},200),c.parentElement.setAttribute("data-slider-data",JSON.stringify(E)),!0}},{key:"resStackSize",value:function(e,t,a){var i,n,r,s,o,c,l,u;if("swatch-pill"!=t.swatch_type&&"button"!=a&&t.adjust_margin_right&&t.adjust_margin_right){var d=e.querySelector("ul.swatch-view");d&&(i="li.swatch-view-item",d.querySelectorAll(i).length,n=e.getBoundingClientRect().width,undefined,r=parseFloat(t.width.match(/[\d\.]+/g)),s=parseFloat(t.border_width.match(/[\d\.]+/g)),o=t.border_space||t.margin_swatch_horizontal,c=parseFloat(o.match(/[\d\.]+/g)),l=parseFloat(t.margin_right.match(/[\d\.]+/g)),u=parseInt((n+l)/(r+2*s+2*c+l)),d.querySelectorAll(i).forEach(function(e,t){(t+1)%u==0&&(e.style.marginRight=0)}))}}},{key:"getOptionValueId",value:function(e,t){var a=e.find(function(e){return e.name===t});return a?a.id.split("ProductOptionValue/")[1]:null}},{key:"morphValues",value:function(e){return this.clientSpecs.getHandleize()?e=(e=(e=(e=(e=e.toLowerCase()).replace(RegExp("['\"\\(\\)\\{\\}\\[\\]]","gi"),"")).replace(RegExp("[^a-z0-9_]+","gi"),"-")).replace(RegExp("-+","gi"),"-")).replace(RegExp("^-|-$","gi"),""):e}},{key:"updateSessionStorageProductData",value:function(e){var t=arguments.length<=1||arguments[1]===undefined?null:arguments[1],a=arguments.length<=2||arguments[2]===undefined?null:arguments[2];if("storefront"==b){var i=e.id.match(/\d+/)[0];this.setDataToSessionStorage(this.getSessionStorageKey(e.handle,!1,!1,!1,t,a),e),this.setDataToSessionStorage(this.getSessionStorageKey(i,!1,!1,!1,t,a),e)}else this.setDataToSessionStorage(this.getSessionStorageKey(e.handle,!1,!1),e)}},{key:"processJSONInformation",value:function(e){var t=this,a=arguments.length<=1||arguments[1]===undefined?null:arguments[1],i=e.options,n=e.images,r="storefront"==b?e.id.split("Product/")[1]:e.id;"storefront"==b?n=e.images?e.images.nodes.map(function(e){return e.url}):null:e.options_with_values&&(i=e.options_with_values);var s=this.getMultiLingualInfo().translation_status?this.getUntranslatedData():null,o=s?s.handle:null;if(this.productInfoTree.setProductInfo({id:r,handle:e.handle,untranslated_handle:o,vendor:e.vendor,published_at:e.publishedAt}),null!=n&&i!=undefined){if(this.getMultiLingualInfo().translation_status&&null==this.getUntranslatedData())return"none"==this.getUntranslatedFetchStatus()&&this.fetchUntranslatedOptions(r),void setTimeout(function(){t.processJSONInformation(e,a)},200);var c={},l=(a&&a.country,a&&a.language,null);"storefront"==b?!(l=e.featuredImage?e.featuredImage.url:null)&&e.images.nodes&&e.images.nodes.length>0&&(l=e.images.nodes[0].url):(!(l=e.featured_image)&&e.images&&e.images.length>0&&(l=e.images[0]),l&&"object"==typeof l&&(l=l.src)),this.uiElements.setDefaultFeaturedImage(l),this.productInfoTree.setValues(c),z(["Processed JS data structure",this.productInfoTree])}else if(e.handle&&""!=e.handle){var u=window.Shopify.locale;"storefront"==b?this.executeFetch({handle:e.handle,locale:u,path_name:null,allow_processing:!1,callback:function(e,a){t.processJSONInformation(e,a)},translation_request:!1}):this.executeFetch({url:this.getMultiLingualInfo().current_url+"/collections/all/products/"+e.handle+".js",path_name:null,allow_processing:!1,callback:function(e){t.processJSONInformation(e)},translation_request:!1})}}},{key:"hideFormElements",value:function(e,t){t&&this.currentDocument.querySelectorAll(e).forEach(function(e){e.parentNode.style.display="none"});this.uiElements.hideElementStyles(e)}},{key:"retryFetchInformationFromJs",value:function(e){var t=this;setTimeout(function(){t.fetchInformationFromJs()},e)}},{key:"fetchInformationFromJs",value:function(){var e=this;if(this.isInstanceTypeCollection()){var t=this.getProductHandleFromScope();t&&(this.processJSONInformation({id:"0",title:"",handle:decodeURI(t)}),this.currentDocument.setAttribute("sa-groups-generated",t))}else{var a=window.decodeURI(window.location.pathname.replace(/\/$/,"")),i=a.includes("/products"),n=null;if("sectioned"==this.instanceSubType&&!this.isSectionPrimary?(n=this.getProductHandleFromScope(),this.currentDocument.setAttribute("sa-groups-generated",n)):this.isSectionPrimary&&this.currentDocument.setAttribute("sa-groups-generated",a),"quick_view"!=this.instanceSubType){if(i&&!n)if("storefront"==b){if("pending"==window.starAppsVKCLStorefrontDataRequest)return void this.retryFetchInformationFromJs(100);if("undefined"!=typeof window.starAppsVKCLStorefrontData&&window.starAppsVKCLStorefrontDataURL==a)return void setTimeout(function(){window.starAppsVKCLStorefrontDataRequest="complete",e.processJSONInformation(window.starAppsVKCLStorefrontData)},100);window.starAppsVKCLStorefrontDataRequest="pending"}else{if("pending"==window.starAppsVKCLJSDataRequest)return void this.retryFetchInformationFromJs(100);if("undefined"!=typeof window.starAppsVKCLJSData&&window.starAppsVKCLJSData==a)return void setTimeout(function(){window.starAppsVKCLJSDataRequest="complete",e.processJSONInformation(window.starAppsVKCLJSData)},100);window.starAppsVKCLJSDataRequest="pending"}if(i||n)if("storefront"==b){n||(n=a.split("/products/")[1]);var r=window.Shopify.locale;this.executeFetch({handle:n,locale:r,path_name:i&&!n?a:null,allow_processing:!0,translation_request:!1,callback:null})}else{var s=undefined;s=n?this.getMultiLingualInfo().current_url+"/products/"+n+".js":a+".js",z("JS data fetch request initiated for URL: "+s),this.executeFetch({url:s,path_name:i&&!n?a:null,allow_processing:!0,callback:null,translation_request:!1})}else this.productUndefined=!0}}}},{key:"executeFetch",value:function(e,t){var a,i=this,n=e.path_name,r=e.allow_processing,s=e.callback,c=e.translation_request;if("storefront"==b){var u=e.handle,d=o(e.locale),p=window.Shopify.country,h=g+"api/"+l+"/graphql.json",f="\n query productDetails @inContext(country: "+p.toUpperCase()+", language: "+d+') {\n product(handle:"'+u+'") {\n id\n handle\n title\n vendor\n availableForSale\n onlineStoreUrl\n tags\n publishedAt\n priceRange{\n maxVariantPrice{\n amount\n }\n minVariantPrice{\n amount\n }\n }\n featuredImage{\n id\n url\n }\n options{\n id\n name\n values\n optionValues{\n id\n name\n }\n }\n images(first: 250){\n nodes{\n id\n url\n altText\n }\n }\n variants(first:250){\n nodes{\n id\n availableForSale\n quantityAvailable\n compareAtPrice{\n currencyCode\n amount\n }\n selectedOptions{\n name\n value\n }\n currentlyNotInStock\n featured_image: image{\n id\n src: url\n altText\n }\n price{\n currencyCode\n amount\n }\n title\n sku\n compareAtPrice {\n amount\n }\n }\n }\n compareAtPriceRange {\n maxVariantPrice {\n amount\n }\n minVariantPrice {\n amount\n }\n }\n }\n }\n ',v={method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":this.clientSpecs.storefront_access_token},body:JSON.stringify({query:f})};if((m=this.getDataFromSessionStorage(this.getSessionStorageKey(u,!1,c)))&&!t)return void(null!==m.id&&(n&&(window.starAppsVKCLStorefrontDataRequest="complete",window.starAppsVKCLStorefrontDataURL=n,window.starAppsVKCLStorefrontData=m),r&&(this.processJSONInformation(m),z("JS data fetch request finished")),s&&s.call(this,m)));window.fetch?fetch(h,v).then(function(e){return e.json()}).then(function(e){var t=e.data.product,a=e.extensions.context;n&&(window.starAppsVKCLStorefrontDataRequest="complete",window.starAppsVKCLStorefrontDataURL=n,window.starAppsVKCLStorefrontData=t),r&&(i.processJSONInformation(t,a),z("Storefront data fetch request finished")),s&&s.call(i,t,a)}):((a=new XMLHttpRequest).open("POST",h,!0),a.setRequestHeader("Content-Type","application/json"),a.setRequestHeader("X-Shopify-Storefront-Access-Token",i.storefront_access_token),a.onload=function(){if(a.status>=200&&a.status<400){var e=JSON.parse(a.responseText),t=e.data.product,i=e.extensions.context;n&&(window.starAppsVKCLStorefrontDataRequest="complete",window.starAppsVKCLStorefrontDataURL=n,window.starAppsVKCLStorefrontData=t),r&&(this.processJSONInformation(t,i),z("Storefront data fetch request finished")),s&&s.call(this,t,i)}}.bind(i),a.send(JSON.stringify({query:f})))}else{var m,_=e.url;if((m=this.getDataFromSessionStorage(this.getSessionStorageKey(_,!0,c)))&&!t)return void(null!==m.id&&(n&&(window.starAppsVKCLJSDataRequest="complete",window.starAppsVKCLJSDataURL=n,window.starAppsVKCLJSData=m),r&&(this.processJSONInformation(m),z("JS data fetch request finished")),s&&s.call(this,m)));window.fetch?fetch(_).then(function(e){return e.json()}).then(function(e){n&&(window.starAppsVKCLJSDataRequest="complete",window.starAppsVKCLJSDataURL=n,window.starAppsVKCLJSData=e),r&&(i.processJSONInformation(e),z("JS data fetch request finished")),s&&s.call(i,e)}):function(){var e=new XMLHttpRequest;e.open("GET",_,!0),e.onload=function(){if(e.status>=200&&e.status<400){var t=JSON.parse(e.responseText);n&&(window.starAppsVKCLJSDataRequest="complete",window.starAppsVKCLJSDataURL=n,window.starAppsVKCLJSData=t),r&&(this.processJSONInformation(t),z("JS data fetch request finished")),s&&s.call(this,t)}}.bind(i),e.send()}()}}},{key:"executeStorefrontFetch",value:function(e){var t,a=this,i=e.callback,n=g+"api/"+l+"/graphql.json",r=e.query,s={method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":this.clientSpecs.storefront_access_token},body:JSON.stringify({query:r})};window.fetch?fetch(n,s).then(function(e){return e.json()}).then(function(e){i&&i.call(a,e.data,e.extensions)}):((t=new XMLHttpRequest).open("POST",n,!0),t.setRequestHeader("Content-Type","application/json"),t.setRequestHeader("X-Shopify-Storefront-Access-Token",a.storefront_access_token),t.onload=function(){if(t.status>=200&&t.status<400){var e=JSON.parse(t.responseText);i&&i.call(this,e.data,e.extensions)}}.bind(a),t.send(JSON.stringify({query:r})))}},{key:"initialize",value:function(){var e=this;if(z("Hey! I have started working with setting - "+this.themeCode),!this.eventsRegistered){var t=function(){var t=["click","change","virtual_click","keyup","keydown"];e.isInstanceTypeCollection()&&R.switch_on_hover&&(t.push("mouseover"),t.push("mouseout"));var a=e.getCorrectSwatchRoot();if(!a)return setTimeout(e.initialize.bind(e),250),{v:undefined};Object.entries(t).forEach(function(t){var i=_slicedToArray(t,2),n=i[0],r=i[1];"length"!=n&&(a?a.addEventListener(r,e.generateUISwitch()):e.groupsDisplaySelector=null)}),window.addEventListener("resize",function(){if(this.isInstanceTypeCollection()){var e=this.currentDocument.querySelector("div.swatches-type-collections");if(e){var t=e.parentNode.parentNode;e.style.width=t.offsetWidth+"px"}}}.bind(e)),e.eventsRegistered=!0,e.generateProductGroups()}();if("object"==typeof t)return t.v}!p&&this.isInstanceTypeCollection()&&(this.hideFormElements(this.getInstanceConfig().selectors_to_hide,!1),p=!0),d||(window.document.addEventListener("click",function(e){for(var t=e.target;t.hasAttribute("swatch-inside");)t=t.parentNode;for(var a=document.querySelectorAll("ul.swatch-drop-down-list:not(.swatch-hide)"),i=0;i0;e.detectAndInitialize(i),J(a)}else e.productUndefined&&(z("Product not found!"),J(a))}catch(n){z(["Loading Failed... Retrying.",n]),$()&&t>=3?J(a):$()&&"SelectorNotFoundException"==n&&t++}},250)}}]),e}(),B=function(){function e(){_classCallCheck(this,e),this.tree=null,this.options=null,this.productInfo=null,this.priceInfoTree=null}return _createClass(e,[{key:"getTree",value:function(){return this.tree}},{key:"getOptions",value:function(){return this.options||[]}},{key:"getProductInfo",value:function(){return this.productInfo}},{key:"getUntranslatedProductHandle",value:function(){return this.productInfo.untranslated_handle}},{key:"setProductInfo",value:function(e){this.productInfo=e}},{key:"getPriceInfoTree",value:function(){return this.priceInfoTree}},{key:"setValues",value:function(e,t,a,i){this.tree=e,this.options=t,this.priceInfoTree=i}}]),e}(),G=function(){function e(){_classCallCheck(this,e),this.app_setting=_.app_setting,this.app_setting_styles=_.app_setting_styles,this.app_setting_config=_.app_setting_config,this.theme_setting=y,this.presets=_.presets,this.presetsMap={},this.default_language=_.primary_locale,this.default_currency=_.currency,this.lambda_cloudfront_url=_.lambda_cloudfront_url,this.data_url_source=_.data_url_source,this.localized_strings=_.localized_string,this.storefront_access_token=_.storefront_key}return _createClass(e,[{key:"getGroupsEnableStatusForProductType",value:function(){return S||A||T||x||C||q||P}},{key:"getVariantsEnableStatusForProductType",value:function(){return(S||A||T||x||C||q||P)&&this.app_setting_config.product_template.variant_swatches}},{key:"getEnableStatusForProductGridType",value:function(){return k||I||L||E||D||M||N}},{key:"getSwatchPresentation",value:function(e){return this.app_setting_styles[e+"_swatch_presentation"]}},{key:"getViewStyle",value:function(e){return this.app_setting_styles[e]}},{key:"getViewDefault",value:function(e){var t=this,a="products"==e,i=a?this.presets[this.app_setting.default_preset]:undefined;return void 0===i&&a?Object.entries(this.presets).forEach(function(a){var n=_slicedToArray(a,2),r=n[0],s=n[1];"button"==s.assoc_view_type&&s.apply_to==e&&(t.app_setting.default_preset=r,i=s)}):"collections"==e&&(i=this.getHiddenPreset()),i}},{key:"getSelectors",value:function(){return this.theme_setting.configurations.products}},{key:"getProductSettings",value:function(){return this.theme_setting.settings.products}},{key:"getHandleize",value:function(){return this.theme_setting.settings.products.handleize}},{key:"getThemeType",value:function(){return this.theme_setting.configurations.products.theme_type}},{key:"getStyles",value:function(){return this.app_setting_styles}},{key:"getHiddenPreset",value:function(){return{assoc_view_type:"hidden"}}},{key:"getViewTypeByGroup",value:function(e,t){var a=null,i=null,n=window.matchMedia?window.matchMedia("screen and (max-width: 768px)"):screen.width<=768,r=undefined,s=undefined;if("products"==t){var o=e.products_preset_id;r=e.products_swatch,!e.same_products_preset_for_mobile&&n.matches&&(o=e.mobile_products_preset_id,r=e.mobile_products_swatch),a=this.presets[o]}else if("collections"==t){var c=e.collections_preset_id;s=e.collections_swatch,!e.same_collections_preset_for_mobile&&n.matches&&(c=e.mobile_collections_preset_id,s=e.mobile_collections_swatch),a=null==c||"0"==c.toString()?this.getHiddenPreset():this.presets[c]}return i=this.presets[e.categories_preset_id],void 0!==a?Object.assign({products_swatch:r,collections_swatch:s,categoryPreset:i},a):Object.assign({products_swatch:e.products_swatch,collections_swatch:e.collections_swatch,categoryPreset:i},this.getViewDefault(t))}},{key:"getViewTypeByOptionName",value:function(e,t){var a=window.matchMedia?window.matchMedia("screen and (max-width: 768px)"):screen.width<=768;if("undefined"!=typeof this.presetsMap[e])return this.presetsMap[e];for(var i=this.getViewDefault(t),n=null,r=0;r'+this.theme_setting.custom_css+""}},{key:"getCustomScripts",value:function(){var e=this.theme_setting.custom_scripts;if(0!=e.length){for(var t="",a=0;a"}},{key:"getRightNavigationSVG",value:function(){return""!=this.getSwatchPresentation().slide_right_button_svg?this.getSwatchPresentation().slide_right_button_svg.replace(RegExp("<[a-z]+","gi"),' swatch-inside="true"'):''}},{key:"getLeftNavigationSVG",value:function(){return""!=this.getSwatchPresentation().slide_left_button_svg?this.getSwatchPresentation().slide_left_button_svg.replace(RegExp("<[a-z]+","gi"),' swatch-inside="true"'):''}},{key:"getMinifiedHTML",value:function(e,t,a){e=this.cvt2HTMLEntities(e);var i=this.clientSpecs.getSwatchPresentation("collections").minified_template;i=(i=(i=(i=i.replace(RegExp("{count}","gi"),t)).replace(RegExp("{option_name}","gi"),e)).replace(RegExp("{product_id}","gi"),a.id)).replace(RegExp("{product_handle}","gi"),a.handle);var n=g;return n&&""!=n&&(n=n.replace(/\/$/,"")),i=i.replace(RegExp("{routes_root}","gi"),n),this.parseHTML('
  • '+i+"
  • ")[0]}},{key:"parseHTML",value:function(e){var t=document.implementation.createHTMLDocument("");return t.body.innerHTML=e,t.body.children}},{key:"decodeHTML",value:function(e){return(new DOMParser).parseFromString(e,"text/html").documentElement.textContent}},{key:"setDefaultFeaturedImage",value:function(e){var t=this.clientSpecs.getDefaultSwatchImage();this.defaultFeaturedImage=t||e}},{key:"hideElementStyles",value:function(e){var t=document.querySelector('style[app="vkcl"][role="hide_elements"]'),a="";if("object"==typeof e||"array"==typeof e)for(var i=0;i",document.querySelector("head").appendChild(this.parseHTML(a)[0])))}},{key:"getStyleProps",value:function(){if(this.isInstanceTypeCollection()){var e=this.currentDocument.querySelector("variant-king-combined-listing").parentNode.getBoundingClientRect().width;return'style="width: '+(e?e+"px":"100%")+"; z-index: "+this.clientSpecs.getCollectionSettings().layer_index+';"'}return""}},{key:"getSwatchRoot",value:function(){var e="undefined"==typeof window.matchMedia||window.matchMedia("(hover: hover)").matches,t=this.clientSpecs.getNoTranslate(),a="";return a+='
    "}},{key:"renderSwatchRoot",value:function(e,t){if(!this.isSwatchRootDisplayed){var a=t.querySelector(".swatches.swatches-type-"+this.instanceType);a&&a.querySelector("[option-target]")&&a.parentNode.removeChild(a),t.innerHTML=e,this.isSwatchRootDisplayed=!0}}},{key:"renderNormal",value:function(e,t,a){var i=a.querySelector('[option-target="'+e+'"]'),n=i.querySelector(".swatch-single");n&&i.removeChild(n);var r=this.parseHTML(t)[0];return i.appendChild(r),i.classList.remove("swatch-hide"),i.querySelectorAll(".swatch-selector")}},{key:"getFlexibleSize",value:function(e){e=parseInt(e.replace("px",""));var t=window.innerWidth,a=t/500;return t>=992&&(a=.4*t/500),a=Math.max(a,.75),e*(a=Math.min(a,1.25))+"px"}},{key:"getLazyResolution",value:function(e,t,a,i){var n=!0;"cover"!=a&&"contain"!=a||("contain"==a&&(n=!1),a="100%"),a=parseInt(a.replace("%","")),a*=2;var r="center";i&&(r=i);var s="",o="width="+parseInt(t[0].replace("px",""))*(a/100)+"&height="+parseInt(t[1].replace("px",""))*(a/100)+(n?"&crop="+r:"");return o=e.includes("?")?"&"+o:"?"+o,e.match(/(\.jpg)(?=$|\?)/gm)&&(o+=s),e+o}},{key:"getViewByType",value:function(e){var t=null,a={getView:null};switch(e.assoc_view_type){case"swatch":t=e[this.instanceType+"_swatch"],a.getView="custom_swatch"==t?this.getCustomImageView.bind(this,e):this.getVariantImageView.bind(this,e);break;case"drop_down":a.getView=this.getDropDownView.bind(this,e);break;case"swatch_drop_down":a.getView=this.getDropDownViewCustom.bind(this,e);break;case"button":a.getView=this.getButtonView.bind(this,e);break;case"hidden":a.getView=this.getHiddenView.bind(this,e)}return a}},{key:"cvt2HTMLEntities",value:function(e){return e.replace(/&/g,"&").replace(/>/g,">").replace(/";o+='
    ",o+=i?c:"","swatch-view-slide"==n&&(o+='
    ',o+='
    ',o+=this.getSwatchSlideStyleHTML("left"));var l="tooltip"==e.params.option_value_display,u=this.isInstanceTypeCollection()?"32px":"80px",d=this.isInstanceTypeCollection()?"32px":"80px";o+="
      ';for(var p=e.params.width||e.params.swatch_size||u,h=e.params.height||e.params.swatch_size||d,g=this.buildBadgeData(e,a.data),f=0;f",o+='
      ',"outside_swatch"===e.params.badge_position&&b&&(o+=this.renderBadge(b,a.data[f])),o+='
      ";var k=this.defaultFeaturedImage,A=a.data[f].featured_image;A!=undefined&&(k=this.getImageSrc(A,e.products_swatch,e.collections_swatch));var I=k&&"none"!=k;I&&(z("Requested background image with URL("+k+")"),k=this.getLazyResolution(k,[p,h],e.params.background_size,e.params.background_position)),o+='
      ',"outside_swatch"!==e.params.badge_position&&(o+=this.renderBadge(b,a.data[f])),o+='
      ';var T="adjacent"==e.params.option_value_display;o+='

      '+_+"

      ",e.params.price_badge&&e.params.price_badge.price_enabled&&1==a.show_price&&!F&&(o+='
      '+a.data[f].price+"
      "),o+="
      ",l&&(o+='
      \n '+_+'\n
      \n
      '),o+=""}}return s&&(o+=this.renderMinificationBtn(e,a,e.assoc_view_type,p,h)),o+="
    ","swatch-view-slide"==n&&(o+=this.getSwatchSlideStyleHTML("right"),o+="
    "),o+="
    "}},{key:"generateChecksum",value:function(e){var t=e.length,a=undefined,i="";if(0===t)return 0;for(e=e.replace(new RegExp("\n\ts"),""),a=0;a=300?300:100*Math.ceil(a/100)}},{key:"getSwatchImageURL",value:function(e,t){for(var a=[{char:"!",replacer:"~21"},{char:"*",replacer:"~2A"},{char:"'",replacer:"~92"},{char:"(",replacer:"~28"},{char:")",replacer:"~29"},{char:";",replacer:"~3B"},{char:":",replacer:"~3A"},{char:"@",replacer:"~40"},{char:"&",replacer:"~26"},{char:"=",replacer:"~3D"},{char:"+",replacer:"~2B"},{char:"$",replacer:"~24"},{char:",",replacer:"~2C"},{char:"/",replacer:"~2F"},{char:"\\",replacer:"~5C"},{char:"?",replacer:"~3F"},{char:"%",replacer:"~25"},{char:"#",replacer:"~23"},{char:"[",replacer:"~5B"},{char:"]",replacer:"~5D"},{char:"{",replacer:"~7B"},{char:"}",replacer:"~7D"},{char:'"',replacer:"~22"},{char:"<",replacer:"~3C"},{char:">",replacer:"~3E"},{char:"|",replacer:"~7C"},{char:"`",replacer:"~60"},{char:"^",replacer:"~5E"},{char:".",replacer:"~2E"}],i=0;i";o+='
    ",o+=i?c:"","swatch-view-slide"==n&&(o+='
    ',o+='
    ',o+=this.getSwatchSlideStyleHTML("left"));var l="tooltip"==e.params.option_value_display,u=this.isInstanceTypeCollection()?"32px":"80px",d=this.isInstanceTypeCollection()?"32px":"80px";o+="
      ';for(var p=e.params.width||e.params.swatch_size||u,h=e.params.height||e.params.swatch_size||d,g=this.getResizeValue(p,h),f=this.buildBadgeData(e,a.data),v=0;v",o+='
      ',"outside_swatch"===e.params.badge_position&&k&&(o+=this.renderBadge(k,a.data[v])),o+='
      ";var I=this.getLazyResolution(a.data[v].featured_image.src,[p,h],e.params.background_size,e.params.background_position);if(this.clientSpecs.app_setting_config.use_optimized_urls){var T=I.split("/");I=T.slice(0,-1).join("/")+"/"+g+"/"+T.pop().replace(".media",".webp")}o+='
      ',"outside_swatch"!==e.params.badge_position&&k&&(o+=this.renderBadge(k,a.data[v])),o+='
      ',o+='

      '+w+"

      ",e.params.price_badge&&e.params.price_badge.price_enabled&&1==a.show_price&&!F&&(o+='
      '+a.data[v].price+"
      "),o+="
      ",l&&(o+='
      \n '+w+'\n
      \n
      '),o+=""}}return r&&(o+=this.renderMinificationBtn(e,a,e.assoc_view_type,p,h)),o+="
    ","swatch-view-slide"==n&&(o+=this.getSwatchSlideStyleHTML("right"),o+="
    "),o+="
    "}},{key:"getButtonView",value:function(e,t,a,i){var n=' data-group-index="'+a.product_group_index+'"',r="minified"==e.params.button_style,s=(window.matchMedia?window.matchMedia("screen and (max-width: 480px)"):screen.width,"swatch-view-"+(["slide","minified"].includes(e.params.button_style)?"slide":e.params.button_style)),o='
    ",c='";o+='
    ",i&&("inline"==e.params.label_display_position?(o+="
    ",o+=c):o+=c),"swatch-view-slide"==s&&(o+='
    ',o+='
    ",o+=this.getSwatchSlideStyleHTML("left")),o+="
      ';for(var l=0;l",o+="
      ",o+=" "+(e.params.radio_button?"
      ":""),o+="
      ",o+='
      '+p+"
      ",e.params.price_badge&&e.params.price_badge.price_enabled&&1==a.show_price&&!F&&(o+='
      '+a.data[l].price+"
      "),o+="
      ",o+="
      ",o+="")}return r&&(o+=this.renderMinificationBtn(e,a,e.assoc_view_type)),o+="
    ","swatch-view-slide"==s&&(o+=this.getSwatchSlideStyleHTML("right"),o+="
    "),"inline"===e.params.label_display_position&&(o+="
    "),o+="
    "}},{key:"getButtonViewCategory",value:function(e,t,a,i){var n="";return n+='\n
      \n '+(a?'\n ":"")+"\n "+Object.entries(e).filter(function(e){var a=_slicedToArray(e,2);a[0];return a[1][0]!==t}).map(function(e){var t=_slicedToArray(e,2),a=(t[0],t[1]);return'\n "}).join("")+"\n
    "}},{key:"getDropDownView",value:function(e,t,a,i){var n=' data-group-index="'+a.product_group_index+'"',r="",s="",o="",c=!!e.params.price_badge&&e.params.price_badge.price_enabled&&1==a.show_price&&!F,l="default"==e.params.dropdown_type?'\n ":"";r+='
    ",r+=i?l:"",r+='
    ',r+='
    ',"label_inside"==e.params.dropdown_type&&(r+='
    "),r+='',r+='
      ';for(var u=0;us.length&&(o=" "+(s=h)+" "+(c?""+g+" ":"")+" "),r+='
    • ",r+=" \n '+h+" "+(c?""+g+" ":"")+" ",r+="
    • ")}return r+="
    ",r+="double_triangle"==e.params.icon_style?'':"inverted_triangle"==e.params.icon_style?'':'',r+="
    ",r+="
    ",r=(r=(r+="
    ").replace("{{ option_value_text }}",s)).replace("{{ option_value }}",o)}},{key:"getDropDownViewCustom",value:function(e,t,a,i){var n=' data-group-index="'+a.product_group_index+'"',r="",s="",o="",c=!!e.params.price_badge&&e.params.price_badge.price_enabled&&1==a.show_price&&!F,l='";r+='
    ",r+=i?l:"";var u=e[this.instanceType+"_swatch"],d=this.isInstanceTypeCollection()?"24px":"48px",p=this.isInstanceTypeCollection()?"24px":"48px",h=e.params.swatch_size||d,g=e.params.swatch_size||p,f=this.getResizeValue(h,g);r+='
    ',r+='
    ',r+='',r+='
      ';for(var v=0;v
    ';b.length>s.length&&(o=x+' '+(s=b)+""),r+='
  • ",r+=x,r+=' \n '+b+" "+(c?""+w+" ":"")+" ",r+="
  • "}}return r+="", r+="double_triangle"==e.params.icon_style?'':"inverted_triangle"==e.params.icon_style?'':'',r+="
    ",r+="
    ",r=(r=(r+="
    ").replace("{{ option_value_text }}",s)).replace("{{ option_value }}",o)}},{key:"getHiddenView",value:function(e,t,a){for(var i="",n=0;n\n \n
    ",c))break}return i}},{key:"selectSwatch",value:function(e,t,a){var i=arguments.length<=3||arguments[3]===undefined?null:arguments[3],n="swatch-selected";if("undefined"!=typeof this.selectedSwatches[e]){var r,s=this.selectedSwatches[e];if(s.classList.remove(n),s.removeAttribute("current-product"),"SELECT"!=s.tagName)if(r="LI"==s.tagName?s:s.closest("li.swatch-view-item")){var o=r.getAttribute("role");r.setAttribute("tabindex","-1"),"option"==o?r.setAttribute("aria-selected",!1):r.setAttribute("aria-checked",!1)}}if((this.isDropDown(t.tagName)&&(t.value=a),t.classList.add(n),"SELECT"!=t.tagName)&&(r="LI"==t.tagName?t:t.closest("li.swatch-view-item"))){o=r.getAttribute("role");r.setAttribute("tabindex","0"),"option"==o?r.setAttribute("aria-selected",!0):r.setAttribute("aria-checked",!0)}if(this.selectedSwatches[e]=t,this.isInstanceTypeProduct&&i){var c=Array.from(t.classList),l=t.closest(".swatch-view-item")?Array.from(t.closest(".swatch-view-item").classList):[];if(i&&(c.includes("category-"+i)||l.includes("category-"+i)))this.selectCategory(i);else{var u=c.find(function(e){return e.startsWith("category-")})||l.find(function(e){return e.startsWith("category-")}),d=u?u.replace("category-",""):null;this.selectCategory(d)}}}},{key:"selectCategory",value:function(e){if(e){var t=document.querySelector('[aria-controls="category-'+e+'"]');t&&t.click()}}},{key:"isDropDown",value:function(e){return"SELECT"==e}},{key:"getIsSwatchRootDisplayed",value:function(){return this.isSwatchRootDisplayed}},{key:"setIsSwatchRootDisplayed",value:function(e){this.isSwatchRootDisplayed=e}},{key:"renderGroupCategory",value:function(e,t,a,i){var n=this,r="",s=t.view_type_preset,o='data-group-index="'+t.product_group_index+'"',c=new Set(t.data.map(function(e){return e.category_id})),l="",u=s.categoryPreset;if(0===Object.keys(e).length)return r;if(!c.has(null)){var d=t.data[0].default_group_category_id;c.has(d)||(l=d)}var p="swatch-view-stack",h=(window.matchMedia?window.matchMedia("screen and (max-width: 480px)"):screen.width,{swatch:function(){var e=n.instanceType+"_swatch";return'"},drop_down:function(){return"default"===s.params.dropdown_type?'\n ":""},swatch_drop_down:function(){return'"},button:function(){return'"},hidden:function(){return""}}),g=h[s.assoc_view_type]?h[s.assoc_view_type]():"";switch(u.assoc_view_type){case"button":r='
    ",r+="
    "+g+"
    ",r+=this.getButtonViewCategory(e,l,a,i),r+="
    ";break;case"label":r+="
    "+g+"
    "}return r}},{key:"renderBadge",value:function(e,t){if("storefront"!==b||e==undefined)return"";var a=_.app_setting_config.preset_badge;switch(e){case O:return"\n "+this.getTranslation(_.app_setting_config.preset_badge.new_badge_text)+"\n ";case j:return"\n "+this.getTranslation(_.app_setting_config.preset_badge.sold_out_badge_text)+"\n ";case H:var i=parseFloat(t.min_compare_at_price-t.min_price),n=t.min_compare_at_price>0?i/t.min_compare_at_price*100:0,r=this.applyReplacements(i,n);return"\n "+r+"\n ";default:return""}}},{key:"isNewPreset",value:function(e){var t=new Date(e);return new Datet&&(e>0?a/e*100:0)>=_.app_setting_config.preset_badge.min_price_diff_for_sale_badge}},{key:"applyReplacements",value:function(e,t){var a={"{{currency_symbol}}":_.currency_symbol,"{{currency_code}}":_.currency,"{{amount_save}}":e.toFixed(2),"{{percentage_save}}":Math.round(t)+"%"};return this.getTranslation(_.app_setting_config.preset_badge.sale_badge_text).replace(/{{(?:currency_symbol|currency_code|amount_save|percentage_save)}}/g,function(e){return a[e]})}},{key:"renderMinificationBtn",value:function(e,t,a){var i=arguments.length<=3||arguments[3]===undefined?null:arguments[3],n=arguments.length<=4||arguments[4]===undefined?null:arguments[4],r=this.formatMinificationText(e.params.minification_admin_template||e.params.minification_template,t),s="minification-btn swatch-minification "+(e.params.minification_template||e.params.minification_admin_template?"btn-with-count":"minification-icon"),o=[];return null!==i&&o.push("width: "+i),null!==n&&o.push("height: "+n),'\n
  • \n
    \n
    \n '+r+"\n
    \n
    \n
  • \n "}},{key:"formatMinificationText",value:function(e,t){var a=t.name;return e.replace(/{{(option_name)}}/g,function(e){return{"{{option_name}}":a}[e]||e})}},{key:"buildBadgeData",value:function(e,t){for(var a=[],i=!!e.params.new_badge&&e.params.new_badge.enable,n=!!e.params.sale_badge&&e.params.sale_badge.enable,r=!!e.params.sold_out_badge&&e.params.sold_out_badge.enable,s=_.app_setting_config.preset_badge.new_show_when_all_same,o=_.app_setting_config.preset_badge.sale_show_when_all_same,c=_.app_setting_config.preset_badge.sold_out_show_when_all_same,l=this.clientSpecs.getPresetBadgeOrderList(),u=0;u"),console.log("Variant King:",e),console.log("Variant King:","Timestamp",t.toString()),console.log("<--------------- END ----------------->")}},K=function(e){var t=document.implementation.createHTMLDocument("");return t.body.innerHTML=e,t.body.children},J=function(e){clearInterval(parseInt(e)),z(["Interval Removed...",e])},$=function(){return"complete"===document.readyState||"loaded"===document.readyState},X=function(){if(s("VariantKingCombinedListing")){if(t(),!y)return;_.app_setting.new_script||(S||A||T||x||C||q||P)&&(Z(),document.addEventListener("vkcl:product:refresh",function(){setTimeout(function(){Z(),z("Refreshing product swatch lookup complete.")},0)})),(k||I||L||E||D||M||N)&&Y()}},Z=(setInterval(function(){X()},500),function ee(){u||(u=new G);var e=u.getSelectors().swatch_root;e.use_section_as_root?function(){var t=!1,a=document.querySelectorAll(e.section_selector);if(!h){var i=window.location.pathname.includes("/products");t=1==a.length&&i}Object.entries(a).forEach(function(e){var a=_slicedToArray(e,2),i=a[0],n=a[1];if("length"!=i&&"undefined"==typeof n.vkcl_initialized){n.vkcl_initialized=!0,n.setAttribute("sa-groups-generated",!0);var r={instance_sub_type:"sectioned"};t&&(r.primary=!0,h=!0),new U("products",n,r).onInstanceActivate()}});var n=$()?1e3:250;setTimeout(ee.bind(_this22),n)}():new U("products",document,null).onInstanceActivate()}),Y=function(){u||(u=new G);var e=u.getCollectionConfig(),t=u.getCollectionSettings();Q(e,t,!0),document.addEventListener("vkcl:render:swatches",function(){setTimeout(function(){Q(e,t,!1)},0)})},Q=function te(e,t,a){var i=document.querySelectorAll(e.swatch_root_selector);Object.entries(i).forEach(function(e){var t=_slicedToArray(e,2),a=t[0],i=t[1];"length"!=a&&("undefined"==typeof i.vkcl_initialized&&(i.vkcl_initialized=!0,i.setAttribute("sa-groups-generated","none"),new U("collections",i,null).initialize()))}),a&&t.continuous_lookup>0&&setTimeout(function(){te(e,t,!0)},t.continuous_lookup)}}();