(function(){"use strict";function n(n,t,i,r,u,f,e){function s(){ct.utls.showLoading();signinCustomer()}function h(){e.ClearCustomerCache(function(){console.log("cache cleared")});l();signoutCustomer()}function c(){if(ct.utls.showLoading(),$("#hdnIsAgentPortalEnabled").val()!=="false"||ct.utls.isNullOrEmpty($("#hdnLegacyAgentPortalUrl").val())){var n=ct.utls.url.identityAgentPortalHostUrl()+"/Redirect?type=login";window.location=n}else window.location.href=$("#hdnLegacyAgentPortalUrl").val()}function l(){removeCustomerLocalStorage();t.currentUser={};t.accessToken={};n.defaults.headers.common.Authorization="Basic";ct.customer.clientStore.removeItem(ct.customer.storageKeys.PostLoginRedirectUrl);ct.customer.clientStore.removeItem(ct.customer.storageKeys.CustomerFirstTimeUser);ct.customer.clientStore.removeItem(ct.customer.storageKeys.BookingsNavigationInfo);ct.customer.clientStore.removeItem(ct.customer.storageKeys.Traveller);ct.customer.clientStore.removeItem(ct.customer.storageKeys.Countries);ct.customer.clientStore.removeItem(ct.customer.storageKeys.LinkedBookings)}var o={};return o.signInCustomer=s,o.signOutCustomer=h,o.signInAgent=c,o}angular.module("ct.customerPortal").factory("authService",n);n.$inject=["$http","$rootScope","$cookies","$log","globalConstants","webApiRequest","headerService"]})(),function(){"use strict";function n(n,t,i,r,u,f,e,o,s,h){function c(){var n=window.location.search.indexOf("firstTimeUser")>=0;n&&(s.InitSignInResponse(),s.GetCustomClaims(function(n){var t,i,r,u;if(ct.utls.showMessage(n),n.Data.ClaimList!=null&&n.Data.ClaimList.length>0)if(t=window._.where(n.Data.ClaimList,{ClaimType:h.claimType.ContactUserId}),i=window._.where(n.Data.ClaimList,{ClaimType:h.claimType.ContactMarketId}),t.length>0&&i.length>0)r=t[0].ClaimValue,u=i[0].ClaimValue,s.SetFirstTimeCustomer(r,u),s.InitSigninResponse();else return window.location.replace("/Profile/MyAddress?type=firstTimeUser"),!1;else return window.location.replace("/Profile/MyAddress?type=firstTimeUser"),!1}))}angular.extend(n,{showSignout:!1,showLogin:!0}),function(){t.showCustomerLogin=!1;u.log("init loginController");ct.utls.hideOverlay();c()}()}angular.module("ct.customerPortal").controller("loginController",n);n.$inject=["$scope","$rootScope","$location","$state","$log","$http","$cookies","authService","headerService","globalConstants"]}()