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