/*! For license information please see LICENSES */ webpackJsonp([3],{"+66z":function(t,e){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},"+gg+":function(t,e,n){var r=n("TQ3y")["__core-js_shared__"];t.exports=r},"+te5":function(t,e,n){var r=n("7lMT");"string"==typeof r&&(r=[[t.i,r,""]]),r.locals&&(t.exports=r.locals);n("rjj0")("dd707630",r,!1,{sourceMap:!1})},"+tje":function(t,e,n){"use strict";var r=n("Xxa5"),i=n.n(r),o=n("exGp"),s=n.n(o),a=n("BO1k"),l=n.n(a),u=n("Dd8w"),c=n.n(u),d=n("kvU2"),p=n.n(d),f=n("PJh5"),h=n.n(f),m=n("fiaM"),v=n("NYxO"),g=n("HPim"),b=n("NnWl");e.a={props:{registration:{type:Object,required:!0},trip:{type:Object}},components:{AirportAutocomplete:g.a},data:function(){return{modalId:this.trip?"edit-trip-"+this.trip.id:"add-trip-"+this.registration.id,loading:!1,initialParams:{assign_now:0,capacity:this.trip?this.trip.capacity:0,description:this.trip?this.trip.description:null,booking_reference:this.trip?this.trip.booking_reference:null,is_group_booking:this.trip?this.trip.is_group_booking:0,segments:this.trip?this.trip.segments:[],arrive_deviation_transit_airport:this.trip?this.trip.arrive_deviation_transit_airport:null},params:{}}},created:function(){var t=this;this.initialiseFields(),this.isEditing||b.a.$on("button-edit-trip.new",function(){console.log("button-edit-trip.new"),t.$bvModal.show(t.modalId)})},computed:c()({isEditing:function(){return!!this.trip},modalOkTitle:function(){return this.loading?"Saving...":"Save"}},Object(v.mapState)({activeSeason:"activeSeason"})),methods:{initialiseFields:function(){this.params=p()(this.initialParams),this.isEditing||(this.params.assign_now=1);var t=!0,e=!1,n=void 0;try{for(var r,i=l()(this.params.segments);!(t=(r=i.next()).done);t=!0){var o=r.value;o.departure_time_date=h()(o.departure_time).format("YYYY-MM-DD"),o.departure_time_time=h()(o.departure_time).format("HH:mm"),o.arrival_time_date=h()(o.arrival_time).format("YYYY-MM-DD"),o.arrival_time_time=h()(o.arrival_time).format("HH:mm")}}catch(t){e=!0,n=t}finally{try{!t&&i.return&&i.return()}finally{if(e)throw n}}},addSegment:function(){var t=this.params.segments.length>0?this.params.segments[this.params.segments.length-1]:null;t&&this.syncSegmentTimes(t);var e=t?{departure_airport:t.arrival_airport,departure_time:t.arrival_time,departure_time_date:h()(t.arrival_time).format("YYYY-MM-DD"),departure_time_time:h()(t.arrival_time).format("HH:mm")}:{},n=m.a.bakeTripSegment(e);this.params.segments.push(n)},removeSegment:function(t){this.params.segments.splice(t,1)},handleOk:function(t){t.preventDefault(),this.isValid()?this.handleSubmit():this.showError({message:"Form validation failed. Please check all values."})},isValid:function(){return!0},onAirportSelected:function(t){var e=t.airport,n=t.index,r=t.field;this.params.segments[n][r]=e.iata_code},onDeviationAirportSelected:function(t){var e=t.airport;t.index,t.field;this.params.arrive_deviation_transit_airport=e.iata_code},syncSegmentTimes:function(t){t.departure_time=h()(t.departure_time_date+" "+t.departure_time_time,"YYYY-MM-DD HH:mm").format("YYYY-MM-DD HH:mm:ss"),t.arrival_time=h()(t.arrival_time_date+" "+t.arrival_time_time,"YYYY-MM-DD HH:mm").format("YYYY-MM-DD HH:mm:ss")},bakePayload:function(){var t=this,e=null,n=null,r=null,i=null;if(this.params.segments.length>0){var o=!0,s=!1,a=void 0;try{for(var u,d=l()(this.params.segments);!(o=(u=d.next()).done);o=!0){var f=u.value;this.syncSegmentTimes(f)}}catch(t){s=!0,a=t}finally{try{!o&&d.return&&d.return()}finally{if(s)throw a}}var h=["MED","JED","RUH","YNB"],m=p()(this.params.segments);e=m[0],n=m.find(function(t){return h.indexOf(t.arrival_airport)>-1}),r=m.find(function(t){return h.indexOf(t.departure_airport)>-1}),i=m.reverse().find(function(e){return e.arrival_airport===t.params.arrive_deviation_transit_airport})}return c()({},this.params,{season_id:this.activeSeason.id,depart_home_flight_code:e?e.flight_code:null,depart_home_airport:e?e.departure_airport:null,depart_home_time:e?e.departure_time:null,arrive_saudi_flight_code:n?n.flight_code:null,arrive_saudi_airport:n?n.arrival_airport:null,arrive_saudi_time:n?n.arrival_time:null,depart_saudi_flight_code:r?r.flight_code:null,depart_saudi_airport:r?r.departure_airport:null,depart_saudi_time:r?r.departure_time:null,arrive_deviation_transit_flight_code:i?i.flight_code:null,arrive_deviation_transit_airport:i?i.arrival_airport:null,arrive_deviation_transit_time:i?i.arrival_time:null})},handleSubmit:function(){var t=s()(i.a.mark(function t(){var e;return i.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(this.loading=!0,e=this.bakePayload(),t.prev=2,!this.isEditing){t.next=8;break}return t.next=6,this.$store.dispatch("registrations/trips/update",{payload:e,parent:this.registration,modelId:this.trip.id});case 6:t.next=10;break;case 8:return t.next=10,this.$store.dispatch("registrations/trips/create",{payload:e,parent:this.registration});case 10:this.$refs.modal.hide(),this.showSuccess(),t.next=18;break;case 14:t.prev=14,t.t0=t.catch(2),console.error(t.t0),this.showError({message:"["+t.t0.response.status+"] "+t.t0.response.data.message});case 18:this.loading=!1;case 19:case"end":return t.stop()}},t,this,[[2,14]])}));return function(){return t.apply(this,arguments)}}()},notifications:{showError:{title:"Saving trip failed",message:"Whoops, something went wrong",type:"error"},showSuccess:{message:"Saved successfully",type:"success"}}}},"+x9i":function(t,e,n){var r=n("vjaL"),i=function(t){var e=[(t=t||{}).lightness,t.saturation].map(function(t){return t=t||[.35,.5,.65],"[object Array]"===Object.prototype.toString.call(t)?t.concat():[t]});this.L=e[0],this.S=e[1],this.hash=t.hash||r};i.prototype.hsl=function(t){var e,n,r=this.hash(t);return e=r%359,r=parseInt(r/360),n=this.S[r%this.S.length],r=parseInt(r/this.S.length),[e,n,this.L[r%this.L.length]]},i.prototype.rgb=function(t){var e=this.hsl(t);return function(t,e,n){t/=360;var r=n<.5?n*(1+e):n+e-n*e,i=2*n-r;return[t+1/3,t,t-1/3].map(function(t){return t<0&&t++,t>1&&t--,t=t<1/6?i+6*(r-i)*t:t<.5?r:t<2/3?i+6*(r-i)*(2/3-t):i,Math.round(255*t)})}.apply(this,e)},i.prototype.hex=function(t){var e,n=this.rgb(t);return e="#",n.forEach(function(t){t<16&&(e+=0),e+=t.toString(16)}),e},t.exports=i},"/4xH":function(t,e,n){var r=n("/TtT");"string"==typeof r&&(r=[[t.i,r,""]]),r.locals&&(t.exports=r.locals);n("rjj0")("17609277",r,!1,{sourceMap:!1})},"/Ce5":function(t,e,n){var r;r=function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/",e(e.s=89)}([function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var r=n(54),i=n(14);t.exports=function(t){return r(i(t))}},function(t,e,n){t.exports=!n(8)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,n){var r=n(5),i=n(11);t.exports=n(3)?function(t,e,n){return r.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var r=n(7),i=n(29),o=n(23),s=Object.defineProperty;e.f=n(3)?Object.defineProperty:function(t,e,n){if(r(t),e=o(e,!0),r(n),i)try{return s(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){var r=n(21)("wks"),i=n(12),o=n(0).Symbol,s="function"==typeof o;(t.exports=function(t){return r[t]||(r[t]=s&&o[t]||(s?o:i)("Symbol."+t))}).store=r},function(t,e,n){var r=n(9);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){var r=n(34),i=n(15);t.exports=Object.keys||function(t){return r(t,i)}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e){var n=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e){t.exports={}},function(t,e){t.exports=!0},function(t,e){e.f={}.propertyIsEnumerable},function(t,e,n){var r=n(5).f,i=n(1),o=n(6)("toStringTag");t.exports=function(t,e,n){t&&!i(t=n?t:t.prototype,o)&&r(t,o,{configurable:!0,value:e})}},function(t,e,n){var r=n(21)("keys"),i=n(12);t.exports=function(t){return r[t]||(r[t]=i(t))}},function(t,e,n){var r=n(0),i=r["__core-js_shared__"]||(r["__core-js_shared__"]={});t.exports=function(t){return i[t]||(i[t]={})}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e,n){var r=n(9);t.exports=function(t,e){if(!r(t))return t;var n,i;if(e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;if("function"==typeof(n=t.valueOf)&&!r(i=n.call(t)))return i;if(!e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},function(t,e,n){var r=n(0),i=n(13),o=n(17),s=n(25),a=n(5).f;t.exports=function(t){var e=i.Symbol||(i.Symbol=o?{}:r.Symbol||{});"_"==t.charAt(0)||t in e||a(e,t,{value:s.f(t)})}},function(t,e,n){e.f=n(6)},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){var r=n(9),i=n(0).document,o=r(i)&&r(i.createElement);t.exports=function(t){return o?i.createElement(t):{}}},function(t,e,n){var r=n(0),i=n(13),o=n(51),s=n(4),a=function(t,e,n){var l,u,c,d=t&a.F,p=t&a.G,f=t&a.S,h=t&a.P,m=t&a.B,v=t&a.W,g=p?i:i[e]||(i[e]={}),b=g.prototype,y=p?r:f?r[e]:(r[e]||{}).prototype;for(l in p&&(n=e),n)(u=!d&&y&&void 0!==y[l])&&l in g||(c=u?y[l]:n[l],g[l]=p&&"function"!=typeof y[l]?n[l]:m&&u?o(c,r):v&&y[l]==c?function(t){var e=function(e,n,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,r)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(c):h&&"function"==typeof c?o(Function.call,c):c,h&&((g.virtual||(g.virtual={}))[l]=c,t&a.R&&b&&!b[l]&&s(b,l,c)))};a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,a.U=64,a.R=128,t.exports=a},function(t,e,n){t.exports=!n(3)&&!n(8)(function(){return 7!=Object.defineProperty(n(27)("div"),"a",{get:function(){return 7}}).a})},function(t,e,n){"use strict";var r=n(17),i=n(28),o=n(35),s=n(4),a=n(1),l=n(16),u=n(56),c=n(19),d=n(63),p=n(6)("iterator"),f=!([].keys&&"next"in[].keys()),h=function(){return this};t.exports=function(t,e,n,m,v,g,b){u(n,e,m);var y,_,x,w=function(t){if(!f&&t in S)return S[t];switch(t){case"keys":case"values":return function(){return new n(this,t)}}return function(){return new n(this,t)}},k=e+" Iterator",C="values"==v,z=!1,S=t.prototype,j=S[p]||S["@@iterator"]||v&&S[v],E=j||w(v),D=v?C?w("entries"):E:void 0,M="Array"==e&&S.entries||j;if(M&&(x=d(M.call(new t)))!==Object.prototype&&(c(x,k,!0),r||a(x,p)||s(x,p,h)),C&&j&&"values"!==j.name&&(z=!0,E=function(){return j.call(this)}),r&&!b||!f&&!z&&S[p]||s(S,p,E),l[e]=E,l[k]=h,v)if(y={values:C?E:w("values"),keys:g?E:w("keys"),entries:D},b)for(_ in y)_ in S||o(S,_,y[_]);else i(i.P+i.F*(f||z),e,y);return y}},function(t,e,n){var r=n(7),i=n(60),o=n(15),s=n(20)("IE_PROTO"),a=function(){},l=function(){var t,e=n(27)("iframe"),r=o.length;for(e.style.display="none",n(53).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("