1if(typeof ShippingNotice!="function"){class ShippingNotice2 extends HTMLElement{constructor(){super(),this.init()}init(){const currencyRate=Shopify.currency.rate?Number(Shopify.currency.rate):1,freeShippingThreshold=Math.round(Number(this.getAttribute("data-free-shipping"))*currencyRate),cartTotal=Number(this.getAttribute("data-cart-total")),freeShippingRemaining=cartTotal-freeShippingThreshold,tiers=(this.getAttribute("data-tier-thresholds")||"").split(",").filter(Boolean).map(Number).map(threshold=>Math.round(threshold*currencyRate)),textEl=this.querySelector("[data-js-free-shipping-text]"),progressBar=this.querySelector("[data-js-free-shipping-slider]"),sliderTrack=this.querySelector("[data-js-tier-slider]"),shipMarker=sliderTrack?sliderTrack.querySelector("[data-shipping-marker]"):null,tierMarkerEls=sliderTrack?Array.from(sliderTrack.querySelectorAll("[data-tier-marker]")):[];let currentTierIndex=-1;if(freeShippingRemaining>=0&&tiers.forEach((threshold,i)=>{cartTotal>=threshold&&(currentTierIndex=i)}),textEl)if(freeShippingRemaining<0)textEl.innerHTML=window.KROWN.settings.locales.tier_pending.replace("{{ remaining_amount }}",this._formatMoney(Math.abs(freeShippingRemaining),KROWN.settings.shop_money_format));else if(currentTierIndex===-1&&tiers.length){const remaining=tiers[0]-cartTotal;textEl.innerHTML=window.KROWN.settings.locales.tier_shipping_unlocked.replace("{{ remaining_amount }}",this._formatMoney(remaining,KROWN.settings.shop_money_format))}else if(currentTierIndex===-1)textEl.innerHTML=window.KROWN.settings.locales.shipping_notice_eligible_for_free;else if(currentTierIndex===0&&tiers.length>1){const remaining=tiers[1]-cartTotal;textEl.innerHTML=window.KROWN.settings.locales.tier_wholesale_unlocked.replace("{{ remaining_amount }}",this._formatMoney(remaining,KROWN.settings.shop_money_format))}else if(currentTierIndex===1&&tiers.length>2){const remaining=tiers[2]-cartTotal;textEl.innerHTML=window.KROWN.settings.locales.tier_bulk_unlocked.replace("{{ remaining_amount }}",this._formatMoney(remaining,KROWN.settings.shop_money_format))}else currentTierIndex===tiers.length-1&&(textEl.innerHTML=window.KROWN.settings.locales.tier_max_reached);const stageColours=["#d4123b","#ff6633","#f2c94c","#2f7d3c","#ffffff"];let stage=0;cartTotal>=freeShippingThreshold&&(stage=1,tiers.forEach((threshold,i)=>{cartTotal>=threshold&&(stage=i+2)})),stage=Math.min(stage,stageColours.length-1);let fillPercent;if(cartTotal<freeShippingThreshold)fillPercent=freeShippingThreshold>0?Math.max(cartTotal,0)/freeShippingThreshold*100:0;else{const segmentPct=tiers.length?100/tiers.length:0;let prevThreshold=freeShippingThreshold,prevPct=0;fillPercent=100;for(let i=0;i<tiers.length;i++){const threshold=tiers[i],pct=segmentPct*(i+1);if(cartTotal<=threshold){const span=threshold-prevThreshold,ratio=span>0?(cartTotal-prevThreshold)/span:1;fillPercent=prevPct+ratio*(pct-prevPct);break}prevThreshold=threshold,prevPct=pct}}if(fillPercent=Math.max(0,Math.min(100,fillPercent)),progressBar&&(progressBar.style.width=`${fillPercent}%`,progressBar.style.backgroundImage="none",progressBar.style.backgroundColor=stageColours[stage]),sliderTrack){shipMarker&&(cartTotal>=freeShippingThreshold?shipMarker.style.display="none":(shipMarker.style.display="",shipMarker.style.left="100%",shipMarker.style.backgroundColor="#fcfae8",shipMarker.style.borderColor="#fcfae8"));const segmentPct=tiers.length?100/tiers.length:0;let nextAssigned=!1;tierMarkerEls.forEach((marker,i)=>{const threshold=tiers[i];if(threshold===void 0){marker.style.display="none";return}const hit=cartTotal>=threshold;if(cartTotal<freeShippingThreshold){marker.style.display="none";return}if(hit){marker.style.display="none";return}marker.style.display="",marker.style.left=`${segmentPct*(i+1)}%`,nextAssigned?(marker.style.backgroundColor="#36453d",marker.style.borderColor="#36453d"):(marker.style.backgroundColor="#fcfae8",marker.style.borderColor="#fcfae8",nextAssigned=!0)})}}_formatMoney(cents,format){typeof cents=="string"&&(cents=cents.replace(".",""));let value="";const placeholderRegex=/\{\{\s*(\w+)\s*\}\}/,formatString=format||moneyFormat;function formatWithDelimiters(number,precision,thousands,decimal){if(thousands=thousands||",",decimal=decimal||".",isNaN(number)||number===null)return 0;number=(number/100).toFixed(precision);const parts=number.split("."),dollarsAmount=parts[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+thousands),centsAmount=parts[1]?decimal+parts[1]:"";return dollarsAmount+centsAmount+KROWN.settings.iso_code}switch(formatString.match(placeholderRegex)[1]){case"amount":value=formatWithDelimiters(cents,2);break;case"amount_no_decimals":value=formatWithDelimiters(cents,0);break;case"amount_with_comma_separator":value=formatWithDelimiters(cents,2,".",",");break;case"amount_no_decimals_with_comma_separator":value=formatWithDelimiters(cents,0,".",",");break;case"amount_no_decimals_with_space_separator":value=formatWithDelimiters(cents,0," ");break;case"amount_with_apostrophe_separator":value=formatWithDelimiters(cents,2,"'");break}return formatString.replace(placeholderRegex,value)}}typeof customElements.get("shipping-notice")>"u"&&customElements.define("shipping-notice",ShippingNotice2)} 2//# sourceMappingURL=/cdn/shop/t/69/assets/component-shipping-notice.js.map?v=92300671070202011501790111808
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.