// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(t,e,n){var a=Scanner.fromMessage(t);a.setLocale(e);var r,o,g,i,s,p,c,d,x,l,m,C,h,u,S,T,v,f,y,R,P;if(i=a.getSpan().nextRegExp(RegExp(n.reservationIdPrefix)).parentAnyTag("td").tagContents().innerCapture(regExpFormatted(/\1 (\d{4}\-\d{4}\-[A-Z]{2}\-\d)/,n.reservationIdPrefix),1),o=a.getSpan().nextRegExp(n.guestName).nextTag("td2").tagContents(),r=o.innerCapture(/(.+?)\,/,1),r.exists()||(r=o),P=getFuzzyDate(a.getSpan().next(n.dates).nextTag("td2").tagContents()),R=a.getSpan().next(n.carLocation).nextTag("td2").tagContents().innerPhoneNumber(),y=a.getSpan().next(n.carLocation).nextTag("td2").tagContents(),y=(""+y).split("\n"),f=y[0].trim(),y=y.slice(1,-2).toString("").trim(),v=getFuzzyDate(a.getSpan().next(n.dates).nextTag("td2").nextTag("td2").tagContents()),T=a.getSpan().next(n.carLocation).nextTag("td2").nextTag("td2").tagContents().innerPhoneNumber(),S=a.getSpan().next(n.carLocation).nextTag("td2").nextTag("td2").tagContents(),S=(""+S).split("\n"),u=S[0].trim(),S=S.slice(1,-2).toString("").trim(),x=a.getSpan().next(n.totalPrice).nextTag("td2").tagContents().innerCapture(/([\d,.]+)/,1),l=(""+a.getSpan().next(n.totalPrice).nextTag("td2").tagContents().innerCapture(/([^\d,.]+)/,1)).trim(),m=a.getSpan().nextRegExp(n.brand).nextTag("td2").tagContents(),c=a.getSpan().nextTag("table2").tagContents().innerLink(),d=c,n.pendingSubject.test(t.subject)&&n.pendingReservation.test(t.plain)&&(s="Pending"),n.cancellationHeader.test(t.subject)&&(s="Cancelled",i=a.getSpan().nextRegExp(n.reservationIdCancel).tagContents().innerCapture(n.reservationIdCancel,1),y=a.getSpan().next(n.carLocation).nextTag("td2").tagContents(),S=a.getSpan().next(n.carLocation).nextTag("td2").nextTag("td2").tagContents()),ASSERT(r,y,P)){var L={"@context":"http://schema.org","@type":"http://schema.org/RentalCarReservation",totalPrice:x,priceCurrency:l,reservationId:i,reservationStatus:"http://schema.org/Reservation"+(s||"Confirmed"),checkinUrl:p,modifyReservationUrl:c,cancelReservationUrl:d,underName:{"@type":"http://schema.org/Person",name:r,email:g},provider:{"@type":"http://schema.org/Organization",name:"Avis"},pickupTime:P,pickupLocation:{"@type":"http://schema.org/Place",name:f,telephone:R,address:y},dropoffTime:v,dropoffLocation:{"@type":"http://schema.org/Place",name:u,telephone:T,address:S}};return m&&(L.reservationFor={"@type":"http://schema.org/Car",brand:{"@type":"http://schema.org/Organization",name:m},license:C,color:h}),[L]}}}).call();