(function(){return function(e,r,t){if(!e||!r||!t)return CONTINUE;var a=Scanner.fromMessage(e);a.setLocale(r);var n,i,p,m,s,l,o,g,u,d,c,h,x,v,C,T,b,N,f,y,$,S,F=[],E={};i=a.getSpan().nextRegExp(regExpFormatted(/\1/,t.travellers)).nextAnyTag("table");var k=i.getTagNumber();if(i=i.allInnerTags("tr"+k).map(function(e){return e.allInnerTagsFiltered("td"+k)}),!i.length)return CONTINUE;m=a.getSpan().nextText(t.priceSummary).nextText(t.totalPrice).parentTag("td5").tagContents(),s=m.innerCapture(regExpFormatted(/\1.*?([\d,.]+)/,t.totalPrice),1),l=s.nextTag("td5").tagContents().innerCapture(regExpFormatted(/\b\1 ([\w ]+)\.?/,t.priceCurrency),1),o=a.getSpan().next(t.flightResPrefix).nextTag("td6").tagContents(),o.exists()||(o=a.getSpan().innerCapture(regExpFormatted(/\1 (\d+)/,t.reservationId),1)),a.getSpan().nextRegExp(regExpFormatted(/\1/,t.cancelled)).exists()?g="Cancelled":a.getSpan().next(t.pending).exists()&&(g="Pending");for(var I=0;I<i.length;I++)p=i[I],n=p[0].innerCapture(/(.*)\s/,1).trim(),C=p[1].innerCapture(regExpFormatted(/^\1/,t.noProgramName))?null:p[1].innerCapture(/($<name>.*) ($<number>\w+)/),p[2]&&(v=p[2].innerCapture(regExpFormatted(/^\1 (\d+)/,t.ticketNumber),1)),E[""+n]={name:n,totalPrice:s,priceCurrency:l,seats:{},seatingType:{},programName:C?C.$name:null,membershipNumber:C?C.$number:null,ticketNumber:v};x=a.getSpan().nextRegExp(regExpFormatted(/\1/,t.travellers));for(var P=/^($<code>[A-Z]{3})\s+($<time>\d{1,2}:\d{2}(?:am|pm)?)($<nextDay>\s+\+1)?/;x.nextText(t.totalTravelTime).exists();){x=x.nextText(t.totalTravelTime),c=a.getDetachedSpan((""+x.previousTag("td"+(k-1)).tagContents()).replace(",","")).innerDate(),x=x.nextTag("table"+k),h=x.allInnerTagsFiltered("td"+k);for(var A,D,R,z=0;A=h[z];z++)if(A.innerCapture(P)&&h[z+1]&&h[z+1].innerCapture(P)&&h[z+3]){A=A.innerCapture(P),y=A.$code,f=a.getDetachedSpan(c+" "+A.$time).innerDate(),D=h[z+1].innerCapture(P),R=D.$nextDay,S=D.$code,$=a.getDetachedSpan(((""+R).length?""+h[z+1].lastInnerDate():""+c)+" "+D.$time),h[z+1].nextText(t.checkin).exists()&&z++,/\d+/.test(""+h[z+2])||z++,T=h[z+2].innerCapture(/($<name>.*)\s($<flightNumber>\d+)/),b=T?T.$name.trim():null,N=T?T.$flightNumber:null,u=h[z+3].innerCapture(/($<type>.*?) \| ($<list>[^|]+)/);var U=u?u.$type:null;if(d=u&&u.$list.innerCapture(regExpFormatted(/^\1/,t.seat))?u.$list.innerCapture(regExpFormatted(/^\1 (.*)/,t.seat),1).split(",").map(function(e){return e.trim()}):null,valid(N)){i=Object.keys(E);for(var I=0;I<i.length;I++)valid(d)&&(E[i[I]].seats[""+N]=d[I]),valid(U)&&(E[i[I]].seatingType[""+N]=U)}ASSERT(b,N,y,f,S,$)&&F.push({airlineName:b,flightNumber:N,reservationId:o,reservationStatus:g,departureCode:y,departureTime:f,arrivalCode:S,arrivalTime:$,passengers:E})}}for(var O,M=[],z=0;z<F.length;z++){O=F[z];for(var j=Object.keys(O.passengers),w=0;w<j.length;w++){var L=O.passengers[j[w]],Z={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:O.airlineName,airlineCode:O.airlineCode,flightNumber:O.flightNumber,departureAirportFuzzy:O.departureAirport,departureAirportCode:O.departureCode,departureTime:O.departureTime,arrivalAirportFuzzy:O.arrivalAirport,arrivalAirportCode:O.arrivalCode,arrivalTime:O.arrivalTime},underName:{"@type":"http://schema.org/Person",name:L.name},checkinUrl:O.checkinUrl,reservationId:O.reservationId,reservationStatus:"http://schema.org/Reservation"+(O.reservationStatus||"Confirmed"),totalPrice:L.totalPrice,priceCurrency:L.priceCurrency,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:L.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:L.seats[O.flightNumber],seatingType:L.seatingType[O.flightNumber]}}};valid(L.membershipNumber,L.programName)&&(Z.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:L.membershipNumber,programName:L.programName}),M.push(Z)}}return M.length?M:void 0}}).call();