if(void 0!==document.getElementById("xtd-search-flight")&&null!=document.getElementById("xtd-search-flight")){Vue.component("v-select",VueSelect.VueSelect);var xtenderSearchFlight=new Vue({el:"#xtd-search-flight",data:function(){var e={from:null,to:null,date:"",pax:2};return{empty_leg:e,legs:[JSON.parse(JSON.stringify(e))],requirements:"",requirements_visibility:!1,return_flight:!0,options:[],loading:"",modal:!1,modal_visibility:!1}},mounted:function(){this.mountFlatPickrs(0),0<=this.$el.className.indexOf("modal")&&(this.modal=!0)},watch:{modal_visibility:function(e){e?this.$el.className+=" xtd-search-flight--modal-opened":this.$el.className=this.$el.className.replace(" xtd-search-flight--modal-opened","")}},methods:{isSearchDisabled:function(){var e=this,t=!0;return window.lodash.each(e.legs,function(e){!0===t&&null!==e.from&&null!==e.to&&1<e.date.length&&0<e.pax&&(t=!1)}),t},searchFlights:function(){var e=this,t=leg="";window.lodash.each(e.legs,function(e){leg="",leg+=e.from.value+" | "+e.from.label+" | "+e.from.location+" >>> ",leg+=e.to.value+" | "+e.to.label+" | "+e.to.location+" | "+e.date+" | PAX: "+e.pax+"\n",t+=leg+"\n"}),window.location.href=this.$el.dataset.url+"?"+this.$el.dataset.query+"="+encodeURIComponent(t)},deleteRequirements:function(){this.requirements_visibility=!1,this.requirements=""},deleteLeg:function(i){var e=this,n=[];window.lodash.each(e.legs,function(e,t){i!==t&&n.push(e)}),e.legs=n},onChangePax:function(e,t){var i=this;(isNaN(parseInt(i.legs[t].pax))||i.legs[t].pax<1)&&(i.legs[t].pax=1)},mountFlatPickrs:function(e){var t=this;setTimeout(function(){flatpickr(t.$refs["flatpikr_"+e][0],{enableTime:!0,dateFormat:"Y-m-d H:i",time_24hr:!0,minDate:Date.now()})},500)},addReturn:function(){var e=this;e.legs.push(e.empty_leg),e.return_flight=!1,this.mountFlatPickrs(e.legs.length-1)},addRequirements:function(){var e;this.requirements_visibility=!0},addFlight:function(){var e=this;e.legs.push(JSON.parse(JSON.stringify(e.empty_leg))),this.mountFlatPickrs(e.legs.length-1)},onSearch:function(e,t){2<e.length&&(t(!0),this.search(t,e,this))},search:window.lodash.debounce(function(i,e,t){e=e.split(" ").join("-");var n=window.xtenderAirline.rest_url.substr(0,window.xtenderAirline.rest_url.indexOf("/xtender/v1/airports/")+21),l=window.xtenderAirline.rest_url.substr(window.xtenderAirline.rest_url.indexOf("/xtender/v1/airports/")+21,-1);this.$http.get(n+encodeURIComponent(e)+l,{}).then(function(e){var t;this.options=e.body,i(!1)},function(e){i(!1)})},700)}})}