1var h=Object.defineProperty;var o=(n,i,t)=>i in n?h(n,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[i]=t;var s=(n,i,t)=>o(n,typeof i!="symbol"?i+"":i,t);class l extends HTMLElement{constructor(){super();s(this,"input");s(this,"type");s(this,"button");s(this,"cartItems");s(this,"initialValue");this.input=void 0,this.type=void 0,this.button=void 0,this.cartItems=this.closest("main-cart-items")||this.closest("cart-drawer-items"),this.initialValue="0",this.initialiseInputEventListener(),this.initialiseButtonEventListener()}initialiseButtonEventListener(){this.button=this.querySelector(".js-quantity-update-button"),this.button&&this.button.addEventListener("click",this.onButtonClick.bind(this))}initialiseInputEventListener(){this.input=this.querySelector(".js-cart-quantity-input"),this.input&&(this.type=this.input.nodeName,this.initialValue=this.input.value,this.input.addEventListener("change",this.onInputChange.bind(this)),this.input.addEventListener("input",this.onInputChange.bind(this)),this.type==="INPUT"&&this.input instanceof HTMLInputElement&&(this.input.addEventListener("keydown",this.onInputKeydown.bind(this)),this.input.addEventListener("blur",this.onInputBlur.bind(this)),this.input.addEventListener("keypress",t=>{(t.key==="Enter"||t.keyCode===13)&&t.preventDefault()})))}onInputKeydown(t){(t.key==="Enter"||t.keyCode===13)&&(t.preventDefault(),this.button&&!this.button.hasAttribute("disabled")&&this.button.click())}onInputBlur(t){this.button&&!this.button.hasAttribute("disabled")&&this.input instanceof HTMLInputElement&&this.input.value!==this.initialValue&&setTimeout(()=>{this.button&&!this.button.hasAttribute("disabled")&&this.button.click()},100)}onInputChange(t){if(this.type==="SELECT"&&this.input)this.input.value==="manual-entry"&&this.renderTemplate();else{if(!this.button||!t.target)return;t.target.value===this.initialValue?this.button.setAttribute("disabled",""):this.button.removeAttribute("disabled")}}onButtonClick(t){var e;this.type==="SELECT"&&this.input?this.input.value==="manual-entry"&&this.input.parentElement&&this.renderTemplate():((e=this.button)==null||e.setAttribute("disabled",""),this.cartItems.validateQuantity(t))}renderTemplate(){var r;const t=this.querySelector("template"),e=t==null?void 0:t.content;if(!t||!e||!((r=this.input)!=null&&r.parentElement))throw new Error("Template not found");const a=e.cloneNode(!0);this.input.parentElement.replaceWith(...Array.from(a.childNodes)),this.initialiseInputEventListener(),this.initialiseButtonEventListener();const u=this.querySelector(".js-cart-quantity-input");u&&(u.focus(),u.select())}}customElements.define("cart-quantity-selector",l);
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.