// 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,C,m,g,h,f,d,S;if(!(n.emailTitelConfirmation.test(e.subject)||n.emailTitelConfirmationChanged.test(e.subject)||n.emailTitelCancelConfirmation.test(e.subject)))return CONTINUE;u=a.getSpan().innerCapture(n.reservationId,1),i=a.getSpan().innerCapture(n.guestName,1),l=""+a.getSpan().innerCapture(n.checkInDate,1),l=r(l),C=""+a.getSpan().innerCapture(n.checkOutDate,1),C=r(C);var T=a.getSpan().innerCapture(n.price,1);if(c=T.innerCapture(/([\d,.]+)/,1),S=d=""+a.getSpan().innerCapture(n.modifyUrl,1),g=a.getSpan().innerCapture(n.hotelName,1),h=a.getSpan().innerCapture(n.hotelPhone,1),n.emailTitelConfirmation.test(e.subject)){if(!ASSERT(i,u,l,C,g))return CONTINUE;p="Confirmed"}if(n.emailTitelConfirmationChanged.test(e.subject)){if(0!==(""+l).length&&0!==(""+C).length||(l=""+a.getSpan().innerCapture(n.confirmationChangedCheckInDate,1),l=r(l),C=""+a.getSpan().innerCapture(n.confirmationChangedCheckOutDate,1),C=r(C)),!ASSERT(i,u,l,C,g))return CONTINUE;p="Confirmed"}if(n.emailTitelCancelConfirmation.test(e.subject)){if(!ASSERT(i,u,l,C,g))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:C,modifyReservationUrl:d,cancelReservationUrl:S,reservationStatus:"http://schema.org/Reservation"+(p||"Confirmed"),reservationId:u,reservationFor:{"@type":"http://schema.org/LodgingBusiness",name:g,url:m,telephone:h,address:f}}]}}).call();