/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var ye=function(n,e){return ye=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var o in r)r.hasOwnProperty(o)&&(t[o]=r[o])},ye(n,e)};function B(n,e){ye(n,e);function t(){this.constructor=n}n.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,o=arguments.length;r<o;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 J(n,e,t,r){function o(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(m){a(m)}}function c(h){try{u(r.throw(h))}catch(m){a(m)}}function u(h){h.done?i(h.value):o(h.value).then(s,c)}u((r=r.apply(n,e||[])).next())})}function Y(n,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,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,o&&(i=u[0]&2?o.return:u[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;switch(o=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++,o=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(n,t)}catch(h){u=[6,h],o=0}finally{r=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function L(){for(var n=0,e=0,t=arguments.length;e<t;e++)n+=arguments[e].length;for(var r=Array(n),o=0,e=0;e<t;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r}var A=function(){function n(){}return n.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,n.decimalToHex(t[0])+n.decimalToHex(t[1])+n.decimalToHex(t[2])+n.decimalToHex(t[3])+"-"+n.decimalToHex(t[4])+n.decimalToHex(t[5])+"-"+n.decimalToHex(t[6])+n.decimalToHex(t[7])+"-"+n.decimalToHex(t[8])+n.decimalToHex(t[9])+"-"+n.decimalToHex(t[10])+n.decimalToHex(t[11])+n.decimalToHex(t[12])+n.decimalToHex(t[13])+n.decimalToHex(t[14])+n.decimalToHex(t[15])}else{for(var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",o="0123456789abcdef",i=0,a="",s=0;s<36;s++)r[s]!=="-"&&r[s]!=="4"&&(i=Math.random()*16|0),r[s]==="x"?a+=o[i]:r[s]==="y"?(i&=3,i|=8,a+=o[i]):a+=r[s];return a}},n.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)},n.decimalToHex=function(e){for(var t=e.toString(16);t.length<2;)t="0"+t;return t},n.base64Encode=function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(r,o){return String.fromCharCode(Number("0x"+o))}))},n.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(""))},n.deserialize=function(e){var t,r=/\+/g,o=/([^&=]+)=([^&]*)/g,i=function(s){return decodeURIComponent(s.replace(r," "))},a={};for(t=o.exec(e);t;)a[i(t[1])]=i(t[2]),t=o.exec(e);return a},n}(),l=function(){function n(){}return Object.defineProperty(n,"libraryName",{get:function(){return"Msal.js"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"claims",{get:function(){return"claims"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"clientId",{get:function(){return"clientId"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"adalIdToken",{get:function(){return"adal.idtoken"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"cachePrefix",{get:function(){return"msal"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"scopes",{get:function(){return"scopes"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"no_account",{get:function(){return"NO_ACCOUNT"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"upn",{get:function(){return"upn"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"domain_hint",{get:function(){return"domain_hint"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"prompt_select_account",{get:function(){return"&prompt=select_account"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"prompt_none",{get:function(){return"&prompt=none"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"prompt",{get:function(){return"prompt"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"response_mode_fragment",{get:function(){return"&response_mode=fragment"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"resourceDelimiter",{get:function(){return"|"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"cacheDelimiter",{get:function(){return"."},enumerable:!1,configurable:!0}),Object.defineProperty(n,"popUpWidth",{get:function(){return this._popUpWidth},set:function(e){this._popUpWidth=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"popUpHeight",{get:function(){return this._popUpHeight},set:function(e){this._popUpHeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"login",{get:function(){return"LOGIN"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"renewToken",{get:function(){return"RENEW_TOKEN"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"unknown",{get:function(){return"UNKNOWN"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"ADFS",{get:function(){return"adfs"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"homeAccountIdentifier",{get:function(){return"homeAccountIdentifier"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"common",{get:function(){return"common"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"openidScope",{get:function(){return"openid"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"profileScope",{get:function(){return"profile"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"oidcScopes",{get:function(){return[this.openidScope,this.profileScope]},enumerable:!1,configurable:!0}),Object.defineProperty(n,"interactionTypeRedirect",{get:function(){return"redirectInteraction"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"interactionTypePopup",{get:function(){return"popupInteraction"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"interactionTypeSilent",{get:function(){return"silentInteraction"},enumerable:!1,configurable:!0}),Object.defineProperty(n,"inProgress",{get:function(){return"inProgress"},enumerable:!1,configurable:!0}),n._popUpWidth=483,n._popUpHeight=600,n}(),Ne="sessionStorage",d;(function(n){n.SCOPE="scope",n.STATE="state",n.ERROR="error",n.ERROR_DESCRIPTION="error_description",n.ACCESS_TOKEN="access_token",n.ID_TOKEN="id_token",n.EXPIRES_IN="expires_in",n.SESSION_STATE="session_state",n.CLIENT_INFO="client_info"})(d||(d={}));var X={id_token:"id_token",token:"token",id_token_token:"id_token token"},E;(function(n){n.AUTHORITY="authority",n.ACQUIRE_TOKEN_ACCOUNT="acquireTokenAccount",n.SESSION_STATE="session.state",n.STATE_LOGIN="state.login",n.STATE_ACQ_TOKEN="state.acquireToken",n.STATE_RENEW="state.renew",n.NONCE_IDTOKEN="nonce.idtoken",n.LOGIN_REQUEST="login.request",n.RENEW_STATUS="token.renew.status",n.URL_HASH="urlHash",n.INTERACTION_STATUS="interaction.status",n.REDIRECT_REQUEST="redirect_request"})(E||(E={}));var q;(function(n){n.IDTOKEN="idtoken",n.CLIENT_INFO="client.info"})(q||(q={}));var P;(function(n){n.LOGIN_ERROR="login.error",n.ERROR="error",n.ERROR_DESC="error.description"})(P||(P={}));var Ue="https://login.microsoftonline.com/common/",Le=Ue+"/discovery/instance?api-version=1.1&authorization_endpoint=",be=".well-known/openid-configuration",I;(function(n){n.ACCOUNT="account",n.SID="sid",n.LOGIN_HINT="login_hint",n.ORGANIZATIONS="organizations",n.CONSUMERS="consumers",n.ID_TOKEN="id_token",n.ACCOUNT_ID="accountIdentifier",n.HOMEACCOUNT_ID="homeAccountIdentifier"})(I||(I={}));var Me=[I.SID,I.LOGIN_HINT],Ie={GET:"GET",POST:"POST"},ae={LOGIN:"login",SELECT_ACCOUNT:"select_account",CONSENT:"consent",NONE:"none"},we={ID_TOKEN_FRAME:"msalIdTokenFrame",TOKEN_FRAME:"msalRenewFrame"},ce={unexpectedError:{code:"unexpected_error",desc:"Unexpected error in authentication."},noWindowObjectError:{code:"no_window_object",desc:"No window object available. Details:"}},Q=function(n){B(e,n);function e(t,r){var o=n.call(this,r)||this;return Object.setPrototypeOf(o,e.prototype),o.errorCode=t,o.errorMessage=r,o.name="AuthError",o}return e.createUnexpectedError=function(t){return new e(ce.unexpectedError.code,ce.unexpectedError.desc+": "+t)},e.createNoWindowObjectError=function(t){return new e(ce.noWindowObjectError.code,ce.noWindowObjectError.desc+" "+t)},e}(Error),b=function(){function n(){}return n.isEmpty=function(e){return typeof e=="undefined"||!e||e.length===0},n.validateAndParseJsonCacheKey=function(e){try{var t=JSON.parse(e);return t&&typeof t=="object"?t:null}catch(r){return null}},n}(),p={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"}},T=function(n){B(e,n);function e(t,r){var o=n.call(this,t,r)||this;return o.name="ClientAuthError",Object.setPrototypeOf(o,e.prototype),o}return e.createEndpointResolutionError=function(t){var r=p.endpointResolutionError.desc;return t&&!b.isEmpty(t)&&(r+=" Details: "+t),new e(p.endpointResolutionError.code,r)},e.createPopupWindowError=function(t){var r=p.popUpWindowError.desc;return t&&!b.isEmpty(t)&&(r+=" Details: "+t),new e(p.popUpWindowError.code,r)},e.createTokenRenewalTimeoutError=function(){return new e(p.tokenRenewalError.code,p.tokenRenewalError.desc)},e.createInvalidIdTokenError=function(t){return new e(p.invalidIdToken.code,p.invalidIdToken.desc+" Given token: "+t)},e.createInvalidStateError=function(t,r){return new e(p.invalidStateError.code,p.invalidStateError.desc+" "+t+", state expected : "+r+".")},e.createNonceMismatchError=function(t,r){return new e(p.nonceMismatchError.code,p.nonceMismatchError.desc+" "+t+", nonce expected : "+r+".")},e.createLoginInProgressError=function(){return new e(p.loginProgressError.code,p.loginProgressError.desc)},e.createAcquireTokenInProgressError=function(){return new e(p.acquireTokenProgressError.code,p.acquireTokenProgressError.desc)},e.createUserCancelledError=function(){return new e(p.userCancelledError.code,p.userCancelledError.desc)},e.createErrorInCallbackFunction=function(t){return new e(p.callbackError.code,p.callbackError.desc+" "+t+".")},e.createUserLoginRequiredError=function(){return new e(p.userLoginRequiredError.code,p.userLoginRequiredError.desc)},e.createUserDoesNotExistError=function(){return new e(p.userDoesNotExistError.code,p.userDoesNotExistError.desc)},e.createClientInfoDecodingError=function(t){return new e(p.clientInfoDecodingError.code,p.clientInfoDecodingError.desc+" Failed with error: "+t)},e.createClientInfoNotPopulatedError=function(t){return new e(p.clientInfoNotPopulatedError.code,p.clientInfoNotPopulatedError.desc+" Failed with error: "+t)},e.createIdTokenNullOrEmptyError=function(t){return new e(p.nullOrEmptyIdToken.code,p.nullOrEmptyIdToken.desc+" Raw ID Token Value: "+t)},e.createIdTokenParsingError=function(t){return new e(p.idTokenNotParsed.code,p.idTokenNotParsed.desc+" Failed with error: "+t)},e.createTokenEncodingError=function(t){return new e(p.tokenEncodingError.code,p.tokenEncodingError.desc+" Attempted to decode: "+t)},e.createInvalidInteractionTypeError=function(){return new e(p.invalidInteractionType.code,p.invalidInteractionType.desc)},e.createCacheParseError=function(t){var r="invalid key: "+t+", "+p.cacheParseError.desc;return new e(p.cacheParseError.code,r)},e.createBlockTokenRequestsInHiddenIframeError=function(){return new e(p.blockTokenRequestsInHiddenIframe.code,p.blockTokenRequestsInHiddenIframe.desc)},e}(Q),g={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."}},N=function(n){B(e,n);function e(t,r){var o=n.call(this,t,r)||this;return o.name="ClientConfigurationError",Object.setPrototypeOf(o,e.prototype),o}return e.createNoSetConfigurationError=function(){return new e(g.configurationNotSet.code,""+g.configurationNotSet.desc)},e.createStorageNotSupportedError=function(t){return new e(g.storageNotSupported.code,g.storageNotSupported.desc+" Given location: "+t)},e.createRedirectCallbacksNotSetError=function(){return new e(g.noRedirectCallbacksSet.code,g.noRedirectCallbacksSet.desc)},e.createInvalidCallbackObjectError=function(t){return new e(g.invalidCallbackObject.code,g.invalidCallbackObject.desc+" Given value for callback function: "+t)},e.createEmptyScopesArrayError=function(t){return new e(g.emptyScopes.code,g.emptyScopes.desc+" Given value: "+t+".")},e.createScopesNonArrayError=function(t){return new e(g.nonArrayScopes.code,g.nonArrayScopes.desc+" Given value: "+t+".")},e.createScopesRequiredError=function(t){return new e(g.scopesRequired.code,g.scopesRequired.desc+" Given value: "+t)},e.createInvalidPromptError=function(t){return new e(g.invalidPrompt.code,g.invalidPrompt.desc+" Given value: "+t)},e.createClaimsRequestParsingError=function(t){return new e(g.claimsRequestParsingError.code,g.claimsRequestParsingError.desc+" Given value: "+t)},e.createEmptyRequestError=function(){var t=g.emptyRequestError,r=t.code,o=t.desc;return new e(r,o)},e.createInvalidCorrelationIdError=function(){return new e(g.invalidCorrelationIdError.code,g.invalidCorrelationIdError.desc)},e.createKnownAuthoritiesNotSetError=function(){return new e(g.b2cKnownAuthoritiesNotSet.code,g.b2cKnownAuthoritiesNotSet.desc)},e.createInvalidAuthorityTypeError=function(){return new e(g.invalidAuthorityType.code,g.invalidAuthorityType.desc)},e.createUntrustedAuthorityError=function(t){return new e(g.untrustedAuthority.code,g.untrustedAuthority.desc+" Provided Authority: "+t)},e.createTelemetryConfigError=function(t){var r=g.telemetryConfigError,o=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(o,i+" mising values: "+s.join(","))},e.createSsoSilentError=function(){return new e(g.ssoSilentError.code,g.ssoSilentError.desc)},e.createInvalidAuthorityMetadataError=function(){return new e(g.invalidAuthorityMetadataError.code,g.invalidAuthorityMetadataError.desc)},e}(T),M=function(){function n(){}return n.isIntersectingScopes=function(e,t){for(var r=this.trimAndConvertArrayToLowerCase(L(e)),o=this.trimAndConvertArrayToLowerCase(L(t)),i=0;i<o.length;i++)if(r.indexOf(o[i].toLowerCase())>-1)return!0;return!1},n.containsScope=function(e,t){var r=this.trimAndConvertArrayToLowerCase(L(e)),o=this.trimAndConvertArrayToLowerCase(L(t));return o.every(function(i){return r.indexOf(i.toString().toLowerCase())>=0})},n.trimAndConvertToLowerCase=function(e){return e.trim().toLowerCase()},n.trimAndConvertArrayToLowerCase=function(e){var t=this;return e.map(function(r){return t.trimAndConvertToLowerCase(r)})},n.trimScopes=function(e){return e.map(function(t){return t.trim()})},n.removeElement=function(e,t){var r=this.trimAndConvertToLowerCase(t);return e.filter(function(o){return o!==r})},n.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},n.validateInputScope=function(e,t){if(!e){if(t)throw N.createScopesRequiredError(e);return}if(!Array.isArray(e))throw N.createScopesNonArrayError(e);if(e.length<1&&t)throw N.createEmptyScopesArrayError(e.toString())},n.getScopeFromState=function(e){if(e){var t=e.indexOf(l.resourceDelimiter);if(t>-1&&t+1<e.length)return e.substring(t+1)}return""},n.appendScopes=function(e,t){if(e){var r=t?this.trimAndConvertArrayToLowerCase(L(t)):null,o=this.trimAndConvertArrayToLowerCase(L(e));return r?L(o,r):o}return null},n.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},n.containsAnyOidcScopes=function(e){var t=e.indexOf(l.openidScope)>-1,r=e.indexOf(l.profileScope)>-1;return t||r},n.onlyContainsClientId=function(e,t){return!!e&&e.indexOf(t)>-1&&e.length===1},n.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},n.removeDefaultScopes=function(e){return e.filter(function(t){return t!==l.openidScope&&t!==l.profileScope})},n.translateClientIdIfSingleScope=function(e,t){return this.onlyContainsClientId(e,t)?l.oidcScopes:e},n}(),v=function(){function n(){}return n.createNavigateUrl=function(e){var t=this.createNavigationUrlString(e),r=e.authorityInstance.AuthorizationEndpoint;r.indexOf("?")<0?r+="?":r+="&";var o=""+r+t.join("&");return o},n.createNavigationUrlString=function(e){var t=M.appendDefaultScopes(e.scopes),r=[];return r.push("response_type="+e.responseType),r.push("scope="+encodeURIComponent(M.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},n.getCurrentUrl=function(){return window.location.href.split("?")[0].split("#")[0]},n.removeHashFromUrl=function(e){return e.split("#")[0]},n.replaceTenantPath=function(e,t){var r=e.toLowerCase(),o=this.GetUrlComponents(r),i=o.PathSegments;return t&&i.length!==0&&(i[0]===l.common||i[0]===I.ORGANIZATIONS||i[0]===I.CONSUMERS)&&(i[0]=t),this.constructAuthorityUriFromObject(o,i)},n.constructAuthorityUriFromObject=function(e,t){return this.CanonicalizeUri(e.Protocol+"//"+e.HostNameAndPort+"/"+t.join("/"))},n.isCommonAuthority=function(e){var t=this.CanonicalizeUri(e),r=this.GetUrlComponents(t).PathSegments;return r.length!==0&&r[0]===l.common},n.isOrganizationsAuthority=function(e){var t=this.CanonicalizeUri(e),r=this.GetUrlComponents(t).PathSegments;return r.length!==0&&r[0]===I.ORGANIZATIONS},n.isConsumersAuthority=function(e){var t=this.CanonicalizeUri(e),r=this.GetUrlComponents(t).PathSegments;return r.length!==0&&r[0]===I.CONSUMERS},n.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 o={Protocol:r[1],HostNameAndPort:r[4],AbsolutePath:r[5]},i=o.AbsolutePath.split("/");return i=i.filter(function(a){return a&&a.length>0}),o.PathSegments=i,r[6]&&(o.Search=r[6]),r[8]&&(o.Hash=r[8]),o},n.CanonicalizeUri=function(e){if(e){var t=e.toLowerCase();return n.endsWith(t,"/")||(t+="/"),t}return e},n.endsWith=function(e,t){return!e||!t?!1:e.indexOf(t,e.length-t.length)!==-1},n.urlRemoveQueryStringParameter=function(e,t){if(b.isEmpty(e))return e;var r=e,o=new RegExp("(\\&"+t+"=)[^&]+");return r=e.replace(o,""),o=new RegExp("("+t+"=)[^&]+&"),r=e.replace(o,""),o=new RegExp("("+t+"=)[^&]+"),r=e.replace(o,""),r},n.getHashFromUrl=function(e){var t=e.indexOf("#"),r=e.indexOf("#/");return r>-1?e.substring(r+2):t>-1?e.substring(t+1):e},n.urlContainsHash=function(e){var t=n.deserializeHash(e);return t.hasOwnProperty(d.ERROR_DESCRIPTION)||t.hasOwnProperty(d.ERROR)||t.hasOwnProperty(d.ACCESS_TOKEN)||t.hasOwnProperty(d.ID_TOKEN)},n.deserializeHash=function(e){var t=n.getHashFromUrl(e);return A.deserialize(t)},n.getHostFromUri=function(e){var t=String(e).replace(/^(https?:)\/\//,"");return t=t.split("/")[0],t},n}(),xe=function(){function n(e,t,r,o,i){this.authority=v.CanonicalizeUri(e),this.clientId=t,this.scopes=r,this.homeAccountIdentifier=A.base64Encode(o)+"."+A.base64Encode(i)}return n}(),He=function(){function n(e,t,r,o){this.accessToken=e,this.idToken=t,this.expiresIn=r,this.homeAccountIdentifier=o}return n}(),de="1.4.18",Z=function(){function n(e,t,r,o,i,a,s){this.authorityInstance=e,this.clientId=t,this.nonce=A.createNewGuid(),this.scopes=i?L(i):l.oidcScopes,this.scopes=M.trimScopes(this.scopes),this.state=a,this.correlationId=s,this.xClientSku="MSAL.JS",this.xClientVer=de,this.responseType=r,this.redirectUri=o}return Object.defineProperty(n.prototype,"authority",{get:function(){return this.authorityInstance?this.authorityInstance.CanonicalAuthority:null},enumerable:!1,configurable:!0}),n.prototype.populateQueryParams=function(e,t,r,o){var i={};t&&(t.prompt&&(this.promptValue=t.prompt),t.claimsRequest&&(this.claimsValue=t.claimsRequest),n.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=n.generateQueryParametersString(i),this.extraQueryParameters=n.generateQueryParametersString(a,o)},n.prototype.constructUnifiedCacheQueryParameter=function(e,t){var r,o,i,a={};if(e)if(e.account){var s=e.account;!((r=s.idTokenClaims)===null||r===void 0)&&r.login_hint?(o=I.LOGIN_HINT,i=s.idTokenClaims.login_hint):s.sid?(o=I.SID,i=s.sid):s.userName&&(o=I.LOGIN_HINT,i=s.userName)}else e.sid?(o=I.SID,i=e.sid):e.loginHint&&(o=I.LOGIN_HINT,i=e.loginHint);else t&&t.hasOwnProperty(l.upn)&&(o=I.ID_TOKEN,i=t.upn);return a=this.addSSOParameter(o,i),a},n.prototype.addHintParameters=function(e,t){var r,o,i=t;return e&&!i[I.SID]&&!i[I.LOGIN_HINT]&&(!((r=e.idTokenClaims)===null||r===void 0)&&r.login_hint?i=this.addSSOParameter(I.LOGIN_HINT,(o=e.idTokenClaims)===null||o===void 0?void 0:o.login_hint,i):e.sid&&this.promptValue===ae.NONE?i=this.addSSOParameter(I.SID,e.sid,i):e.userName&&(i=this.addSSOParameter(I.LOGIN_HINT,e.userName,i))),i},n.prototype.addSSOParameter=function(e,t,r){var o=r||{};if(!t)return o;switch(e){case I.SID:{o[I.SID]=t;break}case I.ID_TOKEN:{o[I.LOGIN_HINT]=t;break}case I.LOGIN_HINT:{o[I.LOGIN_HINT]=t;break}}return o},n.generateQueryParametersString=function(e,t){var r=null;return e&&Object.keys(e).forEach(function(o){o===l.domain_hint&&(t||e[I.SID])||(r?r+="&"+o+"="+encodeURIComponent(e[o]):r=o+"="+encodeURIComponent(e[o]))}),r},n.isSSOParam=function(e){return!!(e&&(e.account||e.sid||e.loginHint))},n.determineResponseType=function(e,t){return M.onlyContainsOidcScopes(t)?X.id_token:e?this.responseTypeForMatchingAccounts(t):X.id_token_token},n.responseTypeForMatchingAccounts=function(e){return M.containsAnyOidcScopes(e)?X.id_token_token:X.token},n}(),Re=function(){function n(){}return n.prototype.sendRequestAsync=function(e,t,r){var o=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(o.handleError(s.responseText));var c;try{c=JSON.parse(s.responseText)}catch(h){a(o.handleError(s.responseText))}var u={statusCode:s.status,body:c};i(u)},s.onerror=function(){a(s.status)},t===Ie.GET)s.send();else throw"not implemented"})},n.prototype.handleError=function(e){var t;try{if(t=JSON.parse(e),t.error)return t.error;throw e}catch(r){return e}},n}(),le=function(){function n(){}return n.setTrustedAuthoritiesFromConfig=function(e,t){e&&!this.getTrustedHostList().length&&t.forEach(function(r){n.TrustedHostList.push(r.toLowerCase())})},n.getAliases=function(e,t,r){return J(this,void 0,void 0,function(){var o,i,a,s;return Y(this,function(c){return o=new Re,i=Ie.GET,a=""+Le+e+"oauth2/v2.0/authorize",s=t.createAndStartHttpEvent(r,i,a,"getAliases"),[2,o.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})]})})},n.setTrustedAuthoritiesFromNetwork=function(e,t,r){return J(this,void 0,void 0,function(){var o,i;return Y(this,function(a){switch(a.label){case 0:return[4,this.getAliases(e,t,r)];case 1:return o=a.sent(),o.forEach(function(s){var c=s.aliases;c.forEach(function(u){n.TrustedHostList.push(u.toLowerCase())})}),i=v.GetUrlComponents(e).HostNameAndPort,n.getTrustedHostList().length&&!n.IsInTrustedHostList(i)&&n.TrustedHostList.push(i.toLowerCase()),[2]}})})},n.getTrustedHostList=function(){return this.TrustedHostList},n.IsInTrustedHostList=function(e){return this.TrustedHostList.indexOf(e.toLowerCase())>-1},n.TrustedHostList=[],n}(),te;(function(n){n[n.Default=0]="Default",n[n.Adfs=1]="Adfs"})(te||(te={}));var _e=function(){function n(e,t,r){this.IsValidationEnabled=t,this.CanonicalAuthority=e,this.validateAsUri(),this.tenantDiscoveryResponse=r}return n.isAdfs=function(e){var t=v.GetUrlComponents(e),r=t.PathSegments;return r.length&&r[0].toLowerCase()===l.ADFS},Object.defineProperty(n.prototype,"AuthorityType",{get:function(){return n.isAdfs(this.canonicalAuthority)?te.Adfs:te.Default},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"Tenant",{get:function(){return this.CanonicalAuthorityUrlComponents.PathSegments[0]},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"AuthorizationEndpoint",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.AuthorizationEndpoint.replace(/{tenant}|{tenantid}/g,this.Tenant)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"EndSessionEndpoint",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.EndSessionEndpoint.replace(/{tenant}|{tenantid}/g,this.Tenant)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"SelfSignedJwtAudience",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.Issuer.replace(/{tenant}|{tenantid}/g,this.Tenant)},enumerable:!1,configurable:!0}),n.prototype.validateResolved=function(){if(!this.hasCachedMetadata())throw"Please call ResolveEndpointsAsync first"},Object.defineProperty(n.prototype,"CanonicalAuthority",{get:function(){return this.canonicalAuthority},set:function(e){this.canonicalAuthority=v.CanonicalizeUri(e),this.canonicalAuthorityUrlComponents=null},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"CanonicalAuthorityUrlComponents",{get:function(){return this.canonicalAuthorityUrlComponents||(this.canonicalAuthorityUrlComponents=v.GetUrlComponents(this.CanonicalAuthority)),this.canonicalAuthorityUrlComponents},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"DefaultOpenIdConfigurationEndpoint",{get:function(){return this.AuthorityType===te.Adfs?""+this.CanonicalAuthority+be:this.CanonicalAuthority+"v2.0/"+be},enumerable:!1,configurable:!0}),n.prototype.validateAsUri=function(){var e;try{e=this.CanonicalAuthorityUrlComponents}catch(t){throw g.invalidAuthorityType}if(!e.Protocol||e.Protocol.toLowerCase()!=="https:")throw g.authorityUriInsecure;if(!e.PathSegments||e.PathSegments.length<1)throw g.authorityUriInvalidPath},n.prototype.DiscoverEndpoints=function(e,t,r){var o=new Re,i=Ie.GET,a=t.createAndStartHttpEvent(r,i,e,"openIdConfigurationEndpoint");return o.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})},n.prototype.resolveEndpointsAsync=function(e,t){return J(this,void 0,void 0,function(){var r,o,i;return Y(this,function(a){switch(a.label){case 0:return this.IsValidationEnabled?(r=this.canonicalAuthorityUrlComponents.HostNameAndPort,le.getTrustedHostList().length!==0?[3,2]:[4,le.setTrustedAuthoritiesFromNetwork(this.canonicalAuthority,e,t)]):[3,3];case 1:a.sent(),a.label=2;case 2:if(!le.IsInTrustedHostList(r))throw N.createUntrustedAuthorityError(r);a.label=3;case 3:return o=this.GetOpenIdConfigurationEndpoint(),i=this,[4,this.DiscoverEndpoints(o,e,t)];case 4:return i.tenantDiscoveryResponse=a.sent(),[2,this.tenantDiscoveryResponse]}})})},n.prototype.hasCachedMetadata=function(){return!!(this.tenantDiscoveryResponse&&this.tenantDiscoveryResponse.AuthorizationEndpoint&&this.tenantDiscoveryResponse.EndSessionEndpoint&&this.tenantDiscoveryResponse.Issuer)},n.prototype.GetOpenIdConfigurationEndpoint=function(){return this.DefaultOpenIdConfigurationEndpoint},n}(),re=function(){function n(e,t){if(!e||b.isEmpty(e)){this.uid="",this.utid="";return}try{var r=A.base64Decode(e),o=JSON.parse(r);o&&(o.hasOwnProperty("uid")&&(this.uid=t?n.stripPolicyFromUid(o.uid,t):o.uid),o.hasOwnProperty("utid")&&(this.utid=o.utid))}catch(i){throw T.createClientInfoDecodingError(i)}}return Object.defineProperty(n.prototype,"uid",{get:function(){return this._uid?this._uid:""},set:function(e){this._uid=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"utid",{get:function(){return this._utid?this._utid:""},set:function(e){this._utid=e},enumerable:!1,configurable:!0}),n.createClientInfoFromIdToken=function(e,t){var r={uid:e.subject,utid:""};return new n(A.base64Encode(JSON.stringify(r)),t)},n.stripPolicyFromUid=function(e,t){var r=e.split("-"),o=t.split("/").reverse(),i="";return b.isEmpty(o[0])?o.length>1&&(i=o[1]):i=o[0],r[r.length-1]===i?r.slice(0,r.length-1).join("-"):e},n.prototype.encodeClientInfo=function(){var e=JSON.stringify({uid:this.uid,utid:this.utid});return A.base64Encode(e)},n}(),ie=function(){function n(){}return n.parseExpiresIn=function(e){var t=e||"3599";return parseInt(t,10)},n.now=function(){return Math.round(new Date().getTime()/1e3)},n.relativeNowMs=function(){return window.performance.now()},n}(),he=function(){function n(){}return n.decodeJwt=function(e){if(b.isEmpty(e))return null;var t=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/,r=t.exec(e);if(!r||r.length<4)return null;var o={header:r[1],JWSPayload:r[2],JWSSig:r[3]};return o},n.validateExpirationIsWithinOffset=function(e,t){var r=t||300;return e&&e>ie.now()+r},n.extractIdToken=function(e){var t=this.decodeJwt(e);if(!t)return null;try{var r=t.JWSPayload,o=A.base64Decode(r);return o?JSON.parse(o):null}catch(i){}return null},n}(),ee=function(){function n(e){if(b.isEmpty(e))throw T.createIdTokenNullOrEmptyError(e);try{this.rawIdToken=e,this.claims=he.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 T.createIdTokenParsingError(t)}}return n}(),De=function(){function n(e,t){this.key=e,this.value=t}return n}(),Se=function(){function n(e){if(!window)throw Q.createNoWindowObjectError("Browser storage class could not find window object");var t=typeof window[e]!="undefined"&&window[e]!==null;if(!t)throw N.createStorageNotSupportedError(e);this.cacheLocation=e}return n.prototype.setItem=function(e,t,r){window[this.cacheLocation].setItem(e,t),r&&this.setItemCookie(e,t)},n.prototype.getItem=function(e,t){return t&&this.getItemCookie(e)?this.getItemCookie(e):window[this.cacheLocation].getItem(e)},n.prototype.removeItem=function(e){return window[this.cacheLocation].removeItem(e)},n.prototype.clear=function(){return window[this.cacheLocation].clear()},n.prototype.setItemCookie=function(e,t,r){var o=encodeURIComponent(e)+"="+encodeURIComponent(t)+";path=/;";if(r){var i=this.getCookieExpirationTime(r);o+="expires="+i+";"}document.cookie=o},n.prototype.getItemCookie=function(e){for(var t=encodeURIComponent(e)+"=",r=document.cookie.split(";"),o=0;o<r.length;o++){for(var i=r[o];i.charAt(0)===" ";)i=i.substring(1);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}return""},n.prototype.clearItemCookie=function(e){this.setItemCookie(e,"",-1)},n.prototype.getCookieExpirationTime=function(e){var t=new Date,r=new Date(t.getTime()+e*24*60*60*1e3);return r.toUTCString()},n}(),j=function(){function n(){}return n.validateRequest=function(e,t,r,o){if(!t&&!e)throw N.createEmptyRequestError();var i,a;e&&(i=t?M.appendScopes(e.scopes,e.extraScopesToConsent):e.scopes,M.validateInputScope(i,!t),i=M.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,o),c=this.validateAndGenerateCorrelationId(e&&e.correlationId),u=S(S({},e),{extraQueryParameters:a,scopes:i,state:s,correlationId:c});return u},n.validatePromptParameter=function(e){if(e&&[ae.LOGIN,ae.SELECT_ACCOUNT,ae.CONSENT,ae.NONE].indexOf(e)<0)throw N.createInvalidPromptError(e)},n.validateEQParameters=function(e,t){var r=S({},e);return r?(t&&delete r[l.claims],Me.forEach(function(o){r[o]&&delete r[o]}),r):null},n.validateClaimsRequest=function(e){if(!!e)try{JSON.parse(e)}catch(t){throw N.createClaimsRequestParsingError(t)}},n.validateAndGenerateState=function(e,t){return b.isEmpty(e)?n.generateLibraryState(t):""+n.generateLibraryState(t)+l.resourceDelimiter+e},n.generateLibraryState=function(e){var t={id:A.createNewGuid(),ts:ie.now(),method:e},r=JSON.stringify(t);return A.base64Encode(r)},n.parseLibraryState=function(e){var t=decodeURIComponent(e).split(l.resourceDelimiter)[0];if(A.isGuid(t))return{id:t,ts:ie.now(),method:l.interactionTypeRedirect};try{var r=A.base64Decode(t),o=JSON.parse(r);return o}catch(i){throw T.createInvalidStateError(e,null)}},n.validateAndGenerateCorrelationId=function(e){if(e&&!A.isGuid(e))throw N.createInvalidCorrelationIdError();return A.isGuid(e)?e:A.createNewGuid()},n.createRequestSignature=function(e){return""+e.scopes.join(" ").toLowerCase()+l.resourceDelimiter+e.authority},n}(),C=function(n){B(e,n);function e(t,r,o){var i=n.call(this,r)||this;return i.temporaryCache=new Se(Ne),i.clientId=t,i.rollbackEnabled=!0,i.migrateCacheEntries(o),i}return e.prototype.migrateCacheEntries=function(t){var r=this,o=l.cachePrefix+"."+q.IDTOKEN,i=l.cachePrefix+"."+q.CLIENT_INFO,a=l.cachePrefix+"."+P.ERROR,s=l.cachePrefix+"."+P.ERROR_DESC,c=n.prototype.getItem.call(this,o),u;if(c)try{u=new ee(c)}catch(_){return}if(u&&u.claims&&u.claims.aud===this.clientId){var h=n.prototype.getItem.call(this,i),m=n.prototype.getItem.call(this,a),y=n.prototype.getItem.call(this,s),w=[c,h,m,y],k=[q.IDTOKEN,q.CLIENT_INFO,P.ERROR,P.ERROR_DESC];k.forEach(function(_,K){return r.duplicateCacheEntry(_,w[K],t)})}},e.prototype.duplicateCacheEntry=function(t,r,o){r&&this.setItem(t,r,o)},e.prototype.generateCacheKey=function(t,r){try{return JSON.parse(t),t}catch(o){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,o,i){var a=b.validateAndParseJsonCacheKey(t);if(!a)return null;var s=t.match(r)&&t.match(o),c=!1;switch(i){case d.ACCESS_TOKEN:c=!!t.match(l.scopes);break;case d.ID_TOKEN:c=!t.match(l.scopes);break}return s&&c?a:null},e.prototype.setItem=function(t,r,o){n.prototype.setItem.call(this,this.generateCacheKey(t,!0),r,o),this.rollbackEnabled&&!o&&n.prototype.setItem.call(this,this.generateCacheKey(t,!1),r,o)},e.prototype.getItem=function(t,r){return n.prototype.getItem.call(this,this.generateCacheKey(t,!0),r)},e.prototype.removeItem=function(t){this.temporaryCache.removeItem(this.generateCacheKey(t,!0)),n.prototype.removeItem.call(this,this.generateCacheKey(t,!0)),this.rollbackEnabled&&n.prototype.removeItem.call(this,this.generateCacheKey(t,!1))},e.prototype.setTemporaryItem=function(t,r,o){this.temporaryCache.setItem(this.generateCacheKey(t,!0),r,o)},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&&n.prototype.removeItem.call(this,r)},e.prototype.resetTempCacheItems=function(t){var r=this,o=t&&j.parseLibraryState(t).id,i=this.tokenRenewalInProgress(t),a=window[this.cacheLocation];o&&!i&&Object.keys(a).forEach(function(s){s.indexOf(o)!==-1&&(r.removeItem(s),n.prototype.clearItemCookie.call(r,s))}),this.setInteractionInProgress(!1),this.removeItem(E.REDIRECT_REQUEST)},e.prototype.setItemCookie=function(t,r,o){n.prototype.setItemCookie.call(this,this.generateCacheKey(t,!0),r,o),this.rollbackEnabled&&n.prototype.setItemCookie.call(this,this.generateCacheKey(t,!1),r,o)},e.prototype.clearItemCookie=function(t){n.prototype.clearItemCookie.call(this,this.generateCacheKey(t,!0)),this.rollbackEnabled&&n.prototype.clearItemCookie.call(this,this.generateCacheKey(t,!1))},e.prototype.getItemCookie=function(t){return n.prototype.getItemCookie.call(this,this.generateCacheKey(t,!0))},e.prototype.getAllTokensByType=function(t,r,o){var i=this,a=Object.keys(window[this.cacheLocation]).reduce(function(s,c){var u=i.matchKeyForType(c,t,r,o);if(u){var h=i.getItem(c);if(h)try{var m=new De(u,JSON.parse(h));return s.concat([m])}catch(y){return s}}return s},[]);return a},e.prototype.getAllAccessTokens=function(t,r){return this.getAllTokensByType(t,r,d.ACCESS_TOKEN)},e.prototype.getAllIdTokens=function(t,r){return this.getAllTokensByType(t,r,d.ID_TOKEN)},e.prototype.getAllTokens=function(t,r){var o=this.getAllAccessTokens(t,r),i=this.getAllIdTokens(t,r);return L(o,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(E.INTERACTION_STATUS,!1))},e.prototype.setInteractionInProgress=function(t){if(t){if(this.isInteractionInProgress(!1))throw T.createAcquireTokenInProgressError();this.setTemporaryItem(this.generateCacheKey(E.INTERACTION_STATUS,!1),this.clientId)}else!t&&this.isInteractionInProgress(!0)&&this.removeItem(this.generateCacheKey(E.INTERACTION_STATUS,!1))},e.prototype.tokenRenewalInProgress=function(t){var r=this.getItem(e.generateTemporaryCacheKey(E.RENEW_STATUS,t));return!!(r&&r===l.inProgress)},e.prototype.clearMsalCookie=function(t){var r=this;if(t)this.clearItemCookie(e.generateTemporaryCacheKey(E.NONCE_IDTOKEN,t)),this.clearItemCookie(e.generateTemporaryCacheKey(E.STATE_LOGIN,t)),this.clearItemCookie(e.generateTemporaryCacheKey(E.LOGIN_REQUEST,t)),this.clearItemCookie(e.generateTemporaryCacheKey(E.STATE_ACQ_TOKEN,t));else{var o=document.cookie.split(";");o.forEach(function(i){var a=i.trim().split("=")[0];a.indexOf(l.cachePrefix)>-1&&n.prototype.clearItemCookie.call(r,a)})}},e.generateAcquireTokenAccountKey=function(t,r){var o=j.parseLibraryState(r).id;return""+E.ACQUIRE_TOKEN_ACCOUNT+l.resourceDelimiter+t+l.resourceDelimiter+o},e.generateAuthorityKey=function(t){return e.generateTemporaryCacheKey(E.AUTHORITY,t)},e.generateTemporaryCacheKey=function(t,r){var o=j.parseLibraryState(r).id;return""+t+l.resourceDelimiter+o},e}(Se),ne=function(){function n(e,t,r,o,i,a,s){this.accountIdentifier=e,this.homeAccountIdentifier=t,this.userName=r,this.name=o,this.idToken=i,this.idTokenClaims=i,this.sid=a,this.environment=s}return n.createAccount=function(e,t){var r=e.objectId||e.subject,o=t?t.uid:"",i=t?t.utid:"",a;return b.isEmpty(o)||(a=b.isEmpty(i)?A.base64Encode(o):A.base64Encode(o)+"."+A.base64Encode(i)),new n(r,a,e.preferredName,e.name,e.claims,e.sid,e.issuer)},n.compareAccounts=function(e,t){return!e||!t?!1:!!(e.homeAccountIdentifier&&t.homeAccountIdentifier&&e.homeAccountIdentifier===t.homeAccountIdentifier)},n}(),O=function(){function n(){}return n.isInIframe=function(){return window.parent!==window},n.isInPopup=function(){return!!(window.opener&&window.opener!==window)},n.generateFrameName=function(e,t){return""+e+l.resourceDelimiter+t},n.monitorIframeForHash=function(e,t,r,o){return new Promise(function(i,a){var s=ie.relativeNowMs(),c=s+t;o.verbose("monitorWindowForIframe polling started");var u=setInterval(function(){if(ie.relativeNowMs()>c){o.error("monitorIframeForHash unable to find hash in url, timing out"),o.errorPii("monitorIframeForHash polling timed out for url: "+r),clearInterval(u),a(T.createTokenRenewalTimeoutError());return}var h;try{h=e.location.href}catch(m){}h&&v.urlContainsHash(h)&&(o.verbose("monitorIframeForHash found url in hash"),clearInterval(u),i(e.location.hash))},n.POLLING_INTERVAL_MS)})},n.monitorPopupForHash=function(e,t,r,o){return new Promise(function(i,a){var s=t/n.POLLING_INTERVAL_MS,c=0;o.verbose("monitorWindowForHash polling started");var u=setInterval(function(){if(e.closed){o.error("monitorWindowForHash window closed"),clearInterval(u),a(T.createUserCancelledError());return}var h;try{h=e.location.href}catch(y){}if(!(!h||h==="about:blank"))if(c++,h&&v.urlContainsHash(h)){o.verbose("monitorPopupForHash found url in hash"),clearInterval(u);var m=e.location.hash;n.clearUrlFragment(e),i(m)}else c>s&&(o.error("monitorPopupForHash unable to find hash in url, timing out"),o.errorPii("monitorPopupForHash polling timed out for url: "+r),clearInterval(u),a(T.createTokenRenewalTimeoutError()))},n.POLLING_INTERVAL_MS)})},n.loadFrame=function(e,t,r,o){var i=this;return o.infoPii("LoadFrame: "+t),new Promise(function(a,s){setTimeout(function(){var c=i.loadFrameSync(e,t,o);if(!c){s("Unable to load iframe with name: "+t);return}a(c)},r)})},n.loadFrameSync=function(e,t,r){var o=n.addHiddenIFrame(t,r);if(o)(o.src===""||o.src==="about:blank")&&(o.src=e,r.infoPii("Frame Name : "+t+" Navigated to: "+e));else return null;return o},n.addHiddenIFrame=function(e,t){if(typeof e=="undefined")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 o=document.createElement("iframe");o.setAttribute("id",e),o.setAttribute("aria-hidden","true"),o.style.visibility="hidden",o.style.position="absolute",o.style.width=o.style.height="0",o.style.border="0",o.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),r=document.getElementsByTagName("body")[0].appendChild(o)}return r},n.removeHiddenIframe=function(e){document.body===e.parentNode&&document.body.removeChild(e)},n.getIframeWithHash=function(e){var t=document.getElementsByTagName("iframe"),r=Array.apply(null,Array(t.length)).map(function(o,i){return t.item(i)});return r.filter(function(o){try{return o.contentWindow.location.hash===e}catch(i){return!1}})[0]},n.getPopups=function(){return window.openedWindows||(window.openedWindows=[]),window.openedWindows},n.getPopUpWithHash=function(e){return n.getPopups().filter(function(t){try{return t.location.hash===e}catch(r){return!1}})[0]},n.trackPopup=function(e){n.getPopups().push(e)},n.closePopups=function(){n.getPopups().forEach(function(e){return e.close()})},n.blockReloadInHiddenIframes=function(){if(v.urlContainsHash(window.location.hash)&&n.isInIframe())throw T.createBlockTokenRequestsInHiddenIframeError()},n.checkIfBackButtonIsPressed=function(e){var t=e.getItem(E.REDIRECT_REQUEST);if(t&&!v.urlContainsHash(window.location.hash)){var r=t.split(l.resourceDelimiter);r.shift();var o=r.length>0?r.join(l.resourceDelimiter):null;e.resetTempCacheItems(o)}},n.clearUrlFragment=function(e){e.location.hash="",typeof e.history.replaceState=="function"&&e.history.replaceState(null,null,""+e.location.pathname+e.location.search)},n.POLLING_INTERVAL_MS=50,n}(),pe=function(){function n(){}return n.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})},n.buildAuthResponse=function(e,t,r,o,i,a){switch(r.responseType){case X.id_token:var s=S(S({},t),{tokenType:d.ID_TOKEN,account:o,scopes:i,accountState:a});return s=n.setResponseIdToken(s,e),s.idToken?s:null;case X.id_token_token:var c=n.setResponseIdToken(t,e);return c&&c.accessToken&&c.idToken?c:null;case X.token:var u=n.setResponseIdToken(t,e);return u;default:return null}},n}(),G=function(){function n(){}return n.saveMetadataFromNetwork=function(e,t,r){return J(this,void 0,void 0,function(){var o;return Y(this,function(i){switch(i.label){case 0:return[4,e.resolveEndpointsAsync(t,r)];case 1:return o=i.sent(),this.metadataMap.set(e.CanonicalAuthority,o),[2,o]}})})},n.getMetadata=function(e){return this.metadataMap.get(e)},n.saveMetadataFromConfig=function(e,t){try{if(t){var r=JSON.parse(t);if(!r.authorization_endpoint||!r.end_session_endpoint||!r.issuer)throw N.createInvalidAuthorityMetadataError();this.metadataMap.set(e,{AuthorizationEndpoint:r.authorization_endpoint,EndSessionEndpoint:r.end_session_endpoint,Issuer:r.issuer})}}catch(o){throw N.createInvalidAuthorityMetadataError()}},n.CreateInstance=function(e,t,r){return b.isEmpty(e)?null:(r&&this.saveMetadataFromConfig(e,r),new _e(e,t,this.metadataMap.get(e)))},n.metadataMap=new Map,n}(),U;(function(n){n[n.Error=0]="Error",n[n.Warning=1]="Warning",n[n.Info=2]="Info",n[n.Verbose=3]="Verbose"})(U||(U={}));var Fe=function(){function n(e,t){t===void 0&&(t={}),this.level=U.Info;var r=t.correlationId,o=r===void 0?"":r,i=t.level,a=i===void 0?U.Info:i,s=t.piiLoggingEnabled,c=s===void 0?!1:s;this.localCallback=e,this.correlationId=o,this.level=a,this.piiLoggingEnabled=c}return n.prototype.logMessage=function(e,t,r){if(!(e>this.level||!this.piiLoggingEnabled&&r)){var o=new Date().toUTCString(),i;b.isEmpty(this.correlationId)?i=o+":"+de+"-"+U[e]+(r?"-pii":"")+" "+t:i=o+":"+this.correlationId+"-"+de+"-"+U[e]+(r?"-pii":"")+" "+t,this.executeCallback(e,i,r)}},n.prototype.executeCallback=function(e,t,r){this.localCallback&&this.localCallback(e,t,r)},n.prototype.error=function(e){this.logMessage(U.Error,e,!1)},n.prototype.errorPii=function(e){this.logMessage(U.Error,e,!0)},n.prototype.warning=function(e){this.logMessage(U.Warning,e,!1)},n.prototype.warningPii=function(e){this.logMessage(U.Warning,e,!0)},n.prototype.info=function(e){this.logMessage(U.Info,e,!1)},n.prototype.infoPii=function(e){this.logMessage(U.Info,e,!0)},n.prototype.verbose=function(e){this.logMessage(U.Verbose,e,!1)},n.prototype.verbosePii=function(e){this.logMessage(U.Verbose,e,!0)},n.prototype.isPiiLoggingEnabled=function(){return this.piiLoggingEnabled},n}(),Ke=6e3,je=300,qe=500,Ge={clientId:"",authority:null,validateAuthority:!0,authorityMetadata:"",knownAuthorities:[],redirectUri:function(){return v.getCurrentUrl()},postLogoutRedirectUri:function(){return v.getCurrentUrl()},navigateToLoginRequestUrl:!0},We={cacheLocation:"sessionStorage",storeAuthStateInCookie:!1},Qe={logger:new Fe(null),loadFrameTimeout:Ke,tokenRenewalOffsetSeconds:je,navigateFrameWait:qe},Be={isAngular:!1,unprotectedResources:new Array,protectedResourceMap:new Map};function Ve(n){var e=n.auth,t=n.cache,r=t===void 0?{}:t,o=n.system,i=o===void 0?{}:o,a=n.framework,s=a===void 0?{}:a,c={auth:S(S({},Ge),e),cache:S(S({},We),r),system:S(S({},Qe),i),framework:S(S({},Be),s)};return c}var fe={serverUnavailable:{code:"server_unavailable",desc:"Server is temporarily unavailable."},unknownServerError:{code:"unknown_server_error"}},Oe=function(n){B(e,n);function e(t,r){var o=n.call(this,t,r)||this;return o.name="ServerError",Object.setPrototypeOf(o,e.prototype),o}return e.createServerUnavailableError=function(){return new e(fe.serverUnavailable.code,fe.serverUnavailable.desc)},e.createUnknownServerError=function(t){return new e(fe.unknownServerError.code,t)},e}(Q),oe={interactionRequired:{code:"interaction_required"},consentRequired:{code:"consent_required"},loginRequired:{code:"login_required"}},ge=function(n){B(e,n);function e(t,r){var o=n.call(this,t,r)||this;return o.name="InteractionRequiredAuthError",Object.setPrototypeOf(o,e.prototype),o}return e.isInteractionRequiredError=function(t){var r=[oe.interactionRequired.code,oe.consentRequired.code,oe.loginRequired.code];return t&&r.indexOf(t)>-1},e.createLoginRequiredAuthError=function(t){return new e(oe.loginRequired.code,t)},e.createInteractionRequiredAuthError=function(t){return new e(oe.interactionRequired.code,t)},e.createConsentRequiredAuthError=function(t){return new e(oe.consentRequired.code,t)},e}(Oe);function ue(n){return{uniqueId:"",tenantId:"",tokenType:"",idToken:null,idTokenClaims:null,accessToken:"",scopes:null,expiresOn:null,account:null,accountState:n,fromCache:!1}}var ze="msal.",Ce="event_name",Je="start_time",Ae="elapsed_time",$={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"},Ye="<tenant>",Ee=function(n){var e=v.GetUrlComponents(n);if(_e.isAdfs(n))return n;var t=e.PathSegments;if(t&&t.length>=2){var r=t[1]==="tfp"?2:1;r<t.length&&(t[r]=Ye)}return e.Protocol+"//"+e.HostNameAndPort+"/"+t.join("/")},ve=function(n){return A.base64Encode(n)},f=function(n){return""+ze+(n||"")},Pe=function(){return!!(typeof window!="undefined"&&"performance"in window&&window.performance.mark&&window.performance.measure)},Xe=function(n,e,t){Pe()&&(window.performance.mark(t),window.performance.measure(n,e,t),window.performance.clearMeasures(n),window.performance.clearMarks(e),window.performance.clearMarks(t))},$e=function(n){Pe()&&window.performance.mark(n)},Ze=function(){function n(e,t,r){var o;this.eventId=A.createNewGuid(),this.label=r,this.event=(o={},o[f(Ce)]=e,o[f(Ae)]=-1,o[""+$.MsalCorrelationIdConstStrKey]=t,o)}return n.prototype.setElapsedTime=function(e){this.event[f(Ae)]=e},n.prototype.stop=function(){this.setElapsedTime(+Date.now()-+this.startTimestamp),Xe(this.displayName,this.perfStartMark,this.perfEndMark)},n.prototype.start=function(){this.startTimestamp=Date.now(),this.event[f(Je)]=this.startTimestamp,$e(this.perfStartMark)},Object.defineProperty(n.prototype,"telemetryCorrelationId",{get:function(){return this.event[""+$.MsalCorrelationIdConstStrKey]},set:function(e){this.event[""+$.MsalCorrelationIdConstStrKey]=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"eventName",{get:function(){return this.event[f(Ce)]},enumerable:!1,configurable:!0}),n.prototype.get=function(){return S(S({},this.event),{eventId:this.eventId})},Object.defineProperty(n.prototype,"key",{get:function(){return this.telemetryCorrelationId+"_"+this.eventId+"-"+this.eventName},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"displayName",{get:function(){return"Msal-"+this.label+"-"+this.telemetryCorrelationId},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"perfStartMark",{get:function(){return"start-"+this.key},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"perfEndMark",{get:function(){return"end-"+this.key},enumerable:!1,configurable:!0}),n}(),Te=Ze,et=function(n){B(e,n);function e(t,r,o,i){var a=n.call(this,f("default_event"),r,"DefaultEvent")||this;return a.event[f("client_id")]=o,a.event[f("sdk_plaform")]=t.sdk,a.event[f("sdk_version")]=t.sdkVersion,a.event[f("application_name")]=t.applicationName,a.event[f("application_version")]=t.applicationVersion,a.event[f("effective_connection_speed")]=t.networkInformation&&t.networkInformation.connectionSpeed,a.event[""+$.UiEventCountTelemetryBatchKey]=a.getEventCount(f("ui_event"),i),a.event[""+$.HttpEventCountTelemetryBatchKey]=a.getEventCount(f("http_event"),i),a.event[""+$.CacheEventCountConstStrKey]=a.getEventCount(f("cache_event"),i),a}return e.prototype.getEventCount=function(t,r){return r[t]?r[t]:0},e}(Te),tt=et,V,W={AUTHORITY:f("authority"),AUTHORITY_TYPE:f("authority_type"),PROMPT:f("ui_behavior"),TENANT_ID:f("tenant_id"),USER_ID:f("user_id"),WAS_SUCESSFUL:f("was_successful"),API_ERROR_CODE:f("api_error_code"),LOGIN_HINT:f("login_hint")},z;(function(n){n[n.AcquireTokenRedirect=2001]="AcquireTokenRedirect",n[n.AcquireTokenSilent=2002]="AcquireTokenSilent",n[n.AcquireTokenPopup=2003]="AcquireTokenPopup",n[n.LoginRedirect=2004]="LoginRedirect",n[n.LoginPopup=2005]="LoginPopup",n[n.Logout=2006]="Logout"})(z||(z={}));var F;(function(n){n.AcquireTokenRedirect="AcquireTokenRedirect",n.AcquireTokenSilent="AcquireTokenSilent",n.AcquireTokenPopup="AcquireTokenPopup",n.LoginRedirect="LoginRedirect",n.LoginPopup="LoginPopup",n.Logout="Logout"})(F||(F={}));var rt=(V={},V[F.AcquireTokenSilent]=z.AcquireTokenSilent,V[F.AcquireTokenPopup]=z.AcquireTokenPopup,V[F.AcquireTokenRedirect]=z.AcquireTokenRedirect,V[F.LoginPopup]=z.LoginPopup,V[F.LoginRedirect]=z.LoginRedirect,V[F.Logout]=z.Logout,V),nt=function(n){B(e,n);function e(t,r,o){var i=n.call(this,f("api_event"),t,o)||this;return o&&(i.apiCode=rt[o],i.apiEventIdentifier=o),i.piiEnabled=r,i}return Object.defineProperty(e.prototype,"apiEventIdentifier",{set:function(t){this.event[$.ApiTelemIdConstStrKey]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"apiCode",{set:function(t){this.event[$.ApiIdConstStrKey]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"authority",{set:function(t){this.event[W.AUTHORITY]=Ee(t).toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"apiErrorCode",{set:function(t){this.event[W.API_ERROR_CODE]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tenantId",{set:function(t){this.event[W.TENANT_ID]=this.piiEnabled&&t?ve(t):null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"accountId",{set:function(t){this.event[W.USER_ID]=this.piiEnabled&&t?ve(t):null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wasSuccessful",{get:function(){return this.event[W.WAS_SUCESSFUL]===!0},set:function(t){this.event[W.WAS_SUCESSFUL]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loginHint",{set:function(t){this.event[W.LOGIN_HINT]=this.piiEnabled&&t?ve(t):null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"authorityType",{set:function(t){this.event[W.AUTHORITY_TYPE]=t.toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"promptType",{set:function(t){this.event[W.PROMPT]=t.toLowerCase()},enumerable:!1,configurable:!0}),e}(Te),D={HTTP_PATH:f("http_path"),USER_AGENT:f("user_agent"),QUERY_PARAMETERS:f("query_parameters"),API_VERSION:f("api_version"),RESPONSE_CODE:f("response_code"),O_AUTH_ERROR_CODE:f("oauth_error_code"),HTTP_METHOD:f("http_method"),REQUEST_ID_HEADER:f("request_id_header"),SPE_INFO:f("spe_info"),SERVER_ERROR_CODE:f("server_error_code"),SERVER_SUB_ERROR_CODE:f("server_sub_error_code"),URL:f("url")},ot=function(n){B(e,n);function e(t,r){return n.call(this,f("http_event"),t,r)||this}return Object.defineProperty(e.prototype,"url",{set:function(t){var r=Ee(t);this.event[D.URL]=r&&r.toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"httpPath",{set:function(t){this.event[D.HTTP_PATH]=Ee(t).toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userAgent",{set:function(t){this.event[D.USER_AGENT]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"queryParams",{set:function(t){this.event[D.QUERY_PARAMETERS]=Z.generateQueryParametersString(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"apiVersion",{set:function(t){this.event[D.API_VERSION]=t.toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"httpResponseStatus",{set:function(t){this.event[D.RESPONSE_CODE]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"oAuthErrorCode",{set:function(t){this.event[D.O_AUTH_ERROR_CODE]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"httpMethod",{set:function(t){this.event[D.HTTP_METHOD]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"requestIdHeader",{set:function(t){this.event[D.REQUEST_ID_HEADER]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"speInfo",{set:function(t){this.event[D.SPE_INFO]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"serverErrorCode",{set:function(t){this.event[D.SERVER_ERROR_CODE]=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"serverSubErrorCode",{set:function(t){this.event[D.SERVER_SUB_ERROR_CODE]=t},enumerable:!1,configurable:!0}),e}(Te),it=ot,at=function(){function n(e,t,r){this.completedEvents={},this.inProgressEvents={},this.eventCountByCorrelationId={},this.onlySendFailureTelemetry=!1,this.telemetryPlatform=S({sdk:l.libraryName,sdkVersion:de,networkInformation:{connectionSpeed:typeof navigator!="undefined"&&navigator.connection&&navigator.connection.effectiveType}},e.platform),this.clientId=e.clientId,this.onlySendFailureTelemetry=e.onlySendFailureTelemetry,this.telemetryEmitter=t,this.logger=r}return n.getTelemetrymanagerStub=function(e,t){var r="UnSetStub",o="0.0",i=function(){},a={applicationName:r,applicationVersion:o},s={platform:a,clientId:e};return new this(s,i,t)},n.prototype.startEvent=function(e){this.logger.verbose("Telemetry Event started: "+e.key),this.telemetryEmitter&&(e.start(),this.inProgressEvents[e.key]=e)},n.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]=L(t||[],[e]),delete this.inProgressEvents[e.key]}},n.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 o=L(this.completedEvents[e],r);delete this.completedEvents[e];var i=this.eventCountByCorrelationId[e];if(delete this.eventCountByCorrelationId[e],!(!o||!o.length)){var a=new tt(this.telemetryPlatform,e,this.clientId,i),s=L(o,[a]);this.telemetryEmitter(s.map(function(c){return c.get()}))}}},n.prototype.createAndStartApiEvent=function(e,t){var r=new nt(e,this.logger.isPiiLoggingEnabled(),t);return this.startEvent(r),r},n.prototype.stopAndFlushApiEvent=function(e,t,r,o){t.wasSuccessful=r,o&&(t.apiErrorCode=o),this.stopEvent(t),this.flush(e)},n.prototype.createAndStartHttpEvent=function(e,t,r,o){var i=new it(e,o);return i.url=r,i.httpMethod=t,this.startEvent(i),i},n.prototype.incrementEventCount=function(e){var t,r=e.eventName,o=this.eventCountByCorrelationId[e.telemetryCorrelationId];o?o[r]=o[r]?o[r]+1:1:this.eventCountByCorrelationId[e.telemetryCorrelationId]=(t={},t[r]=1,t)},n.prototype.getOrphanedEvents=function(e){var t=this;return Object.keys(this.inProgressEvents).reduce(function(r,o){if(o.indexOf(e)!==-1){var i=t.inProgressEvents[o];return delete t.inProgressEvents[o],L(r,[i])}return r},[])},n}(),ke=at,me=function(){function n(){}return n.filterTokenCacheItemsByScope=function(e,t){return e.filter(function(r){var o=r.key.scopes.split(" "),i=M.removeDefaultScopes(t);return i.length===0?M.containsScope(o,t):M.containsScope(o,i)})},n.filterTokenCacheItemsByAuthority=function(e,t){return e.filter(function(r){return v.CanonicalizeUri(r.key.authority)===t})},n.filterTokenCacheItemsByDomain=function(e,t){return e.filter(function(r){var o=v.GetUrlComponents(r.key.authority).HostNameAndPort;return o===t})},n}(),st="https://login.microsoftonline.com/common",ct=function(){function n(e){this.authResponseCallback=null,this.tokenReceivedCallback=null,this.errorReceivedCallback=null,this.config=Ve(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),le.setTrustedAuthoritiesFromConfig(this.config.auth.validateAuthority,this.config.auth.knownAuthorities),G.saveMetadataFromConfig(this.config.auth.authority,this.config.auth.authorityMetadata),this.authority=this.config.auth.authority||st,this.cacheStorage=new C(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=v.urlContainsHash(t);if(O.checkIfBackButtonIsPressed(this.cacheStorage),r&&this.cacheStorage.isInteractionInProgress(!0)){var o=this.getResponseState(t);o.method===l.interactionTypeRedirect&&this.handleRedirectAuthenticationResponse(t)}}return Object.defineProperty(n.prototype,"authority",{get:function(){return this.authorityInstance.CanonicalAuthority},set:function(e){this.authorityInstance=G.CreateInstance(e,this.config.auth.validateAuthority)},enumerable:!1,configurable:!0}),n.prototype.getAuthorityInstance=function(){return this.authorityInstance},n.prototype.handleRedirectCallback=function(e,t){if(!e)throw N.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)},n.prototype.urlContainsHash=function(e){return this.logger.verbose("UrlContainsHash has been called"),v.urlContainsHash(e)},n.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 T.createInvalidInteractionTypeError()},n.prototype.authErrorHandler=function(e,t,r,o){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"),o(t);else throw T.createInvalidInteractionTypeError()},n.prototype.loginRedirect=function(e){this.logger.verbose("LoginRedirect has been called");var t=j.validateRequest(e,!0,this.clientId,l.interactionTypeRedirect);this.acquireTokenInteractive(l.interactionTypeRedirect,!0,t,null,null)},n.prototype.acquireTokenRedirect=function(e){this.logger.verbose("AcquireTokenRedirect has been called");var t=j.validateRequest(e,!1,this.clientId,l.interactionTypeRedirect);this.acquireTokenInteractive(l.interactionTypeRedirect,!1,t,null,null)},n.prototype.loginPopup=function(e){var t=this;this.logger.verbose("LoginPopup has been called");var r=j.validateRequest(e,!0,this.clientId,l.interactionTypePopup),o=this.telemetryManager.createAndStartApiEvent(r.correlationId,F.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,o,!0),i}).catch(function(i){throw t.cacheStorage.resetTempCacheItems(r.state),t.telemetryManager.stopAndFlushApiEvent(r.correlationId,o,!1,i.errorCode),i})},n.prototype.acquireTokenPopup=function(e){var t=this;this.logger.verbose("AcquireTokenPopup has been called");var r=j.validateRequest(e,!1,this.clientId,l.interactionTypePopup),o=this.telemetryManager.createAndStartApiEvent(r.correlationId,F.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,o,!0),i}).catch(function(i){throw t.cacheStorage.resetTempCacheItems(r.state),t.telemetryManager.stopAndFlushApiEvent(r.correlationId,o,!1,i.errorCode),i})},n.prototype.acquireTokenInteractive=function(e,t,r,o,i){var a=this;this.logger.verbose("AcquireTokenInteractive has been called"),O.blockReloadInHiddenIframes();try{this.cacheStorage.setInteractionInProgress(!0)}catch(y){var s=t?T.createLoginInProgressError():T.createAcquireTokenInProgressError(),c=ue(this.getAccountState(r.state));this.cacheStorage.resetTempCacheItems(r.state),this.authErrorHandler(e,s,c,i);return}e===l.interactionTypeRedirect&&this.cacheStorage.setItem(E.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&&!Z.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 m=this.buildIDTokenRequest(r);this.silentLogin=!0,this.acquireTokenSilent(m).then(function(y){a.silentLogin=!1,a.logger.info("Unified cache call is successful"),a.authResponseHandler(e,y,o)},function(y){a.silentLogin=!1,a.logger.error("Error occurred during unified cache ATS: "+y),a.acquireTokenHelper(null,e,t,r,o,i)})}else this.logger.verbose("Login call but no token found, proceed to login"),this.acquireTokenHelper(null,e,t,r,o,i)}else{this.logger.verbose("AcquireToken call, no context or account given"),this.logger.info("User login is required");var c=ue(this.getAccountState(r.state));this.cacheStorage.resetTempCacheItems(r.state),this.authErrorHandler(e,T.createUserLoginRequiredError(),c,i);return}else this.logger.verbose("User session exists, login not required"),this.acquireTokenHelper(u,e,t,r,o,i)},n.prototype.acquireTokenHelper=function(e,t,r,o,i,a){return J(this,void 0,void 0,function(){var s,c,u,h,m,y,w,k,_,K,x;return Y(this,function(R){switch(R.label){case 0:this.logger.verbose("AcquireTokenHelper has been called"),this.logger.verbose("Interaction type: "+t+". isLoginCall: "+r),s=o.scopes?o.scopes.join(" ").toLowerCase():l.oidcScopes.join(" "),this.logger.verbosePii("Request signature: "+s),u=o&&o.authority?G.CreateInstance(o.authority,this.config.auth.validateAuthority,o.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,G.saveMetadataFromNetwork(u,this.telemetryManager,o.correlationId)]);case 2:return R.sent(),[3,4];case 3:this.logger.verbose("Cached metadata found for authority"),R.label=4;case 4:if(m=r?X.id_token:this.getTokenType(e,o.scopes),y=o.redirectStartPage||window.location.href,c=new Z(u,this.clientId,m,this.getRedirectUri(o&&o.redirectUri),o.scopes,o.state,o.correlationId),this.logger.verbose("Finished building server authentication request"),this.updateCacheEntries(c,e,r,y),this.logger.verbose("Updating cache entries"),c.populateQueryParams(e,o),this.logger.verbose("Query parameters populated from account"),w=v.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(C.generateTemporaryCacheKey(E.STATE_ACQ_TOKEN,o.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"),T.createInvalidInteractionTypeError();if(t!==l.interactionTypePopup)return[3,9];this.logger.verbose("Interaction type is popup. Generating popup window");try{h=this.openPopup(w,"msal",l.popUpWidth,l.popUpHeight),O.trackPopup(h)}catch(H){if(this.logger.info(p.popUpWindowError.code+":"+p.popUpWindowError.desc),this.cacheStorage.setItem(P.ERROR,p.popUpWindowError.code),this.cacheStorage.setItem(P.ERROR_DESC,p.popUpWindowError.desc),a)return a(T.createPopupWindowError()),[2]}if(!h)return[3,8];R.label=5;case 5:return R.trys.push([5,7,,8]),[4,O.monitorPopupForHash(h,this.config.system.loadFrameTimeout,w,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),O.closePopups(),[3,8];case 7:return _=R.sent(),a&&a(_),this.config.framework.isAngular?this.broadcast("msal:popUpClosed",_.errorCode+l.resourceDelimiter+_.errorMessage):(this.cacheStorage.setInteractionInProgress(!1),h.close()),[3,8];case 8:return[3,10];case 9:o.onRedirectNavigate?(this.logger.verbose("Invoking onRedirectNavigate callback"),K=o.onRedirectNavigate(w),K!==!1?(this.logger.verbose("onRedirectNavigate did not return false, navigating"),this.navigateWindow(w)):this.logger.verbose("onRedirectNavigate returned false, stopping navigation")):(this.logger.verbose("Navigating window to urlNavigate"),this.navigateWindow(w)),R.label=10;case 10:return[3,12];case 11:return x=R.sent(),this.logger.error(x),this.cacheStorage.resetTempCacheItems(o.state),this.authErrorHandler(t,T.createEndpointResolutionError(x.toString),ue(o.state),a),h&&h.close(),[3,12];case 12:return[2]}})})},n.prototype.ssoSilent=function(e){if(this.logger.verbose("ssoSilent has been called"),!e)throw N.createEmptyRequestError();if(!e.sid&&!e.loginHint)throw N.createSsoSilentError();return this.acquireTokenSilent(S(S({},e),{scopes:l.oidcScopes}))},n.prototype.acquireTokenSilent=function(e){var t=this;this.logger.verbose("AcquireTokenSilent has been called");var r=j.validateRequest(e,!1,this.clientId,l.interactionTypeSilent),o=this.telemetryManager.createAndStartApiEvent(r.correlationId,F.AcquireTokenSilent),i=j.createRequestSignature(r);return new Promise(function(a,s){return J(t,void 0,void 0,function(){var c,u,h,m,y,w,k,_,K,x,R;return Y(this,function(H){switch(H.label){case 0:if(O.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)&&b.isEmpty(h))return this.logger.info("User login is required"),[2,s(T.createUserLoginRequiredError())];if(m=this.getTokenType(u,r.scopes),this.logger.verbose("Response type: "+m),y=new Z(G.CreateInstance(r.authority,this.config.auth.validateAuthority,r.authorityMetadata),this.clientId,m,this.getRedirectUri(r.redirectUri),r.scopes,r.state,r.correlationId),this.logger.verbose("Finished building server authentication request"),Z.isSSOParam(r)||u?(y.populateQueryParams(u,r,null,!0),this.logger.verbose("Query parameters populated from existing SSO or account")):!u&&!b.isEmpty(h)?(w=he.extractIdToken(h),this.logger.verbose("ADAL's idToken exists. Extracting login information from ADAL's idToken to populate query parameters"),y.populateQueryParams(u,null,w,!0)):this.logger.verbose("No additional query parameters added"),k=r.claimsRequest||y.claimsValue,!k&&!r.forceRefresh)try{K=this.getCachedToken(y,u)}catch(se){_=se}return K?(this.logger.verbose("Token found in cache lookup"),this.logger.verbosePii("Scopes found: "+JSON.stringify(K.scopes)),a(K),[2,null]):[3,1];case 1:return _?(this.logger.infoPii(_.errorCode+":"+_.errorMessage),s(_),[2,null]):[3,2];case 2:x=void 0,k?x="Skipped cache lookup since claims were given":r.forceRefresh?x="Skipped cache lookup since request.forceRefresh option was set to true":x="No valid token found in cache lookup",this.logger.verbose(x),y.authorityInstance||(y.authorityInstance=r.authority?G.CreateInstance(r.authority,this.config.auth.validateAuthority,r.authorityMetadata):this.authorityInstance),this.logger.verbosePii("Authority instance: "+y.authority),H.label=3;case 3:return H.trys.push([3,7,,8]),y.authorityInstance.hasCachedMetadata()?[3,5]:(this.logger.verbose("No cached metadata for authority"),[4,G.saveMetadataFromNetwork(y.authorityInstance,this.telemetryManager,r.correlationId)]);case 4:return H.sent(),this.logger.verbose("Authority has been updated with endpoint discovery response"),[3,6];case 5:this.logger.verbose("Cached metadata found for authority"),H.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&&M.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=H.sent(),this.logger.error(R),s(T.createEndpointResolutionError(R.toString())),[2,null];case 8:return[2]}})})}).then(function(a){return t.logger.verbose("Successfully acquired token"),t.telemetryManager.stopAndFlushApiEvent(r.correlationId,o,!0),a}).catch(function(a){throw t.cacheStorage.resetTempCacheItems(r.state),t.telemetryManager.stopAndFlushApiEvent(r.correlationId,o,!1,a.errorCode),a})},n.prototype.openPopup=function(e,t,r,o){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-o/2+a,m=window.open(e,t,"width="+r+", height="+o+", top="+h+", left="+u+", scrollbars=yes");if(!m)throw T.createPopupWindowError();return m.focus&&m.focus(),m}catch(y){throw this.cacheStorage.setInteractionInProgress(!1),T.createPopupWindowError(y.toString())}},n.prototype.loadIframeTimeout=function(e,t,r){return J(this,void 0,void 0,function(){var o,i,a,s,c;return Y(this,function(u){switch(u.label){case 0:return o=window.activeRenewals[r],this.logger.verbosePii("Set loading state to pending for: "+r+":"+o),this.cacheStorage.setItem(C.generateTemporaryCacheKey(E.RENEW_STATUS,o),l.inProgress),this.config.system.navigateFrameWait?[4,O.loadFrame(e,t,this.config.system.navigateFrameWait,this.logger)]:[3,2];case 1:return a=u.sent(),[3,3];case 2:a=O.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,O.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(C.generateTemporaryCacheKey(E.RENEW_STATUS,o))===l.inProgress&&(this.logger.verbose("Loading frame has timed out after: "+this.config.system.loadFrameTimeout/1e3+" seconds for scope/authority "+r+":"+o),o&&window.callbackMappedToRenewStates[o]&&window.callbackMappedToRenewStates[o](null,c),this.cacheStorage.removeItem(C.generateTemporaryCacheKey(E.RENEW_STATUS,o))),O.removeHiddenIframe(i),c;case 7:return O.removeHiddenIframe(i),[2]}})})},n.prototype.navigateWindow=function(e,t){if(e&&!b.isEmpty(e)){var r=t||window,o=t?"Navigated Popup window to:"+e:"Navigate to:"+e;this.logger.infoPii(o),r.location.assign(e)}else throw this.logger.info("Navigate url is empty"),Q.createUnexpectedError("Navigate url is empty")},n.prototype.registerCallback=function(e,t,r,o){var i=this;window.activeRenewals[t]=e,window.promiseMappedToRenewStates[e]||(window.promiseMappedToRenewStates[e]=[]),window.promiseMappedToRenewStates[e].push({resolve:r,reject:o}),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),Q.createUnexpectedError("Error and response are both null")}catch(u){i.logger.warning(u)}delete window.promiseMappedToRenewStates[e],delete window.callbackMappedToRenewStates[e]})},n.prototype.logout=function(e){this.logger.verbose("Logout has been called"),this.logoutAsync(e)},n.prototype.logoutAsync=function(e){return J(this,void 0,void 0,function(){var t,r,o,i,a,s;return Y(this,function(c){switch(c.label){case 0:t=e||A.createNewGuid(),r=this.telemetryManager.createAndStartApiEvent(t,F.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,G.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 o="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+"?"+o+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?"+o+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]}})})},n.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")},n.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 o=t[r];o.value.accessToken===e&&(this.cacheStorage.removeItem(JSON.stringify(o.key)),this.logger.verbosePii("Access token removed: "+o.key))}},n.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"),v.urlContainsHash(e)},n.prototype.processCallBack=function(e,t,r){this.logger.info("ProcessCallBack has been called. Processing callback from redirect response");var o=t;o||(this.logger.verbose("StateInfo is null, getting stateInfo from hash"),o=this.getResponseState(e));var i,a;try{i=this.saveTokenFromHash(e,o)}catch(c){a=c}try{this.cacheStorage.clearMsalCookie(o.state);var s=this.getAccountState(o.state);if(i){if(o.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 "+d.ACCESS_TOKEN),i.tokenType=d.ACCESS_TOKEN):o.requestType===l.login&&(this.logger.verbose("Response tokenType set to "+d.ID_TOKEN),i.tokenType=d.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=ue(s),this.redirectError=a,this.cacheStorage.resetTempCacheItems(o.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),T.createErrorInCallbackFunction(c.toString())}},n.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 o=window.callbackMappedToRenewStates[r.state];this.processCallBack(t,r,o)},n.prototype.handleRedirectAuthenticationResponse=function(e){this.logger.info("Returned from redirect url"),this.logger.verbose("HandleRedirectAuthenticationResponse has been called"),O.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(C.generateTemporaryCacheKey(E.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 o=v.removeHashFromUrl(window.location.href),i=v.removeHashFromUrl(r);if(o!==i){this.logger.verbose("Current url is not login request url, navigating"),this.logger.verbosePii("CurrentUrl: "+o+", finalRedirectUrl: "+i),window.location.assign(""+i+e);return}else{this.logger.verbose("Current url matches login request url");var a=v.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)},n.prototype.getResponseState=function(e){this.logger.verbose("GetResponseState has been called");var t=v.deserializeHash(e),r;if(!t)throw Q.createUnexpectedError("Hash was not parsed correctly.");if(t.hasOwnProperty(d.STATE)){this.logger.verbose("Hash contains state. Creating stateInfo object");var o=j.parseLibraryState(t.state);r={requestType:l.unknown,state:t.state,timestamp:o.ts,method:o.method,stateMatch:!1}}else throw Q.createUnexpectedError("Hash does not contain state.");if(r.state===this.cacheStorage.getItem(C.generateTemporaryCacheKey(E.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(C.generateTemporaryCacheKey(E.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},n.prototype.getCachedToken=function(e,t){this.logger.verbose("GetCachedToken has been called");var r=e.scopes,o=this.getCachedIdToken(e,t),i=this.getCachedAccessToken(e,t,r),a=this.getAccountState(e.state);return pe.buildAuthResponse(o,i,e,t,r,a)},n.prototype.getTokenCacheItemByAuthority=function(e,t,r,o){var i=this,a;return v.isCommonAuthority(e)||v.isOrganizationsAuthority(e)||v.isConsumersAuthority(e)?a=me.filterTokenCacheItemsByDomain(t,v.GetUrlComponents(e).HostNameAndPort):a=me.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 "+o+" found"),null)},n.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),o=e.authority||this.authority,i=this.getTokenCacheItemByAuthority(o,r,null,d.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 ee(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},n.prototype.getCachedAccessToken=function(e,t,r){this.logger.verbose("Getting all cached tokens of type Access Token");var o=this.cacheStorage.getAllAccessTokens(this.clientId,t?t.homeAccountIdentifier:null),i=me.filterTokenCacheItemsByScope(o,r),a=e.authority||this.authority,s=this.getTokenCacheItemByAuthority(a,i,r,d.ACCESS_TOKEN);if(s){e.authorityInstance=G.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 Q.createUnexpectedError("Account should not be null here.");var h=this.getAccountState(e.state),m={uniqueId:"",tenantId:"",tokenType:d.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 m}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},n.prototype.evaluateTokenExpiration=function(e){var t=Number(e.value.expiresIn);return he.validateExpirationIsWithinOffset(t,this.config.system.tokenRenewalOffsetSeconds)},n.prototype.extractADALIdToken=function(){this.logger.verbose("ExtractADALIdToken has been called");var e=this.cacheStorage.getItem(l.adalIdToken);return b.isEmpty(e)?null:he.extractIdToken(e)},n.prototype.renewToken=function(e,t,r,o,i){this.logger.verbose("RenewToken has been called"),this.logger.verbosePii("RenewToken scope and authority: "+e);var a=O.generateFrameName(we.TOKEN_FRAME,e);O.addHiddenIFrame(a,this.logger),this.updateCacheEntries(i,o,!1),this.logger.verbosePii("RenewToken expected state: "+i.state);var s=v.urlRemoveQueryStringParameter(v.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)})},n.prototype.renewIdToken=function(e,t,r,o,i){this.logger.info("RenewIdToken has been called");var a=O.generateFrameName(we.ID_TOKEN_FRAME,e);O.addHiddenIFrame(a,this.logger),this.updateCacheEntries(i,o,!1),this.logger.verbose("RenewIdToken expected state: "+i.state);var s=v.urlRemoveQueryStringParameter(v.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)})},n.prototype.saveToken=function(e,t,r,o,i){var a=new xe(t,this.clientId,r,o.uid,o.utid),s=new He(e.accessToken,e.idToken.rawIdToken,i.toString(),o.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},n.prototype.saveIdToken=function(e,t,r,o,i){this.logger.verbose("SaveIdToken has been called");var a=S({},e),s;a.scopes=l.oidcScopes,a.accessToken=r[d.ID_TOKEN];var c=Number(i.expiration);return this.logger.verbose("Saving ID token to cache"),this.saveToken(a,t,s,o,c)},n.prototype.saveAccessToken=function(e,t,r,o){this.logger.verbose("SaveAccessToken has been called");var i=S({},e),a=r[d.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 m=h.key.scopes.split(" ");M.isIntersectingScopes(m,s)&&this.cacheStorage.removeItem(JSON.stringify(h.key))}}i.accessToken=r[d.ACCESS_TOKEN],i.scopes=s;var y=ie.parseExpiresIn(r[d.EXPIRES_IN]),w=j.parseLibraryState(r[d.STATE]),k=w.ts+y;return this.logger.verbose("Saving access token to cache"),this.saveToken(i,t,a,o,k)},n.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},o,i=v.deserializeHash(e),a="",s="",c=null;if(i.hasOwnProperty(d.ERROR_DESCRIPTION)||i.hasOwnProperty(d.ERROR)){if(this.logger.verbose("Server returned an error"),this.logger.infoPii("Error : "+i[d.ERROR]+"; Error description: "+i[d.ERROR_DESCRIPTION]),this.cacheStorage.setItem(P.ERROR,i[d.ERROR]),this.cacheStorage.setItem(P.ERROR_DESC,i[d.ERROR_DESCRIPTION]),t.requestType===l.login&&(this.logger.verbose("RequestType is login, caching login error, generating authorityKey"),this.cacheStorage.setItem(P.LOGIN_ERROR,i[d.ERROR_DESCRIPTION]+":"+i[d.ERROR]),a=C.generateAuthorityKey(t.state)),t.requestType===l.renewToken){this.logger.verbose("RequestType is renewToken, generating acquireTokenAccountKey"),a=C.generateAuthorityKey(t.state);var u=this.getAccount(),h=void 0;u&&!b.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=C.generateAcquireTokenAccountKey(h,t.state)}var m=i[d.ERROR],y=i[d.ERROR_DESCRIPTION];ge.isInteractionRequiredError(m)||ge.isInteractionRequiredError(y)?o=new ge(i[d.ERROR],i[d.ERROR_DESCRIPTION]):o=new Oe(i[d.ERROR],i[d.ERROR_DESCRIPTION])}else if(this.logger.verbose("Server returns success"),t.stateMatch){this.logger.info("State is right"),i.hasOwnProperty(d.SESSION_STATE)&&(this.logger.verbose("Fragment has session state, caching"),this.cacheStorage.setItem(C.generateTemporaryCacheKey(E.SESSION_STATE,t.state),i[d.SESSION_STATE])),r.accountState=this.getAccountState(t.state);var w=void 0;if(i.hasOwnProperty(d.ACCESS_TOKEN)){this.logger.info("Fragment has access token"),r.accessToken=i[d.ACCESS_TOKEN],i.hasOwnProperty(d.SCOPE)&&(r.scopes=i[d.SCOPE].split(" ")),i.hasOwnProperty(d.ID_TOKEN)?(this.logger.verbose("Fragment has id_token"),c=new ee(i[d.ID_TOKEN])):(this.logger.verbose("No idToken on fragment, getting idToken from cache"),c=new ee(this.cacheStorage.getItem(q.IDTOKEN))),r=pe.setResponseIdToken(r,c);var k=this.populateAuthority(t.state,this.inCookie,this.cacheStorage,c);this.logger.verbose("Got authority from cache"),i.hasOwnProperty(d.CLIENT_INFO)?(this.logger.verbose("Fragment has clientInfo"),w=new re(i[d.CLIENT_INFO],k)):this.authorityInstance.AuthorityType===te.Adfs?w=re.createClientInfoFromIdToken(c,k):this.logger.warning("ClientInfo not received in the response from AAD"),r.account=ne.createAccount(c,w),this.logger.verbose("Account object created from response");var _=void 0;r.account&&!b.isEmpty(r.account.homeAccountIdentifier)?(this.logger.verbose("AccountKey set"),_=r.account.homeAccountIdentifier):(this.logger.verbose("AccountKey set as no_account"),_=l.no_account),s=C.generateAcquireTokenAccountKey(_,t.state);var K=C.generateAcquireTokenAccountKey(l.no_account,t.state);this.logger.verbose("AcquireTokenAccountKey generated");var x=this.cacheStorage.getItem(s),R=void 0;b.isEmpty(x)?b.isEmpty(this.cacheStorage.getItem(K))||(this.logger.verbose("No acquireToken account retrieved from cache"),r=this.saveAccessToken(r,k,i,w)):(R=JSON.parse(x),this.logger.verbose("AcquireToken request account retrieved from cache"),r.account&&R&&ne.compareAccounts(r.account,R)?(r=this.saveAccessToken(r,k,i,w),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(d.ID_TOKEN)){this.logger.info("Fragment has idToken"),c=new ee(i[d.ID_TOKEN]);var k=this.populateAuthority(t.state,this.inCookie,this.cacheStorage,c);if(r=pe.setResponseIdToken(r,c),i.hasOwnProperty(d.CLIENT_INFO)?(this.logger.verbose("Fragment has clientInfo"),w=new re(i[d.CLIENT_INFO],k)):this.authorityInstance.AuthorityType===te.Adfs?w=re.createClientInfoFromIdToken(c,k):this.logger.warning("ClientInfo not received in the response from AAD"),this.account=ne.createAccount(c,w),r.account=this.account,this.logger.verbose("Account object created from response"),c&&c.nonce){this.logger.verbose("IdToken has nonce");var H=this.cacheStorage.getItem(C.generateTemporaryCacheKey(E.NONCE_IDTOKEN,t.state),this.inCookie);c.nonce!==H?(this.account=null,this.cacheStorage.setItem(P.LOGIN_ERROR,"Nonce Mismatch. Expected Nonce: "+H+",Actual Nonce: "+c.nonce),this.logger.error("Nonce Mismatch. Expected Nonce: "+H+", Actual Nonce: "+c.nonce),o=T.createNonceMismatchError(H,c.nonce)):(this.logger.verbose("Nonce matches, saving idToken to cache"),this.cacheStorage.setItem(q.IDTOKEN,i[d.ID_TOKEN],this.inCookie),this.cacheStorage.setItem(q.CLIENT_INFO,w.encodeClientInfo(),this.inCookie),this.saveIdToken(r,k,i,w,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"),o=T.createInvalidIdTokenError(c),this.cacheStorage.setItem(P.ERROR,o.errorCode),this.cacheStorage.setItem(P.ERROR_DESC,o.errorMessage)}}else{this.logger.verbose("State mismatch"),a=t.state,s=t.state;var se=this.cacheStorage.getItem(C.generateTemporaryCacheKey(E.STATE_LOGIN,t.state),this.inCookie);this.logger.error("State Mismatch. Expected State: "+se+", Actual State: "+t.state),o=T.createInvalidStateError(t.state,se),this.cacheStorage.setItem(P.ERROR,o.errorCode),this.cacheStorage.setItem(P.ERROR_DESC,o.errorMessage)}if(this.cacheStorage.removeItem(C.generateTemporaryCacheKey(E.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)),o)throw o;if(!r)throw Q.createUnexpectedError("Response is null");return r},n.prototype.populateAuthority=function(e,t,r,o){this.logger.verbose("PopulateAuthority has been called");var i=C.generateAuthorityKey(e),a=r.getItem(i,t);return b.isEmpty(a)?a:v.replaceTenantPath(a,o.tenantId)},n.prototype.getAccount=function(){if(this.account)return this.account;var e=this.cacheStorage.getItem(q.IDTOKEN,this.inCookie),t=this.cacheStorage.getItem(q.CLIENT_INFO,this.inCookie);if(!b.isEmpty(e)&&!b.isEmpty(t)){var r=new ee(e),o=new re(t,"");return this.account=ne.createAccount(r,o),this.account}return null},n.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},n.prototype.getAllAccounts=function(){for(var e=[],t=this.cacheStorage.getAllAccessTokens(l.clientId,l.homeAccountIdentifier),r=0;r<t.length;r++){var o=new ee(t[r].value.idToken),i=new re(t[r].value.homeAccountIdentifier,""),a=ne.createAccount(o,i);e.push(a)}return this.getUniqueAccounts(e)},n.prototype.getUniqueAccounts=function(e){if(!e||e.length<=1)return e;for(var t=[],r=[],o=0;o<e.length;++o)e[o].homeAccountIdentifier&&t.indexOf(e[o].homeAccountIdentifier)===-1&&(t.push(e[o].homeAccountIdentifier),r.push(e[o]));return r},n.prototype.broadcast=function(e,t){var r=new CustomEvent(e,{detail:t});window.dispatchEvent(r)},n.prototype.getCachedTokenInternal=function(e,t,r,o){var i=t||this.getAccount();if(!i)return null;var a=this.authorityInstance?this.authorityInstance:G.CreateInstance(this.authority,this.config.auth.validateAuthority),s=this.getTokenType(i,e),c=new Z(a,this.clientId,s,this.getRedirectUri(),e,r,o);return this.getCachedToken(c,t)},n.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,o=Array.from(this.config.framework.protectedResourceMap.keys());r<o.length;r++){var i=o[r];if(e.indexOf(i)>-1)return this.config.framework.protectedResourceMap.get(i)}if(e.indexOf("http://")>-1||e.indexOf("https://")>-1){if(v.getHostFromUri(e)===v.getHostFromUri(this.getRedirectUri()))return new Array(this.clientId)}else return new Array(this.clientId);return null},n.prototype.getLoginInProgress=function(){return this.cacheStorage.isInteractionInProgress(!0)},n.prototype.setInteractionInProgress=function(e){this.cacheStorage.setInteractionInProgress(e)},n.prototype.setloginInProgress=function(e){this.setInteractionInProgress(e)},n.prototype.getAcquireTokenInProgress=function(){return this.cacheStorage.isInteractionInProgress(!0)},n.prototype.setAcquireTokenInProgress=function(e){this.setInteractionInProgress(e)},n.prototype.getLogger=function(){return this.logger},n.prototype.setLogger=function(e){this.logger=e},n.prototype.getRedirectUri=function(e){return e||(typeof this.config.auth.redirectUri=="function"?this.config.auth.redirectUri():this.config.auth.redirectUri)},n.prototype.getPostLogoutRedirectUri=function(){return typeof this.config.auth.postLogoutRedirectUri=="function"?this.config.auth.postLogoutRedirectUri():this.config.auth.postLogoutRedirectUri},n.prototype.getCurrentConfiguration=function(){if(!this.config)throw N.createNoSetConfigurationError();return this.config},n.prototype.getTokenType=function(e,t){var r=ne.compareAccounts(e,this.getAccount());return Z.determineResponseType(r,t)},n.prototype.setAccountCache=function(e,t){var r=e?this.getAccountId(e):l.no_account,o=C.generateAcquireTokenAccountKey(r,t);this.cacheStorage.setItem(o,JSON.stringify(e))},n.prototype.setAuthorityCache=function(e,t){var r=C.generateAuthorityKey(e);this.cacheStorage.setItem(r,v.CanonicalizeUri(t),this.inCookie)},n.prototype.updateCacheEntries=function(e,t,r,o){o&&this.cacheStorage.setItem(C.generateTemporaryCacheKey(E.LOGIN_REQUEST,e.state),o,this.inCookie),r?this.cacheStorage.setItem(C.generateTemporaryCacheKey(E.STATE_LOGIN,e.state),e.state,this.inCookie):this.setAccountCache(t,e.state),this.setAuthorityCache(e.state,e.authority),this.cacheStorage.setItem(C.generateTemporaryCacheKey(E.NONCE_IDTOKEN,e.state),e.nonce,this.inCookie)},n.prototype.getAccountId=function(e){var t;return b.isEmpty(e.homeAccountIdentifier)?t=l.no_account:t=e.homeAccountIdentifier,t},n.prototype.buildIDTokenRequest=function(e){var t={scopes:l.oidcScopes,authority:this.authority,account:this.getAccount(),extraQueryParameters:e.extraQueryParameters,correlationId:e.correlationId};return t},n.prototype.getTelemetryManagerFromConfig=function(e,t){if(!e)return ke.getTelemetrymanagerStub(t,this.logger);var r=e.applicationName,o=e.applicationVersion,i=e.telemetryEmitter;if(!r||!o||!i)throw N.createTelemetryConfigError(e);var a={applicationName:r,applicationVersion:o},s={platform:a,clientId:t};return new ke(s,i,this.logger)},n}();export{ct as U};
