// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,n){if(!e||!t||!n)return CONTINUE;var a=Scanner.fromMessage(e);a.setLocale(t);var r,i,c,d,g,s,p,o,h,l,D,u,m,x,T,v;if(r=a.getSpan().nextText(n.reservedFor).nextAnyTag("td").tagContents(),""+r==""&&(r=r.nextAnyTag("td").tagContents()),r=r.innerCapture(/(.*)\s+\d/,1).trim(),s=a.getSpan().innerCapture(regExpFormatted(/\s\1 (\d+)/,n.reservationId),1),c=s.parentAnyTag("table"),x=c.nextTag("table5").allInnerTagsFiltered("td5")[0].tagContents(),valid(c)){var C=c.getTagNumber();if(c=c.allInnerTagsFiltered("td"+C),c.length>=2)if(l=a.getDateDD(c[1].innerDate()),valid(l)&&"fr_FR"!==t)u=a.getDetachedSpan(l.endIso8601),D=a.getDetachedSpan(l.iso8601);else if(c[1].innerText("/").exists()){var S,k,y=c[1].innerCapture(/($<checkInDate>\d{4}\/\w+\/\d+).+($<checkOutDate>\d{4}\/\w+\/\d+)/);y&&y.$checkInDate&&y.$checkOutDate?(S=(""+y.$checkInDate).split("/"),S.length>=3&&(D=a.getDetachedSpan(S[1]+"/"+S[2]+"/"+S[3]).innerDate()),k=(""+y.$checkOutDate).split("/"),k.length>=3&&(u=a.getDetachedSpan(k[1]+"/"+k[2]+"/"+k[3]).innerDate())):(y=c[1].innerCapture(/($<checkInDate>\d+\/\w+\/\d{4}).+($<checkOutDate>\d+\/\w+\/\d{4})/),y&&y.$checkInDate&&y.$checkOutDate&&(D=a.getDetachedSpan((""+y.$checkInDate).replace("/"," ")).innerDate(),u=a.getDetachedSpan((""+y.$checkOutDate).replace("/"," ")).innerDate()))}else{var I=(""+c[1]).replace(/\,/g,"").split("-");D=a.getDetachedSpan(I[0]).innerDate(),u=a.getDetachedSpan(I[1]).innerDate()}}m=a.getSpan().next(n.hotelDetails).nextLink(),c=m.parentAnyTag("td").tagContents(),v=c.innerCapture(regExpFormatted(/\1.*?>\s+(.*)[<|\n]/,n.hotelDetails),1).trim(),c.innerAddress().getLength()>=v.getLength()&&(v=c.innerAddress()),T=c.innerCapture(regExpFormatted(/\b\1 ([-\d\(\) ]+),/,n.telephone),1),h=a.getSpan().next(n.checkin).next(n.checkinTime).parentAnyTag("td").innerCapture(regExpFormatted(/(\1\s*.*)/,n.checkinTime),1),h=h.innerDate().exists()?h.innerDate():h,valid(D,h)&&(D=combineDateAndTime(D,h)),d=a.getSpan().nextText(n.priceSummary).nextText(n.totalPrice).nextTag("td7").tagContents().innerCapture(/([\d,.]+)/,1),g=a.getSpan().innerCapture(regExpFormatted(/\1 ([A-Z]{3})/,n.priceCurrency),1);var $="Confirmed";return n.cancelled.test(e.plain)&&($="Cancelled"),i=e.to,ASSERT(v,D,u)?[{"@context":"http://schema.org","@type":"http://schema.org/LodgingReservation",underName:{"@type":"http://schema.org/Person",name:r,email:i},totalPrice:d,priceCurrency:g,checkinTime:D,checkoutTime:u,modifyReservationUrl:p,cancelReservationUrl:o,reservationStatus:"http://schema.org/Reservation"+$,reservationId:s,reservationFor:{"@type":"http://schema.org/LodgingBusiness",name:x,url:m,telephone:T,address:v}}]:void 0}}).call();