// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,n){var a=Scanner.fromMessage(e);a.setLocale(t);var r,s,o,g,i,l,p,c;if(a.getSpan().allInnerDates().length>0){if(s=a.getDetachedSpan(a.getSpan().allInnerDates().join(" ")).lastInnerDate(),!/[0-9]{4}/.test(""+s)){var D=new Date(1e3*e.epoch),d=new Date(a.getDateDD(s).iso8601),m=modifyDate(s,-365),h=new Date(a.getDateDD(m).iso8601),v=d.getTime()-D.getTime(),u=D.getTime()-h.getTime();v>u&&(s=m)}if(o=a.getDateDD(s),o&&(o=o.endIso8601),c=a.getSpan().lastInnerDate(),g=a.getSpan().next(n.eventUrl).nextLink(),l=(""+c.parentAnyTag("td").tagContents().innerCapture(/[\s\S]*?(.+)\n/,1)).replace(/[\u201c\u201d]/g,"").trim(),""===l&&(l=c.parentAnyTag("td").previousAnyTag("td").tagContents()),i=c.collapseToEnd().nextAddress(),n.cancellation.test(e.subject)&&(p="Cancelled"),r=(""+c.parentAnyTag("td").tagContents().innerCapture(regExpFormatted(/\1\s*(.*)/,""+c),1)).trim(),""!==r||i.exists()||(r=c.nextAnyTag("td").tagContents()),""+r==""+i&&(r=null),ASSERT(l,s))return[{"@context":"http://schema.org","@type":"http://schema.org/EventReservation",reservationStatus:"http://schema.org/Reservation"+(p||"Pending"),reservationFor:{url:g,"@type":"http://schema.org/SocialEvent",name:l,startDate:s,endDate:o,location:valid(r)?{"@type":"http://schema.org/Place",name:r,address:i}:i}}]}}}).call();