piral-adal 1.9.2-beta.8358 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -5
- package/piral-adal.min.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-adal",
|
|
3
|
-
"version": "1.9.2
|
|
3
|
+
"version": "1.9.2",
|
|
4
4
|
"description": "Plugin to integrate AAD authentication in Piral.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"exports": {
|
|
27
27
|
".": "./lib/index.js",
|
|
28
28
|
"./lib/*": {
|
|
29
|
-
"
|
|
30
|
-
"
|
|
29
|
+
"types": "./lib/*.d.ts",
|
|
30
|
+
"import": "./lib/*"
|
|
31
31
|
},
|
|
32
32
|
"./package.json": "./package.json"
|
|
33
33
|
},
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"msal": "^1"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"piral-core": "1.9.2
|
|
59
|
+
"piral-core": "^1.9.2"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "3adb702cbb788889a05a30d2a7ee657ad713a468"
|
|
62
62
|
}
|
package/piral-adal.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{function ht(o){return e=>(e.on("before-fetch",o.extendHeaders),{getAccessToken(){return o.token()}})}var Se=function(o,e){return Se=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])},Se(o,e)};function O(o,e){Se(o,e);function t(){this.constructor=o}o.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var S=function(){return S=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},S.apply(this,arguments)};function G(o,e,t,r){function n(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function s(h){try{u(r.next(h))}catch(T){a(T)}}function c(h){try{u(r.throw(h))}catch(T){a(T)}}function u(h){h.done?i(h.value):n(h.value).then(s,c)}u((r=r.apply(o,e||[])).next())})}function W(o,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,n,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(h){return c([u,h])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,n&&(i=u[0]&2?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,n=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){t.label=u[1];break}if(u[0]===6&&t.label<i[1]){t.label=i[1],i=u;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(u);break}i[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(o,t)}catch(h){u=[6,h],n=0}finally{r=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function U(){for(var o=0,e=0,t=arguments.length;e<t;e++)o+=arguments[e].length;for(var r=Array(o),n=0,e=0;e<t;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,n++)r[n]=i[a];return r}var b=function(){function o(){}return o.createNewGuid=function(){var e=window.crypto;if(e&&e.getRandomValues){var t=new Uint8Array(16);return e.getRandomValues(t),t[6]|=64,t[6]&=79,t[8]|=128,t[8]&=191,o.decimalToHex(t[0])+o.decimalToHex(t[1])+o.decimalToHex(t[2])+o.decimalToHex(t[3])+"-"+o.decimalToHex(t[4])+o.decimalToHex(t[5])+"-"+o.decimalToHex(t[6])+o.decimalToHex(t[7])+"-"+o.decimalToHex(t[8])+o.decimalToHex(t[9])+"-"+o.decimalToHex(t[10])+o.decimalToHex(t[11])+o.decimalToHex(t[12])+o.decimalToHex(t[13])+o.decimalToHex(t[14])+o.decimalToHex(t[15])}else{for(var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",n="0123456789abcdef",i=0,a="",s=0;s<36;s++)r[s]!=="-"&&r[s]!=="4"&&(i=Math.random()*16|0),r[s]==="x"?a+=n[i]:r[s]==="y"?(i&=3,i|=8,a+=n[i]):a+=r[s];return a}},o.isGuid=function(e){var t=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;return t.test(e)},o.decimalToHex=function(e){for(var t=e.toString(16);t.length<2;)t="0"+t;return t},o.base64Encode=function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(r,n){return String.fromCharCode(+("0x"+n))}))},o.base64Decode=function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("Invalid base64 string")}return decodeURIComponent(atob(t).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""))},o.deserialize=function(e){var t,r=/\+/g,n=/([^&=]+)=([^&]*)/g,i=function(s){return decodeURIComponent(s.replace(r," "))},a={};for(t=n.exec(e);t;)a[i(t[1])]=i(t[2]),t=n.exec(e);return a},o}();var l=function(){function o(){}return Object.defineProperty(o,"libraryName",{get:function(){return"Msal.js"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"claims",{get:function(){return"claims"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"clientId",{get:function(){return"clientId"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"adalIdToken",{get:function(){return"adal.idtoken"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"cachePrefix",{get:function(){return"msal"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"scopes",{get:function(){return"scopes"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"no_account",{get:function(){return"NO_ACCOUNT"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"upn",{get:function(){return"upn"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"domain_hint",{get:function(){return"domain_hint"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"prompt_select_account",{get:function(){return"&prompt=select_account"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"prompt_none",{get:function(){return"&prompt=none"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"prompt",{get:function(){return"prompt"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"response_mode_fragment",{get:function(){return"&response_mode=fragment"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"resourceDelimiter",{get:function(){return"|"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"cacheDelimiter",{get:function(){return"."},enumerable:!1,configurable:!0}),Object.defineProperty(o,"popUpWidth",{get:function(){return this._popUpWidth},set:function(e){this._popUpWidth=e},enumerable:!1,configurable:!0}),Object.defineProperty(o,"popUpHeight",{get:function(){return this._popUpHeight},set:function(e){this._popUpHeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(o,"login",{get:function(){return"LOGIN"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"renewToken",{get:function(){return"RENEW_TOKEN"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"unknown",{get:function(){return"UNKNOWN"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"ADFS",{get:function(){return"adfs"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"homeAccountIdentifier",{get:function(){return"homeAccountIdentifier"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"common",{get:function(){return"common"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"openidScope",{get:function(){return"openid"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"profileScope",{get:function(){return"profile"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"oidcScopes",{get:function(){return[this.openidScope,this.profileScope]},enumerable:!1,configurable:!0}),Object.defineProperty(o,"interactionTypeRedirect",{get:function(){return"redirectInteraction"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"interactionTypePopup",{get:function(){return"popupInteraction"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"interactionTypeSilent",{get:function(){return"silentInteraction"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"inProgress",{get:function(){return"inProgress"},enumerable:!1,configurable:!0}),o._popUpWidth=483,o._popUpHeight=600,o}();var Ne="sessionStorage",p;(function(o){o.SCOPE="scope",o.STATE="state",o.ERROR="error",o.ERROR_DESCRIPTION="error_description",o.ACCESS_TOKEN="access_token",o.ID_TOKEN="id_token",o.EXPIRES_IN="expires_in",o.SESSION_STATE="session_state",o.CLIENT_INFO="client_info"})(p||(p={}));var Q={id_token:"id_token",token:"token",id_token_token:"id_token token"},I;(function(o){o.AUTHORITY="authority",o.ACQUIRE_TOKEN_ACCOUNT="acquireTokenAccount",o.SESSION_STATE="session.state",o.STATE_LOGIN="state.login",o.STATE_ACQ_TOKEN="state.acquireToken",o.STATE_RENEW="state.renew",o.NONCE_IDTOKEN="nonce.idtoken",o.LOGIN_REQUEST="login.request",o.RENEW_STATUS="token.renew.status",o.URL_HASH="urlHash",o.INTERACTION_STATUS="interaction.status",o.REDIRECT_REQUEST="redirect_request"})(I||(I={}));var H;(function(o){o.IDTOKEN="idtoken",o.CLIENT_INFO="client.info"})(H||(H={}));var P;(function(o){o.LOGIN_ERROR="login.error",o.ERROR="error",o.ERROR_DESC="error.description"})(P||(P={}));var Ye="https://login.microsoftonline.com/common/",xe=Ye+"/discovery/instance?api-version=1.1&authorization_endpoint=",we=".well-known/openid-configuration",w;(function(o){o.ACCOUNT="account",o.SID="sid",o.LOGIN_HINT="login_hint",o.ORGANIZATIONS="organizations",o.CONSUMERS="consumers",o.ID_TOKEN="id_token",o.ACCOUNT_ID="accountIdentifier",o.HOMEACCOUNT_ID="homeAccountIdentifier"})(w||(w={}));var Ue=[w.SID,w.LOGIN_HINT],se={GET:"GET",POST:"POST"},oe={LOGIN:"login",SELECT_ACCOUNT:"select_account",CONSENT:"consent",NONE:"none"},Ce={ID_TOKEN_FRAME:"msalIdTokenFrame",TOKEN_FRAME:"msalRenewFrame"};var ge={unexpectedError:{code:"unexpected_error",desc:"Unexpected error in authentication."},noWindowObjectError:{code:"no_window_object",desc:"No window object available. Details:"}},D=function(o){O(e,o);function e(t,r){var n=o.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n.errorCode=t,n.errorMessage=r,n.name="AuthError",n}return e.createUnexpectedError=function(t){return new e(ge.unexpectedError.code,ge.unexpectedError.desc+": "+t)},e.createNoWindowObjectError=function(t){return new e(ge.noWindowObjectError.code,ge.noWindowObjectError.desc+" "+t)},e}(Error);var m=function(){function o(){}return o.isEmpty=function(e){return typeof e>"u"||!e||e.length===0},o.validateAndParseJsonCacheKey=function(e){try{var t=JSON.parse(e);return t&&typeof t=="object"?t:null}catch{return null}},o}();var d={endpointResolutionError:{code:"endpoints_resolution_error",desc:"Error: could not resolve endpoints. Please check network and try again."},popUpWindowError:{code:"popup_window_error",desc:"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser."},tokenRenewalError:{code:"token_renewal_error",desc:"Token renewal operation failed due to timeout."},invalidIdToken:{code:"invalid_id_token",desc:"Invalid ID token format."},invalidStateError:{code:"invalid_state_error",desc:"Invalid state."},nonceMismatchError:{code:"nonce_mismatch_error",desc:"Nonce is not matching, Nonce received: "},loginProgressError:{code:"login_progress_error",desc:"Login_In_Progress: Error during login call - login is already in progress."},acquireTokenProgressError:{code:"acquiretoken_progress_error",desc:"AcquireToken_In_Progress: Error during login call - login is already in progress."},userCancelledError:{code:"user_cancelled",desc:"User cancelled the flow."},callbackError:{code:"callback_error",desc:"Error occurred in token received callback function."},userLoginRequiredError:{code:"user_login_error",desc:"User login is required. For silent calls, request must contain either sid or login_hint"},userDoesNotExistError:{code:"user_non_existent",desc:"User object does not exist. Please call a login API."},clientInfoDecodingError:{code:"client_info_decoding_error",desc:"The client info could not be parsed/decoded correctly. Please review the trace to determine the root cause."},clientInfoNotPopulatedError:{code:"client_info_not_populated_error",desc:"The service did not populate client_info in the response, Please verify with the service team"},nullOrEmptyIdToken:{code:"null_or_empty_id_token",desc:"The idToken is null or empty. Please review the trace to determine the root cause."},idTokenNotParsed:{code:"id_token_parsing_error",desc:"ID token cannot be parsed. Please review stack trace to determine root cause."},tokenEncodingError:{code:"token_encoding_error",desc:"The token to be decoded is not encoded correctly."},invalidInteractionType:{code:"invalid_interaction_type",desc:"The interaction type passed to the handler was incorrect or unknown"},cacheParseError:{code:"cannot_parse_cache",desc:"The cached token key is not a valid JSON and cannot be parsed"},blockTokenRequestsInHiddenIframe:{code:"block_token_requests",desc:"Token calls are blocked in hidden iframes"}},E=function(o){O(e,o);function e(t,r){var n=o.call(this,t,r)||this;return n.name="ClientAuthError",Object.setPrototypeOf(n,e.prototype),n}return e.createEndpointResolutionError=function(t){var r=d.endpointResolutionError.desc;return t&&!m.isEmpty(t)&&(r+=" Details: "+t),new e(d.endpointResolutionError.code,r)},e.createPopupWindowError=function(t){var r=d.popUpWindowError.desc;return t&&!m.isEmpty(t)&&(r+=" Details: "+t),new e(d.popUpWindowError.code,r)},e.createTokenRenewalTimeoutError=function(){return new e(d.tokenRenewalError.code,d.tokenRenewalError.desc)},e.createInvalidIdTokenError=function(t){return new e(d.invalidIdToken.code,d.invalidIdToken.desc+" Given token: "+t)},e.createInvalidStateError=function(t,r){return new e(d.invalidStateError.code,d.invalidStateError.desc+" "+t+", state expected : "+r+".")},e.createNonceMismatchError=function(t,r){return new e(d.nonceMismatchError.code,d.nonceMismatchError.desc+" "+t+", nonce expected : "+r+".")},e.createLoginInProgressError=function(){return new e(d.loginProgressError.code,d.loginProgressError.desc)},e.createAcquireTokenInProgressError=function(){return new e(d.acquireTokenProgressError.code,d.acquireTokenProgressError.desc)},e.createUserCancelledError=function(){return new e(d.userCancelledError.code,d.userCancelledError.desc)},e.createErrorInCallbackFunction=function(t){return new e(d.callbackError.code,d.callbackError.desc+" "+t+".")},e.createUserLoginRequiredError=function(){return new e(d.userLoginRequiredError.code,d.userLoginRequiredError.desc)},e.createUserDoesNotExistError=function(){return new e(d.userDoesNotExistError.code,d.userDoesNotExistError.desc)},e.createClientInfoDecodingError=function(t){return new e(d.clientInfoDecodingError.code,d.clientInfoDecodingError.desc+" Failed with error: "+t)},e.createClientInfoNotPopulatedError=function(t){return new e(d.clientInfoNotPopulatedError.code,d.clientInfoNotPopulatedError.desc+" Failed with error: "+t)},e.createIdTokenNullOrEmptyError=function(t){return new e(d.nullOrEmptyIdToken.code,d.nullOrEmptyIdToken.desc+" Raw ID Token Value: "+t)},e.createIdTokenParsingError=function(t){return new e(d.idTokenNotParsed.code,d.idTokenNotParsed.desc+" Failed with error: "+t)},e.createTokenEncodingError=function(t){return new e(d.tokenEncodingError.code,d.tokenEncodingError.desc+" Attempted to decode: "+t)},e.createInvalidInteractionTypeError=function(){return new e(d.invalidInteractionType.code,d.invalidInteractionType.desc)},e.createCacheParseError=function(t){var r="invalid key: "+t+", "+d.cacheParseError.desc;return new e(d.cacheParseError.code,r)},e.createBlockTokenRequestsInHiddenIframeError=function(){return new e(d.blockTokenRequestsInHiddenIframe.code,d.blockTokenRequestsInHiddenIframe.desc)},e}(D);var v={configurationNotSet:{code:"no_config_set",desc:"Configuration has not been set. Please call the UserAgentApplication constructor with a valid Configuration object."},storageNotSupported:{code:"storage_not_supported",desc:"The value for the cacheLocation is not supported."},noRedirectCallbacksSet:{code:"no_redirect_callbacks",desc:"No redirect callbacks have been set. Please call handleRedirectCallback() with the appropriate function arguments before continuing. More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics."},invalidCallbackObject:{code:"invalid_callback_object",desc:"The object passed for the callback was invalid. More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics."},scopesRequired:{code:"scopes_required",desc:"Scopes are required to obtain an access token."},emptyScopes:{code:"empty_input_scopes_error",desc:"Scopes cannot be passed as empty array."},nonArrayScopes:{code:"nonarray_input_scopes_error",desc:"Scopes cannot be passed as non-array."},invalidPrompt:{code:"invalid_prompt_value",desc:"Supported prompt values are 'login', 'select_account', 'consent' and 'none'"},invalidAuthorityType:{code:"invalid_authority_type",desc:"The given authority is not a valid type of authority supported by MSAL. Please see here for valid authorities: <insert URL here>."},authorityUriInsecure:{code:"authority_uri_insecure",desc:"Authority URIs must use https."},authorityUriInvalidPath:{code:"authority_uri_invalid_path",desc:"Given authority URI is invalid."},unsupportedAuthorityValidation:{code:"unsupported_authority_validation",desc:"The authority validation is not supported for this authority type."},untrustedAuthority:{code:"untrusted_authority",desc:"The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter or set validateAuthority=false."},b2cAuthorityUriInvalidPath:{code:"b2c_authority_uri_invalid_path",desc:"The given URI for the B2C authority is invalid."},b2cKnownAuthoritiesNotSet:{code:"b2c_known_authorities_not_set",desc:"Must set known authorities when validateAuthority is set to True and using B2C"},claimsRequestParsingError:{code:"claims_request_parsing_error",desc:"Could not parse the given claims request object."},emptyRequestError:{code:"empty_request_error",desc:"Request object is required."},invalidCorrelationIdError:{code:"invalid_guid_sent_as_correlationId",desc:"Please set the correlationId as a valid guid"},telemetryConfigError:{code:"telemetry_config_error",desc:"Telemetry config is not configured with required values"},ssoSilentError:{code:"sso_silent_error",desc:"request must contain either sid or login_hint"},invalidAuthorityMetadataError:{code:"authority_metadata_error",desc:"Invalid authorityMetadata. Must be a JSON object containing authorization_endpoint, end_session_endpoint, and issuer fields."}},_=function(o){O(e,o);function e(t,r){var n=o.call(this,t,r)||this;return n.name="ClientConfigurationError",Object.setPrototypeOf(n,e.prototype),n}return e.createNoSetConfigurationError=function(){return new e(v.configurationNotSet.code,""+v.configurationNotSet.desc)},e.createStorageNotSupportedError=function(t){return new e(v.storageNotSupported.code,v.storageNotSupported.desc+" Given location: "+t)},e.createRedirectCallbacksNotSetError=function(){return new e(v.noRedirectCallbacksSet.code,v.noRedirectCallbacksSet.desc)},e.createInvalidCallbackObjectError=function(t){return new e(v.invalidCallbackObject.code,v.invalidCallbackObject.desc+" Given value for callback function: "+t)},e.createEmptyScopesArrayError=function(t){return new e(v.emptyScopes.code,v.emptyScopes.desc+" Given value: "+t+".")},e.createScopesNonArrayError=function(t){return new e(v.nonArrayScopes.code,v.nonArrayScopes.desc+" Given value: "+t+".")},e.createScopesRequiredError=function(t){return new e(v.scopesRequired.code,v.scopesRequired.desc+" Given value: "+t)},e.createInvalidPromptError=function(t){return new e(v.invalidPrompt.code,v.invalidPrompt.desc+" Given value: "+t)},e.createClaimsRequestParsingError=function(t){return new e(v.claimsRequestParsingError.code,v.claimsRequestParsingError.desc+" Given value: "+t)},e.createEmptyRequestError=function(){var t=v.emptyRequestError,r=t.code,n=t.desc;return new e(r,n)},e.createInvalidCorrelationIdError=function(){return new e(v.invalidCorrelationIdError.code,v.invalidCorrelationIdError.desc)},e.createKnownAuthoritiesNotSetError=function(){return new e(v.b2cKnownAuthoritiesNotSet.code,v.b2cKnownAuthoritiesNotSet.desc)},e.createInvalidAuthorityTypeError=function(){return new e(v.invalidAuthorityType.code,v.invalidAuthorityType.desc)},e.createUntrustedAuthorityError=function(t){return new e(v.untrustedAuthority.code,v.untrustedAuthority.desc+" Provided Authority: "+t)},e.createTelemetryConfigError=function(t){var r=v.telemetryConfigError,n=r.code,i=r.desc,a={applicationName:"string",applicationVersion:"string",telemetryEmitter:"function"},s=Object.keys(a).reduce(function(c,u){return t[u]?c:c.concat([u+" ("+a[u]+")"])},[]);return new e(n,i+" mising values: "+s.join(","))},e.createSsoSilentError=function(){return new e(v.ssoSilentError.code,v.ssoSilentError.desc)},e.createInvalidAuthorityMetadataError=function(){return new e(v.invalidAuthorityMetadataError.code,v.invalidAuthorityMetadataError.desc)},e}(E);var N=function(){function o(){}return o.isIntersectingScopes=function(e,t){for(var r=this.trimAndConvertArrayToLowerCase(U(e)),n=this.trimAndConvertArrayToLowerCase(U(t)),i=0;i<n.length;i++)if(r.indexOf(n[i].toLowerCase())>-1)return!0;return!1},o.containsScope=function(e,t){var r=this.trimAndConvertArrayToLowerCase(U(e)),n=this.trimAndConvertArrayToLowerCase(U(t));return n.every(function(i){return r.indexOf(i.toString().toLowerCase())>=0})},o.trimAndConvertToLowerCase=function(e){return e.trim().toLowerCase()},o.trimAndConvertArrayToLowerCase=function(e){var t=this;return e.map(function(r){return t.trimAndConvertToLowerCase(r)})},o.trimScopes=function(e){return e.map(function(t){return t.trim()})},o.removeElement=function(e,t){var r=this.trimAndConvertToLowerCase(t);return e.filter(function(n){return n!==r})},o.parseScope=function(e){var t="";if(e)for(var r=0;r<e.length;++r)t+=r!==e.length-1?e[r]+" ":e[r];return t},o.validateInputScope=function(e,t){if(!e){if(t)throw _.createScopesRequiredError(e);return}if(!Array.isArray(e))throw _.createScopesNonArrayError(e);if(e.length<1&&t)throw _.createEmptyScopesArrayError(e.toString())},o.getScopeFromState=function(e){if(e){var t=e.indexOf(l.resourceDelimiter);if(t>-1&&t+1<e.length)return e.substring(t+1)}return""},o.appendScopes=function(e,t){if(e){var r=t?this.trimAndConvertArrayToLowerCase(U(t)):null,n=this.trimAndConvertArrayToLowerCase(U(e));return r?U(n,r):n}return null},o.onlyContainsOidcScopes=function(e){var t=e.length,r=0;return e.indexOf(l.openidScope)>-1&&(r+=1),e.indexOf(l.profileScope)>-1&&(r+=1),t>0&&t===r},o.containsAnyOidcScopes=function(e){var t=e.indexOf(l.openidScope)>-1,r=e.indexOf(l.profileScope)>-1;return t||r},o.onlyContainsClientId=function(e,t){return!!e&&e.indexOf(t)>-1&&e.length===1},o.appendDefaultScopes=function(e){var t=e;return t.indexOf(l.openidScope)===-1&&t.push(l.openidScope),t.indexOf(l.profileScope)===-1&&t.push(l.profileScope),t},o.removeDefaultScopes=function(e){return e.filter(function(t){return t!==l.openidScope&&t!==l.profileScope})},o.translateClientIdIfSingleScope=function(e,t){return this.onlyContainsClientId(e,t)?l.oidcScopes:e},o}();var f=function(){function o(){}return o.createNavigateUrl=function(e){var t=this.createNavigationUrlString(e),r=e.authorityInstance.AuthorizationEndpoint;r.indexOf("?")<0?r+="?":r+="&";var n=""+r+t.join("&");return n},o.createNavigationUrlString=function(e){var t=N.appendDefaultScopes(e.scopes),r=[];return r.push("response_type="+e.responseType),r.push("scope="+encodeURIComponent(N.parseScope(t))),r.push("client_id="+encodeURIComponent(e.clientId)),r.push("redirect_uri="+encodeURIComponent(e.redirectUri)),r.push("state="+encodeURIComponent(e.state)),r.push("nonce="+encodeURIComponent(e.nonce)),r.push("client_info=1"),r.push("x-client-SKU="+e.xClientSku),r.push("x-client-Ver="+e.xClientVer),e.promptValue&&r.push("prompt="+encodeURIComponent(e.promptValue)),e.claimsValue&&r.push("claims="+encodeURIComponent(e.claimsValue)),e.queryParameters&&r.push(e.queryParameters),e.extraQueryParameters&&r.push(e.extraQueryParameters),r.push("client-request-id="+encodeURIComponent(e.correlationId)),r},o.getCurrentUrl=function(){return window.location.href.split("?")[0].split("#")[0]},o.removeHashFromUrl=function(e){return e.split("#")[0]},o.replaceTenantPath=function(e,t){var r=e.toLowerCase(),n=this.GetUrlComponents(r),i=n.PathSegments;return t&&i.length!==0&&(i[0]===l.common||i[0]===w.ORGANIZATIONS||i[0]===w.CONSUMERS)&&(i[0]=t),this.constructAuthorityUriFromObject(n,i)},o.constructAuthorityUriFromObject=function(e,t){return this.CanonicalizeUri(e.Protocol+"//"+e.HostNameAndPort+"/"+t.join("/"))},o.isCommonAuthority=function(e){var t=this.CanonicalizeUri(e),r=this.GetUrlComponents(t).PathSegments;return r.length!==0&&r[0]===l.common},o.isOrganizationsAuthority=function(e){var t=this.CanonicalizeUri(e),r=this.GetUrlComponents(t).PathSegments;return r.length!==0&&r[0]===w.ORGANIZATIONS},o.isConsumersAuthority=function(e){var t=this.CanonicalizeUri(e),r=this.GetUrlComponents(t).PathSegments;return r.length!==0&&r[0]===w.CONSUMERS},o.GetUrlComponents=function(e){if(!e)throw"Url required";var t=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),r=e.match(t);if(!r||r.length<6)throw"Valid url required";var n={Protocol:r[1],HostNameAndPort:r[4],AbsolutePath:r[5]},i=n.AbsolutePath.split("/");return i=i.filter(function(a){return a&&a.length>0}),n.PathSegments=i,r[6]&&(n.Search=r[6]),r[8]&&(n.Hash=r[8]),n},o.CanonicalizeUri=function(e){if(e){var t=e.toLowerCase();return o.endsWith(t,"/")||(t+="/"),t}return e},o.endsWith=function(e,t){return!e||!t?!1:e.indexOf(t,e.length-t.length)!==-1},o.urlRemoveQueryStringParameter=function(e,t){if(m.isEmpty(e))return e;var r=e,n=new RegExp("(\\&"+t+"=)[^&]+");return r=e.replace(n,""),n=new RegExp("("+t+"=)[^&]+&"),r=e.replace(n,""),n=new RegExp("("+t+"=)[^&]+"),r=e.replace(n,""),r},o.getHashFromUrl=function(e){var t=e.indexOf("#"),r=e.indexOf("#/");return r>-1?e.substring(r+2):t>-1?e.substring(t+1):e},o.urlContainsHash=function(e){var t=o.deserializeHash(e);return t.hasOwnProperty(p.ERROR_DESCRIPTION)||t.hasOwnProperty(p.ERROR)||t.hasOwnProperty(p.ACCESS_TOKEN)||t.hasOwnProperty(p.ID_TOKEN)},o.deserializeHash=function(e){var t=o.getHashFromUrl(e);return b.deserialize(t)},o.getHostFromUri=function(e){var t=String(e).replace(/^(https?:)\/\//,"");return t=t.split("/")[0],t},o}();var Le=function(){function o(e,t,r,n,i){this.authority=f.CanonicalizeUri(e),this.clientId=t,this.scopes=r,this.homeAccountIdentifier=b.base64Encode(n)+"."+b.base64Encode(i)}return o}();var Me=function(){function o(e,t,r,n){this.accessToken=e,this.idToken=t,this.expiresIn=r,this.homeAccountIdentifier=n}return o}();var ne="1.4.18";var X=function(){function o(e,t,r,n,i,a,s){this.authorityInstance=e,this.clientId=t,this.nonce=b.createNewGuid(),this.scopes=i?U(i):l.oidcScopes,this.scopes=N.trimScopes(this.scopes),this.state=a,this.correlationId=s,this.xClientSku="MSAL.JS",this.xClientVer=ne,this.responseType=r,this.redirectUri=n}return Object.defineProperty(o.prototype,"authority",{get:function(){return this.authorityInstance?this.authorityInstance.CanonicalAuthority:null},enumerable:!1,configurable:!0}),o.prototype.populateQueryParams=function(e,t,r,n){var i={};t&&(t.prompt&&(this.promptValue=t.prompt),t.claimsRequest&&(this.claimsValue=t.claimsRequest),o.isSSOParam(t)&&(i=this.constructUnifiedCacheQueryParameter(t,null))),r&&(i=this.constructUnifiedCacheQueryParameter(null,r)),i=this.addHintParameters(e,i);var a=t?t.extraQueryParameters:null;this.queryParameters=o.generateQueryParametersString(i),this.extraQueryParameters=o.generateQueryParametersString(a,n)},o.prototype.constructUnifiedCacheQueryParameter=function(e,t){var r,n,i,a={};if(e)if(e.account){var s=e.account;!((r=s.idTokenClaims)===null||r===void 0)&&r.login_hint?(n=w.LOGIN_HINT,i=s.idTokenClaims.login_hint):s.sid?(n=w.SID,i=s.sid):s.userName&&(n=w.LOGIN_HINT,i=s.userName)}else e.sid?(n=w.SID,i=e.sid):e.loginHint&&(n=w.LOGIN_HINT,i=e.loginHint);else t&&t.hasOwnProperty(l.upn)&&(n=w.ID_TOKEN,i=t.upn);return a=this.addSSOParameter(n,i),a},o.prototype.addHintParameters=function(e,t){var r,n,i=t;return e&&!i[w.SID]&&!i[w.LOGIN_HINT]&&(!((r=e.idTokenClaims)===null||r===void 0)&&r.login_hint?i=this.addSSOParameter(w.LOGIN_HINT,(n=e.idTokenClaims)===null||n===void 0?void 0:n.login_hint,i):e.sid&&this.promptValue===oe.NONE?i=this.addSSOParameter(w.SID,e.sid,i):e.userName&&(i=this.addSSOParameter(w.LOGIN_HINT,e.userName,i))),i},o.prototype.addSSOParameter=function(e,t,r){var n=r||{};if(!t)return n;switch(e){case w.SID:{n[w.SID]=t;break}case w.ID_TOKEN:{n[w.LOGIN_HINT]=t;break}case w.LOGIN_HINT:{n[w.LOGIN_HINT]=t;break}}return n},o.generateQueryParametersString=function(e,t){var r=null;return e&&Object.keys(e).forEach(function(n){n===l.domain_hint&&(t||e[w.SID])||(r?r+="&"+n+"="+encodeURIComponent(e[n]):r=n+"="+encodeURIComponent(e[n]))}),r},o.isSSOParam=function(e){return!!(e&&(e.account||e.sid||e.loginHint))},o.determineResponseType=function(e,t){return N.onlyContainsOidcScopes(t)?Q.id_token:e?this.responseTypeForMatchingAccounts(t):Q.id_token_token},o.responseTypeForMatchingAccounts=function(e){return N.containsAnyOidcScopes(e)?Q.id_token_token:Q.token},o}();var me=function(){function o(){}return o.prototype.sendRequestAsync=function(e,t,r){var n=this;return new Promise(function(i,a){var s=new XMLHttpRequest;if(s.open(t,e,!0),s.onload=function(){(s.status<200||s.status>=300)&&a(n.handleError(s.responseText));var c;try{c=JSON.parse(s.responseText)}catch{a(n.handleError(s.responseText))}var u={statusCode:s.status,body:c};i(u)},s.onerror=function(){a(s.status)},t===se.GET)s.send();else throw"not implemented"})},o.prototype.handleError=function(e){var t;try{if(t=JSON.parse(e),t.error)return t.error;throw e}catch{return e}},o}();var ce=function(){function o(){}return o.setTrustedAuthoritiesFromConfig=function(e,t){e&&!this.getTrustedHostList().length&&t.forEach(function(r){o.TrustedHostList.push(r.toLowerCase())})},o.getAliases=function(e,t,r){return G(this,void 0,void 0,function(){var n,i,a,s;return W(this,function(c){return n=new me,i=se.GET,a=""+xe+e+"oauth2/v2.0/authorize",s=t.createAndStartHttpEvent(r,i,a,"getAliases"),[2,n.sendRequestAsync(a,i,!0).then(function(u){return s.httpResponseStatus=u.statusCode,t.stopEvent(s),u.body.metadata}).catch(function(u){throw s.serverErrorCode=u,t.stopEvent(s),u})]})})},o.setTrustedAuthoritiesFromNetwork=function(e,t,r){return G(this,void 0,void 0,function(){var n,i;return W(this,function(a){switch(a.label){case 0:return[4,this.getAliases(e,t,r)];case 1:return n=a.sent(),n.forEach(function(s){var c=s.aliases;c.forEach(function(u){o.TrustedHostList.push(u.toLowerCase())})}),i=f.GetUrlComponents(e).HostNameAndPort,o.getTrustedHostList().length&&!o.IsInTrustedHostList(i)&&o.TrustedHostList.push(i.toLowerCase()),[2]}})})},o.getTrustedHostList=function(){return this.TrustedHostList},o.IsInTrustedHostList=function(e){return this.TrustedHostList.indexOf(e.toLowerCase())>-1},o.TrustedHostList=[],o}();var ee;(function(o){o[o.Default=0]="Default",o[o.Adfs=1]="Adfs"})(ee||(ee={}));var ve=function(){function o(e,t,r){this.IsValidationEnabled=t,this.CanonicalAuthority=e,this.validateAsUri(),this.tenantDiscoveryResponse=r}return o.isAdfs=function(e){var t=f.GetUrlComponents(e),r=t.PathSegments;return r.length&&r[0].toLowerCase()===l.ADFS},Object.defineProperty(o.prototype,"AuthorityType",{get:function(){return o.isAdfs(this.canonicalAuthority)?ee.Adfs:ee.Default},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"Tenant",{get:function(){return this.CanonicalAuthorityUrlComponents.PathSegments[0]},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"AuthorizationEndpoint",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.AuthorizationEndpoint.replace(/{tenant}|{tenantid}/g,this.Tenant)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"EndSessionEndpoint",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.EndSessionEndpoint.replace(/{tenant}|{tenantid}/g,this.Tenant)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"SelfSignedJwtAudience",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.Issuer.replace(/{tenant}|{tenantid}/g,this.Tenant)},enumerable:!1,configurable:!0}),o.prototype.validateResolved=function(){if(!this.hasCachedMetadata())throw"Please call ResolveEndpointsAsync first"},Object.defineProperty(o.prototype,"CanonicalAuthority",{get:function(){return this.canonicalAuthority},set:function(e){this.canonicalAuthority=f.CanonicalizeUri(e),this.canonicalAuthorityUrlComponents=null},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"CanonicalAuthorityUrlComponents",{get:function(){return this.canonicalAuthorityUrlComponents||(this.canonicalAuthorityUrlComponents=f.GetUrlComponents(this.CanonicalAuthority)),this.canonicalAuthorityUrlComponents},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"DefaultOpenIdConfigurationEndpoint",{get:function(){return this.AuthorityType===ee.Adfs?""+this.CanonicalAuthority+we:this.CanonicalAuthority+"v2.0/"+we},enumerable:!1,configurable:!0}),o.prototype.validateAsUri=function(){var e;try{e=this.CanonicalAuthorityUrlComponents}catch{throw v.invalidAuthorityType}if(!e.Protocol||e.Protocol.toLowerCase()!=="https:")throw v.authorityUriInsecure;if(!e.PathSegments||e.PathSegments.length<1)throw v.authorityUriInvalidPath},o.prototype.DiscoverEndpoints=function(e,t,r){var n=new me,i=se.GET,a=t.createAndStartHttpEvent(r,i,e,"openIdConfigurationEndpoint");return n.sendRequestAsync(e,i,!0).then(function(s){return a.httpResponseStatus=s.statusCode,t.stopEvent(a),{AuthorizationEndpoint:s.body.authorization_endpoint,EndSessionEndpoint:s.body.end_session_endpoint,Issuer:s.body.issuer}}).catch(function(s){throw a.serverErrorCode=s,t.stopEvent(a),s})},o.prototype.resolveEndpointsAsync=function(e,t){return G(this,void 0,void 0,function(){var r,n,i;return W(this,function(a){switch(a.label){case 0:return this.IsValidationEnabled?(r=this.canonicalAuthorityUrlComponents.HostNameAndPort,ce.getTrustedHostList().length!==0?[3,2]:[4,ce.setTrustedAuthoritiesFromNetwork(this.canonicalAuthority,e,t)]):[3,3];case 1:a.sent(),a.label=2;case 2:if(!ce.IsInTrustedHostList(r))throw _.createUntrustedAuthorityError(r);a.label=3;case 3:return n=this.GetOpenIdConfigurationEndpoint(),i=this,[4,this.DiscoverEndpoints(n,e,t)];case 4:return i.tenantDiscoveryResponse=a.sent(),[2,this.tenantDiscoveryResponse]}})})},o.prototype.hasCachedMetadata=function(){return!!(this.tenantDiscoveryResponse&&this.tenantDiscoveryResponse.AuthorizationEndpoint&&this.tenantDiscoveryResponse.EndSessionEndpoint&&this.tenantDiscoveryResponse.Issuer)},o.prototype.GetOpenIdConfigurationEndpoint=function(){return this.DefaultOpenIdConfigurationEndpoint},o}();var ie=function(){function o(e,t){if(!e||m.isEmpty(e)){this.uid="",this.utid="";return}try{var r=b.base64Decode(e),n=JSON.parse(r);n&&(n.hasOwnProperty("uid")&&(this.uid=t?o.stripPolicyFromUid(n.uid,t):n.uid),n.hasOwnProperty("utid")&&(this.utid=n.utid))}catch(i){throw E.createClientInfoDecodingError(i)}}return Object.defineProperty(o.prototype,"uid",{get:function(){return this._uid?this._uid:""},set:function(e){this._uid=e},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"utid",{get:function(){return this._utid?this._utid:""},set:function(e){this._utid=e},enumerable:!1,configurable:!0}),o.createClientInfoFromIdToken=function(e,t){var r={uid:e.subject,utid:""};return new o(b.base64Encode(JSON.stringify(r)),t)},o.stripPolicyFromUid=function(e,t){var r=e.split("-"),n=t.split("/").reverse(),i="";return m.isEmpty(n[0])?n.length>1&&(i=n[1]):i=n[0],r[r.length-1]===i?r.slice(0,r.length-1).join("-"):e},o.prototype.encodeClientInfo=function(){var e=JSON.stringify({uid:this.uid,utid:this.utid});return b.base64Encode(e)},o}();var Y=function(){function o(){}return o.parseExpiresIn=function(e){var t=e||"3599";return parseInt(t,10)},o.now=function(){return Math.round(new Date().getTime()/1e3)},o.relativeNowMs=function(){return window.performance.now()},o}();var ue=function(){function o(){}return o.decodeJwt=function(e){if(m.isEmpty(e))return null;var t=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/,r=t.exec(e);if(!r||r.length<4)return null;var n={header:r[1],JWSPayload:r[2],JWSSig:r[3]};return n},o.validateExpirationIsWithinOffset=function(e,t){var r=t||300;return e&&e>Y.now()+r},o.extractIdToken=function(e){var t=this.decodeJwt(e);if(!t)return null;try{var r=t.JWSPayload,n=b.base64Decode(r);return n?JSON.parse(n):null}catch{}return null},o}();var $=function(){function o(e){if(m.isEmpty(e))throw E.createIdTokenNullOrEmptyError(e);try{this.rawIdToken=e,this.claims=ue.extractIdToken(e),this.claims&&(this.claims.hasOwnProperty("iss")&&(this.issuer=this.claims.iss),this.claims.hasOwnProperty("oid")&&(this.objectId=this.claims.oid),this.claims.hasOwnProperty("sub")&&(this.subject=this.claims.sub),this.claims.hasOwnProperty("tid")&&(this.tenantId=this.claims.tid),this.claims.hasOwnProperty("ver")&&(this.version=this.claims.ver),this.claims.hasOwnProperty("preferred_username")?this.preferredName=this.claims.preferred_username:this.claims.hasOwnProperty("upn")&&(this.preferredName=this.claims.upn),this.claims.hasOwnProperty("name")&&(this.name=this.claims.name),this.claims.hasOwnProperty("nonce")&&(this.nonce=this.claims.nonce),this.claims.hasOwnProperty("exp")&&(this.expiration=this.claims.exp),this.claims.hasOwnProperty("home_oid")&&(this.homeObjectId=this.claims.home_oid),this.claims.hasOwnProperty("sid")&&(this.sid=this.claims.sid),this.claims.hasOwnProperty("cloud_instance_host_name")&&(this.cloudInstance=this.claims.cloud_instance_host_name))}catch(t){throw E.createIdTokenParsingError(t)}}return o}();var He=function(){function o(e,t){this.key=e,this.value=t}return o}();var Ae=function(){function o(e){if(!window)throw D.createNoWindowObjectError("Browser storage class could not find window object");var t=typeof window[e]<"u"&&window[e]!==null;if(!t)throw _.createStorageNotSupportedError(e);this.cacheLocation=e}return o.prototype.setItem=function(e,t,r){window[this.cacheLocation].setItem(e,t),r&&this.setItemCookie(e,t)},o.prototype.getItem=function(e,t){return t&&this.getItemCookie(e)?this.getItemCookie(e):window[this.cacheLocation].getItem(e)},o.prototype.removeItem=function(e){return window[this.cacheLocation].removeItem(e)},o.prototype.clear=function(){return window[this.cacheLocation].clear()},o.prototype.setItemCookie=function(e,t,r){var n=encodeURIComponent(e)+"="+encodeURIComponent(t)+";path=/;";if(r){var i=this.getCookieExpirationTime(r);n+="expires="+i+";"}document.cookie=n},o.prototype.getItemCookie=function(e){for(var t=encodeURIComponent(e)+"=",r=document.cookie.split(";"),n=0;n<r.length;n++){for(var i=r[n];i.charAt(0)===" ";)i=i.substring(1);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}return""},o.prototype.clearItemCookie=function(e){this.setItemCookie(e,"",-1)},o.prototype.getCookieExpirationTime=function(e){var t=new Date,r=new Date(t.getTime()+e*24*60*60*1e3);return r.toUTCString()},o}();var F=function(){function o(){}return o.validateRequest=function(e,t,r,n){if(!t&&!e)throw _.createEmptyRequestError();var i,a;e&&(i=t?N.appendScopes(e.scopes,e.extraScopesToConsent):e.scopes,N.validateInputScope(i,!t),i=N.translateClientIdIfSingleScope(i,r),this.validatePromptParameter(e.prompt),a=this.validateEQParameters(e.extraQueryParameters,e.claimsRequest),this.validateClaimsRequest(e.claimsRequest));var s=this.validateAndGenerateState(e&&e.state,n),c=this.validateAndGenerateCorrelationId(e&&e.correlationId),u=S(S({},e),{extraQueryParameters:a,scopes:i,state:s,correlationId:c});return u},o.validatePromptParameter=function(e){if(e&&[oe.LOGIN,oe.SELECT_ACCOUNT,oe.CONSENT,oe.NONE].indexOf(e)<0)throw _.createInvalidPromptError(e)},o.validateEQParameters=function(e,t){var r=S({},e);return r?(t&&delete r[l.claims],Ue.forEach(function(n){r[n]&&delete r[n]}),r):null},o.validateClaimsRequest=function(e){if(e)try{JSON.parse(e)}catch(t){throw _.createClaimsRequestParsingError(t)}},o.validateAndGenerateState=function(e,t){return m.isEmpty(e)?o.generateLibraryState(t):""+o.generateLibraryState(t)+l.resourceDelimiter+e},o.generateLibraryState=function(e){var t={id:b.createNewGuid(),ts:Y.now(),method:e},r=JSON.stringify(t);return b.base64Encode(r)},o.parseLibraryState=function(e){var t=decodeURIComponent(e).split(l.resourceDelimiter)[0];if(b.isGuid(t))return{id:t,ts:Y.now(),method:l.interactionTypeRedirect};try{var r=b.base64Decode(t),n=JSON.parse(r);return n}catch{throw E.createInvalidStateError(e,null)}},o.validateAndGenerateCorrelationId=function(e){if(e&&!b.isGuid(e))throw _.createInvalidCorrelationIdError();return b.isGuid(e)?e:b.createNewGuid()},o.createRequestSignature=function(e){return""+e.scopes.join(" ").toLowerCase()+l.resourceDelimiter+e.authority},o}();var A=function(o){O(e,o);function e(t,r,n){var i=o.call(this,r)||this;return i.temporaryCache=new Ae(Ne),i.clientId=t,i.rollbackEnabled=!0,i.migrateCacheEntries(n),i}return e.prototype.migrateCacheEntries=function(t){var r=this,n=l.cachePrefix+"."+H.IDTOKEN,i=l.cachePrefix+"."+H.CLIENT_INFO,a=l.cachePrefix+"."+P.ERROR,s=l.cachePrefix+"."+P.ERROR_DESC,c=o.prototype.getItem.call(this,n),u;if(c)try{u=new $(c)}catch{return}if(u&&u.claims&&u.claims.aud===this.clientId){var h=o.prototype.getItem.call(this,i),T=o.prototype.getItem.call(this,a),y=o.prototype.getItem.call(this,s),C=[c,h,T,y],k=[H.IDTOKEN,H.CLIENT_INFO,P.ERROR,P.ERROR_DESC];k.forEach(function(x,V){return r.duplicateCacheEntry(x,C[V],t)})}},e.prototype.duplicateCacheEntry=function(t,r,n){r&&this.setItem(t,r,n)},e.prototype.generateCacheKey=function(t,r){try{return JSON.parse(t),t}catch{return t.indexOf(""+l.cachePrefix)===0||t.indexOf(l.adalIdToken)===0?t:r?l.cachePrefix+"."+this.clientId+"."+t:l.cachePrefix+"."+t}},e.prototype.matchKeyForType=function(t,r,n,i){var a=m.validateAndParseJsonCacheKey(t);if(!a)return null;var s=t.match(r)&&t.match(n),c=!1;switch(i){case p.ACCESS_TOKEN:c=!!t.match(l.scopes);break;case p.ID_TOKEN:c=!t.match(l.scopes);break}return s&&c?a:null},e.prototype.setItem=function(t,r,n){o.prototype.setItem.call(this,this.generateCacheKey(t,!0),r,n),this.rollbackEnabled&&!n&&o.prototype.setItem.call(this,this.generateCacheKey(t,!1),r,n)},e.prototype.getItem=function(t,r){return o.prototype.getItem.call(this,this.generateCacheKey(t,!0),r)},e.prototype.removeItem=function(t){this.temporaryCache.removeItem(this.generateCacheKey(t,!0)),o.prototype.removeItem.call(this,this.generateCacheKey(t,!0)),this.rollbackEnabled&&o.prototype.removeItem.call(this,this.generateCacheKey(t,!1))},e.prototype.setTemporaryItem=function(t,r,n){this.temporaryCache.setItem(this.generateCacheKey(t,!0),r,n)},e.prototype.getTemporaryItem=function(t,r){return this.temporaryCache.getItem(this.generateCacheKey(t,!0),r)},e.prototype.resetCacheItems=function(){var t=window[this.cacheLocation],r;for(r in t)t.hasOwnProperty(r)&&r.indexOf(l.cachePrefix)!==-1&&o.prototype.removeItem.call(this,r)},e.prototype.resetTempCacheItems=function(t){var r=this,n=t&&F.parseLibraryState(t).id,i=this.tokenRenewalInProgress(t),a=window[this.cacheLocation];n&&!i&&Object.keys(a).forEach(function(s){s.indexOf(n)!==-1&&(r.removeItem(s),o.prototype.clearItemCookie.call(r,s))}),this.setInteractionInProgress(!1),this.removeItem(I.REDIRECT_REQUEST)},e.prototype.setItemCookie=function(t,r,n){o.prototype.setItemCookie.call(this,this.generateCacheKey(t,!0),r,n),this.rollbackEnabled&&o.prototype.setItemCookie.call(this,this.generateCacheKey(t,!1),r,n)},e.prototype.clearItemCookie=function(t){o.prototype.clearItemCookie.call(this,this.generateCacheKey(t,!0)),this.rollbackEnabled&&o.prototype.clearItemCookie.call(this,this.generateCacheKey(t,!1))},e.prototype.getItemCookie=function(t){return o.prototype.getItemCookie.call(this,this.generateCacheKey(t,!0))},e.prototype.getAllTokensByType=function(t,r,n){var i=this,a=Object.keys(window[this.cacheLocation]).reduce(function(s,c){var u=i.matchKeyForType(c,t,r,n);if(u){var h=i.getItem(c);if(h)try{var T=new He(u,JSON.parse(h));return s.concat([T])}catch{return s}}return s},[]);return a},e.prototype.getAllAccessTokens=function(t,r){return this.getAllTokensByType(t,r,p.ACCESS_TOKEN)},e.prototype.getAllIdTokens=function(t,r){return this.getAllTokensByType(t,r,p.ID_TOKEN)},e.prototype.getAllTokens=function(t,r){var n=this.getAllAccessTokens(t,r),i=this.getAllIdTokens(t,r);return U(n,i)},e.prototype.isInteractionInProgress=function(t){var r=this.getInteractionInProgress();return t?r===this.clientId:!!r},e.prototype.getInteractionInProgress=function(){return this.getTemporaryItem(this.generateCacheKey(I.INTERACTION_STATUS,!1))},e.prototype.setInteractionInProgress=function(t){if(t){if(this.isInteractionInProgress(!1))throw E.createAcquireTokenInProgressError();this.setTemporaryItem(this.generateCacheKey(I.INTERACTION_STATUS,!1),this.clientId)}else!t&&this.isInteractionInProgress(!0)&&this.removeItem(this.generateCacheKey(I.INTERACTION_STATUS,!1))},e.prototype.tokenRenewalInProgress=function(t){var r=this.getItem(e.generateTemporaryCacheKey(I.RENEW_STATUS,t));return!!(r&&r===l.inProgress)},e.prototype.clearMsalCookie=function(t){var r=this;if(t)this.clearItemCookie(e.generateTemporaryCacheKey(I.NONCE_IDTOKEN,t)),this.clearItemCookie(e.generateTemporaryCacheKey(I.STATE_LOGIN,t)),this.clearItemCookie(e.generateTemporaryCacheKey(I.LOGIN_REQUEST,t)),this.clearItemCookie(e.generateTemporaryCacheKey(I.STATE_ACQ_TOKEN,t));else{var n=document.cookie.split(";");n.forEach(function(i){var a=i.trim().split("=")[0];a.indexOf(l.cachePrefix)>-1&&o.prototype.clearItemCookie.call(r,a)})}},e.generateAcquireTokenAccountKey=function(t,r){var n=F.parseLibraryState(r).id;return""+I.ACQUIRE_TOKEN_ACCOUNT+l.resourceDelimiter+t+l.resourceDelimiter+n},e.generateAuthorityKey=function(t){return e.generateTemporaryCacheKey(I.AUTHORITY,t)},e.generateTemporaryCacheKey=function(t,r){var n=F.parseLibraryState(r).id;return""+t+l.resourceDelimiter+n},e}(Ae);var ae=function(){function o(e,t,r,n,i,a,s){this.accountIdentifier=e,this.homeAccountIdentifier=t,this.userName=r,this.name=n,this.idToken=i,this.idTokenClaims=i,this.sid=a,this.environment=s}return o.createAccount=function(e,t){var r=e.objectId||e.subject,n=t?t.uid:"",i=t?t.utid:"",a;return m.isEmpty(n)||(a=m.isEmpty(i)?b.base64Encode(n):b.base64Encode(n)+"."+b.base64Encode(i)),new o(r,a,e.preferredName,e.name,e.claims,e.sid,e.issuer)},o.compareAccounts=function(e,t){return!e||!t?!1:!!(e.homeAccountIdentifier&&t.homeAccountIdentifier&&e.homeAccountIdentifier===t.homeAccountIdentifier)},o}();var L=function(){function o(){}return o.isInIframe=function(){return window.parent!==window},o.isInPopup=function(){return!!(window.opener&&window.opener!==window)},o.generateFrameName=function(e,t){return""+e+l.resourceDelimiter+t},o.monitorIframeForHash=function(e,t,r,n){return new Promise(function(i,a){var s=Y.relativeNowMs(),c=s+t;n.verbose("monitorWindowForIframe polling started");var u=setInterval(function(){if(Y.relativeNowMs()>c){n.error("monitorIframeForHash unable to find hash in url, timing out"),n.errorPii("monitorIframeForHash polling timed out for url: "+r),clearInterval(u),a(E.createTokenRenewalTimeoutError());return}var h;try{h=e.location.href}catch{}h&&f.urlContainsHash(h)&&(n.verbose("monitorIframeForHash found url in hash"),clearInterval(u),i(e.location.hash))},o.POLLING_INTERVAL_MS)})},o.monitorPopupForHash=function(e,t,r,n){return new Promise(function(i,a){var s=t/o.POLLING_INTERVAL_MS,c=0;n.verbose("monitorWindowForHash polling started");var u=setInterval(function(){if(e.closed){n.error("monitorWindowForHash window closed"),clearInterval(u),a(E.createUserCancelledError());return}var h;try{h=e.location.href}catch{}if(!(!h||h==="about:blank"))if(c++,h&&f.urlContainsHash(h)){n.verbose("monitorPopupForHash found url in hash"),clearInterval(u);var T=e.location.hash;o.clearUrlFragment(e),i(T)}else c>s&&(n.error("monitorPopupForHash unable to find hash in url, timing out"),n.errorPii("monitorPopupForHash polling timed out for url: "+r),clearInterval(u),a(E.createTokenRenewalTimeoutError()))},o.POLLING_INTERVAL_MS)})},o.loadFrame=function(e,t,r,n){var i=this;return n.infoPii("LoadFrame: "+t),new Promise(function(a,s){setTimeout(function(){var c=i.loadFrameSync(e,t,n);if(!c){s("Unable to load iframe with name: "+t);return}a(c)},r)})},o.loadFrameSync=function(e,t,r){var n=o.addHiddenIFrame(t,r);if(n)(n.src===""||n.src==="about:blank")&&(n.src=e,r.infoPii("Frame Name : "+t+" Navigated to: "+e));else return null;return n},o.addHiddenIFrame=function(e,t){if(typeof e>"u")return null;t.info("Add msal iframe to document"),t.infoPii("Add msal frame to document:"+e);var r=document.getElementById(e);if(r)t.verbose("Add msal iframe already exists");else{t.verbose("Add msal iframe does not exist");var n=document.createElement("iframe");n.setAttribute("id",e),n.setAttribute("aria-hidden","true"),n.style.visibility="hidden",n.style.position="absolute",n.style.width=n.style.height="0",n.style.border="0",n.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),r=document.getElementsByTagName("body")[0].appendChild(n)}return r},o.removeHiddenIframe=function(e){document.body===e.parentNode&&document.body.removeChild(e)},o.getIframeWithHash=function(e){var t=document.getElementsByTagName("iframe"),r=Array.apply(null,Array(t.length)).map(function(n,i){return t.item(i)});return r.filter(function(n){try{return n.contentWindow.location.hash===e}catch{return!1}})[0]},o.getPopups=function(){return window.openedWindows||(window.openedWindows=[]),window.openedWindows},o.getPopUpWithHash=function(e){return o.getPopups().filter(function(t){try{return t.location.hash===e}catch{return!1}})[0]},o.trackPopup=function(e){o.getPopups().push(e)},o.closePopups=function(){o.getPopups().forEach(function(e){return e.close()})},o.blockReloadInHiddenIframes=function(){if(f.urlContainsHash(window.location.hash)&&o.isInIframe())throw E.createBlockTokenRequestsInHiddenIframeError()},o.checkIfBackButtonIsPressed=function(e){var t=e.getItem(I.REDIRECT_REQUEST);if(t&&!f.urlContainsHash(window.location.hash)){var r=t.split(l.resourceDelimiter);r.shift();var n=r.length>0?r.join(l.resourceDelimiter):null;e.resetTempCacheItems(n)}},o.clearUrlFragment=function(e){e.location.hash="",typeof e.history.replaceState=="function"&&e.history.replaceState(null,null,""+e.location.pathname+e.location.search)},o.POLLING_INTERVAL_MS=50,o}();var ye=function(){function o(){}return o.setResponseIdToken=function(e,t){if(e){if(!t)return e}else return null;var r=Number(t.expiration);return r&&!e.expiresOn&&(e.expiresOn=new Date(r*1e3)),S(S({},e),{idToken:t,idTokenClaims:t.claims,uniqueId:t.objectId||t.subject,tenantId:t.tenantId})},o.buildAuthResponse=function(e,t,r,n,i,a){switch(r.responseType){case Q.id_token:var s=S(S({},t),{tokenType:p.ID_TOKEN,account:n,scopes:i,accountState:a});return s=o.setResponseIdToken(s,e),s.idToken?s:null;case Q.id_token_token:var c=o.setResponseIdToken(t,e);return c&&c.accessToken&&c.idToken?c:null;case Q.token:var u=o.setResponseIdToken(t,e);return u;default:return null}},o}();var z=function(){function o(){}return o.saveMetadataFromNetwork=function(e,t,r){return G(this,void 0,void 0,function(){var n;return W(this,function(i){switch(i.label){case 0:return[4,e.resolveEndpointsAsync(t,r)];case 1:return n=i.sent(),this.metadataMap.set(e.CanonicalAuthority,n),[2,n]}})})},o.getMetadata=function(e){return this.metadataMap.get(e)},o.saveMetadataFromConfig=function(e,t){try{if(t){var r=JSON.parse(t);if(!r.authorization_endpoint||!r.end_session_endpoint||!r.issuer)throw _.createInvalidAuthorityMetadataError();this.metadataMap.set(e,{AuthorizationEndpoint:r.authorization_endpoint,EndSessionEndpoint:r.end_session_endpoint,Issuer:r.issuer})}}catch{throw _.createInvalidAuthorityMetadataError()}},o.CreateInstance=function(e,t,r){return m.isEmpty(e)?null:(r&&this.saveMetadataFromConfig(e,r),new ve(e,t,this.metadataMap.get(e)))},o.metadataMap=new Map,o}();var M;(function(o){o[o.Error=0]="Error",o[o.Warning=1]="Warning",o[o.Info=2]="Info",o[o.Verbose=3]="Verbose"})(M||(M={}));var De=function(){function o(e,t){t===void 0&&(t={}),this.level=M.Info;var r=t.correlationId,n=r===void 0?"":r,i=t.level,a=i===void 0?M.Info:i,s=t.piiLoggingEnabled,c=s===void 0?!1:s;this.localCallback=e,this.correlationId=n,this.level=a,this.piiLoggingEnabled=c}return o.prototype.logMessage=function(e,t,r){if(!(e>this.level||!this.piiLoggingEnabled&&r)){var n=new Date().toUTCString(),i;m.isEmpty(this.correlationId)?i=n+":"+ne+"-"+M[e]+(r?"-pii":"")+" "+t:i=n+":"+this.correlationId+"-"+ne+"-"+M[e]+(r?"-pii":"")+" "+t,this.executeCallback(e,i,r)}},o.prototype.executeCallback=function(e,t,r){this.localCallback&&this.localCallback(e,t,r)},o.prototype.error=function(e){this.logMessage(M.Error,e,!1)},o.prototype.errorPii=function(e){this.logMessage(M.Error,e,!0)},o.prototype.warning=function(e){this.logMessage(M.Warning,e,!1)},o.prototype.warningPii=function(e){this.logMessage(M.Warning,e,!0)},o.prototype.info=function(e){this.logMessage(M.Info,e,!1)},o.prototype.infoPii=function(e){this.logMessage(M.Info,e,!0)},o.prototype.verbose=function(e){this.logMessage(M.Verbose,e,!1)},o.prototype.verbosePii=function(e){this.logMessage(M.Verbose,e,!0)},o.prototype.isPiiLoggingEnabled=function(){return this.piiLoggingEnabled},o}();var Xe=6e3,$e=300,Ze=500,et={clientId:"",authority:null,validateAuthority:!0,authorityMetadata:"",knownAuthorities:[],redirectUri:function(){return f.getCurrentUrl()},postLogoutRedirectUri:function(){return f.getCurrentUrl()},navigateToLoginRequestUrl:!0},tt={cacheLocation:"sessionStorage",storeAuthStateInCookie:!1},rt={logger:new De(null),loadFrameTimeout:Xe,tokenRenewalOffsetSeconds:$e,navigateFrameWait:Ze},ot={isAngular:!1,unprotectedResources:new Array,protectedResourceMap:new Map};function Fe(o){var e=o.auth,t=o.cache,r=t===void 0?{}:t,n=o.system,i=n===void 0?{}:n,a=o.framework,s=a===void 0?{}:a,c={auth:S(S({},et),e),cache:S(S({},tt),r),system:S(S({},rt),i),framework:S(S({},ot),s)};return c}var _e={serverUnavailable:{code:"server_unavailable",desc:"Server is temporarily unavailable."},unknownServerError:{code:"unknown_server_error"}},Ee=function(o){O(e,o);function e(t,r){var n=o.call(this,t,r)||this;return n.name="ServerError",Object.setPrototypeOf(n,e.prototype),n}return e.createServerUnavailableError=function(){return new e(_e.serverUnavailable.code,_e.serverUnavailable.desc)},e.createUnknownServerError=function(t){return new e(_e.unknownServerError.code,t)},e}(D);var le={interactionRequired:{code:"interaction_required"},consentRequired:{code:"consent_required"},loginRequired:{code:"login_required"}},Te=function(o){O(e,o);function e(t,r){var n=o.call(this,t,r)||this;return n.name="InteractionRequiredAuthError",Object.setPrototypeOf(n,e.prototype),n}return e.isInteractionRequiredError=function(t){var r=[le.interactionRequired.code,le.consentRequired.code,le.loginRequired.code];return t&&r.indexOf(t)>-1},e.createLoginRequiredAuthError=function(t){return new e(le.loginRequired.code,t)},e.createInteractionRequiredAuthError=function(t){return new e(le.interactionRequired.code,t)},e.createConsentRequiredAuthError=function(t){return new e(le.consentRequired.code,t)},e}(Ee);function pe(o){return{uniqueId:"",tenantId:"",tokenType:"",idToken:null,idTokenClaims:null,accessToken:"",scopes:null,expiresOn:null,account:null,accountState:o,fromCache:!1}}var Ke="msal.",ke="event_name",qe="start_time",Re="elapsed_time",J={MsalCorrelationIdConstStrKey:"Microsoft.MSAL.correlation_id",ApiTelemIdConstStrKey:"msal.api_telem_id",ApiIdConstStrKey:"msal.api_id",BrokerAppConstStrKey:"Microsoft_MSAL_broker_app",CacheEventCountConstStrKey:"Microsoft_MSAL_cache_event_count",HttpEventCountTelemetryBatchKey:"Microsoft_MSAL_http_event_count",IdpConstStrKey:"Microsoft_MSAL_idp",IsSilentTelemetryBatchKey:"",IsSuccessfulConstStrKey:"Microsoft_MSAL_is_successful",ResponseTimeConstStrKey:"Microsoft_MSAL_response_time",TenantIdConstStrKey:"Microsoft_MSAL_tenant_id",UiEventCountTelemetryBatchKey:"Microsoft_MSAL_ui_event_count"},je="<tenant>";var de=function(o){var e=f.GetUrlComponents(o);if(ve.isAdfs(o))return o;var t=e.PathSegments;if(t&&t.length>=2){var r=t[1]==="tfp"?2:1;r<t.length&&(t[r]=je)}return e.Protocol+"//"+e.HostNameAndPort+"/"+t.join("/")},Ie=function(o){return b.base64Encode(o)},g=function(o){return""+Ke+(o||"")},Ge=function(){return!!(typeof window<"u"&&"performance"in window&&window.performance.mark&&window.performance.measure)},We=function(o,e,t){Ge()&&(window.performance.mark(t),window.performance.measure(o,e,t),window.performance.clearMeasures(o),window.performance.clearMarks(e),window.performance.clearMarks(t))},Be=function(o){Ge()&&window.performance.mark(o)};var nt=function(){function o(e,t,r){var n;this.eventId=b.createNewGuid(),this.label=r,this.event=(n={},n[g(ke)]=e,n[g(Re)]=-1,n[""+J.MsalCorrelationIdConstStrKey]=t,n)}return o.prototype.setElapsedTime=function(e){this.event[g(Re)]=e},o.prototype.stop=function(){this.setElapsedTime(+Date.now()-+this.startTimestamp),We(this.displayName,this.perfStartMark,this.perfEndMark)},o.prototype.start=function(){this.startTimestamp=Date.now(),this.event[g(qe)]=this.startTimestamp,Be(this.perfStartMark)},Object.defineProperty(o.prototype,"telemetryCorrelationId",{get:function(){return this.event[""+J.MsalCorrelationIdConstStrKey]},set:function(e){this.event[""+J.MsalCorrelationIdConstStrKey]=e},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"eventName",{get:function(){return this.event[g(ke)]},enumerable:!1,configurable:!0}),o.prototype.get=function(){return S(S({},this.event),{eventId:this.eventId})},Object.defineProperty(o.prototype,"key",{get:function(){return this.telemetryCorrelationId+"_"+this.eventId+"-"+this.eventName},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"displayName",{get:function(){return"Msal-"+this.label+"-"+this.telemetryCorrelationId},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"perfStartMark",{get:function(){return"start-"+this.key},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"perfEndMark",{get:function(){return"end-"+this.key},enumerable:!1,configurable:!0}),o}(),he=nt;var it=function(o){O(e,o);function e(t,r,n,i){var a=o.call(this,g("default_event"),r,"DefaultEvent")||this;return a.event[g("client_id")]=n,a.event[g("sdk_plaform")]=t.sdk,a.event[g("sdk_version")]=t.sdkVersion,a.event[g("application_name")]=t.applicationName,a.event[g("application_version")]=t.applicationVersion,a.event[g("effective_connection_speed")]=t.networkInformation&&t.networkInformation.connectionSpeed,a.event[""+J.UiEventCountTelemetryBatchKey]=a.getEventCount(g("ui_event"),i),a.event[""+J.HttpEventCountTelemetryBatchKey]=a.getEventCount(g("http_event"),i),a.event[""+J.CacheEventCountConstStrKey]=a.getEventCount(g("cache_event"),i),a}return e.prototype.getEventCount=function(t,r){return r[t]?r[t]:0},e}(he),Ve=it;var te,Z={AUTHORITY:g("authority"),AUTHORITY_TYPE:g("authority_type"),PROMPT:g("ui_behavior"),TENANT_ID:g("tenant_id"),USER_ID:g("user_id"),WAS_SUCESSFUL:g("was_successful"),API_ERROR_CODE:g("api_error_code"),LOGIN_HINT:g("login_hint")},re;(function(o){o[o.AcquireTokenRedirect=2001]="AcquireTokenRedirect",o[o.AcquireTokenSilent=2002]="AcquireTokenSilent",o[o.AcquireTokenPopup=2003]="AcquireTokenPopup",o[o.LoginRedirect=2004]="LoginRedirect",o[o.LoginPopup=2005]="LoginPopup",o[o.Logout=2006]="Logout"})(re||(re={}));var K;(function(o){o.AcquireTokenRedirect="AcquireTokenRedirect",o.AcquireTokenSilent="AcquireTokenSilent",o.AcquireTokenPopup="AcquireTokenPopup",o.LoginRedirect="LoginRedirect",o.LoginPopup="LoginPopup",o.Logout="Logout"})(K||(K={}));var at=(te={},te[K.AcquireTokenSilent]=re.AcquireTokenSilent,te[K.AcquireTokenPopup]=re.AcquireTokenPopup,te[K.AcquireTokenRedirect]=re.AcquireTokenRedirect,te[K.LoginPopup]=re.LoginPopup,te[K.LoginRedirect]=re.LoginRedirect,te[K.Logout]=re.Logout,te),st=function(o){O(e,o);function e(t,r,n){var i=o.call(this,g("api_event"),t,n)||this;return n&&(i.apiCode=at[n],i.apiEventIdentifier=n),i.piiEnabled=r,i}return Object.defineProperty(e.prototype,"apiEventIdentifier",{set:function(t){this.event[J.ApiTelemIdConstStrKey]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"apiCode",{set:function(t){this.event[J.ApiIdConstStrKey]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"authority",{set:function(t){this.event[Z.AUTHORITY]=de(t).toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"apiErrorCode",{set:function(t){this.event[Z.API_ERROR_CODE]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tenantId",{set:function(t){this.event[Z.TENANT_ID]=this.piiEnabled&&t?Ie(t):null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"accountId",{set:function(t){this.event[Z.USER_ID]=this.piiEnabled&&t?Ie(t):null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wasSuccessful",{get:function(){return this.event[Z.WAS_SUCESSFUL]===!0},set:function(t){this.event[Z.WAS_SUCESSFUL]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loginHint",{set:function(t){this.event[Z.LOGIN_HINT]=this.piiEnabled&&t?Ie(t):null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"authorityType",{set:function(t){this.event[Z.AUTHORITY_TYPE]=t.toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"promptType",{set:function(t){this.event[Z.PROMPT]=t.toLowerCase()},enumerable:!1,configurable:!0}),e}(he),Qe=st;var B={HTTP_PATH:g("http_path"),USER_AGENT:g("user_agent"),QUERY_PARAMETERS:g("query_parameters"),API_VERSION:g("api_version"),RESPONSE_CODE:g("response_code"),O_AUTH_ERROR_CODE:g("oauth_error_code"),HTTP_METHOD:g("http_method"),REQUEST_ID_HEADER:g("request_id_header"),SPE_INFO:g("spe_info"),SERVER_ERROR_CODE:g("server_error_code"),SERVER_SUB_ERROR_CODE:g("server_sub_error_code"),URL:g("url")},ct=function(o){O(e,o);function e(t,r){return o.call(this,g("http_event"),t,r)||this}return Object.defineProperty(e.prototype,"url",{set:function(t){var r=de(t);this.event[B.URL]=r&&r.toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"httpPath",{set:function(t){this.event[B.HTTP_PATH]=de(t).toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userAgent",{set:function(t){this.event[B.USER_AGENT]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"queryParams",{set:function(t){this.event[B.QUERY_PARAMETERS]=X.generateQueryParametersString(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"apiVersion",{set:function(t){this.event[B.API_VERSION]=t.toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"httpResponseStatus",{set:function(t){this.event[B.RESPONSE_CODE]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"oAuthErrorCode",{set:function(t){this.event[B.O_AUTH_ERROR_CODE]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"httpMethod",{set:function(t){this.event[B.HTTP_METHOD]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"requestIdHeader",{set:function(t){this.event[B.REQUEST_ID_HEADER]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"speInfo",{set:function(t){this.event[B.SPE_INFO]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"serverErrorCode",{set:function(t){this.event[B.SERVER_ERROR_CODE]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"serverSubErrorCode",{set:function(t){this.event[B.SERVER_SUB_ERROR_CODE]=t},enumerable:!1,configurable:!0}),e}(he),ze=ct;var ut=function(){function o(e,t,r){this.completedEvents={},this.inProgressEvents={},this.eventCountByCorrelationId={},this.onlySendFailureTelemetry=!1,this.telemetryPlatform=S({sdk:l.libraryName,sdkVersion:ne,networkInformation:{connectionSpeed:typeof navigator<"u"&&navigator.connection&&navigator.connection.effectiveType}},e.platform),this.clientId=e.clientId,this.onlySendFailureTelemetry=e.onlySendFailureTelemetry,this.telemetryEmitter=t,this.logger=r}return o.getTelemetrymanagerStub=function(e,t){var r="UnSetStub",n="0.0",i=function(){},a={applicationName:r,applicationVersion:n},s={platform:a,clientId:e};return new this(s,i,t)},o.prototype.startEvent=function(e){this.logger.verbose("Telemetry Event started: "+e.key),this.telemetryEmitter&&(e.start(),this.inProgressEvents[e.key]=e)},o.prototype.stopEvent=function(e){if(this.logger.verbose("Telemetry Event stopped: "+e.key),!(!this.telemetryEmitter||!this.inProgressEvents[e.key])){e.stop(),this.incrementEventCount(e);var t=this.completedEvents[e.telemetryCorrelationId];this.completedEvents[e.telemetryCorrelationId]=U(t||[],[e]),delete this.inProgressEvents[e.key]}},o.prototype.flush=function(e){var t=this;if(this.logger.verbose("Flushing telemetry events: "+e),!(!this.telemetryEmitter||!this.completedEvents[e])){var r=this.getOrphanedEvents(e);r.forEach(function(c){return t.incrementEventCount(c)});var n=U(this.completedEvents[e],r);delete this.completedEvents[e];var i=this.eventCountByCorrelationId[e];if(delete this.eventCountByCorrelationId[e],!(!n||!n.length)){var a=new Ve(this.telemetryPlatform,e,this.clientId,i),s=U(n,[a]);this.telemetryEmitter(s.map(function(c){return c.get()}))}}},o.prototype.createAndStartApiEvent=function(e,t){var r=new Qe(e,this.logger.isPiiLoggingEnabled(),t);return this.startEvent(r),r},o.prototype.stopAndFlushApiEvent=function(e,t,r,n){t.wasSuccessful=r,n&&(t.apiErrorCode=n),this.stopEvent(t),this.flush(e)},o.prototype.createAndStartHttpEvent=function(e,t,r,n){var i=new ze(e,n);return i.url=r,i.httpMethod=t,this.startEvent(i),i},o.prototype.incrementEventCount=function(e){var t,r=e.eventName,n=this.eventCountByCorrelationId[e.telemetryCorrelationId];n?n[r]=n[r]?n[r]+1:1:this.eventCountByCorrelationId[e.telemetryCorrelationId]=(t={},t[r]=1,t)},o.prototype.getOrphanedEvents=function(e){var t=this;return Object.keys(this.inProgressEvents).reduce(function(r,n){if(n.indexOf(e)!==-1){var i=t.inProgressEvents[n];return delete t.inProgressEvents[n],U(r,[i])}return r},[])},o}(),Oe=ut;var be=function(){function o(){}return o.filterTokenCacheItemsByScope=function(e,t){return e.filter(function(r){var n=r.key.scopes.split(" "),i=N.removeDefaultScopes(t);return i.length===0?N.containsScope(n,t):N.containsScope(n,i)})},o.filterTokenCacheItemsByAuthority=function(e,t){return e.filter(function(r){return f.CanonicalizeUri(r.key.authority)===t})},o.filterTokenCacheItemsByDomain=function(e,t){return e.filter(function(r){var n=f.GetUrlComponents(r.key.authority).HostNameAndPort;return n===t})},o}();var lt="https://login.microsoftonline.com/common",Pe=function(){function o(e){this.authResponseCallback=null,this.tokenReceivedCallback=null,this.errorReceivedCallback=null,this.config=Fe(e),this.logger=this.config.system.logger,this.clientId=this.config.auth.clientId,this.inCookie=this.config.cache.storeAuthStateInCookie,this.telemetryManager=this.getTelemetryManagerFromConfig(this.config.system.telemetry,this.clientId),ce.setTrustedAuthoritiesFromConfig(this.config.auth.validateAuthority,this.config.auth.knownAuthorities),z.saveMetadataFromConfig(this.config.auth.authority,this.config.auth.authorityMetadata),this.authority=this.config.auth.authority||lt,this.cacheStorage=new A(this.clientId,this.config.cache.cacheLocation,this.inCookie),window.activeRenewals||(window.activeRenewals={}),window.renewStates||(window.renewStates=[]),window.callbackMappedToRenewStates||(window.callbackMappedToRenewStates={}),window.promiseMappedToRenewStates||(window.promiseMappedToRenewStates={}),window.msal=this;var t=window.location.hash,r=f.urlContainsHash(t);if(L.checkIfBackButtonIsPressed(this.cacheStorage),r&&this.cacheStorage.isInteractionInProgress(!0)){var n=this.getResponseState(t);n.method===l.interactionTypeRedirect&&this.handleRedirectAuthenticationResponse(t)}}return Object.defineProperty(o.prototype,"authority",{get:function(){return this.authorityInstance.CanonicalAuthority},set:function(e){this.authorityInstance=z.CreateInstance(e,this.config.auth.validateAuthority)},enumerable:!1,configurable:!0}),o.prototype.getAuthorityInstance=function(){return this.authorityInstance},o.prototype.handleRedirectCallback=function(e,t){if(!e)throw _.createInvalidCallbackObjectError(e);t?(this.tokenReceivedCallback=e,this.errorReceivedCallback=t,this.logger.warning("This overload for callback is deprecated - please change the format of the callbacks to a single callback as shown: (err: AuthError, response: AuthResponse).")):this.authResponseCallback=e,this.redirectError?this.authErrorHandler(l.interactionTypeRedirect,this.redirectError,this.redirectResponse):this.redirectResponse&&this.authResponseHandler(l.interactionTypeRedirect,this.redirectResponse)},o.prototype.urlContainsHash=function(e){return this.logger.verbose("UrlContainsHash has been called"),f.urlContainsHash(e)},o.prototype.authResponseHandler=function(e,t,r){if(this.logger.verbose("AuthResponseHandler has been called"),this.cacheStorage.setInteractionInProgress(!1),e===l.interactionTypeRedirect)this.logger.verbose("Interaction type is redirect"),this.errorReceivedCallback?(this.logger.verbose("Two callbacks were provided to handleRedirectCallback, calling success callback with response"),this.tokenReceivedCallback(t)):this.authResponseCallback&&(this.logger.verbose("One callback was provided to handleRedirectCallback, calling authResponseCallback with response"),this.authResponseCallback(null,t));else if(e===l.interactionTypePopup)this.logger.verbose("Interaction type is popup, resolving"),r(t);else throw E.createInvalidInteractionTypeError()},o.prototype.authErrorHandler=function(e,t,r,n){if(this.logger.verbose("AuthErrorHandler has been called"),this.cacheStorage.setInteractionInProgress(!1),e===l.interactionTypeRedirect)if(this.logger.verbose("Interaction type is redirect"),this.errorReceivedCallback)this.logger.verbose("Two callbacks were provided to handleRedirectCallback, calling error callback"),this.errorReceivedCallback(t,r.accountState);else if(this.authResponseCallback)this.logger.verbose("One callback was provided to handleRedirectCallback, calling authResponseCallback with error"),this.authResponseCallback(t,r);else throw this.logger.verbose("handleRedirectCallback has not been called and no callbacks are registered, throwing error"),t;else if(e===l.interactionTypePopup)this.logger.verbose("Interaction type is popup, rejecting"),n(t);else throw E.createInvalidInteractionTypeError()},o.prototype.loginRedirect=function(e){this.logger.verbose("LoginRedirect has been called");var t=F.validateRequest(e,!0,this.clientId,l.interactionTypeRedirect);this.acquireTokenInteractive(l.interactionTypeRedirect,!0,t,null,null)},o.prototype.acquireTokenRedirect=function(e){this.logger.verbose("AcquireTokenRedirect has been called");var t=F.validateRequest(e,!1,this.clientId,l.interactionTypeRedirect);this.acquireTokenInteractive(l.interactionTypeRedirect,!1,t,null,null)},o.prototype.loginPopup=function(e){var t=this;this.logger.verbose("LoginPopup has been called");var r=F.validateRequest(e,!0,this.clientId,l.interactionTypePopup),n=this.telemetryManager.createAndStartApiEvent(r.correlationId,K.LoginPopup);return new Promise(function(i,a){t.acquireTokenInteractive(l.interactionTypePopup,!0,r,i,a)}).then(function(i){return t.logger.verbose("Successfully logged in"),t.telemetryManager.stopAndFlushApiEvent(r.correlationId,n,!0),i}).catch(function(i){throw t.cacheStorage.resetTempCacheItems(r.state),t.telemetryManager.stopAndFlushApiEvent(r.correlationId,n,!1,i.errorCode),i})},o.prototype.acquireTokenPopup=function(e){var t=this;this.logger.verbose("AcquireTokenPopup has been called");var r=F.validateRequest(e,!1,this.clientId,l.interactionTypePopup),n=this.telemetryManager.createAndStartApiEvent(r.correlationId,K.AcquireTokenPopup);return new Promise(function(i,a){t.acquireTokenInteractive(l.interactionTypePopup,!1,r,i,a)}).then(function(i){return t.logger.verbose("Successfully acquired token"),t.telemetryManager.stopAndFlushApiEvent(r.correlationId,n,!0),i}).catch(function(i){throw t.cacheStorage.resetTempCacheItems(r.state),t.telemetryManager.stopAndFlushApiEvent(r.correlationId,n,!1,i.errorCode),i})},o.prototype.acquireTokenInteractive=function(e,t,r,n,i){var a=this;this.logger.verbose("AcquireTokenInteractive has been called"),L.blockReloadInHiddenIframes();try{this.cacheStorage.setInteractionInProgress(!0)}catch{var s=t?E.createLoginInProgressError():E.createAcquireTokenInProgressError(),c=pe(this.getAccountState(r.state));this.cacheStorage.resetTempCacheItems(r.state),this.authErrorHandler(e,s,c,i);return}e===l.interactionTypeRedirect&&this.cacheStorage.setItem(I.REDIRECT_REQUEST,""+l.inProgress+l.resourceDelimiter+r.state);var u;if(r&&r.account&&!t?(u=r.account,this.logger.verbose("Account set from request")):(u=this.getAccount(),this.logger.verbose("Account set from MSAL Cache")),!u&&!X.isSSOParam(r))if(t){var h=this.extractADALIdToken();if(h&&!r.scopes){this.logger.info("ADAL's idToken exists. Extracting login information from ADAL's idToken");var T=this.buildIDTokenRequest(r);this.silentLogin=!0,this.acquireTokenSilent(T).then(function(y){a.silentLogin=!1,a.logger.info("Unified cache call is successful"),a.authResponseHandler(e,y,n)},function(y){a.silentLogin=!1,a.logger.error("Error occurred during unified cache ATS: "+y),a.acquireTokenHelper(null,e,t,r,n,i)})}else this.logger.verbose("Login call but no token found, proceed to login"),this.acquireTokenHelper(null,e,t,r,n,i)}else{this.logger.verbose("AcquireToken call, no context or account given"),this.logger.info("User login is required");var c=pe(this.getAccountState(r.state));this.cacheStorage.resetTempCacheItems(r.state),this.authErrorHandler(e,E.createUserLoginRequiredError(),c,i);return}else this.logger.verbose("User session exists, login not required"),this.acquireTokenHelper(u,e,t,r,n,i)},o.prototype.acquireTokenHelper=function(e,t,r,n,i,a){return G(this,void 0,void 0,function(){var s,c,u,h,T,y,C,k,x,V,q;return W(this,function(R){switch(R.label){case 0:this.logger.verbose("AcquireTokenHelper has been called"),this.logger.verbose("Interaction type: "+t+". isLoginCall: "+r),s=n.scopes?n.scopes.join(" ").toLowerCase():l.oidcScopes.join(" "),this.logger.verbosePii("Request signature: "+s),u=n&&n.authority?z.CreateInstance(n.authority,this.config.auth.validateAuthority,n.authorityMetadata):this.authorityInstance,R.label=1;case 1:return R.trys.push([1,11,,12]),u.hasCachedMetadata()?[3,3]:(this.logger.verbose("No cached metadata for authority"),[4,z.saveMetadataFromNetwork(u,this.telemetryManager,n.correlationId)]);case 2:return R.sent(),[3,4];case 3:this.logger.verbose("Cached metadata found for authority"),R.label=4;case 4:if(T=r?Q.id_token:this.getTokenType(e,n.scopes),y=n.redirectStartPage||window.location.href,c=new X(u,this.clientId,T,this.getRedirectUri(n&&n.redirectUri),n.scopes,n.state,n.correlationId),this.logger.verbose("Finished building server authentication request"),this.updateCacheEntries(c,e,r,y),this.logger.verbose("Updating cache entries"),c.populateQueryParams(e,n),this.logger.verbose("Query parameters populated from account"),C=f.createNavigateUrl(c)+l.response_mode_fragment,t===l.interactionTypeRedirect)r?this.logger.verbose("Interaction type redirect but login call is true. State not cached"):(this.cacheStorage.setItem(A.generateTemporaryCacheKey(I.STATE_ACQ_TOKEN,n.state),c.state,this.inCookie),this.logger.verbose("State cached for redirect"),this.logger.verbosePii("State cached: "+c.state));else if(t===l.interactionTypePopup)window.renewStates.push(c.state),window.requestType=r?l.login:l.renewToken,this.logger.verbose("State saved to window"),this.logger.verbosePii("State saved: "+c.state),this.registerCallback(c.state,s,i,a);else throw this.logger.verbose("Invalid interaction error. State not cached"),E.createInvalidInteractionTypeError();if(t!==l.interactionTypePopup)return[3,9];this.logger.verbose("Interaction type is popup. Generating popup window");try{h=this.openPopup(C,"msal",l.popUpWidth,l.popUpHeight),L.trackPopup(h)}catch{if(this.logger.info(d.popUpWindowError.code+":"+d.popUpWindowError.desc),this.cacheStorage.setItem(P.ERROR,d.popUpWindowError.code),this.cacheStorage.setItem(P.ERROR_DESC,d.popUpWindowError.desc),a)return a(E.createPopupWindowError()),[2]}if(!h)return[3,8];R.label=5;case 5:return R.trys.push([5,7,,8]),[4,L.monitorPopupForHash(h,this.config.system.loadFrameTimeout,C,this.logger)];case 6:return k=R.sent(),this.handleAuthenticationResponse(k),this.cacheStorage.setInteractionInProgress(!1),this.logger.info("Closing popup window"),this.config.framework.isAngular&&this.broadcast("msal:popUpHashChanged",k),L.closePopups(),[3,8];case 7:return x=R.sent(),a&&a(x),this.config.framework.isAngular?this.broadcast("msal:popUpClosed",x.errorCode+l.resourceDelimiter+x.errorMessage):(this.cacheStorage.setInteractionInProgress(!1),h.close()),[3,8];case 8:return[3,10];case 9:n.onRedirectNavigate?(this.logger.verbose("Invoking onRedirectNavigate callback"),V=n.onRedirectNavigate(C),V!==!1?(this.logger.verbose("onRedirectNavigate did not return false, navigating"),this.navigateWindow(C)):this.logger.verbose("onRedirectNavigate returned false, stopping navigation")):(this.logger.verbose("Navigating window to urlNavigate"),this.navigateWindow(C)),R.label=10;case 10:return[3,12];case 11:return q=R.sent(),this.logger.error(q),this.cacheStorage.resetTempCacheItems(n.state),this.authErrorHandler(t,E.createEndpointResolutionError(q.toString),pe(n.state),a),h&&h.close(),[3,12];case 12:return[2]}})})},o.prototype.ssoSilent=function(e){if(this.logger.verbose("ssoSilent has been called"),!e)throw _.createEmptyRequestError();if(!e.sid&&!e.loginHint)throw _.createSsoSilentError();return this.acquireTokenSilent(S(S({},e),{scopes:l.oidcScopes}))},o.prototype.acquireTokenSilent=function(e){var t=this;this.logger.verbose("AcquireTokenSilent has been called");var r=F.validateRequest(e,!1,this.clientId,l.interactionTypeSilent),n=this.telemetryManager.createAndStartApiEvent(r.correlationId,K.AcquireTokenSilent),i=F.createRequestSignature(r);return new Promise(function(a,s){return G(t,void 0,void 0,function(){var c,u,h,T,y,C,k,x,V,q,R;return W(this,function(j){switch(j.label){case 0:if(L.blockReloadInHiddenIframes(),c=r.scopes.join(" ").toLowerCase(),this.logger.verbosePii("Serialized scopes: "+c),r.account?(u=r.account,this.logger.verbose("Account set from request")):(u=this.getAccount(),this.logger.verbose("Account set from MSAL Cache")),h=this.cacheStorage.getItem(l.adalIdToken),!u&&!(r.sid||r.loginHint)&&m.isEmpty(h))return this.logger.info("User login is required"),[2,s(E.createUserLoginRequiredError())];if(T=this.getTokenType(u,r.scopes),this.logger.verbose("Response type: "+T),y=new X(z.CreateInstance(r.authority,this.config.auth.validateAuthority,r.authorityMetadata),this.clientId,T,this.getRedirectUri(r.redirectUri),r.scopes,r.state,r.correlationId),this.logger.verbose("Finished building server authentication request"),X.isSSOParam(r)||u?(y.populateQueryParams(u,r,null,!0),this.logger.verbose("Query parameters populated from existing SSO or account")):!u&&!m.isEmpty(h)?(C=ue.extractIdToken(h),this.logger.verbose("ADAL's idToken exists. Extracting login information from ADAL's idToken to populate query parameters"),y.populateQueryParams(u,null,C,!0)):this.logger.verbose("No additional query parameters added"),k=r.claimsRequest||y.claimsValue,!k&&!r.forceRefresh)try{V=this.getCachedToken(y,u)}catch(fe){x=fe}return V?(this.logger.verbose("Token found in cache lookup"),this.logger.verbosePii("Scopes found: "+JSON.stringify(V.scopes)),a(V),[2,null]):[3,1];case 1:return x?(this.logger.infoPii(x.errorCode+":"+x.errorMessage),s(x),[2,null]):[3,2];case 2:q=void 0,k?q="Skipped cache lookup since claims were given":r.forceRefresh?q="Skipped cache lookup since request.forceRefresh option was set to true":q="No valid token found in cache lookup",this.logger.verbose(q),y.authorityInstance||(y.authorityInstance=r.authority?z.CreateInstance(r.authority,this.config.auth.validateAuthority,r.authorityMetadata):this.authorityInstance),this.logger.verbosePii("Authority instance: "+y.authority),j.label=3;case 3:return j.trys.push([3,7,,8]),y.authorityInstance.hasCachedMetadata()?[3,5]:(this.logger.verbose("No cached metadata for authority"),[4,z.saveMetadataFromNetwork(y.authorityInstance,this.telemetryManager,r.correlationId)]);case 4:return j.sent(),this.logger.verbose("Authority has been updated with endpoint discovery response"),[3,6];case 5:this.logger.verbose("Cached metadata found for authority"),j.label=6;case 6:return window.activeRenewals[i]?(this.logger.verbose("Renewing token in progress. Registering callback"),this.registerCallback(window.activeRenewals[i],i,a,s)):r.scopes&&N.onlyContainsOidcScopes(r.scopes)?(this.logger.verbose("OpenID Connect scopes only, renewing idToken"),this.silentLogin=!0,this.renewIdToken(i,a,s,u,y)):(this.logger.verbose("Renewing access token"),this.renewToken(i,a,s,u,y)),[3,8];case 7:return R=j.sent(),this.logger.error(R),s(E.createEndpointResolutionError(R.toString())),[2,null];case 8:return[2]}})})}).then(function(a){return t.logger.verbose("Successfully acquired token"),t.telemetryManager.stopAndFlushApiEvent(r.correlationId,n,!0),a}).catch(function(a){throw t.cacheStorage.resetTempCacheItems(r.state),t.telemetryManager.stopAndFlushApiEvent(r.correlationId,n,!1,a.errorCode),a})},o.prototype.openPopup=function(e,t,r,n){this.logger.verbose("OpenPopup has been called");try{var i=window.screenLeft?window.screenLeft:window.screenX,a=window.screenTop?window.screenTop:window.screenY,s=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,c=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,u=s/2-r/2+i,h=c/2-n/2+a,T=window.open(e,t,"width="+r+", height="+n+", top="+h+", left="+u+", scrollbars=yes");if(!T)throw E.createPopupWindowError();return T.focus&&T.focus(),T}catch(y){throw this.cacheStorage.setInteractionInProgress(!1),E.createPopupWindowError(y.toString())}},o.prototype.loadIframeTimeout=function(e,t,r){return G(this,void 0,void 0,function(){var n,i,a,s,c;return W(this,function(u){switch(u.label){case 0:return n=window.activeRenewals[r],this.logger.verbosePii("Set loading state to pending for: "+r+":"+n),this.cacheStorage.setItem(A.generateTemporaryCacheKey(I.RENEW_STATUS,n),l.inProgress),this.config.system.navigateFrameWait?[4,L.loadFrame(e,t,this.config.system.navigateFrameWait,this.logger)]:[3,2];case 1:return a=u.sent(),[3,3];case 2:a=L.loadFrameSync(e,t,this.logger),u.label=3;case 3:i=a,u.label=4;case 4:return u.trys.push([4,6,,7]),[4,L.monitorIframeForHash(i.contentWindow,this.config.system.loadFrameTimeout,e,this.logger)];case 5:return s=u.sent(),s&&this.handleAuthenticationResponse(s),[3,7];case 6:throw c=u.sent(),this.cacheStorage.getItem(A.generateTemporaryCacheKey(I.RENEW_STATUS,n))===l.inProgress&&(this.logger.verbose("Loading frame has timed out after: "+this.config.system.loadFrameTimeout/1e3+" seconds for scope/authority "+r+":"+n),n&&window.callbackMappedToRenewStates[n]&&window.callbackMappedToRenewStates[n](null,c),this.cacheStorage.removeItem(A.generateTemporaryCacheKey(I.RENEW_STATUS,n))),L.removeHiddenIframe(i),c;case 7:return L.removeHiddenIframe(i),[2]}})})},o.prototype.navigateWindow=function(e,t){if(e&&!m.isEmpty(e)){var r=t||window,n=t?"Navigated Popup window to:"+e:"Navigate to:"+e;this.logger.infoPii(n),r.location.assign(e)}else throw this.logger.info("Navigate url is empty"),D.createUnexpectedError("Navigate url is empty")},o.prototype.registerCallback=function(e,t,r,n){var i=this;window.activeRenewals[t]=e,window.promiseMappedToRenewStates[e]||(window.promiseMappedToRenewStates[e]=[]),window.promiseMappedToRenewStates[e].push({resolve:r,reject:n}),window.callbackMappedToRenewStates[e]||(window.callbackMappedToRenewStates[e]=function(a,s){delete window.activeRenewals[t];for(var c=0;c<window.promiseMappedToRenewStates[e].length;++c)try{if(s)window.promiseMappedToRenewStates[e][c].reject(s);else if(a)window.promiseMappedToRenewStates[e][c].resolve(a);else throw i.cacheStorage.resetTempCacheItems(e),D.createUnexpectedError("Error and response are both null")}catch(u){i.logger.warning(u)}delete window.promiseMappedToRenewStates[e],delete window.callbackMappedToRenewStates[e]})},o.prototype.logout=function(e){this.logger.verbose("Logout has been called"),this.logoutAsync(e)},o.prototype.logoutAsync=function(e){return G(this,void 0,void 0,function(){var t,r,n,i,a,s;return W(this,function(c){switch(c.label){case 0:t=e||b.createNewGuid(),r=this.telemetryManager.createAndStartApiEvent(t,K.Logout),this.clearCache(),this.account=null,c.label=1;case 1:return c.trys.push([1,5,,6]),this.authorityInstance.hasCachedMetadata()?[3,3]:(this.logger.verbose("No cached metadata for authority"),[4,z.saveMetadataFromNetwork(this.authorityInstance,this.telemetryManager,e)]);case 2:return c.sent(),[3,4];case 3:this.logger.verbose("Cached metadata found for authority"),c.label=4;case 4:return n="client-request-id="+t,i=void 0,this.getPostLogoutRedirectUri()?(i="&post_logout_redirect_uri="+encodeURIComponent(this.getPostLogoutRedirectUri()),this.logger.verbose("redirectUri found and set")):(i="",this.logger.verbose("No redirectUri set for app. postLogoutQueryParam is empty")),a=void 0,this.authorityInstance.EndSessionEndpoint?(a=this.authorityInstance.EndSessionEndpoint+"?"+n+i,this.logger.verbose("EndSessionEndpoint found and urlNavigate set"),this.logger.verbosePii("urlNavigate set to: "+this.authorityInstance.EndSessionEndpoint)):(a=this.authority+"oauth2/v2.0/logout?"+n+i,this.logger.verbose("No endpoint, urlNavigate set to default")),this.telemetryManager.stopAndFlushApiEvent(t,r,!0),this.logger.verbose("Navigating window to urlNavigate"),this.navigateWindow(a),[3,6];case 5:return s=c.sent(),this.telemetryManager.stopAndFlushApiEvent(t,r,!1,s.errorCode),[3,6];case 6:return[2]}})})},o.prototype.clearCache=function(){this.logger.verbose("Clearing cache"),window.renewStates=[];for(var e=this.cacheStorage.getAllTokens(l.clientId,l.homeAccountIdentifier),t=0;t<e.length;t++)this.cacheStorage.removeItem(JSON.stringify(e[t].key));this.cacheStorage.resetCacheItems(),this.cacheStorage.clearMsalCookie(),this.logger.verbose("Cache cleared")},o.prototype.clearCacheForScope=function(e){this.logger.verbose("Clearing access token from cache");for(var t=this.cacheStorage.getAllAccessTokens(l.clientId,l.homeAccountIdentifier),r=0;r<t.length;r++){var n=t[r];n.value.accessToken===e&&(this.cacheStorage.removeItem(JSON.stringify(n.key)),this.logger.verbosePii("Access token removed: "+n.key))}},o.prototype.isCallback=function(e){return this.logger.info("isCallback will be deprecated in favor of urlContainsHash in MSAL.js v2.0."),this.logger.verbose("isCallback has been called"),f.urlContainsHash(e)},o.prototype.processCallBack=function(e,t,r){this.logger.info("ProcessCallBack has been called. Processing callback from redirect response");var n=t;n||(this.logger.verbose("StateInfo is null, getting stateInfo from hash"),n=this.getResponseState(e));var i,a;try{i=this.saveTokenFromHash(e,n)}catch(c){a=c}try{this.cacheStorage.clearMsalCookie(n.state);var s=this.getAccountState(n.state);if(i){if(n.requestType===l.renewToken||i.accessToken?(window.parent!==window?this.logger.verbose("Window is in iframe, acquiring token silently"):this.logger.verbose("Acquiring token interactive in progress"),this.logger.verbose("Response tokenType set to "+p.ACCESS_TOKEN),i.tokenType=p.ACCESS_TOKEN):n.requestType===l.login&&(this.logger.verbose("Response tokenType set to "+p.ID_TOKEN),i.tokenType=p.ID_TOKEN),!r){this.logger.verbose("Setting redirectResponse"),this.redirectResponse=i;return}}else if(!r){this.logger.verbose("Response is null, setting redirectResponse with state"),this.redirectResponse=pe(s),this.redirectError=a,this.cacheStorage.resetTempCacheItems(n.state);return}this.logger.verbose("Calling callback provided to processCallback"),r(i,a)}catch(c){throw this.logger.error("Error occurred in token received callback function: "+c),E.createErrorInCallbackFunction(c.toString())}},o.prototype.handleAuthenticationResponse=function(e){this.logger.verbose("HandleAuthenticationResponse has been called");var t=e||window.location.hash,r=this.getResponseState(t);this.logger.verbose("Obtained state from response");var n=window.callbackMappedToRenewStates[r.state];this.processCallBack(t,r,n)},o.prototype.handleRedirectAuthenticationResponse=function(e){this.logger.info("Returned from redirect url"),this.logger.verbose("HandleRedirectAuthenticationResponse has been called"),L.clearUrlFragment(window),this.logger.verbose("Window.location.hash cleared");var t=this.getResponseState(e);if(this.config.auth.navigateToLoginRequestUrl&&window.parent===window){this.logger.verbose("Window.parent is equal to window, not in popup or iframe. Navigation to login request url after login turned on");var r=this.cacheStorage.getItem(A.generateTemporaryCacheKey(I.LOGIN_REQUEST,t.state),this.inCookie);if(!r||r==="null"){this.logger.error("Unable to get valid login request url from cache, redirecting to home page"),window.location.assign("/");return}else{this.logger.verbose("Valid login request url obtained from cache");var n=f.removeHashFromUrl(window.location.href),i=f.removeHashFromUrl(r);if(n!==i){this.logger.verbose("Current url is not login request url, navigating"),this.logger.verbosePii("CurrentUrl: "+n+", finalRedirectUrl: "+i),window.location.assign(""+i+e);return}else{this.logger.verbose("Current url matches login request url");var a=f.GetUrlComponents(r);a.Hash&&(this.logger.verbose("Login request url contains hash, resetting non-msal hash"),window.location.hash=a.Hash)}}}else this.config.auth.navigateToLoginRequestUrl||this.logger.verbose("Default navigation to start page after login turned off");this.processCallBack(e,t,null)},o.prototype.getResponseState=function(e){this.logger.verbose("GetResponseState has been called");var t=f.deserializeHash(e),r;if(!t)throw D.createUnexpectedError("Hash was not parsed correctly.");if(t.hasOwnProperty(p.STATE)){this.logger.verbose("Hash contains state. Creating stateInfo object");var n=F.parseLibraryState(t.state);r={requestType:l.unknown,state:t.state,timestamp:n.ts,method:n.method,stateMatch:!1}}else throw D.createUnexpectedError("Hash does not contain state.");if(r.state===this.cacheStorage.getItem(A.generateTemporaryCacheKey(I.STATE_LOGIN,r.state),this.inCookie)||r.state===this.silentAuthenticationState)return this.logger.verbose("State matches cached state, setting requestType to login"),r.requestType=l.login,r.stateMatch=!0,r;if(r.state===this.cacheStorage.getItem(A.generateTemporaryCacheKey(I.STATE_ACQ_TOKEN,r.state),this.inCookie))return this.logger.verbose("State matches cached state, setting requestType to renewToken"),r.requestType=l.renewToken,r.stateMatch=!0,r;if(!r.stateMatch){this.logger.verbose("State does not match cached state, setting requestType to type from window"),r.requestType=window.requestType;for(var i=window.renewStates,a=0;a<i.length;a++)if(i[a]===r.state){this.logger.verbose("Matching state found for request"),r.stateMatch=!0;break}r.stateMatch||this.logger.verbose("Matching state not found for request")}return r},o.prototype.getCachedToken=function(e,t){this.logger.verbose("GetCachedToken has been called");var r=e.scopes,n=this.getCachedIdToken(e,t),i=this.getCachedAccessToken(e,t,r),a=this.getAccountState(e.state);return ye.buildAuthResponse(n,i,e,t,r,a)},o.prototype.getTokenCacheItemByAuthority=function(e,t,r,n){var i=this,a;return f.isCommonAuthority(e)||f.isOrganizationsAuthority(e)||f.isConsumersAuthority(e)?a=be.filterTokenCacheItemsByDomain(t,f.GetUrlComponents(e).HostNameAndPort):a=be.filterTokenCacheItemsByAuthority(t,e),a.length===1?a[0]:a.length>1?(this.logger.warning("Multiple matching tokens found. Cleaning cache and requesting a new token."),a.forEach(function(s){i.cacheStorage.removeItem(JSON.stringify(s.key))}),null):(this.logger.verbose("No matching tokens of type "+n+" found"),null)},o.prototype.getCachedIdToken=function(e,t){this.logger.verbose("Getting all cached tokens of type ID Token");var r=this.cacheStorage.getAllIdTokens(this.clientId,t?t.homeAccountIdentifier:null),n=e.authority||this.authority,i=this.getTokenCacheItemByAuthority(n,r,null,p.ID_TOKEN);if(i){this.logger.verbose("Evaluating ID token found");var a=this.evaluateTokenExpiration(i);if(a){this.logger.verbose("ID token expiration is within offset, using ID token found in cache");var s=i.value;return s?this.logger.verbose("ID Token found in cache is valid and unexpired"):this.logger.verbose("ID Token found in cache is invalid"),s?new $(s.idToken):null}else return this.logger.verbose("Cached ID token is expired, removing from cache"),this.cacheStorage.removeItem(JSON.stringify(i.key)),null}else return this.logger.verbose("No tokens found"),null},o.prototype.getCachedAccessToken=function(e,t,r){this.logger.verbose("Getting all cached tokens of type Access Token");var n=this.cacheStorage.getAllAccessTokens(this.clientId,t?t.homeAccountIdentifier:null),i=be.filterTokenCacheItemsByScope(n,r),a=e.authority||this.authority,s=this.getTokenCacheItemByAuthority(a,i,r,p.ACCESS_TOKEN);if(s){e.authorityInstance=z.CreateInstance(s.key.authority,this.config.auth.validateAuthority),this.logger.verbose("Evaluating access token found");var c=this.evaluateTokenExpiration(s);if(c){this.logger.verbose("Access token expiration is within offset, using access token found in cache");var u=t||this.getAccount();if(!u)throw D.createUnexpectedError("Account should not be null here.");var h=this.getAccountState(e.state),T={uniqueId:"",tenantId:"",tokenType:p.ACCESS_TOKEN,idToken:null,idTokenClaims:null,accessToken:s.value.accessToken,scopes:s.key.scopes.split(" "),expiresOn:new Date(Number(s.value.expiresIn)*1e3),account:u,accountState:h,fromCache:!0};return T}else return this.logger.verbose("Access token expired, removing from cache"),this.cacheStorage.removeItem(JSON.stringify(s.key)),null}else return this.logger.verbose("No matching token found when filtering by scope and authority"),null},o.prototype.evaluateTokenExpiration=function(e){var t=Number(e.value.expiresIn);return ue.validateExpirationIsWithinOffset(t,this.config.system.tokenRenewalOffsetSeconds)},o.prototype.extractADALIdToken=function(){this.logger.verbose("ExtractADALIdToken has been called");var e=this.cacheStorage.getItem(l.adalIdToken);return m.isEmpty(e)?null:ue.extractIdToken(e)},o.prototype.renewToken=function(e,t,r,n,i){this.logger.verbose("RenewToken has been called"),this.logger.verbosePii("RenewToken scope and authority: "+e);var a=L.generateFrameName(Ce.TOKEN_FRAME,e);L.addHiddenIFrame(a,this.logger),this.updateCacheEntries(i,n,!1),this.logger.verbosePii("RenewToken expected state: "+i.state);var s=f.urlRemoveQueryStringParameter(f.createNavigateUrl(i),l.prompt)+l.prompt_none+l.response_mode_fragment;window.renewStates.push(i.state),window.requestType=l.renewToken,this.logger.verbose("Set window.renewState and requestType"),this.registerCallback(i.state,e,t,r),this.logger.infoPii("Navigate to: "+s),this.loadIframeTimeout(s,a,e).catch(function(c){return r(c)})},o.prototype.renewIdToken=function(e,t,r,n,i){this.logger.info("RenewIdToken has been called");var a=L.generateFrameName(Ce.ID_TOKEN_FRAME,e);L.addHiddenIFrame(a,this.logger),this.updateCacheEntries(i,n,!1),this.logger.verbose("RenewIdToken expected state: "+i.state);var s=f.urlRemoveQueryStringParameter(f.createNavigateUrl(i),l.prompt)+l.prompt_none+l.response_mode_fragment;this.silentLogin?(this.logger.verbose("Silent login is true, set silentAuthenticationState"),window.requestType=l.login,this.silentAuthenticationState=i.state):(this.logger.verbose("Not silent login, set window.renewState and requestType"),window.requestType=l.renewToken,window.renewStates.push(i.state)),this.registerCallback(i.state,e,t,r),this.logger.infoPii('Navigate to:" '+s),this.loadIframeTimeout(s,a,e).catch(function(c){return r(c)})},o.prototype.saveToken=function(e,t,r,n,i){var a=new Le(t,this.clientId,r,n.uid,n.utid),s=new Me(e.accessToken,e.idToken.rawIdToken,i.toString(),n.encodeClientInfo());return this.cacheStorage.setItem(JSON.stringify(a),JSON.stringify(s)),i?(this.logger.verbose("New expiration set for token"),e.expiresOn=new Date(i*1e3)):this.logger.error("Could not parse expiresIn parameter for access token"),e},o.prototype.saveIdToken=function(e,t,r,n,i){this.logger.verbose("SaveIdToken has been called");var a=S({},e),s;a.scopes=l.oidcScopes,a.accessToken=r[p.ID_TOKEN];var c=Number(i.expiration);return this.logger.verbose("Saving ID token to cache"),this.saveToken(a,t,s,n,c)},o.prototype.saveAccessToken=function(e,t,r,n){this.logger.verbose("SaveAccessToken has been called");var i=S({},e),a=r[p.SCOPE],s=a.split(" "),c=this.cacheStorage.getAllAccessTokens(this.clientId,t);this.logger.verbose("Retrieving all access tokens from cache and removing duplicates");for(var u=0;u<c.length;u++){var h=c[u];if(h.key.homeAccountIdentifier===e.account.homeAccountIdentifier){var T=h.key.scopes.split(" ");N.isIntersectingScopes(T,s)&&this.cacheStorage.removeItem(JSON.stringify(h.key))}}i.accessToken=r[p.ACCESS_TOKEN],i.scopes=s;var y=Y.parseExpiresIn(r[p.EXPIRES_IN]),C=F.parseLibraryState(r[p.STATE]),k=C.ts+y;return this.logger.verbose("Saving access token to cache"),this.saveToken(i,t,a,n,k)},o.prototype.saveTokenFromHash=function(e,t){this.logger.verbose("SaveTokenFromHash has been called"),this.logger.info("State status: "+t.stateMatch+"; Request type: "+t.requestType);var r={uniqueId:"",tenantId:"",tokenType:"",idToken:null,idTokenClaims:null,accessToken:null,scopes:[],expiresOn:null,account:null,accountState:"",fromCache:!1},n,i=f.deserializeHash(e),a="",s="",c=null;if(i.hasOwnProperty(p.ERROR_DESCRIPTION)||i.hasOwnProperty(p.ERROR)){if(this.logger.verbose("Server returned an error"),this.logger.infoPii("Error : "+i[p.ERROR]+"; Error description: "+i[p.ERROR_DESCRIPTION]),this.cacheStorage.setItem(P.ERROR,i[p.ERROR]),this.cacheStorage.setItem(P.ERROR_DESC,i[p.ERROR_DESCRIPTION]),t.requestType===l.login&&(this.logger.verbose("RequestType is login, caching login error, generating authorityKey"),this.cacheStorage.setItem(P.LOGIN_ERROR,i[p.ERROR_DESCRIPTION]+":"+i[p.ERROR]),a=A.generateAuthorityKey(t.state)),t.requestType===l.renewToken){this.logger.verbose("RequestType is renewToken, generating acquireTokenAccountKey"),a=A.generateAuthorityKey(t.state);var u=this.getAccount(),h=void 0;u&&!m.isEmpty(u.homeAccountIdentifier)?(h=u.homeAccountIdentifier,this.logger.verbose("AccountId is set")):(h=l.no_account,this.logger.verbose("AccountId is set as no_account")),s=A.generateAcquireTokenAccountKey(h,t.state)}var T=i[p.ERROR],y=i[p.ERROR_DESCRIPTION];Te.isInteractionRequiredError(T)||Te.isInteractionRequiredError(y)?n=new Te(i[p.ERROR],i[p.ERROR_DESCRIPTION]):n=new Ee(i[p.ERROR],i[p.ERROR_DESCRIPTION])}else if(this.logger.verbose("Server returns success"),t.stateMatch){this.logger.info("State is right"),i.hasOwnProperty(p.SESSION_STATE)&&(this.logger.verbose("Fragment has session state, caching"),this.cacheStorage.setItem(A.generateTemporaryCacheKey(I.SESSION_STATE,t.state),i[p.SESSION_STATE])),r.accountState=this.getAccountState(t.state);var C=void 0;if(i.hasOwnProperty(p.ACCESS_TOKEN)){this.logger.info("Fragment has access token"),r.accessToken=i[p.ACCESS_TOKEN],i.hasOwnProperty(p.SCOPE)&&(r.scopes=i[p.SCOPE].split(" ")),i.hasOwnProperty(p.ID_TOKEN)?(this.logger.verbose("Fragment has id_token"),c=new $(i[p.ID_TOKEN])):(this.logger.verbose("No idToken on fragment, getting idToken from cache"),c=new $(this.cacheStorage.getItem(H.IDTOKEN))),r=ye.setResponseIdToken(r,c);var k=this.populateAuthority(t.state,this.inCookie,this.cacheStorage,c);this.logger.verbose("Got authority from cache"),i.hasOwnProperty(p.CLIENT_INFO)?(this.logger.verbose("Fragment has clientInfo"),C=new ie(i[p.CLIENT_INFO],k)):this.authorityInstance.AuthorityType===ee.Adfs?C=ie.createClientInfoFromIdToken(c,k):this.logger.warning("ClientInfo not received in the response from AAD"),r.account=ae.createAccount(c,C),this.logger.verbose("Account object created from response");var x=void 0;r.account&&!m.isEmpty(r.account.homeAccountIdentifier)?(this.logger.verbose("AccountKey set"),x=r.account.homeAccountIdentifier):(this.logger.verbose("AccountKey set as no_account"),x=l.no_account),s=A.generateAcquireTokenAccountKey(x,t.state);var V=A.generateAcquireTokenAccountKey(l.no_account,t.state);this.logger.verbose("AcquireTokenAccountKey generated");var q=this.cacheStorage.getItem(s),R=void 0;m.isEmpty(q)?m.isEmpty(this.cacheStorage.getItem(V))||(this.logger.verbose("No acquireToken account retrieved from cache"),r=this.saveAccessToken(r,k,i,C)):(R=JSON.parse(q),this.logger.verbose("AcquireToken request account retrieved from cache"),r.account&&R&&ae.compareAccounts(r.account,R)?(r=this.saveAccessToken(r,k,i,C),this.logger.info("The user object received in the response is the same as the one passed in the acquireToken request")):this.logger.warning("The account object created from the response is not the same as the one passed in the acquireToken request"))}if(i.hasOwnProperty(p.ID_TOKEN)){this.logger.info("Fragment has idToken"),c=new $(i[p.ID_TOKEN]);var k=this.populateAuthority(t.state,this.inCookie,this.cacheStorage,c);if(r=ye.setResponseIdToken(r,c),i.hasOwnProperty(p.CLIENT_INFO)?(this.logger.verbose("Fragment has clientInfo"),C=new ie(i[p.CLIENT_INFO],k)):this.authorityInstance.AuthorityType===ee.Adfs?C=ie.createClientInfoFromIdToken(c,k):this.logger.warning("ClientInfo not received in the response from AAD"),this.account=ae.createAccount(c,C),r.account=this.account,this.logger.verbose("Account object created from response"),c&&c.nonce){this.logger.verbose("IdToken has nonce");var j=this.cacheStorage.getItem(A.generateTemporaryCacheKey(I.NONCE_IDTOKEN,t.state),this.inCookie);c.nonce!==j?(this.account=null,this.cacheStorage.setItem(P.LOGIN_ERROR,"Nonce Mismatch. Expected Nonce: "+j+",Actual Nonce: "+c.nonce),this.logger.error("Nonce Mismatch. Expected Nonce: "+j+", Actual Nonce: "+c.nonce),n=E.createNonceMismatchError(j,c.nonce)):(this.logger.verbose("Nonce matches, saving idToken to cache"),this.cacheStorage.setItem(H.IDTOKEN,i[p.ID_TOKEN],this.inCookie),this.cacheStorage.setItem(H.CLIENT_INFO,C.encodeClientInfo(),this.inCookie),this.saveIdToken(r,k,i,C,c))}else this.logger.verbose("No idToken or no nonce. Cache key for Authority set as state"),a=t.state,s=t.state,this.logger.error("Invalid id_token received in the response"),n=E.createInvalidIdTokenError(c),this.cacheStorage.setItem(P.ERROR,n.errorCode),this.cacheStorage.setItem(P.ERROR_DESC,n.errorMessage)}}else{this.logger.verbose("State mismatch"),a=t.state,s=t.state;var fe=this.cacheStorage.getItem(A.generateTemporaryCacheKey(I.STATE_LOGIN,t.state),this.inCookie);this.logger.error("State Mismatch. Expected State: "+fe+", Actual State: "+t.state),n=E.createInvalidStateError(t.state,fe),this.cacheStorage.setItem(P.ERROR,n.errorCode),this.cacheStorage.setItem(P.ERROR_DESC,n.errorMessage)}if(this.cacheStorage.removeItem(A.generateTemporaryCacheKey(I.RENEW_STATUS,t.state)),this.cacheStorage.resetTempCacheItems(t.state),this.logger.verbose("Status set to complete, temporary cache cleared"),this.inCookie&&(this.logger.verbose("InCookie is true, setting authorityKey in cookie"),this.cacheStorage.setItemCookie(a,"",-1),this.cacheStorage.clearMsalCookie(t.state)),n)throw n;if(!r)throw D.createUnexpectedError("Response is null");return r},o.prototype.populateAuthority=function(e,t,r,n){this.logger.verbose("PopulateAuthority has been called");var i=A.generateAuthorityKey(e),a=r.getItem(i,t);return m.isEmpty(a)?a:f.replaceTenantPath(a,n.tenantId)},o.prototype.getAccount=function(){if(this.account)return this.account;var e=this.cacheStorage.getItem(H.IDTOKEN,this.inCookie),t=this.cacheStorage.getItem(H.CLIENT_INFO,this.inCookie);if(!m.isEmpty(e)&&!m.isEmpty(t)){var r=new $(e),n=new ie(t,"");return this.account=ae.createAccount(r,n),this.account}return null},o.prototype.getAccountState=function(e){if(e){var t=e.indexOf(l.resourceDelimiter);if(t>-1&&t+1<e.length)return e.substring(t+1)}return e},o.prototype.getAllAccounts=function(){for(var e=[],t=this.cacheStorage.getAllAccessTokens(l.clientId,l.homeAccountIdentifier),r=0;r<t.length;r++){var n=new $(t[r].value.idToken),i=new ie(t[r].value.homeAccountIdentifier,""),a=ae.createAccount(n,i);e.push(a)}return this.getUniqueAccounts(e)},o.prototype.getUniqueAccounts=function(e){if(!e||e.length<=1)return e;for(var t=[],r=[],n=0;n<e.length;++n)e[n].homeAccountIdentifier&&t.indexOf(e[n].homeAccountIdentifier)===-1&&(t.push(e[n].homeAccountIdentifier),r.push(e[n]));return r},o.prototype.broadcast=function(e,t){var r=new CustomEvent(e,{detail:t});window.dispatchEvent(r)},o.prototype.getCachedTokenInternal=function(e,t,r,n){var i=t||this.getAccount();if(!i)return null;var a=this.authorityInstance?this.authorityInstance:z.CreateInstance(this.authority,this.config.auth.validateAuthority),s=this.getTokenType(i,e),c=new X(a,this.clientId,s,this.getRedirectUri(),e,r,n);return this.getCachedToken(c,t)},o.prototype.getScopesForEndpoint=function(e){if(this.config.framework.unprotectedResources.length>0){for(var t=0;t<this.config.framework.unprotectedResources.length;t++)if(e.indexOf(this.config.framework.unprotectedResources[t])>-1)return null}if(this.config.framework.protectedResourceMap.size>0)for(var r=0,n=Array.from(this.config.framework.protectedResourceMap.keys());r<n.length;r++){var i=n[r];if(e.indexOf(i)>-1)return this.config.framework.protectedResourceMap.get(i)}if(e.indexOf("http://")>-1||e.indexOf("https://")>-1){if(f.getHostFromUri(e)===f.getHostFromUri(this.getRedirectUri()))return new Array(this.clientId)}else return new Array(this.clientId);return null},o.prototype.getLoginInProgress=function(){return this.cacheStorage.isInteractionInProgress(!0)},o.prototype.setInteractionInProgress=function(e){this.cacheStorage.setInteractionInProgress(e)},o.prototype.setloginInProgress=function(e){this.setInteractionInProgress(e)},o.prototype.getAcquireTokenInProgress=function(){return this.cacheStorage.isInteractionInProgress(!0)},o.prototype.setAcquireTokenInProgress=function(e){this.setInteractionInProgress(e)},o.prototype.getLogger=function(){return this.logger},o.prototype.setLogger=function(e){this.logger=e},o.prototype.getRedirectUri=function(e){return e||(typeof this.config.auth.redirectUri=="function"?this.config.auth.redirectUri():this.config.auth.redirectUri)},o.prototype.getPostLogoutRedirectUri=function(){return typeof this.config.auth.postLogoutRedirectUri=="function"?this.config.auth.postLogoutRedirectUri():this.config.auth.postLogoutRedirectUri},o.prototype.getCurrentConfiguration=function(){if(!this.config)throw _.createNoSetConfigurationError();return this.config},o.prototype.getTokenType=function(e,t){var r=ae.compareAccounts(e,this.getAccount());return X.determineResponseType(r,t)},o.prototype.setAccountCache=function(e,t){var r=e?this.getAccountId(e):l.no_account,n=A.generateAcquireTokenAccountKey(r,t);this.cacheStorage.setItem(n,JSON.stringify(e))},o.prototype.setAuthorityCache=function(e,t){var r=A.generateAuthorityKey(e);this.cacheStorage.setItem(r,f.CanonicalizeUri(t),this.inCookie)},o.prototype.updateCacheEntries=function(e,t,r,n){n&&this.cacheStorage.setItem(A.generateTemporaryCacheKey(I.LOGIN_REQUEST,e.state),n,this.inCookie),r?this.cacheStorage.setItem(A.generateTemporaryCacheKey(I.STATE_LOGIN,e.state),e.state,this.inCookie):this.setAccountCache(t,e.state),this.setAuthorityCache(e.state,e.authority),this.cacheStorage.setItem(A.generateTemporaryCacheKey(I.NONCE_IDTOKEN,e.state),e.nonce,this.inCookie)},o.prototype.getAccountId=function(e){var t;return m.isEmpty(e.homeAccountIdentifier)?t=l.no_account:t=e.homeAccountIdentifier,t},o.prototype.buildIDTokenRequest=function(e){var t={scopes:l.oidcScopes,authority:this.authority,account:this.getAccount(),extraQueryParameters:e.extraQueryParameters,correlationId:e.correlationId};return t},o.prototype.getTelemetryManagerFromConfig=function(e,t){if(!e)return Oe.getTelemetrymanagerStub(t,this.logger);var r=e.applicationName,n=e.applicationVersion,i=e.telemetryEmitter;if(!r||!n||!i)throw _.createTelemetryConfigError(e);var a={applicationName:r,applicationVersion:n},s={platform:a,clientId:t};return new Oe(s,i,this.logger)},o}();function Je(o,e){return o.getAccount()?o.acquireTokenSilent(e).then(t=>t.accessToken).catch(t=>t.name==="InteractionRequiredAuthError"?o.acquireTokenPopup(e).then(r=>r.accessToken).catch(r=>Promise.reject(r&&r.message)):(console.error(t),Promise.reject("Could not fetch token"))):Promise.reject("Not logged in")}function Dn(o){let{redirectUri:e=`${location.origin}/auth`,restrict:t=!1,scopes:r=["User.Read"],storeAuthStateInCookie:n,cacheLocation:i="sessionStorage",framework:a,system:s,...c}=o,u=new Pe({auth:{redirectUri:e,...c},cache:{storeAuthStateInCookie:n,cacheLocation:i},system:s,framework:a}),h={scopes:r};return u.handleRedirectCallback(()=>{}),{login(){u.loginRedirect(h)},logout(){u.logout()},account(){return u.getAccount()},extendHeaders(T){t||T.setHeaders(Je(u,h).then(y=>y&&{Authorization:`Bearer ${y}`},()=>{}))},token(){return Je(u,h)}}}})();
|
|
1
|
+
(()=>{function ht(o){return e=>(e.on("before-fetch",o.extendHeaders),{getAccessToken(){return o.token()}})}var Se=function(o,e){return Se=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])},Se(o,e)};function O(o,e){Se(o,e);function t(){this.constructor=o}o.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var S=function(){return S=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},S.apply(this,arguments)};function G(o,e,t,r){function n(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function s(h){try{u(r.next(h))}catch(T){a(T)}}function c(h){try{u(r.throw(h))}catch(T){a(T)}}function u(h){h.done?i(h.value):n(h.value).then(s,c)}u((r=r.apply(o,e||[])).next())})}function W(o,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,n,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(h){return c([u,h])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,n&&(i=u[0]&2?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,n=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){t.label=u[1];break}if(u[0]===6&&t.label<i[1]){t.label=i[1],i=u;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(u);break}i[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(o,t)}catch(h){u=[6,h],n=0}finally{r=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function U(){for(var o=0,e=0,t=arguments.length;e<t;e++)o+=arguments[e].length;for(var r=Array(o),n=0,e=0;e<t;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,n++)r[n]=i[a];return r}var b=(function(){function o(){}return o.createNewGuid=function(){var e=window.crypto;if(e&&e.getRandomValues){var t=new Uint8Array(16);return e.getRandomValues(t),t[6]|=64,t[6]&=79,t[8]|=128,t[8]&=191,o.decimalToHex(t[0])+o.decimalToHex(t[1])+o.decimalToHex(t[2])+o.decimalToHex(t[3])+"-"+o.decimalToHex(t[4])+o.decimalToHex(t[5])+"-"+o.decimalToHex(t[6])+o.decimalToHex(t[7])+"-"+o.decimalToHex(t[8])+o.decimalToHex(t[9])+"-"+o.decimalToHex(t[10])+o.decimalToHex(t[11])+o.decimalToHex(t[12])+o.decimalToHex(t[13])+o.decimalToHex(t[14])+o.decimalToHex(t[15])}else{for(var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",n="0123456789abcdef",i=0,a="",s=0;s<36;s++)r[s]!=="-"&&r[s]!=="4"&&(i=Math.random()*16|0),r[s]==="x"?a+=n[i]:r[s]==="y"?(i&=3,i|=8,a+=n[i]):a+=r[s];return a}},o.isGuid=function(e){var t=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;return t.test(e)},o.decimalToHex=function(e){for(var t=e.toString(16);t.length<2;)t="0"+t;return t},o.base64Encode=function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(r,n){return String.fromCharCode(+("0x"+n))}))},o.base64Decode=function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("Invalid base64 string")}return decodeURIComponent(atob(t).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""))},o.deserialize=function(e){var t,r=/\+/g,n=/([^&=]+)=([^&]*)/g,i=function(s){return decodeURIComponent(s.replace(r," "))},a={};for(t=n.exec(e);t;)a[i(t[1])]=i(t[2]),t=n.exec(e);return a},o})();var l=(function(){function o(){}return Object.defineProperty(o,"libraryName",{get:function(){return"Msal.js"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"claims",{get:function(){return"claims"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"clientId",{get:function(){return"clientId"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"adalIdToken",{get:function(){return"adal.idtoken"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"cachePrefix",{get:function(){return"msal"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"scopes",{get:function(){return"scopes"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"no_account",{get:function(){return"NO_ACCOUNT"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"upn",{get:function(){return"upn"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"domain_hint",{get:function(){return"domain_hint"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"prompt_select_account",{get:function(){return"&prompt=select_account"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"prompt_none",{get:function(){return"&prompt=none"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"prompt",{get:function(){return"prompt"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"response_mode_fragment",{get:function(){return"&response_mode=fragment"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"resourceDelimiter",{get:function(){return"|"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"cacheDelimiter",{get:function(){return"."},enumerable:!1,configurable:!0}),Object.defineProperty(o,"popUpWidth",{get:function(){return this._popUpWidth},set:function(e){this._popUpWidth=e},enumerable:!1,configurable:!0}),Object.defineProperty(o,"popUpHeight",{get:function(){return this._popUpHeight},set:function(e){this._popUpHeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(o,"login",{get:function(){return"LOGIN"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"renewToken",{get:function(){return"RENEW_TOKEN"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"unknown",{get:function(){return"UNKNOWN"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"ADFS",{get:function(){return"adfs"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"homeAccountIdentifier",{get:function(){return"homeAccountIdentifier"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"common",{get:function(){return"common"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"openidScope",{get:function(){return"openid"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"profileScope",{get:function(){return"profile"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"oidcScopes",{get:function(){return[this.openidScope,this.profileScope]},enumerable:!1,configurable:!0}),Object.defineProperty(o,"interactionTypeRedirect",{get:function(){return"redirectInteraction"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"interactionTypePopup",{get:function(){return"popupInteraction"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"interactionTypeSilent",{get:function(){return"silentInteraction"},enumerable:!1,configurable:!0}),Object.defineProperty(o,"inProgress",{get:function(){return"inProgress"},enumerable:!1,configurable:!0}),o._popUpWidth=483,o._popUpHeight=600,o})();var Ne="sessionStorage",p;(function(o){o.SCOPE="scope",o.STATE="state",o.ERROR="error",o.ERROR_DESCRIPTION="error_description",o.ACCESS_TOKEN="access_token",o.ID_TOKEN="id_token",o.EXPIRES_IN="expires_in",o.SESSION_STATE="session_state",o.CLIENT_INFO="client_info"})(p||(p={}));var Q={id_token:"id_token",token:"token",id_token_token:"id_token token"},I;(function(o){o.AUTHORITY="authority",o.ACQUIRE_TOKEN_ACCOUNT="acquireTokenAccount",o.SESSION_STATE="session.state",o.STATE_LOGIN="state.login",o.STATE_ACQ_TOKEN="state.acquireToken",o.STATE_RENEW="state.renew",o.NONCE_IDTOKEN="nonce.idtoken",o.LOGIN_REQUEST="login.request",o.RENEW_STATUS="token.renew.status",o.URL_HASH="urlHash",o.INTERACTION_STATUS="interaction.status",o.REDIRECT_REQUEST="redirect_request"})(I||(I={}));var H;(function(o){o.IDTOKEN="idtoken",o.CLIENT_INFO="client.info"})(H||(H={}));var P;(function(o){o.LOGIN_ERROR="login.error",o.ERROR="error",o.ERROR_DESC="error.description"})(P||(P={}));var Ye="https://login.microsoftonline.com/common/",xe=Ye+"/discovery/instance?api-version=1.1&authorization_endpoint=",we=".well-known/openid-configuration",w;(function(o){o.ACCOUNT="account",o.SID="sid",o.LOGIN_HINT="login_hint",o.ORGANIZATIONS="organizations",o.CONSUMERS="consumers",o.ID_TOKEN="id_token",o.ACCOUNT_ID="accountIdentifier",o.HOMEACCOUNT_ID="homeAccountIdentifier"})(w||(w={}));var Ue=[w.SID,w.LOGIN_HINT],se={GET:"GET",POST:"POST"},oe={LOGIN:"login",SELECT_ACCOUNT:"select_account",CONSENT:"consent",NONE:"none"},Ce={ID_TOKEN_FRAME:"msalIdTokenFrame",TOKEN_FRAME:"msalRenewFrame"};var ge={unexpectedError:{code:"unexpected_error",desc:"Unexpected error in authentication."},noWindowObjectError:{code:"no_window_object",desc:"No window object available. Details:"}},D=(function(o){O(e,o);function e(t,r){var n=o.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n.errorCode=t,n.errorMessage=r,n.name="AuthError",n}return e.createUnexpectedError=function(t){return new e(ge.unexpectedError.code,ge.unexpectedError.desc+": "+t)},e.createNoWindowObjectError=function(t){return new e(ge.noWindowObjectError.code,ge.noWindowObjectError.desc+" "+t)},e})(Error);var m=(function(){function o(){}return o.isEmpty=function(e){return typeof e>"u"||!e||e.length===0},o.validateAndParseJsonCacheKey=function(e){try{var t=JSON.parse(e);return t&&typeof t=="object"?t:null}catch{return null}},o})();var d={endpointResolutionError:{code:"endpoints_resolution_error",desc:"Error: could not resolve endpoints. Please check network and try again."},popUpWindowError:{code:"popup_window_error",desc:"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser."},tokenRenewalError:{code:"token_renewal_error",desc:"Token renewal operation failed due to timeout."},invalidIdToken:{code:"invalid_id_token",desc:"Invalid ID token format."},invalidStateError:{code:"invalid_state_error",desc:"Invalid state."},nonceMismatchError:{code:"nonce_mismatch_error",desc:"Nonce is not matching, Nonce received: "},loginProgressError:{code:"login_progress_error",desc:"Login_In_Progress: Error during login call - login is already in progress."},acquireTokenProgressError:{code:"acquiretoken_progress_error",desc:"AcquireToken_In_Progress: Error during login call - login is already in progress."},userCancelledError:{code:"user_cancelled",desc:"User cancelled the flow."},callbackError:{code:"callback_error",desc:"Error occurred in token received callback function."},userLoginRequiredError:{code:"user_login_error",desc:"User login is required. For silent calls, request must contain either sid or login_hint"},userDoesNotExistError:{code:"user_non_existent",desc:"User object does not exist. Please call a login API."},clientInfoDecodingError:{code:"client_info_decoding_error",desc:"The client info could not be parsed/decoded correctly. Please review the trace to determine the root cause."},clientInfoNotPopulatedError:{code:"client_info_not_populated_error",desc:"The service did not populate client_info in the response, Please verify with the service team"},nullOrEmptyIdToken:{code:"null_or_empty_id_token",desc:"The idToken is null or empty. Please review the trace to determine the root cause."},idTokenNotParsed:{code:"id_token_parsing_error",desc:"ID token cannot be parsed. Please review stack trace to determine root cause."},tokenEncodingError:{code:"token_encoding_error",desc:"The token to be decoded is not encoded correctly."},invalidInteractionType:{code:"invalid_interaction_type",desc:"The interaction type passed to the handler was incorrect or unknown"},cacheParseError:{code:"cannot_parse_cache",desc:"The cached token key is not a valid JSON and cannot be parsed"},blockTokenRequestsInHiddenIframe:{code:"block_token_requests",desc:"Token calls are blocked in hidden iframes"}},E=(function(o){O(e,o);function e(t,r){var n=o.call(this,t,r)||this;return n.name="ClientAuthError",Object.setPrototypeOf(n,e.prototype),n}return e.createEndpointResolutionError=function(t){var r=d.endpointResolutionError.desc;return t&&!m.isEmpty(t)&&(r+=" Details: "+t),new e(d.endpointResolutionError.code,r)},e.createPopupWindowError=function(t){var r=d.popUpWindowError.desc;return t&&!m.isEmpty(t)&&(r+=" Details: "+t),new e(d.popUpWindowError.code,r)},e.createTokenRenewalTimeoutError=function(){return new e(d.tokenRenewalError.code,d.tokenRenewalError.desc)},e.createInvalidIdTokenError=function(t){return new e(d.invalidIdToken.code,d.invalidIdToken.desc+" Given token: "+t)},e.createInvalidStateError=function(t,r){return new e(d.invalidStateError.code,d.invalidStateError.desc+" "+t+", state expected : "+r+".")},e.createNonceMismatchError=function(t,r){return new e(d.nonceMismatchError.code,d.nonceMismatchError.desc+" "+t+", nonce expected : "+r+".")},e.createLoginInProgressError=function(){return new e(d.loginProgressError.code,d.loginProgressError.desc)},e.createAcquireTokenInProgressError=function(){return new e(d.acquireTokenProgressError.code,d.acquireTokenProgressError.desc)},e.createUserCancelledError=function(){return new e(d.userCancelledError.code,d.userCancelledError.desc)},e.createErrorInCallbackFunction=function(t){return new e(d.callbackError.code,d.callbackError.desc+" "+t+".")},e.createUserLoginRequiredError=function(){return new e(d.userLoginRequiredError.code,d.userLoginRequiredError.desc)},e.createUserDoesNotExistError=function(){return new e(d.userDoesNotExistError.code,d.userDoesNotExistError.desc)},e.createClientInfoDecodingError=function(t){return new e(d.clientInfoDecodingError.code,d.clientInfoDecodingError.desc+" Failed with error: "+t)},e.createClientInfoNotPopulatedError=function(t){return new e(d.clientInfoNotPopulatedError.code,d.clientInfoNotPopulatedError.desc+" Failed with error: "+t)},e.createIdTokenNullOrEmptyError=function(t){return new e(d.nullOrEmptyIdToken.code,d.nullOrEmptyIdToken.desc+" Raw ID Token Value: "+t)},e.createIdTokenParsingError=function(t){return new e(d.idTokenNotParsed.code,d.idTokenNotParsed.desc+" Failed with error: "+t)},e.createTokenEncodingError=function(t){return new e(d.tokenEncodingError.code,d.tokenEncodingError.desc+" Attempted to decode: "+t)},e.createInvalidInteractionTypeError=function(){return new e(d.invalidInteractionType.code,d.invalidInteractionType.desc)},e.createCacheParseError=function(t){var r="invalid key: "+t+", "+d.cacheParseError.desc;return new e(d.cacheParseError.code,r)},e.createBlockTokenRequestsInHiddenIframeError=function(){return new e(d.blockTokenRequestsInHiddenIframe.code,d.blockTokenRequestsInHiddenIframe.desc)},e})(D);var v={configurationNotSet:{code:"no_config_set",desc:"Configuration has not been set. Please call the UserAgentApplication constructor with a valid Configuration object."},storageNotSupported:{code:"storage_not_supported",desc:"The value for the cacheLocation is not supported."},noRedirectCallbacksSet:{code:"no_redirect_callbacks",desc:"No redirect callbacks have been set. Please call handleRedirectCallback() with the appropriate function arguments before continuing. More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics."},invalidCallbackObject:{code:"invalid_callback_object",desc:"The object passed for the callback was invalid. More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics."},scopesRequired:{code:"scopes_required",desc:"Scopes are required to obtain an access token."},emptyScopes:{code:"empty_input_scopes_error",desc:"Scopes cannot be passed as empty array."},nonArrayScopes:{code:"nonarray_input_scopes_error",desc:"Scopes cannot be passed as non-array."},invalidPrompt:{code:"invalid_prompt_value",desc:"Supported prompt values are 'login', 'select_account', 'consent' and 'none'"},invalidAuthorityType:{code:"invalid_authority_type",desc:"The given authority is not a valid type of authority supported by MSAL. Please see here for valid authorities: <insert URL here>."},authorityUriInsecure:{code:"authority_uri_insecure",desc:"Authority URIs must use https."},authorityUriInvalidPath:{code:"authority_uri_invalid_path",desc:"Given authority URI is invalid."},unsupportedAuthorityValidation:{code:"unsupported_authority_validation",desc:"The authority validation is not supported for this authority type."},untrustedAuthority:{code:"untrusted_authority",desc:"The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter or set validateAuthority=false."},b2cAuthorityUriInvalidPath:{code:"b2c_authority_uri_invalid_path",desc:"The given URI for the B2C authority is invalid."},b2cKnownAuthoritiesNotSet:{code:"b2c_known_authorities_not_set",desc:"Must set known authorities when validateAuthority is set to True and using B2C"},claimsRequestParsingError:{code:"claims_request_parsing_error",desc:"Could not parse the given claims request object."},emptyRequestError:{code:"empty_request_error",desc:"Request object is required."},invalidCorrelationIdError:{code:"invalid_guid_sent_as_correlationId",desc:"Please set the correlationId as a valid guid"},telemetryConfigError:{code:"telemetry_config_error",desc:"Telemetry config is not configured with required values"},ssoSilentError:{code:"sso_silent_error",desc:"request must contain either sid or login_hint"},invalidAuthorityMetadataError:{code:"authority_metadata_error",desc:"Invalid authorityMetadata. Must be a JSON object containing authorization_endpoint, end_session_endpoint, and issuer fields."}},_=(function(o){O(e,o);function e(t,r){var n=o.call(this,t,r)||this;return n.name="ClientConfigurationError",Object.setPrototypeOf(n,e.prototype),n}return e.createNoSetConfigurationError=function(){return new e(v.configurationNotSet.code,""+v.configurationNotSet.desc)},e.createStorageNotSupportedError=function(t){return new e(v.storageNotSupported.code,v.storageNotSupported.desc+" Given location: "+t)},e.createRedirectCallbacksNotSetError=function(){return new e(v.noRedirectCallbacksSet.code,v.noRedirectCallbacksSet.desc)},e.createInvalidCallbackObjectError=function(t){return new e(v.invalidCallbackObject.code,v.invalidCallbackObject.desc+" Given value for callback function: "+t)},e.createEmptyScopesArrayError=function(t){return new e(v.emptyScopes.code,v.emptyScopes.desc+" Given value: "+t+".")},e.createScopesNonArrayError=function(t){return new e(v.nonArrayScopes.code,v.nonArrayScopes.desc+" Given value: "+t+".")},e.createScopesRequiredError=function(t){return new e(v.scopesRequired.code,v.scopesRequired.desc+" Given value: "+t)},e.createInvalidPromptError=function(t){return new e(v.invalidPrompt.code,v.invalidPrompt.desc+" Given value: "+t)},e.createClaimsRequestParsingError=function(t){return new e(v.claimsRequestParsingError.code,v.claimsRequestParsingError.desc+" Given value: "+t)},e.createEmptyRequestError=function(){var t=v.emptyRequestError,r=t.code,n=t.desc;return new e(r,n)},e.createInvalidCorrelationIdError=function(){return new e(v.invalidCorrelationIdError.code,v.invalidCorrelationIdError.desc)},e.createKnownAuthoritiesNotSetError=function(){return new e(v.b2cKnownAuthoritiesNotSet.code,v.b2cKnownAuthoritiesNotSet.desc)},e.createInvalidAuthorityTypeError=function(){return new e(v.invalidAuthorityType.code,v.invalidAuthorityType.desc)},e.createUntrustedAuthorityError=function(t){return new e(v.untrustedAuthority.code,v.untrustedAuthority.desc+" Provided Authority: "+t)},e.createTelemetryConfigError=function(t){var r=v.telemetryConfigError,n=r.code,i=r.desc,a={applicationName:"string",applicationVersion:"string",telemetryEmitter:"function"},s=Object.keys(a).reduce(function(c,u){return t[u]?c:c.concat([u+" ("+a[u]+")"])},[]);return new e(n,i+" mising values: "+s.join(","))},e.createSsoSilentError=function(){return new e(v.ssoSilentError.code,v.ssoSilentError.desc)},e.createInvalidAuthorityMetadataError=function(){return new e(v.invalidAuthorityMetadataError.code,v.invalidAuthorityMetadataError.desc)},e})(E);var N=(function(){function o(){}return o.isIntersectingScopes=function(e,t){for(var r=this.trimAndConvertArrayToLowerCase(U(e)),n=this.trimAndConvertArrayToLowerCase(U(t)),i=0;i<n.length;i++)if(r.indexOf(n[i].toLowerCase())>-1)return!0;return!1},o.containsScope=function(e,t){var r=this.trimAndConvertArrayToLowerCase(U(e)),n=this.trimAndConvertArrayToLowerCase(U(t));return n.every(function(i){return r.indexOf(i.toString().toLowerCase())>=0})},o.trimAndConvertToLowerCase=function(e){return e.trim().toLowerCase()},o.trimAndConvertArrayToLowerCase=function(e){var t=this;return e.map(function(r){return t.trimAndConvertToLowerCase(r)})},o.trimScopes=function(e){return e.map(function(t){return t.trim()})},o.removeElement=function(e,t){var r=this.trimAndConvertToLowerCase(t);return e.filter(function(n){return n!==r})},o.parseScope=function(e){var t="";if(e)for(var r=0;r<e.length;++r)t+=r!==e.length-1?e[r]+" ":e[r];return t},o.validateInputScope=function(e,t){if(!e){if(t)throw _.createScopesRequiredError(e);return}if(!Array.isArray(e))throw _.createScopesNonArrayError(e);if(e.length<1&&t)throw _.createEmptyScopesArrayError(e.toString())},o.getScopeFromState=function(e){if(e){var t=e.indexOf(l.resourceDelimiter);if(t>-1&&t+1<e.length)return e.substring(t+1)}return""},o.appendScopes=function(e,t){if(e){var r=t?this.trimAndConvertArrayToLowerCase(U(t)):null,n=this.trimAndConvertArrayToLowerCase(U(e));return r?U(n,r):n}return null},o.onlyContainsOidcScopes=function(e){var t=e.length,r=0;return e.indexOf(l.openidScope)>-1&&(r+=1),e.indexOf(l.profileScope)>-1&&(r+=1),t>0&&t===r},o.containsAnyOidcScopes=function(e){var t=e.indexOf(l.openidScope)>-1,r=e.indexOf(l.profileScope)>-1;return t||r},o.onlyContainsClientId=function(e,t){return!!e&&e.indexOf(t)>-1&&e.length===1},o.appendDefaultScopes=function(e){var t=e;return t.indexOf(l.openidScope)===-1&&t.push(l.openidScope),t.indexOf(l.profileScope)===-1&&t.push(l.profileScope),t},o.removeDefaultScopes=function(e){return e.filter(function(t){return t!==l.openidScope&&t!==l.profileScope})},o.translateClientIdIfSingleScope=function(e,t){return this.onlyContainsClientId(e,t)?l.oidcScopes:e},o})();var f=(function(){function o(){}return o.createNavigateUrl=function(e){var t=this.createNavigationUrlString(e),r=e.authorityInstance.AuthorizationEndpoint;r.indexOf("?")<0?r+="?":r+="&";var n=""+r+t.join("&");return n},o.createNavigationUrlString=function(e){var t=N.appendDefaultScopes(e.scopes),r=[];return r.push("response_type="+e.responseType),r.push("scope="+encodeURIComponent(N.parseScope(t))),r.push("client_id="+encodeURIComponent(e.clientId)),r.push("redirect_uri="+encodeURIComponent(e.redirectUri)),r.push("state="+encodeURIComponent(e.state)),r.push("nonce="+encodeURIComponent(e.nonce)),r.push("client_info=1"),r.push("x-client-SKU="+e.xClientSku),r.push("x-client-Ver="+e.xClientVer),e.promptValue&&r.push("prompt="+encodeURIComponent(e.promptValue)),e.claimsValue&&r.push("claims="+encodeURIComponent(e.claimsValue)),e.queryParameters&&r.push(e.queryParameters),e.extraQueryParameters&&r.push(e.extraQueryParameters),r.push("client-request-id="+encodeURIComponent(e.correlationId)),r},o.getCurrentUrl=function(){return window.location.href.split("?")[0].split("#")[0]},o.removeHashFromUrl=function(e){return e.split("#")[0]},o.replaceTenantPath=function(e,t){var r=e.toLowerCase(),n=this.GetUrlComponents(r),i=n.PathSegments;return t&&i.length!==0&&(i[0]===l.common||i[0]===w.ORGANIZATIONS||i[0]===w.CONSUMERS)&&(i[0]=t),this.constructAuthorityUriFromObject(n,i)},o.constructAuthorityUriFromObject=function(e,t){return this.CanonicalizeUri(e.Protocol+"//"+e.HostNameAndPort+"/"+t.join("/"))},o.isCommonAuthority=function(e){var t=this.CanonicalizeUri(e),r=this.GetUrlComponents(t).PathSegments;return r.length!==0&&r[0]===l.common},o.isOrganizationsAuthority=function(e){var t=this.CanonicalizeUri(e),r=this.GetUrlComponents(t).PathSegments;return r.length!==0&&r[0]===w.ORGANIZATIONS},o.isConsumersAuthority=function(e){var t=this.CanonicalizeUri(e),r=this.GetUrlComponents(t).PathSegments;return r.length!==0&&r[0]===w.CONSUMERS},o.GetUrlComponents=function(e){if(!e)throw"Url required";var t=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),r=e.match(t);if(!r||r.length<6)throw"Valid url required";var n={Protocol:r[1],HostNameAndPort:r[4],AbsolutePath:r[5]},i=n.AbsolutePath.split("/");return i=i.filter(function(a){return a&&a.length>0}),n.PathSegments=i,r[6]&&(n.Search=r[6]),r[8]&&(n.Hash=r[8]),n},o.CanonicalizeUri=function(e){if(e){var t=e.toLowerCase();return o.endsWith(t,"/")||(t+="/"),t}return e},o.endsWith=function(e,t){return!e||!t?!1:e.indexOf(t,e.length-t.length)!==-1},o.urlRemoveQueryStringParameter=function(e,t){if(m.isEmpty(e))return e;var r=e,n=new RegExp("(\\&"+t+"=)[^&]+");return r=e.replace(n,""),n=new RegExp("("+t+"=)[^&]+&"),r=e.replace(n,""),n=new RegExp("("+t+"=)[^&]+"),r=e.replace(n,""),r},o.getHashFromUrl=function(e){var t=e.indexOf("#"),r=e.indexOf("#/");return r>-1?e.substring(r+2):t>-1?e.substring(t+1):e},o.urlContainsHash=function(e){var t=o.deserializeHash(e);return t.hasOwnProperty(p.ERROR_DESCRIPTION)||t.hasOwnProperty(p.ERROR)||t.hasOwnProperty(p.ACCESS_TOKEN)||t.hasOwnProperty(p.ID_TOKEN)},o.deserializeHash=function(e){var t=o.getHashFromUrl(e);return b.deserialize(t)},o.getHostFromUri=function(e){var t=String(e).replace(/^(https?:)\/\//,"");return t=t.split("/")[0],t},o})();var Le=(function(){function o(e,t,r,n,i){this.authority=f.CanonicalizeUri(e),this.clientId=t,this.scopes=r,this.homeAccountIdentifier=b.base64Encode(n)+"."+b.base64Encode(i)}return o})();var Me=(function(){function o(e,t,r,n){this.accessToken=e,this.idToken=t,this.expiresIn=r,this.homeAccountIdentifier=n}return o})();var ne="1.4.18";var X=(function(){function o(e,t,r,n,i,a,s){this.authorityInstance=e,this.clientId=t,this.nonce=b.createNewGuid(),this.scopes=i?U(i):l.oidcScopes,this.scopes=N.trimScopes(this.scopes),this.state=a,this.correlationId=s,this.xClientSku="MSAL.JS",this.xClientVer=ne,this.responseType=r,this.redirectUri=n}return Object.defineProperty(o.prototype,"authority",{get:function(){return this.authorityInstance?this.authorityInstance.CanonicalAuthority:null},enumerable:!1,configurable:!0}),o.prototype.populateQueryParams=function(e,t,r,n){var i={};t&&(t.prompt&&(this.promptValue=t.prompt),t.claimsRequest&&(this.claimsValue=t.claimsRequest),o.isSSOParam(t)&&(i=this.constructUnifiedCacheQueryParameter(t,null))),r&&(i=this.constructUnifiedCacheQueryParameter(null,r)),i=this.addHintParameters(e,i);var a=t?t.extraQueryParameters:null;this.queryParameters=o.generateQueryParametersString(i),this.extraQueryParameters=o.generateQueryParametersString(a,n)},o.prototype.constructUnifiedCacheQueryParameter=function(e,t){var r,n,i,a={};if(e)if(e.account){var s=e.account;!((r=s.idTokenClaims)===null||r===void 0)&&r.login_hint?(n=w.LOGIN_HINT,i=s.idTokenClaims.login_hint):s.sid?(n=w.SID,i=s.sid):s.userName&&(n=w.LOGIN_HINT,i=s.userName)}else e.sid?(n=w.SID,i=e.sid):e.loginHint&&(n=w.LOGIN_HINT,i=e.loginHint);else t&&t.hasOwnProperty(l.upn)&&(n=w.ID_TOKEN,i=t.upn);return a=this.addSSOParameter(n,i),a},o.prototype.addHintParameters=function(e,t){var r,n,i=t;return e&&!i[w.SID]&&!i[w.LOGIN_HINT]&&(!((r=e.idTokenClaims)===null||r===void 0)&&r.login_hint?i=this.addSSOParameter(w.LOGIN_HINT,(n=e.idTokenClaims)===null||n===void 0?void 0:n.login_hint,i):e.sid&&this.promptValue===oe.NONE?i=this.addSSOParameter(w.SID,e.sid,i):e.userName&&(i=this.addSSOParameter(w.LOGIN_HINT,e.userName,i))),i},o.prototype.addSSOParameter=function(e,t,r){var n=r||{};if(!t)return n;switch(e){case w.SID:{n[w.SID]=t;break}case w.ID_TOKEN:{n[w.LOGIN_HINT]=t;break}case w.LOGIN_HINT:{n[w.LOGIN_HINT]=t;break}}return n},o.generateQueryParametersString=function(e,t){var r=null;return e&&Object.keys(e).forEach(function(n){n===l.domain_hint&&(t||e[w.SID])||(r?r+="&"+n+"="+encodeURIComponent(e[n]):r=n+"="+encodeURIComponent(e[n]))}),r},o.isSSOParam=function(e){return!!(e&&(e.account||e.sid||e.loginHint))},o.determineResponseType=function(e,t){return N.onlyContainsOidcScopes(t)?Q.id_token:e?this.responseTypeForMatchingAccounts(t):Q.id_token_token},o.responseTypeForMatchingAccounts=function(e){return N.containsAnyOidcScopes(e)?Q.id_token_token:Q.token},o})();var me=(function(){function o(){}return o.prototype.sendRequestAsync=function(e,t,r){var n=this;return new Promise(function(i,a){var s=new XMLHttpRequest;if(s.open(t,e,!0),s.onload=function(){(s.status<200||s.status>=300)&&a(n.handleError(s.responseText));var c;try{c=JSON.parse(s.responseText)}catch{a(n.handleError(s.responseText))}var u={statusCode:s.status,body:c};i(u)},s.onerror=function(){a(s.status)},t===se.GET)s.send();else throw"not implemented"})},o.prototype.handleError=function(e){var t;try{if(t=JSON.parse(e),t.error)return t.error;throw e}catch{return e}},o})();var ce=(function(){function o(){}return o.setTrustedAuthoritiesFromConfig=function(e,t){e&&!this.getTrustedHostList().length&&t.forEach(function(r){o.TrustedHostList.push(r.toLowerCase())})},o.getAliases=function(e,t,r){return G(this,void 0,void 0,function(){var n,i,a,s;return W(this,function(c){return n=new me,i=se.GET,a=""+xe+e+"oauth2/v2.0/authorize",s=t.createAndStartHttpEvent(r,i,a,"getAliases"),[2,n.sendRequestAsync(a,i,!0).then(function(u){return s.httpResponseStatus=u.statusCode,t.stopEvent(s),u.body.metadata}).catch(function(u){throw s.serverErrorCode=u,t.stopEvent(s),u})]})})},o.setTrustedAuthoritiesFromNetwork=function(e,t,r){return G(this,void 0,void 0,function(){var n,i;return W(this,function(a){switch(a.label){case 0:return[4,this.getAliases(e,t,r)];case 1:return n=a.sent(),n.forEach(function(s){var c=s.aliases;c.forEach(function(u){o.TrustedHostList.push(u.toLowerCase())})}),i=f.GetUrlComponents(e).HostNameAndPort,o.getTrustedHostList().length&&!o.IsInTrustedHostList(i)&&o.TrustedHostList.push(i.toLowerCase()),[2]}})})},o.getTrustedHostList=function(){return this.TrustedHostList},o.IsInTrustedHostList=function(e){return this.TrustedHostList.indexOf(e.toLowerCase())>-1},o.TrustedHostList=[],o})();var ee;(function(o){o[o.Default=0]="Default",o[o.Adfs=1]="Adfs"})(ee||(ee={}));var ve=(function(){function o(e,t,r){this.IsValidationEnabled=t,this.CanonicalAuthority=e,this.validateAsUri(),this.tenantDiscoveryResponse=r}return o.isAdfs=function(e){var t=f.GetUrlComponents(e),r=t.PathSegments;return r.length&&r[0].toLowerCase()===l.ADFS},Object.defineProperty(o.prototype,"AuthorityType",{get:function(){return o.isAdfs(this.canonicalAuthority)?ee.Adfs:ee.Default},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"Tenant",{get:function(){return this.CanonicalAuthorityUrlComponents.PathSegments[0]},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"AuthorizationEndpoint",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.AuthorizationEndpoint.replace(/{tenant}|{tenantid}/g,this.Tenant)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"EndSessionEndpoint",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.EndSessionEndpoint.replace(/{tenant}|{tenantid}/g,this.Tenant)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"SelfSignedJwtAudience",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.Issuer.replace(/{tenant}|{tenantid}/g,this.Tenant)},enumerable:!1,configurable:!0}),o.prototype.validateResolved=function(){if(!this.hasCachedMetadata())throw"Please call ResolveEndpointsAsync first"},Object.defineProperty(o.prototype,"CanonicalAuthority",{get:function(){return this.canonicalAuthority},set:function(e){this.canonicalAuthority=f.CanonicalizeUri(e),this.canonicalAuthorityUrlComponents=null},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"CanonicalAuthorityUrlComponents",{get:function(){return this.canonicalAuthorityUrlComponents||(this.canonicalAuthorityUrlComponents=f.GetUrlComponents(this.CanonicalAuthority)),this.canonicalAuthorityUrlComponents},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"DefaultOpenIdConfigurationEndpoint",{get:function(){return this.AuthorityType===ee.Adfs?""+this.CanonicalAuthority+we:this.CanonicalAuthority+"v2.0/"+we},enumerable:!1,configurable:!0}),o.prototype.validateAsUri=function(){var e;try{e=this.CanonicalAuthorityUrlComponents}catch{throw v.invalidAuthorityType}if(!e.Protocol||e.Protocol.toLowerCase()!=="https:")throw v.authorityUriInsecure;if(!e.PathSegments||e.PathSegments.length<1)throw v.authorityUriInvalidPath},o.prototype.DiscoverEndpoints=function(e,t,r){var n=new me,i=se.GET,a=t.createAndStartHttpEvent(r,i,e,"openIdConfigurationEndpoint");return n.sendRequestAsync(e,i,!0).then(function(s){return a.httpResponseStatus=s.statusCode,t.stopEvent(a),{AuthorizationEndpoint:s.body.authorization_endpoint,EndSessionEndpoint:s.body.end_session_endpoint,Issuer:s.body.issuer}}).catch(function(s){throw a.serverErrorCode=s,t.stopEvent(a),s})},o.prototype.resolveEndpointsAsync=function(e,t){return G(this,void 0,void 0,function(){var r,n,i;return W(this,function(a){switch(a.label){case 0:return this.IsValidationEnabled?(r=this.canonicalAuthorityUrlComponents.HostNameAndPort,ce.getTrustedHostList().length!==0?[3,2]:[4,ce.setTrustedAuthoritiesFromNetwork(this.canonicalAuthority,e,t)]):[3,3];case 1:a.sent(),a.label=2;case 2:if(!ce.IsInTrustedHostList(r))throw _.createUntrustedAuthorityError(r);a.label=3;case 3:return n=this.GetOpenIdConfigurationEndpoint(),i=this,[4,this.DiscoverEndpoints(n,e,t)];case 4:return i.tenantDiscoveryResponse=a.sent(),[2,this.tenantDiscoveryResponse]}})})},o.prototype.hasCachedMetadata=function(){return!!(this.tenantDiscoveryResponse&&this.tenantDiscoveryResponse.AuthorizationEndpoint&&this.tenantDiscoveryResponse.EndSessionEndpoint&&this.tenantDiscoveryResponse.Issuer)},o.prototype.GetOpenIdConfigurationEndpoint=function(){return this.DefaultOpenIdConfigurationEndpoint},o})();var ie=(function(){function o(e,t){if(!e||m.isEmpty(e)){this.uid="",this.utid="";return}try{var r=b.base64Decode(e),n=JSON.parse(r);n&&(n.hasOwnProperty("uid")&&(this.uid=t?o.stripPolicyFromUid(n.uid,t):n.uid),n.hasOwnProperty("utid")&&(this.utid=n.utid))}catch(i){throw E.createClientInfoDecodingError(i)}}return Object.defineProperty(o.prototype,"uid",{get:function(){return this._uid?this._uid:""},set:function(e){this._uid=e},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"utid",{get:function(){return this._utid?this._utid:""},set:function(e){this._utid=e},enumerable:!1,configurable:!0}),o.createClientInfoFromIdToken=function(e,t){var r={uid:e.subject,utid:""};return new o(b.base64Encode(JSON.stringify(r)),t)},o.stripPolicyFromUid=function(e,t){var r=e.split("-"),n=t.split("/").reverse(),i="";return m.isEmpty(n[0])?n.length>1&&(i=n[1]):i=n[0],r[r.length-1]===i?r.slice(0,r.length-1).join("-"):e},o.prototype.encodeClientInfo=function(){var e=JSON.stringify({uid:this.uid,utid:this.utid});return b.base64Encode(e)},o})();var Y=(function(){function o(){}return o.parseExpiresIn=function(e){var t=e||"3599";return parseInt(t,10)},o.now=function(){return Math.round(new Date().getTime()/1e3)},o.relativeNowMs=function(){return window.performance.now()},o})();var ue=(function(){function o(){}return o.decodeJwt=function(e){if(m.isEmpty(e))return null;var t=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/,r=t.exec(e);if(!r||r.length<4)return null;var n={header:r[1],JWSPayload:r[2],JWSSig:r[3]};return n},o.validateExpirationIsWithinOffset=function(e,t){var r=t||300;return e&&e>Y.now()+r},o.extractIdToken=function(e){var t=this.decodeJwt(e);if(!t)return null;try{var r=t.JWSPayload,n=b.base64Decode(r);return n?JSON.parse(n):null}catch{}return null},o})();var $=(function(){function o(e){if(m.isEmpty(e))throw E.createIdTokenNullOrEmptyError(e);try{this.rawIdToken=e,this.claims=ue.extractIdToken(e),this.claims&&(this.claims.hasOwnProperty("iss")&&(this.issuer=this.claims.iss),this.claims.hasOwnProperty("oid")&&(this.objectId=this.claims.oid),this.claims.hasOwnProperty("sub")&&(this.subject=this.claims.sub),this.claims.hasOwnProperty("tid")&&(this.tenantId=this.claims.tid),this.claims.hasOwnProperty("ver")&&(this.version=this.claims.ver),this.claims.hasOwnProperty("preferred_username")?this.preferredName=this.claims.preferred_username:this.claims.hasOwnProperty("upn")&&(this.preferredName=this.claims.upn),this.claims.hasOwnProperty("name")&&(this.name=this.claims.name),this.claims.hasOwnProperty("nonce")&&(this.nonce=this.claims.nonce),this.claims.hasOwnProperty("exp")&&(this.expiration=this.claims.exp),this.claims.hasOwnProperty("home_oid")&&(this.homeObjectId=this.claims.home_oid),this.claims.hasOwnProperty("sid")&&(this.sid=this.claims.sid),this.claims.hasOwnProperty("cloud_instance_host_name")&&(this.cloudInstance=this.claims.cloud_instance_host_name))}catch(t){throw E.createIdTokenParsingError(t)}}return o})();var He=(function(){function o(e,t){this.key=e,this.value=t}return o})();var Ae=(function(){function o(e){if(!window)throw D.createNoWindowObjectError("Browser storage class could not find window object");var t=typeof window[e]<"u"&&window[e]!==null;if(!t)throw _.createStorageNotSupportedError(e);this.cacheLocation=e}return o.prototype.setItem=function(e,t,r){window[this.cacheLocation].setItem(e,t),r&&this.setItemCookie(e,t)},o.prototype.getItem=function(e,t){return t&&this.getItemCookie(e)?this.getItemCookie(e):window[this.cacheLocation].getItem(e)},o.prototype.removeItem=function(e){return window[this.cacheLocation].removeItem(e)},o.prototype.clear=function(){return window[this.cacheLocation].clear()},o.prototype.setItemCookie=function(e,t,r){var n=encodeURIComponent(e)+"="+encodeURIComponent(t)+";path=/;";if(r){var i=this.getCookieExpirationTime(r);n+="expires="+i+";"}document.cookie=n},o.prototype.getItemCookie=function(e){for(var t=encodeURIComponent(e)+"=",r=document.cookie.split(";"),n=0;n<r.length;n++){for(var i=r[n];i.charAt(0)===" ";)i=i.substring(1);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}return""},o.prototype.clearItemCookie=function(e){this.setItemCookie(e,"",-1)},o.prototype.getCookieExpirationTime=function(e){var t=new Date,r=new Date(t.getTime()+e*24*60*60*1e3);return r.toUTCString()},o})();var F=(function(){function o(){}return o.validateRequest=function(e,t,r,n){if(!t&&!e)throw _.createEmptyRequestError();var i,a;e&&(i=t?N.appendScopes(e.scopes,e.extraScopesToConsent):e.scopes,N.validateInputScope(i,!t),i=N.translateClientIdIfSingleScope(i,r),this.validatePromptParameter(e.prompt),a=this.validateEQParameters(e.extraQueryParameters,e.claimsRequest),this.validateClaimsRequest(e.claimsRequest));var s=this.validateAndGenerateState(e&&e.state,n),c=this.validateAndGenerateCorrelationId(e&&e.correlationId),u=S(S({},e),{extraQueryParameters:a,scopes:i,state:s,correlationId:c});return u},o.validatePromptParameter=function(e){if(e&&[oe.LOGIN,oe.SELECT_ACCOUNT,oe.CONSENT,oe.NONE].indexOf(e)<0)throw _.createInvalidPromptError(e)},o.validateEQParameters=function(e,t){var r=S({},e);return r?(t&&delete r[l.claims],Ue.forEach(function(n){r[n]&&delete r[n]}),r):null},o.validateClaimsRequest=function(e){if(e)try{JSON.parse(e)}catch(t){throw _.createClaimsRequestParsingError(t)}},o.validateAndGenerateState=function(e,t){return m.isEmpty(e)?o.generateLibraryState(t):""+o.generateLibraryState(t)+l.resourceDelimiter+e},o.generateLibraryState=function(e){var t={id:b.createNewGuid(),ts:Y.now(),method:e},r=JSON.stringify(t);return b.base64Encode(r)},o.parseLibraryState=function(e){var t=decodeURIComponent(e).split(l.resourceDelimiter)[0];if(b.isGuid(t))return{id:t,ts:Y.now(),method:l.interactionTypeRedirect};try{var r=b.base64Decode(t),n=JSON.parse(r);return n}catch{throw E.createInvalidStateError(e,null)}},o.validateAndGenerateCorrelationId=function(e){if(e&&!b.isGuid(e))throw _.createInvalidCorrelationIdError();return b.isGuid(e)?e:b.createNewGuid()},o.createRequestSignature=function(e){return""+e.scopes.join(" ").toLowerCase()+l.resourceDelimiter+e.authority},o})();var A=(function(o){O(e,o);function e(t,r,n){var i=o.call(this,r)||this;return i.temporaryCache=new Ae(Ne),i.clientId=t,i.rollbackEnabled=!0,i.migrateCacheEntries(n),i}return e.prototype.migrateCacheEntries=function(t){var r=this,n=l.cachePrefix+"."+H.IDTOKEN,i=l.cachePrefix+"."+H.CLIENT_INFO,a=l.cachePrefix+"."+P.ERROR,s=l.cachePrefix+"."+P.ERROR_DESC,c=o.prototype.getItem.call(this,n),u;if(c)try{u=new $(c)}catch{return}if(u&&u.claims&&u.claims.aud===this.clientId){var h=o.prototype.getItem.call(this,i),T=o.prototype.getItem.call(this,a),y=o.prototype.getItem.call(this,s),C=[c,h,T,y],k=[H.IDTOKEN,H.CLIENT_INFO,P.ERROR,P.ERROR_DESC];k.forEach(function(x,V){return r.duplicateCacheEntry(x,C[V],t)})}},e.prototype.duplicateCacheEntry=function(t,r,n){r&&this.setItem(t,r,n)},e.prototype.generateCacheKey=function(t,r){try{return JSON.parse(t),t}catch{return t.indexOf(""+l.cachePrefix)===0||t.indexOf(l.adalIdToken)===0?t:r?l.cachePrefix+"."+this.clientId+"."+t:l.cachePrefix+"."+t}},e.prototype.matchKeyForType=function(t,r,n,i){var a=m.validateAndParseJsonCacheKey(t);if(!a)return null;var s=t.match(r)&&t.match(n),c=!1;switch(i){case p.ACCESS_TOKEN:c=!!t.match(l.scopes);break;case p.ID_TOKEN:c=!t.match(l.scopes);break}return s&&c?a:null},e.prototype.setItem=function(t,r,n){o.prototype.setItem.call(this,this.generateCacheKey(t,!0),r,n),this.rollbackEnabled&&!n&&o.prototype.setItem.call(this,this.generateCacheKey(t,!1),r,n)},e.prototype.getItem=function(t,r){return o.prototype.getItem.call(this,this.generateCacheKey(t,!0),r)},e.prototype.removeItem=function(t){this.temporaryCache.removeItem(this.generateCacheKey(t,!0)),o.prototype.removeItem.call(this,this.generateCacheKey(t,!0)),this.rollbackEnabled&&o.prototype.removeItem.call(this,this.generateCacheKey(t,!1))},e.prototype.setTemporaryItem=function(t,r,n){this.temporaryCache.setItem(this.generateCacheKey(t,!0),r,n)},e.prototype.getTemporaryItem=function(t,r){return this.temporaryCache.getItem(this.generateCacheKey(t,!0),r)},e.prototype.resetCacheItems=function(){var t=window[this.cacheLocation],r;for(r in t)t.hasOwnProperty(r)&&r.indexOf(l.cachePrefix)!==-1&&o.prototype.removeItem.call(this,r)},e.prototype.resetTempCacheItems=function(t){var r=this,n=t&&F.parseLibraryState(t).id,i=this.tokenRenewalInProgress(t),a=window[this.cacheLocation];n&&!i&&Object.keys(a).forEach(function(s){s.indexOf(n)!==-1&&(r.removeItem(s),o.prototype.clearItemCookie.call(r,s))}),this.setInteractionInProgress(!1),this.removeItem(I.REDIRECT_REQUEST)},e.prototype.setItemCookie=function(t,r,n){o.prototype.setItemCookie.call(this,this.generateCacheKey(t,!0),r,n),this.rollbackEnabled&&o.prototype.setItemCookie.call(this,this.generateCacheKey(t,!1),r,n)},e.prototype.clearItemCookie=function(t){o.prototype.clearItemCookie.call(this,this.generateCacheKey(t,!0)),this.rollbackEnabled&&o.prototype.clearItemCookie.call(this,this.generateCacheKey(t,!1))},e.prototype.getItemCookie=function(t){return o.prototype.getItemCookie.call(this,this.generateCacheKey(t,!0))},e.prototype.getAllTokensByType=function(t,r,n){var i=this,a=Object.keys(window[this.cacheLocation]).reduce(function(s,c){var u=i.matchKeyForType(c,t,r,n);if(u){var h=i.getItem(c);if(h)try{var T=new He(u,JSON.parse(h));return s.concat([T])}catch{return s}}return s},[]);return a},e.prototype.getAllAccessTokens=function(t,r){return this.getAllTokensByType(t,r,p.ACCESS_TOKEN)},e.prototype.getAllIdTokens=function(t,r){return this.getAllTokensByType(t,r,p.ID_TOKEN)},e.prototype.getAllTokens=function(t,r){var n=this.getAllAccessTokens(t,r),i=this.getAllIdTokens(t,r);return U(n,i)},e.prototype.isInteractionInProgress=function(t){var r=this.getInteractionInProgress();return t?r===this.clientId:!!r},e.prototype.getInteractionInProgress=function(){return this.getTemporaryItem(this.generateCacheKey(I.INTERACTION_STATUS,!1))},e.prototype.setInteractionInProgress=function(t){if(t){if(this.isInteractionInProgress(!1))throw E.createAcquireTokenInProgressError();this.setTemporaryItem(this.generateCacheKey(I.INTERACTION_STATUS,!1),this.clientId)}else!t&&this.isInteractionInProgress(!0)&&this.removeItem(this.generateCacheKey(I.INTERACTION_STATUS,!1))},e.prototype.tokenRenewalInProgress=function(t){var r=this.getItem(e.generateTemporaryCacheKey(I.RENEW_STATUS,t));return!!(r&&r===l.inProgress)},e.prototype.clearMsalCookie=function(t){var r=this;if(t)this.clearItemCookie(e.generateTemporaryCacheKey(I.NONCE_IDTOKEN,t)),this.clearItemCookie(e.generateTemporaryCacheKey(I.STATE_LOGIN,t)),this.clearItemCookie(e.generateTemporaryCacheKey(I.LOGIN_REQUEST,t)),this.clearItemCookie(e.generateTemporaryCacheKey(I.STATE_ACQ_TOKEN,t));else{var n=document.cookie.split(";");n.forEach(function(i){var a=i.trim().split("=")[0];a.indexOf(l.cachePrefix)>-1&&o.prototype.clearItemCookie.call(r,a)})}},e.generateAcquireTokenAccountKey=function(t,r){var n=F.parseLibraryState(r).id;return""+I.ACQUIRE_TOKEN_ACCOUNT+l.resourceDelimiter+t+l.resourceDelimiter+n},e.generateAuthorityKey=function(t){return e.generateTemporaryCacheKey(I.AUTHORITY,t)},e.generateTemporaryCacheKey=function(t,r){var n=F.parseLibraryState(r).id;return""+t+l.resourceDelimiter+n},e})(Ae);var ae=(function(){function o(e,t,r,n,i,a,s){this.accountIdentifier=e,this.homeAccountIdentifier=t,this.userName=r,this.name=n,this.idToken=i,this.idTokenClaims=i,this.sid=a,this.environment=s}return o.createAccount=function(e,t){var r=e.objectId||e.subject,n=t?t.uid:"",i=t?t.utid:"",a;return m.isEmpty(n)||(a=m.isEmpty(i)?b.base64Encode(n):b.base64Encode(n)+"."+b.base64Encode(i)),new o(r,a,e.preferredName,e.name,e.claims,e.sid,e.issuer)},o.compareAccounts=function(e,t){return!e||!t?!1:!!(e.homeAccountIdentifier&&t.homeAccountIdentifier&&e.homeAccountIdentifier===t.homeAccountIdentifier)},o})();var L=(function(){function o(){}return o.isInIframe=function(){return window.parent!==window},o.isInPopup=function(){return!!(window.opener&&window.opener!==window)},o.generateFrameName=function(e,t){return""+e+l.resourceDelimiter+t},o.monitorIframeForHash=function(e,t,r,n){return new Promise(function(i,a){var s=Y.relativeNowMs(),c=s+t;n.verbose("monitorWindowForIframe polling started");var u=setInterval(function(){if(Y.relativeNowMs()>c){n.error("monitorIframeForHash unable to find hash in url, timing out"),n.errorPii("monitorIframeForHash polling timed out for url: "+r),clearInterval(u),a(E.createTokenRenewalTimeoutError());return}var h;try{h=e.location.href}catch{}h&&f.urlContainsHash(h)&&(n.verbose("monitorIframeForHash found url in hash"),clearInterval(u),i(e.location.hash))},o.POLLING_INTERVAL_MS)})},o.monitorPopupForHash=function(e,t,r,n){return new Promise(function(i,a){var s=t/o.POLLING_INTERVAL_MS,c=0;n.verbose("monitorWindowForHash polling started");var u=setInterval(function(){if(e.closed){n.error("monitorWindowForHash window closed"),clearInterval(u),a(E.createUserCancelledError());return}var h;try{h=e.location.href}catch{}if(!(!h||h==="about:blank"))if(c++,h&&f.urlContainsHash(h)){n.verbose("monitorPopupForHash found url in hash"),clearInterval(u);var T=e.location.hash;o.clearUrlFragment(e),i(T)}else c>s&&(n.error("monitorPopupForHash unable to find hash in url, timing out"),n.errorPii("monitorPopupForHash polling timed out for url: "+r),clearInterval(u),a(E.createTokenRenewalTimeoutError()))},o.POLLING_INTERVAL_MS)})},o.loadFrame=function(e,t,r,n){var i=this;return n.infoPii("LoadFrame: "+t),new Promise(function(a,s){setTimeout(function(){var c=i.loadFrameSync(e,t,n);if(!c){s("Unable to load iframe with name: "+t);return}a(c)},r)})},o.loadFrameSync=function(e,t,r){var n=o.addHiddenIFrame(t,r);if(n)(n.src===""||n.src==="about:blank")&&(n.src=e,r.infoPii("Frame Name : "+t+" Navigated to: "+e));else return null;return n},o.addHiddenIFrame=function(e,t){if(typeof e>"u")return null;t.info("Add msal iframe to document"),t.infoPii("Add msal frame to document:"+e);var r=document.getElementById(e);if(r)t.verbose("Add msal iframe already exists");else{t.verbose("Add msal iframe does not exist");var n=document.createElement("iframe");n.setAttribute("id",e),n.setAttribute("aria-hidden","true"),n.style.visibility="hidden",n.style.position="absolute",n.style.width=n.style.height="0",n.style.border="0",n.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),r=document.getElementsByTagName("body")[0].appendChild(n)}return r},o.removeHiddenIframe=function(e){document.body===e.parentNode&&document.body.removeChild(e)},o.getIframeWithHash=function(e){var t=document.getElementsByTagName("iframe"),r=Array.apply(null,Array(t.length)).map(function(n,i){return t.item(i)});return r.filter(function(n){try{return n.contentWindow.location.hash===e}catch{return!1}})[0]},o.getPopups=function(){return window.openedWindows||(window.openedWindows=[]),window.openedWindows},o.getPopUpWithHash=function(e){return o.getPopups().filter(function(t){try{return t.location.hash===e}catch{return!1}})[0]},o.trackPopup=function(e){o.getPopups().push(e)},o.closePopups=function(){o.getPopups().forEach(function(e){return e.close()})},o.blockReloadInHiddenIframes=function(){if(f.urlContainsHash(window.location.hash)&&o.isInIframe())throw E.createBlockTokenRequestsInHiddenIframeError()},o.checkIfBackButtonIsPressed=function(e){var t=e.getItem(I.REDIRECT_REQUEST);if(t&&!f.urlContainsHash(window.location.hash)){var r=t.split(l.resourceDelimiter);r.shift();var n=r.length>0?r.join(l.resourceDelimiter):null;e.resetTempCacheItems(n)}},o.clearUrlFragment=function(e){e.location.hash="",typeof e.history.replaceState=="function"&&e.history.replaceState(null,null,""+e.location.pathname+e.location.search)},o.POLLING_INTERVAL_MS=50,o})();var ye=(function(){function o(){}return o.setResponseIdToken=function(e,t){if(e){if(!t)return e}else return null;var r=Number(t.expiration);return r&&!e.expiresOn&&(e.expiresOn=new Date(r*1e3)),S(S({},e),{idToken:t,idTokenClaims:t.claims,uniqueId:t.objectId||t.subject,tenantId:t.tenantId})},o.buildAuthResponse=function(e,t,r,n,i,a){switch(r.responseType){case Q.id_token:var s=S(S({},t),{tokenType:p.ID_TOKEN,account:n,scopes:i,accountState:a});return s=o.setResponseIdToken(s,e),s.idToken?s:null;case Q.id_token_token:var c=o.setResponseIdToken(t,e);return c&&c.accessToken&&c.idToken?c:null;case Q.token:var u=o.setResponseIdToken(t,e);return u;default:return null}},o})();var z=(function(){function o(){}return o.saveMetadataFromNetwork=function(e,t,r){return G(this,void 0,void 0,function(){var n;return W(this,function(i){switch(i.label){case 0:return[4,e.resolveEndpointsAsync(t,r)];case 1:return n=i.sent(),this.metadataMap.set(e.CanonicalAuthority,n),[2,n]}})})},o.getMetadata=function(e){return this.metadataMap.get(e)},o.saveMetadataFromConfig=function(e,t){try{if(t){var r=JSON.parse(t);if(!r.authorization_endpoint||!r.end_session_endpoint||!r.issuer)throw _.createInvalidAuthorityMetadataError();this.metadataMap.set(e,{AuthorizationEndpoint:r.authorization_endpoint,EndSessionEndpoint:r.end_session_endpoint,Issuer:r.issuer})}}catch{throw _.createInvalidAuthorityMetadataError()}},o.CreateInstance=function(e,t,r){return m.isEmpty(e)?null:(r&&this.saveMetadataFromConfig(e,r),new ve(e,t,this.metadataMap.get(e)))},o.metadataMap=new Map,o})();var M;(function(o){o[o.Error=0]="Error",o[o.Warning=1]="Warning",o[o.Info=2]="Info",o[o.Verbose=3]="Verbose"})(M||(M={}));var De=(function(){function o(e,t){t===void 0&&(t={}),this.level=M.Info;var r=t.correlationId,n=r===void 0?"":r,i=t.level,a=i===void 0?M.Info:i,s=t.piiLoggingEnabled,c=s===void 0?!1:s;this.localCallback=e,this.correlationId=n,this.level=a,this.piiLoggingEnabled=c}return o.prototype.logMessage=function(e,t,r){if(!(e>this.level||!this.piiLoggingEnabled&&r)){var n=new Date().toUTCString(),i;m.isEmpty(this.correlationId)?i=n+":"+ne+"-"+M[e]+(r?"-pii":"")+" "+t:i=n+":"+this.correlationId+"-"+ne+"-"+M[e]+(r?"-pii":"")+" "+t,this.executeCallback(e,i,r)}},o.prototype.executeCallback=function(e,t,r){this.localCallback&&this.localCallback(e,t,r)},o.prototype.error=function(e){this.logMessage(M.Error,e,!1)},o.prototype.errorPii=function(e){this.logMessage(M.Error,e,!0)},o.prototype.warning=function(e){this.logMessage(M.Warning,e,!1)},o.prototype.warningPii=function(e){this.logMessage(M.Warning,e,!0)},o.prototype.info=function(e){this.logMessage(M.Info,e,!1)},o.prototype.infoPii=function(e){this.logMessage(M.Info,e,!0)},o.prototype.verbose=function(e){this.logMessage(M.Verbose,e,!1)},o.prototype.verbosePii=function(e){this.logMessage(M.Verbose,e,!0)},o.prototype.isPiiLoggingEnabled=function(){return this.piiLoggingEnabled},o})();var Xe=6e3,$e=300,Ze=500,et={clientId:"",authority:null,validateAuthority:!0,authorityMetadata:"",knownAuthorities:[],redirectUri:function(){return f.getCurrentUrl()},postLogoutRedirectUri:function(){return f.getCurrentUrl()},navigateToLoginRequestUrl:!0},tt={cacheLocation:"sessionStorage",storeAuthStateInCookie:!1},rt={logger:new De(null),loadFrameTimeout:Xe,tokenRenewalOffsetSeconds:$e,navigateFrameWait:Ze},ot={isAngular:!1,unprotectedResources:new Array,protectedResourceMap:new Map};function Fe(o){var e=o.auth,t=o.cache,r=t===void 0?{}:t,n=o.system,i=n===void 0?{}:n,a=o.framework,s=a===void 0?{}:a,c={auth:S(S({},et),e),cache:S(S({},tt),r),system:S(S({},rt),i),framework:S(S({},ot),s)};return c}var _e={serverUnavailable:{code:"server_unavailable",desc:"Server is temporarily unavailable."},unknownServerError:{code:"unknown_server_error"}},Ee=(function(o){O(e,o);function e(t,r){var n=o.call(this,t,r)||this;return n.name="ServerError",Object.setPrototypeOf(n,e.prototype),n}return e.createServerUnavailableError=function(){return new e(_e.serverUnavailable.code,_e.serverUnavailable.desc)},e.createUnknownServerError=function(t){return new e(_e.unknownServerError.code,t)},e})(D);var le={interactionRequired:{code:"interaction_required"},consentRequired:{code:"consent_required"},loginRequired:{code:"login_required"}},Te=(function(o){O(e,o);function e(t,r){var n=o.call(this,t,r)||this;return n.name="InteractionRequiredAuthError",Object.setPrototypeOf(n,e.prototype),n}return e.isInteractionRequiredError=function(t){var r=[le.interactionRequired.code,le.consentRequired.code,le.loginRequired.code];return t&&r.indexOf(t)>-1},e.createLoginRequiredAuthError=function(t){return new e(le.loginRequired.code,t)},e.createInteractionRequiredAuthError=function(t){return new e(le.interactionRequired.code,t)},e.createConsentRequiredAuthError=function(t){return new e(le.consentRequired.code,t)},e})(Ee);function pe(o){return{uniqueId:"",tenantId:"",tokenType:"",idToken:null,idTokenClaims:null,accessToken:"",scopes:null,expiresOn:null,account:null,accountState:o,fromCache:!1}}var Ke="msal.",ke="event_name",qe="start_time",Re="elapsed_time",J={MsalCorrelationIdConstStrKey:"Microsoft.MSAL.correlation_id",ApiTelemIdConstStrKey:"msal.api_telem_id",ApiIdConstStrKey:"msal.api_id",BrokerAppConstStrKey:"Microsoft_MSAL_broker_app",CacheEventCountConstStrKey:"Microsoft_MSAL_cache_event_count",HttpEventCountTelemetryBatchKey:"Microsoft_MSAL_http_event_count",IdpConstStrKey:"Microsoft_MSAL_idp",IsSilentTelemetryBatchKey:"",IsSuccessfulConstStrKey:"Microsoft_MSAL_is_successful",ResponseTimeConstStrKey:"Microsoft_MSAL_response_time",TenantIdConstStrKey:"Microsoft_MSAL_tenant_id",UiEventCountTelemetryBatchKey:"Microsoft_MSAL_ui_event_count"},je="<tenant>";var de=function(o){var e=f.GetUrlComponents(o);if(ve.isAdfs(o))return o;var t=e.PathSegments;if(t&&t.length>=2){var r=t[1]==="tfp"?2:1;r<t.length&&(t[r]=je)}return e.Protocol+"//"+e.HostNameAndPort+"/"+t.join("/")},Ie=function(o){return b.base64Encode(o)},g=function(o){return""+Ke+(o||"")},Ge=function(){return!!(typeof window<"u"&&"performance"in window&&window.performance.mark&&window.performance.measure)},We=function(o,e,t){Ge()&&(window.performance.mark(t),window.performance.measure(o,e,t),window.performance.clearMeasures(o),window.performance.clearMarks(e),window.performance.clearMarks(t))},Be=function(o){Ge()&&window.performance.mark(o)};var nt=(function(){function o(e,t,r){var n;this.eventId=b.createNewGuid(),this.label=r,this.event=(n={},n[g(ke)]=e,n[g(Re)]=-1,n[""+J.MsalCorrelationIdConstStrKey]=t,n)}return o.prototype.setElapsedTime=function(e){this.event[g(Re)]=e},o.prototype.stop=function(){this.setElapsedTime(+Date.now()-+this.startTimestamp),We(this.displayName,this.perfStartMark,this.perfEndMark)},o.prototype.start=function(){this.startTimestamp=Date.now(),this.event[g(qe)]=this.startTimestamp,Be(this.perfStartMark)},Object.defineProperty(o.prototype,"telemetryCorrelationId",{get:function(){return this.event[""+J.MsalCorrelationIdConstStrKey]},set:function(e){this.event[""+J.MsalCorrelationIdConstStrKey]=e},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"eventName",{get:function(){return this.event[g(ke)]},enumerable:!1,configurable:!0}),o.prototype.get=function(){return S(S({},this.event),{eventId:this.eventId})},Object.defineProperty(o.prototype,"key",{get:function(){return this.telemetryCorrelationId+"_"+this.eventId+"-"+this.eventName},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"displayName",{get:function(){return"Msal-"+this.label+"-"+this.telemetryCorrelationId},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"perfStartMark",{get:function(){return"start-"+this.key},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"perfEndMark",{get:function(){return"end-"+this.key},enumerable:!1,configurable:!0}),o})(),he=nt;var it=(function(o){O(e,o);function e(t,r,n,i){var a=o.call(this,g("default_event"),r,"DefaultEvent")||this;return a.event[g("client_id")]=n,a.event[g("sdk_plaform")]=t.sdk,a.event[g("sdk_version")]=t.sdkVersion,a.event[g("application_name")]=t.applicationName,a.event[g("application_version")]=t.applicationVersion,a.event[g("effective_connection_speed")]=t.networkInformation&&t.networkInformation.connectionSpeed,a.event[""+J.UiEventCountTelemetryBatchKey]=a.getEventCount(g("ui_event"),i),a.event[""+J.HttpEventCountTelemetryBatchKey]=a.getEventCount(g("http_event"),i),a.event[""+J.CacheEventCountConstStrKey]=a.getEventCount(g("cache_event"),i),a}return e.prototype.getEventCount=function(t,r){return r[t]?r[t]:0},e})(he),Ve=it;var te,Z={AUTHORITY:g("authority"),AUTHORITY_TYPE:g("authority_type"),PROMPT:g("ui_behavior"),TENANT_ID:g("tenant_id"),USER_ID:g("user_id"),WAS_SUCESSFUL:g("was_successful"),API_ERROR_CODE:g("api_error_code"),LOGIN_HINT:g("login_hint")},re;(function(o){o[o.AcquireTokenRedirect=2001]="AcquireTokenRedirect",o[o.AcquireTokenSilent=2002]="AcquireTokenSilent",o[o.AcquireTokenPopup=2003]="AcquireTokenPopup",o[o.LoginRedirect=2004]="LoginRedirect",o[o.LoginPopup=2005]="LoginPopup",o[o.Logout=2006]="Logout"})(re||(re={}));var K;(function(o){o.AcquireTokenRedirect="AcquireTokenRedirect",o.AcquireTokenSilent="AcquireTokenSilent",o.AcquireTokenPopup="AcquireTokenPopup",o.LoginRedirect="LoginRedirect",o.LoginPopup="LoginPopup",o.Logout="Logout"})(K||(K={}));var at=(te={},te[K.AcquireTokenSilent]=re.AcquireTokenSilent,te[K.AcquireTokenPopup]=re.AcquireTokenPopup,te[K.AcquireTokenRedirect]=re.AcquireTokenRedirect,te[K.LoginPopup]=re.LoginPopup,te[K.LoginRedirect]=re.LoginRedirect,te[K.Logout]=re.Logout,te),st=(function(o){O(e,o);function e(t,r,n){var i=o.call(this,g("api_event"),t,n)||this;return n&&(i.apiCode=at[n],i.apiEventIdentifier=n),i.piiEnabled=r,i}return Object.defineProperty(e.prototype,"apiEventIdentifier",{set:function(t){this.event[J.ApiTelemIdConstStrKey]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"apiCode",{set:function(t){this.event[J.ApiIdConstStrKey]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"authority",{set:function(t){this.event[Z.AUTHORITY]=de(t).toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"apiErrorCode",{set:function(t){this.event[Z.API_ERROR_CODE]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tenantId",{set:function(t){this.event[Z.TENANT_ID]=this.piiEnabled&&t?Ie(t):null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"accountId",{set:function(t){this.event[Z.USER_ID]=this.piiEnabled&&t?Ie(t):null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wasSuccessful",{get:function(){return this.event[Z.WAS_SUCESSFUL]===!0},set:function(t){this.event[Z.WAS_SUCESSFUL]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loginHint",{set:function(t){this.event[Z.LOGIN_HINT]=this.piiEnabled&&t?Ie(t):null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"authorityType",{set:function(t){this.event[Z.AUTHORITY_TYPE]=t.toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"promptType",{set:function(t){this.event[Z.PROMPT]=t.toLowerCase()},enumerable:!1,configurable:!0}),e})(he),Qe=st;var B={HTTP_PATH:g("http_path"),USER_AGENT:g("user_agent"),QUERY_PARAMETERS:g("query_parameters"),API_VERSION:g("api_version"),RESPONSE_CODE:g("response_code"),O_AUTH_ERROR_CODE:g("oauth_error_code"),HTTP_METHOD:g("http_method"),REQUEST_ID_HEADER:g("request_id_header"),SPE_INFO:g("spe_info"),SERVER_ERROR_CODE:g("server_error_code"),SERVER_SUB_ERROR_CODE:g("server_sub_error_code"),URL:g("url")},ct=(function(o){O(e,o);function e(t,r){return o.call(this,g("http_event"),t,r)||this}return Object.defineProperty(e.prototype,"url",{set:function(t){var r=de(t);this.event[B.URL]=r&&r.toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"httpPath",{set:function(t){this.event[B.HTTP_PATH]=de(t).toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userAgent",{set:function(t){this.event[B.USER_AGENT]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"queryParams",{set:function(t){this.event[B.QUERY_PARAMETERS]=X.generateQueryParametersString(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"apiVersion",{set:function(t){this.event[B.API_VERSION]=t.toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"httpResponseStatus",{set:function(t){this.event[B.RESPONSE_CODE]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"oAuthErrorCode",{set:function(t){this.event[B.O_AUTH_ERROR_CODE]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"httpMethod",{set:function(t){this.event[B.HTTP_METHOD]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"requestIdHeader",{set:function(t){this.event[B.REQUEST_ID_HEADER]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"speInfo",{set:function(t){this.event[B.SPE_INFO]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"serverErrorCode",{set:function(t){this.event[B.SERVER_ERROR_CODE]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"serverSubErrorCode",{set:function(t){this.event[B.SERVER_SUB_ERROR_CODE]=t},enumerable:!1,configurable:!0}),e})(he),ze=ct;var ut=(function(){function o(e,t,r){this.completedEvents={},this.inProgressEvents={},this.eventCountByCorrelationId={},this.onlySendFailureTelemetry=!1,this.telemetryPlatform=S({sdk:l.libraryName,sdkVersion:ne,networkInformation:{connectionSpeed:typeof navigator<"u"&&navigator.connection&&navigator.connection.effectiveType}},e.platform),this.clientId=e.clientId,this.onlySendFailureTelemetry=e.onlySendFailureTelemetry,this.telemetryEmitter=t,this.logger=r}return o.getTelemetrymanagerStub=function(e,t){var r="UnSetStub",n="0.0",i=function(){},a={applicationName:r,applicationVersion:n},s={platform:a,clientId:e};return new this(s,i,t)},o.prototype.startEvent=function(e){this.logger.verbose("Telemetry Event started: "+e.key),this.telemetryEmitter&&(e.start(),this.inProgressEvents[e.key]=e)},o.prototype.stopEvent=function(e){if(this.logger.verbose("Telemetry Event stopped: "+e.key),!(!this.telemetryEmitter||!this.inProgressEvents[e.key])){e.stop(),this.incrementEventCount(e);var t=this.completedEvents[e.telemetryCorrelationId];this.completedEvents[e.telemetryCorrelationId]=U(t||[],[e]),delete this.inProgressEvents[e.key]}},o.prototype.flush=function(e){var t=this;if(this.logger.verbose("Flushing telemetry events: "+e),!(!this.telemetryEmitter||!this.completedEvents[e])){var r=this.getOrphanedEvents(e);r.forEach(function(c){return t.incrementEventCount(c)});var n=U(this.completedEvents[e],r);delete this.completedEvents[e];var i=this.eventCountByCorrelationId[e];if(delete this.eventCountByCorrelationId[e],!(!n||!n.length)){var a=new Ve(this.telemetryPlatform,e,this.clientId,i),s=U(n,[a]);this.telemetryEmitter(s.map(function(c){return c.get()}))}}},o.prototype.createAndStartApiEvent=function(e,t){var r=new Qe(e,this.logger.isPiiLoggingEnabled(),t);return this.startEvent(r),r},o.prototype.stopAndFlushApiEvent=function(e,t,r,n){t.wasSuccessful=r,n&&(t.apiErrorCode=n),this.stopEvent(t),this.flush(e)},o.prototype.createAndStartHttpEvent=function(e,t,r,n){var i=new ze(e,n);return i.url=r,i.httpMethod=t,this.startEvent(i),i},o.prototype.incrementEventCount=function(e){var t,r=e.eventName,n=this.eventCountByCorrelationId[e.telemetryCorrelationId];n?n[r]=n[r]?n[r]+1:1:this.eventCountByCorrelationId[e.telemetryCorrelationId]=(t={},t[r]=1,t)},o.prototype.getOrphanedEvents=function(e){var t=this;return Object.keys(this.inProgressEvents).reduce(function(r,n){if(n.indexOf(e)!==-1){var i=t.inProgressEvents[n];return delete t.inProgressEvents[n],U(r,[i])}return r},[])},o})(),Oe=ut;var be=(function(){function o(){}return o.filterTokenCacheItemsByScope=function(e,t){return e.filter(function(r){var n=r.key.scopes.split(" "),i=N.removeDefaultScopes(t);return i.length===0?N.containsScope(n,t):N.containsScope(n,i)})},o.filterTokenCacheItemsByAuthority=function(e,t){return e.filter(function(r){return f.CanonicalizeUri(r.key.authority)===t})},o.filterTokenCacheItemsByDomain=function(e,t){return e.filter(function(r){var n=f.GetUrlComponents(r.key.authority).HostNameAndPort;return n===t})},o})();var lt="https://login.microsoftonline.com/common",Pe=(function(){function o(e){this.authResponseCallback=null,this.tokenReceivedCallback=null,this.errorReceivedCallback=null,this.config=Fe(e),this.logger=this.config.system.logger,this.clientId=this.config.auth.clientId,this.inCookie=this.config.cache.storeAuthStateInCookie,this.telemetryManager=this.getTelemetryManagerFromConfig(this.config.system.telemetry,this.clientId),ce.setTrustedAuthoritiesFromConfig(this.config.auth.validateAuthority,this.config.auth.knownAuthorities),z.saveMetadataFromConfig(this.config.auth.authority,this.config.auth.authorityMetadata),this.authority=this.config.auth.authority||lt,this.cacheStorage=new A(this.clientId,this.config.cache.cacheLocation,this.inCookie),window.activeRenewals||(window.activeRenewals={}),window.renewStates||(window.renewStates=[]),window.callbackMappedToRenewStates||(window.callbackMappedToRenewStates={}),window.promiseMappedToRenewStates||(window.promiseMappedToRenewStates={}),window.msal=this;var t=window.location.hash,r=f.urlContainsHash(t);if(L.checkIfBackButtonIsPressed(this.cacheStorage),r&&this.cacheStorage.isInteractionInProgress(!0)){var n=this.getResponseState(t);n.method===l.interactionTypeRedirect&&this.handleRedirectAuthenticationResponse(t)}}return Object.defineProperty(o.prototype,"authority",{get:function(){return this.authorityInstance.CanonicalAuthority},set:function(e){this.authorityInstance=z.CreateInstance(e,this.config.auth.validateAuthority)},enumerable:!1,configurable:!0}),o.prototype.getAuthorityInstance=function(){return this.authorityInstance},o.prototype.handleRedirectCallback=function(e,t){if(!e)throw _.createInvalidCallbackObjectError(e);t?(this.tokenReceivedCallback=e,this.errorReceivedCallback=t,this.logger.warning("This overload for callback is deprecated - please change the format of the callbacks to a single callback as shown: (err: AuthError, response: AuthResponse).")):this.authResponseCallback=e,this.redirectError?this.authErrorHandler(l.interactionTypeRedirect,this.redirectError,this.redirectResponse):this.redirectResponse&&this.authResponseHandler(l.interactionTypeRedirect,this.redirectResponse)},o.prototype.urlContainsHash=function(e){return this.logger.verbose("UrlContainsHash has been called"),f.urlContainsHash(e)},o.prototype.authResponseHandler=function(e,t,r){if(this.logger.verbose("AuthResponseHandler has been called"),this.cacheStorage.setInteractionInProgress(!1),e===l.interactionTypeRedirect)this.logger.verbose("Interaction type is redirect"),this.errorReceivedCallback?(this.logger.verbose("Two callbacks were provided to handleRedirectCallback, calling success callback with response"),this.tokenReceivedCallback(t)):this.authResponseCallback&&(this.logger.verbose("One callback was provided to handleRedirectCallback, calling authResponseCallback with response"),this.authResponseCallback(null,t));else if(e===l.interactionTypePopup)this.logger.verbose("Interaction type is popup, resolving"),r(t);else throw E.createInvalidInteractionTypeError()},o.prototype.authErrorHandler=function(e,t,r,n){if(this.logger.verbose("AuthErrorHandler has been called"),this.cacheStorage.setInteractionInProgress(!1),e===l.interactionTypeRedirect)if(this.logger.verbose("Interaction type is redirect"),this.errorReceivedCallback)this.logger.verbose("Two callbacks were provided to handleRedirectCallback, calling error callback"),this.errorReceivedCallback(t,r.accountState);else if(this.authResponseCallback)this.logger.verbose("One callback was provided to handleRedirectCallback, calling authResponseCallback with error"),this.authResponseCallback(t,r);else throw this.logger.verbose("handleRedirectCallback has not been called and no callbacks are registered, throwing error"),t;else if(e===l.interactionTypePopup)this.logger.verbose("Interaction type is popup, rejecting"),n(t);else throw E.createInvalidInteractionTypeError()},o.prototype.loginRedirect=function(e){this.logger.verbose("LoginRedirect has been called");var t=F.validateRequest(e,!0,this.clientId,l.interactionTypeRedirect);this.acquireTokenInteractive(l.interactionTypeRedirect,!0,t,null,null)},o.prototype.acquireTokenRedirect=function(e){this.logger.verbose("AcquireTokenRedirect has been called");var t=F.validateRequest(e,!1,this.clientId,l.interactionTypeRedirect);this.acquireTokenInteractive(l.interactionTypeRedirect,!1,t,null,null)},o.prototype.loginPopup=function(e){var t=this;this.logger.verbose("LoginPopup has been called");var r=F.validateRequest(e,!0,this.clientId,l.interactionTypePopup),n=this.telemetryManager.createAndStartApiEvent(r.correlationId,K.LoginPopup);return new Promise(function(i,a){t.acquireTokenInteractive(l.interactionTypePopup,!0,r,i,a)}).then(function(i){return t.logger.verbose("Successfully logged in"),t.telemetryManager.stopAndFlushApiEvent(r.correlationId,n,!0),i}).catch(function(i){throw t.cacheStorage.resetTempCacheItems(r.state),t.telemetryManager.stopAndFlushApiEvent(r.correlationId,n,!1,i.errorCode),i})},o.prototype.acquireTokenPopup=function(e){var t=this;this.logger.verbose("AcquireTokenPopup has been called");var r=F.validateRequest(e,!1,this.clientId,l.interactionTypePopup),n=this.telemetryManager.createAndStartApiEvent(r.correlationId,K.AcquireTokenPopup);return new Promise(function(i,a){t.acquireTokenInteractive(l.interactionTypePopup,!1,r,i,a)}).then(function(i){return t.logger.verbose("Successfully acquired token"),t.telemetryManager.stopAndFlushApiEvent(r.correlationId,n,!0),i}).catch(function(i){throw t.cacheStorage.resetTempCacheItems(r.state),t.telemetryManager.stopAndFlushApiEvent(r.correlationId,n,!1,i.errorCode),i})},o.prototype.acquireTokenInteractive=function(e,t,r,n,i){var a=this;this.logger.verbose("AcquireTokenInteractive has been called"),L.blockReloadInHiddenIframes();try{this.cacheStorage.setInteractionInProgress(!0)}catch{var s=t?E.createLoginInProgressError():E.createAcquireTokenInProgressError(),c=pe(this.getAccountState(r.state));this.cacheStorage.resetTempCacheItems(r.state),this.authErrorHandler(e,s,c,i);return}e===l.interactionTypeRedirect&&this.cacheStorage.setItem(I.REDIRECT_REQUEST,""+l.inProgress+l.resourceDelimiter+r.state);var u;if(r&&r.account&&!t?(u=r.account,this.logger.verbose("Account set from request")):(u=this.getAccount(),this.logger.verbose("Account set from MSAL Cache")),!u&&!X.isSSOParam(r))if(t){var h=this.extractADALIdToken();if(h&&!r.scopes){this.logger.info("ADAL's idToken exists. Extracting login information from ADAL's idToken");var T=this.buildIDTokenRequest(r);this.silentLogin=!0,this.acquireTokenSilent(T).then(function(y){a.silentLogin=!1,a.logger.info("Unified cache call is successful"),a.authResponseHandler(e,y,n)},function(y){a.silentLogin=!1,a.logger.error("Error occurred during unified cache ATS: "+y),a.acquireTokenHelper(null,e,t,r,n,i)})}else this.logger.verbose("Login call but no token found, proceed to login"),this.acquireTokenHelper(null,e,t,r,n,i)}else{this.logger.verbose("AcquireToken call, no context or account given"),this.logger.info("User login is required");var c=pe(this.getAccountState(r.state));this.cacheStorage.resetTempCacheItems(r.state),this.authErrorHandler(e,E.createUserLoginRequiredError(),c,i);return}else this.logger.verbose("User session exists, login not required"),this.acquireTokenHelper(u,e,t,r,n,i)},o.prototype.acquireTokenHelper=function(e,t,r,n,i,a){return G(this,void 0,void 0,function(){var s,c,u,h,T,y,C,k,x,V,q;return W(this,function(R){switch(R.label){case 0:this.logger.verbose("AcquireTokenHelper has been called"),this.logger.verbose("Interaction type: "+t+". isLoginCall: "+r),s=n.scopes?n.scopes.join(" ").toLowerCase():l.oidcScopes.join(" "),this.logger.verbosePii("Request signature: "+s),u=n&&n.authority?z.CreateInstance(n.authority,this.config.auth.validateAuthority,n.authorityMetadata):this.authorityInstance,R.label=1;case 1:return R.trys.push([1,11,,12]),u.hasCachedMetadata()?[3,3]:(this.logger.verbose("No cached metadata for authority"),[4,z.saveMetadataFromNetwork(u,this.telemetryManager,n.correlationId)]);case 2:return R.sent(),[3,4];case 3:this.logger.verbose("Cached metadata found for authority"),R.label=4;case 4:if(T=r?Q.id_token:this.getTokenType(e,n.scopes),y=n.redirectStartPage||window.location.href,c=new X(u,this.clientId,T,this.getRedirectUri(n&&n.redirectUri),n.scopes,n.state,n.correlationId),this.logger.verbose("Finished building server authentication request"),this.updateCacheEntries(c,e,r,y),this.logger.verbose("Updating cache entries"),c.populateQueryParams(e,n),this.logger.verbose("Query parameters populated from account"),C=f.createNavigateUrl(c)+l.response_mode_fragment,t===l.interactionTypeRedirect)r?this.logger.verbose("Interaction type redirect but login call is true. State not cached"):(this.cacheStorage.setItem(A.generateTemporaryCacheKey(I.STATE_ACQ_TOKEN,n.state),c.state,this.inCookie),this.logger.verbose("State cached for redirect"),this.logger.verbosePii("State cached: "+c.state));else if(t===l.interactionTypePopup)window.renewStates.push(c.state),window.requestType=r?l.login:l.renewToken,this.logger.verbose("State saved to window"),this.logger.verbosePii("State saved: "+c.state),this.registerCallback(c.state,s,i,a);else throw this.logger.verbose("Invalid interaction error. State not cached"),E.createInvalidInteractionTypeError();if(t!==l.interactionTypePopup)return[3,9];this.logger.verbose("Interaction type is popup. Generating popup window");try{h=this.openPopup(C,"msal",l.popUpWidth,l.popUpHeight),L.trackPopup(h)}catch{if(this.logger.info(d.popUpWindowError.code+":"+d.popUpWindowError.desc),this.cacheStorage.setItem(P.ERROR,d.popUpWindowError.code),this.cacheStorage.setItem(P.ERROR_DESC,d.popUpWindowError.desc),a)return a(E.createPopupWindowError()),[2]}if(!h)return[3,8];R.label=5;case 5:return R.trys.push([5,7,,8]),[4,L.monitorPopupForHash(h,this.config.system.loadFrameTimeout,C,this.logger)];case 6:return k=R.sent(),this.handleAuthenticationResponse(k),this.cacheStorage.setInteractionInProgress(!1),this.logger.info("Closing popup window"),this.config.framework.isAngular&&this.broadcast("msal:popUpHashChanged",k),L.closePopups(),[3,8];case 7:return x=R.sent(),a&&a(x),this.config.framework.isAngular?this.broadcast("msal:popUpClosed",x.errorCode+l.resourceDelimiter+x.errorMessage):(this.cacheStorage.setInteractionInProgress(!1),h.close()),[3,8];case 8:return[3,10];case 9:n.onRedirectNavigate?(this.logger.verbose("Invoking onRedirectNavigate callback"),V=n.onRedirectNavigate(C),V!==!1?(this.logger.verbose("onRedirectNavigate did not return false, navigating"),this.navigateWindow(C)):this.logger.verbose("onRedirectNavigate returned false, stopping navigation")):(this.logger.verbose("Navigating window to urlNavigate"),this.navigateWindow(C)),R.label=10;case 10:return[3,12];case 11:return q=R.sent(),this.logger.error(q),this.cacheStorage.resetTempCacheItems(n.state),this.authErrorHandler(t,E.createEndpointResolutionError(q.toString),pe(n.state),a),h&&h.close(),[3,12];case 12:return[2]}})})},o.prototype.ssoSilent=function(e){if(this.logger.verbose("ssoSilent has been called"),!e)throw _.createEmptyRequestError();if(!e.sid&&!e.loginHint)throw _.createSsoSilentError();return this.acquireTokenSilent(S(S({},e),{scopes:l.oidcScopes}))},o.prototype.acquireTokenSilent=function(e){var t=this;this.logger.verbose("AcquireTokenSilent has been called");var r=F.validateRequest(e,!1,this.clientId,l.interactionTypeSilent),n=this.telemetryManager.createAndStartApiEvent(r.correlationId,K.AcquireTokenSilent),i=F.createRequestSignature(r);return new Promise(function(a,s){return G(t,void 0,void 0,function(){var c,u,h,T,y,C,k,x,V,q,R;return W(this,function(j){switch(j.label){case 0:if(L.blockReloadInHiddenIframes(),c=r.scopes.join(" ").toLowerCase(),this.logger.verbosePii("Serialized scopes: "+c),r.account?(u=r.account,this.logger.verbose("Account set from request")):(u=this.getAccount(),this.logger.verbose("Account set from MSAL Cache")),h=this.cacheStorage.getItem(l.adalIdToken),!u&&!(r.sid||r.loginHint)&&m.isEmpty(h))return this.logger.info("User login is required"),[2,s(E.createUserLoginRequiredError())];if(T=this.getTokenType(u,r.scopes),this.logger.verbose("Response type: "+T),y=new X(z.CreateInstance(r.authority,this.config.auth.validateAuthority,r.authorityMetadata),this.clientId,T,this.getRedirectUri(r.redirectUri),r.scopes,r.state,r.correlationId),this.logger.verbose("Finished building server authentication request"),X.isSSOParam(r)||u?(y.populateQueryParams(u,r,null,!0),this.logger.verbose("Query parameters populated from existing SSO or account")):!u&&!m.isEmpty(h)?(C=ue.extractIdToken(h),this.logger.verbose("ADAL's idToken exists. Extracting login information from ADAL's idToken to populate query parameters"),y.populateQueryParams(u,null,C,!0)):this.logger.verbose("No additional query parameters added"),k=r.claimsRequest||y.claimsValue,!k&&!r.forceRefresh)try{V=this.getCachedToken(y,u)}catch(fe){x=fe}return V?(this.logger.verbose("Token found in cache lookup"),this.logger.verbosePii("Scopes found: "+JSON.stringify(V.scopes)),a(V),[2,null]):[3,1];case 1:return x?(this.logger.infoPii(x.errorCode+":"+x.errorMessage),s(x),[2,null]):[3,2];case 2:q=void 0,k?q="Skipped cache lookup since claims were given":r.forceRefresh?q="Skipped cache lookup since request.forceRefresh option was set to true":q="No valid token found in cache lookup",this.logger.verbose(q),y.authorityInstance||(y.authorityInstance=r.authority?z.CreateInstance(r.authority,this.config.auth.validateAuthority,r.authorityMetadata):this.authorityInstance),this.logger.verbosePii("Authority instance: "+y.authority),j.label=3;case 3:return j.trys.push([3,7,,8]),y.authorityInstance.hasCachedMetadata()?[3,5]:(this.logger.verbose("No cached metadata for authority"),[4,z.saveMetadataFromNetwork(y.authorityInstance,this.telemetryManager,r.correlationId)]);case 4:return j.sent(),this.logger.verbose("Authority has been updated with endpoint discovery response"),[3,6];case 5:this.logger.verbose("Cached metadata found for authority"),j.label=6;case 6:return window.activeRenewals[i]?(this.logger.verbose("Renewing token in progress. Registering callback"),this.registerCallback(window.activeRenewals[i],i,a,s)):r.scopes&&N.onlyContainsOidcScopes(r.scopes)?(this.logger.verbose("OpenID Connect scopes only, renewing idToken"),this.silentLogin=!0,this.renewIdToken(i,a,s,u,y)):(this.logger.verbose("Renewing access token"),this.renewToken(i,a,s,u,y)),[3,8];case 7:return R=j.sent(),this.logger.error(R),s(E.createEndpointResolutionError(R.toString())),[2,null];case 8:return[2]}})})}).then(function(a){return t.logger.verbose("Successfully acquired token"),t.telemetryManager.stopAndFlushApiEvent(r.correlationId,n,!0),a}).catch(function(a){throw t.cacheStorage.resetTempCacheItems(r.state),t.telemetryManager.stopAndFlushApiEvent(r.correlationId,n,!1,a.errorCode),a})},o.prototype.openPopup=function(e,t,r,n){this.logger.verbose("OpenPopup has been called");try{var i=window.screenLeft?window.screenLeft:window.screenX,a=window.screenTop?window.screenTop:window.screenY,s=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,c=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,u=s/2-r/2+i,h=c/2-n/2+a,T=window.open(e,t,"width="+r+", height="+n+", top="+h+", left="+u+", scrollbars=yes");if(!T)throw E.createPopupWindowError();return T.focus&&T.focus(),T}catch(y){throw this.cacheStorage.setInteractionInProgress(!1),E.createPopupWindowError(y.toString())}},o.prototype.loadIframeTimeout=function(e,t,r){return G(this,void 0,void 0,function(){var n,i,a,s,c;return W(this,function(u){switch(u.label){case 0:return n=window.activeRenewals[r],this.logger.verbosePii("Set loading state to pending for: "+r+":"+n),this.cacheStorage.setItem(A.generateTemporaryCacheKey(I.RENEW_STATUS,n),l.inProgress),this.config.system.navigateFrameWait?[4,L.loadFrame(e,t,this.config.system.navigateFrameWait,this.logger)]:[3,2];case 1:return a=u.sent(),[3,3];case 2:a=L.loadFrameSync(e,t,this.logger),u.label=3;case 3:i=a,u.label=4;case 4:return u.trys.push([4,6,,7]),[4,L.monitorIframeForHash(i.contentWindow,this.config.system.loadFrameTimeout,e,this.logger)];case 5:return s=u.sent(),s&&this.handleAuthenticationResponse(s),[3,7];case 6:throw c=u.sent(),this.cacheStorage.getItem(A.generateTemporaryCacheKey(I.RENEW_STATUS,n))===l.inProgress&&(this.logger.verbose("Loading frame has timed out after: "+this.config.system.loadFrameTimeout/1e3+" seconds for scope/authority "+r+":"+n),n&&window.callbackMappedToRenewStates[n]&&window.callbackMappedToRenewStates[n](null,c),this.cacheStorage.removeItem(A.generateTemporaryCacheKey(I.RENEW_STATUS,n))),L.removeHiddenIframe(i),c;case 7:return L.removeHiddenIframe(i),[2]}})})},o.prototype.navigateWindow=function(e,t){if(e&&!m.isEmpty(e)){var r=t||window,n=t?"Navigated Popup window to:"+e:"Navigate to:"+e;this.logger.infoPii(n),r.location.assign(e)}else throw this.logger.info("Navigate url is empty"),D.createUnexpectedError("Navigate url is empty")},o.prototype.registerCallback=function(e,t,r,n){var i=this;window.activeRenewals[t]=e,window.promiseMappedToRenewStates[e]||(window.promiseMappedToRenewStates[e]=[]),window.promiseMappedToRenewStates[e].push({resolve:r,reject:n}),window.callbackMappedToRenewStates[e]||(window.callbackMappedToRenewStates[e]=function(a,s){delete window.activeRenewals[t];for(var c=0;c<window.promiseMappedToRenewStates[e].length;++c)try{if(s)window.promiseMappedToRenewStates[e][c].reject(s);else if(a)window.promiseMappedToRenewStates[e][c].resolve(a);else throw i.cacheStorage.resetTempCacheItems(e),D.createUnexpectedError("Error and response are both null")}catch(u){i.logger.warning(u)}delete window.promiseMappedToRenewStates[e],delete window.callbackMappedToRenewStates[e]})},o.prototype.logout=function(e){this.logger.verbose("Logout has been called"),this.logoutAsync(e)},o.prototype.logoutAsync=function(e){return G(this,void 0,void 0,function(){var t,r,n,i,a,s;return W(this,function(c){switch(c.label){case 0:t=e||b.createNewGuid(),r=this.telemetryManager.createAndStartApiEvent(t,K.Logout),this.clearCache(),this.account=null,c.label=1;case 1:return c.trys.push([1,5,,6]),this.authorityInstance.hasCachedMetadata()?[3,3]:(this.logger.verbose("No cached metadata for authority"),[4,z.saveMetadataFromNetwork(this.authorityInstance,this.telemetryManager,e)]);case 2:return c.sent(),[3,4];case 3:this.logger.verbose("Cached metadata found for authority"),c.label=4;case 4:return n="client-request-id="+t,i=void 0,this.getPostLogoutRedirectUri()?(i="&post_logout_redirect_uri="+encodeURIComponent(this.getPostLogoutRedirectUri()),this.logger.verbose("redirectUri found and set")):(i="",this.logger.verbose("No redirectUri set for app. postLogoutQueryParam is empty")),a=void 0,this.authorityInstance.EndSessionEndpoint?(a=this.authorityInstance.EndSessionEndpoint+"?"+n+i,this.logger.verbose("EndSessionEndpoint found and urlNavigate set"),this.logger.verbosePii("urlNavigate set to: "+this.authorityInstance.EndSessionEndpoint)):(a=this.authority+"oauth2/v2.0/logout?"+n+i,this.logger.verbose("No endpoint, urlNavigate set to default")),this.telemetryManager.stopAndFlushApiEvent(t,r,!0),this.logger.verbose("Navigating window to urlNavigate"),this.navigateWindow(a),[3,6];case 5:return s=c.sent(),this.telemetryManager.stopAndFlushApiEvent(t,r,!1,s.errorCode),[3,6];case 6:return[2]}})})},o.prototype.clearCache=function(){this.logger.verbose("Clearing cache"),window.renewStates=[];for(var e=this.cacheStorage.getAllTokens(l.clientId,l.homeAccountIdentifier),t=0;t<e.length;t++)this.cacheStorage.removeItem(JSON.stringify(e[t].key));this.cacheStorage.resetCacheItems(),this.cacheStorage.clearMsalCookie(),this.logger.verbose("Cache cleared")},o.prototype.clearCacheForScope=function(e){this.logger.verbose("Clearing access token from cache");for(var t=this.cacheStorage.getAllAccessTokens(l.clientId,l.homeAccountIdentifier),r=0;r<t.length;r++){var n=t[r];n.value.accessToken===e&&(this.cacheStorage.removeItem(JSON.stringify(n.key)),this.logger.verbosePii("Access token removed: "+n.key))}},o.prototype.isCallback=function(e){return this.logger.info("isCallback will be deprecated in favor of urlContainsHash in MSAL.js v2.0."),this.logger.verbose("isCallback has been called"),f.urlContainsHash(e)},o.prototype.processCallBack=function(e,t,r){this.logger.info("ProcessCallBack has been called. Processing callback from redirect response");var n=t;n||(this.logger.verbose("StateInfo is null, getting stateInfo from hash"),n=this.getResponseState(e));var i,a;try{i=this.saveTokenFromHash(e,n)}catch(c){a=c}try{this.cacheStorage.clearMsalCookie(n.state);var s=this.getAccountState(n.state);if(i){if(n.requestType===l.renewToken||i.accessToken?(window.parent!==window?this.logger.verbose("Window is in iframe, acquiring token silently"):this.logger.verbose("Acquiring token interactive in progress"),this.logger.verbose("Response tokenType set to "+p.ACCESS_TOKEN),i.tokenType=p.ACCESS_TOKEN):n.requestType===l.login&&(this.logger.verbose("Response tokenType set to "+p.ID_TOKEN),i.tokenType=p.ID_TOKEN),!r){this.logger.verbose("Setting redirectResponse"),this.redirectResponse=i;return}}else if(!r){this.logger.verbose("Response is null, setting redirectResponse with state"),this.redirectResponse=pe(s),this.redirectError=a,this.cacheStorage.resetTempCacheItems(n.state);return}this.logger.verbose("Calling callback provided to processCallback"),r(i,a)}catch(c){throw this.logger.error("Error occurred in token received callback function: "+c),E.createErrorInCallbackFunction(c.toString())}},o.prototype.handleAuthenticationResponse=function(e){this.logger.verbose("HandleAuthenticationResponse has been called");var t=e||window.location.hash,r=this.getResponseState(t);this.logger.verbose("Obtained state from response");var n=window.callbackMappedToRenewStates[r.state];this.processCallBack(t,r,n)},o.prototype.handleRedirectAuthenticationResponse=function(e){this.logger.info("Returned from redirect url"),this.logger.verbose("HandleRedirectAuthenticationResponse has been called"),L.clearUrlFragment(window),this.logger.verbose("Window.location.hash cleared");var t=this.getResponseState(e);if(this.config.auth.navigateToLoginRequestUrl&&window.parent===window){this.logger.verbose("Window.parent is equal to window, not in popup or iframe. Navigation to login request url after login turned on");var r=this.cacheStorage.getItem(A.generateTemporaryCacheKey(I.LOGIN_REQUEST,t.state),this.inCookie);if(!r||r==="null"){this.logger.error("Unable to get valid login request url from cache, redirecting to home page"),window.location.assign("/");return}else{this.logger.verbose("Valid login request url obtained from cache");var n=f.removeHashFromUrl(window.location.href),i=f.removeHashFromUrl(r);if(n!==i){this.logger.verbose("Current url is not login request url, navigating"),this.logger.verbosePii("CurrentUrl: "+n+", finalRedirectUrl: "+i),window.location.assign(""+i+e);return}else{this.logger.verbose("Current url matches login request url");var a=f.GetUrlComponents(r);a.Hash&&(this.logger.verbose("Login request url contains hash, resetting non-msal hash"),window.location.hash=a.Hash)}}}else this.config.auth.navigateToLoginRequestUrl||this.logger.verbose("Default navigation to start page after login turned off");this.processCallBack(e,t,null)},o.prototype.getResponseState=function(e){this.logger.verbose("GetResponseState has been called");var t=f.deserializeHash(e),r;if(!t)throw D.createUnexpectedError("Hash was not parsed correctly.");if(t.hasOwnProperty(p.STATE)){this.logger.verbose("Hash contains state. Creating stateInfo object");var n=F.parseLibraryState(t.state);r={requestType:l.unknown,state:t.state,timestamp:n.ts,method:n.method,stateMatch:!1}}else throw D.createUnexpectedError("Hash does not contain state.");if(r.state===this.cacheStorage.getItem(A.generateTemporaryCacheKey(I.STATE_LOGIN,r.state),this.inCookie)||r.state===this.silentAuthenticationState)return this.logger.verbose("State matches cached state, setting requestType to login"),r.requestType=l.login,r.stateMatch=!0,r;if(r.state===this.cacheStorage.getItem(A.generateTemporaryCacheKey(I.STATE_ACQ_TOKEN,r.state),this.inCookie))return this.logger.verbose("State matches cached state, setting requestType to renewToken"),r.requestType=l.renewToken,r.stateMatch=!0,r;if(!r.stateMatch){this.logger.verbose("State does not match cached state, setting requestType to type from window"),r.requestType=window.requestType;for(var i=window.renewStates,a=0;a<i.length;a++)if(i[a]===r.state){this.logger.verbose("Matching state found for request"),r.stateMatch=!0;break}r.stateMatch||this.logger.verbose("Matching state not found for request")}return r},o.prototype.getCachedToken=function(e,t){this.logger.verbose("GetCachedToken has been called");var r=e.scopes,n=this.getCachedIdToken(e,t),i=this.getCachedAccessToken(e,t,r),a=this.getAccountState(e.state);return ye.buildAuthResponse(n,i,e,t,r,a)},o.prototype.getTokenCacheItemByAuthority=function(e,t,r,n){var i=this,a;return f.isCommonAuthority(e)||f.isOrganizationsAuthority(e)||f.isConsumersAuthority(e)?a=be.filterTokenCacheItemsByDomain(t,f.GetUrlComponents(e).HostNameAndPort):a=be.filterTokenCacheItemsByAuthority(t,e),a.length===1?a[0]:a.length>1?(this.logger.warning("Multiple matching tokens found. Cleaning cache and requesting a new token."),a.forEach(function(s){i.cacheStorage.removeItem(JSON.stringify(s.key))}),null):(this.logger.verbose("No matching tokens of type "+n+" found"),null)},o.prototype.getCachedIdToken=function(e,t){this.logger.verbose("Getting all cached tokens of type ID Token");var r=this.cacheStorage.getAllIdTokens(this.clientId,t?t.homeAccountIdentifier:null),n=e.authority||this.authority,i=this.getTokenCacheItemByAuthority(n,r,null,p.ID_TOKEN);if(i){this.logger.verbose("Evaluating ID token found");var a=this.evaluateTokenExpiration(i);if(a){this.logger.verbose("ID token expiration is within offset, using ID token found in cache");var s=i.value;return s?this.logger.verbose("ID Token found in cache is valid and unexpired"):this.logger.verbose("ID Token found in cache is invalid"),s?new $(s.idToken):null}else return this.logger.verbose("Cached ID token is expired, removing from cache"),this.cacheStorage.removeItem(JSON.stringify(i.key)),null}else return this.logger.verbose("No tokens found"),null},o.prototype.getCachedAccessToken=function(e,t,r){this.logger.verbose("Getting all cached tokens of type Access Token");var n=this.cacheStorage.getAllAccessTokens(this.clientId,t?t.homeAccountIdentifier:null),i=be.filterTokenCacheItemsByScope(n,r),a=e.authority||this.authority,s=this.getTokenCacheItemByAuthority(a,i,r,p.ACCESS_TOKEN);if(s){e.authorityInstance=z.CreateInstance(s.key.authority,this.config.auth.validateAuthority),this.logger.verbose("Evaluating access token found");var c=this.evaluateTokenExpiration(s);if(c){this.logger.verbose("Access token expiration is within offset, using access token found in cache");var u=t||this.getAccount();if(!u)throw D.createUnexpectedError("Account should not be null here.");var h=this.getAccountState(e.state),T={uniqueId:"",tenantId:"",tokenType:p.ACCESS_TOKEN,idToken:null,idTokenClaims:null,accessToken:s.value.accessToken,scopes:s.key.scopes.split(" "),expiresOn:new Date(Number(s.value.expiresIn)*1e3),account:u,accountState:h,fromCache:!0};return T}else return this.logger.verbose("Access token expired, removing from cache"),this.cacheStorage.removeItem(JSON.stringify(s.key)),null}else return this.logger.verbose("No matching token found when filtering by scope and authority"),null},o.prototype.evaluateTokenExpiration=function(e){var t=Number(e.value.expiresIn);return ue.validateExpirationIsWithinOffset(t,this.config.system.tokenRenewalOffsetSeconds)},o.prototype.extractADALIdToken=function(){this.logger.verbose("ExtractADALIdToken has been called");var e=this.cacheStorage.getItem(l.adalIdToken);return m.isEmpty(e)?null:ue.extractIdToken(e)},o.prototype.renewToken=function(e,t,r,n,i){this.logger.verbose("RenewToken has been called"),this.logger.verbosePii("RenewToken scope and authority: "+e);var a=L.generateFrameName(Ce.TOKEN_FRAME,e);L.addHiddenIFrame(a,this.logger),this.updateCacheEntries(i,n,!1),this.logger.verbosePii("RenewToken expected state: "+i.state);var s=f.urlRemoveQueryStringParameter(f.createNavigateUrl(i),l.prompt)+l.prompt_none+l.response_mode_fragment;window.renewStates.push(i.state),window.requestType=l.renewToken,this.logger.verbose("Set window.renewState and requestType"),this.registerCallback(i.state,e,t,r),this.logger.infoPii("Navigate to: "+s),this.loadIframeTimeout(s,a,e).catch(function(c){return r(c)})},o.prototype.renewIdToken=function(e,t,r,n,i){this.logger.info("RenewIdToken has been called");var a=L.generateFrameName(Ce.ID_TOKEN_FRAME,e);L.addHiddenIFrame(a,this.logger),this.updateCacheEntries(i,n,!1),this.logger.verbose("RenewIdToken expected state: "+i.state);var s=f.urlRemoveQueryStringParameter(f.createNavigateUrl(i),l.prompt)+l.prompt_none+l.response_mode_fragment;this.silentLogin?(this.logger.verbose("Silent login is true, set silentAuthenticationState"),window.requestType=l.login,this.silentAuthenticationState=i.state):(this.logger.verbose("Not silent login, set window.renewState and requestType"),window.requestType=l.renewToken,window.renewStates.push(i.state)),this.registerCallback(i.state,e,t,r),this.logger.infoPii('Navigate to:" '+s),this.loadIframeTimeout(s,a,e).catch(function(c){return r(c)})},o.prototype.saveToken=function(e,t,r,n,i){var a=new Le(t,this.clientId,r,n.uid,n.utid),s=new Me(e.accessToken,e.idToken.rawIdToken,i.toString(),n.encodeClientInfo());return this.cacheStorage.setItem(JSON.stringify(a),JSON.stringify(s)),i?(this.logger.verbose("New expiration set for token"),e.expiresOn=new Date(i*1e3)):this.logger.error("Could not parse expiresIn parameter for access token"),e},o.prototype.saveIdToken=function(e,t,r,n,i){this.logger.verbose("SaveIdToken has been called");var a=S({},e),s;a.scopes=l.oidcScopes,a.accessToken=r[p.ID_TOKEN];var c=Number(i.expiration);return this.logger.verbose("Saving ID token to cache"),this.saveToken(a,t,s,n,c)},o.prototype.saveAccessToken=function(e,t,r,n){this.logger.verbose("SaveAccessToken has been called");var i=S({},e),a=r[p.SCOPE],s=a.split(" "),c=this.cacheStorage.getAllAccessTokens(this.clientId,t);this.logger.verbose("Retrieving all access tokens from cache and removing duplicates");for(var u=0;u<c.length;u++){var h=c[u];if(h.key.homeAccountIdentifier===e.account.homeAccountIdentifier){var T=h.key.scopes.split(" ");N.isIntersectingScopes(T,s)&&this.cacheStorage.removeItem(JSON.stringify(h.key))}}i.accessToken=r[p.ACCESS_TOKEN],i.scopes=s;var y=Y.parseExpiresIn(r[p.EXPIRES_IN]),C=F.parseLibraryState(r[p.STATE]),k=C.ts+y;return this.logger.verbose("Saving access token to cache"),this.saveToken(i,t,a,n,k)},o.prototype.saveTokenFromHash=function(e,t){this.logger.verbose("SaveTokenFromHash has been called"),this.logger.info("State status: "+t.stateMatch+"; Request type: "+t.requestType);var r={uniqueId:"",tenantId:"",tokenType:"",idToken:null,idTokenClaims:null,accessToken:null,scopes:[],expiresOn:null,account:null,accountState:"",fromCache:!1},n,i=f.deserializeHash(e),a="",s="",c=null;if(i.hasOwnProperty(p.ERROR_DESCRIPTION)||i.hasOwnProperty(p.ERROR)){if(this.logger.verbose("Server returned an error"),this.logger.infoPii("Error : "+i[p.ERROR]+"; Error description: "+i[p.ERROR_DESCRIPTION]),this.cacheStorage.setItem(P.ERROR,i[p.ERROR]),this.cacheStorage.setItem(P.ERROR_DESC,i[p.ERROR_DESCRIPTION]),t.requestType===l.login&&(this.logger.verbose("RequestType is login, caching login error, generating authorityKey"),this.cacheStorage.setItem(P.LOGIN_ERROR,i[p.ERROR_DESCRIPTION]+":"+i[p.ERROR]),a=A.generateAuthorityKey(t.state)),t.requestType===l.renewToken){this.logger.verbose("RequestType is renewToken, generating acquireTokenAccountKey"),a=A.generateAuthorityKey(t.state);var u=this.getAccount(),h=void 0;u&&!m.isEmpty(u.homeAccountIdentifier)?(h=u.homeAccountIdentifier,this.logger.verbose("AccountId is set")):(h=l.no_account,this.logger.verbose("AccountId is set as no_account")),s=A.generateAcquireTokenAccountKey(h,t.state)}var T=i[p.ERROR],y=i[p.ERROR_DESCRIPTION];Te.isInteractionRequiredError(T)||Te.isInteractionRequiredError(y)?n=new Te(i[p.ERROR],i[p.ERROR_DESCRIPTION]):n=new Ee(i[p.ERROR],i[p.ERROR_DESCRIPTION])}else if(this.logger.verbose("Server returns success"),t.stateMatch){this.logger.info("State is right"),i.hasOwnProperty(p.SESSION_STATE)&&(this.logger.verbose("Fragment has session state, caching"),this.cacheStorage.setItem(A.generateTemporaryCacheKey(I.SESSION_STATE,t.state),i[p.SESSION_STATE])),r.accountState=this.getAccountState(t.state);var C=void 0;if(i.hasOwnProperty(p.ACCESS_TOKEN)){this.logger.info("Fragment has access token"),r.accessToken=i[p.ACCESS_TOKEN],i.hasOwnProperty(p.SCOPE)&&(r.scopes=i[p.SCOPE].split(" ")),i.hasOwnProperty(p.ID_TOKEN)?(this.logger.verbose("Fragment has id_token"),c=new $(i[p.ID_TOKEN])):(this.logger.verbose("No idToken on fragment, getting idToken from cache"),c=new $(this.cacheStorage.getItem(H.IDTOKEN))),r=ye.setResponseIdToken(r,c);var k=this.populateAuthority(t.state,this.inCookie,this.cacheStorage,c);this.logger.verbose("Got authority from cache"),i.hasOwnProperty(p.CLIENT_INFO)?(this.logger.verbose("Fragment has clientInfo"),C=new ie(i[p.CLIENT_INFO],k)):this.authorityInstance.AuthorityType===ee.Adfs?C=ie.createClientInfoFromIdToken(c,k):this.logger.warning("ClientInfo not received in the response from AAD"),r.account=ae.createAccount(c,C),this.logger.verbose("Account object created from response");var x=void 0;r.account&&!m.isEmpty(r.account.homeAccountIdentifier)?(this.logger.verbose("AccountKey set"),x=r.account.homeAccountIdentifier):(this.logger.verbose("AccountKey set as no_account"),x=l.no_account),s=A.generateAcquireTokenAccountKey(x,t.state);var V=A.generateAcquireTokenAccountKey(l.no_account,t.state);this.logger.verbose("AcquireTokenAccountKey generated");var q=this.cacheStorage.getItem(s),R=void 0;m.isEmpty(q)?m.isEmpty(this.cacheStorage.getItem(V))||(this.logger.verbose("No acquireToken account retrieved from cache"),r=this.saveAccessToken(r,k,i,C)):(R=JSON.parse(q),this.logger.verbose("AcquireToken request account retrieved from cache"),r.account&&R&&ae.compareAccounts(r.account,R)?(r=this.saveAccessToken(r,k,i,C),this.logger.info("The user object received in the response is the same as the one passed in the acquireToken request")):this.logger.warning("The account object created from the response is not the same as the one passed in the acquireToken request"))}if(i.hasOwnProperty(p.ID_TOKEN)){this.logger.info("Fragment has idToken"),c=new $(i[p.ID_TOKEN]);var k=this.populateAuthority(t.state,this.inCookie,this.cacheStorage,c);if(r=ye.setResponseIdToken(r,c),i.hasOwnProperty(p.CLIENT_INFO)?(this.logger.verbose("Fragment has clientInfo"),C=new ie(i[p.CLIENT_INFO],k)):this.authorityInstance.AuthorityType===ee.Adfs?C=ie.createClientInfoFromIdToken(c,k):this.logger.warning("ClientInfo not received in the response from AAD"),this.account=ae.createAccount(c,C),r.account=this.account,this.logger.verbose("Account object created from response"),c&&c.nonce){this.logger.verbose("IdToken has nonce");var j=this.cacheStorage.getItem(A.generateTemporaryCacheKey(I.NONCE_IDTOKEN,t.state),this.inCookie);c.nonce!==j?(this.account=null,this.cacheStorage.setItem(P.LOGIN_ERROR,"Nonce Mismatch. Expected Nonce: "+j+",Actual Nonce: "+c.nonce),this.logger.error("Nonce Mismatch. Expected Nonce: "+j+", Actual Nonce: "+c.nonce),n=E.createNonceMismatchError(j,c.nonce)):(this.logger.verbose("Nonce matches, saving idToken to cache"),this.cacheStorage.setItem(H.IDTOKEN,i[p.ID_TOKEN],this.inCookie),this.cacheStorage.setItem(H.CLIENT_INFO,C.encodeClientInfo(),this.inCookie),this.saveIdToken(r,k,i,C,c))}else this.logger.verbose("No idToken or no nonce. Cache key for Authority set as state"),a=t.state,s=t.state,this.logger.error("Invalid id_token received in the response"),n=E.createInvalidIdTokenError(c),this.cacheStorage.setItem(P.ERROR,n.errorCode),this.cacheStorage.setItem(P.ERROR_DESC,n.errorMessage)}}else{this.logger.verbose("State mismatch"),a=t.state,s=t.state;var fe=this.cacheStorage.getItem(A.generateTemporaryCacheKey(I.STATE_LOGIN,t.state),this.inCookie);this.logger.error("State Mismatch. Expected State: "+fe+", Actual State: "+t.state),n=E.createInvalidStateError(t.state,fe),this.cacheStorage.setItem(P.ERROR,n.errorCode),this.cacheStorage.setItem(P.ERROR_DESC,n.errorMessage)}if(this.cacheStorage.removeItem(A.generateTemporaryCacheKey(I.RENEW_STATUS,t.state)),this.cacheStorage.resetTempCacheItems(t.state),this.logger.verbose("Status set to complete, temporary cache cleared"),this.inCookie&&(this.logger.verbose("InCookie is true, setting authorityKey in cookie"),this.cacheStorage.setItemCookie(a,"",-1),this.cacheStorage.clearMsalCookie(t.state)),n)throw n;if(!r)throw D.createUnexpectedError("Response is null");return r},o.prototype.populateAuthority=function(e,t,r,n){this.logger.verbose("PopulateAuthority has been called");var i=A.generateAuthorityKey(e),a=r.getItem(i,t);return m.isEmpty(a)?a:f.replaceTenantPath(a,n.tenantId)},o.prototype.getAccount=function(){if(this.account)return this.account;var e=this.cacheStorage.getItem(H.IDTOKEN,this.inCookie),t=this.cacheStorage.getItem(H.CLIENT_INFO,this.inCookie);if(!m.isEmpty(e)&&!m.isEmpty(t)){var r=new $(e),n=new ie(t,"");return this.account=ae.createAccount(r,n),this.account}return null},o.prototype.getAccountState=function(e){if(e){var t=e.indexOf(l.resourceDelimiter);if(t>-1&&t+1<e.length)return e.substring(t+1)}return e},o.prototype.getAllAccounts=function(){for(var e=[],t=this.cacheStorage.getAllAccessTokens(l.clientId,l.homeAccountIdentifier),r=0;r<t.length;r++){var n=new $(t[r].value.idToken),i=new ie(t[r].value.homeAccountIdentifier,""),a=ae.createAccount(n,i);e.push(a)}return this.getUniqueAccounts(e)},o.prototype.getUniqueAccounts=function(e){if(!e||e.length<=1)return e;for(var t=[],r=[],n=0;n<e.length;++n)e[n].homeAccountIdentifier&&t.indexOf(e[n].homeAccountIdentifier)===-1&&(t.push(e[n].homeAccountIdentifier),r.push(e[n]));return r},o.prototype.broadcast=function(e,t){var r=new CustomEvent(e,{detail:t});window.dispatchEvent(r)},o.prototype.getCachedTokenInternal=function(e,t,r,n){var i=t||this.getAccount();if(!i)return null;var a=this.authorityInstance?this.authorityInstance:z.CreateInstance(this.authority,this.config.auth.validateAuthority),s=this.getTokenType(i,e),c=new X(a,this.clientId,s,this.getRedirectUri(),e,r,n);return this.getCachedToken(c,t)},o.prototype.getScopesForEndpoint=function(e){if(this.config.framework.unprotectedResources.length>0){for(var t=0;t<this.config.framework.unprotectedResources.length;t++)if(e.indexOf(this.config.framework.unprotectedResources[t])>-1)return null}if(this.config.framework.protectedResourceMap.size>0)for(var r=0,n=Array.from(this.config.framework.protectedResourceMap.keys());r<n.length;r++){var i=n[r];if(e.indexOf(i)>-1)return this.config.framework.protectedResourceMap.get(i)}if(e.indexOf("http://")>-1||e.indexOf("https://")>-1){if(f.getHostFromUri(e)===f.getHostFromUri(this.getRedirectUri()))return new Array(this.clientId)}else return new Array(this.clientId);return null},o.prototype.getLoginInProgress=function(){return this.cacheStorage.isInteractionInProgress(!0)},o.prototype.setInteractionInProgress=function(e){this.cacheStorage.setInteractionInProgress(e)},o.prototype.setloginInProgress=function(e){this.setInteractionInProgress(e)},o.prototype.getAcquireTokenInProgress=function(){return this.cacheStorage.isInteractionInProgress(!0)},o.prototype.setAcquireTokenInProgress=function(e){this.setInteractionInProgress(e)},o.prototype.getLogger=function(){return this.logger},o.prototype.setLogger=function(e){this.logger=e},o.prototype.getRedirectUri=function(e){return e||(typeof this.config.auth.redirectUri=="function"?this.config.auth.redirectUri():this.config.auth.redirectUri)},o.prototype.getPostLogoutRedirectUri=function(){return typeof this.config.auth.postLogoutRedirectUri=="function"?this.config.auth.postLogoutRedirectUri():this.config.auth.postLogoutRedirectUri},o.prototype.getCurrentConfiguration=function(){if(!this.config)throw _.createNoSetConfigurationError();return this.config},o.prototype.getTokenType=function(e,t){var r=ae.compareAccounts(e,this.getAccount());return X.determineResponseType(r,t)},o.prototype.setAccountCache=function(e,t){var r=e?this.getAccountId(e):l.no_account,n=A.generateAcquireTokenAccountKey(r,t);this.cacheStorage.setItem(n,JSON.stringify(e))},o.prototype.setAuthorityCache=function(e,t){var r=A.generateAuthorityKey(e);this.cacheStorage.setItem(r,f.CanonicalizeUri(t),this.inCookie)},o.prototype.updateCacheEntries=function(e,t,r,n){n&&this.cacheStorage.setItem(A.generateTemporaryCacheKey(I.LOGIN_REQUEST,e.state),n,this.inCookie),r?this.cacheStorage.setItem(A.generateTemporaryCacheKey(I.STATE_LOGIN,e.state),e.state,this.inCookie):this.setAccountCache(t,e.state),this.setAuthorityCache(e.state,e.authority),this.cacheStorage.setItem(A.generateTemporaryCacheKey(I.NONCE_IDTOKEN,e.state),e.nonce,this.inCookie)},o.prototype.getAccountId=function(e){var t;return m.isEmpty(e.homeAccountIdentifier)?t=l.no_account:t=e.homeAccountIdentifier,t},o.prototype.buildIDTokenRequest=function(e){var t={scopes:l.oidcScopes,authority:this.authority,account:this.getAccount(),extraQueryParameters:e.extraQueryParameters,correlationId:e.correlationId};return t},o.prototype.getTelemetryManagerFromConfig=function(e,t){if(!e)return Oe.getTelemetrymanagerStub(t,this.logger);var r=e.applicationName,n=e.applicationVersion,i=e.telemetryEmitter;if(!r||!n||!i)throw _.createTelemetryConfigError(e);var a={applicationName:r,applicationVersion:n},s={platform:a,clientId:t};return new Oe(s,i,this.logger)},o})();function Je(o,e){return o.getAccount()?o.acquireTokenSilent(e).then(t=>t.accessToken).catch(t=>t.name==="InteractionRequiredAuthError"?o.acquireTokenPopup(e).then(r=>r.accessToken).catch(r=>Promise.reject(r&&r.message)):(console.error(t),Promise.reject("Could not fetch token"))):Promise.reject("Not logged in")}function Dn(o){let{redirectUri:e=`${location.origin}/auth`,restrict:t=!1,scopes:r=["User.Read"],storeAuthStateInCookie:n,cacheLocation:i="sessionStorage",framework:a,system:s,...c}=o,u=new Pe({auth:{redirectUri:e,...c},cache:{storeAuthStateInCookie:n,cacheLocation:i},system:s,framework:a}),h={scopes:r};return u.handleRedirectCallback(()=>{}),{login(){u.loginRedirect(h)},logout(){u.logout()},account(){return u.getAccount()},extendHeaders(T){t||T.setHeaders(Je(u,h).then(y=>y&&{Authorization:`Bearer ${y}`},()=>{}))},token(){return Je(u,h)}}}})();
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
tslib/tslib.es6.js:
|