// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,n){var r=Scanner.fromMessage(e);r.setLocale(t);var a,i,s,o,c,p,g,h,v,d,m,f,x,S=[];a=r.getSpan().innerCapture(n.reservationIdRegExp,1).trim(),i=r.getSpan().innerCapture(n.nameRegExp,1).trim(),s=r.getSpan().next(n.pricePrefix).nextTag("td1").tagContents(),s&&s.exists()&&(o=s.innerCapture(/([\d,.]+)/,1),c=s.innerCapture(/([^\d,.]+)/,1).trim()),f=r.getDetachedSpan(""+r.getSpan().next(n.ticketDetailsPrefix).withEnd(r.getSpan().next(n.ticketDetailsPrefix).next(n.ticketDetailsSuffix).getStart())),d=f.allInnerTags("tr1"),d.forEach(function(e){if(m=e.allInnerTags("td1"),p=m[0].innerCapture(n.eventDetailsRegExp),p&&4===p.length&&(h=p[1].trim(),g=p[2].trim(),v=p[3].innerDate(),g&&(x=r.getSpan().next(n.eventAddressPrefix).next(g).nextAddress()),ASSERT(v))){var t={startDate:v,eventName:h,eventLocation:g,eventAddress:x};S.push(t)}});var u=[];if(S.forEach(function(e){if(ASSERT(a)){var t={"@context":"http://schema.org","@type":"http://schema.org/EventReservation",name:i,totalPrice:o,priceCurrency:c,reservationStatus:"http://schema.org/ReservationConfirmed",reservationId:a,reservedTicket:{"@type":"http://schema.org/Ticket",ticketedSeat:{"@type":"http://schema.org/Seat"}},reservationFor:{"@type":"http://schema.org/Event",eventStatus:"http://schema.org/EventConfirmed",name:e.eventName,startDate:e.startDate,location:{"@type":"http://schema.org/Place",name:e.eventLocation,address:e.eventAddress}}};u.push(t)}}),u.length)return u}}).call();