// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,n){var a=Scanner.fromMessage(e);a.setLocale(t);var r,p,i,g,s,o,x,d,l,c,m,u,S,h,C,T,f,v,y,E,I,R,A,N,P,$,k;if("1"===n.version&&(g=a.getSpan().next(n.reservationIdPrefix).parentAnyTag("td").tagContents().innerCapture(regExpFormatted(/\1\s*(.*)/,n.reservationIdPrefix),1),not(g)&&(g=a.getSpan().next(n.reservationIdPrefix).nextAnyTag("td").tagContents()),$=a.getSpan().nextText(n.pickupInformationHeader).nextText("\n"),$=a.getSpan().withInterval($.getEnd(),$.nextText("\n").getStart()),k=getFuzzyDate(a.getDetachedSpan((""+$).replace(/,(\D+) (\d+),/," $2 $1 "))),P=$.parentAnyTag("td").lastInnerPhoneNumber(),R=a.getSpan().withInterval($.getEnd(),P.getStart()).trim().innerCapture(/^($<name>.*)\s(.*?\s)?($<address>.*(?:\s\(\d{5} \))?)$/),A=R?R.$name:null,N=R?R.$address:null,N||(R=a.getSpan().nextText(n.pickupInformationHeader).parentAnyTag("td").tagContents(),R=(""+R).split("\n"),N=""+R.slice(2,3)),I=a.getSpan().nextText(n.pickupInformationHeader).nextRegExp(n.returnDateRegExp).nextText("\n"),I=a.getSpan().withInterval(I.getEnd(),I.nextText("\n").getStart()),l=getFuzzyDate(a.getDetachedSpan((""+I).replace(/,(\D+) (\d+),/," $2 $1 "))),E=I.parentAnyTag("td").lastInnerPhoneNumber(),f=a.getSpan().withInterval(I.getEnd(),E.getStart()).trim().innerCapture(/^($<name>.*)\s(.*?\s)?($<address>.*(?:\s\(\d{5} \))?)$/),v=f?f.$name:null,y=f?f.$address:null,y||(f=a.getSpan().nextText(n.returnText).parentAnyTag("td").tagContents(),f=(""+f).split("\n"),y=""+f.slice(2,3)),a.getSpan().nextText(n.cancellationHeader).exists()?(s="Cancelled",r=a.getSpan().next(n.firstNameSuffix).parentAnyTag("td").tagContents().innerCapture(regExpFormatted(/\s*(.+?)\1/,n.firstNameSuffix),1).trim()):r=a.getSpan().nextText(n.firstNamePrefix).nextAnyTag("td").tagContents(),p=a.getSpan().nextRegExp(RegExp(n.emailAddressPrefix,"i")).nextAnyTag("td").tagContents(),c=a.getSpan().nextRegExp(RegExp(regExpEscape(n.pricingPrefix)+"(?:\\s+\\(.*?\\))?")),m=c.nextTag("td7").tagContents().innerCapture(/([\d,.]+)/,1),u=c.innerCapture(/\((.*?)\)/,1),not(u)&&(u=c.nextTag("td7").tagContents().innerCapture(/[\d,.]+\s+([A-Z]{3})/,1)),T=a.getSpan().nextText("add-to-email-calendar-from-mail.ac").parentAnyTag("td"),4===T.allInnerLinks().length&&(x=T.nextLink().nextLink(),d=x.nextLink()),S=a.getSpan().nextText(n.carPrefix).nextAnyTag("table"),i=S.getTagNumber(),S=S.allInnerTagsFiltered("td"+i),S.length>2&&(S=S[1].tagContents())),"2"===n.version){if(n.cancellation.test(a.getSpan().tagContents()))return CONTINUE;r=a.getSpan().innerCapture(n.guestName,1),p=a.getSpan().nextRegExp(n.guestName).nextLink(),g=a.getSpan().innerCapture(n.reservationId,1);var D=a.getSpan().innerCapture(n.price,1);m=D.innerCapture(/([\d,.]+)/,1),u=D.innerCapture(/([^\d,.]+)/,1).trim(),k=a.getSpan().nextRegExp(n.dates).nextDate(),l=a.getSpan().nextRegExp(n.dates).nextDate().nextDate(),P=E=a.getSpan().nextRegExp(n.dates).nextPhoneNumber(),N=y=a.getSpan().innerCapture(n.address,1),S=a.getSpan().innerCapture(n.brand,1),s="Confirmed"}if(!ASSERT(g,r,N,k,y,l))return CONTINUE;var L={"@context":"http://schema.org","@type":"http://schema.org/RentalCarReservation",totalPrice:m,priceCurrency:u,reservationId:g,reservationStatus:"http://schema.org/Reservation"+(s||"Confirmed"),checkinUrl:o,modifyReservationUrl:x,cancelReservationUrl:d,underName:{"@type":"http://schema.org/Person",name:r,email:p},provider:{"@type":"http://schema.org/Organization",name:"Avis"},pickupTime:k,pickupLocation:{"@type":"http://schema.org/Place",name:A,telephone:P,address:N},dropoffTime:l,dropoffLocation:{"@type":"http://schema.org/Place",name:v,telephone:E,address:y}};return S&&(""+S).length>0&&(L.reservationFor={"@type":"http://schema.org/Car",brand:{"@type":"http://schema.org/Organization",name:S},license:h,color:C}),[L]}}).call();