// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,r,t){var a=Scanner.fromMessage(e);a.setLocale(r);var n,i,p,o,s,d,g,l,m,c,h,u,v,T,C,f,y,A,x,N=[],b=[],S=[],k=[];for(x=a.getSpan().next(t.contactPerson).parentAnyTag("td").tagContents().innerCapture(regExpFormatted(/\1\s+(.*)/,t.contactPerson),1),f=a.getSpan().next(t.passengers).parentAnyTag("table"),A=/table(\d)/.exec(""+f)[1],m=a.getSpan().next(t.passengers).parentAnyTag("table").allInnerTags("tr"+A),n=1;n<m.length;n++)m[n].allInnerTags("td"+A).length>2&&(c=m[n],h={},h.name=c.nextAnyTag("td").tagContents(),S.push(h));for(0===S.length&&(y=a.getSpan().next(t.traveller).parentAnyTag("td").tagContents().innerCapture(regExpFormatted(/\1\s+(.*)/,t.traveller),1),S.push({name:y})),p=a.getSpan().next(t.flightSummary).nextAnyTag("table").allInnerCapture(t.departure,0),n=0;n<p.length;n++)o=p[n],C={},s=(""+o.previousAnyTag("td").previousAnyTag("td").tagContents()).replace(/-/g," ")||s,d=o.parentAnyTag("td").tagContents().innerCapture(regExpFormatted(/($<departureAirport>.*)\s+\(($<departureCode>.*)\)\s+\1\s+($<departureTime>.*)/,t.departure)),C.departureAirport=d.$departureAirport,C.departureCode=d.$departureCode,C.departureTime=a.getDetachedSpan(""+s+" "+d.$departureTime).innerDate(),g=o.next(t.arrival).parentAnyTag("td").tagContents().innerCapture(regExpFormatted(/($<arrivalAirport>.*)\s+\(($<arrivalCode>.*)\)\s+\1\s+($<arrivalTime>.*)/,t.arrival)),C.arrivalAirport=g.$arrivalAirport,C.arrivalCode=g.$arrivalCode,C.arrivalTime=a.getDetachedSpan(""+s+" "+g.$arrivalTime).innerDate(),l=o.next(t.flight).parentAnyTag("td").tagContents().innerCapture(regExpFormatted(/($<airlineCode>\w{2})?\s?($<airline>.*)\s+\1\s+($<flightNr>\d+)/,t.flight)),C.airlineName=l.$airline,C.airlineCode=l.$airlineCode,C.flightNumber=l.$flightNr,C.seatingType=l.$flightNr.nextAnyTag("td").nextAnyTag("td").tagContents(),C.reservationId=a.getSpan().next(t.flightReservationId).parentAnyTag("td").tagContents().innerCapture(regExpFormatted(/\1\s+(.*)/,t.flightReservationId),1),ASSERT(C.airlineName,C.flightNumber,C.arrivalTime,C.departureTime,C.arrivalAirport,C.departureAirport)&&b.push(C);for(u=a.getSpan().next(t.carSummary).parentTag("table3").allInnerCapture(t.carPickup,0),n=0;n<u.length;n++)T=u[n],v={},v.pickupTime=T.parentAnyTag("td").tagContents().innerDate(),v.dropoffTime=T.next(t.carDropoff).parentAnyTag("td").tagContents().innerDate(),v.pickupAddress=v.dropoffAddress=T.next(t.carLocation).parentAnyTag("td").tagContents().innerCapture(regExpFormatted(/\1\s+(.*)/,t.carLocation),1),v.reservationId=T.next(t.carReservationId).parentAnyTag("td").tagContents().innerCapture(regExpFormatted(/\1\s+(.*)/,t.carReservationId),1),v.provider=T.parentTag("td4").tagContents().innerCapture(/(.*)\:/,1),v.name=x,ASSERT(v.name,v.provider,v.dropoffTime,v.pickupTime)&&k.push(v);for(n=0,C;n<b.length;n++){C=b[n];for(var $=0;$<S.length;$++){var F=S[$];i={"@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.departureCode,departureTime:C.departureTime,arrivalAirportFuzzy:C.arrivalAirport,arrivalAirportCode:C.arrivalCode,arrivalTime:C.arrivalTime},underName:{"@type":"http://schema.org/Person",name:F.name},checkinUrl:C.checkinUrl,reservationId:C.reservationId,reservationStatus:"http://schema.org/Reservation"+(C.reservationStatus||"Confirmed"),totalPrice:F.totalPrice,priceCurrency:F.priceCurrency,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:F.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:C.seats,seatingType:C.seatingType}}},valid(F.membershipNumber,F.programName)&&(i.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:F.membershipNumber,programName:F.programName}),N.push(i)}}for(n=0,v;n<k.length;n++)v=k[n],i={"@context":"http://schema.org","@type":"http://schema.org/RentalCarReservation",totalPrice:v.totalPrice,priceCurrency:v.priceCurrency,reservationId:v.reservationId,reservationStatus:"http://schema.org/Reservation"+(v.reservationStatus||"Confirmed"),checkinUrl:v.checkinUrl,modifyReservationUrl:v.modifyReservationUrl,cancelReservationUrl:v.cancelReservationUrl,underName:{"@type":"http://schema.org/Person",name:v.name,email:v.email},provider:{"@type":"http://schema.org/Organization",name:v.provider},pickupTime:v.pickupTime,pickupLocation:{"@type":"http://schema.org/Place",name:v.pickupName,telephone:v.pickupTelephone,address:v.pickupAddress},dropoffTime:v.dropoffTime,dropoffLocation:{"@type":"http://schema.org/Place",name:v.dropoffName,telephone:v.dropoffTelephone,address:v.dropoffAddress}},v.brand&&(i.reservationFor={"@type":"http://schema.org/Car",brand:{"@type":"http://schema.org/Organization",name:v.brand},license:v.license,color:v.color}),N.push(i);if(N.length)return N}}).call();