// 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,C,d,T,x,m,u,l,S,h,f,y;if(!n.emailTitelConfirmation.test(e.subject)&&!n.emailTitelCancelConfirmation.test(e.subject))return CONTINUE;if(n.emailTitelConfirmation.test(e.subject)&&n.fr.test(a.getSpan().tagContents())){s=a.getSpan().nextText(n.reservationId).nextAnyTag("td").tagContents(),r=a.getSpan().nextText(n.guestName).nextAnyTag("td").tagContents();var A=a.getSpan().nextText(n.dateText).parentTag("td1").tagContents().innerDate();C=A.innerCapture(/(.+)\-(.+)/,1),c=a.getSpan().nextText(n.checkinTime).nextAnyTag("td").tagContents(),d=getFuzzyDate(a.getDetachedSpan(C+" "+c).innerDate()),x=A.innerCapture(/(.+)\-(.+)/,2),T=a.getSpan().nextText(n.checkoutTime).nextAnyTag("td").tagContents(),m=getFuzzyDate(a.getDetachedSpan(x+" "+T).innerDate());var v=a.getSpan().nextText(n.price).nextAnyTag("td").tagContents();g=v.innerCapture(/([\d,.]+)/,1),o=v.innerCapture(/([^\d,.]+)/,1).trim(),y=f=a.getSpan().nextText(n.modifyUrl).parentAnyTag("td").tagContents().innerLink();var D=a.getSpan().nextText(n.dateText).nextTag("td2").tagContents();l=D.innerCapture(regExpFormatted(/(.+)</),1),u=D.innerLink();var D=a.getSpan().nextText(n.dateText).parentTag("td1").tagContents();if(h=D.innerAddress(),S=D.lastInnerPhoneNumber(),!ASSERT(r,s,d,m,h))return CONTINUE;p="Confirmed"}else if(n.emailTitelConfirmation.test(e.subject)){s=a.getSpan().nextText(n.comReservationId).nextAnyTag("td").tagContents(),r=a.getSpan().nextText(n.guestName).nextAnyTag("td").tagContents(),C=a.getSpan().nextText(n.comCheckinDate).nextAnyTag("td").tagContents(),x=a.getSpan().nextText(n.comCheckoutDate).nextAnyTag("td").tagContents(),T=a.getSpan().nextText(n.comCheckoutTime).nextAnyTag("td").tagContents(),c=a.getSpan().nextText(n.comCheckinTime).nextAnyTag("td").tagContents(),d=combineDateAndTime(C,c),m=combineDateAndTime(x,T);var v=a.getSpan().nextText(n.price).nextAnyTag("td").tagContents();g=v.innerCapture(/([\d,.]+)/,1),o=v.innerCapture(/([^\d,.]+)\s\(/,1).trim(),y=f=a.getSpan().nextText(n.comModifyUrl).parentAnyTag("td").tagContents().innerLink();var D=a.getSpan().nextText(n.comHotelInfo).parentAnyTag("table").tagContents();if(l=D.innerCapture(regExpFormatted(/(.+)</),1),u=D.innerLink(),S=D.innerPhoneNumber(),h=D.innerAddress(),!ASSERT(r,s,d,m,h))return CONTINUE;p="Confirmed"}if(n.emailTitelCancelConfirmation.test(e.subject)&&n.fr.test(a.getSpan().tagContents())){s=a.getSpan().innerCapture(n.cancelReservationId,1),r=a.getSpan().innerCapture(n.cancelGuestName,1);var D=a.getSpan().nextRegExp(n.cancelReservationId).nextTag("td2").tagContents();l=D.innerCapture(regExpFormatted(/(.+)</),1),u=D.innerLink();var D=a.getSpan().nextRegExp(n.cancelReservationId).parentTag("td1").tagContents();if(h=D.innerAddress(),S=D.allInnerPhoneNumbers()[1],d=a.getSpan().innerCapture(n.cancelDates,1),d=D.innerDate(),m=a.getSpan().innerCapture(n.cancelDates,2),m=getFuzzyDate(a.getDetachedSpan(m+" 12:00")),!ASSERT(r,s,d,m,h))return CONTINUE;p="Cancelled"}else if(n.emailTitelCancelConfirmation.test(e.subject)){s=a.getSpan().innerCapture(n.cancelComReservationId,1),r=a.getSpan().innerCapture(n.cancelComGuestName,1);var D=a.getSpan().nextTag("table8").tagContents();if(l=D.innerCapture(regExpFormatted(/(.+)</),1),u=D.innerLink(),S=D.innerPhoneNumber(),h=D.innerAddress(),d=a.getSpan().innerCapture(n.cancelComDates,1),d=getFuzzyDate(a.getDetachedSpan(d+" 12:00")),m=a.getSpan().innerCapture(n.cancelComDates,2),m=getFuzzyDate(a.getDetachedSpan(m+" 12:00")),!ASSERT(r,s,d,m,h))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:d,checkoutTime:m,modifyReservationUrl:f,cancelReservationUrl:y,reservationStatus:"http://schema.org/Reservation"+(p||"Confirmed"),reservationId:s,reservationFor:{"@type":"http://schema.org/LodgingBusiness",name:l,url:u,telephone:S,address:h}}]}}).call();