// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,r,t){var i=Scanner.fromMessage(e);i.setLocale(r);var a,n,p,o,g,l,u,s,h,d,m,x,f,c,v,A,T,C,y,S=[],z=[];a=i.getSpan().innerCapture(regExpFormatted(/\1\s*(.+)/,t.reservationIdPrefix),1).trim(),n=i.getSpan().next(t.checkinUrlPrefix).nextLink(),T=i.getSpan().next(t.pricePrefix).nextTag("td2").tagContents(),T.exists()&&(C=T.innerCapture(/([\d,.]+)/,1),y=T.innerCapture(/([^\d,.]+)/,1).trim()),A=i.getSpan().next(t.flightDetailPrefix).next(t.passengerPrefix).parentAnyTag("table"),A.exists()&&(S=A.allInnerTagsFiltered("td2").map(function(e){return(""+e).trim()}).filter(function(e){return!t.passengerPrefix.test(e)&&!/^</.test(e)})),v=i.getSpan().next(t.flightDetailPrefix).nextAnyTag("table"),c=v.next(t.flightNumberRegExp);do p=c.previousTag("table3").innerDate(),[,o,g]=c.innerCapture(t.flightNumberRegExp),c=c.next(t.flightTimeAirportRegExp),c.exists()&&([,u,s,h]=c.innerCapture(t.flightTimeAirportRegExp),c=c.nextTag("td2").next(t.flightTimeAirportRegExp),c.exists()&&([,m,x,f]=c.innerCapture(t.flightTimeAirportRegExp),l=i.getDetachedSpan(""+u+", "+p).innerDate(),d=i.getDetachedSpan(""+m+", "+p).innerDate(),i.getDateDD(l).iso8601>i.getDateDD(d).iso8601&&(d=modifyDate(d,1)),ASSERT(o,g)&&z.push({airlineCode:o,flightNumber:g,departureTime:l,departureAirportFuzzy:s,departureAirportCode:h,arrivalTime:d,arrivalAirportFuzzy:x,arrivalAirportCode:f}))),c=c.next(t.flightNumberRegExp);while(c.exists());var D=[];if(z.forEach(function(e){S.forEach(function(r){if(ASSERT(r,a)){var t={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:e.airlineName,airlineCode:e.airlineCode,flightNumber:e.flightNumber,departureAirportFuzzy:e.departureAirportFuzzy,departureAirportCode:e.departureAirportCode,departureTime:e.departureTime,arrivalAirportFuzzy:e.arrivalAirportFuzzy,arrivalAirportCode:e.arrivalAirportCode,arrivalTime:e.arrivalTime},underName:{"@type":"http://schema.org/Person",name:r},checkinUrl:n,reservationId:a,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:C,priceCurrency:y,reservedTicket:{"@type":"http://schema.org/Ticket",ticketedSeat:{"@type":"http://schema.org/Seat"}}};D.push(t)}})}),D.length)return D}}).call();