forked from diegoroman/msal-angularjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmsal-angular.min.js
18 lines (16 loc) · 76 KB
/
msal-angular.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.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;)o=(t=e.charCodeAt(l++))>>2,i=(3&t)<<4|(r=e.charCodeAt(l++))>>4,s=(15&r)<<2|(n=e.charCodeAt(l++))>>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+/=",r=(e=String(e).replace(/=+$/,"")).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){c=(a=n<<18|o<<12|i<<6)>>16&255,u=a>>8&255,d+=String.fromCharCode(c,u);break}if(p+1===r-1){c=(a=n<<18|o<<12)>>16&255,d+=String.fromCharCode(c);break}c=(a=n<<18|o<<12|i<<6|s)>>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]*)$/.exec(e);return!t||t.length<4?null:{header:t[1],JWSPayload:t[2],JWSSig:t[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,s+=o[i|=8]):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";r.r(t),r.d(t,"__extends",function(){return o}),r.d(t,"__assign",function(){return i}),r.d(t,"__rest",function(){return s}),r.d(t,"__decorate",function(){return a}),r.d(t,"__param",function(){return c}),r.d(t,"__metadata",function(){return u}),r.d(t,"__awaiter",function(){return l}),r.d(t,"__generator",function(){return d}),r.d(t,"__exportStar",function(){return p}),r.d(t,"__values",function(){return h}),r.d(t,"__read",function(){return f}),r.d(t,"__spread",function(){return g}),r.d(t,"__await",function(){return m}),r.d(t,"__asyncGenerator",function(){return y}),r.d(t,"__asyncDelegator",function(){return w}),r.d(t,"__asyncValues",function(){return v});
/*! *****************************************************************************
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 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])};function o(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var i=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};function s(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&&(r[n[o]]=e[n[o]])}return r}function a(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 c(e,t){return function(r,n){t(r,n,e)}}function u(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(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 d(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=n[2&i[0]?"return":i[0]?"throw":"next"])&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function p(e,t){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}function h(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 f(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 g(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(f(arguments[t]));return e}function m(e){return this instanceof m?(this.v=e,this):new m(e)}function y(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),i=[];return n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n;function s(e){o[e]&&(n[e]=function(t){return new Promise(function(r,n){i.push([e,t,r,n])>1||a(e,t)})})}function a(e,t){try{!function(e){e.value instanceof m?Promise.resolve(e.value.v).then(c,u):l(i[0][2],e)}(o[e](t))}catch(e){l(i[0][3],e)}}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),i.shift(),i.length&&a(i[0][0],i[0][1])}}function w(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){e[n]&&(t[n]=function(t){return(r=!r)?{value:m(e[n](t)),done:"return"===n}:o?o(t):t})}}function v(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator];return t?t.call(e):h(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(){return function(){this.valid=!1,this.parameters={},this.stateMatch=!1,this.stateResponse="",this.requestType="unknown"}}();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)).error)return t.error;throw e}catch(t){return e}},e}();t.XhrClient=n},function(e,t,r){
// @preserve Copyright (c) Microsoft Open Technologies, Inc.
!function(){"use strict";if(angular){var t=r(11),n=angular.module("MsalAngular",[]);n.provider("msalAuthenticationService",function(){var e=null,r=null,n={isAuthenticated:!1,userName:"",loginError:"",idToken:{}},o=function(t){var r=e.getCachedToken({scopes:t},e.getUser());n.isAuthenticated=null!=r&&null!==r.token&&r.token.length>0;var o=e.getUser();o&&(n.userName=o.name,n.idToken=o.idToken),r&&r.error&&(n.loginError=r.error)};this.init=function(n,i){if(!n)throw new Error("You must set configOptions, when calling init");n,n.optionalParams||(n.optionalParams={}),n.optionalParams.isAngular=!0,i&&i.interceptors&&i.interceptors.push("ProtectedResourceInterceptor"),e=new t.UserAgentApplication(n.clientID,n.authority,n.tokenReceivedCallback,n.optionalParams),n.routeProtectionConfig?e.routeProtectionConfig=n.routeProtectionConfig:e.routeProtectionConfig={},e.loginScopes=[e.clientId],r=t.Constants,o(e.loginScopes)},this.$get=["$rootScope","$window","$q","$location","$timeout","$injector",function(t,i,s,a,c,u){var l=function(i,s,l){if(e.isCallback(i)){var d=!1,p=null,h=null;if(l.openedWindows.length>0&&l.openedWindows[l.openedWindows.length-1].opener&&l.openedWindows[l.openedWindows.length-1].opener.msal){var f=l.openedWindows[l.openedWindows.length-1].opener;d=!0,p=(e=f.msal).getRequestInfo(i),f.callBackMappedToRenewStates[p.stateResponse]&&(h=f.callBackMappedToRenewStates[p.stateResponse])}else l.parent&&l.parent.msal&&(p=(e=l.parent.msal).getRequestInfo(i),h=l.parent!==l&&l.parent.callBackMappedToRenewStates[p.stateResponse]?l.parent.callBackMappedToRenewStates[p.stateResponse]:e._tokenReceivedCallback);e._logger.verbose("Processing the hash: "+i),e.saveTokenFromHash(p);var g=p.parameters.access_token||p.parameters.id_token,m=p.parameters.error,y=p.parameters.error_description,w=null;if(p.stateMatch){if("RENEW_TOKEN"===p.requestType?(w=r.accessToken,e._renewActive=!1,l.parent!==l||l.parent.callBackMappedToRenewStates[p.stateResponse]||(g?t.$broadcast("msal:acquireTokenSuccess",g):m&&y&&t.$broadcast("msal:acquireTokenFailure",y,m))):"LOGIN"===p.requestType&&(w=r.idToken,o(e.loginScopes),n.userName?(c(function(){o(e.loginScopes),t.userInfo=n},1),t.$broadcast("msal:loginSuccess",g)):t.$broadcast("msal:loginFailure",y||e._cacheStorage.getItem(r.msalErrorDescription),m||e._cacheStorage.getItem(r.msalError))),h&&"function"==typeof h&&h(y,g,m,w),l.parent!==l)return void(s&&s.preventDefault&&s.preventDefault());if(l.parent===l&&!d)if(e._navigateToLoginRequestUrl){var v=e._cacheStorage.getItem(r.loginRequest);void 0!==v&&v&&0!==v.length&&(e._logger.verbose("Redirecting to start page: "+v),!a.$$html5&&v.indexOf("#")>-1&&a.url(v.substring(v.indexOf("#")+1)),l.location.href=v)}else a.$$html5?a.hash(""):a.path("")}else t.$broadcast("msal:stateMismatch",y,m)}else{if(o(e.loginScopes),!n.isAuthenticated&&n.userName&&!e._renewActive)u.get("msalAuthenticationService").acquireTokenSilent(e.loginScopes).then(function(e){e&&(n.isAuthenticated=!0)},function(e){var r=e.split("|");t.$broadcast("msal:loginFailure",r[0],r[1])})}},d=function(n,o){null!==n&&e._cacheStorage.setItem(r.angularLoginRequest,n),e._logger.info("Start login at:"+n!==null?n:window.location.href),t.$broadcast("msal:loginRedirect"),o.popUp?e.loginPopup(o.consentScopes,o.extraQueryParameters):e.loginRedirect(o.consentScopes,o.extraQueryParameters)};function p(t){if(e&&e._unprotectedResources)for(var r=0;r<e._unprotectedResources.length;r++)if(t.indexOf(e._unprotectedResources[r])>-1)return!0;return!1}var h=function(t,r,o,i,s){if(r)for(var c=function(e){var t=null,r=[];if(e.hasOwnProperty("parent"))for(t=e;t;)r.unshift(t),t=u.get("$state").get(t.parent);else for(var n=e.name.split("."),o=0,i=n[0];o<n.length;o++)(t=u.get("$state").get(i))&&r.push(t),i+="."+n[o+1];return r}(r),l=null,h=0;h<c.length;h++){if(l=c[h],e.routeProtectionConfig.requireLogin||l.requireLogin){if(!n.isAuthenticated&&!e._renewActive&&!e.getUser()){e._logger.info("State change event for:"+a.$$url);var f=u.get("$state").href(r,o,{absolute:!0});d(f,e.routeProtectionConfig)}}else if(l.templateUrl){var g;(g="function"==typeof l.templateUrl?l.templateUrl(o):l.templateUrl)&&!p(g)&&e._unprotectedResources.push(g)}}},f=function(t,r,n,o,i,s){e._logger.verbose("State change error occured. Error: "+typeof s=="string"?s:JSON.stringify(s)),s&&s.data&&(e._logger.info("Setting defaultPrevented to true if state change error occured because msal rejected a request. Error: "+s.data),t&&t.preventDefault())};if(u.has("$transitions")){var g=u.get("$transitions");g.onStart({},function(e){h(null,e.to(),e.params("to"),e.from(),e.params("from"))}),g.onError({},function(e){f(null,e.to(),e.params("to"),e.from(),e.params("from"),e.error())})}return t.$on("$routeChangeStart",function(t,r){var o;r&&r.$$route&&(e.routeProtectionConfig.requireLogin||r.$$route.requireLogin?n.isAuthenticated||e._renewActive||e.loginInProgress()||(e._logger.info("Route change event for:"+a.$$url),d(null,e.routeProtectionConfig)):(o="function"==typeof r.$$route.templateUrl?r.$$route.templateUrl(r.params):r.$$route.templateUrl)&&!p(o)&&e._unprotectedResources.push(o))}),t.$on("$stateChangeStart",h),t.$on("$locationChangeStart",function(r,s,u){if(e._logger.info("Location change event from "+u+" to "+s),a.$$html5)var d=a.hash();else d="#"+a.path();l(d,r,i),c(function(){o(e.loginScopes),t.userInfo=n},1)}),t.$on("$stateChangeError",f),i.addEventListener("msal:popUpHashChanged",function(e){l(e.detail,null,i)}),i.addEventListener("msal:popUpClosed",function(r){var n=r.detail.split("|");e._loginInProgress?(t.$broadcast("msal:loginFailure",n[0],n[1]),e._loginInProgress=!1):e._acquireTokenInProgress&&(t.$broadcast("msal:acquireTokenFailure",n[0],n[1]),e._acquireTokenInProgress=!1)}),o(e.loginScopes),t.userInfo=n,{loginRedirect:function(t,r){e.loginRedirect(t,r)},loginPopup:function(r,n){var o=s.defer();return e.loginPopup(r,n).then(function(e){t.$broadcast("msal:loginSuccess",e),o.resolve(e)},function(e){var r=e.split("|");t.$broadcast("msal:loginFailure",r[0],r[1]),o.reject(e)}),o.promise},clearCacheForScope:function(t){e.clearCacheForScope(t)},getAllUsers:function(){return e.getAllUsers()},acquireTokenRedirect:function(t,n,o,i){var s=e._cacheStorage.getItem(r.loginRequest);window.location.href!==s&&e._cacheStorage.setItem(r.loginRequest,window.location.href),e.acquireTokenRedirect(t,n,o,i)},acquireTokenPopup:function(r,n,o,i){var a=s.defer();return e.acquireTokenPopup(r,n,o,i).then(function(r){e._renewActive=!1,t.$broadcast("msal:acquireTokenSuccess",r),a.resolve(r)},function(r){var n=r.split("|");e._renewActive=!1,t.$broadcast("msal:acquireTokenFailure",n[0],n[1]),a.reject(r)}),a.promise},acquireTokenSilent:function(r,n,o,i){var a=s.defer();return e.acquireTokenSilent(r,n,o,i).then(function(r){e._renewActive=!1,t.$broadcast("msal:acquireTokenSuccess",r),a.resolve(r)},function(r){var n=r.split("|");e._renewActive=!1,t.$broadcast("msal:acquireTokenFailure",n[0],n[1]),a.reject(r)}),a.promise},getUser:function(){return e.getUser()},isCallback:function(t){return e.isCallback(t)},loginInProgress:function(){return e.loginInProgress()},logout:function(){e.logout()},userInfo:n,_getCachedToken:function(t){return e.getCachedToken({scopes:t},e.getUser())},_getScopesForEndpoint:function(t){return e.getScopesForEndpoint(t)},_info:function(t){e._logger.info(t)},_verbose:function(t){e._logger.verbose(t)}}}]}),n.factory("ProtectedResourceInterceptor",["msalAuthenticationService","$q","$rootScope","$templateCache","$injector",function(e,t,r,n,o){return{request:function(o){if(o){if(o.headers=o.headers||{},n.get(o.url))return o;var i=e._getScopesForEndpoint(o.url),s=window.msal.routeProtectionConfig;if(e._verbose("Url: "+o.url+" maps to scopes: "+i),null===i)return o;var a=e._getCachedToken(i,e.getUser());if(a&&a.token)return e._info("Token is available for this url "+o.url),o.headers.Authorization="Bearer "+a.token,o;if(e.loginInProgress()){if(s&&s.popUp){e._info("Url: "+o.url+" will be loaded after login is successful");var c=t.defer();return r.$on("msal:loginSuccess",function(t,r){r&&(e._info("Login completed, sending request for "+o.url),o.headers.Authorization="Bearer "+r,c.resolve(o))}),r.$on("msal:loginFailure",function(e,t){t&&(o.data=t,c.reject(o))}),c.promise}return e._info("login is in progress."),o.data="login in progress, cancelling the request for "+o.url,t.reject(o)}c=t.defer();return e.acquireTokenSilent(i).then(function(t){e._verbose("Token is available"),o.headers.Authorization="Bearer "+t,c.resolve(o)},function(e){o.data=e,c.reject(o)}),c.promise}},responseError:function(n){if(e._info("Getting error in the response: "+JSON.stringify(n)),n){if(401===n.status){var o=e._getScopesForEndpoint(n.config.url),i=e._getCachedToken(o,e.getUser());i&&i.token&&e.clearCacheForScope(i.token),r.$broadcast("msal:notAuthorized",n,o)}else r.$broadcast("msal:errorResponse",n);return t.reject(n)}}}}])}else console.error("Angular.JS is not included");void 0!==e&&e.exports&&(e.exports="MsalAngular")}()},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",y="token",w="id_token token",v=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},_=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,v=n.navigateToLoginRequestUrl,_=void 0===v||v,b=n.state,I=void 0===b?"":b,C=n.isAngular,S=void 0!==C&&C,k=n.unprotectedResources,T=void 0===k?new Array:k,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=_,this._state=I,this._isAngular=S,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,A=this.isCallback(U);if(!this._isAngular)if(A)this.handleAuthenticationResponse.call(this,U);else{var O=this._cacheStorage.getItem(c.Constants.urlHash);O&&this.processCallBack(O)}}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)this._tokenReceivedCallback(c.ErrorDescription.loginProgressError,null,c.ErrorCodes.loginProgressError,c.Constants.idToken,this.getUserState(this._cacheStorage.getItem(c.Constants.stateLogin)));else{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,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)o(c.ErrorCodes.loginProgressError+"|"+c.ErrorDescription.loginProgressError);else{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,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=e.filter(function(e){return"openid"!==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,this._redirectUri,this._state):new s.AuthenticationRequestParameters(o,this.clientId,e,y,this._redirectUri,this._state):new s.AuthenticationRequestParameters(o,this.clientId,e,w,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(s=0;s<o.length;s++){c=(a=o[s]).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,c=(a=o[s]).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)this._tokenReceivedCallback(c.ErrorDescription.inputScopesError,null,c.ErrorCodes.inputScopesError,c.Constants.accessToken,this.getUserState(this._cacheStorage.getItem(c.Constants.stateLogin)));else{e&&(e=this.filterScopes(e));var a=r||this.getUser();if(!this._acquireTokenInProgress){e.join(" ").toLowerCase();if(a||!this._tokenReceivedCallback){var u;this._acquireTokenInProgress=!0;var 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,o._redirectUri,o._state):new s.AuthenticationRequestParameters(l,o.clientId,e,y,o._redirectUri,o._state):new s.AuthenticationRequestParameters(l,o.clientId,e,w,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))})}else this._tokenReceivedCallback(c.ErrorDescription.userLoginError,null,c.ErrorCodes.userLoginError,c.Constants.accessToken,this.getUserState(this._cacheStorage.getItem(c.Constants.stateLogin)))}}},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)a(c.ErrorCodes.acquireTokenProgressError+"|"+c.ErrorDescription.acquireTokenProgressError);else{var d=e.join(" ").toLowerCase();if(l){var p;o._acquireTokenInProgress=!0;var h=t?g.AuthorityFactory.CreateInstance(t,o.validateAuthority):o.authorityInstance,v=o.openWindow("about:blank","_blank",1,o,i,a);v&&h.ResolveEndpointsAsync().then(function(){p=f.Utils.compareObjects(l,o.getUser())?e.indexOf(o.clientId)>-1?new s.AuthenticationRequestParameters(h,o.clientId,e,m,o._redirectUri,o._state):new s.AuthenticationRequestParameters(h,o.clientId,e,y,o._redirectUri,o._state):new s.AuthenticationRequestParameters(h,o.clientId,e,w,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),v&&(v.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),v&&v.close()}).catch(function(e){o._logger.warning("could not resolve endpoints"),a(e)})}else a(c.ErrorCodes.userLoginError+"|"+c.ErrorDescription.userLoginError)}})},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,d=e.join(" ").toLowerCase(),p=r||o.getUser();if(!p)return void a(c.ErrorCodes.userLoginError+"|"+c.ErrorDescription.userLoginError);var h=t?g.AuthorityFactory.CreateInstance(t,o.validateAuthority):o.authorityInstance;l=f.Utils.compareObjects(p,o.getUser())?e.indexOf(o.clientId)>-1?new s.AuthenticationRequestParameters(h,o.clientId,e,m,o._redirectUri,o._state):new s.AuthenticationRequestParameters(h,o.clientId,e,y,o._redirectUri,o._state):new s.AuthenticationRequestParameters(h,o.clientId,e,w,o._redirectUri,o._state);var v=o.getCachedToken(l,p);if(v){if(v.token)return o._logger.info("Token is already in cache for scope:"+d),void i(v.token);if(v.errorDesc||v.error)return o._logger.infoPii(v.errorDesc+":"+v.error),void a(v.errorDesc+"|"+v.error)}else o._logger.verbose("Token is not in cache for scope:"+d);return h.ResolveEndpointsAsync().then(function(){window.activeRenewals[d]?(o._logger.verbose("Renew token for scope: "+d+" is in progress. Registering callback"),o.registerCallback(window.activeRenewals[d],d,i,a)):e&&e.indexOf(o.clientId)>-1&&1===e.length?(o._logger.verbose("renewing idToken"),o.renewIdToken(e,i,a,p,l,n)):(o._logger.verbose("renewing accesstoken"),o.renewToken(e,i,a,p,l,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")){for(var d=(u=t.parameters.scope).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;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){var i;this._logger.info("State is right"),e.parameters.hasOwnProperty(c.Constants.sessionState)&&this._cacheStorage.setItem(c.Constants.msalSessionState,e.parameters[c.Constants.sessionState]);var 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;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([v],e.prototype,"acquireTokenSilent",null),e}();t.UserAgentApplication=_},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=function(){return function(e,t,r,o,i){this.authority=e,this.clientId=t,this.scopes=r,this.userIdentifier=n.Utils.base64EncodeStringUrlSafe(o)+"."+n.Utils.base64EncodeStringUrlSafe(i)}}();t.AccessTokenKey=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){return function(e,t,r,n){this.accessToken=e,this.idToken=t,this.expiresIn=r,this.clientInfo=n}}();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(){return function(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")}}}();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(){return function(e,t){this.key=e,this.value=t}}();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}]);