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