// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,r){var a=Scanner.fromMessage(e);a.setLocale(t);var n,i,s,g,p,o,l,d,m,u,T,h,c,y,A,v,x=[],C=[];for(n=a.getSpan().innerCapture(regExpFormatted(/\1\s+(\w+)/,r.reservationId),1),T=a.getSpan().next(r.itinerary).nextTag("table2");T.inner(r.departure).exists();){for(m={},u=T.nextAnyTag("td").tagContents().innerCapture(/($<departure>.*)\s+-\s+($<arrival>.*)\n\n($<airlineCode>\D{2})($<flightNumber>\d+)/),m.departureAirport=u.$departure,m.arrivalAirport=u.$arrival,m.airlineCode=u.$airlineCode,m.flightNumber=u.$flightNumber,g=T.next(r.duration).nextAnyTag("td").tagContents(),p=g.nextAnyTag("td").nextAnyTag("td").tagContents(),i=p.nextAnyTag("td").nextAnyTag("td").tagContents(),s=i.nextAnyTag("td").tagContents(),m.departureTime=combineDateAndTime(i,g),m.arrivalTime=combineDateAndTime(s,p),m.passengers=[],c=T.next(r.passengers).nextTag("table3").allInnerTags("tr3"),y=0;y<c.length;y++)h=c[y],v={},v.name=h.nextAnyTag("td").tagContents(),A=v.name.nextAnyTag("td").tagContents().innerCapture(/($<seat>.*?)\s+($<seatingType>.*)/),v.seat=A.$seat,v.seatingType=A.$seatingType,ASSERT(v.name)&&m.passengers.push(v);T=T.nextTag("table2").nextTag("table2").nextTag("table2"),ASSERT(m.flightNumber,m.airlineCode,m.departureTime,m.arrivalTime,m.departureAirport,m.arrivalAirport)&&x.push(m)}for(y=0;y<x.length;y++){m=x[y];for(var b=0;b<m.passengers.length;b++){v=m.passengers[b];var f={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:"Air New Zealand",airlineCode:m.airlineCode,flightNumber:m.flightNumber,departureAirportFuzzy:m.departureAirport,departureTime:m.departureTime,arrivalAirportFuzzy:m.arrivalAirport,arrivalTime:m.arrivalTime},underName:{"@type":"http://schema.org/Person",name:v.name},checkinUrl:d,reservationId:n,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:o,priceCurrency:l,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:v.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:v.seat,seatingType:v.seatingType}}};C.push(f)}}if(C.length)return C}}).call();