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