jQuery(document).ready(function(_){"use strict";_("body"),_(".add-request-quote-button");var c=_(document).find(ywraq_frontend.widget_classes),l="undefined"!=typeof ywraq_frontend&&ywraq_frontend.block_loader,u="undefined"!=typeof ywraq_frontend&&ywraq_frontend.allow_out_of_stock,y="undefined"!=typeof ywraq_frontend&&ywraq_frontend.allow_only_on_out_of_stock,t=(_(".yith-ywraq-item-remove"),_(".shipping_address")),e=_(".woocommerce-billing-fields"),i=document.location.href,a=_(document).find("#yith-ywrq-table-list"),d={message:null,overlayCSS:{background:"#fff",opacity:.7},ignoreIfBlocked:!0},s=function(){var t=_(document).find("[data-colspan-mobile]");_.each(t,function(){var t=_(this);window.innerWidth<=768?t.prop("colspan",t.data("colspan-mobile")):t.prop("colspan",t.data("colspan"))})};u=!(!u&&"yes"!=u),y=!(!y&&"yes"!=y),0").html(t).find("#yith-ywrq-table-list"),_("#yith-ywrq-table-list").html(t.html()),s(),_(document).trigger("ywraq_table_reloaded"))}),_(document).on("ywraq_table_reloaded yith_wwraq_removed_successfully yith_check_table",function(){0==_(document).find("#yith-ywrq-table-list").length&&_(document).find(".yith-ywraq-before-table .wc-backward").hide()}),_(document).trigger("yith_check_table"),_.fn.yith_ywraq_variations=function(){var r,o,i,d,s,c,e,t=_(document).find("form.variations_form");t.length&&void 0!==t.data("product_id")&&(r=t.data("product_id").toString().replace(/[^0-9]/g,""),o=_(".add-to-quote-"+r).find(".yith-ywraq-add-button"),i=o.find("a.add-request-quote-button"),d=_(".yith_ywraq_add_item_product-response-"+r),s=_(".yith_ywraq_add_item_response-"+r),c=_(".yith_ywraq_add_item_browse-list-"+r),e=function(){i.show().addClass("disabled"),o.show().removeClass("hide").removeClass("addedd"),d.hide().removeClass("show"),s.hide().removeClass("show"),c.hide().removeClass("show"),(y&&u||y)&&i.hide()},t.on("found_variation",function(t,e){var a=""+_(".add-to-quote-"+r).attr("data-variation"),n=!0;d.hide().removeClass("show"),u?y&&e.is_in_stock&&(n=!1):e.is_in_stock||(n=!1),n?(i.show().removeClass("disabled"),o.show().removeClass("hide").removeClass("addedd")):(i.hide().addClass("disabled"),o.hide().removeClass("show").removeClass("addedd")),s.hide().removeClass("show"),c.hide().removeClass("show"),-1!==a.indexOf(""+e.variation_id)&&n?(i.hide(),s.show().removeClass("hide"),c.show().removeClass("hide")):n&&(i.show().removeClass("disabled"),o.show().removeClass("hide").removeClass("addedd"),s.hide().removeClass("show"),c.hide().removeClass("show"))}),t.on("reset_data",function(t){e()}),e())},_(".variations_form").each(function(){_(this).yith_ywraq_variations()}),_(document).on("qv_loader_stop",function(t){_(".variations_form").each(function(){_(this).yith_ywraq_variations()})}),_.fn.yith_ywraq_refresh_button=function(){var t=_('[name|="product_id"]').val();_(".add-to-quote-"+t).find("a.add-request-quote-button").parents(".yith-ywraq-add-to-quote");if(!_('[name|="variation_id"]').length)return!1},_.fn.yith_ywraq_refresh_button();var f=!1;_(document).on("click",".add-request-quote-button",function(t){t.preventDefault();var e=_(this),a=e.closest(".yith-ywraq-add-to-quote"),n="ac",t="";if(e.hasClass("outofstock")?window.alert(ywraq_frontend.i18n_out_of_stock):e.hasClass("disabled")&&window.alert(ywraq_frontend.i18n_choose_a_variation),!(e.hasClass("disabled")||e.hasClass("outofstock")||f)){if(_(".grouped_form").length){var r=0;if(_(".grouped_form input.qty").each(function(){r=Math.floor(_(this).val())+r}),0==r)return void alert(ywraq_frontend.select_quantity)}if("undefined"==typeof(t=e.closest(".cart").length?e.closest(".cart"):a.siblings(".cart").first().length?a.siblings(".cart").first():_(".composite_form").length?_(".composite_form"):0')},complete:function(){e.next().remove()},success:function(t){"true"==t.result||"exists"==t.result?("yes"==ywraq_frontend.go_to_the_list?window.location.href=t.rqa_url:(_(".yith_ywraq_add_item_response-"+d).hide().addClass("hide").html(""),_(".yith_ywraq_add_item_product-response-"+d).show().removeClass("hide").html(t.message),_(".yith_ywraq_add_item_browse-list-"+d).show().removeClass("hide"),e.parent().hide().removeClass("show").addClass("addedd"),_(".add-to-quote-"+d).attr("data-variation",t.variations),c.length&&(c.ywraq_refresh_widget(),c=_(document).find(".widget_ywraq_list_quote, .widget_ywraq_mini_list_quote")),w()),_(document).trigger("yith_wwraq_added_successfully",[t,d])):"false"==t.result&&(_(".yith_ywraq_add_item_response-"+d).show().removeClass("hide").html(t.message),_(document).trigger("yith_wwraq_error_while_adding")),f=!1}})))}_('').hide().appendTo(t).click().remove()}}),_.fn.serializefiles=function(){var t=_(this),n=new FormData;_.each(_(t).find("input[type='file']"),function(t,a){_.each(_(a)[0].files,function(t,e){n.append(a.name,e)})});var t=_(t).serializeArray(),a=!1;return _.each(t,function(t,e){"quantity"!=e.name&&!e.name.indexOf("quantity")||(a=!0),"add-to-cart"!=e.name&&n.append(e.name,encodeURIComponent(e.value))}),!1===a&&n.append("quantity",1),n},_.fn.ywraq_refresh_widget=function(){c.each(function(){var e=_(this),t=e.find(".yith-ywraq-list-wrapper"),a=e.find(".yith-ywraq-list"),n=e.find(".yith-ywraq-list-widget-wrapper").data("instance");_.ajax({type:"POST",url:ywraq_frontend.ajaxurl.toString().replace("%%endpoint%%","yith_ywraq_action"),data:n+"&ywraq_action=refresh_quote_list&action=yith_ywraq_action&context=frontend",beforeSend:function(){a.css("opacity",.5),e.hasClass("widget_ywraq_list_quote")&&t.prepend(' ')},complete:function(){e.hasClass("widget_ywraq_list_quote")&&t.next().remove(),a.css("opacity",1)},success:function(t){e.hasClass("widget_ywraq_mini_list_quote")?e.find(".yith-ywraq-list-widget-wrapper").html(t.mini):e.find(".yith-ywraq-list-widget-wrapper").html(t.large),_(document).trigger("yith_ywraq_widget_refreshed")}})})},_(document).on("click",".yith-ywraq-item-remove",function(t){t.preventDefault();var e=_(this),n=e.data("remove-item"),t=e.parents(".ywraq-wrapper"),r=(_("#yith-ywraq-form"),t.find(".wpcf7-form")),o=t.find(".gform_wrapper"),t="",i=e.data("product_id"),t="context=frontend&action=yith_ywraq_action&ywraq_action=remove_item&key="+e.data("remove-item")+"&wp_nonce="+e.data("wp_nonce")+"&product_id="+i;_.ajax({type:"POST",url:ywraq_frontend.ajaxurl.toString().replace("%%endpoint%%","yith_ywraq_action"),dataType:"json",data:t,beforeSend:function(){e.find(".ajax-loading").css("visibility","visible")},complete:function(){e.siblings(".ajax-loading").css("visibility","hidden")},success:function(t){var e,a;1===t?((e=_("[data-remove-item='"+n+"']").parents(".cart_item")).hasClass("composite-parent")&&(t=e.data("composite-id"),_("[data-composite-id='"+t+"']").remove()),e.hasClass("yith-wapo-parent")&&(a=e.find(".product-remove a").data("remove-item"),_("[data-wapo_parent_key='"+a+"']").remove()),e.hasClass("ywcp_component_item")&&_("tr.ywcp_component_child_item").filter("[data-wcpkey='"+n+"']").remove(),e.hasClass("bundle-parent")&&(a=e.data("bundle-key"),_("[data-bundle-key='"+a+"']").remove()),e.remove(),0===_(".cart_item").length&&(r.length&&r.remove(),o.length&&o.remove(),_("#yith-ywraq-form, .yith-ywraq-mail-form-wrapper").remove(),_("#yith-ywraq-message").html(ywraq_frontend.no_product_in_list)),c.length?(c.ywraq_refresh_widget(),c=_(document).find(ywraq_frontend.widget_classes)):(c=_(document).find(ywraq_frontend.widget_classes)).ywraq_refresh_widget(),w(),_(document).find('.hide-when-removed[data-product_id="'+i+'"]').hide(),_(document).find('.yith-ywraq-add-button[data-product_id="'+i+'"]').show(),_(document).trigger("yith_wwraq_removed_successfully")):_(document).trigger("yith_wwraq_error_while_removing")}})}),_(".ywraq_clean_list").on("click",function(t){t.preventDefault();var e=_(this);e.block(d);_.ajax({type:"POST",url:ywraq_frontend.ajaxurl.toString().replace("%%endpoint%%","yith_ywraq_action"),dataType:"json",data:"ywraq_action=clean_quote",success:function(t){t=_("
").html(t.response).find(".ywraq-wrapper");_(".ywraq-wrapper").html(t.html()),c.ywraq_refresh_widget(),w(),e.unblock()}})});var n,r,o;function w(){_(document).find(".ywraq_number_items").each(function(){var e=_(this),t=e.data("show_url"),a=e.data("item_name"),n=e.data("item_plural_name");_.ajax({type:"POST",url:ywraq_frontend.ajaxurl.toString().replace("%%endpoint%%","yith_ywraq_action"),data:"ywraq_action=refresh_number_items&action=yith_ywraq_action&context=frontend&item_name="+a+"&item_plural_name="+n+"&show_url="+t,success:function(t){e.replaceWith(t),_(document).trigger("ywraq_number_items_refreshed")}})})}0<_(".wpcf7-submit").closest(".wpcf7").length&&_(document).find(".ywraq-wrapper .wpcf7").each(function(){var t=_(this);t.find('input[name="_wpcf7"]').val()==ywraq_frontend.cform7_id&&(t.on("wpcf7mailsent",function(){_.ajax({type:"POST",url:ywraq_frontend.ajaxurl.toString().replace("%%endpoint%%","yith_ywraq_order_action"),dataType:"json",data:{lang:ywraq_frontend.current_lang,action:"yith_ywraq_order_action",current_user_id:ywraq_frontend.current_user_id,context:"frontend",ywraq_order_action:"mail_sent_order_created"},success:function(t){""!=t.rqa_url&&(window.location.href=t.rqa_url)}})}),document.addEventListener("wpcf7mailsent",function(t){window.location.href=ywraq_frontend.rqa_url},!1))}),_("#yith-ywrq-table-list").on("change",".qty",function(){_(this).val()<=0&&_(this).val(1)}),_(document).bind("gform_confirmation_loaded",function(t,e){ywraq_frontend.gf_id==e&&(window.location.href=ywraq_frontend.rqa_url)}),"undefined"!=typeof ywraq_frontend.wpforms&&(n=_("#wpforms-form-"+ywraq_frontend.wpforms),0<_(n).length&&_(n).on("wpformsAjaxSubmitSuccess",function(t){console.log(t),_.ajax({type:"POST",url:ywraq_frontend.ajaxurl.toString().replace("%%endpoint%%","yith_ywraq_order_action"),dataType:"json",data:{lang:ywraq_frontend.current_lang,action:"yith_ywraq_order_action",current_user_id:ywraq_frontend.current_user_id,context:"frontend",ywraq_order_action:"mail_sent_order_created"},success:function(t){""!=t.rqa_url&&(window.location.href=t.rqa_url)}})})),"undefined"!=typeof ywraq_frontend.ninja_forms&&"undefined"!=typeof Marionette&&(r=Marionette.Object.extend({initialize:function(){this.listenTo(Backbone.Radio.channel("forms"),"submit:response",this.actionSubmit)},actionSubmit:function(t){ywraq_frontend.ninja_forms===t.data.form_id&&_.ajax({type:"POST",url:ywraq_frontend.ajaxurl.toString().replace("%%endpoint%%","yith_ywraq_order_action"),dataType:"json",data:{lang:ywraq_frontend.current_lang,action:"yith_ywraq_order_action",current_user_id:ywraq_frontend.current_user_id,context:"frontend",ywraq_order_action:"mail_sent_order_created"},success:function(t){""!=t.rqa_url&&(window.location.href=t.rqa_url)}})}}),jQuery(document).ready(function(t){new r})),ywraq_frontend.auto_update_cart_on_quantity_change&&_(document).on("click, change","#yith-ywrq-table-list .product-quantity input",function(t){var e,a,n=_(this),r=n.attr("name"),o=n.closest(".quantity");o.block(d),a=(void 0===r?(r=(a=n.closest(".product-quantity").find(".input-text.qty")).attr("name"),e=a.val(),a=r.match(/[^[\]]+(?=])/g),n.hasClass("plus")&&e++,n.hasClass("minus")&&e--):(e=n.val(),a=r.match(/[^[\]]+(?=])/g),n=n.prop("min"),Number(e)").html(t).find("#yith-ywrq-table-list"),_("#yith-ywrq-table-list").html(t.html()),_(document).trigger("ywraq_table_reloaded"),s(),c.length&&(c.ywraq_refresh_widget(),c=_(document).find(".widget_ywraq_list_quote, .widget_ywraq_mini_list_quote"))),o.unblock()})}})}),0