// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,r){var a=Scanner.fromMessage(e);a.setLocale(t);var n,i,g,o,s,p,m,l,u,c,d,h,b,C,T,N,v,x,y,f,S,$,k,z=[],A={};n=a.getSpan().nextText(r.confirmationCode).parentTag("table2").tagContents().innerCapture(r.confirmationCodeRegex,1);var F=a.getSpan().nextText(r.passengerInfo).parentTag("table2").nextTag("td2").nextTag("td2").nextTag("td2").nextTag("td2");o=F.nextTag("td2").tagContents(),S=F.nextTag("td2").nextTag("td2").tagContents(),d=F.nextTag("td2").nextTag("td2").nextTag("td2").tagContents().innerCapture(/($<programName>\D+)($<membershipNumber>\d+)/),k=d?d.$programName:null,$=d?d.$membershipNumber:null,c=a.getSpan().nextText(r.totalPrice).nextTag("td2").tagContents().innerCapture(/($<currency>\w+)\s($<totalPrice>.+)/),l=c?c.$totalPrice:null,u=c?c.$currency:null,A[g]={name:o,programName:k,membershipNumber:$,ticketNumber:S,seats:{},seatingType:{},totalPrice:l,priceCurrency:u},i=a.getSpan().nextText(r.checkinUrl).nextTag("td2").innerLink(),p=a.getSpan().nextText(r.itinerary).parentTag("table2").allInnerTags("td2");for(var P=8;P<p.length;P+=14){var s=""+p[P].tagContents();s=s.substring(0,2)+" "+s.substring(2,5);var D=p[P+7].tagContents();T=getFuzzyDate(a.getDetachedSpan(s+" "+D).firstDate()),s=""+p[P+4].tagContents(),s=s.substring(0,2)+" "+s.substring(2,5),D=p[P+11].tagContents(),x=getFuzzyDate(a.getDetachedSpan(s+" "+D).firstDate()),N=p[P+2].tagContents(),v=p[P+9].tagContents(),y=p[P+3].tagContents(),f=p[P+10].tagContents(),h=p[P+1].tagContents().innerCapture(/($<code>\w+)\s($<flightNumber>\d+)/),C=h?h.$code:null,m=h?h.$flightNumber:null,ASSERT(C,m,T,N,x,y)&&z.push({airlineCode:C,airlineName:b,flightNumber:m,departureAirport:N,departureCode:v,departureTime:T,arrivalAirport:y,arrivalCode:f,arrivalTime:x,passengers:A})}for(var R=[],P=0;P<z.length;P++)for(var I=z[P],M=Object.keys(I.passengers),U=0;U<M.length;U++){var F=I.passengers[M[U]],w={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:I.airlineName,airlineCode:I.airlineCode,flightNumber:I.flightNumber,departureAirportFuzzy:I.departureAirport,departureAirportCode:I.departureCode,departureTime:I.departureTime,arrivalAirportFuzzy:I.arrivalAirport,arrivalAirportCode:I.arrivalCode,arrivalTime:I.arrivalTime},underName:{"@type":"http://schema.org/Person",name:F.name,email:F.email},checkinUrl:i,reservationId:n,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:F.totalPrice,priceCurrency:F.priceCurrency,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:F.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:F.seats[I.flightNumber],seatingType:F.seatingType[I.flightNumber]}}};valid(F.membershipNumber,F.programName)&&(w.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:F.membershipNumber,programName:F.programName}),R.push(w)}if(R.length)return R}}).call();