// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,r,t){var a=Scanner.fromMessage(e);a.setLocale(r);var n,i,p,o,s,m,g,d,l,u,h,c,v,T,C,y,A,N,b,$,x=[],S={};for(n=a.getSpan().next(t.reservationId).parentAnyTag("td").tagContents().innerCapture(regExpFormatted(/\1[\s\n]*(\w*)/),1),s=a.getSpan().next(t.departs).parentAnyTag("table").allInnerTags("tr3"),N=0;N<s.length;N++)s[N].innerDate().exists()&&(y=s[N],b=y.nextAnyTag("td").nextAnyTag("td").nextAnyTag("td").tagContents(),d=b.nextAnyTag("td").tagContents(),c=d.nextAnyTag("td").tagContents(),o=c.nextAnyTag("td").tagContents(),A=o.nextAnyTag("td").nextAnyTag("td").tagContents(),p=A.nextAnyTag("td").tagContents(),b=b.innerCapture(/($<airlineName>\w+)\s+($<flightNumber>\d+)/),g=b.$airlineName,m=b.$flightNumber,d=d.innerCapture(/($<departureAirport>.*)\s+\(($<departureCode>.*)\)($<departureTime>[\s\S]*)/),u=d.$departureAirport,h=d.$departureCode,l=a.getDetachedSpan((""+d.$departureTime).replace(/\n/g," ")).innerDate(),c=c.innerCapture(/($<arrivalAirport>.*)\s+\(($<arrivalCode>.*)\)($<arrivalTime>[\s\S]*)/),T=c.$arrivalAirport,C=c.$arrivalCode,v=a.getDetachedSpan((""+c.$arrivalTime).replace(/\n/g," ")).innerDate(),S={},S[(""+A).trim()]={name:(""+A).trim(),seats:(""+p).trim(),seatingType:(""+o).replace(/\n/g," ").trim()},ASSERT(g,m,u,h,l,T,C,v)&&x.push({airlineName:g,flightNumber:m,reservationId:n,departureAirport:u,departureCode:h,departureTime:l,arrivalAirport:T,arrivalCode:C,arrivalTime:v,passengers:S}));var f=[];for(N=0;N<x.length;N++)for(var k=x[N],F=Object.keys(k.passengers),z=0;z<F.length;z++){var I=k.passengers[F[z]];/alaska/i.test(k.airlineName)&&(k.airlineCode="AS"),$={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:k.airlineName,airlineCode:k.airlineCode,flightNumber:k.flightNumber,departureAirportFuzzy:k.departureAirport,departureAirportCode:k.departureCode,departureTime:k.departureTime,arrivalAirportFuzzy:k.arrivalAirport,arrivalAirportCode:k.arrivalCode,arrivalTime:k.arrivalTime},underName:{"@type":"http://schema.org/Person",name:I.name},checkinUrl:i,reservationStatus:"http://schema.org/Reservation"+(k.reservationStatus||"Confirmed"),reservationId:valid(k.reservationId)?k.reservationId:n,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:I.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:I.seats,seatingType:I.seatingType}},totalPrice:I.totalPrice,priceCurrency:I.priceCurrency},not(I.membershipNumber)||($.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:I.membershipNumber,programName:I.programName}),f.push($)}if(f.length)return f}}).call();