tribe.tickets=tribe.tickets||{},tribe.tickets.data={},function(t,e){const s=t(document);e.storeLocal=function(t){const s=t||tribe.tickets.utils.getTicketsPostId(),i=tribe.tickets.utils.getTicketsFormFromPostId(s),c=tribe.tickets.block.getTicketsForCart(i),o=i.closest(tribe.tickets.block.selectors.container).find(tribe.tickets.modal.metaItem),r=e.getMetaForSave(o);sessionStorage.setItem("tribe_tickets_attendees-"+s,JSON.stringify(r)),sessionStorage.setItem("tribe_tickets_cart-"+s,JSON.stringify(c))},e.getMetaForSave=function(e){const s=[],i=[];return e.each((function(){const e={},s=t(this),c=s.data("ticket-id"),o=s.find(tribe.tickets.meta.selectors.formFieldInput);o.length&&(i[c]||(i[c]={},i[c].ticket_id=c,i[c].items=[]),o.each((function(){const s=t(this);let i=s.val();const c=s.is(":radio");let o=s.attr("name");if(o=o.split("["),o=o.pop().replace("]",""),(c||s.is(":checkbox"))&&!s.prop("checked")){if(c&&""!==e[o])return;i=""}e[o]=i})),i[c].items.push(e))})),Object.keys(i).forEach((function(t){const e={ticket_id:t,items:i[t].items};s.push(e)})),s},e.clearLocal=function(t){const e=t||tribe.tickets.utils.getTicketsPostId();sessionStorage.removeItem("tribe_tickets_attendees-"+e),sessionStorage.removeItem("tribe_tickets_cart-"+e)},e.getLocal=function(t){const e=t||tribe.tickets.utils.getTicketsPostId(),s=JSON.parse(sessionStorage.getItem("tribe_tickets_attendees-"+e)),i=JSON.parse(sessionStorage.getItem("tribe_tickets_cart-"+e)),c={};return c.meta=s,c.tickets=i,c},e.getData=function(e,s){let i={meta:{},tickets:{}};const c=t.Deferred(),o=s||tribe.tickets.utils.getTicketsPostId(),r=JSON.parse(sessionStorage.getItem("tribe_tickets_attendees-"+o));if(null!==r&&(i.meta=r),!e){const t=JSON.parse(sessionStorage.getItem("tribe_tickets_cart-"+o));null!==t&&t.length&&(i.tickets=t),c.resolve(i)}if(!i.tickets||!i.meta){const e=tribe.tickets.utils.getTicketsProviderIdFromPostId(o);t.ajax({type:"GET",data:{provider:e,post_id:o},dataType:"json",url:tribe.tickets.utils.getRestEndpoint(),success(t){null===r&&sessionStorage.setItem("tribe_tickets_attendees-"+o,JSON.stringify(t.meta)),sessionStorage.setItem("tribe_tickets_cart-"+o,JSON.stringify(t.tickets)),i={meta:t.meta,tickets:t.tickets},c.resolve(i)},error(){c.reject(!1)}})}return c.promise()},e.ready=function(){s.on("beforeunload",(function(){window.tribe.tickets.modal_redirect?tribe.tickets.data.clearLocal():s.find(tribe.tickets.block.selectors.container).each((function(s,i){const c=t(i).find(tribe.tickets.block.selectors.form).data("post-id");e.data.storeLocal(c)}))}))},t(e.ready)}(jQuery,tribe.tickets.data),window.ticketsPlus=window.ticketsPlus||{},window.ticketsPlus.v2=window.ticketsPlus.v2||{},window.ticketsPlus.v2.ticketsData={};