!function(t,e,o){"use strict";if("undefined"!=typeof yith_welrp){var i=performance.getEntriesByType("navigation")[0],n=void 0!==i&&i.toJSON(),a=!1,s=/Apple/.test(navigator.vendor)&&!/CriOS|EdgiOS/.test(navigator.userAgent)&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.maxTouchPoints>2);n&&"back_forward"==n.type&&r(yith_welrp.checkLogin,{context:"frontend"}).done((function(t){a=t.logged}));var l=function(i){if(i.length){if(this.self=i,this.wrap=i.find(".yith-welrp-popup-wrapper"),this.popup=i.find(".yith-welrp-popup"),this.content=i.find(".yith-welrp-popup-content-wrapper"),this.overlay=i.find(".yith-welrp-overlay"),this.blocked=!1,this.opened=!1,this.animated=!1,this.additional=i.hasClass("fixed"),this.currentSection=null,this.previousSection=null,this.animationIn=this.popup.attr("data-animation-in"),this.animationOut=this.popup.attr("data-animation-out"),this.position(null),this.handleFacebook(),this.handleGoogle(),this.handleGoogleReCaptcha(),t(e).on("resize",{obj:this},this.position),yith_welrp.mainSelector&&t(o).on("click",yith_welrp.mainSelector,{obj:this,additional:!1},this.open),yith_welrp.additionalSelector)yith_welrp.additionalSelector.split(",").forEach((e=>t(o).on("click",e,{obj:this,additional:!0},this.open)));this.wrap.hasClass("close-on-click")&&this.overlay.on("click",{obj:this},this.close),this.popup.on("click",".yith-welrp-popup-close",{obj:this},this.close),this.popup.on("click","a.yith-welrp-go-back",{obj:this},this.goBack),this.popup.on("click","a.yith-welrp-lost-password",{obj:this},this.goLostPassword),this.popup.on("click","a.yith-welrp-send-auth, a.yith-welrp-send-email",{obj:this},this.sendResetEmail),this.popup.on("click",".yith-welrp-password-eye",{obj:this},this.passwordEye),this.popup.on("submit","form.yith-welrp-form",{obj:this},this.formSubmit),this.popup.on("keyup","#user_login, #reg_email",{obj:this},this.emailSuggestions),this.popup.on("click",".yith-welrp-email-suggestion-item",{obj:this},this.useEmailSuggestion),this.popup.on("click","*",this.closeEmailSuggestion)}};l.prototype.position=function(o){var i=null==o?this.popup:o.data.obj.popup,n=t(e).width(),a=t(e).height(),s=n-40>yith_welrp.popupWidth?a/10+"px":"0",l=n-40>yith_welrp.popupWidth?yith_welrp.popupWidth+"px":"auto";i.css({"margin-top":s,"margin-bottom":s,width:l})},l.prototype.block=function(){this.blocked||(this.popup.block({message:null,overlayCSS:{background:"#fff url("+yith_welrp.loader+") no-repeat center",opacity:.5,cursor:"none"}}),this.blocked=!0)},l.prototype.unblock=function(){this.blocked&&(this.popup.unblock(),this.blocked=!1)},l.prototype.reset=function(e){this.loadTemplate("email-section",{title:this.additional?yith_welrp.fsAdditionalTitle:yith_welrp.fsTitle}),this.previousSection=null,e&&this.addMessage(e,"error"),this.unblock(),t(o).trigger("yith_welrp_popup_reset")},l.prototype.loadTemplate=function(t,e){var o=wp.template(t);this.content.find(".yith-welrp-message").remove(),this.previousSection=this.content.html(),this.showTemplate(o(e))},l.prototype.showTemplate=function(e){this.content.hide().html(e).fadeIn(),t(o).trigger("yith_welrp_popup_template_loaded",[this.popup,this])},l.prototype.addMessage=function(e,o){if(e){void 0===o&&(o="success");var i=t("<div/>",{class:"yith-welrp-message "+o}).html(e);t(".yith-welrp-message").length?t(".yith-welrp-message").replaceWith(i):this.content.find(".yith-welrp-submit-button").before(i)}},l.prototype.passwordEye=function(e){var o=t(this).closest(".yith-welrp-password-container").find("input"),i=o.attr("type");t(this).toggleClass("opened"),o.attr("type","password"==i?"text":"password")},l.prototype.open=function(e){if(!a){e.preventDefault();var i=e.data.obj;i.opened||i.animated||(e.data.additional&&(i.additional=!0,i.additional_selector=e.handleObj.selector,i.popup.addClass("additional")),i.loadTemplate("email-section",{title:i.additional?yith_welrp.fsAdditionalTitle:yith_welrp.fsTitle}),i.self.show(),i.animationIn?(i.animated=!0,c(i.overlay,"fadeIn"),c(i.popup,i.animationIn,(function(){i.animated=!1}))):(i.overlay.show(),i.popup.show()),t("html, body").addClass("yith_welrp_opened"),t(o).trigger("yith_welrp_popup_opened",[i.popup,i]))}},l.prototype.close=function(e){e.preventDefault();var i=e.data.obj;i.animated||(i.animationOut?(i.animated=!0,h(i.popup,i.animationOut),h(i.overlay,"fadeOut slow",(function(){i.opened=!1,i.additional=!1,i.animated=!1,i.popup.removeClass("additional"),i.self.hide()}))):(i.opened=!1,i.additional=!1,i.popup.removeClass("additional"),i.overlay.hide(),i.popup.hide(),i.self.hide()),t("html, body").removeClass("yith_welrp_opened"),t(o).trigger("yith_welrp_popup_closed",[i.popup,i]))},l.prototype.goBack=function(t){t.preventDefault();var e=t.data.obj;null!=e.previousSection?(e.showTemplate(e.previousSection),e.previousSection=null):e.reset()},l.prototype.goLostPassword=function(t){t.preventDefault();var e=t.data.obj,o=e.content.find("input[name='user_email']"),i={title:yith_welrp.lostPasswordTitle,message:yith_welrp.lostPasswordMessage,button_label:yith_welrp.lostPasswordButton,user_login:o.length?o.val():"",action:"lost-password"};e.loadTemplate("lost-password-section",i)},l.prototype.sendResetEmail=function(e){e.preventDefault();var o=e.data.obj,i=[{name:"action",value:"lost-password"},{name:"resend",value:!0},{name:"user_login",value:t(this).data("user-login")}];o.formAction(i)},l.prototype.emailSuggestions=function(e){var o=t(this),i=o.val().split("@"),n=i[0],a=i.length>1?i[1]:"",s="";t.each(yith_welrp.emailSuggestions,(function(t,e){(!a||0===e.indexOf(a)&&a!==e)&&(s=s+'<li class="yith-welrp-email-suggestion-item">'+n+"@"+e+"</li>")})),n.length<3||!s?o.closest(".yith-welrp-email-suggestion").replaceWith(o).end().focus():(o.closest(".yith-welrp-email-suggestion").length||o.wrap('<div class="yith-welrp-email-suggestion"></div>').after('<ul class="yith-welrp-email-suggestion-list"></ul>').focus(),o.next(".yith-welrp-email-suggestion-list").html(s))},l.prototype.useEmailSuggestion=function(e){e.stopPropagation(),t(this).closest(".yith-welrp-email-suggestion").find("input").val(t(this).text()).keyup()},l.prototype.closeEmailSuggestion=function(e){if(!t(this).closest(".yith-welrp-email-suggestion").length&&!t(this).hasClass("yith-welrp-email-suggestion")){var o=t(".yith-welrp-email-suggestion").find("input");o.length&&t(".yith-welrp-email-suggestion").replaceWith(o)}},l.prototype.formSubmit=function(e){e.preventDefault();var o=e.data.obj,i=t(this).serializeArray();o.formAction(i)},l.prototype.formAction=function(i){var n=this;i.push({name:"origin",value:e.location.href},{name:"additional",value:n.additional?1:0},{name:"additional_selector",value:n.additional?n.additional_selector:0},{name:"context",value:"frontend"}),n.block(),r(yith_welrp.formAction,i).done((function(i){if(i.success&&void 0!==i.data.action){if(void 0!==i.data.action.redirectTo)return void(e.location.href=i.data.action.redirectTo);void 0!==i.data.action.nextSection&&n.loadTemplate(i.data.action.nextSection,i.data.popup)}n.addMessage(i.data.message,i.success?"success":"error"),t(o).trigger("yith_welrp_popup_form_action_handled",[i.success,i,this]),n.unblock()})).fail((function(t){n.reset(yith_welrp.errorMsg)}))},l.prototype.handleGoogleReCaptcha=function(){void 0!==yith_welrp.googleReCaptcha&&p("https://www.google.com/recaptcha/api.js").done((function(e,i){var n=null;t(o).on("yith_welrp_popup_template_loaded",(function(){var t=o.getElementById("g-recaptcha");t&&(n=grecaptcha.render(t,{sitekey:yith_welrp.googleReCaptcha,theme:"light"}))})),t(o).on("yith_welrp_popup_form_action_handled",(function(t,e){e||null===n||grecaptcha.reset(n)}))})).fail((function(t,e,o){console.log("Error retreiving Google reCaptcha")}))},l.prototype.socialAction=function(i,n){var a=this,s=[{name:"origin",value:e.location.pathname},{name:"additional",value:a.additional?1:0},{name:"context",value:"frontend"},{name:"token",value:i},{name:"social",value:n}];r(yith_welrp.socialAction,s).done((function(i){i.success?void 0!==i.data.redirectTo&&(e.location.href=i.data.redirectTo):a.reset(i.data.message,"error"),t(o).trigger("yith_welrp_popup_form_social_handled",[i.success,i,n,this])})).fail((function(t){a.reset(yith_welrp.message)}))},l.prototype.handleFacebook=function(){var t=this;void 0===yith_welrp.facebookAppID||s?t.removeButton("#yith-welrp-facebook-button"):p("https://connect.facebook.net/en_US/sdk.js").done((function(e,o){FB.init({appId:yith_welrp.facebookAppID,xfbml:!0,version:"v4.0",status:!0}),t.popup.on("click","#yith-welrp-facebook-button",(e=>{t.block(),FB.getLoginStatus((function(e){"connected"==e.status?t.socialAction(e.authResponse.accessToken,"facebook"):FB.login((function(e){"connected"===e.status?t.socialAction(e.authResponse.accessToken,"facebook"):t.reset(yith_welrp.errorMsg)}),{scope:"public_profile,email"})}),!0)}))})).fail((function(t,e,o){console.error("Error get FB SDK")}))},l.prototype.handleGoogle=function(){var i=this;void 0!==yith_welrp.googleAppID?(p("https://accounts.google.com/gsi/client").done((function(e,i){google.accounts.id.initialize({client_id:yith_welrp.googleAppID,callback:yith_welrp_google_response_handler}),t(o).on("yith_welrp_popup_opened yith_welrp_popup_reset",(function(){google.accounts.id.renderButton(o.getElementById("yith-welrp-google-button-hidden"),yith_welrp.googleButtonAttributes)}))})).fail((function(t,e,o){console.error("Error get Google SDK")})),e.yith_welrp_google_response_handler=function(t){void 0!==t.credential?(i.block(),i.socialAction(t.credential,"google")):i.reset(yith_welrp.errorMsg)}):i.removeButton("#yith-welrp-google-button-hidden")},l.prototype.removeButton=function(e){t(o).on("yith_welrp_popup_template_loaded",(()=>{this.popup.find(e).closest(".yith-welrp-social").remove(),this.popup.find(".yith-welrp-social").length||this.popup.find(".yith-welrp-social-sep, .yith-welrp-social-container").remove()}))},t(o).ready((function(){new l(t(o).find("#yith-welrp"))}))}function p(e,o){return o=t.extend(o||{},{dataType:"script",cache:!0,url:e}),jQuery.ajax(o)}function r(e,o){return t.ajax({url:yith_welrp.ajaxUrl.toString().replace("%%endpoint%%",e),data:o,dataType:"json",type:"POST"})}function c(t,e,o){t.show().addClass("animated "+e),t.one("animationend",(function(){t.removeClass("animated "+e),void 0!==o&&o()}))}function h(t,e,o){t.addClass("animated "+e),t.one("animationend",(function(){t.hide().removeClass("animated "+e),void 0!==o&&o()}))}}(jQuery,window,document);