// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,t,r){var a=Scanner.fromMessage(e);a.setLocale(t);var n,i,p,g,x,u,o,l,m=[],h=[],d=[],s=1,T="Confirmed";for(g=a.getSpan().nextText(r.price).nextText("\n"),g=a.getSpan().withInterval(g.getEnd(),g.nextText("\n").getStart()),x=g.innerCapture(regExpFormatted(/([\d\., ]+)/),1).trim(),u=g.innerCapture(regExpFormatted(/([^\d\., ]+)/),1),i=a.getSpan().nextText(r.flight).nextText("[1]"),a.getSpan().nextText(r.cancel).exists()?T="Cancelled":a.getSpan().nextText(r.limit).exists()?T="Pending":a.getSpan().nextText(r.refund).exists()&&(T="Cancelled");i.exists();){var v,S,c,z={},f=i.nextDate();z.flightNumber=i.nextRegExp(regExpFormatted(/\d{3,4}/)),S=z.flightNumber.nextDate(),v=z.flightNumber.nextDate().nextDate(),z.departureAirportFuzzy=a.getSpan().withInterval(z.flightNumber.getEnd(),S.previousText("(").getStart()).trim(),z.arrivalAirportFuzzy=a.getSpan().withInterval(z.flightNumber.nextText("-").getEnd(),v.previousText("(").getStart()).trim(),z.departureTime=getFuzzyDate(a.getDetachedSpan(f+" "+S)),z.arrivalTime=getFuzzyDate(a.getDetachedSpan(f+" "+v)),c=i.nextText(r.ticket),z.ticketNumber=a.getSpan().withInterval(c.getEnd(),c.nextText("\n").getStart()).trim(),z.seatNumber=[],ASSERT(z.arrivalAirportFuzzy,z.departureAirportFuzzy,z.flightNumber,z.departureTime,z.arrivalTime)&&m.push(z),s++,i=i.nextText("["+s+"]")}n=a.getSpan().nextText(r.passenger).nextText("\n"),n=a.getSpan().withInterval(n.getEnd(),n.nextText("\n").getStart()),l=a.getSpan().nextText(r.siege).nextText("\n"),s=0;do{if(ASSERT(n)&&h.push({name:n}),l.exists()){var y=a.getSpan().withInterval(l.nextText(n).getEnd(),l.nextText(n).nextText("\n").getStart()).trim().split(" ");for(var F in y){var N=y[F];""+N!="-"&&(m[F].seatNumber[s]=N)}l=a.getSpan().withInterval(l.getEnd(),l.nextText("\n").getStart())}n=n.nextText("\n"),n=a.getSpan().withInterval(n.getEnd(),n.nextText("\n").getStart()),s++}while(n.getLength());for(var b=0;b<m.length;b++)for(var A=m[b],E=0;E<h.length;E++){var C=h[E],w={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:"Airdo",airlineCode:"HD",flightNumber:A.flightNumber,departureAirportFuzzy:A.departureAirportFuzzy,departureAirportCode:A.departureAirportCode,departureTime:A.departureTime,arrivalAirportFuzzy:A.arrivalAirportFuzzy,arrivalAirportCode:A.arrivalAirportCode,arrivalTime:A.arrivalTime},underName:{"@type":"http://schema.org/Person",name:C.name},checkinUrl:o,reservationId:p,reservationStatus:"http://schema.org/Reservation"+T,totalPrice:x,priceCurrency:u,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:A.ticketNumber,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:A.seatNumber[E],seatingType:""}}};d.push(w)}if(d.length)return d}}).call();