https://260samplesale.com/cdn/shop/t/465/assets/predictive-search.js?v=96408057161073681821789990202
1if(customElements.component="predictive-search",!customElements.get(customElements.component)){class PredictiveSearch extends HTMLElement{constructor(){super(),this.input=this.querySelector('input[type="search"]'),this.predictiveSearchResults=this.querySelector("#predictive-search"),this.cleanIcon=this.querySelector("[data-search-clean]"),this.input.addEventListener("input",window.theme.debounce.apply(event=>{this.onChange(event)},300).bind(this)),this.input.addEventListener("focus",this.onFocus.bind(this)),this.addEventListener("blur",this.onFocusOut.bind(this)),this.noResults=this.predictiveSearchResults.innerHTML,this.cleanIcon.addEventListener("click",()=>{this.removedCaractere(),this.onChange()})}onChange(){const searchTerm=this.input.value.trim();if(!searchTerm.length){this.predictiveSearchResults.innerHTML=this.noResults,this.cleanIcon.style.display="none";return}this.cleanIcon.style.display="block",this.getSearchResults(searchTerm)}getSearchResults(searchTerm){const vendorFilter=this.querySelector('input[name="filter.p.vendor"]');let vendorQuery="";vendorFilter&&vendorFilter.value&&(vendorQuery=`&filter.p.vendor=${encodeURIComponent(vendorFilter.value)}`),fetch(`${window.predictive_search_url}?q=${encodeURIComponent(searchTerm)}${vendorQuery}&resources[type]=product,collection,article,page&resources[limit]=12§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 parser=new DOMParser,resultsMarkup=parser.parseFromString(text,"text/html").querySelector("#shopify-section-predictive-search").innerHTML;return fetch(`/search?q=${searchTerm}&type=product${vendorQuery}`).then(response=>{if(!response.ok)throw new Error("Network response was not ok.");return response.text()}).then(html=>{const qtyElement=parser.parseFromString(html,"text/html").querySelector(".collection__qty");if(qtyElement){const numberOfResults=parseInt(qtyElement.textContent.trim(),10),tempDiv=document.createElement("div");tempDiv.innerHTML=resultsMarkup;const placeholder=tempDiv.querySelector("span[data-search-count]");placeholder&&(placeholder.textContent=`(${numberOfResults})`),this.predictiveSearchResults.innerHTML=tempDiv.innerHTML}else this.predictiveSearchResults.innerHTML=resultsMarkup;this.open()}).catch(error=>{console.error("Error fetching search results:",error),this.close()})}).catch(error=>{console.error("Error fetching predictive search results:",error),this.close()})}open(){this.predictiveSearchResults.style.display="block",this.setAttribute("open",!0)}close(){this.predictiveSearchResults.style.display="none",this.removeAttribute("open")}getQuery(){return this.input.value.trim()}onFocus(){const searchTerm=this.getQuery();if(!searchTerm.length){this.predictiveSearchResults.innerHTML=this.noResults;return}this.getAttribute("open")==="true"?this.open():this.getSearchResults(searchTerm)}removedCaractere(){const searchTerm=this.input.value.slice(0,-1);this.input.value=searchTerm}onFocusOut(){setTimeout(()=>{this.contains(document.activeElement)||this.close()})}}customElements.define(customElements.component,PredictiveSearch)} 2//# sourceMappingURL=/cdn/shop/t/465/assets/predictive-search.js.map?v=96408057161073681821789990202
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.