(window.webpackJsonp=window.webpackJsonp||[]).push([[9],{J0YA:function(e,t,r){"use strict";var a=r("mrSG"),o=(r("AcpL"),r("yTtk"),r("gIcY")),i=r("XlPw"),n=r("F/XL"),s=r("7Bb1"),l=(r("xCW2"),r("9Wjo"),r("wd/R")),u=(r("KuF8"),function(){return function(){}}()),h=r("nJ9Q"),c=r("klCq"),S=(r("ckqB"),r("1Opb"),function(){return function(){}}()),f=r("kHqD"),g=r("AytR");r("Klzi"),r.d(t,"a",(function(){return p}));var p=function(){function e(e,t,r,a,o,i,n,s,l){var u=this;this.flightState=e,this.flightService=t,this.fb=r,this.generalState=a,this.flightAdapter=o,this.generalHelper=i,this.flightHomeService=n,this.generalService=s,this.translateService=l,this.travelItineraryAdapter=new h.a(this.flightState,this.generalState),this.airlineSortOrderLst="6E,H1,SG,AI,9W".split(","),this.keepInLocalStore=function(e,t){"undefined"!=typeof localStorage&&u.localStorageKey[e]&&u.localStorageKey[e].length>0&&localStorage.setItem(e,JSON.stringify(t))},this.getFromLocalStore=function(e){try{if("undefined"!=typeof localStorage)return JSON.parse(localStorage.getItem(e))}catch(t){return}},this.keepInSession=function(e,t){"undefined"!=typeof sessionStorage&&u.sessionStorageKey[e]&&u.sessionStorageKey[e].length>0&&sessionStorage.setItem(e,JSON.stringify(t))},this.getFromSession=function(e){try{if("undefined"!=typeof sessionStorage)return JSON.parse(sessionStorage.getItem(e))}catch(t){return}},this.clearSessionState=function(e){"undefined"!=typeof sessionStorage&&sessionStorage.removeItem(e)},this.clearLocalStorageState=function(e){"undefined"!=typeof localStorage&&localStorage.removeItem(e)},this.updateStateBySession=function(e){"undefined"!=typeof sessionStorage&&(e===u.sessionStorageKey.avlreq?u.flightState.SearchRequestFormGroup=JSON.parse(sessionStorage.getItem(e)):e===u.sessionStorageKey.avlres?u.flightState.SearchResult=JSON.parse(sessionStorage.getItem(u.sessionStorageKey.avlres)):e===u.sessionStorageKey.smartpricingres?u.flightState.SmartPricerResponse=JSON.parse(sessionStorage.getItem(u.sessionStorageKey.smartpricingres)):e===u.sessionStorageKey.getpricingres?u.flightState.SmartPricerResponse=JSON.parse(sessionStorage.getItem(u.sessionStorageKey.getpricingres)):e===u.sessionStorageKey.trvitnreq?u.flightState.CreateItineraryRequest=JSON.parse(sessionStorage.getItem(u.sessionStorageKey.trvitnreq)):e===u.sessionStorageKey.trvitnfg&&(u.flightState.TravelItineraryFormGrp=JSON.parse(sessionStorage.getItem(u.sessionStorageKey.trvitnfg))))},this.updateAllStateBySession=function(e){var t;"undefined"!=typeof sessionStorage&&(e&&"display"!=e&&"pricing"!=e&&"trvitin"!=e||"undefined"!=sessionStorage.getItem(u.sessionStorageKey.avlres)&&(u.flightState.SearchResult=JSON.parse(sessionStorage.getItem(u.sessionStorageKey.avlres))),e&&"pricing"!=e||("undefined"!=sessionStorage.getItem(u.sessionStorageKey.smartpricingreq)&&(u.flightState.SmartPricerRequest=JSON.parse(sessionStorage.getItem(u.sessionStorageKey.smartpricingreq))),"undefined"!=sessionStorage.getItem(u.sessionStorageKey.smartpricingres)&&(u.flightState.SmartPricerResponse=JSON.parse(sessionStorage.getItem(u.sessionStorageKey.smartpricingres))),"undefined"!=sessionStorage.getItem(u.sessionStorageKey.insfareres)&&(u.flightState.InsuranceFareResult=JSON.parse(sessionStorage.getItem(u.sessionStorageKey.insfareres))),"undefined"!=sessionStorage.getItem(u.sessionStorageKey.insurancestatus)&&(u.flightState.InsuranceApplied=JSON.parse(sessionStorage.getItem(u.sessionStorageKey.insurancestatus)))),"farerule"==e&&"undefined"!=sessionStorage.getItem(u.sessionStorageKey.getpricingres)&&(u.flightState.SmartPricerResponse=JSON.parse(sessionStorage.getItem(u.sessionStorageKey.getpricingres))),e&&"trvitin"!=e||("undefined"!=sessionStorage.getItem(u.sessionStorageKey.smartpricingreq)&&(u.flightState.SmartPricerRequest=JSON.parse(sessionStorage.getItem(u.sessionStorageKey.smartpricingreq))),"undefined"!=sessionStorage.getItem(u.sessionStorageKey.getpricingres)&&(u.flightState.SmartPricerResponse=JSON.parse(sessionStorage.getItem(u.sessionStorageKey.getpricingres))),"undefined"!=sessionStorage.getItem(u.sessionStorageKey.trvitnreq)&&(u.flightState.CreateItineraryRequest=JSON.parse(sessionStorage.getItem(u.sessionStorageKey.trvitnreq))),"undefined"!=sessionStorage.getItem(u.sessionStorageKey.insfareres)&&(u.flightState.InsuranceFareResult=JSON.parse(sessionStorage.getItem(u.sessionStorageKey.insfareres))),"undefined"!=sessionStorage.getItem(u.sessionStorageKey.insfareres)&&(u.flightState.InsuranceFareResult=JSON.parse(sessionStorage.getItem(u.sessionStorageKey.insfareres))),"undefined"!=sessionStorage.getItem(u.sessionStorageKey.insurancestatus)&&(u.flightState.InsuranceApplied=JSON.parse(sessionStorage.getItem(u.sessionStorageKey.insurancestatus))))),"true"==u.generalHelper.getFromSession(u.generalHelper.sessionStorageKey.loginstatus)&&(u.generalState.LoginStatus=!0,u.generalState.ClientID=u.generalHelper.sessionStorageKey.clientid),(t=u.generalHelper.getFromSession(u.generalHelper.sessionStorageKey.userprofile))&&t.Profile&&t.Profile.Email&&(u.generalState.ClientIDDecrypted=t.Profile.Email)},this.flightSort=function(e,t,r){var a={};null!=u.flightState.SearchResult.Trips&&(a=u.flightState.SearchResult.Trips[t]),null!=a.Journey&&a.Journey.sort((function(t,a){return r?t[e]a[e]?1:0:t[e]a[e]?-1:0}))},this.getConvertedTime=function(e){return e=e.split(":")[0]+"."+e.split(":")[1],Number(e)}}return Object.defineProperty(e.prototype,"SearchRequest",{get:function(){return this.flightState.SearchRequestFormGroup},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"SectorType",{get:function(){return this.flightState.SectorType},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"SmartPricerResponse",{get:function(){return this.flightState.SmartPricerResponse},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Trips",{get:function(){if(this.SearchRequest)return this.SearchRequest.get("Trips")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CrossSellFormGroup",{get:function(){return this.travelItineraryAdapter.getBRBFormGroup()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CurrencySymbol",{get:function(){return this.generalHelper.getCurrencySymbol()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localStorageKey",{get:function(){var e;return function(e){e.recentsearch="recentsearch",e.popularairports="popularairports",e.allairports="allairports",e.recentselectedairport="recentselectedairport",e.refid="RefID"}(e||(e={})),e},enumerable:!0,configurable:!0}),e.prototype.getLowestFareTrip=function(e){if(this.flightState.SearchResult.Trips[e]&&this.flightState.SearchResult.Trips[e].Journey.sort((function(e){return e.NetFare}))[0])return this.flightState.SearchResult.Trips[e].Journey.sort((function(e){return e.NetFare}))[0].NetFare},Object.defineProperty(e.prototype,"sessionStorageKey",{get:function(){var e;return function(e){e.avlreq="avlreq",e.avlrsfreq="avlrsfreq",e.avlres="avlres",e.avlrsfres="avlrsfres",e.smartpricingreq="smpreq",e.smartpricingres="smpres",e.getpricingreq="pricereq",e.getpricingres="priceres",e.insfareres="insfareres",e.insurancestatus="insurancestatus",e.trvitnreq="trvitnreq",e.trvitnres="trvitnres",e.trvitnfg="trvitnfg",e.ssrres="ssrres",e.seatlayres="seatlayres",e.multicityres="multicityres",e.tuiavlnormal="tuiavlnormal",e.tuiavlrsf="tuiavlrsf",e.expsrchrsptui="expsrchrsptui",e.smartpricertui="smartpricertui",e.insuranceDays="insuranceDays",e.AUI="AUI",e.cpcFrom="cpcFrom",e.cpcID="cpcID",e.utmMedium="utmMedium",e.utmSource="utmSource",e.utmCampaign="utmCampaign",e.displayUrl="displayUrl",e.searchrestui="searchrestui",e.RefID="RefID",e.isCreateItnryComplete="isCreateItnryComplete",e.airportInLocationRes="airportInLocationRes",e.clientid="clientid",e.user="user",e.profile="profile",e.loginstatus="loginstatus",e.reissue="reissue"}(e||(e={})),e},enumerable:!0,configurable:!0}),e.prototype.setMerchantIDIfGoogleSearch=function(){"undefined"!=typeof sessionStorage&&sessionStorage.getItem("googleSearchMerchantID")&&"undefined"!=sessionStorage.getItem("googleSearchMerchantID")&&(g.a.MerchantSettings.Desktop.AUI=sessionStorage.getItem("googleSearchMerchantID"),g.a.MerchantSettings.Desktop.APIkey=g.a.MerchantSettings.GoogleSearch.APIkey,g.a.MerchantSettings.Mobile.AUI=g.a.MerchantSettings.GoogleSearch.AUI,g.a.MerchantSettings.Mobile.APIkey=g.a.MerchantSettings.GoogleSearch.APIkey)},e.prototype.clearAllFlightSessionState=function(){"undefined"!=typeof sessionStorage&&(this.clearSessionState(this.sessionStorageKey.tuiavlnormal),this.clearSessionState(this.sessionStorageKey.tuiavlrsf),this.clearSessionState(this.sessionStorageKey.avlreq),this.clearSessionState(this.sessionStorageKey.avlres),this.clearSessionState(this.sessionStorageKey.getpricingreq),this.clearSessionState(this.sessionStorageKey.getpricingres),this.clearSessionState(this.sessionStorageKey.insfareres),this.clearSessionState(this.sessionStorageKey.smartpricingreq),this.clearSessionState(this.sessionStorageKey.smartpricingres),this.clearSessionState(this.sessionStorageKey.ssrres),this.clearSessionState(this.sessionStorageKey.seatlayres),this.clearSessionState(this.sessionStorageKey.trvitnfg),this.clearSessionState(this.sessionStorageKey.trvitnreq),this.clearSessionState(this.sessionStorageKey.trvitnres),this.clearSessionState(this.sessionStorageKey.RefID),this.clearSessionState(this.sessionStorageKey.isCreateItnryComplete),"false"==sessionStorage.getItem("loginstatus")&&(this.clearSessionState(this.sessionStorageKey.clientid),this.clearSessionState(this.sessionStorageKey.user),this.clearSessionState(this.sessionStorageKey.profile),this.clearSessionState(this.sessionStorageKey.loginstatus)),this.clearSessionState(this.sessionStorageKey.reissue))},e.prototype.clearAllFlightLocalStorage=function(){"undefined"!=typeof localStorage&&this.clearLocalStorageState(this.localStorageKey.refid)},e.prototype.clearAddOnStatsValue=function(){this.flightState.RPIamount=0,this.flightState.insurancePremium=0,this.flightState.BaggageProtectionAmount=0,this.flightState.ALSamount=0,this.generalState.PromoDiscount=0,this.generalState.GetRetrieveBookingResponse=void 0,this.flightState.ssrTotalFareVM&&(this.flightState.ssrTotalFareVM.Baggage.TotalFare=0,this.flightState.ssrTotalFareVM.Meals.TotalFare=0,this.flightState.ssrTotalFareVM.Seat.TotalFare=0,this.flightState.ssrTotalFareVM.Seat.TotalNos=0,this.flightState.ssrTotalFareVM.Sports.TotalFare=0,this.flightState.ssrTotalFareVM.PriorityCheckin.TotalFare=0,this.flightState.ssrTotalFareVM.PriorityBaggage.TotalFare=0,this.flightState.ssrFareChangeAmount=0)},e.prototype.clearSearchRelatedValue=function(){this.flightState.SearchRequest={},this.flightState.SmartPricerResponse={},this.flightState.TravelItineraryFormGrp.reset(),this.flightState.BRBPackageRes=[],this.flightState.FilterModel={},this.flightState.SearchResult={},this.flightState.SearchResultRSF={},this.flightState.SelectedFlightsDomMC=[],this.flightState.SelectedFltOwd={},this.flightState.SelectedFltRet={},this.flightState.TravellerCheckList={},this.flightState.SmartPricerRequest={},this.flightState.seatLayoutResponse={},this.flightState.selectedBRBCollection={},this.clearSessionState("insuranceDays"),this.clearSessionState("previousNetFare")},e.prototype.clearFlightTUI=function(){this.flightState&&(this.flightState.TUI="")},e.prototype.clearFlightReissue=function(){"undefined"!=typeof sessionStorage&&sessionStorage.getItem("reissue")&&this.clearSessionState(this.sessionStorageKey.reissue)},e.prototype.updateAllStateByLocalStorage=function(){null!=this.getFromLocalStore(this.localStorageKey.allairports)&&(this.flightState.AllAirports=this.getFromLocalStore(this.localStorageKey.allairports))},e.prototype.updateFareTypeFromSession=function(){"undefined"!=typeof sessionStorage&&this.SearchRequest.controls.FareType.setValue(JSON.parse(sessionStorage.getItem(this.sessionStorageKey.avlreq)).FareType)},e.prototype.setFilterModel=function(){var e=this,t={Trips:[]};this.flightState.SearchResult.Trips.forEach((function(r){if(r.Journey&&r.Journey.length>0){var a=null;(a={}).stop={},a.stop.none={enable:!1,visible:!1},a.stop.one={enable:!1,visible:!1},a.stop.two={enable:!1,visible:!1},a.fareType={Refundable:!1,DefenceFare:!1,StudentFare:!1,SeniorCitizenFare:!1},a.fareScale={max:0},a.depTime={evening:!1,morning:!1,noon:!1,midnight:!1},a.arrTime={evening:!1,morning:!1,noon:!1,midnight:!1},a.airline=[],a.depAirport=[],a.arrAirport=[],a.layover={min:0,max:0,sel:0},a.connAirport=[],r.Journey&&r.Journey.forEach((function(t){if(e.airlineSortOrderLst.length>0){var r=e.airlineSortOrderLst.findIndex((function(e){return e===t.MAC}));t.weightage=r>-1?e.airlineSortOrderLst.length-r+1e3:0}else t.weightage=0;t.visible=!0,0==t.Stops?(a.stop.none.visible||(a.stop.none.visible=!0),(!a.stop.none.minFare||t.NetFarea.fareScale.max&&(a.fareScale.max=a.fareScale.sel=t.NetFare),a.airline&&a.airline.length>0?-1==a.airline.map((function(e){return e.name})).indexOf(t.AirlineName)?a.airline.push({appliedAny:!1,name:t.AirlineName,count:1,enable:!1,minFare:t.NetFare,logo:e.generalHelper.getAirlineLogo(t.MAC,t.Provider)}):(a.airline[a.airline.findIndex((function(e){return e.name==t.AirlineName}))].count++,a.airline[a.airline.findIndex((function(e){return e.name==t.AirlineName}))].minFare>t.NetFare&&t.NetFare>0&&(a.airline[a.airline.findIndex((function(e){return e.name==t.AirlineName}))].minFare=t.NetFare)):a.airline.push({appliedAny:!1,name:t.AirlineName,count:1,enable:!1,minFare:t.NetFare,logo:e.generalHelper.getAirlineLogo(t.MAC,t.Provider)});var o=0;t.Connections.forEach((function(e){e&&(""!==e.Duration&&(e.Duration.toLowerCase().indexOf("hr")>-1?(o+=Number(e.Duration.toLowerCase().split("hr")[0]),o+=Number(e.Duration.toLowerCase().split("hr")[1].split("m")[0])/60):(o+=Number(e.Duration.split("h")[0]),o+=Number(e.Duration.split("h")[1].split("m")[0])/60)),null!=a.connAirport.length&&-1!==a.connAirport.map((function(e){return e.code})).indexOf(e.Airport)||a.connAirport.push({appliedAny:!1,code:e.Airport,name:e.ArrAirportName.split("|")[0],enable:!1}))})),a.layover.max0?-1==a.depAirport.map((function(e){return e.code})).indexOf(t.From)&&a.depAirport.push({appliedAny:!1,name:"",code:t.From,enable:!1}):a.depAirport.push({appliedAny:!1,name:"",code:t.From,enable:!1}),a.arrAirport&&a.arrAirport.length>0?-1==a.arrAirport.map((function(e){return e.code})).indexOf(t.To)&&a.arrAirport.push({appliedAny:!1,name:"",code:t.To,enable:!1}):a.arrAirport.push({appliedAny:!1,name:"",code:t.To,enable:!1})})),t.Trips.push(a)}})),this.flightState.FilterModel=t},e.prototype.resetFilter=function(e,t){"airline"!=t&&""!=t||this.flightState.FilterModel.Trips[e].airline.forEach((function(e){e.enable=!1})),"arrTime"!=t&&""!=t||(this.flightState.FilterModel.Trips[e].arrTime.evening=!1,this.flightState.FilterModel.Trips[e].arrTime.midnight=!1,this.flightState.FilterModel.Trips[e].arrTime.morning=!1,this.flightState.FilterModel.Trips[e].arrTime.noon=!1),"depTime"!=t&&""!=t||(this.flightState.FilterModel.Trips[e].depTime.evening=!1,this.flightState.FilterModel.Trips[e].depTime.midnight=!1,this.flightState.FilterModel.Trips[e].depTime.morning=!1,this.flightState.FilterModel.Trips[e].depTime.noon=!1),"connAirport"!=t&&""!=t||this.flightState.FilterModel.Trips[e].connAirport.forEach((function(e){e.enable=!1})),"depAirport"!=t&&""!=t||this.flightState.FilterModel.Trips[e].depAirport.forEach((function(e){e.enable=!1})),"arrAirport"!=t&&""!=t||this.flightState.FilterModel.Trips[e].arrAirport.forEach((function(e){e.enable=!1})),"fareScale"!=t&&""!=t||(this.flightState.FilterModel.Trips[e].fareScale.sel=this.flightState.FilterModel.Trips[e].fareScale.max,this.flightState.FilterModel.Trips[e].fareType.Refundable=!1,this.flightState.FilterModel.Trips[e].fareType.DefenceFare=!1,this.flightState.FilterModel.Trips[e].fareType.StudentFare=!1,this.flightState.FilterModel.Trips[e].fareType.SeniorCitizenFare=!1,this.flightState.FilterModel.Trips[e].layover.sel=this.flightState.FilterModel.Trips[e].layover.max),"stops"!=t&&""!=t||(this.flightState.FilterModel.Trips[e].stop.none.enable=!1,this.flightState.FilterModel.Trips[e].stop.one.enable=!1,this.flightState.FilterModel.Trips[e].stop.two.enable=!1),"faretype"!=t&&""!=t||(this.flightState.FilterModel.Trips[e].fareType.Refundable=!1,this.flightState.FilterModel.Trips[e].fareType.DefenceFare=!1,this.flightState.FilterModel.Trips[e].fareType.StudentFare=!1,this.flightState.FilterModel.Trips[e].fareType.SeniorCitizenFare=!1)},e.prototype.searchResponseHasData=function(e){try{return!!this.flightState&&!!this.flightState.SearchResult&&!!this.flightState.SearchResult.Trips&&0!=this.flightState.SearchResult.Trips.length&&!!this.flightState.SearchResult.Trips[e].Journey&&this.flightState.SearchResult.Trips[e].Journey.length>0}catch(t){Object(i.a)(new Error(t.stack.toLocaleString()))}},e.prototype.sort=function(e,t,r){-1===e.indexOf(",")?this.flightSort(e,t,r):this.nestedsort(this.flightState.SearchResult.Trips[t].Journey,e,r)},e.prototype.nestedsort=function(e,t,r){var a,o,i=t.split(",");e.sort((function(e,t){if("Connections"==i[0]?(a=e[i[0]].length,o=t[i[0]].length):(a=e[i[0]],o=t[i[0]]),r){if(a>o)return 1;if(a(o=t[i[n]]))return 1;if(ao)return-1;if(a(o=t[i[n]]))return-1;if(a0&&this.flightState.SearchResult.Trips&&this.flightState.SearchResult.Trips.length>0&&(this.flightState.SearchResult.Trips[0].Journey.forEach((function(o,i){r="",a=0,t=o.VAC+o.FlightNo+o.Connections.length,e.flightState.SearchResultRSF.Trips[0].Journey.forEach((function(i,n){if(t===i.VAC+i.FlightNo+i.Connections.length){var s,l,u=void 0;(u=e.flightState.SearchResultRSF.Trips[1].Journey.filter((function(e){return i.ReturnIdentifier>0&&e.VAC==i.VAC&&e.ReturnIdentifier==i.ReturnIdentifier})))&&u.forEach((function(t){s=t.VAC+t.FlightNo+t.Connections.length,e.flightState.SearchResult.Trips[1].Journey.forEach((function(e){l=e.VAC+e.FlightNo+e.Connections.length;var n=t.VAC+"_"+t.FlightNo,u=i.NetFare+t.NetFare,h=o.NetFare+e.NetFare;uh-u&&(a=h-u):a=h-u,s===l&&(o.RsfDisplayNetFare=i.NetFare,o.RsfDisplayGrossFare=i.GrossFare,-1==r.split(",").indexOf(n)&&(r=r+n+",")))}))}))}})),r.length>0?(o.isRSF=!0,o.RsfPriceDrop=a,o.RSFReturnFlights=r):o.isRSF=!1})),this.flightState.SearchResult.Trips[1].Journey.forEach((function(t,r){i="",o=t.VAC+t.FlightNo+t.Connections.length,e.flightState.SearchResultRSF.Trips[1].Journey.forEach((function(r,n){if(o===r.VAC+r.FlightNo+r.Connections.length){var s,l,u=void 0;(u=e.flightState.SearchResultRSF.Trips[0].Journey.filter((function(e){return r.ReturnIdentifier>0&&e.VAC==r.VAC&&e.ReturnIdentifier==r.ReturnIdentifier})))&&u.forEach((function(o){s=o.VAC+o.FlightNo+o.Connections.length,e.flightState.SearchResult.Trips[0].Journey.forEach((function(e){l=e.VAC+e.FlightNo+e.Connections.length;var n=o.VAC+"_"+o.FlightNo,u=r.NetFare+o.NetFare,h=t.NetFare+e.NetFare;uh-u&&(a=h-u):a=h-u,s===l&&(t.RsfDisplayNetFare=r.NetFare,t.RsfDisplayGrossFare=r.GrossFare,-1==i.split(",").indexOf(n)?i=i+n+",":i+=n))}))}))}})),i.length>0?(t.isRSF=!0,t.RsfPriceDrop=a,t.RSFReturnFlights=i):t.isRSF=!1})))},e.prototype.ApplyRSFM=function(){var e,t,r=this;this.flightState.SearchResultRSF.Trips&&this.flightState.SearchResultRSF.Trips.length>0&&this.flightState.SearchResult.Trips&&this.flightState.SearchResult.Trips.length>0&&(this.flightState.SearchResult.Trips[0].Journey.forEach((function(t,a){e="";var o=r.flightState.SearchResultRSF.Trips[0].Journey.find((function(e){return e.VAC===t.VAC&&e.FlightNo===t.FlightNo&&e.Connections.length===t.Connections.length}));if(o){var i=r.flightState.SearchResultRSF.Trips[1].Journey.filter((function(e){return o.ReturnIdentifier>0&&e.VAC==o.VAC&&e.ReturnIdentifier===o.ReturnIdentifier}));i.length>0&&(i.forEach((function(a,i){var n=t.NetFare+r.flightState.SearchResult.Trips[1].Journey.sort((function(e){return e.NetFare}))[0].NetFare,s=o.NetFare+a.NetFare;n>s&&(t.RsfPriceDrop=n-s,e=e+a.VAC+"_"+a.FlightNo+",")})),e.length>0&&(t.isRSF=!0,t.RSFReturnFlights=e))}})),this.flightState.SearchResult.Trips[1].Journey.forEach((function(e,a){t="";var o=r.flightState.SearchResultRSF.Trips[1].Journey.find((function(t){return t.VAC===e.VAC&&t.FlightNo===e.FlightNo&&t.Connections.length===e.Connections.length}));if(o){var i=r.flightState.SearchResultRSF.Trips[0].Journey.filter((function(e){return o.ReturnIdentifier>0&&e.VAC==o.VAC&&e.ReturnIdentifier===o.ReturnIdentifier}));i.length>0&&(i.forEach((function(a,o){var n=e.NetFare+r.flightState.SearchResult.Trips[0].Journey.sort((function(e){return e.NetFare}))[0].NetFare,s=e.NetFare+i.sort((function(t){return t.NetFare+e.NetFare}))[0].NetFare;n>s&&(e.RsfPriceDrop=n-s,t=t+a.VAC+"_"+a.FlightNo+",")})),e.isRSF=!0,e.RSFReturnFlights=t)}})))},e.prototype.ApplyRSF1=function(){var e=this;if(null!=this.flightState.SearchResultRSF.Trips&&this.flightState.SearchResultRSF.Trips.length>0){var t=null;null!=this.flightState.SearchResultRSF.Trips[1].Journey&&this.flightState.SearchResultRSF.Trips[1].Journey.length>0&&this.flightState.SearchResultRSF.Trips[0].Journey.forEach((function(r){var a=e.flightState.SearchResultRSF.Trips[0].Journey.filter((function(e){return e.VAC==r.VAC&&e.FlightNo==r.FlightNo}));if(null!=e.flightState.SearchResultRSF.Trips[1].Journey.filter((function(e){return e.VAC==r.VAC&&a.filter((function(t){return t.ReturnIdentifier==e.ReturnIdentifier})).length>0}))){var o=e.flightState.SearchResultRSF.Trips[1].Journey.filter((function(e){return e.VAC==r.VAC&&a.filter((function(t){return t.ReturnIdentifier==e.ReturnIdentifier})).length>0}));t="",o.forEach((function(e){t=t+e.VAC+"_"+e.FlightNo+","}))}r.RSFReturnFlights=t})),this.flightState.SearchResult.Trips[0].Journey.forEach((function(t){e.flightState.SearchResultRSF.Trips[0].Journey.forEach((function(e){if(t.VAC==e.VAC&&t.FlightNo==e.FlightNo&&t.Connections.length==e.Connections.length)return t.isRSF=!0,t.RSFIndex=e.Index,t.RtnId=e.ReturnIdentifier,t.RSFReturnFlights=e.RSFReturnFlights,!1}))}))}},e.prototype.createFilterSort=function(){var e=this,t=!0;return function(r,a){t=!t,e.flightState.SearchResult.Trips[a].Journey.sort((function(e,a){return t?e[r]a[r]?1:0:e[r]a[r]?-1:0}))}},e.prototype.getTotalLowestFare=function(e,t){var r,a,o=e.NetFare+t.NetFare;if(e.isRSF&&t.RSFMsgDisplay){var i=this.flightState.SearchResultRSF.Trips[0].Journey.find((function(t){return t.VAC==e.VAC&&t.FlightNo===e.FlightNo})),n=this.flightState.SearchResultRSF.Trips[1].Journey.find((function(e){return e.VAC==t.VAC&&e.FlightNo===t.FlightNo}));a=null!=i&&null!=n&&(r=i.NetFare+n.NetFare)0&&this.flightState.SearchResult.Trips[1]&&this.flightState.SearchResult.Trips[1].Journey.map((function(e){return e.RSFMsgDisplay=!1})),this.flightState.SearchResult&&this.flightState.SearchResult.Trips&&this.flightState.SearchResult.Trips.length>0&&this.flightState.SearchResult.Trips[0]&&this.flightState.SearchResult.Trips[0].Journey.forEach((function(t){if(t.Index==e&&(r.flightState.SelectedFltOwd=t,t&&t.isRSF&&!0===t.isRSF&&r.checkRsfLcc(t))){t.RSFMsgDisplay=!0;var a=(t.VAC+t.FlightNo+t.Connections.length+t.DepartureTime+t.ArrivalTime+t.Provider).replace(/\s/g,""),o=0,i=0;t.RSFReturnFlights&&t.RSFReturnFlights.split(",").forEach((function(e){var n=[];r.flightState.SearchResultRSF&&r.flightState.SearchResultRSF.Trips&&r.flightState.SearchResultRSF.Trips[0]&&(n=r.flightState.SearchResultRSF.Trips[0].Journey.filter((function(e){return e.VAC+e.FlightNo.replace(/\s/g,"")+e.Connections.length+e.DepartureTime.toString()+e.ArrivalTime.toString()+e.Provider==a&&r.checkRsfLcc(e)})));var s=r.flightState.SearchResult.Trips[1].Journey.find((function(t){return t.isRSF&&t.VAC==e.split("_")[0]&&t.FlightNo.replace(/\s/g,"")==e.split("_")[1]&&t.Connections.length.toString()==e.split("_")[2]&&t.DepartureTime.toString()==e.split("_")[3]&&t.ArrivalTime.toString()==e.split("_")[4]&&t.Provider==e.split("_")[5]&&r.checkRsfLcc(t)}));n&&n.length>0&&n.sort((function(e){return e.NetFare})).forEach((function(a){var n=r.flightState.SearchResultRSF.Trips[1].Journey.find((function(t){return t.VAC==e.split("_")[0]&&t.FlightNo.replace(/\s/g,"")==e.split("_")[1]&&t.Connections.length.toString()==e.split("_")[2]&&t.DepartureTime.toString()==e.split("_")[3]&&t.ArrivalTime.toString()==e.split("_")[4]&&t.Provider.toString()==e.split("_")[5]&&r.checkRsfLcc(t)&&t.ReturnIdentifier===a.ReturnIdentifier})),l=0;n&&0==n.NetFare&&a&&n?(o=0==o||o>a.NetFare?a.NetFare:o,i=0==i||i>a.GrossFare?a.GrossFare:i,s.RSFMsgDisplay=!0,o%2?(s.RsfDisplayNetFare=a.NetFare-(o+1)/2,s.RsfDisplayCommission=a.TotalCommission/2,t.RsfDisplayNetFare=(o+1)/2,t.RsfDisplayCommission=a.TotalCommission/2):(s.RsfDisplayNetFare=a.NetFare-o/2,t.RsfDisplayNetFare=o/2,t.RsfDisplayCommission=a.TotalCommission/2),i%2?(s.RsfDisplayGrossFare=a.GrossFare-(i+1)/2,t.RsfDisplayGrossFare=(i+1)/2):(s.RsfDisplayGrossFare=a.GrossFare-i/2,t.RsfDisplayGrossFare=i/2),s.RsfPriceDrop=l=s.NetFare+t.NetFare-(s.RsfDisplayNetFare+t.RsfDisplayNetFare)):n&&n.NetFare>0&&a&&n&&(s.RsfDisplayNetFare=n.NetFare,t.RsfDisplayNetFare=a.NetFare,s.RsfDisplayGrossFare=n.GrossFare,t.RsfDisplayGrossFare=a.GrossFare,l=s.NetFare+t.NetFare-(s.RsfDisplayNetFare+t.RsfDisplayNetFare),s.RsfDisplayCommission=n.TotalCommission,t.RsfDisplayCommission=a.TotalCommission,l>0&&(s.RSFMsgDisplay=!0,s.RsfPriceDrop=l))}))}))}}))):this.flightState.SearchResult&&this.flightState.SearchResult.Trips&&this.flightState.SearchResult.Trips.length>0&&this.flightState.SearchResult.Trips[1]&&this.flightState.SearchResult.Trips[1].Journey.forEach((function(t){t&&t.Index==e&&(r.flightState.SelectedFltRet=t),!r.flightState.SelectedFltOwd||r.flightState.SelectedFltOwd.isRSF||r.flightState.SelectedFltOwd.isRSF||(t.RSFMsgDisplay=!1)}))},e.prototype.checkRsfLcc=function(e){return!("SG"!=e.VAC&&"PSG"!=e.VAC&&"CSG"!=e.VAC&&"ISG"!=e.VAC&&"ESG"!=e.VAC||"SS"!=e.FareClass&&"RS"!=e.FareClass)||"SG"!=e.VAC&&"PSG"!=e.VAC&&"CSG"!=e.VAC&&"ISG"!=e.VAC&&"ESG"!=e.VAC&&"6E"!=e.VAC&&"C6E"!=e.VAC||!("6E"!=e.VAC&&"C6E"!=e.VAC||"N"!=e.FareClass&&"R"!=e.FareClass)},e.prototype.getUserDetailsFromSession=function(){var e,t={};return null!=(e=this.getFromSession("user"))&&(t.Title=e.Title,t.FName=e.Fname,t.LName=e.Lname,t.Mobile=e.MobNumber,t.Phone=e.Contacts.Phone,t.Email=e.Contacts.Email,t.Address=e.Contacts.Address,t.State=e.Contacts.State,t.City=e.Contacts.City,t.PIN=e.Contacts.PIN),t},e.prototype.getSSRSegmentsStatus=function(e){var t;return e.Segments.length&&(t=e.Segments.filter((function(e){return e.SSR.length>0})).length>0),t},e.prototype.getFareRuleSegmentsStatus=function(e){var t=!1;return null!=e.Segments&&e.Segments.length>0&&null!=e.Segments.filter((function(e){return null!=e.Rules}))&&(t=e.Segments.filter((function(e){return e.Rules.length>0})).length>0),t},e.prototype.getFareInfoSegmentsStatus=function(e){var t=!1;return e.Segments.length&&(t=e.Segments.filter((function(e){return null!=e.Flight&&null!=e.Flight})).length>0),t},e.prototype.getFilterByName=function(e,t,r){var a,o=""!=e&&null!=e?e.toLowerCase():e;return"I"==this.SectorType&&t?t.forEach((function(e){a=Object(n.a)(e.filter((function(e){return 0==e.Name.toLowerCase().indexOf(o)})))})):"D"==this.SectorType&&r&&r.forEach((function(e){a=Object(n.a)(e.filter((function(e){return 0==e.Name.toLowerCase().indexOf(o)})))})),a},e.prototype.setAirlineFilter=function(e,t){var r;return"I"==this.SectorType&&null!=e?r=e:"D"==this.SectorType&&null!=t&&(r=t),r},e.prototype.toogleFilter=function(e,t){return e.forEach((function(e){var r=e.filter((function(e){return e.Code==t.Code}))[0];null!=r&&(r.Selected=t.Selected),5==e.filter((function(e){return e.Selected})).length?e.filter((function(e){return!e.Selected})).map((function(e){e.Disabled=!0})):e.filter((function(e){return!e.Selected})).map((function(e){e.Disabled=!1}))})),e},e.prototype.selectedAirlines=function(e,t){var r=[];return"I"==this.SectorType&&e?e.forEach((function(e){r=e.filter((function(e){return e.Selected}))})):"D"==this.SectorType&&t&&t.forEach((function(e){r=e.filter((function(e){return e.Selected}))})),Object(n.a)(r)},e.prototype.updateAirlines=function(e,t,r){var a=[];"I"==this.SectorType&&t?t.forEach((function(e){a=e.filter((function(e){return e.Selected}))})):"D"==this.SectorType&&r&&r.forEach((function(e){a=e.filter((function(e){return e.Selected}))}));var o=a.reduce((function(e,t){return""!=e?e+","+t.Code:t.Code}),"");e.setValue(o)},e.prototype.resetSelected=function(e,t,r){var a=[];"I"==this.SectorType&&t?t.forEach((function(e){a=e.filter((function(e){return e.Selected}))})):"D"==this.SectorType&&r&&r.forEach((function(e){a=e.filter((function(e){return e.Selected}))}));var o=a.filter((function(e){return e.Selected})).map((function(e){return e.Code}));return e.forEach((function(e){o.indexOf(e.Code)>-1&&(e.Selected=!0)})),Object(n.a)(e)},e.prototype.getBaggageDetails=function(e){var t,r=[];return e.Trips.forEach((function(e,a){e.Journey.forEach((function(e){e.Segments.forEach((function(e){e.SSR.forEach((function(e){"2"==e.Type&&((t=e).trpcount=a+1,r.push(t))}))}))}))})),r},e.prototype.updateBaggage=function(e,t,r){if(void 0===r.SSR||0==r.SSR.length)r.SSR.push({PaxID:t+1,FUID:e.value.FUID,SSID:e.value.ID,Type:"2"}),this.flightState.CreateItineraryRequest=r;else{var a=r.SSR.filter((function(r){return"2"==r.Type&&r.PaxID==t+1&&r.FUID==e.value.FUID}));0!=a.length?(a.forEach((function(t){t.FUID=e.value.FUID,t.SSID=e.value.ID})),this.flightState.CreateItineraryRequest=r):(r.SSR.push({PaxID:t+1,FUID:e.value.FUID,SSID:e.value.ID,Type:"2"}),this.flightState.CreateItineraryRequest=r)}},e.prototype.calculateFareReview=function(e){var t=0,r=0,a=0;return this.flightState.SmartPricerResponse?(this.flightState.SmartPricerResponse.Trips.forEach((function(e){e.Journey.forEach((function(e){t=e.Segments.reduce((function(e,t){return e+t.Fares.TotalBaseFare}),0),r=e.Segments.reduce((function(e,t){return e+t.Fares.TotalTax}),0),a=e.Segments.reduce((function(e,t){return e+t.Fares.NetFare}),0)}))})),{baseFare:t,tax:r,netFare:a}):{baseFare:t,tax:r,netFare:a}},e.prototype.convertTripToFareSplitupModel=function(e){var t=new s.a;return e&&e.length>0&&e.forEach((function(e){e.Journey.forEach((function(e){e.Segments.forEach((function(e){t.Splitup.NetFare+=e.Fares.NetFare,t.Splitup.BaseFare+=e.Fares.TotalBaseFare,t.Splitup.Tax+=e.Fares.TotalTax,t.Splitup.Discount+=e.Fares.NetFare-e.Fares.GrossFare,e.Fares.PTCFare.forEach((function(e){null!=e&&("ADT"==e.PTC?(t.Splitup.AdtFare+=e.Fare,t.Splitup.AdtTax+=e.Tax,t.Splitup.AdtTotal=t.Splitup.AdtFare+t.Splitup.AdtTax,t.Splitup.AdtNet=t.Splitup.AdtTotal-t.Splitup.AdtDiscount):"CHD"==e.PTC?(t.Splitup.ChdFare+=e.Fare,t.Splitup.ChdTax+=e.Tax,t.Splitup.ChdTotal+=t.Splitup.ChdFare+t.Splitup.ChdTax,t.Splitup.ChdNet+=t.Splitup.ChdTotal-t.Splitup.ChdDiscount):"INF"==e.PTC&&(t.Splitup.InfFare+=e.Fare,t.Splitup.InfTax+=e.Tax,t.Splitup.InfTotal+=t.Splitup.InfFare+t.Splitup.InfTax,t.Splitup.InfNet+=t.Splitup.InfTotal-t.Splitup.InfDiscount))}))}))}))})),t.Splitup.Insurance=this.flightState.InsuranceApplied?this.flightState.InsuranceFareResult.NetPremium:0,this.flightState.InsuranceApplied&&(t.Splitup.NetFare=t.Splitup.NetFare+parseInt(this.flightState.InsuranceFareResult.NetPremium.toString())),t},e.prototype.getTravelClassName=function(e){return null==e?"":e?"E"===e.toUpperCase()?this.translateService.instant("economy"):"PE"===e.toUpperCase()?this.translateService.instant("premiumeconomy"):"F"===e.toUpperCase()?this.translateService.instant("firstclass"):"B"===e.toUpperCase()?this.translateService.instant("business"):e.toLowerCase():void 0},e.prototype.getTravelClassCode=function(e){if(e){if("economy"===e.toLocaleLowerCase())return"E";if("premiumeconomy"===e.replace(" ","").toLocaleLowerCase())return"PE";if("firstclass"===e.replace(" ","").toLocaleLowerCase())return"F";if("business"===e.toLocaleLowerCase())return"B"}},e.prototype.processItineraryResponse=function(e){return null!=e&&null!=e.Trips&&(e.Pax.length>0&&(e.NoOfAdult=e.Pax.filter((function(e){return"ADT"==e.PTC.toUpperCase()})).length,e.NoOfChild=e.Pax.filter((function(e){return"CHD"==e.PTC.toUpperCase()})).length,e.NoOfInfant=e.Pax.filter((function(e){return"INF"==e.PTC.toUpperCase()})).length),e.BRBAmount=e.CrossSell.filter((function(e){return"BRB"==e.Code}))[0].Amount,e.Trips.forEach((function(t,r){t.Journey.forEach((function(t){t.Segments.forEach((function(t){var o,i;try{for(var n=a.__values(t.Fares.PTCFare),s=n.next();!s.done;s=n.next()){var l=s.value;"ADT"==l.PTC&&(0==r?(e.AdtNetFare+=l.NetFare,e.AdtBaseFare+=l.Fare,e.AdtTax+=l.Tax):(e.AdtNetFareRT+=l.NetFare,e.AdtBaseFareRT+=l.Fare,e.AdtTaxRT+=l.Tax)),"CHD"==l.PTC&&(0==r?(e.ChdNetFare+=l.NetFare,e.ChdBaseFare+=l.Fare,e.ChdTax+=l.Tax):(e.ChdNetFareRT+=l.NetFare,e.ChdBaseFareRT+=l.Fare,e.ChdTaxRT+=l.Tax)),"INF"==l.PTC&&(0==r?(e.InfNetFare+=l.NetFare,e.InfBaseFare+=l.Fare,e.InfTax+=l.Tax):(e.InfNetFareRT+=l.NetFare,e.InfBaseFareRT+=l.Fare,e.InfTaxRT+=l.Tax))}}catch(u){o={error:u}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(o)throw o.error}}}))}))})),e.AdtBaseFare=e.AdtBaseFare*e.NoOfAdult,e.AdtCommission=e.AdtCommission*e.NoOfAdult,e.AdtNetFare=e.AdtNetFare*e.NoOfAdult,e.AdtTax=e.AdtTax*e.NoOfAdult,e.ChdBaseFare=e.ChdBaseFare*e.NoOfAdult,e.ChdCommission=e.ChdCommission*e.NoOfAdult,e.ChdNetFare=e.ChdNetFare*e.NoOfAdult,e.ChdTax=e.ChdTax*e.NoOfAdult,e.InfBaseFare=e.InfBaseFare*e.NoOfAdult,e.InfCommission=e.InfCommission*e.NoOfAdult,e.InfNetFare=e.InfNetFare*e.NoOfAdult,e.InfTax=e.InfTax*e.NoOfAdult,(e.FareType="RT")&&(e.AdtBaseFareRT=e.AdtBaseFareRT*e.NoOfAdult,e.AdtCommissionRT=e.AdtCommissionRT*e.NoOfAdult,e.AdtNetFareRT=e.AdtNetFareRT*e.NoOfAdult,e.AdtTaxRT=e.AdtTaxRT*e.NoOfAdult,e.ChdBaseFareRT=e.ChdBaseFareRT*e.NoOfAdult,e.ChdCommissionRT=e.ChdCommissionRT*e.NoOfAdult,e.ChdNetFareRT=e.ChdNetFareRT*e.NoOfAdult,e.ChdTaxRT=e.ChdTaxRT*e.NoOfAdult,e.InfBaseFareRT=e.InfBaseFareRT*e.NoOfAdult,e.InfCommissionRT=e.InfCommissionRT*e.NoOfAdult,e.InfNetFareRT=e.InfNetFareRT*e.NoOfAdult,e.InfTaxRT=e.InfTaxRT*e.NoOfAdult)),e},e.prototype.getSSRPerPax=function(e){return null!=e&&null!=e.Trips&&(e.SSRDetails=[],e.Pax.forEach((function(t){var r={Pax:null,Services:[]};r.Pax=t,e.Trips.forEach((function(a,o){a.Journey[0].Segments.forEach((function(a,o){var i=e.SSR.filter((function(e){return e.PaxID==t.PaxID})),n={Sector:"",Baggage:"",Meals:"",Seat:"",otherServices:""};n.Sector=a.Flight.DepartureCode+"- "+a.Flight.ArrivalCode;var s=i.filter((function(e){return"2"==e.Type&&e.FUID.indexOf((o+1).toString())>-1}));n.Baggage=s.length?s[0].Description+" ("+s[0].Charge+")":"Nil";var l=i.filter((function(e){return"1"==e.Type&&e.FUID.indexOf((o+1).toString())>-1}));n.Meals=l.length?l[0].Description+" ("+l[0].Charge+")":"Nil";var u=e.SeatMap.filter((function(e){return e.PaxID==t.PaxID&&e.FUID.indexOf((o+1).toString())>-1}));n.Seat=u.length&&""!=u[0].SeatNo?u[0].SeatNo:"Nil",n.otherServices="Nil",r.Services.push(n)}))})),e.SSRDetails.push(r)}))),e},e.prototype.getSectorsNames=function(e){var t=[];return e.Trips.forEach((function(e){t.push(e.Journey[0].Segments[0].Flight.DepartureCode+" - "+e.Journey[0].Segments[e.Journey[0].Segments.length-1].Flight.ArrivalCode)})),t},e.prototype.getSeatLayoutPax=function(){return this.flightState.CreateItineraryRequest.Travellers.filter((function(e){return"INF"!=e.PTC}))},e.prototype.getEmptySeatLayoutTrip=function(){return{Journey:[]}},e.prototype.getEmptySeatLayoutJourney=function(){return{Provider:"",Segments:[]}},e.prototype.addSeatLayoutPax=function(e,t){var r=e.filter((function(e){return e.paxfieldgroupname==t.paxfieldgroupname})),a=r.indexOf(t);return t.add=!1,a!=r.length-1&&(r[a+1].visible=!0,r[a+1].rmv=!0,r[a+1].add=!0),e},e.prototype.removeSeatLayoutPax=function(e,t){return e[t].visible=!1,t>0&&(e[t-1].add=!0),e},e.prototype.addSeatlayoutToCreateItineraryRequest=function(e){var t=this;e.length>0&&e.forEach((function(e){t.flightState.CreateItineraryRequest.SSR.push(e)}))},e.prototype.processSeatLayoutJourney=function(e,t,r,a){return e.Segments.forEach((function(e,o){var i=0,n=0;e.SLYValArr=e.Seats.map((function(e){return e.YValue})).filter((function(e,t,r){return e&&r.indexOf(e)===t})),e.SLRowCount=e.SLYValArr.length,e.SLXValArr=e.Seats.map((function(e){return e.XValue})).filter((function(e,t,r){return e&&r.indexOf(e)===t})),e.SLColumnCount=e.SLXValArr.length,e.SLYValArr.forEach((function(t,r){r>0&&(t-e.SLYValArr[r-1]==2?i+=25:t-e.SLYValArr[r-1]==3&&(i+=35)),e.SLYPos.push(i)}));for(var s=0;s0&&(n=s==e.SLColumnCount/2?parseInt(n.toString(),10)+60:parseInt(n.toString(),10)+32),e.SLXPos.push(n);e.Seats.forEach((function(i,n){i.SLTypeClass="SG"==e.AirlineCode?1==i.AvailStatus?"PS"==i.SeatInfo.trim()?"prefer-seat":"SS"==i.SeatInfo.trim()?"standrd-seat":"SM"==i.SeatInfo.trim()?"spicemax-seat":"EES"==i.SeatInfo.trim()?"emrgncy-seat":"occu-seat":"occu-seat":1==i.AvailStatus?"PRS"==i.SeatInfo.trim()?"premium-seat":"WIN"==i.SeatInfo.trim()?"window-seat":"FS"==i.SeatInfo.trim()?"free-seat":"EES"==i.SeatInfo.trim()?"emrgncy-seat":"notapl-seat":"occu-seat","FleetBlocked"==i.SeatStatus&&(i.SLTypeClass="airport-seat"),"FleetBlocked"==i.SeatType||"Occupied"==i.SeatType||o>0&&0==a&&t||o>0&&1==a&&r||"open"!=i.SeatStatus.toLowerCase().trim()?("fleetblocked"!=i.SeatStatus.toLowerCase().trim()&&(i.SLTypeClass="airport-seat"),i.IsSelectable=!1):i.IsSelectable=!0}))})),e},e.prototype.isSameFlight=function(e){var t=!1;return e.forEach((function(r,a){if(e.length>1&&a>0&&r.AirlineName==e[a-1].AirlineName&&r.FlightNo==e[a-1].FlightNo&&r.AirlineUnit==e[a-1].AirlineUnit)return t=!0,!1})),t},e.prototype.getSearchedSector=function(){var e="",t="";return this.SearchRequest&&this.SearchRequest.get("Trips")&&this.SearchRequest.get("Trips").value[0]&&this.SearchRequest.get("Trips").value[0].FromCity&&(e=this.SearchRequest.get("Trips").value[0].FromCity.replace("-"," ")+" ("+this.SearchRequest.get("Trips").value[0].From.replace("-"," ")+")"),this.SearchRequest&&this.SearchRequest.get("Trips")&&this.SearchRequest.get("Trips").value[0]&&this.SearchRequest.get("Trips").value[0].ToCity&&(t=this.SearchRequest.get("Trips").value[0].ToCity+" ("+this.SearchRequest.get("Trips").value[0].To+")"),e+" - "+t},e.prototype.getSearchedReturnSector=function(){var e=this.SearchRequest.get("Trips").value[0].From;return this.SearchRequest.get("Trips").value[0].To+" - "+e},e.prototype.getSelectedSector=function(e,t){var r="";if(null!=t){var a=e&&e.From?t.filter((function(t){return t.Code.trim()==e.From.trim()}))[0]:null,o=e&&e.To?t.filter((function(t){return t.Code.trim()==e.To.trim()}))[0]:null;a&&a.CityName&&(r=a.Name.replace("-"," ")+"~ "+a.CityName.replace("-"," ")+" ("+a.Code+") - "),o&&(r+=o.Name.replace("-"," ")+"~ "+o.CityName.replace("-"," ")+" ("+o.Code+")")}else e&&(r=e.From+" - "+e.To);return r},e.prototype.getPriorityDetails=function(e){var t,r=[];return e.Trips.forEach((function(e,a){e.Journey.forEach((function(e){e.Segments[0].SSR.forEach((function(e){"8"==e.Type&&((t=e).trpcount=a+1,r.push(t))}))}))})),r},e.prototype.updatePriority=function(e,t,r){if(void 0===r.SSR||0==r.SSR.length)return r.SSR.push({PaxID:t+1,FUID:e.value.FUID,SSID:e.value.ID,Type:"2"}),r;var a=r.SSR.filter((function(r){return"8"==r.Type&&r.PaxID==t+1&&r.FUID==e.value.FUID}));return 0!=a.length?(a.forEach((function(t){t.FUID=e.value.FUID,t.SSID=e.value.ID})),r):(r.SSR.push({PaxID:t+1,FUID:e.value.FUID,SSID:e.value.ID,Type:"8"}),r)},e.prototype.processSSR=function(e){var t=this;return e.Trips.forEach((function(e,r){e.Journey.forEach((function(e,a){e.Segments.forEach((function(e,o){e.From=t.SmartPricerResponse.Trips[r].Journey[a].Segments[o].Flight.DepartureCode,e.To=t.SmartPricerResponse.Trips[r].Journey[a].Segments[o].Flight.ArrivalCode}))}))})),e},e.prototype.resetTUIFromURL=function(e){return e.split("/")[0].replace(new RegExp("%7C","g"),"|")},e.prototype.getSearchRequestFromSession=function(){var e=this.getFromSession(this.sessionStorageKey.avlreq);this.fillSearchRequestGroup(e)},e.prototype.fillSearchRequestGroup=function(e){this.SearchRequest.setValue(e)},e.prototype.resetSearchRequestModel=function(){var e,t=this;return e=this.fb.group({ADT:[this.SearchRequest.controls.ADT.value],CHD:[this.SearchRequest.controls.CHD.value],INF:[this.SearchRequest.controls.INF.value],FareType:[this.SearchRequest.controls.FareType.value],TUI:[this.SearchRequest.controls.TUI.value],Source:[this.SearchRequest.controls.Source.value],Mode:[this.SearchRequest.controls.Mode.value],Cabin:[this.SearchRequest.controls.Cabin.value],ClientID:[this.SearchRequest.controls.ClientID.value],Trips:this.fb.array([]),Parameters:this.fb.group({Airlines:"",Refundable:"",GroupType:"",IsDirect:!1,IsDefenceFare:!1,IsStudentFare:!1,IsSeniorCitizenFare:!1,PaxCategory:""})}),this.SearchRequest.get("Trips").controls.forEach((function(r){e.controls.Trips.push(t.fb.group({From:[r.get("From").value,o.B.required],To:[r.get("To").value,o.B.required],OnwardDate:[r.get("OnwardDate").value,o.B.required],ReturnDate:[r.get("ReturnDate").value]}))})),e},e.prototype.resetReturnDate=function(e){return"RT"==e?(this.Trips&&this.Trips.controls[0]&&this.Trips.controls[0].get("ReturnDate")&&(this.Trips.controls[0].get("ReturnDate").setErrors({required:!0}),this.Trips.controls[0].get("ReturnDate").markAsTouched()),"Please select return date"):this.Trips&&this.Trips.controls?(this.Trips.controls.forEach((function(e){e&&e.controls.ReturnDate&&(e.controls.ReturnDate.setValue(""),e.controls.ReturnDate.setErrors(null))})),""):void 0},e.prototype.removeTrips=function(){for(var e=this.Trips.length-1;e>0;e--)this.Trips.removeAt(e)},e.prototype.processMultiCitySmrtPrcrResponse=function(e,t){var r=!1,a=this.SearchRequest.get("Trips").controls[t];a.controls.TUI?a.controls.TUI.setValue(e):a.addControl("TUI",new o.h(e,[]));var i=JSON.parse(JSON.stringify(this.SearchRequest.value));return i.Trips.length==i.Trips.filter((function(e){return""!=e.TUI})).length&&(r=!0),r},e.prototype.processMultiCityExpSearchResponse=function(e,t){var r=!1,a=this.SearchRequest.get("Trips").controls[t];a.controls.TUI?a.controls.TUI.setValue(e):a.addControl("TUI",new o.h(e,[]));var i=JSON.parse(JSON.stringify(this.SearchRequest.value));return i.Trips.length==i.Trips.filter((function(e){return e.TUI&&""!=e.TUI})).length&&(r=!0),r},e.prototype.initializeDomMulticityResponse=function(){for(var e=0;e3&&e.match(/\[(.*?)\]/)&&(e=e.match(/\[(.*?)\]/)[1]),this.flightState&&this.flightState.AllAirports&&(t=this.flightState.AllAirports.find((function(t){return t.Code==e}))),t},e.prototype.updateSearchFormGroupByRecentSearchRes=function(e,t){if(e.length>0){var r=this.Trips.controls[0];!r.controls||"ON"!=t&&"RT"!=t||(r.controls.From.setValue(e[0].From),r.controls.To.setValue(e[0].To),r.controls.FromCity.setValue(e[0].DepartureCity),r.controls.ToCity.setValue(e[0].ArrivalCity),this.getAirportInfoByCode(e[0].From)&&r.controls.FromArptName.setValue(this.getAirportInfoByCode(e[0].From).Name),this.getAirportInfoByCode(e[0].To)&&r.controls.ToArptName.setValue(this.getAirportInfoByCode(e[0].To).Name),r.controls.OnwardDate.setValue(e[0].OnwardDate),r.controls.ReturnDate.setValue(e[0].ReturnDate),this.SearchRequest&&this.SearchRequest.controls&&(this.SearchRequest.controls.ADT.setValue(1),this.SearchRequest.controls.CHD.setValue(0),this.SearchRequest.controls.INF.setValue(0),this.SearchRequest.controls.Cabin.setValue("E"),this.SearchRequest.controls.FareType.setValue(e[0].ReturnDate&&""!=e[0].ReturnDate?"RT":"ON"))),"MC"==t&&(this.Trips.controls[1].get("From").setValue(e[0].To),this.Trips.controls[1].get("OnwardDate").setValue(e[0].OnwardDate))}},e.prototype.updateSearchFormGroupByNearestAirport=function(e,t,r){var a=new S;if(a.AirportCode=e.AirportCode,a.AirportName=e.AirportName,a.CityName=e.CityName,"undefined"!=typeof sessionStorage&&sessionStorage.setItem("airportInLocationRes",JSON.stringify(a)),this.Trips.controls[0].get("From").setValue(e.AirportCode),this.Trips.controls[0].get("FromCity").setValue(e.CityName),t&&t.length>0&&(t[0].Code!=e.AirportCode?(this.Trips.controls[0].get("To").value||(this.Trips.controls[0].get("To").setValue(t[0].Code),this.Trips.controls[0].get("ToCity").setValue(t[0].CityName)),"MC"==r&&(this.Trips.controls[1].get("From").setValue(t[0].Code),this.Trips.controls[1].get("FromCity").setValue(t[0].CityName))):(this.Trips.controls[0].get("To").setValue(t[1].Code),this.Trips.controls[0].get("ToCity").setValue(t[1].CityName),"MC"==r&&(this.Trips.controls[1].get("From").setValue(t[1].Code),this.Trips.controls[1].get("FromCity").setValue(t[1].CityName)))),(new Date).getHours()>12||12==(new Date).getHours()&&(new Date).getMinutes()>0){var o=new Date;o.setDate(o.getDate()+1),this.Trips.controls[0].controls.OnwardDate.setValue(l(o).format("YYYY-MM-DD"))}else this.Trips.controls[0].controls.OnwardDate.setValue(l(new Date).format("YYYY-MM-DD"))},e.prototype.updateSearchFormGroupByWebsettings=function(e){var t,r=this.SearchRequest.controls.Trips.controls[0];""==r.controls.From.value&&""==r.controls.To.value&&this.generalState&&this.generalState.WebSettings&&this.generalState.WebSettings.length>0&&this.generalState.WebSettings[0]&&(r.controls.From.setValue(this.generalState.WebSettings[0].filter((function(e){return"DefaultFrom"==e.Key}))[0].Value.toUpperCase()),r.controls.To.setValue(this.generalState.WebSettings[0].filter((function(e){return"DefaultTo"==e.Key}))[0].Value.toUpperCase())),(new Date).getHours()>12||12==(new Date).getHours()&&(new Date).getMinutes()>0?((t=new Date).setDate(t.getDate()+1),this.Trips.controls[0].controls.OnwardDate.setValue(l(t).format("YYYY-MM-DD")),"MC"==e&&(t.setDate(t.getDate()+1),this.Trips.controls[1].controls.OnwardDate.setValue(l(t).format("YYYY-MM-DD")))):(this.Trips.controls[0].controls.OnwardDate.setValue(new Date),"MC"==e&&((t=new Date).setDate(t.getDate()+1),this.Trips.controls[1].controls.OnwardDate.setValue(l(t).format("YYYY-MM-DD"))))},e.prototype.updateSearchFormGroupByPopularAirport=function(e,t){var r,a=this.SearchRequest.controls.Trips.controls[0];if(e&&e.length>0&&""==a.controls.From.value&&""==a.controls.To.value&&(a.controls.From.setValue(e[0].Code),a.controls.To.setValue(e[1].Code),a.controls.FromCity.setValue(e[0].CityName),a.controls.ToCity.setValue(e[1].CityName),"MC"==t)){var o=this.SearchRequest.controls.Trips.controls[1];o.controls.From.setValue(e[1].Code),o.controls.FromCity.setValue(e[1].CityName)}(new Date).getHours()>12||12==(new Date).getHours()&&(new Date).getMinutes()>0?((r=new Date).setDate(r.getDate()+1),this.Trips.controls[0].controls.OnwardDate.setValue(l(r).format("YYYY-MM-DD")),"MC"==t&&(r.setDate(r.getDate()+1),this.Trips.controls[1].controls.OnwardDate.setValue(l(r).format("YYYY-MM-DD")))):(this.Trips.controls[0].controls.OnwardDate.setValue(new Date),"MC"==t&&((r=new Date).setDate(r.getDate()+1),this.Trips.controls[1].controls.OnwardDate.setValue(l(r).format("YYYY-MM-DD"))))},e.prototype.updateSectorTypInState=function(){var e,t,r=this;this.flightState&&(this.flightState.SectorType="D"),this.generalState&&(this.generalState.SectorType="D"),null!=this.SearchRequest.get("Trips")&&this.SearchRequest.get("Trips").controls&&this.SearchRequest.get("Trips").controls.forEach((function(a){if(a.get("From")&&a.get("From").value&&a.get("To")&&a.get("To").value&&(e=r.getAirportInfoByCode(a.get("From").value),t=r.getAirportInfoByCode(a.get("To").value),e&&t)){var o=r.countryCheck();if(e.Country&&e.Country.trim().toLowerCase()!=o||t.Country&&t.Country.trim().toLowerCase()!=o)return r.flightState&&(r.flightState.SectorType="I"),void(r.generalState&&(r.generalState.SectorType="I"))}})),this.SearchRequest&&this.SearchRequest.controls.FareType&&this.SearchRequest.controls.FareType.value&&(this.flightState.SearchType="RS"==this.SearchRequest.controls.FareType.value?"RT":"DM"==this.SearchRequest.controls.FareType.value||"IM"==this.SearchRequest.controls.FareType.value?"MC":this.SearchRequest.controls.FareType.value)},e.prototype.updateSectorTypeInReqFormGroup=function(){var e,t,r=this,a="D";null!=this.SearchRequest.get("Trips")&&this.SearchRequest.get("Trips").controls&&this.SearchRequest.get("Trips").controls.forEach((function(o){if(o.get("From")&&o.get("From").value&&o.get("To")&&o.get("To").value&&(e=r.getAirportInfoByCode(o.get("From").value),t=r.getAirportInfoByCode(o.get("To").value),e&&t)){var i=r.countryCheck();if(e.Country&&e.Country.trim().toLowerCase()!=i||t.Country&&t.Country.trim().toLowerCase()!=i)return void(a="I")}})),this.SearchRequest&&this.SearchRequest.controls&&this.SearchRequest.controls.SecType||this.SearchRequest.addControl("SecType",new o.h("")),this.SearchRequest.controls.SecType.setValue(a)},e.prototype.countryCheck=function(){try{var e="",t=this.flightState.SearchType?this.flightState.SearchType:this.SearchRequest.controls.FareType.value;return"ON"==t?g.a.CountrySettings.domCountrySettings.forEach((function(t){"ON"==t.searchtype&&(e=t.country)})):"RS"==t||"RT"==t?g.a.CountrySettings.domCountrySettings.forEach((function(t){"RT"==t.searchtype&&(e=t.country)})):"MC"!=t&&"DM"!=t||g.a.CountrySettings.domCountrySettings.forEach((function(t){"MC"==t.searchtype&&(e=t.country)})),e}catch(r){}},e.prototype.updateSectorTypInHomeState=function(){var e,t,r=this;this.flightState.homeSectorType="D",this.SearchRequest.get("Trips").controls.forEach((function(a){if(""!=a.get("From").value&&""!=a.get("To").value){e=r.getAirportInfoByCode(a.get("From").value),t=r.getAirportInfoByCode(a.get("To").value);var o=r.countryCheck();if(e&&t&&(e.Country.trim().toLowerCase()!=o||t.Country.trim().toLowerCase()!=o))return void(r.flightState.homeSectorType="I")}}))},e.prototype.getNearestAirportsFromSession=function(){var e=JSON.parse(sessionStorage.getItem("airportInLocationRes")),t=new u;return t.CityName=e.CityName,t.AirportCode=e.AirportCode,t.AirportName=e.AirportName,t},e.prototype.getAirportsFromRecentSearch=function(e,t,r){var a={},o=[],i=this.getFromLocalStore(this.localStorageKey.recentselectedairport);if(e&&e.length>0){for(var n=function(i){"from"==r?a=e.find((function(e){return e.Code==t[i].From})):"to"==r&&(a=e.find((function(e){return e.Code==t[i].To}))),a&&(null!=o.filter((function(e){return e.Code==a.Code}))&&o.filter((function(e){return e.Code==a.Code})).length>0||o.push(a))},s=0;s0){var l=[];o.forEach((function(e){l.length>0?-1==l.map((function(e){return e.Code})).indexOf(e.Code)&&l.push(e):l.push(e)})),o=l}return o},e.prototype.setTripValueByFareType=function(e,t){var r=this.Trips;if(r.controls[0].get("From")&&""==r.controls[0].get("From").value){var a=this.getAirportsFromRecentSearch(e,t,"from");if(a.length>0){r.controls[0].get("From").setValue(a[0].Code),r.controls[0].get("FromCity").setValue(a[0].CityName);var o=new Date;((new Date).getHours()>12||12==(new Date).getHours()&&(new Date).getMinutes()>0)&&o.setDate(o.getDate()+1),r.controls[0].get("OnwardDate").setValue(l(o).format("YYYY-MM-DD"))}}if(r.controls[0].get("To")&&""==r.controls[0].get("To").value){var i=this.getAirportsFromRecentSearch(e,t,"to");i.length>0&&(r.controls[0].get("To").setValue(i[0].Code),r.controls[0].get("ToCity").setValue(i[0].CityName))}},e.prototype.setRecentSelectedAirports=function(e,t,r){var a={sectorType:"",Airport:{}},o=this.getFromLocalStore(this.localStorageKey.recentselectedairport),i=0;null!=o&&null!=o?(o.forEach((function(e){e&&e.sectorType==r&&JSON.stringify(e.Airport)===JSON.stringify(t)&&i++})),0==i&&(a.sectorType=r,a.Airport=t,o.push(a),this.keepInLocalStore(this.localStorageKey.recentselectedairport,o),this.keepInLocalStore(this.localStorageKey.recentselectedairport,o))):(o=[],a.sectorType=r,a.Airport=t,o.push(a),this.keepInLocalStore(this.localStorageKey.recentselectedairport,o))},e.prototype.setSsrData=function(e,t,r,a,o){var i=this.flightState.TravelItineraryFormGrp.controls.SSR;if(o)if((s=i.controls.findIndex((function(e){return e.value.SSID===a})))>0){var n=i.controls.findIndex((function(e){return e.value.SSID===a&&e.value.Type===r&&e.value.PaxID===t}));i.controls[n].controls.SSID.setValue(a)}else(n=i.controls.findIndex((function(e){return 0===e.value.SSID&&e.value.Type===r&&e.value.PaxID===t})))>0?i.controls[n].controls.SSID.setValue(a):i.push(this.fb.group({PaxID:t,FUID:e,SSID:a,Type:r,Code:""}));else{var s=i.controls.findIndex((function(e){return e.value.SSID===a&&e.value.Type===r&&e.value.PaxID===t}));i.controls[s].controls.SSID.setValue(0)}},e.prototype.getLowestFare=function(e){return e.filter((function(e){return e.Price>0})).reduce((function(e,t){return 0==e||t.Price0){var p=t[0].PTCFare.filter((function(e){return null!==e}));t[0].TotalAtoCharge&&t[0].TotalAtoCharge>=0&&(u.TotalATOCharge=t[0].TotalAtoCharge),t[0].TotalReissueCharge&&t[0].TotalReissueCharge>=0&&(u.TotalReissueCharge=t[0].TotalReissueCharge),p&&p.length&&t[0].PTCFare.filter((function(e){return null!==e})).forEach((function(e){if("ADT"==e.PTC){u.AdultGST=0,u.AdultOtherTaxAll=0,e.Count=t[0].PTCFare.filter((function(e){return null!==e&&"ADT"==e.PTC})).length,u.AdultBaseFare+=e.Fare,t[0].DealKey&&t[0].DealKey.indexOf("M")>-1&&e.Markup&&(u.AdultBaseFare+=e.Markup),e.CSFare&&e.CSFare>0&&(u.AdultCSCharge+=e.CSFare,u.AdultBaseFare+=u.AdultCSCharge),u.TotalAdultBaseFare=u.AdultBaseFare*o,u.AdultOtherTaxType=e.OTT;var r=[],a=[];""!=u.AdultOtherTaxType&&" "!=u.AdultOtherTaxType&&null!=u.AdultOtherTaxType&&(r=(r=u.AdultOtherTaxType.split(",")).filter((function(e){return""!=e&&" "!=e})).map((function(e){return e.trim()}))),""!=e.OT&&" "!=e.OT&&null!=e.OT&&(a=(a=e.OT.split(",")).filter((function(e){return""!=e})));var l=r.filter((function(e){return"CGST"==e||"SGST"==e||"IGST"==e||"UGST"==e||"JN"==e}));if("SG"==S){var h=r.filter((function(e){return"AAT"==e})),c=r.filter((function(e){return"AAT"!=e}));if(h.length>0)for(var p=0;p0)for(p=0;p0&&a.forEach((function(e){" "==e&&""==e||(u.AdultOtherTax=u.AdultOtherTax+parseFloat(e))}));if(l.length>0)for(p=0;p0&&(u.AdultOtherTax=u.AdultGST>0?u.AdultOtherTax-u.AdultGST:u.AdultOtherTax,u.AdultJNTax=u.AdultJNTax+u.AdultGST),u.TotalJNTax+=u.AdultJNTax*o,u.TotalOtherTaxUDF+=u.AdultOtherTaxAll*o,u.TotalFuelTax+=e.YQ*o,u.TotalPSF+=e.PSF*o,u.TotalUserDevelopmentTax+=e.UD*o,u.TotalYR=u.TotalYR+e.YR*o,u.TotalAPI=u.TotalAPI+e.API*o,u.TotalVATonServiceCharge+=e.VATonServiceCharge*o,u.TotalVATonTransactionFee+=e.VATonTransactionFee*o,u.TotalK7tax=u.AdultK7tax*o}else if("CHD"==e.PTC){u.ChildGST=0,u.ChildOtherTaxAll=0,e.Count=t[0].PTCFare.filter((function(e){return"CHD"==e.PTC})).length,u.ChildBaseFare+=e.Fare,t[0].DealKey&&t[0].DealKey.indexOf("M")>-1&&e.Markup&&(u.ChildBaseFare+=e.Markup),e.CSFare&&e.CSFare>0&&(u.ChildCSCharge+=e.CSFare,u.ChildBaseFare+=u.ChildCSCharge),u.TotalChildBaseFare=u.ChildBaseFare*i,u.ChildOtherTaxType=e.OTT;var T=[],d=[];if(""!=u.ChildOtherTaxType&&" "!=u.ChildOtherTaxType&&null!=u.ChildOtherTaxType&&(T=(T=u.ChildOtherTaxType.split(",")).filter((function(e){return""!=e&&" "!=e})).map((function(e){return e.trim()}))),""!=e.OT&&" "!=e.OT&&null!=e.OT&&(d=(d=e.OT.split(",")).filter((function(e){return""!=e}))),l=T.filter((function(e){return"CGST"==e||"SGST"==e||"IGST"==e||"UGST"==e||"JN"==e})),"SG"==S){if(h=T.filter((function(e){return"AAT"==e})),c=T.filter((function(e){return"AAT"!=e})),h.length>0)for(p=0;p0)for(p=0;p0&&d.forEach((function(e){" "==e&&""==e||(u.ChildOtherTax=u.ChildOtherTax+parseFloat(e))}));if(l.length>0)for(p=0;p0&&(u.ChildOtherTax=u.ChildGST>0?u.ChildOtherTax-u.ChildGST:u.ChildOtherTax,u.ChildJNTax=u.ChildJNTax+u.ChildGST),u.TotalJNTax+=u.ChildJNTax*i,u.TotalOtherTaxUDF+=u.ChildOtherTaxAll*i,u.TotalFuelTax+=e.YQ*i,u.TotalPSF+=e.PSF*i,u.TotalUserDevelopmentTax+=e.UD*i,u.TotalYR=u.TotalYR+e.YR*i,u.TotalAPI=u.TotalAPI+e.API*i,u.TotalVATonServiceCharge+=e.VATonServiceCharge*i,u.TotalVATonTransactionFee+=e.VATonTransactionFee*i,u.TotalK7tax+=u.ChildK7tax*i}else if("INF"==e.PTC){u.InfantGST=0,u.InfantOtherTaxAll=0,e.Count=t[0].PTCFare.filter((function(e){return"INF"==e.PTC})).length,u.InfantBaseFare+=e.Fare,t[0].DealKey&&t[0].DealKey.indexOf("M")>-1&&e.Markup&&(u.InfantBaseFare+=e.Markup),e.CSFare&&e.CSFare>0&&(u.InfantCSCharge+=e.CSFare,u.InfantBaseFare+=u.InfantCSCharge),u.TotalInfantBaseFare=u.InfantBaseFare*n,u.InfantOtherTaxType=e.OTT;var y=[],m=[];if(""!=u.InfantOtherTaxType&&" "!=u.InfantOtherTaxType&&null!=u.InfantOtherTaxType&&(y=(y=u.InfantOtherTaxType.split(",")).filter((function(e){return""!=e&&" "!=e})).map((function(e){return e.trim()}))),""!=e.OT&&" "!=e.OT&&null!=e.OT&&(m=(m=e.OT.split(",")).filter((function(e){return""!=e}))),l=y.filter((function(e){return"CGST"==e||"SGST"==e||"IGST"==e||"UGST"==e||"JN"==e})),"SG"==S){if(h=y.filter((function(e){return"AAT"==e})),c=y.filter((function(e){return"AAT"!=e})),h.length>0)for(p=0;p0)for(p=0;p0&&m.forEach((function(e){" "==e&&""==e||(u.InfantOtherTax=u.InfantOtherTax+parseFloat(e))}));if(l.length>0)for(p=0;p0&&(u.InfantOtherTax=u.InfantGST>0?u.InfantOtherTax-u.InfantGST:u.InfantOtherTax,u.InfantJNTax=u.InfantJNTax+u.InfantGST),u.TotalJNTax+=u.InfantJNTax*n,u.TotalOtherTaxUDF+=u.InfantOtherTaxAll*n,u.TotalFuelTax+=e.YQ*n,u.TotalPSF+=e.PSF*n,u.TotalUserDevelopmentTax+=e.UD*n,u.TotalYR=u.TotalYR+e.YR*n,u.TotalAPI=u.TotalAPI+e.API*n,u.TotalVATonServiceCharge+=e.VATonServiceCharge*n,u.TotalVATonTransactionFee+=e.VATonTransactionFee*n,u.TotalK7tax+=u.InfantK7tax*i}})),u.VATonNetAmount=u.TotalJNTax+u.TotalK7tax+u.TotalVATonServiceCharge+u.TotalVATonTransactionFee,l.generalState&&l.generalState.PromoDiscount>=0&&"display"!=r?u.TotalCommission=l.generalState.PromoDiscount:u.TotalCommission+=t[0].TotalCommission,c=c+t[0].TotalVATonServiceCharge+t[0].TotalVATonTransactionFee,u.TotalBaseFare=u.TotalAdultBaseFare+u.TotalChildBaseFare+u.TotalInfantBaseFare,u.TotalAirlineMisc=u.TotalAPI+u.TotalYR+c,l.flightState&&l.flightState.insurancePremium&&(u.InsPremium=l.flightState.insurancePremium,u.INSFare=l.flightState.INSFares),l.flightState&&l.flightState.RPIamount&&(u.RPIamount=l.flightState.RPIamount),l.flightState&&l.flightState.ALSamount&&(u.ALSamount=l.flightState.ALSamount),l.flightState&&l.flightState.BaggageProtectionAmount&&(u.BRBAmount=l.flightState.BaggageProtectionAmount),!l.flightState||!l.flightState.ssrTotalFareVM||null!=a&&a||(u.TotalBaggageAmount=l.flightState.ssrTotalFareVM.Baggage.TotalFare,u.TotalMealsAmount=l.flightState.ssrTotalFareVM.Meals.TotalFare,u.TotalSeatsAmount=l.flightState.ssrTotalFareVM.Seat.TotalFare,u.TotalSportAmount=l.flightState.ssrTotalFareVM.Sports.TotalFare,u.TotalPriorityCheckin=l.flightState.ssrTotalFareVM.PriorityCheckin.TotalFare,u.TotalPriorityBaggage=l.flightState.ssrTotalFareVM.PriorityBaggage.TotalFare,u.TotalMISCCharges=l.flightState.ssrTotalFareVM.MISC.TotalFare,h=l.flightState.ssrTotalFareVM.Seat.TotalNos),u.TotalOtherTax=u.AdultOtherTax*o+u.ChildOtherTax*i+u.InfantOtherTax*n,u.TotalTax+=parseFloat(t[0].TotalTax.toString())+parseFloat(t[0].TotalCommission.toString()),s&&(u.TotalOtherTax=u.TotalOtherTax-u.TotalK7tax),u.TotalST+=t[0].TotalServiceTax,t[0].DealKey&&t[0].DealKey.indexOf("M")>-1&&t[0].TotalMarkup&&(u.TotalTax=u.TotalTax-t[0].TotalMarkup,u.TotalST=u.TotalST-t[0].TotalMarkup)}})),s&&(u.TotalAirlineMisc-=c,u.TotalTax=u.TotalTax-u.VATonNetAmount,u.VAT+=u.VATonNetAmount),this.generalState&&this.generalState.ConvenienceFee>0&&(this.isPaymentPage()||this.isGoogleSearch())&&(s?(u.ConvenienceFee=this.generalState.ConvenienceFee-this.generalState.VATonConvncFee,u.VATonConvenienceFee=this.generalState.VATonConvncFee,u.VAT+=u.VATonConvenienceFee):u.ConvenienceFee=this.generalState.ConvenienceFee,u.NetFare+=u.ConvenienceFee),u.NetFare+=u.TotalBaseFare+u.TotalTax-u.TotalCommission,u.TotalMealsAmount>0&&u.AddOn.push({Type:"1",Name:"Meals",Charge:u.TotalMealsAmount}),u.TotalBaggageAmount>0&&u.AddOn.push({Type:"2",Name:"Baggage",Charge:u.TotalBaggageAmount}),u.TotalSportAmount>0&&u.AddOn.push({Type:"3",Name:"Sports",Charge:u.TotalSportAmount}),u.bagaggeInsurance>0&&u.AddOn.push({Type:"6",Name:"Baggage insurance",Charge:u.bagaggeInsurance}),u.TotalPriorityBaggage>0&&u.AddOn.push({Type:"7",Name:"Baggage out first",Charge:u.TotalPriorityBaggage}),u.TotalPriorityCheckin>0&&u.AddOn.push({Type:"8",Name:"Priority check-in",Charge:u.TotalPriorityCheckin}),(u.TotalSeatsAmount>0||h>0&&this.isBusinessClass(e))&&u.AddOn.push({Type:"9",Name:"Seats",Charge:u.TotalSeatsAmount}),0!=u.TotalMISCCharges&&u.AddOn.push({Type:"100",Name:"MISC",Charge:u.TotalMISCCharges}),u.AddOn.length>0?(u.HasAddons=!0,u.AddOn.forEach((function(e){u.TotalAddOn+=e.Charge})),u.NetFare+=u.TotalAddOn):u.HasAddons=!1,u.NetFare+=u.TotalATOCharge,u.NetFare+=u.TotalReissueCharge,u.NetFare+=u.RPIamount,u.NetFare+=u.InsPremium,u.NetFare+=u.BRBAmount,u.NetFare+=u.ALSamount,s&&(u.NetFare+=u.VAT),u.VATonNetAmount>0&&(this.generalState.TotalVAT=u.VATonNetAmount),this.generalState.VATinTotal=u.VAT,this.generalState.Transactionfee=u.TotalVATonTransactionFee+u.TotalVATonServiceCharge,this.generalState.TotalNetFare=u.NetFare,this.generalState.TotalBaseFare=u.TotalBaseFare,this.generalState.TotalTax=u.TotalTax,this.generalState.TotalCommition=u.TotalCommission,this.generalState.TotalAddOns=u.TotalAddOn+u.InsPremium+u.RPIamount+u.BRBAmount+u.ALSamount,this.generalState.TotalReissue=u.TotalATOCharge+u.TotalReissueCharge,u},e.prototype.getFares=function(e){if(e){var t=[];return e.Segments&&e.Segments.forEach((function(e){e&&null!=e.Fares&&t.push(e.Fares)})),t}},e.prototype.getPassengerListCountFromAvlReq=function(){var e={};if("undefined"!=typeof sessionStorage&&sessionStorage.getItem("avlreq")){var t=JSON.parse(sessionStorage.getItem("avlreq"));e.adultCount=t.ADT,e.childCount=t.CHD,e.infantCount=t.INF}return e},e.prototype.getPassengerListCount=function(){var e={};return this.SmartPricerResponse&&(e.adultCount=this.SmartPricerResponse.ADT,e.childCount=this.SmartPricerResponse.CHD,e.infantCount=this.SmartPricerResponse.INF),e},Object.defineProperty(e.prototype,"RecentSearch",{get:function(){return this.getFromLocalStore("recentsearch")},enumerable:!0,configurable:!0}),e.prototype.resetSearchFormGroup=function(){if(this.flightState.SearchRequestFormGroup&&this.flightState.SearchRequest){var e=this.SearchRequest.get("Trips").length;if(this.SearchRequest.get("Trips").length!=this.flightState.SearchRequest.Trips.length){var t=Math.abs(this.SearchRequest.get("Trips").length-this.flightState.SearchRequest.Trips.length);if(this.SearchRequest.get("Trips").length>this.flightState.SearchRequest.Trips.length){for(var r=1;r<=t;r++)this.Trips.removeAt(e-r);this.SearchRequest.get("Trips").patchValue(this.flightState.SearchRequest.Trips)}else{for(r=0;r0&&e.forEach((function(e){e.Journey.forEach((function(e){e.Segments.forEach((function(e){t+=e.Fares.TotalCommission}))}))})),t},e.prototype.webSettings=function(e,t,r,a){var o,i=this,n=!1;if(this.generalState.WebSettings&&this.generalState.WebSettings[0]){var s=this.generalState.WebSettings[0].filter((function(e){return"DomLCCchannelcode"==e.Key}));if(s.length>0)var l=s[0].Value.split(",");var u=this.generalState.WebSettings[0].filter((function(e){return"IntLCCchannelcode"==e.Key}));if(u.length>0)var h=u[0].Value.split(",");return"SSR"==e?o="I"!=r?l.includes(this.SmartPricerResponse.Trips[a].Journey[0].Provider)?this.generalState.WebSettings[0].filter((function(e){return"ShowSSRDom"==e.Key})):this.generalState.WebSettings[0].filter((function(e){return"ShowSSRDomGDS"==e.Key})):h.includes(this.SmartPricerResponse.Trips[a].Journey[0].Provider)?this.generalState.WebSettings[0].filter((function(e){return"ShowSSRInt"==e.Key})):this.generalState.WebSettings[0].filter((function(e){return"ShowSSRIntGDS"==e.Key})):"baggage"==e?o="I"!=r?l.includes(this.SmartPricerResponse.Trips[a].Journey[0].Provider)?this.generalState.WebSettings[0].filter((function(e){return"ShowBaggageDom"==e.Key})):this.generalState.WebSettings[0].filter((function(e){return"ShowBaggageDomGDS"==e.Key})):h.includes(this.SmartPricerResponse.Trips[a].Journey[0].Provider)?this.generalState.WebSettings[0].filter((function(e){return"ShowBaggageInt"==e.Key})):this.generalState.WebSettings[0].filter((function(e){return"ShowBaggageIntGDS"==e.Key})):"sports"==e?o="I"!=r?l.includes(this.SmartPricerResponse.Trips[a].Journey[0].Provider)?this.generalState.WebSettings[0].filter((function(e){return"ShowSportsDom"==e.Key})):this.generalState.WebSettings[0].filter((function(e){return"ShowSportsDomGDS"==e.Key})):h.includes(this.SmartPricerResponse.Trips[a].Journey[0].Provider)?this.generalState.WebSettings[0].filter((function(e){return"ShowSportsInt"==e.Key})):this.generalState.WebSettings[0].filter((function(e){return"ShowSportsIntGDS"==e.Key})):"meals"==e?o="I"!=r?l.includes(this.SmartPricerResponse.Trips[a].Journey[0].Provider)?this.generalState.WebSettings[0].filter((function(e){return"ShowMealsDom"==e.Key})):this.generalState.WebSettings[0].filter((function(e){return"ShowMealsDomGDS"==e.Key})):h.includes(this.SmartPricerResponse.Trips[a].Journey[0].Provider)?this.generalState.WebSettings[0].filter((function(e){return"ShowMealsInt"==e.Key})):this.generalState.WebSettings[0].filter((function(e){return"ShowMealsIntGDS"==e.Key})):"prioritybaggage"==e?o="I"!=r?l.includes(this.SmartPricerResponse.Trips[a].Journey[0].Provider)?this.generalState.WebSettings[0].filter((function(e){return"ShowBaggageOutFirstDom"==e.Key})):this.generalState.WebSettings[0].filter((function(e){return"ShowBaggageOutFirstDomGDS"==e.Key})):h.includes(this.SmartPricerResponse.Trips[a].Journey[0].Provider)?this.generalState.WebSettings[0].filter((function(e){return"ShowBaggageOutFirstInt"==e.Key})):this.generalState.WebSettings[0].filter((function(e){return"ShowBaggageOutFirstIntGDS"==e.Key})):"prioritycheckin"==e?o="I"!=r?l.includes(this.SmartPricerResponse.Trips[a].Journey[0].Provider)?this.generalState.WebSettings[0].filter((function(e){return"ShowPriorityCheckinDom"==e.Key})):this.generalState.WebSettings[0].filter((function(e){return"ShowPriorityCheckinDomGDS"==e.Key})):h.includes(this.SmartPricerResponse.Trips[a].Journey[0].Provider)?this.generalState.WebSettings[0].filter((function(e){return"ShowPriorityCheckinInt"==e.Key})):this.generalState.WebSettings[0].filter((function(e){return"ShowPriorityCheckinIntGDS"==e.Key})):"LCC"==e?o=this.generalState.WebSettings[0].filter("I"!=r?function(e){return"domLCCchannelcode"==e.Key}:function(e){return"intLCCchannelcode"==e.Key}):"seat"==e&&(o="I"!=r?l.includes(this.SmartPricerResponse.Trips[a].Journey[0].Provider)?this.generalState.WebSettings[0].filter((function(e){return"ShowSeatLayoutDom"==e.Key})):this.generalState.WebSettings[0].filter((function(e){return"ShowSeatLayoutDomGDS"==e.Key})):h.includes(this.SmartPricerResponse.Trips[a].Journey[0].Provider)?this.generalState.WebSettings[0].filter((function(e){return"ShowSeatLayoutInt"==e.Key})):this.generalState.WebSettings[0].filter((function(e){return"ShowSeatLayoutIntGDS"==e.Key}))),o&&o.length&&o[0]&&o[0].Value&&o[0].Value.split(/[-,,]/).forEach((function(e){(e==t||e==i.SmartPricerResponse.Trips[a].Journey[0].Provider)&&(n=!0)})),n}},e.prototype.resetSSRStatevalue=function(){this.flightState&&this.flightState.ssrTotalFareVM&&(this.flightState.ssrTotalFareVM.Meals.TotalFare=0,this.flightState.ssrTotalFareVM.Baggage.TotalFare=0,this.flightState.ssrTotalFareVM.Sports.TotalFare=0,this.flightState.ssrTotalFareVM.PriorityBaggage.TotalFare=0,this.flightState.ssrTotalFareVM.PriorityCheckin.TotalFare=0,this.flightState.ssrTotalFareVM.Seat.TotalFare=0)},e.prototype.removeBaggageInsuarance=function(){this.flightState.baggageInsurance=0,this.flightState.selectedBRBCollection=void 0,this.CrossSellFormGroup[0].controls.Type.setValue(""),this.CrossSellFormGroup[0].controls.Value.setValue("")},e.prototype.checkPaxCollapse=function(){var e=this;this.flightState.TravelItineraryFormGrp.valid||this.flightState.TravelItineraryFormGrp.controls.Travellers.controls.forEach((function(t){if(1!=t.valid){var r=t.controls.PTC.value;"ADT"===r?e.flightState.IsToexpandedADT=!0:"CHD"===r?e.flightState.IsToexpandedCHD=!0:e.flightState.IsToexpandedINF=!0}}))},e.prototype.setSectorType=function(){var e=!1;if(this.Trips)for(var t=JSON.parse(JSON.stringify(this.Trips.value)),r=0;r0&&e.CrossSell.forEach((function(e){"INS"==e.Code&&(t.flightState.insurancePremium=e.Amount),"BRB"==e.Code&&(t.flightState.BaggageProtectionAmount=e.Amount),"RPI"==e.Code&&(t.flightState.RPIamount=e.Amount),"ALS"==e.Code&&(t.flightState.ALSamount=e.Amount)})),e.SSR&&e.SSR.length>0&&(this.flightState.ssrTotalFareVM||(this.flightState.ssrTotalFareVM=new c.a),e.SSR.forEach((function(r){"1"==r.Type&&0!=r.Charge&&(t.flightState.ssrTotalFareVM.Meals.TotalFare+=r.Charge*r.FUID.split(",").length),"2"==r.Type&&0!=r.Charge&&(t.flightState.ssrTotalFareVM.Baggage.TotalFare+=r.Charge*r.FUID.split(",").length),"3"==r.Type&&0!=r.Charge&&(t.flightState.ssrTotalFareVM.Sports.TotalFare+=r.Charge*r.FUID.split(",").length),"7"==r.Type&&0!=r.Charge&&(t.flightState.ssrTotalFareVM.PriorityBaggage.TotalFare+=r.Charge*r.FUID.split(",").length),"8"==r.Type&&0!=r.Charge&&(t.flightState.ssrTotalFareVM.PriorityCheckin.TotalFare+=r.Charge*r.FUID.split(",").length),("9"==r.Type&&0!=r.Charge||"9"==r.Type&&"B"==e.Trips[0].Journey[0].Segments[0].Flight.Cabin)&&(t.flightState.ssrTotalFareVM.Seat.TotalFare+=r.Charge*r.FUID.split(",").length,t.flightState.ssrTotalFareVM.Seat.TotalNos+=1),"100"==r.Type&&0!=r.Charge&&(t.flightState.ssrTotalFareVM.MISC.TotalFare+=r.Charge*r.FUID.split(",").length)})))},e.prototype.IsSector=function(e){if("INTRT"==e){if("I"==this.flightState.SectorType&&("RT"==this.SearchRequest.controls.FareType.value||"RS"==this.SearchRequest.controls.FareType.value))return!0}else if("INTON"==e){if("I"==this.flightState.SectorType&&"ON"==this.SearchRequest.controls.FareType.value)return!0}else if("DOMRT"==e){if("D"==this.flightState.SectorType&&("RT"==this.SearchRequest.controls.FareType.value||"RS"==this.SearchRequest.controls.FareType.value))return!0}else if("DOMON"==e){if("D"==this.flightState.SectorType&&"ON"==this.SearchRequest.controls.FareType.value)return!0}else if("DOMMC"==e){if("D"==this.flightState.SectorType&&"MC"==this.SearchRequest.controls.FareType.value||"DM"==this.SearchRequest.controls.FareType.value)return!0}else if("INTMC"==e&&("I"==this.flightState.SectorType&&"MC"==this.SearchRequest.controls.FareType.value||"IM"==this.SearchRequest.controls.FareType.value))return!0;return!1},e.prototype.getTime=function(e,t){if(!e)return"";if("H"==t){var r=e.toLocaleLowerCase().split("h")[0];return 0==r.indexOf("0")?r.slice(1,r.length):r}return"M"==t?e.split("h")[1].replace("m",""):void 0},e.prototype.getStopAndConnection=function(e){var t=e.length+this.translateService.instant("stopviaMsg");return e.forEach((function(e){e.ArrAirportName&&(t+=e.ArrAirportName.split("|")[1])})),t},e.prototype.restoreSectorType=function(){this.flightState.SectorType=this.flightState.SearchRequest.SecType,this.generalState&&(this.generalState.SectorType=this.getFromSession("SectorType"))},e.prototype.isBusinessClass=function(e){return!!(e&&e.length>0&&"B"==e[0].Segments[0].Flight.Cabin)},e.prototype.isPaymentPage=function(){return!(!this.generalState.GetRetrieveBookingResponse||null==this.generalState.GetRetrieveBookingResponse.TransactionID)},e.prototype.isGoogleSearch=function(){var e=!1;return g.a.MerchantSettings.Desktop.AUI==g.a.MerchantSettings.GoogleSearch.AUI&&(e=!0),e},e.prototype.createSearchNavigationUrl=function(e){var t,r,a="";return t=e.ADT+"_"+e.CHD+"_"+e.INF,1==e.Trips.length&&"MC"!=e.FareType&&"DM"!=e.FareType?"RT"==e.FareType?(r=e.Trips[0].From+"-"+e.Trips[0].To,a=e.Trips[0].OnwardDate+"-"+e.Trips[0].ReturnDate):(r=e.Trips[0].From+"-"+e.Trips[0].To,a=e.Trips[0].OnwardDate):e.Trips.length>1&&e.Trips.forEach((function(e){r=r+"_"+e.From,a=a+"_"+e.OnwardDate})),e.FareType+"/"+r+"/"+a+"/"+t},e.prototype.setStateExpSearchResDefined=function(){this.flightState.FilterModel={},this.flightState.SearchResult={},this.flightState.SearchResult.Trips=[];for(var e=0;e0&&(this.generalState.MulticityPromo=[],this.flightState.SmartPricerResponseMC&&this.flightState.SmartPricerResponseMC.forEach((function(e,t){var r={},o=0;r.TUI=e,a.flightState.SmartPricerResponse&&a.flightState.SmartPricerResponse.Trips[t]&&(r.PromoCode=a.flightState.SmartPricerResponse.Trips[t].Journey[0].Promo,a.flightState.SmartPricerResponse.Trips[t].Journey.forEach((function(e){e.Segments.forEach((function(e){o+=e.Fares.TotalCommission}))}))),r.DefaultPromoAmount=o,r.PromoAmount=o,a.generalState.MulticityPromo.push(r)}))):""!=t&&""!=r&&this.generalState.GetRetrieveBookingResponse&&this.generalState.GetRetrieveBookingResponse.FlightInfoNew&&this.generalState.GetRetrieveBookingResponse.FlightInfoNew.length>1&&(this.generalState.MulticityPromo=[],this.generalState.GetRetrieveBookingResponse.FlightInfoNew.forEach((function(e,o){var i={},n=0;i.TUI=t.split(",")[o],i.TransactionID=r.split(",")[o],e&&(i.PromoCode=e.Promo&&e.Promo[0]?e.Promo[0].Code.toString():"",e.Trips[0].Journey.forEach((function(e){e.Segments.forEach((function(e){n+=e.Fares.TotalCommission}))}))),i.PromoAmount=n,a.generalState.MulticityPromo.push(i)})))},e.prototype.createDisplayNavigationUrl=function(e,t,r){var a,o,i,n="";r?"recentSearch"==r?i=e.FareType:"impulsiveFare"==r&&(i="ON"):i=this.flightState.SearchType,a=e.ADT+"_"+e.CHD+"_"+e.INF,1==e.Trips.length&&"MC"!=e.FareType&&"DM"!=e.FareType?"RT"==e.FareType?(o=e.Trips[0].From+"-"+e.Trips[0].To,n=e.Trips[0].OnwardDate+"_"+e.Trips[0].ReturnDate):(o=e.Trips[0].From+"-"+e.Trips[0].To,n=e.Trips[0].OnwardDate):e.Trips.length>1&&(o="",e.Trips.forEach((function(e){o=""!=o?o+"_"+e.From+"-"+e.To:e.From+"-"+e.To,n=""!=n?n+"_"+e.OnwardDate:e.OnwardDate})));var s="";return t.forEach((function(e,t){0==t?s=e:s+="_"+e})),null==e.Parameters.IsDirect&&(e.Parameters.IsDirect=!1),null!=e.Parameters.PaxCategory&&""!=e.Parameters.PaxCategory||(e.Parameters.PaxCategory="NA"),"flight/display/"+o+"/"+n+"/"+a+"/"+this.flightState.SectorType+"/"+i+"/"+e.Cabin+"/"+e.Parameters.IsDirect+"/"+e.Parameters.PaxCategory+"/"+s},e.prototype.IsRsfReIssue=function(){if(sessionStorage.getItem("reissue")&&"undefined"!=sessionStorage.getItem("reissue")){var e=JSON.parse(sessionStorage.getItem("reissue"));return!(!e||"RS"!=e.searchType)}},e.prototype.checkStudentFareValidation=function(){if(this.SearchRequest.controls.CHD.value>0||this.SearchRequest.controls.INF.value>0)return!0},e.prototype.checkSeniorCitizenValidation=function(){if(this.SearchRequest.controls.CHD.value>0||this.SearchRequest.controls.INF.value>0)return!0},e.prototype.updatePaxCategoryInState=function(){var e=this;this.flightState.PaxCategory="",this.flightState&&this.flightState.SmartPricerResponse&&this.flightState.SmartPricerResponse.Trips&&this.flightState.SmartPricerResponse.Trips.length>0&&this.flightState.SmartPricerResponse.Trips.forEach((function(t){t.Journey&&t.Journey.length>0&&t.Journey[0]&&"DEF"==t.Journey[0].PaxCategory?e.flightState.PaxCategory="DEF":t.Journey&&t.Journey.length>0&&t.Journey[0]&&"STU"==t.Journey[0].PaxCategory?e.flightState.PaxCategory="STU":t.Journey&&t.Journey.length>0&&t.Journey[0]&&"SCP"==t.Journey[0].PaxCategory&&(e.flightState.PaxCategory="SCP")}))},e.prototype.isCouponFare=function(e,t){var r=this;try{var a=void 0,o=!1,i=void 0;return this.generalState.WebSettings&&this.generalState.WebSettings[0]&&(a=this.generalState.WebSettings[0].filter((function(e){return"CouponCodeAirlines"==e.Key}))),a&&a[0]&&a[0].Value&&(i=a[0].Value.split(",")),i&&i.length>0&&i.filter((function(a){if(a==e)for(var i=0;i0)for(var a=0;a0&&this.flightState.SmartPricerResponse.Trips.forEach((function(t,r){var a=0;t.Journey&&t.Journey[0].Segments&&t.Journey[0].Segments.forEach((function(t,o){var n=0;Object.keys(e.flightState.TravelItineraryFormGrp.get("Travellers").controls).forEach((function(s){var u=e.flightState.TravelItineraryFormGrp.get("Travellers").get(s);u instanceof i.k&&u.get("PTC")&&"INF"!=u.get("PTC").value&&(0==l&&0==a&&0==n||e.createSSRForPax(n,t.Flight.FUID,1,r,o),e.createSSRForPax(n,t.Flight.FUID,2,r,o),e.createSSRForPax(n,t.Flight.FUID,3,r,o),e.createSSRForPax(n,t.Flight.FUID,4,r,o),e.createSSRForPax(n,t.Flight.FUID,5,r,o),e.createSSRForPax(n,t.Flight.FUID,9,r,o),e.createSSRForPax(n,t.Flight.FUID,7,r,o),e.createSSRForPax(n,t.Flight.FUID,8,r,o)),n++})),a++})),l++}))},e.prototype.createInsuranceFormGroup=function(){this.flightState.TravelInsuranceFormGrp=this.fb.group({Insurance:this.fb.array([this.fb.group({InsChecked:new i.h("",[i.B.required]),InsDays:new i.h("1")})])})},e.prototype.createALSFormGroup=function(){this.flightState.ALSInsuranceFormgroup=this.fb.group({LiveFlightTracking:this.fb.array([this.fb.group({ALSchecked:new i.h("",[i.B.required])})])})},e.prototype.createRefundPremiumInsuranceFormGroup=function(){this.flightState.RefundPremiumInsuranceFormgroup=this.fb.group({RefundPremiumIInsurance:this.fb.array([this.fb.group({RefundPremiumInsuranceChecked:new i.h("",[i.B.required])})])})},e.prototype.createBaggageProtectionInsuranceFormGroup=function(){this.flightState.BaggageProtectionInsuranceFormgroup=this.fb.group({BaggageProtectionIns:this.fb.array([this.fb.group({BaggageProtectionInsChecked:new i.h("",[i.B.required])})])})},e.prototype.noWhitespaceValidator=function(e){return(e.value||"").trim().length<=1?{space:!0}:null},e.prototype.createSSRForPax=function(e,t,r,a,o){this.flightState.TravelItineraryFormGrp.controls.SSR.push(this.fb.group({PaxID:e+1,FUID:t,SSID:0,Type:r,Code:"",Fare:0,tripIdx:a,segIdx:o}))},e.prototype.createPaxFormGroup=function(e,t){this.flightState.TravelItineraryFormGrp.controls.Travellers.push(this.fb.group({ID:e+1,PaxID:0,Operation:"",Title:["",i.B.required],FName:["",[i.B.required,i.B.pattern("^[a-zA-Z ]*$"),this.noWhitespaceValidator]],LName:["",[i.B.required,i.B.pattern("^[a-zA-Z ]*$"),this.noWhitespaceValidator]],Age:0,DOB:"ADT"!=t?[i.B.required]:"",Gender:"M",Country:"",PTC:t,Nationality:[""],PassportNo:"",PLI:"",PDOE:"",VisaType:"",DOBDay:"0",DOBMonth:"0",DOBYear:"0",PDOEDay:"0",PDOEMonth:"0",PDOEBYear:"0",DefenceID:"",PaxCategoryID:"",DocType:""},{validator:[this.setvalidationForNonMandatoryFields("Nationality"),this.setvalidationForNonMandatoryFields("VisaType"),this.setvalidationForNonMandatoryFields("PassportNo"),this.setvalidationForNonMandatoryFields("PLI"),this.setvalidationForNonMandatoryFields("DOB"),this.setvalidationForNonMandatoryFields("Country"),this.setvalidationForNonMandatoryFields("PDOE"),this.setvalidationForNonMandatoryFields("DocType")]}))},e.prototype.setvalidationForNonMandatoryFields=function(e){var t=this;return function(r){null!=t.flightState.TravellerCheckList&&null!=t.flightState.TravellerCheckList[0]&&("Nationality"==e&&1==t.flightState.TravellerCheckList[0].Nationality&&r.controls[e].setValidators([i.B.required]),"VisaType"==e&&1==t.flightState.TravellerCheckList[0].VisaType&&r.controls[e].setValidators([i.B.required]),"PassportNo"!=e||1!=t.flightState.TravellerCheckList[0].PassportNo||"P"!=r.controls.DocType.value&&"I"!=r.controls.DocType.value&&"N"!=r.controls.DocType.value||r.controls[e].setValidators([i.B.required]),"PassportNo"==e&&1==t.flightState.TravellerCheckList[0].CNIC_No&&"C"==r.controls.DocType.value&&r.controls[e].setValidators([i.B.required,i.B.maxLength(15),i.B.minLength(15)]),"PLI"==e&&1==t.flightState.TravellerCheckList[0].PLI&&"P"==r.controls.DocType.value&&r.controls[e].setValidators([i.B.required]),"Country"==e&&1==t.flightState.TravellerCheckList[0].Country&&r.controls[e].setValidators([i.B.required]),"PDOE"!=e||1!=t.flightState.TravellerCheckList[0].PDOE||"P"!=r.controls.DocType.value&&"I"!=r.controls.DocType.value&&"N"!=r.controls.DocType.value||r.controls[e].setValidators([i.B.required,t.passportValidation(e,r)]),("DOB"==e&&"1"==t.flightState.TravellerCheckList[0].DOB||"DOB"==e&&("CHD"==r.controls.PTC.value||"INF"==r.controls.PTC.value))&&r.controls[e].setValidators([t.DOBValidation(e,r)]),"DocType"!=e||"1"!=t.flightState.TravellerCheckList[0].IQAMA_No&&"1"!=t.flightState.TravellerCheckList[0].CNIC_No&&"1"!=t.flightState.TravellerCheckList[0].PassportNo&&"1"!=t.flightState.TravellerCheckList[0].National_ID||r.controls[e].setValidators([i.B.required]))}},Object.defineProperty(e.prototype,"flightOnwardDate",{get:function(){return null!=this.flightState&&null!=this.flightState.SmartPricerResponse&&null!=this.flightState.SmartPricerResponse.OnwardDate?n(this.flightState.SmartPricerResponse.OnwardDate).format("YYYY-MM-DD"):void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"getPassportExpiryDate",{get:function(){try{return n().add(20,"years").format("YYYY-MM-DD")}catch(e){}},enumerable:!0,configurable:!0}),e.prototype.passportValidation=function(e,t){var r=this;return function(a){var o={};if(null==t.controls.PDOE.value||""==t.controls.PDOE.value)return o[e]=!0,o;var i=r.flightOnwardDate,s=n(t.controls.PDOE.value).format("YYYY-MM-DD");return sn)return o[e]=!0,o.max=!0,t.controls.DOB.setErrors(o),o;if(il)return o[e]=!0,o.max=!0,t.controls.DOB.setErrors(o),t.controls.DOB.markAsTouched(),o;if("date of birth"==i.toString().toLowerCase())return o[e]=!0,t.controls.DOB.setErrors(o),t.controls.DOB.markAsTouched(),o}else if("INF"==t.controls.PTC.value){var h;i=new Date(t.controls.DOB.value),"RT"==r.flightState.SmartPricerResponse.FareType||"RS"==r.flightState.SmartPricerResponse.FareType?h=new Date(r.flightState.SmartPricerResponse.ReturnDate):"DM"==r.flightState.SmartPricerResponse.FareType||"IM"==r.flightState.SmartPricerResponse.FareType||"MC"==r.flightState.SmartPricerResponse.FareType?r.flightState.SmartPricerResponse.Trips.forEach((function(e){h=new Date(e.Journey[e.Journey.length-1].Segments[e.Journey[e.Journey.length-1].Segments.length-1].Flight.DepartureTime)})):h=new Date(r.flightState.SmartPricerResponse.OnwardDate);var c=new Date;if(h.setFullYear(h.getFullYear()-2),ic)return o[e]=!0,o.max=!0,t.controls.DOB.setErrors(o),t.controls.DOB.markAsTouched(),o;if("date of birth"==i.toString().toLowerCase())return o[e]=!0,t.controls.DOB.setErrors(o),t.controls.DOB.markAsTouched(),o}else t.controls.DOB.setErrors(null)}},e.prototype.TravelItineraryFormGrpReValidation=function(){var e=this;Object.keys(this.flightState.TravelItineraryFormGrp.get("Travellers").controls).forEach((function(t){var r=e.flightState.TravelItineraryFormGrp.get("Travellers").get(t);r instanceof i.k&&("ADT"!=r.controls.PTC.value||!e.checkInTravelCheckList("DOB")||""!=r.controls.DOB.value&&null!=r.controls.DOB.value||e.updateErrorsAndMarkAsToutched(r,"DOB"),"CHD"!=r.controls.PTC.value&&"INF"!=r.controls.PTC.value||""!=r.controls.DOB.value&&null!=r.controls.DOB.value||e.updateErrorsAndMarkAsToutched(r,"DOB"),"ADT"!=r.controls.PTC.value||!e.flightState.PaxCategory||"SCP"!=e.flightState.PaxCategory||""!=r.controls.DOB.value&&null!=r.controls.DOB.value||e.updateErrorsAndMarkAsToutched(r,"DOB"),"P"!=r.controls.DocType.value&&"I"!=r.controls.DocType.value&&"N"!=r.controls.DocType.value||!e.checkInTravelCheckList("PassportNo")||""!=r.controls.PassportNo.value&&null!=r.controls.PassportNo.value||e.updateErrorsAndMarkAsToutched(r,"PassportNo"),"C"!=r.controls.DocType.value||!e.checkInTravelCheckList("PassportNo")||""!=r.controls.PassportNo.value&&null!=r.controls.PassportNo.value||e.updateErrorsAndMarkAsToutched(r,"PassportNo"),r.controls.PassportNo.setValidators([i.B.required,i.B.maxLength(15),i.B.minLength(13)]),"P"!=r.controls.DocType.value||!e.checkInTravelCheckList("PLI")||""!=r.controls.PLI.value&&null!=r.controls.PLI.value||e.updateErrorsAndMarkAsToutched(r,"PLI"),"P"!=r.controls.DocType.value&&"I"!=r.controls.DocType.value&&"N"!=r.controls.DocType.value||!e.checkInTravelCheckList("PDOE")||""!=r.controls.PDOE.value&&null!=r.controls.PDOE.value||e.updateErrorsAndMarkAsToutched(r,"PDOE"),!e.checkInTravelCheckList("Nationality")||""!=r.controls.Nationality.value&&null!=r.controls.Nationality.value||e.updateErrorsAndMarkAsToutched(r,"Nationality"),!e.checkInTravelCheckList("VisaType")||""!=r.controls.VisaType.value&&null!=r.controls.VisaType.value||e.updateErrorsAndMarkAsToutched(r,"VisaType"),!e.checkInTravelCheckList("Country")||""!=r.controls.Country.value&&null!=r.controls.Country.value||e.updateErrorsAndMarkAsToutched(r,"Country"),r.markAllAsTouched(),"C"==r.controls.DocType.value&&(r.controls.PLI.setErrors(null),r.controls.PDOE.setErrors(null),e.checkInTravelCheckList("Nationality")||r.controls.Nationality.setErrors(null),e.checkInTravelCheckList("VisaType")||r.controls.VisaType.setErrors(null),e.checkInTravelCheckList("Country")||r.controls.Country.setErrors(null)),"I"==r.controls.DocType.value&&(r.controls.PLI.setErrors(null),e.checkInTravelCheckList("VisaType")||r.controls.VisaType.setErrors(null),e.checkInTravelCheckList("Country")||r.controls.Country.setErrors(null)),"N"==r.controls.DocType.value&&(r.controls.PLI.setErrors(null),e.checkInTravelCheckList("VisaType")||r.controls.VisaType.setErrors(null),e.checkInTravelCheckList("Country")||r.controls.Country.setErrors(null)))})),this.flightState.TravelItineraryFormGrp.get("ContactInfo");var t=this.flightState.TravelItineraryFormGrp.get("ContactInfo");t instanceof i.k&&(""!=t.controls.Mobile.value&&null!=t.controls.Mobile.value||this.updateErrorsAndMarkAsToutched(t,"Mobile"),""!=t.controls.Mobile.value&&t.controls.Mobile.invalid&&t.controls.Mobile.setErrors({pattern:!0}),""!=t.controls.Email.value&&null!=t.controls.Email.value||this.updateErrorsAndMarkAsToutched(t,"Email"),""!=t.controls.MobileCountryCode.value&&null!=t.controls.MobileCountryCode.value||this.updateErrorsAndMarkAsToutched(t,"MobileCountryCode"),this.generalState.isGSTValidate?(""!=t.controls.GSTCompanyName.value&&null!=t.controls.GSTCompanyName.value||this.updateErrorsAndMarkAsToutched(t,"GSTCompanyName"),""!=t.controls.GSTTIN.value&&null!=t.controls.GSTTIN.value||this.updateErrorsAndMarkAsToutched(t,"GSTTIN"),""!=t.controls.PIN.value&&null!=t.controls.PIN.value||this.updateErrorsAndMarkAsToutched(t,"PIN"),""!=t.controls.GSTAddress.value&&null!=t.controls.GSTAddress.value||this.updateErrorsAndMarkAsToutched(t,"GSTAddress"),""!=t.controls.GSTCompanyName.value&&this.generalState.GSTFormGroup.controls.GSTCompanyName.invalid&&(t.controls.GSTCompanyName.setValidators([this.noWhitespaceValidator]),t.controls.GSTCompanyName.markAsTouched()),""!=t.controls.GSTTIN.value&&this.generalState.GSTFormGroup.controls.GSTTIN.invalid&&(t.controls.GSTTIN.setValidators([i.B.pattern("^([0]{1}[1-9]{1}|[1-2]{1}[0-9]{1}|[3]{1}[0-7]{1})([a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[0-9]{1}[zZ]{1}[0-9a-zA-Z]{1})+$")]),t.controls.GSTCompanyName.setErrors({pattern:!0}),t.controls.GSTTIN.markAsTouched()),""!=t.controls.GSTAddress.value&&this.generalState.GSTFormGroup.controls.GSTAddress.invalid&&(t.controls.GSTAddress.setValidators([i.B.pattern("^[#.0-9a-zA-Zs,-]+$")]),t.controls.GSTAddress.markAsTouched()),""!=t.controls.PIN.value&&this.generalState.GSTFormGroup.controls.PIN.invalid&&(t.controls.PIN.setValidators([i.B.pattern("^[0-9\\s]+$")]),t.controls.PIN.markAsTouched())):(t.controls.GSTCompanyName.setErrors(null),t.controls.GSTTIN.setErrors(null),t.controls.PIN.setErrors(null),t.controls.GSTAddress.setErrors(null)))},e.prototype.PaxReValidation=function(){var e=this;Object.keys(this.flightState.TravelItineraryFormGrp.get("Travellers").controls).forEach((function(t){var r=e.flightState.TravelItineraryFormGrp.get("Travellers").get(t);r instanceof i.k&&("ADT"!=r.controls.PTC.value||!e.checkInTravelCheckList("DOB")||""!=r.controls.DOB.value&&null!=r.controls.DOB.value||e.updateErrorsAndMarkAsToutched(r,"DOB"),"CHD"!=r.controls.PTC.value&&"INF"!=r.controls.PTC.value||""!=r.controls.DOB.value&&null!=r.controls.DOB.value||e.updateErrorsAndMarkAsToutched(r,"DOB"),!e.checkInTravelCheckList("PassportNo")||""!=r.controls.PassportNo.value&&null!=r.controls.PassportNo.value||e.updateErrorsAndMarkAsToutched(r,"PassportNo"),!e.checkInTravelCheckList("PLI")||""!=r.controls.PLI.value&&null!=r.controls.PLI.value||e.updateErrorsAndMarkAsToutched(r,"PLI"),!e.checkInTravelCheckList("PDOE")||""!=r.controls.PDOE.value&&null!=r.controls.PDOE.value||e.updateErrorsAndMarkAsToutched(r,"PDOE"),!e.checkInTravelCheckList("Nationality")||""!=r.controls.Nationality.value&&null!=r.controls.Nationality.value||e.updateErrorsAndMarkAsToutched(r,"Nationality"),!e.checkInTravelCheckList("VisaType")||""!=r.controls.VisaType.value&&null!=r.controls.VisaType.value||e.updateErrorsAndMarkAsToutched(r,"VisaType"),!e.checkInTravelCheckList("Country")||""!=r.controls.Country.value&&null!=r.controls.Country.value||e.updateErrorsAndMarkAsToutched(r,"Country"),r.markAllAsTouched())}))},e.prototype.checkInTravelCheckList=function(e){if(this.flightState&&this.flightState.TravellerCheckList&&this.flightState.TravellerCheckList[0]){if("DOB"==e)return 1==this.flightState.TravellerCheckList[0].DOB;if("PassportNo"==e)return 1==this.flightState.TravellerCheckList[0].PassportNo;if("PLI"==e)return 1==this.flightState.TravellerCheckList[0].PLI;if("PDOE"==e)return 1==this.flightState.TravellerCheckList[0].PDOE;if("Nationality"==e)return 1==this.flightState.TravellerCheckList[0].Nationality;if("VisaType"==e)return 1==this.flightState.TravellerCheckList[0].VisaType;if("Country"==e)return 1==this.flightState.TravellerCheckList[0].Country}},e.prototype.updateErrorsAndMarkAsToutched=function(e,t){e.get(t).setValidators([i.B.required]),e.get(t).updateValueAndValidity(),e.get(t).markAsTouched()},e.prototype.contactInfoValidation=function(){1==this.generalState.GuestStatus&&""==this.ContatctInfoFormGroup.controls.Mobile.value&&(this.ContatctInfoFormGroup.controls.Mobile.setErrors({required:!0}),this.ContatctInfoFormGroup.controls.Mobile.markAsTouched())},e.prototype.GSTDataValidation=function(){this.generalState.isGSTValidate?(""==this.ContatctInfoFormGroup.controls.GSTCompanyName.value||""==this.ContatctInfoFormGroup.controls.GSTTIN.value?(""==this.ContatctInfoFormGroup.controls.GSTCompanyName.value&&(this.ContatctInfoFormGroup.controls.GSTCompanyName.setErrors({required:!0}),this.ContatctInfoFormGroup.controls.GSTCompanyName.markAsTouched()),""==this.ContatctInfoFormGroup.controls.GSTTIN.value&&(this.ContatctInfoFormGroup.controls.GSTTIN.setErrors({required:!0}),this.ContatctInfoFormGroup.controls.GSTTIN.markAsTouched())):""!=this.generalState.GSTFormGroup.controls.GSTTIN.value&&(this.ContatctInfoFormGroup.controls.GSTTIN.setValue(this.ContatctInfoFormGroup.controls.GSTTIN.value.trim()),this.ContatctInfoFormGroup.controls.GSTTIN.invalid&&this.ContatctInfoFormGroup.controls.GSTTIN.setErrors({pattern:!0}),this.ContatctInfoFormGroup.controls.GSTTIN.markAsTouched()),this.markFormControlValid(this.ContatctInfoFormGroup)):(this.ContatctInfoFormGroup.controls.GSTCompanyName.setErrors(null),this.ContatctInfoFormGroup.controls.GSTTIN.setErrors(null))},e.prototype.markFormControlValid=function(e){var t=this,r=!0;Object.values(e.controls).forEach((function(e){e.controls?t.markFormControlValid(e):e.invalid&&r&&(r=!1)})),r&&e.setErrors(null)},e.prototype.removeGSTDateValidation=function(){this.ContatctInfoFormGroup.controls.GSTCompanyName.setErrors(null),this.ContatctInfoFormGroup.controls.GSTTIN.setErrors(null)},e.prototype.getGSTValidationMessage=function(e){return!e.valid&&e.hasError("required")?"This field is required":!e.valid&&e.hasError("pattern")?"Invalid input":void 0},e.prototype.createBaggageInsuranceRequest=function(){var e={ClientID:"",Provider:"BRB"};return e.TUI=this.flightState.SmartPricerResponse.TUI,e},e.prototype.getBRBFormGroup=function(){var e,t=this;return e=[],null!=this.flightState&&null!=this.flightState.TravelItineraryFormGrp&&null!=this.flightState.TravelItineraryFormGrp.get("CrossSell")&&Object.keys(this.flightState.TravelItineraryFormGrp.get("CrossSell").controls).forEach((function(r){var a=t.flightState.TravelItineraryFormGrp.get("CrossSell").get(r);a instanceof i.k&&a.get("Code")&&"BRB"==a.get("Code").value&&e.push(a.get("Parameters").controls[0])})),e},Object.defineProperty(e.prototype,"travellerchecklist",{get:function(){return this.flightState.TravellerCheckList},enumerable:!0,configurable:!0}),e.prototype.createTravelItineraryRequest=function(e,t,r,a,o){var i=this,l=JSON.parse(JSON.stringify(this.flightState.TravelItineraryFormGrp.value));this.updatePaxCategory(),this.flightState&&this.flightState.PaxCategory&&"DEF"==this.flightState.PaxCategory&&l.Travellers.forEach((function(e){""!=e.PaxCategoryID&&(e.DefenceID=e.PaxCategoryID)})),o&&(l.RefTransactionID=o);var u,h,c={};if(c.IsScheduleChanged=!!this.flightState.isSchedulechange&&this.flightState.isSchedulechange,l.GeneralKeys=c,l.SSRAmount=0,l.ClientID=this.generalState.ClientID,l.DeviceID="",l.AppVersion="",r?(l.TUI=this.flightState.SmartPricerResponseMC[a],l.NetAmount=this.flightState.SmartPricerResponse.NetAmountArray[a],l.SequenceID=a+1):(l.TUI=this.flightState.SmartPricerResponse.TUI,l.NetAmount=this.flightState.SmartPricerResponse.NetAmount),1==this.flightState.SaveTravellers&&l.Travellers.forEach((function(e){e.Operation=e.PaxID?"U":"I"})),this.travellerchecklist&&this.travellerchecklist[0]?(1==this.travellerchecklist[0].DOB?l.Travellers.filter((function(e){return"ADT"==e.PTC})).forEach((function(e){var t;""!=e.DOB?(e.DOB=n(e.DOB).format("YYYY-MM-DD"),t=r?new Date(i.flightState.SmartPricerResponse.Trips[0].Journey[0].Segments[0].Flight.DepartureTime.toString().split("T")[0]):"RT"===i.flightState.SmartPricerResponse.FareType||"RS"===i.flightState.SmartPricerResponse.FareType?new Date(i.flightState.SmartPricerResponse.ReturnDate):new Date(i.flightState.SmartPricerResponse.OnwardDate),e.Age=n(t).diff(e.DOB,"years",!1)):e.DOB="";e.PDOE=null!=e.PDOE&&""!=e.PDOE&&null!=e.PDOE&&e.PDOE.length?n(e.PDOE).format("YYYY-MM-DD"):"",e.FName=e.FName.trim(),e.LName=e.LName.trim()})):l.Travellers.filter((function(e){return"ADT"==e.PTC})).map((function(e){if(null!=e.DOB&&""!=e.DOB.trim()&&null!=e.DOB&&e.DOB.length>0){e.DOB=n(e.DOB).format("YYYY-MM-DD");var t=void 0;r?t=new Date(i.flightState.SmartPricerResponse.Trips[0].Journey[0].Segments[0].Flight.DepartureTime.toString().split("T")[0]):"RT"===i.flightState.SmartPricerResponse.FareType||"RS"===i.flightState.SmartPricerResponse.FareType?i.flightState.SmartPricerResponse.ReturnDate&&""!=i.flightState.SmartPricerResponse.ReturnDate?t=new Date(i.flightState.SmartPricerResponse.ReturnDate):i.flightState.SmartPricerResponse.Trips&&i.flightState.SmartPricerResponse.Trips[1]&&i.flightState.SmartPricerResponse.Trips[1].Journey&&i.flightState.SmartPricerResponse.Trips[1].Journey[0]&&i.flightState.SmartPricerResponse.Trips[1].Journey[0].Segments&&i.flightState.SmartPricerResponse.Trips[1].Journey[0].Segments[0]&&i.flightState.SmartPricerResponse.Trips[1].Journey[0].Segments[0].Flight&&i.flightState.SmartPricerResponse.Trips[1].Journey[0].Segments[0].Flight.DepartureTime&&(t=new Date(i.flightState.SmartPricerResponse.Trips[1].Journey[0].Segments[0].Flight.DepartureTime)):i.flightState.SmartPricerResponse.OnwardDate&&""!=i.flightState.SmartPricerResponse.OnwardDate?t=new Date(i.flightState.SmartPricerResponse.OnwardDate):i.flightState.SmartPricerResponse.Trips&&i.flightState.SmartPricerResponse.Trips[0]&&i.flightState.SmartPricerResponse.Trips[0].Journey&&i.flightState.SmartPricerResponse.Trips[0].Journey[0]&&i.flightState.SmartPricerResponse.Trips[0].Journey[0].Segments&&i.flightState.SmartPricerResponse.Trips[0].Journey[0].Segments[0]&&i.flightState.SmartPricerResponse.Trips[0].Journey[0].Segments[0].Flight&&i.flightState.SmartPricerResponse.Trips[0].Journey[0].Segments[0].Flight.DepartureTime&&(t=new Date(i.flightState.SmartPricerResponse.Trips[0].Journey[0].Segments[0].Flight.DepartureTime)),e.Age=n(t).diff(e.DOB,"years",!1),null!=e.Age&&null!=e.Age||(e.DOB="")}else e.DOB="";e.PDOE=null!=e.PDOE&&""!=e.PDOE&&null!=e.PDOE&&e.PDOE.length?n(e.PDOE).format("YYYY-MM-DD"):"",e.FName=e.FName.trim(),e.LName=e.LName.trim()})),l.Travellers.filter((function(e){return"ADT"!=e.PTC})).length>0&&l.Travellers.filter((function(e){return"ADT"!=e.PTC})).forEach((function(e){var t;e.DOB=n(e.DOB).format("YYYY-MM-DD"),e.PDOE=null!=e.PDOE&&""!=e.PDOE&&null!=e.PDOE&&e.PDOE.length?n(e.PDOE).format("YYYY-MM-DD"):"",t=r?new Date(i.flightState.SmartPricerResponse.Trips[0].Journey[0].Segments[0].Flight.DepartureTime.toString().split("T")[0]):"RT"===i.flightState.SmartPricerResponse.FareType||"RS"===i.flightState.SmartPricerResponse.FareType?new Date(i.flightState.SmartPricerResponse.ReturnDate):new Date(i.flightState.SmartPricerResponse.OnwardDate),e.Age=n(t).diff(e.DOB,"years",!1),e.FName=e.FName.trim(),e.LName=e.LName.trim()}))):l.Travellers.forEach((function(e){e.DOB="",e.Age=null})),this.generalState.UserDetails&&this.generalState.UserDetails&&!this.generalState.GuestStatus){var S=!1;l.ContactInfo.Mobile!=this.generalState.UserDetails.MobNumber&&(S=!0),l.ContactInfo.IsGuest=!!this.generalState.AkbarGuestStatus,l.ContactInfo.UpdateProfile=S,this.generalState.isGSTValidate||(l.ContactInfo.GSTCompanyName="",l.ContactInfo.GSTTIN="",l.ContactInfo.GSTaddress="")}if(this.generalState.GuestStatus&&(l.ContactInfo.Email=this.generalState.ClientIDDecrypted,l.ContactInfo.IsGuest=!0,l.ContactInfo.UpdateProfile=!0,l.ContactInfo.Title=l.Travellers[0].Title,l.ContactInfo.FName=l.Travellers[0].FName,l.ContactInfo.LName=l.Travellers[0].LName),this.generalState.WebSettings&&this.generalState.WebSettings[0]&&this.generalState.WebSettings[0].filter((function(e){return"ContactInfoAddress"==e.Key}))[0].Value&&this.generalState.WebSettings[0]&&""!=this.generalState.WebSettings[0].filter((function(e){return"ContactInfoAddress"==e.Key}))[0].Value&&(s.a.ContactInfo.Address=this.generalState.WebSettings[0].filter((function(e){return"ContactInfoAddress"==e.Key}))[0].Value),this.generalState.WebSettings&&this.generalState.WebSettings[0]&&this.generalState.WebSettings[0].filter((function(e){return"ContactInfoState"==e.Key}))[0].Value&&""!=this.generalState.WebSettings[0].filter((function(e){return"ContactInfoState"==e.Key}))[0].Value&&(s.a.ContactInfo.State=this.generalState.WebSettings[0].filter((function(e){return"ContactInfoState"==e.Key}))[0].Value),this.generalState.WebSettings&&this.generalState.WebSettings[0]&&this.generalState.WebSettings[0].filter((function(e){return"ContactInfoCity"==e.Key}))[0].Value&&""!=this.generalState.WebSettings[0].filter((function(e){return"ContactInfoCity"==e.Key}))[0].Value&&(s.a.ContactInfo.City=this.generalState.WebSettings[0].filter((function(e){return"ContactInfoCity"==e.Key}))[0].Value),this.generalState.isGSTValidate||(this.generalState.WebSettings&&this.generalState.WebSettings[0]&&this.generalState.WebSettings[0].filter((function(e){return"ContactInfoPIN"==e.Key}))[0].Value&&""!=this.generalState.WebSettings[0].filter((function(e){return"ContactInfoPIN"==e.Key}))[0].Value&&(s.a.ContactInfo.PIN=this.generalState.WebSettings[0].filter((function(e){return"ContactInfoPIN"==e.Key}))[0].Value),l.ContactInfo.PIN=s.a.ContactInfo.PIN),l.ContactInfo.Address=s.a.ContactInfo.Address,l.ContactInfo.State=s.a.ContactInfo.State,l.ContactInfo.City=s.a.ContactInfo.City,l.ContactInfo.Language=this.flightState.TravelItineraryFormGrp.controls.ContactInfo.controls.Language.value,l.CrossSellAmount=0,null!=l.CrossSell&&l.CrossSell.length>0){var f=l.CrossSell;l.CrossSell=[],f.forEach((function(e,r){if("BRB"==e.Code&&i.flightState.BaggageProtectionAmount>0){var a={Code:"BRB",Parameters:[]},o={Type:"Days"};o.Value=t,a.Parameters.push(o),l.CrossSell.push(a),l.CrossSellAmount+=i.flightState.BaggageProtectionAmount}}))}if(r&&null!=l.Auxiliaries&&l.Auxiliaries.length>0&&""==l.Auxiliaries[0].Parameters[0].Value&&(l.Auxiliaries=[]),e>0){var g,p={Code:"INS",Parameters:[]};(g={Type:"Days"}).Value=t,p.Parameters.push(g),l.CrossSell.push(p),l.CrossSellAmount+=parseFloat(e)}if(this.flightState.RPIamount>0&&((p={Code:"RPI",Parameters:[]}).Parameters.push(g={Type:"Days",Value:"1"}),l.CrossSell.push(p),l.CrossSellAmount+=this.flightState.RPIamount),this.flightState.ALSamount>0&&((p={Code:"ALS",Parameters:[]}).Parameters.push(g={Type:"Days",Value:"1"}),l.CrossSell.push(p),l.CrossSellAmount+=this.flightState.ALSamount),u=[],null!=l.SSR&&l.SSR.length>0)if(r?l.SSR.filter((function(e){return e.tripIdx==a})).forEach((function(e){if(0!=e.SSID)if(null!=e.SSID.length&&e.SSID.length>0)for(var t=0;t0)for(var t=0;t0?u:null,this.flightState.ssrFareChangeAmount>0)l.SSRAmount=this.flightState.ssrFareChangeAmount;else if(this.flightState&&this.flightState.ssrTotalFareVM)if(r){var T=this.flightState.TravelItineraryFormGrp.controls.SSR.value.filter((function(e){return e.tripIdx==a&&0!=e.SSID}));T.map((function(e){e.Fare=Number(9==e.Type?i.flightState.seatLayoutResponse.Trips[e.tripIdx].Journey[0].Segments[parseInt(e.FUID)-1].Seats.find((function(t){return t.SSID==e.SSID})).Fare:i.flightState.ReviewSSRResponse.Trips[e.tripIdx].Journey[0].Segments[parseInt(e.FUID)-1].SSR.find((function(t){return t.ID==e.SSID[0]})).Charge)})),l.SSRAmount=T.filter((function(e){return e.tripIdx==a})).reduce((function(e,t){return e+t.Fare}),0)}else l.SSRAmount=this.flightState.ssrTotalFareVM.Baggage.TotalFare+this.flightState.ssrTotalFareVM.Meals.TotalFare+this.flightState.ssrTotalFareVM.Seat.TotalFare+this.flightState.ssrTotalFareVM.Sports.TotalFare+this.flightState.ssrTotalFareVM.PriorityCheckin.TotalFare+this.flightState.ssrTotalFareVM.PriorityBaggage.TotalFare;else l.SSRAmount=0;return l.BRulesAccepted="",r?this.flightState&&this.flightState.GetBusinessRuleResponse&&this.flightState.GetBusinessRuleResponse.length>0&&void 0!==this.flightState.GetBusinessRuleResponse[a]&&this.flightState.GetBusinessRuleResponse[a].BusinessRules&&(h=this.flightState.GetBusinessRuleResponse[a].BusinessRules.filter((function(e){return("PAX"==e.DisplayArea||"JOURNEY"==e.DisplayArea)&&"TRUE"==e.Acceptance.toLocaleUpperCase()&&e.IsSelected&&e.IsAccepted})))&&h.length>0&&null!=h[0]&&h.forEach((function(e){""==l.BRulesAccepted?l.BRulesAccepted=e.Code:l.BRulesAccepted+=","+e.Code})):this.flightState&&this.flightState.GetBusinessRuleResponse&&this.flightState.GetBusinessRuleResponse.length>0&&void 0!==this.flightState.GetBusinessRuleResponse[0]&&this.flightState.GetBusinessRuleResponse[0].BusinessRules&&(h=this.flightState.GetBusinessRuleResponse[0].BusinessRules.filter((function(e){return("PAX"==e.DisplayArea||"JOURNEY"==e.DisplayArea)&&"TRUE"==e.Acceptance.toLocaleUpperCase()&&e.IsSelected&&e.IsAccepted})))&&h.length>0&&null!=h[0]&&h.forEach((function(e){""==l.BRulesAccepted?l.BRulesAccepted=e.Code:l.BRulesAccepted+=","+e.Code})),l},e.prototype.setFareChangeDialogData=function(e,t){var r=new o.g;return r.width="500px",r.data={response:e,amount:t},r},e.prototype.DefaultEmailValidator=function(e){return e.value&&"default@default.com"==e.value.toLowerCase()?{defaultEmail:!0}:null},e.prototype.cancelIterneraryRequest=function(e){var t=e.value,r={};return r.ClientID=this.generalState.ClientID,r.ClientIP="",r.Remarks=t.Remarks,r.TransactionID=t.TransactionID,r.TUI=this.generalState.TUI,r.Trips=t.Trips,r},e.prototype.getStatus=function(e){var t,r;try{var o=e.split(",");try{for(var i=a.__values(o),n=i.next();!n.done;n=i.next())switch(n.value){case"I8":case"S8":case"U8":return"Failed";case"BO0":return"In Process";case"BO1":return"Failed";case"BR0":return"In Process";case"BR1":return"Failed";case"TO0":return"Confirmed";case"TO1":return"Failed";case"TR0":return"Confirmed";case"TR1":return"Failed";case"CO0":return"Cancelled";case"PO0":return"Part Cancelled";case"CF":return"Refunded";case"CP":return"Part Cancelled";case"CR":return"Can Requested";case"CJ":return"Can Rejected";case"CV":return"Can Verified";case"CD":case"CT":return"Cancelled";case"CA":return"Can Approved";default:return"Failed"}}catch(s){t={error:s}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}}catch(l){}},e.prototype.PaxCategoryValidation=function(){var e=this;this.flightState&&this.flightState.PaxCategory&&"DEF"==this.flightState.PaxCategory&&Object.keys(this.flightState.TravelItineraryFormGrp.get("Travellers").controls).forEach((function(t){var r=e.flightState.TravelItineraryFormGrp.get("Travellers").get(t);r instanceof i.k&&""==r.controls.PaxCategoryID.value&&e.updateErrorsAndMarkAsToutched(r,"PaxCategoryID")})),this.flightState&&this.flightState.PaxCategory&&"STU"==this.flightState.PaxCategory&&Object.keys(this.flightState.TravelItineraryFormGrp.get("Travellers").controls).forEach((function(t){var r=e.flightState.TravelItineraryFormGrp.get("Travellers").get(t);r instanceof i.k&&""==r.controls.PaxCategoryID.value&&e.updateErrorsAndMarkAsToutched(r,"PaxCategoryID")})),this.flightState&&this.flightState.PaxCategory&&"SCP"==this.flightState.PaxCategory&&Object.keys(this.flightState.TravelItineraryFormGrp.get("Travellers").controls).forEach((function(t){var r=e.flightState.TravelItineraryFormGrp.get("Travellers").get(t);r instanceof i.k&&""==r.controls.PaxCategoryID.value&&e.updateErrorsAndMarkAsToutched(r,"PaxCategoryID")}))},e.prototype.updatePaxCategory=function(){var e=!1;this.flightState&&this.flightState.SmartPricerResponse&&this.flightState.SmartPricerResponse.Trips&&this.flightState.SmartPricerResponse.Trips.length>0&&this.flightState.SmartPricerResponse.Trips.forEach((function(t){t.Journey&&t.Journey.length>0&&t.Journey[0]&&"DEF"==t.Journey[0].PaxCategory&&(e=!0)})),e&&(this.flightState.PaxCategory="DEF")},e}()}}]);