// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,r){var a=Scanner.fromMessage(e);a.setLocale(t);var n,i,o,p,s,g=a.getSpan(),l=[],x=[];if(r.isETicket.test(e.subject))n=g.nextText(r.underPersonNameETicket_prefix).nextTag("td1").nextTag("td1").tagContents();else{var c=g.nextText(r.underPersonBlock_prefix),u=c.nextText(r.underPersonFirstName_prefix).nextTag("td3").tagContents(),d=c.nextText(r.underPersonLastName_prefix).nextTag("td3").tagContents();n=u+" "+d}if(i=g.innerCapture(regExpFormatted(/\1 ([a-zA-Z0-9]+)./,r.reservationId_prefix),1),g.nextText(r.totalPrice_prefix)!==a.getNullSpan()){var T=g.nextText(r.totalPrice_prefix).nextTag("td1").nextTag("td1").nextTag("td1").nextTag("td1").tagContents();[,p,o]=/^(.*) (.*)$/.exec(T)}s=g.nextText(r.checkinUrl_prefix).nextLink(),l=g.nextRegExp(r.reservationForBlock_prefix).nextTag("table1").allInnerTags("tr2"),g.nextText(r.isReservationChange)!==a.getNullSpan()&&delete l[0];var m=function(t,n){t.forEach(function(t){var i,o,p,s,l,x,c,u,d,T,m;r.isETicket.test(e.subject)&&(s=g.nextText(r.ticketNumber_prefix).nextTag("td1").nextTag("td1").tagContents()),i=g.innerCapture(regExpFormatted(/\1(.*)\n(.*)\n([a-zA-Z0-9 ]+)</,r.reservationForBlock_prefix),4),l=g.innerCapture(regExpFormatted(/\1 (.*) </,r.seatType_prefix),1);var C=t.allInnerTags("td2"),h=C[5].tagContents();[,o,p]=/^([a-zA-Z]+) ([a-zA-Z0-9]+)/.exec(h),c=C[2].tagContents(),[,u]=/\((.*)\)/.exec(c),T=C[4].tagContents(),[,m]=/\((.*)\)/.exec(T),x=(""+C[1].tagContents()).slice(0,-1),x=a.getDetachedSpan(x).innerDate(),x===a.getNullSpan()&&(x=C[1].tagContents()),d=(""+C[3].tagContents()).slice(0,-1),d=a.getDetachedSpan(d).innerDate(),d===a.getNullSpan()&&(d=C[3].tagContents()),n({airlineName:i,airlineCode:o,flightNumber:p,departureDateTime:x,departureAirport:c,departureAirportCode:u,arrivalDateTime:d,arrivalAirport:T,arrivalAirportCode:m,ticketNumber:s,seatType:l})})};return m(l,function(e){ASSERT(e.flightNumber,e.departureAirport,e.arrivalAirport)&&x.push({"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:e.airlineName,airlineCode:e.airlineCode,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:n},checkinUrl:s,reservationId:i,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:o,priceCurrency:p,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:e.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:e.seatNumber,seatingType:e.seatType}}})}),x.length>=1?x:CONTINUE}}).call();