1"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function _createClass(t,e,n){return e&&_defineProperties(t.prototype,e),n&&_defineProperties(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e)}function _createSuper(t){var e=_isNativeReflectConstruct();return function(){var n,r=_getPrototypeOf(t);if(e){var o=_getPrototypeOf(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return _possibleConstructorReturn(this,n)}}function _possibleConstructorReturn(t,e){if(e&&("object"===_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _wrapNativeSuper(t){var e="function"==typeof Map?new Map:void 0;return(_wrapNativeSuper=function(t){if(null===t||!_isNativeFunction(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return _construct(t,arguments,_getPrototypeOf(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(n,t)})(t)}function _construct(t,e,n){return(_construct=_isNativeReflectConstruct()?Reflect.construct.bind():function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&_setPrototypeOf(o,n.prototype),o}).apply(null,arguments)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function _isNativeFunction(t){return-1!==Function.toString.call(t).indexOf("[native code]")}function _setPrototypeOf(t,e){return(_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function _getPrototypeOf(t){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var SearchOverlay=function(t){_inherits(n,_wrapNativeSuper(HTMLElement));var e=_createSuper(n);function n(){var t;return _classCallCheck(this,n),(t=e.call(this)).input=t.querySelector("[data-search-input]"),t.results=t.querySelector("[data-search-results]"),t.empty=t.querySelector("[data-search-empty]"),t.clearBtn=t.querySelector("[data-search-clear]"),t.status=t.querySelector("[data-search-status]"),t.controller=null,t.cache={},t.opener=null,t.searchUrl=window.routes&&window.routes.predictive_search_url||"/search/suggest",t}return _createClass(n,[{key:"connectedCallback",value:function(){var t=this;this.debouncedFetch||(this.debouncedFetch=debounce(function(e){return t.fetchResults(e)},250)),this.onDocClick=function(e){var n=e.target.closest(".js-open-search-overlay");n&&(e.preventDefault(),t.opener=n,t.open())},document.addEventListener("click",this.onDocClick),this.onGlobalKeydown=function(e){"Escape"!==e.key||t.hidden||t.close()},document.addEventListener("keydown",this.onGlobalKeydown),this.onSelfClick=function(e){if(e.target.closest("[data-search-close]"))t.close();else{if(e.target.closest("[data-search-clear]"))return t.reset(),void t.input.focus();var n=e.target.closest("[data-search-term]");n&&t.search(n.getAttribute("data-search-term"))}},this.addEventListener("click",this.onSelfClick),this.onInputHandler=function(){return t.onInput()},this.input.addEventListener("input",this.onInputHandler),this.onInputKeydown=function(e){"Enter"===e.key&&(e.preventDefault(),t.submit())},this.input.addEventListener("keydown",this.onInputKeydown)}},{key:"disconnectedCallback",value:function(){this.hidden||this.close(),document.removeEventListener("click",this.onDocClick),document.removeEventListener("keydown",this.onGlobalKeydown),this.removeEventListener("click",this.onSelfClick),this.input.removeEventListener("input",this.onInputHandler),this.input.removeEventListener("keydown",this.onInputKeydown)}},{key:"open",value:function(){this.hidden=!1,document.body.classList.add("overflow-hidden"),this.setExpanded(!0),trapFocus(this,this.input)}},{key:"close",value:function(){this.hidden=!0,document.body.classList.remove("overflow-hidden"),this.setExpanded(!1),removeTrapFocus(this.opener),this.controller&&this.controller.abort()}},{key:"setExpanded",value:function(t){document.querySelectorAll(".js-open-search-overlay").forEach(function(e){return e.setAttribute("aria-expanded",t?"true":"false")})}},{key:"reset",value:function(){this.input.value="",this.toggleClear(),this.showEmpty(),this.controller&&this.controller.abort()}},{key:"onInput",value:function(){this.toggleClear();var t=this.input.value.trim();t?this.debouncedFetch(t):this.showEmpty()}},{key:"search",value:function(t){this.input.value=t,this.toggleClear(),this.input.focus(),this.fetchResults(t.trim())}},{key:"submit",value:function(){var t=this.input.value.trim();if(t){var e=t.endsWith("*")?t:"".concat(t,"*"),n=new URLSearchParams({q:e,"options[prefix]":"last"});window.location.href="/search?".concat(n.toString())}}},{key:"toggleClear",value:function(){this.clearBtn.hidden=!this.input.value}},{key:"announce",value:function(t){var e=this;this.status&&(this.status.textContent="",requestAnimationFrame(function(){e.status.textContent=t}))}},{key:"showEmpty",value:function(){this.results.hidden=!0,this.results.innerHTML="",this.empty.hidden=!1}},{key:"showResults",value:function(){this.empty.hidden=!0,this.results.hidden=!1,this.results.removeAttribute("aria-busy");var t=this.results.querySelectorAll(".search-results__item").length,e=t?"".concat(t," produto").concat(1!==t?"s":""," encontrado").concat(1!==t?"s":""):"nenhum resultado encontrado";this.announce(e)}},{key:"fetchResults",value:function(t){var e=this;if(t){if(t in this.cache)return this.results.innerHTML=this.cache[t],void this.showResults();this.controller&&this.controller.abort(),this.controller=new AbortController,this.results.setAttribute("aria-busy","true");var n="".concat(this.searchUrl,"?q=").concat(encodeURIComponent(t),"&").concat(encodeURIComponent("resources[type]"),"=product&").concat(encodeURIComponent("resources[limit]"),"=6§ion_id=predictive-search-overlay");fetch(n,{signal:this.controller.signal}).then(function(t){return t.ok?t.text():Promise.reject(t.status)}).then(function(n){var r=(new DOMParser).parseFromString(n,"text/html").querySelector("#shopify-section-predictive-search-overlay"),o=r?r.innerHTML:"";e.cache[t]=o,e.results.innerHTML=o,e.results.removeAttribute("aria-busy"),e.showResults()}).catch(function(t){t&&"AbortError"===t.name||e.results.removeAttribute("aria-busy")})}else this.showEmpty()}}]),n}();customElements.get("search-overlay")||customElements.define("search-overlay",SearchOverlay);
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.