https://www.velotricbike.com/cdn/shop/t/644/assets/vl-bundle-cart.js?v=97459970987027271951789470659
1(()=>{var Dt=Object.defineProperty,r=(d,t)=>Dt(d,"name",{value:t,configurable:!0}),H=window.VelotricBundle;if(!H?.shell?.ready)throw new Error("vl-bundle-shell.js must execute before vl-bundle-cart.js");var n=H.shell.api;if(!n)throw new Error("Missing shell named API contract");var o=n.$el,s=n.$elParent,w=n.$list,Xt=n.appendElementToBody,Jt=n.capitalize,Zt=n.createPortal,te=n.createPrefetchLink,F=n.delay,ee=n.getFocusTargets,re=n.getTargets,oe=n.isCurrentPageLink,ae=n.isExternalLink,se=n.isNotIframe,ie=n.isNotThemeStore,ne=n.isSafari,q=n.registerComponent,de=n.removeCustomElementFromBody,ce=n.stripHtml,Q=n.transitionToPromise,le=n.upperCamelCaseToSnakeCase,pe=n.viewportObserver,E=n.whenDefined,j=window.VelotricBundle;if(!j?.shell?.ready)throw new Error("vl-bundle-shell.js must execute before vl-bundle-cart.js");var M=j.shell.api;if(!M)throw new Error("Missing shell named API contract");var i=M.BaseComponent,he=M.ShopifyEditor,W=window.VelotricBundle;if(!W?.shell?.ready)throw new Error("vl-bundle-shell.js must execute before vl-bundle-cart.js");var C=W.shell.api;if(!C)throw new Error("Missing shell named API contract");var u=C.isEnterKey,Ce=C.isEscKey,we=C.isLeftKey,fe=C.isRightKey,Ee=C.isSpaceKey,ve=C.isTabKey,bt="[data-quantity-input]",v=class extends i{static{r(this,"QuantityComponent")}input;prevValue;stockValue;constructor(){super(),this.input=o(bt,this),this.prevValue=this.value,this.stockValue=this.dataset.stock||"0"}mountComponent(){this.updateButtonsDisable(),this.addListener(this.input,"keypress",this.handleKeydown),this.addListener(this.input,"input",this.handleInput),this.addListener(this.input,"blur",this.handleBlur)}handleBlur=r(t=>{if(this.input){let a=t.target.value||"0";this.input.value=a,this.updateButtonsDisable(),this.prevValue=a}},"handleBlur");handleKeydown=r(t=>{this.input&&u(t)&&(t.preventDefault(),this.input.blur())},"handleKeydown");handleInput=r(t=>{if(this.input){let a=t.target.value;this.input.value=this.isMoreThanStock?this.stockValue:a,this.updateButtonsDisable(),this.prevValue=a}},"handleInput");inputChange(t){this.input&&(t==="minus"?this.input.stepDown():this.input.stepUp(),+this.prevValue!=+this.value&&this.input.dispatchEvent(new Event("change",{bubbles:!0})),this.updateButtonsDisable())}updateButtonsDisable(){this.updateButtonDisabled("minus",this.isLessThanMin),this.updateButtonDisabled("plus",this.isMoreThanStock)}setDisable(t){this.updateButtonDisabled("minus",t),this.updateButtonDisabled("plus",t)}updateButtonDisabled(t,e){o(`quantity-btn[data-action="${t}"]`,this)?.toggleAttribute("disabled",e)}get value(){return this.input?this.input.value:"0"}get isLessThanMin(){return this.input?+this.value<=+this.input.min:!1}get isMoreThanStock(){return+this.value>=+this.stockValue}},G="quantity-component",D=class extends i{static{r(this,"QuantityBtn")}mountComponent(){this.addListener(this,"click",this.handleButtonClick),this.addListener(this,"keydown",this.handleKeyDown)}handleButtonClick=r(t=>{t.preventDefault(),this.update()},"handleButtonClick");handleKeyDown=r(t=>{let e=t.target;u(t)&&!e.hasAttribute("disabled")&&(t.preventDefault(),this.update())},"handleKeyDown");update(){let t=s(G,this),e=this.dataset.action;t&&e&&(t.inputChange(e),e==="minus"&&this.setDisabled())}setDisabled(){let t=s(G,this);this.toggleAttribute("disabled",t?.input?.value==="1")}},gt="[data-cart-item-checkmark]",Tt="[data-cart-item-quantity]",b=class extends i{static{r(this,"CartItem")}mountComponent(){this.setHeight(this.hasAttribute("is-new")?0:this.scrollHeight)}async removeItem(){await this.collapse()}async expand(){this.setHeight(this.scrollHeight),await Q(this)}async collapse(){this.setHeight(0),await Q(this)}async showAsNew(){await this.expand(),this.removeAttribute("is-new"),this.dispatchEvent(new Event("showAsNew",{bubbles:!0}))}showCheckmark=r(()=>{let t=o(gt,this);t?.classList.remove("hidden"),F(2500).then(()=>{t?.classList.add("hidden")})},"showCheckmark");setLoading=r(t=>{this?.toggleAttribute("is-loading",t)},"setLoading");setHeight(t){this.style.maxHeight=`${Math.ceil(t)}px`}setDisabled(t){o(Tt,this)?.setDisable(t)}},yt="[data-free-shipping-progress-bar-dots]",Rt="[data-free-shipping-bar-message]",At="data-free-shipping-difference",Lt="data-free-shipping-difference-percent",xt="data-progress-message",_t="data-achieved-message",g=class extends i{static{r(this,"FreeShippingBar")}constructor(){super(),this.updateProgressByDifference(this.getAttribute(At),+this.getAttribute(Lt))}updateProgressByDifference(t,e){let a=this.getAttribute(xt)??"",l=this.getAttribute(_t)??"";e<100?(this.setText(a.replace("[value]",t)),this.setProgress(e)):(this.setText(l),this.setProgress(100))}setProgress=r(t=>{let e=o(yt,this);e&&(e.style.transform=`translateX(${t}%)`)},"setProgress");setText=r(t=>{o(Rt,this)?.replaceChildren(t)},"setText");checkAndAddFreeItem=r(()=>{fetch("/cart.js").then(t=>t.json()).then(t=>{let m=t.items.filter(h=>h.product_id===0xd5579ea8174);if(m.length===0||m.reduce((h,vt)=>h+vt.quantity,0)<2)return;let wt=[54151595327860,54151595360628];if(!m.some(h=>wt.includes(h.variant_id)))return;let ft=t.items.some(h=>h.variant_id===42443111661751),Et=t.items.some(h=>h.variant_id===42443111792823);ft||Et||document.querySelector(".add_free_item_1")?.click()}).catch(t=>console.error("\u83B7\u53D6\u8D2D\u7269\u8F66\u5931\u8D25",t))},"checkAndAddFreeItem")},T=class extends i{static{r(this,"CartRemoveButton")}mountComponent(){this.addListener(this,"keydown",this.handleKeyDown),this.addListener(this,"click",this.handleButtonClick)}handleButtonClick=r(t=>{t.preventDefault(),this.update()},"handleButtonClick");handleKeyDown=r(t=>{u(t)&&(t.preventDefault(),this.update())},"handleKeyDown");
1update(){let t=s("cart-page, cart-drawer",this),e=this.dataset.index;t&&e&&t.updateItem(+e,0)}},Y=window.VelotricBundle;if(!Y?.cards?.ready)throw new Error("vl-bundle-cards.js must execute before vl-bundle-cart.js");var z=Y.cards.api;if(!z)throw new Error("Missing cards named API contract");var y=z.Card,X="[data-product-card-quick-view-button]",kt="#Quick-view",R=class extends y{static{r(this,"HorizontalProductCard")}mountComponent(){let t=o(X,this);this.addListener(t,"keydown",this.handleQuickViewBtnKeyDown),this.addListener(t,"click",this.handleQuickViewBtnClick),this.addListener(this,"mouseenter",this.handleProductCardEnter)}handleQuickViewBtnKeyDown=r(async t=>{u(t)&&(t.preventDefault(),this.callQuickView(!0))},"handleQuickViewBtnKeyDown");handleQuickViewBtnClick=r(async()=>{this.callQuickView(!0)},"handleQuickViewBtnClick");handleProductCardEnter=r(()=>{this.callQuickView(!1)},"handleProductCardEnter");async callQuickView(t){let e=o(kt),a=this.dataset.url,l=this.dataset.id;!e||!a||!l||(await e.requestProductFromUrl(a,l),t&&(this.setQuickViewLoading(!0),await e.openAndRenderProductByUrl(a),this.setQuickViewLoading(!1)))}setQuickViewLoading(t){let e=o(X,this);e&&(e.classList.toggle("loading",t),e.toggleAttribute("disabled",t))}},J="[data-product-card-quick-view-button]",Pt="#Quick-view",A=class extends y{static{r(this,"VerticalProductCard")}mountComponent(){let t=o(J,this);this.addListener(t,"click",this.handleQuickViewBtnClick),this.addListener(t,"keydown",this.handleQuickViewBtnKeyDown),this.addListener(this,"mouseenter",this.handleProductCardEnter)}handleQuickViewBtnKeyDown=r(async t=>{u(t)&&(t.preventDefault(),this.callQuickView(!0))},"handleQuickViewBtnKeyDown");handleQuickViewBtnClick=r(async()=>{this.callQuickView(!0)},"handleQuickViewBtnClick");handleProductCardEnter=r(()=>{this.callQuickView(!1)},"handleProductCardEnter");async callQuickView(t){let e=o(Pt),a=this.dataset.url,l=this.dataset.id;!e||!a||!l||(await e.requestProductFromUrl(a,l),t&&(this.setQuickViewLoading(!0),await e.openAndRenderProductByUrl(a),this.setQuickViewLoading(!1)))}setQuickViewLoading(t){let e=o(J,this);e&&(e.classList.toggle("loading",t),e.toggleAttribute("disabled",t))}},Z=window.VelotricBundle;if(!Z?.shell?.ready)throw new Error("vl-bundle-shell.js must execute before vl-bundle-cart.js");
1var p=Z.shell.api;if(!p)throw new Error("Missing shell named API contract");var er=p.getStylePropValue,rr=p.getTemplateContent,tt=p.getTemplateFirstChild,et=p.hideElement,rt=p.parseHTML,or=p.removeStyleVariable,c=p.replaceNodeChildren,ar=p.setStyleVariable,ot=p.showElement,sr=p.skipTransition,at="cart-drawer",St="cart-drawer-items-block",L=class extends i{static{r(this,"CartDrawerItemsBlock")}mountComponent(){let t=s(at,this);t?.on("update-nodes",this.handleCartDrawerUpdate),t?.on("purchase",this.handleCartDrawerPurschase)}unmountComponent(){let t=s(at,this);t?.off("update-nodes",this.handleCartDrawerUpdate),t?.off("purchase",this.handleCartDrawerPurschase)}handleCartDrawerUpdate=r(({node:t,parsedState:e})=>{let a=o(`${St}[block-id="${this.getAttribute("block-id")}"]`,t);e&&e.quantity===1&&o(`cart-item[data-variant-id="${e.id}"]`,a).setAttribute("is-new",""),c(this,a)},"handleCartDrawerUpdate");handleCartDrawerPurschase=r(async({parsedState:t})=>{let e=o(`cart-item[data-variant-id="${t.id}"]`,this);e&&t.quantity===1&&await e?.showAsNew(),e?.showCheckmark()},"handleCartDrawerPurschase")},st="cart-drawer",Bt="cart-drawer-in-cart-banner-block",x=class extends i{static{r(this,"CartDrawerInCartBannerBlock")}mountComponent(){s(st,this)?.on("update-nodes",this.handleCartDrawerUpdate)}unmountComponent(){s(st,this)?.off("update-nodes",this.handleCartDrawerUpdate)}handleCartDrawerUpdate=r(({node:t})=>{c(this,o(`${Bt}[block-id="${this.getAttribute("block-id")}"]`,t))},"handleCartDrawerUpdate")},it=".loading-overlay",Vt="[in-cart-related-product]",It='[data-sidebar-template="CartDrawer"]',Ut="body-element",_=class extends i{static{r(this,"CartDrawerRelatedProducts")}prevUrl;mountComponent(){this.loadProducts()}erase(){this.replaceChildren(),this.setReady(!1)}loadProducts(){if(this.prevUrl!==this.dataset.url&&(this.prevUrl=this.dataset.url,!!this.dataset.url))return this.showPreloader(),fetch(this.dataset.url).then(t=>t.text()).then(t=>{this.hidePreloader();let e=o(It,rt(t)),a=tt(e);this.updateByHTML(a)}).catch(()=>{o(Ut).showNotification("Error in cart drawer related products","warning")})}updateByHTML=r(t=>{let e=o(`#${this.id}`,t);c(this,e);let a=w(Vt,this);this.setReady(a.length>0)},"updateByHTML");setReady(t){this.toggleAttribute("is-ready",t)}
1showPreloader(){let t=o(it,this);ot(t)}hidePreloader(){let t=o(it,this);et(t)}},Ot=".cart-drawer__on-side-related-products-carousel-wrapper",nt=r(d=>!!d?.querySelector(Ot),"hasCartDrawerAsideProducts"),$t="[in-cart-related-product]",k=class extends _{static{r(this,"CartDrawerRelatedProducts")}updateByHTML=r(t=>{let e=o(`#${this.id}`,t);c(this,e);let a=w($t,this);this.setReady(a.length>0),this.closest(".cart-drawer")?.toggleAttribute("has-aside-products",nt(t))},"updateByHTML")},Nt="[data-cart-drawer-related-products]",dt="cart-drawer",Kt="cart-drawer-related-products-block",Qt="carousel-component",P=class extends i{static{r(this,"CartDrawerRelatedProductsBlock")}mountComponent(){s(dt,this)?.on("update-nodes",this.handleCartDrawerUpdate)}unmountComponent(){s(dt,this)?.off("update-nodes",this.handleCartDrawerUpdate)}handleCartDrawerUpdate=r(({node:t})=>{let e=o(Nt,this);if(!e)return;let a=o(`${Kt}[block-id="${this.getAttribute("block-id")}"] [data-cart-drawer-related-products]`,t);if(a){if(this.hasAttribute("is-auto-recommendations")){let m=a.getAttribute("data-url");e.setAttribute("data-url",m),m?e.loadProducts():(e.erase(),this.checkHasAsideProducts(),this.updateVisibility())}else c(e,a),this.checkHasAsideProducts(),this.updateVisibility();this.reInitCarousel()}},"handleCartDrawerUpdate");checkHasAsideProducts(){if(this.hasAttribute("is-aside-related-products")){let e=w("[is-aside-related-products] vertical-product-card, [is-aside-related-products] horizontal-product-card"),a=o("cart-drawer"),l=e?.length>0;a&&a.toggleAttribute("has-aside-products",l)}}updateVisibility=r(()=>{if(!this.hasAttribute("is-aside-related-products")){let e=o("cart-drawer"),a=!!o("cart-item",e);e.toggleAttribute("empty-cart",!a)}},"updateVisibility");reInitCarousel=r(()=>{let t=o(Qt,this);t&&t.withAutoplay&&(t.setCarousel(),t.setAutoplay())},"reInitCarousel")},ct="cart-drawer",Mt="cart-drawer-timer-block",S=class extends i{static{r(this,"CartDrawerTimerBlock")}mountComponent(){s(ct,this)?.on("update-nodes",this.handleCartDrawerUpdate)}unmountComponent(){s(ct,this)?.off("update-nodes",this.handleCartDrawerUpdate)}handleCartDrawerUpdate=r(({node:t})=>{c(this,o(`${Mt}[block-id="${this.getAttribute("block-id")}"]`,t))},"handleCartDrawerUpdate")},lt="cart-drawer",Ht="cart-drawer-header",B=class extends i{static{r(this,"CartDrawerHeader")}mountComponent(){s(lt,this)?.on("update-nodes",this.handleCartDrawerUpdate)}unmountComponent(){s(lt,this)?.off("update-nodes",this.handleCartDrawerUpdate)}handleCartDrawerUpdate=r(({node:t})=>{c(this,o(Ht,t))},"handleCartDrawerUpdate")},pt="cart-drawer",Ft="cart-drawer-footer",V=class extends i{static{r(this,"CartDrawerFooter")}mountComponent(){s(pt,this)?.on("update-nodes",this.handleCartDrawerUpdate)}unmountComponent(){s(pt,this)?.off("update-nodes",this.handleCartDrawerUpdate)}handleCartDrawerUpdate=r(({node:t})=>{c(this,o(Ft,t))},"handleCartDrawerUpdate")},ut="[data-cart-note-textarea]",I="cartNote",U="cart-page",O="cart-drawer",$=class extends i{static{r(this,"CartNote")}valueFromLS;currentValue;mountComponent(){let t=s(O,this),e=s(U,this),a=o(ut,this);this.currentValue=a?.value,this.updateByLocalStorage(),this.addListener(a,"blur",this.handleTextareaBlur),this.addListener(window,"storage",this.handleBetweenTabsUpdate),E(U).then(()=>e?.on("cartIsEmpty",this.handleCartStatusUpdate)),E(O).then(()=>t?.on("cartIsEmpty",this.handleCartStatusUpdate))}unmountComponent(){let t=s(O,this),e=s(U,this);E(U).then(()=>e?.off("cartIsEmpty",this.handleCartStatusUpdate)),E(O).then(()=>t?.off("cartIsEmpty",this.handleCartStatusUpdate))}handleTextareaBlur=r(t=>{let{value:e}=t.target;e&&(localStorage.setItem(I,e),this.currentValue=e)},"handleTextareaBlur");updateByLocalStorage=r(()=>{let t=o(ut,this);this.valueFromLS=localStorage.getItem(I),this.valueFromLS!==this.currentValue&&(t.value=this.valueFromLS,this.currentValue=this.valueFromLS)},"updateByLocalStorage");handleBetweenTabsUpdate=r(t=>{t.key===I&&this.updateByLocalStorage()},"handleBetweenTabsUpdate");handleCartStatusUpdate=r(()=>{this.clearValueFromLS()},"handleCartStatusUpdate");clearValueFromLS=r(()=>{localStorage.removeItem(I),this.currentValue=void 0},"clearValueFromLS")},ht="cart-drawer",mt="free-shipping-bar",N=class extends i{static{r(this,"CartDrawerFreeShippingBarBlock")}mountComponent(){s(ht,this)?.on("update-nodes",this.handleCartUpdate)}unmountComponent(){s(ht,this)?.off("update-nodes",this.handleCartUpdate)}handleCartUpdate=r(t=>{let e=o(mt,this),a=o(mt,t.node);
1if(!e||!a)return;let l=a.getAttribute("data-free-shipping-difference")||"",m=+(a.getAttribute("data-free-shipping-difference-percent")||0);e.updateProgressByDifference(l,m)},"handleCartUpdate")},Ct="cart-drawer",qt="[data-cart-checkout-button]",K=class extends i{static{r(this,"CartDrawerButtonsBlock")}mountComponent(){let t=s(Ct,this);t?.on("start-update",this.handleStartCartUpdate),t?.on("stop-update",this.handleCartUpdate),t?.on("update-nodes",this.handleCartUpdate)}unmountComponent(){let t=s(Ct,this);t?.off("start-update",this.handleStartCartUpdate),t?.off("update-nodes",this.handleCartUpdate)}handleStartCartUpdate=r(()=>{this.setLoading(!0)},"handleStartCartUpdate");handleCartUpdate=r(()=>{this.setLoading(!1)},"handleCartUpdate");setLoading(t){let e=o(qt,this);e?.toggleAttribute("disabled",t),e?.classList.toggle("loading",t)}},f=window.VelotricBundle||(window.VelotricBundle={});if(!f.common?.ready)throw new Error("vl-bundle-common.js must execute before vl-bundle-cart.js");if(!f.shell?.ready)throw new Error("vl-bundle-shell.js must execute before vl-bundle-cart.js");if(!f.carousel?.ready)throw new Error("vl-bundle-carousel.js must execute before vl-bundle-cart.js");if(!f.cards?.ready)throw new Error("vl-bundle-cards.js must execute before vl-bundle-cart.js");if(f.cart?.ready)throw new Error("vl-bundle-cart.js executed more than once");f.cart={version:1,ready:!0,api:{}};var jt=[v,D,b,g,T,R,A,L,x,k,P,S,B,V,$,N,K];jt.forEach(q)})(); 2//# sourceMappingURL=/cdn/shop/t/644/assets/vl-bundle-cart.js.map?v=97459970987027271951789470659
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.