!function(_){woodmartThemeModule.$document.on("wdShopPageInit",function(){woodmartThemeModule.ajaxSearch()}),_.each(["frontend/element_ready/wd_search.default"],function(e,a){woodmartThemeModule.wdElementorAddAction(a,function(){woodmartThemeModule.ajaxSearch()})}),woodmartThemeModule.ajaxSearch=function(){void 0!==_.fn.devbridgeAutocomplete&&(_("form.woodmart-ajax-search").each(function(){var d=_(this),n=parseInt(d.data("count")),s=parseInt(d.data("thumbnail")),o=parseInt(d.data("symbols_count")),r=d.find('[name="product_cat"]'),e=d.parent(),l=d.data("post_type"),c=woodmart_settings.ajaxurl+"?action=woodmart_ajax_search",i=parseInt(d.data("price")),u=d.data("sku"),h=d.parents(".wd-search-full-screen").length,w=d.parents(".wd-search-full-screen-2").length,p=d.parents(".wd-search-dropdown").length,m=e.find(`.wd-search-results${h||w?"":" > "}.wd-scroll-content`),f=e.find(".wd-search-results"),g=d.data("include_cat_search");function v(e){0!==d.parents(".wd-search-form.wd-display-form.wd-with-overlay").length&&_(".wd-close-side").trigger("wdCloseSideAction",["open"===e?"show":"hide","click"])}0'+woodmart_settings.all_results+"")),_(e).removeAttr("style")},onSelect:function(){d.parent().find(".wd-search-results").removeClass("wd-opened")},onSearchComplete:function(){d.removeClass("wd-search-loading"),woodmartThemeModule.$document.trigger("wood-images-loaded")},formatResult:function(e,a){var a="("+(a="&"===a?"&":a).replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")+")",t="";return e.divider&&(t+='
'+e.divider+"
"),s&&e.thumbnail&&(t+='
'+e.thumbnail+"
"),e.value&&(t=(t+='
')+'
'+e.value.replace(new RegExp(a,"gi"),"$1").replace(/<(\/?strong)>/g,"<$1>")+"
"),u&&e.sku&&(t+='

'+e.sku+"

"),i&&e.price&&(t+='

'+e.price+"

"),e.value&&(t+="
"),e.permalink&&(a="",e.value&&(a=`aria-label="${e.value}"`),t+=` `),e.products_not_found&&(t=''+e.value+""),w&&(e.no_results?f.addClass("wd-no-results"):f.removeClass("wd-no-results")),h||w||f.addClass("wd-opened"),(w?d.parent():d).parent().addClass("wd-searched"),t}}),a.addClass("wd-search-inited")),r.length&&"cat_selected"===e.type){""!==r.val()&&(t.product_cat=r.val());a=d.find('[type="text"]').devbridgeAutocomplete();let e=woodmart_settings.ajaxurl+"?"+new URLSearchParams(t).toString();g&&"yes"===g&&(e+="&include_cat_search="+g),a.setOptions({serviceUrl:e}),a.hide(),a.onValueChange()}}),woodmartThemeModule.$document.on("click",function(e){e=e.target;_(e).is(".wd-search-form")||_(e).parents().is(".wd-search-form")||_(e).is(".wd-search-full-screen")||_(e).parents().is(".wd-search-full-screen")||d.find('[type="text"]').devbridgeAutocomplete("hide")}),_(".wd-search-results > .wd-scroll-content").on("click",function(e){e.stopPropagation()})}),_(".wd-header-search.wd-display-dropdown > a").on("click",function(e){e.preventDefault()}))},_(document).ready(function(){woodmartThemeModule.ajaxSearch()}),window.addEventListener("wdUpdatedHeader",function(){woodmartThemeModule.ajaxSearch()})}(jQuery);