// 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,c,p,s,x,l,m,u,C,d,h,R,S,E,T;if(!n.emailTitelConfirmation.test(e.subject)&&!n.emailTitelCancelConfirmation.test(e.subject))return CONTINUE;c=a.getSpan().nextRegExp(n.reservationId).nextAnyTag("td").tagContents().innerCapture(/([\w\d]+)/,1),r=a.getSpan().nextRegExp(n.guestName).nextAnyTag("td").tagContents(),x=a.getSpan().nextRegExp(n.checkInDate).nextAnyTag("td").tagContents().innerDate(),s=a.getSpan().nextRegExp(n.checkInTime).nextDate(),u=a.getSpan().nextRegExp(n.checkOutDate).nextAnyTag("td").tagContents().innerDate(),m=a.getSpan().nextRegExp(n.checkOutTime).nextDate(),l=getFuzzyDate(a.getDetachedSpan(x+" "+s).innerDate()),C=getFuzzyDate(a.getDetachedSpan(u+" "+m).innerDate());var D=a.getSpan().nextRegExp(n.price).nextAnyTag("td").tagContents();if(g=D.innerCapture(/([\d,.]+)/,1),o=D.innerCapture(/([^\d,.]+)/,1).trim(),E=T=a.getSpan().nextRegExp(n.reservationId).nextAnyTag("td").tagContents().innerLink(),h=a.getSpan().nextRegExp(n.hotelName).tagContents().innerCapture(n.hotelName,1),d=a.getSpan().nextRegExp(n.hotelUrl).nextLink(),R=a.getSpan().nextRegExp(n.hotelPhone).nextPhoneNumber(),n.emailTitelConfirmation.test(e.subject)){if(!ASSERT(r,c,l,C,h))return CONTINUE;p="Confirmed"}if(n.emailTitelCancelConfirmation.test(e.subject)){if(c=a.getSpan().nextRegExp(n.cancelReservationId).tagContents().innerCapture(n.cancelReservationId,1),l=a.getSpan().nextRegExp(n.checkInDate).nextDate(),C=a.getSpan().nextRegExp(n.checkOutDate).nextDate(),r=a.getSpan().nextRegExp(n.cancelGuestName).nextAnyTag("td").tagContents().innerCapture(/(.+)/,1),i=a.getSpan().nextRegExp(n.cancelGuestName).nextAnyTag("td").tagContents().innerLink(),h="Waikiki Parc Hotel",!ASSERT(r,c,l,C,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:l,checkoutTime:C,modifyReservationUrl:E,cancelReservationUrl:T,reservationStatus:"http://schema.org/Reservation"+(p||"Confirmed"),reservationId:c,reservationFor:{"@type":"http://schema.org/LodgingBusiness",name:h,url:d,telephone:R,address:S}}]}}).call();