!function(t,e){"use strict";e.init=function(){e.$rsvp=t(".tribe-events-tickets-rsvp"),e.attendee_template=t(document.getElementById("tribe-tickets-rsvp-tmpl")).html(),e.$rsvp.on("change input keyup",".tribe-tickets-quantity",e.event.quantity_changed),e.$rsvp.closest(".cart").on("submit",e.event.handle_submission),t(".tribe-rsvp-list").on("click",".attendee-meta-row .toggle",(function(){t(this).toggleClass("on").siblings(".attendee-meta-details").slideToggle()}))},e.quantity_changed=function(e){const i=e.closest(".tribe-events-tickets-rsvp"),n=i.find(".tribe-tickets-quantity");let s=0;n.each((function(){s+=parseInt(t(this).val(),10)})),0===s?i.removeClass("tribe-tickets-has-rsvp"):i.addClass("tribe-tickets-has-rsvp")},e.validate_rsvp_info=function(e){const i=e.find("input.tribe-tickets-quantity"),n=e.find("input#tribe-tickets-full-name"),s=e.find("input#tribe-tickets-email");let a=0;return i.each((function(){a+=parseInt(t(this).val(),10)})),n.val().trim().length&&s.val().trim().length&&a},e.validate_meta=function(t){let e=!0;return!!window.tribe_event_tickets_plus&&(e=window.tribe_event_tickets_plus.meta.validate_meta(t)),e},e.event.quantity_changed=function(){e.quantity_changed(t(this))},e.event.handle_submission=function(i){const n=t(this).closest("form"),s=n.find(".tribe-rsvp-messages, .tribe-rsvp-message-confirmation-error"),a=n.find(".tribe-event-tickets-meta-required-message"),r=e.validate_rsvp_info(n),c=e.validate_meta(n);return!(!r||!c)||(r?s.hide():s.show(),c?(a.hide(),n.removeClass("tribe-event-tickets-plus-meta-missing-required")):(n.addClass("tribe-event-tickets-plus-meta-missing-required"),a.show()),t("html, body").animate({scrollTop:n.offset().top-100},300),!1)},t(e.init)}(jQuery,{num_attendees:0,event:{}}),window.tec=window.tec||{},window.tec.tickets=window.tec.tickets||{},window.tec.tickets.rsvp={};