(window.webpackJsonp=window.webpackJsonp||[]).push([[13],{"H+BR":function(e,t,o){"use strict";o.d(t,"a",(function(){return r}));var r=function(){return function(){this.country="",this.latitude="",this.longitude="",this.referenceId="",this.locationId="",this.createdDate="",this.location="",this.type=""}}()},hZaO:function(e,t,o){"use strict";o.d(t,"a",(function(){return v}));var r=o("AcpL"),a=o("Rx7G"),i=o("H+BR"),n=o("wd/R"),s=o("qHG9"),l=o("tScZ"),c=o("AytR"),h=o("BjKo"),u=o("LvDl"),S=o.n(u),d=o("CcnG"),p=o("gIcY"),f=o("o3x0"),v=function(){function e(e,t,o,r,a){var i=this;this.hotelServiceHelper=e,this.hotelStateService=t,this.fb=o,this.generalState=r,this.dialog=a,this.hotelAdapter=new l.a(this.hotelStateService,this.generalState,this.fb,this.hotelServiceHelper),this.createHotelSearchRequestFromNewURL=function(e,t){t&&(e.referenceId="",t.locId&&(e.locationId=t.locId),t.dest&&(e.destination=t.dest),t.loc&&(e.location=t.loc),t.refId&&"NA"!==t.refId&&(e.referenceId=t.refId),t.country&&(e.country=t.country),t.type&&(e.type=t.type),t.lat&&(e.latitude=t.lat),t.long&&(e.longitude=t.long),t.crtDate&&(e.createdDate=t.crtDate),t.noOfNts&&(e.noOfNights=t.noOfNts),t.chkIn&&(e.checkIn=t.chkIn),t.chkOut&&(e.checkOut=t.chkOut),t.rmCnt&&(e.roomCount=t.rmCnt),t.gtCnt&&(e.guestCount=t.gtCnt),t.occup&&i.createOccupancyDetails(e,t.occup),t.trvFor&&(i.hotelStateService.travellingFor=t.trvFor),c.a.projectName==h.a.B2B&&(t.nationality&&(e.nationality=t.nationality),t.resCountry&&(e.residenceCountry=t.resCountry),t.nationalityCode&&(e.nationalityCode=t.nationalityCode),t.resCountryCode&&(e.residenceCountryCode=t.resCountryCode)))},this.createHotelSearchRequestFromURL=function(e,t){if(t){if(e.referenceId="",t.get("locId")&&(e.locationId=t.get("locId")),t.get("dest")&&(e.destination=t.get("dest")),t.get("loc")&&(e.location=t.get("loc")),t.get("refId")&&"NA"!==t.get("refId")&&(e.referenceId=t.get("refId")),t.get("country")&&(e.country=t.get("country")),t.get("type")&&(e.type=t.get("type")),t.get("lat")&&(e.latitude=t.get("lat")),t.get("long")&&(e.longitude=t.get("long")),t.get("crtDate")&&(e.createdDate=t.get("crtDate")),t.get("noOfNts")&&(e.noOfNights=t.get("noOfNts")),t.get("chkIn")&&(e.checkIn=t.get("chkIn")),t.get("chkOut")&&(e.checkOut=t.get("chkOut")),t.get("rmCnt")&&(e.roomCount=t.get("rmCnt")),t.get("gtCnt")&&(e.guestCount=t.get("gtCnt")),t.get("occup")){var o=t.get("occup");i.createOccupancyDetails(e,o)}t.get("trvFor")&&(i.hotelStateService.travellingFor=t.get("trvFor")),c.a.projectName==h.a.B2B&&(t.get("nationality")&&(e.nationality=t.get("nationality")),t.get("resCountry")&&(e.residenceCountry=t.get("resCountry")),t.get("nationalityCode")&&(e.nationalityCode=t.get("nationalityCode")),t.get("resCountryCode")&&(e.residenceCountryCode=t.get("resCountryCode")))}}}return Object.defineProperty(e.prototype,"SearchRequest",{get:function(){return this.hotelStateService.SearchRequestFormGroup},enumerable:!0,configurable:!0}),e.prototype.updateSearchFormGroupByHotelRecentSearchRes=function(e){e&&e.length>0&&this.hotelAdapter.createhotelsearchformgroup(e[0].recent)},e.prototype.addVisibleFlag=function(){this.hotelStateService.SearchResult.hotels.forEach((function(e){e.visible=!0}))},e.prototype.updateSearchFormGroupByHotelPopularDestinations=function(e,t){var o=new i.a;t&&e&&e.length>0&&(this.resetSearchRequest(o),this.hotelAdapter.createhotelsearchformgroup(o),this.fillSelectedDestinationState(e[0],this.hotelStateService.SearchRequestFormGroup))},e.prototype.fillSelectedDestinationState=function(e,t){var o="NA";e.referenceId&&(o=e.referenceId),this.setDestinationDetails(e.fullName,e.type,t);var r=n().format("YYYY-MM-DD hhmmss a");t.controls.country.setValue(e.country),t.controls.latitude.setValue(e.coordinates.lat),t.controls.longitude.setValue(e.coordinates.long),t.controls.referenceId.setValue(o),t.controls.type.setValue(e.type),t.controls.createdDate.setValue(r),t.controls.locationId.setValue(e.id),c.a.projectName==h.a.B2B&&(t.controls.nationality.setValue("INDIA"),t.controls.residenceCountry.setValue("INDIA")),e.createdDate=r,this.hotelStateService.SelectedDestination=e,this.hotelServiceHelper.keepInSession(this.hotelServiceHelper.sessionStorageKey.SELECTEDDESTINATION,this.hotelStateService.SelectedDestination)},e.prototype.setDestinationDetails=function(e,t,o){if("Airport"===t)this.getAirportDetails(e,o);else if(e&&""!=e)if(-1!==e.indexOf(",")){var r=e.split(",");4==r.length?(o.controls.destination.setValue(r[0]+","+r[1]),o.controls.location.setValue(r[2]+","+r[3])):3==r.length?(o.controls.destination.setValue(r[0]),o.controls.location.setValue(r[1]+","+r[2])):(o.controls.destination.setValue(r[0]),o.controls.location.setValue(r[1]))}else o.controls.destination.setValue(e),o.controls.location.setValue(e)},e.prototype.getAirportDetails=function(e,t){if(e&&""!=e&&-1!==e.indexOf(",")){var o=e.split(",");if(3==o.length){var r=o.indexOf(","),a=o[2].indexOf("("),i=o[2].substr(r+1,a-r-1);if(t.controls.location.setValue(o[1]+","+i),o[2].indexOf("(")>-1&&o[2].indexOf(")")>-1){var n=o[2].indexOf("("),s=o[2].indexOf(")");if((c=o[2].substr(n+1,s-n-1)).indexOf("-")>-1){var l=c.split("-")[1].replace("Intl.","International Airport");t.controls.destination.setValue(l)}}}else if(2==o.length&&(r=o.indexOf(","),a=o[1].indexOf("("),i=o[1].substr(r+1,a-r-1),t.controls.location.setValue(o[0]+","+i),o[1].indexOf("(")>-1&&o[1].indexOf(")")>-1)){var c,h=o[1].indexOf("("),u=o[1].indexOf(")");(c=o[1].substr(h+1,u-h-1)).indexOf("-")>-1&&(l=c.split("-")[1].replace("Intl.","International Airport"),t.controls.destination.setValue(l))}}},e.prototype.seoResetSearchRequest=function(e){e.destination="Select Destination",e.noOfNights="1",e.checkIn=n().add(1,"d").format("YYYY-MM-DD"),e.checkOut=n(e.checkIn).add(1,"d").format("YYYY-MM-DD"),e.roomCount="1",e.state=null,e.guestCount="AKBTGULF"===c.a.AKBTTheme||"B2B"==c.a.projectName||"AKBTQATAR"===c.a.AKBTTheme?"2":"1",e.rooms=[];var t={};t.adults="AKBTGULF"===c.a.AKBTTheme||"B2B"==c.a.projectName||"AKBTQATAR"===c.a.AKBTTheme?"2":"1",t.children="0",t.childAges=[],c.a.projectName===h.a.B2B&&(e.nationality="INDIA",e.residenceCountry="INDIA",e.nationalityCode="IN",e.residenceCountryCode="IN"),e.rooms.push(t)},e.prototype.resetSearchRequest=function(e){e.destination="Select Destination",e.noOfNights="1",e.checkIn=n().format("YYYY-MM-DD"),e.checkOut=n(e.checkIn).add(1,"d").format("YYYY-MM-DD"),e.roomCount="1",e.guestCount="AKBTGULF"===c.a.AKBTTheme||"B2B"==c.a.projectName||"AKBTQATAR"===c.a.AKBTTheme?"2":"1",e.rooms=[];var t={};t.adults="AKBTGULF"===c.a.AKBTTheme||"B2B"==c.a.projectName||"AKBTQATAR"===c.a.AKBTTheme?"2":"1",t.children="0",t.childAges=[],c.a.projectName===h.a.B2B&&(e.nationality="INDIA",e.residenceCountry="INDIA",e.nationalityCode="IN",e.residenceCountryCode="IN"),e.rooms.push(t)},e.prototype.mergeRecent=function(e,t){for(var o=Object.assign([],t),r=0;r0){var o=!1;t.forEach((function(t){var r=JSON.parse(t);e>r.recent.createdDate&&(o=!0)})),o&&(localStorage.removeItem("recentSearches"),sessionStorage.removeItem("recentSearches"),t=[])}}else t=[];return t},e.prototype.processRecentSearchData=function(e){var t=[],o=n().format("YYYY-MM-DD");return e.forEach((function(e,r){var a=JSON.parse(e);a.recent&&a.recent.checkIn>=o&&t.push(a)})),t.sort((function(e,t){return n(t.recent.createdDate).diff(n(e.recent.createdDate))})),t},e.prototype.processLocalSuggestion=function(e){var t=[];return e.length>0&&e.forEach((function(e,o){try{var r=JSON.parse(e);r.localSuggestion&&t.push(r.localSuggestion)}catch(a){}})),t.sort((function(e,t){var o=new Date(e.createdDate).getTime()/1e3;return new Date(t.createdDate).getTime()/1e3-o})),t},e.prototype.mergeLocalSuggestion=function(e,t){for(var o=Object.assign([],t),r=0;r0){for(var i=0;i-1&&r.splice(a,1)}r.unshift(e),r=r.splice(0,3),sessionStorage.setItem("recentSearches",JSON.stringify(r)),localStorage.setItem("recentSearches",JSON.stringify(r))}},e.prototype.deleteFromLocal=function(e,t){if(void 0!==typeof sessionStorage){(r=JSON.parse(sessionStorage.getItem("recentSearches")))||(r=[]);var o=-1;r.length>0&&(o=r.findIndex((function(t){return JSON.parse(t).SearchKey==e})))>-1&&r.splice(o,1),sessionStorage.setItem("recentSearches",JSON.stringify(r))}var r;void 0!==typeof localStorage&&((r=JSON.parse(localStorage.getItem("recentSearches")))||(r=[]),o=-1,r.length>0&&(o=r.findIndex((function(t){return JSON.parse(t).SearchKey==e})))>-1&&r.splice(o,1),localStorage.setItem("recentSearches",JSON.stringify(r)));var a=-1;t.forEach((function(t,o){t.SearchKey==e&&(a=o)})),t.splice(a,1)},e.prototype.clearAllFromLocal=function(e,t){if(void 0!==typeof sessionStorage){(a=JSON.parse(sessionStorage.getItem("recentSearches")))||(a=[]);var o=-1;if(a.length>0){for(var r=0;r-1&&a.splice(o)}sessionStorage.setItem("recentSearches",JSON.stringify(a))}if(void 0!==typeof localStorage){var a;if((a=JSON.parse(localStorage.getItem("recentSearches")))||(a=[]),o=-1,a.length>0){for(r=0;r-1&&a.splice(o)}localStorage.setItem("recentSearches",JSON.stringify(a))}var i=-1;t.forEach((function(t,o){t.SearchKey==e&&(i=o)})),t.splice(i)},e.prototype.createNavigationPath=function(e,t,o,r,a,i,s,l){void 0===t&&(t=""),void 0===o&&(o=""),void 0===r&&(r=""),void 0===a&&(a=""),void 0===i&&(i=""),void 0===s&&(s=""),void 0===l&&(l="");var u="",S="NA";return""!=e.controls.referenceId.value&&null!=e.controls.referenceId.value&&(S=e.controls.referenceId.value),u=e.controls.locationId.value+"/"+e.controls.destination.value+"/"+e.controls.location.value+"/"+S+"/"+e.controls.country.value+"/"+e.controls.type.value+"/"+e.controls.latitude.value+"/"+e.controls.longitude.value+"/"+e.controls.createdDate.value+"/"+e.controls.noOfNights.value+"/"+n(e.controls.checkIn.value).format("YYYY-MM-DD")+"/"+n(e.controls.checkOut.value).format("YYYY-MM-DD")+"/"+e.controls.roomCount.value+"/"+e.controls.guestCount.value+"/"+this.createOccupancyString(e.controls.rooms.value)+"/"+this.hotelStateService.travellingFor+"/"+this.hotelStateService.providerName,c.a.projectName==h.a.B2B&&(u=u+"/"+e.controls.nationality.value+"/"+e.controls.residenceCountry.value+"/"+e.controls.nationalityCode.value+"/"+e.controls.residenceCountryCode.value),"Index"==t&&(u=u+"/"+S),"IndexMoreRooms"==t&&(u=u+"/"+S+"/"+r),"Display"==t&&(u=u+"/"+o+"/"+r),"MoreRooms"==t&&(c.a.projectName==h.a.B2B?u=u+"/"+o+"/"+a+"/"+i+"/"+r+"/"+s+"/"+l:c.a.projectName==h.a.B2C&&(u=u+"/"+o+"/"+a+"/"+i+"/"+r)),u},e.prototype.createOccupancyString=function(e){var t="";return e.forEach((function(e,o){t=t+"Room"+o+"-"+e.adults+"-"+e.children+"-",e.childAges&&e.childAges.length>0&&e.childAges.forEach((function(e){t=t+e+"~"})),t+="$"})),t},e.prototype.createWhatsAppContent=function(e,t){var o=this,r=this.hotelStateService.SearchRequestFormGroup.get("checkIn").value,a=this.hotelStateService.SearchRequestFormGroup.get("checkOut").value,i=this.hotelStateService.SearchRequestFormGroup.get("roomCount").value,s=this.hotelStateService.SearchRequestFormGroup.get("noOfNights").value,l=this.hotelStateService.SearchRequestFormGroup.get("guestCount").value,h="Your Hotel information for *"+this.hotelStateService.SearchRequestFormGroup.get("destination").value+", "+this.hotelStateService.SearchRequestFormGroup.get("location").value+"* %0A%0ACheck In : *"+n(r).format("MMM'DD")+"*%0ACheck Out : *"+n(a).format("MMM'DD")+"*%0A*"+l+"* Pax, *"+i+"* Rooms, *"+s+"* Nights%0A%0A";return e.forEach((function(e,r){h+=r+1+". *"+e.name+"* - "+t+" *"+o.formatNumber(Math.round(e.rate.total))+"* %0A%0A"})),h+="Thank you for choosing *Akbar Travels* %0AContact: +91 2240 666 444 %0AEmail: "+c.a.supportMail},e.prototype.formatNumber=function(e){return e.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")},e.prototype.resetModifySearchFormGroup=function(){var e=JSON.parse(JSON.stringify(this.hotelServiceHelper.getFromSession(this.hotelServiceHelper.sessionStorageKey.SEARCHFORMGROUP)));this.hotelAdapter.createhotelsearchformgroup(e)},e.prototype.Encodeparentheses=function(e){return(e.indexOf("(")>-1||e.indexOf(")")>-1)&&(e=e.replace(/\(/g,"").replace(/\)/g,"")),e},e.prototype.EncodeAllSpecialCharacters=function(e){return e.replace(/[^a-zA-Z0-9- ]/g,"")},e.prototype.sortAvailable=function(e,t){return function(o,r){var a,i;return"rate"==e?(a=o.rate?o.rate.total:0,i=r.rate?r.rate.total:0):(a=o[e],i=r[e]),"asc"===t?ai?1:0:ai?-1:0}},e.prototype.sortHotels=function(e,t){if(this.hotelStateService.SearchResult&&this.hotelStateService.SearchResult.hotels&&this.hotelStateService.SearchResult.hotels.length){this.hotelStateService.currentFilter=e;var o=[],r=[],a=[],i=[];o=this.hotelStateService.SearchResult.hotels.filter((function(e){return 1==e.isSoldOut})),r=this.hotelStateService.SearchResult.hotels.filter((function(e){return 1!=e.isSoldOut})),i=this.hotelStateService.SearchResult.hotels.filter((function(e){return 1!=e.isSoldOut})),o.sort(this.sortAvailable(e,t)),r.sort(this.sortAvailable(e,t)),i.sort(this.sortAvailable(e,t)),a=this.hotelStateService.SearchResult.hotels.filter((function(e){return e.isPreferedHotel}));var n=this.hotelServiceHelper.getFromSession("SEARCHFORMGROUP");this.hotelStateService.SearchResult.hotels="hotel"==n.type.toLowerCase()?S.a.uniqWith(a.concat(r),(function(e,t){return e.id===t.id})):S.a.uniqWith(i,(function(e,t){return e.id===t.id}))}},e.prototype.resetPopular=function(){this.hotelStateService.FilterModel&&this.hotelStateService.FilterModel.hotelFilterDetail&&this.hotelStateService.FilterModel.hotelFilterDetail.popularLocation.popular.forEach((function(e){e.sel=!1}))},e.prototype.urlDateCheck=function(e,t){return!(!n(e).isSameOrAfter(n().format("YYYY-MM-DD"))||!n(t).isAfter(n(e)))},e.prototype.createNewHotelSearchRequestFromURL=function(e,t){t&&(e.referenceId="",t.locId&&(e.locationId=t.locId),t.dest&&(e.destination=t.dest),t.loc&&(e.location=t.loc),t.refId&&"NA"!==t.refId&&(e.referenceId=t.refId),t.country&&(e.country=t.country),t.type&&(e.type=t.type),t.lat&&(e.latitude=t.lat),t.long&&(e.longitude=t.long),t.crtDate&&(e.createdDate=t.crtDate),t.noOfNts&&(e.noOfNights=t.noOfNts),t.chkIn&&(e.checkIn=t.chkIn),t.chkOut&&(e.checkOut=t.chkOut),t.rmCnt&&(e.roomCount=t.rmCnt),t.gtCnt&&(e.guestCount=t.gtCnt),t.occup&&this.createOccupancyDetails(e,t.occup),t.trvFor&&(this.hotelStateService.travellingFor=t.trvFor),c.a.projectName==h.a.B2B&&(t.nationality&&(e.nationality=t.nationality),t.resCountry&&(e.residenceCountry=t.resCountry),t.nationalityCode&&(e.nationalityCode=t.nationalityCode),t.resCountryCode&&(e.residenceCountryCode=t.resCountryCode)))},e.prototype.createOccupancyDetails=function(e,t){var o=[],r=t.split("$");r&&r.length>0&&r.forEach((function(e){if(e&&""!==e){var t={},r=e.split("-");if(r&&r.length>0){t.adults=r[1],t.children=r[2];var a=r[3].split("~"),i=[];a&&a.length>0&&a.forEach((function(e){e&&""!==e&&i.push(e)})),t.childAges=i}o.push(t)}})),e.rooms=o},e.prototype.setProfileData=function(e){this.generalState.UserDetails||(this.generalState.UserDetails=new r.c),this.generalState.UserDetails.Fname=e.Rooms[0].Guests[0].FirstName,this.generalState.UserDetails.Lname=e.Rooms[0].Guests[0].LastName,this.generalState.UserDetails.Title=e.Rooms[0].Guests[0].Title},e.prototype.setGuestProfileData=function(e,t){this.generalState.UserDetails=new r.c,this.generalState.UserDetails.UserId=t.controls.Email.value,this.generalState.UserDetails.Fname=e.Rooms[0].Guests[0].FirstName,this.generalState.UserDetails.Lname=e.Rooms[0].Guests[0].LastName,this.generalState.UserDetails.Title=e.Rooms[0].Guests[0].Title,this.generalState.UserDetails.Mname="",this.generalState.UserDetails.MobNumber=t.controls.Mobile.value,this.generalState.UserDetails.Gender="M",this.generalState.UserDetails.DOB="",this.generalState.UserDetails.Contacts=e.Rooms[0].Guests[0],this.generalState.UserDetails.Email=t.controls.Email.value,this.generalState.UserDetails.UserType="guest"},e.prototype.createHotelShareDetails=function(){var e=[];return this.hotelStateService.shareEmailSearch.address=this.hotelStateService.HotelDetails.hotelSummary.address,this.hotelStateService.shareEmailSearch.rate={total:this.hotelStateService.HotelDetails.hotelRoomReccomendations[0].totalFare,discounts:this.hotelStateService.HotelDetails.hotelRoomReccomendations[0].totalDiscount,baseRate:this.hotelStateService.HotelDetails.hotelRoomReccomendations[0].baseRate},e.push(this.hotelStateService.shareEmailSearch),e},e.prototype.setTravellingFor=function(e){var t=this;this.hotelStateService.travellingForArray=[{name:"Work",value:"WRK",selected:!1}],this.hotelStateService.travellingFor="NTF",e&&this.hotelStateService.travellingForArray.forEach((function(o){e==o.value&&(o.selected=!0,t.hotelStateService.travellingFor=o.value)}))},e.prototype.filterShortlistedHotels=function(e,t){var o=this;this.hotelStateService.ShortListedHotels=[],this.hotelStateService.SearchResult&&this.hotelStateService.SearchResult.hotels&&this.hotelStateService.SearchResult.hotels.forEach((function(e){e.shortlisted=!1})),e&&e.forEach((function(e){if(e.dest==t){var r=[];e&&e.hotels&&e.hotels.forEach((function(e){var t,a;t=o.hotelStateService.SearchResult.hotels.filter((function(t){return t.id==e})),a=o.hotelStateService.SearchResult.hotels.findIndex((function(t){return t.id==e})),t.length>0&&(o.hotelStateService.ShortListedHotels.push(t[0]),a>-1&&(o.hotelStateService.SearchResult.hotels[a].shortlisted=!0),r.push(e))})),e.hotels=r}})),this.hotelServiceHelper.keepInSession(this.hotelServiceHelper.sessionStorageKey.SHORTLISTEDHOTEL,e,!0)},e.prototype.removeShortlisted=function(e,t,o){var r;if(null==t&&null!=this.hotelServiceHelper.getFromSession("SEARCHFORMGROUP")){var a=this.hotelServiceHelper.getFromSession("SEARCHFORMGROUP");t=a.locationId}o?(r=this.hotelStateService.DisplayShortListed.findIndex((function(t){return t.id==e})))>-1&&this.hotelStateService.DisplayShortListed.splice(r,1):((r=this.hotelStateService.shortListedHotels.findIndex((function(t){return t.id==e})))>-1&&this.hotelStateService.shortListedHotels.splice(r,1),this.hotelStateService.SearchResult.hotels.filter((function(t){return t.id==e}))[0].shortlisted=!1);var i=-1;this.hotelStateService.AllShortListedHotels.forEach((function(o,r){var a;o&&o.dest==t&&(a=o.hotels.findIndex((function(t){return t==e})),o.hotels.splice(a,1),o.hotels&&0==o.hotels.length&&(i=r))})),i>-1&&this.hotelStateService.AllShortListedHotels.splice(i,1),this.hotelServiceHelper.keepInSession(this.hotelServiceHelper.sessionStorageKey.SHORTLISTEDHOTEL,this.hotelStateService.AllShortListedHotels,!0),o||this.processDisplayShortlist(t,!1),this.hotelStateService.getBounds.next()},e.prototype.shortListHotel=function(e,t,o,r){var a=this;void 0===o&&(o=!1),void 0===r&&(r=null);var i=!1,n=-1,s=!1;this.hotelStateService.AllShortListedHotels.forEach((function(o,l){if(o.dest==t){if(i=!0,o.hotels.length>3&&0==o.hotels.filter((function(t){return t==e.id})).length)return s=!0,void(r&&r());var c=!1,h=0;if(o.hotels.forEach((function(t,o){e.id==t&&(c=!0,h=o)})),c){e.shortlisted=!1,o.hotels.splice(h,1),0==o.hotels.length&&(n=l);var u=a.hotelStateService.shortListedHotels.findIndex((function(t){return t.id==e.id}));a.hotelStateService.shortListedHotels.splice(u,1)}else e.shortlisted=!0,o.hotels.push(e.id),a.hotelStateService.shortListedHotels.push(e)}})),i||(this.hotelStateService.AllShortListedHotels.push({dest:t,hotels:[e.id]}),this.hotelStateService.shortListedHotels.push(e),e.shortlisted=!0),n>-1&&this.hotelStateService.AllShortListedHotels.splice(n,1),this.hotelStateService.getBounds.next(),this.hotelServiceHelper.keepInSession(this.hotelServiceHelper.sessionStorageKey.SHORTLISTEDHOTEL,this.hotelStateService.AllShortListedHotels,!0),s||this.processDisplayShortlist(t,o,e)},e.prototype.processDisplayShortlist=function(e,t,o){var r=this,a=JSON.parse(localStorage.getItem(this.hotelServiceHelper.sessionStorageKey.SHORTLISTEDHOTEL));t?(this.hotelStateService.DisplayShortListed=[],a.forEach((function(t){if(t.dest==e){t.hotelDetails||(t.hotelDetails=[]);var a=-1;t.hotelDetails.forEach((function(e,t){e.id==o.id&&(a=t)})),a>-1?t.hotelDetails.splice(a,1):t.hotelDetails.push({id:o.id,name:o.name,address:o.address,heroImage:o.heroImage,starRating:o.starRating,isSoldOut:o.isSoldOut,rate:o.rate}),r.hotelStateService.DisplayShortListed=t.details}}))):a.forEach((function(t){t.dest==e&&(t.hotelDetails=[],t.hotels.forEach((function(e){var o=r.hotelStateService.SearchResult.hotels.filter((function(t){return t.id==e}));o&&o.length>0&&t.hotelDetails.push({id:o[0].id,name:o[0].name,address:o[0].address,heroImage:o[0].heroImage,distance:o[0].distance,starRating:o[0].starRating,isSoldOut:o[0].isSoldOut,rate:o[0].rate})})))})),this.hotelStateService.AllShortListedHotels=a,this.hotelServiceHelper.keepInSession(this.hotelServiceHelper.sessionStorageKey.SHORTLISTEDHOTEL,a,!0)},e.prototype.fillSelectedNationality=function(e,t){t.controls.nationality.setValue(e.Name),t.controls.nationalityCode.setValue(e.Code),this.hotelStateService.SelectedNationality=e,this.hotelServiceHelper.keepInSession(this.hotelServiceHelper.sessionStorageKey.SELECTEDNATIONALITY,this.hotelStateService.SelectedNationality)},e.prototype.fillSelectedResidenceCountry=function(e,t){t.controls.residenceCountry.setValue(e.Name),t.controls.residenceCountryCode.setValue(e.Code),this.hotelStateService.SelectedResidenceCountry=e,this.hotelServiceHelper.keepInSession(this.hotelServiceHelper.sessionStorageKey.SELECTEDRESIDENCECOUNTRY,this.hotelStateService.SelectedResidenceCountry)},e.ngInjectableDef=d.cc({factory:function(){return new e(d.dc(s.a),d.dc(a.a),d.dc(p.g),d.dc(r.b),d.dc(f.e))},token:e,providedIn:"root"}),e}()},tScZ:function(e,t,o){"use strict";o.d(t,"a",(function(){return c}));var r=o("mrSG"),a=o("wd/R"),i=o("AytR"),n=o("gIcY"),s=o("KuF8"),l=o("BjKo"),c=function(){function e(e,t,o,r){this.hotelStateService=e,this.generalStateService=t,this.fb=o,this.hotelServiceHelper=r,this.generalHelper=new s.a}return e.prototype.createRecentSearchRequest=function(){var e={};return e.TUI=i.a.projectName==l.a.B2B?this.generalStateService.TUI:"abc|3d89bddc-ebf7-4654-8699-ffaa11159084|20181020101010",e.ClientID=this.generalHelper.getClientId(),e.Searches=[],e},e.prototype.createEmailShareFormGroup=function(){return this.fb.group({ClientID:["",[n.B.required,n.B.email]]})},e.prototype.createmarkupFormGroup=function(){return this.fb.group({markup:["",[n.B.required,n.B.pattern("[0-9]+(.[0-9]{1,3})?$")]]})},e.prototype.createDiscountFormGroup=function(e){return this.fb.group({Discount:["",[n.B.required,n.B.pattern("[0-9]+(.[0-9]{1,3})?$"),h(e)]]})},e.prototype.createWhatsappShareFormGroup=function(){return this.fb.group({PhoneNumber:["",[n.B.required,n.B.pattern("[6-9]\\d{9}")]]})},e.prototype.createEmailSearchRequest=function(e,t){var o={};return o.MailTo=e,o.TUI=this.generalStateService.TUI,o.ClientID=this.generalStateService.ClientID,o.MailContent=t,o.isHtml=!0,o.MsgType="EML",o.MailSub="Hotel Search",o},e.prototype.createWhatsappSearchRequest=function(e){var t={};t.Phone=e,t.TUI=this.generalStateService.TUI;var o=[];return this.hotelStateService.SearchResult.hotels.forEach((function(e){1==e.ShareEmailSearch&&o.push(e)})),t.Hotel=o,t},e.prototype.createSMSSearchRequest=function(e,t){var o={};return o.ContactNumber=e,o.MsgType="SMS",o.SMSContent=t,o},e.prototype.createhotelsearchformgroup=function(e){var t,o,a=this,i=this.fb.group(e);if(i.removeControl("rooms"),null!=e.rooms){var s=function(e){i.get("rooms")||i.addControl("rooms",new n.e([]));var t=l.fb.group({adults:e.adults,children:e.children});t.addControl("childAges",new n.e([])),e.childAges.forEach((function(e){t.get("childAges").push(a.fb.control(e))})),i.get("rooms").push(t)},l=this;try{for(var c=r.__values(e.rooms),h=c.next();!h.done;h=c.next())s(h.value)}catch(u){t={error:u}}finally{try{h&&!h.done&&(o=c.return)&&o.call(c)}finally{if(t)throw t.error}}}return this.setValidationsForHotelSearchFormGroup(i),this.hotelServiceHelper.keepInSession(this.hotelServiceHelper.sessionStorageKey.SEARCHFORMGROUP,i.value),this.hotelStateService.SearchRequestFormGroup=i,i},e.prototype.setValidationsForHotelSearchFormGroup=function(e){e.get("destination").setValidators([n.B.required,this.textValidation("destination",e)]),e.get("country").setValidators([n.B.required]),e.get("checkIn").setValidators([n.B.required]),e.get("checkOut").setValidators([n.B.required])},e.prototype.textValidation=function(e,t){return function(t){var o={};if("destination"==e&&(""==t.value||null==t.value||"Select Destination"==t.value))return o[e]="Invalid",o}},e.prototype.createhotelresultcontentrequest=function(e,t,o){void 0===o&&(o=50);try{var r={};return this.hotelStateService&&this.hotelStateService.HotelInItResponse&&(r.searchId=this.hotelStateService.HotelInItResponse.searchId,r.searchTracingKey=this.hotelStateService.HotelInItResponse.searchTracingKey),r.limit=o,r.offset=e,r.filterData=t,r}catch(a){}},e.prototype.createhotelinitrequest=function(e){try{var t={geoCode:{}};if(t.geoCode.lat=e.controls.latitude.value,t.geoCode.long=e.controls.longitude.value,t.locationId=e.controls.locationId.value,t.currency=""+i.a.baseCurrency,t.culture=""+i.a.hotelCulture,t.checkIn=a(e.controls.checkIn.value).format("MM/DD/YYYY"),t.checkOut=a(e.controls.checkOut.value).format("MM/DD/YYYY"),t.rooms=e.controls.rooms.value,t.destinationCountryCode=e.controls.country.value,t.nationality=i.a.mobileCountryCode.countryCode.toUpperCase(),t.countryOfResidence=i.a.mobileCountryCode.countryCode.toUpperCase(),t.channelId=this.hotelStateService.providerName&&null!=this.hotelStateService.providerName&&"undefined"!=this.hotelStateService.providerName&&"NSP"!=this.hotelStateService.providerName&&"WG"!=this.hotelStateService.providerName&&"SS"!=this.hotelStateService.providerName&&"GG"!=this.hotelStateService.providerName?this.hotelStateService.providerName:""+i.a.hotelChannelId,t.channelId=this.hotelStateService.isSeo?"b2cAllianceDeals":""+i.a.hotelChannelId,i.a.projectName==l.a.B2C)t.segmentId="AKBTGULF"===i.a.AKBTTheme?"b2cuaedeals":"B2CGROUP";else{var o=this.generalHelper.getFromSession(this.generalHelper.sessionStorageKey.AGENTPROFILERESPONSE);t.segmentId=o?o.htdealCode:null}return"NA"==t.locationId&&(t.locationId=null,t.radiusInKm=i.a.hotelRadiusInKm),t.AffiliateRegion=i.a.hotelAffiliateRegion,t}catch(r){}},e.prototype.createHotelSaveRecentSearchRequest=function(e,t,o){try{var r={};return r.ClientID=this.generalHelper.getClientId(),r.TUI="3d89bddc-ebf7-4654-8699-ffaa11159084|3d89bddc-ebf7-4654-8699-ffaa11159084|20181020101010",r.SearchData=e,r.Operation=t,r.CheckInDate=o,r}catch(a){}},e.prototype.createDeleteRecentSearchRequest=function(e){var t={TUI:"3d89bddc-ebf7-4654-8699-ffaa11159084|3d89bddc-ebf7-4654-8699-ffaa11159084|20181020101010"};return t.ClientID=this.generalHelper.getClientId(),t.SearchKey=e,t},e.prototype.createUniqueKey=function(e){var t=JSON.parse(e),o="loc_id~"+t.recent.locationId+"&in~"+t.recent.checkIn+"&out~"+t.recent.checkOut+"&";return t.recent.rooms.forEach((function(e,t){o=o+"Room"+t+"-"+e.adults+"-"+e.children+"-",e.childAges&&e.childAges.length>0&&e.childAges.forEach((function(e){o=o+e+"~"})),o+="$"})),o},e.prototype.createHotelRoomFormGroup=function(){return this.fb.group("AKBTGULF"===i.a.AKBTTheme||"B2B"==i.a.projectName||"AKBTQATAR"===i.a.AKBTTheme?{adults:["2"],children:["0"],childAges:this.fb.array([])}:{adults:["1"],children:["0"],childAges:this.fb.array([])})},e.prototype.createHotelAgeFormGroup=function(){return this.fb.control("0")},e.prototype.createRegisterGuestRequest=function(){var e={};e.ClientID=this.generalStateService.ClientIDDecrypted,e.TUI=this.hotelStateService.TUI,e.IsGuest=!0;var t=JSON.parse(JSON.stringify(this.hotelStateService.HotelTravelItineraryFormGrp.value)),o=this.hotelStateService.HotelTravelItineraryFormGrp.get("ContactInfo"),r={};r.Email=this.generalStateService.ClientIDDecrypted,r.Mobile=o.controls.Mobile.value,r.FName=t.Rooms[0].Guests[0].FirstName,r.LName=t.Rooms[0].Guests[0].LastName,r.DOB="",r.Title=t.Rooms[0].Guests[0].Title,e.Profile=r;var a={};return a.Email=this.generalStateService.ClientIDDecrypted,a.Phone=o.controls.Mobile.value,e.Contacts=a,e.Notification="",e},e.prototype.createRegisterSocialLoginRequest=function(e,t){var o={};o.ClientID=this.generalStateService.ClientID,o.TUI=this.generalStateService.TUI,o.IsGuest=!1;var r={};r.Email=this.generalStateService.ClientIDDecrypted,r.Mobile=t.controls.Mobile.value,r.FName=e.Rooms[0].Guests[0].FirstName,r.MName="",r.LName=e.Rooms[0].Guests[0].LastName,r.DOB="",r.Gender="",r.Subscription="",r.Anniversary="",r.Title=e.Rooms[0].Guests[0].Title,r.SocialMediaID=this.generalStateService.SocialMediaID,r.SocialMediaType=this.generalStateService.SocialMediaType,o.Profile=r;var a={};return a.Email=this.generalStateService.ClientIDDecrypted,a.Phone=t.controls.Mobile.value,a.Address="",a.Country="",a.State="",a.City="",a.PIN="",o.Contacts=a,o.Notification="",o},e}();function h(e){return function(t){var o={};if(e){var r=+t.value;return r&&r>0&&r<=e?null:(o.amountValidator={value:t.value},o)}return null}}}}]);