// 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,c,p,o,u,s,l,C,g,m,d,S,h,f;if(!n.emailTitelConfirmation.test(e.subject)&&!n.emailTitelCancelConfirmation.test(e.subject))return CONTINUE;u=a.getSpan().innerCapture(n.reservationId,1),i=a.getSpan().innerCapture(n.guestName,1),c=a.getSpan().innerCapture(n.guestEmail,1),l=""+a.getSpan().innerCapture(n.checkInDate,1),l=r(l),C=""+a.getSpan().innerCapture(n.checkOutDate,1),C=r(C);var v=a.getSpan().innerCapture(n.price,1);if(p=v.innerCapture(/([\d,.]+)/,1),o=v.innerCapture(/([^\d,.]+)/,1).trim(),m=a.getSpan().innerCapture(n.hotelName,1),d=a.getSpan().innerCapture(n.hotelPhone,1),S=""+a.getSpan().innerCapture(n.hotelAddress,1),g=f=h=""+a.getSpan().innerCapture(n.modifyUrl,1),n.emailTitelConfirmation.test(e.subject)){if(!ASSERT(i,u,l,C,S))return CONTINUE;s="Confirmed"}if(n.emailTitelCancelConfirmation.test(e.subject)){u=a.getSpan().innerCapture(n.cancelReservationId,1),m=a.getSpan().innerCapture(n.cancelHotelName,1),i=a.getSpan().innerCapture(n.cancelGuestName,1);var v=a.getSpan().innerCapture(n.cancelPrice,1);if(p=v.innerCapture(/([\d,.]+)/,1),o=v.innerCapture(/([^\d,.]+)/,1).trim(),l=""+a.getSpan().innerCapture(n.cancelCheckInDate,1),l=r(l),!ASSERT(i,u,l,m))return CONTINUE;s="Cancelled"}return[{"@context":"http://schema.org","@type":"http://schema.org/LodgingReservation",underName:{"@type":"http://schema.org/Person",name:i,email:c},totalPrice:p,priceCurrency:o,checkinTime:l,checkoutTime:C,modifyReservationUrl:h,cancelReservationUrl:f,reservationStatus:"http://schema.org/Reservation"+(s||"Confirmed"),reservationId:u,reservationFor:{"@type":"http://schema.org/LodgingBusiness",name:m,url:g,telephone:d,address:S}}]}}).call();