// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,r,t){var a=Scanner.fromMessage(e);a.setLocale(r);var n,i=a.getSpan(),o=t.isCancellation?"Cancelled":"Confirmed",l=[],p=[],s=[];n=i.next(t.reservationIdPrefix).parentAnyTag("td").tagContents().innerCapture(/\s([A-Z0-9]{6})\s/,1),i.next(t.passengerBlockPrefix).nextTag("table3").allInnerTags("table4").filter(function(e,r){return r%2===0}).forEach(function(e){l.push({name:e.allInnerTags("td4")[0].tagContents()})}),0===l.length&&l.push({});for(var u=i.next(t.flightsBlockPrefix).nextTag("table2").allInnerTags("table4"),d=function(e){return e.tagContents()},m=0;m<u.length;m+=3){var c,g,h,f,T,v,C,A,b,x=u[0].allInnerTags("td4").map(d).map(function(e){return""+e}).join(" "),y=u[1].allInnerTags("td4").map(d);u[2].allInnerTags("td4").map(d);f=x.replace(t.dateTimeRegExp,t.dateTimeReplacer),[,c,g]=y[1].innerCapture(/([A-Z0-9]{2})(\d{1,4})/),y=(""+y[5]).split(/\n/),[,T,h]=y.shift().match(/\s+(\d{1,2}:\d{2})\s+(.+)/),[,A,C]=y.join(" ").match(/\s+(\d{1,2}:\d{2})\s+(.+)/),v=a.getDetachedSpan(f+" "+T),b=a.getDetachedSpan(f+" "+A),s.push({airlineCode:c,flightNumber:g,departureAirport:h.trim(),departureDateTime:v,arrivalAirport:C.trim(),arrivalDateTime:b})}return s.forEach(function(e){l.forEach(function(r){ASSERT(e.airlineCode,e.flightNumber,e.departureAirport,e.departureDateTime),p.push({"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineCode:e.airlineCode,airlineName:e.airlineName,flightNumber:e.flightNumber,departureAirportFuzzy:e.departureAirport,departureAirportCode:e.departureAirportCode,departureTime:e.departureDateTime,arrivalAirportFuzzy:e.arrivalAirport,arrivalAirportCode:e.arrivalAirportCode,arrivalTime:e.arrivalDateTime},underName:{"@type":"http://schema.org/Person",name:r.name},reservationId:n,reservationStatus:"http://schema.org/Reservation"+o,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:r.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:r.seat,seatingType:null}}})})}),p}}).call();