// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,r){var a=Scanner.fromMessage(e),n=a.getSpan();a.setLocale(t);for(var i,o,l,p,s,g,u,d,c=[],h={},m=[],C=n.nextText(r.contactDetailsPrefix).nextAnyTag("table").nextAnyTag("tr").allInnerTags("td8"),T=n.next(r.passengerDetailsPrefix).next(r.underPersonNamePrefix).parentAnyTag("table").allInnerTags("tr7"),f=1;f<T.length;f++){for(var v=T[f].nextTag("td8").tagContents().trim(),x=T[f].allInnerTags("td7"),A=[],y=1;y<x.length;y++)A.push(x[y].tagContents().trim());h[""+v]={name:v,seats:A,seatingType:{},ticketNumber:null,totalPrice:null,priceCurrency:null}}i=C[2].tagContents(),C[4]&&(o=C[4].tagContents()),n.nextText(r.pricePrefix)!==a.getNullSpan()&&([,p,s]=n.nextText(r.pricePrefix).nextAnyTag("td").tagContents().innerCapture(/([\d,.]+)\s?(\D)/)),l=n.nextText(r.reservationIdPrefix).nextAnyTag("td").tagContents(),n.nextText(r.flightBlock).parentTag("table8").allInnerTags("table9").forEach(function(e){for(var t=e.allInnerTags("tr9").filter(function(e){var t=""+e.tagContents();return 0!==(""+e.tagContents()).length&&t.indexOf(r.flightBlock)===-1&&t.indexOf(r.flightBlock_2)===-1}),n=t.length,i=0;i<n;i+=3){var o,l,p,s,u,d,h,m,C=t[i+2].allInnerTags("td10");[,o,l]=t[i+1].tagContents().innerCapture(/.*?\s(\D{2})(\d+)/);var T=""+t[i].tagContents();p=a.getDetachedSpan(T+" "+C[2].tagContents()).innerDate(),[,s,u]=C[0].tagContents().innerCapture(/(.*)?\s\((\D{3})\)/),d=a.getDetachedSpan(T+" "+C[5].tagContents()).innerDate(),[,h,m]=C[3].tagContents().innerCapture(/(.*)?\s\((\D{3})\)/),c.push({airlineName:null,airlineCode:o,flightNumber:l,departureDateTime:p,departureAirport:s,departureAirportCode:u,arrivalDateTime:d,arrivalAirport:h,arrivalAirportCode:m,seatNumber:g,seatType:null})}});var D=0;return c.forEach(function(e){if(ASSERT(h,e.airlineName||e.airlineCode,e.departureAirport||e.departureAirportCode,e.departureDateTime,e.arrivalAirport||e.arrivalAirportCode,e.arrivalDateTime)){for(var t=Object.keys(h),r=0;r<t.length;r++)m.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:t[r]},checkinUrl:d,reservationId:l,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:p,priceCurrency:s,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:u,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:h[t[r]].seats[D],seatingType:e.seatingType}}});D++%t.length}}),m.length>=1?m:CONTINUE}}).call();