!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports&&"function"==typeof require?t(require("jquery")):t(jQuery)}(function(t){"use strict";var e={escapeRegExChars:function(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")},createNode:function(t){var e=document.createElement("div");return e.className=t,e.style.position="absolute",e.style.display="none",e},highlight:function(t,s){if(dgwt_wcas.is_premium){var i,o=s.split(/ /);if(o)for(o=o.sort(function(t,e){return e.length-t.length}),i=0;i1){var a="("+e.escapeRegExChars(o[i].trim())+")";t=t.replace(new RegExp(a,"gi"),"$1")}}else a="("+e.escapeRegExChars(s)+")",t=t.replace(new RegExp(a,"gi"),"$1");return t}},s=27,i=9,o=13,a=38,n=39,l=40;function r(e,s){var i=t.noop,o={ajaxSettings:{},autoSelectFirst:!1,appendTo:document.body,serviceUrl:null,lookup:null,onSelect:null,onMouseOver:null,onMouseLeave:null,width:"auto",containerDetailsWidth:"auto",showDetailsPanel:!1,showImage:!1,showPrice:!1,showSKU:!1,showDescription:!1,showSaleBadge:!1,showFeaturedBadge:!1,saleBadgeText:"sale",featuredBadgeText:"featured",minChars:3,maxHeight:600,deferRequestBy:0,params:{},formatResult:r.formatResult,delimiter:null,zIndex:999999999,type:"GET",noCache:!1,isRtl:!1,onSearchStart:i,onSearchComplete:i,onSearchError:i,preserveInput:!1,searchFormClass:"dgwt-wcas-search-wrapp",containerClass:"dgwt-wcas-suggestions-wrapp",containerDetailsClass:"dgwt-wcas-details-wrapp",searchInputClass:"dgwt-wcas-search-input",preloaderClass:"dgwt-wcas-preloader",closeTrigger:"dgwt-wcas-close",tabDisabled:!1,dataType:"text",currentRequest:null,triggerSelectOnValidInput:!0,isPremium:!1,overlayMobile:!1,preventBadQueries:!0,lookupFilter:function(t,e,s){return-1!==t.value.toLowerCase().indexOf(s)},paramName:"query",transformResult:function(e){return"string"==typeof e?t.parseJSON(e):e},showNoSuggestionNotice:!1,noSuggestionNotice:"No results",orientation:"bottom",forceFixPosition:!1,positionFixed:!1};this.element=e,this.el=t(e),this.suggestions=[],this.badQueries=[],this.selectedIndex=-1,this.currentValue=this.element.value,this.intervalId=0,this.cachedResponse={},this.cachedDetails={},this.detailsRequestsSent=[],this.onChangeInterval=null,this.onChange=null,this.isLocal=!1,this.suggestionsContainer=null,this.detailsContainer=null,this.noSuggestionsContainer=null,this.options=t.extend({},o,s),this.classes={selected:"dgwt-wcas-suggestion-selected",suggestion:"dgwt-wcas-suggestion",suggestionsContainerOrientTop:"dgwt-wcas-suggestions-wrapp--top"},this.hint=null,this.hintValue="",this.selection=null,this.overlayMobileState="off",this.initialize(),this.setOptions(s)}r.utils=e,t.Autocomplete=r,r.formatResult=function(t,s){return s?(t=e.highlight(t,s)).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/<sup/g,"").replace(/<(\/?strong)>/g,"<$1>"):t},r.prototype={killerFn:null,initialize:function(){var e,s,i=this,o="."+i.classes.suggestion,a=(i.classes.selected,i.options),n="."+a.closeTrigger;i.element.setAttribute("autocomplete","off"),i.killerFn=function(e){0===t(e.target).closest("."+i.options.containerClass).length&&0===t(e.target).closest("."+i.options.containerDetailsClass).length&&(i.killSuggestions(),i.disableKillerFn())};var l=i.el.closest("."+a.searchFormClass).data("wcas-context");i.noSuggestionsContainer=t('
').html(this.options.noSuggestionNotice).get(0),i.suggestionsContainer=r.utils.createNode(a.containerClass),(e=t(i.suggestionsContainer)).attr("data-wcas-context",l),e.addClass("woocommerce"),e.appendTo("body"),!0===a.showImage&&e.addClass("dgwt-wcas-has-img"),!0===a.showPrice&&e.addClass("dgwt-wcas-has-price"),!0===a.showDescription&&e.addClass("dgwt-wcas-has-desc"),!0===a.showSKU&&e.addClass("dgwt-wcas-has-sku"),"auto"!==a.width&&e.width(a.width),!0===a.showDetailsPanel&&(i.detailsContainer=r.utils.createNode(a.containerDetailsClass),(s=t(i.detailsContainer)).attr("data-wcas-context",l),s.addClass("woocommerce"),s.appendTo("body")),e.on("mouseover.autocomplete",o,function(){i.onMouseOver(t(this).data("index")),i.activate(t(this).data("index"))}),e.on("mouseout.autocomplete",function(){}),t(document).on("click.autocomplete",n,function(e){i.killerFn(e),i.clear(!1),t(this).removeClass(a.closeTrigger),t(this).closest("."+a.searchFormClass).find("."+a.searchInputClass).val("").focus()}),e.on("click.autocomplete",o,function(){return i.select(t(this).data("index")),!1}),t(document).on("change",'[name="js-dgwt-wcas-quantity"]',function(e){t(this).closest(".js-dgwt-wcas-pd-addtc").find("[data-quantity]").attr("data-quantity",t(this).val())}),i.fixPositionCapture=function(){i.adjustContainerWidth(),i.visible&&i.fixPosition()},t(window).on("resize.autocomplete",i.fixPositionCapture),i.el.on("keydown.autocomplete",function(t){i.onKeyPress(t)}),i.el.on("keyup.autocomplete",function(t){i.onKeyUp(t)}),i.el.on("blur.autocomplete",function(){i.onBlur()}),i.el.on("focus.autocomplete",function(){i.onFocus()}),i.el.on("change.autocomplete",function(t){i.onKeyUp(t)}),i.el.on("input.autocomplete",function(t){i.onKeyUp(t)})},onFocus:function(){this.options.overlayMobile&&t(window).width()<992&&"ontouchend"in document&&this.enableOverlayMobile(),this.fixPositionCapture(),this.el.val().length>=this.options.minChars&&this.onValueChange()},onBlur:function(){this.enableKillerFn()},abortAjax:function(){this.currentRequest&&(this.currentRequest.abort(),this.currentRequest=null)},setOptions:function(e){var s=this,i=s.getSuggestionsContainer(),o=s.options;(t.extend(o,e),s.isLocal=t.isArray(o.lookup),s.isLocal&&(o.lookup=s.verifySuggestionsFormat(o.lookup)),o.orientation=s.validateOrientation(o.orientation,"bottom"),i.css({"max-height":s.canShowDetailsBox()?"none":o.maxHeight+"px",width:o.width+"px","z-index":o.zIndex}),!0===o.showDetailsPanel)&&(s.getDetailsContainer().css({"z-index":o.zIndex-1}),t("body").addClass("dgwt-wcas-is-details"));s.options.onSearchComplete=function(){s.preloader("hide","form","dgwt-wcas-inner-preloader"),s.preloader("show","form",o.closeTrigger)}},clearCache:function(){this.cachedResponse={},this.cachedDetails={},this.badQueries=[]},clear:function(t){t&&this.clearCache(),this.currentValue="",this.suggestions=[]},disable:function(){this.disabled=!0,clearInterval(this.onChangeInterval),this.abortAjax()},enable:function(){this.disabled=!1},fixPosition:function(){var e=t("."+this.options.containerClass+'[data-wcas-context="'+this.getContext()+'"]'),s=this.getFormOffset();e.css(s),this.canShowDetailsBox()&&this.fixPositionDetailsBox()},fixPositionDetailsBox:function(){var e=this.el.closest("[data-wcas-context]"),s=t("."+this.options.containerDetailsClass+'[data-wcas-context="'+this.getContext()+'"]'),i=t("."+this.options.containerClass+'[data-wcas-context="'+this.getContext()+'"]'),o=this.getFormOffset(),a=o.left;if(0==s.length)return!1;var n=!0===this.options.isRtl?1:2,l=Math.round(o.left);if(o.left=l+Math.round(i.width()+n),s.css(o),e.width()>=550)return t("body").removeClass("dgwt-wcas-details-outside"),t("body").removeClass("dgwt-wcas-details-right"),t("body").removeClass("dgwt-wcas-details-left"),void(!0===this.options.isRtl&&(i.css("left",l+Math.round(s.width()+n)+"px"),s.css("left",a+"px")));var r=t(window).width(),c=s.width(),d=s.offset();t("body").addClass("dgwt-wcas-details-outside"),!0===this.options.isRtl&&(o.left=o.left+1);var u=!1,g=!1;r0&&(e=t.data("wcas-context")),e},getFormWrapper:function(){return this.el.closest("[data-wcas-context]")},getSuggestionsContainer:function(){return t("."+this.options.containerClass+'[data-wcas-context="'+this.getContext()+'"]')},getDetailsContainer:function(){return t("."+this.options.containerDetailsClass+'[data-wcas-context="'+this.getContext()+'"]')},scrollDownSuggestions:function(){var t=this.getSuggestionsContainer();t[0].scrollTop=t[0].scrollHeight},enableKillerFn:function(){t(document).on("click.autocomplete",this.killerFn)},disableKillerFn:function(){t(document).off("click.autocomplete",this.killerFn)},killSuggestions:function(){var t=this;t.stopKillSuggestions(),t.intervalId=window.setInterval(function(){t.visible&&(t.options.preserveInput||t.el.val(t.currentValue),t.hide()),t.stopKillSuggestions()},50)},stopKillSuggestions:function(){window.clearInterval(this.intervalId)},isCursorAtEnd:function(){var t,e=this.el.val().length,s=this.element.selectionStart;return"number"==typeof s?s===e:!document.selection||((t=document.selection.createRange()).moveStart("character",-e),e===t.text.length)},onKeyPress:function(t){if(this.disabled||this.visible||t.which!==l||!this.currentValue){if(!this.disabled&&this.visible){switch(t.which){case s:this.el.val(this.currentValue),this.hide();break;case n:if(this.hint&&this.options.onHint&&this.isCursorAtEnd()){this.selectHint();break}return;case i:if(this.hint&&this.options.onHint)return void this.selectHint();if(-1===this.selectedIndex)return void this.hide();if(this.select(this.selectedIndex),!1===this.options.tabDisabled)return;break;case o:if(-1===this.selectedIndex)return void this.hide();this.select(this.selectedIndex);break;case a:this.moveUp();break;case l:this.moveDown();break;default:return}t.stopImmediatePropagation(),t.preventDefault()}}else this.suggest()},onKeyUp:function(t){var e=this;if(!e.disabled){switch(t.which){case a:case l:return}clearInterval(e.onChangeInterval),e.currentValue!==e.el.val()&&(e.findBestHint(),e.options.deferRequestBy>0?e.onChangeInterval=setInterval(function(){e.onValueChange()},e.options.deferRequestBy):e.onValueChange())}},onValueChange:function(){var e=this.options,s=this.el.val(),i=this.getQuery(s);this.selection&&this.currentValue!==i&&(this.selection=null,(e.onInvalidateSelection||t.noop).call(this.element)),clearInterval(this.onChangeInterval),this.currentValue=s,this.selectedIndex=-1,e.triggerSelectOnValidInput&&this.isExactMatch(i)?this.select(0):i.length=992&&!("ontouchend"in document)},getQuery:function(e){var s,i=this.options.delimiter;return i?(s=e.split(i),t.trim(s[s.length-1])):e},getSuggestionsLocal:function(e){var s,i=this.options,o=e.toLowerCase(),a=i.lookupFilter,n=parseInt(i.lookupLimit,10);return s={suggestions:t.grep(i.lookup,function(t){return a(t,e,o)})},n&&s.suggestions.length>n&&(s.suggestions=s.suggestions.slice(0,n)),s},getSuggestions:function(e){var s,i,o,a,n=this,l=n.options,r=l.serviceUrl;l.params[l.paramName]=e,i=l.ignoreParams?null:l.params,n.preloader("show","form","dgwt-wcas-inner-preloader"),!1!==l.onSearchStart.call(n.element,l.params)&&(t.isFunction(l.lookup)?l.lookup(e,function(t){n.suggestions=t.suggestions,n.suggest(),n.getDetails(t.suggestions[0]),l.onSearchComplete.call(n.element,e,t.suggestions)}):(n.isLocal?s=n.getSuggestionsLocal(e):(t.isFunction(r)&&(r=r.call(n.element,e)),o=r+"?"+t.param(i||{}),s=n.cachedResponse[o]),s&&t.isArray(s.suggestions)?(n.suggestions=s.suggestions,n.suggest(),n.getDetails(s.suggestions[0]),l.onSearchComplete.call(n.element,e,s.suggestions)):n.isBadQuery(e)?l.onSearchComplete.call(n.element,e,[]):(n.abortAjax(),a={url:r,data:i,type:l.type,dataType:l.dataType},t.extend(a,l.ajaxSettings),n.currentRequest=t.ajax(a).done(function(t){var s;n.currentRequest=null,void 0!==(s=l.transformResult(t,e)).suggestions&&(n.processResponse(s,e,o),n.getDetails(s.suggestions[0])),n.fixPositionCapture(),l.onSearchComplete.call(n.element,e,s.suggestions)}).fail(function(t,s,i){l.onSearchError.call(n.element,e,t,s,i)}))))},getDetails:function(e){var s=this,i=s.options;if(!s.canShowDetailsBox())return!1;if(null!=e&&("string"!=typeof e.more_products||"more_products"!==e.more_products)){var o,a,n=t("."+i.containerDetailsClass);s.fixHeight();var l={action:dgwt_wcas.action_result_details,post_id:null!=e.post_id?e.post_id:0,term_id:null!=e.term_id?e.term_id:0,taxonomy:null!=e.taxonomy?e.taxonomy:"",value:null!=e.value?e.value:""};if(o=l.action+l.post_id+l.term_id+l.taxonomy,null!=(a=s.cachedDetails[o]))n.html(a.details),s.fixHeight(),s.fixPositionCapture();else{if(n.html(""),s.preloader("show","details","",!0),-1!=t.inArray(o,s.detailsRequestsSent))return;s.detailsRequestsSent.push(o),t.ajax({data:l,type:"post",url:dgwt_wcas.ajax_details_endpoint,success:function(t){var e="string"==typeof t?jQuery.parseJSON(t):t;s.cachedDetails[o]=e,s.preloader("hide","details","",!0),null!=e.details?n.html(e.details):n.html(""),s.fixPositionCapture(),s.fixHeight()},error:function(t,e){s.preloader("hide","details","",!0),n.html(t),s.fixPositionCapture(),s.fixHeight()}})}}},isBadQuery:function(t){if(!this.options.preventBadQueries)return!1;for(var e=this.badQueries,s=e.length;s--;)if(0===t.indexOf(e[s]))return!0;return!1},hide:function(){var e=this.getSuggestionsContainer(),s=this.getDetailsContainer();t.isFunction(this.options.onHide)&&this.visible&&this.options.onHide.call(this.element,container),this.visible=!1,this.selectedIndex=-1,clearInterval(this.onChangeInterval),e.hide(),e.removeClass(this.classes.suggestionsContainerOrientTop),s.hide(),t("body").removeClass("dgwt-wcas-open"),t("body").removeClass("dgwt-wcas-block-scroll"),this.signalHint(null)},suggest:function(){if(this.suggestions.length){var e,s=this,i=s.options,o=i.groupBy,a=i.formatResult,n=s.getQuery(s.currentValue),l=s.classes.suggestion,r=s.classes.selected,c=s.getSuggestionsContainer(),d=s.getDetailsContainer(),u=t(s.noSuggestionsContainer),g=i.beforeRender,h="";i.triggerSelectOnValidInput&&s.isExactMatch(n)?s.select(0):(t.each(s.suggestions,function(t,s){var r="",c=!1;if(o&&(h+=function(t,s){var i=t.data[o];return e===i?"":'
'+(e=i)+"
"}(s,0)),void 0===s.post_id){var d=l,u="dgwt-wcas-st",g="",w="",p="";"product_cat"===s.taxonomy?(d+=" dgwt-wcas-suggestion-cat",g+=''+dgwt_wcas.t.category+"",void 0!==s.breadcrumbs&&s.breadcrumbs&&(p=s.breadcrumbs+" > "+s.value,w+=''+dgwt_wcas.copy_in_category+" "+s.breadcrumbs+"")):"product_tag"===s.taxonomy?(d+=" dgwt-wcas-suggestion-tag",g+=''+dgwt_wcas.t.tag+""):void 0!==s.type&&"more_products"===s.type?(d+=" js-dgwt-wcas-suggestion-more dgwt-wcas-suggestion-more",u="dgwt-wcas-st-more",s.value=dgwt_wcas.copy_show_more+" ("+s.total+")"):(d+=" dgwt-wcas-suggestion-nores",s.value=dgwt_wcas.copy_no_result),p=p.length>0?' title="'+p+'"':"",h+='
',h+="'+g+a(s.value,n)+w+"",h+="
"}else!0===i.showImage&&void 0!==s.thumb_html&&(c=!0),r+=void 0!==s.post_id?'data-post-id="'+s.post_id+'" ':"",r+=void 0!==s.taxonomy?'data-taxonomy="'+s.taxonomy+'" ':"",r+=void 0!==s.term_id?'data-term-id="'+s.term_id+'" ':"",h+='
",c&&(h+=''+s.thumb_html+""),h+=c?'
':"",h+='',h+=''+a(s.value,n)+"",!0===i.showSKU&&void 0!==s.sku&&s.sku.length>0&&(h+='('+dgwt_wcas.t.sku_label+" "+a(s.sku,n)+")"),!0===i.showDescription&&void 0!==s.desc&&s.desc&&(h+=''+a(s.desc,n)+""),h+="",!0===i.showPrice&&void 0!==s.price&&(h+=''+s.price+""),!0===i.showFeaturedBadge&&!0===s.on_sale&&(h+=''+i.saleBadgeText+""),!0===i.showFeaturedBadge&&!0===s.featured&&(h+=''+i.featuredBadgeText+""),h+=c?"
":"",h+="
"}),this.adjustContainerWidth(),u.detach(),c.html(h),t.isFunction(g)&&g.call(s.element,c,s.suggestions),s.fixPositionCapture(),c.show(),t("body").addClass("dgwt-wcas-open"),!0===i.showDetailsPanel&&(d.show(),s.fixHeight()),i.autoSelectFirst&&(s.selectedIndex=0,c.scrollTop(0),c.children("."+l).first().addClass(r)),s.visible=!0,"top"===s.options.orientation&&(s.getSuggestionsContainer().addClass(s.classes.suggestionsContainerOrientTop),t("body").addClass("dgwt-wcas-block-scroll"),setTimeout(function(){s.scrollDownSuggestions()},300)),s.findBestHint())}else this.options.showNoSuggestionNotice?this.noSuggestions():this.hide()},noSuggestions:function(){var e=this.getSuggestionsContainer(),s=t(this.noSuggestionsContainer);s.detach(),e.empty(),e.append(s),this.fixPositionCapture(),e.show(),this.visible=!0},adjustContainerWidth:function(){var e,s=this.options,i=t("body"),o=this.getFormWrapper(),a=this.getSuggestionsContainer(),n=this.getDetailsContainer(),l=this.getFormOffset(),r=getComputedStyle(o[0]).width;if(r=Math.round(parseFloat(r.replace("px",""))),"auto"===s.width&&(e=this.el.outerWidth(),a.css("width",e+"px")),!0===s.showDetailsPanel){if(o.width()>=550)return i.addClass("dgwt-wcas-full-width"),r%2==0?(a.css("width",Math.round(r/2)),n.css("width",Math.round(r/2))):(a.css("width",Math.floor(r/2)),n.css("width",Math.ceil(r/2))),i.removeClass("dgwt-wcas-details-left"),i.removeClass("dgwt-wcas-details-right"),void(!0===s.isRtl?n.css("left","0"):a.css("left",r/2+l.left+"px"));i.addClass("dgwt-wcas-details-right")}},findBestHint:function(){var e=this.el.val().toLowerCase(),s=null;e&&(t.each(this.suggestions,function(t,i){var o=0===i.value.toLowerCase().indexOf(e);return o&&(s=i),!o}),this.signalHint(s))},signalHint:function(e){var s="";e&&(s=this.currentValue+e.value.substr(this.currentValue.length)),this.hintValue!==s&&(this.hintValue=s,this.hint=e,(this.options.onHint||t.noop)(s))},preloader:function(e,s,i,o){var a,n,l="dgwt-wcas-preloader-wrapp",r=null==i?l:l+" "+i;if("form"===s?n=this.getFormWrapper().find(".dgwt-wcas-preloader"):"details"===s&&(n=t(this.detailsContainer)),1==dgwt_wcas.show_preloader&&0!=n.length)if(!0===o)if("hide"!==e){if("show"===e){var c=this.options.isRtl?"-rtl":"";a='
',n.html(a)}}else t(l).remove();else"hide"===e?n.removeClass(i):n.addClass(i)},verifySuggestionsFormat:function(e){return e.length&&"string"==typeof e[0]?t.map(e,function(t){return{value:t,data:null}}):e},validateOrientation:function(e,s){return e=t.trim(e||"").toLowerCase(),-1===t.inArray(e,["auto","bottom","top"])&&(e=s),e},processResponse:function(t,e,s){var i=this.options;t.suggestions=this.verifySuggestionsFormat(t.suggestions),i.noCache||(this.cachedResponse[s]=t,i.preventBadQueries&&!t.suggestions.length&&this.badQueries.push(e)),e===this.getQuery(this.currentValue)&&("top"===this.options.orientation&&t.suggestions.reverse(),this.suggestions=t.suggestions,this.suggest())},activate:function(e){var s,i=this.classes.selected,o=this.getSuggestionsContainer(),a=o.find("."+this.classes.suggestion);return o.find("."+i).removeClass(i),this.selectedIndex=e,-1!==this.selectedIndex&&a.length>this.selectedIndex?(s=a.get(this.selectedIndex),t(s).addClass(i),s):null},selectHint:function(){var e=t.inArray(this.hint,this.suggestions);this.select(e)},select:function(t){this.hide(),this.onSelect(t),this.disableKillerFn()},moveUp:function(){if(-1!==this.selectedIndex)return 0===this.selectedIndex?(this.getSuggestionsContainer().children().first().removeClass(this.classes.selected),this.selectedIndex=-1,this.el.val(this.currentValue),void this.findBestHint()):void this.adjustScroll(this.selectedIndex-1)},moveDown:function(){this.selectedIndex!==this.suggestions.length-1&&this.adjustScroll(this.selectedIndex+1)},adjustScroll:function(e){var s=this.activate(e);if(s&&!this.canShowDetailsBox()){var i,o,a,n=this.getSuggestionsContainer(),l=t(s).outerHeight();i=s.offsetTop,a=(o=n.scrollTop())+this.options.maxHeight-l,ia&&n.scrollTop(i-this.options.maxHeight+l),this.options.preserveInput||this.el.val(this.getValue(this.suggestions[e].value)),this.signalHint(null)}},onSelect:function(e){var s=this.options.onSelect,i=this.suggestions[e];void 0===i.type||"more_products"!==i.type?(this.currentValue=this.getValue(i.value),this.currentValue===this.el.val()||this.options.preserveInput||this.el.val(this.currentValue),i.url.length>0&&(window.location.href=i.url),this.signalHint(null),this.suggestions=[],this.selection=i,t.isFunction(s)&&s.call(this.element,i)):this.el.closest("form").trigger("submit")},onMouseOver:function(e){var s=this.options.onMouseOver,i=this.suggestions[e];this.selectedIndex!==e&&this.getDetails(i),t.isFunction(s)&&s.call(this.element,i)},onMouseLeave:function(e){var s=this.options.onMouseLeave,i=this.suggestions[e];t.isFunction(s)&&s.call(this.element,i)},getValue:function(t){var e,s,i=this.options.delimiter;return i?1===(s=(e=this.currentValue).split(i)).length?t:e.substr(0,e.length-s[s.length-1].length)+t:t},dispose:function(){this.el.off(".autocomplete").removeData("autocomplete"),this.disableKillerFn(),t(window).off("resize.autocomplete",this.fixPositionCapture),t("."+this.options.containerClass).remove(),t("."+this.options.containerDetailsClass).remove()},enableOverlayMobile:function(){var e=this;if("on"!==e.overlayMobileState){e.overlayMobileState="on";var s,i=e.getFormWrapper(),o=e.getSuggestionsContainer();t("body").addClass("dgwt-wcas-overlay-mobile-on"),'
','
','','','',"","","
","
",t("body").append('
'),(s=t(".js-dgwt-wcas-overlay-mobile")).css("zIndex",999999),i.after(''),i.appendTo(".js-dgwt-wcas-om-bar"),o.appendTo(".js-dgwt-wcas-om-bar"),i.addClass("dgwt-wcas-search-wrapp-mobile"),i.hasClass("dgwt-wcas-has-submit")&&(i.addClass("dgwt-wcas-has-submit-off"),i.removeClass("dgwt-wcas-has-submit")),i.find("."+e.options.searchInputClass).focus(),t(document).on("click",".js-dgwt-wcas-om-return",function(t){e.disableOverlayMobile(s)})}},disableOverlayMobile:function(e){var s=this,i=s.getSuggestionsContainer();s.killSuggestions(),s.disableKillerFn();var o=t(".js-dgwt-wcas-om-bar").find("."+s.options.searchFormClass);o.hasClass("dgwt-wcas-has-submit-off")&&(o.removeClass("dgwt-wcas-has-submit-off"),o.addClass("dgwt-wcas-has-submit")),o.removeClass("dgwt-wcas-search-wrapp-mobile"),t("body").removeClass("dgwt-wcas-overlay-mobile-on"),i.appendTo("body"),i.removeAttr("body-scroll-lock-ignore"),t(".js-dgwt-wcas-om-hook").after(o),t(".js-dgwt-wcas-overlay-mobile").remove(),t(".js-dgwt-wcas-om-hook").remove(),setTimeout(function(){o.find("."+s.options.searchInputClass).val("")},150),s.overlayMobileState="off"}},t.fn.dgwtWcasAutocomplete=function(e,s){return arguments.length?this.each(function(){var i=t(this),o=i.data("autocomplete");"string"==typeof e?o&&"function"==typeof o[e]&&o[e](s):(o&&o.dispose&&o.dispose(),o=new r(this,e),i.data("autocomplete",o))}):this.first().data("autocomplete")},t(window).on("load",function(){t(".dgwt-wcas-search-submit").length>0&&t(".dgwt-wcas-search-submit").each(function(){var e=t(this).closest(".dgwt-wcas-search-wrapp").find(".dgwt-wcas-preloader");1==dgwt_wcas.is_rtl?e.css("left",6+t(this).outerWidth()+"px"):e.css("right",t(this).outerWidth()+"px")})}),t(document).ready(function(){var e=1==dgwt_wcas.show_details_box;(jQuery(window).width()<992||"ontouchend"in document)&&(e=!1),t(".dgwt-wcas-search-input").dgwtWcasAutocomplete({minChars:dgwt_wcas.min_chars,width:dgwt_wcas.sug_width,autoSelectFirst:!1,triggerSelectOnValidInput:!1,serviceUrl:dgwt_wcas.ajax_search_endpoint,paramName:"s",showDetailsPanel:e,showImage:1==dgwt_wcas.show_images,showPrice:1==dgwt_wcas.show_price,showDescription:1==dgwt_wcas.show_desc,showSKU:1==dgwt_wcas.show_sku,showSaleBadge:1==dgwt_wcas.show_sale_badge,showFeaturedBadge:1==dgwt_wcas.show_featured_badge,saleBadgeText:dgwt_wcas.t.sale_badge,featuredBadgeText:dgwt_wcas.t.featured_badge,isRtl:1==dgwt_wcas.is_rtl,isPremium:1==dgwt_wcas.is_premium,overlayMobile:1==dgwt_wcas.overlay_mobile})}),t(window).on("load",function(){var e=t(".dgwt-wcas-search-wrapp[data-wcas-context]"),s=[];e.length>0&&e.each(function(){var e=t(this).attr("data-wcas-context");if(-1==t.inArray(e,s))s.push(e);else{var i=Math.random().toString(36).substring(2,6),o=t('.dgwt-wcas-suggestions-wrapp[data-wcas-context="'+e+'"]'),a=t('.dgwt-wcas-details-wrapp[data-wcas-context="'+e+'"]');t(this).attr("data-wcas-context",i),o.length>0&&t(o[o.length-1]).attr("data-wcas-context",i),a.length>0&&t(a[a.length-1]).attr("data-wcas-context",i)}})})});