1document.addEventListener("alpine:init",()=>{Alpine.data("PredictiveSearch",resources=>({loading:!1,resultsOpen:!1,rawQuery:"",resultsHTML:null,showViewAll:!1,resources,selectedElement:null,activeElement:null,allOptionsArray:null,get activeElementId(){return this.activeElement?this.activeElement.getAttribute("id"):""},get currentResultsGroup(){return this._currentResultsGroup},set currentResultsGroup(newValue){if(newValue===""){this._currentResultsGroup=newValue;return}if(this._currentResultsGroup===""){this.$refs[`${newValue}Results`]&&(this.$refs[`${newValue}Results`].hidden=!1),this._currentResultsGroup=newValue;return}const currentResultsGroupEl=this.$refs[`${this._currentResultsGroup}Results`];this._currentResultsGroup=newValue;const nextResultsGroupEl=this.$refs[`${newValue}Results`];this.switchResultsGroup(currentResultsGroupEl,nextResultsGroupEl)},get trimmedQuery(){return this.rawQuery.trim()},get shouldAnimate(){return window.matchMedia("(prefers-reduced-motion: no-preference)").matches},get queryKey(){return this.trimmedQuery.replace(" ","-").toLowerCase()},init(){this.$watch("trimmedQuery",value=>{value.length?(this.openResults(),this.getSearchResults()):(this.closeResults(),this.resultsHTML=null)}),this.$watch("resultsHTML",async value=>{value?(this.$refs.results.hidden=!1,this.showViewAll=!0,this.currentResultsGroup="",this.$nextTick(()=>{this.setInitialResultsGroup(),this.$refs.resultsSlot.scrollTo(0,0)})):(this.$refs.results.hidden=!0,this.showViewAll=!1)})},close(clearSearchTerm=!0,focusAfter){this.closeResults(clearSearchTerm),focusAfter&&setTimeout(()=>{this.$focus.focus(focusAfter)})},openResults(){this.resultsOpen=!0,document.documentElement.style.overflowY="hidden"},closeResults(clearSearchTerm=!1){this.resultsOpen=!1,clearSearchTerm&&(this.rawQuery=""),this.selectedElement=null,document.documentElement.style.overflowY="auto"},setInitialResultsGroup(){this.$refs.groupToggles?this.currentResultsGroup=this.$refs.groupToggles.querySelector('input[type="radio"]').value:this.currentResultsGroup="products"},async getSearchResults(){this.loading=!0,liveRegion(window.theme.strings.loading);const updatedHTML=await fetchHTML(getURLWithParams(window.theme.routes.predictive_search_url,{q:this.trimmedQuery,"resources[type]":this.resources,"resources[limit_scope]":"each",section_id:"predictive-search"})),resultsMarkup=querySelectorInHTMLString("#shopify-section-predictive-search",updatedHTML).innerHTML,liveRegionText=querySelectorInHTMLString("#predictive-search-count",updatedHTML).innerHTML;this.resultsHTML=resultsMarkup,liveRegion(liveRegionText),this.$nextTick(()=>{this.allOptionsArray=Array.from(this.$root.querySelectorAll('[role="option"]')),document.dispatchEvent(new CustomEvent("switch:load:images",{detail:{container:this.$refs.results}}))}),this.loading=!1,this.openResults()},onFocus(){this.trimmedQuery.length&&(this.resultsHTML?this.openResults():this.getSearchResults())},onFormSubmit(event){(!this.trimmedQuery.length||this.$el.querySelector('[aria-selected="true"] a'))&&event.preventDefault()},onOpen(){setTimeout(()=>{this.$focus.focus(this.$refs.input)},350)},async switchResultsGroup(fromEl,toEl){this.shouldAnimate&&await fromEl.animate({opacity:[1,0]},{duration:75,easing:"ease"}).finished,fromEl.hidden=!0,toEl.hidden=!1,this.shouldAnimate&&await toEl.animate({opacity:[0,1]},{duration:150,easing:"ease"}).finished,this.selectedElement&&this.selectedElement.offsetParent&&this.scrollSelectedElementIntoView()},switchOption(direction){direction==="previous"&&!this.selectedElement||(direction==="next"?this.selectedElement=nextOrFirst(this.allOptionsArray,this.selectedElement):direction==="previous"&&(this.selectedElement=previousOrLast(this.allOptionsArray,this.selectedElement)),this.selectedElement.offsetParent||(this.currentResultsGroup=this.selectedElement.closest("[data-results-group]").dataset.resultsGroup),this.scrollSelectedElementIntoView())},scrollSelectedElementIntoView(){this.selectedElement.scrollIntoView({behavior:this.shouldAnimate?"smooth":"auto",block:"end"})},selectOption(){if(this.selectedElement){const selectedOptionAction=this.selectedElement.querySelector("a, button");selectedOptionAction&&selectedOptionAction.click()}},onKeyup(){switch(this.$event.preventDefault(),this.$event.code){case"ArrowUp":this.switchOption("previous");break;case"ArrowDown":this.switchOption("next");break;case"Enter":this.selectOption();break}},onKeydown(){(this.$event.code==="ArrowUp"||this.$event.code==="ArrowDown")&&this.$event.preventDefault(),this.$event.code==="Escape"&&this.handleEscape()},handleEscape(){const searchToggleEl=Array.from(document.querySelectorAll("[data-search-toggle]")).filter(el=>!!el.offsetParent)[0];this.close(!0,searchToggleEl)},isSelected(){return this.$el===this.selectedElement?"true":"false"}}))}); 2//# sourceMappingURL=/cdn/shop/t/44/assets/predictive-search.js.map?v=82226763232895514491782982359
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.