forked from diegoroman/msal-angularjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmsal.min.js
19 lines (16 loc) · 66.9 KB
/
msal.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*! msal v0.2.1 2018-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()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=10)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){}return e.compareObjects=function(e,t){return!(!e||!t)&&!(!e.userIdentifier||!t.userIdentifier||e.userIdentifier!==t.userIdentifier)},e.expiresIn=function(e){return e||(e="3599"),this.now()+parseInt(e,10)},e.now=function(){return Math.round((new Date).getTime()/1e3)},e.isEmpty=function(e){return void 0===e||!e||0===e.length},e.extractIdToken=function(e){var t=this.decodeJwt(e);if(!t)return null;try{var r=t.JWSPayload,n=this.base64DecodeStringUrlSafe(r);return n?JSON.parse(n):null}catch(e){}return null},e.base64EncodeStringUrlSafe=function(e){return window.btoa?window.btoa(e):this.encode(e)},e.base64DecodeStringUrlSafe=function(e){return e=e.replace(/-/g,"+").replace(/_/g,"/"),window.atob?decodeURIComponent(encodeURIComponent(window.atob(e))):decodeURIComponent(encodeURIComponent(this.decode(e)))},e.encode=function(e){var t,r,n,o,i,s,a,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u="",l=0;for(e=this.utf8Encode(e);l<e.length;)t=e.charCodeAt(l++),r=e.charCodeAt(l++),n=e.charCodeAt(l++),o=t>>2,i=(3&t)<<4|r>>4,s=(15&r)<<2|n>>6,a=63&n,isNaN(r)?s=a=64:isNaN(n)&&(a=64),u=u+c.charAt(o)+c.charAt(i)+c.charAt(s)+c.charAt(a);return u.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},e.utf8Encode=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",r=0;r<e.length;r++){var n=e.charCodeAt(r);n<128?t+=String.fromCharCode(n):n>127&&n<2048?(t+=String.fromCharCode(n>>6|192),t+=String.fromCharCode(63&n|128)):(t+=String.fromCharCode(n>>12|224),t+=String.fromCharCode(n>>6&63|128),t+=String.fromCharCode(63&n|128))}return t},e.decode=function(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e=String(e).replace(/=+$/,"");var r=e.length;if(r%4==1)throw new Error("The token to be decoded is not correctly encoded.");for(var n,o,i,s,a,c,u,l,d="",p=0;p<r;p+=4){if(n=t.indexOf(e.charAt(p)),o=t.indexOf(e.charAt(p+1)),i=t.indexOf(e.charAt(p+2)),s=t.indexOf(e.charAt(p+3)),p+2===r-1){a=n<<18|o<<12|i<<6,c=a>>16&255,u=a>>8&255,d+=String.fromCharCode(c,u);break}if(p+1===r-1){a=n<<18|o<<12,c=a>>16&255,d+=String.fromCharCode(c);break}a=n<<18|o<<12|i<<6|s,c=a>>16&255,u=a>>8&255,l=255&a,d+=String.fromCharCode(c,u,l)}return d},e.decodeJwt=function(e){if(this.isEmpty(e))return null;var t=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/,r=t.exec(e);return!r||r.length<4?null:{header:r[1],JWSPayload:r[2],JWSSig:r[3]}},e.deserialize=function(e){var t,r=/\+/g,n=/([^&=]+)=([^&]*)/g,o=function(e){return decodeURIComponent(e.replace(r," "))},i={};for(t=n.exec(e);t;)i[o(t[1])]=o(t[2]),t=n.exec(e);return i},e.isIntersectingScopes=function(e,t){e=this.convertToLowerCase(e);for(var r=0;r<t.length;r++)if(e.indexOf(t[r].toLowerCase())>-1)return!0;return!1},e.containsScope=function(e,t){return e=this.convertToLowerCase(e),t.every(function(t){return e.indexOf(t.toString().toLowerCase())>=0})},e.convertToLowerCase=function(e){return e.map(function(e){return e.toLowerCase()})},e.removeElement=function(e,t){return e.filter(function(e){return e!==t})},e.decimalToHex=function(e){for(var t=e.toString(16);t.length<2;)t="0"+t;return t},e.getLibraryVersion=function(){return"0.2.1"},e.replaceFirstPath=function(t,r){if(t.match(/^(https?\:)\/\/(([^:\/?#] *)(?:\:([0-9]+))?)([\/]{0,1}[^?#] *)(\?[^#] *|)(#. *|)$/)){var n=e.GetUrlComponents(t),o=n.PathSegments;o.shift(),(o[0]&&"common"===o[0]||"organizations"===o[0])&&(o[0]=r,t=n.Protocol+"//"+n.HostNameAndPort+"/"+o.join("/"))}return t},e.createNewGuid=function(){var t=window.crypto;if(t&&t.getRandomValues){var r=new Uint8Array(16);return t.getRandomValues(r),r[6]|=64,r[6]&=79,r[8]|=128,r[8]&=191,e.decimalToHex(r[0])+e.decimalToHex(r[1])+e.decimalToHex(r[2])+e.decimalToHex(r[3])+"-"+e.decimalToHex(r[4])+e.decimalToHex(r[5])+"-"+e.decimalToHex(r[6])+e.decimalToHex(r[7])+"-"+e.decimalToHex(r[8])+e.decimalToHex(r[9])+"-"+e.decimalToHex(r[10])+e.decimalToHex(r[11])+e.decimalToHex(r[12])+e.decimalToHex(r[13])+e.decimalToHex(r[14])+e.decimalToHex(r[15])}for(var n="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",o="0123456789abcdef",i=0,s="",a=0;a<36;a++)"-"!==n[a]&&"4"!==n[a]&&(i=16*Math.random()|0),"x"===n[a]?s+=o[i]:"y"===n[a]?(i&=3,i|=8,s+=o[i]):s+=n[a];return s},e.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&&e.length>0}),n.PathSegments=o,n},e.CanonicalizeUri=function(t){return t&&(t=t.toLowerCase()),t&&!e.endsWith(t,"/")&&(t+="/"),t},e.endsWith=function(e,t){return!(!e||!t)&&-1!==e.indexOf(t,e.length-t.length)},e}();t.Utils=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(5),i=r(9);!function(e){e[e.Aad=0]="Aad",e[e.Adfs=1]="Adfs",e[e.B2C=2]="B2C"}(t.AuthorityType||(t.AuthorityType={}));var s=function(){function e(e,t){this.IsValidationEnabled=t,this.CanonicalAuthority=e,this.validateAsUri()}return Object.defineProperty(e.prototype,"Tenant",{get:function(){return this.CanonicalAuthorityUrlComponents.PathSegments[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"AuthorizationEndpoint",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.AuthorizationEndpoint.replace("{tenant}",this.Tenant)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"EndSessionEndpoint",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.EndSessionEndpoint.replace("{tenant}",this.Tenant)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"SelfSignedJwtAudience",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.Issuer.replace("{tenant}",this.Tenant)},enumerable:!0,configurable:!0}),e.prototype.validateResolved=function(){if(!this.tenantDiscoveryResponse)throw"Please call ResolveEndpointsAsync first"},Object.defineProperty(e.prototype,"CanonicalAuthority",{get:function(){return this.canonicalAuthority},set:function(e){this.canonicalAuthority=n.Utils.CanonicalizeUri(e),this.canonicalAuthorityUrlComponents=null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CanonicalAuthorityUrlComponents",{get:function(){return this.canonicalAuthorityUrlComponents||(this.canonicalAuthorityUrlComponents=n.Utils.GetUrlComponents(this.CanonicalAuthority)),this.canonicalAuthorityUrlComponents},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"DefaultOpenIdConfigurationEndpoint",{get:function(){return this.CanonicalAuthority+"v2.0/.well-known/openid-configuration"},enumerable:!0,configurable:!0}),e.prototype.validateAsUri=function(){var e;try{e=this.CanonicalAuthorityUrlComponents}catch(e){throw o.ErrorMessage.invalidAuthorityType}if(!e.Protocol||"https:"!==e.Protocol.toLowerCase())throw o.ErrorMessage.authorityUriInsecure;if(!e.PathSegments||e.PathSegments.length<1)throw o.ErrorMessage.authorityUriInvalidPath},e.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}})},e.prototype.ResolveEndpointsAsync=function(){var e=this,t="";return this.GetOpenIdConfigurationEndpointAsync().then(function(r){return t=r,e.DiscoverEndpoints(t)}).then(function(t){return e.tenantDiscoveryResponse=t,e})},e}();t.Authority=s},function(e,t,r){"use strict";function n(e,t){function r(){this.constructor=e}w(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function o(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)for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&(r[n[o]]=e[n[o]]);return r}function i(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;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s}function s(e,t){return function(r,n){t(r,n,e)}}function a(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function c(e,t,r,n){return new(r||(r=Promise))(function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(s,a)}c((n=n.apply(e,t||[])).next())})}function u(e,t){function r(e){return function(t){return n([e,t])}}function n(r){if(o)throw new TypeError("Generator is already executing.");for(;c;)try{if(o=1,i&&(s=i[2&r[0]?"return":r[0]?"throw":"next"])&&!(s=s.call(i,r[1])).done)return s;switch(i=0,s&&(r=[0,s.value]),r[0]){case 0:case 1:s=r;break;case 4:return c.label++,{value:r[1],done:!1};case 5:c.label++,i=r[1],r=[0];continue;case 7:r=c.ops.pop(),c.trys.pop();continue;default:if(s=c.trys,!(s=s.length>0&&s[s.length-1])&&(6===r[0]||2===r[0])){c=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]<s[3])){c.label=r[1];break}if(6===r[0]&&c.label<s[1]){c.label=s[1],s=r;break}if(s&&c.label<s[2]){c.label=s[2],c.ops.push(r);break}s[2]&&c.ops.pop(),c.trys.pop();continue}r=t.call(e,c)}catch(e){r=[6,e],i=0}finally{o=s=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}var o,i,s,a,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:r(0),throw:r(1),return:r(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a}function l(e,t){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}function d(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 p(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||t-- >0)&&!(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 h(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(p(arguments[t]));return e}function f(e){return this instanceof f?(this.v=e,this):new f(e)}function g(e,t,r){function n(e){l[e]&&(u[e]=function(t){return new Promise(function(r,n){d.push([e,t,r,n])>1||o(e,t)})})}function o(e,t){try{i(l[e](t))}catch(e){c(d[0][3],e)}}function i(e){e.value instanceof f?Promise.resolve(e.value.v).then(s,a):c(d[0][2],e)}function s(e){o("next",e)}function a(e){o("throw",e)}function c(e,t){e(t),d.shift(),d.length&&o(d[0][0],d[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var u,l=r.apply(e,t||[]),d=[];return u={},n("next"),n("throw"),n("return"),u[Symbol.asyncIterator]=function(){return this},u}function m(e){function t(t,o){e[t]&&(r[t]=function(r){return(n=!n)?{value:f(e[t](r)),done:"return"===t}:o?o(r):r})}var r,n;return r={},t("next"),t("throw",function(e){throw e}),t("return"),r[Symbol.iterator]=function(){return this},r}function y(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator];return t?t.call(e):"function"==typeof d?d(e):e[Symbol.iterator]()}Object.defineProperty(t,"__esModule",{value:!0}),t.__extends=n,r.d(t,"__assign",function(){return _}),t.__rest=o,t.__decorate=i,t.__param=s,t.__metadata=a,t.__awaiter=c,t.__generator=u,t.__exportStar=l,t.__values=d,t.__read=p,t.__spread=h,t.__await=f,t.__asyncGenerator=g,t.__asyncDelegator=m,t.__asyncValues=y;/*! *****************************************************************************
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.
***************************************************************************** */
var w=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])},_=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){}return Object.defineProperty(e,"errorDescription",{get:function(){return"error_description"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"error",{get:function(){return"error"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"scope",{get:function(){return"scope"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"acquireTokenUser",{get:function(){return"msal.acquireTokenUser"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"clientInfo",{get:function(){return"client_info"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"clientId",{get:function(){return"clientId"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"authority",{get:function(){return"msal.authority"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"idToken",{get:function(){return"id_token"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"accessToken",{get:function(){return"access_token"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"expiresIn",{get:function(){return"expires_in"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"sessionState",{get:function(){return"session_state"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"msalClientInfo",{get:function(){return"msal.client.info"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"msalError",{get:function(){return"msal.error"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"msalErrorDescription",{get:function(){return"msal.error.description"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"msalSessionState",{get:function(){return"msal.session.state"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"tokenKeys",{get:function(){return"msal.token.keys"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"accessTokenKey",{get:function(){return"msal.access.token.key"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"expirationKey",{get:function(){return"msal.expiration.key"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"stateLogin",{get:function(){return"msal.state.login"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"stateAcquireToken",{get:function(){return"msal.state.acquireToken"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"stateRenew",{get:function(){return"msal.state.renew"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"nonceIdToken",{get:function(){return"msal.nonce.idtoken"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"userName",{get:function(){return"msal.username"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"idTokenKey",{get:function(){return"msal.idtoken"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"loginRequest",{get:function(){return"msal.login.request"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"loginError",{get:function(){return"msal.login.error"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"renewStatus",{get:function(){return"msal.token.renew.status"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"msal",{get:function(){return"msal"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"resourceDelimeter",{get:function(){return"|"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"tokenRenewStatusCancelled",{get:function(){return"Canceled"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"tokenRenewStatusCompleted",{get:function(){return"Completed"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"tokenRenewStatusInProgress",{get:function(){return"In Progress"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"popUpWidth",{get:function(){return this._popUpWidth},set:function(e){this._popUpWidth=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"popUpHeight",{get:function(){return this._popUpHeight},set:function(e){this._popUpHeight=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"login",{get:function(){return"LOGIN"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"renewToken",{get:function(){return"RENEW_TOKEN"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"unknown",{get:function(){return"UNKNOWN"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"urlHash",{get:function(){return"msal.urlHash"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"angularLoginRequest",{get:function(){return"msal.angular.login.request"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"userIdentifier",{get:function(){return"userIdentifier"},enumerable:!0,configurable:!0}),e._popUpWidth=483,e._popUpHeight=600,e}();t.Constants=n;var o=function(){function e(){}return Object.defineProperty(e,"loginProgressError",{get:function(){return"login_progress_error"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"acquireTokenProgressError",{get:function(){return"acquiretoken_progress_error"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"inputScopesError",{get:function(){return"input_scopes_error"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"endpointResolutionError",{get:function(){return"endpoints_resolution_error"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"popUpWindowError",{get:function(){return"popup_window_error"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"userLoginError",{get:function(){return"user_login_error"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"userCancelledError",{get:function(){return"user_cancelled"},enumerable:!0,configurable:!0}),e}();t.ErrorCodes=o;var i=function(){function e(){}return Object.defineProperty(e,"loginProgressError",{get:function(){return"Login is in progress"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"acquireTokenProgressError",{get:function(){return"Acquire token is in progress"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"inputScopesError",{get:function(){return"Invalid value of input scopes provided"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"endpointResolutionError",{get:function(){return"Endpoints cannot be resolved"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"popUpWindowError",{get:function(){return"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser."},enumerable:!0,configurable:!0}),Object.defineProperty(e,"userLoginError",{get:function(){return"User login is required"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"userCancelledError",{get:function(){return"User closed the popup window and cancelled the flow"},enumerable:!0,configurable:!0}),e}();t.ErrorDescription=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(0);!function(e){e[e.Error=0]="Error",e[e.Warning=1]="Warning",e[e.Info=2]="Info",e[e.Verbose=3]="Verbose"}(n=t.LogLevel||(t.LogLevel={}));var i=function(){function e(e,t){void 0===t&&(t={}),this._level=n.Info;var r=t.correlationId,o=void 0===r?"":r,i=t.level,s=void 0===i?n.Info:i,a=t.piiLoggingEnabled,c=void 0!==a&&a;this._localCallback=e,this._correlationId=o,this._level=s,this._piiLoggingEnabled=c}return e.prototype.logMessage=function(e,t,r){if(!(e>this._level||!this._piiLoggingEnabled&&r)){var i,s=(new Date).toUTCString();i=o.Utils.isEmpty(this._correlationId)?s+":"+o.Utils.getLibraryVersion()+"-"+n[e]+" "+t:s+":"+this._correlationId+"-"+o.Utils.getLibraryVersion()+"-"+n[e]+" "+t,this.executeCallback(e,i,r)}},e.prototype.executeCallback=function(e,t,r){this._localCallback&&this._localCallback(e,t,r)},e.prototype.error=function(e){this.logMessage(n.Error,e,!1)},e.prototype.errorPii=function(e){this.logMessage(n.Error,e,!0)},e.prototype.warning=function(e){this.logMessage(n.Warning,e,!1)},e.prototype.warningPii=function(e){this.logMessage(n.Warning,e,!0)},e.prototype.info=function(e){this.logMessage(n.Info,e,!1)},e.prototype.infoPii=function(e){this.logMessage(n.Info,e,!0)},e.prototype.verbose=function(e){this.logMessage(n.Verbose,e,!1)},e.prototype.verbosePii=function(e){this.logMessage(n.Verbose,e,!0)},e}();t.Logger=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){}return Object.defineProperty(e,"authorityUriInvalidPath",{get:function(){return"AuthorityUriInvalidPath"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"authorityUriInsecure",{get:function(){return"AuthorityUriInsecure"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"invalidAuthorityType",{get:function(){return"InvalidAuthorityType"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"unsupportedAuthorityValidation",{get:function(){return"UnsupportedAuthorityValidation"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"b2cAuthorityUriInvalidPath",{get:function(){return"B2cAuthorityUriInvalidPath"},enumerable:!0,configurable:!0}),e}();t.ErrorMessage=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){this.valid=!1,this.parameters={},this.stateMatch=!1,this.stateResponse="",this.requestType="unknown"}return e}();t.TokenResponse=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=function(){function e(e,t,r,n,o){this.displayableId=e,this.name=t,this.identityProvider=r,this.userIdentifier=n,this.idToken=o}return e.createUser=function(t,r,o){var i,s;r?(i=r.uid,s=r.utid):(i="",s="");var a=n.Utils.base64EncodeStringUrlSafe(i)+"."+n.Utils.base64EncodeStringUrlSafe(s);return new e(t.preferredName,t.name,t.issuer,a,t.decodedIdToken)},e}();t.User=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2),o=r(1),i=r(9),s=function(e){function t(t,r){return e.call(this,t,r)||this}return n.__extends(t,e),Object.defineProperty(t.prototype,"AadInstanceDiscoveryEndpointUrl",{get:function(){return t.AadInstanceDiscoveryEndpoint+"?api-version=1.0&authorization_endpoint="+this.CanonicalAuthority+"oauth2/v2.0/authorize"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"AuthorityType",{get:function(){return o.AuthorityType.Aad},enumerable:!0,configurable:!0}),t.prototype.GetOpenIdConfigurationEndpointAsync=function(){var e=this,t=new Promise(function(t,r){return t(e.DefaultOpenIdConfigurationEndpoint)});if(!this.IsValidationEnabled)return t;var r=this.CanonicalAuthorityUrlComponents.HostNameAndPort;return this.IsInTrustedHostList(r)?t:(new i.XhrClient).sendRequestAsync(this.AadInstanceDiscoveryEndpointUrl,"GET",!0).then(function(e){return e.tenant_discovery_endpoint})},t.prototype.IsInTrustedHostList=function(e){return t.TrustedHostList[e.toLowerCase()]},t.AadInstanceDiscoveryEndpoint="https://login.microsoftonline.com/common/discovery/instance",t.TrustedHostList={"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}(o.Authority);t.AadAuthority=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){}return e.prototype.sendRequestAsync=function(e,t,r){var n=this;return new Promise(function(r,o){var i=new XMLHttpRequest;if(i.open(t,e,!0),i.onload=function(e){(i.status<200||i.status>=300)&&o(n.handleError(i.responseText));try{var t=JSON.parse(i.responseText)}catch(e){o(n.handleError(i.responseText))}r(t)},i.onerror=function(e){o(i.status)},"GET"!==t)throw"not implemented";i.send()})},e.prototype.handleError=function(e){var t;try{if(t=JSON.parse(e),t.error)return t.error;throw e}catch(t){return e}},e}();t.XhrClient=n},function(e,t,r){e.exports=r(11)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(12);t.UserAgentApplication=n.UserAgentApplication;var o=r(4);t.Logger=o.Logger;var i=r(4);t.LogLevel=i.LogLevel;var s=r(7);t.User=s.User;var a=r(3);t.Constants=a.Constants;var c=r(6);t.TokenResponse=c.TokenResponse;var u=r(1);t.Authority=u.Authority},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2),o=r(13),i=r(14),s=r(15),a=r(16),c=r(3),u=r(17),l=r(4),d=r(18),p=r(6),h=r(7),f=r(0),g=r(20),m={id_token:"id_token",token:"token",id_token_token:"id_token token"},y=function(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},w=function(){function e(e,t,r,n){void 0===n&&(n={}),this._cacheLocations={localStorage:"localStorage",sessionStorage:"sessionStorage"},this._clockSkew=300,this._tokenReceivedCallback=null,this._isAngular=!1;var o=n.validateAuthority,i=void 0===o||o,s=n.cacheLocation,a=void 0===s?"sessionStorage":s,u=n.redirectUri,p=void 0===u?window.location.href.split("?")[0].split("#")[0]:u,h=n.postLogoutRedirectUri,f=void 0===h?window.location.href.split("?")[0].split("#")[0]:h,g=n.logger,m=void 0===g?new l.Logger(null):g,y=n.loadFrameTimeout,w=void 0===y?6e3:y,_=n.navigateToLoginRequestUrl,v=void 0===_||_,b=n.state,I=void 0===b?"":b,C=n.isAngular,k=void 0!==C&&C,S=n.unprotectedResources,T=void 0===S?new Array:S,P=n.protectedResourceMap,E=void 0===P?new Map:P;if(this.loadFrameTimeout=w,this.clientId=e,this.validateAuthority=i,this.authority=t||"https://login.microsoftonline.com/common",this._tokenReceivedCallback=r,this._redirectUri=p,this._postLogoutredirectUri=f,this._loginInProgress=!1,this._acquireTokenInProgress=!1,this._cacheLocation=a,this._navigateToLoginRequestUrl=v,this._state=I,this._isAngular=k,this._unprotectedResources=T,this._protectedResourceMap=E,!this._cacheLocations[a])throw new Error("Cache Location is not valid. Provided value:"+this._cacheLocation+".Possible values are: "+this._cacheLocations.localStorage+", "+this._cacheLocations.sessionStorage);this._cacheStorage=new d.Storage(this._cacheLocation),this._logger=m,window.openedWindows=[],window.activeRenewals={},window.renewStates=[],window.callBackMappedToRenewStates={},window.callBacksMappedToRenewStates={},window.msal=this;var U=window.location.hash,O=this.isCallback(U);if(!this._isAngular)if(O)this.handleAuthenticationResponse.call(this,U);else{var A=this._cacheStorage.getItem(c.Constants.urlHash);A&&this.processCallBack(A)}}return Object.defineProperty(e.prototype,"cacheLocation",{get:function(){return this._cacheLocation},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"authority",{get:function(){return this.authorityInstance.CanonicalAuthority},set:function(e){this.authorityInstance=g.AuthorityFactory.CreateInstance(e,this.validateAuthority)},enumerable:!0,configurable:!0}),e.prototype.processCallBack=function(e){this._logger.info("Processing the callback from redirect response");var t=this.getRequestInfo(e);this.saveTokenFromHash(t);var r,n=t.parameters[c.Constants.accessToken]||t.parameters[c.Constants.idToken],o=t.parameters[c.Constants.errorDescription],i=t.parameters[c.Constants.error];r=t.parameters[c.Constants.accessToken]?c.Constants.accessToken:c.Constants.idToken,this._cacheStorage.removeItem(c.Constants.urlHash);try{this._tokenReceivedCallback&&this._tokenReceivedCallback.call(this,o,n,i,r,this.getUserState(this._cacheStorage.getItem(c.Constants.stateLogin)))}catch(e){this._logger.error("Error occurred in token received callback function: "+e)}},e.prototype.loginRedirect=function(e,t){var r=this;if(this._loginInProgress&&this._tokenReceivedCallback)return void this._tokenReceivedCallback(c.ErrorDescription.loginProgressError,null,c.ErrorCodes.loginProgressError,c.Constants.idToken,this.getUserState(this._cacheStorage.getItem(c.Constants.stateLogin)));if(e){var n=this.validateInputScope(e);if(n&&!f.Utils.isEmpty(n)&&this._tokenReceivedCallback)return void this._tokenReceivedCallback(c.ErrorDescription.inputScopesError,null,c.ErrorCodes.inputScopesError,c.Constants.idToken,this.getUserState(this._cacheStorage.getItem(c.Constants.stateLogin)));e=this.filterScopes(e)}this._loginInProgress=!0,this.authorityInstance.ResolveEndpointsAsync().then(function(){var n=new s.AuthenticationRequestParameters(r.authorityInstance,r.clientId,e,m.id_token,r._redirectUri,r._state);t&&(n.extraQueryParameters=t);var o=r._cacheStorage.getItem(c.Constants.angularLoginRequest);o&&""!==o?r._cacheStorage.setItem(c.Constants.angularLoginRequest,""):o=window.location.href,r._cacheStorage.setItem(c.Constants.loginRequest,o),r._cacheStorage.setItem(c.Constants.loginError,""),r._cacheStorage.setItem(c.Constants.stateLogin,n.state),r._cacheStorage.setItem(c.Constants.nonceIdToken,n.nonce),r._cacheStorage.setItem(c.Constants.msalError,""),r._cacheStorage.setItem(c.Constants.msalErrorDescription,"");var i=c.Constants.authority+c.Constants.resourceDelimeter+n.state;f.Utils.isEmpty(r._cacheStorage.getItem(i))&&r._cacheStorage.setItem(i,r.authority);var a=n.createNavigateUrl(e)+"&prompt=select_account&response_mode=fragment";r.promptUser(a)})},e.prototype.loginPopup=function(e,t){var r=this;return new Promise(function(n,o){if(r._loginInProgress)return void o(c.ErrorCodes.loginProgressError+"|"+c.ErrorDescription.loginProgressError);if(e){var i=r.validateInputScope(e);if(i&&!f.Utils.isEmpty(i))return void o(c.ErrorCodes.inputScopesError+"|"+c.ErrorDescription.inputScopesError);e=r.filterScopes(e)}else e=[r.clientId];var a=e.join(" ").toLowerCase(),u=r.openWindow("about:blank","_blank",1,r,n,o);u&&(r._loginInProgress=!0,r.authorityInstance.ResolveEndpointsAsync().then(function(){var i=new s.AuthenticationRequestParameters(r.authorityInstance,r.clientId,e,m.id_token,r._redirectUri,r._state);t&&(i.extraQueryParameters=t),r._cacheStorage.setItem(c.Constants.loginRequest,window.location.href),r._cacheStorage.setItem(c.Constants.loginError,""),r._cacheStorage.setItem(c.Constants.nonceIdToken,i.nonce),r._cacheStorage.setItem(c.Constants.msalError,""),r._cacheStorage.setItem(c.Constants.msalErrorDescription,"");var l=c.Constants.authority+c.Constants.resourceDelimeter+i.state;f.Utils.isEmpty(r._cacheStorage.getItem(l))&&r._cacheStorage.setItem(l,r.authority);var d=i.createNavigateUrl(e)+"&prompt=select_account&response_mode=fragment";window.renewStates.push(i.state),window.requestType=c.Constants.login,r.registerCallback(i.state,a,n,o),u&&(r._logger.infoPii("Navigated Popup window to:"+d),u.location.href=d)},function(){r._logger.info(c.ErrorCodes.endpointResolutionError+":"+c.ErrorDescription.endpointResolutionError),r._cacheStorage.setItem(c.Constants.msalError,c.ErrorCodes.endpointResolutionError),r._cacheStorage.setItem(c.Constants.msalErrorDescription,c.ErrorDescription.endpointResolutionError),o&&o(c.ErrorCodes.endpointResolutionError+":"+c.ErrorDescription.endpointResolutionError),u&&u.close()}).catch(function(e){r._logger.warning("could not resolve endpoints"),o(e)}))})},e.prototype.promptUser=function(e){e&&!f.Utils.isEmpty(e)?(this._logger.infoPii("Navigate to:"+e),window.location.replace(e)):this._logger.info("Navigate url is empty")},e.prototype.openWindow=function(e,t,r,n,o,i){var s=this,a=this.openPopup(e,t,c.Constants.popUpWidth,c.Constants.popUpHeight);if(null==a)return n._loginInProgress=!1,n._acquireTokenInProgress=!1,this._logger.info(c.ErrorCodes.popUpWindowError+":"+c.ErrorDescription.popUpWindowError),this._cacheStorage.setItem(c.Constants.msalError,c.ErrorCodes.popUpWindowError),this._cacheStorage.setItem(c.Constants.msalErrorDescription,c.ErrorDescription.popUpWindowError),i&&i(c.ErrorCodes.popUpWindowError+"|"+c.ErrorDescription.popUpWindowError),null;window.openedWindows.push(a);var u=window.setInterval(function(){if(a&&a.closed&&n._loginInProgress){if(i&&i(c.ErrorCodes.userCancelledError+"|"+c.ErrorDescription.userCancelledError),window.clearInterval(u),s._isAngular)return void s.broadcast("msal:popUpClosed",c.ErrorCodes.userCancelledError+"|"+c.ErrorDescription.userCancelledError);n._loginInProgress=!1,n._acquireTokenInProgress=!1}try{var e=a.location;if(-1!==e.href.indexOf(s._redirectUri)&&(window.clearInterval(u),n._loginInProgress=!1,n._acquireTokenInProgress=!1,s._logger.info("Closing popup window"),s._isAngular)){s.broadcast("msal:popUpHashChanged",e.hash);for(var t=0;t<window.openedWindows.length;t++)window.openedWindows[t].close()}}catch(e){}},r);return a},e.prototype.broadcast=function(e,t){var r=new CustomEvent(e,{detail:t});window.dispatchEvent(r)},e.prototype.logout=function(){this.clearCache(),this._user=null;var e="";this._postLogoutredirectUri&&(e="post_logout_redirect_uri="+encodeURIComponent(this._postLogoutredirectUri));var t=this.authority+"/oauth2/v2.0/logout?"+e;this.promptUser(t)},e.prototype.clearCache=function(){window.renewStates=[];for(var e=this._cacheStorage.getAllAccessTokens(c.Constants.clientId,c.Constants.userIdentifier),t=0;t<e.length;t++)this._cacheStorage.removeItem(JSON.stringify(e[t].key));this._cacheStorage.resetCacheItems()},e.prototype.clearCacheForScope=function(e){for(var t=this._cacheStorage.getAllAccessTokens(c.Constants.clientId,c.Constants.userIdentifier),r=0;r<t.length;r++){var n=t[r];n.value.accessToken==e&&this._cacheStorage.removeItem(JSON.stringify(n.key))}},e.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);return l.focus&&l.focus(),l}catch(e){return this._logger.error("error opening popup "+e.message),this._loginInProgress=!1,this._acquireTokenInProgress=!1,null}},e.prototype.validateInputScope=function(e){if(!e||e.length<1)return"Scopes cannot be passed as an empty array";if(!Array.isArray(e))throw new Error("API does not accept non-array scopes");return e.indexOf(this.clientId)>-1&&e.length>1?"ClientId can only be provided as a single scope":""},e.prototype.filterScopes=function(e){return e=e.filter(function(e){return"openid"!==e}),e=e.filter(function(e){return"profile"!==e})},e.prototype.registerCallback=function(e,t,r,n){var o=this;window.activeRenewals[t]=e,window.callBacksMappedToRenewStates[e]||(window.callBacksMappedToRenewStates[e]=[]),window.callBacksMappedToRenewStates[e].push({resolve:r,reject:n}),window.callBackMappedToRenewStates[e]||(window.callBackMappedToRenewStates[e]=function(r,n,i,s){window.activeRenewals[t]=null;for(var a=0;a<window.callBacksMappedToRenewStates[e].length;++a)try{r||i?window.callBacksMappedToRenewStates[e][a].reject(r+"|"+i):n&&window.callBacksMappedToRenewStates[e][a].resolve(n)}catch(e){o._logger.warning(e)}window.callBacksMappedToRenewStates[e]=null,window.callBackMappedToRenewStates[e]=null})},e.prototype.getCachedTokenInternal=function(e,t){var r=t||this.getUser();if(r){var n,o=this.authorityInstance?this.authorityInstance:g.AuthorityFactory.CreateInstance(this.authority,this.validateAuthority);return n=f.Utils.compareObjects(r,this.getUser())?e.indexOf(this.clientId)>-1?new s.AuthenticationRequestParameters(o,this.clientId,e,m.id_token,this._redirectUri,this._state):new s.AuthenticationRequestParameters(o,this.clientId,e,m.token,this._redirectUri,this._state):new s.AuthenticationRequestParameters(o,this.clientId,e,m.id_token_token,this._redirectUri,this._state),this.getCachedToken(n,t)}},e.prototype.getCachedToken=function(e,t){var r=null,n=e.scopes,o=this._cacheStorage.getAllAccessTokens(this.clientId,t?t.userIdentifier:null);if(0===o.length)return null;var i=[];if(e.authority){for(var s=0;s<o.length;s++){var a=o[s],c=a.key.scopes.split(" ");f.Utils.containsScope(c,n)&&a.key.authority===e.authority&&i.push(a)}if(0===i.length)return null;if(1!==i.length)return{errorDesc:"The cache contains multiple tokens satisfying the requirements.Call AcquireToken again providing more requirements like authority",token:null,error:"multiple_matching_tokens_detected"};r=i[0]}else{for(var s=0;s<o.length;s++){var a=o[s],c=a.key.scopes.split(" ");f.Utils.containsScope(c,n)&&i.push(a)}if(1===i.length)r=i[0],e.authorityInstance=g.AuthorityFactory.CreateInstance(r.key.authority,this.validateAuthority);else{if(i.length>1)return{errorDesc:"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements like authority",token:null,error:"multiple_matching_tokens_detected"};var u=this.getUniqueAuthority(o,"authority");if(u.length>1)return{errorDesc:"Multiple authorities found in the cache. Pass authority in the API overload.",token:null,error:"multiple_matching_tokens_detected"};e.authorityInstance=g.AuthorityFactory.CreateInstance(u[0],this.validateAuthority)}}if(null!=r){var l=Number(r.value.expiresIn),d=this._clockSkew||300;return l&&l>f.Utils.now()+d?{errorDesc:null,token:r.value.accessToken,error:null}:(this._cacheStorage.removeItem(JSON.stringify(i[0].key)),null)}return null},e.prototype.getAllUsers=function(){for(var e=[],t=this._cacheStorage.getAllAccessTokens(c.Constants.clientId,c.Constants.userIdentifier),r=0;r<t.length;r++){var n=new u.IdToken(t[r].value.idToken),o=new a.ClientInfo(t[r].value.clientInfo),i=h.User.createUser(n,o,this.authority);e.push(i)}return this.getUniqueUsers(e)},e.prototype.getUniqueUsers=function(e){if(!e||e.length<=1)return e;for(var t=[],r=[],n=0;n<e.length;++n)e[n].userIdentifier&&-1===t.indexOf(e[n].userIdentifier)&&(t.push(e[n].userIdentifier),r.push(e[n]));return r},e.prototype.getUniqueAuthority=function(e,t){var r=[],n=[];return e.forEach(function(e){e.key.hasOwnProperty(t)&&-1===n.indexOf(e.key[t])&&(n.push(e.key[t]),r.push(e.key[t]))}),r},e.prototype.addHintParameters=function(e,t){var r=t||this.getUser(),n=r.userIdentifier.split("."),o=f.Utils.base64DecodeStringUrlSafe(n[0]),i=f.Utils.base64DecodeStringUrlSafe(n[1]);return this.urlContainsQueryStringParameter("login_hint",e)||!r.displayableId||f.Utils.isEmpty(r.displayableId)||(e+="&login_hint="+encodeURIComponent(t.displayableId)),f.Utils.isEmpty(o)||f.Utils.isEmpty(i)||(this.urlContainsQueryStringParameter("domain_req",e)||f.Utils.isEmpty(i)||(e+="&domain_req="+encodeURIComponent(i)),this.urlContainsQueryStringParameter("login_req",e)||f.Utils.isEmpty(o)||(e+="&login_req="+encodeURIComponent(o)),this.urlContainsQueryStringParameter("domain_hint",e)||f.Utils.isEmpty(i)||(e+="9188040d-6c67-4c5b-b112-36a304b66dad"===i?"&domain_hint="+encodeURIComponent("consumers"):"&domain_hint="+encodeURIComponent("organizations"))),e},e.prototype.urlContainsQueryStringParameter=function(e,t){return new RegExp("[\\?&]"+e+"=").test(t)},e.prototype.acquireTokenRedirect=function(e,t,r,n){var o=this,i=this.validateInputScope(e);if(i&&!f.Utils.isEmpty(i)&&this._tokenReceivedCallback)return void this._tokenReceivedCallback(c.ErrorDescription.inputScopesError,null,c.ErrorCodes.inputScopesError,c.Constants.accessToken,this.getUserState(this._cacheStorage.getItem(c.Constants.stateLogin)));e&&(e=this.filterScopes(e));var a=r||this.getUser();if(!this._acquireTokenInProgress){e.join(" ").toLowerCase();if(!a&&this._tokenReceivedCallback)return void this._tokenReceivedCallback(c.ErrorDescription.userLoginError,null,c.ErrorCodes.userLoginError,c.Constants.accessToken,this.getUserState(this._cacheStorage.getItem(c.Constants.stateLogin)));this._acquireTokenInProgress=!0;var u,l=t?g.AuthorityFactory.CreateInstance(t,this.validateAuthority):this.authorityInstance;l.ResolveEndpointsAsync().then(function(){u=f.Utils.compareObjects(a,o.getUser())?e.indexOf(o.clientId)>-1?new s.AuthenticationRequestParameters(l,o.clientId,e,m.id_token,o._redirectUri,o._state):new s.AuthenticationRequestParameters(l,o.clientId,e,m.token,o._redirectUri,o._state):new s.AuthenticationRequestParameters(l,o.clientId,e,m.id_token_token,o._redirectUri,o._state),o._cacheStorage.setItem(c.Constants.nonceIdToken,u.nonce);var t=c.Constants.acquireTokenUser+c.Constants.resourceDelimeter+a.userIdentifier+c.Constants.resourceDelimeter+u.state;f.Utils.isEmpty(o._cacheStorage.getItem(t))&&o._cacheStorage.setItem(t,JSON.stringify(a));var r=c.Constants.authority+c.Constants.resourceDelimeter+u.state;f.Utils.isEmpty(o._cacheStorage.getItem(r))&&o._cacheStorage.setItem(r,l.CanonicalAuthority),n&&(u.extraQueryParameters=n);var i=u.createNavigateUrl(e)+"&prompt=select_account&response_mode=fragment";(i=o.addHintParameters(i,a))&&(o._cacheStorage.setItem(c.Constants.stateAcquireToken,u.state),window.location.replace(i))})}},e.prototype.acquireTokenPopup=function(e,t,r,n){var o=this;return new Promise(function(i,a){var u=o.validateInputScope(e);u&&!f.Utils.isEmpty(u)&&a(c.ErrorCodes.inputScopesError+"|"+u),e&&(e=o.filterScopes(e));var l=r||o.getUser();if(o._acquireTokenInProgress)return void a(c.ErrorCodes.acquireTokenProgressError+"|"+c.ErrorDescription.acquireTokenProgressError);var d=e.join(" ").toLowerCase();if(!l)return void a(c.ErrorCodes.userLoginError+"|"+c.ErrorDescription.userLoginError);o._acquireTokenInProgress=!0;var p,h=t?g.AuthorityFactory.CreateInstance(t,o.validateAuthority):o.authorityInstance,y=o.openWindow("about:blank","_blank",1,o,i,a);y&&h.ResolveEndpointsAsync().then(function(){p=f.Utils.compareObjects(l,o.getUser())?e.indexOf(o.clientId)>-1?new s.AuthenticationRequestParameters(h,o.clientId,e,m.id_token,o._redirectUri,o._state):new s.AuthenticationRequestParameters(h,o.clientId,e,m.token,o._redirectUri,o._state):new s.AuthenticationRequestParameters(h,o.clientId,e,m.id_token_token,o._redirectUri,o._state),o._cacheStorage.setItem(c.Constants.nonceIdToken,p.nonce),p.state=p.state;var t=c.Constants.acquireTokenUser+c.Constants.resourceDelimeter+l.userIdentifier+c.Constants.resourceDelimeter+p.state;f.Utils.isEmpty(o._cacheStorage.getItem(t))&&o._cacheStorage.setItem(t,JSON.stringify(l));var r=c.Constants.authority+c.Constants.resourceDelimeter+p.state;f.Utils.isEmpty(o._cacheStorage.getItem(r))&&o._cacheStorage.setItem(r,h.CanonicalAuthority),n&&(p.extraQueryParameters=n);var u=p.createNavigateUrl(e)+"&prompt=select_account&response_mode=fragment";u=o.addHintParameters(u,l),window.renewStates.push(p.state),window.requestType=c.Constants.renewToken,o.registerCallback(p.state,d,i,a),y&&(y.location.href=u)},function(){o._logger.info(c.ErrorCodes.endpointResolutionError+":"+c.ErrorDescription.endpointResolutionError),o._cacheStorage.setItem(c.Constants.msalError,c.ErrorCodes.endpointResolutionError),o._cacheStorage.setItem(c.Constants.msalErrorDescription,c.ErrorDescription.endpointResolutionError),a&&a(c.ErrorCodes.endpointResolutionError+"|"+c.ErrorDescription.endpointResolutionError),y&&y.close()}).catch(function(e){o._logger.warning("could not resolve endpoints"),a(e)})})},e.prototype.acquireTokenSilent=function(e,t,r,n){var o=this;return new Promise(function(i,a){var u=o.validateInputScope(e);if(!u||f.Utils.isEmpty(u)){e&&(e=o.filterScopes(e));var l=e.join(" ").toLowerCase(),d=r||o.getUser();if(!d)return void a(c.ErrorCodes.userLoginError+"|"+c.ErrorDescription.userLoginError);var p,h=t?g.AuthorityFactory.CreateInstance(t,o.validateAuthority):o.authorityInstance;p=f.Utils.compareObjects(d,o.getUser())?e.indexOf(o.clientId)>-1?new s.AuthenticationRequestParameters(h,o.clientId,e,m.id_token,o._redirectUri,o._state):new s.AuthenticationRequestParameters(h,o.clientId,e,m.token,o._redirectUri,o._state):new s.AuthenticationRequestParameters(h,o.clientId,e,m.id_token_token,o._redirectUri,o._state);var y=o.getCachedToken(p,d);if(y){if(y.token)return o._logger.info("Token is already in cache for scope:"+l),void i(y.token);if(y.errorDesc||y.error)return o._logger.infoPii(y.errorDesc+":"+y.error),void a(y.errorDesc+"|"+y.error)}else o._logger.verbose("Token is not in cache for scope:"+l);return h.ResolveEndpointsAsync().then(function(){window.activeRenewals[l]?(o._logger.verbose("Renew token for scope: "+l+" is in progress. Registering callback"),o.registerCallback(window.activeRenewals[l],l,i,a)):e&&e.indexOf(o.clientId)>-1&&1===e.length?(o._logger.verbose("renewing idToken"),o.renewIdToken(e,i,a,d,p,n)):(o._logger.verbose("renewing accesstoken"),o.renewToken(e,i,a,d,p,n))}).catch(function(e){o._logger.warning("could not resolve endpoints"),a(e)})}a(c.ErrorCodes.inputScopesError+"|"+u)})},e.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(c.Constants.renewStatus+o,c.Constants.tokenRenewStatusInProgress),this.loadFrame(e,t),setTimeout(function(){n._cacheStorage.getItem(c.Constants.renewStatus+o)===c.Constants.tokenRenewStatusInProgress&&(n._logger.verbose("Loading frame has timed out after: "+n.loadFrameTimeout/1e3+" seconds for scope "+r+":"+o),o&&window.callBackMappedToRenewStates[o]&&window.callBackMappedToRenewStates[o]("Token renewal operation failed due to timeout",null,"Token Renewal Failed",c.Constants.accessToken),n._cacheStorage.setItem(c.Constants.renewStatus+o,c.Constants.tokenRenewStatusCancelled))},this.loadFrameTimeout)},e.prototype.loadFrame=function(e,t){var r=this;this._logger.info("LoadFrame: "+t);var n=t;setTimeout(function(){var o=r.addAdalFrame(n);""!==o.src&&"about:blank"!==o.src||(o.src=e,r._logger.infoPii("Frame Name : "+t+" Navigated to: "+e))},500)},e.prototype.addAdalFrame=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},e.prototype.renewToken=function(e,t,r,n,o,i){var s=e.join(" ").toLowerCase();this._logger.verbose("renewToken is called for scope:"+s);var a=this.addAdalFrame("msalRenewFrame"+s);i&&(o.extraQueryParameters=i);var u=c.Constants.acquireTokenUser+c.Constants.resourceDelimeter+n.userIdentifier+c.Constants.resourceDelimeter+o.state;f.Utils.isEmpty(this._cacheStorage.getItem(u))&&this._cacheStorage.setItem(u,JSON.stringify(n));var l=c.Constants.authority+c.Constants.resourceDelimeter+o.state;f.Utils.isEmpty(this._cacheStorage.getItem(l))&&this._cacheStorage.setItem(l,o.authority),this._cacheStorage.setItem(c.Constants.nonceIdToken,o.nonce),this._logger.verbose("Renew token Expected state: "+o.state);var d=o.createNavigateUrl(e)+"&prompt=none";d=this.addHintParameters(d,n),window.renewStates.push(o.state),window.requestType=c.Constants.renewToken,this.registerCallback(o.state,s,t,r),this._logger.infoPii("Navigate to:"+d),a.src="about:blank",this.loadIframeTimeout(d,"msalRenewFrame"+s,s)},e.prototype.renewIdToken=function(e,t,r,n,o,i){e.join(" ").toLowerCase();this._logger.info("renewidToken is called");var s=this.addAdalFrame("msalIdTokenFrame");i&&(o.extraQueryParameters=i);var a=c.Constants.acquireTokenUser+c.Constants.resourceDelimeter+n.userIdentifier+c.Constants.resourceDelimeter+o.state;f.Utils.isEmpty(this._cacheStorage.getItem(a))&&this._cacheStorage.setItem(a,JSON.stringify(n));var u=c.Constants.authority+c.Constants.resourceDelimeter+o.state;f.Utils.isEmpty(this._cacheStorage.getItem(u))&&this._cacheStorage.setItem(u,o.authority),this._cacheStorage.setItem(c.Constants.nonceIdToken,o.nonce),this._logger.verbose("Renew Idtoken Expected state: "+o.state);var l=o.createNavigateUrl(e)+"&prompt=none";l=this.addHintParameters(l,n),window.renewStates.push(o.state),window.requestType=c.Constants.renewToken,this.registerCallback(o.state,this.clientId,t,r),this._logger.infoPii("Navigate to:"+l),s.src="about:blank",this.loadIframeTimeout(l,"msalIdTokenFrame",this.clientId)},e.prototype.getUser=function(){if(this._user)return this._user;var e=this._cacheStorage.getItem(c.Constants.idTokenKey),t=this._cacheStorage.getItem(c.Constants.msalClientInfo);if(!f.Utils.isEmpty(e)&&!f.Utils.isEmpty(t)){var r=new u.IdToken(e),n=new a.ClientInfo(t);return this._user=h.User.createUser(r,n,this.authority),this._user}return null},e.prototype.handleAuthenticationResponse=function(e){null==e&&(e=window.location.hash);var t=null,r=!1,n=!1;try{n=window.opener&&window.opener.msal&&window.opener.msal!==window.msal}catch(e){n=!1}n?(t=window.opener.msal,r=!0):window.parent&&window.parent.msal&&(t=window.parent.msal);var o,i=t.getRequestInfo(e),s=null,a=null;if(t._logger.info("Returned from redirect url"),window.parent!==window&&window.parent.msal)a=window.parent.callBackMappedToRenewStates[i.stateResponse];else if(n)a=window.opener.callBackMappedToRenewStates[i.stateResponse];else{if(t._navigateToLoginRequestUrl)return a=null,t._cacheStorage.setItem(c.Constants.urlHash,e),!1,void(window.parent!==window||r||(window.location.href=t._cacheStorage.getItem(c.Constants.loginRequest)));a=t._tokenReceivedCallback,window.location.hash=""}t.saveTokenFromHash(i),i.requestType===c.Constants.renewToken&&window.parent?(window.parent!==window?t._logger.verbose("Window is in iframe, acquiring token silently"):t._logger.verbose("acquiring token interactive in progress"),s=i.parameters[c.Constants.accessToken]||i.parameters[c.Constants.idToken],o=c.Constants.accessToken):i.requestType===c.Constants.login&&(s=i.parameters[c.Constants.idToken],o=c.Constants.idToken);var u=i.parameters[c.Constants.errorDescription],l=i.parameters[c.Constants.error];try{a&&a.call(t,u,s,l,o)}catch(e){t._logger.error("Error occurred in token received callback function: "+e)}if(n)for(var d=0;d<window.opener.openedWindows.length;d++)window.opener.openedWindows[d].close()},e.prototype.saveAccessToken=function(e,t,r,n,s){var u,l=new a.ClientInfo(n);if(t.parameters.hasOwnProperty("scope")){u=t.parameters.scope;for(var d=u.split(" "),p=this._cacheStorage.getAllAccessTokens(this.clientId,e),h=0;h<p.length;h++){var g=p[h];if(g.key.userIdentifier===r.userIdentifier){var m=g.key.scopes.split(" ");f.Utils.isIntersectingScopes(m,d)&&this._cacheStorage.removeItem(JSON.stringify(g.key))}}var y=new o.AccessTokenKey(e,this.clientId,u,l.uid,l.utid),w=new i.AccessTokenValue(t.parameters[c.Constants.accessToken],s.rawIdToken,f.Utils.expiresIn(t.parameters[c.Constants.expiresIn]).toString(),n);this._cacheStorage.setItem(JSON.stringify(y),JSON.stringify(w))}else{u=this.clientId;var y=new o.AccessTokenKey(e,this.clientId,u,l.uid,l.utid),w=new i.AccessTokenValue(t.parameters[c.Constants.idToken],t.parameters[c.Constants.idToken],s.expiration,n);this._cacheStorage.setItem(JSON.stringify(y),JSON.stringify(w))}},e.prototype.saveTokenFromHash=function(e){this._logger.info("State status:"+e.stateMatch+"; Request type:"+e.requestType),this._cacheStorage.setItem(c.Constants.msalError,""),this._cacheStorage.setItem(c.Constants.msalErrorDescription,"");var t="",r="",n="";if(t=e.parameters.hasOwnProperty("scope")?e.parameters.scope.toLowerCase():this.clientId,e.parameters.hasOwnProperty(c.Constants.errorDescription)||e.parameters.hasOwnProperty(c.Constants.error)){if(this._logger.infoPii("Error :"+e.parameters[c.Constants.error]+"; Error description:"+e.parameters[c.Constants.errorDescription]),this._cacheStorage.setItem(c.Constants.msalError,e.parameters.error),this._cacheStorage.setItem(c.Constants.msalErrorDescription,e.parameters[c.Constants.errorDescription]),e.requestType===c.Constants.login&&(this._loginInProgress=!1,this._cacheStorage.setItem(c.Constants.loginError,e.parameters[c.Constants.errorDescription]+":"+e.parameters[c.Constants.error]),r=c.Constants.authority+c.Constants.resourceDelimeter+e.stateResponse),e.requestType===c.Constants.renewToken){this._acquireTokenInProgress=!1,r=c.Constants.authority+c.Constants.resourceDelimeter+e.stateResponse;var o=null!==this.getUser()?this.getUser().userIdentifier:"";n=c.Constants.acquireTokenUser+c.Constants.resourceDelimeter+o+c.Constants.resourceDelimeter+e.stateResponse}}else if(e.stateMatch){this._logger.info("State is right"),e.parameters.hasOwnProperty(c.Constants.sessionState)&&this._cacheStorage.setItem(c.Constants.msalSessionState,e.parameters[c.Constants.sessionState]);var i,s="";if(e.parameters.hasOwnProperty(c.Constants.accessToken)){this._logger.info("Fragment has access token"),this._acquireTokenInProgress=!1;var l=void 0;i=e.parameters.hasOwnProperty(c.Constants.idToken)?new u.IdToken(e.parameters[c.Constants.idToken]):new u.IdToken(this._cacheStorage.getItem(c.Constants.idTokenKey)),r=c.Constants.authority+c.Constants.resourceDelimeter+e.stateResponse;var d=void 0;f.Utils.isEmpty(this._cacheStorage.getItem(r))||(d=this._cacheStorage.getItem(r),d=f.Utils.replaceFirstPath(d,i.tenantId)),e.parameters.hasOwnProperty(c.Constants.clientInfo)?(s=e.parameters[c.Constants.clientInfo],l=h.User.createUser(i,new a.ClientInfo(s),d)):(this._logger.warning("ClientInfo not received in the response from AAD"),l=h.User.createUser(i,new a.ClientInfo(s),d)),n=c.Constants.acquireTokenUser+c.Constants.resourceDelimeter+l.userIdentifier+c.Constants.resourceDelimeter+e.stateResponse;var p=void 0;f.Utils.isEmpty(this._cacheStorage.getItem(n))||(p=JSON.parse(this._cacheStorage.getItem(n)),l&&p&&f.Utils.compareObjects(l,p)?(this.saveAccessToken(d,e,l,s,i),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 user object created from the response is not the same as the one passed in the acquireToken request"))}if(e.parameters.hasOwnProperty(c.Constants.idToken)&&t.indexOf(this.clientId)>-1){this._logger.info("Fragment has id token"),this._loginInProgress=!1,i=new u.IdToken(e.parameters[c.Constants.idToken]),e.parameters.hasOwnProperty(c.Constants.clientInfo)?s=e.parameters[c.Constants.clientInfo]:this._logger.warning("ClientInfo not received in the response from AAD"),r=c.Constants.authority+c.Constants.resourceDelimeter+e.stateResponse;var d=void 0;f.Utils.isEmpty(this._cacheStorage.getItem(r))||(d=this._cacheStorage.getItem(r),d=f.Utils.replaceFirstPath(d,i.tenantId)),this._user=h.User.createUser(i,new a.ClientInfo(s),d),i&&i.nonce?i.nonce!==this._cacheStorage.getItem(c.Constants.nonceIdToken)?(this._user=null,this._cacheStorage.setItem(c.Constants.loginError,"Nonce Mismatch. Expected Nonce: "+this._cacheStorage.getItem(c.Constants.nonceIdToken)+",Actual Nonce: "+i.nonce),this._logger.error("Nonce Mismatch.Expected Nonce: "+this._cacheStorage.getItem(c.Constants.nonceIdToken)+",Actual Nonce: "+i.nonce)):(this._cacheStorage.setItem(c.Constants.idTokenKey,e.parameters[c.Constants.idToken]),this._cacheStorage.setItem(c.Constants.msalClientInfo,s),this.saveAccessToken(d,e,this._user,s,i)):(r=e.stateResponse,n=e.stateResponse,this._logger.error("Invalid id_token received in the response"),e.parameters.error="invalid idToken",e.parameters.error_description="Invalid idToken. idToken: "+e.parameters[c.Constants.idToken],this._cacheStorage.setItem(c.Constants.msalError,"invalid idToken"),this._cacheStorage.setItem(c.Constants.msalErrorDescription,"Invalid idToken. idToken: "+e.parameters[c.Constants.idToken]))}}else r=e.stateResponse,n=e.stateResponse,this._logger.error("State Mismatch.Expected State: "+this._cacheStorage.getItem(c.Constants.stateLogin)+",Actual State: "+e.stateResponse),e.parameters.error="Invalid_state",e.parameters.error_description="Invalid_state. state: "+e.stateResponse,this._cacheStorage.setItem(c.Constants.msalError,"Invalid_state"),this._cacheStorage.setItem(c.Constants.msalErrorDescription,"Invalid_state. state: "+e.stateResponse);this._cacheStorage.setItem(c.Constants.renewStatus+e.stateResponse,c.Constants.tokenRenewStatusCompleted),this._cacheStorage.removeAcquireTokenEntries(r,n)},e.prototype.isCallback=function(e){e=this.getHash(e);var t=f.Utils.deserialize(e);return t.hasOwnProperty(c.Constants.errorDescription)||t.hasOwnProperty(c.Constants.error)||t.hasOwnProperty(c.Constants.accessToken)||t.hasOwnProperty(c.Constants.idToken)},e.prototype.getHash=function(e){return e.indexOf("#/")>-1?e=e.substring(e.indexOf("#/")+2):e.indexOf("#")>-1&&(e=e.substring(1)),e},e.prototype.getRequestInfo=function(e){e=this.getHash(e);var t=f.Utils.deserialize(e),r=new p.TokenResponse;if(t&&(r.parameters=t,t.hasOwnProperty(c.Constants.errorDescription)||t.hasOwnProperty(c.Constants.error)||t.hasOwnProperty(c.Constants.accessToken)||t.hasOwnProperty(c.Constants.idToken))){r.valid=!0;var n=void 0;if(!t.hasOwnProperty("state"))return r;if(n=t.state,r.stateResponse=n,n===this._cacheStorage.getItem(c.Constants.stateLogin))return r.requestType=c.Constants.login,r.stateMatch=!0,r;if(n===this._cacheStorage.getItem(c.Constants.stateAcquireToken))return r.requestType=c.Constants.renewToken,r.stateMatch=!0,r;if(!r.stateMatch){r.requestType=window.requestType;for(var o=window.renewStates,i=0;i<o.length;i++)if(o[i]===r.stateResponse){r.stateMatch=!0;break}}}return r},e.prototype.getScopeFromState=function(e){if(e){var t=e.indexOf("|");if(t>-1&&t+1<e.length)return e.substring(t+1)}return""},e.prototype.getUserState=function(e){if(e){var t=e.indexOf("|");if(t>-1&&t+1<e.length)return e.substring(t+1)}return""},e.prototype.isInIframe=function(){return window.parent!==window},e.prototype.loginInProgress=function(){return!!this._cacheStorage.getItem(c.Constants.urlHash)||this._loginInProgress},e.prototype.getHostFromUri=function(e){var t=String(e).replace(/^(https?:)\/\//,"");return t=t.split("/")[0]},e.prototype.getScopesForEndpoint=function(e){if(this._unprotectedResources.length>0)for(var t=0;t<this._unprotectedResources.length;t++)if(e.indexOf(this._unprotectedResources[t])>-1)return null;if(this._protectedResourceMap.size>0)for(var r=0,n=Array.from(this._protectedResourceMap.keys());r<n.length;r++){var o=n[r];if(e.indexOf(o)>-1)return this._protectedResourceMap.get(o)}return e.indexOf("http://")>-1||e.indexOf("https://")>-1?this.getHostFromUri(e)===this.getHostFromUri(this._redirectUri)?new Array(this.clientId):null:new Array(this.clientId)},e.prototype.setloginInProgress=function(e){this._loginInProgress=e},e.prototype.getAcquireTokenInProgress=function(){return this._acquireTokenInProgress},e.prototype.setAcquireTokenInProgress=function(e){this._acquireTokenInProgress=e},e.prototype.getLogger=function(){return this._logger},n.__decorate([y],e.prototype,"acquireTokenSilent",null),e}();t.UserAgentApplication=w},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=function(){function e(e,t,r,o,i){this.authority=e,this.clientId=t,this.scopes=r,this.userIdentifier=n.Utils.base64EncodeStringUrlSafe(o)+"."+n.Utils.base64EncodeStringUrlSafe(i)}return e}();t.AccessTokenKey=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t,r,n){this.accessToken=e,this.idToken=t,this.expiresIn=r,this.clientInfo=n}return e}();t.AccessTokenValue=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=function(){function e(e,t,r,o,i,s){this.authorityInstance=e,this.clientId=t,this.scopes=r,this.responseType=o,this.redirectUri=i,this.correlationId=n.Utils.createNewGuid(),this.state=s&&!n.Utils.isEmpty(s)?n.Utils.createNewGuid()+"|"+s:n.Utils.createNewGuid(),this.nonce=n.Utils.createNewGuid(),this.xClientSku="MSAL.JS",this.xClientVer=n.Utils.getLibraryVersion()}return Object.defineProperty(e.prototype,"authority",{get:function(){return this.authorityInstance.CanonicalAuthority},enumerable:!0,configurable:!0}),e.prototype.createNavigateUrl=function(e){var t=this.createNavigationUrlString(e),r=this.authorityInstance.AuthorizationEndpoint;return r.indexOf("?")<0?r+="?":r+="&",""+r+t.join("&")},e.prototype.createNavigationUrlString=function(e){e||(e=[this.clientId]),-1===e.indexOf(this.clientId)&&e.push(this.clientId);var t=[];return t.push("response_type="+this.responseType),this.translateclientIdUsedInScope(e),t.push("scope="+encodeURIComponent(this.parseScope(e))),t.push("client_id="+encodeURIComponent(this.clientId)),t.push("redirect_uri="+encodeURIComponent(this.redirectUri)),t.push("state="+encodeURIComponent(this.state)),t.push("nonce="+encodeURIComponent(this.nonce)),t.push("client_info=1"),t.push("x-client-SKU="+this.xClientSku),t.push("x-client-Ver="+this.xClientVer),this.extraQueryParameters&&t.push(this.extraQueryParameters),t.push("client-request-id="+encodeURIComponent(this.correlationId)),t},e.prototype.translateclientIdUsedInScope=function(e){var t=e.indexOf(this.clientId);t>=0&&(e.splice(t,1),-1===e.indexOf("openid")&&e.push("openid"),-1===e.indexOf("profile")&&e.push("profile"))},e.prototype.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},e}();t.AuthenticationRequestParameters=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=function(){function e(e){if(!e||n.Utils.isEmpty(e))return this.uid="",void(this.utid="");try{var t=n.Utils.base64DecodeStringUrlSafe(e),r=JSON.parse(t);r&&(r.hasOwnProperty("uid")&&(this.uid=r.uid),r.hasOwnProperty("utid")&&(this.utid=r.utid))}catch(e){throw new Error(e)}}return Object.defineProperty(e.prototype,"uid",{get:function(){return this._uid?this._uid:""},set:function(e){this._uid=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"utid",{get:function(){return this._utid?this._utid:""},set:function(e){this._utid=e},enumerable:!0,configurable:!0}),e}();t.ClientInfo=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=function(){function e(e){if(n.Utils.isEmpty(e))throw new Error("null or empty raw idtoken");try{this.rawIdToken=e,this.decodedIdToken=n.Utils.extractIdToken(e),this.decodedIdToken&&(this.decodedIdToken.hasOwnProperty("iss")&&(this.issuer=this.decodedIdToken.iss),this.decodedIdToken.hasOwnProperty("oid")&&(this.objectId=this.decodedIdToken.oid),this.decodedIdToken.hasOwnProperty("sub")&&(this.subject=this.decodedIdToken.sub),this.decodedIdToken.hasOwnProperty("tid")&&(this.tenantId=this.decodedIdToken.tid),this.decodedIdToken.hasOwnProperty("ver")&&(this.version=this.decodedIdToken.ver),this.decodedIdToken.hasOwnProperty("preferred_username")&&(this.preferredName=this.decodedIdToken.preferred_username),this.decodedIdToken.hasOwnProperty("name")&&(this.name=this.decodedIdToken.name),this.decodedIdToken.hasOwnProperty("nonce")&&(this.nonce=this.decodedIdToken.nonce),this.decodedIdToken.hasOwnProperty("exp")&&(this.expiration=this.decodedIdToken.exp),this.decodedIdToken.hasOwnProperty("home_oid")&&(this.homeObjectId=this.decodedIdToken.home_oid))}catch(e){throw new Error("Failed to parse the returned id token")}}return e}();t.IdToken=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(3),o=r(19),i=function(){function e(t){if(e._instance)return e._instance;if(this._cacheLocation=t,this._localStorageSupported=void 0!==window[this._cacheLocation]&&null!=window[this._cacheLocation],this._sessionStorageSupported=void 0!==window[t]&&null!=window[t],e._instance=this,!this._localStorageSupported&&!this._sessionStorageSupported)throw new Error("localStorage and sessionStorage not supported");return e._instance}return e.prototype.setItem=function(e,t){if(!window[this._cacheLocation])throw new Error("localStorage and sessionStorage are not supported");window[this._cacheLocation].setItem(e,t)},e.prototype.getItem=function(e){if(window[this._cacheLocation])return window[this._cacheLocation].getItem(e);throw new Error("localStorage and sessionStorage are not supported")},e.prototype.removeItem=function(e){if(window[this._cacheLocation])return window[this._cacheLocation].removeItem(e);throw new Error("localStorage and sessionStorage are not supported")},e.prototype.clear=function(){if(window[this._cacheLocation])return window[this._cacheLocation].clear();throw new Error("localStorage and sessionStorage are not supported")},e.prototype.getAllAccessTokens=function(e,t){var r,n=[],i=window[this._cacheLocation];if(!i)throw new Error("localStorage and sessionStorage are not supported");var s=void 0;for(s in i)if(i.hasOwnProperty(s)&&s.match(e)&&s.match(t)){var a=this.getItem(s);a&&(r=new o.AccessTokenCacheItem(JSON.parse(s),JSON.parse(a)),n.push(r))}return n},e.prototype.removeAcquireTokenEntries=function(e,t){var r=window[this._cacheLocation];if(!r)throw new Error("localStorage and sessionStorage are not supported");var n=void 0;for(n in r)r.hasOwnProperty(n)&&(""!=e&&n.indexOf(e)>-1||""!=t&&n.indexOf(t)>-1)&&this.removeItem(n)},e.prototype.resetCacheItems=function(){var e=window[this._cacheLocation];if(!e)throw new Error("localStorage and sessionStorage are not supported");var t=void 0;for(t in e)e.hasOwnProperty(t)&&-1!==t.indexOf(n.Constants.msal)&&this.setItem(t,""),e.hasOwnProperty(t)&&-1!==t.indexOf(n.Constants.renewStatus)&&this.removeItem(t)},e}();t.Storage=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){this.key=e,this.value=t}return e}();t.AccessTokenCacheItem=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(8),i=r(21),s=r(1),a=r(5),c=function(){function e(){}return e.DetectAuthorityFromUrl=function(e){switch(e=n.Utils.CanonicalizeUri(e),n.Utils.GetUrlComponents(e).PathSegments[0]){case"tfp":return s.AuthorityType.B2C;case"adfs":return s.AuthorityType.Adfs;default:return s.AuthorityType.Aad}},e.CreateInstance=function(t,r){switch(e.DetectAuthorityFromUrl(t)){case s.AuthorityType.B2C:return new i.B2cAuthority(t,r);case s.AuthorityType.Aad:return new o.AadAuthority(t,r);default:throw a.ErrorMessage.invalidAuthorityType}},e}();t.AuthorityFactory=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2),o=r(8),i=r(1),s=r(5),a=r(0),c=function(e){function t(t,r){var n=e.call(this,t,r)||this,o=a.Utils.GetUrlComponents(t),i=o.PathSegments;if(i.length<3)throw s.ErrorMessage.b2cAuthorityUriInvalidPath;return n.CanonicalAuthority="https://"+o.HostNameAndPort+"/"+i[0]+"/"+i[1]+"/"+i[2]+"/",n}return n.__extends(t,e),Object.defineProperty(t.prototype,"AuthorityType",{get:function(){return i.AuthorityType.B2C},enumerable:!0,configurable:!0}),t.prototype.GetOpenIdConfigurationEndpointAsync=function(){var e=this,t=new Promise(function(t,r){return t(e.DefaultOpenIdConfigurationEndpoint)});return this.IsValidationEnabled?this.IsInTrustedHostList(this.CanonicalAuthorityUrlComponents.HostNameAndPort)?t:new Promise(function(e,t){return t(s.ErrorMessage.unsupportedAuthorityValidation)}):t},t}(o.AadAuthority);t.B2cAuthority=c}])});
//# sourceMappingURL=msal.min.js.map