// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,n){var r=Scanner.fromMessage(e);r.setLocale(t);var a,i,p,s,o,u,c,m,g,l,C,S,h,d;if(!n.emailTitelConfirmation.test(e.subject)&&!n.emailTitelCancelConfirmation.test(e.subject))return CONTINUE;o=r.getSpan().innerCapture(n.reservationId,1),a=r.getSpan().innerCapture(n.guestFirstName,1),i=r.getSpan().innerCapture(n.guestEmail,1),c=r.getSpan().nextRegExp(n.checkInDate).nextDate(),m=r.getSpan().nextRegExp(n.checkOutDate).nextDate();var f=r.getSpan().innerCapture(n.price,1);if(p=f.innerCapture(/([\d,.]+)/,1),s=f.innerCapture(/([^\d,.]+)/,1).trim(),l=r.getSpan().innerCapture(n.hotelName,1),S=r.getSpan().innerCapture(regExpFormatted(/\1.+\n.*\n.*\n.*\n.*([\s\S]*)\2/,n.guestEmail,n.hotelPhone),2).trim(),S||(S=r.getSpan().nextRegExp(n.guestEmail).nextAddress()),C=r.getSpan().innerCapture(n.hotelPhone,1),n.emailTitelConfirmation.test(e.subject)){if(!ASSERT(a,o,c,m,S))return CONTINUE;u="Confirmed"}if(n.emailTitelCancelConfirmation.test(e.subject)){o=r.getSpan().innerCapture(n.cancelReservationId,1).trim();var v=r.getSpan().innerCapture(n.guestFirstName,1),E=r.getSpan().innerCapture(n.guestLastName,1);a=v+" "+E,i=r.getSpan().innerCapture(n.cancelGuestEmail,1);var f=r.getSpan().innerCapture(n.cancelPrice,1);if(p=f.innerCapture(/([\d,.]+)/,1),s=f.innerCapture(/([^\d,.]+)/,1).trim(),!ASSERT(a,o,c,l))return CONTINUE;u="Cancelled"}return[{"@context":"http://schema.org","@type":"http://schema.org/LodgingReservation",underName:{"@type":"http://schema.org/Person",name:a,email:i},totalPrice:p,priceCurrency:s,checkinTime:c,checkoutTime:m,modifyReservationUrl:h,cancelReservationUrl:d,reservationStatus:"http://schema.org/Reservation"+(u||"Confirmed"),reservationId:o,reservationFor:{"@type":"http://schema.org/LodgingBusiness",name:l,url:g,telephone:C,address:S}}]}}).call();