// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,r){function n(e){return e=e.replace(/[^\d\sa-zA-z:\u6642\u5206]+/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 p,i,o,c,s,m,u,h,g,l,d,f,C,S,v,y,R,N,T,k,P="Toyota";o=a.getSpan().innerCapture(r.reservationId,1),p=a.getSpan().innerCapture(r.guestName,1),i=a.getSpan().innerCapture(r.guestEmail,1),R=""+a.getSpan().innerCapture(r.pickupNameAndPhone,1),T=""+a.getSpan().innerCapture(r.pickupNameAndPhone,2),0!==(""+R).length&&null!==R||(R=""+a.getSpan().innerCapture(r.pickupName,1)),k=""+a.getSpan().innerCapture(r.pickupTime,1),k=n(k),C=""+a.getSpan().innerCapture(r.dropoffName,1),y=""+a.getSpan().innerCapture(r.dropoffTime,1),y=n(y),l=""+a.getSpan().innerCapture(r.car,1);var U=a.getSpan().innerCapture(r.price,1);if(0===(""+U).length||null===U)var U=a.getSpan().innerCapture(r.priceAlt,1);if(h=U.innerCapture(/([\d,.]+)/,1),g=U.innerCapture(/([^\d,.]+)/,1).trim(),0===p.toString.length&&r.reminderSubject.test(e.subject)&&(p=a.getSpan().innerCapture(/(.+)/,1)),r.confirmSubject.test(e.subject)){if(!ASSERT(p,o,k,y,N||R,S||C))return CONTINUE;c="Confirmed"}if(r.cancellationSubject.test(e.subject)){if(!ASSERT(p,o,k,y,N||R,S||C))return CONTINUE;c="Cancelled"}return(""+l).length>0?[{"@context":"http://schema.org","@type":"http://schema.org/RentalCarReservation",totalPrice:h,priceCurrency:g,reservationId:o,reservationStatus:"http://schema.org/Reservation"+(c||"Confirmed"),checkinUrl:s,modifyReservationUrl:m,cancelReservationUrl:u,underName:{"@type":"http://schema.org/Person",name:p,email:i},provider:{"@type":"http://schema.org/Organization",name:P},reservationFor:{"@type":"http://schema.org/Car",brand:{"@type":"http://schema.org/Organization",name:l},license:d,color:f},pickupTime:k,pickupLocation:{"@type":"http://schema.org/Place",name:R,telephone:T,address:N||R},dropoffTime:y,dropoffLocation:{"@type":"http://schema.org/Place",name:C,telephone:v,address:S||C}}]:[{"@context":"http://schema.org","@type":"http://schema.org/RentalCarReservation",totalPrice:h,priceCurrency:g,reservationId:o,reservationStatus:"http://schema.org/Reservation"+(c||"Confirmed"),checkinUrl:s,modifyReservationUrl:m,cancelReservationUrl:u,underName:{"@type":"http://schema.org/Person",name:p,email:i},provider:{"@type":"http://schema.org/Organization",name:P},pickupTime:k,pickupLocation:{"@type":"http://schema.org/Place",name:R,telephone:T,address:N||R},dropoffTime:y,dropoffLocation:{"@type":"http://schema.org/Place",name:C,telephone:v,address:S||C}}]}}).call();