1$(document).ready(function(){let productNavSlider=$(".product-nav-slider"),productThumbSlider=$(".product-thumb-slider");if(productNavSlider.length>0&&!productNavSlider.hasClass("slick-initialized")&&productThumbSlider.length>0&&!productThumbSlider.hasClass("slick-initialized")){let setActiveThumb2=function(index){productThumbSlider.find(".main-product__slider-media").removeClass("is-active-thumb"),productThumbSlider.find('.main-product__slider-media[data-slick-index="'+index+'"]').addClass("is-active-thumb")},refreshSlidersPosition2=function(){productNavSlider.hasClass("slick-initialized")&&productNavSlider.slick("setPosition"),productThumbSlider.hasClass("slick-initialized")&&productThumbSlider.slick("setPosition")};var setActiveThumb=setActiveThumb2,refreshSlidersPosition=refreshSlidersPosition2;productNavSlider.slick({slidesToShow:1,slidesToScroll:1,arrows:!0,dots:!0,fade:!1,infinite:!1,speed:300,prevArrow:'<button type="button" class="nav-prev-arrow" aria-label="Previous image"><svg width="10" height="18" viewBox="0 0 10 18" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9 1L1 9L9 17" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></button>',nextArrow:'<button type="button" class="nav-next-arrow" aria-label="Next image"><svg width="10" height="18" viewBox="0 0 10 18" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L9 9L1 17" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></button>'});var useVerticalThumbs=window.matchMedia("(min-width: 768px)").matches;productThumbSlider.slick({slidesToShow:useVerticalThumbs?5:4,slidesToScroll:1,arrows:!0,dots:!1,infinite:!1,speed:300,centerMode:!1,variableWidth:!1,vertical:useVerticalThumbs,verticalSwiping:useVerticalThumbs,swipe:!0,touchMove:!0,prevArrow:'<button type="button" class="prev-arrow" aria-label="Previous slide"><svg width="14" height="8" viewBox="0 0 14 8" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13 7L7 1L1 7" stroke="#222329" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></button>',nextArrow:'<button type="button" class="next-arrow" aria-label="Next slide"><svg width="14" height="8" viewBox="0 0 14 8" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L7 7L13 1" stroke="#222329" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></button>'}),productThumbSlider.on("click",".main-product__slider-media",function(){if(!$(this).hasClass("slick-cloned")){var index=$(this).data("slick-index");if(typeof index=="number"){productNavSlider.slick("slickGoTo",index);var $active=productThumbSlider.find(".main-product__slider-media.slick-active"),firstVisible=$active.first().data("slick-index"),lastVisible=$active.last().data("slick-index"),total=productThumbSlider.find(".main-product__slider-media").length;index===lastVisible&&index<total-1?productThumbSlider.slick("slickNext"):index===firstVisible&&index>0&&productThumbSlider.slick("slickPrev")}}}),productNavSlider.on("afterChange",function(event,slick,currentSlide){setActiveThumb2(currentSlide)}),setActiveThumb2(0),requestAnimationFrame(refreshSlidersPosition2),$(window).on("load",refreshSlidersPosition2),setTimeout(refreshSlidersPosition2,250)}$('input[name="bespoke-option"]').on("change",function(){$('input[name="bespoke-option"]:checked').val()==="yes"?($(".main-product__customise-wrapper.hex_color_option_wrapper").show(),$(".color_selection_options_wrapper").hide()):($(".main-product__customise-wrapper.hex_color_option_wrapper").hide(),$(".color_selection_options_wrapper").show())});const logoWizardState={enabled:!1,currentStepIndex:0,completedItems:[],queuedSizes:[],isAddingAdditionalItem:!1,isSubmissionComplete:!1,currentDesignExcluded:!1,$customiseSelection:$(),$designSteps:$(),$sizeStep:$(),$sizeRowsContainer:$(),quantitySelections:[],$quantityStep:$(),$quantityList:$(),$reviewStep:$(),$detailsStep:$(),$volumeInfoBar:$(),$backButton:$(),$nextButton:$(),$progressCurrent:$(),$progressTotal:$(),$progressBarFill:$(),$progressDots:$(),$summaryList:$(),$summaryHelpText:$(),$continueDetailsButton:$(),$queuedSizeList:$(),returnToIndex:null,$generateProxy:$(),$band:$(),$helpMenu:$()},LMW_STEP_META={location:["Location","Where Will It Go?","This decides how we finish the edges of your mat."],size:["Size","How Big Does It Need To Be?","Pick which way round, then enter or choose a size."],quantity:["Quantity","How Many Mats?","The more you order, the lower the price per mat."],upload:["Your logo","Upload Your Logo","Any format is fine \u2014 our designers tidy it up for print at no charge."],details:["Details","Last Step \u2014 Your Details","Submit and your proof is generated instantly, ready to edit and finalise."]};function getWizardStepType($step){return!$step||!$step.length?"":logoWizardState.$detailsStep.length&&$step.is(logoWizardState.$detailsStep)?"details":$step.find(".main-product__backing-option").length?"location":$step.find(".main-product__size-option").length?"size":$step.find(".main-product__quantity-option").length?"quantity":$step.find(".main-product__upload-option").length?"upload":""}function hasReturnTarget(){return logoWizardState.returnToIndex!==null&&logoWizardState.returnToIndex!==void 0}function lmwTrack(eventName,props){try{const DL=window.dataLayer=window.dataLayer||[],$root=$(".main-product__customise-selection").first(),allSteps=logoWizardState.enabled?getWizardSteps():[],stepNames={upload:"upload_logo",details:"contact_details"},rawType=allSteps.length?getWizardStepType($(allSteps[logoWizardState.currentStepIndex])):"",stepType=stepNames[rawType]||rawType;DL.push(Object.assign({event:eventName,lm_product_handle:safeTrim($root.attr("data-product-handle")||""),lm_step_name:stepType},props||{}))}catch{}}const LMW_DARK_LOGO_THRESHOLD=.45;function hexToRgb(hex){const clean=safeTrim(hex).replace("#",""),full=clean.length===3?clean.split("").map(c=>c+c).join(""):clean;return/^[0-9a-f]{6}$/i.test(full)?{r:parseInt(full.slice(0,2),16),g:parseInt(full.slice(2,4),16),b:parseInt(full.slice(4,6),16)}:null}
1function pickBackgroundSwatchForLogo(info){const $swatches=$('input[name="background-color-swatch"]').not("#background-custom-colour");if(!$swatches.length)return;let $target=$swatches.first();if(info&&typeof info.luminance=="number"&&info.luminance<LMW_DARK_LOGO_THRESHOLD){let best=null,bestLum=-1,bestAny=null,bestAnyLum=-1;$swatches.each(function(){const rgb=hexToRgb(this.value);if(!rgb)return;const lum=(.2126*rgb.r+.7152*rgb.g+.0722*rgb.b)/255,max=Math.max(rgb.r,rgb.g,rgb.b),min=Math.min(rgb.r,rgb.g,rgb.b),sat=max?(max-min)/max:0;lum>bestAnyLum&&(bestAnyLum=lum,bestAny=this),sat<=.2&&lum>bestLum&&(bestLum=lum,best=this)});const chosen=best||bestAny;chosen&&($target=$(chosen))}$target.is(":checked")||$target.prop("checked",!0).trigger("change"),logoWizardState.autoBackgroundName=safeTrim($target.attr("data-color-name"))||safeTrim($target.val()),info&&typeof info.luminance=="number"&&lmwTrack("lm_mat_colour_auto",{lm_colour:logoWizardState.autoBackgroundName,lm_dark_logo:info.luminance<LMW_DARK_LOGO_THRESHOLD,lm_logo_luminance:Math.round(info.luminance*100)/100})}document.addEventListener("lmw:logo-brightness",function(e){pickBackgroundSwatchForLogo(e&&e.detail?e.detail:null),logoWizardState.enabled&&logoWizardState.$summaryList&&logoWizardState.$summaryList.length&&updateWizardSummary(),prewarmLogoSprite()});function prewarmLogoSprite(){try{const logoUrl=safeTrim($(".main-product__uploaded-file-url").val());if(!logoUrl)return;const design=buildCurrentDesignItem()||{};fetch(LOGO_PREWARM_API_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({logoUrl,matSize:safeTrim(design.customWidth?"":design.size),customWidth:safeTrim(design.customWidth),customLength:safeTrim(design.customLength),orientation:safeTrim(design.orientation)||"landscape",showRubberBorder:!isMatwellLocationSelected(),backgroundColor:safeTrim(design.backgroundColor||design.color)}),keepalive:!0}).catch(function(){})}catch{}}function safeTrim(value){return value==null?"":String(value).trim()}function getCustomDimensionsLabel(){const width=safeTrim($('input[name="width"]').val()),length=safeTrim($('input[name="length"]').val());return!width||!length?"":`${width}cm x ${length}cm`}function getCustomSizeDisplayText(){const dimensionsLabel=getCustomDimensionsLabel();return dimensionsLabel?`Custom Size (${dimensionsLabel})`:"Need a custom size?"}function isCustomOptionElement($option){if(!$option||!$option.length)return!1;const optionText=safeTrim($option.attr("data-text")||$option.text()).toLowerCase();return optionText.indexOf("custom")>-1||optionText.indexOf("bespoke")>-1}function isCustomSelectionForSizeSelect($sizeSelect){if(!$sizeSelect||!$sizeSelect.length)return!1;const $activeOption=$sizeSelect.find(".cw-product-bundle__variant-options .cw-product-bundle__variant-option.active-status").first();if($activeOption.length>0)return isCustomOptionElement($activeOption);const selectedText=safeTrim($sizeSelect.find(".cw-product-bundle__variant-selected .cw-product-bundle__variant-text").text()).toLowerCase();return selectedText.indexOf("custom")>-1||selectedText.indexOf("bespoke")>-1}function normalizeComparableLabel(value){return safeTrim(value).toLowerCase().replace(/\s+/g," ")}function resolveSizeSelectMatchedOption($sizeSelect){if(!$sizeSelect||!$sizeSelect.length)return $();const $options=$sizeSelect.find(".cw-product-bundle__variant-options .cw-product-bundle__variant-option");if($options.length===0)return $();const selectedDisplayText=normalizeComparableLabel($sizeSelect.find(".cw-product-bundle__variant-selected .cw-product-bundle__variant-text").text()),selectedHiddenValue=normalizeComparableLabel($sizeSelect.find('input[type="hidden"]').val());let $matchedOption=$();return selectedHiddenValue&&($matchedOption=$options.filter(function(){const $option=$(this),optionDataText=normalizeComparableLabel($option.attr("data-text")),optionLabelText=normalizeComparableLabel($option.find(".cw-product-bundle__option-text").first().text()||$option.text()),optionDisplayText=normalizeComparableLabel($option.attr("data-display-text"));return selectedHiddenValue===optionDataText||selectedHiddenValue===optionLabelText||selectedHiddenValue===optionDisplayText}).first()),$matchedOption.length===0&&selectedDisplayText&&($matchedOption=$options.filter(function(){const $option=$(this),optionDataText=normalizeComparableLabel($option.attr("data-text")),optionLabelText=normalizeComparableLabel($option.find(".cw-product-bundle__option-text").first().text()||$option.text()),optionDisplayText=normalizeComparableLabel($option.attr("data-display-text"));return selectedDisplayText===optionDataText||selectedDisplayText===optionLabelText||selectedDisplayText===optionDisplayText}).first()),$matchedOption}function resolveSizeSelectVariantId($sizeSelect){if(!$sizeSelect||!$sizeSelect.length)return"";const activeVariantId=safeTrim($sizeSelect.find(".cw-product-bundle__variant-options .cw-product-bundle__variant-option.active-status").first().attr("data-variant-id"));if(activeVariantId)return activeVariantId;const persistedVariantId=safeTrim($sizeSelect.attr("data-selected-variant-id"));if(persistedVariantId)return persistedVariantId;const $matchedOption=resolveSizeSelectMatchedOption($sizeSelect);return $matchedOption.length>0?safeTrim($matchedOption.attr("data-variant-id")):""}function isCustomSizeSelectedOnSizeSelect($sizeSelect){if(!$sizeSelect||!$sizeSelect.length)return!1;const persistedCustomFlag=safeTrim($sizeSelect.attr("data-selected-is-custom-size")).toLowerCase();if(persistedCustomFlag==="true")return!0;
1if(persistedCustomFlag==="false")return!1;const $matchedOption=resolveSizeSelectMatchedOption($sizeSelect);return $matchedOption.length>0?isCustomOptionElement($matchedOption):isCustomSelectionForSizeSelect($sizeSelect)}window.updateCustomSizeLabels=function(){return updateCustomSizeLabels2()};function updateCustomSizeLabels2(){const dimensionsLabel=getCustomDimensionsLabel(),customDisplayText=dimensionsLabel?`Custom Size (${dimensionsLabel})`:"Custom size";$(".main-product__size-option .cw-product-bundle__variant-option--custom-size").each(function(){const $option=$(this),$optionText=$option.find(".cw-product-bundle__option-text").first();$optionText.length>0&&$optionText.text(customDisplayText),$option.attr("data-display-text",customDisplayText)}),$(".main-product__size-option .cw-product-bundle__variant-select").each(function(){const $sizeSelect=$(this);if(!isCustomSelectionForSizeSelect($sizeSelect))return;const $selectedText=$sizeSelect.find(".cw-product-bundle__variant-selected .cw-product-bundle__variant-text").first();$selectedText.length>0&&$selectedText.text(customDisplayText)})}function escapeHtml(value){return safeTrim(value).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function isMatwellLocationSelected(){return $("#location-option-2").is(":checked")}const MATWELL_TRIM_ALLOWANCE_CM=3;function getCustomSizeSubCopy(){return isMatwellLocationSelected()?`Enter your recess size \u2014 we add ${MATWELL_TRIM_ALLOWANCE_CM}cm to the width and length so the mat can be trimmed to fit.`:"Made to your exact measurements \u2014 our most popular choice."}function syncCustomSizeSubCopy(){$(".main-product__size-option .cw-product-bundle__custom-sub").text(getCustomSizeSubCopy())}function updateMatwellDependentUI(){const isMatwell=isMatwellLocationSelected(),$colorPickerWrap=$(".main-product__color-picker-cta-wrap"),$customColourSwatch=$("#background-custom-colour"),$sizeNote=$(".logo-mat-wizard__matwell-size-note"),$fallbackSwatch=$('input[name="background-color-swatch"]').not($customColourSwatch).first();$sizeNote.length&&$sizeNote.toggle(isMatwell),syncCustomSizeSubCopy(),typeof refreshCustomSizeUI=="function"&&refreshCustomSizeUI(),$colorPickerWrap.length&&$colorPickerWrap.toggle(!isMatwell),$customColourSwatch.length&&($customColourSwatch.prop("disabled",isMatwell),isMatwell&&$customColourSwatch.is(":checked")&&$fallbackSwatch.length&&$fallbackSwatch.prop("checked",!0).trigger("change")),$("#backgroundCustomColourTrigger, #backgroundCustomColourInput, #backgroundCustomColourHex").prop("disabled",isMatwell)}function parseCurrencyAmount(value){const rawValue=safeTrim(value);if(!rawValue)return null;const normalized=rawValue.replace(/[^0-9.\-]/g,"");if(!normalized)return null;const parsedValue=parseFloat(normalized);return Number.isFinite(parsedValue)?parsedValue:null}function parsePercentAmount(value){const rawValue=safeTrim(value);if(!rawValue)return null;const normalized=rawValue.replace(/save/gi,"").replace(/[^0-9.\-]/g,"");if(!normalized)return null;const parsedValue=parseFloat(normalized);return Number.isFinite(parsedValue)?parsedValue:null}function parseQuantityValue(value){const rawValue=safeTrim(value);if(!rawValue)return null;const parsedValue=parseFloat(rawValue.replace(/[^0-9.\-]/g,""));return Number.isFinite(parsedValue)?parsedValue:null}function roundToTwo(value){return Number.isFinite(value)?Math.round(value*100)/100:null}function formatMoneyAmount(value){if(!Number.isFinite(value))return"";const amountInPence=Math.round(value*100);return window.Shopify&&typeof window.Shopify.formatMoney=="function"?window.Shopify.formatMoney(amountInPence):`\xA3${value.toFixed(2)}`}function getQuantityDiscountTiers(){const tierMap={2:0,3:0,4:0};return[2,3,4].forEach(tierQty=>{const tierRaw=safeTrim($(`.main-product__quantity-option .cw-product-bundle__variant-option[data-selected-qty="${tierQty}"]`).attr("data-save-percentage")),tierPercent=parsePercentAmount(tierRaw);tierMap[tierQty]=tierPercent!==null?tierPercent:0}),tierMap}function getDiscountPercentForQty(quantity,tiers){return quantity>=4?tiers[4]||0:quantity===3?tiers[3]||0:quantity===2&&tiers[2]||0}const INSTANT_PROOF_API_URL=window.logoMatInstantProofEndpoint||"https://process-fm-logomat-designs.azurewebsites.net/api/proofs/create",LOGO_PREWARM_API_URL=window.logoMatPrewarmEndpoint||"https://process-fm-logomat-designs.azurewebsites.net/api/logos/prewarm",INSTANT_PROOF_CLIENT_TIMEOUT_MS=parseInt(window.logoMatInstantProofClientTimeoutMs||"95000",10);function normalizeInstantProofOutcome(rawResponse,fallbackStatus){const raw=rawResponse||{},normalizedStatus=safeTrim(raw.instantProofStatus||fallbackStatus||"failed").toLowerCase(),isSuccess=normalizedStatus==="success",resolvedProofMode=safeTrim(raw.proofMode||(isSuccess?"instant":"manual")).toLowerCase()||(isSuccess?"instant":"manual");return{instantProofStatus:normalizedStatus,proofMode:resolvedProofMode,requiresManualReview:typeof raw.requiresManualReview=="boolean"?raw.requiresManualReview:!isSuccess,proofId:safeTrim(raw.proofId),proofUrl:safeTrim(raw.proofUrl),proofImageUrl:safeTrim(raw.proofImageUrl||raw.previewImageUrl),draftOrderId:safeTrim(raw.draftOrderId),draftOrderInvoiceUrl:safeTrim(raw.draftOrderInvoiceUrl),renderDurationMs:raw.renderDurationMs!==void 0&&raw.renderDurationMs!==null?parseInt(raw.renderDurationMs,10):null,errorCode:safeTrim(raw.errorCode||(isSuccess?"":normalizedStatus)),errorMessage:safeTrim(raw.message||raw.errorMessage),rawStatus:safeTrim(raw.status).toLowerCase()}}function getShopifyMarketingConsent(){try{var cp=window.Shopify&&window.Shopify.customerPrivacy;if(!cp)return{allowed:!1,source:"shopify_customer_privacy_unavailable",shopifyMarketing:"",shopifyAllowed:!1,consentId:""};var explicit="";try{var visitorConsent=cp.currentVisitorConsent&&cp.currentVisitorConsent();explicit=visitorConsent&&visitorConsent.marketing||""}catch{explicit=""}var allowedBool=!1;try{allowedBool=!!(cp.marketingAllowed&&cp.marketingAllowed())}catch{allowedBool=!1}var consentId="";try{consentId=cp.consentId&&cp.consentId()||""}catch{consentId=""}var allowed,source;return explicit==="yes"?(allowed=!0,source="shopify_current_visitor_consent"):explicit==="no"?(allowed=!1,source="shopify_current_visitor_consent"):(allowed=allowedBool,source="shopify_marketing_allowed"),{allowed,source,shopifyMarketing:explicit,shopifyAllowed:allowedBool,consentId}}catch{return{allowed:!1,source:"shopify_customer_privacy_error",shopifyMarketing:"",shopifyAllowed:!1,consentId:""}}}function getVatDisplayMode(){let mode=safeTrim(window.fmVatMode);return!mode&&document.documentElement&&(mode=safeTrim(document.documentElement.getAttribute("data-vat-mode"))),mode.toLowerCase()==="inc"?"inc":"ex"}function readExVatPriceFromSizeSelect($sizeSelect){if(!$sizeSelect||$sizeSelect.length===0)return"";const $price=$sizeSelect.find(".cw-product-bundle__variant-selected .cw-product-bundle__variant-price").first();return $price.length===0?"":safeTrim($price.attr("data-ex-price"))||safeTrim($price.text())}function buildInstantProofRequestPayload(customerData,primaryDesign,designItems,designItemsObject){const primaryDesignObject=Array.isArray(designItemsObject)&&designItemsObject.length>0?designItemsObject[0]:null,quantityValue=normalizeQuantityValue(primaryDesignObject&&primaryDesignObject.quantityValue||parseQuantityValue(primaryDesign.quantity)||parseQuantityValue(customerData["Quantity Value"])||parseQuantityValue(customerData.Quantity)||1),variantIdValue=safeTrim(primaryDesignObject&&primaryDesignObject.productVariantId||primaryDesign.productVariantId||customerData["Product Variant Id"]||""),productIdValue=safeTrim(primaryDesignObject&&primaryDesignObject.productId||primaryDesign.productId||customerData["Product Id"]||""),productHandleValue=safeTrim(primaryDesignObject&&primaryDesignObject.productHandle||primaryDesign.productHandle||customerData["Product Handle"]||""),unitPriceExValue=parseCurrencyAmount(primaryDesignObject&&(primaryDesignObject.productPriceEx||primaryDesignObject.productPrice)||primaryDesign.productPriceEx||primaryDesign.productPrice),discountedUnitPriceExValue=parseCurrencyAmount(primaryDesignObject&&(primaryDesignObject.totalPriceEx||primaryDesignObject.totalPrice)||primaryDesign.totalPriceEx||primaryDesign.totalPrice),lineTotalExValue=discountedUnitPriceExValue!==null&&quantityValue!==null?roundToTwo(discountedUnitPriceExValue*quantityValue):null,marketingConsent=getShopifyMarketingConsent();let metaCapiFields={};try{typeof window.fmGetMetaLeadFields=="function"&&(metaCapiFields=window.fmGetMetaLeadFields()||{})}catch{}return{logo_url:safeTrim(primaryDesign.imageUrl||customerData["Image URL"]),background_color:safeTrim(primaryDesign.backgroundColor||customerData["Backgroun
1d Color"]||primaryDesign.color),size:safeTrim(primaryDesign.customWidth?"":primaryDesign.size),custom_width:safeTrim(primaryDesign.customWidth),custom_length:safeTrim(primaryDesign.customLength),orientation:safeTrim(primaryDesign.orientation||customerData.Orientation||"landscape"),company_name:safeTrim(customerData["Company Name"]||"Customer"),quantity:quantityValue,source_type:"shopify_wizard",price_basis:"ex_vat",display_vat_mode:getVatDisplayMode(),vat_rate:.2,unit_price_ex_vat:unitPriceExValue,discounted_unit_price_ex_vat:discountedUnitPriceExValue,line_total_ex_vat:lineTotalExValue,product_id:productIdValue,product_handle:productHandleValue,Backing:safeTrim(customerData.Backing||primaryDesign.backing||""),marketing_consent:marketingConsent.allowed,marketingConsent:marketingConsent.allowed,"Marketing Consent":marketingConsent.allowed?"true":"false","Marketing Consent Source":marketingConsent.source,"Shopify Marketing Consent":marketingConsent.shopifyMarketing,"Shopify Marketing Allowed":marketingConsent.shopifyAllowed?"true":"false","Shopify Consent ID":marketingConsent.consentId,gclid:safeTrim(customerData.gclid||""),msclkid:safeTrim(customerData.msclkid||""),utm_source:safeTrim(customerData.utm_source||""),utm_medium:safeTrim(customerData.utm_medium||""),utm_campaign:safeTrim(customerData.utm_campaign||""),fbc:safeTrim(metaCapiFields.fbc||""),fbp:safeTrim(metaCapiFields.fbp||""),user_agent:safeTrim(metaCapiFields.user_agent||""),event_source_url:safeTrim(metaCapiFields.event_source_url||""),Firstname:safeTrim(customerData.Firstname),Surname:safeTrim(customerData.Surname),Email:safeTrim(customerData.Email),Phone:safeTrim(customerData["Phone Normalized"]||customerData.Phone),"Product Variant Id":variantIdValue,"Product Id":productIdValue,"Product Handle":productHandleValue,"Proof Mode":"instant","Instant Proof Eligible":!0,"Requires Manual Review":!1,"Design Item Count":designItems.length,"Design Items":JSON.stringify(designItems),"Design Items Object":designItemsObject,"Quantity Value":quantityValue}}function getPrimarySizeSelect(){return logoWizardState.$sizeRowsContainer.length>0?logoWizardState.$sizeRowsContainer.find(".logo-mat-wizard__size-row .cw-product-bundle__variant-select").first():$(".main-product__size-option .cw-product-bundle__variant-select").first()}function getSelectedSizeValue(){const $sizeSelect=getPrimarySizeSelect();return $sizeSelect.length===0?"":safeTrim($sizeSelect.find(".cw-product-bundle__variant-selected .cw-product-bundle__variant-text").text())}function isCustomSizeSelection(){return isCustomSelectionForSizeSelect(getPrimarySizeSelect())}function resolveCurrentVariantId(){const variantRaw=$(".data-variant-selector").text();if(!variantRaw)return"";let variantData=[];try{variantData=JSON.parse(variantRaw)}catch{return""}const selectedOptions=$(".product-set-variant").find("input[type=radio]:checked"),selectedOptionValues=[];selectedOptions.map((i,elm)=>{selectedOptionValues.push($(elm).val())});const currentVariant=variantData.find(variant=>variant.options.every((value,index)=>value===selectedOptionValues[index]));return currentVariant&¤tVariant.id?currentVariant.id:""}function buildCurrentDesignItem(){const $primarySizeSelect=getPrimarySizeSelect(),backingValue=safeTrim($('input[name="select-backing"]:checked').val()),orientationValue=safeTrim($('input[name="select-orientation"]:checked').val()),selectedSizeValue=getSelectedSizeValue(),customWidth=safeTrim($('input[name="width"]').val()),customLength=safeTrim($('input[name="length"]').val()),selectedProductPriceValue=safeTrim($primarySizeSelect.find(".cw-product-bundle__variant-selected .cw-product-bundle__variant-price").first().text()),selectedProductPriceExValue=readExVatPriceFromSizeSelect($primarySizeSelect),selectedSizeOptionVariantId=resolveSizeSelectVariantId($primarySizeSelect),selectedProductQuantityValue=safeTrim($(".main-product__quantity-option").find(".cw-product-bundle__variant-selected").attr("currentqty")),discountPercentageValue=safeTrim($(".main-product__quantity-option").find(".cw-product-bundle__variant-selected .cw-product-bundle__variant-save-percentage").text()),totalPriceValue=safeTrim($(".main-product__quantity-option").find(".cw-product-bundle__variant-selected .cw-product-bundle__variant-price").text()),selectedColorValue=safeTrim($(".main-product__color-option").find('input[name="color-swatch"]:checked').val()),selectedBgColorValue=safeTrim($(".main-product__color-option").find('input[name="background-color-swatch"]:checked').attr("data-color-name")),bespokeOptionValue=safeTrim($('input[name="bespoke-option"]:checked').val()),uploadedFileUrlInput=$(".main-product__uploaded-file-url"),imagePreviewElement=$(".main-product__upload-preview img");let imageUrl="";uploadedFileUrlInput.length>0&&safeTrim(uploadedFileUrlInput.val())?imageUrl=safeTrim(uploadedFileUrlInput.val()):imagePreviewElement.length>0&&(imageUrl=safeTrim(imagePreviewElement.attr("src")));let backgroundColorValue="";if(bespokeOptionValue==="yes"&&(backgroundColorValue=safeTrim($("#color-option-input").val())),!backgroundColorValue){var manualColourValue=safeTrim($("#backgroundManualColour").val());manualColourValue&&(backgroundColorValue=manualColourValue)}if(!backgroundColorValue){var $checkedSwatch=$('input[name="background-color-swatch"]:checked').first();if($checkedSwatch.length>0){var dataName=safeTrim($checkedSwatch.attr("data-color-name")),swatchValue=safeTrim($checkedSwatch.val());$checkedSwatch.attr("id")==="background-custom-colour"?backgroundColorValue=swatchValue||dataName:backgroundColorValue=dataName||swatchValue}}if(!backgroundColorValue){var $firstSwatch=$('input[name="background-color-swatch"]').first();$firstSwatch.length>0&&(backgroundColorValue=safeTrim($firstSwatch.attr("data-color-name"))||safeTrim($firstSwatch.val())||"")}var $wizardRoot=$(".main-product__customise-selection").first(),productId=safeTrim($wizardRoot.attr("data-product-id")||""),productHandle=safeTrim($wizardRoot.attr("data-product-handle")||"");return{location:backingValue,orientation:orientationValue,size:selectedSizeValue,customWidth:isCustomSizeSelectedOnSizeSelect($primarySizeSelect)?customWidth:"",customLength:isCustomSizeSelectedOnSizeSelect($primarySizeSelect)?customLength:"",productPrice:selectedProductPriceValue,productPriceEx:selectedProductPriceExValue,quantity:selectedProductQuantityValue,discountPercentage:discountPercentageValue,totalPrice:totalPriceValue,color:selectedColorValue,backgroundColor:backgroundColorValue,bespokeColor:bespokeOptionValue,imageUrl,productVariantId:selectedSizeOptionVariantId||resolveCurrentVariantId(),productId,productHandle}}function isSizePlaceholderValue(sizeValue){const normalizedValue=safeTrim(sizeValue).toLowerCase();return!normalizedValue||normalizedValue==="select size"||normalizedValue==="select an option"}function getCurrentSizeSelectionData(){const $sizeSelect=getPrimarySizeSelect();if($sizeSelect.length===0)return null;const selectedSizeValue=safeTrim($sizeSelect.find(".cw-product-bundle__variant-selected .cw-product-bundle__variant-text").text());if(isSizePlaceholderValue(selectedSizeValue))return null;const selectedProductPriceValue=safeTrim($sizeSelect.find(".cw-product-bundle__variant-selected .cw-product-bundle__variant-price").first().text()),selectedProductPriceExValue=readExVatPriceFromSizeSelect($sizeSelect),selectedVariantId=resolveSizeSelectVariantId($sizeSelect),isCu
1stomSize=isCustomSizeSelectedOnSizeSelect($sizeSelect);return{size:selectedSizeValue,customWidth:isCustomSize?safeTrim($('input[name="width"]').val()):"",customLength:isCustomSize?safeTrim($('input[name="length"]').val()):"",productPrice:selectedProductPriceValue,productPriceEx:selectedProductPriceExValue,productVariantId:selectedVariantId||resolveCurrentVariantId()}}function getSelectedSizeDataList(){const selections=[],$rows=logoWizardState.$sizeRowsContainer.length>0?logoWizardState.$sizeRowsContainer.children(".logo-mat-wizard__size-row"):$();if($rows.length>0)return $rows.each(function(){const $sizeSelect=$(this).find(".cw-product-bundle__variant-select").first(),selectedSizeValue=safeTrim($sizeSelect.find(".cw-product-bundle__variant-selected .cw-product-bundle__variant-text").text());if(isSizePlaceholderValue(selectedSizeValue))return;const selectedProductPriceValue=safeTrim($sizeSelect.find(".cw-product-bundle__variant-selected .cw-product-bundle__variant-price").first().text()),selectedProductPriceExValue=readExVatPriceFromSizeSelect($sizeSelect),selectedVariantId=resolveSizeSelectVariantId($sizeSelect),isCustomSize=isCustomSizeSelectedOnSizeSelect($sizeSelect);selections.push({size:selectedSizeValue,customWidth:isCustomSize?safeTrim($('input[name="width"]').val()):"",customLength:isCustomSize?safeTrim($('input[name="length"]').val()):"",productPrice:selectedProductPriceValue,productPriceEx:selectedProductPriceExValue,productVariantId:selectedVariantId||resolveCurrentVariantId()})}),selections;const currentSelection=getCurrentSizeSelectionData();return currentSelection?[currentSelection]:[]}function normalizeQuantityValue(value){const parsed=parseInt(value,10);return!Number.isFinite(parsed)||Number.isNaN(parsed)?1:Math.max(parsed,1)}function syncQuantitySelections(sizeCount){const targetCount=Math.max(sizeCount,0),nextSelections=[];for(let index=0;index<targetCount;index+=1){const existingQty=logoWizardState.quantitySelections[index];nextSelections.push(normalizeQuantityValue(existingQty||1))}logoWizardState.quantitySelections=nextSelections}function getQuantityPricingForSize(sizeData,quantity){const qtyValue=normalizeQuantityValue(quantity),basePriceValue=parseCurrencyAmount(sizeData.productPrice),safeBasePriceValue=basePriceValue!==null?basePriceValue:0,tiers=getQuantityDiscountTiers(),discountPercentValue=getDiscountPercentForQty(qtyValue,tiers),discountedUnitValue=roundToTwo(safeBasePriceValue*(1-discountPercentValue/100));return{quantity:qtyValue,discountPercentValue,discountPercentageText:discountPercentValue>0?"Multi-mat discount applied":"",productPriceText:formatMoneyAmount(safeBasePriceValue),totalPriceText:formatMoneyAmount(discountedUnitValue!==null?discountedUnitValue:safeBasePriceValue)}}function renderQuantityRows(){if(!logoWizardState.$quantityList.length)return;const sizeSelections=getSelectedSizeDataList();if(syncQuantitySelections(sizeSelections.length),logoWizardState.$quantityList.empty(),!sizeSelections.length){logoWizardState.$quantityList.append('<p class="logo-mat-wizard__qty-empty">Choose a size first, then set how many mats you need.</p>'),logoWizardState.$volumeInfoBar.length>0&&logoWizardState.$volumeInfoBar.removeClass("is-visible").hide();return}const sizeData=sizeSelections[0],quantityValue=normalizeQuantityValue(logoWizardState.quantitySelections[0]||1),tiers=getQuantityDiscountTiers(),basePriceValue=parseCurrencyAmount(sizeData.productPrice)||0,unitFor=qty=>roundToTwo(basePriceValue*(1-getDiscountPercentForQty(qty,tiers)/100)),unitValue=unitFor(quantityValue),totalValue=roundToTwo(unitValue*quantityValue),sizeLabel=safeTrim(sizeData.customWidth)?`${sizeData.customWidth} \xD7 ${sizeData.customLength} cm`:formatStandardSizeLabel(sizeData.size)||safeTrim(sizeData.size),locationLabel=isMatwellLocationSelected()?"Borderless \xB7 in a recess":"Bordered \xB7 loose lay",matWord=quantityValue===1?"mat":"mats",tickSvg='<svg width="12" height="12" viewBox="0 0 14 14" fill="none" stroke="#fff" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2.5 7.5l3 3 6-7"/></svg>',tiersMarkup=[[1,"1 mat"],[2,"2 mats"],[3,"3 mats"],[4,"4+ mats"]].map(([tierQty,label])=>{const isActive=tierQty===4?quantityValue>=4:quantityValue===tierQty;return` 2 <button type="button" class="lmw-qty__tier${isActive?" is-active":""}" data-lmw-tier="${tierQty}" aria-pressed="${isActive?"true":"false"}">
3 <span class="lmw-qty__tick" aria-hidden="true">${tickSvg}</span> 4 <span class="lmw-qty__tier-label">${label}</span> 5 <span class="lmw-qty__tier-price">${formatMoneyAmount(unitFor(tierQty))}<span>+ VAT each</span></span> 6 </button>`}).join("");if(logoWizardState.$quantityList.append(` 7 <div class="lmw-qty"> 8 <div class="lmw-qty__row logo-mat-wizard__qty-row" data-qty-index="0"> 9 <div class="lmw-qty__what"> 10 <div class="lmw-qty__loc">${escapeHtml(locationLabel)}</div> 11 <div class="lmw-qty__size">${escapeHtml(sizeLabel)}</div> 12 </div> 13 <div class="lmw-qty__stepper"> 14 <button type="button" class="logo-mat-wizard__qty-button" data-action="decrease" aria-label="Decrease quantity">−</button> 15 <span class="lmw-qty__value logo-mat-wizard__qty-value" aria-live="polite">${quantityValue}</span> 16 <button type="button" class="logo-mat-wizard__qty-button" data-action="increase" aria-label="Increase quantity">+</button> 17 </div> 18 <div class="lmw-qty__total"> 19 <div class="lmw-qty__total-label">Total for ${quantityValue} ${matWord}</div> 20 <div class="lmw-qty__total-value">${formatMoneyAmount(totalValue)}<span>+ VAT</span></div> 21 </div> 22 </div> 23 <div class="lmw-qty__tiers" role="group" aria-label="Price per mat by quantity">${tiersMarkup}</div> 24 ${quantityValue>=10?'<div class="lmw-qty__note">Need 10 or more? <button type="button" class="lmw-qty__chat js-ch-chat-open">Chat to us</button> for our best price.</div>':""} 25 </div> 26 `),logoWizardState.$volumeInfoBar.length>0){const defaultVolumeInfoEnabled=safeTrim(logoWizardState.$volumeInfoBar.attr("data-default-enabled")).toLowerCase()==="true";logoWizardState.$volumeInfoBar.toggleClass("is-visible",defaultVolumeInfoEnabled),defaultVolumeInfoEnabled?logoWizardState.$volumeInfoBar.show():logoWizardState.$volumeInfoBar.hide()}}$(document).on("click",".lmw-qty__tier",function(){const tierQty=parseInt($(this).attr("data-lmw-tier"),10);!Number.isFinite(tierQty)||tierQty<1||(logoWizardState.quantitySelections[0]=tierQty,renderQuantityRows(),lmwTrack("lm_qty_change",{lm_qty:tierQty,lm_source:"tier"}))});function setWizardBackButtonMode(mode){if(!logoWizardState.$backButton.length)return;const isStartOver=mode==="start-over";logoWizardState.$backButton.toggleClass("logo-mat-wizard__nav-button--start-over",isStartOver).text(isStartOver?"Start Over":"Back")}function resetWizardForNewSubmission(){logoWizardState.isSubmissionComplete=!1,logoWizardState.returnToIndex=null,setWizardBackButtonMode("back");const $checkoutForm=$(".secure-checkout__form");if($checkoutForm.removeClass("form-submit-success is-submitting"),$checkoutForm.find("input").removeClass("invalid"),$checkoutForm.find(".error-message").hide(),$checkoutForm.find("#firstName, #surname, #email, #company, #phone").val(""),setInstantProofDebugMessage(""),isCheckoutSubmitting=!1,setCheckoutSubmitState(!1),logoWizardState.$sizeRowsContainer.length>0){logoWizardState.$sizeRowsContainer.children(".logo-mat-wizard__size-row").slice(1).remove();const $firstSelect=logoWizardState.$sizeRowsContainer.children(".logo-mat-wizard__size-row").first().find(".cw-product-bundle__variant-select").first();resetSizeSelectToPlaceholder($firstSelect),refreshSizeRowsState()}else resetSizeSelectionToPlaceholder();logoWizardState.quantitySelections=[],logoWizardState.$volumeInfoBar.length>0&&logoWizardState.$volumeInfoBar.removeClass("is-visible").hide(),showWizardStep(0,{skipValidation:!0})}function getQuantityDataForSize(sizeData,index){const quantityValue=logoWizardState.quantitySelections[index]||1,pricing=getQuantityPricingForSize(sizeData,quantityValue),exPricing=getQuantityPricingForSize({...sizeData,productPrice:safeTrim(sizeData.productPriceEx)||sizeData.productPrice},quantityValue);return{quantity:String(pricing.quantity),discountPercentage:pricing.discountPercentageText,totalPrice:pricing.totalPriceText,productPrice:safeTrim(sizeData.productPrice)||pricing.productPriceText,productPriceEx:safeTrim(sizeData.productPriceEx)||exPricing.productPriceText,totalPriceEx:exPricing.totalPriceText}}function buildDesignItemFromBaseAndSize(baseItem,sizeData,quantityData){return!baseItem||!sizeData?baseItem:{...baseItem,size:safeTrim(sizeData.size),customWidth:safeTrim(sizeData.customWidth),customLength:safeTrim(sizeData.customLength),productPrice:safeTrim(quantityData&&quantityData.productPrice||sizeData.productPrice)||baseItem.productPrice,quantity:safeTrim(quantityData&&quantityData.quantity)||safeTrim(baseItem.quantity)||"1",discountPercentage:safeTrim(quantityData&&quantityData.discountPercentage)||safeTrim(baseItem.discountPercentage),totalPrice:safeTrim(quantityData&&quantityData.totalPrice)||safeTrim(baseItem.totalPrice)||safeTrim(quantityData&&quantityData.productPrice||sizeData.productPrice),productPriceEx:safeTrim(quantityData&&quantityData.productPriceEx||sizeData.productPriceEx)||baseItem.productPriceEx,totalPriceEx:safeTrim(quantityData&&quantityData.totalPriceEx
26)||safeTrim(baseItem.totalPriceEx)||safeTrim(quantityData&&quantityData.productPriceEx||sizeData.productPriceEx),productVariantId:sizeData.productVariantId||baseItem.productVariantId}}function getQueuedSizeDesignItems(baseItem){const sizeSelections=getSelectedSizeDataList();return!baseItem||!sizeSelections.length?[]:sizeSelections.map((sizeData,index)=>buildDesignItemFromBaseAndSize(baseItem,sizeData,getQuantityDataForSize(sizeData,index)))}function getWizardSummaryEntries(){const currentItem=buildCurrentDesignItem(),sizeItems=getQueuedSizeDesignItems(currentItem);return sizeItems.length?sizeItems.map((item,index)=>({source:"current",index,item})):isSizePlaceholderValue(currentItem.size)?[]:[{source:"current",index:0,item:currentItem}]}function resetSizeSelectToPlaceholder($sizeSelect){$sizeSelect.length!==0&&($sizeSelect.find(".cw-product-bundle__variant-selected").html('<span class="cw-product-bundle__variant-text">Select Size</span><span class="cw-product-bundle__variant-price"></span>'),$sizeSelect.find('input[type="hidden"]').val(""),$sizeSelect.find(".cw-product-bundle__variant-option").removeClass("active-status"),$sizeSelect.find(".cw-product-bundle__variant-options").hide(),$sizeSelect.removeClass("is-open"),$sizeSelect.removeClass("is-custom-size-selected"),$sizeSelect.removeAttr("data-selected-variant-id"),$sizeSelect.removeAttr("data-selected-option-text"),$sizeSelect.removeAttr("data-selected-option-raw-text"),$sizeSelect.removeAttr("data-selected-is-custom-size"),updateCustomSizeLabels2())}function resetSizeSelectionToPlaceholder(){resetSizeSelectToPlaceholder(getPrimarySizeSelect()),$(".custom-width-input-field").hide(),$('input[name="width"], input[name="length"]').val(""),$(".size-error-message, .size-error-message--max, .size-error-message--required, .size-error-message-length--required, .size-error-message--min").hide()}function refreshSizeRowsState(){if(!logoWizardState.$sizeRowsContainer.length)return;const $sizeRows=logoWizardState.$sizeRowsContainer.children(".logo-mat-wizard__size-row"),canRemoveRows=$sizeRows.length>1;$sizeRows.each(function(){$(this).find(".logo-mat-wizard__size-row-remove").prop("disabled",!canRemoveRows).attr("aria-disabled",canRemoveRows?"false":"true")})}function getDesignItemsForSubmission(){if(!logoWizardState.enabled)return[buildCurrentDesignItem()];const currentItem=buildCurrentDesignItem(),sizeSelections=getSelectedSizeDataList();return sizeSelections.length?sizeSelections.map((sizeData,index)=>buildDesignItemFromBaseAndSize(currentItem,sizeData,getQuantityDataForSize(sizeData,index))):isSizePlaceholderValue(currentItem.size)?[]:[currentItem]}function isDesignStepAvailable($step){return!$step||$step.length===0?!1:$step.hasClass("hex_color_option_wrapper")?$('input[name="bespoke-option"]:checked').val()==="yes":$step.hasClass("color_selection_options_wrapper")?$('input[name="bespoke-option"]:checked').val()!=="yes":!0}function getWizardSteps(){if(!logoWizardState.enabled)return[];const filteredDesignSteps=logoWizardState.$designSteps.filter(function(){return isDesignStepAvailable($(this))}).toArray(),quantitySteps=[],colorSteps=[],nonReorderedSteps=[];filteredDesignSteps.forEach(stepElement=>{const $step=$(stepElement);if($step.find(".main-product__quantity-option").length>0){quantitySteps.push(stepElement);return}if($step.hasClass("color_selection_options_wrapper")||$step.hasClass("hex_color_option_wrapper")){colorSteps.push(stepElement);return}nonReorderedSteps.push(stepElement)});const orientationSteps=[],backingSteps=[],otherNonReorderedSteps=[];nonReorderedSteps.forEach(stepElement=>{const $step=$(stepElement);$step.hasClass("lmw-step-merged")||$step.find(".main-product__orientation-option").length>0&&$step.find(".main-product__size-option").length===0?orientationSteps.push(stepElement):$step.find(".main-product__backing-option").length>0?backingSteps.push(stepElement):otherNonReorderedSteps.push(stepElement)});const orderedNonReorderedSteps=[...backingSteps,...otherNonReorderedSteps],designStepElements=[];let insertedPostSizeSteps=!1;if(orderedNonReorderedSteps.forEach(stepElement=>{designStepElements.push(stepElement),insertedPostSizeSteps||$(stepElement).find(".main-product__size-option").length>0&&(designStepElements.push(...quantitySteps),insertedPostSizeSteps=!0)}),insertedPostSizeSteps||designStepElements.push(...quantitySteps),logoWizardState.$detailsStep.length>0){const detailsStep=logoWizardState.$detailsStep.get(0);
26detailsStep&&designStepElements.push(detailsStep)}return designStepElements}function updateWizardSummary(){if(!logoWizardState.enabled)return;const $panel=logoWizardState.$summaryList;if(!$panel||!$panel.length)return;if(logoWizardState.isSubmissionComplete){$panel.hide();return}$panel.show();const sizeItem=getSelectedSizeDataList()[0],isRecess=isMatwellLocationSelected(),portrait=safeTrim($('input[name="select-orientation"]:checked').val())==="portrait",quantityValue=normalizeQuantityValue(logoWizardState.quantitySelections[0]||1);let sizeLabel="\u2014",totalText="\u2014";if(sizeItem){sizeLabel=safeTrim(sizeItem.customWidth)?`${sizeItem.customWidth} \xD7 ${sizeItem.customLength} cm`:formatStandardSizeLabel(sizeItem.size)||safeTrim(sizeItem.size)||"\u2014";const basePriceValue=parseCurrencyAmount(sizeItem.productPrice)||0,unitValue=roundToTwo(basePriceValue*(1-getDiscountPercentForQty(quantityValue,getQuantityDiscountTiers())/100));totalText=formatMoneyAmount(roundToTwo(unitValue*quantityValue))}const logoUrl=hasUploadedLogo()?safeTrim($(".main-product__uploaded-file-url").val()):"",logoIsPdf=/\.pdf(\?|$)/i.test(logoUrl)||$(".main-product__upload-preview .lmw-upload__pdf").length>0;let logoText="\u2014";logoUrl?logoText=logoIsPdf?"Uploaded (PDF)":"Uploaded":isLogoDeferred()&&(logoText="To follow by email");const rows=[["Location",isRecess?"In a recess":"Loose lay","Edit","location"],["Orientation",portrait?"Portrait":"Landscape","Edit","size"],["Size",sizeLabel,"Edit","size"],["Quantity",String(quantityValue),"Edit","quantity"],["Logo",logoText,"Change logo","upload"]],panelOpen=!!logoWizardState.selectionsOpen;$panel.toggleClass("is-open",panelOpen),$panel.html(` 27 <button type="button" class="lmw-selections__toggle" aria-expanded="${panelOpen?"true":"false"}"> 28 <span class="lmw-selections__head">Your selections</span> 29 <span class="lmw-selections__toggle-total">${escapeHtml(totalText)} <span>+ VAT</span></span> 30 <span class="lmw-selections__chev" aria-hidden="true"></span> 31 </button> 32 <div class="lmw-selections__body"> 33 ${logoUrl&&!logoIsPdf?`<div class="lmw-selections__logo"><img src="${escapeHtml(logoUrl)}" alt="Your uploaded logo"></div>`:""} 34 ${rows.map(([label,value,action,stepType])=>` 35 <div class="lmw-selections__row"> 36 <span class="lmw-selections__k">${escapeHtml(label)}</span> 37 <span class="lmw-selections__v">${escapeHtml(value)}</span> 38 ${action?`<button type="button" class="lmw-selections__edit" data-lmw-edit-step="${stepType}">${escapeHtml(action)}</button>`:'<span class="lmw-selections__edit lmw-selections__edit--none" aria-hidden="true"></span>'} 39 </div>`).join("")} 40 <div class="lmw-selections__total"> 41 <span class="lmw-selections__k">Total</span> 42 <span class="lmw-selections__total-value">${escapeHtml(totalText)} <span>+ VAT</span></span> 43 </div> 44 </div> 45 `)}$(document).on("click",".lmw-selections__toggle",function(){const $panel=$(this).closest(".lmw-selections");logoWizardState.selectionsOpen=!$panel.hasClass("is-open"),$panel.toggleClass("is-open",logoWizardState.selectionsOpen),$(this).attr("aria-expanded",logoWizardState.selectionsOpen?"true":"false")});function getCustomSizeLimits(){const recess=isMatwellLocationSelected();return{recess,minW:40,minL:40,maxW:recess?195-MATWELL_TRIM_ALLOWANCE_CM:200,maxL:650}}function getCustomSizeError(widthValue,lengthValue){if(!(widthValue>0)||!(lengthValue>0))return"";const lim=getCustomSizeLimits();return widthValue<lim.minW||lengthValue<lim.minL?"Minimum size is 40cm on each side.":widthValue>lim.maxW?lim.recess?`Maximum width for a recess mat is ${lim.maxW}cm \u2014 chat to us for wider mats.`:`Maximum width is ${lim.maxW}cm \u2014 chat to us for wider mats.`:lengthValue>lim.maxL?`Maximum length is ${lim.maxL}cm \u2014 chat to us for longer runs.`:""}function setCustomSizeError(message){const $error=$("[data-lmw-custom-error]");$error.length&&($error.text(message||""),$error.toggle(!!message))}function validateCustomSizeStep(){if(!getSelectedSizeDataList().some(item=>{const sizeLabel=safeTrim(item.size).toLowerCase();return sizeLabel.indexOf("custom")>-1||sizeLabel.indexOf("bespoke")>-1}))return setCustomSizeError(""),!0;const widthValue=parseFloat($('input[name="width"]').val()),lengthValue=parseFloat($('input[name="length"]').val());let message=getCustomSizeError(widthValue,lengthValue);return!message&&(!(widthValue>0)||!(lengthValue>0))&&(message="Enter both measurements to continue."),setCustomSizeError(message),!message}function hasUploadedLogo(){return safeTrim($(".main-product__uploaded-file-url").val()).length>0}function isLogoDeferred(){return safeTrim($(".main-product__logo-deferred").val())==="1"}function syncUploadStepGate(){if(!logoWizardState.enabled||!logoWizardState.$nextButton)return;const allSteps=getWizardSteps(),$activeStep=$(allSteps[logoWizardState.currentStepIndex]),onUploadStep=$activeStep.find(".main-product__upload-option").length>0,awaitingLogo=onUploadStep&&!hasUploadedLogo()&&!isLogoDeferred();logoWizardState.$nextButton.toggleClass("logo-mat-wizard__nav-button--awaiting-logo",awaitingLogo),awaitingLogo?logoWizardState.$nextButton.attr("aria-disabled","true"):logoWizardState.$nextButton.removeAttr("aria-disabled"),onUploadStep&&logoWizardState.$nextButton.text(awaitingLogo?"Add logo to continue":hasReturnTarget()?"Save & return":"Next"),onUploadStep&&!awaitingLogo&&($activeStep.find(".logo-mat-wizard__step-error").hide().text(""),$activeStep.find(".main-product__upload-option").removeClass("is-error"))}function validateStep(stepElement){const $step=$(stepElement);if($step.length===0)return!0;const $error=$step.find(".logo-mat-wizard__step-error");$error.hide().text("");const revealStepError=function(){$error[0]&&typeof $error[0].scrollIntoView=="function"&&$error[0].scrollIntoView({block:"nearest"})};if($step.find(".main-product__size-option").length>0){if(getSelectedSizeDataList().length===0)return $error.text("Please choose a size before continuing.").show(),revealStepError(),!1;if(!validateCustomSizeStep())return $error.text("Please check your custom dimensions before continuing.").show(),!1}if($step.find(".main-product__quantity-option").length>0){const selectedSizes=getSelectedSizeDataList();if(selectedSizes.length===0)return $error.text("Please choose at least one size before setting quantity.").show(),revealStepError(),!1;if(syncQuantitySelections(selectedSizes.length),logoWizardState.quantitySelections.some(qtyValue=>normalizeQuantityValue(qtyValue)<1))return $error.text("Please choose a valid quantity for each size.").show(),revealStepError(),!1}const $uploadOption=$step.find(".main-product__upload-option");if($uploadOption.length>0&&!hasUploadedLogo()&&!isLogoDeferred())return $error.text($uploadOption.hasClass("is-uploading")?"Your logo is still uploading \u2014 one moment.":"Please upload your logo before continuing.").show(),$uploadOption.hasClass("is-uploading")||$uploadOption.addClass("is-error"),revealStepError(),!1;if($step.hasClass("hex_color_option_wrapper")&&!safeTrim($("#color-option-input").val()))return $error.text("Please enter a bespoke background colour.").show(),revealStepError(),!1;if($step.find('input[name="background-color-swatch"]').length>
450){const selectedBackground=$('input[name="background-color-swatch"]:checked');if(selectedBackground.length>0&&selectedBackground.attr("id")==="background-custom-colour"){const customHexValue=safeTrim($("#backgroundCustomColourHex").val());if(!/^[0-9A-Fa-f]{6}$/.test(customHexValue))return $error.text("Please enter a valid 6-digit hex colour before continuing.").show(),revealStepError(),!1}}return!0}function isForceManualMode(){return safeTrim(logoWizardState.$customiseSelection&&logoWizardState.$customiseSelection.attr("data-force-manual"))==="true"}function renderManualCompletionBand(){if(logoWizardState.$customiseSelection&&logoWizardState.$customiseSelection.addClass("is-manual-complete"),!(!logoWizardState.$bandTitle||logoWizardState.$bandTitle.length===0)){if(logoWizardState.$bandTitle.text("Thanks \u2014 we've got your design"),logoWizardState.$bandSub&&logoWizardState.$bandSub.length>0&&logoWizardState.$bandSub.text("Your request is now with our design team.").show(),logoWizardState.$customiseSelection.find(".logo-mat-wizard__eyebrow-step").hide(),logoWizardState.$progressDots&&logoWizardState.$progressDots.length>0){for(var totalSteps=getWizardSteps().length||0,checkSvg='<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="3.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg>',dotsMarkup="",d=0;d<totalSteps;d++)dotsMarkup+='<span class="logo-mat-wizard__progress-dot is-active is-done" aria-hidden="true">'+checkSvg+"</span>";logoWizardState.$progressDots.html(dotsMarkup)}logoWizardState.$progressBarFill&&logoWizardState.$progressBarFill.length>0&&logoWizardState.$progressBarFill.css("width","100%")}}function showWizardStep(index,options){if(!logoWizardState.enabled)return;const config=options||{},allSteps=getWizardSteps();if(allSteps.length===0)return;let nextIndex=index;if(nextIndex<0&&(nextIndex=0),nextIndex>allSteps.length-1&&(nextIndex=allSteps.length-1),!config.skipValidation){const currentStep=allSteps[logoWizardState.currentStepIndex];if(nextIndex>logoWizardState.currentStepIndex&&!validateStep(currentStep))return}logoWizardState.currentStepIndex=nextIndex,logoWizardState.$designSteps.addClass("logo-mat-wizard__step--inactive"),logoWizardState.$reviewStep.addClass("logo-mat-wizard__step--inactive"),logoWizardState.$detailsStep.addClass("logo-mat-wizard__step--inactive");const activeStep=$(allSteps[logoWizardState.currentStepIndex]);if(activeStep.removeClass("logo-mat-wizard__step--inactive"),logoWizardState.$bandTitle&&logoWizardState.$bandTitle.length>0){const stepMeta=LMW_STEP_META[getWizardStepType(activeStep)];if(stepMeta)logoWizardState.$bandTitle.text(stepMeta[1]),logoWizardState.$bandSub.text(stepMeta[2]).toggle(stepMeta[2].length>0);else{const $activeTitle=activeStep.find(".main-product__select-text").first();logoWizardState.$bandTitle.text($activeTitle.length>0?safeTrim($activeTitle.text()):"");const $activeSub=activeStep.find(".logo-mat-wizard__step-subheading").first(),activeSubText=$activeSub.length>0?safeTrim($activeSub.text()):"";logoWizardState.$bandSub.text(activeSubText).toggle(activeSubText.length>0)}}const isDetailsStep=activeStep.is(logoWizardState.$detailsStep),isLastStep=logoWizardState.currentStepIndex===allSteps.length-1;if(logoWizardState.$backButton.removeClass("logo-mat-wizard__nav-button--hidden"),logoWizardState.isSubmissionComplete?(setWizardBackButtonMode("start-over"),logoWizardState.$backButton.removeClass("logo-mat-wizard__nav-button--invisible")):(setWizardBackButtonMode("back"),logoWizardState.$backButton.toggleClass("logo-mat-wizard__nav-button--invisible",logoWizardState.currentStepIndex===0&&!hasReturnTarget())),isDetailsStep?logoWizardState.$nextButton.addClass("logo-mat-wizard__nav-button--hidden"):(logoWizardState.$nextButton.removeClass("logo-mat-wizard__nav-button--hidden"),logoWizardState.$nextButton.text(hasReturnTarget()?"Save & return":"Next")),isDetailsStep&&!logoWizardState.isSubmissionComplete?(logoWizardState.$customiseSelection.addClass("lmw-details-active"),logoWizardState.$generateProxy.removeClass("logo-mat-wizard__nav-button--hidden")):(logoWizardState.$customiseSelection.removeClass("lmw-details-active"),logoWizardState.$generateProxy.addClass("logo-mat-wizard__nav-button--hidden")),isDetail
45sStep){updateWizardSummary();try{typeof ensureIntlTelInput=="function"&&ensureIntlTelInput()}catch{}}if(logoWizardState.$progressCurrent.text(logoWizardState.currentStepIndex+1),logoWizardState.$progressTotal.text(allSteps.length),logoWizardState.$progressBarFill.length>0){const progressPercent=allSteps.length>1?logoWizardState.currentStepIndex/(allSteps.length-1)*100:allSteps.length===1?100:0;logoWizardState.$progressBarFill.css("width",`${progressPercent}%`)}if(logoWizardState.$progressDots.length>0){const totalSteps=allSteps.length,currentStepIdx=logoWizardState.currentStepIndex,dotsMarkup=Array.from({length:totalSteps},(_,dotIndex)=>{let stateClass="";return dotIndex<currentStepIdx?stateClass=" is-active is-done":dotIndex===currentStepIdx&&(stateClass=" is-active is-current"),`<span class="logo-mat-wizard__progress-dot${stateClass}" aria-hidden="true"></span>`}).join("");logoWizardState.$progressDots.html(dotsMarkup)}const isQuantityStep=activeStep.find(".main-product__quantity-option").length>0;isQuantityStep&&renderQuantityRows(),!isQuantityStep&&logoWizardState.$volumeInfoBar.length>0&&logoWizardState.$volumeInfoBar.removeClass("is-visible").hide(),syncUploadStepGate(),typeof logoWizardState.updateScrollCue=="function"&&requestAnimationFrame(logoWizardState.updateScrollCue)}function initLogoWizard(){const bodyClass=$("body").attr("class")||"";if(!/\bpg-eq-custom-/.test(bodyClass))return;const $customiseSelection=$(".main-product__customise-selection").first(),$checkout=$("#secure-checkout");if($customiseSelection.length===0||$checkout.length===0)return;const $designSteps=$customiseSelection.children(".main-product__customise-wrapper").not(".logo-mat-wizard__review-step, .logo-mat-wizard__details-step");if($designSteps.length===0)return;logoWizardState.enabled=!0,logoWizardState.$customiseSelection=$customiseSelection,logoWizardState.$designSteps=$designSteps,logoWizardState.$volumeInfoBar=$customiseSelection.children(".volume-info-bar"),logoWizardState.$customiseSelection.addClass("logo-mat-wizard is-wizard-ready lmw-v3"),$(".main-product__right").addClass("logo-mat-wizard-ready"),logoWizardState.$designSteps.addClass("logo-mat-wizard__step"),(function(){const $orientationStep=logoWizardState.$designSteps.filter(function(){return $(this).find(".main-product__orientation-option").length>0}).first(),$sizeStepEl=logoWizardState.$designSteps.filter(function(){return $(this).find(".main-product__size-option").length>0}).first();if(!$orientationStep.length||!$sizeStepEl.length)return;const $orientationOption=$orientationStep.find(".main-product__orientation-option").first(),$sizeBlock=$sizeStepEl.find(".main-product__select-block").first();if(!$orientationOption.length||!$sizeBlock.length)return;const $wrap=$('<div class="lmw-orientation"><p class="lmw-block-label">1. Which way round?</p></div>');$wrap.append($orientationOption),$sizeBlock.prepend($wrap),$orientationStep.addClass("lmw-step-merged")})(),(function(){const copy={"location-option-1":["Loose lay","Sits on top of your floor with a rubber border."],"location-option-2":["In a recess (matwell)","Sits inside a matwell, without a rubber border."]};Object.keys(copy).forEach(function(id){const $spans=$("#"+id).siblings("label").find(".main-product__select-option-text span");$spans.length>=1&&$spans.eq(0).text(copy[id][0]),$spans.length>=2&&$spans.eq(1).text(copy[id][1])})})();const wizardHelpHeading=safeTrim(logoWizardState.$customiseSelection.attr("data-wizard-help-heading")),wizardHelpText=safeTrim(logoWizardState.$customiseSelection.attr("data-wizard-help-text")),wizardHelpPhone=safeTrim(logoWizardState.$customiseSelection.attr("data-wizard-help-phone")),wizardHelpEmail=safeTrim(logoWizardState.$customiseSelection.attr("data-wizard-help-email")),wizardHelpPhoneHref=wizardHelpPhone.replace(/[^0-9+]/g,""),wizardHelpEmailResolved=wizardHelpEmail||"[email protected]",wizardHelpPhoneResolved=wizardHelpPhone||"0121 702 1659",wizardHelpPhoneHrefResolved=wizardHelpPhoneHref||"+441217021659",wizardWhatsAppNumber=(function(){let digits=wizardHelpPhoneHrefResolved.replace(/[^0-9]/g,"");
45return digits.indexOf("0")===0&&(digits="44"+digits.slice(1)),digits||"441217021659"})(),$quantityStep=logoWizardState.$designSteps.filter(function(){return $(this).find(".main-product__quantity-option").length>0}).first();if(logoWizardState.$quantityStep=$quantityStep,logoWizardState.$volumeInfoBar.length>0&&$quantityStep.length>0&&($quantityStep.find(".main-product__select-block").first().append(logoWizardState.$volumeInfoBar.addClass("logo-mat-wizard__volume-info")),logoWizardState.$volumeInfoBar.hide()),$quantityStep.length>0){const $quantityHeading=$quantityStep.find(".main-product__select-heading").first();if($quantityHeading.length>0){const $quantityHeadingText=$quantityHeading.find(".main-product__select-text").first();$quantityHeadingText.length>0&&$quantityHeadingText.text("Select Quantity");let $quantitySubheading=$quantityHeading.find(".logo-mat-wizard__step-subheading").first();$quantitySubheading.length===0&&($quantitySubheading=$('<p class="logo-mat-wizard__step-subheading"></p>'),$quantityHeading.append($quantitySubheading)),$quantitySubheading.parent().hasClass("logo-mat-wizard__heading-row")&&$quantityHeading.append($quantitySubheading),$quantitySubheading.text("Choose how many mats you need.")}const $quantityBlock=$quantityStep.find(".main-product__select-block").first();$quantityBlock.find(".logo-mat-wizard__quantity-list").length===0&&$quantityBlock.prepend('<div class="logo-mat-wizard__quantity-list" aria-live="polite"></div>'),logoWizardState.$quantityList=$quantityBlock.find(".logo-mat-wizard__quantity-list").first(),$quantityStep.find(".main-product__quantity-option, .custom-width-input-field--qty").hide(),$quantityStep.on("click",".logo-mat-wizard__qty-button",function(){const rowIndex=parseInt($(this).closest(".logo-mat-wizard__qty-row").attr("data-qty-index")||"-1",10);if(Number.isNaN(rowIndex)||rowIndex<0)return;const action=safeTrim($(this).attr("data-action")).toLowerCase(),currentQty=normalizeQuantityValue(logoWizardState.quantitySelections[rowIndex]||1);logoWizardState.quantitySelections[rowIndex]=action==="decrease"?Math.max(currentQty-1,1):currentQty+1,renderQuantityRows(),lmwTrack("lm_qty_change",{lm_qty:logoWizardState.quantitySelections[rowIndex],lm_source:"stepper"})})}logoWizardState.$designSteps.each(function(){$(this).find(".logo-mat-wizard__step-error").length===0&&$(this).find(".main-product__customise-block").first().append('<p class="logo-mat-wizard__step-error" style="display:none;"></p>')});const $sizeStep=logoWizardState.$designSteps.filter(function(){return $(this).find(".main-product__size-option").length>0}).first();if(logoWizardState.$sizeStep=$sizeStep,$sizeStep.length>0){const $sizeOption=$sizeStep.find(".main-product__size-option").first(),removeButtonMarkup=` 46 <button type="button" class="logo-mat-wizard__size-row-remove" aria-label="Remove size"> 47 <svg viewBox="0 0 24 24" aria-hidden="true"> 48 <path d="M9 3h6l1 2h4v2H4V5h4l1-2zm-1 6h2v9H8V9zm4 0h2v9h-2V9zm4 0h2v9h-2V9zM6 20h12l1-12H5l1 12z"></path> 49 </svg> 50 </button> 51 `;let $sizeRows=$sizeOption.children(".logo-mat-wizard__size-rows").first();if($sizeRows.length===0){$sizeRows=$('<div class="logo-mat-wizard__size-rows"></div>');const $initialSelect=$sizeOption.children(".cw-product-bundle__variant-select").first().addBack().filter(".cw-product-bundle__variant-select").first();if($initialSelect.length>0){const $firstRow=$('<div class="logo-mat-wizard__size-row"></div>');$firstRow.append($initialSelect),$firstRow.append($(removeButtonMarkup)),$sizeRows.append($firstRow)}$sizeOption.prepend($sizeRows)}else $sizeRows.children(".logo-mat-wizard__size-row").each(function(){$(this).find(".logo-mat-wizard__size-row-remove").length===0&&$(this).append($(removeButtonMarkup))});logoWizardState.$sizeRowsContainer=$sizeRows,$sizeOption.on("click",".logo-mat-wizard__size-row-remove",function(){const $sizeRow=$(this).closest(".logo-mat-wizard__size-row");logoWizardState.$sizeRowsContainer.children(".logo-mat-wizard__size-row").length<=1?resetSizeSelectToPlaceholder($sizeRow.find(".cw-product-bundle__variant-select").first()):$sizeRow.remove(),refreshSizeRowsState(),showWizardStep(logoWizardState.currentStepIndex,{skipValidation:!0}
51)}),refreshSizeRowsState()}logoWizardState.$customiseSelection.find(".main-product__checkout").addClass("logo-mat-wizard__legacy-cta");const wizardLogoUrl=safeTrim(logoWizardState.$customiseSelection.attr("data-wizard-logo")),wizardLogoMarkup=wizardLogoUrl?`<img class="logo-mat-wizard__band-logo" src="${escapeHtml(wizardLogoUrl)}" alt="First Mats" width="372" height="68" decoding="async">`:'<span class="logo-mat-wizard__band-logo logo-mat-wizard__band-logo--text">First Mats</span>',$wizardBand=$(` 52 <div class="logo-mat-wizard__band"> 53 <div class="logo-mat-wizard__band-top"> 54 ${wizardLogoMarkup} 55 <div class="logo-mat-wizard__help"> 56 <button type="button" class="logo-mat-wizard__help-pill" aria-haspopup="true" aria-expanded="false"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a8 8 0 0 1-11.6 7.2L4 21l1.8-4.6A8 8 0 1 1 21 12z"/></svg><span>Need a hand?</span></button> 57 <div class="logo-mat-wizard__help-menu" hidden> 58 <a class="logo-mat-wizard__help-item" data-help-channel="whatsapp" href="https://wa.me/${wizardWhatsAppNumber}" target="_blank" rel="noopener"> 59 <span class="logo-mat-wizard__help-icon logo-mat-wizard__help-icon--whatsapp"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a8 8 0 0 1-11.6 7.2L4 21l1.8-4.6A8 8 0 1 1 21 12z"/></svg></span> 60 <span class="logo-mat-wizard__help-text">WhatsApp us<span class="logo-mat-wizard__help-sub">Fastest reply, 9\u20135 Mon\u2013Fri</span></span> 61 </a> 62 <a class="logo-mat-wizard__help-item" data-help-channel="call" href="tel:${escapeHtml(wizardHelpPhoneHrefResolved)}"> 63 <span class="logo-mat-wizard__help-icon logo-mat-wizard__help-icon--call"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3.1 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.2 2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1 1 .4 1.9.7 2.8a2 2 0 0 1-.5 2.1L8 9.9a16 16 0 0 0 6 6l1.3-1.3a2 2 0 0 1 2.1-.4c.9.3 1.8.6 2.8.7a2 2 0 0 1 1.8 2z"/></svg></span> 64 <span class="logo-mat-wizard__help-text">Call us<span class="logo-mat-wizard__help-sub">${escapeHtml(wizardHelpPhoneResolved)}</span></span> 65 </a> 66 <a class="logo-mat-wizard__help-item" data-help-channel="email" href="mailto:${escapeHtml(wizardHelpEmailResolved)}"> 67 <span class="logo-mat-wizard__help-icon logo-mat-wizard__help-icon--email"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#173729" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2" y="4" width="20" height="16" rx="2"/><path d="m2 7 10 7 10-7"/></svg></span> 68 <span class="logo-mat-wizard__help-text">Email us<span class="logo-mat-wizard__help-sub">${escapeHtml(wizardHelpEmailResolved)}</span></span> 69 </a> 70 </div> 71 </div> 72 </div> 73 <div class="logo-mat-wizard__eyebrow"> 74 <span class="logo-mat-wizard__eyebrow-step" aria-live="polite">Step <strong class="logo-mat-wizard__progress-current">1</strong> of <strong class="logo-mat-wizard__progress-total">5</strong></span> 75 </div> 76 <h2 class="logo-mat-wizard__band-title"></h2> 77 <p class="logo-mat-wizard__band-sub"></p> 78 <div class="logo-mat-wizard__progress-bar" aria-hidden="true"> 79 <span class="logo-mat-wizard__progress-bar-fill"></span> 80 <div class="logo-mat-wizard__progress-dots"></div> 81 </div> 82 </div> 83 `);logoWizardState.$customiseSelection.prepend($wizardBand),logoWizardState.$band=$wizardBand,logoWizardState.$helpMenu=$wizardBand.find(".logo-mat-wizard__help-menu");function buildHelpMessage(){const isRecess=isMatwellLocationSelected(),orientation=safeTrim($('input[name="select-orientation"]:checked').val())==="portrait"?"Portrait":"Landscape",sizeItem=getSelectedSizeDataList()[0];let sizeText="not chosen yet";sizeItem&&(sizeText=safeTrim(sizeItem.customWidth)?`${sizeItem.customWidth} \xD7 ${sizeItem.customLength} cm`:safeTrim(sizeItem.size));
83const qty=normalizeQuantityValue(logoWizardState.quantitySelections[0]||1);let logoText="not yet";if(hasUploadedLogo()){const fileInput=document.querySelector(".main-product__upload-file-input"),fileName=fileInput&&fileInput.files&&fileInput.files[0]?fileInput.files[0].name:"";logoText=fileName?`uploaded (${fileName})`:"uploaded"}return["Hi First Mats, I need a hand with a logo mat.",`Location: ${isRecess?"In a recess":"Loose lay"}`,`Orientation: ${orientation}`,`Size: ${sizeText}`,`Quantity: ${qty}`,`Logo: ${logoText}`].join(` 84`)}function setHelpMenuOpen(open){logoWizardState.$helpMenu.prop("hidden",!open),$wizardBand.find(".logo-mat-wizard__help-pill").attr("aria-expanded",open?"true":"false")}$wizardBand.on("click",".logo-mat-wizard__help-pill",function(){const willOpen=logoWizardState.$helpMenu.prop("hidden");if(willOpen){const message=buildHelpMessage();logoWizardState.$helpMenu.find('[data-help-channel="whatsapp"]').attr("href",`https://wa.me/${wizardWhatsAppNumber}?text=${encodeURIComponent(message)}`),logoWizardState.$helpMenu.find('[data-help-channel="email"]').attr("href",`mailto:${wizardHelpEmailResolved}?subject=${encodeURIComponent("Logo mat enquiry")}&body=${encodeURIComponent(message)}`)}setHelpMenuOpen(willOpen),willOpen&&lmwTrack("lm_help_open")}),$wizardBand.on("click",".logo-mat-wizard__help-item",function(){lmwTrack("lm_help_channel",{lm_channel:safeTrim($(this).attr("data-help-channel"))})}),$(document).on("pointerdown",function(e){logoWizardState.$helpMenu.prop("hidden")||$(e.target).closest(".logo-mat-wizard__help").length===0&&setHelpMenuOpen(!1)}),logoWizardState.$progressCurrent=$wizardBand.find(".logo-mat-wizard__progress-current"),logoWizardState.$progressTotal=$wizardBand.find(".logo-mat-wizard__progress-total"),logoWizardState.$progressBarFill=$wizardBand.find(".logo-mat-wizard__progress-bar-fill"),logoWizardState.$progressDots=$wizardBand.find(".logo-mat-wizard__progress-dots"),logoWizardState.$bandTitle=$wizardBand.find(".logo-mat-wizard__band-title"),logoWizardState.$bandSub=$wizardBand.find(".logo-mat-wizard__band-sub");const detailsHeading=safeTrim(logoWizardState.$customiseSelection.attr("data-wizard-details-heading"))||"Where shall we send your free design?",detailsSubheading=safeTrim(logoWizardState.$customiseSelection.attr("data-wizard-details-subheading")),detailsTooltip=safeTrim(logoWizardState.$customiseSelection.attr("data-wizard-details-tooltip")),detailsTooltipMarkup=detailsTooltip?`<button type="button" class="logo-mat-wizard__heading-tooltip" title="${escapeHtml(detailsTooltip)}" aria-label="${escapeHtml(detailsTooltip)}">?</button>`:"",detailsSubheadingMarkup=detailsSubheading?`<p class="logo-mat-wizard__step-subheading">${escapeHtml(detailsSubheading)}</p>`:"",$detailsStep=$(` 85 <div class="main-product__customise-wrapper logo-mat-wizard__details-step logo-mat-wizard__step"> 86 <div class="main-product__customise-block"> 87 <div class="main-product__select-heading"> 88 <span class="main-product__select-count"></span> 89 <div class="logo-mat-wizard__heading-row"> 90 <span class="main-product__select-text">${escapeHtml(detailsHeading)}</span> 91 ${detailsTooltipMarkup} 92 </div> 93 ${detailsSubheadingMarkup} 94 </div> 95 <div class="main-product__select-block"> 96 <div class="logo-mat-wizard__checkout-slot"></div> 97 </div> 98 </div> 99 </div> 100 `);logoWizardState.$customiseSelection.append($detailsStep),logoWizardState.$reviewStep=$(),logoWizardState.$detailsStep=$detailsStep,logoWizardState.$summaryList=$(),logoWizardState.$summaryHelpText=$(),logoWizardState.$continueDetailsButton=$(),$checkout.appendTo($detailsStep.find(".logo-mat-wizard__checkout-slot")).addClass("logo-mat-wizard__inline-checkout").show();const $wizardCheckoutForm=$detailsStep.find(".secure-checkout__form").first();if($wizardCheckoutForm.length>0){$wizardCheckoutForm.find(".secure-checkout__title").text(detailsHeading||"Enter Details"),$wizardCheckoutForm.find(".secure-checkout__information p").text(detailsSubheading||"Enter your contact details so we can send you over your proof");const $wizardFillData=$wizardCheckoutForm.find(".secure-checkout__fill-data").first(),$firstNameField=$wizardCheckoutForm.find("#firstName").closest(".secure-checkout__field"),$surnameField=$wizardCheckoutForm.find("#surname").closest(".secure-checkout__field"),$emailField=$wizardCheckoutForm.find("#email").closest(".secure-checkout__field"),$companyField=$wizardCheckoutForm.find("#company").closest(".secure-checkout__field"),$phoneField=$wizardCheckoutForm.find("#phone").closest(".secure-checkout__field");$wizardFillData.length>0&&$wizardFillData.append($firstNameField,$surnameField,$emailField,$ph
100oneField,$companyField),$firstNameField.add($surnameField).removeClass("secure-checkout__full").addClass("secure-checkout__half"),$emailField.add($phoneField).add($companyField).removeClass("secure-checkout__half").addClass("secure-checkout__full"),$firstNameField.find(".secure-checkout__label").text("First name"),$surnameField.find(".secure-checkout__label").text("Last name"),$emailField.find(".secure-checkout__label").text("Email"),$phoneField.find(".secure-checkout__label").text("Phone"),$companyField.find(".secure-checkout__label").text("Company"),$wizardCheckoutForm.find("#firstName, #surname, #email, #company, #phone").attr("placeholder",""),$wizardCheckoutForm.find(".secure-checkout__button").text("Generate my instant proof"),$wizardFillData.length>0&&$wizardCheckoutForm.find(".lmw-proof-callout").length===0&&$wizardFillData.after(` 101 <div class="lmw-proof-callout"> 102 <span class="lmw-proof-callout__icon" aria-hidden="true"><svg width="14" height="14" viewBox="0 0 24 24" fill="#173729"><path d="M13 2 4 14h7l-1 8 9-12h-7z"/></svg></span> 103 <span class="lmw-proof-callout__text"> 104 <span class="lmw-proof-callout__title">Your proof is generated instantly after you submit.</span> 105 <span class="lmw-proof-callout__sub">Edit and finalise your design on the next page.</span> 106 </span> 107 </div> 108 `)}const $selectionsPanel=$('<aside class="lmw-selections" aria-label="Your selections"></aside>');$detailsStep.find(".main-product__select-block").first().append($selectionsPanel),logoWizardState.$summaryList=$selectionsPanel;const $wizardNav=$(` 109 <div class="logo-mat-wizard__navigation"> 110 <button type="button" class="logo-mat-wizard__nav-button logo-mat-wizard__nav-button--back">Back</button> 111 <button type="button" class="logo-mat-wizard__nav-button logo-mat-wizard__nav-button--next">Next</button> 112 <button type="button" class="logo-mat-wizard__nav-button logo-mat-wizard__nav-button--generate logo-mat-wizard__nav-button--hidden">Generate my instant proof</button> 113 </div> 114 `);logoWizardState.$customiseSelection.append($wizardNav),logoWizardState.$wizardNav=$wizardNav;const $scrollRail=$('<div class="lmw-scroll-rail" aria-hidden="true" hidden><div class="lmw-scroll-rail__thumb"></div></div>'),$scrollFade=$('<div class="lmw-scroll-fade" aria-hidden="true" hidden></div>');logoWizardState.$customiseSelection.append($scrollRail,$scrollFade);function updateScrollCue(){const card=logoWizardState.$customiseSelection[0];if(!card||!card.classList.contains("is-lmw-modal")){$scrollRail.prop("hidden",!0),$scrollFade.prop("hidden",!0);return}const stepEl=card.querySelector(".logo-mat-wizard__step:not(.logo-mat-wizard__step--inactive)");if(!stepEl){$scrollRail.prop("hidden",!0),$scrollFade.prop("hidden",!0);return}const maxScroll=stepEl.scrollHeight-stepEl.clientHeight;if(maxScroll<8){$scrollRail.prop("hidden",!0),$scrollFade.prop("hidden",!0);return}const cardRect=card.getBoundingClientRect(),stepRect=stepEl.getBoundingClientRect(),railTop=stepRect.top-cardRect.top+6,railHeight=Math.max(0,stepRect.height-12),thumbHeight=Math.max(28,railHeight*(stepEl.clientHeight/stepEl.scrollHeight)),progress=Math.min(1,Math.max(0,stepEl.scrollTop/maxScroll)),thumbTop=(railHeight-thumbHeight)*progress;$scrollRail.prop("hidden",!1).css({top:railTop+"px",height:railHeight+"px"}),$scrollRail.find(".lmw-scroll-rail__thumb").css({height:thumbHeight+"px",transform:`translateY(${thumbTop}px)`});const atEnd=progress>.98;$scrollFade.prop("hidden",atEnd).css({bottom:cardRect.bottom-stepRect.bottom+"px"})}logoWizardState.updateScrollCue=updateScrollCue,logoWizardState.$customiseSelection[0].addEventListener("scroll",updateScrollCue,!0),$(window).on("resize orientationchange",updateScrollCue),setInterval(updateScrollCue,400),logoWizardState.$backButton=$wizardNav.find(".logo-mat-wizard__nav-button--back"),logoWizardState.$nextButton=$wizardNav.find(".logo-mat-wizard__nav-button--next"),logoWizardState.$generateProxy=$wizardNav.find(".logo-mat-wizard__nav-button--generate"),logoWizardState.$generateProxy.on("click",function(){$(".secure-checkout__form .secure-checkout__button").first().trigger("click")}),logoWizardState.$nextButton.on("click",function(){const currentStep=getWizardSteps()[logoWizardState.currentStepIndex];if(!validateStep(currentStep))return;const target=hasReturnTarget()?logoWizardState.returnToIndex:logoWizardState.currentStepIndex+1;logoWizardState.returnToIndex=null,showWizardStep(target,{skipValidation:!0}
114)}),logoWizardState.$backButton.on("click",function(){if(logoWizardState.isSubmissionComplete){resetWizardForNewSubmission();return}const target=hasReturnTarget()?logoWizardState.returnToIndex:logoWizardState.currentStepIndex-1;logoWizardState.returnToIndex=null,showWizardStep(target,{skipValidation:!0})}),logoWizardState.$customiseSelection.on("click","[data-lmw-edit-step]",function(e){e.preventDefault();const wantedType=safeTrim($(this).attr("data-lmw-edit-step")),allSteps=getWizardSteps();let targetIndex=-1,detailsIndex=-1;allSteps.forEach(function(stepEl,index){const type=getWizardStepType($(stepEl));type===wantedType&&targetIndex===-1&&(targetIndex=index),type==="details"&&(detailsIndex=index)}),!(targetIndex===-1||detailsIndex===-1)&&(lmwTrack("lm_summary_edit",{lm_edit_step:wantedType}),logoWizardState.returnToIndex=detailsIndex,showWizardStep(targetIndex,{skipValidation:!0}))});function updateGenerateButtonState(){var $btn=$(".secure-checkout__form .secure-checkout__button");if($btn.length){var firstName=safeTrim($("#firstName").val()),surname=safeTrim($("#surname").val()),company=safeTrim($("#company").val()),email=safeTrim($("#email").val()),phone=safeTrim($("#phone").val()),emailOk=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email),complete=!!(firstName&&surname&&company&&emailOk&&phone);$btn.toggleClass("logo-mat-wizard__gen-incomplete",!complete),logoWizardState.$generateProxy.toggleClass("logo-mat-wizard__gen-incomplete",!complete)}}$(document).on("input change","#firstName, #surname, #company, #email, #phone",updateGenerateButtonState),updateGenerateButtonState(),$(document).on("input change",".main-product__uploaded-file-url",syncUploadStepGate),$(document).on("change",".main-product__upload-file-input",function(){let attempts=0;const poll=setInterval(function(){attempts++,syncUploadStepGate(),(attempts>=50||hasUploadedLogo())&&clearInterval(poll)},200)}),$(document).on("click",".main-product__upload-remove",function(){setTimeout(syncUploadStepGate,0)}),setInterval(syncUploadStepGate,1e3),$(document).on("click",".js-lm-defer-logo",function(){$(".main-product__logo-deferred").val("1"),$(".main-product__uploaded-logo-source").val("email-later"),$("#statusMessage").text("No problem \u2014 we'll ask for your logo by email after you send the form.").removeClass("is-error is-uploading").addClass("is-success"),$(".lm-upload-rescue").prop("hidden",!0),syncUploadStepGate(),logoWizardState.enabled&&logoWizardState.$nextButton&&logoWizardState.$nextButton.trigger("click")}),$(document).on("change",'input[name="bespoke-option"], input[name="background-color-swatch"], input[name="select-orientation"], input[name="select-backing"], input[name="width"], input[name="length"], #color-option-input, #backgroundCustomColourInput, #backgroundCustomColourHex',function(){logoWizardState.enabled&&showWizardStep(logoWizardState.currentStepIndex,{skipValidation:!0})}),$(document).on("click",".main-product__size-option .cw-product-bundle__variant-option, .main-product__quantity-option .cw-product-bundle__variant-option",function(){logoWizardState.enabled&&showWizardStep(logoWizardState.currentStepIndex,{skipValidation:!0})}),$(document).on("click",".logo-mat-wizard__need-help-btn--email",function(e){const href=this.getAttribute&&this.getAttribute("href")||"";if(href.indexOf("mailto:")===0)try{window.location.href=href}catch{}}),$(document).on("click",".logo-mat-wizard__size-help-toggle",function(){const $toggle=$(this),targetId=safeTrim($toggle.attr("aria-controls"));if(!targetId)return;const $panel=$(`#${targetId}`);if($panel.length===0)return;const isExpanded=$toggle.attr("aria-expanded")==="true";$toggle.attr("aria-expanded",isExpanded?"false":"true"),$panel.prop("hidden",isExpanded)});const $introScreen=logoWizardState.$customiseSelection.find("[data-lmw-intro]").first();if($introScreen.length>0){let closeWizardModal2=function(){if($card.removeClass("is-lmw-modal").removeAttr("role").removeAttr("aria-modal"),$body.removeClass("lmw-modal-open"),$backdrop&&($backdrop.remove(),$backdrop=null),$(document).off("keydown.lmwModal"),$card.addClass("is-intro"),logoWizardState.returnToIndex=null,showWizardStep(0,{skipValidation:!0}
114),lastFocusedEl&&typeof lastFocusedEl.focus=="function")try{lastFocusedEl.focus()}catch{}},openWizardModal2=function(){lastFocusedEl=document.activeElement,$backdrop=$('<div class="lmw-modal-backdrop"></div>').appendTo($body).on("click",closeWizardModal2),$body.addClass("lmw-modal-open"),$card.removeClass("is-intro").addClass("is-lmw-modal").attr({role:"dialog","aria-modal":"true"}),$card.find(".lmw-modal-close").length===0&&$('<button type="button" class="lmw-modal-close" aria-label="Close design tool">×</button>').appendTo($card).on("click",closeWizardModal2),$(document).on("keydown.lmwModal",function(e){(e.key==="Escape"||e.keyCode===27)&&closeWizardModal2()}),showWizardStep(0,{skipValidation:!0}),$card.scrollTop(0)};var closeWizardModal=closeWizardModal2,openWizardModal=openWizardModal2;logoWizardState.$customiseSelection.addClass("is-intro");const $card=logoWizardState.$customiseSelection,$body=$("body");let $backdrop=null,lastFocusedEl=null;logoWizardState.closeWizardModal=closeWizardModal2,$introScreen.on("click","[data-lmw-intro-start]",function(e){e.preventDefault(),openWizardModal2()})}showWizardStep(0,{skipValidation:!0})}let productCusNavSlider=$(".js-product-cus-nav-slider"),productCusThumbSlider=$(".js-product-cus-thumb-slider");productCusNavSlider.length>0&&!productCusNavSlider.hasClass("slick-initialized")&&productCusThumbSlider.length>0&&!productCusThumbSlider.hasClass("slick-initialized")&&(productCusNavSlider.slick({slidesToShow:1,slidesToScroll:1,arrows:!1,dots:!1,fade:!1,infinite:!0,speed:500,asNavFor:".js-product-cus-thumb-slider"}),productCusThumbSlider.slick({slidesToShow:6,slidesToScroll:1,asNavFor:".js-product-cus-nav-slider",arrows:!0,dots:!1,infinite:!0,centerMode:!1,focusOnSelect:!0,variableWidth:!1,prevArrow:'<button type="button" class="prev-arrow" aria-label="Previous slide"><svg width="8" height="14" viewBox="0 0 8 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7 1L1 7L7 13" stroke="#222329" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></button>',nextArrow:'<button type="button" class="next-arrow" aria-label="Next slide"><svg width="8" height="14" viewBox="0 0 8 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 13L7 7L1 1" stroke="#222329" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></button>'})),$(".main-product__quantity-option").find(".cw-product-bundle__variant-option").first().addClass("active-status"),$(".cw-product-bundle__variant-select").each(function(index,currentSelecter){var isSizeDropdown=$(this).closest(".main-product__size-option").length>0;let minPriceOption=null,minPrice=1/0,firstSelectedQty;if($(this).find(".cw-product-bundle__variant-option").each(function(i,optiondata){let optionQty=$(optiondata).attr("data-selected-qty");optionQty&&i==0&&(firstSelectedQty=optionQty,$(".main-product__quantity-option .cw-product-bundle__variant-selected").attr("currentQty",optionQty));const price=parseFloat($(this).data("variant-price")/100)||0;if(price>=59&&price<minPrice&&(minPrice=price,minPriceOption=$(this)),$(optiondata).attr("data-text").toUpperCase().indexOf("CUSTOM")>-1){const $customPriceEl=$(optiondata).find(".cw-product-bundle__option-price");$customPriceEl.hasClass("cw-product-bundle__option-price--custom-cta")||$customPriceEl.hide()}}),minPriceOption&&!isSizeDropdown){const selectedText=minPriceOption.data("text")||"",selectedSavePercentage=minPriceOption.data("save-percentage")||"",selectedPrice=minPriceOption.data("price")||"",selectedVariantPrice=minPriceOption.data("variant-price")||"",selectedValue=minPriceOption.text()||"",selectedHtml=` 115 ${selectedText?`<span class="cw-product-bundle__variant-text" data-variant-price="${selectedVariantPrice}">${selectedText}</span>`:""} 116 ${selectedSavePercentage?`<span class="cw-product-bundle__variant-save-percentage ssss">${selectedSavePercentage}</span>`:""} 117 ${selectedPrice?`<span class="cw-product-bundle__variant-price demo123">${selectedPrice}</span>`:""} 118 `;$(this).find(".cw-product-bundle__variant-selected").html(selectedHtml),$(this).find('input[type="hidden"]').val(selectedValue),OptionsHandler(minPriceOption)}});function decorateSizeOptionsForWizard(){$(".main-product__size-option .cw-product-bundle__variant-option").each(function(){const $option=$(this);if(String($option.attr("data-text")||$option.find(".cw-product-bundle__option-text").text()||"").toLowerCase().indexOf("custom")>-1){$option.addClass("cw-product-bundle__variant-option--custom-size");
118const $priceSlot=$option.find(".cw-product-bundle__option-price").first();$priceSlot.length&&$priceSlot.find(".cw-product-bundle__custom-cta").length===0&&$priceSlot.addClass("cw-product-bundle__option-price--custom-cta").show().html('<span class="cw-product-bundle__custom-cta"><span class="cw-product-bundle__custom-cta-text">Enter size</span><span class="cw-product-bundle__custom-cta-arrow" aria-hidden="true">\u25BE</span></span>')}}),$(".main-product__size-option .cw-product-bundle__variant-options").each(function(){const $list=$(this),$customSizeOption=$list.children(".cw-product-bundle__variant-option--custom-size").first();if($customSizeOption.length){if($customSizeOption.prependTo($list),!$customSizeOption.hasClass("lmw-custom-hero-built")){$customSizeOption.addClass("lmw-custom-hero-built");const $heroLabel=$customSizeOption.find(".cw-product-bundle__option-text").first();$heroLabel.before('<span class="cw-product-bundle__custom-icon" aria-hidden="true"><svg viewBox="0 0 24 24" width="26" height="26" fill="none" stroke="#E9B23C" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><g transform="rotate(-45 12 12)"><rect x="1.5" y="9" width="21" height="6" rx="1.5"/><path d="M6 9v3M10 9v3M14 9v3M18 9v3"/></g></svg></span>'),$heroLabel.wrap('<span class="cw-product-bundle__custom-titlerow"></span>'),$heroLabel.after('<span class="cw-product-bundle__custom-badge">\u2605 Most requested</span>'),$customSizeOption.find(".cw-product-bundle__custom-titlerow").after('<span class="cw-product-bundle__custom-sub">'+escapeHtml(getCustomSizeSubCopy())+"</span>"),$customSizeOption.append('<span class="cw-product-bundle__custom-check" aria-hidden="true"><svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="#ffffff" stroke-width="3.4" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg></span>')}$list.children(".cw-product-bundle__size-divider").length===0&&$customSizeOption.after('<div class="cw-product-bundle__size-divider"><span>Or pick a standard size</span></div>');const $sizeInputs=$customSizeOption.closest(".main-product__customise-wrapper").find(".custom-width-input-field").first();$sizeInputs.length&&$customSizeOption.after($sizeInputs)}if($customSizeOption.length&&$list.children(".lmw-custom-panel").length===0){const $sizeInputsNow=$list.children(".custom-width-input-field").first();if($sizeInputsNow.length){const $panel=$('<div class="lmw-custom-panel"><p class="lmw-block-label">2. Enter your custom size</p><div class="lmw-custom-panel__box"></div></div>');$sizeInputsNow.before($panel),$panel.find(".lmw-custom-panel__box").append($sizeInputsNow),$panel.before('<button type="button" class="lmw-switch-row" data-lmw-switch="custom">Enter a custom size instead<span aria-hidden="true">\u2192</span></button>'),$panel.after('<button type="button" class="lmw-switch-row" data-lmw-switch="standard">Or pick a standard size instead<span aria-hidden="true">\u2192</span></button>')}}relabelStandardSizeOptions($list);const $extras=$list.children(".cw-product-bundle__variant-option--extra");$extras.length>0&&$list.children(".lmw-size-more").length===0&&($list.addClass("is-collapsed"),$list.append('<button type="button" class="lmw-size-more" aria-expanded="false"><span class="lmw-size-more__label">Show '+$extras.length+' more sizes</span><span class="lmw-size-more__arrow" aria-hidden="true">\u2193</span></button>'),$list.data("lmwExtraCount",$extras.length))}),updateCustomSizeLabels2()}function setSizeListCollapsed($list,collapsed){const extraCount=$list.data("lmwExtraCount")||$list.children(".cw-product-bundle__variant-option--extra").length;$list.toggleClass("is-collapsed",collapsed);const $btn=$list.children(".lmw-size-more");$btn.attr("aria-expanded",collapsed?"false":"true"),$btn.find(".lmw-size-more__label").text(collapsed?`Show ${extraCount} more sizes`:"Show fewer sizes"),$btn.find(".lmw-size-more__arrow").text(collapsed?"\u2193":"\u2191")}$(document).on("click",".lmw-size-more",function(e){e.preventDefault(),e.stopPropagation();const $list=$(this).closest(".cw-product-bundle__variant-options"),expanding=$list.hasClass("is-collapsed");setSizeListCollapsed($list,!expanding),expanding&&lmwTrack("lm_size_list_expand")});function formatStandardSizeLabel(dataText){const match=String(dataText||"").match(/(\d+(?:\.\d+)?)\s*(?:cm)?\s*[xÃ]\s*(\d+(?:\.\d+)?)/i);if(!match)return"";const a=parseFloat(match[1]),b=parseFloat(match[2]),portrait=safeTrim($('input[name="select-orientation"]:checked').val())==="portrait",hi=Math.max(a,b),lo=Math.min(a,b);return portrait?`${lo} \xD7 ${hi} cm`:`${hi} \xD7 ${lo} cm`}function relabelStandardSizeOptions($scope){($scope&&$scope.length?$scope:$(".main-product__size-option")).find(".cw-product-bundle__variant-option").not(".cw-product-bundle__variant-option--custom-size").each(function(){const $option=$(this),label=formatStandardSizeLabel($option.attr("data-text"));if(!label)return;const $text=$option.find(".cw-product-bundle__option-text").first();$text.length&&$text.text(label),$option.attr("data-display-text",label)})}function setSizeMode(mode){const $sizeOption=$(".main-product__size-option"),previous=$sizeOption.hasClass("lmw-mode-custom")?"custom"
118:$sizeOption.hasClass("lmw-mode-standard")?"standard":"";$sizeOption.removeClass("lmw-mode-custom lmw-mode-standard").addClass(mode==="custom"?"lmw-mode-custom":mode==="standard"?"lmw-mode-standard":""),mode&&mode!==previous&&lmwTrack("lm_size_mode",{lm_mode:mode})}function ensureCustomSizeActive(){const $hero=$(".main-product__size-option .cw-product-bundle__variant-option--custom-size").first();$hero.length&&!$hero.hasClass("active-status")&&$hero.trigger("click")}function roundToOneDecimal(value){return Math.round(value*10)/10}function drawSizeDiagram(){const $diagram=$("[data-lmw-diagram]");if(!$diagram.length||$diagram.prop("hidden"))return;const widthValue=parseFloat($('input[name="width"]').val()),lengthValue=parseFloat($('input[name="length"]').val()),portrait=safeTrim($('input[name="select-orientation"]:checked').val())==="portrait";let bw=portrait?120:200,bh=portrait?180:128;if(widthValue>0&&lengthValue>0){const ratio=Math.min(4,Math.max(.25,widthValue/lengthValue)),k=Math.min(200/widthValue,180/lengthValue);bw=Math.max(110,Math.min(200,widthValue*k)),bh=Math.max(56,Math.min(180,bw/ratio)),bh>180&&(bh=180,bw=Math.max(110,bh*ratio))}$diagram.find("[data-lmw-diagram-mat]").css({width:Math.round(bw)+"px",height:Math.round(bh)+"px"}).toggleClass("lmw-diagram__mat--borderless",isMatwellLocationSelected()),$diagram.find("[data-lmw-diagram-aline]").css({width:Math.round(bw)+"px"}),$diagram.find(".lmw-diagram__a").css({width:Math.round(bw)+"px"})}function refreshCustomSizeUI(){const $width=$('input[name="width"]'),$length=$('input[name="length"]');if(!$width.length||!$length.length)return;const lim=getCustomSizeLimits();$width.attr("max",lim.maxW),$length.attr("max",lim.maxL);const widthValue=parseFloat($width.val()),lengthValue=parseFloat($length.val()),bothEntered=widthValue>0&&lengthValue>0,error=getCustomSizeError(widthValue,lengthValue);setCustomSizeError(error);const valid=bothEntered&&!error,$calc=$("[data-lmw-custom-calc]");if($calc.length)if(valid){$("[data-lmw-readout-size]").text(`${widthValue} \xD7 ${lengthValue} cm`);const $made=$("[data-lmw-readout-made]");lim.recess?$made.text(`Made ${roundToOneDecimal(widthValue+MATWELL_TRIM_ALLOWANCE_CM)} \xD7 ${roundToOneDecimal(lengthValue+MATWELL_TRIM_ALLOWANCE_CM)} cm so it can be trimmed to fit`).prop("hidden",!1):$made.text("").prop("hidden",!0),$calc.prop("hidden",!1)}else $calc.prop("hidden",!0);const $priceCell=$("[data-lmw-custom-price]");if($priceCell.length){const $priceSrc=$(".main-product__price-value").first(),exPrice=$priceSrc.attr("data-ex-price"),incPrice=$priceSrc.attr("data-inc-price");if(valid&&exPrice&&incPrice){const isInc=window.fmVatMode==="inc";$priceCell.find("[data-lmw-custom-price-value]").attr("data-ex-price",exPrice).attr("data-inc-price",incPrice).text(isInc?incPrice:exPrice),$priceCell.prop("hidden",!1)}else $priceCell.prop("hidden",!0)}drawSizeDiagram()}$(document).on("input",'input[name="width"], input[name="length"]',function(){(safeTrim($('input[name="width"]').val())!==""||safeTrim($('input[name="length"]').val())!=="")&&(ensureCustomSizeActive(),setSizeMode("custom")),refreshCustomSizeUI()}),$(document).on("focusin",'input[name="width"], input[name="length"]',function(){$("[data-lmw-diagram]").prop("hidden",!1),drawSizeDiagram()}),$(document).on("wheel",'input[name="width"], input[name="length"]',function(){this.blur()}),$(document).on("click",".main-product__size-option .cw-product-bundle__variant-option:not(.cw-product-bundle__variant-option--custom-size)",function(){setSizeMode("standard"),$("[data-lmw-diagram]").prop("hidden",!0),refreshCustomSizeUI()}),$(document).on("click",".main-product__size-option .cw-product-bundle__variant-option--extra",function(){setSizeListCollapsed($(this).closest(".cw-product-bundle__variant-options"),!1)}),$(document).on("click",".lmw-switch-row",function(){const target=safeTrim($(this).attr("data-lmw-switch"));resetSizeSelectToPlaceholder(getPrimarySizeSelect()),$('input[name="width"], input[name="length"]').val(""),$(".main-product__size-option .cw-product-bundle__variant-price").show(),setSizeMode(""),$("[data-lmw-diagram]").prop("hidden",!0),refreshCustomSizeUI(),logoWizardState.enabled&&showWizardStep(logoWizardState.currentStepIndex,{skipValidation:!0}
118),target==="custom"&&$('input[name="width"]').trigger("focus")}),$(document).on("change",'input[name="select-orientation"]',function(){const $width=$('input[name="width"]'),$length=$('input[name="length"]'),widthValue=parseFloat($width.val()),lengthValue=parseFloat($length.val()),portrait=$(this).val()==="portrait";widthValue>0&&lengthValue>0&&(!portrait&&widthValue<lengthValue||portrait&&widthValue>lengthValue)&&($width.val(lengthValue),$length.val(widthValue),$width.trigger("input"),$length.trigger("input")),relabelStandardSizeOptions(),refreshCustomSizeUI()}),$(document).on("click",".cw-product-bundle__size-expander",function(e){e.preventDefault(),e.stopPropagation();const $btn=$(this),isCollapsed=$btn.closest(".cw-product-bundle__variant-options").toggleClass("is-collapsed").hasClass("is-collapsed");$btn.attr("aria-expanded",isCollapsed?"false":"true"),$btn.find(".cw-product-bundle__size-expander-sign").text(isCollapsed?"+":"\u2013"),$btn.find(".cw-product-bundle__size-expander-label").text(isCollapsed?"Show smaller & larger sizes":"Hide extra sizes")}),decorateSizeOptionsForWizard();function OptionsHandler(ele){let selectedText=$(ele).attr("data-text")||"",displaySelectedText=selectedText,selectedVariantID=Number($(ele).attr("data-variant-id"));$(".main-product__checkout-button").length>0&&$(".main-product__checkout-button").attr("data-variant-id",selectedVariantID);let selectedSavePercentage=$(ele).attr("data-save-percentage")||"",fmIncMode=window.fmVatMode==="inc",selectedPrice_ex=$(ele).attr("data-price")||"",selectedPrice_inc=$(ele).attr("data-price-inc")||selectedPrice_ex,selectedPrice_02=fmIncMode?selectedPrice_inc:selectedPrice_ex,dataWithoutMoneyPrice=$(ele).attr("data-without-monny-formate")||"",selectedValue=$(ele).text();const isSizeDropdownOption=$(ele).closest(".main-product__size-option").length>0;console.log("dataWithoutMoneyPrice "+dataWithoutMoneyPrice);let qtyDropText=$(".main-product__quantity-option").find(".cw-product-bundle__variant-option.active-status").data("text");$(".main-product__quantity-option").find(".cw-product-bundle__variant-selected .cw-product-bundle__variant-text").text(qtyDropText),$(".main-product__price-value").attr("data-ex-price",selectedPrice_ex).attr("data-inc-price",selectedPrice_inc).text(selectedPrice_02);let selectedHtml="";if(isSizeDropdownOption&&isCustomOptionElement($(ele))&&(displaySelectedText=getCustomSizeDisplayText()),displaySelectedText&&(selectedHtml+=`<span class="cw-product-bundle__variant-text">${displaySelectedText}</span>`),selectedSavePercentage&&(selectedHtml+=`<span class="cw-product-bundle__variant-save-percentage ddddd">${selectedSavePercentage}</span>`),selectedPrice_02&&(selectedHtml+=`<span class="cw-product-bundle__variant-price" data-ex-price="${selectedPrice_ex}" data-inc-price="${selectedPrice_inc}" data-without-money-total="${dataWithoutMoneyPrice}" data-total-price="${selectedPrice_02}">${selectedPrice_02}</span>`),isSizeDropdownOption&&isCustomOptionElement($(ele))&&(selectedValue=displaySelectedText),$(ele).closest(".cw-product-bundle__variant-select").find(".cw-product-bundle__variant-selected").html(selectedHtml),$(ele).closest(".cw-product-bundle__variant-select").find('input[type="hidden"]').val(selectedValue),isSizeDropdownOption){const $sizeVariantSelect=$(ele).closest(".cw-product-bundle__variant-select"),isCustomSizeOptionSelected=isCustomOptionElement($(ele));$(ele).closest(".cw-product-bundle__variant-options").find(".cw-product-bundle__variant-option").removeClass("active-status"),$(ele).addClass("active-status"),$sizeVariantSelect.attr("data-selected-variant-id",safeTrim($(ele).attr("data-variant-id"))),$sizeVariantSelect.attr("data-selected-option-text",safeTrim(displaySelectedText)),$sizeVariantSelect.attr("data-selected-option-raw-text",safeTrim(selectedText)),$sizeVariantSelect.attr("data-selected-is-custom-size",isCustomSizeOptionSelected?"true":"false"),$sizeVariantSelect.toggleClass("is-custom-size-selected",isCustomSizeOptionSelected),$sizeVariantSelect.removeClass("is-open"),$sizeVariantSelect.find(".cw-product-bundle__variant-options").hide(),updateCustomSizeLabels2()}else $(ele).parent().hide();let selected_variant_option_price=parseFloat($(ele).attr("data-variant-price"));if(!isNaN(selected_variant_option_price)&&selected_variant_option_price>0){const tenPercent_1=selected_variant_option_price,fifteenPercentage=$('.cw-product-bundle__variant-option[data-selected-qty="2"]').attr("data-save-percentage"),fifteenPercentFormate=fifteenPercentage.replace("%",""),fifteenPercent=selected_variant_option_price*fifteenPercentFormate/100,fifteenPercent_1=selected_variant_option_price-fifteenPercent,twentyPercentage=$('.cw-product-bundle__variant-option[data-selected-qty="3"]').attr("data-save-percentage"),twentyPercentFormate=twentyPercentage.replace("%",""),twentyPercent=selected_variant_option_price*twentyPercentFormate/100,twentyPercent_1=selected_variant_option_price-twentyPercent,thirtyPercentFormate=$('.cw-product-bundle__variant-option[data-selected-qty="4"]').attr("data-save-percentage").replace("%",""),thirtyPercent=selected_variant_option_price*thirtyPercentFormate/100,thirtyPercent_1=selected_variant_option_price-thirtyPercent;let percentage_off=$(".main-product__quantity-option").find(".cw-product-bundle__variant-save-percentage").text().replace("Save","").trim();percentage_off==thirtyPercent_1?$(".main-product__quantity-option").find(".cw-product-bundle__variant-price").html(Shopify.formatMoney(thirtyPercent_1)):percentage_off==twentyPercentage?$(".main-product__quantity-option").find(".cw-product-bundle__variant-price").html(Shopify.formatMoney(twentyPercent_1)):percentage_off==fifteenPercentage?$(".main-product__quantity-option").find(".cw-product-bundle__variant-price").html(Shopify.formatMoney(fifteenPercent_1)):$(".main-product__quantity-option").find(".cw-product-bundle__variant-price").html(Shopify.formatMoney(tenPercent_1)),$('.cw-product-bundle__variant-option[data-selected-qty="4"]').attr("data-price",Shopify.formatMoney(thirtyPercent_1)),$('.cw-product-bundle__variant-option[data-selected-qty="4"]').find(".cw-product-bundle__option-
118price").html(Shopify.formatMoney(thirtyPercent_1)),$('.cw-product-bundle__variant-option[data-selected-qty="3"]').attr("data-price",Shopify.formatMoney(twentyPercent_1)),$('.cw-product-bundle__variant-option[data-selected-qty="3"]').find(".cw-product-bundle__option-price").html(Shopify.formatMoney(twentyPercent_1)),$('.cw-product-bundle__variant-option[data-selected-qty="2"]').attr("data-price",Shopify.formatMoney(fifteenPercent_1)),$('.cw-product-bundle__variant-option[data-selected-qty="2"]').find(".cw-product-bundle__option-price").html(Shopify.formatMoney(fifteenPercent_1)),$('.cw-product-bundle__variant-option[data-selected-qty="1"]').attr("data-price",Shopify.formatMoney(tenPercent_1)),$('.cw-product-bundle__variant-option[data-selected-qty="1"]').find(".cw-product-bundle__option-price").html(Shopify.formatMoney(tenPercent_1));let UpdatedSizePrice=$(".main-product__select-dropdown.main-product__quantity-option").find(".cw-product-bundle__variant-option.active-status").attr("data-price");$(".main-product__select-dropdown.main-product__quantity-option").find(".cw-product-bundle__variant-selected .cw-product-bundle__variant-price").text(UpdatedSizePrice)}var selected_size_dropdown=$(".main-product__size-option .cw-product-bundle__variant-selected .cw-product-bundle__variant-text").text(),$primarySizeSelect=$(".main-product__size-option .cw-product-bundle__variant-select").first(),eleDataText=String($(ele).attr("data-text")||"").toLowerCase(),isCustomSizeSelected=eleDataText.indexOf("custom")>-1||isCustomSelectionForSizeSelect($primarySizeSelect)||selected_size_dropdown&&selected_size_dropdown.toLowerCase().indexOf("custom")>-1;isCustomSizeSelected?($(".custom-width-input-field").show(),$(".cw-product-bundle__variant-price").hide(),customPriceHandler(this),$('.cw-product-bundle__variant-option[data-selected-qty="1"]').show().addClass("active-status").trigger("click"),$('.cw-product-bundle__variant-option[data-selected-qty]:not([data-selected-qty="1"])').hide().removeClass("active-status"),$(".cw-product-bundle__variant-price").hide(),updateCustomSizeLabels2()):($(".custom-width-input-field").hide(),$(".cw-product-bundle__variant-price").show(),$('input[name="width"]').val(""),$('input[name="length"]').val(""),$('.cw-product-bundle__variant-option[data-selected-qty="1"]').show().addClass("active-status").trigger("click"),$('.cw-product-bundle__variant-option[data-selected-qty]:not([data-selected-qty="1"])').show().removeClass("active-status"),updateCustomSizeLabels2());var selected_size_dropdown=$(".main-product__size-option .cw-product-bundle__variant-selected .cw-product-bundle__variant-text").text();$(`[value="${selected_size_dropdown}"]`).prop("checked",!0)}$(document).on("click",".cw-product-bundle__variant-selected",function(event){event.preventDefault();const $selected=$(this),$currentSelect=$selected.closest(".cw-product-bundle__variant-select"),$currentOptions=$selected.siblings(".cw-product-bundle__variant-options");if($selected.closest(".main-product__size-option").length>0){const shouldOpen=!$currentSelect.hasClass("is-open");$(".main-product__size-option .cw-product-bundle__variant-select").not($currentSelect).removeClass("is-open").find(".cw-product-bundle__variant-options").hide(),$(".cw-product-bundle__variant-options").not($currentOptions).hide(),shouldOpen?($currentSelect.addClass("is-open"),$currentOptions.show()):($currentSelect.removeClass("is-open"),$currentOptions.hide());return}$(".main-product__size-option .cw-product-bundle__variant-select").removeClass("is-open"),$(".cw-product-bundle__variant-options").not($currentOptions).hide(),$currentOptions.toggle()}),$(document).on("click",".main-product__size-option .cw-product-bundle__variant-option",function(){OptionsHandler(this)}),$('.main-product__right input[name="color-swatch"]').on("change",function(){var selectedColorValue=$('.main-product__right input[name="color-swatch"]:checked').val();$(`input[value="${selectedColorValue}"]`).prop("checked",!0)}),$(document).on("click",".main-product__quantity-option .cw-product-bundle__variant-option",function(){$(".main-product__quantity-option .cw-product-bundle__variant-option").removeClass("active-status"),$(this).addClass("active-status");let selectedText=$(this).attr("data-text")||"",selectedSavePercentage=$(this).attr("data-save-percentage")||"",selectedPrice_03=$(this).attr("data-price")||"",selectedValue=$(this).text(),selectedHtml="",currentClickQty=$(this).attr("data-selected-qty"),fourPlusQty=$("#fourplusqty").val();$(".main-product__quantity-option .cw-product-bundle__variant-selected")&&(selectedText=="4+ Qty"?$(".main-product__quantity-option .cw-product-bundle__variant-selected").attr("currentqty",fourPlusQty):$(".main-product__quantity-option .cw-product-bundle__variant-selected").attr("currentqty",currentClickQty)),selectedText&&(selectedHtml+=`<span class="cw-product-bundle__variant-text">${selectedText}</span>`),selectedSavePercentage&&(selectedHtml+=`<span class="cw-product-bundle__variant-save-percentage qqqqq">Save ${selectedSavePercentage}</span>`),selectedPrice_03&&(selectedHtml+=`<span class="cw-product-bundle__variant-price">${selectedPrice_03}</span>`),$(this).closest(".cw-product-bundle__variant-select").find(".cw-product-bundle__variant-selected").html(selectedHtml),$(this).closest(".cw-product-bundle__variant-select").find('input[type="hidden"]').val(selectedValue),$(this).parent().hide(),selectedText=="4+ Qty"?$(".custom-width-input-field--qty").show():$(".custom-width-input-field--qty").hide(),document.querySelector(".main-product__price-value").textContent=selectedPrice_03}),$(document).on("click",function(e){$(e.target).closest(".cw-product-bundle__variant-select").length||($(".cw-product-bundle__variant-options").hide(),$(".main-product__size-option .cw-product-bundle__variant-select").removeClass("is-open"))}),typeof Fancybox<"u"&&Fancybox.bind("[data-fancybox]",{showClass:"checkout-form-popup"});let trustedLogo=$(".trusted-logo__slider");trustedLogo.length>0&&!trustedLogo.hasClass("slick-initialized")&&trustedLogo.slick({dots:!1,arrows:!1,slidesToShow:5,infinite:!0,lazyLoad:"progressive",speed:3e3,autoplay:!0,autoplaySpeed:0,cssEase:"linear",draggable:!1,swipe:!1,touchMove:!1,pauseOnHover:!1,pauseOnFocus:!1,swipeToSlide:!1,variableWidth:!0,responsive:[{breakpoint:992,settings:{slidesToShow:4,speed:8e3}},{breakpoint:768,settings:{slidesToShow:3}},{breakpoint:575,settings:{slidesToShow:2,speed:3e3}}]}),$(".ideal-step .ideal-step__block-title").length>0&&$(".ideal-step .ideal-step__block-title").matchHeight({byRow:!0}
118),initLogoWizard(),updateMatwellDependentUI(),$(document).on("change",'input[name="select-backing"]',function(){updateMatwellDependentUI()});let formButton=$(".secure-checkout__form .secure-checkout__button"),isCheckoutSubmitting=!1;const defaultSubmitButtonText=safeTrim(formButton.first().text())||"Submit",checkoutSubmitLoadingText="Please Wait, Generating Design";let phoneNumberField=document.querySelector(".secure-checkout__fill-data .secure-checkout__field input[type='tel']"),iti,phoneNumberInput=document.querySelector("#phone"),errorMsg=document.querySelector("#phoneError"),validMsg=document.querySelector("#validMsg"),errorMap=["Please check the phone number.","Please check the country code.","That number looks too short.","That number looks too long.","Please check the phone number."];function reset(){phoneNumberInput&&errorMsg&&validMsg?(phoneNumberInput.classList.remove("invalid"),errorMsg.textContent="",errorMsg.style.display="none",validMsg.classList.add("hide")):console.log("Required elements not found")}let showError=msg=>{phoneNumberInput.classList.add("invalid"),errorMsg.textContent=msg,errorMsg.style.display="block"};const checkoutStageLines=["Reading your logo\u2026","Matching your colours to mat fibres\u2026","Weaving it into the mat pile\u2026","Placing it in your entrance\u2026"],checkoutLongWaitLine="Taking longer than usual \u2014 your proof will land by email in a few minutes. Your price is locked in.",checkoutProofReadyLine="Your proof is ready \u2014 opening it now\u2026",checkoutFacts=["We colour-match to your exact HEX code \u2014 your brand book's colour, not the nearest stock shade.","Rubber edges come as standard on every logo mat.","Prefer a round one? Circular logo mats run from 85cm to 150cm across.","Chosen for nationwide roll-outs \u2014 built for entrances that see thousands of feet a day.","Unlimited free revisions \u2014 nothing prints until you're happy with the proof.","Sending direct to your customer? We can deliver unbranded, with no price paperwork inside.","Every order carries a 100% satisfaction guarantee \u2014 if it isn't right, we make it right."];let checkoutLoaderTimers=[];function stopCheckoutLoaderCopy(){checkoutLoaderTimers.forEach(function(timerId){clearTimeout(timerId)}),checkoutLoaderTimers=[]}function startCheckoutLoaderCopy($forms){stopCheckoutLoaderCopy();const $stage=$forms.find(".secure-checkout__progress-text").add($(".lmw-proof-overlay__stage")),$fact=$forms.find(".secure-checkout__progress-fact").add($(".lmw-proof-overlay__fact"));let stageIndex=0,factIndex=Math.floor(Math.random()*checkoutFacts.length),longWait=!1;$stage.text(checkoutStageLines[0]),$fact.text(checkoutFacts[factIndex]);const rotateStage=function(){longWait||(stageIndex=(stageIndex+1)%checkoutStageLines.length,$stage.text(checkoutStageLines[stageIndex])),checkoutLoaderTimers.push(setTimeout(rotateStage,2600))},rotateFact=function(){factIndex=(factIndex+1)%checkoutFacts.length,$fact.text(checkoutFacts[factIndex]),checkoutLoaderTimers.push(setTimeout(rotateFact,3500))};checkoutLoaderTimers.push(setTimeout(rotateStage,2600)),checkoutLoaderTimers.push(setTimeout(rotateFact,3500)),checkoutLoaderTimers.push(setTimeout(function(){$(".lmw-proof-overlay").addClass("is-long-wait")},4e4)),checkoutLoaderTimers.push(setTimeout(function(){longWait=!0,$stage.text(checkoutLongWaitLine)},7e4))}function ensureCheckoutProgressUI(){$(".secure-checkout__form .secure-checkout__submit").each(function(){const $submitWrap=$(this);$submitWrap.find(".secure-checkout__progress").length>0||$submitWrap.append(`<div class="secure-checkout__progress" role="status" aria-live="polite"> 119 <div class="secure-checkout__progress-track" aria-hidden="true"> 120 <div class="secure-checkout__progress-bar"></div> 121 </div> 122 <p class="secure-checkout__progress-text">${checkoutSubmitLoadingText}</p> 123 <p class="secure-checkout__progress-fact" style="margin:4px 0 0;font-size:12px;opacity:.8;"></p> 124 </div>`)})}ensureCheckoutProgressUI();const PROOF_OVERLAY_TARGET_MS=3e4,PROOF_OVERLAY_TARGET_PCT=90,PROOF_OVERLAY_CEILING_MS=9e4,PROOF_OVERLAY_CEILING_PCT=99,PROOF_OVERLAY_RING_RADIUS=52,PROOF_OVERLAY_RING_LENGTH=2*Math.PI*PROOF_OVERLAY_RING_RADIUS;let proofOverlayTimer=null,proofOverlayStartedAt=0;function ensureProofOverlayUI(){let $overlay=$(".lmw-proof-overlay");return $overlay.length>0||($overlay=$(`<div class="lmw-proof-overlay" hidden aria-hidden="true"> 125 <div class="lmw-proof-overlay__card"> 126 <div class="lmw-proof-overlay__ring" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" aria-label="Generating your proof"> 127 <svg viewBox="0 0 120 120" aria-hidden="true"> 128 <circle class="lmw-proof-overlay__ring-track" cx="60" cy="60" r="${PROOF_OVERLAY_RING_RADIUS}"></circle> 129 <circle class="lmw-proof-overlay__ring-fill" cx="60" cy="60" r="${PROOF_OVERLAY_RING_RADIUS}"></circle> 130 </svg>
131 <span class="lmw-proof-overlay__pct" aria-hidden="true"><strong class="lmw-proof-overlay__pct-value">0</strong>%</span> 132 </div> 133 <p class="lmw-proof-overlay__title">Generating your proof</p> 134 <p class="lmw-proof-overlay__stage" role="status" aria-live="polite"></p> 135 <p class="lmw-proof-overlay__hint">This usually takes about 30 seconds \u2014 please keep this window open.</p> 136 <p class="lmw-proof-overlay__fact"></p> 137 </div> 138 </div>`),$overlay.find(".lmw-proof-overlay__ring-fill").css({strokeDasharray:PROOF_OVERLAY_RING_LENGTH,strokeDashoffset:PROOF_OVERLAY_RING_LENGTH}),$(document.body).append($overlay)),$overlay}formButton.length>0&&ensureProofOverlayUI();function proofOverlayPercentFor(elapsedMs){if(elapsedMs<=0)return 0;if(elapsedMs<PROOF_OVERLAY_TARGET_MS)return elapsedMs/PROOF_OVERLAY_TARGET_MS*PROOF_OVERLAY_TARGET_PCT;if(elapsedMs<PROOF_OVERLAY_CEILING_MS){const spanMs=PROOF_OVERLAY_CEILING_MS-PROOF_OVERLAY_TARGET_MS,spanPct=PROOF_OVERLAY_CEILING_PCT-PROOF_OVERLAY_TARGET_PCT;return PROOF_OVERLAY_TARGET_PCT+(elapsedMs-PROOF_OVERLAY_TARGET_MS)/spanMs*spanPct}return PROOF_OVERLAY_CEILING_PCT}function renderProofOverlayPercent(percent){const $overlay=$(".lmw-proof-overlay");if($overlay.length===0)return;const clamped=Math.max(0,Math.min(100,Math.round(percent)));$overlay.find(".lmw-proof-overlay__pct-value").text(clamped),$overlay.find(".lmw-proof-overlay__ring").attr("aria-valuenow",clamped),$overlay.find(".lmw-proof-overlay__ring-fill").css("stroke-dashoffset",PROOF_OVERLAY_RING_LENGTH*(1-clamped/100))}function startProofOverlay(){const $overlay=ensureProofOverlayUI();proofOverlayTimer&&clearInterval(proofOverlayTimer),proofOverlayStartedAt=new Date().getTime(),$overlay.removeClass("is-long-wait is-complete").addClass("is-visible"),$overlay.removeAttr("hidden").attr("aria-hidden","false"),renderProofOverlayPercent(0),proofOverlayTimer=setInterval(function(){renderProofOverlayPercent(proofOverlayPercentFor(new Date().getTime()-proofOverlayStartedAt))},200)}function completeProofOverlay(){proofOverlayTimer&&(clearInterval(proofOverlayTimer),proofOverlayTimer=null);const $overlay=$(".lmw-proof-overlay");$overlay.length!==0&&($overlay.addClass("is-complete").removeClass("is-long-wait"),renderProofOverlayPercent(100),stopCheckoutLoaderCopy(),$(".lmw-proof-overlay__stage, .secure-checkout__progress-text").text(checkoutProofReadyLine))}function stopProofOverlay(){proofOverlayTimer&&(clearInterval(proofOverlayTimer),proofOverlayTimer=null),$(".lmw-proof-overlay").removeClass("is-visible is-long-wait is-complete").attr({hidden:"hidden","aria-hidden":"true"})}function setCheckoutSubmitState(isSubmitting,labelText){if(formButton.length===0)return;const $forms=formButton.closest(".secure-checkout__form");formButton.prop("disabled",isSubmitting),formButton.toggleClass("is-submitting",isSubmitting),$forms.toggleClass("is-submitting",isSubmitting),isSubmitting?(startProofOverlay(),startCheckoutLoaderCopy($forms)):(stopCheckoutLoaderCopy(),stopProofOverlay(),$forms.find(".secure-checkout__progress-text").text(checkoutSubmitLoadingText),$forms.find(".secure-checkout__progress-fact").text("")),formButton.text(isSubmitting?labelText||checkoutSubmitLoadingText:defaultSubmitButtonText),logoWizardState.$generateProxy&&logoWizardState.$generateProxy.length&&logoWizardState.$generateProxy.prop("disabled",isSubmitting).toggleClass("is-submitting",isSubmitting).text(isSubmitting?"Generating your proof\u2026":"Generate my instant proof")}function setInstantProofDebugMessage(_messageText){const $debugEl=$(".secure-checkout__instant-debug");$debugEl.length!==0&&$debugEl.text("").hide()}function ensureIntlTelInput(){return iti||(!phoneNumberField||typeof window.intlTelInput!="function"?null:(iti=window.intlTelInput(phoneNumberField,{initialCountry:"gb",separateDialCode:!0,formatOnDisplay:!0,nationalMode:!1,utilsScript:"https://cdn.jsdelivr.net/npm/[email protected]/build/js/utils.js"}),iti))}if(phoneNumberField){if("IntersectionObserver"in window){var itiObserver=new IntersectionObserver(function(entries){for(var i=0;i<entries.length;i++)if(entries[i].isIntersecting){ensureIntlTelInput(),itiObserver.disconnect();break}});itiObserver.observe(phoneNumberField)}else ensureIntlTelInput();phoneNumberField.addEventListener("focus",ensureIntlTelInput,{once:!0}),phoneNumberField.addEventListener("pointerdown",ensureIntlTelInput,{once:!0})}
138$(formButton).click(function(e){if(e.preventDefault(),isCheckoutSubmitting)return;var isValid=!0;$(".error-message").hide(),$(".secure-checkout__form input").removeClass("invalid");let firstName=$("#firstName").val();firstName&&typeof firstName=="string"?(firstName=firstName.trim(),/^[A-Za-zÃ-ÃÃ-öø-ÿ' -]+$/.test(firstName)?($("#firstName").removeClass("invalid"),$("#firstNameError").hide()):(isValid=!1,$("#firstName").addClass("invalid"),$("#firstNameError").text("First name must contain only letters.").css("display","block"))):(isValid=!1,$("#firstName").addClass("invalid"),$("#firstNameError").text("First name is required.").css("display","block"));let surname=$("#surname").val();surname&&typeof surname=="string"?(surname=surname.trim(),/^[A-Za-zÃ-ÃÃ-öø-ÿ' -]+$/.test(surname)?($("#surname").removeClass("invalid"),$("#surnameError").hide()):(isValid=!1,$("#surname").addClass("invalid"),$("#surnameError").text("Surname must contain only letters.").css("display","block"))):(isValid=!1,$("#surname").addClass("invalid"),$("#surnameError").text("Surname is required.").css("display","block"));let company=$("#company").val();company&&typeof company=="string"?(company=company.trim(),/^[A-Za-z0-9Ã-ÃÃ-öø-ÿ&'.,\-\/() ]+$/.test(company)?($("#company").removeClass("invalid"),$("#companyError").hide()):(isValid=!1,$("#company").addClass("invalid"),$("#companyError").text("Please enter a valid company name.").css("display","block"))):(isValid=!1,$("#company").addClass("invalid"),$("#companyError").text("Company Name is required.").css("display","block"));let email=$("#email").val();email&&typeof email=="string"?(email=email.trim(),/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(email)?($("#email").removeClass("invalid"),$("#emailError").hide()):(isValid=!1,$("#email").addClass("invalid"),$("#emailError").text("Please enter a valid email address.").css("display","block"))):(isValid=!1,$("#email").addClass("invalid"),$("#emailError").text("Email address is required.").css("display","block")),reset();let phoneNumber=phoneNumberInput.value,validMsg2=document.querySelector("#validMsg");if(!phoneNumber||phoneNumber.trim()==="")showError("Phone number is required."),isValid=!1;else{var itiInstance=ensureIntlTelInput();if(!itiInstance)validMsg2.classList.remove("hide"),validMsg2.textContent="\u2713 Valid";else if(itiInstance.isValidNumber())validMsg2.classList.remove("hide"),validMsg2.textContent="\u2713 Valid";else{const utilsReady=!!(window.intlTelInput&&window.intlTelInput.utils)||typeof window.intlTelInputUtils<"u",digitCount=String(phoneNumber).replace(/\D/g,"").length;if(!utilsReady&&digitCount>=10&&digitCount<=15)validMsg2.classList.remove("hide"),validMsg2.textContent="\u2713 Valid";else{let errorCode=itiInstance.getValidationError(),msg=errorMap[errorCode]||"Please check the phone number.";showError(msg),isValid=!1}}}if(isValid){$(".secure-checkout__field input").each(function(){let secureCheckoutInput=$(this);secureCheckoutInput.val().trim()!==""&&(secureCheckoutInput.removeClass("invalid"),secureCheckoutInput.siblings(".error-message").hide())});const designItems=getDesignItemsForSubmission(),primaryDesign=designItems[0]||buildCurrentDesignItem(),proofMode=designItems.length>1?"manual":"instant",instantProofEligible=proofMode==="instant"&&designItems.length===1,requiresManualReview=!instantProofEligible;let customer_firstname=$("#secure-checkout").find("#firstName").val(),customer_surname=$("#secure-checkout").find("#surname").val(),customer_email=$("#secure-checkout").find("#email").val(),customer_phone=$("#secure-checkout").find("#phone").val();const customer_phone_normalized=iti&&typeof iti.getNumber=="function"?iti.getNumber():customer_phone;let customer_company=$("#secure-checkout").find("#company").val();const productPriceValue=parseCurrencyAmount(primaryDesign.productPrice),discountPercentValue=parsePercentAmount(primaryDesign.discountPercentage),providedDiscountedUnitPriceValue=parseCurrencyAmount(primaryDesign.totalPrice),quantityValue=parseQuantityValue(primaryDesign.quantity),discountedUnitPriceValue=providedDiscountedUnitPriceValue!==null?providedDiscountedUnitPriceValue:productPriceValue!==null?roundToTwo(discountPercentValue!==null?productPriceValue*(1-discountPercentValue/100):productPriceValue):null,lineTotalValue=discountedUnitPriceValue!==null&&quantityValue!==null?roundToTwo(discountedUnitPriceValue*quantityValue):null,designItemsObject=designItems.map(item=>{const itemProductPriceValue=parseCurrencyAmount(item.productPrice),itemDiscountPercentValue=parsePercentAmount(item.discountPercentage),itemProvidedDiscountedUnitPriceValue=parseCurrencyAmount(item.totalPrice),itemQuantityValue=parseQuantityValue(item.quantity),itemDiscountedUnitPriceValue=itemProvidedDiscountedUnitPriceValue!==null?itemProvidedDiscountedUnitPriceValue:itemProductPriceValue!==null?roundToTwo(itemDiscountPercentValue!==null?itemProductPriceValue*(1-itemDiscountPercentValue/100):itemProductPriceValue):null,itemLineTotalValue=itemDiscountedUnitPriceValue!==null&&itemQuantityValue!==null?roundToTwo(itemDiscountedUnitPriceValue*itemQuantityValue):null,itemProductPriceExValue=parseCurrencyAmount(item.productPriceEx||item.productPrice),itemDiscountedUnitPriceExValue=(function(){const provided=parseCurrencyAmount(item.totalPriceEx
138);return provided!==null?provided:itemProductPriceExValue===null?null:roundToTwo(itemDiscountPercentValue!==null?itemProductPriceExValue*(1-itemDiscountPercentValue/100):itemProductPriceExValue)})(),itemLineTotalExValue=itemDiscountedUnitPriceExValue!==null&&itemQuantityValue!==null?roundToTwo(itemDiscountedUnitPriceExValue*itemQuantityValue):null;return{...item,quantityValue:itemQuantityValue,productPriceValue:itemProductPriceValue,discountPercentValue:itemDiscountPercentValue,discountedUnitPriceValue:itemDiscountedUnitPriceValue,lineTotalValue:itemLineTotalValue,productPriceExValue:itemProductPriceExValue,discountedUnitPriceExValue:itemDiscountedUnitPriceExValue,lineTotalExValue:itemLineTotalExValue,sizeType:item.customWidth?"custom":"standard"}});let customerData={},queryparameters,currentUrl=window.location.href;currentUrl.includes("?")&&(queryparameters=currentUrl.split("?")[1],console.log("queryparameters:",queryparameters),sessionStorage.setItem("queryparameters",queryparameters),queryparameters.split("&").forEach(param=>{const[key,value]=param.split("=");customerData[key]=decodeURIComponent(value||"")})),customerData.Firstname=customer_firstname,customerData.Surname=customer_surname,customerData.Email=customer_email,customerData.Phone=customer_phone,customerData["Phone Normalized"]=customer_phone_normalized,customerData["Company Name"]=customer_company,customerData.Location=primaryDesign.location,customerData.Orientation=primaryDesign.orientation,primaryDesign.customWidth?(customerData["Custom Width"]=primaryDesign.customWidth,customerData["Custom Length"]=primaryDesign.customLength):customerData.Size=primaryDesign.size,customerData["Product Price"]=primaryDesign.productPrice,customerData.Quantity=primaryDesign.quantity,customerData["Discount percentage"]=primaryDesign.discountPercentage,customerData["Total Price"]=primaryDesign.totalPrice,customerData["Size Type"]=primaryDesign.customWidth?"custom":"standard",productPriceValue!==null&&(customerData["Unit Price Value"]=productPriceValue),discountPercentValue!==null&&(customerData["Discount Percent Value"]=discountPercentValue),discountedUnitPriceValue!==null&&(customerData["Discounted Unit Price Value"]=discountedUnitPriceValue),quantityValue!==null&&(customerData["Quantity Value"]=quantityValue),lineTotalValue!==null&&(customerData["Line Total Value"]=lineTotalValue),customerData.Currency="GBP",customerData["Price Basis"]="ex_vat",customerData["Display VAT Mode"]=getVatDisplayMode(),primaryDesign.color&&(customerData.Color=primaryDesign.color),primaryDesign.productVariantId&&(customerData["Product Variant Id"]=primaryDesign.productVariantId),primaryDesign.imageUrl&&(customerData["Image URL"]=primaryDesign.imageUrl),primaryDesign.backgroundColor&&(customerData["Background Color"]=primaryDesign.backgroundColor),customerData["Bespoke color"]=primaryDesign.bespokeColor;var $logoSource=document.querySelector(".main-product__uploaded-logo-source");customerData["Logo Source"]=$logoSource&&$logoSource.value||"",customerData["Proof Mode"]=proofMode,customerData["Instant Proof Eligible"]=instantProofEligible?"true":"false",customerData["Requires Manual Review"]=requiresManualReview?"true":"false",customerData["Instant Proof Status"]=instantProofEligible?"pending":"skipped",customerData["Design Item Count"]=designItems.length,customerData["Design Items"]=JSON.stringify(designItems),customerData["Design Items Object"]=designItemsObject;const hasLogoUrl=safeTrim(primaryDesign.imageUrl||customerData["Image URL"])!=="",hasBackgroundColor=safeTrim(primaryDesign.backgroundColor||customerData["Background Color"]||primaryDesign.color)!=="",shouldAttemptInstantProof=instantProofEligible&&hasLogoUrl&&hasBackgroundColor;customerData["Instant Proof Attempted"]=shouldAttemptInstantProof?"true":"false",shouldAttemptInstantProof||(instantProofEligible?hasLogoUrl?hasBackgroundColor||(customerData["Instant Proof Skip Reason"]="missing_background_color"):customerData["Instant Proof Skip Reason"]="missing_logo_url":customerData["Instant Proof Skip Reason"]="multi_item_or_manual_mode");try{if(typeof window.fmGetMetaLeadFields=="function"){var __metaFields=window.fmGetMetaLeadFields();customerData.fbc=__metaFields.fbc||"",customerData.fbp=__metaFields.fbp||"",customerData.user_agent=__metaFields.user_agent||"",customerData.event_source_url=__metaFields.event_source_url||"",customerData.marketing_consent=!!__metaFields.marketing_consent}}catch{}isCheckoutSubmitting=!0,logoWizardState.isSubmissionComplete=!1,setInstantProofDebugMessage(""),setCheckoutSubmitState(!0,"Please Wait, Generating Design");const submitLeadPayload=function(instantOutcome){const resolvedOutcome=instantOutcome||normalizeInstantProofOutcome({status:shouldAttemptInstantProof?"manual_fallback":"skipped",instantProofStatus:shouldAttemptInstantProof?"failed":"skipped",proofMode,requiresManualReview},shouldAttemptInstantProof?"failed":"skipped");customerData["Proof Mode"]=resolvedOutcome.proofMode||proofMode,customerData["Instant Proof Status"]=resolvedOutcome.instantProofStatus||(shouldAttemptInstantProof?"failed":"skipped"),customerData["Requires Manual Review"]=typeof resolvedOutcome.requiresManualReview=="boolean"?resolvedOutcome.requiresManualReview?"true":"false":requiresManualReview?"true":"false",resolvedOutcome.proofId&&(customerData["Proof ID"]=resolvedOutcome.proofId),resolvedOutcome.proofUrl&&(customerData["Proof URL"]=resolvedOutcome.proofUrl),resolvedOutcome.proofImageUrl&&(customerData["Proof Image URL"]=resolvedOutcome.proofImageUrl),resolvedOutcome.draftOrderId&&(customerData["Draft Order ID"]=resolvedOutcome.draftOrderId),resolvedOutcome.draftOrderInvoiceUrl&&(customerData["Draft Order Invoice URL"]=resolvedOutcome.draftOrderInvoiceUrl),resolvedOutcome.renderDurationMs!==null&&resolvedOutcome.renderDurationMs!==void 0&&!Number.isNaN(resolvedOutcome.renderDurationMs)&&(customerData["Instant Render Duration Ms"]=resolvedOutcome.renderDurationMs),resolvedOutcome.errorCode&&(customerData["Instant Error Code"]=resolvedOutcome.errorCode),resolvedOutcome.errorMessage&&(customerData["Instant Error Message"]=resolvedOutcome.errorMessage),setInstantProofDebugMessage(""),$.ajax({url:"https://firstmatsproofs.c
138o.uk/firstmatsproofs.co.uk/eq-pdp-image/postdata.php",method:"POST",dataType:"JSON",contentType:"application/json; charset=utf-8",data:JSON.stringify(customerData),success:function(){if($(".secure-checkout__form").addClass("form-submit-success"),logoWizardState.isSubmissionComplete=!0,(function(){var DL=window.dataLayer=window.dataLayer||[],proofStatus=safeTrim(resolvedOutcome.instantProofStatus).toLowerCase(),handle=primaryDesign&&primaryDesign.productHandle||customerData["Product Handle"]||"";setTimeout(function(){if(proofStatus==="success"&&safeTrim(resolvedOutcome.proofUrl)!=="")DL.push({event:"lm_proof_shown",lm_proof_id:resolvedOutcome.proofId||"",lm_proof_mode:resolvedOutcome.proofMode||"",lm_render_duration_ms:resolvedOutcome.renderDurationMs,lm_product_handle:handle});else if(proofStatus==="skipped"){var serverCode=resolvedOutcome.errorCode;safeTrim(serverCode).toLowerCase()===proofStatus&&(serverCode=""),DL.push({event:"lm_proof_skipped",lm_skip_reason:customerData["Instant Proof Skip Reason"]||serverCode||"unknown",lm_skip_detail:resolvedOutcome.errorMessage||"",lm_product_handle:handle})}else DL.push({event:"lm_proof_failed",lm_proof_status:proofStatus||"failed",lm_error_code:resolvedOutcome.errorCode||"",lm_product_handle:handle})},0)})(),resolvedOutcome.instantProofStatus==="success"&&safeTrim(resolvedOutcome.proofUrl)!==""){completeProofOverlay(),setTimeout(function(){window.location.href=resolvedOutcome.proofUrl},400);return}showWizardStep(logoWizardState.currentStepIndex,{skipValidation:!0}),renderManualCompletionBand(),isCheckoutSubmitting=!1,setCheckoutSubmitState(!1)},error:function(){$(".secure-checkout__form").hasClass("form-submit-success")&&$(".secure-checkout__form").removeClass("form-submit-success"),logoWizardState.isSubmissionComplete=!1,isCheckoutSubmitting=!1,setCheckoutSubmitState(!1)}})},instantPayload=buildInstantProofRequestPayload(customerData,primaryDesign,designItems,designItemsObject);$.ajax({url:INSTANT_PROOF_API_URL,method:"POST",dataType:"JSON",contentType:"application/json; charset=utf-8",timeout:INSTANT_PROOF_CLIENT_TIMEOUT_MS,data:JSON.stringify(instantPayload),success:function(response){const instantOutcome=normalizeInstantProofOutcome(response,"failed");submitLeadPayload(instantOutcome)},error:function(_xhr,textStatus){const fallbackStatus=textStatus==="timeout"?"timeout":"failed";submitLeadPayload(normalizeInstantProofOutcome({status:"manual_fallback",instantProofStatus:fallbackStatus,proofMode:"manual",requiresManualReview:!0,message:fallbackStatus==="timeout"?"Instant proof timed out.":"Instant proof request failed."},fallbackStatus))}})}}),$(".custom-mats-product__tabs .tab-a").on("click",function(){$(".custom-mats-product__tabs .tab").removeClass("tab-active"),$(".custom-mats-product__tabs .tab[data-id='"+$(this).attr("data-id")+"']").addClass("tab-active"),$(".custom-mats-product__tabs .tab-a").removeClass("active").attr("aria-selected","false"),$(this).addClass("active").attr("aria-selected","true")}),$(".custom-mats-product__video-play").click(function(){$(this).parent().hide();const videoSrc=$("#youtubeVideo").attr("src")+"&autoplay=1";$("#youtubeVideo").attr("src",videoSrc),$("#videoContainer").css("display","block")}),$(".js-product-lovedby-slider").length>0&&!$(".js-product-lovedby-slider").hasClass("slick-initialized")&&$(".js-product-lovedby-slider").slick({slidesToShow:3,slidesToScroll:1,arrows:!0,dots:!1,fade:!1,autoplay:!0,autoplaySpeed:2e3,prevArrow:'<button type="button" class="prev-arrow" aria-label="Previous slide"><svg width="41" height="41" viewBox="0 0 41 41" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M23 15L17 21L23 27" stroke="#7D86BC" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><circle cx="20.5" cy="20.5" r="20" transform="rotate(-180 20.5 20.5)" stroke="#7D86BC"/></svg></button>',nextArrow:'<button type="button" class="next-arrow" aria-label="Next slide"><svg width="41" height="41" viewBox="0 0 41 41" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M18 26L24 20L18 14" stroke="#7D86BC" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><circle cx="20.5" cy="20.5" r="20" stroke="#7D86BC"/></svg></button>',responsive:[{breakpoint:991.98,settings:{slidesToShow:2,arrows:!0}},{breakpoint:575.98,settings:{slidesToShow:1,arrows:!0,prevArrow:'<button type="button" class="prev-arrow" aria-label="Previous slide"><svg width="41" height="42" viewBox="0 0 41 42" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="20.5" cy="21" r="20" transform="rotate(-180 20.5 21)" fill="#7D86BC" stroke="#7D86BC"/><path d="M23 15.5L17 21.5L23 27.5" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></button>',nextArrow:'<button type="button" class="next-arrow" aria-label="Next slide"><svg width="41" height="42" viewBox="0 0 41 42" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="20.5" cy="21" r="20" fill="#7D86BC" stroke="#7D86BC"/><path d="M18 26.5L24 20.5L18 14.5" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></button>'}}]})});function customPriceHandler(selectedOption){const widthInput=document.querySelector('input[name="width"]'),lengthInput=document.querySelector('input[name="length"]');if(!widthInput||!lengthInput)return;function calculatePrice(){const bundlePriceDisplays=document.querySelectorAll(".cw-product-bundle__variant-price"),bundleOptionPriceDisplays=document.querySelectorAll(".cw-product-bundle__variant-option"),width=parseFloat(widthInput.value)||0,length=parseFloat(lengthInput.value)||0;if(width>0&&length>0){const price=(width*length/1e4*50.46+13)*1.6,priceInc=price*1.2,fmIncMode=window.fmVatMode==="inc",formattedPriceEx=Shopify.formatMoney(price*100),formattedPriceInc=Shopify.formatMoney(priceInc*100),formattedPrice=fmIncMode?formattedPriceInc:formattedPriceEx;$(".main-product__price-value").attr("data-ex-price",formattedPriceEx).attr("data-inc-price",formattedPriceInc).text(formattedPrice),$(".main-product__size-option").find(".cw-product-bundle__variant-selected .cw-product-bundle__variant-price").attr("data-without-money-total",formattedPrice),$(".main-product__size-option").find(".cw-product-bundle__variant-selected .cw-product-bundle__variant-price").attr("data-ex-price",formattedPriceEx).attr("data-inc-price",formattedPriceInc),bundlePriceDisplays.forEach(element=>{element.textContent=formattedPrice}),bundleOptionPriceDisplays.forEach(ele=>{if(ele.getAttribute("data-text").includes("Custom Size")){ele.setAttribute("data-price",formattedPriceEx),ele.setAttribute("data-price-inc",formattedPriceInc),ele.setAttribute("data-variant-price",price*100);var customOptPriceEl=ele.querySelector(".cw-product-bundle__option-
138price");customOptPriceEl&&(customOptPriceEl.setAttribute("data-ex-price",formattedPriceEx),customOptPriceEl.setAttribute("data-inc-price",formattedPriceInc),customOptPriceEl.textContent=formattedPrice)}}),quantityPriceHandler(price*100),$(".cw-product-bundle__variant-price").show(),updateCustomSizeLabels()}else $(".cw-product-bundle__variant-price").hide(),updateCustomSizeLabels();$('.cw-product-bundle__variant-option[data-selected-qty="1"]').show().addClass("active-status"),$('.cw-product-bundle__variant-option[data-selected-qty]:not([data-selected-qty="1"])').hide().removeClass("active-status")}widthInput.dataset.logoMatCustomSizeBound||(widthInput.addEventListener("input",calculatePrice),lengthInput.addEventListener("input",calculatePrice),widthInput.dataset.logoMatCustomSizeBound="true"),calculatePrice()}function quantityPriceHandler(money){const percentageOffElement=document.querySelector(".main-product__quantity-option .cw-product-bundle__variant-save-percentage"),percentageOff=percentageOffElement?percentageOffElement.textContent.replace(/Save\s*/i,"").trim():"",PercentageFifteen=$('.cw-product-bundle__variant-option[data-selected-qty="2"]').attr("data-save-percentage"),PercentageFifteenCleaned=PercentageFifteen.replace(/Save\s*/i,"").trim(),PercentageFifteenFormate=parseFloat(PercentageFifteenCleaned)/100,PercentageTwenty=$('.cw-product-bundle__variant-option[data-selected-qty="3"]').attr("data-save-percentage"),PercentageTwentyCleaned=PercentageTwenty.replace(/Save\s*/i,"").trim(),PercentageTwentyFormate=parseFloat(PercentageTwentyCleaned)/100,PercentageThirty=$('.cw-product-bundle__variant-option[data-selected-qty="4"]').attr("data-save-percentage"),PercentageThirtyCleaned=PercentageThirty.replace(/Save\s*/i,"").trim(),PercentageThirtyFormate=parseFloat(PercentageThirtyCleaned)/100,fifteenPercentOff=money-money*PercentageFifteenFormate,twentyPercentOff=money-money*PercentageTwentyFormate,thirtyPercentOff=money-money*PercentageThirtyFormate;let price;percentageOff===PercentageThirty?price=Shopify.formatMoney(thirtyPercentOff):percentageOff===PercentageTwenty?price=Shopify.formatMoney(twentyPercentOff):percentageOff===PercentageFifteen?price=Shopify.formatMoney(fifteenPercentOff):price=Shopify.formatMoney(money);const mainPriceElement=document.querySelector(".main-product__quantity-option .cw-product-bundle__variant-price");mainPriceElement&&(mainPriceElement.innerHTML=price);const updateVariantOption=(qty,discountPrice)=>{const variantOption=document.querySelector(`.cw-product-bundle__variant-option[data-selected-qty="${qty}"]`);if(variantOption){variantOption.setAttribute("data-price",discountPrice);const optionPriceElement=variantOption.querySelector(".cw-product-bundle__option-price");optionPriceElement&&(optionPriceElement.innerHTML=discountPrice)}};updateVariantOption("4",Shopify.formatMoney(thirtyPercentOff)),updateVariantOption("3",Shopify.formatMoney(twentyPercentOff)),updateVariantOption("2",Shopify.formatMoney(fifteenPercentOff)),updateVariantOption("1",Shopify.formatMoney(money))}$("#fourplusqty").on("input",function(){let qtyText=$(".main-product__quantity-option .cw-product-bundle__variant-option").attr("data-text")||"";var inputValue=$(this).val();qtyText=="4+ Qty",$(".main-product__quantity-option .cw-product-bundle__variant-selected").attr("currentqty",inputValue)});
139//# sourceMappingURL=/cdn/shop/t/342/assets/eq-product-script.js.map?v=85797845478619674381790177121
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.