// Copyright 2014 Apple Inc.  All Rights Reserved.
new ReverseTemplateList([new ReverseTemplate("air_inuit-flight-confirmation-en",function(e){return/^Air Inuit - (?:Your)*(?:\s)*Booking/.test(e.subject)},function(e){if(/^Air Inuit - (?:Your)*(?:\s)*Booking/.test(e.subject)){var r=Scanner.fromMessage(e);r.setLocale("en_CA");var t,a,i,n,o,s,p,l,u,c,g,m,d,h,T,C,v,A,f,y,N=r.getSpan(),I=[],b={};for(a=(""+N.nextText("Web Booking Reference").nextTag("td1").tagContents()).match(/(.+)\s/)[1].trim(),l=N.nextText("TOTAL TRIP COST").nextTag("th2").tagContents().innerCapture(/($<priceCurrency>[\w]+)\s($<totalPrice>[\d,.]+)/),u=l?l.$totalPrice:null,c=l?l.$priceCurrency:null,o=N.withInterval(N.nextText("PASSENGER DETAILS").getEnd(),N.nextText("TRAVEL INFORMATION").getStart()).allInnerTagsFiltered("tr1"),o.shift(),f=0;f<o.length;f++)[,n,t]=o[f].innerCapture(/^(.+?)\[\/td1\].*\s([0-9-]+)/),n=n.trim(),b[""+n]={name:n,totalPrice:u,priceCurrency:c,ticketNumber:t};for(s=N.nextText("TRAVEL INFORMATION").parentTag("table1").allInnerTagsFiltered("tr1"),s.shift(),f=0;f<s.length;f++)if(!/BAGGAGE ALLOWANCE/.test(s[f])){var x;[,x]=s[f].innerCapture(/(.+)\n/),/\//.test(x)||([,g,p]=x.innerCapture(/([A-Z0-9]{2})\s(\d+)/));var S=s[f].allInnerTagsFiltered("td1");m=S[0].innerDate(),[,d,h]=S[0].innerCapture(/(.+)\s\((.+)\)/),T=S[1].innerDate(),[,C,v]=S[1].innerCapture(/(.+)\s\((.+)\)/),ASSERT(m,T)&&I.push({airlineCode:g,flightNumber:p,departureTime:m,departureCode:h,departureAirport:d.trim(),arrivalTime:T,arrivalCode:v,arrivalAirport:C.trim(),passengers:b})}var R=[];for(f=0;f<I.length;f++){var k=I[f],F=Object.keys(k.passengers);for(y=0;y<F.length;y++){A=k.passengers[F[y]];var E={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:"Air Inuit",airlineCode:k.airlineCode,flightNumber:k.flightNumber,departureAirportFuzzy:k.departureAirport,departureAirportCode:k.departureCode,departureTime:k.departureTime,arrivalAirportFuzzy:k.arrivalAirport,arrivalAirportCode:k.arrivalCode,arrivalTime:k.arrivalTime},underName:{"@type":"http://schema.org/Person",name:A.name},checkinUrl:i,reservationId:a,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:A.totalPrice,priceCurrency:A.priceCurrency,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:A.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:"",seatingType:""}}};R.push(E)}}if(R.length)return R}},"0/1/2/3/4/5/240/283/284","SGc485221b")]);