// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,n){function r(e){return e=e.replace(/[^\d\sa-zA-z:]+/g," ").replace(/\s+/g," ").replace(/^(\d+)\s(\d+)\s/,"$1/$2/"),e=getFuzzyDate(a.getDetachedSpan(e))}var a=Scanner.fromMessage(e);a.setLocale(t);var i,o,c,s,u,p,l,m,g,d,C,f,h,S;if(!(n.emailTitelConfirmation.test(e.subject)||n.emailTitelModified.test(e.subject)||n.emailTitelCancelConfirmation.test(e.subject)))return CONTINUE;u=a.getSpan().innerCapture(n.reservationId,1),i=a.getSpan().innerCapture(n.guestName,1);var T=a.getSpan().innerCapture(n.price,1);if(c=T.innerCapture(/([\d,.]+)/,1),l=""+a.getSpan().innerCapture(n.checkInDate,1),l=r(l),m=""+a.getSpan().innerCapture(n.checkOutDate,1),m=r(m),d=a.getSpan().innerCapture(n.hotelInfo,1),f=a.getSpan().innerCapture(n.hotelInfo,2),C=a.getSpan().nextPhoneNumber().nextPhoneNumber(),n.emailTitelModified.test(e.subject)&&(l=""+a.getSpan().innerCapture(n.checkInDateModified,1),l=r(l),m=""+a.getSpan().innerCapture(n.checkOutDateModified,1),m=r(m),i=a.getSpan().innerCapture(n.guestNameModified,1)),n.emailTitelConfirmation.test(e.subject)||n.emailTitelModified.test(e.subject)){if(!ASSERT(i,u,l,d))return CONTINUE;p="Confirmed"}if(n.emailTitelCancelConfirmation.test(e.subject)){var T=a.getSpan().innerCapture(n.priceCancel,1);if(c=T.innerCapture(/([\d,.]+)/,1),i=a.getSpan().innerCapture(n.guestNameCancel,1),!ASSERT(i,u,l,d))return CONTINUE;p="Cancelled"}return[{"@context":"http://schema.org","@type":"http://schema.org/LodgingReservation",underName:{"@type":"http://schema.org/Person",name:i,email:o},totalPrice:c,priceCurrency:s,checkinTime:l,checkoutTime:m,modifyReservationUrl:h,cancelReservationUrl:S,reservationStatus:"http://schema.org/Reservation"+(p||"Confirmed"),reservationId:u,reservationFor:{"@type":"http://schema.org/LodgingBusiness",name:d,url:g,telephone:C,address:f}}]}}).call();