1!function(){window.ADYENLOCALES={baseList:["ar","bg-BG","ca-ES","cs-CZ","da-DK","de-DE","el-GR","en-US","es-ES","et-EE","fi-FI","fr-FR","hr-HR","hu-HU","is-IS","it-IT","ja-JP","ko-KR","lt-LT","lv-LV","nl-NL","no-NO","pl-PL","pt-BR","pt-PT","ro-RO","ru-RU","sk-SK","sl-SI","sv-SE","zh-CN","zh-TW"],byLanguage:{ar:"ar",bg:"bg-BG",ca:"ca-ES",cs:"cs-CZ",da:"da-DK",de:"de-DE",el:"el-GR",en:"en-US",es:"es-ES",et:"et-EE",fi:"fi-FI",fr:"fr-FR",hr:"hr-HR",hu:"hu-HU",is:"is-IS",it:"it-IT",ja:"ja-JP",ko:"ko-KR",lt:"lt-LT",lv:"lv-LV",nl:"nl-NL",no:"no-NO",pl:"pl-PL",pt:"pt-PT",ro:"ro-RO",ru:"ru-RU",sk:"sk-SK",sl:"sl-SI",sv:"sv-SE",zh:"zh-CN"}},window.REGEXES={PASSWORD:/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9]).{8,20}$/,HASNUMBER:/\d/,CONTAINSUPPERLOWER:/^(?=.*[A-Z])(?=.*[a-z]).*$/,CHARACTERRANGE:/^.{8,20}$/,EMAIL:/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/,NUMBER:/^[\-\+]?(\d+|\d+\.?\d+)$/,NOSPECIAL:/^[\w\s.,\-']*$/,PHONE:/^[^A-Za-z]+$/},window.AddressAutocomplete=class e{static apiKey="AIzaSyBQQ-XsXEUoHc2ltzRXq_gSnnp37VZSaLA";static autocompleteApiUrl="https://places.googleapis.com/v1/places:autocomplete";static validationApiUrl=`https://addressvalidation.googleapis.com/v1:validateAddress?key=${e.apiKey}`;constructor(e,t,s,i,o,r,a=!1){this.suggest=document.createElement("div"),this.suggest.classList.add("address-suggestions","hidden"),this.suggest.setAttribute("role","listbox"),this.suggest.setAttribute("aria-live","polite"),this.suggest.setAttribute("aria-label","address-suggestions"),this.suggestions=[];let n=null,l={};this.updateStates=()=>
1{if(i&&(n=i.closest(".formField:not(.hidden)"),n)){const e=Array.from(i.querySelectorAll("[data-iso]"));l=e.reduce((e,t)=>(e[t.getAttribute("data-iso")]=t.value,e),{})}},this.updateStates();const c=Array.from(r.querySelectorAll("[data-iso]")),d=c.reduce((e,t)=>(e[t.getAttribute("data-iso")]=t.value,e),{}),h=c.reduce((e,t)=>(e[t.value]=t.getAttribute("data-iso"),e),{});a&&r.addEventListener("change",()=>{this.suggestions=[],this.updateStates()});const u=e.closest(".formField");u.appendChild(this.suggest),e.addEventListener("focus",e=>{const t=null!==u.querySelector("input:-webkit-autofill,input:autofill");e.isTrusted&&!t&&this.suggestions&&this.suggestions.length>0&&this.suggest.classList.remove("hidden")}),e.addEventListener("blur",()=>{window.setTimeout(()=>this.suggest.classList.add("hidden"),300)}),e.addEventListener("keyup",t=>{const s=null!==u.querySelector("input:-webkit-autofill,input:autofill");t.isTrusted&&!s&&13!==t.keyCode&&(window.clearTimeout(this.keyupTimeout),this.keyupTimeout=window.setTimeout(async()=>{const t=e.value.trim();if(t&&t.length&&t.length>1)try{const e=a?h[r.value]:void 0;this.suggestions=await this.postAutocomplete(t,e),this.displaySuggestions()}catch(e){console.error("Autocomplete error: ",e),this.suggest.classList.add("hidden")}else this.suggest.classList.add("hidden")},300))}),this.suggest.addEventListener("click",async a=>{const c=a.target.getAttribute("data-index");if(c&&this.suggestions&&this.suggestions.length>0){const a=this.suggestions[Number(c)];if(a)try{const c=await this.postValidation(a);if(e.value=c.addressLines&&c.addressLines.length>0?c.addressLines[0]:"",e.dispatchEvent(new Event("input")),t.value=c.addressLines&&c.addressLines.length>1?c.addressLines[1]:"",t.dispatchEvent(new Event("input")),s.value=c.locality??"",s.dispatchEvent(new Event("input")),o.value=c.postalCode??"",o.dispatchEvent(new Event("input")),!c.regionCode||d[c.regionCode]&&r.value!==d[c.regionCode])throw new Error(`Invaid country: ${c.regionCode??"no country"}`);c.administrativeArea="Québec"===c.administrativeArea?"QC":c.administrativeArea,n&&(c.administrativeArea&&l[c.administrativeArea]?(n.classList.remove("hidden"),i.removeAttribute("disabled"),i.classList.remove("select-placeholder"),i.value=l[c.administrativeArea],i.dispatchEvent(new Event("input"))):(n.classList.remove("hidden"),i.removeAttribute("disabled")))}catch(e){console.error("Validation error: ",e)}}})}getSessionToken(){return window.crypto?.randomUUID?crypto.randomUUID():(Math.random()+1).toString(36).substring(7)}displaySuggestions(){this.suggestions&&this.suggestions.length>0?(this.suggest.innerHTML=this.suggestions.map((e,t)=>`<div class="suggestion" data-index="${t}" role="option">${e}</div>`).join(""),this.suggest.classList.remove("hidden")):(this.suggest.innerHTML="",this.suggest.classList.add("hidden"))}async postAutocomplete(t,s){this.sessionToken||(this.sessionToken=this.getSessionToken());const i={input:t,includedRegionCodes:[s??window.RegionSetting??"US"],sessionToken:this.sessionToken},o=await fetch(e.autocompleteApiUrl,{method:"POST",headers:{"Content-Type":"application/json","X-Goog-Api-Key":e.apiKey},cache:"no-cache",body:JSON.stringify(i)}),r=await o.json();return r.suggestions?.map(e=>e.placePrediction.text.text)}async postValidation(t){const s={address:{addressLines:t,postalCode:""},sessionToken:this.sessionToken},i=await fetch(e.validationApiUrl,{method:"POST",headers:{"Content-Type":"application/json"},cache:"no-cache",body:JSON.stringify(s)});this.sessionToken=null;const o=await i.json();return this.suggest.classList.add("hidden"),o.result.address.postalAddress}};const e=window.location.href.match(/(?:cannondale\.com\/)(\w{2}-\w{2})/);let t;if(e){const s=e[1].replace(/-\w{2}/,e=>e.toUpperCase());if(window.ADYENLOCALES.baseList.includes(s))t=s;else{const e=s.split("-")[0];t=window.ADYENLOCALES.byLanguage[e]||"en-US"}}window.AdyenHandler=class e{static isNotProd=/(?:c[md]-(?:qa|dev)0|local)\.cannondale/i.test(window.location);static locale=t;createKeyLookup={scheme:"Card",applepay:"ApplePay",bcmc:"Bancontactcard",bcmc_mobile:"BcmcMobile",eps:"EPS",googlepay:"GooglePay",ideal:"iDEAL",paypal:"PayPal"};
1methodsToIgnore=["Bancontact card"];resultCodes={Authorised:"Authorised",Cancelled:"Cancelled",Error:"Error",Refused:"Refused"};storedBillingAddress={};needsBillingForm=["scheme","ideal","eps","klarna","klarna_account","klarna_paynow","bcmc_mobile"];configuration={environment:e.isNotProd?"test":"live",clientKey:e.isNotProd?"test_ZYYBLUXTG5GORHMYV3ZNJL2DGA3SB7S5":"live_MIDOFG35JJHDZK6HILQUG2XQYQ3Z6UBX",analytics:{enabled:!0},locale:e.locale,session:{id:"",merchantOrderReference:"",sessionData:""},beforeSubmit:(e,t,s)=>{console.log("before submit hook"),document.getElementById("AdyenErrorLabel").classList.add("hidden"),this.component=t;try{this.beforeSubmitHandler(e,t,s)}catch(e){console.error("There was a problem with the before submit handler for adyen",e)}},onPaymentCompleted:(e,t)=>{if(console.log("completed hook"),!e||!t)return void console.log("Arguments are missing",{result:e,component:t});const{resultCode:s,sessionData:i,sessionResult:o}=e;if(s===this.resultCodes.Authorised)this.configuration.session.sessionResult=o,this.paymentCompletedHandler();else{switch(console.log("an error occurred"),s){case this.resultCodes.Cancelled:case this.resultCodes.Error:case this.resultCodes.Refused:}document.getElementById("AdyenErrorLabel").classList.remove("hidden"),t.setStatus("ready")}},onPaymentFailed:(e,t)=>{if(!e||!t)return void console.log("Arguments are missing",{result:e,component:t});const{resultCode:s,sessionData:i,sessionResult:o}=e;switch(console.log("failed hook",s,t),console.log("an error occurred"),s){case this.resultCodes.Cancelled:case this.resultCodes.Error:case this.resultCodes.Refused:}this.resetComponent(t);const r=document.getElementById("AdyenErrorLabel");r.classList.remove("hidden"),document.getElementById(t._node.id).appendChild(r)},onError:(e,t)=>{console.log("error hook"),console.error("error with adyen",e.name,e.message,e.stack,t),this.resetComponent(t)}};constructor({amount:e,checkout:t,checkoutLoading:s,checkoutPageLoading:i,currency:o,countryCode:r,moveBillingForm:a,shopperEmail:n,cartId:l,urlErrorId:c,beforeSubmitHandler:d=()=>{},paymentCompletedHandler:h=()=>{}}){const u=window.CURRENCY_DECIMALS[o];this.amount=u?Math.round(e*10**u):e,this.checkout=t,this.checkoutLoading=s,this.checkoutPageLoading=i,this.currency=o,this.countryCode=r,this.moveBillingForm=a,this.shopperEmail=n,this.cartId=l,this.beforeSubmitHandler=d,this.paymentCompletedHandler=h,this.urlErrorId=c,this.init()}resetCardsForm(e){this.cardsLoading||(this.cardsLoading=new window.LoadingGraphic(document.getElementById("AdyenCardsComponent"),{position:"absolute",background:"white"}));const t=new MutationObserver((e,s)=>{for(const s of e)"childList"===s.type&&s.addedNodes.length>0&&s.addedNodes.forEach(e=>{e.classList.contains("adyen-checkout__button")&&(this.moveBillingForm(document.querySelector(".radio-toggle__input:checked")),t.disconnect(),this.cardsLoading.end())})});t.observe(document.getElementById("AdyenCardsComponent"),{childList:!0,subtree:!0}),this.cardsLoading.start(),e.mount("#AdyenschemeComponent")}resetComponent(e){const t=e?._node?.id;t?(console.log("Reset component",t),"AdyenCardsComponent"===t?this.resetCardsForm(e):e.mount(`#${t}`)):console.warn("Could not reset component",e)}createComponents(e){const{paymentMethodsResponse:{paymentMethods:t}}=this.AdyenCheckoutInstance,s=t.reduce((e,{name:t,type:s})=>("scheme"===s&&(t="Cards"),this.methodsToIgnore.includes(t)||e.push({createKey:/klarna/i.test(s)?"Klarna":this.createKeyLookup[s],name:t,type:s}),e),[]),i=document.createElement("template");e&&(CheckoutBillingForm.classList.add("hidden"),window.legalBlock.classList.add("hidden"),window.initialBillingParent.appendChild(CheckoutBillingForm),window.initialBillingParent.appendChild(window.legalBlock),document.querySelectorAll(".adyen-checkout-option").forEach(e=>e.remove()));const o="affirm"===this.urlErrorId?e=>"affirm"===e:e=>"scheme"===e;i.innerHTML=s.map(({createKey:e,name:t,type:s})=>{const i=window.PaymentMethodTranslations[s]??t,r=o(s)?"checked":"";return`\n <div class="adyen-checkout-option checkout__options-option ${s}-select-panel ${this.needsBillingForm.includes(s)?"-needs-billing-form":""}">\n <input type="radio" name="payment_type" value="${s}" class="radio-toggle__input" id="payment_type_${s}" ${r} />\n\n <label class="radio-toggle" for="payment_type_${s}" data-panel-name="${s}">
1\n <span>${i}</span>\n <img src="/-/media/foundation/kernel/commerce/${e}" />\n </label>\n\n <div id="Adyen${s}Component" class="radio-toggle__content"></div>\n </div>\n `}).join(""),this.checkoutLoading.start(),PaymentMethodsRadioToggle.querySelector(".checkout__payment-options").appendChild(i.content),this.adyenComponents={};const r=document.querySelector(".radio-toggle__input:checked");if(r.closest(".adyen-checkout-option")){const e=new MutationObserver((t,s)=>{for(const s of t)"childList"===s.type&&s.addedNodes.length>0&&s.addedNodes.forEach(t=>{(t.classList.contains("adyen-checkout__button")||t.className.includes("checkout__paywith"))&&(this.moveBillingForm(r),e.disconnect(),this.checkoutLoading.end(),this.checkoutPageLoading.end())})});e.observe(r.parentElement.querySelector(".radio-toggle__content"),{childList:!0,subtree:!0})}else this.moveBillingForm(r),this.checkoutLoading.end(),this.checkoutPageLoading.end();s.forEach(({createKey:e,type:t})=>{let s={};if(/klarna/i.test(t))s={useKlarnaWidget:!0,type:t};else if("bcmc_mobile"===t)s={type:t};else switch(t){case"scheme":case"Bancontactcard":s={hasHolderName:!0,holderNameRequired:!0};break;case"paypal":s={intent:"capture",blockPayPalVenmoButton:!0,onAuthorized:({billingAddress:e},t)=>{this.storedBillingAddress=Object.keys(e).reduce((t,s)=>{const i=e[s];return i&&i.length&&"ZZ"!==i&&(t[s]=i),t},{}),t.resolve()}};break;case"applepay":s={requiredBillingContactFields:["postalAddress"],onAuthorized:({authorizedEvent:e,billingAddress:t},s)=>{this.storedBillingAddress=Object.keys(t).reduce((e,s)=>{const i=t[s];return i&&i.length&&"ZZ"!==i&&(e[s]=i),e},{});const{payment:{billingContact:i}}=e;i&&(this.storedBillingAddress.firstName=i.givenName,this.storedBillingAddress.lastName=i.familyName),s.resolve()}};break;case"googlepay":s={billingAddressRequired:!0,billingAddressParameters:{format:"FULL"},phoneNumberRequired:!0,emailRequired:!0,onAuthorized:({authorizedEvent:e,billingAddress:t,deliveryAddress:s},i)=>{this.storedBillingAddress=Object.keys(t).reduce((e,s)=>{const i=t[s];return i&&i.length&&"ZZ"!==i&&(e[s]=i),e},{});const{paymentMethodData:o}=e;o&&(this.storedBillingAddress.nameOnCard=o.info?.billingAddress?.name),i.resolve()}}}try{switch(t){case"applepay":this.adyenComponents[t]=new window.AdyenWeb[e](this.AdyenCheckoutInstance,s),this.adyenComponents[t].isAvailable().then(()=>{this.adyenComponents[t].mount(`#Adyen${t}Component`)}).catch(()=>{document.querySelector(".applepay-select-panel").remove()});break;case"ideal":this.adyenComponents[t]=new window.AdyenWeb.Redirect(this.AdyenCheckoutInstance,{type:"ideal"}).mount("#AdyenidealComponent");break;default:this.adyenComponents[t]=new window.AdyenWeb[e](this.AdyenCheckoutInstance,s).mount(`#Adyen${t}Component`)}}catch(s){console.warn(`Error initializing adyen component with type ${t} and createKey ${e}`,s.message)}});const a=PaymentMethodsRadioToggle.querySelectorAll(".radio-toggle");1===a.length?a[0].closest(".checkout__options-option")?.classList.add("single-payment"):document.querySelector(".single-payment")?.classList.remove("single-payment")}async init(e){try{const t=await window.EndpointManager.post("/api/payment/createPaymentSessionSecure",{cartId:this.cartId,returnUrl:`${this.checkout.basePageURL}/adyen-confirmation`}),s=JSON.parse(t),{id:i,merchantAccount:o,reference:r,sessionData:a}=s;return this.configuration.session.id=i,this.configuration.session.sessionData=a,this.configuration.session.merchantOrderReference=r,this.merchantAccount=o,this.AdyenCheckoutInstance=await window.AdyenWeb.AdyenCheckout(this.configuration),this.createComponents(e),!0}catch(e){const{Code:t,Content:s}=e.Messages[0];if("0"===t)document.querySelector('.checkout__step[data-step="shipping"] .checkout__step-edit em')?.click(),window.cjsQuickModal({title:window.CheckoutText.ERROR_EMOJI,content:`\n <p>${window.CheckoutText.INCORRECT_POSTAL_CODE}</p>\n <br>\n <a class="triggerModalClose button inverted">${window.CheckoutText.CLOSE_ERROR_MODAL}</a>\n `,canClose:!0}).toggle();return!1}}};class s{constructor(e){this.elem=e,this.cartEmpty=e.querySelector(".cart-section__empty"),this.cartError=e.querySelector(".cart-section__error"),this.cartSummary=e.querySelector(".cart-section__summary"),this.cartItems=e.querySelector(".cart-section__summary-list"),this.mcMessageC2C=document.getElementById("mcMessageC2C"),this.mcMessageD2C=document.getElementById("mcMessageD2C"),this.mcItemMessage=e.querySelector(".mc-item__message-text"),this.mcItemDetails=e.querySelector(".mc-item__details"),this.subtotalElems=e.querySelectorAll(".cart-section__subtotal"),this.vatIncluded=document.getElementById("vatIncluded"),this.call2recycleLineItems=e.querySelectorAll(".call2recycle__line-item"),this.call2recycleFeeElems=e.querySelectorAll(".cart-section__recycle-fee"),this.peopleforbikesLineItems=e.querySelectorAll(".peopleforbikes__line-item"),this.peopleforbikesFeeElems=e.querySelectorAll(".cart-section__people-for-bikes-fee"),this.checkoutLink=e.querySelector(".cart-section__checkout-link"),this.fullCartItemTotal=document.getElementById("fullCartItemTotal"),this.errorSummaries=e.querySelectorAll(".cart-section__error-summary"),window.AffirmEnabled&&(this.affirmDisplay=document.getElementById("affirmDisplay")),window.KlarnaEnabled&&(this.klarnaDisplay=document.getElementById("klarnaCartDisplay")),this.cartText={GHOST:{REMOVED:this.cartSummary.dataset.removedlabel||"has been removed from your cart"},C2C:{TITLE:this.cartSummary.dataset.c2ctitle||"Pick Up in Shop",COPY:this.cartSummary.dataset.c2ccopy||"Your bike will be assembled at a shop."},D2C:{TITLE:this.cartSummary.dataset.d2ctitle||"Ships to You",COPY:this.cartSummary.dataset.d2ccopy||"Your items will ship free if your order is more than 49+"}
1,D2COPTIONAVAILABLE:this.cartSummary.dataset.d2coptionlabel||"This item has the option to ship to you direct"},this.loadingGraphic=new window.LoadingGraphic(this.cartSummary,{position:"fixed",background:"white"}),window.utilities.bindHybridClick(this.cartSummary,e=>{const t=e.target.closest("[data-action]");if(t&&!t.classList.contains("disabled")){switch(t.dataset.action){case"remove":case"quantity-down":s.removeItem(t.dataset.lineNumber,t.dataset.lineItemId,t.dataset.quantity,t.dataset.shippingMethod);break;case"quantity-up":s.addItem(t.dataset.salsifyId,t.dataset.sku)}}}),window.utilities.bindHybridClick(this.cartItems,e=>{const t=e.target.closest(".shipping-restriction-link");if(t){const e=`shipping-restriction-${t.dataset.sku}`,s=document.querySelector(`[data-modal-name="${e}"]`);window.cjsToggleModal(e),s.querySelector(".closeModal").focus()}})}static getCartData(){return window.storedCart?Promise.resolve(window.storedCart):s.fetchCartData()}static async fetchCartData(){return s.fetchCartDataPromise||(s.fetchCartDataPromise=(async()=>{try{const e=await window.EndpointManager.post("/api/cart",{});return window.storedCart=e,e}catch(e){throw console.error("Error fetching cart data:",e),e}finally{s.fetchCartDataPromise=null}})()),s.fetchCartDataPromise}static async initialize(){window.carts.forEach(e=>e.loadingGraphic.start());let e=!0;try{const e=await s.getCartData();s.populateCarts(e)}catch(t){console.log("An error occurred retrieving the cart",t),e=!1}finally{return window.carts.forEach(e=>e.loadingGraphic.end()),e}}static async addItem(e,t,i){const o=!t||i;t||(t=window.selectedVariant.Sku,e=window.productSalsifyId),o||window.carts.forEach(e=>e.elem.classList.remove("status-added"));try{const r=await window.EndpointManager.post("/api/cart/items",{SalsifyId:e,sku:t,Quantity:1}),a=r.Lines.find(({Sku:e})=>e===t);if(a){o&&window.recentSkus.push(t),s.populateCarts(r);const e=document.getElementById("mini-cart-recommendations");
1if(e){const t=r.Lines.map(e=>e.SalsifyId);i&&!window.isCartPage?window.utilities.itemAddedAnimation(i).then(()=>window.utilities.RecommendedProductsCarousel(a,e,t)):window.utilities.RecommendedProductsCarousel(a,e,t)}window.updateCartPageRecommendations&&(i&&window.isCartPage?window.utilities.itemAddedAnimation(i).then(()=>window.updateCartPageRecommendations(r)):window.updateCartPageRecommendations(r)),s._gaUpdateCart(a,"add",1,o),o&&(window.carts.forEach(e=>e.elem.classList.add("status-added")),window.isCartPage||window.showMiniCart())}else if(r.Messages){const e=r.Messages.find(e=>50===e.Code);if(e){window.cjsQuickModal({name:"out-of-stock-error-modal",title:window.messaging.errorEmoji,modalClassName:"checkout__error-modal",content:`\n <p>${e.Message}</p>\n <br>\n <a class="triggerModalClose button inverted">${window.messaging.closeErrorModal||"OK"}</a>\n `}).toggle();const t=i||document.getElementById("AddToCartButton");t&&o&&(t.querySelector(".-in-stock").classList.add("hidden"),t.querySelector(".-out-of-stock").classList.remove("hidden"),t.classList.add("disabled"))}}}catch(e){console.log("An error occurred retrieving the cart",e)}finally{window.carts.forEach(e=>e.loadingGraphic.end())}}static async removeItem(e,t,i=1,o){window.carts.forEach(e=>e.loadingGraphic.start());try{const r=window.storedCart.Lines[e];1===i?s._gaUpdateCart(r,"remove"):s._gaUpdateCart(r,"remove",r.Quantity);const a=`/api/cart/items/${t}/${i}/${o}`,n=await window.EndpointManager.delete(a,{});s.populateCarts(n)}catch(e){console.log("An error occurred retrieving the cart",e)}finally{window.carts.forEach(e=>e.loadingGraphic.end())}}static checkForRemovedPromoCodes(e){const t=e.Messages.find(e=>e.Key.includes("DISCOUNT_CODE_REMOVED"));if(t){window.promoCodes?.loadPromoCode();var s=t.Key.indexOf("["),i=t.Key.indexOf("]"),o=t.Key.substring(s+2,i-1),r=window.CartText.PROMO_CODES_REMOVED_MESSAGE.replace("{0}",o);window.cjsQuickModal({name:"promo-codes-removed-modal",title:window.CartText.PROMO_CODES_REMOVED_TITLE,modalClassName:"checkout__error-modal",content:`\n <p>${r}</p>\n <br>\n <a class="triggerModalClose button inverted">${window.CartText.PROMO_CODES_REMOVED_BUTTON}</a>\n `},async()=>{window.EndpointManager.delete("/api/carts/clearcartmessage/DISCOUNT_CODE_REMOVED","").then(()=>{}).catch(e=>console.warn("Error clearing removed promo code messages",e))}).toggle()}}static populateCarts(e){if(localStorage.removeItem("StoredStep"),e){const t=s.prepareData(e);if((t.cartSections.C2C.length||t.cartSections.D2C.length)&&window.carts.forEach(s=>s.render(e,t)),e.IsMergedCart){window.cjsQuickModal({name:"out-of-stock-error-modal",title:window.messaging.cartMergeHeader,modalClassName:"checkout__error-modal",content:`\n <p>${window.messaging.cartMergeBody}</p>\n <br>\n <a class="triggerModalClose button inverted">${window.messaging.closeErrorModal||"OK"}</a>\n `},async()=>{const e=JSON.stringify({clearMergeMessage:!0});window.EndpointManager.post("/api/cart",{cartMessageData:e}).then(()=>{}).catch(e=>console.warn("Error clearing merge message",e))}).toggle()}this.checkForRemovedPromoCodes(e)}else console.warn("Cart error: ","Server returned no cart data"),window.miniCartTrigger.setAttribute("data-error","error")}static _gaUpdateCart(e,t,s=1,i=!0){const o=e.ProductUrl.substring(8).split("/")[4],r=o[0].toUpperCase()+o.substring(1),a="Bike"===e.ProductType?"Bikes":e.ProductType;dataLayer.push({ecommerce:null}),dataLayer.push({event:"add"===t?"add_to_cart":"remove_from_cart",ecommerce:{items:[{item_id:e.Sku.substring(0,7),item_name:[e.ProductTitle,e.ProductSubtitle].join(" "),affiliation:"Cannondale Website",currency:window.currencyCode||"",discount:e.Msrp-e.Price,item_brand:"Cannondale",item_category:a,item_category2:e.CategoryName,item_category3:r,item_category4:e.ProductTitle,item_list_id:i?"":"cart",item_list_name:i?"":"Cart",item_variant:[e.Color,e.Size].join("|").toLowerCase(),price:e.Price,quantity:s}]}})}static prepareData(e){if(0==e.Lines.length&&!window.hasPreparedCart)return window.carts.forEac
1h(e=>e.setEmpty()),window.miniCartTrigger.removeAttribute("data-quantity"),window.miniCartTrigger.removeAttribute("data-error"),{cartSections:{D2C:[],C2C:[]}};const t=window.utilities.parseMessagesObject(e.Messages),s=e.Lines.map(e=>{const s=t.MessageLookup[e.Sku];return s&&(e.errorMsg=s.Message,e.errorCode=s.Code),e});window.hasPreparedCart&&window.storedCart.Lines.forEach((t,i)=>{e.Lines.filter(e=>e.Sku===t.Sku)[0]||(t.isGhost=!0,s.splice(i,0,t))}),window.hasPreparedCart=!0,window.storedCart=e;let i=-1;const o=s.reduce((e,t,s)=>{const o=t.SelectedShippingMethod;return t.isGhost||(t.lineNumber=++i),e[o].push(t),e},{D2C:[],C2C:[]});return t.HasError?window.miniCartTrigger.setAttribute("data-error","error"):(window.miniCartTrigger.removeAttribute("data-error"),window.storedCart&&window.storedCart.Lines.length>0?window.miniCartTrigger.setAttribute("data-quantity",window.storedCart.ItemCount):window.miniCartTrigger.removeAttribute("data-quantity")),{cartSections:o,HasError:t.HasError}}static updateCartSubtotal(e,t){const{Subtotal:s,TaxMode:i}=window.storedCart;e.forEach(e=>e.textContent=window.utilities.formatCurrency(s)),"Disabled"===i&&t.classList.remove("hidden")}static updateCartFees(e,t,s){const i=e>0;t.forEach(e=>e.classList.toggle("hidden",!i)),i&&s.forEach(t=>t.textContent=window.utilities.formatCurrency(e))}setEmpty(){this.cartEmpty.classList.remove("hidden"),this.cartSummary.classList.add("hidden"),this.onEmpty&&this.onEmpty()}render(e,t){if(this.cartEmpty.classList.add("hidden"),this.cartSummary.classList.remove("hidden"),this.cartItems.innerHTML=`${["C2C","D2C"].map(e=>t.cartSections[e].length?`\n <div class="Cart-section-header">\n <h3>${this.cartText[e].TITLE}</h3>\n <p>${this.cartText[e].COPY}</p>\n </div>\n ${t.cartSections[e].map(e=>this.renderCartItem(e)).join("")}\n `:"").join("")}`,t.HasError?(this.checkoutLink.setAttribute("data-disabled","disabled"),this.errorSummaries.forEach(e=>e.classList.remove("hidden"))):(this.checkoutLink.removeAttribute("data-disabled"),this.errorSummaries.forEach(e=>e.classList.add("hidden"))),s.updateCartFees(window.storedCart.RecycleFeeTotal,this.call2recycleLineItems,this.call2recycleFeeElems),s.updateCartFees(window.storedCart.PeopleForBikesTotal,this.peopleforbikesLineItems,this.peopleforbikesFeeElems),s.updateCartSubtotal(this.subtotalElems,this.vatIncluded),"function"==typeof window.renderSavings&&window.renderSavings(e.TotalSavings),this.fullCartItemTotal&&(this.fullCartItemTotal.textContent=`(${e.ItemCount})`),window.AffirmEnabled){const e=window.utilities.affirmFormat(window.storedCart.Total),t=parseInt(window.storedCart.Total)<window.AffirmLoanThreshold;this.affirmDisplay.setAttribute("data-amount",e),window.affirm?.ui?affirm.ui.ready(()=>{affirm.ui.refresh(),this.affirmDisplay.classList.remove("hidden",t)}):console.log("Affirm not loaded")}if(window.KlarnaEnabled){const e=window.utilities.affirmFormat(window.storedCart.Total),t=parseInt(window.storedCart.Total)<window.KlarnaLowerThreshold||parseInt(window.storedCart.Total)>window.KlarnaUpperThreshold;this.klarnaDisplay.setAttribute("data-purchase-amount",e),this.klarnaDisplay.classList.toggle("hidden",t)}this.onRender&&this.onRender()}renderGhostItem(e){return`<div class="Cart-item -ghost-item">\n <p class="Cart-item-ghost-text"><a href="${e.ProductUrl}">${e.ProductTitle} ${e.ProductSubtitle}</a> ${this.cartText.GHOST.REMOVED}</p>\n </div>`}renderCartItem(e){if(e.isGhost)return this.renderGhostItem(e);const t=e.ShippingRestrictions?.length>0&&e.ShippingRestrictions.find(e=>!0===e.ShowCartLink);t&&window.cjsQuickModal({name:`shipping-restriction-${e.Sku}`,title:window.messaging.shippingRestrictionHeader,showClose:!0,content:`\n <p class="p_s" style="margin-bottom: 0;">${e.ShippingRestrictions.map(e=>e.LinkModalSubtext).join("<br/><br/>")}</p>\n `});const s=!!("number"==typeof e.Msrp&&"number"==typeof e.Price&&e.Msrp>e.Price);return`<div class="Cart-item">\n <a class="Cart-item-img" href="${e.ProductUrl}" style="background-image: url(${e.PreviewImageUrl});"></a>\n <div class="Cart-item-details">\n <div class="row-spread">\n <h3 class="Cart-item-details-title">\n <a href="${e.ProductUrl}">\n ${e.ProductTitle} ${e.ProductSubtitle}\n </a>\n </h3>\n <p class="Cart-item-price">${window.utilities.formatCurrency(e.TotalLinePrice)}</p>\n </div>\n\n <div class="row-spread">\n <p class="Cart-item-size_and_color">\n ${e.Size}/${e.Color}\n </p>\n <div>\n ${e.Quantity>1?`<p class="Cart-item-price-strikethrough" style="text-decoration: none; margin:0;">${window.utilities.formatCurrency(e.Price)} ${window.messaging.each}</p>`:""}\n ${s?`<p class="Cart-item-price-strikethrough">${window.utilities.formatCurrency(e.Msrp)} ${e.Quantity>1?window.messaging.each:""}</p>`:""}\n </div>\n </div>\n\n ${e.errorMsg?`\n <div class="error-label leftAlign"><div class="error-label__indicator"></div><span class="error-label__msg fullWidth">${e.errorMsg}</span></div>\n `:""}\n\n <div style="display: flex;">\n <div class="Cart-item-quantity">\n <a class="Cart-item-quantity-arrow${1===e.Quantity?" disabled":""}" data-shipping-method="${e.SelectedShippingMethod}" data-action="quantity-down" data-quantity="${e.Quantity-1}" data-sku="${e.Sku}" data-line-item-id="${e.LineItemId}" data-line-number="${e.lineNumber}" ${1===e.Quantity?' tabindex="-1"':' tabindex="0" role="button"'}><i class="icon icon-minus"></i></a>
1\n <span class="Cart-item-quantity-display">${e.Quantity}</span>\n <a class="Cart-item-quantity-arrow${e.Quantity>=e.Inventory?" disabled":""}" data-action="quantity-up" data-salsify-id="${e.SalsifyId}" data-sku="${e.Sku}" ${e.Quantity>=e.Inventory?' tabindex="-1"':' tabindex="0"'} role="button"><i class="icon icon-plus"></i></a>\n </div>\n <a class="Cart-link-remove" data-shipping-method="${e.SelectedShippingMethod}" data-action='remove' data-quantity="0" data-line-item-id="${e.LineItemId}" data-line-number="${e.lineNumber}" tabindex="0" role="button"></a>\n </div>\n \n ${t?`<div class="shippingRestrictionsNotice"><a class="shipping-restriction-link" data-sku="${e.Sku}" tabindex="0">${window.messaging.shippingRestrictionHeader}</a></div>`:""}\n\n \n </div>\n \n </div>`}}window.Cart=s;let i=!1;class o{constructor(e){this.elem=e,this.trigger=this.elem.querySelector(".trigger"),this.trigger.insertAdjacentHTML("beforeend",'<div class="selected"><div class="text"></div><span class="indicator"></span></div>');const t=this.elem.querySelector(".new-select");t?this.newSelect=t:(this.newSelect=document.createElement("div"),this.newSelect.className="new-select",this.elem.appendChild(this.newSelect)),"auto"!==this.elem.getAttribute("data-create")&&0!==this.newSelect.innerHTML.length||(this.newSelect.innerHTML=Array.from(this.elem.querySelectorAll("option")).map(e=>`\n <a class="option" data-value="${e.value}">\n <div class="text">${e.textContent}</div>\n <span class="indicator"></span>\n </a>\n `).join(""))}static setClickEvents(){i||(i=!0,document.addEventListener("click",e=>{if(e.target.closest(".bike-registration"))return;const t=e.target.closest(".dropdown");if(t){e.preventDefault(),e.stopPropagation(),t.classList.contains("is-open")?t.classList.remove("is-open"):(document.querySelectorAll(".dropdown.is-open,.filter-product .all-filters-panel.is-open").forEach(e=>e.classList.remove("is-open")),document.querySelectorAll(".filter-product .all-filters-trigger.is-active").forEach(e=>e.classList.remove("is-active")),t.classList.add("is-open"));const s=e.target.closest(".new-select a");if(s){const e=t.querySelector("select"),i=document.createEvent("HTMLEvents");i.initEvent("change",!1,!0),e.value=s.getAttribute("data-value"),e.dispatchEvent(i)}}else document.querySelectorAll(".dropdown.is-open").forEach(e=>e.classList.remove("is-open"))}))}static createDropdown(e){"string"==typeof e?document.querySelectorAll(e).forEach(e=>{e.classList.contains("bike-registration")||new o(e)}):new o(e),o.setClickEvents()}}class r{static eyeOpen='<svg width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M12.3438 7.5C10.1094 7.5 8.11085 8.45311 6.68607 9.44956C5.97089 9.94974 5.38806 10.4692 4.97934 10.9037C4.77567 11.1201 4.60896 11.3222 4.48956 11.4959C4.43022 11.5822 4.37677 11.6699 4.33626 11.7549C4.30222 11.8264 4.25 11.9506 4.25 12.0938C4.25 12.2369 4.30222 12.3611 4.33626 12.4326C4.37677 12.5176 4.43022 12.6053 4.48956 12.6916C4.60896 12.8653 4.77567 13.0674 4.97934 13.2838C5.38806 13.7183 5.97089 14.2378 6.68607 14.7379C8.11085 15.7344 10.1094 16.6875 12.3438 16.6875C14.5784 16.6875 16.5769 15.7344 18.0016 14.7379C18.7168 14.2378 19.2996 13.7183 19.7082 13.2838C19.9119 13.0673 20.0786 12.8653 20.198 12.6916C20.2573 12.6053 20.3108 12.5176 20.3513 12.4325C20.3853 12.3611 20.4375 12.2368 20.4375 12.0938C20.4375 11.9507 20.3853 11.8264 20.3513 11.755C20.3108 11.6699 20.2573 11.5822 20.198 11.4959C20.0786 11.3222 19.9119 11.1202 19.7082 10.9037C19.2996 10.4692 18.7168 9.94974 18.0016 9.44957C16.5769 8.4531 14.5784 7.5 12.3438 7.5ZM7.22654 10.2379C8.55933 9.30583 10.3703 8.45893 12.3438 8.45893C14.3174 8.45893 16.1284 9.30583 17.4611 10.2379C18.1247 10.702 18.6576 11.179 19.02 11.5642C19.2018 11.7575 19.3345 11.9211 19.4181 12.0427C19.4309 12.0614 19.4421 12.0784 19.4518 12.0937C19.4421 12.109 19.4309 12.1261 19.4181 12.1448C19.3345 12.2664 19.2018 12.43 19.02 12.6233C18.6576 13.0085 18.1247 13.4855 17.4611 13.9496C16.1284 14.8817 14.3174 15.7286 12.3438 15.7286C10.3703 15.7286 8.55933 14.8817 7.22654 13.9496C6.56293 13.4855 6.02996 13.0085 5.66758 12.6233C5.48569 12.43 5.35303 12.2664 5.26944 12.1448C5.25657 12.126 5.24537 12.109 5.23569 12.0938C5.24537 12.0785 5.25657 12.0615 5.26944 12.0427C5.35303 11.9211 5.48569 11.7575 5.66758 11.5642C6.02996 11.179 6.56293 10.7021 7.22654 10.2379ZM19.496 12.1452C19.4961 12.1434 19.4965 12.1373 19.4986 12.129L19.5325 12.1099C19.5368 12.1132 19.5415 12.1162 19.5465 12.1188C19.5374 12.134 19.5268 12.1509
119.5145 12.1695L19.4985 12.1748C19.4983 12.1741 19.4981 12.173 19.4978 12.1716C19.4975 12.1701 19.4971 12.1682 19.4968 12.1663C19.4966 12.1649 19.4952 12.156 19.496 12.1452ZM5.17307 12.1695C5.16077 12.1509 5.15012 12.134 5.14097 12.1188C5.14614 12.1162 5.15082 12.1131 5.15503 12.1099L5.18891 12.129C5.19096 12.1369 5.19139 12.143 5.19151 12.1448C5.19238 12.1559 5.19091 12.165 5.1907 12.1663C5.1901 12.1702 5.18933 12.1734 5.18898 12.1748L5.17307 12.1695ZM5.12635 12.0937L5.15503 12.1099C5.16167 12.1048 5.16713 12.0992 5.17146 12.0938C5.16713 12.0883 5.16167 12.0827 5.15503 12.0776L5.18891 12.0585C5.19095 12.0506 5.19136 12.0448 5.19148 12.0431C5.19237 12.0318 5.1909 12.0225 5.19071 12.0213L5.1907 12.0212C5.1901 12.0173 5.18933 12.0141 5.18898 12.0127L5.17307 12.018C5.16077 12.0366 5.15012 12.0535 5.14097 12.0687C5.14614 12.0713 5.15082 12.0744 5.15503 12.0776L5.12635 12.0937ZM19.5145 12.018L19.4985 12.0127L19.4981 12.0146C19.4977 12.0163 19.4972 12.0187 19.4967 12.0216C19.4966 12.0228 19.495 12.0326 19.4962 12.0447C19.4963 12.0462 19.4968 12.0515 19.4986 12.0585L19.5325 12.0776C19.5258 12.0827 19.5203 12.0884 19.516 12.0938L19.519 12.0973C19.5229 12.1017 19.5274 12.106 19.5325 12.1099L19.5612 12.0937L19.5325 12.0776C19.5366 12.0744 19.5413 12.0713 19.5465 12.0687C19.5374 12.0535 19.5268 12.0366 19.5145 12.018ZM12.3438 9.04286C10.7656 9.04286 9.56025 10.4566 9.56025 12.0938C9.56025 13.7306 10.7656 15.1446 12.3438 15.1446C13.9225 15.1446 15.1273 13.7305 15.1273 12.0938C15.1273 10.4567 13.9224 9.04286 12.3438 9.04286ZM10.5097 12.0938C10.5097 10.896 11.375 10.0018 12.3438 10.0018C13.3129 10.0018 14.1779 10.8959 14.1779 12.0938C14.1779 13.2914 13.3129 14.1857 12.3438 14.1857C11.375 14.1857 10.5097 13.2913 10.5097 12.0938Z" fill="black"/>\n </svg>';static eyeClosed='<svg width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.86239 8.72161C7.43768 8.95193 7.04379 9.19938 6.68607 9.44956C5.97089 9.94974 5.38806 10.4692 4.97934 10.9037C4.77567 11.1201 4.60896 11.3222 4.48956 11.4959C4.43022 11.5822 4.37677 11.6699 4.33626 11.7549C4.30222 11.8264 4.25 11.9506 4.25 12.0938C4.25 12.2369 4.30222 12.3611 4.33626 12.4326C4.37677 12.5176 4.43022 12.6053 4.48956 12.6916C4.60896 12.8653 4.77567 13.0674 4.97934 13.2838C5.38806 13.7183 5.97089 14.2378 6.68607 14.7379C8.11085 15.7344 10.1094 16.6875 12.3438 16.6875C13.3601 16.6875 14.3276 16.4903 15.2145 16.1816L14.4607 15.4167C13.7883 15.6116 13.0773 15.7286 12.3438 15.7286C10.3703 15.7286 8.55933 14.8817 7.22654 13.9496C6.56293 13.4855 6.02996 13.0085 5.66758 12.6233C5.48569 12.43 5.35303 12.2664 5.26944 12.1448C5.25657 12.126 5.24537 12.109 5.23569 12.0938C5.24537 12.0785 5.25657 12.0615 5.26944 12.0427C5.35303 11.9211 5.48569 11.7575 5.66758 11.5642C6.02996 11.179 6.56293 10.7021 7.22654 10.2379C7.63127 9.95489 8.08009 9.67969 8.56417 9.43368L7.86239 8.72161ZM9.851 10.7394C9.66419 11.1515 9.56025 11.613 9.56025 12.0938C9.56025 13.7306 10.7656 15.1446 12.3438 15.1446C12.8711 15.1446 13.3568 14.9868 13.7698 14.7156L13.0745 14.0101C12.8474 14.1236 12.5992 14.1857 12.3438 14.1857C11.375 14.1857 10.5097 13.2913 10.5097 12.0938C10.5097 11.8807 10.537 11.6772 10.5875 11.4867L9.851 10.7394ZM11.4992 10.2397L10.8135 9.54391C11.2481 9.2288 11.7714 9.04286 12.3438 9.04286C13.9224 9.04286 15.1273 10.4567 15.1273 12.0938C15.1273 12.6216 15.002 13.1263 14.7793 13.5678L14.0592 12.8372C14.1356 12.6085 14.1779 12.3585 14.1779 12.0938C14.1779 10.8959 13.3129 10.0018 12.3438 10.0018C12.045 10.0018 11.756 10.0869 11.4992 10.2397ZM16.006 14.8126C16.5351 14.552 17.0239 14.2554 17.4611 13.9496C18.1247 13.4855 18.6576 13.0085 19.02 12.6233C19.2018 12.43 19.3345 12.2664 19.4181 12.1448C19.4309 12.1261 19.4421 12.109 19.4518 12.0937C19.4421 12.0784 19.4309 12.0614 19.4181 12.0427C19.3345 11.9211 19.2018 11.7575 19.02 11.5642C18.6576 11.179 18.1247 10.702 17.4611 10.2379C16.1284 9.30583 14.3174 8.45893 12.3438 8.45893C11.5608 8.45893 10.8035 8.59222 10.0915 8.81125L9.34328 8.05211C10.2653 7.71697 11.2777 7.5 12.3438 7.5C14.5784 7.5 16.5769 8.4531 18.0016 9.44957C18.7168 9.94974 19.2996 10.4692 19.7082 10.9037C19.9119 11.1202 20.0786 11.3222 20.198 11.4959C20.2573 11.5822 20.3108 11.6699 20.3513 11.755C20.3853 11.8264 20.4375 11.9507 20.4375 12.0938C20.4375 12.2368 20.3853 12.3611 20.3513 12.4325C20.3108 12.5176 20.2573 12.6053 20.198 12.6916C20.0786 12.8653 19.9119 13.0673 19.7082 13.2838C19.2996 13.7183 18.7168 14.2378 18.0016 14.7379C17.6119 15.0105 17.1792 15.2799 16.7105 15.5273L16.006 14.8126ZM19.4986 12.129C19.4965 12.1373 19.4961 12.1434 19.496 12.1452C19.4952 12.156 19.4966 12.1649 19.4968 12.1663L19.4978 12.1716L19.4985 12.1748L19.5145 12.1695C19.5268 12.1509
119.5374 12.134 19.5465 12.1188C19.5415 12.1162 19.5368 12.1132 19.5325 12.1099L19.5612 12.0937L19.5325 12.0776C19.5366 12.0744 19.5413 12.0713 19.5465 12.0687C19.5374 12.0535 19.5268 12.0366 19.5145 12.018L19.4985 12.0127L19.4981 12.0146C19.4977 12.0163 19.4972 12.0187 19.4967 12.0216C19.4966 12.0228 19.495 12.0326 19.4962 12.0447C19.4963 12.0462 19.4968 12.0515 19.4986 12.0585L19.5325 12.0776C19.5258 12.0827 19.5203 12.0884 19.516 12.0938L19.519 12.0973C19.5229 12.1017 19.5274 12.106 19.5325 12.1099L19.4986 12.129ZM5.14097 12.1188C5.15012 12.134 5.16077 12.1509 5.17307 12.1695L5.18898 12.1748C5.18933 12.1734 5.1901 12.1702 5.1907 12.1663C5.19091 12.165 5.19238 12.1559 5.19151 12.1448C5.19139 12.143 5.19096 12.1369 5.18891 12.129L5.15503 12.1099C5.16167 12.1048 5.16713 12.0992 5.17146 12.0938C5.16713 12.0883 5.16167 12.0827 5.15503 12.0776L5.18891 12.0585C5.19095 12.0506 5.19136 12.0448 5.19148 12.0431C5.19237 12.0318 5.1909 12.0225 5.19071 12.0213L5.1907 12.0212C5.1901 12.0173 5.18933 12.0141 5.18898 12.0127L5.17307 12.018C5.16077 12.0366 5.15012 12.0535 5.14097 12.0687C5.14614 12.0713 5.15082 12.0744 5.15503 12.0776L5.12635 12.0937L5.15503 12.1099C5.15082 12.1131 5.14614 12.1162 5.14097 12.1188Z" fill="black"/>\n <path d="M7.25 6L18.875 17.625" stroke="black" stroke-width="1.125" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>';constructor(e){this.field=e,this.toggleElem=document.createElement("span"),this.toggleElem.setAttribute("class","password-toggle-btn"),this.toggleElem.innerHTML=r.eyeClosed,this.toggleElem.ariaLabel=this.field.dataset.showPassword,this.toggleElem.tabIndex=0,this.toggleElem.addEventListener("click",()=>{this.toggle()}),this.field.after(this.toggleElem),this.field.style="display: unset"}toggle(){let e="text",t=this.field.dataset.hidePassword,s=r.eyeOpen;"password"!==this.field.type&&(e="password",s=r.eyeClosed,t=this.field.dataset.showPassword),this.toggleElem.innerHTML=s,this.field.type=e,this.toggleElem.ariaLabel=t}}class a{constructor(e){e&&(this.elem=e,this.formElem=document.getElementById("PromoCodeForm"),this.promoCodeFormField=this.elem.querySelector(".formField"),this.promoCodeButton=document.getElementById("PromoCodeButton"),this.promoCodeField=document.getElementById("PromoCodeField"),this.promoCodeFieldLabel=this.elem.querySelector(".label-swap"),this.promoCodePanelTrigger=this.elem.querySelector(".promo-code-block__trigger"),this.promoCodeDisplay=document.getElementById("PromoCodeDisplay"),this.promoCodeCount=0,this.validatedForm=new f(this.formElem),this.init())}init(){this.loadPromoCode();const e={fn:()=>this.promoCodeCount<2,msg:this.promoCodeField.dataset.vdMessageExceeded,ruleName:"promoCodeLimit"},t={fn:()=>!/[%#&*+:?.\/\\]/.test(this.promoCodeField.value),msg:this.promoCodeField.dataset.vdSpecialCharacters,ruleName:"noSpecialCharacters"},i=this.validatedForm.fields.find(e=>e.field===this.promoCodeField);i&&(i.validationFunctions.push(e,t),i.ruleNames.push("promoCodeLimit","noSpecialCharacters")),this.formElem.addEventListener("submit",async e=>{if(e.preventDefault(),this.validatedForm.validate())try{const e=await this.addPromoCode(this.promoCodeField.value);this.promoCodeField.value="",this.promoCodeCount=e.PromoCodes.length,this.renderPromoCodes(e.PromoCodes),"function"==typeof window.renderSavings&&window.renderSavings(e.TotalSavings),this.promoCodeFieldLabel.classList.remove("is-visible"),window.isCartPage?s.populateCarts(e):window.isCheckoutPage&&window.updateUserData(e)}catch(e){i.setErrors({serverError:e.Messages[0].Content})}}),this.promoCodeDisplay.addEventListener("click",async e=>{if(e.target&&e.target.classList.contains("remove-promo-code")){const t=await this.removePromoCode(e.target.getAttribute("data-promo-code"));this.promoCodeCount=t.PromoCodes.length,this.renderPromoCodes(t.PromoCodes),"function"==typeof window.renderSavings&&window.renderSavings(t.TotalSavings),window.isCartPage?s.populateCarts(t):window.isCheckoutPage&&window.updateUserData(t)}}),this.promoCodePanelTrigger.addEventListener("click",()=>{this.elem.classList.toggle("is-open")})}async loadPromoCode(){try{const e=await s.getCartData();this.promoCodeCount=e.PromoCodes.length,this.renderPromoCodes(e.PromoCodes),"function"==typeof window.renderSavings&&window.renderSavings(e.TotalSavings)}catch(e){console.log("An error occurred loading promo codes",e)}}async addPromoCode(e){try{const t=`/api/carts/discount-code/add/${e}`;return await window.EndpointManager.post(t,{})}catch(e){throw console.log("An error occurred adding promo code",e),e}}async removePromoCode(e){try{const t=`/api/carts/discount-code/remove/${e}`;return await window.EndpointManager.delete(t,{})}catch(e){console.log("An error occurred removing promo code",e)}}renderPromoCodes(e){this.promoCodeDisplay.innerHTML=e.map(({Name:e,Code:t,Description:s})=>`\n <div class="promo-code-display-block">\n <h4 class="p_s -bold">
1\n <span>${e}</span>\n <a id="RemoveCodeButton" class="remove-promo-code" data-promo-code="${t}" style="--background-delete: url(${window.deletePromoIconUrl})"></a>\n </h4>\n <p class="p_xxs">${s}</p>\n </div>\n `).join("")}}class n{constructor(e,t){this.elem=document.createElement("div"),this.elem.className=e.modalClassName?["modal",e.modalClassName].join(" "):"modal",this.elem.setAttribute("data-modal-name",e.name),this.elem.innerHTML=`\n <div class="modalOuter">\n <div class="modalUpper">\n ${e.title?`<p class="modalTitle h4 -bold">${e.title}</p>`:""}\n ${e.showClose?window.generateModalCloseElem().outerHTML:""}\n </div>\n <div class="modalInner">\n ${e.content}\n </div>\n </div>\n `,null!=e.disableClickAway&&e.disableClickAway&&this.elem.setAttribute("data-modal-disable-click-away","true"),null!=e.disableEsc&&e.disableEsc&&this.elem.setAttribute("data-modal-disable-esc","true");const s=document.querySelector(`[data-modal-name="${e.name}"]`);null!=s&&document.body.removeChild(s),document.body.appendChild(this.elem),D(this.elem,t)}toggle(){O(this.elem)}}class l{constructor(e,t){this.selected,this.elem=e,this.elemHeadline=this.elem.querySelector(".dropdown-headline"),this.headlineString=this.elemHeadline.querySelector(".dropdown-headline__inner"),this.wrapperList=this.elem.querySelector(".dropdown-list__wrapper"),this.elemList=this.wrapperList.querySelector(".dropdown-list"),this.onFocus=t,this.caretImg=this.elem.querySelector(".dropdown-headline__icon img"),this.elemHeadline.addEventListener("click",()=>{this.bDisabled||(this.wrapperList.classList.contains("hidden")?this.open():this.close())}),this.addClickHandlers()}open(){this.onFocus(),this.wrapperList.classList.remove("hidden")}close(){this.wrapperList.classList.add("hidden")}setSelection(e){if(e){if(this.selected){const e=this.selected.querySelector(".checkmark");e&&(e.innerHTML="")}this.selected=e,this.selected.querySelector(".checkmark").innerHTML=`<img src="${window.regionSelectorIcons.check}" />`,this.updateHeadlineString()}}addClickHandlers(){this.elemList.querySelectorAll(".dropdown-list__option").forEach((e,t)=>{e.addEventListener("click",()=>{this.setSelection(e)})})}initLocDefaultValue(e){if(null==e||""==e)return;let t=this.elemList.querySelector(`[data-main-region="${e.toUpperCase()}"]`);null==t&&(t=this.elemList.querySelector(`[data-value="${e.toUpperCase()}"][data-main-region=""]`)),this.setSelection(t)}initLangDefaultValue(e){if(null==e||""==e)return;let t=this.elemList.querySelector(`[data-value="${e}"]`);this.setSelection(t)}updateHeadlineString(){this.close()}get value(){return this.selected.dataset.value}}class c extends l{constructor(e,t){super(e,t),this.onChange,this.selected=this.elemList.querySelector(".dropdown-list__option"),this.countryMap={},this.elemList.querySelectorAll(".dropdown-list__option").forEach(e=>{const t=e.dataset;this.countryMap[t.value.toLowerCase()]=t.label})}updateHeadlineString(){this.headlineString.innerHTML=this.selected.innerHTML,this.elemHeadline.querySelector(".checkmark").classList.add("hidden"),super.updateHeadlineString()}setSelection(e){e&&(super.setSelection(e),this.onChange&&this.onChange(this.languagesArray))}get languagesArray(){const e=[];return null==this.selected?.dataset?.langs?(console.error("Country Select: bad data"),[]):(this.selected.dataset.langs.split("|").forEach(t=>{if(""==t||null==t)return;const s=t.split(",");e.push({value:s[0],label:s[1]})}),e)}}class d extends l{constructor(e,t){super(e,t),this.headlineString=this.elemHeadline.querySelector(".region-lbl")}reloadList(e){this.array=e,this.#e(),this.bDisabled=this.array.length<=1,this.wrapperList.classList.add("hidden"),this.bDisabled?(this.elemHeadline.classList.add("disabled"),this.caretImg.src=window.regionSelectorIcons.caretGray):(this.elemHeadline.classList.remove("disabled"),this.caretImg.src=window.regionSelectorIcons.caretBlack,this.addClickHandlers())}#e(){this.elemList.innerHTML=this.array.map(e=>this.#t(e)).join(""),this.selected=this.elemList.querySelector(".dropdown-list__option"),this.addClickHandlers(),this.updateHeadlineString(),this.selected.querySelector(".checkmark").innerHTML=`<img src="${window.regionSelectorIcons.check}" />`}#t(e){return`<div class="dropdown-list__option" data-value="${e.value}" data-label="${e.label}"><span class="checkmark"></span><div class='region-lbl'>${e.label}</div></div>`}updateHeadlineString(){this.headlineString.innerHTML=this.selected.dataset.label,super.updateHeadlineString()}}class h{constructor(e){this.elem=e,this.newCountryLabel="{NEW_REGION}",this.previousCountryLabel="{PREVIOUS_REGION}",this.bUserInitiated=!1,this.trigger=document.querySelector("#utility-region-trigger"),this.overlay=this.elem.querySelector(".region-selection-overlay"),this.btnConfirm=this.elem.querySelector(".region-selection__button"),this.btnClose=this.elem.querySelector(".region-selection__close"),this.parent=this.elem.querySelector(".region-selection__wrapper"),this.errorWrapper=this.elem.querySelector(".region-selection__error"),this.bOpen=!1,this.confirmText=this.elem.querySelectorAll(".region-selection__confirm"),this.chooseText=this.elem.querySelectorAll(".region-selection__choose"),this.noLocText=this.elem.querySelectorAll(".region-selection__no_location"),this.changeText=this.elem.querySelectorAll(".region-selection__will_clear");const t=this.elem.querySelector(".region-selection__country-dropdown"),s=this.elem.querySelector(".region-selection__language-dropdown");this.selectCountry=new c(t,()=>{this.closeAllSelects()}),this.selectLanguage=new d(s,()=>{this.closeAllSelects()}),this.selectCountry.onChange=e=>{this.selectLanguage.reloadList(e),this.#s()},this.selectCountry.setSelection(this.selectCountry.selected),this.overlay.addEventListener("click",()=>{this.#i()}),this.btnClose.addEventListener("click",()=>{this.#i()}),this.trigger.addEventListener("click",()=>{this.open(!0)}),this.btnConfirm.addEventListener("click",()=>{this.#o()}),this.elem.addEventListener("click",e=>
1{e.target.closest(".region-selection__country, .region-selection__language")||this.closeAllSelects()});const i=localStorage.region,o=localStorage.language;if(i)this.selectCountry.initLocDefaultValue(i),o&&this.selectLanguage.initLangDefaultValue(o);else{let e,t="";const s=window.location.pathname.split("/")[1];if(s.length>3){const i=s.split("-");e=i[0],t=i[1]}t||e?(this.selectCountry.initLocDefaultValue(t),void 0!==e&&this.selectLanguage.initLangDefaultValue(e)):this.selectCountry.setSelection(this.selectCountry.elemList.querySelector('[data-label="International"]'))}debouncedListener("resize",()=>{this.#r()},250)}closeAllSelects(){this.selectCountry.close(),this.selectLanguage.close()}#r(){document.body.style.setProperty("--region-selection-shift-offset",`${this.parent.offsetHeight}px`)}#o(){const e=this.selectCountry.value.toLowerCase(),t=this.selectLanguage.value.toLowerCase(),s=""==e?"/en":`/${t}-${e}`;let i=/^\/\w{2}(?:-\w{2})?(?=\/|$)/.exec(location.pathname)[0];const o="/fr-nl"==s?location.href.replace(i,"/fr-fr"):location.href.replace(i,s);localStorage.region=e,localStorage.language=t,document.cookie=`UserSelectedRegion=${s.substring(1)}; max-age=34560000; path=/;`,o!=window.location.href?window.location.href=o:(this.elem.querySelector(".region-selection__btn").classList.remove("-with-error"),this.errorWrapper.classList.add("hidden"),this.elem.classList.add("hidden"),document.body.classList.remove("-shifted"))}#i(){if(!this.bUserInitiated)return this.elem.querySelector(".region-selection__btn").classList.add("-with-error"),this.errorWrapper.classList.remove("hidden"),void this.#r();this.elem.classList.add("hidden"),sessionStorage.setItem("ignoreRegionSelector",!0)}open(e=!1){this.bUserInitiated=e,this.#s(),this.elem.classList.remove("hidden"),this.bOpen=!0,e?this.btnClose.classList.remove("hidden"):(this.#r(),document.body.classList.add("-shifted"),this.btnClose.classList.add("hidden"))}#s(){const e=localStorage.region;let t=this.confirmText;const s=this.selectCountry.selected.dataset;e?this.bUserInitiated&&(t=this.chooseText,s.value.toLowerCase()!=e.toLowerCase()&&this.changeText&&(t=this.changeText)):t=this.noLocText,this.confirmText.forEach(e=>e.classList.add("hidden")),this.chooseText.forEach(e=>e.classList.add("hidden")),this.noLocText.forEach(e=>e.classList.add("hidden")),this.changeText.forEach(e=>e.classList.add("hidden")),t.forEach(t=>{let i;const o=window.location.pathname.split("/")[1];o.length>3&&(i=o.split("-")[1]);const r=this.selectCountry.countryMap[i||e];t.innerHTML=t.innerHTML.replace(this.previousCountryLabel,r);const a=`<span class="region-selection__replace">${s.label}</span>`;t.innerHTML=t.innerHTML.replace(this.newCountryLabel,a);const n=t.querySelector(".region-selection__replace");n&&(n.innerHTML=s.label),t.classList.remove("hidden")})}}class u{constructor(e){e&&(this.savingsSummary=e,this.savingSummaryMessage=this.savingsSummary.textContent)}renderSavings(e){const t=window.utilities.formatCurrency(e);this.savingsSummary.textContent=e>0?this.savingSummaryMessage.replace("{0}",t):"",this.savingsSummary.classList.toggle("hidden",e<=0),sessionStorage.setItem("totalSavings",e),sessionStorage.setItem("totalSavingsFormatted",t)}}class m{constructor(e,t={}){this.elem=e,this.scrollElem=e.querySelector(".scrollable-content__scroller"),this.arrowAnchor=e.querySelector(".-arrow-anchor"),this.items=Array.from(this.scrollElem.children),this.itemsLen=this.items.length,this.arrows=e.querySelectorAll(".scrollable-content__arrow"),this.arrows.forEach(e=>{e.addEventListener("click",()=>{e.classList.contains("hiding")||this.scrollByArrow(parseInt(e.dataset.direction))})}),this.updateArrows(0),this.scrollTimeout=null,this.scrollElem.addEventListener("scroll",()=>{this.scrollTimeout&&window.clearTimeout(this.scrollTimeout),this.scrollTimeout=window.setTimeout(()=>{this.updateArrows(this.scrollElem.scrollLeft)},100)}),t.bShouldCenter&&window.debouncedListener("resize",()=>{this.updateCenter()}),window.addEventListener("DOMContentLoaded",()=>{setTimeout(()=>{this.updateArrows(0),this.updateCenter(t.bShouldCenter)},100)}),this.index=0}_getLeft(e){return e.getBoundingClientRect().left-this.scrollElem.getBoundingClientRect().left}updateCenter(){const e="center-items",t=window.innerWidth;this.scrollElem.children[0].getBoundingClientRect().width*this.itemsLen+256<t?(this.scrollElem.classList.add(e),this.hideArrow(0),this.hideArrow(1)):this.scrollElem.classList.contains(e)&&(this.scrollElem.classList.remove(e),this.updateArrows(this._getLeft(this.items[0])))}updateArrows(e){const t=this.scrollElem.scrollWidth-this.scrollElem.clientWidth;t<=0?(this.hideArrow(0),this.hideArrow(1)):e<=21?(this.hideArrow(0),this.arrows[1].classList.remove("hidden")):e>=t-21?(this.arrows[0].classList.remove("hidden"),this.hideArrow(1)):(this.arrows[0].classList.remove("hidden"),this.arrows[1].classList.remove("hidden")),this.checkArrowHeight()}checkArrowHeight(){null!=this.scrollElem&&(null==this.arrowAnchor&&(this.arrowAnchor=this.scrollElem.querySelector(".-arrow-anchor")),null!=this.arrowAnchor&&0!=this.arrowAnchor.offsetHeight?this.arrows.forEach(e
1=>e.style.top=this.arrowAnchor.offsetHeight/2+"px"):setTimeout(this.checkArrowHeight,100))}hideArrow(e){this.arrows[e].classList.add("hiding"),setTimeout(()=>{this.arrows[e].classList.add("hidden"),this.arrows[e].classList.remove("hiding")},300)}getScrollAmount(e){let t=this.items[0].getBoundingClientRect().width,s=null;if(1===e){let e=-1;for(;++e<this.itemsLen;){if(this._getLeft(this.items[e])>10){s=t;break}}}else{let e=this.itemsLen;for(;--e>-1;){if(this._getLeft(this.items[e])<-10){s=-1*t;break}}}return s}scrollByArrow(e){const t=this.getScrollAmount(e);this.scrollElem.scrollBy({top:0,left:t,behavior:"smooth"})}static createScrollableContent(e,t,s){return new m(e,t,()=>{})}}class p{constructor(){this.headerWrap=document.getElementById("site-header-wrap"),this.headerElem=document.querySelector(".site-header"),this.productFilter=document.querySelector(".filter-and-sort__status-and-sort"),this.productFiltersInner=document.querySelector(".filter-and-sort__filters-inner"),this.searchBar=document.querySelector(".filter-and-sort__search-bar:not(.hidden)"),this.searchBarHeight=this.searchBar?this.searchBar.offsetHeight:0,this.billboardVideo=document.querySelector("main > .billboard-centered:first-child .html5-video, main > .lab71-billboard:first-child .html5-video"),this.hasContentSwap=!1,this.scrollY=window.scrollY,this.isStuck=!1,this.headerSearchElem=document.querySelector(".header-search"),this.updateHeaderHeightOffset(),window.debouncedListener("resize",e=>this.updateHeaderHeightOffset()),document.getElementById("BikeConfiguration__Outer")?.classList.add("-use-sticky-offset"),this.updateStickyStatus(),window.debouncedListener("resize",e=>this.updateStickyStatus(),50),window.addEventListener("scroll",e=>this.updateStickyStatus())}addContent(e){const t=document.getElementById("MainNavigation").parentElement,s=this.headerElem.querySelector(".header-cart"),i=document.createElement("div");i.className="sticky-header__content",i.innerHTML=e,t.style.flexWrap="nowrap",s?t.insertBefore(i,s):t.appendChild(i),this.hasContentSwap=!0}updateHeaderHeightOffset(){this.headerWrap.style.height=[this.headerElem.offsetHeight,"px"].join(""),document.getElementById("BikeConfiguration__Outer")?.style.setProperty("--sticky-offset",this.headerWrap.offsetHeight+"px")}repaintBillboardVideo(){this.billboardVideo.style.display="none",window.setTimeout(()=>{this.billboardVideo.style.display="block"},10)}stick(){this.isStuck=!0,this.headerWrap.classList.add("sticky-header"),this.headerElem.style.transitionDuration="0ms",this.headerElem.style.top="-"+this.headerElem.offsetHeight+"px",this.productFilter&&(this.productFilter.style.top=this.searchBarHeight+"px"),this.productFiltersInner&&(this.productFiltersInner.style.top=this.searchBarHeight+this.productFilter.offsetHeight+"px"),this.productFiltersInner&&(this.productFiltersInner.style.height="calc(100vh - "+(this.searchBarHeight+this.productFilter.offsetHeight)+"px)"),this.searchBar&&(this.searchBar.style.top="0px"),document.getElementById("BikeConfiguration__Outer")?.classList.remove("-use-sticky-offset")}unstick(){this.isStuck=!1,this.headerWrap.classList.remove("sticky-header"),this.headerElem.style.transitionDuration="150ms",this.headerElem.style.top="0px",this.productFilter&&(this.productFilter.style.top=this.headerWrap.offsetHeight+this.searchBarHeight+"px"),this.productFiltersInner&&(this.productFiltersInner.style.top=this.headerWrap.offsetHeight+this.searchBarHeight+this.productFilter.offsetHeight+"px"),this.productFiltersInner&&(this.productFiltersInner.style.height="calc(100vh - "+(this.headerWrap.offsetHeight+this.searchBarHeight+this.productFilter.offsetHeight)+"px)"),this.searchBar&&(this.searchBar.style.top=this.headerWrap.offsetHeight+"px"),this.billboardVideo&&this.repaintBillboardVideo(),document.getElementById("BikeConfiguration__Outer")?.classList.remove("-use-sticky-offset")}show(){this.headerElem.style.transitionDuration="250ms",this.headerElem.style.top="0px",this.productFilter&&(this.productFilter.style.top=this.headerWrap.offsetHeight+this.searchBarHeight+"px"),this.productFiltersInner&&(this.productFiltersInner.style.top=this.headerWrap.offsetHeight+this.searchBarHeight+this.productFilter.offsetHeight+"px"),this.productFiltersInner&&(this.productFiltersInner.style.height="calc(100vh - "+(this.headerWrap.offsetHeight+this.searchBarHeight+this.productFilter.offsetHeight)+"px)"),this.searchBar&&(this.searchBar.style.top=this.headerWrap.offsetHeight+"px"),document.getElementById("BikeConfiguration__Outer")?.classList.add("-use-sticky-offset")}hide(){this.headerElem.style.transitionDuration="250ms",this.headerElem.style.top="-"+this.headerElem.offsetHeight+"px",this.productFilter&&(this.productFilter.style.top=this.searchBarHeight+"px"),this.productFiltersInner&&(this.productFiltersInner.style.top=this.searchBarHeight+this.productFilter.offsetHeight+"px"),this.productFiltersInner&&(this.productFiltersInner.style.height="calc(100vh - "+(this.searchBarHeight+this.productFilter.offsetHeight)+"px)"),this.searchBar&&(this.searchBar.style.top="0px"),document.getElementById("BikeConfiguration__Outer")?.classList.remove("-use-sticky-offset"),this.headerSearchElem?.classList.contains("search-open")&&(this.headerSearchElem.querySelector(".close")?.click(),this.headerSearchElem.querySelector("input")?.blur())}updateStickyStatus(){if(document.documentElement.className.includes("modalwasopen"))return;const e=window.scrollY<=this.scrollY;window.scrollY>this.headerElem.offsetHeight&&!this.isStuck?(this.stick(),this.hasContentSwap&&(window.scrollY>240?this.headerElem.classList.add("show-content"):this.headerElem.classList.remove("show-content"))):this.isStuck&&window.scrollY<=0?this.unstick():this.isStuck&&e?this.show():this.isStuck&&!e&&this.hide(),this.scrollY=window.scrollY}}class g{constructor(e,t){this.elem=e,this.dataType=t;const s=this.elem.getAttribute("data-filter");this.area=document.querySelector(`.sortable-items[data-filtertarget="${s}"]`),this.select=e.querySelector("select"),this.options=[],this.items=[],this.newOpts=[],this.createArray()}clickHandler(){}closeAllItems(){const e=["is-open","is-active"];
1this.items.forEach(t=>{t.classList.remove(e.join())})}createArray(){const e=`data-${this.dataType}`;this.items=document.querySelectorAll(`[${e}]`),this.items.forEach(t=>{const s=t.getAttribute(e);-1===this.options.indexOf(s)&&this.options.push(s)})}initDropdown(){this.elem.classList.add("dropdown"),o.createDropdown(this.elem),this.newOpts=this.elem.querySelectorAll("a.option:not(.default)"),this.newOpts.forEach(e=>e.addEventListener("click",t=>this.clickHandler(e)))}}class y extends g{constructor(e){super(e,"filteritem"),this.createItems(),this.initDropdown(),this.filterLookup=Array.from(this.area.children).map(e=>({elem:e,val:e.getAttribute("data-filteritem")}))}clickHandler(e){this.closeAllItems();const t=e.getAttribute("data-value");"all"===t?this.filterLookup.forEach(e=>e.elem.classList.add("is-visible")):this.filterLookup.forEach(e=>{e.val===t?e.elem.classList.add("is-visible"):e.elem.classList.remove("is-visible")})}createItems(){const e=this.options.map(e=>`<option class="option" value="${e}">${e}</option>`).join("");this.select.insertAdjacentHTML("beforeend",e)}}class w extends g{constructor(e){super(e,"sort"),this.initDropdown()}clickHandler(e){this.closeAllItems();const t="sort-ascending"===e.getAttribute("data-value")?this.sortAscending:this.sortDescending;this.items.sort(t).forEach(e=>this.area.appendChild(e))}sortAscending(e,t){return t.getAttribute("data-sort")<e.getAttribute("data-sort")?1:-1}sortDescending(e,t){return t.getAttribute("data-sort")<e.getAttribute("data-sort")?-1:1}}class f{constructor(e){this.formElem=e,this.submitButtonWithState=this.formElem.querySelector("button.with-state[type=submit]"),this.enterEmail=document.getElementById("EnterEmail"),this.reEnterEmailField=document.getElementById("ReEnterEmail"),this.fields=Array.from(this.formElem.querySelectorAll("[data-validetta]")).map(e=>{const t=new v(e);return t.isPasswordField&&(this.hasPasswordField=!0,this.passwordRulesElem=t.passwordRulesElem,this.passwordRules=t.passwordRules),t}),this.shouldValidateOnBlur=!1,this.formElem.addEventListener("click",()=>this.shouldValidateOnBlur=!0),this.formElem.addEventListener("input",()=>this.shouldValidateOnBlur=!0),this.fields.forEach(e=>{e.field.addEventListener("input",t=>this.validateField(e)),e.field.addEventListener("blur",t=>{this.shouldValidateOnBlur&&this.validateField(e)})}),this.enterEmail&&this.reEnterEmailField&&this.enterEmail.addEventListener("input",e=>{this.reEnterEmailField.parentElement.classList.remove("hidden")}),this.formElem.addEventListener("submit",e=>{if(!this.validate())return e.preventDefault(),e.stopImmediatePropagation(),!1;this.submitButtonWithState&&(this.submitButtonWithState.classList.add("submitted"),this.submitButtonWithState.setAttribute("disabled",!0)),this.hasPasswordField&&this.passwordRulesElem&&this.passwordRules.forEach(e=>{e.classList.remove("invalid")})})}validateField(e){const t=e.validate(this.fields);t?e.setErrors(t):e.clearErrors()}validate(){return 0===this.fields.reduce((e,t)=>{if(!t.field.dataset?.hidden){const s=t.validate(this.fields);s?(e.push(s),t.setErrors(s)):t.clearErrors()}return e},[]).length}}class v{constructor(e){if(this.field=e,this.name=this.field.name,this.parent=e.closest(".formField"),this.parentForm=e.closest("form"),this.errorSpan=document.createElement("span"),this.errorSpan.className="error-item error-label__msg",this.parent.appendChild(this.errorSpan),this.errorIndicator=document.createElement("div"),this.errorIndicator.className="error-item error-label__indicator",this.parent.appendChild(this.errorIndicator),this.errorPopup=document.createElement("div"),this.errorPopup.className="error-item error-label__popup fade-elem faded",this.parent.appendChild(this.errorPopup),this.ruleNames=[],this.validationFunctions=this.field.getAttribute("data-validetta").split(",").map(e=>{const t=e.split("["),s=t[0],i=t[1]?t[1].replace("]",""):null;return this.ruleNames.push(s),"equalTo"===s?(this.pairedField=this.parentForm.querySelector(`input[name="${i}"]`),this.isMatchMessage=this.field.getAttribute("data-vd-message-ismatch"),this.addEqualToListener()):"notEqualTo"===s?this.pairedField=this.parentForm.querySelector(`input[name="${i}"]`):"password"===s&&(this.isPasswordField=!0),{fn:this.generateRuleFunction(s,i),msg:this.field.getAttribute(`data-vd-message-${s}`),ruleName:s}}),this.isPasswordField&&(this.passwordRulesElem=this.parentForm.querySelector(".passwordRules"),this.passwordRules=this.passwordRulesElem.querySelectorAll("li")),this.parent.hasAttribute("data-server-error-key")){const e=window.formServerErrors[this.parent.getAttribute("data-server-error-key")];e&&(this.errorSpan.innerHTML=e,this.parent.classList.add("has-error"),this.errorSpan.parentElement.classList.add("has-error"))}}_testForMatch(){this.matchSpanStored||(this.matchSpanStored=this.errorSpan.innerHTML),!this.field.value.length||this.pairedField.parentNode.classList.contains("has-error")||this.pairedField.parentNode.classList.contains("show-warning")||this.field.value!==this.pairedField.value?(this.pairedField.parentNode.classList.remove("is-match"),this.parent.classList.remove("is-match"),this.errorSpan.innerHTML=this.matchSpanStored):(this.pairedField.parentNode.querySelector(".error-label__msg").innerHTML="",this.pairedField.parentNode.classList.add("is-match"),this.parent.classList.add("is-match"),this.errorSpan.innerHTML=this.isMatchMessage)}addEqualToListener(){this.pairedField&&(this.field.addEventListener("keyup",e=>this._testForMatch()),this.field.addEventListener("blur",e=>this._testForMatch()),this.pairedField.addEventListener("keyup",e=>this._testForMatch()),this.pairedField.addEventListener("blur",e=>this._testForMatch()))}generateRuleFunction(e,t){switch(e){case"email":return()=>window.REGEXES.EMAIL.test(this.field.value.trim());case"equalTo":return()=>{try{return this.field.value.trim()===this.pairedField.value.trim()}catch(e){return console.warn("Validation equalTo error",e),!1}};case"notEqualTo":return()=>{try{return this.field.value.trim()!==this.pairedField.value.trim()}catch(e){return console.warn("Validation notEqualTo error",e),!1}};case"minLength":return()=>this.field.value.trim().length>=parseInt(t);case"maxLength":return()=>this.field.value.trim().length<=parseInt(t);case"noSpecial":return()=>window.REGEXES.NOSPECIAL.test(this.field.value);case"number":return()=>window.REGEXES.NUMBER.test(this.field.value.trim());case"password":return()=>window.REGEXES.PASSWORD.test(this.field.value.trim());case"characterRange":return()=>window.REGEXES.CHARACTERRANGE.test(this.field.value.trim());case"hasNumber":return()=>window.REGEXES.HASNUMBER.test(this.field.value.trim());case"containsUpperLower":return()=>window.REGEXES.CONTAINSUPPERLOWER.test(this.field.value.trim());case"phone":return()=>window.REGEXES.PHONE.test(this.field.value.trim());case"required":return()=>this.field.parentElement.classList.contains("hidden")||this.field.value.trim().length>0}}emailTypoHandler(){const e=this.field.value.trim(),t=/@gnail\.com$|\.con$/.exec(e),s={email:e,typo:t};t?(this.parent.classList.add("show-warning"),this.errorSpan.textContent=window.messaging.emailTypoMessage.replace(/(?<=")\{(\w+)\}(?=")/g,(e,t)=>s[t])):this.parent.classList.remove("show-warning")}clearErrors(){this.parent.classList.remove("has-error"),this.errorSpan.parentElement.classList.remove("has-error"),this.passwordRules&&(this.passwordRules.forEac
1h(e=>e.classList.add("valid")),this.passwordRules.forEach(e=>e.classList.remove("invalid")))}setErrors(e){if(e.required)this.errorSpan.innerHTML=e.required,this.isPasswordField&&this.passwordRules.forEach(e=>e.classList.add("invalid"));else if(this.isPasswordField){this.errorSpan.innerHTML=this.validationFunctions.filter(e=>"password"===e.ruleName)[0].msg;const t=Object.keys(e);this.passwordRules.forEach(e=>{t.indexOf(e.getAttribute("data-password-rule"))>-1?(e.classList.remove("valid"),e.classList.add("invalid")):(e.classList.remove("invalid"),e.classList.add("valid"))})}else this.errorSpan.innerHTML=Object.keys(e).map(t=>e[t]).join("");this.parent.classList.remove("show-warning"),this.parent.classList.add("has-error"),this.errorSpan.parentElement.classList.add("has-error")}validate(){if(this.field.closest(".ignore-validation"))return null;let e=!0;if(this.matchSpanStored=null,"checkbox"===this.field.type)return this.field.checked?null:(e=!1,{required:this.validationFunctions.filter(e=>"required"===e.ruleName)[0].msg});if(0===this.field.value.trim().length&&this.ruleNames.indexOf("required")<0)return null;const t=this.validationFunctions.reduce((t,s)=>(s.fn()||(e=!1,t[s.ruleName]=s.msg),t),{});return e?("email"===this.field.type&&this.emailTypoHandler(),null):t}}const C=document.querySelectorAll(".accordion .sortable-item .panel"),L=()=>{C.forEach(e=>{e.style.setProperty("--max-height",[e.scrollHeight,"px"].join(""))})};function b(e){let t,s,i;const o=document.createElement("div");o.classList="card-grid__video",o.hidden=!0;const r=document.createElement("div");r.classList="image-detail-carousel__video";const a=document.createElement("div");a.classList="card-grid__video__close",a.tabIndex=-1,a.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none">\n <path d="M12.9324 1.70711C13.323 1.31658 13.323 0.683418 12.9324 0.292893C12.5419 -0.0976311 11.9087 -0.0976311 11.5182 0.292893L6.61268 5.19843L1.70715 0.292905C1.31663 -0.0976194 0.683465 -0.0976194 0.292941 0.292905C-0.0975833 0.683429 -0.0975833 1.31659 0.292941 1.70712L5.19846 6.61264L0.292893 11.5182C-0.0976309 11.9087 -0.0976312 12.5419 0.292893 12.9324C0.683417 13.323 1.31658 13.323 1.70711 12.9324L6.61268 8.02686L11.5183 12.9324C11.9088 13.323 12.542 13.323 12.9325 12.9324C13.323 12.5419 13.323 11.9087 12.9325 11.5182L8.02689 6.61264L12.9324 1.70711Z" fill="black"/>\n </svg>';let n=new window.LoadingGraphic(r,{position:"fixed",theme:"dark"});n.start(),o.appendChild(a),o.appendChild(r),document.body.appendChild(o),window.utilities.bindHybridClick(e,e=>{if(e.target.closest(".card-grid__button"))return!1;o.classList.add("-active"),o.hidden=!1,a.tabIndex=0,s&&(i.playFn(),a.focus()),document.body.classList.add("noscroll")}),window.utilities.bindHybridClick(a,()=>{o.classList.remove("-active"),o.hidden=!0,a.tabIndex=-1,s&&i.pauseFn(),document.body.classList.remove("noscroll"),e.focus()}),document.addEventListener("keydown",t=>{"Escape"===t.key&&!1===o.hidden&&(o.classList.remove("-active"),o.hidden=!0,a.tabIndex=-1,s&&i.pauseFn(),document.body.classList.remove("noscroll"),e.focus())}),window.utilities.generateVideoHTML(e.dataset.videoSrc,e.dataset.posterSrc).then(o=>{let a,l,c;switch(t=o,n.end(),r.innerHTML=t.html,s=r.children[0],t.type){case"youtube":a=s,l=function(){s.contentWindow.postMessage('{"event":"command","func":"playVideo"}',"*")},c=function(){s.contentWindow.postMessage('{"event":"command","func":"pauseVideo"}',"*")};break;case"vimeo":a=new Vimeo.Player(s),l=function(){a.play().then(function(){}).catch(function(e){console.log("An error occurred with the vimeo API:",e)})},c=function(){a.pause().then(function(){}).catch(function(e){console.log("An error occurred with the vimeo API:",e)})};break;default:a=s,l=function(){s.play()},c=function(){s.pause()}}i={player:a,playFn:l,pauseFn:c};const d=e.querySelector("img");d.src&&d.src!==window.location.href||(d.src=t.poster)})}L(),debouncedListener("resize",L,250),function(){const e=document.querySelector(".compare-tool");if(!e)return;function t(){return window.innerWidth<window.cannondaleBreakpoints.largeTablet}const s=e.querySelector(".compare-panel-header"),i=e.querySelector(".compare-panel"),o=e.querySelector('.show-trigger[data-trigger="compare-panel-header"]'),r=e.querySelector("[data-trigger='compare-panel']"),a=s.querySelector(".content-container"),n=i.querySelector(".chosen-bikes.product-grid"),l=i.querySelector(".product-grid.mobile-only"),c=document.querySelector("main"),d=new window.LoadingGraphic(s,{position:"absolute",background:"rgba(255,255,255,0.4)"});let h=document.querySelector("html").getAttribute("lang");window.EndpointManager.registerParameterizedEndpoint("bike-compare",e=>`/${h.toLowerCase()}/api/products/${e.join()}`);let u={BikeCompareDtos:[],LanguageRegion:h,Skus:[]};function m(e){return e&&"string"==typeof e?e.replace(/\bnull\b/gi,""):""}
1function p(){document.querySelectorAll("a.compare").forEach(e=>{-1===u.Skus.indexOf(e.getAttribute("data-salsifyid"))?(e.removeAttribute("data-added"),e.textContent="+Compare"):(e.setAttribute("data-added","added"),e.textContent="-Remove")})}function g(){const e=u.BikeCompareDtos.map(v);3===e.length&&e.pop(),l.innerHTML=e.join(""),n.innerHTML=u.BikeCompareDtos.map(C).join("")}async function y(s){if(d.start(),s)try{const e=await window.EndpointManager.getParameterizedEndpoint("bike-compare",u.Skus);e&&e.length&&(e.forEach(e=>{if(!e.Price){const t=e.Variants.filter(({IsValid:e})=>e)[0];t&&(t.SalePrice>0?e.Price=window.utilities.formatCurrency(t.SalePrice,!0):t.Msrp>0&&(e.Price=window.utilities.formatCurrency(t.Msrp,!0)))}}),u.BikeCompareDtos=e,localStorage.setItem(`skuList_${window.RegionSetting}`,u.Skus),localStorage.setItem(`BikeCompareDtos_${window.RegionSetting}`,JSON.stringify(u.BikeCompareDtos)))}catch(e){console.log("error retrieving bike compare details",e)}else{const e=localStorage.getItem(`skuList_${window.RegionSetting}`);u.Skus=e&&e.length?e.split(","):[];const t=localStorage.getItem(`BikeCompareDtos_${window.RegionSetting}`),s=t?JSON.parse(t):[];u.BikeCompareDtos=s}!function(){document.querySelectorAll(".specifications-section .specs").forEach(e=>e.remove()),document.querySelectorAll(".specifications-section .specs-trigger").forEach(e=>e.classList.add("hidden"));const e=Array.from(document.querySelectorAll(".specifications-section"));u.BikeCompareDtos.length&&(u.BikeCompareDtos.forEach(t=>{e.forEach(e=>{const s=e.getAttribute("data-spec-name");if(s&&s.length){const i=s.split("."),o=e.getAttribute("data-spec-detail"),r=o&&o.length?o.split("."):null,a=m(L(t,i)),n=r?m(L(t,r)):"";a.length?(e.appendChild(b(a,n,s)),n.length&&e.querySelector(".specs-trigger").classList.remove("hidden")):e.appendChild(b("","",s))}})}),e.forEach(e=>{0===e.querySelectorAll(".specs:not(.empty-specs)").length?e.style.display="none":e.style.removeProperty("display")}),document.querySelectorAll(".specifications-section-group").forEach(e=>{0===e.querySelectorAll(".specs:not(.empty-specs)").length?e.classList.add("hidden"):e.classList.remove("hidden")}))}(),t()||(a.innerHTML=u.BikeCompareDtos.map(S).join("")),u.Skus.length?(e.classList.remove("hidden"),document.body.classList.add("compare-toolbar-active")):(e.classList.add("hidden"),document.body.classList.remove("compare-toolbar-active"),e.classList.contains("is-takeover")&&r.click()),e.classList.contains("is-takeover")&&g(),p();const i=new Event("bikeComparePopulate");document.dispatchEvent(i),d.end()}function w(i){if(d.running)return!1;if(i.hasAttribute("data-added"))f(i.getAttribute("data-salsifyid")),i.removeAttribute("data-added"),i.textContent="+Compare";else{const r=i.getAttribute("data-salsifyid");e.classList.remove("hidden"),u.Skus.length<(t()?2:3)&&-1===u.Skus.indexOf(r)&&(u.Skus.push(r),localStorage.setItem("skuList",u.Skus),i.setAttribute("data-added","added"),i.textContent="-Remove",y(!0),t()||s.classList.contains("is-open")||o.click())}}function f(e){const t=localStorage.getItem(`skuList_${window.RegionSetting}`),s=t?t.split(","):[],i=localStorage.getItem(`BikeCompareDtos_${window.RegionSetting}`),o=(i?JSON.parse(i):[]).filter(t=>t.SalsifyId!==e);s.splice(s.indexOf(e),1),localStorage.setItem(`skuList_${window.RegionSetting}`,s.join()),localStorage.setItem(`BikeCompareDtos_${window.RegionSetting}`,JSON.stringify(o)),document.querySelectorAll(`a.compare[data-salsifyid="${e}"]`).forEach(e=>{e.removeAttribute("data-added"),e.textContent="+Compare"}),y(!1)}function v(e){return`\n <div class="mobile-compare-card">\n <div class="text">\n <h2 class="title">\n <strong class="platform">${e.Title}</strong>\n <span class="name">${e.Subtitle}</span>\n </h2>\n ${e.Price?`<span class="price">${e.Price}</span>`:""}\n </div>\n <div class="actions">\n <a class="small inverted secondary button" href="${e.RelativeUrl}">View Details</a>\n <div class="remove">\n <a class="compare remove" data-added="added" data-salsifyid="${e.SalsifyId}">Remove</a>\n </div>\n </div>\n <div class="look">\n <div class="content">\n <div class="image"><img src="${e.ProductImageUrl}" alt=""></div>
1\n <span class="color" style="background:${e.BackgroundColor};"></span>\n </div>\n </div>\n </div>`}function C(e){return`<div class="product-card card">\n <div class="product-card__upper">\n <div class="card-inner">\n <a class="content product" data-color="dark" href="${e.RelativeUrl}">\n <div class="tags"></div>\n <img src="${e.ProductImageUrl}" alt="">\n <div class="product-details">\n <h2 class="title">${e.Title}</h2>\n <div class="details">\n <div class="detail">${e.Subtitle}</div>\n ${e.Price?`<strong class="price">${e.Price}</strong>`:""}\n </div>\n </div>\n </a>\n <a data-salsifyid="${e.SalsifyId}" class="compare">+Compare</a>\n </div>\n </div>\n </div>`}function L(e,t){for(;t.length;){if(!(e=e[t.shift()]))return null}return e}function b(e,t,s){let i=t.length?`\n <ul class="inline more-specs plain" data-panel="specs-${s}">\n ${t.split("|").map(e=>`<li>${e}</li>`).join("")}\n </ul>\n `:"";const o=document.createElement("div");return o.className=e.length?"specs":"specs empty-specs",o.innerHTML=`\n <ul class="plain"><li>${e}</li></ul>\n ${i}\n `,o}function S(e){return`\n <div class="product" data-salsifyid="${e.SalsifyId}">\n <img src="${e.ProductImageUrl.replace("2000px","100px")}" alt="">\n <h2 class="title"><strong class="platform">${e.Title}</strong>${e.Subtitle}</h2>\n <a class="remove" data-salsifyid="${e.SalsifyId}">Remove</a>\n </div>\n `}o.addEventListener("click",e=>{window.localStorage.setItem("hideComparePanelHeader",o.classList.contains("is-active"))});"true"===window.localStorage.getItem("hideComparePanelHeader")&&o.click(),a.querySelectorAll(".product").length>0?e.classList.remove("hidden"):e.classList.add("hidden"),window.utilities.bindHybridClick(document,e=>{const t=e.target;if(t.classList.contains("compare"))return e.preventDefault(),w(t),!1}),a.addEventListener("click",e=>{const t=e.target;t.classList.contains("remove")&&f(t.getAttribute("data-salsifyid"))}),r.addEventListener("click",i=>{e.classList.toggle("is-takeover"),g(),p(),e.classList.contains("is-takeover")?(c.style.zIndex=999,s.classList.contains("is-open")&&o.click()):(c.style.zIndex=0,t()||o.click())}),e.addEventListener("scroll",e=>{s.classList.toggle("is-sticky",n.getBoundingClientRect().top<=-200)}),y(),document.addEventListener("productSearchResultsLoaded",(e,t)=>{p()}),window.bikeCompareTool={setCompareLinkStatuses:p}}(),window.addEventListener("load",function(){document.querySelectorAll(".photo-split .photo-container").forEach(e=>{const t=e.querySelector("img").offsetWidth;e.querySelector("figcaption").style.width=[t,"px"].join("")})}),document.addEventListener("DOMContentLoaded",async()=>{const e=document.querySelectorAll(".card-grid__inner");for(const t of e){const e=t.querySelectorAll(".card-grid__item");1==e.length?(t.classList.remove("__3up"),t.classList.add("__1up")):2==e.length&&(t.classList.remove("__3up"),t.classList.add("__2up"));for(const t of e)t.querySelector("img").style.aspectRatio=t.dataset.aspectRatio,t.classList.contains("__has-video")&&b(t);window.utilities.bindHybridClick(t,e=>{const t=e.target;if(t.closest(".card-grid__button"))return e.stopPropagation(),!1;return!!t.closest(".card-grid__item")&&void 0})}});function S(e){const t=e.querySelector(".text"),s=t.parentElement,i=t.clientWidth,o=t.clientHeight;e.classList.add("is-styled"),s.style.minHeight=[i,"px"].join(""),s.style.paddingLeft=[o,"px"].join(""),t.setAttribute("style",`width: ${i}px;`)}document.querySelectorAll("body:not(.sc-editor) .carousel-collection").forEach(e=>{const t=$(e.querySelector(".slick-prev")),s=$(e.querySelector(".slick-next")),i=window.utilities.createCarousel(e,function(){setTimeout(()=>{const t=e.querySelector(".slick-active img");if(t){const s=t.getAttribute("data-title"),i=t.getAttribute("data-subtitle"),o=t.getAttribute("data-url");e.querySelector(".carousel-collection__headline").innerHTML=`<span>${s}</span>${i}`,e.querySelector("a.button.secondary").href=o}},1)});document.addEventListener("DOMContentLoaded",function(){i.init({prevArrow:t,nextArrow:s})})}),[{selector:"body:not(.sc-editor) .carousel-blog"},{selector:".category-carousel",options:{bShouldCenter:!0}},{selector:".product-features",options:{bShouldCenter:!1}}
1].forEach(function({selector:e,options:t={}}){const s=t.slidesToShow||2;document.querySelectorAll(e).forEach(e=>{try{const i=new m(e,t,function(){this.elem.querySelectorAll(".vertical:not(.is-styled)").forEach(S)});document.addEventListener("DOMContentLoaded",function(){t.hasScroll&&(e.querySelector(".scrollable-content__scroller").style.overflow="auto"),i.elem.querySelectorAll(".vertical").forEach(S),i.init&&i.init({adaptiveHeight:!0,responsive:i.buildResponsiveOptions({variableWidth:!0,slidesToShow:s},{adaptiveHeight:!1,variableWidth:!0,slidesToShow:s})})})}catch(t){console.warn("Error initializing carousel",t,e)}}),debouncedListener("resize",()=>{document.querySelectorAll(".vertical").forEach(S)},250)}),async function(){if(window.miniCartTrigger=document.querySelector(".header-cart .trigger"),window.miniCartElem=document.getElementById("MiniCart"),!window.miniCartTrigger||!window.miniCartElem)return!1;const e=document.querySelector(".header-cart").parentNode;window.recentSkus=[],window.carts=[],window.storedCart=null;const t=document.querySelectorAll(".add-to-cart-button"),i=document.getElementById("FullCart"),o=new s(miniCartElem),r=i?new s(i):null;o.renderCartItem=function(e){if(e.isGhost||!window.miniCartMessages)return"";let t;return t=e.AvailableShippingMethods.length>1?window.regionPreferredShipping:e.AvailableShippingMethods[0],"D2C"===t?(this.mcMessageC2C.classList.add("hidden"),this.mcMessageD2C.classList.remove("hidden")):"C2C"===t&&(this.mcMessageD2C.classList.add("hidden"),this.mcMessageC2C.classList.remove("hidden")),`\n <div class="mc-item__image"><img src="${e.PreviewImageUrl}"></div>\n <div class="mc-item__info">\n <h3 class="p_s -bold">${e.ProductTitle} ${e.ProductSubtitle}</h3>\n <h4 class="p_xs">${e.Size?`${e.Size}/`:""}${e.Color}</h4>\n </div>\n `},o.render=function(e,t){const i=e.Lines.find(e=>e.Sku===window.recentSkus[window.recentSkus.length-1]);this.mcItemDetails.innerHTML=i?this.renderCartItem(i):"",s.updateCartFees(window.storedCart.RecycleFeeTotal,this.call2recycleLineItems,this.call2recycleFeeElems),s.updateCartFees(window.storedCart.PeopleForBikesTotal,this.peopleforbikesLineItems,this.peopleforbikesFeeElems),s.updateCartSubtotal(this.subtotalElems,this.vatIncluded)},o.setEmpty=function(){},window.carts.push(o),r&&(window.carts.push(r),r.rightSideElem=document.getElementById("FullCart__right-side"),r.onEmpty=function(){this.rightSideElem.classList.add("hidden"),this.elem.classList.add("FullCart__empty")},r.onRender=function(){this.rightSideElem.classList.remove("hidden")});await s.initialize()||r&&(r.rightSideElem.classList.add("hidden"),r.cartSummary.classList.add("hidden"),r.cartEmpty.classList.add("hidden"),r.cartError.classList.remove("hidden")),window.hideMiniCart=()=>{e.style.removeProperty("z-index"),miniCartElem.classList.add("hidden"),miniCartElem.classList.remove("status-added")},window.showMiniCart=()=>{e.style.zIndex="12",miniCartElem.classList.remove("hidden"),document.getElementById("mcSummary-upper").querySelector("button").focus()},window.toggleMiniCart=()=>{miniCartElem.classList.contains("hidden")?window.showMiniCart():window.hideMiniCart()},window.addItemToCart=e=>{const t=e.dataset.salsifyid,i=e.dataset.sku;t&&i&&s.addItem(t,i,e)},miniCartElem.addEventListener("click",e=>e.target===miniCartElem?window.hideMiniCart():null),t&&t.length&&t.forEach(e=>{window.utilities.bindHybridClick(e,t=>{e.classList.contains("disabled")||e.classList.contains("-prevent-add")||s.addItem()})})}(),document.querySelectorAll("body:not(.sc-editor) .consumer-benefits").forEach(e=>{const t=e.querySelectorAll(".interaction"),s=Array.from(e.querySelectorAll(".headline"));function i(){if(window.innerWidth>=1097){const e=[s.reduce((e,t)=>t.clientHeight>e?t.clientHeight:e,0),"px"].join("");s.forEach(t=>t.style.height=e)}else s.forEach(e=>e.style.height="")}t.forEach(e=>e.addEventListener("click",function(){this.classList.toggle("is-open")})),document.addEventListener("DOMContentLoaded",i),debouncedListener("resize",i)});let E=-1;function k(e){const t=e.querySelector(".image picture img").currentSrc;e.style.backgroundImage=`url(${t})`}
1document.querySelectorAll(".content-assist").forEach(e=>{const t=e.querySelectorAll(".paragraph-with-title"),s=document.querySelector(`[data-target="${e.getAttribute("data-nav")}"]`);if(s){const e=document.createElement("nav");let i=-1;e.className="nav-contentassist",s.appendChild(e),t.forEach(t=>{const s=t.querySelector("h2"),o=s.textContent,r=`content-nav-${++E}-${++i}`;e.insertAdjacentHTML("beforeend",`<div class="item"><a class="link" data-ca-nav-id="${r}">${o}</a></div>`),s.id=r}),e.addEventListener("click",e=>{const t=e.target.getAttribute("data-ca-nav-id");t&&$("html, body").animate({scrollTop:$(`#${t}`).position().top-50},500)})}});const A=[];document.querySelectorAll([".billboard",".hero-pdp",".hero-about",".crosslink-content",".hero-bike-finder",".hero-checkout-confirmation",".hero-collections",".product-card.large",".product-card.wide"].join()).forEach(e=>{switch(e.getAttribute("data-type")){case"color":e.style.backgroundColor=e.getAttribute("data-bg");break;case"image":k(e),A.push(e);break;case"diptych":e.querySelectorAll(".column").forEach(t=>{const s=t.getAttribute("data-bg"),i=t.querySelector(".background"),o=i.querySelector("picture img");s&&(e.style.backgroundColor=s),o&&(i.style.backgroundImage=`url(${o.currentSrc})`)})}}),debouncedListener("resize",()=>{A.forEach(e=>k(e))},250),document.addEventListener("click",e=>{const t=e.target;if(t&&t.hasAttribute("data-disabled"))return e.preventDefault(),e.stopPropagation(),!1}),o.createDropdown(".dropdown:not(.ignore-auto-dropdown)");let _=!1;function q(e,t){if(_&&!t)return!1;const s=e.parentElement,i=s.querySelector(".error-label__msg");if(i.scrollWidth>i.clientWidth){let e=s.querySelector(".error-label__popup");e||(e=document.createElement("div"),e.className="error-label__popup fade-elem faded",s.appendChild(e)),e.innerHTML=i.innerHTML,t?(e.classList.add("touch"),e.classList.toggle("faded")):(e.classList.remove("touch"),e.classList.remove("faded"))}}$(document).on&&($(document).on("touchstart",".error-label__indicator, .error-label__msg",function(e){e.stopPropagation(),e.stopImmediatePropagation(),_=!0,q(this,!0)}),$(document).on("mouseenter",".error-label__indicator, .error-label__popup, .error-label__msg",function(){q(this)}),$(document).on("mouseleave",".error-label__indicator, .error-label__popup, .error-label__msg",function(){this.parentElement.querySelector(".error-label__popup").classList.add("faded")}));const T=document.querySelectorAll(".expandable-item__content"),I=e=>e.style.setProperty("--max-height",[e.scrollHeight,"px"].join(""));document.querySelectorAll(".expandable-item__trigger").forEach(e=>{let t=null,s=null;e.addEventListener("click",i=>{const o=e.closest(".expandable-item, .expandable-item__mobile-only"),r=o.querySelector(".expandable-item__content");I(r),o.classList.toggle("is-open"),o.classList.contains("is-open")?"ReviewsExpandable"===o.id&&(t=window.setTimeout(()=>I(r),800),s=window.setTimeout(()=>I(r),1200)):(window.clearTimeout(t),window.clearTimeout(s))})}),debouncedListener("resize",()=>{T.forEach(I)},250),document.addEventListener("touchstart",function e(t){document.documentElement.classList.add("can-touch"),document.removeEventListener("touchstart",e,!1)},!1);const M=document.querySelector(".header-search"),B="input, button, a:not(.trigger)";if(M){const e=document.querySelector('.panel[data-panel="showhide-search-header"]');new MutationObserver(()=>{e.classList.contains("is-open")?(M.classList.add("search-open"),M.querySelectorAll(B).forEach(e=>{e.setAttribute("tabIndex",0)})):(M.classList.remove("search-open"),M.querySelectorAll(B).forEach(e=>{e.setAttribute("tabIndex",-1)}))}).observe(e,{attributes:!0}),M.querySelectorAll(B).forEach(e=>{e.setAttribute("tabIndex",-1)});const t={input:M.querySelector(".header-search__input"),"input-clear":M.querySelector(".header-search__input-clear"),button:M.querySelector(".header-search__button")},s=()=>{const e=t.input.value.trim();if(""!==e){const t=window.location.href.match(/^.+\/\w{2}(?:-\w{2})?(?=\/|$)/),s=encodeURIComponent(e);window.location.href=[t,`/search-results?searchquery=${s}#q=${s}&firstQueryCause=searchFromLink`].join("")}};t["input-clear"].onclick=()=>t.input.value="",t.button.onclick=s,t.input.onkeydown=e=>{"Enter"===e.key&&s()}}function H(){document.querySelectorAll(".hotspot-description, .hotspot-text-container").forEach(e
1=>e.classList.remove("active"))}document.addEventListener("click",e=>{e.target.closest(".hotspot-point-container")||H()}),document.querySelectorAll(".hotspots-product-wrapper .hotspot-text-container, .hotspots-product-wrapper .hotspot-point").forEach(e=>e.addEventListener("click",e=>{e.preventDefault(),H();const t=this.classList.contains("hotspot-text-container")?this:this.parentElement.querySelector(".hotspot-text-container"),s=t.querySelectorAll(".hotspot-description");s.length&&(t.classList.add("active"),s.forEach(e=>e.classList.add("active")))})),$(".carousel-image").flickity({freeScroll:!0,cellAlign:"left",contain:!0,prevNextButtons:!1,pageDots:!1,adaptiveHeight:!1,imagesLoaded:!0});let P,x=!1;function F(e,t){const s=e.nextElementSibling;return!t||s&&s.matches(t)?s:null}function R(e,t,s){0!==e.value.length?(t.classList.add("is-visible"),s&&e.classList.remove("select-placeholder"),F(t,".error-msg")&&e.classList.add("input-error")):(s&&e.classList.add("select-placeholder"),t.classList.remove("is-visible"))}function O(e){const t="string"==typeof e?document.querySelector(`[data-modal-name="${e}"]`):e;t.classList.toggle("modalOpen"),t.classList.contains("modalOpen")?(document.documentElement.classList.add("modalopen"),document.documentElement.classList.add("modalwasopen")):(document.documentElement.classList.remove("modalopen"),window.clearTimeout(window.modalWasOpenTimeout),window.modalWasOpenTimeout=window.setTimeout(()=>document.documentElement.classList.remove("modalwasopen"),10))}function D(e,t){const s="true"!==e.dataset.modalDisableClickAway;window.utilities.bindHybridClick(e,function(i){(i.target.closest(".triggerModalClose")||i.target===e&&s)&&(t&&t(),O(e))})}function N(e){const t=e.getAttribute("data-trigger"),s=document.querySelectorAll(`[data-panel="${t}"]`),i=s[0].getAttribute("data-noscroll");if(document.querySelectorAll(".filter-product .dropdown.is-open").forEach(e=>e.classList.remove("is-open")),e.classList.toggle("is-active"),s.forEach(t=>{!function(e,t){if(t.getAttribute("data-closebutton")&&!t.querySelector(".close")){const s=document.createElement("button");s.className="close trigger",s.addEventListener("click",t=>{t.preventDefault(),N(e)}),t.appendChild(s)}}(e,t),t.classList.toggle("is-open")}),i){const e="mobile"===i?"noscroll-mobile":"noscroll";document.documentElement.classList.toggle(e,s[0].classList.contains("is-open"))}}function j(e,t,s,i,o){const r=t?document.querySelector(t):null,a=Array.from(document.querySelectorAll(e)).map(e=>({elem:e,reference:r||e}));function n(){const e=window.innerWidth,t=e<window.cannondaleBreakpoints.tablet?s:e>window.cannondaleBreakpoints.desktop?o:i;a.forEach(e=>{var s=e.reference.offsetHeight*t;r.getBoundingClientRect().top+s<0?e.elem.classList.add("is-sticky"):e.elem.classList.remove("is-sticky")})}n(),debouncedListener("scroll",n,10),debouncedListener("resize",n,250)}function U(e,t){return t?`https://img.youtube.com/vi/${e}/mqdefault.jpg`:`http://i3.ytimg.com/vi/${e}/maxresdefault.jpg`}function W(e){const t=window.innerWidth,s=t<window.cannondaleBreakpoints.tablet?"data-poster-mobile":t>=window.cannondaleBreakpoints.desktop?"data-poster":"data-poster-tablet";return e.getAttribute(s)}function z(e,t,s){document.querySelectorAll(e).forEach(e=>{e.classList.add("is-loading","animation-reset"),e.setAttribute("data-offsetmobile",t),e.setAttribute("data-offsetdesktop",s)})}function V(e){e?.forEach(e=>{const t=Math.random();e.style.transition=`opacity ${500*t}ms`,setTimeout(()=>e.style.opacity=1,1500*t)})}function G(e){const t=e?.length;let s=-1;for(;++s<t;){let t=e[s];if(-(t.elem.getBoundingClientRect().top-window.innerHeight)-200>=0){V(t.letters),e.splice(s,1);break}}}document.body.addEventListener("touchstart",function(e){e.target&&e.target.closest(".flickity-slider")?(x=!0,P={x:e.touches[0].pageX,y:e.touches[0].pageY}):x=!1}),document.body.addEventListener("touchmove",function(e){if(x&&e.cancelable){const t={x:e.touches[0].pageX-P.x,y:e.touches[0].pageY-P.y};Math.abs(t.x)>7&&e.preventDefault()}},{passive:!1}),document.querySelectorAll("[data-focus='input'] .trigger").forEach(e
1=>{e.addEventListener("click",t=>{if(window.innerWidth>=window.cannondaleBreakpoints.tablet){const t=e.closest("[data-focus='input']");let s=t.querySelector('input[type="text"]');s||(s=t.querySelector(".magic-box-input input")),s&&s.focus()}})}),document.querySelectorAll(".label-swap").forEach(e=>{const t=F(e,"input, select"),s="SELECT"===t.tagName,i=s?"change":"keyup";R(t,e,s),t.addEventListener("blur",()=>R(t,e,s)),t.addEventListener(i,()=>R(t,e,s))}),document.querySelectorAll(".languages").forEach(e=>{const t=$(e),s=t.closest(".panel");function i(){const e=-(t.offset().left-s.offset().left);t.css({"margin-left":e,width:s.outerWidth()})}var o=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;$.fn.attrchange=function(e){if(o){var t={subtree:!1,attributes:!0},s=new o(function(t){t.forEach(function(t){e.call(t.target,t.attributeName)})});return this.each(function(){s.observe(this,t)})}},t.attrchange(function(e){"class"==e&&container.toggleClass("specified")}),window.onload=()=>{setTimeout(i,1)}}),window.addEventListener("LOCALLY_region_update",async e=>{const{city:t,country:s,lat:i,lng:o,state:r}=e.detail;window.LocationManager.storeUserLocation({cityState:[t,r].join(),country:s,latitude:i,longitude:o,searchText:[t,r,s].join(", ")})}),window.switchLiveEventCallback=e=>{let t=null,s={url:e.url};switch(e.store_address&&(s.store_id=e.store_id,s.store_name=e.store_name,s.store_address=e.store_address),parseInt(e.id)){case 1:case 4:case 5:case 6:case 7:case 9:case 21:case 38:case 41:case 46:case 47:case 48:case 49:case 65:case 70:case 79:case 82:case 83:t="locally_product_locator";break;
1case 56:case 59:case 61:case 63:case 66:case 68:case 71:case 73:case 75:case 77:case 80:case 84:t="locally_store_locator"}if(t){const i={event_name:e.description,event_type:e.type,additional_data:s};dataLayer.push({event:t,locally_info:i})}},window.modalWasOpenTimeout=null,window.generateModalCloseElem=()=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");return e.setAttribute("class","closeModal triggerModalClose"),e.setAttribute("width","32"),e.setAttribute("height","32"),e.setAttribute("viewbox","0 0 32 32"),e.setAttribute("fill","none"),e.innerHTML='<path d="M22.3198 11.0945C22.7103 10.704 22.7103 10.0708 22.3198 9.68027C21.9292 9.28974 21.2961 9.28974 20.9055 9.68027L16 14.5858L11.0945 9.68028C10.704 9.28976 10.0708 9.28976 9.68027 9.68028C9.28975 10.0708 9.28975 10.704 9.68027 11.0945L14.5858 16L9.68022 20.9056C9.2897 21.2961 9.2897 21.9293 9.68022 22.3198C10.0707 22.7103 10.7039 22.7103 11.0944 22.3198L16 17.4142L20.9056 22.3198C21.2961 22.7103 21.9293 22.7103 22.3198 22.3198C22.7103 21.9293 22.7103 21.2961 22.3198 20.9056L17.4142 16L22.3198 11.0945Z" fill="black"/>',e},window.cjsQuickModal=(e,t)=>new n(e,t),window.cjsToggleModal=e=>O(e),document.querySelectorAll("div[data-modal-name]").forEach(e=>{const t=document.createElement("div"),s=document.createElement("div"),i=document.createElement("div"),o=window.generateModalCloseElem(),r=e.dataset.modalTitle;if(e.classList.add("modal"),t.className="modalOuter",s.className="modalUpper",i.className="modalInner",Array.from(e.children).forEach(e=>i.appendChild(e)),r?.length){const e=document.createElement("p");e.className="modalTitle h4 -bold",e.textContent=r,s.appendChild(e)}s.appendChild(o),t.appendChild(s),t.appendChild(i),e.appendChild(t),document.body.appendChild(e),D(e)}),document.querySelectorAll("[data-modal-trigger]").forEach(e=>{window.utilities.bindHybridClick(e,function(t){t.preventDefault(),O(e.getAttribute("data-modal-trigger"))})}),document.addEventListener("keydown",e=>{"Escape"===e.key&&document.querySelectorAll(".modalOpen").forEach(e=>{"true"!==e.getAttribute("data-modal-disable-esc")&&O(e)})}),new class{constructor(e){e&&(this.elem=e,this.primaryNavigationSection=document.getElementById("PrimaryNavigation"),this.siteHeader=document.getElementById("site-header-wrap"),this.generalSiteLinks=document.getElementById("general-site-links"),this.menuOpenButton=document.getElementById("nav-open"),this.menuCloseButton=document.getElementById("nav-close"),this.primaryNavigationTriggers=e.querySelectorAll(".nav-primary-trigger"),this.secondaryNavigationTriggers=e.querySelectorAll(".nav-secondary-trigger"),this.primaryNavigationContainers=e.querySelectorAll(".nav__primary"),this.navLinkColumns=e.querySelectorAll(".nav__tertiary"),this.categoryFilter=document.getElementById("category"),this.modelFilter=document.getElementById("model"),this.bikesByCategory=document.getElementById("bikes-by-category"),this.bikesByModel=document.getElementById("bikes-by-model"),this.init())}init(){this.bikesByModel&&this.bikesByModel.classList.add("hidden"),this.menuOpenButton.addEventListener("click",e=>{this.primaryNavigationSection.classList.add("menu-open"),this.menuOpenButton.classList.add("hidden"),this.menuCloseButton.classList.remove("hidden"),this.siteHeader.classList.add("pin-header")}),this.menuCloseButton.addEventListener("click",e=>{this.primaryNavigationSection.querySelectorAll(".nav__primary").forEach(e=>e.classList.remove("nav-primary-active","hidden")),this.primaryNavigationSection.querySelectorAll(".nav-secondary-active").forEach(e=>e.classList.remove("nav-secondary-active")),this.generalSiteLinks.classList.remove("hidden"),this.primaryNavigationSection.classList.remove("menu-open"),this.menuOpenButton.classList.remove("hidden"),this.menuCloseButton.classList.add("hidden"),this.siteHeader.classList.remove("pin-header")}),this.primaryNavigationTriggers.forEach(e=>{e.addEventListener("click",t=>{this.primaryNavigationSection.classList.contains("menu-open")&&t.preventDefault(),this.primaryMenuToggle(e),this.generalSiteLinks.classList.contains("hidden")?this.generalSiteLinks.classList.remove("hidden"):this.generalSiteLinks.classList.add("hidden")})}
1),this.secondaryNavigationTriggers.forEach(e=>{e.addEventListener("click",t=>{this.primaryNavigationSection.classList.contains("menu-open")&&t.preventDefault(),this.secondaryMenuToggle(e)})}),this.primaryNavigationContainers.forEach(e=>{e.addEventListener("mouseover",()=>{this.siteHeader.classList.add("pin-header")})}),this.siteHeader.addEventListener("mouseout",()=>{this.primaryNavigationSection.classList.contains("menu-open")||this.siteHeader.classList.remove("pin-header")}),this.categoryFilter&&this.bikesByCategory&&this.modelFilter&&this.bikesByModel&&(this.categoryFilter.addEventListener("click",e=>{e.preventDefault(),this.categoryFilter.classList.add("selected"),this.bikesByCategory.classList.remove("hidden"),this.modelFilter.classList.remove("selected"),this.bikesByModel.classList.add("hidden")}),this.modelFilter.addEventListener("click",e=>{e.preventDefault(),this.modelFilter.classList.add("selected"),this.bikesByModel.classList.remove("hidden"),this.categoryFilter.classList.remove("selected"),this.bikesByCategory.classList.add("hidden")}))}primaryMenuToggle(e){const t=e.closest(".nav__primary"),s=t.querySelectorAll(".nav__secondary"),i=e.closest(".nav__mobile-panel").querySelectorAll(".nav__primary");t.classList.contains("nav-primary-active")?(t.classList.remove("nav-primary-active"),s.forEach(e=>{e.classList.contains("nav-secondary-active")&&e.classList.remove("nav-secondary-active")})):t.classList.add("nav-primary-active"),i.forEach(e=>{e!==t&&(e.classList.contains("hidden")?e.classList.remove("hidden"):e.classList.add("hidden"))})}secondaryMenuToggle(e){const t=e.closest(".nav__secondary");
1e.closest(".nav__item-links").querySelectorAll(".nav__secondary").forEach(e=>{e!==t&&e.classList.contains("nav-secondary-active")&&(e.classList.contains("nav-secondary-active")?e.classList.remove("nav-secondary-active"):e.classList.add("nav-secondary-active"))}),t.classList.contains("nav-secondary-active")?t.classList.remove("nav-secondary-active"):t.classList.add("nav-secondary-active")}}(document.getElementById("MainNavigation")),document.querySelectorAll("input[type=password]").forEach(e=>{new r(e)}),window.renderProductCarousel=async(e,t,s)=>{const i=e.querySelector(".scrollable-content"),o=window.utilities.gaList(t.products,t.title,s);i.querySelector(".scrollable-content__scroller").innerHTML=t.products.map(e=>window.renderProductCard(e,{showAddToCart:t.showAddToCart,useSitecoreKeys:s})).join(""),i.querySelectorAll("img").forEach(e=>{e.onload=function(){e.style.opacity=1}}),i.querySelectorAll(".add-to-cart-button").forEach(e=>{window.utilities.bindHybridClick(e,t=>{window.addItemToCart(e)})}),i.querySelectorAll(".product-card__link").forEach(e=>{e.addEventListener("click",t=>{o(t,e)})}),m.createScrollableContent(i)},window.productCarousels&&document.querySelectorAll(".carousel-product > .carousel-container").forEach(async e=>{const t=window.productCarousels[e.id];if(t){if(t.excludePDP&&window.productSalsifyId){const e=t.products.findIndex(e=>e.salsifyid===window.productSalsifyId);e>-1&&t.products.splice(e,1)}t.products=await window.utilities.normalizeProductsFromSitecore(t.products,t.showAddToCart),window.renderProductCarousel(e,t,!0)}}),document.querySelectorAll(".prog-load.is-img-loading").forEach(e=>{const t=e.querySelector("picture:nth-child(2)");if(t){let s;const i=t.querySelectorAll("source"),o=t.querySelector("img"),r=o.getAttribute("data-src"),a=function(){e.classList.add("is-img-loaded"),e.classList.remove("is-img-loading"),o.onload=null,null!==s&&(window.clearTimeout(s),s=null)};i.forEach(e=>{let t=e.getAttribute("data-srcset");t&&(e.setAttribute("srcset",t),e.removeAttribute("data-srcset"))}),o.onload=a,s=window.setTimeout(a,5e3),r&&(o.setAttribute("src",r),o.removeAttribute("data-src"))}else e.classList.remove("is-img-loading")}),document.addEventListener("DOMContentLoaded",()=>{const e=document.getElementById("PromoCode");e&&(window.promoCodes=new a(e))}),document.addEventListener("DOMContentLoaded",async()=>{let e;const t=["en","en-eu","en-la","es-la"];try{e=new h(document.getElementById("region-selection"));const s=window.location.href.split(".com/")[1].split("/")[0];if(!t.includes(s)||localStorage.region||localStorage.language){if("true"==sessionStorage.getItem("ignoreRegionSelector"))return;if(!localStorage.language||!localStorage.region)return;`${localStorage.language.toLowerCase()}-${localStorage.region.toLowerCase()}`!=s&&e.open(!0)}else e.open()}catch(e){return void console.warn("Could not retrieve country list",e)}}),document.addEventListener("DOMContentLoaded",()=>{const e=document.getElementById("SavingsSummary");e&&(savingsSummary=new u(e),window.renderSavings=savingsSummary.renderSavings.bind(savingsSummary))}),document.querySelectorAll(".search-location, .archive-search").forEach(e=>{const t=e.querySelector("input"),s=e.querySelector(".visibility-toggle"),i=e.querySelector(".button"),o=e.querySelector(".predictive-results");function r(){o.classList.remove("is-visible")}t&&t.addEventListener("keyup",function(){this.value.length?s.classList.add("is-visible"):r()}),i&&i.addEventListener("click",function(){r()})}),document.addEventListener("click",e=>{const t=e.target.closest("[data-trigger]");if(t)if(e.preventDefault(),t.classList.contains("no-self-close")&&t.classList.contains("is-active"));else{const e=t.parentElement,s="child"===t.getAttribute("data-swap")?e:e.closest(".multi-showhide");s&&s.querySelectorAll(".is-active").forEach(e=>{e!==t&&N(e)}),N(t)}}),document.addEventListener("DOMContentLoaded",()=>{const e=document.getElementById("SitewidePromoBanner");if(e){const t=document.getElementById("promoBannerCloseButton");sessionStorage.getItem("promoBannerClose")||(e.classList.remove("hidden"),window.StickyHeader?.updateHeaderHeightOffset()),t&&t.addEventListener("click",()=>{e.classList.add("hidden"),window.StickyHeader?.updateHeaderHeightOffset(),sessionStorage.setItem("promoBannerClose","true")})}}),window.preventStickyHeader?document.querySelector(".site-header").classList.add("sticky-eyebrow"):window.StickyHeader=new p,j(".hero-pdp .actions",".hero-pdp",1,1,.5),j(".filter-product",".filter-product-scroll-reference",0,0,0),document.querySelectorAll("[data-filter]").forEach(e
1=>"visibility"===e.getAttribute("data-filtertype")?new y(e):new w(e)),document.querySelectorAll("[data-swaptext]").forEach(e=>{e.addEventListener("click",function(){const e=this.querySelector(".label")||this,t=e.textContent,s=this.getAttribute("data-swaptext");this.classList.toggle("swapped-text"),e.textContent=s,this.setAttribute("data-swaptext",t)})}),document.querySelectorAll(".tabbed-layout-js").forEach(e=>{const t=e.querySelectorAll(".tabbed-layout__trigger"),s=Array.from(e.querySelectorAll(".tabbed-layout__panel")).map(e=>({name:e.getAttribute("data-panel-name"),elem:e}));t.forEach(e=>{const i=e.getAttribute("data-panel-name");e.addEventListener("click",o=>{s.forEach(e=>{e.name===i?e.elem.classList.add("is-active"):e.elem.classList.remove("is-active")}),t.forEach(t=>{t!==e&&t.classList.remove("is-active")}),e.classList.add("is-active")})})}),document.querySelectorAll("body:not(.sc-editor) .carousel-terrain").forEach(e=>{const t=e.querySelectorAll(".title"),s=e.querySelectorAll(".linkout"),i=e.querySelector(".carousel-container"),o=document.createElement("div"),r=document.createElement("div"),a=window.utilities.createCarousel(e,function(e,i,o,r){t[o].classList.add("is-hiding"),s[o].classList.add("is-hiding"),window.setTimeout(()=>{t.concat(s).forEach(e=>{e.classList.remove("is-hiding","is-visible")}),t[r].classList.add("is-visible"),s[r].classList.add("is-visible")})});o.className="all-titles",r.className="all-buttons",t.forEach(e=>
1o.appendChild(e)),s.forEach(e=>r.appendChild(e)),i.appendChild(o),i.appendChild(r),a.$carousel.on("init",function(e){t[0].classList.add("is-visible"),s[0].classList.add("is-visible")}),document.addEventListener("DOMContentLoaded",function(){a.init({prevArrow:'<button type="button" class="slick-prev"><i class="icon icon-arrow-large-left"></i></button>',nextArrow:'<button type="button" class="slick-next"><i class="icon icon-arrow-large-right"></i></button>',appendArrows:void 0,dots:!1,centerMode:!0,centerPadding:"13%",focusOnSelect:!0,speed:750,responsive:[{breakpoint:600,settings:{centerPadding:"11.5%"}},{breakpoint:1023,settings:{centerPadding:"22.5%"}}]});const t=e.querySelector(".slick-prev"),s=e.querySelector(".slick-next");t.addEventListener("mouseover",function(){e.classList.add("hover-prev")}),s.addEventListener("mouseover",function(){e.classList.add("hover-next")}),t.addEventListener("mouseout",function(){e.classList.remove("hover-prev")}),s.addEventListener("mouseout",function(){e.classList.remove("hover-next")})})}),document.querySelectorAll("[data-toggletarget]").forEach(e=>{e.addEventListener("click",function(){const e=this.getAttribute("data-toggletarget"),t=document.querySelectorAll(`[data-toggletarget="${e}"]`),s=document.querySelectorAll(`[data-totoggle="${e}"]`),i=this.getAttribute("data-togglestring");t.forEach(e=>e.classList.remove("is-active")),this.classList.add("is-active"),s.forEach(e=>e.setAttribute("data-togglestring",i))})}),document.querySelectorAll(".tooltip:not(.--js-ignore)").forEach(e=>{const t=e.querySelector(".tooltip__message"),s=()=>{t.classList.remove("-show"),document.body.removeEventListener("click",s)};t&&e.addEventListener("click",e=>{e.stopPropagation(),t.classList.toggle("-show"),t.classList.contains("-show")&&document.body.addEventListener("click",s)})}),document.querySelectorAll(".validettaValidate").forEach(e=>{new f(e)}),window.createValidatedForm=e=>new f(e),document.querySelectorAll(".video").forEach(e=>{const t=e.querySelector(".poster"),s=e.querySelector(".trigger"),i=e.querySelector(".responsive-iframe"),o=e.querySelector(".cta").cloneNode(!0),r=document.createElement("img"),a=e.getAttribute("data-videoid"),n=e.getAttribute("data-background-screen"),l=W(e);if(r.className="poster-image",r.alt="",t.appendChild(r),t.appendChild(o),n&&n.length>0){const t=e.querySelector(".video__text");t&&(t.style.backgroundColor=n)}const c=()=>{i.insertAdjacentHTML("beforeend",`<iframe width="560" height="315" src="${a}?rel=0&autoplay=1&modestbranding=1" frameborder="0" allow="autoplay" allowfullscreen></iframe>`),e.classList.add("is-open"),s.removeEventListener("click",c)};s.addEventListener("click",c),l&&l.length>0?(r.src=l,debouncedListener("resize",()=>r.src=W(e),250)):e.classList.contains("small")?(r.src=U(a,window.innerWidth>=window.cannondaleBreakpoints.tablet),debouncedListener("resize",()=>r.src=U(a,window.innerWidth>=window.cannondaleBreakpoints.tablet),250)):r.src=U(a,!1)});class Z{constructor(e){this.elem=e,this.offsetMobile=e.getAttribute("data-offsetmobile")||0,this.offsetDesktop=e.getAttribute("data-offsetdesktop")||0,this.currentOffset=null,this.setCurrentOffset(),this.scrollAction(!0)}_moveWithoutAnimating(e){this.elem.classList.add("no-animation"),this.elem.classList.toggle("is-loading","hide"===e),setTimeout(()=>{this.elem.classList.remove("no-animation")},1e3)}setCurrentOffset(){const e=window.innerWidth;this.currentOffset=e<window.cannondaleBreakpoints.largeTablet?this.offsetMobile:this.offsetDesktop}scrollAction(e){const t=this.elem.getBoundingClientRect().top,s=-(t-window.innerHeight);e&&window.scrollY>t&&this._moveWithoutAnimating("show"),s-this.currentOffset>=0&&(this.elem.classList.remove("is-loading"),this.elem.classList.remove("no-animation"))}}function K(e,t,s,i){document.querySelectorAll(e).forEach(e=>Y(e,t,s,i))}function Y(e,t,s,i){const o=e.querySelectorAll(t);let r=i;o.forEach(e=>{e.style.transitionDelay=[r,"s"].join(""),r+=s})}z([".blog-content",".blog-list-card-grid",".consumer-benefits-container",".crosslink-content",".crosslink-editorial",".crosslink-split",".feature-highlight",".hotspots",".hotspots-product-wrapper",".intro",".intro-with-media",".paragraph-large",".photo-split","#search-results .product-grid",".product-line",".product-overview",".quote",".register-a-bike .column-block",".simple-type-and-image",".storyteller-product",".video"].join(),200,200),z(".photo-split, .paragraph-large, .feature-highlight",100,100),function(){const e=[".billboard",".hero-about",".hero-pdp",".hero-plp",".hero-collections",".hero-bike-finder",".blog-header",".hero-checkout-confirmation"].join();
1document.querySelectorAll(e).forEach(e=>{const t=e.querySelector("img");e.classList.add("animation-paused"),!t||t.complete?(e.classList.add("animation-started"),e.classList.remove("animation-paused")):t.onload=()=>{e.classList.add("animation-started"),e.classList.remove("animation-paused")}})}(),K(".hero-pdp",".tag",.25,0),K(".hero-pdp",".sticky-label ",.25,0),K(".animation-kit-build .box-container",".border",.05,0),z(".timeline",300,300),K(".timeline",".item",.05,0),z(".carousel-image",300,450),K(".carousel-image",".item",.05,0);const Q=document.querySelector(".nav-main");Q&&(Q.querySelector(".nav-trigger").addEventListener("click",e=>Q.classList.add("is-animating")),Q.querySelector(".close").addEventListener("click",e=>Q.classList.remove("is-animating"))),z(".carousel-product, .carousel-collection, .carousel-platform",300,300),z(".product-features",300,350),document.querySelectorAll('[class^="carousel"]').forEach(e=>{e.parentElement.closest('[class^="carousel"]')||e.addEventListener("init",t=>{Y(e,".slick-slide",.05,0)})}),document.querySelectorAll(".location-results .result").forEach((e,t)=>{window.setTimeout(()=>{e.classList.add("fade-in")},300*t)}),K(".search-results-help",".result-link",.5,0),window.innerWidth>window.cannondaleBreakpoints.largeTablet&&K(".sortable",".sortable-item",.1,0),function(){const e=Array.from(document.querySelectorAll(".is-loading, .animation-reset")).map(e=>new Z(e));debouncedListener("scroll",()=>{e.forEach(e=>{e.scrollAction()})},10),debouncedListener("resize",()=>{e.forEach(e=>{e.setCurrentOffset(),e.scrollAction()})},250)}(),function(){const e=[".filter-product",".product-grid",".blog-list-header",".register-a-bike",".search-location",".location-results",".sortable",".search-results-menu",".search-results-help",".compare-tool",".blog-list-top-story",".archive-search-result"].join();document.querySelectorAll(e).forEach(e=>e.classList.add("fade-in"))}(),function(){const e=document.querySelectorAll(".simple-type-and-image .headline");if(!e.length)return!1;const t=Array.from(e).map(e=>(e.innerHTML=e.textContent.split("").map(e=>`<span class="fade" style="opacity: 0;">${e}</span>`).join(""),{elem:e,letters:e.querySelectorAll("span")}));G(t),window.addEventListener("load",()=>G(t)),debouncedListener("scroll",()=>G(t),10)}(),K(".product-specifications",".column:first-child .border",.125,0)}();
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.