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