// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,n){var a=Scanner.fromMessage(e);a.setLocale(t);var r,i,c,o,p,s,g,l,u,m,C,d,x,S;if(!n.emailTitelConfirmation.test(e.subject)&&!n.emailTitelCancelConfirmation.test(e.subject))return CONTINUE;p=a.getSpan().nextRegExp(n.reservationId).nextAnyTag("td").tagContents(),r=a.getSpan().nextRegExp(n.guestName).nextAnyTag("td").tagContents(),g=a.getSpan().nextRegExp(n.checkInDate).nextDate(),l=a.getSpan().nextRegExp(n.checkOutDate).nextDate();var h=a.getSpan().nextRegExp(n.price).nextAnyTag("td").tagContents();c=h.innerCapture(/([\d,.]+)/,1),o=h.innerCapture(/([^\d,.]+)/,1).trim();var f=a.getSpan().nextRegExp(n.hotelInfo).parentAnyTag("table").parentAnyTag("table").tagContents();if(m=f.innerCapture(regExpFormatted(/(.+?)\s+\[/),1),d=f.innerAddress(),C=f.innerPhoneNumber(),n.emailTitelConfirmation.test(e.subject)){if(!ASSERT(r,p,g,l,m))return CONTINUE;s="Confirmed"}if(n.emailTitelCancelConfirmation.test(e.subject)){p=a.getSpan().innerCapture(n.cancelReservationId,1),r=a.getSpan().innerCapture(n.cancelGuestName,1),i=a.getSpan().innerCapture(n.cancelGuestEmail,1);var h=a.getSpan().innerCapture(n.cancelPrice,1);if(c=h.innerCapture(/([\d,.]+)/,1),o=h.innerCapture(/([^\d,.]+)/,1).trim(),g=a.getSpan().nextRegExp(n.cancelCheckInDate).nextDate(),l=a.getSpan().nextRegExp(n.cancelCheckOutDate).nextDate(),m=a.getSpan().innerCapture(n.cancelHotelName,1),d=a.getSpan().innerCapture(n.cancelHotelAddress,1).innerAddress(),!ASSERT(r,p,g,l,m))return CONTINUE;s="Cancelled"}return[{"@context":"http://schema.org","@type":"http://schema.org/LodgingReservation",underName:{"@type":"http://schema.org/Person",name:r,email:i},totalPrice:c,priceCurrency:o,checkinTime:g,checkoutTime:l,modifyReservationUrl:x,cancelReservationUrl:S,reservationStatus:"http://schema.org/Reservation"+(s||"Confirmed"),reservationId:p,reservationFor:{"@type":"http://schema.org/LodgingBusiness",name:m,url:u,telephone:C,address:d}}]}}).call();