woodmartThemeModule.beforeSearchcontent=function(){var e,t,o=function(e,t){t.classList.remove("wd-opened"),c(e,"close"),setTimeout(function(){e.parentNode.classList.remove("wd-searched")},400)},n=function(e){var t=this.closest("form"),n=t.parentNode.querySelector(".wd-dropdown-results");o(t,n)},r=function(e){var t=this,n=t.closest("form"),r=n.parentNode.querySelector(".wd-dropdown-results"),d=e.keyCode||e.charCode;"Tab"===e.key||e.shiftKey&&"Tab"===e.key||(0!==t.value.length||8!==d&&46!==d?(t.dispatchEvent(new Event("wdOpenBeforeSearchContent")),setTimeout(function(){var e=!0,t=r.querySelector(".wd-search-history"),o=r.querySelector(".wd-search-requests"),d=r.querySelector(".wd-search-area");t&&0!==t.childElementCount||o&&0!==o.childElementCount||d&&(0!==d.childElementCount||0!==d.textContent.length)||(e=!1),e&&(r.classList.add("wd-opened"),c(n,"open"))},100)):o(n,r))},c=function(e,t){e.closest(".wd-search-form.wd-display-form.wd-with-overlay")&&jQuery(".wd-close-side").trigger("wdCloseSideAction",["open"===t?"show":"hide","click"])};e=document.querySelectorAll("form.searchform"),t=!1,document.addEventListener("keydown",function(e){("Tab"===e.key||e.shiftKey&&"Tab"===e.key)&&(t=!0)}),document.addEventListener("mousedown",function(){t=!1}),e.forEach(function(e){var c=e.parentNode.querySelector(".wd-dropdown-results");if(c){var d=e.querySelector('[type="text"]'),s=e.querySelector(".wd-search-cat-btn");d.addEventListener("focus",r),d.addEventListener("keydown",r),s&&s.addEventListener("click",n),[e,c].forEach(function(n){n.addEventListener("focusout",function(){setTimeout(function(){!t||e.contains(document.activeElement)||c.contains(document.activeElement)||o(e,c)},10)})})}}),document.addEventListener("click",function(e){var t=e.target.closest("form.searchform");document.querySelectorAll(".wd-dropdown-results.wd-opened").forEach(function(e){var n=e.closest(".wd-search-form, .wd-search-dropdown");if(n){var r=n.querySelector("form.searchform");t&&r===t||o(r,e)}})},{passive:!0})},window.addEventListener("load",function(){woodmartThemeModule.beforeSearchcontent()});