PageSourceSearch

https://www.goodranchers.com/cdn/shop/t/410/assets/component-cart-…?v=120007075003112319061790179510

js goodranchers.com collected 2026-09-24 20:03:52 UTC 3,472 bytes, 2 lines download raw bytes

1import{QuantitySelectorComponent}from"@theme/component-quantity-selector";import{QuantitySelectorUpdateEvent}from"@theme/events";class CartQuantitySelectorComponent extends QuantitySelectorComponent{#loading=!1;#prevDisabled=null;setLoading(isLoading){if(!this.initialized||this.#loading===isLoading)return;const{quantityInput,minusButton,plusButton}=this.refs;isLoading&&(this.#prevDisabled={input:quantityInput.disabled,minus:minusButton.disabled,plus:plusButton.disabled}),this.#loading=isLoading;const loader=this.querySelector("[data-qty-loader]");if(loader instanceof HTMLElement&&loader.classList.toggle("hidden",!isLoading),this.classList.toggle("gr-cart-qty--loading",isLoading),this.setAttribute("aria-busy",isLoading?"true":"false"),isLoading){minusButton.disabled=!0,plusButton.disabled=!0,quantityInput.disabled=!0;return}this.#prevDisabled&&(quantityInput.disabled=this.#prevDisabled.input,minusButton.disabled=this.#prevDisabled.minus,plusButton.disabled=this.#prevDisabled.plus,this.#prevDisabled=null),this.updateButtonStates()}#isInGRCartDrawer(){return!!this.closest("gr-cart-drawer")}#dispatchCartQuantity(nextQuantity){const{quantityInput}=this.refs,cartLine=Number(quantityInput.dataset.cartLine);cartLine&&quantityInput.dispatchEvent(new QuantitySelectorUpdateEvent(nextQuantity,cartLine))}getEffectiveMax(){const{max}=this.getCurrentValues();return max}increaseQuantity(event){if(event.target instanceof HTMLElement){if(event.preventDefault(),this.#isInGRCartDrawer()){if(this.#loading)return;const{min,step,value}=this.getCurrentValues(),effectiveMax=this.getEffectiveMax(),nextValue=Math.min(effectiveMax??1/0,Math.max(min,value+step));if(nextValue===value)return;this.setLoading(!0),this.#dispatchCartQuantity(nextValue);return}super.increaseQuantity(event)}}decreaseQuantity(event){if(event.target instanceof HTMLElement){if(event.preventDefault(),this.#isInGRCartDrawer()){if(this.#loading)return;const{min,step,value}=this.getCurrentValues(),effectiveMax=this.getEffectiveMax(),nextValue=Math.min(effectiveMax??1/0,Math.max(min,value-step));if(nextValue===value)return;this.setLoading(!0),this.#dispatchCartQuantity(nextValue);return}super.decreaseQuantity(event)}}setQuantity(event){if(event.target instanceof HTMLInputElement){if(event.preventDefault(),this.#isInGRCartDrawer()){if(this.#loading)return;const{quantityInput}=this.refs,{min,step}=this.getCurrentValues(),effectiveMax=this.getEffectiveMax(),raw=parseInt(event.target.value)||0,clamped=Math.min(effectiveMax??1/0,Math.max(min,raw));if((clamped-min)%step!==0){quantityInput.value=clamped.toString(),quantityInput.reportValidity();return}const current=parseInt(quantityInput.value)||0;if(clamped===current)return;quantityInput.value=current.toString(),this.setLoading(!0),this.#dispatchCartQuantity(clamped);return}super.setQuantity(event)}}updateButtonStates(){const{minusButton,plusButton}=this.refs,{min,value}=this.getCurrentValues(),effectiveMax=this.getEffectiveMax();if(this.#loading){minusButton.disabled=!0,plusButton.disabled=!0;return}const disableIncrease=this.dataset.disableIncrease==="true";minusButton.disabled=value<=min,plusButton.disabled=disableIncrease||effectiveMax!==null&&value>=effectiveMax}}customElements.get("cart-quantity-selector-component")||customElements.define("cart-quantity-selector-component",CartQuantitySelectorComponent);
2//# sourceMappingURL=/cdn/shop/t/410/assets/component-cart-quantity-selector.js.map?v=120007075003112319061790179510

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.