// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,n){var a=Scanner.fromMessage(e);a.setLocale(t);var r,i,s,o,g,p,d,x,c,l,T,h;r=a.getSpan().nextText(n.underPersonNamePrefix).nextAnyTag("td").nextAnyTag("td").tagContents().innerCapture(/(.*)\n/,1),i=""+e.to,d=a.getSpan().innerCapture(regExpFormatted(/\1\s+?(\d+)\s+?/,n.reservationIdPrefix),1);var m=a.getSpan().nextText(n.reservationIdPrefix);m=m.parentAnyTag("table").innerDate().exists()?m.parentAnyTag("table"):m.nextDate().parentAnyTag("table"),s=m.nextAnyTag("td").tagContents().innerCapture(/([^\,]+)/,1),m=m.nextAnyTag("td").nextAnyTag("td").tagContents(),T=a.getSpan().innerCapture(regExpFormatted(/(\1\s+.*)/,n.checkInTime),1).innerDate();var u=a.getDateDD(m.innerDate());if(u&&u.iso8601&&u.endIso8601)x=combineDateAndTime(u.iso8601,T),c=u.endIso8601;else{var A=m.innerCapture(/(?:[a-zA-Z]{3})?(.*) - (?:[a-zA-Z]{3})?(.+?)\s[\,|\s]/);x=a.getDetachedSpan((""+A[1]).replace(/\//g," ")+" "+T).innerDate(),c=a.getDetachedSpan((""+A[2]).replace(/\//g," ")).innerDate()}p=a.getSpan().nextText(n.hotelAddressPrefix).nextLink(),g=a.getSpan().nextText(n.hotelAddressPrefix).nextAddress(),o=(""+a.getSpan().nextText(n.hotelAddressPrefix).nextPhoneNumber()).replace(n.phonePrefix,"").trim();var C=a.getSpan().nextText(n.totalPricePrefix).parentAnyTag("td").tagContents();C.innerCapture(/(\d+)/,1).exists()||(C=C.nextAnyTag("td").tagContents()),h=C.innerCapture(/(.)\d+/,1),l=C.innerCapture(/([\d,.]+)/,1);var v=n.cancelled.test(e.plain)?"Cancelled":"Confirmed";return ASSERT(OR(r,i),g,x)?[{"@context":"http://schema.org","@type":"http://schema.org/LodgingReservation",underName:{"@type":"http://schema.org/Person",name:r,email:i},totalPrice:l,priceCurrency:h,checkinTime:x,checkoutTime:c,reservationStatus:"http://schema.org/Reservation"+v,reservationId:d,reservationFor:{"@type":"http://schema.org/LodgingBusiness",name:s,telephone:o,url:p,address:g}}]:CONTINUE}}).call();