// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,n){var r=Scanner.fromMessage(e);r.setLocale(t);var a,o,i,s,c,p,d,l,h,m,g,T,x,u,f,v,C,y,k,R,P,S,U,A,N,I,b=[],D=[],L=[];u=n.cancellation.test(e.subject)?"Cancelled":"Confirmed",r.getSpan().next(n.hotel).exists()&&(o=r.getSpan().next(n.hotel).parentTag("table6"),m=o.next(n.hotel).nextAnyTag("td").tagContents().innerCapture(/($<hotelName>.*)<($<hotelUrl>.*)>($<address>[\S\s]*)/),p=m.$hotelName,c=m.$hotelUrl,l=m.$address,d=l.next(n.phone).nextAnyTag("td").tagContents().lastInnerPhoneNumber(),a=o.next(n.checkIn).nextAnyTag("td").tagContents().innerDate(),i=o.next(n.checkOut).nextAnyTag("td").tagContents().innerDate(),h=o.next(n.name).nextAnyTag("td").tagContents(),ASSERT(h,p,l,a,i)&&D.push({name:h,reservationId:x,totalPrice:g,priceCurrency:T,hotelName:p,hotelAddress:l,hotelUrl:c,hotelPhone:d,checkInDateTime:a,checkOutDateTime:i})),r.getSpan().nextText(n.rentalCompany).exists()&&(m=r.getSpan().nextText(n.itinerary).nextTag("table6"),h=m.innerText(n.name).nextTag("td6").tagContents(),y=m.innerText(n.rentalCarProvider).nextTag("td6").tagContents(),A=m.innerText(n.pickupLocation).nextTag("td6").tagContents(),R=m.innerText(n.dropoffLocation).nextTag("td6").tagContents(),N=m.innerText(n.phone).nextTag("td6").innerPhoneNumber(),I=m.innerText(n.pickupTime).nextTag("td6").innerDate(),S=m.innerText(n.dropoffTime).nextTag("td6").innerDate(),C=m.innerText(n.brand).nextTag("td6").tagContents().innerCapture(/(.*)\s/,1).trim(),x=m.innerText(n.reservationId).nextTag("td6").tagContents(),g=r.getSpan().nextText(n.pricing).nextText(n.total).nextTag("td5").tagContents().innerCapture(/([\d,.]+)/,1),ASSERT(I,y,x,OR(A,U))&&L.push({name:h,brand:C,pickupTime:I,pickupName:U,pickupAddress:A,pickupTelephone:N,dropoffTime:S,dropoffName:k,dropoffAddress:R,dropoffTelephone:P,provider:y,reservationId:x,reservationStatus:u,cancelReservationUrl:v,totalPrice:g}));for(var O,$=0;$<L.length;$++)O=L[$],f={"@context":"http://schema.org","@type":"http://schema.org/RentalCarReservation",totalPrice:O.totalPrice,priceCurrency:O.priceCurrency,reservationId:O.reservationId,reservationStatus:"http://schema.org/Reservation"+(O.reservationStatus||"Confirmed"),checkinUrl:O.checkinUrl,modifyReservationUrl:O.modifyReservationUrl,cancelReservationUrl:O.cancelReservationUrl,underName:{"@type":"http://schema.org/Person",name:O.name,email:O.email},provider:{"@type":"http://schema.org/Organization",name:O.provider},pickupTime:O.pickupTime,pickupLocation:{"@type":"http://schema.org/Place",name:O.pickupName,telephone:O.pickupTelephone,address:O.pickupAddress},dropoffTime:O.dropoffTime,dropoffLocation:{"@type":"http://schema.org/Place",name:O.dropoffName,telephone:O.dropoffTelephone,address:O.dropoffAddress}},O.brand&&(f.reservationFor={"@type":"http://schema.org/Car",brand:{"@type":"http://schema.org/Organization",name:O.brand},license:O.license,color:O.color}),b.push(f);for($=0,s;$<D.length;$++)s=D[$],f={"@context":"http://schema.org","@type":"http://schema.org/LodgingReservation",underName:{"@type":"http://schema.org/Person",name:s.name,email:s.email},totalPrice:s.totalPrice,priceCurrency:s.priceCurrency,checkinTime:s.checkInDateTime,checkoutTime:s.checkOutDateTime,modifyReservationUrl:s.modifyReservationUrl,cancelReservationUrl:s.cancelReservationUrl,reservationStatus:"http://schema.org/Reservation"+u,reservationId:s.reservationId,reservationFor:{"@type":"http://schema.org/LodgingBusiness",name:s.hotelName,url:s.hotelUrl,telephone:s.hotelPhone,address:s.hotelAddress}},b.push(f);if(b.length)return b}}).call();