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