new ReverseTemplateList([new ReverseTemplate("virginamerica.com-confirmation-and-checkin-en",function(e){return/^Virgin America Reservation [A-Z]{6}/.test(e.subject)||/^It's Time to Check In/.test(e.subject)},function(e){if(/^Virgin America Reservation [A-Z]{6}/.test(e.subject)||/^It's Time to Check In/.test(e.subject)){var t=Scanner.fromMessage(e);t.setLocale("en_US");var r,a,n,i,s,o,p,m,g,l,u,c,h,d,v,b,C,T,f,A,y,N=[],x={};if(r=t.getSpan().innerCapture(/\bYour Confirmation Code: ([A-Z]{6})/,1),a=r.nextLink(),i=t.getSpan().nextRegExp(/Who['\u2019]s Flying/).nextAnyTag("table"),i.exists()){var S=i.getTagNumber();i=i.allInnerTags("tr"+S);for(var $,k=1;$=i[k++];)u=$.allInnerTags("td"+S),n=u[0].tagContents(),x[""+n]={name:n,membershipNumber:""+u[1].tagContents(),seatList:u[2]&&u[2].tagContents().split(/(?:\s+|,)(?:\/\s+)?/g).filter(function(e){return"Not"!=e}).map(function(e){return"Selected"==e||"N/A"==e?"":e})}}if(p=t.getSpan().nextRegExp(/Where You['\u2019]re Going/).nextAnyTag("table"),p.exists()){var S=p.getTagNumber();p=p.allInnerTags("tr"+S);for(var k=1;o=p[k];k++)if(o=o.allInnerTags("td"+S),o.length>=4&&(s=o[0].innerDate(),c=o[1].tagContents().innerCapture(/($<code>.*?)\s*($<flightNumber>\d{1,4})/g),h=c?c.$code:null,m=c?c.$flightNumber:null,d=o[2].tagContents().innerCapture(/($<airport>.*)\s\(($<code>[A-Z]{3})\)/),b=d?d.$airport:null,C=d?d.$code:null,v=combineDateAndTime(s,o[2].tagContents().innerDate()),T=o[3].tagContents().innerCapture(/($<airport>.*)\s\(($<code>[A-Z]{3})\)/),A=T?T.$airport:null,y=T?T.$code:null,f=combineDateAndTime(s,o[3].tagContents().innerDate()),f<v&&(f=modifyDate(f,1)),ASSERT(h,m,C,v,y,f))){for(var I=Object.keys(x),F=0;n=I[F++];)x[n].seats||(x[n].seats={}),x[n].seatList.length>=k&&(x[n].seats[m]=x[n].seatList[k-1]);N.push({airlineCode:h,flightNumber:m,departureAirport:b,departureCode:C,departureTime:v,arrivalAirport:A,arrivalCode:y,arrivalTime:f,passengers:x})}}l=t.getSpan().firstText("What It Costs").nextTag("table3").innerCapture(/This total is for [0-9][\d]* Traveler\(s\) in (.*):/,1),g=t.getSpan().nextText("Grand Total:").nextTag("td4").tagContents().innerCapture(/([\d,.]+)/,1);for(var R=[],k=0;k<N.length;k++){var j=N[k];if(j.passengers)for(var I=Object.keys(j.passengers),F=0;F<I.length;F++){var z=j.passengers[I[F]];schema={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineCode:j.airlineCode,flightNumber:j.flightNumber,departureAirportFuzzy:j.departureAirport,departureAirportCode:j.departureCode,departureTime:j.departureTime,arrivalAirportFuzzy:j.arrivalAirport,arrivalAirportCode:j.arrivalCode,arrivalTime:j.arrivalTime},underName:{"@type":"http://schema.org/Person",name:z.name},reservedTicket:{"@type":"http://schema.org/Ticket",ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:z.seats[j.flightNumber]}},checkinUrl:a,reservationId:r,totalPrice:g,priceCurrency:l,reservationStatus:"http://schema.org/ReservationConfirmed"},valid(z.membershipNumber)&&(schema.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:z.membershipNumber,programName:"Frequent Flyer"}),R.push(schema)}}if(R.length)return R}},"0/1/2/3/4/5/6/152/848/849","SG781cd342")]);