PageSourceSearch

https://boldcare.in/cdn/shop/t/92/assets/cart.js?v=164017787512102065981766583642

js boldcare.in collected 2026-09-26 12:24:26 UTC 9,775 bytes, 18 lines download raw bytes

1class TabList extends HTMLUListElement{constructor(){super(),this.controls.forEach(button=>button.addEventListener("click",this.handleButtonClick.bind(this)))}get controls(){return this._controls=this._controls||Array.from(this.querySelectorAll("[aria-controls]"))}handleButtonClick(event){event.preventDefault(),this.controls.forEach(button=>{button.setAttribute("aria-expanded","false"),document.getElementById(button.getAttribute("aria-controls"))?.removeAttribute("open")});const target=event.currentTarget;target.setAttribute("aria-expanded","true"),document.getElementById(target.getAttribute("aria-controls"))?.setAttribute("open","")}reset(){this.controls[0].dispatchEvent(new Event("click"))}}customElements.define("tab-list",TabList,{extends:"ul"});class CartDrawer extends DrawerElement{constructor(){super()}get shouldAppendToBody(){return!1}get recentlyViewed(){return this.querySelector("recently-viewed")}get tabList(){return this.querySelector('[is="tab-list"]')}connectedCallback(){super.connectedCallback(),document.addEventListener("cart:bundled-sections",this.onPrepareBundledSections.bind(this)),this.recentlyViewed&&this.recentlyViewed.addEventListener("is-empty",this.onRecentlyViewedEmpty.bind(this))}onPrepareBundledSections(event){event.detail.sections.push(theme.utils.sectionId(this))}onRecentlyViewedEmpty(){this.recentlyViewed.innerHTML=`
2    <div class="drawer__scrollable relative flex justify-center items-start grow shrink text-center">
3      <div class="drawer__empty grid gap-5 md:gap-8">
4        <h2 class="drawer__empty-text heading leading-none tracking-tight">${theme.strings.recentlyViewedEmpty}</h2>
5      </div>
6    </div>
7    `}show(focusElement=null,animate=!0){super.show(focusElement,animate),this.tabList&&(this.tabList.reset(),this.open&&theme.a11y.trapFocus(this,this.focusElement))}}customElements.define("cart-drawer",CartDrawer);class CartQuantity extends QuantitySelector{constructor(){super()}quantityUpdateUnsubscriber=void 0;connectedCallback(){super.connectedCallback(),this.quantityUpdateUnsubscriber=theme.pubsub.subscribe(theme.pubsub.PUB_SUB_EVENTS.quantityUpdate,this.validateQtyRules.bind(this))}disconnectedCallback(){super.disconnectedCallback(),this.quantityUpdateUnsubscriber&&this.quantityUpdateUnsubscriber()}validateQtyRules(){const value=parseInt(this.input.value);if(this.input.min){const buttonMinus=this.querySelector('[name="minus"]');buttonMinus&&(buttonMinus.disabled=parseInt(value)<=parseInt(this.input.min))}if(this.input.max){const buttonPlus=this.querySelector('[name="plus"]');buttonPlus&&(buttonPlus.disabled=parseInt(value)>=parseInt(this.input.max))}}}customElements.define("cart-quantity",CartQuantity);class CartRemoveButton extends HTMLAnchorElement{constructor(){super(),this.addEventListener("click",event=>{event.preventDefault(),this.closest("cart-items").updateQuantity(this.dataset.index,0)})}}customElements.define("cart-remove-button",CartRemoveButton,{extends:"a"});class CartItems extends HTMLElement{constructor(){super(),this.addEventListener("change",theme.utils.debounce(this.onChange.bind(this),300)),this.cartUpdateUnsubscriber=theme.pubsub.subscribe(theme.pubsub.PUB_SUB_EVENTS.cartUpdate,this.onCartUpdate.bind(this))}cartUpdateUnsubscriber=void 0;disconnectedCallback(){this.cartUpdateUnsubscriber&&this.cartUpdateUnsubscriber()}onChange(event){this.updateQuantity(event.target.dataset.index,event.target.value,document.activeElement.getAttribute("name"),event.target)}onCartUpdate(event){if(event.cart.errors){this.onCartError(event.cart.errors,event.target);return}const sectionId=theme.utils.sectionId(this),sectionToRender=new DOMParser().parseFromString(event.cart.sections[sectionId],"text/html"),miniCart=document.querySelector(`#MiniCart-${sectionId}`);if(miniCart){const updatedElement=sectionToRender.querySelector(`#MiniCart-${sectionId}`);updatedElement&&(miniCart.innerHTML=updatedElement.innerHTML)}const mainCart=document.querySelector(`#MainCart-${sectionId}`);if(mainCart){const updatedElement=sectionToRender.querySelector(`#MainCart-${sectionId}`);updatedElement?mainCart.innerHTML=updatedElement.innerHTML:(mainCart.closest(".cart").classList.add("is-empty"),mainCart.remove())}const lineItem=document.getElementById(`CartItem-${event.line}`)||document.getElementById(`CartDrawer-Item-${event.line}`);lineItem&&lineItem.querySelector(`[name="${event.name}"]`)?theme.a11y.trapFocus(mainCart||miniCart,lineItem.querySelector(`[name="${event.name}"]`)):event.cart.item_count===0?miniCart?theme.a11y.trapFocus(miniCart,miniCart.querySelector("a")):theme.a11y.trapFocus(document.querySelector(".empty-state"),document.querySelector(".empty-state__link")):miniCart?theme.a11y.trapFocus(miniCart,miniCart.querySelector(".horizontal-product__title")):theme.a11y.trapFocus(mainCart,mainCart.querySelector(".cart__item-title")),document.dispatchEvent(new CustomEvent("cart:updated",{detail:{cart:event.cart}}))}onCartError(errors,target){target?this.updateQuantity(target.dataset.index,target.defaultValue,document.activeElement.getAttribute("name"),target):window.location.href=theme.routes.cart_url,alert(errors)}updateQuantity(line,quantity,name,target){this.enableLoading(line);let sectionsToBundle=[];document.documentElement.dispatchEvent(new CustomEvent("cart:bundled-sections",{bubbles:!0,detail:{sections:sectionsToBundle}}));const body=JSON.stringify({line,quantity,sections:sectionsToBundle});
7fetch(`${theme.routes.cart_change_url}`,{...theme.utils.fetchConfig(),body}).then(response=>response.json()).then(parsedState=>{theme.pubsub.publish(theme.pubsub.PUB_SUB_EVENTS.cartUpdate,{cart:parsedState,target,line,name})}).catch(error=>{console.log(error)})}enableLoading(line){const sectionId=theme.utils.sectionId(this),loader=document.getElementById(`Loader-${sectionId}-${line}`);loader&&(loader.hidden=!1)}}customElements.define("cart-items",CartItems);class CartNote extends HTMLElement{constructor(){super(),this.addEventListener("change",theme.utils.debounce(this.onChange.bind(this),300))}onChange(event){const body=JSON.stringify({note:event.target.value});fetch(`${theme.routes.cart_update_url}`,{...theme.utils.fetchConfig(),body})}}customElements.define("cart-note",CartNote);class MainCart extends HTMLElement{constructor(){super(),document.addEventListener("cart:bundled-sections",this.onPrepareBundledSections.bind(this))}onPrepareBundledSections(event){event.detail.sections.push(theme.utils.sectionId(this))}}customElements.define("main-cart",MainCart);class CountryProvince extends HTMLElement{constructor(){super(),this.provinceElement=this.querySelector('[name="address[province]"]'),this.countryElement=this.querySelector('[name="address[country]"]'),this.countryElement.addEventListener("change",this.handleCountryChange.bind(this)),this.getAttribute("country")!==""?(this.countryElement.selectedIndex=Math.max(0,Array.from(this.countryElement.options).findIndex(option=>option.textContent===this.dataset.country)),this.countryElement.dispatchEvent(new Event("change"))):this.handleCountryChange()}handleCountryChange(){const option=this.countryElement.options[this.countryElement.selectedIndex],provinces=JSON.parse(option.dataset.provinces);this.provinceElement.parentElement.hidden=provinces.length===0,provinces.length!==0&&(this.provinceElement.innerHTML="",provinces.forEach(data=>{const selected=data[1]===this.dataset.province;this.provinceElement.options.add(new Option(data[1],data[0],selected,selected))}))}}customElements.define("country-province",CountryProvince);class ShippingCalculator extends HTMLFormElement{constructor(){super(),this.submitButton=this.querySelector('[type="submit"]'),this.resultsElement=this.lastElementChild,this.submitButton.addEventListener("click",this.handleFormSubmit.bind(this))}handleFormSubmit(event){event.preventDefault();const zip=this.querySelector('[name="address[zip]"]').value,country=this.querySelector('[name="address[country]"]').value,province=this.querySelector('[name="address[province]"]').value;this.submitButton.setAttribute("aria-busy","true");const body=JSON.stringify({shipping_address:{zip,country,province}});let sectionUrl=`${theme.routes.cart_url}/shipping_rates.json`;sectionUrl=sectionUrl.replace("//","/"),fetch(sectionUrl,{...theme.utils.fetchConfig("javascript"),body}).then(response=>response.json()).then(parsedState=>{parsedState.shipping_rates?this.formatShippingRates(parsedState.shipping_rates):this.formatError(parsedState)}).catch(e=>{console.error(e)}).finally(()=>{this.resultsElement.hidden=!1,this.submitButton.removeAttribute("aria-busy")})}formatError(errors){const shippingRatesList=Object.keys(errors).map(errorKe
7y=>`<li>${errors[errorKey]}</li>`);this.resultsElement.innerHTML=`
8      <div class="alert alert--error grid gap-2 text-sm leading-tight">
9        <p>${theme.shippingCalculatorStrings.error}</p>
10        <ul class="list-disc grid gap-2" role="list">${shippingRatesList.join("")}</ul>
11      </div>
12    `}formatShippingRates(shippingRates){const shippingRatesList=shippingRates.map(({presentment_name,currency,price})=>`<li>${presentment_name}: ${currency} ${price}</li>`);this.resultsElement.innerHTML=`
13      <div class="alert alert--${shippingRates.length===0?"error":"success"} grid gap-2 text-sm leading-tight">
14        <p>${shippingRates.length===0?theme.shippingCalculatorStrings.notFound:shippingRates.length===1?theme.shippingCalculatorStrings.oneResult:theme.shippingCalculatorStrings.multipleResults}</p>
15        ${shippingRatesList===""?"":`<ul class="list-disc grid gap-2" role="list">${shippingRatesList.join("")}</ul>`}
16      </div>
17    `}}customElements.define("shipping-calculator",ShippingCalculator,{extends:"form"});
18//# sourceMappingURL=/cdn/shop/t/92/assets/cart.js.map?v=164017787512102065981766583642

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.