// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,r,t){var a=Scanner.fromMessage(e);a.setLocale(r);var i,p,n,d=a.getSpan().next(t.reservationIdPrefix).parentTag("td3").tagContents().innerCapture(regExpFormatted(/\1\s(.+)/,t.reservationIdPrefix),1),m=[],u=a.getSpan().nextText(t.departurePrefix),o=/p/,l=/a/;if(u.exists()){var T={};T.departureDate=u.parentTag("td3").tagContents().innerCapture(regExpFormatted(/\1(.+?)\,(.+)/,t.departurePrefix),2).trim(),i=u.nextTag("table4").nextTag("td4").nextTag("td4").nextTag("td4").tagContents().innerCapture(/($<airlineName>.+),\sFlight\s($<flightNumber>\d+)/),T.airlineName=i.$airlineName,T.flightNumber=i.$flightNumber,p=u.nextText(t.takeoffPrefix).parentTag("td4").tagContents().innerCapture(/($<departureTime>\S+), ($<departureAirport>.+)\(($<departureAirportCode>.+)\)/),T.departureTime=p.$departureTime,o.test(T.departureTime)?T.departureTime=(""+T.departureTime).replace(o,"pm"):l.test(T.departureTime)&&(T.departureTime=(""+T.departureTime).replace(l,"am")),T.departureAirport=p.$departureAirport.trim(),T.departureAirportCode=p.$departureAirportCode,T.departureDate=getFuzzyDate(a.getDetachedSpan(""+T.departureDate)),T.departureTime=getFuzzyDate(a.getDetachedSpan(""+T.departureTime)),T.departureTime=combineDateAndTime(T.departureDate,T.departureTime),n=u.nextText(t.landingPrefix).parentTag("td4").tagContents().innerCapture(/($<arrivalTime>\S+), ($<arrivalAirport>.+)\(($<arrivalAirportCode>.+)\)/),T.arrivalTime=n.$arrivalTime,o.test(T.arrivalTime)?T.arrivalTime=(""+T.arrivalTime).replace(o,"pm"):l.test(T.arrivalTime)&&(T.arrivalTime=(""+T.arrivalTime).replace(l,"am")),T.arrivalAirport=n.$arrivalAirport.trim(),T.arrivalAirportCode=n.$arrivalAirportCode,T.arrivalTime=getFuzzyDate(a.getDetachedSpan(""+T.arrivalTime)),T.arrivalTime=combineDateAndTime(T.departureDate,T.arrivalTime),m.push(T)}var g=a.getSpan().nextText(t.returnPrefix);if(g.exists()){var v={};v.departureDate=g.parentTag("td3").tagContents().innerCapture(regExpFormatted(/\1(.+?)\,(.+)/,t.returnPrefix),2).trim(),i=g.nextTag("table4").nextTag("td4").nextTag("td4").nextTag("td4").tagContents().innerCapture(/($<airlineName>.+),\sFlight\s($<flightNumber>\d+)/),v.airlineName=i.$airlineName,v.flightNumber=i.$flightNumber,p=g.nextText(t.takeoffPrefix).parentTag("td4").tagContents().innerCapture(/($<departureTime>\S+), ($<departureAirport>.+)\(($<departureAirportCode>.+)\)/),v.departureTime=p.$departureTime,o.test(v.departureTime)?v.departureTime=(""+v.departureTime).replace(o,"pm"):l.test(v.departureTime)&&(v.departureTime=(""+v.departureTime).replace(l,"am")),v.departureAirport=p.$departureAirport.trim(),v.departureAirportCode=p.$departureAirportCode,v.departureDate=getFuzzyDate(a.getDetachedSpan(""+v.departureDate)),v.departureTime=getFuzzyDate(a.getDetachedSpan(""+v.departureTime)),v.departureTime=combineDateAndTime(v.departureDate,v.departureTime),n=g.nextText(t.landingPrefix).parentTag("td4").tagContents().innerCapture(/($<arrivalTime>\S+), ($<arrivalAirport>.+)\(($<arrivalAirportCode>.+)\)/),v.arrivalTime=n.$arrivalTime,o.test(v.arrivalTime)?v.arrivalTime=(""+v.arrivalTime).replace(o,"pm"):l.test(v.arrivalTime)&&(v.arrivalTime=(""+v.arrivalTime).replace(l,"am")),v.arrivalAirport=n.$arrivalAirport.trim(),v.arrivalAirportCode=n.$arrivalAirportCode,v.arrivalTime=getFuzzyDate(a.getDetachedSpan(""+v.arrivalTime)),v.arrivalTime=combineDateAndTime(v.departureDate,v.arrivalTime),m.push(v)}for(var s=[],c=0;c<m.length;c++){var C=m[c],x={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:C.airlineName,airlineCode:C.airlineCode,flightNumber:C.flightNumber,departureAirportFuzzy:C.departureAirport,departureAirportCode:C.departureAirportCode,departureTime:C.departureTime,arrivalAirportFuzzy:C.arrivalAirport,arrivalAirportCode:C.arrivalAirportCode,arrivalTime:C.arrivalTime},underName:{"@type":"http://schema.org/Person",name:""},reservationId:d,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:"",priceCurrency:"",reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:"",ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:""}}};s.push(x)}return s}}).call();