msal
Version:
Microsoft Authentication Library for js
17 lines (15 loc) • 93.7 kB
JavaScript
/*! msal v1.1.3 2019-08-14 */
"use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Msal",[],t):"object"==typeof exports?exports.Msal=t():e.Msal=t()}(window,function(){return n={},o.m=r=[function(e,t,r){
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function i(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}function o(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),s=[];try{for(;(void 0===t||0<t--)&&!(n=i.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function d(e){return this instanceof d?(this.v=e,this):new d(e)}t.__extends=function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},t.__assign=function(){return t.__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},t.__assign.apply(this,arguments)},t.__rest=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r},t.__decorate=function(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;0<=a;a--)(o=e[a])&&(s=(i<3?o(s):3<i?o(t,r,s):o(t,r))||s);return 3<i&&s&&Object.defineProperty(t,r,s),s},t.__param=function(r,n){return function(e,t){n(e,t,r)}},t.__metadata=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},t.__awaiter=function(i,s,a,c){return new(a=a||Promise)(function(e,t){function r(e){try{o(c.next(e))}catch(e){t(e)}}function n(e){try{o(c.throw(e))}catch(e){t(e)}}function o(t){t.done?e(t.value):new a(function(e){e(t.value)}).then(r,n)}o((c=c.apply(i,s||[])).next())})},t.__generator=function(r,n){var o,i,s,e,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,i&&(s=2&t[0]?i.return:t[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,t[1])).done)return s;switch(i=0,s&&(t=[2&t[0],s.value]),t[0]){case 0:case 1:s=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,i=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(s=0<(s=a.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3])){a.label=t[1];break}if(6===t[0]&&a.label<s[1]){a.label=s[1],s=t;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(t);break}s[2]&&a.ops.pop(),a.trys.pop();continue}t=n.call(r,a)}catch(e){t=[6,e],i=0}finally{o=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}},t.__exportStar=function(e,t){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])},t.__values=i,t.__read=o,t.__spread=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(o(arguments[t]));return e},t.__spreadArrays=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var i=arguments[t],s=0,a=i.length;s<a;s++,o++)n[o]=i[s];return n},t.__await=d,t.__asyncGenerator=function(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,i=r.apply(e,t||[]),s=[];return o={},n("next"),n("throw"),n("return"),o[Symbol.asyncIterator]=function(){return this},o;function n(n){i[n]&&(o[n]=function(r){return new Promise(function(e,t){1<s.push([n,r,e,t])||a(n,r)})})}function a(e,t){try{!function(e){e.value instanceof d?Promise.resolve(e.value.v).then(c,u):l(s[0][2],e)}(i[e](t))}catch(e){l(s[0][3],e)}}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}},t.__asyncDelegator=function(n){var e,o;return e={},t("next"),t("throw",function(e){throw e}),t("return"),e[Symbol.iterator]=function(){return this},e;function t(t,r){e[t]=n[t]?function(e){return(o=!o)?{value:d(n[t](e)),done:"return"===t}:r?r(e):e}:r}},t.__asyncValues=function(o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,t=o[Symbol.asyncIterator];return t?t.call(o):(o=i(o),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=o[n]&&function(r){return new Promise(function(e,t){(function(t,e,r,n){Promise.resolve(n).then(function(e){t({value:e,done:r})},e)})(e,t,(r=o[n](r)).done,r.value)})}}},t.__makeTemplateObject=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},t.__importStar=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t},t.__importDefault=function(e){return e&&e.__esModule?e:{default:e}}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=(o.isEmpty=function(e){return void 0===e||!e||0===e.length},o);function o(){}t.StringUtils=n},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=(Object.defineProperty(o,"errorDescription",{get:function(){return"error_description"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"error",{get:function(){return"error"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"scope",{get:function(){return"scope"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"clientInfo",{get:function(){return"client_info"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"clientId",{get:function(){return"clientId"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"idToken",{get:function(){return"id_token"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"adalIdToken",{get:function(){return"adal.idtoken"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"accessToken",{get:function(){return"access_token"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"expiresIn",{get:function(){return"expires_in"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"sessionState",{get:function(){return"session_state"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"claims",{get:function(){return"claims"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"msalClientInfo",{get:function(){return"msal.client.info"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"msalError",{get:function(){return"msal.error"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"msalErrorDescription",{get:function(){return"msal.error.description"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"msalSessionState",{get:function(){return"msal.session.state"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"tokenKeys",{get:function(){return"msal.token.keys"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"accessTokenKey",{get:function(){return"msal.access.token.key"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"expirationKey",{get:function(){return"msal.expiration.key"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"stateLogin",{get:function(){return"msal.state.login"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"stateAcquireToken",{get:function(){return"msal.state.acquireToken"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"stateRenew",{get:function(){return"msal.state.renew"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"nonceIdToken",{get:function(){return"msal.nonce.idtoken"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"userName",{get:function(){return"msal.username"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"idTokenKey",{get:function(){return"msal.idtoken"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"loginRequest",{get:function(){return"msal.login.request"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"loginError",{get:function(){return"msal.login.error"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"renewStatus",{get:function(){return"msal.token.renew.status"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"urlHash",{get:function(){return"msal.urlHash"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"angularLoginRequest",{get:function(){return"msal.angular.login.request"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"msal",{get:function(){return"msal"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"no_account",{get:function(){return"NO_ACCOUNT"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"consumersUtid",{get:function(){return"9188040d-6c67-4c5b-b112-36a304b66dad"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"upn",{get:function(){return"upn"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"prompt_select_account",{get:function(){return"&prompt=select_account"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"prompt_none",{get:function(){return"&prompt=none"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"prompt",{get:function(){return"prompt"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"response_mode_fragment",{get:function(){return"&response_mode=fragment"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"resourceDelimiter",{get:function(){return"|"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"tokenRenewStatusCancelled",{get:function(){return"Canceled"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"tokenRenewStatusCompleted",{get:function(){return"Completed"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"tokenRenewStatusInProgress",{get:function(){return"In Progress"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"popUpWidth",{get:function(){return this._popUpWidth},set:function(e){this._popUpWidth=e},enumerable:!0,configurable:!0}),Object.defineProperty(o,"popUpHeight",{get:function(){return this._popUpHeight},set:function(e){this._popUpHeight=e},enumerable:!0,configurable:!0}),Object.defineProperty(o,"login",{get:function(){return"LOGIN"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"renewToken",{get:function(){return"RENEW_TOKEN"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"unknown",{get:function(){return"UNKNOWN"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"homeAccountIdentifier",{get:function(){return"homeAccountIdentifier"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"common",{get:function(){return"common"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"openidScope",{get:function(){return"openid"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"profileScope",{get:function(){return"profile"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"cacheLocationLocal",{get:function(){return"localStorage"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"cacheLocationSession",{get:function(){return"sessionStorage"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"interactionTypeRedirect",{get:function(){return"redirectInteraction"},enumerable:!0,configurable:!0}),Object.defineProperty(o,"interactionTypePopup",{get:function(){return"popupInteraction"},enumerable:!0,configurable:!0}),o._popUpWidth=483,o._popUpHeight=600,o);function o(){}t.Constants=n,t.CacheKeys={AUTHORITY:"msal.authority",ACQUIRE_TOKEN_ACCOUNT:"msal.acquireTokenAccount"},t.AADTrustedHostList={"login.windows.net":"login.windows.net","login.chinacloudapi.cn":"login.chinacloudapi.cn","login.cloudgovapi.us":"login.cloudgovapi.us","login.microsoftonline.com":"login.microsoftonline.com","login.microsoftonline.de":"login.microsoftonline.de","login.microsoftonline.us":"login.microsoftonline.us"},t.SSOTypes={ACCOUNT:"account",SID:"sid",LOGIN_HINT:"login_hint",ID_TOKEN:"id_token",DOMAIN_HINT:"domain_hint",ORGANIZATIONS:"organizations",CONSUMERS:"consumers",ACCOUNT_ID:"accountIdentifier",HOMEACCOUNT_ID:"homeAccountIdentifier",LOGIN_REQ:"login_req",DOMAIN_REQ:"domain_req"},t.BlacklistedEQParams=[t.SSOTypes.SID,t.SSOTypes.LOGIN_HINT],t.PromptState={LOGIN:"login",SELECT_ACCOUNT:"select_account",CONSENT:"consent",NONE:"none"},t.libraryVersion=function(){return"1.1.3"}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=(a.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,a.decimalToHex(t[0])+a.decimalToHex(t[1])+a.decimalToHex(t[2])+a.decimalToHex(t[3])+"-"+a.decimalToHex(t[4])+a.decimalToHex(t[5])+"-"+a.decimalToHex(t[6])+a.decimalToHex(t[7])+"-"+a.decimalToHex(t[8])+a.decimalToHex(t[9])+"-"+a.decimalToHex(t[10])+a.decimalToHex(t[11])+a.decimalToHex(t[12])+a.decimalToHex(t[13])+a.decimalToHex(t[14])+a.decimalToHex(t[15])}for(var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",n="0123456789abcdef",o=0,i="",s=0;s<36;s++)"-"!==r[s]&&"4"!==r[s]&&(o=16*Math.random()|0),"x"===r[s]?i+=n[o]:"y"===r[s]?(o&=3,i+=n[o|=8]):i+=r[s];return i},a.decimalToHex=function(e){for(var t=e.toString(16);t.length<2;)t="0"+t;return t},a.base64Encode=function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode(Number("0x"+t))}))},a.base64Decode=function(e){return decodeURIComponent(atob(e).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""))},a.deserialize=function(e){function t(e){return decodeURIComponent(e.replace(n," "))}var r,n=/\+/g,o=/([^&=]+)=([^&]*)/g,i={};for(r=o.exec(e);r;)i[t(r[1])]=t(r[2]),r=o.exec(e);return i},a);function a(){}t.CryptoUtils=n},function(e,i,t){Object.defineProperty(i,"__esModule",{value:!0});var r=t(0),n=t(2),o=t(6);i.ClientConfigurationErrorMessage={configurationNotSet:{code:"no_config_set",desc:"Configuration has not been set. Please call the UserAgentApplication constructor with a valid Configuration object."},invalidCacheLocation:{code:"invalid_cache_location",desc:"The cache location provided is not valid."},noStorageSupported:{code:"browser_storage_not_supported",desc:"localStorage and sessionStorage are not supported."},noRedirectCallbacksSet:{code:"no_redirect_callbacks",desc:"No redirect callbacks have been set. Please call setRedirectCallbacks() 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."},clientScope:{code:"clientid_input_scopes_error",desc:"Client ID can only be provided as a single scope."},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."},b2cAuthorityUriInvalidPath:{code:"b2c_authority_uri_invalid_path",desc:"The given URI for the B2C authority is invalid."},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."},telemetryConfigError:{code:"telemetry_config_error",desc:"Telemetry config is not configured with required values"}};var s,a=(s=o.ClientAuthError,r.__extends(c,s),c.createNoSetConfigurationError=function(){return new c(i.ClientConfigurationErrorMessage.configurationNotSet.code,""+i.ClientConfigurationErrorMessage.configurationNotSet.desc)},c.createInvalidCacheLocationConfigError=function(e){return new c(i.ClientConfigurationErrorMessage.invalidCacheLocation.code,i.ClientConfigurationErrorMessage.invalidCacheLocation.desc+" Provided value: "+e+". Possible values are: "+n.Constants.cacheLocationLocal+", "+n.Constants.cacheLocationSession+".")},c.createNoStorageSupportedError=function(){return new c(i.ClientConfigurationErrorMessage.noStorageSupported.code,i.ClientConfigurationErrorMessage.noStorageSupported.desc)},c.createRedirectCallbacksNotSetError=function(){return new c(i.ClientConfigurationErrorMessage.noRedirectCallbacksSet.code,i.ClientConfigurationErrorMessage.noRedirectCallbacksSet.desc)},c.createInvalidCallbackObjectError=function(e){return new c(i.ClientConfigurationErrorMessage.invalidCallbackObject.code,i.ClientConfigurationErrorMessage.invalidCallbackObject.desc+" Given value for callback function: "+e)},c.createEmptyScopesArrayError=function(e){return new c(i.ClientConfigurationErrorMessage.emptyScopes.code,i.ClientConfigurationErrorMessage.emptyScopes.desc+" Given value: "+e+".")},c.createScopesNonArrayError=function(e){return new c(i.ClientConfigurationErrorMessage.nonArrayScopes.code,i.ClientConfigurationErrorMessage.nonArrayScopes.desc+" Given value: "+e+".")},c.createClientIdSingleScopeError=function(e){return new c(i.ClientConfigurationErrorMessage.clientScope.code,i.ClientConfigurationErrorMessage.clientScope.desc+" Given value: "+e+".")},c.createScopesRequiredError=function(e){return new c(i.ClientConfigurationErrorMessage.scopesRequired.code,i.ClientConfigurationErrorMessage.scopesRequired.desc+" Given value: "+e)},c.createInvalidPromptError=function(e){return new c(i.ClientConfigurationErrorMessage.invalidPrompt.code,i.ClientConfigurationErrorMessage.invalidPrompt.desc+" Given value: "+e)},c.createClaimsRequestParsingError=function(e){return new c(i.ClientConfigurationErrorMessage.claimsRequestParsingError.code,i.ClientConfigurationErrorMessage.claimsRequestParsingError.desc+" Given value: "+e)},c.createEmptyRequestError=function(){var e=i.ClientConfigurationErrorMessage.emptyRequestError;return new c(e.code,e.desc)},c.createTelemetryConfigError=function(r){var e=i.ClientConfigurationErrorMessage.telemetryConfigError,t=e.code,n=e.desc,o={applicationName:"string",applicationVersion:"string",telemetryEmitter:"function"};return new c(t,n+" mising values: "+Object.keys(o).reduce(function(e,t){return r[t]?e:e.concat([t+" ("+o[t]+")"])},[]).join(","))},c);function c(e,t){var r=s.call(this,e,t)||this;return r.name="ClientConfigurationError",Object.setPrototypeOf(r,c.prototype),r}i.ClientConfigurationError=a},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var o=r(2),n=r(13),i=r(1),s=(a.createNavigateUrl=function(e){var t=this.createNavigationUrlString(e),r=e.authorityInstance.AuthorizationEndpoint;return r.indexOf("?")<0?r+="?":r+="&",""+r+t.join("&")},a.createNavigationUrlString=function(e){var t=e.scopes;-1===t.indexOf(e.clientId)&&t.push(e.clientId);var r=[];return r.push("response_type="+e.responseType),this.translateclientIdUsedInScope(t,e.clientId),r.push("scope="+encodeURIComponent(n.ScopeSet.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},a.translateclientIdUsedInScope=function(e,t){var r=e.indexOf(t);0<=r&&(e.splice(r,1),-1===e.indexOf("openid")&&e.push("openid"),-1===e.indexOf("profile")&&e.push("profile"))},a.getDefaultRedirectUri=function(){return window.location.href.split("?")[0].split("#")[0]},a.replaceTenantPath=function(e,t){e=e.toLowerCase();var r=this.GetUrlComponents(e),n=r.PathSegments;return!t||0===n.length||n[0]!==o.Constants.common&&n[0]!==o.SSOTypes.ORGANIZATIONS||(n[0]=t),this.constructAuthorityUriFromObject(r,n)},a.constructAuthorityUriFromObject=function(e,t){return this.CanonicalizeUri(e.Protocol+"//"+e.HostNameAndPort+"/"+t.join("/"))},a.GetUrlComponents=function(e){if(!e)throw"Url required";var t=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),r=e.match(t);if(!r||r.length<6)throw"Valid url required";var n={Protocol:r[1],HostNameAndPort:r[4],AbsolutePath:r[5]},o=n.AbsolutePath.split("/");return o=o.filter(function(e){return e&&0<e.length}),n.PathSegments=o,n},a.CanonicalizeUri=function(e){return(e=e&&e.toLowerCase())&&!a.endsWith(e,"/")&&(e+="/"),e},a.endsWith=function(e,t){return!(!e||!t)&&-1!==e.indexOf(t,e.length-t.length)},a.urlRemoveQueryStringParameter=function(e,t){if(i.StringUtils.isEmpty(e))return e;var r=new RegExp("(\\&"+t+"=)[^&]+");return e=e.replace(r,""),r=new RegExp("("+t+"=)[^&]+&"),e=e.replace(r,""),r=new RegExp("("+t+"=)[^&]+"),e=e.replace(r,"")},a.getHashFromUrl=function(e){var t=e.indexOf("#"),r=e.indexOf("#/");return-1<r?e.substring(r+2):-1<t?e.substring(t+1):e},a);function a(){}t.UrlUtils=s},function(e,r,t){Object.defineProperty(r,"__esModule",{value:!0});var n=t(0),o=t(7),i=t(1);r.ClientAuthErrorMessage={multipleMatchingTokens:{code:"multiple_matching_tokens",desc:"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements like authority."},multipleCacheAuthorities:{code:"multiple_authorities",desc:"Multiple authorities found in the cache. Pass authority in the API overload."},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."},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"}};var s,a=(s=o.AuthError,n.__extends(c,s),c.createEndpointResolutionError=function(e){var t=r.ClientAuthErrorMessage.endpointResolutionError.desc;return e&&!i.StringUtils.isEmpty(e)&&(t+=" Details: "+e),new c(r.ClientAuthErrorMessage.endpointResolutionError.code,t)},c.createMultipleMatchingTokensInCacheError=function(e){return new c(r.ClientAuthErrorMessage.multipleMatchingTokens.code,"Cache error for scope "+e+": "+r.ClientAuthErrorMessage.multipleMatchingTokens.desc+".")},c.createMultipleAuthoritiesInCacheError=function(e){return new c(r.ClientAuthErrorMessage.multipleCacheAuthorities.code,"Cache error for scope "+e+": "+r.ClientAuthErrorMessage.multipleCacheAuthorities.desc+".")},c.createPopupWindowError=function(e){var t=r.ClientAuthErrorMessage.popUpWindowError.desc;return e&&!i.StringUtils.isEmpty(e)&&(t+=" Details: "+e),new c(r.ClientAuthErrorMessage.popUpWindowError.code,t)},c.createTokenRenewalTimeoutError=function(){return new c(r.ClientAuthErrorMessage.tokenRenewalError.code,r.ClientAuthErrorMessage.tokenRenewalError.desc)},c.createInvalidIdTokenError=function(e){return new c(r.ClientAuthErrorMessage.invalidIdToken.code,r.ClientAuthErrorMessage.invalidIdToken.desc+" Given token: "+e)},c.createInvalidStateError=function(e,t){return new c(r.ClientAuthErrorMessage.invalidStateError.code,r.ClientAuthErrorMessage.invalidStateError.desc+" "+e+", state expected : "+t+".")},c.createNonceMismatchError=function(e,t){return new c(r.ClientAuthErrorMessage.nonceMismatchError.code,r.ClientAuthErrorMessage.nonceMismatchError.desc+" "+e+", nonce expected : "+t+".")},c.createLoginInProgressError=function(){return new c(r.ClientAuthErrorMessage.loginProgressError.code,r.ClientAuthErrorMessage.loginProgressError.desc)},c.createAcquireTokenInProgressError=function(){return new c(r.ClientAuthErrorMessage.acquireTokenProgressError.code,r.ClientAuthErrorMessage.acquireTokenProgressError.desc)},c.createUserCancelledError=function(){return new c(r.ClientAuthErrorMessage.userCancelledError.code,r.ClientAuthErrorMessage.userCancelledError.desc)},c.createErrorInCallbackFunction=function(e){return new c(r.ClientAuthErrorMessage.callbackError.code,r.ClientAuthErrorMessage.callbackError.desc+" "+e+".")},c.createUserLoginRequiredError=function(){return new c(r.ClientAuthErrorMessage.userLoginRequiredError.code,r.ClientAuthErrorMessage.userLoginRequiredError.desc)},c.createUserDoesNotExistError=function(){return new c(r.ClientAuthErrorMessage.userDoesNotExistError.code,r.ClientAuthErrorMessage.userDoesNotExistError.desc)},c.createClientInfoDecodingError=function(e){return new c(r.ClientAuthErrorMessage.clientInfoDecodingError.code,r.ClientAuthErrorMessage.clientInfoDecodingError.desc+" Failed with error: "+e)},c.createClientInfoNotPopulatedError=function(e){return new c(r.ClientAuthErrorMessage.clientInfoNotPopulatedError.code,r.ClientAuthErrorMessage.clientInfoNotPopulatedError.desc+" Failed with error: "+e)},c.createIdTokenNullOrEmptyError=function(e){return new c(r.ClientAuthErrorMessage.nullOrEmptyIdToken.code,r.ClientAuthErrorMessage.nullOrEmptyIdToken.desc+" Raw ID Token Value: "+e)},c.createIdTokenParsingError=function(e){return new c(r.ClientAuthErrorMessage.idTokenNotParsed.code,r.ClientAuthErrorMessage.idTokenNotParsed.desc+" Failed with error: "+e)},c.createTokenEncodingError=function(e){return new c(r.ClientAuthErrorMessage.tokenEncodingError.code,r.ClientAuthErrorMessage.tokenEncodingError.desc+" Attempted to decode: "+e)},c.createInvalidInteractionTypeError=function(){return new c(r.ClientAuthErrorMessage.invalidInteractionType.code,r.ClientAuthErrorMessage.invalidInteractionType.desc)},c);function c(e,t){var r=s.call(this,e,t)||this;return r.name="ClientAuthError",Object.setPrototypeOf(r,c.prototype),r}r.ClientAuthError=a},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(0);t.AuthErrorMessage={unexpectedError:{code:"unexpected_error",desc:"Unexpected error in authentication."}};var o,i=(o=Error,n.__extends(s,o),s.createUnexpectedError=function(e){return new s(t.AuthErrorMessage.unexpectedError.code,t.AuthErrorMessage.unexpectedError.desc+": "+e)},s);function s(e,t){var r=o.call(this,t)||this;return Object.setPrototypeOf(r,s.prototype),r.errorCode=e,r.errorMessage=t,r.name="AuthError",r}t.AuthError=i},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(4),i=r(18),s=r(5);(n=t.AuthorityType||(t.AuthorityType={}))[n.Aad=0]="Aad",n[n.Adfs=1]="Adfs",n[n.B2C=2]="B2C";var a=(Object.defineProperty(c.prototype,"Tenant",{get:function(){return this.CanonicalAuthorityUrlComponents.PathSegments[0]},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"AuthorizationEndpoint",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.AuthorizationEndpoint.replace("{tenant}",this.Tenant)},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"EndSessionEndpoint",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.EndSessionEndpoint.replace("{tenant}",this.Tenant)},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"SelfSignedJwtAudience",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.Issuer.replace("{tenant}",this.Tenant)},enumerable:!0,configurable:!0}),c.prototype.validateResolved=function(){if(!this.tenantDiscoveryResponse)throw"Please call ResolveEndpointsAsync first"},Object.defineProperty(c.prototype,"CanonicalAuthority",{get:function(){return this.canonicalAuthority},set:function(e){this.canonicalAuthority=s.UrlUtils.CanonicalizeUri(e),this.canonicalAuthorityUrlComponents=null},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"CanonicalAuthorityUrlComponents",{get:function(){return this.canonicalAuthorityUrlComponents||(this.canonicalAuthorityUrlComponents=s.UrlUtils.GetUrlComponents(this.CanonicalAuthority)),this.canonicalAuthorityUrlComponents},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"DefaultOpenIdConfigurationEndpoint",{get:function(){return this.CanonicalAuthority+"v2.0/.well-known/openid-configuration"},enumerable:!0,configurable:!0}),c.prototype.validateAsUri=function(){var e;try{e=this.CanonicalAuthorityUrlComponents}catch(e){throw o.ClientConfigurationErrorMessage.invalidAuthorityType}if(!e.Protocol||"https:"!==e.Protocol.toLowerCase())throw o.ClientConfigurationErrorMessage.authorityUriInsecure;if(!e.PathSegments||e.PathSegments.length<1)throw o.ClientConfigurationErrorMessage.authorityUriInvalidPath},c.prototype.DiscoverEndpoints=function(e){return(new i.XhrClient).sendRequestAsync(e,"GET",!0).then(function(e){return{AuthorizationEndpoint:e.authorization_endpoint,EndSessionEndpoint:e.end_session_endpoint,Issuer:e.issuer}})},c.prototype.resolveEndpointsAsync=function(){var t=this,r="";return this.GetOpenIdConfigurationEndpointAsync().then(function(e){return r=e,t.DiscoverEndpoints(r)}).then(function(e){return t.tenantDiscoveryResponse=e,t})},c);function c(e,t){this.IsValidationEnabled=t,this.CanonicalAuthority=e,this.validateAsUri()}t.Authority=a},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.EVENT_NAME_PREFIX="msal.",t.EVENT_NAME_KEY="event_name",t.START_TIME_KEY="start_time",t.ELAPSED_TIME_KEY="elapsed_time",t.TELEMETRY_BLOB_EVENT_NAMES={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"},t.TENANT_PLACEHOLDER="<tenant>"},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var c,n,i=r(1),s=r(2);(n=c=t.LogLevel||(t.LogLevel={}))[n.Error=0]="Error",n[n.Warning=1]="Warning",n[n.Info=2]="Info",n[n.Verbose=3]="Verbose";var o=(a.prototype.logMessage=function(e,t,r){if(!(e>this.level||!this.piiLoggingEnabled&&r)){var n,o=(new Date).toUTCString();n=i.StringUtils.isEmpty(this.correlationId)?o+":"+s.libraryVersion()+"-"+c[e]+" "+t:o+":"+this.correlationId+"-"+s.libraryVersion()+"-"+c[e]+" "+t,this.executeCallback(e,n,r)}},a.prototype.executeCallback=function(e,t,r){this.localCallback&&this.localCallback(e,t,r)},a.prototype.error=function(e){this.logMessage(c.Error,e,!1)},a.prototype.errorPii=function(e){this.logMessage(c.Error,e,!0)},a.prototype.warning=function(e){this.logMessage(c.Warning,e,!1)},a.prototype.warningPii=function(e){this.logMessage(c.Warning,e,!0)},a.prototype.info=function(e){this.logMessage(c.Info,e,!1)},a.prototype.infoPii=function(e){this.logMessage(c.Info,e,!0)},a.prototype.verbose=function(e){this.logMessage(c.Verbose,e,!1)},a.prototype.verbosePii=function(e){this.logMessage(c.Verbose,e,!0)},a.prototype.isPiiLoggingEnabled=function(){return this.piiLoggingEnabled},a);function a(e,t){void 0===t&&(t={}),this.level=c.Info;var r=t.correlationId,n=void 0===r?"":r,o=t.level,i=void 0===o?c.Info:o,s=t.piiLoggingEnabled,a=void 0!==s&&s;this.localCallback=e,this.correlationId=n,this.level=i,this.piiLoggingEnabled=a}t.Logger=o},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(7);t.ServerErrorMessage={serverUnavailable:{code:"server_unavailable",desc:"Server is temporarily unavailable."},unknownServerError:{code:"unknown_server_error"}};var i,s=(i=o.AuthError,n.__extends(a,i),a.createServerUnavailableError=function(){return new a(t.ServerErrorMessage.serverUnavailable.code,t.ServerErrorMessage.serverUnavailable.desc)},a.createUnknownServerError=function(e){return new a(t.ServerErrorMessage.unknownServerError.code,e)},a);function a(e,t){var r=i.call(this,e,t)||this;return r.name="ServerError",Object.setPrototypeOf(r,a.prototype),r}t.ServerError=s},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});function n(e,t,r){var n=r.value;return r.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.isInIframe()?new Promise(function(){}):n.apply(this,e)},r}var m=r(0),C=r(26),v=r(27),g=r(28),E=r(29),w=r(2),I=r(30),S=r(31),b=r(16),T=r(13),A=r(1),o=r(3),f=r(15),k=r(33),_=r(5),O=r(34),y=r(35),i=r(20),s=r(4),P=r(7),R=r(6),M=r(11),U=r(21),N=r(22),a=r(36),x="id_token",c="token",u="id_token token",l=(Object.defineProperty(d.prototype,"authority",{get:function(){return this.authorityInstance.CanonicalAuthority},set:function(e){this.authorityInstance=y.AuthorityFactory.CreateInstance(e,this.config.auth.validateAuthority)},enumerable:!0,configurable:!0}),d.prototype.getAuthorityInstance=function(){return this.authorityInstance},d.prototype.handleRedirectCallback=function(e,t){if(!e)throw this.redirectCallbacksSet=!1,s.ClientConfigurationError.createInvalidCallbackObjectError(e);if(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.redirectCallbacksSet=!0,!this.config.framework.isAngular){var r=this.cacheStorage.getItem(w.Constants.urlHash);r&&this.processCallBack(r,null)}},d.prototype.authResponseHandler=function(e,t,r){if(e===w.Constants.interactionTypeRedirect)this.errorReceivedCallback?this.tokenReceivedCallback(t):this.authResponseCallback&&this.authResponseCallback(null,t);else{if(e!==w.Constants.interactionTypePopup)throw R.ClientAuthError.createInvalidInteractionTypeError();r(t)}},d.prototype.authErrorHandler=function(e,t,r,n){if(e===w.Constants.interactionTypeRedirect)this.errorReceivedCallback?this.errorReceivedCallback(t,r.accountState):this.authResponseCallback(t,r);else{if(e!==w.Constants.interactionTypePopup)throw R.ClientAuthError.createInvalidInteractionTypeError();n(t)}},d.prototype.loginRedirect=function(e){if(!this.redirectCallbacksSet)throw s.ClientConfigurationError.createRedirectCallbacksNotSetError();this.acquireTokenInteractive(w.Constants.interactionTypeRedirect,!0,e)},d.prototype.acquireTokenRedirect=function(e){if(!e)throw s.ClientConfigurationError.createEmptyRequestError();if(!this.redirectCallbacksSet)throw s.ClientConfigurationError.createRedirectCallbacksNotSetError();this.acquireTokenInteractive(w.Constants.interactionTypeRedirect,!1,e)},d.prototype.loginPopup=function(r){var n=this;return new Promise(function(e,t){n.acquireTokenInteractive(w.Constants.interactionTypePopup,!0,r,e,t)})},d.prototype.acquireTokenPopup=function(r){var n=this;if(!r)throw s.ClientConfigurationError.createEmptyRequestError();return new Promise(function(e,t){n.acquireTokenInteractive(w.Constants.interactionTypePopup,!1,r,e,t)})},d.prototype.acquireTokenInteractive=function(t,r,n,o,i){var s=this;if(this.loginInProgress||this.acquireTokenInProgress){var e=this.loginInProgress?R.ClientAuthError.createLoginInProgressError():R.ClientAuthError.createAcquireTokenInProgressError(),a=N.buildResponseStateOnly(this.getAccountState(n&&n.state));this.authErrorHandler(t,e,a,i)}else{var c=r?this.appendScopes(n):n.scopes;this.validateInputScope(c,!r);var u=n&&n.account&&!r?n.account:this.getAccount();if(u||g.ServerRequestParameters.isSSOParam(n))this.acquireTokenHelper(u,t,r,n,c,o,i);else{if(!r)throw this.logger.info("User login is required"),R.ClientAuthError.createUserLoginRequiredError();if(this.extractADALIdToken()&&!c){this.logger.info("ADAL's idToken exists. Extracting login information from ADAL's idToken ");var l=this.buildIDTokenRequest(n);this.silentLogin=!0,this.acquireTokenSilent(l).then(function(e){s.silentLogin=!1,s.logger.info("Unified cache call is successful"),s.authResponseHandler(t,e,o)},function(e){s.silentLogin=!1,s.logger.error("Error occurred during unified cache ATS: "+e),s.acquireTokenHelper(null,t,r,n,c,o,i)})}else this.acquireTokenHelper(null,t,r,n,c,o,i)}}},d.prototype.acquireTokenHelper=function(n,o,i,s,a,c,u){var l=this;i?this.loginInProgress=!0:this.acquireTokenInProgress=!0;var d,p,h=a?a.join(" ").toLowerCase():this.clientId.toLowerCase(),f=!i&&s&&s.authority?y.AuthorityFactory.CreateInstance(s.authority,this.config.auth.validateAuthority):this.authorityInstance;o===w.Constants.interactionTypePopup&&!(p=this.openWindow("about:blank","_blank",1,this,c,u))||f.resolveEndpointsAsync().then(function(){var e,t=i?x:l.getTokenType(n,a,!1);i&&((e=l.cacheStorage.getItem(w.Constants.angularLoginRequest))&&""!==e?l.cacheStorage.setItem(w.Constants.angularLoginRequest,""):e=window.location.href),d=new g.ServerRequestParameters(f,l.clientId,a,t,l.getRedirectUri(),s&&s.state),l.updateCacheEntries(d,n,e),d.populateQueryParams(n,s);var r=_.UrlUtils.createNavigateUrl(d)+w.Constants.response_mode_fragment;if(o===w.Constants.interactionTypeRedirect)i||l.cacheStorage.setItem(w.Constants.stateAcquireToken,d.state,l.inCookie);else{if(o!==w.Constants.interactionTypePopup)throw R.ClientAuthError.createInvalidInteractionTypeError();window.renewStates.push(d.state),window.requestType=i?w.Constants.login:w.Constants.renewToken,l.registerCallback(d.state,h,c,u)}l.navigateWindow(r,p)}).catch(function(e){l.logger.warning("could not resolve endpoints"),l.authErrorHandler(o,R.ClientAuthError.createEndpointResolutionError(e.toString),N.buildResponseStateOnly(s.state),u),p&&p.close()})},d.prototype.acquireTokenSilent=function(p){var h=this;if(!p)throw s.ClientConfigurationError.createEmptyRequestError();return new Promise(function(e,t){h.validateInputScope(p.scopes,!0);var r=p.scopes.join(" ").toLowerCase(),n=p.account||h.getAccount(),o=h.cacheStorage.getItem(w.Constants.adalIdToken);if(!n&&!p.sid&&!p.loginHint&&A.StringUtils.isEmpty(o))return h.logger.info("User login is required"),t(R.ClientAuthError.createUserLoginRequiredError());var i=h.getTokenType(n,p.scopes,!0),s=new g.ServerRequestParameters(y.AuthorityFactory.CreateInstance(p.authority,h.config.auth.validateAuthority),h.clientId,p.scopes,i,h.getRedirectUri(),p&&p.state);if(g.ServerRequestParameters.isSSOParam(p)||n)s.populateQueryParams(n,p);else if(!n&&!A.StringUtils.isEmpty(o)){var a=f.TokenUtils.extractIdToken(o);h.logger.verbose("ADAL's idToken exists. Extracting login information from ADAL's idToken "),s.populateQueryParams(n,null,a)}var c,u,l=p.claimsRequest||s.claimsValue;if(!l&&!p.forceRefresh)try{u=h.getCachedToken(s,n)}catch(e){c=e}if(u)return h.logger.info("Token is already in cache for scope:"+r),e(u),null;if(c)return h.logger.infoPii(c.errorCode+":"+c.errorMessage),t(c),null;var d=void 0;return d=l?"Skipped cache lookup since claims were given.":p.forceRefresh?"Skipped cache lookup since request.forceRefresh option was set to true":"Token is not in cache for scope:"+r,h.logger.verbose(d),s.authorityInstance||(s.authorityInstance=p.authority?y.AuthorityFactory.CreateInstance(p.authority,h.config.auth.validateAuthority):h.authorityInstance),s.authorityInstance.resolveEndpointsAsync().then(function(){window.activeRenewals[r]?(h.logger.verbose("Renew token for scope: "+r+" is in progress. Registering callback"),h.registerCallback(window.activeRenewals[r],r,e,t)):p.scopes&&-1<p.scopes.indexOf(h.clientId)&&1===p.scopes.length?(h.logger.verbose("renewing idToken"),h.silentLogin=!0,h.renewIdToken(p.scopes,e,t,n,s)):(h.logger.verbose("renewing accesstoken"),h.renewToken(p.scopes,e,t,n,s))}).catch(function(e){return h.logger.warning("could not resolve endpoints"),t(R.ClientAuthError.createEndpointResolutionError(e.toString())),null})})},d.prototype.openWindow=function(e,t,r,n,o,i){var s,a=this;try{s=this.openPopup(e,t,w.Constants.popUpWidth,w.Constants.popUpHeight)}catch(e){return n.loginInProgress=!1,n.acquireTokenInProgress=!1,this.logger.info(R.ClientAuthErrorMessage.popUpWindowError.code+":"+R.ClientAuthErrorMessage.popUpWindowError.desc),this.cacheStorage.setItem(w.Constants.msalError,R.ClientAuthErrorMessage.popUpWindowError.code),this.cacheStorage.setItem(w.Constants.msalErrorDescription,R.ClientAuthErrorMessage.popUpWindowError.desc),i&&i(R.ClientAuthError.createPopupWindowError()),null}window.openedWindows.push(s);var c=window.setInterval(function(){if(s&&s.closed&&(n.loginInProgress||n.acquireTokenInProgress)){if(i&&i(R.ClientAuthError.createUserCancelledError()),window.clearInterval(c),a.config.framework.isAngular)return void a.broadcast("msal:popUpClosed",R.ClientAuthErrorMessage.userCancelledError.code+w.Constants.resourceDelimiter+R.ClientAuthErrorMessage.userCancelledError.desc);n.loginInProgress=!1,n.acquireTokenInProgress=!1}try{var e=s.location;if(-1!==e.href.indexOf(a.getRedirectUri())&&(window.clearInterval(c),n.loginInProgress=!1,n.acquireTokenInProgress=!1,a.logger.info("Closing popup window"),a.config.framework.isAngular)){a.broadcast("msal:popUpHashChanged",e.hash);for(var t=0;t<window.openedWindows.length;t++)window.openedWindows[t].close()}}catch(e){}},r);return s},d.prototype.openPopup=function(e,t,r,n){try{var o=window.screenLeft?window.screenLeft:window.screenX,i=window.screenTop?window.screenTop:window.screenY,s=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,a=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,c=s/2-r/2+o,u=a/2-n/2+i,l=window.open(e,t,"width="+r+", height="+n+", top="+u+", left="+c);if(!l)throw R.ClientAuthError.createPopupWindowError();return l.focus&&l.focus(),l}catch(e){throw this.logger.error("error opening popup "+e.message),this.loginInProgress=!1,this.acquireTokenInProgress=!1,R.ClientAuthError.createPopupWindowError(e.toString())}},d.prototype.isInIframe=function(){return window.parent!==window},d.prototype.parentIsMsal=function(){return window.parent!==window&&window.parent.msal},d.prototype.loadIframeTimeout=function(e,t,r){var n=this,o=window.activeRenewals[r];this.logger.verbose("Set loading state to pending for: "+r+":"+o),this.cacheStorage.setItem(w.Constants.renewStatus+o,w.Constants.tokenRenewStatusInProgress),this.loadFrame(e,t),setTimeout(function(){n.cacheStorage.getItem(w.Constants.renewStatus+o)===w.Constants.tokenRenewStatusInProgress&&(n.logger.verbose("Loading frame has timed out after: "+n.config.system.loadFrameTimeout/1e3+" seconds for scope "+r+":"+o),o&&window.callbackMappedToRenewStates[o]&&window.callbackMappedToRenewStates[o](null,R.ClientAuthError.createTokenRenewalTimeoutError()),n.cacheStorage.setItem(w.Constants.renewStatus+o,w.Constants.tokenRenewStatusCancelled))},this.config.system.loadFrameTimeout)},d.prototype.loadFrame=function(t,r){var n=this;this.logger.info("LoadFrame: "+r);var o=r;setTimeout(function(){var e=n.addHiddenIFrame(o);""!==e.src&&"about:blank"!==e.src||(e.src=t,n.logger.infoPii("Frame Name : "+r+" Navigated to: "+t))},this.config.system.navigateFrameWait)},d.prototype.addHiddenIFrame=function(e){if(void 0===e)return null;this.logger.info("Add msal frame to document:"+e);var t=document.getElementById(e);if(!t){if(document.createElement&&document.documentElement&&-1===window.navigator.userAgent.indexOf("MSIE 5.0")){var r=document.createElement("iframe");r.setAttribute("id",e),r.style.visibility="hidden",r.style.position="absolute",r.style.width=r.style.height="0",r.style.border="0",t=document.getElementsByTagName("body")[0].appendChild(r)}else document.body&&document.body.insertAdjacentHTML&&document.body.insertAdjacentHTML("beforeend","<iframe name='"+e+"' id='"+e+"' style='display:none'></iframe>");window.frames&&window.frames[e]&&(t=window.frames[e])}return t},d.prototype.navigateWindow=function(e,t){if(!e||A.StringUtils.isEmpty(e))throw this.logger.info("Navigate url is empty"),P.AuthError.createUnexpectedError("Navigate url is empty");var r=t||window,n=t?"Navigated Popup window to:"+e:"Navigate to:"+e;this.logger.infoPii(n),r.location.replace(e)},d.prototype.registerCallback=function(n,o,e,t){var i=this;window.activeRenewals[o]=n,window.promiseMappedToRenewStates[n]||(window.promiseMappedToRenewStates[n]=[]),window.promiseMappedToRenewStates[n].push({resolve:e,reject:t}),window.callbackMappedToRenewStates[n]||(window.callbackMappedToRenewStates[n]=function(e,t){window.activeRenewals[o]=null;for(var r=0;r<window.promiseMappedToRenewStates[n].length;++r)try{if(t)window.promiseMappedToRenewStates[n][r].reject(t);else{if(!e)throw P.AuthError.createUnexpectedError("Error and response are both null");window.promiseMappedToRenewStates[n][r].resolve(e)}}catch(e){i.logger.warning(e)}window.promiseMappedToRenewStates[n]=null,window.callbackMappedToRenewStates[n]=null})},d.prototype.logout=function(){var r=this;this.clearCache(),this.account=null;var n="";this.getPostLogoutRedirectUri()&&(n="post_logout_redirect_uri="+encodeURIComponent(this.getPostLogoutRedirectUri())),this.authorityInstance.resolveEndpointsAsync().then(function(e){var t=e.EndSessionEndpoint?e.EndSessionEndpoint+"?"+n:r.authority+"oauth2/v2.0/logout?"+n;r.navigateWindow(t)})},d.prototype.clearCache=function(){window.renewStates=[];for(var e=this.cacheStorage.getAllAccessTokens(w.Constants.clientId,w.Constants.homeAccountIdentifier),t=0;t<e.length;t++)this.cacheStorage.removeItem(JSON.stringify(e[t].key));this.cacheStorage.resetCacheItems(),this.cacheStorage.clearCookie()},d.prototype.clearCacheForScope=function(e){for(var t=this.cacheStorage.getAllAccessTokens(w.Constants.clientId,w.Constants.homeAccountIdentifier),r=0;r<t.length;r++){var n=t[r];n.value.accessToken===e&&this.cacheStorage.removeItem(JSON.stringify(n.key))}},d.prototype.isCallback=function(e){return this.logger.info("isCallback will be deprecated in favor of urlContainsHash in MSAL.js v2.0."),this.urlContainsHash(e)},d.prototype.urlContainsHash=function(e){var t=this.deserializeHash(e);return t.hasOwnProperty(w.Constants.errorDescription)||t.hasOwnProperty(w.Constants.error)||t.hasOwnProperty(w.Constants.accessToken)||t.hasOwnProperty(w.Constants.idToken)},d.prototype.processCallBack=function(e,t,r){var n,o;this.logger.info("Processing the callback from redirect response"),t=t||this.getResponseState(e);try{n=this.saveTokenFromHash(e,t)}catch(e){o=e}t