UNPKG

msal-iframe-ok

Version:

Fork to allow silent renewal in iFrame of Microsoft Authentication Library for js

17 lines (15 loc) 94.2 kB
/*! msal-iframe-ok v1.0.2 2019-07-09 */ "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Msal",[],t):"object"==typeof exports?exports.Msal=t():e.Msal=t()}(window,function(){return function(r){var n={};function o(e){if(n[e])return n[e].exports;var t=n[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=r,o.c=n,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(r,n,function(e){return t[e]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=17)}([function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),a=r(2),p=r(4),o=r(2),i=r(20),s=function(){function s(){}return s.compareAccounts=function(e,t){return!(!e||!t)&&!(!e.homeAccountIdentifier||!t.homeAccountIdentifier||e.homeAccountIdentifier!==t.homeAccountIdentifier)},s.decimalToHex=function(e){for(var t=e.toString(16);t.length<2;)t="0"+t;return t},s.getLibraryVersion=function(){return o.Library.version},s.createNewGuid=function(){var e=window.crypto;if(e&&e.getRandomValues){var t=new Uint8Array(16);return e.getRandomValues(t),t[6]|=64,t[6]&=79,t[8]|=128,t[8]&=191,s.decimalToHex(t[0])+s.decimalToHex(t[1])+s.decimalToHex(t[2])+s.decimalToHex(t[3])+"-"+s.decimalToHex(t[4])+s.decimalToHex(t[5])+"-"+s.decimalToHex(t[6])+s.decimalToHex(t[7])+"-"+s.decimalToHex(t[8])+s.decimalToHex(t[9])+"-"+s.decimalToHex(t[10])+s.decimalToHex(t[11])+s.decimalToHex(t[12])+s.decimalToHex(t[13])+s.decimalToHex(t[14])+s.decimalToHex(t[15])}for(var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",n="0123456789abcdef",o=0,i="",a=0;a<36;a++)"-"!==r[a]&&"4"!==r[a]&&(o=16*Math.random()|0),"x"===r[a]?i+=n[o]:"y"===r[a]?(o&=3,i+=n[o|=8]):i+=r[a];return i},s.expiresIn=function(e){return e||(e="3599"),this.now()+parseInt(e,10)},s.now=function(){return Math.round((new Date).getTime()/1e3)},s.isEmpty=function(e){return void 0===e||!e||0===e.length},s.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]}},s.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},s.base64EncodeStringUrlSafe=function(e){return i.Base64.encode(e)},s.base64DecodeStringUrlSafe=function(e){return e=e.replace(/-/g,"+").replace(/_/g,"/"),decodeURIComponent(encodeURIComponent(i.Base64.decode(e)))},s.encode=function(e){var t,r,n,o,i,a,s,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,a=(15&r)<<2|(n=e.charCodeAt(l++))>>6,s=63&n,isNaN(r)?a=s=64:isNaN(n)&&(s=64),u=u+c.charAt(o)+c.charAt(i)+c.charAt(a)+c.charAt(s);return u.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},s.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):(127<n&&n<2048?t+=String.fromCharCode(n>>6|192):(t+=String.fromCharCode(n>>12|224),t+=String.fromCharCode(n>>6&63|128)),t+=String.fromCharCode(63&n|128))}return t},s.decode=function(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r=(e=String(e).replace(/=+$/,"")).length;if(r%4==1)throw p.ClientAuthError.createTokenEncodingError(e);for(var n,o,i,a,s,c,u,l,d="",h=0;h<r;h+=4){if(n=t.indexOf(e.charAt(h)),o=t.indexOf(e.charAt(h+1)),i=t.indexOf(e.charAt(h+2)),a=t.indexOf(e.charAt(h+3)),h+2===r-1){c=(s=n<<18|o<<12|i<<6)>>16&255,u=s>>8&255,d+=String.fromCharCode(c,u);break}if(h+1===r-1){c=(s=n<<18|o<<12)>>16&255,d+=String.fromCharCode(c);break}c=(s=n<<18|o<<12|i<<6|a)>>16&255,u=s>>8&255,l=255&s,d+=String.fromCharCode(c,u,l)}return d},s.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},s.isIntersectingScopes=function(e,t){e=this.convertToLowerCase(e);for(var r=0;r<t.length;r++)if(-1<e.indexOf(t[r].toLowerCase()))return!0;return!1},s.containsScope=function(t,e){return t=this.convertToLowerCase(t),e.every(function(e){return 0<=t.indexOf(e.toString().toLowerCase())})},s.convertToLowerCase=function(e){return e.map(function(e){return e.toLowerCase()})},s.removeElement=function(e,t){return e.filter(function(e){return e!==t})},s.getDefaultRedirectUri=function(){return window.location.href.split("?")[0].split("#")[0]},s.replaceTenantPath=function(e,t){e=e.toLowerCase();var r=this.GetUrlComponents(e),n=r.PathSegments;return!t||0===n.length||n[0]!==a.Constants.common&&n[0]!==a.SSOTypes.ORGANIZATIONS||(n[0]=t),this.constructAuthorityUriFromObject(r,n)},s.constructAuthorityUriFromObject=function(e,t){return this.CanonicalizeUri(e.Protocol+"//"+e.HostNameAndPort+"/"+t.join("/"))},s.GetUrlComponents=function(e){if(!e)throw"Url required";var t=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),r=e.match(t);if(!r||r.length<6)throw"Valid url required";var n={Protocol:r[1],HostNameAndPort:r[4],AbsolutePath:r[5]},o=n.AbsolutePath.split("/");return o=o.filter(function(e){return e&&0<e.length}),n.PathSegments=o,n},s.CanonicalizeUri=function(e){return e&&(e=e.toLowerCase()),e&&!s.endsWith(e,"/")&&(e+="/"),e},s.endsWith=function(e,t){return!(!e||!t)&&-1!==e.indexOf(t,e.length-t.length)},s.urlRemoveQueryStringParameter=function(e,t){if(this.isEmpty(e))return e;var r=new RegExp("(\\&"+t+"=)[^&]+");return e=e.replace(r,""),r=new RegExp("("+t+"=)[^&]+&"),e=e.replace(r,""),r=new RegExp("("+t+"=)[^&]+"),e=e.replace(r,"")},s.constructUnifiedCacheQueryParameter=function(e,t){var r,n,o={};if(e)if(e.account){var i=e.account;i.sid?(r=a.SSOTypes.SID,n=i.sid):i.userName&&(r=a.SSOTypes.LOGIN_HINT,n=i.userName)}else e.sid?(r=a.SSOTypes.SID,n=e.sid):e.loginHint&&(r=a.SSOTypes.LOGIN_HINT,n=e.loginHint);else t&&(n=t.hasOwnProperty(a.Constants.upn)?(r=a.SSOTypes.ID_TOKEN,t.upn):(r=a.SSOTypes.ORGANIZATIONS,null));return o=this.addSSOParameter(r,n),e&&e.account&&e.account.homeAccountIdentifier&&(o=this.addSSOParameter(a.SSOTypes.HOMEACCOUNT_ID,e.account.homeAccountIdentifier,o)),o},s.addSSOParameter=function(e,t,r){if(r||(r={}),!t)return r;switch(e){case a.SSOTypes.SID:r[a.SSOTypes.SID]=t;break;case a.SSOTypes.ID_TOKEN:r[a.SSOTypes.LOGIN_HINT]=t,r[a.SSOTypes.DOMAIN_HINT]=a.SSOTypes.ORGANIZATIONS;break;case a.SSOTypes.LOGIN_HINT:r[a.SSOTypes.LOGIN_HINT]=t;break;case a.SSOTypes.ORGANIZATIONS:r[a.SSOTypes.DOMAIN_HINT]=a.SSOTypes.ORGANIZATIONS;break;case a.SSOTypes.CONSUMERS:r[a.SSOTypes.DOMAIN_HINT]=a.SSOTypes.CONSUMERS;break;case a.SSOTypes.HOMEACCOUNT_ID:var n=t.split("."),o=s.base64DecodeStringUrlSafe(n[0]),i=s.base64DecodeStringUrlSafe(n[1]);r[a.SSOTypes.LOGIN_REQ]=o,(r[a.SSOTypes.DOMAIN_REQ]=i)===a.Constants.consumersUtid?r[a.SSOTypes.DOMAIN_HINT]=a.SSOTypes.CONSUMERS:r[a.SSOTypes.DOMAIN_HINT]=a.SSOTypes.ORGANIZATIONS;break;case a.SSOTypes.LOGIN_REQ:r[a.SSOTypes.LOGIN_REQ]=t;break;case a.SSOTypes.DOMAIN_REQ:r[a.SSOTypes.DOMAIN_REQ]=t}return r},s.generateQueryParametersString=function(t){var r=null;return t&&Object.keys(t).forEach(function(e){null==r?r=e+"="+encodeURIComponent(t[e]):r+="&"+e+"="+encodeURIComponent(t[e])}),r},s.isSSOParam=function(e){return e&&(e.account||e.sid||e.loginHint)},s.setResponseIdToken=function(e,t){var r=n.__assign({},e);return r.idToken=t,r.idToken.objectId?r.uniqueId=r.idToken.objectId:r.uniqueId=r.idToken.subject,r.tenantId=r.idToken.tenantId,r},s}();t.Utils=s},function(e,t,r){ /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function o(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 i(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=i.next()).done;)a.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 a}function d(e){return this instanceof d?(this.v=e,this):new d(e)}t.__extends=function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},t.__assign=function(){return t.__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},t.__assign.apply(this,arguments)},t.__rest=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&(r[n[o]]=e[n[o]])}return r},t.__decorate=function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;0<=s;s--)(o=e[s])&&(a=(i<3?o(a):3<i?o(t,r,a):o(t,r))||a);return 3<i&&a&&Object.defineProperty(t,r,a),a},t.__param=function(r,n){return function(e,t){n(e,t,r)}},t.__metadata=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},t.__awaiter=function(i,a,s,c){return new(s||(s=Promise))(function(e,t){function r(e){try{o(c.next(e))}catch(e){t(e)}}function n(e){try{o(c.throw(e))}catch(e){t(e)}}function o(t){t.done?e(t.value):new s(function(e){e(t.value)}).then(r,n)}o((c=c.apply(i,a||[])).next())})},t.__generator=function(r,n){var o,i,a,e,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,i&&(a=2&t[0]?i.return:t[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,t[1])).done)return a;switch(i=0,a&&(t=[2&t[0],a.value]),t[0]){case 0:case 1:a=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,i=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]<a[3])){s.label=t[1];break}if(6===t[0]&&s.label<a[1]){s.label=a[1],a=t;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(t);break}a[2]&&s.ops.pop(),s.trys.pop();continue}t=n.call(r,s)}catch(e){t=[6,e],i=0}finally{o=a=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}},t.__exportStar=function(e,t){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])},t.__values=o,t.__read=i,t.__spread=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(i(arguments[t]));return e},t.__await=d,t.__asyncGenerator=function(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,i=r.apply(e,t||[]),a=[];return o={},n("next"),n("throw"),n("return"),o[Symbol.asyncIterator]=function(){return this},o;function n(n){i[n]&&(o[n]=function(r){return new Promise(function(e,t){1<a.push([n,r,e,t])||s(n,r)})})}function s(e,t){try{(r=i[e](t)).value instanceof d?Promise.resolve(r.value.v).then(c,u):l(a[0][2],r)}catch(e){l(a[0][3],e)}var r}function c(e){s("next",e)}function u(e){s("throw",e)}function l(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}},t.__asyncDelegator=function(n){var e,o;return e={},t("next"),t("throw",function(e){throw e}),t("return"),e[Symbol.iterator]=function(){return this},e;function t(t,r){e[t]=n[t]?function(e){return(o=!o)?{value:d(n[t](e)),done:"return"===t}:r?r(e):e}:r}},t.__asyncValues=function(c){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,t=c[Symbol.asyncIterator];return t?t.call(c):(c=o(c),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(s){e[s]=c[s]&&function(a){return new Promise(function(e,t){var r,n,o,i;a=c[s](a),r=e,n=t,o=a.done,i=a.value,Promise.resolve(i).then(function(e){r({value:e,done:o})},n)})}}},t.__makeTemplateObject=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},t.__importStar=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t},t.__importDefault=function(e){return e&&e.__esModule?e:{default:e}}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=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,"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,"idToken",{get:function(){return"id_token"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"adalIdToken",{get:function(){return"adal.idtoken"},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,"claims",{get:function(){return"claims"},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,"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,"msal",{get:function(){return"msal"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"no_account",{get:function(){return"NO_ACCOUNT"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"consumersUtid",{get:function(){return"9188040d-6c67-4c5b-b112-36a304b66dad"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"upn",{get:function(){return"upn"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"prompt_select_account",{get:function(){return"&prompt=select_account"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"prompt_none",{get:function(){return"&prompt=none"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"prompt",{get:function(){return"prompt"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"response_mode_fragment",{get:function(){return"&response_mode=fragment"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"resourceDelimiter",{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,"homeAccountIdentifier",{get:function(){return"homeAccountIdentifier"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"common",{get:function(){return"common"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"openidScope",{get:function(){return"openid"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"profileScope",{get:function(){return"profile"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"cacheLocationLocal",{get:function(){return"localStorage"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"cacheLocationSession",{get:function(){return"sessionStorage"},enumerable:!0,configurable:!0}),e._popUpWidth=483,e._popUpHeight=600,e}();t.Constants=n,t.CacheKeys={AUTHORITY:"msal.authority",ACQUIRE_TOKEN_ACCOUNT:"msal.acquireTokenAccount"},t.SSOTypes={ACCOUNT:"account",SID:"sid",LOGIN_HINT:"login_hint",ID_TOKEN:"id_token",DOMAIN_HINT:"domain_hint",ORGANIZATIONS:"organizations",CONSUMERS:"consumers",ACCOUNT_ID:"accountIdentifier",HOMEACCOUNT_ID:"homeAccountIdentifier",LOGIN_REQ:"login_req",DOMAIN_REQ:"domain_req"},t.PromptState={LOGIN:"login",SELECT_ACCOUNT:"select_account",CONSENT:"consent",NONE:"none"},t.Library={version:"1.0.2"}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(1),a=r(2),n=r(4);t.ClientConfigurationErrorMessage={configurationNotSet:{code:"no_config_set",desc:"Configuration has not been set. Please call the UserAgentApplication constructor with a valid Configuration object."},invalidCacheLocation:{code:"invalid_cache_location",desc:"The cache location provided is not valid."},noStorageSupported:{code:"browser_storage_not_supported",desc:"localStorage and sessionStorage are not supported."},noRedirectCallbacksSet:{code:"no_redirect_callbacks",desc:"No redirect callbacks have been set. Please call setRedirectCallbacks() with the appropriate function arguments before continuing. More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics."},invalidCallbackObject:{code:"invalid_callback_object",desc:"The object passed for the callback was invalid. More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics."},scopesRequired:{code:"scopes_required",desc:"Scopes are required to obtain an access token."},emptyScopes:{code:"empty_input_scopes_error",desc:"Scopes cannot be passed as empty array."},nonArrayScopes:{code:"nonarray_input_scopes_error",desc:"Scopes cannot be passed as non-array."},clientScope:{code:"clientid_input_scopes_error",desc:"Client ID can only be provided as a single scope."},invalidPrompt:{code:"invalid_prompt_value",desc:"Supported prompt values are 'login', 'select_account', 'consent' and 'none'"},invalidAuthorityType:{code:"invalid_authority_type",desc:"The given authority is not a valid type of authority supported by MSAL. Please see here for valid authorities: <insert URL here>."},authorityUriInsecure:{code:"authority_uri_insecure",desc:"Authority URIs must use https."},authorityUriInvalidPath:{code:"authority_uri_invalid_path",desc:"Given authority URI is invalid."},unsupportedAuthorityValidation:{code:"unsupported_authority_validation",desc:"The authority validation is not supported for this authority type."},b2cAuthorityUriInvalidPath:{code:"b2c_authority_uri_invalid_path",desc:"The given URI for the B2C authority is invalid."},claimsRequestParsingError:{code:"claims_request_parsing_error",desc:"Could not parse the given claims request object."}};var o=function(n){function o(e,t){var r=n.call(this,e,t)||this;return r.name="ClientConfigurationError",Object.setPrototypeOf(r,o.prototype),r}return i.__extends(o,n),o.createNoSetConfigurationError=function(){return new o(t.ClientConfigurationErrorMessage.configurationNotSet.code,""+t.ClientConfigurationErrorMessage.configurationNotSet.desc)},o.createInvalidCacheLocationConfigError=function(e){return new o(t.ClientConfigurationErrorMessage.invalidCacheLocation.code,t.ClientConfigurationErrorMessage.invalidCacheLocation.desc+" Provided value: "+e+". Possible values are: "+a.Constants.cacheLocationLocal+", "+a.Constants.cacheLocationSession+".")},o.createNoStorageSupportedError=function(){return new o(t.ClientConfigurationErrorMessage.noStorageSupported.code,t.ClientConfigurationErrorMessage.noStorageSupported.desc)},o.createRedirectCallbacksNotSetError=function(){return new o(t.ClientConfigurationErrorMessage.noRedirectCallbacksSet.code,t.ClientConfigurationErrorMessage.noRedirectCallbacksSet.desc)},o.createInvalidCallbackObjectError=function(e){return new o(t.ClientConfigurationErrorMessage.invalidCallbackObject.code,t.ClientConfigurationErrorMessage.invalidCallbackObject.desc+" Given value for callback function: "+e)},o.createEmptyScopesArrayError=function(e){return new o(t.ClientConfigurationErrorMessage.emptyScopes.code,t.ClientConfigurationErrorMessage.emptyScopes.desc+" Given value: "+e+".")},o.createScopesNonArrayError=function(e){return new o(t.ClientConfigurationErrorMessage.nonArrayScopes.code,t.ClientConfigurationErrorMessage.nonArrayScopes.desc+" Given value: "+e+".")},o.createClientIdSingleScopeError=function(e){return new o(t.ClientConfigurationErrorMessage.clientScope.code,t.ClientConfigurationErrorMessage.clientScope.desc+" Given value: "+e+".")},o.createScopesRequiredError=function(e){return new o(t.ClientConfigurationErrorMessage.scopesRequired.code,t.ClientConfigurationErrorMessage.scopesRequired.desc+" Given value: "+e)},o.createInvalidPromptError=function(e){return new o(t.ClientConfigurationErrorMessage.invalidPrompt.code,t.ClientConfigurationErrorMessage.invalidPrompt.desc+" Given value: "+e)},o.createClaimsRequestParsingError=function(e){return new o(t.ClientConfigurationErrorMessage.claimsRequestParsingError.code,t.ClientConfigurationErrorMessage.claimsRequestParsingError.desc+" Given value: "+e)},o}(n.ClientAuthError);t.ClientConfigurationError=o},function(e,r,t){Object.defineProperty(r,"__esModule",{value:!0});var i=t(1),n=t(5),a=t(0);r.ClientAuthErrorMessage={multipleMatchingTokens:{code:"multiple_matching_tokens",desc:"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements like authority."},multipleCacheAuthorities:{code:"multiple_authorities",desc:"Multiple authorities found in the cache. Pass authority in the API overload."},endpointResolutionError:{code:"endpoints_resolution_error",desc:"Error: could not resolve endpoints. Please check network and try again."},popUpWindowError:{code:"popup_window_error",desc:"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser."},tokenRenewalError:{code:"token_renewal_error",desc:"Token renewal operation failed due to timeout."},invalidIdToken:{code:"invalid_id_token",desc:"Invalid ID token format."},invalidStateError:{code:"invalid_state_error",desc:"Invalid state."},nonceMismatchError:{code:"nonce_mismatch_error",desc:"Nonce is not matching, Nonce received: "},loginProgressError:{code:"login_progress_error",desc:"Login_In_Progress: Error during login call - login is already in progress."},acquireTokenProgressError:{code:"acquiretoken_progress_error",desc:"AcquireToken_In_Progress: Error during login call - login is already in progress."},userCancelledError:{code:"user_cancelled",desc:"User cancelled the flow."},callbackError:{code:"callback_error",desc:"Error occurred in token received callback function."},userLoginRequiredError:{code:"user_login_error",desc:"User login is required."},userDoesNotExistError:{code:"user_non_existent",desc:"User object does not exist. Please call a login API."},clientInfoDecodingError:{code:"client_info_decoding_error",desc:"The client info could not be parsed/decoded correctly. Please review the trace to determine the root cause."},clientInfoNotPopulatedError:{code:"client_info_not_populated_error",desc:"The service did not populate client_info in the response, Please verify with the service team"},nullOrEmptyIdToken:{code:"null_or_empty_id_token",desc:"The idToken is null or empty. Please review the trace to determine the root cause."},idTokenNotParsed:{code:"id_token_parsing_error",desc:"ID token cannot be parsed. Please review stack trace to determine root cause."},tokenEncodingError:{code:"token_encoding_error",desc:"The token to be decoded is not encoded correctly."}};var o=function(n){function o(e,t){var r=n.call(this,e,t)||this;return r.name="ClientAuthError",Object.setPrototypeOf(r,o.prototype),r}return i.__extends(o,n),o.createEndpointResolutionError=function(e){var t=r.ClientAuthErrorMessage.endpointResolutionError.desc;return e&&!a.Utils.isEmpty(e)&&(t+=" Details: "+e),new o(r.ClientAuthErrorMessage.endpointResolutionError.code,t)},o.createMultipleMatchingTokensInCacheError=function(e){return new o(r.ClientAuthErrorMessage.multipleMatchingTokens.code,"Cache error for scope "+e+": "+r.ClientAuthErrorMessage.multipleMatchingTokens.desc+".")},o.createMultipleAuthoritiesInCacheError=function(e){return new o(r.ClientAuthErrorMessage.multipleCacheAuthorities.code,"Cache error for scope "+e+": "+r.ClientAuthErrorMessage.multipleCacheAuthorities.desc+".")},o.createPopupWindowError=function(e){var t=r.ClientAuthErrorMessage.popUpWindowError.desc;return e&&!a.Utils.isEmpty(e)&&(t+=" Details: "+e),new o(r.ClientAuthErrorMessage.popUpWindowError.code,t)},o.createTokenRenewalTimeoutError=function(){return new o(r.ClientAuthErrorMessage.tokenRenewalError.code,r.ClientAuthErrorMessage.tokenRenewalError.desc)},o.createInvalidIdTokenError=function(e){return new o(r.ClientAuthErrorMessage.invalidIdToken.code,r.ClientAuthErrorMessage.invalidIdToken.desc+" Given token: "+e)},o.createInvalidStateError=function(e,t){return new o(r.ClientAuthErrorMessage.invalidStateError.code,r.ClientAuthErrorMessage.invalidStateError.desc+" "+e+", state expected : "+t+".")},o.createNonceMismatchError=function(e,t){return new o(r.ClientAuthErrorMessage.nonceMismatchError.code,r.ClientAuthErrorMessage.nonceMismatchError.desc+" "+e+", nonce expected : "+t+".")},o.createLoginInProgressError=function(){return new o(r.ClientAuthErrorMessage.loginProgressError.code,r.ClientAuthErrorMessage.loginProgressError.desc)},o.createAcquireTokenInProgressError=function(){return new o(r.ClientAuthErrorMessage.acquireTokenProgressError.code,r.ClientAuthErrorMessage.acquireTokenProgressError.desc)},o.createUserCancelledError=function(){return new o(r.ClientAuthErrorMessage.userCancelledError.code,r.ClientAuthErrorMessage.userCancelledError.desc)},o.createErrorInCallbackFunction=function(e){return new o(r.ClientAuthErrorMessage.callbackError.code,r.ClientAuthErrorMessage.callbackError.desc+" "+e+".")},o.createUserLoginRequiredError=function(){return new o(r.ClientAuthErrorMessage.userLoginRequiredError.code,r.ClientAuthErrorMessage.userLoginRequiredError.desc)},o.createUserDoesNotExistError=function(){return new o(r.ClientAuthErrorMessage.userDoesNotExistError.code,r.ClientAuthErrorMessage.userDoesNotExistError.desc)},o.createClientInfoDecodingError=function(e){return new o(r.ClientAuthErrorMessage.clientInfoDecodingError.code,r.ClientAuthErrorMessage.clientInfoDecodingError.desc+" Failed with error: "+e)},o.createClientInfoNotPopulatedError=function(e){return new o(r.ClientAuthErrorMessage.clientInfoNotPopulatedError.code,r.ClientAuthErrorMessage.clientInfoNotPopulatedError.desc+" Failed with error: "+e)},o.createIdTokenNullOrEmptyError=function(e){return new o(r.ClientAuthErrorMessage.nullOrEmptyIdToken.code,r.ClientAuthErrorMessage.nullOrEmptyIdToken.desc+" Raw ID Token Value: "+e)},o.createIdTokenParsingError=function(e){return new o(r.ClientAuthErrorMessage.idTokenNotParsed.code,r.ClientAuthErrorMessage.idTokenNotParsed.desc+" Failed with error: "+e)},o.createTokenEncodingError=function(e){return new o(r.ClientAuthErrorMessage.tokenEncodingError.code,r.ClientAuthErrorMessage.tokenEncodingError.desc+" Attempted to decode: "+e)},o}(n.AuthError);r.ClientAuthError=o},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(1);t.AuthErrorMessage={unexpectedError:{code:"unexpected_error",desc:"Unexpected error in authentication."}};var n=function(n){function o(e,t){var r=n.call(this,t)||this;return Object.setPrototypeOf(r,o.prototype),r.errorCode=e,r.errorMessage=t,r.name="AuthError",r}return i.__extends(o,n),o.createUnexpectedError=function(e){return new o(t.AuthErrorMessage.unexpectedError.code,t.AuthErrorMessage.unexpectedError.desc+": "+e)},o}(Error);t.AuthError=n},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(0),i=r(3),a=r(12);(n=t.AuthorityType||(t.AuthorityType={}))[n.Aad=0]="Aad",n[n.Adfs=1]="Adfs",n[n.B2C=2]="B2C";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=o.Utils.CanonicalizeUri(e),this.canonicalAuthorityUrlComponents=null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CanonicalAuthorityUrlComponents",{get:function(){return this.canonicalAuthorityUrlComponents||(this.canonicalAuthorityUrlComponents=o.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 i.ClientConfigurationErrorMessage.invalidAuthorityType}if(!e.Protocol||"https:"!==e.Protocol.toLowerCase())throw i.ClientConfigurationErrorMessage.authorityUriInsecure;if(!e.PathSegments||e.PathSegments.length<1)throw i.ClientConfigurationErrorMessage.authorityUriInvalidPath},e.prototype.DiscoverEndpoints=function(e){return(new a.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 t=this,r="";return this.GetOpenIdConfigurationEndpointAsync().then(function(e){return r=e,t.DiscoverEndpoints(r)}).then(function(e){return t.tenantDiscoveryResponse=e,t})},e}();t.Authority=s},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var c,n,i=r(0);(n=c=t.LogLevel||(t.LogLevel={}))[n.Error=0]="Error",n[n.Warning=1]="Warning",n[n.Info=2]="Info",n[n.Verbose=3]="Verbose";var o=function(){function e(e,t){void 0===t&&(t={}),this.level=c.Info;var r=t.correlationId,n=void 0===r?"":r,o=t.level,i=void 0===o?c.Info:o,a=t.piiLoggingEnabled,s=void 0!==a&&a;this.localCallback=e,this.correlationId=n,this.level=i,this.piiLoggingEnabled=s}return e.prototype.logMessage=function(e,t,r){if(!(e>this.level||!this.piiLoggingEnabled&&r)){var n,o=(new Date).toUTCString();n=i.Utils.isEmpty(this.correlationId)?o+":"+i.Utils.getLibraryVersion()+"-"+c[e]+" "+t:o+":"+this.correlationId+"-"+i.Utils.getLibraryVersion()+"-"+c[e]+" "+t,this.executeCallback(e,n,r)}},e.prototype.executeCallback=function(e,t,r){this.localCallback&&this.localCallback(e,t,r)},e.prototype.error=function(e){this.logMessage(c.Error,e,!1)},e.prototype.errorPii=function(e){this.logMessage(c.Error,e,!0)},e.prototype.warning=function(e){this.logMessage(c.Warning,e,!1)},e.prototype.warningPii=function(e){this.logMessage(c.Warning,e,!0)},e.prototype.info=function(e){this.logMessage(c.Info,e,!1)},e.prototype.infoPii=function(e){this.logMessage(c.Info,e,!0)},e.prototype.verbose=function(e){this.logMessage(c.Verbose,e,!1)},e.prototype.verbosePii=function(e){this.logMessage(c.Verbose,e,!0)},e}();t.Logger=o},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var i=r(1),n=r(5);t.ServerErrorMessage={serverUnavailable:{code:"server_unavailable",desc:"Server is temporarily unavailable."},unknownServerError:{code:"unknown_server_error"}};var o=function(n){function o(e,t){var r=n.call(this,e,t)||this;return r.name="ServerError",Object.setPrototypeOf(r,o.prototype),r}return i.__extends(o,n),o.createServerUnavailableError=function(){return new o(t.ServerErrorMessage.serverUnavailable.code,t.ServerErrorMessage.serverUnavailable.desc)},o.createUnknownServerError=function(e){return new o(t.ServerErrorMessage.unknownServerError.code,e)},o}(n.AuthError);t.ServerError=o},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var m=r(1),y=r(19),C=r(22),p=r(23),v=r(24),b=r(2),w=r(25),I=r(26),S=r(10),E=r(0),g=r(28),n=r(13),a=r(14),s=r(3),A=r(5),k=r(4),T=r(8),_=r(15),c=r(16),l="id_token",o="token",i="id_token token",u=function(){function e(e){this.authResponseCallback=null,this.tokenReceivedCallback=null,this.errorReceivedCallback=null,this.config=n.buildConfiguration(e),this.redirectCallbacksSet=!1,this.logger=this.config.system.logger,this.clientId=this.config.auth.clientId,this.inCookie=this.config.cache.storeAuthStateInCookie,this.authority=this.config.auth.authority||"https://login.microsoftonline.com/common",this.loginInProgress=!1,this.acquireTokenInProgress=!1;try{this.cacheStorage=new I.Storage(this.config.cache.cacheLocation)}catch(e){throw s.ClientConfigurationError.createInvalidCacheLocationConfigError(this.config.cache.cacheLocation)}window.openedWindows=[],window.activeRenewals={},window.renewStates=[],window.callbackMappedToRenewStates={},window.promiseMappedToRenewStates={},window.msal=this;var t=window.location.hash,r=this.isCallback(t);this.config.framework.isAngular||r&&this.handleAuthenticationResponse(t)}return Object.defineProperty(e.prototype,"authority",{get:function(){return this.authorityInstance.CanonicalAuthority},set:function(e){this.authorityInstance=g.AuthorityFactory.CreateInstance(e,this.config.auth.validateAuthority)},enumerable:!0,configurable:!0}),e.prototype.getAuthorityInstance=function(){return this.authorityInstance},e.prototype.handleRedirectCallback=function(e,t){if(!e)throw this.redirectCallbacksSet=!1,s.ClientConfigurationError.createInvalidCallbackObjectError(e);if(t?(this.tokenReceivedCallback=e,this.errorReceivedCallback=t,this.logger.warning("This overload for callback is deprecated - please change the format of the callbacks to a single callback as shown: (err: AuthError, response: AuthResponse).")):this.authResponseCallback=e,this.redirectCallbacksSet=!0,!this.config.framework.isAngular){var r=this.cacheStorage.getItem(b.Constants.urlHash);r&&this.processCallBack(r,null)}},e.prototype.redirectSuccessHandler=function(e){this.errorReceivedCallback?this.tokenReceivedCallback(e):this.authResponseCallback&&this.authResponseCallback(null,e)},e.prototype.redirectErrorHandler=function(e,t){this.errorReceivedCallback?this.errorReceivedCallback(e,t.accountState):this.authResponseCallback(e,t)},e.prototype.loginRedirect=function(t){var r=this;if(!this.redirectCallbacksSet)throw s.ClientConfigurationError.createRedirectCallbacksNotSetError();if(this.loginInProgress)this.redirectErrorHandler(k.ClientAuthError.createLoginInProgressError(),c.buildResponseStateOnly(t&&t.state));else{var n=this.appendScopes(t);this.validateInputScope(n,!1);var e=this.getAccount();if(E.Utils.isSSOParam(t))this.loginRedirectHelper(e,t,n);else if(this.extractADALIdToken()&&!n){this.logger.info("ADAL's idToken exists. Extracting login information from ADAL's idToken ");var o=this.buildIDTokenRequest(t);this.silentLogin=!0,this.acquireTokenSilent(o).then(function(e){r.silentLogin=!1,r.logger.info("Unified cache call is successful"),r.redirectCallbacksSet&&r.redirectSuccessHandler(e)},function(e){r.silentLogin=!1,r.logger.error("Error occurred during unified cache ATS"),r.loginRedirectHelper(null,t,n)})}else this.loginRedirectHelper(null,t,n)}},e.prototype.loginRedirectHelper=function(n,o,i){var a=this;this.loginInProgress=!0,this.authorityInstance.resolveEndpointsAsync().then(function(){var e=new p.ServerRequestParameters(a.authorityInstance,a.clientId,i,l,a.getRedirectUri(),o&&o.state);e=a.populateQueryParams(n,o,e);var t=a.cacheStorage.getItem(b.Constants.angularLoginRequest);t&&""!==t?a.cacheStorage.setItem(b.Constants.angularLoginRequest,""):t=window.location.href,a.updateCacheEntries(e,n,t);var r=e.createNavigateUrl(i)+b.Constants.response_mode_fragment;a.promptUser(r)}).catch(function(e){a.logger.warning("could not resolve endpoints"),a.redirectErrorHandler(k.ClientAuthError.createEndpointResolutionError(e.toString),c.buildResponseStateOnly(o&&o.state))})},e.prototype.acquireTokenRedirect=function(r){var n=this;if(!this.redirectCallbacksSet)throw s.ClientConfigurationError.createRedirectCallbacksNotSetError();this.validateInputScope(r.scopes,!0);var o=r.account||this.getAccount();if(this.acquireTokenInProgress)this.redirectErrorHandler(k.ClientAuthError.createAcquireTokenInProgressError(),c.buildResponseStateOnly(this.getAccountState(r.state)));else{if(!o&&!r.sid&&!r.loginHint)throw this.logger.info("User login is required"),k.ClientAuthError.createUserLoginRequiredError();var i,a=r.authority?g.AuthorityFactory.CreateInstance(r.authority,this.config.auth.validateAuthority):this.authorityInstance;this.acquireTokenInProgress=!0,a.resolveEndpointsAsync().then(function(){var e=n.getTokenType(o,r.scopes,!1);i=new p.ServerRequestParameters(a,n.clientId,r.scopes,e,n.getRedirectUri(),r.state),n.updateCacheEntries(i,o);var t=(i=n.populateQueryParams(o,r,i)).createNavigateUrl(r.scopes)+b.Constants.response_mode_fragment;t&&(n.cacheStorage.setItem(b.Constants.stateAcquireToken,i.state,n.inCookie),window.location.replace(t))}).catch(function(e){n.logger.warning("could not resolve endpoints"),n.redirectErrorHandler(k.ClientAuthError.createEndpointResolutionError(e.toString),c.buildResponseStateOnly(r.state))})}},e.prototype.isCallback=function(e){e=this.getHash(e);var t=E.Utils.deserialize(e);return t.hasOwnProperty(b.Constants.errorDescription)||t.hasOwnProperty(b.Constants.error)||t.hasOwnProperty(b.Constants.accessToken)||t.hasOwnProperty(b.Constants.idToken)},e.prototype.loginPopup=function(i){var a=this;return new Promise(function(t,r){if(a.loginInProgress)return r(k.ClientAuthError.createLoginInProgressError());var n=a.appendScopes(i);a.validateInputScope(n,!1);var e=a.getAccount();if(E.Utils.isSSOParam(i))a.loginPopupHelper(e,t,r,i,n);else if(a.extractADALIdToken()&&!n){a.logger.info("ADAL's idToken exists. Extracting login information from ADAL's idToken ");var o=a.buildIDTokenRequest(i);a.silentLogin=!0,a.acquireTokenSilent(o).then(function(e){a.silentLogin=!1,a.logger.info("Unified cache call is successful"),t(e)},function(e){a.silentLogin=!1,a.logger.error("Error occurred during unified cache ATS"),a.loginPopupHelper(null,t,r,i,n)})}else a.loginPopupHelper(null,t,r,i,n)})},e.prototype.loginPopupHelper=function(r,n,o,i,a){var s=this;a||(a=[this.clientId]);var c=a.join(" ").toLowerCase(),u=this.openWindow("about:blank","_blank",1,this,n,o);u&&(this.loginInProgress=!0,this.authorityInstance.resolveEndpointsAsync().then(function(){var e=new p.ServerRequestParameters(s.authorityInstance,s.clientId,a,l,s.getRedirectUri(),i&&i.state);e=s.populateQueryParams(r,i,e),s.updateCacheEntries(e,r,window.location.href),s.cacheStorage.setItem(b.Constants.loginRequest,window.location.href,s.inCookie),s.cacheStorage.setItem(b.Constants.loginError,""),s.cacheStorage.setItem(b.Constants.nonceIdToken,e.nonce,s.inCookie),s.cacheStorage.setItem(b.Constants.msalError,""),s.cacheStorage.setItem(b.Constants.msalErrorDescription,""),s.setAuthorityCache(e.state,s.authority);var t=e.createNavigateUrl(a)+b.Constants.response_mode_fragment;window.renewStates.push(e.state),window.requestType=b.Constants.login,s.registerCallback(e.state,c,n,o),u&&(s.logger.infoPii("Navigated Popup window to:"+t),u.location.href=t)},function(){s.logger.info(k.ClientAuthErrorMessage.endpointResolutionError.code+":"+k.ClientAuthErrorMessage.endpointResolutionError.desc),s.cacheStorage.setItem(b.Constants.msalError,k.ClientAuthErrorMessage.endpointResolutionError.code),s.cacheStorage.setItem(b.Constants.msalErrorDescription,k.ClientAuthErrorMessage.endpointResolutionError.desc),o&&o(k.ClientAuthError.createEndpointResolutionError()),u&&u.close()}).catch(function(e){s.logger.warning("could not resolve endpoints"),o(k.ClientAuthError.createEndpointResolutionError(e.toString))}))},e.prototype.acquireTokenPopup=function(u){var l=this;return new Promise(function(r,n){l.validateInputScope(u.scopes,!0);var o,i=u.scopes.join(" ").toLowerCase(),a=u.account||l.getAccount();if(l.acquireTokenInProgress)return n(k.ClientAuthError.createAcquireTokenInProgressError());if(!a&&!u.sid&&!u.loginHint)return l.logger.info("User login is required"),n(k.ClientAuthError.createUserLoginRequiredError());l.acquireTokenInProgress=!0;var s=u.authority?g.AuthorityFactory.CreateInstance(u.authority,l.config.auth.validateAuthority):l.authorityInstance,c=l.openWindow("about:blank","_blank",1,l,r,n);c&&s.resolveEndpointsAsync().then(function(){var e=l.getTokenType(a,u.scopes,!1);o=new p.ServerRequestParameters(s,l.clientId,u.scopes,e,l.getRedirectUri(),u.state),o=l.populateQueryParams(a,u,o),l.updateCacheEntries(o,a);var t=o.createNavigateUrl(u.scopes)+b.Constants.response_mode_fragment;window.renewStates.push(o.state),window.requestType=b.Constants.renewToken,l.registerCallback(o.state,i,r,n),c&&(c.location.href=t)},function(){l.logger.info(k.ClientAuthErrorMessage.endpointResolutionError.code+":"+k.ClientAuthErrorMessage.endpointResolutionError.desc),l.cacheStorage.setItem(b.Constants.msalError,k.ClientAuthErrorMessage.endpointResolutionError.code),l.cacheStorage.setItem(b.Constants.msalErrorDescription,k.ClientAuthErrorMessage.endpointResolutionError.desc),n&&n(k.ClientAuthError.createEndpointResolutionError()),c&&c.close()}).catch(function(e){l.logger.warning("could not resolve endpoints"),n(k.ClientAuthError.createEndpointResolutionError(e.toString()))})})},e.prototype.openWindow=function(e,t,r,n,o,i){var a,s=this;try{a=this.openPopup(e,t,b.Constants.popUpWidth,b.Constants.popUpHeight)}catch(e){return n.loginInProgress=!1,n.acquireTokenInProgress=!1,this.logger.info(k.ClientAuthErrorMessage.popUpWindowError.code+":"+k.ClientAuthErrorMessage.popUpWindowError.desc),this.cacheStorage.setItem(b.Constants.msalError,k.ClientAuthErrorMessage.popUpWindowError.code),this.cacheStorage.setItem(b.Constants.msalErrorDescription,k.ClientAuthErrorMessage.popUpWindowError.desc),i&&i(k.ClientAuthError.createPopupWindowError()),null}window.openedWindows.push(a);var c=window.setInterval(function(){if(a&&a.closed&&(n.loginInProgress||n.acquireTokenInProgress)){if(i&&i(k.ClientAuthError.createUserCancelledError()),window.clearInterval(c),s.config.framework.isAngular)return void s.broadcast("msal:popUpClosed",k.ClientAuthErrorMessage.userCancelledError.code+b.Constants.resourceDelimiter+k.ClientAuthErrorMessage.userCancelledError.desc);n.loginInProgress=!1,n.acquireTokenInProgress=!1}try{var e=a.location;if(-1!==e.href.indexOf(s.getRedirectUri())&&(window.clearInterval(c),n.loginInProgress=!1,n.acquireTokenInProgress=!1,s.logger.info("Closing popup window"),s.config.framework.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.openPopup=function(e,t,r,n){try{var o=window.screenLeft?window.screenLeft:window.screenX,i=window.screenTop?window.screenTop:window.screenY,a=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,s=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,c=a/2-r/2+o,u=s/2-n/2+i,l=window.open(e,t,"width="+r+", height="+n+", top="+u+", left="+c);if(!l)throw k.ClientAuthError.createPopupWindowError();return l.focus&&l.focus(),l}catch(e){throw this.logger.error("error opening popup "+e.message),this.loginInProgress=!1,this.acquireTokenInProgress=!1,k.ClientAuthError.createPopupWindowError(e.toString())}},e.prototype.acquireTokenSilent=function(d){var h=this;return new Promise(function(e,t){h.validateInputScope(d.scopes,!0);var r=d.scopes.join(" ").toLowerCase(),n=d.account||h.getAccount(),o=h.cacheStorage.getItem(b.Constants.adalIdToken);if(!n&&!d.sid&&!d.loginHint&&E.Utils.isEmpty(o))return h.logger.info("User login is required"),t(k.ClientAuthError.createUserLoginRequiredError());var i=h.getTokenType(n,d.scopes,!0),a=new p.ServerRequestParameters(g.AuthorityFactory.CreateInstance(d.authority,h.config.auth.validateAuthority),h.clientId,d.scopes,i,h.getRedirectUri(),d&&d.state);if(E.Utils.isSSOParam(d)||n)a=h.populateQueryParams(n,d,a);else if(!n&&!E.Utils.isEmpty(o)){var s=E.Utils.extractIdToken(o);h.logger.verbose("ADAL's idToken exists. Extracting login information from ADAL's idToken "),a=h.populateQueryParams(n,null,a,s)}var c,u,l=d.claimsRequest||a.claimsValue;if(!l)try{u=h.getCachedToken(a,n)}catch(e){c=e}return u?(h.logger.info("Token is already in cache for scope:"+r),e(u),null):c?(h.logger.infoPii(c.errorCode+":"+c.errorMessage),t(c),null):(l?h.logger.verbose("Skipped cache lookup since claims were given."):h.logger.verbose("Token is not in cache for scope:"+r),a.authorityInstance||(a.authorityInstance=d.authority?g.AuthorityFactory.CreateInstance(d.authority,h.config.auth.validateAuthority):h.authorityInstance),a.authorityInstance.resolveEndpointsAsync().then(function(){window.activeRenewals[r]?(h.logger.verbose("Renew token for scope: "+r+" is in progress. Registering callback"),h.registerCallback(window.activeRenewals[r],r,e,t)):d.scopes&&-1<d.scopes.indexOf(h.clientId)&&1===d.scopes.length?(h.logger