// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,r){var a=Scanner.fromMessage(e);a.setLocale(t);var n,i,l,o,p,g,m,s,u,h,d,c=[],C=[],v=[];for(n=a.getSpan().innerCapture(regExpFormatted(/\1\s+(\w+)/,r.reservationId),1),g=a.getSpan().next(r.passengerDetails).nextTag("table1").allInnerTags("tr1"),p=0;p<g.length;p+=3)s={},s.name=g[p].nextTag("td1").tagContents(),s.ticketNumber=""+g[p].next(r.ticketNumber).nextTag("td1").tagContents(),0!==(""+s.name).length&&c.push(s);i=a.getSpan().next(r.price).nextTag("td1").tagContents(),l=i.innerCapture(regExpFormatted(/([\d\.,]+)/),1).trim(),o=i.innerCapture(regExpFormatted(/([^\d\.,]+)/),1).trim();var T=a.getSpan().next(r.flightDetails).nextTag("table1");do{var N=T.allInnerTags("tr1");for(p=0;p<N.length;p++)u={},m=N[p].allInnerTags("td1"),m.length>2&&(u.departureTime=m[1].allInnerDates()[0],u.arrivalTime=m[2].allInnerDates()[0],u.departureAirport=m[1].tagContents().innerCapture(/(.*)\n/,1),u.arrivalAirport=m[2].tagContents().innerCapture(/(.*)\n/,1),h=m[0].tagContents().innerCapture(/($<airlineCode>\w{2})($<flightNumber>\d+)/),u.airlineCode=h.$airlineCode,u.flightNumber=h.$flightNumber,u.airlineName=m[0].tagContents().innerCapture(r.airlineName,1),0===(""+u.airlineName).length&&(u.airlineName="WestJet"),ASSERT(u.departureAirport,u.arrivalAirport,u.departureTime,u.arrivalTime,u.airlineCode,u.flightNumber)&&C.push(u));T=T.nextTag("table1")}while(!r.stopLegsGroup.test(""+T.tagContents()));for(d="Confirmed",p=0;p<C.length;p++){u=C[p];for(var f=0;f<c.length;f++){s=c[f];var x={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:u.airlineName,airlineCode:u.airlineCode,flightNumber:u.flightNumber,departureAirportFuzzy:u.departureAirport,departureTime:u.departureTime,arrivalAirportFuzzy:u.arrivalAirport,arrivalTime:u.arrivalTime},underName:{"@type":"http://schema.org/Person",name:s.name},checkinUrl:null,reservationId:n,reservationStatus:"http://schema.org/Reservation"+d,totalPrice:l,priceCurrency:o,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:s.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat"}}};v.push(x)}}if(v.length)return v}}).call();