(function(){function e(e,r){for(var t=0;t<e.length;)r.test(e[t])?e.splice(t,1):t++;return e}return function(r,t,a){var n=Scanner.fromMessage(r);n.setLocale(a);var i,p,l,o,m,s,g,u,d,T,h,v,b,c,C,A,x,f,N,l,o,y=[],F={},$=n.getSpan().next(t.total);(""+$).length>0&&(h=$.nextTag("table5").nextTag("table5").nextTag("table5").nextTag("table5").nextTag("table5").nextTag("table5").nextTag("td5").tagContents(),l=h.innerCapture(/([\d,.]+)/,1),o=h.innerCapture(/([^\d,.]+)/,1)),i=""+n.getSpan().innerCapture(t.reservationId,1),A=n.getSpan().nextRegExp(/Ticket number\(s\)/).nextTag("table3").nextTag("table3").allInnerTagsFiltered("td3");for(var k=0;k<A.length;k++)A[k].innerCapture(/($<name>.*) <.*?>/)&&(C=A[k].innerCapture(/($<name>.*) <.*?>/,1),x=A[k+1]&&A[k+1].innerCapture(/^([0-9A-Z]+)$/,1)),valid(C)&&(F[""+C]={name:C,ticketNumber:x,seats:{},seatingType:{},frequentFlier:""}),C=null;for(f=n.getSpan().next(t.terminal).nextTag("table4").nextTag("table4").allInnerTags("table5"),m=0;m<f.length;m+=5){v={},d=f[m].innerDate(),b=f[m+1].allInnerDates(),v.departureTime=combineDateAndTime(d,b[0]),v.arrivalTime=combineDateAndTime(d,b[1]),Date.parse(v.departureTime)>Date.parse(v.arrivalTime)&&(v.arrivalTime=modifyDate(v.arrivalTime,1)),c=f[m+2].nextAnyTag("td").tagContents().innerCapture(regExpFormatted(/($<departureAirport>.*)\s+\(($<departureCode>.*)\)\s+\1\s+($<arrivalAirport>.*)\s+\(($<arrivalCode>.*)\)/,t.to)),v.departureAirport=c.$departureAirport,v.departureCode=c.$departureCode,v.arrivalAirport=c.$arrivalAirport,v.arrivalCode=c.$arrivalCode,v.flightNumber=f[m+3].nextAnyTag("td").tagContents();var T=f[m+4].nextTag("table6"),S=T.nextTag("table6"),D=S.nextTag("table6");N=Object.keys(F);var z=(""+T.nextAnyTag("td").tagContents()).split(/\s\n\n/),I=e((""+S.nextAnyTag("td").tagContents()).split(/\n\n/),/\[/),R=e((""+D.nextAnyTag("td").tagContents()).split(/\n\n/),/\[/);for(g=0;g<N.length;g++)F[z[g]].seats[""+v.flightNumber]=/select seat/i.test(R[g])?"":R[g],u=I[g],F[z[g]].membershipNumber="N/A"===u?"":u,valid(u)&&(F[z[g]].programName="Frequent Flyer");ASSERT(v.flightNumber,v.departureTime,v.arrivalTime,v.departureCode,v.arrivalCode)&&y.push({flightNumber:v.flightNumber,departureTime:v.departureTime,departureCode:v.departureCode,departureAirport:v.departureAirport,arrivalTime:v.arrivalTime,arrivalCode:v.arrivalCode,arrivalAirport:v.arrivalAirport,passengers:F})}var E=[];for(m=0;m<y.length;m++){var v=y[m];for(N=Object.keys(v.passengers),s=0;s<N.length;s++){var M=v.passengers[N[s]],P={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",flightNumber:v.flightNumber,departureAirportFuzzy:v.departureAirport,departureAirportCode:v.departureCode,departureTime:v.departureTime,arrivalAirportFuzzy:v.arrivalAirport,arrivalAirportCode:v.arrivalCode,arrivalTime:v.arrivalTime},underName:{"@type":"http://schema.org/Person",name:M.name},checkinUrl:p,reservationId:i,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:l,priceCurrency:o,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:M.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:M.seats[v.flightNumber],seatingType:M.seatingType[v.flightNumber]}}};valid(M.membershipNumber,M.programName)&&(P.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:M.membershipNumber,programName:M.programName}),E.push(P)}}if(E.length)return E}}).call();