// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,r){if(!e||!t||!r)return CONTINUE;var a=Scanner.fromMessage(e);a.setLocale(t);var n,i,p,g,o,m,d,u,l,s,T=[];for(n=a.getSpan().nextText(r.passenger).nextTag("tr4").nextTag("tr4").nextTag("tr4").innerTag("td4").nextTag("td4").tagContents().innerCapture(regExpFormatted(/\.(.*)/),1).trim(),m=a.getDetachedSpan(e.subject).innerCapture(regExpFormatted(/(\w+)$/),1),d=a.getSpan().nextText(r.totalPayment).previousText(r.total).nextTag("td4").tagContents(),i=d.innerCapture(regExpFormatted(/([\d\.,\s]+)/),1).trim(),p=d.innerCapture(regExpFormatted(/([^\d\.,\s]+)/),1).trim(),u=a.getSpan().nextText(r.flightData).parentTag("table4").allInnerTagsFiltered("tr4"),l=1;l<u.length;l+=2){s={};var h=u[l],c=u[l+1],x=h.innerCapture(regExpFormatted(/\1.* (..) (\d{2,})/,r.number));3===x.length&&(s.airlineCode=x[1],s.flightNumber=x[2]),s.departureAirport=c.nextTag("tr5").innerTag("td5").tagContents().innerCapture(regExpFormatted(/[\d:]+(.*)/),1).trim(),s.departureTime=getFuzzyDate(a.getDetachedSpan(h.innerDate()+" "+c.firstDate())),s.arrivalAirport=c.nextTag("tr5").innerTag("td5").nextTag("td5").tagContents().innerCapture(regExpFormatted(/[\d:]+(.*)/),1).trim(),s.arrivalTime=a.getDetachedSpan(h.innerDate()+" "+c.firstDate().nextDate()),s.seatingNumber=c.innerCapture(regExpFormatted(/\1: (.+)/,r.seat),1),ASSERT(s.departureTime,s.arrivalTime,s.departureAirport,s.arrivalAirport,s.flightNumber)&&T.push(s)}var v=[];for(l=0;l<T.length;l++){s=T[l];var C={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:s.airlineName,airlineCode:s.airlineCode,flightNumber:s.flightNumber,departureAirportFuzzy:s.departureAirport,departureAirportCode:s.departureIata,departureTime:s.departureTime,arrivalAirportFuzzy:s.arrivalAirport,arrivalAirportCode:s.arrivalIata,arrivalTime:s.arrivalTime},underName:{"@type":"http://schema.org/Person",name:n},checkinUrl:o,reservationId:m,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:i,priceCurrency:p,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:g,ticketedSeat:{"@type":"http://schema.org/Seat",seatingType:s.seatingType,seatNumber:s.seatingNumber}}};v.push(C)}return v.length?v:CONTINUE}}).call();