(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,l,s,o,g,u,d,c,h,v,x,C,T,b,N,y,f,$,F,S=[],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(),l=m.innerCapture(regExpFormatted(/\1.*?([\d,.]+)/,t.totalPrice),1),s=l.nextTag("td5").tagContents().innerCapture(regExpFormatted(/\b\1 ([\w ]+)\.?/,t.priceCurrency),1),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]&&(x=p[2].innerCapture(regExpFormatted(/^\1 (\d+)/,t.ticketNumber),1)),E[""+n]={name:n,totalPrice:l,priceCurrency:s,seats:{},seatingType:{},programName:C?C.$name:null,membershipNumber:C?C.$number:null,ticketNumber:x};v=a.getSpan().nextRegExp(regExpFormatted(/\1/,t.travellers));for(var A=/^($<code>[A-Z]{3})\s+($<time>\d{1,2}:\d{2}(?:am|pm)?)($<nextDay>\s+\+1)?/;v.nextText(t.totalTravelTime).exists();){v=v.nextText(t.totalTravelTime),c=a.getDetachedSpan((""+v.previousTag("td"+(k-1)).tagContents()).replace(",","")).innerDate(),v=v.nextTag("table"+k),h=v.allInnerTagsFiltered("td"+k);for(var P,D,z,R=0;P=h[R];R++)if(P.innerCapture(A)&&h[R+1]&&h[R+1].innerCapture(A)&&h[R+3]){P=P.innerCapture(A),f=P.$code,y=a.getDetachedSpan(c+" "+P.$time).innerDate(),D=h[R+1].innerCapture(A),z=D.$nextDay,F=D.$code,$=a.getDetachedSpan(((""+z).length?""+h[R+1].lastInnerDate():""+c)+" "+D.$time),h[R+1].nextText(t.checkin).exists()&&R++,/\d+/.test(""+h[R+2])||R++,T=h[R+2].innerCapture(/($<name>.*)\s($<flightNumber>\d+)/),b=T?T.$name.trim():null,N=T?T.$flightNumber:null,u=h[R+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,f,y,F,$)&&S.push({airlineName:b,flightNumber:N,reservationId:o,reservationStatus:g,departureCode:f,departureTime:y,arrivalCode:F,arrivalTime:$,passengers:E})}}for(var O,M=[],R=0;R<S.length;R++){O=S[R];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();