1window.Maximize.loadedScript.includes("labels-and-badges.js")||(window.Maximize.loadedScript.push("labels-and-badges.js"),requestAnimationFrame(()=>{document.addEventListener("alpine:init",()=>{Alpine.store("xLabelsAndBadges",{fixedPositionTemplate:`<div 2 class="x-badge-{label-id} x-badge-container pointer-events-none{container-img-class}{css-display-class} ltr" 3 {preview-show-condition} 4 style="--rounded-corners: 4px;" 5 > 6 {content} 7 </div>`,productDetailTemplate:`<div 8 class="x-badge-{label-id} x-badge-container max-h-full bottom-0 pointer-events-none{container-css-class}{container-img-class}{css-rtl}" 9 style="--rounded-corners: 4px;" 10 > 11 {content} 12 </div>`,previewActiveBlock:"",init(){Shopify.designMode&&(this.previewActiveBlock=localStorage.getItem("xBadgesPreviewActiveBlock"),document.addEventListener("shopify:block:select",event=>{if(!event.target.classList.contains("x-badges-block-preview"))return;let blockId=event.detail.blockId;this.previewActiveBlock=blockId,localStorage.setItem("xBadgesPreviewActiveBlock",blockId),document.dispatchEvent(new CustomEvent("maximize:badges:block-select"))}),document.addEventListener("shopify:section:select",function(event){const previewActiveBlock=localStorage.getItem("xBadgesPreviewActiveBlock"),badgeElement=document.querySelector(`.x-badge-${previewActiveBlock}`);badgeElement&&(badgeElement.style.display="block")}))},load(el,callback=()=>{},container=null){container&&(el.container=container),this.doLoad(el,callback)},doLoad(el,callback=()=>{}){if(this.initAllLabels(el),Shopify.designMode){let productData=xParseJSON(el.getAttribute("x-labels-data"));document.addEventListener("shopify:section:load",()=>{productData&&!productData.isXBadgesPreview&&this.initAllLabels(el)})}callback(el)},initAllLabels(el){let productData=xParseJSON(el.getAttribute("x-labels-data"));if(!productData)return;if(Shopify.designMode){let currentLabels=el.getElementsByClassName("x-badge-container");if(currentLabels.length>0){const labelsNum=currentLabels.length;for(let i=0;i<labelsNum;i++)currentLabels[0].remove()}}let allLabels=document.getElementsByClassName("x-badges-block-data");el.querySelectorAll(".label-container").forEach(el2=>el2.innerHTML="");for(let i=0;i<allLabels.length;i++){let label=xParseJSON(allLabels[i].getAttribute("x-badges-block-data"));if(!label.enable&&!productData.isXBadgesPreview)return;label.settings.icon_type=="custom_icon_image"?label.settings.icon=` 13 <img 14 loading="lazy" 15 width="100%" 16 height="100%" 17 class="h-full w-full object-cover" 18 alt="${label.settings.image_alt.length>0?label.settings.image_alt:productData.title}" 19 src="${label.settings.custom_icon_image}&width=50" 20 /> 21 `:label.settings.icon=allLabels[i].getAttribute("x-badges-icon"),label.settings.content=allLabels[i].getAttribute("x-badges-content"),this.appendLabel(el,label,productData)}},appendLabel(el,label,productData){if(productData.container=="product-info"&&productData.label_position=="content_inline"){el.innerHTML+=this.processTemplate(el,label,productData);return}let container=el.querySelector(`.${label.settings.position}-container`);productData.container=="product-info"&&productData.label_position!=="content_inline"&&(container=el.querySelector(".top-right-container"),productData.desktop_layout=="1_column"&&productData.desktop_carousel_option=="thumbnail"&&productData.desktop_carousel_position=="right"&&(container=el.querySelector(".top-left-container"))),container||(container=this.createFixedPositionContainer(label,productData),el.appendChild(container)),container.innerHTML+=this.processTemplate(el,label,productData)},createFixedPositionContainer(label,productData){let position=label.settings.position,checkOnMediaGallery=!1;productData.container=="product-info"&&productData.label_position!=="content_inline"&&(position="top-right",productData.desktop_layout=="1_column"&&productData.desktop_carousel_option=="thumbnail"&&productData.desktop_carousel_position=="right"&&(position="top-left"),checkOnMediaGallery=!0);let HTMLClass="";label.settings.type.includes("scrolling")&&!checkOnMediaGallery?HTMLClass+=label.settings.type.includes("top")?` ${label.settings.type}-container top-left-container label-container pointer-events-none overflow-hidden absolute top-1.5 flex flex-col left-1.5 right-1.5 gap-1`:` ${label.settings.type}-container bottom-left-container label-container pointer-events-none overflow-hidden absolute bottom-1.5 flex flex-col-reverse left-1.5 right-1.5 gap-1`:(HTMLClass=`${position}-container label-container absolute flex gap-1 pointer-events-none`,checkOnMediaGallery?HTMLClass+=position.includes("left")?" product-labels__product-info-media text-left items-end md:items-start rtl:items-end rtl:md:items-end":" product-labels__product-info-media text-right rtl:items-end rtl:md:items-start":(HTMLClass+=position.includes("top")?" top-1.5 flex-col":" bottom-1.5 flex-col-reverse",HTMLClass+=position.includes("left")?" left-1.5 right-1.5 text-left":" right-1.5 left-1.5 text-right"));const container=document.createElement("div");return container.setAttribute("class",HTMLClass),container},processContent(el,label,productData){let content2=!1;const canShow=this.canShow(label,productData);if(label.settings.image&&canShow){let imageHeight,imageWidth,imageDirection,styleImage,imageSize=Math.round(label.settings.size*.6);productData.container=="product-info"?(imageHeight=126,imageWidth=Math.round(imageHeight*label.settings.image_aspect_ratio)):(imageWidth=label.settings.size*15,imageHeight=imageWidth/label.settings.image_aspect_ratio);let image;label.settings.image.src?image=label.settings.image.src.includes("burst.shopifycdn.com")?label.settings.image.src:label.settings.image.src+"&width="+imageWidth*3:image=label.settings.image.includes("burst.shopifycdn.com")?label.settings.image:label.settings.image+"&width="+imageWidth*3,productData.container=="card"?(imageDirection=label.settings.position.includes("left")?"justify-start":"justify-end",styleImage="width: var(--width-image-label); height: var(--height-image-label)"):productData.label_position=="content_inline"?imageDirection=productData.make_content_center?"justify-center":"justify-start":imageDirection="justify-end rtl:justify-start",content2=`
22 <div x-ref="content" class="x-badge-content flex ${imageDirection}{css-opacity} rounded-corners overflow-hidden"> 23 <img 24 loading="lazy" 25 width="${imageWidth}" 26 height="${imageHeight}" 27 alt="${label.settings.image_alt.length>0?label.settings.image_alt:productData.title}" 28 src="${image}?width=${imageSize}" 29 style="${styleImage}" 30 class="rounded-corners" 31 /> 32 </div> 33 `}else if(label.settings.content&&canShow){let qty=productData.inventory_management.length<1||productData.qty<0?"":productData.qty,saleAmount=productData.sale_amount.includes("-")?"":productData.sale_amount,countDown=label.settings.schedule_enabled?'<span class="x-badge-countdown-'+label.id+' label-countdown empty:hidden"></span>':"",sale=Math.round((productData.compare_at_price-productData.price)*100/productData.compare_at_price);if(sale=sale==100?99:sale,sale=sale>0?sale+"%":"",label?.settings?.list_label){let contentLabel=Array.from(JSON.parse(label.settings.content));if(contentLabel.length>0){content2="";let num_loop=productData.container=="product-info"?20:10;contentLabel.length>3&&(num_loop=5);const sizeClass=productData.container=="product-info"?" pt-2 pb-2 pl-4 pr-4":"",inlineStyle=productData.container=="product-info"?"":'style="font-size: var(--h7-font-size);"',inlineStyleIcon=productData.container=="product-info"?"":'style="height: var(--h7-font-size); width: var(--h7-font-size); min-width: var(--h7-font-size); min-height: var(--h7-font-size);"';if(productData.container=="product-info"){let contentItem="";for(let j=0;j<contentLabel.length;j++)contentItem=contentLabel[j].replace(/{sale}/gi,sale).replace(/{sale_amount}/gi,saleAmount).replace(/{qty}/gi,qty).replace(/{price}/gi,productData.price_with_currency).replace(/{count_down}/gi,countDown),contentItem.length>0&&(content2+=`<div class="x-badge-text-item h7${productData.container=="product-info"?"":" px-2 py-1"} flex gap-2 items-center rounded-corners ${sizeClass} {css-opacity}{css-type}"><div class="flex whitespace-nowrap"><span class="inline-block relative icon-label empty:hidden">${label.settings.icon}</span></div><div class="min-w-max pe-2.5 whitespace-nowrap"><span class="leading-normal w-fit p-break-words">${contentItem}</span></div></div>`);content2=content2.length>0?`<div 34 x-ref="content" 35 class='x-badge-content ltr select-none gap-2' 36 ${inlineStyle} 37 > 38 <div class="w-full overflow-hidden"> 39 <div class="flex flex-wrap ${productData.label_position!=="content_inline"&&" flex-row-reverse rtl:flex-row"} whitespace-nowrap min-w-full gap-1"> 40 ${content2} 41 </div> 42 </div> 43 </div>`:!1}else{for(let i=0;i<num_loop;i++){let scrollingContent="",contentItem="";for(let j=0;j<contentLabel.length;j++)contentItem=contentLabel[j].replace(/{sale}/gi,sale).replace(/{sale_amount}/gi,saleAmount).replace(/{qty}/gi,qty).replace(/{price}/gi,productData.price_with_currency).replace(/{count_down}/gi,countDown),contentItem.length>0&&(scrollingContent+=`<div class="pe-2.5 flex whitespace-nowrap"><span class="inline-block relative icon-label empty:hidden" ${inlineStyleIcon}>${label.settings.icon}</span></div><div class="min-w-max pe-2.5 whitespace-nowrap"><span class="leading-normal w-fit p-break-words">${contentItem}</span></div>`);scrollingContent.length>0&&(content2+=`<div class="flex whitespace-nowrap items-center animate-scroll-banner el_animate">${scrollingContent}</div>`)}content2=content2.length>0?`<div 44 x-ref="content" 45 class='x-badge-content x-badge-text h7${productData.container=="product-info"?"":" px-2 py-1"} ltr select-none rounded-corners ${sizeClass} {css-opacity}{css-type} gap-2' 46 ${inlineStyle} 47 > 48 <div class="w-full overflow-hidden"> 49 <div class="flex flex-nowrap whitespace-nowrap min-w-full"> 50 ${content2} 51 </div> 52 </div> 53 </div>`:!1}}}else{content2=label.settings.content.replace(/{sale}/gi,sale).replace(/{sale_amount}/gi,saleAmount).replace(/{qty}/gi,qty).replace(/{price}/gi,productData.price_with_currency).replace(/{count_down}/gi,countDown).replace(/{count_down}/gi,countDown),productData.metafield_label&&productData.metafield_label.forEach(obj=>
53{Object.entries(obj).forEach(([key,value])=>{content2=content2.replace(new RegExp(`\\{${key}\\}`,"gi"),value)})});const sizeClass=productData.container=="product-info"?" pt-2 pb-2 pl-4 pr-4":"",inlineStyle=productData.container=="product-info"?"":'style="font-size: var(--h7-font-size);"',inlineStyleIcon=productData.container=="product-info"?"":'style="height: var(--h7-font-size); width: var(--h7-font-size); min-width: var(--h7-font-size); min-height: var(--h7-font-size);"';content2=content2.length>0?`<div 54 x-ref="content" 55 class='x-badge-content x-badge-text h7${productData.container=="product-info"?"":" px-2 py-1"} text-left ltr select-none inline-flex justify-center${sizeClass} items-center{css-opacity}{css-type} gap-2' 56 ${inlineStyle} 57 ><span class="icon-label empty:hidden" ${inlineStyleIcon}>${label.settings.icon}</span><span class="leading-normal w-fit p-break-words">${content2}</span></div>`:!1}countDown.length>0&&label.settings.schedule_enabled&&Alpine.store("xHelper").countdown(label.settings,function(canShow2,seconds,minutes,hours,days){const countdownElements=(el.container?el.container:el).getElementsByClassName("x-badge-countdown-"+label.id);if(!canShow2){for(let i=0;i<countdownElements.length;i++)countdownElements[i].innerHTML="";return}days=days>0?days+"D ":"",hours=hours==0&&days.length==0?"":hours+" : ";const timeLeft=days+hours+minutes+" : "+seconds;for(let i=0;i<countdownElements.length;i++)countdownElements[i].innerHTML=timeLeft})}return content2},processTemplate(el,label,productData){let template="";if(content=this.processContent(el,label,productData)){const cssOpacity=" opacity-"+label.settings.opacity;let cssType="";label.settings.type=="default"&&(cssType=" rounded-corners"),label.settings.type=="rounded_corner"&&(cssType=" rounded-slip");let containerCssClass=productData.container=="card"?" absolute w-max":"",classRTL=productData.container=="product-info"&&productData.label_position!="content_inline"?" ltr":"";const previewShowCondition=productData.isXBadgesPreview?`x-show="$store.xLabelsAndBadges.previewActiveBlock == '{label-id}'"`:"",imgClass=label.settings.image?" label-img":"",hiddenClass=label.settings.show_on_product_card?"":" hidden";template=this.getLabelTemplate(productData.container,label.settings.position),template=template.replaceAll("{preview-show-condition}",previewShowCondition).replaceAll("{content}",content).replaceAll("{css-opacity}",cssOpacity).replaceAll("{css-type}",cssType).replaceAll("{css-rtl}",classRTL).replaceAll("{container-css-class}",containerCssClass).replaceAll("{container-img-class}",imgClass).replaceAll("{css-display-class}",hiddenClass).replaceAll(/{label-id}/gi,label.id)}return template},getLabelTemplate(container){return container=="product-info"?this.productDetailTemplate:this.fixedPositionTemplate},canShow(label,productData){if(productData.isXBadgesPreview)return!0;if(productData.container=="card"&&!label.settings.show_on_product_card||productData.container=="product-info"&&!label.settings.show_on_product_page)return!1;if(label.type=="sale-label"&&productData.compare_at_price>productData.price||label.type=="sold-out-label"&&!productData.available)return!0;if(label.type=="preorder-label")return!!productData.is_show_preorder;if(label.type=="new-label"){if(label.settings.day_since=="creation_date"&&label.settings.number_show<productData.diff_day_create)return!1;if(label.settings.day_since=="activation_date"&&label.settings.number_show<productData.diff_day_publish)return!1}if(label.settings.schedule_enabled){let endDate=new Date(label.settings.end_year,label.settings.end_month-1,label.settings.end_day,label.settings.end_hour,label.settings.end_minute);label.endTime=endDate.getTime()+(-1*label.settings.timezone*60-endDate.getTimezoneOffset())*60*1e3;let startDate=new Date(label.settings.start_year,label.settings.start_month-1,label.settings.start_day,label.settings.start_hour,label.settings.start_minute);label.startTime=startDate.getTime()+(-1*label.settings.timezone*60-startDate.getTimezoneOffset())*60*1e3;let now=new Date().getTime();if(label.endTime<now||label.startTime>now)return!1}if(label.settings.applied_products.includes(productData.id))return!0;for(let i=0;i<label.settings.applied_collections.length;i++)if(productData.collections.includes(label.settings.applied_collections[i]))return!0;return label.type!="sale-label"&&label.type!="sold-out-label"&&label.settings.applied_products.length==0&&label.settings.applied_collections.length==0}})})})); 58//# sourceMappingURL=/cdn/shop/t/26/assets/labels-and-badges.js.map?v=94705830190574568211768190870
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.