// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,r){var n=Scanner.fromMessage(e);n.setLocale("en_US");for(var t=n.getSpan(),a=[],o=[],p=[],i=e.plain.split(/Pick-Up/i).length-1,c=(e.plain.slice(),0);c<i;c++)t=t.next(/(^Car Rental[\s\S]*?)(?:^Flight [A-Z]|^Hotel$|^Car Rental$|^Plan)/gm),t.isNullSpan_||p.push(""+t);return 0===p.length?CONTINUE:(p.forEach(function(e){var t,a,p,i,c,s,l,d,h,m,f,u,g,v,k,T,y,N,U="Confirmed",C=n.getDetachedSpan(e),R=e.slice(),e=e.split("\n");y=/Company.*\n.*\n(.*)\n/.exec(R),y&&2===y.length&&(y=y[1]),c=/Pick-Up At.*\n.*\n(.*)\n/.exec(R),c&&2===c.length&&(c=y+", "+c[1]),h=c,a=C.nextDate(),s=C.nextDate().nextDate(),t=/Confirmation #.*\n.*\n(.*)\n/.exec(R),t&&2===t.length&&(t=t[1]),N=/Vehicle Type.*\n.*\n(.*)\n/.exec(R),N&&2===N.length&&(N=N[1]),m=/Rate.*\n.*\n([\d,.]+)\s*([A-Z]{2,3})/.exec(R),m&&3===m.length&&(f=m[1],u=m[2]),o.push({reservationId:t,pickupTime:a,pickupName:p,pickupTelephone:i,pickupAddress:c,dropoffTime:s,dropoffName:l,dropoffTelephone:d,dropoffAddress:h,totalPrice:f,priceCurrency:u,reservationStatus:U,checkinUrl:g,modifyReservationUrl:v,cancelReservationUrl:k,underName:T,brand:N,provider:y,underPersonName:r.underName})}),o.forEach(function(e){ASSERT(e.pickupTime,e.pickupAddress,e.dropoffTime,e.dropoffAddress),a.push({"@context":"http://schema.org","@type":"http://schema.org/RentalCarReservation",reservationId:e.reservationId,totalPrice:e.totalPrice,priceCurrency:e.priceCurrency,reservationStatus:"http://schema.org/"+e.reservationStatus,checkinUrl:e.checkinUrl,modifyReservationUrl:e.modifyReservationUrl,cancelReservationUrl:e.cancelReservationUrl,underName:{"@type":"http://schema.org/Person",name:e.underName},provider:{"@type":"http://schema.org/Organization",name:e.provider},reservationFor:{"@type":"http://schema.org/Car",brand:{"@type":"http://schema.org/Organization",name:e.brand},license:"",color:""},pickupTime:e.pickupTime,pickupLocation:{"@type":"http://schema.org/Place",name:e.pickupName,telephone:e.pickupTelephone,address:e.pickupAddress},dropoffTime:e.dropoffTime,dropoffLocation:{"@type":"http://schema.org/Place",name:e.dropoffName,telephone:e.dropoffTelephone,address:e.dropoffAddress}})}),a.length>=1?a:CONTINUE)}}).call();