(window.webpackJsonp=window.webpackJsonp||[]).push([[24],{GuWZ:function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r("yTtk"),r("AcpL");var n=r("klCq"),i=r("AytR"),s=function(){function e(e,t,r){this.flightState=e,this.generalState=t,this.translateService=r}return Object.defineProperty(e.prototype,"SSRResponse",{get:function(){return this.flightState.ReviewSSRResponse},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"SSRForm",{get:function(){return null!=this.flightState&&null!=this.flightState.TravelItineraryFormGrp&&null!=this.flightState.TravelItineraryFormGrp.get("SSR")?this.flightState.TravelItineraryFormGrp.get("SSR"):void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"SectorType",{get:function(){return this.flightState.SectorType},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"PaxForm",{get:function(){return null!=this.flightState&&null!=this.flightState.TravelItineraryFormGrp&&null!=this.flightState.TravelItineraryFormGrp.get("Travellers")?this.flightState.TravelItineraryFormGrp.get("Travellers"):void 0},enumerable:!0,configurable:!0}),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 n=r.SSR.filter((function(r){return"8"==r.Type&&r.PaxID==t+1&&r.FUID==e.value.FUID}));return 0!=n.length?(n.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.getDays=function(){var e;e=[];for(var t=1;t<=31;t++)e.push(t.toString());return e},e.prototype.getMonths=function(){return[{id:1,name:"Jan"},{id:2,name:"Feb"},{id:3,name:"Mar"},{id:4,name:"Apr"},{id:5,name:"May"},{id:6,name:"Jun"},{id:7,name:"Jul"},{id:8,name:"Aug"},{id:9,name:"Sept"},{id:10,name:"Oct"},{id:11,name:"Nov"},{id:12,name:"Dec"}]},e.prototype.getYear=function(e){var t,r=new Date;if(t=[],"ADT"==e)for(var n=r.getFullYear()-12;n>r.getFullYear()-100;n--)t.push(n.toString());else if("CHD"==e)for(n=r.getFullYear()-2;n>r.getFullYear()-13;n--)t.push(n.toString());else if("INF"==e)for(n=r.getFullYear();n>r.getFullYear()-3;n--)t.push(n.toString());else for(n=r.getFullYear();n0&&(S=a[0])}else if("2"==n){var o=t.SSR.filter((function(e){return e.Type==n.trim()&&e.Code==S.Code&&"1"!=e.Type}));if(o&&o.length>0){var l=u.getSSRGroupSSIDByType(e,parseInt(t.FUID),parseInt(n),r),g=[];g.push(o[0].ID),l.setValue(g)}}})),o&&g&&g.indexOf(this.SSRResponse.Trips[r].Journey[0].Provider)>-1&&this.zeroMealUnselect(e,t,r,n,p)):(s.setValue(0),t==parseInt(this.SSRResponse.Trips[r].Journey[0].Segments[0].FUID)&&this.SSRResponse.Trips[r].Journey[0].Segments.forEach((function(t,s){if(0==s){var a=t.SSR.filter((function(e){return e.Type==n.trim()&&e.ID==i}));a&&a.length>0&&(l=a[0])}else{var o=t.SSR.filter((function(e){return e.Type==n.trim()&&e.Code==l.Code}));o&&o.length>0&&(o[0].Charge>0||u.getSSRGroupSSIDByType(e,parseInt(t.FUID),parseInt(n),r).setValue(0))}})))},e.prototype.zeroMealUnselect=function(e,t,r,n,i){var s=this;try{var a=this.generalState&&this.generalState.WebSettings&&this.generalState.WebSettings[0]?this.generalState.WebSettings[0].filter((function(e){return"ZeromealPurchaseOverridedProviders"==e.Key}))[0].Value:"",o=[],S=0;a&&a.indexOf(this.SSRResponse.Trips[r].Journey[0].Provider)>-1&&this.SSRResponse.Trips[r].Journey[0].Segments.forEach((function(i){S++;var a=s.getSelectedSSRFG(e,Number(i.FUID),Number(n),r).controls.SSID;if(i.SSR&&i.SSR.filter((function(e){return e.ID==a.value}))[0]&&0==i.SSR.filter((function(e){return e.ID==a.value}))[0].Charge&&o.push(i.FUID),S==s.SSRResponse.Trips[r].Journey[0].Segments.length&&o&&o.length>0){var l=o.filter((function(e){return e!=t}));l&&l.length>0&&l.forEach((function(t){s.getSelectedSSRFG(e,Number(t),Number(n),r)&&s.getSelectedSSRFG(e,Number(t),Number(n),r).controls.SSID.setValue(0)}))}}))}catch(l){}},e.prototype.getSSRAmountStatus=function(e,t,r){var n=0;return this.SSRResponse.Trips[e].Journey&&this.SSRResponse.Trips[e].Journey.length>0&&this.SSRResponse.Trips[e].Journey[0].Segments&&this.SSRResponse.Trips[e].Journey[0].Segments.length>0&&this.SSRResponse.Trips[e].Journey[0].Segments[t].SSR&&this.SSRResponse.Trips[e].Journey[0].Segments[t].SSR.length>0&&this.SSRResponse.Trips[e].Journey[0].Segments[t].SSR.forEach((function(e){e.Type==r&&(n+=e.Charge)})),n>0},e.prototype.updateSSR=function(e,t,r,n,i,s,a){var o,S,l=this,u=[];0!=s.value&&(u=s.value),a?(-1==u.indexOf(i)&&u.push(i),s.setValue(u),t==parseInt(this.SSRResponse.Trips[r].Journey[0].Segments[0].FUID)&&this.SSRResponse.Trips[r].Journey[0].Segments.forEach((function(t,s){if(0==s){var a=t.SSR.filter((function(e){return e.Type==n.trim()&&e.ID==i}));a&&a.length>0&&(o=a[0])}else{var S=t.SSR.filter((function(e){return e.Type==n.trim()&&e.Code==o.Code}));if(S&&S.length>0){var u,g,p=S[0].Charge>0;("2"!=n&&"3"!=n||l.getSectorwiseSSR(n,t))&&p||((g=(u=l.getSSRGroupSSIDByType(e,parseInt(t.FUID),parseInt(n),r)).value).indexOf(S[0].ID)>-1&&g.splice(g.indexOf(S[0].ID),1),u.setValue(g))}}}))):"9"==n?s.setValue(0):(u.indexOf(i)>-1&&u.splice(u.indexOf(i),1),s.setValue(u),t==parseInt(this.SSRResponse.Trips[r].Journey[0].Segments[0].FUID)&&this.SSRResponse.Trips[r].Journey[0].Segments.forEach((function(t,s){if(0==s){var a=t.SSR.filter((function(e){return e.Type==n.trim()&&e.ID==i}));a&&a.length>0&&(S=a[0])}else{var o=t.SSR.filter((function(e){return e.Type==n.trim()&&e.Code==S.Code}));if(o&&o.length>0){var u,g,p=o[0].Charge>0;("2"!=n&&"3"!=n||l.getSectorwiseSSR(n,t))&&p||((g=(u=l.getSSRGroupSSIDByType(e,parseInt(t.FUID),parseInt(n),r)).value).indexOf(o[0].ID)>-1&&g.splice(g.indexOf(o[0].ID),1),u.setValue(g))}}})))},e.prototype.getSectorwiseSSR=function(e,t){var r;if(this.generalState.WebSettings&&this.generalState.WebSettings[0])if("2"==e){if("D"==this.SectorType)return!!((r=this.generalState.WebSettings[0].find((function(e){return"SectorwiseBaggageDom"==e.Key})))&&r.Value&&r.Value.indexOf(t.VAC)>-1);if("I"==this.SectorType)return!!((r=this.generalState.WebSettings[0].find((function(e){return"SectorwiseBaggageInt"==e.Key})))&&r.Value&&r.Value.indexOf(t.VAC)>-1)}else if("3"==e){if("D"==this.SectorType)return!!((r=this.generalState.WebSettings[0].find((function(e){return"SectorwiseSportsDom"==e.Key})))&&r.Value&&r.Value.indexOf(t.VAC)>-1);if("I"==this.SectorType)return!!((r=this.generalState.WebSettings[0].find((function(e){return"SectorwiseSportsInt"==e.Key})))&&r.Value&&r.Value.indexOf(t.VAC)>-1)}},e.prototype.setMutipleSSRStatus=function(e){var t=!1;return null!=this.SSRResponse.Trips[0].Journey[0].MultiSSR&&("Add Baggage"==e?t=this.SSRResponse.Trips[0].Journey[0].MultiSSR.indexOf("B")>-1:"Add Meals"==e&&(t=this.SSRResponse.Trips[0].Journey[0].MultiSSR.indexOf("M")>-1)),t},e.prototype.getSSRFormByPax=function(e,t,r){var n=this,i=[];return this.SSRResponse.Trips[t].Journey[0].Segments.map((function(e){return e.FUID})).forEach((function(s){i.push(n.getSelectedSSRFG(e,parseInt(s),parseInt(r),t))})),i},e.prototype.getEmptyBRBPkg=function(){return{Code:"",Name:"",Fare:{BaseFare:0,Tax:0,NetFare:0,GrossFare:0,ServiceTax:0,Discount:0}}},e.prototype.addBRBInCreateItinearyRequest=function(e){this.flightState.CreateItineraryRequest.CrossSellAmount+=e.Fare.NetFare;var t=this.flightState.CreateItineraryRequest.CrossSell.filter((function(e){return"BRB"==e.Code.trim()}));t.length&&(t[0].Parameters[0].Value=e.Code)},e.prototype.removeBRBOnUncheck=function(){this.flightState.TravelItineraryFormGrp.get("CrossSell").controls.forEach((function(e){"BRB"==e.controls.Code.value&&e.get("Parameters").controls.forEach((function(e){e.controls.Type.setValue(""),e.controls.Value.setValue("")}))}))},e.prototype.getSeatBySSID=function(e,t,r){var n;return this.flightState.seatLayoutResponse.Trips[e].Journey&&this.flightState.seatLayoutResponse.Trips[e].Journey.length>0&&(n=this.flightState.seatLayoutResponse.Trips[e].Journey[0].Segments[t].Seats.filter((function(e){return e.SSID==r})))&&n.length>0?n[0]:void 0},e.prototype.getSSRInSegment=function(e,t){var r;return this.flightState.ReviewSSRResponse&&this.flightState.ReviewSSRResponse.Trips&&this.flightState.ReviewSSRResponse.Trips&&this.flightState.ReviewSSRResponse.Trips[t].Journey&&this.flightState.ReviewSSRResponse.Trips[t].Journey.length>0&&this.flightState.ReviewSSRResponse.Trips[t].Journey[0].Segments.forEach((function(t){t.FUID==e&&(r=t)})),r&&r.SSR&&r.SSR.length>0?r.SSR:void 0},e.prototype.getSelectedSsrFareVM=function(){var e,t=this,r=new n.a;return r.Baggage=new n.b,r.Meals=new n.b,r.Seat=new n.b,this.flightState.TravelItineraryFormGrp&&this.flightState.TravelItineraryFormGrp.get("SSR").value.forEach((function(n){2==n.Type?n.SSID.length>0&&(e=t.getSSRInSegment(n.FUID,n.tripIdx))&&n.SSID.forEach((function(t){var i=e.filter((function(e){return e.ID==t}));i&&i.length>0&&(0==n.segIdx&&r.Baggage.TotalNos++,r.Baggage.TotalFare=r.Baggage.TotalFare+i[0].Charge)})):1==n.Type?n.SSID.length>0&&(e=t.getSSRInSegment(n.FUID,n.tripIdx))&&n.SSID.forEach((function(t){var n=e.filter((function(e){return e.ID==t}));n&&n.length>0&&(r.Meals.TotalNos++,r.Meals.TotalFare=r.Meals.TotalFare+n[0].Charge)})):9==n.Type?n.SSID>0&&(r.Seat.TotalNos++,r.Seat.TotalFare=r.Seat.TotalFare+parseFloat(n.Fare)):3==n.Type?n.SSID.length>0&&(e=t.getSSRInSegment(n.FUID,n.tripIdx))&&n.SSID.forEach((function(t){var i=e.filter((function(e){return e.ID==t}));i&&i.length>0&&(0==n.segIdx&&r.Sports.TotalNos++,r.Sports.TotalFare=r.Sports.TotalFare+i[0].Charge)})):7==n.Type?n.SSID.length>0&&(e=t.getSSRInSegment(n.FUID,n.tripIdx))&&n.SSID.forEach((function(t){var n=e.filter((function(e){return e.ID==t}));n&&n.length>0&&(r.PriorityBaggage.TotalNos++,r.PriorityBaggage.TotalFare=r.PriorityBaggage.TotalFare+n[0].Charge)})):8==n.Type&&n.SSID.length>0&&(e=t.getSSRInSegment(n.FUID,n.tripIdx))&&n.SSID.forEach((function(t){var n=e.filter((function(e){return e.ID==t}));n&&n.length>0&&(r.PriorityCheckin.TotalNos++,r.PriorityCheckin.TotalFare=r.PriorityCheckin.TotalFare+n[0].Charge)}))})),this.flightState.ssrTotalFareVM=r,r},e.prototype.cancelSelectedAddOn=function(e){"1"===e?(this.flightState.TravelItineraryFormGrp.controls.SSR.controls.forEach((function(t){t.controls.Type.value==e&&t.controls.SSID.setValue(0)})),this.flightState.ssrTotalFareVM.Meals.TotalFare=0):"2"===e?(this.flightState.ssrTotalFareVM.Baggage.TotalFare=0,this.flightState.TravelItineraryFormGrp.controls.SSR.controls.forEach((function(t){t.controls.Type.value==e&&t.controls.SSID.setValue(0)})),this.setFreeBaggSelectedByDef()):"3"===e?(this.flightState.TravelItineraryFormGrp.controls.SSR.controls.forEach((function(t){t.controls.Type.value==e&&t.controls.SSID.setValue(0)})),this.flightState.ssrTotalFareVM.Sports.TotalFare=0):"9"===e?(this.flightState.TravelItineraryFormGrp.controls.SSR.controls.forEach((function(t){t.controls.Type.value==e&&t.controls.SSID.setValue(0)})),this.flightState.ssrTotalFareVM.Seat.TotalFare=0):"5"===e?this.flightState.insurancePremium=0:"P"===e&&(this.flightState.TravelItineraryFormGrp.controls.SSR.controls.forEach((function(e){"7"==e.controls.Type.value&&e.controls.SSID.setValue(0)})),this.flightState.ssrTotalFareVM.PriorityBaggage.TotalFare=0,this.flightState.TravelItineraryFormGrp.controls.SSR.controls.forEach((function(e){"8"==e.controls.Type.value&&e.controls.SSID.setValue(0)})),this.flightState.ssrTotalFareVM.PriorityCheckin.TotalFare=0)},e.prototype.haveFreeBaggage=function(e,t,r){var n=this,i=!1;if(this.generalState&&this.generalState.WebSettings&&this.generalState.WebSettings[0]){var s=this.generalState.WebSettings[0].find((function(e){return"ZeroAmountPurchaseSSR"==e.Key}));s.Value.length>0&&s.Value.split(",").forEach((function(t){null!=n.flightState&&null!=n.flightState.ReviewSSRResponse&&null!=e&&null!=n.flightState.ReviewSSRResponse.Trips[e].Journey&&n.flightState.ReviewSSRResponse.Trips[e].Journey.length>0&&null!=n.flightState.ReviewSSRResponse.Trips[e].Journey[0].Provider&&t==n.flightState.ReviewSSRResponse.Trips[e].Journey[0].Provider&&(i=!0)}))}return i},e.prototype.getbabbageweightInKg=function(e){var t=e?e.toLocaleLowerCase().trim().split("kg")[0].split(" "):e;return Number(t[t.length-1].replace(/\'/g,"").split(/(\d+)/).filter(Boolean)[0])>0?t[t.length-1]:t[t.length-2]},e.prototype.getFreeBaggage=function(e){var t=this,r=[],n=this.flightState.ReviewSSRResponse.Trips[e].Journey[0].Segments[0].SSR.filter((function(e){return 0==e.Charge&&"2"==e.Type}));return n.forEach((function(i,s){var a=[];t.flightState.ReviewSSRResponse.Trips[e].Journey[0].Segments.forEach((function(e,t){e.SSR.filter((function(e){return e.Description.trim()===i.Description.trim()&&"2"==e.Type&&0==e.Charge}))[0]&&(a[t]=e.SSR.filter((function(e){return e.Description.trim()===i.Description.trim()&&"2"==e.Type&&0==e.Charge}))[0])})),a.length==t.flightState.ReviewSSRResponse.Trips[e].Journey[0].Segments.length&&r.push(n[s])})),r},e.prototype.checkSectorWiseBaggage=function(e){var t;return!!((t=this.generalState.WebSettings[0].filter("I"==this.flightState.SectorType?function(e){return"SectorwiseBaggageInt"==e.Key}:function(e){return" SectorwiseBaggageDom"==e.Key}))&&t[0]&&t[0].Value.indexOf(this.flightState.ReviewSSRResponse.Trips[e].Journey[0].Segments[0].VAC)>-1)},e.prototype.setFreeBaggSelectedByDef=function(){var e,t,r,n=this,i=!1;if(this.flightState.ReviewSSRResponse&&this.flightState.ReviewSSRResponse.Trips){t=[];for(var s=function(s){if(e=void 0,t.push(""),a.flightState.ReviewSSRResponse.Trips[s].Journey&&a.flightState.ReviewSSRResponse.Trips[s].Journey.length>0&&a.flightState.ReviewSSRResponse.Trips[s].Journey[0].Segments&&a.flightState.ReviewSSRResponse.Trips[s].Journey[0].Segments.length>0&&a.flightState.ReviewSSRResponse.Trips[s].Journey[0].Segments[0].SSR&&!0===a.haveFreeBaggage(s,0,a.flightState.ReviewSSRResponse.Trips[s].Journey[0].Segments[0].FUID)){if(a.checkSectorWiseBaggage(s)||(r=a.getFreeBaggage(s)),r&&1==r.length)e=r[0];else if(r&&r.length>1)for(var o=0,S=0,l=0,u=0,g=!1,p=0;p-1?(g=!1,S=Number(h.replace(/\D/g,"")),r[p].PieceDescription&&(u=Number(a.getbabbageweightInKg(r[p].PieceDescription).replace(/\D/g,""))),u>l&&(g=!0)):S=Number(h.replace(/\D/g,"")),(S>o||S==o&&g)&&(e=r[p])}e&&e.ID&&a.PaxForm.value.forEach((function(r){if("INF"!=r.PTC){var a=n.SSRForm.value.filter((function(e){return e.PaxID==r.ID&&e.FUID==n.flightState.ReviewSSRResponse.Trips[s].Journey[0].Segments[0].FUID&&2==e.Type&&0!=e.SSID}));if(a&&a.length>0){if(a[0].SSID&&a[0].SSID.length>0)for(var o=0;o0&&o.flightState.ReviewSSRResponse.Trips[a].Journey[0].Segments&&o.flightState.ReviewSSRResponse.Trips[a].Journey[0].Segments.length>0)for(var S=function(S){for(var l=0;l0&&o.flightState.ReviewSSRResponse.Trips[a].Journey[0].Segments[S]&&s&&s.indexOf(o.flightState.ReviewSSRResponse.Trips[a].Journey[0].Provider)>-1&&(e={}),e&&e.ID&&o.PaxForm.value.forEach((function(o){if("INF"!=o.PTC){var l=r.SSRForm.value.filter((function(e){return e.PaxID==o.ID&&e.tripIdx==a&&e.FUID==r.flightState.ReviewSSRResponse.Trips[a].Journey[0].Segments[S].FUID&&1==e.Type&&0!=e.SSID}));if(l&&l.length>0){if(l[0].SSID&&l[0].SSID.length>0)for(var u=0;u-1&&r.flightState.ReviewSSRResponse.Trips[a].Journey[0].Segments.forEach((function(e,t){if(n.push(e.FUID),t>0){var i=r.getSelectedSSRFG(o.ID,Number(e.FUID),1,a).controls.SSID;e.SSR&&e.SSR.filter((function(e){return e.ID==i.value}))[0]&&0==e.SSR.filter((function(e){return e.ID==i.value}))[0].Charge&&r.updateSingleSSR(o.ID,parseInt(n[0]),a,"1",0,void 0,!0)}}))}}));break}},l=0;l0&&(i.a.NationalitySortList.forEach((function(t,r){e.forEach((function(r,n){r.Code===t.Code&&e.splice(n,1)}))})),e=i.a.NationalitySortList.concat(e)),e},e}()}}]);