// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(t,e,n){var r=Scanner.fromMessage(t);r.setLocale(e);var a,i,g,o,s,p,l,d,y,u,T,A,x,h,C,c,m,f,v,N=[],S={};y="Jeju Air",d=r.getSpan(),i=d.innerCapture(regExpFormatted(/.*\1\s*:\s*(\d*)/,n.reservationId_prefix),1),p=d.next(n.passenger).nextAnyTag("tr");do p=p.nextAnyTag("tr");while(null===p.nextAnyTag("td").nextAnyTag("td").tagContents().innerCapture(n.firstFlight));for(o=p.nextAnyTag("td").tagContents(),a=p.nextAnyTag("td").nextAnyTag("td").nextAnyTag("td").tagContents(),f=d.innerCapture(n.flightCurrency_alt,1),p=d.next(n.flightExit).nextAnyTag("tr");0===p.nextAnyTag("td").tagContents().getLength();)p=p.nextAnyTag("tr");do{for(p=p.nextAnyTag("tr");0===p.nextAnyTag("td").tagContents().getLength();)p=p.nextAnyTag("tr");m=p.nextAnyTag("td").nextAnyTag("td").nextAnyTag("td").nextAnyTag("td").nextAnyTag("td").tagContents(),m=m.innerCapture(n.totalPrice_prefix,1)}while(null===m);ASSERT(o)&&(S[""+o]={name:o,seats:{},seatingType:null,ticketNumber:a,totalPrice:m,priceCurrency:f});var F=d.next(n.flightSummary).nextAnyTag("tr");for(p=F.nextAnyTag("tr");0===p.nextAnyTag("td").tagContents().getLength()||p.nextAnyTag("td").nextAnyTag("td").tagContents()==n.flightNumber;)p=p.nextAnyTag("tr");do for(v=p.nextAnyTag("td").nextAnyTag("td"),l=v.tagContents(),u=null,v=v.nextAnyTag("td"),C=v.tagContents(),A=C.innerCapture(/(.*) - (.*)/,1),C=C.innerCapture(/(.*) - (.*)/,2),x=null,c=null,v=v.nextAnyTag("td"),T=v.tagContents(),T=T.innerCapture(/(.+)\(.*\)(.+)/),s=T[1],T=T[2],T=s+" "+T,T=getFuzzyDate(r.getDetachedSpan(T).firstDate()),v=v.nextAnyTag("td"),h=v.tagContents(),h=h.innerCapture(/(.+)\(.*\)(.+)/),s=h[1],h=h[2],h=s+" "+h,h=getFuzzyDate(r.getDetachedSpan(h).firstDate()),ASSERT(l,A,T,C,h)&&N.push({reservationId:i,airlineName:y,airlineCode:u,flightNumber:l,departureAirport:A,departureCode:x,departureTime:T,arrivalAirport:C,arrivalCode:c,arrivalTime:h,passengers:S}),p=p.nextAnyTag("tr");0===p.nextAnyTag("td").tagContents().getLength();)p=p.nextAnyTag("tr");while(null!==p.nextAnyTag("td").tagContents().innerCapture(n.oneFlight));for(var z=[],b=0;b<N.length;b++)for(var k=N[b],D=Object.keys(k.passengers),L=0;L<D.length;L++){var P=k.passengers[D[L]],E={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:k.airlineName,airlineCode:k.airlineCode||"7C",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:P.name},checkinUrl:g,reservationId:k.reservationId,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:P.totalPrice,priceCurrency:P.priceCurrency,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:a,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:P.seats[k.flightNumber],seatingType:P.seatingType}}};z.push(E)}if(z.length)return z}}).call();