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