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