// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,n){if(!e||!t||!n)return CONTINUE;var a=loadHelper("seatme.com-microdata-parser.js"),r=a(e),i=Scanner.fromMessage(e);if(i.setLocale(t),r)return delete r[0].modifiedTime,r[0].startTime="zh_Hans_CN"===t||"ja_JP"===t?combineDateAndTime(/(.*)T/.exec(r[0].startTime)[1],i.getSpan().innerCapture(/(\d{2}:\d{2})/,1).innerDate()):i.getSpan().innerDate(),r[0]["@context"]="http://schema.org",r[0].reservationStatus="http://schema.org/ReservationConfirmed",r;if("zh_Hans_CN"===t)return CONTINUE;var s,o,p,m,g,c,d,h,l,u,S;return s=i.getSpan().innerCapture(n.underNameLabel,1),h=i.getSpan().nextAddress(),d=i.getSpan().nextText(n.contactLabel).nextPhoneNumber(),S=i.getSpan().nextRegExp(n.agentUrlLabel).nextLink(),g=i.getSpan().nextText(n.urlLabel).nextLink(),m=i.getSpan().innerCapture(n.partySize,1),p=i.getSpan().innerCapture(n.name,1),c=i.getDetachedSpan(""+i.getSpan().innerCapture(n.startTime,1)).innerDate(),c.exists()||"ja_JP"!==t||(c=i.getSpan().innerCapture(n.startTimeRegex),c=i.getDetachedSpan(""+c.$day+"/"+c.$month+" "+c.$time).innerDate()),p.exists()||(p=i.getDetachedSpan(e.subject).innerCapture(n.subjectName,1)),l=i.getSpan().next(n.modifyUrlLabel).nextLink(),l.exists()&&l.innerRegExp(/\/edit\/[-\w]+\//)&&(o=l.innerCapture(/\/edit\/([-\w]+)\//,1)),u=i.getSpan().nextText(n.cancelUrlLabel).nextLink(),ASSERT(p,c,s)?[{"@context":"http://schema.org","@type":"http://schema.org/FoodEstablishmentReservation",partySize:m,reservationId:o,reservationStatus:"http://schema.org/ReservationConfirmed",reservationFor:{"@type":"http://schema.org/FoodEstablishment",name:p,url:g,telephone:d,address:h},startTime:c,bookingAgent:{"@type":"http://schema.org/Organization",name:"SeatMe",url:S},underName:{"@type":"http://schema.org/Person",name:(""+s).trim()},cancelReservationUrl:u,modifyReservationUrl:l}]:void 0}}).call();