(function(){return function(e,t,r){var a=Scanner.fromMessage(e);a.setLocale(t);var n,i,p,g,o,u,x=[],l=[],s=[],d=1,h="Confirmed";p=a.getSpan().nextText(r.price).nextText("\n"),p=a.getSpan().withInterval(p.getEnd(),p.nextText("\n").getStart()),g=p.innerCapture(regExpFormatted(/([\d., ]+)/),1).trim(),o=p.innerCapture(regExpFormatted(/([^\d., ]+)/),1),n=a.getSpan().nextText(r.passenger).nextText("\n"),n=a.getSpan().withInterval(n.getEnd(),n.nextText(r.passengerSuffix).getStart());do{ASSERT(n)&&l.push({name:n}),n=n.nextText("\n"),n=a.getSpan().withInterval(n.getEnd(),n.nextText("\n").getStart())}while(n.getLength());for(i=a.getSpan().nextText(r.flight).nextText("[1]"),a.getSpan().nextText(r.limit).exists()?h="Pending":a.getSpan().nextText(r.cancel).exists()||r.cancel.test(e.subject)?h="Cancelled":a.getSpan().nextText(r.refund).exists()&&(h="Cancelled");i.exists();){var m,c,v,T={},S=i.nextDate(),z=RegExp(regExpFormatted(/\1\s*(\w*)\s/,r.reservationId));T.reservationId=i.next(z).innerCapture(z,1);var f=i.nextRegExp(/([0-9A-Z]{2,3}?)\s?(\d{3,4})/).innerCapture(/([0-9A-Z]{2,3}?)\s?(\d{3,4})/);switch(""+(T.airlineCode=f[1])){case"ANA":T.airlineCode="NH"}T.flightNumber=f[2],c=T.flightNumber.nextDate(),m=T.flightNumber.nextDate().nextDate(),T.departureAirportFuzzy=a.getSpan().withInterval(T.flightNumber.getEnd(),c.previousText("(").getStart()).trim(),T.arrivalAirportFuzzy=a.getSpan().withInterval(T.flightNumber.nextText("-").getEnd(),m.previousText("(").getStart()).trim(),T.departureTime=getFuzzyDate(a.getDetachedSpan(S+" "+c)),T.arrivalTime=getFuzzyDate(a.getDetachedSpan(S+" "+m)),v=i.nextText(r.ticket),T.ticketNumber=a.getSpan().withInterval(v.getEnd(),v.nextText("\n").getStart()).trim(),ASSERT(T.arrivalAirportFuzzy,T.departureAirportFuzzy,T.flightNumber,T.departureTime,T.arrivalTime)&&x.push(T),d++,i=i.nextText("["+d+"]")}for(var y=0;y<x.length;y++)for(var A=x[y],F=0;F<l.length;F++){var C=l[F],N={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineCode:A.airlineCode,flightNumber:A.flightNumber,departureAirportFuzzy:A.departureAirportFuzzy,departureAirportCode:A.departureAirportCode,departureTime:A.departureTime,arrivalAirportFuzzy:A.arrivalAirportFuzzy,arrivalAirportCode:A.arrivalAirportCode,arrivalTime:A.arrivalTime},underName:{"@type":"http://schema.org/Person",name:C.name},checkinUrl:u,reservationId:A.reservationId,reservationStatus:"http://schema.org/Reservation"+h,totalPrice:g,priceCurrency:o,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:A.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:A.seatNumber,seatingType:""}}};s.push(N)}if(s.length)return s}}).call();