(function(){return function(e,t,r){var a=Scanner.fromMessage(e);a.setLocale(t);var n,i,s,g,o,p,m,l,d,u,T,c,h,C,x,f,b,v,y,A,N,S=[],F={};r.isCancelled&&(T="Cancelled");var I=a.getSpan().nextRegExp(/[Cc]onfirmation code:/).parentAnyTag("td").tagContents().innerCapture(/\b[Cc]onfirmation code:\s+(\w+)/,1),E={};if(not(I)){I=a.getSpan().nextRegExp(/Confirmation code:/).nextAnyTag("td").tagContents(),C=a.getSpan().nextRegExp(/Confirmation code:/).parentAnyTag("table"),o=int(C.getTagNumber())+1,C=C.nextTag("table"+o).allInnerTags("tr"+o).map(function(e){return e.allInnerTagsFiltered("td"+o)}).filter(function(e){return 2===e.length});for(var R=0;R<C.length;R++)E[C[R][1].innerCapture(/^([\w ]+)/,1).trim()]=""+C[R][0]}g=a.getSpan().nextText("Passenger name").parentTag("table3").withStart(a.getSpan().nextText("Passenger name").getEnd()).allInnerTags("tr3"),c=a.getSpan().nextText("Total fare (All passengers)").nextAnyTag("td").tagContents().innerCapture(/([\d,.]+)/,1);for(var k=0,D=g.length;k<D;k++)C=g[k].allInnerTags("td3").map(function(e){return e.tagContents()}),s=""+C[0],F[s]={name:s,programName:"Frequent Flyer",membershipNumber:""+C[1]!="None listed"&&C[1],ticketNumber:C[2],seats:{},seatingType:{},totalPrice:c,priceCurrency:h};d=a.getSpan().nextRegExp(/[Tt]rip details/).parentTag("table3").allInnerTags("table4").filter(function(e){return/(FLIGHT|DEPART)/.test(e)||e.innerDate().exists()});for(var P=/Flight # (\d+) : Arrives next day,/,w=0;w<d.length;w++)if(d[w].innerText("FLIGHT#").exists()&&d[w-1]&&d[w+1]){/Stop: Change plane/.test(d[w].previousAnyTag("table"))||(l=d[w-1].tagContents().innerDate()),u=d[w].tagContents().innerCapture(/FLIGHT# (\w+)/,1),x=d[w].tagContents().innerCapture(/Operated by (.+)/,1).replace(/flight # \d+/,""),f=d[w+1].nextText("DEPART").nextTag("td4").nextTag("td4").tagContents(),b=combineDateAndTime(l,f.innerDate()),v=f.innerCapture(/\s([A-Z]{3})$/,1),y=d[w+1].nextText("ARRIVE").nextTag("td4").nextTag("td4").tagContents(),A=combineDateAndTime(l,y.innerDate()),d[w+2]&&d[w+2].innerCapture(P)&&(A=modifyDate(A,1)),N=y.innerCapture(/\s([A-Z]{3})/,1),n=E[""+x]||I;var z=d[w+1].nextText("CABIN").nextTag("td4").nextTag("td4").tagContents();for(m=[],p=d[w+1].nextText("SEATS").nextTag("td4").nextTag("td4").tagContents();p.innerCapture(/([\dA-Z]+) </,1).exists();){var L=p.innerCapture(/(\w+) </,1);m.push(L),p=p.withStart(L.getEnd())}if(valid(u)){g=Object.keys(F);for(var k=0;k<g.length;k++)F[g[k]].seats[""+u]=m[k],F[g[k]].seatingType[""+u]=z}ASSERT(u,b,v,A,N)&&S.push({airlineName:x,flightNumber:u,departureCode:v,departureTime:b,arrivalCode:N,arrivalTime:A,reservationId:n,passengers:F})}for(var G=[],w=0;w<S.length;w++)for(var H=S[w],M=Object.keys(H.passengers),O=0;O<M.length;O++){var U=H.passengers[M[O]],Z={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:H.airlineName.trim(),airlineCode:H.airlineCode||"US",flightNumber:H.flightNumber,departureAirportFuzzy:H.departureAirport,departureAirportCode:H.departureCode,departureTime:H.departureTime,arrivalAirportFuzzy:H.arrivalAirport,arrivalAirportCode:H.arrivalCode,arrivalTime:H.arrivalTime},underName:{"@type":"http://schema.org/Person",name:U.name,email:U.email},checkinUrl:i,reservationId:H.reservationId,reservationStatus:"http://schema.org/Reservation"+(T||"Confirmed"),totalPrice:U.totalPrice,priceCurrency:U.priceCurrency,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:U.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:U.seats[H.flightNumber],seatingType:U.seatingType[H.flightNumber]}}};valid(U.membershipNumber,U.programName)&&(Z.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:U.membershipNumber,programName:U.programName}),G.push(Z)}if(G.length)return G}}).call();