// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,r,t){var a=Scanner.fromMessage(e);a.setLocale(r);var i,n,p,o,u,l,d,g,h,m,s,c,v,f,C,$,A=[],S=[];i=a.getSpan().innerCapture(t.name,1);var y=[i];for(c=a.getSpan().innerCapture(regExpFormatted(/\1\s+(\w+)/,t.reservationId),1),$=a.getSpan().innerCapture(regExpFormatted(/\1\s*(.*)/,t.price),1),u=$.innerCapture(/([\d,.]+)/,1),l=$.innerCapture(/([^\d,.]+)/,1).trim(),o=a.getSpan().innerCapture(t.flightSection,1),o=o.split(/\n/),v=0;v<o.length;v++)if(h=o[v],h.getLength()>0&&/\w+/.test(""+h)){var N=h.innerCapture(t.flightLegInfo);if(!N)continue;d=a.getDetachedSpan(N.$flightDate+" "+N.$departureHour+":"+N.$departureMinute).innerDate(),m=a.getDetachedSpan(N.$flightDate+" "+N.$arrivalHour+":"+N.$arrivalMinute).innerDate(),ASSERT(N.$airlineCode,N.$flightNumber,N.$departureAirport,d,N.$arrivalAirport,m)&&S.push({airlineCode:N.$airlineCode,flightNumber:N.$flightNumber,departureCode:g,departureAirport:N.$departureAirport,departureTime:d,arrivalCode:s,arrivalAirport:N.$arrivalAirport.trim(),arrivalTime:m,passengers:[i]})}for(v=0;v<S.length;v++){h=S[v];for(var T=0;T<y.length;T++){var F={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:h.airlineName,airlineCode:h.airlineCode,flightNumber:h.flightNumber,departureAirportFuzzy:h.departureAirport,departureAirportCode:h.departureCode,departureTime:h.departureTime,arrivalAirportFuzzy:h.arrivalAirport,arrivalAirportCode:h.arrivalCode,arrivalTime:h.arrivalTime},underName:{"@type":"http://schema.org/Person",name:y[T]},checkinUrl:f,reservationId:c,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:u,priceCurrency:l,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:C,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:n,seatingType:p}}};A.push(F)}}if(A.length)return A}}).call();