function wcwl_apply_event_on_page_update(){var e=".wcwl_elements";jQuery(".wcwl_frontend_wrap").length&&(e=".wcwl_frontend_wrap"),jQuery(".wcwl_nojs").toggleClass("wcwl_nojs",!1),jQuery(e+":not(.bound)").addClass("bound").on("click","a.wcwl_control",function(e){e.preventDefault(),wcwl_reset_waitlist_elements(jQuery(this)),wcwl_process_waitlist_request(jQuery(this))}),jQuery(".woocommerce.quick-view.single-product .wcwl_elements:not(.bound)").addClass("bound").on("click","a.wcwl_control",function(e){e.preventDefault(),jQuery(".wcwl_notice").hide(),wcwl_process_waitlist_request(jQuery(this))}),jQuery(".wcwl_toggle").on("click","button",function(){var e=jQuery(this).closest(".wcwl_frontend_wrap");wcwl_toggle_archive_fields(e),e.find(".wcwl_intro, .wcwl_optin, .wcwl_email_elements").show()}),jQuery(".wcwl_notice").on("click",".wcwl_notice_dismiss",function(){var e;jQuery(this).closest(".wcwl_notice").hide(),jQuery(".wcwl_frontend_wrap").length?(wcwl_toggle_archive_fields(e=jQuery(this).closest(".wcwl_frontend_wrap")),e.find(".spinner").hide(),e.find(".wcwl_toggle").show(),e.find(".wcwl_elements").hide()):((e=jQuery(this).closest(".wcwl_elements")).find(".spinner").hide(),e.find(".wcwl_intro, .wcwl_optin, .wcwl_email_elements, .wcwl_control, .wcwl_control button").show())}),wcwl_hide_waitlist_notice_if_empty(),wcwl_add_keyboard_button_events(),null!=jQuery(e).css("display")&&(waitlist_display_class=null!=jQuery(e).css("display"))}function wcwl_toggle_archive_fields(e){jQuery(".wcwl_elements, .wcwl_notice").hide(),jQuery(".wcwl_toggle, .woocommerce_waitlist, .wcwl_frontend_wrap > .wcwl_control").show(),e.find(".wcwl_toggle").hide(),e.find(".wcwl_elements, .wcwl_email_elements, .wcwl_control, .wcwl_optin").show()}function wcwl_reset_waitlist_elements(e){jQuery(".wcwl_frontend_wrap").length?wcwl_toggle_archive_fields(e.closest(".wcwl_frontend_wrap")):(jQuery(".wcwl_elements, .wcwl_email_elements, .wcwl_control, .wcwl_optin, .wcwl_intro").show(),jQuery(".wcwl_notice").hide(),e.closest(".wcwl_elements").find(".wcwl_intro").hide()),jQuery(".wcwl_email, .wcwl_optin").removeClass("wcwl_error_highlight")}function wcwl_process_waitlist_request(e){var t=e.closest(".wcwl_frontend_wrap"),l=[],i=(t=t.length?t:e.closest(".wcwl_elements")).find('input[name="wcwl_email"]'),w=(wcwl_check_email_field(i)||l.push("email"),t.find(".wcwl_optin input"));wcwl_check_optin_field(w)||l.push("optin"),jQuery("div.product-type-grouped").length&&0==wcwl_data.user_id&&!jQuery("input.wcwl_checkbox:checked").length&&l.push("grouped_no_checked"),0==l.length?(e.find("button").hide(),t.find(".wcwl_email_elements, .wcwl_optin").hide(),e.find(".spinner").show(),wcwl_add_screenreader_message(t.find(".wcwl_control"),wcwl_data.loading_message),wcwl_process_ajax_request(t,e,i.val())):(t.find(".wcwl_notice").hide(),t.find(".wcwl_intro, .wcwl_optin").show(),"email"===l[0]?i.focus():"optin"===l[0]?w.focus():"grouped_no_checked"===l[0]&&(t.find(".wcwl_notice p").text(wcwl_data.no_checkboxes_message),t.find(".wcwl_notice").show()))}function wcwl_process_ajax_request(l,e,t){var i=e.data("context"),w=wcwl_get_grouped_products(),_=e.data("product-id"),c=e.data("wpml-lang"),n={action:"wcwl_process_user_waitlist_request",nonce:e.data("nonce"),product_id:_,language:c,products:w,email:t,context:i,archive:l.hasClass("wcwl_frontend_wrap")?"true":"false"};jQuery(document.body).trigger("wcwl_before_waitlist_request",n),jQuery.post(wcwl_data.ajax_url,n).done(function(e){var t;void 0!==e?.data?.redirectUrl?(t=""!==e.data.redirectUrl?e.data.redirectUrl:document.location,document.location=t):(t=l,e.success&&(t=(t=e.data.html.replace("\x3c!-- wcwl_elements --\x3e","")).replace("\x3c!-- wcwl_frontend_wrap --\x3e",""),l.replaceWith(t)),l.hasClass("wcwl_frontend_wrap")?wcwl_process_dom_changes_on_archive_page(_,i,e):(jQuery(".single_variation_wrap").length&&wcwl_update_availability_html_on_variation_form(t,_),(t=jQuery('.wcwl_control[data-product-id="'+_+'"]').closest(".wcwl_elements")).length&&(t.find(".wcwl_intro").hide(),e.success||t.find(".wcwl_notice p").text(e.data),t.find(".wcwl_notice").show(),t.css("display",waitlist_display_class),"none"!==waitlist_display_class&&void 0!==waitlist_display_class||t.show())),jQuery(".woocommerce.quick-view.single-product .product-type-simple").length&&jQuery(".wcwl_frontend_wrap .wcwl_notice").hide(),wcwl_apply_event_on_page_update(),jQuery(document.body).trigger("wcwl_after_waitlist_request",[e,n]))})}function wcwl_update_availability_html_on_variation_form(i,w){var _=jQuery("form.variations_form").data("product_variations");jQuery.each(_,function(e,t){var l;t.variation_id===w&&(i=i.replace("\x3c!-- wcwl_elements --\x3e",""),l=t.availability_html.substring(t.availability_html.lastIndexOf('
"+t+"
")}function wcwl_hide_waitlist_notice_if_empty(){jQuery(".wcwl_notice:empty").hide()}jQuery(document).ready(function(e){wcwl_apply_event_on_page_update(),wcwl_hook_up_variation_events(),e("body").on("quick-view-displayed",function(){wcwl_hook_up_variation_events()})}),"undefined"!=typeof wcwl_bundle_data&&jQuery(".bundle_availability").length&&jQuery(".bundle_form .bundle_data").on("woocommerce-product-bundle-initialized, woocommerce-product-bundle-updated",function(){setTimeout(function(){wcwl_maybe_show_for_bundle()},300)}),"undefined"!=typeof wcwl_event_data&&jQuery("#tribe-events").length?0<(wcwl_tickets=jQuery(".woocommerce.tribe-tickets-form-row")).length?(requires_waitlist=!1,jQuery.each(wcwl_tickets,function(e,t){var l=jQuery(t).data("product-id"),l=wcwl_event_data.tickets[l];l&&(requires_waitlist=!0,jQuery(l).insertAfter(jQuery(t).find(".tickets_nostock")))}),requires_waitlist&&(jQuery(wcwl_event_data.button).insertAfter(jQuery(".tribe-events-tickets")),wcwl_apply_event_on_page_update())):0<(wcwl_tickets=jQuery('input[value="Tribe__Tickets_Plus__Commerce__WooCommerce__Main"').nextAll("div.product.type-product")).length&&(requires_waitlist=!1,jQuery.each(wcwl_tickets,function(e,t){var l=jQuery(t).data("ticket-id"),l=wcwl_event_data.tickets[l];l&&(requires_waitlist=!0,jQuery(l).insertAfter(jQuery(t)))}),requires_waitlist)&&(jQuery(wcwl_event_data.button).insertAfter(jQuery("form#tribe-tickets")),wcwl_apply_event_on_page_update()):(wcwl_ticket_form=jQuery('form[data-provider-id="woo"]'),"undefined"!=typeof wcwl_event_data&&jQuery(wcwl_ticket_form).length&&0<(wcwl_tickets=0==(wcwl_tickets=wcwl_ticket_form.find(".tribe-tickets__item")).length?wcwl_ticket_form.find(".tribe-tickets__tickets-item"):wcwl_tickets).length&&(requires_waitlist=!1,jQuery.each(wcwl_tickets,function(e,t){var l=jQuery(t).data("ticket-id"),l=wcwl_event_data.tickets[l];l&&(requires_waitlist=!0,jQuery('