1customElements.get("quick-add-bulk")||customElements.define("quick-add-bulk",class extends BulkAdd{constructor(){super(),this.quantity=this.querySelector("quantity-input");const debouncedOnChange=debounce(event=>{parseInt(event.target.value)===0?this.startQueue(event.target.dataset.index,parseInt(event.target.value)):this.validateQuantity(event)},ON_CHANGE_DEBOUNCE_TIMER);this.addEventListener("change",debouncedOnChange.bind(this)),this.listenForActiveInput(),this.listenForKeydown(),this.lastActiveInputId=null}connectedCallback(){this.cartUpdateUnsubscriber=subscribe(PUB_SUB_EVENTS.cartUpdate,event=>{event.source==="quick-add"||event.cartData.items&&!event.cartData.items.some(item=>item.id===parseInt(this.dataset.index))||event.cartData.variant_id&&event.cartData.variant_id!==parseInt(this.dataset.index)||this.onCartUpdate().then(()=>{this.listenForActiveInput(),this.listenForKeydown()})})}disconnectedCallback(){this.cartUpdateUnsubscriber&&this.cartUpdateUnsubscriber()}get input(){return this.querySelector("quantity-input input")}selectProgressBar(){return this.querySelector(".progress-bar-container")}listenForActiveInput(){this.classList.contains("hidden")||this.input?.addEventListener("focusin",event=>event.target.select()),this.isEnterPressed=!1}listenForKeydown(){this.input?.addEventListener("keydown",event=>{event.key==="Enter"&&(this.input?.blur(),this.isEnterPressed=!0)})}cleanErrorMessageOnType(event){event.target.addEventListener("keypress",()=>{event.target.setCustomValidity("")},{once:!0})}get sectionId(){return this._sectionId||(this._sectionId=this.closest(".collection-quick-add-bulk").dataset.id),this._sectionId}onCartUpdate(){return new Promise((resolve,reject)=>{fetch(`${this.getSectionsUrl()}?section_id=${this.sectionId}`).then(response=>response.text()).then(responseText=>{const sourceQty=new DOMParser().parseFromString(responseText,"text/html").querySelector(`#quick-add-bulk-${this.dataset.index}-${this.sectionId}`);sourceQty&&(this.innerHTML=sourceQty.innerHTML),resolve()}).catch(e=>{console.error(e),reject(e)})})}getSectionsUrl(){const pageParams=new URLSearchParams(window.location.search),pageNumber=decodeURIComponent(pageParams.get("page")||"");return`${window.location.pathname}${pageNumber?`?page=${pageNumber}`:""}`}updateMultipleQty(items){this.selectProgressBar().classList.remove("hidden");const ids=Object.keys(items),linesUpdate=this.startCartLinesUpdate(items),body=JSON.stringify({updates:items,sections:this.getSectionsToRender().map(section=>section.section),sections_url:this.getSectionsUrl()});fetch(`${routes.cart_update_url}`,{...fetchConfig(),body}).then(response=>response.json()).then(parsedState=>{if(parsedState.errors)throw Object.assign(new Error(parsedState.errors),{code:"INVALID"});linesUpdate?.resolve(parsedState),this.renderSections(parsedState,ids),publish(PUB_SUB_EVENTS.cartUpdate,{source:"quick-add",cartData:parsedState})}).catch(e=>{e.code!=="INVALID"&&console.error(e),this.dispatchCartErrorEvent(e.code==="INVALID"?e.message:window.cartStrings.error,e.code||"SERVICE_UNAVAILABLE"),linesUpdate?.reject(e)}).finally(()=>{this.selectProgressBar().classList.add("hidden"),this.setRequestStarted(!1)})}getSectionsToRender(){return[{id:`quick-add-bulk-${this.dataset.index}-${this.sectionId}`,section:this.sectionId,selector:`#quick-add-bulk-${this.dataset.index}-${this.sectionId}`},{id:"cart-icon-bubble",section:"cart-icon-bubble",selector:".shopify-section"},{id:"CartDrawer",selector:".drawer__inner",section:"cart-drawer"}]}renderSections(parsedState,ids){this.queue.filter(element=>ids.includes(element.id)).length===0&&(this.getSectionsToRender().forEach(section=>{const sectionElement=document.getElementById(section.id);section.section==="cart-drawer"&§ionElement.closest("cart-drawer")?.classList.toggle("is-empty",parsedState.items.length.length===0);const elementToReplace=sectionElement&§ionElement.querySelector(section.selector)?sectionElement.querySelector(section.selector):sectionElement;elementToReplace&&(elementToReplace.innerHTML=this.getSectionInnerHTML(parsedState.sections[section.section],section.selector))}),this.isEnterPressed&&this.querySelector(`#Quantity-${this.lastActiveInputId}`).select(),this.listenForActiveInput(),this.listenForKeydown())}});
2//# sourceMappingURL=/cdn/shop/t/27/assets/quick-add-bulk.js.map?v=76794346665429494411782452451
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.