1class r extends HTMLElement{constructor(){super(),this.input=this.querySelector('input[type="search"]'),this.predictiveSearchResults=this.querySelector("#predictive-search"),this.predictiveSearchForm=this.querySelector("[data-search-form]"),this.input.addEventListener("input",this.debounce(e=>{this.onChange(e)},300).bind(this)),this.predictiveSearchForm.addEventListener("submit",e=>{e.preventDefault(),this.input.focus()})}onChange(){const e=this.input.value.trim();if(!e.length){this.close();return}this.getSearchResults(e)}getSearchResults(e){fetch(`/search/suggest?q=${e}&resources[type]=article&resources[limit]=10§ion_id=predictive-search`).then(t=>{if(!t.ok){var s=new Error(t.status);throw this.close(),s}return t.text()}).then(t=>{const s=new DOMParser().parseFromString(t,"text/html").querySelector("#shopify-section-predictive-search").innerHTML;this.predictiveSearchResults.innerHTML=s,this.open()}).catch(t=>{throw this.close(),t})}open(){this.predictiveSearchResults.style.display="block"}close(){this.predictiveSearchResults.style.display="none"}debounce(e,t){let s;return(...i)=>{clearTimeout(s),s=setTimeout(()=>e.apply(this,i),t)}}}customElements.define("predictive-search",r);
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.