!function(c){woodmartThemeModule.simpleDropdown=function(){c(".wd-search-cat").each(function(){var d=c(this),n=d.find("> a"),i=d.find("> input"),o=d.find("> .wd-dropdown"),a=d.parent().parent().find(".s");function r(){o.removeClass("wd-opened")}function s(){var e,t;woodmartThemeModule.$window.width()<=768||a.hasClass("wd-padding-inited")||"yes"!==woodmart_settings.search_input_padding||(e=d.innerWidth()+d.parent().siblings(".searchsubmit").innerWidth()+17,t="padding-right",woodmartThemeModule.$body.hasClass("rtl")&&(t="padding-left"),a.css(t,e),a.addClass("wd-padding-inited"))}a.on("focus",function(){s()}),woodmartThemeModule.$document.on("click",function(e){e=e.target;if(o.hasClass("wd-opened")&&!c(e).is(".wd-search-cat")&&!c(e).parents().is(".wd-search-cat"))return r(),!1}),n.on("click",function(e){return e.preventDefault(),o.hasClass("wd-opened")?r():(o.addClass("wd-opened"),void 0!==c.fn.devbridgeAutocomplete&&d.parent().siblings('[type="text"]').devbridgeAutocomplete("hide"),setTimeout(function(){woodmartThemeModule.$document.trigger("wdSimpleDropdownOpened")},300)),!1}),o.on("click","a",function(e){e.preventDefault();var e=c(this),t=e.data("val"),d=e.text();o.find(".current-item").removeClass("current-item"),e.parent().addClass("current-item"),0!==t?o.find("ul:not(.children) > li:first-child").show():0===t&&o.find("ul:not(.children) > li:first-child").hide(),n.find("span").text(d),i.val(t),i.closest("form.woodmart-ajax-search").find('[type="text"]').trigger("cat_selected"),r(),s()})})},c(document).ready(function(){woodmartThemeModule.simpleDropdown()})}(jQuery);