// Copyright 2014 Apple Inc.  All Rights Reserved.
(function(){return function(e,r,t){var a=Scanner.fromMessage(e);a.setLocale(r);var n,i,p,o,l,g,m,u,d=[],h=[];o=a.getSpan().innerCapture(regExpFormatted(/\1(.*?)(\n|\[)/,t.reference),1).trim(),l=a.getSpan().innerCapture(regExpFormatted(/\1(.*)/,t.total),1),g=l.innerCapture(/([\d,\.]+)/,1),m=l.innerCapture(/([A-Z]{3})/,1);var s,v,T=1===a.getSpan().allInnerTags("table4").length;T?(s=2,v="td3",p=a.getSpan().next(t.info).parentTag("table3").allInnerTags("tr3")):(s=0,v="td4",p=a.getSpan().next(t.info).nextTag("table4").allInnerTags("tr4")),n=a.getSpan().next(t.passenger).nextTag(v).tagContents();for(var c=s;c<p.length-1;c++){var S,C=p[c].allInnerTags(v),f={};!T&&C.length<4||(f.flightNumber=C[0].tagContents().innerCapture(/(\d{3,4}) -/,1),u=C[2].tagContents().trim().split(/\n/)[0],S=C[0].innerDate(),f.departureTime=C[1].innerDate(),f.arrivalTime=f.departureTime.nextDate(),f.departureAirport=a.getSpan().withInterval(f.departureTime.getEnd(),f.departureTime.next("\n").getStart()).trim(),f.arrivalAirport=a.getSpan().withInterval(f.arrivalTime.getEnd(),f.arrivalTime.next("\n").getStart()).trim(),f.departureTime=a.getDetachedSpan(S+" "+f.departureTime),f.arrivalTime=a.getDetachedSpan(S+" "+f.arrivalTime),ASSERT(f.departureTime,f.arrivalTime,f.arrivalAirport,f.departureAirport,f.flightNumber)&&d.push(f))}for(var A=0;A<d.length;A++){var x=d[A],y={"@context":"http://schema.org","@type":"http://schema.org/FlightReservation",reservationFor:{"@type":"http://apple.com/FuzzyFlight",airlineName:"Norwegian",airlineCode:"DY",flightNumber:x.flightNumber,departureAirportFuzzy:x.departureAirport,departureAirportCode:x.departureAirportCode,departureTime:x.departureTime,arrivalAirportFuzzy:x.arrivalAirport,arrivalAirportCode:x.arrivalAirportCode,arrivalTime:x.arrivalTime},underName:{"@type":"http://schema.org/Person",name:n},checkinUrl:"",reservationId:o,reservationStatus:"http://schema.org/ReservationConfirmed",totalPrice:g,priceCurrency:m,reservedTicket:{"@type":"http://schema.org/Ticket",ticketNumber:i,ticketedSeat:{"@type":"http://schema.org/Seat",seatNumber:"",seatingType:u}}};h.push(y)}if(h.length)return h}}).call();