// Copyright 2014 Apple Inc.  All Rights Reserved.
new ReverseTemplateList([new ReverseTemplate("delta.com-forwarded-itinerary-en",function(e){return/^Delta\.com (?:Itinerary|Trip Information) from:/.test(e.subject)},function(e){function r(){F?F=!1:ASSERT(b,c,T,v,l)&&(C.push({airlineName:u,airlineCode:g,flightNumber:l,departureTime:c,departureAirport:d,departureCode:b,arrivalTime:v,arrivalAirport:N,arrivalCode:T,passengers:y}),h=d=c=b=f=N=v=T=s=u=g=l=null)}if(/^Delta\.com (?:Itinerary|Trip Information) from:/.test(e.subject)){var t=Scanner.fromMessage(e);t.setLocale("en_US");var a,i,n,o,p,l,m,s,u,g,h,c,d,b,f,v,N,T,C=[],y={};i=t.getSpan().nextRegExp(/Confirmation Number\s+:/).parentAnyTag("td").tagContents().innerCapture(/Confirmation Number\s+:(.*)/,1),o=t.getSpan().nextText("Who's Coming Along").nextTag("table2").allInnerTagsFiltered("td2");for(var A=0;A<o.length;A++)y[""+o[A]]={name:""+o[A],seats:{},seatingType:{}};p=t.getSpan().nextText("Our Flights").nextTag("table2").allInnerTags("tr2");for(var S=/($<airport>.*?) \(($<code>[A-Z]{3})\)/,F=!0,A=0;A<p.length;A++)m=p[A].allInnerTagsFiltered("td2"),m[0].innerCapture(/^Flight Number:/)?r():m[0].innerCapture(S)&&m[3]?(h=m[0].innerCapture(S),d=h?h.$airport:null,b=h?h.$code:null,f=m[2].innerCapture(S),N=f?f.$airport:null,T=f?f.$code:null,s=m[3].innerCapture(/($<airlineName>.*)\s+($<flightNumber>\d+)/),u=s?s.$airlineName.trim():null,""+u=="DL"&&(u=null,g="DL"),l=s?s.$flightNumber:null):m[0].innerCapture(/^Departs/)&&m[1]&&(c=m[0].innerDate(),v=m[1].innerDate());r();for(var $=[],A=0;A<C.length;A++)for(var x=C[A],I=Object.keys(x.passengers),D=0;D<I.length;D++){var k=x.passengers[I[D]],z={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:x.airlineName,airlineCode:x.airlineCode,flightNumber:x.flightNumber,departureAirportFuzzy:x.departureAirport,departureAirportCode:x.departureCode,departureTime:x.departureTime,arrivalAirportFuzzy:x.arrivalAirport,arrivalAirportCode:x.arrivalCode,arrivalTime:x.arrivalTime},underName:{"@type":"http://schema.org/Person",name:k.name},checkinUrl:n,reservationId:i,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:k.totalPrice,priceCurrency:k.priceCurrency,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:a,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:k.seats[x.flightNumber],seatingType:k.seatingType[x.flightNumber]}}};valid(k.membershipNumber,k.programName)&&(z.programMembershipUsed={"@type":"http://schema.org/ProgramMembership",membershipNumber:k.membershipNumber,programName:k.programName}),$.push(z)}if($.length)return $}},"0/1/2/3/4/5/240/413/416","SGc03c5063")]);