// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,r,t){var n=Scanner.fromMessage(e);n.setLocale(r);var a,i,l,o,p,g,m,s,h,u,d,c,v=[],T=[],f=[];a=n.getSpan().innerCapture(regExpFormatted(/\1\s+(\w+)/,t.reservationId),1),o=n.getSpan().next(t.checkIn).nextLink();for(var C,b=n.getSpan().next(t.passenger);0!==(""+b).length;)C=b.innerCapture(t.passenger),m={},m.name=C.$name,m.ticketNumber=C.$ticketNumber,ASSERT(m.name)&&v.push(m),b=b.next(t.passenger);for(h=n.getSpan().next(t.flightDetails).nextAnyTag("table"),h=h.allInnerTags(0!==h.allInnerTags("tr3").length?"tr3":"tr4"),p=0;p<h.length;p++)s={},g=h[p].allInnerTags("td3"),0===(""+g).length&&(g=h[p].allInnerTags("td4")),g.length>2&&(u=g[0].allInnerDates(),u.length>1?(i=u[0],l=u[1]):i=l=u[0],s.departureTime=combineDateAndTime(i,g[1].innerDate()),s.departureAirport=g[1].tagContents().innerCapture(/(.*)\n/,1),s.arrivalTime=combineDateAndTime(l,g[2].innerDate()),s.arrivalAirport=g[2].tagContents().innerCapture(/(.*)\n/,1),d=g[3].innerCapture(/($<airlineCode>\w+)\s($<flightNumber>\d+)/),s.airlineCode=d.$airlineCode,s.flightNumber=d.$flightNumber,s.seatingType=g[4].tagContents().innerCapture(/\n(.*)/,1),ASSERT(s.departureAirport,s.arrivalAirport,s.departureTime,s.arrivalTime,s.airlineCode,s.flightNumber)&&T.push(s));c=t.bookingPending?"Pending":"Confirmed";for(var A=0;A<v.length;A++)for(m=v[A],p=0;p<T.length;p++){s=T[p];var N={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:"Aero M\xe9xico",airlineCode:s.airlineCode,flightNumber:s.flightNumber,departureAirportFuzzy:s.departureAirport,departureTime:s.departureTime,arrivalAirportFuzzy:s.arrivalAirport,arrivalTime:s.arrivalTime},underName:{"@type":"http://schema.org/Person",name:m.name},checkinUrl:o,reservationId:a,reservationStatus:"http://schema.org/Reservation"+c,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:m.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat"}}};f.push(N)}if(f.length)return f}}).call();