1class PredictiveSearch extends HTMLElement{constructor(){super(),this.input=this.querySelector('input[type="search"]'),this.predictiveSearchResults=this.querySelector("#predictive-search"),this.setHeight(),window.addEventListener("resize",()=>{this.setHeight()}),this.input.addEventListener("input",this.debounce(event=>{this.onChange(event)},300).bind(this))}setHeight(){let headHeight=0;if(this.parentElement.classList.contains("buly--search-desktop"))this.querySelector("#predictive-search").style.maxHeight="calc(100vh - "+this.querySelector("form.search--desktop").getBoundingClientRect().bottom+"px)";else{const annBar=document.querySelector("#shopify-section-announcement-bar"),header=document.querySelector("#shopify-section-header.buly-header");annBar&&(headHeight=annBar.offsetHeight),header&&(headHeight+=header.offsetHeight),this.input&&(headHeight+=this.input.offsetHeight),this.querySelector("#predictive-search").style.maxHeight="calc(100vh - "+headHeight+"px)"}}onChange(){const searchTerm=this.input.value.trim();if(!searchTerm.length){this.close();return}this.getSearchResults(searchTerm)}getSearchResults(searchTerm){var root_url=window.langify.locale.root_url!="/"?window.langify.locale.root_url:"";fetch(`${root_url}/search/suggest?q=${searchTerm}&resources[type]=product&resources[limit]=20§ion_id=predictive-search`).then(response=>{if(!response.ok){var error=new Error(response.status);throw this.close(),error}return response.text()}).then(text=>{const resultsMarkup=new DOMParser().parseFromString(text,"text/html").querySelector("#shopify-section-predictive-search").innerHTML;this.predictiveSearchResults.innerHTML=resultsMarkup,this.open()}).catch(error=>{throw this.close(),error})}open(){this.predictiveSearchResults.style.display="block"}close(){this.predictiveSearchResults.style.display="none"}debounce(fn,wait){let t;return(...args)=>{clearTimeout(t),t=setTimeout(()=>fn.apply(this,args),wait)}}}customElements.define("predictive-search",PredictiveSearch); 2//# sourceMappingURL=/cdn/shop/t/277/assets/predictive-search.js.map?v=97309200108166943951713810318
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.