// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,r,t){var a=Scanner.fromMessage(e);a.setLocale(r);var i,n,o,p,l,s=a.getSpan(),u="Confirmed",d=[],c=[],g=[];if(n=s.nextText(t.ticketNumberPrefix).nextAnyTag("td").tagContents().innerCapture(/(.*?)\s\-\s/,1),s.nextText(t.passengerNameHeader).parentTag("table2").allInnerTags("tr2").slice(3,-3).forEach(function(e){var r=e.allInnerTags("td2");d.push({name:r[0].tagContents()})}),s.nextText(t.legDepartureAirportHeader).parentTag("table3").allInnerTags("tr3").slice(2,-4).forEach(function(e){var r,t,i,n,o,p,l,s,u,d,g,m,h,T=e.allInnerTags("td3");[p,d]=(""+T[1].tagContents()).split("\n"),[,t,i]=T[2].tagContents().innerCapture(/([0-9A-Z]{2})(\d{3,4})/),n=s=T[3].tagContents().innerDate(),[o,u]=(""+T[4].tagContents()).split(" - "),c.push({airlineName:r,airlineCode:t,flightNumber:i,departureDateTime:a.getDetachedSpan(""+n+" "+o).innerDate(),departureAirport:""+p,departureAirportCode:l,arrivalDateTime:a.getDetachedSpan(""+s+" "+u).innerDate(),arrivalAirport:d,arrivalAirportCode:g,seatNumber:m,seatingType:h})}),d.forEach(function(e){c.forEach(function(r){ASSERT(e.name,r.flightNumber,r.departureAirportCode||r.departureAirport,r.departureDateTime,r.arrivalAirportCode||r.arrivalAirport,r.arrivalDateTime)&&g.push({"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:r.airlineName,airlineCode:r.airlineCode,flightNumber:r.flightNumber,departureAirportFuzzy:r.departureAirport,departureAirportCode:r.departureAirportCode,departureTime:r.departureDateTime,arrivalAirportFuzzy:r.arrivalAirport,arrivalAirportCode:r.arrivalAirportCode,arrivalTime:r.arrivalDateTime},underName:{"@type":"http://schema.org/Person",name:e.name},checkinUrl:o,reservationId:i,reservationStatus:"http://schema.org/Reservation"+u,totalPrice:p,priceCurrency:l,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:n,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:r.seatNumber,seatingType:r.seatingType}}})})}),g.length>0)return g}}).call();