// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,r){var a=Scanner.fromMessage(e);a.setLocale(t);var i,n,o,p,s,g,u=a.getSpan(),l=[],c=[];n=u.next(r.reservationId_prefix).nextAnyTag("td").tagContents(),i=u.next(r.underPersonName_prefix).nextAnyTag("tr").nextAnyTag("td").tagContents();var d=""+u.next(r.totalPrice_prefix).nextAnyTag("td").tagContents();o=d.substring(1),p=d[0];var h=u.nextText(r.flightLegs_prefix).nextAnyTag("table").allInnerTags("tr5");h.forEach(function(e){var t=e.allInnerTags("td5");l.push(t)});var m=function(e,t){e.forEach(function(r,i){if(/Depart/.test(""+r[3].tagContents())){var n=""+r[1].tagContents(),o=""+r[2].tagContents(),p=""+e[i+1][2].tagContents(),s=n+", "+o;s=getFuzzyDate(a.getDetachedSpan(s).firstDate());var g=n+", "+p;g=getFuzzyDate(a.getDetachedSpan(g).firstDate());var u=/Depart (.*) \( (.*) \)/.exec(r[3]),l=u[1],c=u[2],d=/Arrive (.*) \( (.*) \)/.exec(e[i+1][3]),h=d[1],m=d[2],v=/Flight.*\s(.*)\s(.*)/.exec(e[i+1][1].tagContents()),f=v[1],A=v[2];t({airlineCode:f,flightNumber:A,departureDateTime:s,departureAirport:l,departureAirportCode:c,arrivalDateTime:g,arrivalAirport:h,arrivalAirportCode:m})}})};return m(l,function(e){ASSERT(e.flightNumber,e.departureAirport,e.arrivalAirport)&&c.push({"@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.departureAirport,departureAirportCode:e.departureAirportCode,departureTime:e.departureDateTime,arrivalAirportFuzzy:e.arrivalAirport,arrivalAirportCode:e.arrivalAirportCode,arrivalTime:e.arrivalDateTime},underName:{"@type":"http://schema.org/Person",name:i},checkinUrl:g,reservationId:n,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:o,priceCurrency:p,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:s,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:e.seatNumber,seatingType:e.seatType}}})}),c.length>=1?c:CONTINUE}}).call();