// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,r){var a=Scanner.fromMessage(e);a.setLocale(t);var n,i,p,o,g,s,l,m,d,u,h,c,T,v,C,x=[];for(n=a.getSpan().next(r.name).parentAnyTag("td").tagContents().innerCapture(regExpFormatted(/\1\s+(.*)/,r.name),1),p=a.getSpan().next(r.reservationId).parentAnyTag("td").tagContents().innerCapture(regExpFormatted(/\1\s+(.*)</,r.reservationId),1),o=p.nextAnyTag("td").innerLink(),v=a.getSpan().next(r.departure).parentTag("table5").allInnerTags("tr5"),c=1;c<v.length;c++)v[c].tagContents().innerRegExp(r.departure).exists()?(u=v[c].tagContents().innerRegExp(r.departure),h=u.previousAnyTag("th").tagContents()):v[c].innerDate().exists()&&(u=v[c],T={},C=u.nextTag("td6").tagContents().innerCapture(/($<airline>[^\d]+)\s+($<flightNumber>\d+)/),T.airlineName=C.$airline,T.flightNumber=C.$flightNumber,T.airlineCode=/delta/gi.test(T.airlineName)?"DL":null,T.departureAirport=T.flightNumber.nextTag("td6").nextTag("td6").tagContents(),T.departureTime=a.getDetachedSpan(""+h+" "+T.departureAirport.nextTag("td6").tagContents()).lastInnerDate(),T.arrivalAirport=T.departureAirport.nextTag("td6").nextTag("td6").tagContents(),i=(""+T.arrivalAirport.nextTag("td6").tagContents()).replace("N"," pm"),T.seatNumber=T.arrivalAirport.nextTag("td6").nextTag("td6").tagContents().innerCapture(regExpFormatted(/\1\s+(.*)/,r.seat),1),i=/\*\*/.test(i)?i.replace("**","").replace(/\n/,""):h+" "+i,T.arrivalTime=a.getDetachedSpan(i).lastInnerDate(),ASSERT(T.airlineName,T.flightNumber,T.departureAirport,T.departureTime,T.arrivalAirport,T.arrivalTime)&&x.push(T));var N=[];for(c=0;c<x.length;c++){T=x[c];var A={"@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:n},checkinUrl:o,reservationId:(""+p).trim(),reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:s,priceCurrency:l,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:g,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:T.seatNumber,seatingType:T.seatingType}}};valid(m,d)&&(A.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:m,programName:d}),N.push(A)}if(N.length)return N}}).call();