// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,r,t){var a=Scanner.fromMessage(e);a.setLocale(r);var n,i,p,o,m,g,s,l,u,h,d,c,v,C,N,T,b=[],f={};s=a.getSpan(),i=s.next(t.reservationId).innerCapture(t.reservationId,1);for(var y=a.getSpan().next(t.ticket).nextTag("table2").allInnerTags("td2"),x=0;x<y.length;x++){if(o=y[x].tagContents().trim(),n=y[x].previousPhoneNumber(),not(o))return CONTINUE;f[""+o]={name:o,seats:{},seatingType:{},ticketNumber:""+n,totalPrice:null,priceCurrency:null}}var S;do{S=S?S.next(t.leg):s.next(t.leg),m=S.next(t.departure).parentTag("table4").allInnerTags("td4");var I=m[1].previousDate();h=m[1].tagContents().trim(),c=m[4].tagContents().trim(),h=a.getDetachedSpan(I+" "+h),c=a.getDetachedSpan(I+" "+c),d=m[2].tagContents().trim(),v=m[5].tagContents().trim();var A=m[1].next(t.flightInfos).parentTag("tr3").allInnerTags("td3")[1].tagContents().innerCapture(t.flightSummary);g=A.$flightNumber,u=A.$airlineCode,l=A.$airlineName,C=a.getSpan().next(t.price).nextTag("td4").nextTag("td4"),N=a.getDetachedSpan(C.tagContents().innerCapture(regExpFormatted(/([\d\.,]+)/),1)+C.nextTag("td4").tagContents().trim()),T=C.tagContents().innerCapture(regExpFormatted(/([^\d\.,]+)/),1).trim(),ASSERT(u,g,d,h,v,c)&&b.push({reservationId:i,airlineName:l,airlineCode:u,flightNumber:g,departureAirport:d,departureTime:h,arrivalAirport:v,arrivalTime:c,passengers:f})}while(0!==(""+S.next(t.leg)).length);for(var k=[],x=0;x<b.length;x++)for(var F=b[x],z=Object.keys(F.passengers),P=0;P<z.length;P++){var D=F.passengers[z[P]],E={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:F.airlineName,airlineCode:F.airlineCode,flightNumber:F.flightNumber,departureAirportFuzzy:F.departureAirport,departureAirportCode:F.departureCode,departureTime:F.departureTime,arrivalAirportFuzzy:F.arrivalAirport,arrivalAirportCode:F.arrivalCode,arrivalTime:F.arrivalTime},underName:{"@type":"http://schema.org/Person",name:D.name},checkinUrl:p,reservationId:F.reservationId,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:N,priceCurrency:T,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:n,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:D.seats[F.flightNumber],seatingType:D.seatingType[F.flightNumber]}}};valid(D.membershipNumber,D.programName)&&(E.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:D.membershipNumber,programName:D.programName}),k.push(E)}if(k.length)return k}}).call();