(function(){return function(e,t,r){if(!e||!t||!r)return CONTINUE;var a=Scanner.fromMessage(e);a.setLocale(t);for(var n,i,p,s,m,g,o,s,m,l,d,T,h,u,x,v=a.getSpan(),c=[],b=[],C=[],y=RegExp(r.reservationIdPrefix+"(.+)?"),N=v.nextText(r.reservationIdPrefix).parentAnyTag("td").tagContents().innerCapture(y,1),A=v.nextText(r.viewTrip).nextDate(),f=[],F=A;(""+F.nextTag("td6").tagContents()).length>1;){var I=F.nextTag("table4").nextTag("table4"),D=I.allInnerTagsFiltered("td6");if(0!==D.length){i=D[0],p=D[1],s=D[2],m=D[3],g=D[4],o=D[5],l=o.nextTag("td5").nextTag("td5").tagContents().innerCapture(/($<name>\D+)\s($<code>\d+)/),d=l.$code,T=l.$name,x=o.nextText(r.seat).nextAnyTag("td").tagContents().innerCapture(/(^[a-zA-Z0-9,-\s]*)/,1);var E=x.nextText(r.seatType).nextAnyTag("td").tagContents().innerCapture(/(^.+)/,1);u=E.nextText(r.meals).nextAnyTag("td").tagContents(),s=combineDateAndTime(A,s),m=combineDateAndTime(A,m),Date.parse(s)>Date.parse(m)&&(m=modifyDate(m,1)),F=u.nextTag("table4"),ASSERT(i,p,s,m,g,o)&&f.push({departureCode:i,arrivalCode:p,departureTime:s,arrivalTime:m,departureAirport:g,arrivalAirport:o,flightNumber:d,airlineName:T,seat:x,seatType:E,meals:u})}else A=I.allInnerTagsFiltered("td4")[0].innerDate(),F=A}var k=u.nextTag("table4").nextTag("table4").nextTag("table4").allInnerTags("table4"),z=k[0].allInnerTagsFiltered("td4"),S=k[0].allInnerTagsFiltered("td5");if(u.nextText(r.price).exists())for(var R=u,$=0;$<z.length/2;$++){var P=R.nextText(r.price).parentAnyTag("td").nextAnyTag("td").tagContents().innerCapture(/.*\s($<total>\d+(\.\d+)?)/);P&&(c[$]=P.$total);var M=RegExp(r.fare+"-(.*)");b[$]=R.nextText(r.fare).parentAnyTag("td").tagContents().innerCapture(M,1),R=c[$]}for(var U,Z,O,w=[],L=RegExp(r.ticket+"\\s#\\s([\\d\\-]+)"),j=0;j<z.length/2;j++){S.length&&(U=S.length===z.length/2?S[j].innerCapture(L,1):S[3*j+2].innerCapture(L,1));var n=z[2*j];z[2*j+1].innerCapture(regExpFormatted(/\1\s\#\s([\dA-Z]+)/,r.membership),1)&&(O=z[2*j+1].innerCapture(regExpFormatted(/\1\s\#\s([\dA-Z]+)/,r.membership),1),Z=r.membership),w.push({name:n,ticketNumber:U,programName:Z,membershipNumber:O})}for(var q=0;q<f.length;q++)for(var B=f[q],j=0;j<w.length;j++){var G=w[j],H=x;z.length/2>1&&(h=B.seat.split(","));var J=z.length/2>1?h[j]:H,K={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:B.airlineName,flightNumber:B.flightNumber,departureAirportFuzzy:B.departureAirport,departureAirportCode:B.departureCode,departureTime:B.departureTime,arrivalAirportFuzzy:B.arrivalAirport,arrivalAirportCode:B.arrivalCode,arrivalTime:B.arrivalTime},underName:{"@type":"http://schema.org/Person",name:G.name},reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:G.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:J.trim(),seatingType:B.seatType}},reservationId:N,totalPrice:c[j],priceCurrency:b[j],reservationStatus:"http://schema.org/ReservationConfirmed"};valid(G.membershipNumber)&&(K.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:G.membershipNumber,programName:G.programName}),C.push(K)}return C.length?C:CONTINUE}}).call();