// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,r,t){var a=Scanner.fromMessage(e);a.setLocale(r);var i,n=a.getSpan(),o=t.isCancellation?"Cancelled":"Confirmed",p=[],l=[],s=[];return i=n.next(t.reservationIdPrefix).nextAnyTag("td").tagContents(),n.next(t.passengerBlockPrefix).nextTag("table4").allInnerTags("tr4").slice(2).forEach(function(e){var r=e.allInnerTags("td4").map(function(e){return e.tagContents()});p.push({name:r[0]})}),0===p.length&&p.push({}),n.next(t.flightsBlockPrefix).nextAnyTag("table").allInnerTags("tr3").slice(1,-2).forEach(function(e){var r=e.allInnerTags("td3").map(function(e){return e.tagContents()});if(4===r.length){var t,i,n,o,p,l,u,c,d,g,h,m,f=r[1].tagContents().innerCapture(/([0-9A-Z]{2})(\d{1,4})/);t=f[1],i=f[2];var v=r[2].split(/\n/);p=v[1],l=v[2],n=v[3];var C=r[3].split(/\n/);g=C[1],h=C[2],c=C[3],u=a.getDetachedSpan(p+" "+l.split("/")[0].replace(/(\d{2})(\d{2})/,"$1:$2").innerDate()),m=a.getDetachedSpan(g+" "+h.split("/")[0].replace(/(\d{2})(\d{2})/,"$1:$2")).innerDate(),s.push({airlineCode:t,flightNumber:i,departureAirport:n,departureAirportCode:o,departureDateTime:u,arrivalAirport:c,arrivalAirportCode:d,arrivalDateTime:m})}}),s.forEach(function(e){p.forEach(function(r){ASSERT(e.airlineCode,e.flightNumber,e.departureAirport,e.departureDateTime),l.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:i,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}}})})}),l}}).call();