jplan-pack 0.6.704 → 0.6.705
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AuthFailRoute-300Chibi.js +1 -0
- package/dist/{AuthFailRoute-BNfsMQrE.mjs → AuthFailRoute-BDI4nIKK.mjs} +11 -9
- package/dist/{AuthRoute-BGNB5fSJ.mjs → AuthRoute-Bpx-a9Du.mjs} +12 -9
- package/dist/AuthRoute-BukX2xM4.js +1 -0
- package/dist/AuthRoute.css +1 -1
- package/dist/{index-BTBPJUpt.js → index-CETrAqjE.js} +1 -1
- package/dist/{index-DBAtzXUA.mjs → index-CGhUrRJf.mjs} +2 -2
- package/dist/jplan-pack.cjs.js +1 -1
- package/dist/jplan-pack.es.js +1 -1
- package/package.json +1 -1
- package/dist/AuthFailRoute-D0neuLsM.js +0 -1
- package/dist/AuthFailRoute.css +0 -1
- package/dist/AuthRoute-fNo2KFNW.js +0 -1
@@ -110,4 +110,4 @@ Error Description: ${a.errorMessage}`);else{const c=a;this.logger.error(`A non-M
|
|
110
110
|
Error: ${c.name}
|
111
111
|
Error Description: ${c.message}`)}return null}return r||(this.logger.warning("The developer's authority was not found within the CloudInstanceDiscoveryMetadata returned from the network request."),this.logger.verbose("Creating custom Authority for custom domain scenario."),r=Qt.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)),r}isInKnownAuthorities(){return this.authorityOptions.knownAuthorities.filter(t=>t&&Me.getDomainFromUrl(t).toLowerCase()===this.hostnameAndPort).length>0}static generateAuthority(e,t){let r;if(t&&t.azureCloudInstance!==jf.None){const o=t.tenant?t.tenant:B.DEFAULT_COMMON_TENANT;r=`${t.azureCloudInstance}/${o}/`}return r||e}static createCloudDiscoveryMetadataFromHost(e){return{preferred_network:e,preferred_cache:e,aliases:[e]}}getPreferredCache(){if(this.managedIdentity)return B.DEFAULT_AUTHORITY_HOST;if(this.discoveryComplete())return this.metadata.preferred_cache;throw Y(io)}isAlias(e){return this.metadata.aliases.indexOf(e)>-1}isAliasOfKnownMicrosoftAuthority(e){return Iw.has(e)}static isPublicCloudAuthority(e){return B.KNOWN_PUBLIC_CLOUDS.indexOf(e)>=0}static buildRegionalAuthorityString(e,t,r){const o=new Me(e);o.validateAsUri();const a=o.getUrlComponents();let c=`${t}.${a.HostNameAndPort}`;this.isPublicCloudAuthority(a.HostNameAndPort)&&(c=`${t}.${B.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX}`);const d=Me.constructAuthorityUriFromObject({...o.getUrlComponents(),HostNameAndPort:c}).urlString;return r?`${d}?${r}`:d}static replaceWithRegionalInformation(e,t){const r={...e};return r.authorization_endpoint=Qt.buildRegionalAuthorityString(r.authorization_endpoint,t),r.token_endpoint=Qt.buildRegionalAuthorityString(r.token_endpoint,t),r.end_session_endpoint&&(r.end_session_endpoint=Qt.buildRegionalAuthorityString(r.end_session_endpoint,t)),r}static transformCIAMAuthority(e){let t=e;const o=new Me(e).getUrlComponents();if(o.PathSegments.length===0&&o.HostNameAndPort.endsWith(B.CIAM_AUTH_URL)){const a=o.HostNameAndPort.split(".")[0];t=`${t}${a}${B.AAD_TENANT_DOMAIN_SUFFIX}`}return t}}Qt.reservedTenantDomains=new Set(["{tenant}","{tenantid}",Vo.COMMON,Vo.CONSUMERS,Vo.ORGANIZATIONS]);function f2(n){var o;const r=(o=new Me(n).getUrlComponents().PathSegments.slice(-1)[0])==null?void 0:o.toLowerCase();switch(r){case Vo.COMMON:case Vo.ORGANIZATIONS:case Vo.CONSUMERS:return;default:return r}}function Nw(n){return n.endsWith(B.FORWARD_SLASH)?n:`${n}${B.FORWARD_SLASH}`}function m2(n){const e=n.cloudDiscoveryMetadata;let t;if(e)try{t=JSON.parse(e)}catch{throw Qe(Zf)}return{canonicalAuthority:n.authority?Nw(n.authority):void 0,knownAuthorities:n.knownAuthorities,cloudDiscoveryMetadata:t}}/*! @azure/msal-common v14.16.0 2024-11-05 */async function Rw(n,e,t,r,o,a,c){c==null||c.addQueueMeasurement(x.AuthorityFactoryCreateDiscoveredInstance,a);const d=Qt.transformCIAMAuthority(Nw(n)),h=new Qt(d,e,t,r,o,a,c);try{return await J(h.resolveEndpointsAsync.bind(h),x.AuthorityResolveEndpointsAsync,o,c,a)(),h}catch{throw Y(io)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class Ko extends ct{constructor(e,t,r,o,a){super(e,t,r),this.name="ServerError",this.errorNo=o,this.status=a,Object.setPrototypeOf(this,Ko.prototype)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class xr{static generateThrottlingStorageKey(e){return`${gs.THROTTLING_PREFIX}.${JSON.stringify(e)}`}static preProcess(e,t){var a;const r=xr.generateThrottlingStorageKey(t),o=e.getThrottlingCache(r);if(o){if(o.throttleTime<Date.now()){e.removeItem(r);return}throw new Ko(((a=o.errorCodes)==null?void 0:a.join(" "))||B.EMPTY_STRING,o.errorMessage,o.subError)}}static postProcess(e,t,r){if(xr.checkResponseStatus(r)||xr.checkResponseForRetryAfter(r)){const o={throttleTime:xr.calculateThrottleTime(parseInt(r.headers[un.RETRY_AFTER])),error:r.body.error,errorCodes:r.body.error_codes,errorMessage:r.body.error_description,subError:r.body.suberror};e.setThrottlingCache(xr.generateThrottlingStorageKey(t),o)}}static checkResponseStatus(e){return e.status===429||e.status>=500&&e.status<600}static checkResponseForRetryAfter(e){return e.headers?e.headers.hasOwnProperty(un.RETRY_AFTER)&&(e.status<200||e.status>=300):!1}static calculateThrottleTime(e){const t=e<=0?0:e,r=Date.now()/1e3;return Math.floor(Math.min(r+(t||gs.DEFAULT_THROTTLE_TIME_SECONDS),r+gs.DEFAULT_MAX_THROTTLE_TIME_SECONDS)*1e3)}static removeThrottle(e,t,r,o){const a={clientId:t,authority:r.authority,scopes:r.scopes,homeAccountIdentifier:o,claims:r.claims,authenticationScheme:r.authenticationScheme,resourceRequestMethod:r.resourceRequestMethod,resourceRequestUri:r.resourceRequestUri,shrClaims:r.shrClaims,sshKid:r.sshKid},c=this.generateThrottlingStorageKey(a);e.removeItem(c)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class cu extends ct{constructor(e,t,r){super(e.errorCode,e.errorMessage,e.subError),Object.setPrototypeOf(this,cu.prototype),this.name="NetworkError",this.error=e,this.httpStatus=t,this.responseHeaders=r}}function jv(n,e,t){return new cu(n,e,t)}/*! @azure/msal-common v14.16.0 2024-11-05 */class am{constructor(e,t){this.config=bV(e),this.logger=new $o(this.config.loggerOptions,iw,Yf),this.cryptoUtils=this.config.cryptoInterface,this.cacheManager=this.config.storageInterface,this.networkClient=this.config.networkInterface,this.serverTelemetryManager=this.config.serverTelemetryManager,this.authority=this.config.authOptions.authority,this.performanceClient=t}createTokenRequestHeaders(e){const t={};if(t[un.CONTENT_TYPE]=B.URL_FORM_CONTENT_TYPE,!this.config.systemOptions.preventCorsPreflight&&e)switch(e.type){case Un.HOME_ACCOUNT_ID:try{const r=da(e.credential);t[un.CCS_HEADER]=`Oid:${r.uid}@${r.utid}`}catch(r){this.logger.verbose("Could not parse home account ID for CCS Header: "+r)}break;case Un.UPN:t[un.CCS_HEADER]=`UPN: ${e.credential}`;break}return t}async executePostToTokenEndpoint(e,t,r,o,a,c){var h;c&&((h=this.performanceClient)==null||h.addQueueMeasurement(c,a));const d=await this.sendPostRequest(o,e,{body:t,headers:r},a);return this.config.serverTelemetryManager&&d.status<500&&d.status!==429&&this.config.serverTelemetryManager.clearTelemetryCache(),d}async sendPostRequest(e,t,r,o){var c,d,h;xr.preProcess(this.cacheManager,e);let a;try{a=await J(this.networkClient.sendPostRequestAsync.bind(this.networkClient),x.NetworkClientSendPostRequestAsync,this.logger,this.performanceClient,o)(t,r);const f=a.headers||{};(d=this.performanceClient)==null||d.addFields({refreshTokenSize:((c=a.body.refresh_token)==null?void 0:c.length)||0,httpVerToken:f[un.X_MS_HTTP_VERSION]||"",requestId:f[un.X_MS_REQUEST_ID]||""},o)}catch(f){if(f instanceof cu){const g=f.responseHeaders;throw g&&((h=this.performanceClient)==null||h.addFields({httpVerToken:g[un.X_MS_HTTP_VERSION]||"",requestId:g[un.X_MS_REQUEST_ID]||"",contentTypeHeader:g[un.CONTENT_TYPE]||void 0,contentLengthHeader:g[un.CONTENT_LENGTH]||void 0,httpStatus:f.httpStatus},o)),f.error}throw f instanceof ct?f:Y(WE)}return xr.postProcess(this.cacheManager,e,a),a}async updateAuthority(e,t){var a;(a=this.performanceClient)==null||a.addQueueMeasurement(x.UpdateTokenEndpointAuthority,t);const r=`https://${e}/${this.authority.tenant}/`,o=await Rw(r,this.networkClient,this.cacheManager,this.authority.options,this.logger,t,this.performanceClient);this.authority=o}createTokenQueryParameters(e){const t=new ps(e.correlationId,this.performanceClient);return e.embeddedClientId&&t.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenQueryParameters&&t.addExtraQueryParameters(e.tokenQueryParameters),t.addCorrelationId(e.correlationId),t.createQueryString()}}/*! @azure/msal-common v14.16.0 2024-11-05 */const Pl="no_tokens_found",Ow="native_account_unavailable",sm="refresh_token_expired",g2="interaction_required",p2="consent_required",_2="login_required",lu="bad_token";/*! @azure/msal-common v14.16.0 2024-11-05 */const Jv=[g2,p2,_2,lu],v2=["message_only","additional_action","basic_action","user_password_expired","consent_required","bad_token"],y2={[Pl]:"No refresh token found in the cache. Please sign-in.",[Ow]:"The requested account is not available in the native broker. It may have been deleted or logged out. Please sign-in again using an interactive API.",[sm]:"Refresh token has expired.",[lu]:"Identity provider returned bad_token due to an expired or invalid refresh token. Please invoke an interactive API to resolve."};class Cr extends ct{constructor(e,t,r,o,a,c,d,h){super(e,t,r),Object.setPrototypeOf(this,Cr.prototype),this.timestamp=o||B.EMPTY_STRING,this.traceId=a||B.EMPTY_STRING,this.correlationId=c||B.EMPTY_STRING,this.claims=d||B.EMPTY_STRING,this.name="InteractionRequiredAuthError",this.errorNo=h}}function Qv(n,e,t){const r=!!n&&Jv.indexOf(n)>-1,o=!!t&&v2.indexOf(t)>-1,a=!!e&&Jv.some(c=>e.indexOf(c)>-1);return r||a||o}function Xh(n){return new Cr(n,y2[n])}/*! @azure/msal-common v14.16.0 2024-11-05 */class vr{static setRequestState(e,t,r){const o=vr.generateLibraryState(e,r);return t?`${o}${B.RESOURCE_DELIM}${t}`:o}static generateLibraryState(e,t){if(!e)throw Y(qh);const r={id:e.createNewGuid()};t&&(r.meta=t);const o=JSON.stringify(r);return e.base64Encode(o)}static parseRequestState(e,t){if(!e)throw Y(qh);if(!t)throw Y(Ca);try{const r=t.split(B.RESOURCE_DELIM),o=r[0],a=r.length>1?r.slice(1).join(B.RESOURCE_DELIM):B.EMPTY_STRING,c=e.base64Decode(o),d=JSON.parse(c);return{userRequestState:a||B.EMPTY_STRING,libraryState:d}}catch{throw Y(Ca)}}}/*! @azure/msal-common v14.16.0 2024-11-05 */const C2={SW:"sw",UHW:"uhw"};class wa{constructor(e,t){this.cryptoUtils=e,this.performanceClient=t}async generateCnf(e,t){var a;(a=this.performanceClient)==null||a.addQueueMeasurement(x.PopTokenGenerateCnf,e.correlationId);const r=await J(this.generateKid.bind(this),x.PopTokenGenerateCnf,t,this.performanceClient,e.correlationId)(e),o=this.cryptoUtils.base64UrlEncode(JSON.stringify(r));return{kid:r.kid,reqCnfString:o}}async generateKid(e){var r;return(r=this.performanceClient)==null||r.addQueueMeasurement(x.PopTokenGenerateKid,e.correlationId),{kid:await this.cryptoUtils.getPublicKeyThumbprint(e),xms_ksl:C2.SW}}async signPopToken(e,t,r){return this.signPayload(e,t,r)}async signPayload(e,t,r,o){const{resourceRequestMethod:a,resourceRequestUri:c,shrClaims:d,shrNonce:h,shrOptions:f}=r,g=c?new Me(c):void 0,v=g==null?void 0:g.getUrlComponents();return this.cryptoUtils.signJwt({at:e,ts:Wr(),m:a==null?void 0:a.toUpperCase(),u:v==null?void 0:v.HostNameAndPort,nonce:h||this.cryptoUtils.createNewGuid(),p:v==null?void 0:v.AbsolutePath,q:v!=null&&v.QueryString?[[],v.QueryString]:void 0,client_claims:d||void 0,...o},t,f,r.correlationId)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class E2{constructor(e,t){this.cache=e,this.hasChanged=t}get cacheHasChanged(){return this.hasChanged}get tokenCache(){return this.cache}}/*! @azure/msal-common v14.16.0 2024-11-05 */function w2(n){var r,o;const e="code=",t=(r=n.error_uri)==null?void 0:r.lastIndexOf(e);return t&&t>=0?(o=n.error_uri)==null?void 0:o.substring(t+e.length):void 0}class wi{constructor(e,t,r,o,a,c,d){this.clientId=e,this.cacheStorage=t,this.cryptoObj=r,this.logger=o,this.serializableCache=a,this.persistencePlugin=c,this.performanceClient=d}validateServerAuthorizationCodeResponse(e,t){if(!e.state||!t)throw e.state?Y(Sl,"Cached State"):Y(Sl,"Server State");let r,o;try{r=decodeURIComponent(e.state)}catch{throw Y(Ca,e.state)}try{o=decodeURIComponent(t)}catch{throw Y(Ca,e.state)}if(r!==o)throw Y(qE);if(e.error||e.error_description||e.suberror){const a=w2(e);throw Qv(e.error,e.error_description,e.suberror)?new Cr(e.error||"",e.error_description,e.suberror,e.timestamp||"",e.trace_id||"",e.correlation_id||"",e.claims||"",a):new Ko(e.error||"",e.error_description,e.suberror,a)}}validateTokenResponse(e,t){var r;if(e.error||e.error_description||e.suberror){const o=`Error(s): ${e.error_codes||B.NOT_AVAILABLE} - Timestamp: ${e.timestamp||B.NOT_AVAILABLE} - Description: ${e.error_description||B.NOT_AVAILABLE} - Correlation ID: ${e.correlation_id||B.NOT_AVAILABLE} - Trace ID: ${e.trace_id||B.NOT_AVAILABLE}`,a=(r=e.error_codes)!=null&&r.length?e.error_codes[0]:void 0,c=new Ko(e.error,o,e.suberror,a,e.status);if(t&&e.status&&e.status>=Vc.SERVER_ERROR_RANGE_START&&e.status<=Vc.SERVER_ERROR_RANGE_END){this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently unavailable and the access token is unable to be refreshed.
|
112
112
|
${c}`);return}else if(t&&e.status&&e.status>=Vc.CLIENT_ERROR_RANGE_START&&e.status<=Vc.CLIENT_ERROR_RANGE_END){this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently available but is unable to refresh the access token.
|
113
|
-
${c}`);return}throw Qv(e.error,e.error_description,e.suberror)?new Cr(e.error,e.error_description,e.suberror,e.timestamp||B.EMPTY_STRING,e.trace_id||B.EMPTY_STRING,e.correlation_id||B.EMPTY_STRING,e.claims||B.EMPTY_STRING,a):c}}async handleServerTokenResponse(e,t,r,o,a,c,d,h,f){var C;(C=this.performanceClient)==null||C.addQueueMeasurement(x.HandleServerTokenResponse,e.correlation_id);let g;if(e.id_token){if(g=Ii(e.id_token||B.EMPTY_STRING,this.cryptoObj.base64Decode),a&&a.nonce&&g.nonce!==a.nonce)throw Y(YE);if(o.maxAge||o.maxAge===0){const T=g.auth_time;if(!T)throw Y(Wf);aw(T,o.maxAge)}}this.homeAccountIdentifier=Ot.generateHomeAccountId(e.client_info||B.EMPTY_STRING,t.authorityType,this.logger,this.cryptoObj,g);let v;a&&a.state&&(v=vr.parseRequestState(this.cryptoObj,a.state)),e.key_id=e.key_id||o.sshKid||void 0;const p=this.generateCacheRecord(e,t,r,o,g,c,a);let w;try{if(this.persistencePlugin&&this.serializableCache&&(this.logger.verbose("Persistence enabled, calling beforeCacheAccess"),w=new E2(this.serializableCache,!0),await this.persistencePlugin.beforeCacheAccess(w)),d&&!h&&p.account){const T=p.account.generateAccountKey();if(!this.cacheStorage.getAccount(T,this.logger))return this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache"),await wi.generateAuthenticationResult(this.cryptoObj,t,p,!1,o,g,v,void 0,f)}await this.cacheStorage.saveCacheRecord(p,o.storeInCache,o.correlationId)}finally{this.persistencePlugin&&this.serializableCache&&w&&(this.logger.verbose("Persistence enabled, calling afterCacheAccess"),await this.persistencePlugin.afterCacheAccess(w))}return wi.generateAuthenticationResult(this.cryptoObj,t,p,!1,o,g,v,e,f)}generateCacheRecord(e,t,r,o,a,c,d){const h=t.getPreferredCache();if(!h)throw Y(Gf);const f=ww(a);let g,v;e.id_token&&a&&(g=ou(this.homeAccountIdentifier,h,e.id_token,this.clientId,f||""),v=cm(this.cacheStorage,t,this.homeAccountIdentifier,this.cryptoObj.base64Decode,a,e.client_info,h,f,d,void 0,this.logger));let p=null;if(e.access_token){const T=e.scope?_t.fromString(e.scope):new _t(o.scopes||[]),k=(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,I=(typeof e.ext_expires_in=="string"?parseInt(e.ext_expires_in,10):e.ext_expires_in)||0,N=(typeof e.refresh_in=="string"?parseInt(e.refresh_in,10):e.refresh_in)||void 0,O=r+k,L=O+I,$=N&&N>0?r+N:void 0;p=iu(this.homeAccountIdentifier,h,e.access_token,this.clientId,f||t.tenant||"",T.printScopes(),O,L,this.cryptoObj.base64Decode,$,e.token_type,c,e.key_id,o.claims,o.requestedClaimsHash)}let w=null;if(e.refresh_token){let T;if(e.refresh_token_expires_in){const k=typeof e.refresh_token_expires_in=="string"?parseInt(e.refresh_token_expires_in,10):e.refresh_token_expires_in;T=r+k}w=sw(this.homeAccountIdentifier,h,e.refresh_token,this.clientId,e.foci,c,T)}let C=null;return e.foci&&(C={clientId:this.clientId,environment:h,familyId:e.foci}),{account:v,idToken:g,accessToken:p,refreshToken:w,appMetadata:C}}static async generateAuthenticationResult(e,t,r,o,a,c,d,h,f){var O,L,$,G,D;let g=B.EMPTY_STRING,v=[],p=null,w,C,T=B.EMPTY_STRING;if(r.accessToken){if(r.accessToken.tokenType===ze.POP&&!a.popKid){const se=new wa(e),{secret:ie,keyId:Q}=r.accessToken;if(!Q)throw Y(qf);g=await se.signPopToken(ie,Q,a)}else g=r.accessToken.secret;v=_t.fromString(r.accessToken.target).asArray(),p=new Date(Number(r.accessToken.expiresOn)*1e3),w=new Date(Number(r.accessToken.extendedExpiresOn)*1e3),r.accessToken.refreshOn&&(C=new Date(Number(r.accessToken.refreshOn)*1e3))}r.appMetadata&&(T=r.appMetadata.familyId===ms?ms:"");const k=(c==null?void 0:c.oid)||(c==null?void 0:c.sub)||"",I=(c==null?void 0:c.tid)||"";h!=null&&h.spa_accountid&&r.account&&(r.account.nativeAccountId=h==null?void 0:h.spa_accountid);const N=r.account?nm(r.account.getAccountInfo(),void 0,c,(O=r.idToken)==null?void 0:O.secret):null;return{authority:t.canonicalAuthority,uniqueId:k,tenantId:I,scopes:v,account:N,idToken:((L=r==null?void 0:r.idToken)==null?void 0:L.secret)||"",idTokenClaims:c||{},accessToken:g,fromCache:o,expiresOn:p,extExpiresOn:w,refreshOn:C,correlationId:a.correlationId,requestId:f||B.EMPTY_STRING,familyId:T,tokenType:(($=r.accessToken)==null?void 0:$.tokenType)||B.EMPTY_STRING,state:d?d.userRequestState:B.EMPTY_STRING,cloudGraphHostName:((G=r.account)==null?void 0:G.cloudGraphHostName)||B.EMPTY_STRING,msGraphHost:((D=r.account)==null?void 0:D.msGraphHost)||B.EMPTY_STRING,code:h==null?void 0:h.spa_code,fromNativeBroker:!1}}}function cm(n,e,t,r,o,a,c,d,h,f,g){g==null||g.verbose("setCachedAccount called");const p=n.getAccountKeys().find(I=>I.startsWith(t));let w=null;p&&(w=n.getAccount(p,g));const C=w||Ot.createAccount({homeAccountId:t,idTokenClaims:o,clientInfo:a,environment:c,cloudGraphHostName:h==null?void 0:h.cloud_graph_host_name,msGraphHost:h==null?void 0:h.msgraph_host,nativeAccountId:f},e,r),T=C.tenantProfiles||[],k=d||C.realm;if(k&&!T.find(I=>I.tenantId===k)){const I=tm(t,C.localAccountId,k,o);T.push(I)}return C.tenantProfiles=T,C}/*! @azure/msal-common v14.16.0 2024-11-05 */async function Pw(n,e,t){return typeof n=="string"?n:n({clientId:e,tokenEndpoint:t})}/*! @azure/msal-common v14.16.0 2024-11-05 */class Mw extends am{constructor(e,t){var r;super(e,t),this.includeRedirectUri=!0,this.oidcDefaultScopes=(r=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:r.defaultScopes}async getAuthCodeUrl(e){var r;(r=this.performanceClient)==null||r.addQueueMeasurement(x.GetAuthCodeUrl,e.correlationId);const t=await J(this.createAuthCodeUrlQueryString.bind(this),x.AuthClientCreateQueryString,this.logger,this.performanceClient,e.correlationId)(e);return Me.appendQueryString(this.authority.authorizationEndpoint,t)}async acquireToken(e,t){var d,h;if((d=this.performanceClient)==null||d.addQueueMeasurement(x.AuthClientAcquireToken,e.correlationId),!e.code)throw Y(QE);const r=Wr(),o=await J(this.executeTokenRequest.bind(this),x.AuthClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(this.authority,e),a=(h=o.headers)==null?void 0:h[un.X_MS_REQUEST_ID],c=new wi(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin,this.performanceClient);return c.validateTokenResponse(o.body),J(c.handleServerTokenResponse.bind(c),x.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(o.body,this.authority,r,e,t,void 0,void 0,void 0,a)}handleFragmentResponse(e,t){if(new wi(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,null,null).validateServerAuthorizationCodeResponse(e,t),!e.code)throw Y(nw);return e}getLogoutUri(e){if(!e)throw Qe(mw);const t=this.createLogoutUrlQueryString(e);return Me.appendQueryString(this.authority.endSessionEndpoint,t)}async executeTokenRequest(e,t){var f,g;(f=this.performanceClient)==null||f.addQueueMeasurement(x.AuthClientExecuteTokenRequest,t.correlationId);const r=this.createTokenQueryParameters(t),o=Me.appendQueryString(e.tokenEndpoint,r),a=await J(this.createTokenRequestBody.bind(this),x.AuthClientCreateTokenRequestBody,this.logger,this.performanceClient,t.correlationId)(t);let c;if(t.clientInfo)try{const v=kl(t.clientInfo,this.cryptoUtils.base64Decode);c={credential:`${v.uid}${en.CLIENT_INFO_SEPARATOR}${v.utid}`,type:Un.HOME_ACCOUNT_ID}}catch(v){this.logger.verbose("Could not parse client info for CCS Header: "+v)}const d=this.createTokenRequestHeaders(c||t.ccsCredential),h={clientId:((g=t.tokenBodyParameters)==null?void 0:g.clientId)||this.config.authOptions.clientId,authority:e.canonicalAuthority,scopes:t.scopes,claims:t.claims,authenticationScheme:t.authenticationScheme,resourceRequestMethod:t.resourceRequestMethod,resourceRequestUri:t.resourceRequestUri,shrClaims:t.shrClaims,sshKid:t.sshKid};return J(this.executePostToTokenEndpoint.bind(this),x.AuthorizationCodeClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,t.correlationId)(o,a,d,h,t.correlationId,x.AuthorizationCodeClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var o,a;(o=this.performanceClient)==null||o.addQueueMeasurement(x.AuthClientCreateTokenRequestBody,e.correlationId);const t=new ps(e.correlationId,this.performanceClient);if(t.addClientId(e.embeddedClientId||((a=e.tokenBodyParameters)==null?void 0:a[Ei])||this.config.authOptions.clientId),this.includeRedirectUri?t.addRedirectUri(e.redirectUri):ra.validateRedirectUri(e.redirectUri),t.addScopes(e.scopes,!0,this.oidcDefaultScopes),t.addAuthorizationCode(e.code),t.addLibraryInfo(this.config.libraryInfo),t.addApplicationTelemetry(this.config.telemetry.application),t.addThrottling(),this.serverTelemetryManager&&!Jh(this.config)&&t.addServerTelemetry(this.serverTelemetryManager),e.codeVerifier&&t.addCodeVerifier(e.codeVerifier),this.config.clientCredentials.clientSecret&&t.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const c=this.config.clientCredentials.clientAssertion;t.addClientAssertion(await Pw(c.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),t.addClientAssertionType(c.assertionType)}if(t.addGrantType(VE.AUTHORIZATION_CODE_GRANT),t.addClientInfo(),e.authenticationScheme===ze.POP){const c=new wa(this.cryptoUtils,this.performanceClient);let d;e.popKid?d=this.cryptoUtils.encodeKid(e.popKid):d=(await J(c.generateCnf.bind(c),x.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,t.addPopToken(d)}else if(e.authenticationScheme===ze.SSH)if(e.sshJwk)t.addSshJwk(e.sshJwk);else throw Qe(au);(!_r.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&t.addClaims(e.claims,this.config.authOptions.clientCapabilities);let r;if(e.clientInfo)try{const c=kl(e.clientInfo,this.cryptoUtils.base64Decode);r={credential:`${c.uid}${en.CLIENT_INFO_SEPARATOR}${c.utid}`,type:Un.HOME_ACCOUNT_ID}}catch(c){this.logger.verbose("Could not parse client info for CCS Header: "+c)}else r=e.ccsCredential;if(this.config.systemOptions.preventCorsPreflight&&r)switch(r.type){case Un.HOME_ACCOUNT_ID:try{const c=da(r.credential);t.addCcsOid(c)}catch(c){this.logger.verbose("Could not parse home account ID for CCS Header: "+c)}break;case Un.UPN:t.addCcsUpn(r.credential);break}return e.embeddedClientId&&t.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenBodyParameters&&t.addExtraQueryParameters(e.tokenBodyParameters),e.enableSpaAuthorizationCode&&(!e.tokenBodyParameters||!e.tokenBodyParameters[Yv])&&t.addExtraQueryParameters({[Yv]:"1"}),t.createQueryString()}async createAuthCodeUrlQueryString(e){var a,c;const t=e.correlationId||this.config.cryptoInterface.createNewGuid();(a=this.performanceClient)==null||a.addQueueMeasurement(x.AuthClientCreateQueryString,t);const r=new ps(t,this.performanceClient);r.addClientId(e.embeddedClientId||((c=e.extraQueryParameters)==null?void 0:c[Ei])||this.config.authOptions.clientId);const o=[...e.scopes||[],...e.extraScopesToConsent||[]];if(r.addScopes(o,!0,this.oidcDefaultScopes),r.addRedirectUri(e.redirectUri),r.addCorrelationId(t),r.addResponseMode(e.responseMode),r.addResponseTypeCode(),r.addLibraryInfo(this.config.libraryInfo),Jh(this.config)||r.addApplicationTelemetry(this.config.telemetry.application),r.addClientInfo(),e.codeChallenge&&e.codeChallengeMethod&&r.addCodeChallengeParams(e.codeChallenge,e.codeChallengeMethod),e.prompt&&r.addPrompt(e.prompt),e.domainHint&&r.addDomainHint(e.domainHint),e.prompt!==Ut.SELECT_ACCOUNT)if(e.sid&&e.prompt===Ut.NONE)this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request"),r.addSid(e.sid);else if(e.account){const d=this.extractAccountSid(e.account);let h=this.extractLoginHint(e.account);if(h&&e.domainHint&&(this.logger.warning('AuthorizationCodeClient.createAuthCodeUrlQueryString: "domainHint" param is set, skipping opaque "login_hint" claim. Please consider not passing domainHint'),h=null),h){this.logger.verbose("createAuthCodeUrlQueryString: login_hint claim present on account"),r.addLoginHint(h);try{const f=da(e.account.homeAccountId);r.addCcsOid(f)}catch{this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(d&&e.prompt===Ut.NONE){this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account"),r.addSid(d);try{const f=da(e.account.homeAccountId);r.addCcsOid(f)}catch{this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(e.loginHint)this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from request"),r.addLoginHint(e.loginHint),r.addCcsUpn(e.loginHint);else if(e.account.username){this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from account"),r.addLoginHint(e.account.username);try{const f=da(e.account.homeAccountId);r.addCcsOid(f)}catch{this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}}else e.loginHint&&(this.logger.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request"),r.addLoginHint(e.loginHint),r.addCcsUpn(e.loginHint));else this.logger.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");if(e.nonce&&r.addNonce(e.nonce),e.state&&r.addState(e.state),(e.claims||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&r.addClaims(e.claims,this.config.authOptions.clientCapabilities),e.embeddedClientId&&r.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),this.addExtraQueryParams(e,r),e.nativeBroker&&(r.addNativeBroker(),e.authenticationScheme===ze.POP)){const d=new wa(this.cryptoUtils);let h;e.popKid?h=this.cryptoUtils.encodeKid(e.popKid):h=(await J(d.generateCnf.bind(d),x.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,r.addPopToken(h)}return r.createQueryString()}createLogoutUrlQueryString(e){const t=new ps(e.correlationId,this.performanceClient);return e.postLogoutRedirectUri&&t.addPostLogoutRedirectUri(e.postLogoutRedirectUri),e.correlationId&&t.addCorrelationId(e.correlationId),e.idTokenHint&&t.addIdTokenHint(e.idTokenHint),e.state&&t.addState(e.state),e.logoutHint&&t.addLogoutHint(e.logoutHint),this.addExtraQueryParams(e,t),t.createQueryString()}addExtraQueryParams(e,t){!(e.extraQueryParameters&&e.extraQueryParameters.hasOwnProperty("instance_aware"))&&this.config.authOptions.instanceAware&&(e.extraQueryParameters=e.extraQueryParameters||{},e.extraQueryParameters.instance_aware="true"),e.extraQueryParameters&&t.addExtraQueryParameters(e.extraQueryParameters)}extractAccountSid(e){var t;return((t=e.idTokenClaims)==null?void 0:t.sid)||null}extractLoginHint(e){var t;return((t=e.idTokenClaims)==null?void 0:t.login_hint)||null}}/*! @azure/msal-common v14.16.0 2024-11-05 */const T2=300;class Zh extends am{constructor(e,t){super(e,t)}async acquireToken(e){var c,d;(c=this.performanceClient)==null||c.addQueueMeasurement(x.RefreshTokenClientAcquireToken,e.correlationId);const t=Wr(),r=await J(this.executeTokenRequest.bind(this),x.RefreshTokenClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(e,this.authority),o=(d=r.headers)==null?void 0:d[un.X_MS_REQUEST_ID],a=new wi(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin);return a.validateTokenResponse(r.body),J(a.handleServerTokenResponse.bind(a),x.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(r.body,this.authority,t,e,void 0,void 0,!0,e.forceCache,o)}async acquireTokenByRefreshToken(e){var r;if(!e)throw Qe(fw);if((r=this.performanceClient)==null||r.addQueueMeasurement(x.RefreshTokenClientAcquireTokenByRefreshToken,e.correlationId),!e.account)throw Y(zf);if(this.cacheManager.isAppMetadataFOCI(e.account.environment))try{return await J(this.acquireTokenWithCachedRefreshToken.bind(this),x.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!0)}catch(o){const a=o instanceof Cr&&o.errorCode===Pl,c=o instanceof Ko&&o.errorCode===Dv.INVALID_GRANT_ERROR&&o.subError===Dv.CLIENT_MISMATCH_ERROR;if(a||c)return J(this.acquireTokenWithCachedRefreshToken.bind(this),x.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1);throw o}return J(this.acquireTokenWithCachedRefreshToken.bind(this),x.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1)}async acquireTokenWithCachedRefreshToken(e,t){var a;(a=this.performanceClient)==null||a.addQueueMeasurement(x.RefreshTokenClientAcquireTokenWithCachedRefreshToken,e.correlationId);const r=Si(this.cacheManager.getRefreshToken.bind(this.cacheManager),x.CacheManagerGetRefreshToken,this.logger,this.performanceClient,e.correlationId)(e.account,t,void 0,this.performanceClient,e.correlationId);if(!r)throw Xh(Pl);if(r.expiresOn&&jh(r.expiresOn,e.refreshTokenExpirationOffsetSeconds||T2))throw Xh(sm);const o={...e,refreshToken:r.secret,authenticationScheme:e.authenticationScheme||ze.BEARER,ccsCredential:{credential:e.account.homeAccountId,type:Un.HOME_ACCOUNT_ID}};try{return await J(this.acquireToken.bind(this),x.RefreshTokenClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(o)}catch(c){if(c instanceof Cr&&c.subError===lu){this.logger.verbose("acquireTokenWithRefreshToken: bad refresh token, removing from cache");const d=ua(r);this.cacheManager.removeRefreshToken(d)}throw c}}async executeTokenRequest(e,t){var h,f;(h=this.performanceClient)==null||h.addQueueMeasurement(x.RefreshTokenClientExecuteTokenRequest,e.correlationId);const r=this.createTokenQueryParameters(e),o=Me.appendQueryString(t.tokenEndpoint,r),a=await J(this.createTokenRequestBody.bind(this),x.RefreshTokenClientCreateTokenRequestBody,this.logger,this.performanceClient,e.correlationId)(e),c=this.createTokenRequestHeaders(e.ccsCredential),d={clientId:((f=e.tokenBodyParameters)==null?void 0:f.clientId)||this.config.authOptions.clientId,authority:t.canonicalAuthority,scopes:e.scopes,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid};return J(this.executePostToTokenEndpoint.bind(this),x.RefreshTokenClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,e.correlationId)(o,a,c,d,e.correlationId,x.RefreshTokenClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var o,a,c;(o=this.performanceClient)==null||o.addQueueMeasurement(x.RefreshTokenClientCreateTokenRequestBody,e.correlationId);const t=e.correlationId,r=new ps(t,this.performanceClient);if(r.addClientId(e.embeddedClientId||((a=e.tokenBodyParameters)==null?void 0:a[Ei])||this.config.authOptions.clientId),e.redirectUri&&r.addRedirectUri(e.redirectUri),r.addScopes(e.scopes,!0,(c=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:c.defaultScopes),r.addGrantType(VE.REFRESH_TOKEN_GRANT),r.addClientInfo(),r.addLibraryInfo(this.config.libraryInfo),r.addApplicationTelemetry(this.config.telemetry.application),r.addThrottling(),this.serverTelemetryManager&&!Jh(this.config)&&r.addServerTelemetry(this.serverTelemetryManager),r.addRefreshToken(e.refreshToken),this.config.clientCredentials.clientSecret&&r.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const d=this.config.clientCredentials.clientAssertion;r.addClientAssertion(await Pw(d.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),r.addClientAssertionType(d.assertionType)}if(e.authenticationScheme===ze.POP){const d=new wa(this.cryptoUtils,this.performanceClient);let h;e.popKid?h=this.cryptoUtils.encodeKid(e.popKid):h=(await J(d.generateCnf.bind(d),x.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,r.addPopToken(h)}else if(e.authenticationScheme===ze.SSH)if(e.sshJwk)r.addSshJwk(e.sshJwk);else throw Qe(au);if((!_r.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&r.addClaims(e.claims,this.config.authOptions.clientCapabilities),this.config.systemOptions.preventCorsPreflight&&e.ccsCredential)switch(e.ccsCredential.type){case Un.HOME_ACCOUNT_ID:try{const d=da(e.ccsCredential.credential);r.addCcsOid(d)}catch(d){this.logger.verbose("Could not parse home account ID for CCS Header: "+d)}break;case Un.UPN:r.addCcsUpn(e.ccsCredential.credential);break}return e.embeddedClientId&&r.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenBodyParameters&&r.addExtraQueryParameters(e.tokenBodyParameters),r.createQueryString()}}/*! @azure/msal-common v14.16.0 2024-11-05 */class b2 extends am{constructor(e,t){super(e,t)}async acquireToken(e){var t;try{const[r,o]=await this.acquireCachedToken({...e,scopes:(t=e.scopes)!=null&&t.length?e.scopes:[...Ra]});return o===Po.PROACTIVELY_REFRESHED&&(this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed."),new Zh(this.config,this.performanceClient).acquireTokenByRefreshToken(e).catch(()=>{})),r}catch(r){if(r instanceof ru&&r.errorCode===so)return new Zh(this.config,this.performanceClient).acquireTokenByRefreshToken(e);throw r}}async acquireCachedToken(e){var h;(h=this.performanceClient)==null||h.addQueueMeasurement(x.SilentFlowClientAcquireCachedToken,e.correlationId);let t=Po.NOT_APPLICABLE;if(e.forceRefresh||!this.config.cacheOptions.claimsBasedCachingEnabled&&!_r.isEmptyObj(e.claims))throw this.setCacheOutcome(Po.FORCE_REFRESH_OR_CLAIMS,e.correlationId),Y(so);if(!e.account)throw Y(zf);const r=e.account.tenantId||f2(e.authority),o=this.cacheManager.getTokenKeys(),a=this.cacheManager.getAccessToken(e.account,e,o,r,this.performanceClient,e.correlationId);if(a){if(ZB(a.cachedAt)||jh(a.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))throw this.setCacheOutcome(Po.CACHED_ACCESS_TOKEN_EXPIRED,e.correlationId),Y(so);a.refreshOn&&jh(a.refreshOn,0)&&(t=Po.PROACTIVELY_REFRESHED)}else throw this.setCacheOutcome(Po.NO_CACHED_ACCESS_TOKEN,e.correlationId),Y(so);const c=e.authority||this.authority.getPreferredCache(),d={account:this.cacheManager.readAccountFromCache(e.account),accessToken:a,idToken:this.cacheManager.getIdToken(e.account,o,r,this.performanceClient,e.correlationId),refreshToken:null,appMetadata:this.cacheManager.readAppMetadataFromCache(c)};return this.setCacheOutcome(t,e.correlationId),this.config.serverTelemetryManager&&this.config.serverTelemetryManager.incrementCacheHits(),[await J(this.generateResultFromCacheRecord.bind(this),x.SilentFlowClientGenerateResultFromCacheRecord,this.logger,this.performanceClient,e.correlationId)(d,e),t]}setCacheOutcome(e,t){var r,o;(r=this.serverTelemetryManager)==null||r.setCacheOutcome(e),(o=this.performanceClient)==null||o.addFields({cacheOutcome:e},t),e!==Po.NOT_APPLICABLE&&this.logger.info(`Token refresh is required due to cache outcome: ${e}`)}async generateResultFromCacheRecord(e,t){var o;(o=this.performanceClient)==null||o.addQueueMeasurement(x.SilentFlowClientGenerateResultFromCacheRecord,t.correlationId);let r;if(e.idToken&&(r=Ii(e.idToken.secret,this.config.cryptoInterface.base64Decode)),t.maxAge||t.maxAge===0){const a=r==null?void 0:r.auth_time;if(!a)throw Y(Wf);aw(a,t.maxAge)}return wi.generateAuthenticationResult(this.cryptoUtils,this.authority,e,!0,t,r)}}/*! @azure/msal-common v14.16.0 2024-11-05 */const I2={sendGetRequestAsync:()=>Promise.reject(Y(Se)),sendPostRequestAsync:()=>Promise.reject(Y(Se))};/*! @azure/msal-common v14.16.0 2024-11-05 */const Xv=",",Dw="|";function S2(n){const{skus:e,libraryName:t,libraryVersion:r,extensionName:o,extensionVersion:a}=n,c=new Map([[0,[t,r]],[2,[o,a]]]);let d=[];if(e!=null&&e.length){if(d=e.split(Xv),d.length<4)return e}else d=Array.from({length:4},()=>Dw);return c.forEach((h,f)=>{var g,v;h.length===2&&((g=h[0])!=null&&g.length)&&((v=h[1])!=null&&v.length)&&A2({skuArr:d,index:f,skuName:h[0],skuVersion:h[1]})}),d.join(Xv)}function A2(n){const{skuArr:e,index:t,skuName:r,skuVersion:o}=n;t>=e.length||(e[t]=[r,o].join(Dw))}class Ns{constructor(e,t){this.cacheOutcome=Po.NOT_APPLICABLE,this.cacheManager=t,this.apiId=e.apiId,this.correlationId=e.correlationId,this.wrapperSKU=e.wrapperSKU||B.EMPTY_STRING,this.wrapperVer=e.wrapperVer||B.EMPTY_STRING,this.telemetryCacheKey=Kt.CACHE_KEY+en.CACHE_KEY_SEPARATOR+e.clientId}generateCurrentRequestHeaderValue(){const e=`${this.apiId}${Kt.VALUE_SEPARATOR}${this.cacheOutcome}`,t=[this.wrapperSKU,this.wrapperVer],r=this.getNativeBrokerErrorCode();r!=null&&r.length&&t.push(`broker_error=${r}`);const o=t.join(Kt.VALUE_SEPARATOR),a=this.getRegionDiscoveryFields(),c=[e,a].join(Kt.VALUE_SEPARATOR);return[Kt.SCHEMA_VERSION,c,o].join(Kt.CATEGORY_SEPARATOR)}generateLastRequestHeaderValue(){const e=this.getLastRequests(),t=Ns.maxErrorsToSend(e),r=e.failedRequests.slice(0,2*t).join(Kt.VALUE_SEPARATOR),o=e.errors.slice(0,t).join(Kt.VALUE_SEPARATOR),a=e.errors.length,c=t<a?Kt.OVERFLOW_TRUE:Kt.OVERFLOW_FALSE,d=[a,c].join(Kt.VALUE_SEPARATOR);return[Kt.SCHEMA_VERSION,e.cacheHits,r,o,d].join(Kt.CATEGORY_SEPARATOR)}cacheFailedRequest(e){const t=this.getLastRequests();t.errors.length>=Kt.MAX_CACHED_ERRORS&&(t.failedRequests.shift(),t.failedRequests.shift(),t.errors.shift()),t.failedRequests.push(this.apiId,this.correlationId),e instanceof Error&&e&&e.toString()?e instanceof ct?e.subError?t.errors.push(e.subError):e.errorCode?t.errors.push(e.errorCode):t.errors.push(e.toString()):t.errors.push(e.toString()):t.errors.push(Kt.UNKNOWN_ERROR),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t)}incrementCacheHits(){const e=this.getLastRequests();return e.cacheHits+=1,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e),e.cacheHits}getLastRequests(){const e={failedRequests:[],errors:[],cacheHits:0};return this.cacheManager.getServerTelemetry(this.telemetryCacheKey)||e}clearTelemetryCache(){const e=this.getLastRequests(),t=Ns.maxErrorsToSend(e),r=e.errors.length;if(t===r)this.cacheManager.removeItem(this.telemetryCacheKey);else{const o={failedRequests:e.failedRequests.slice(t*2),errors:e.errors.slice(t),cacheHits:0};this.cacheManager.setServerTelemetry(this.telemetryCacheKey,o)}}static maxErrorsToSend(e){let t,r=0,o=0;const a=e.errors.length;for(t=0;t<a;t++){const c=e.failedRequests[2*t]||B.EMPTY_STRING,d=e.failedRequests[2*t+1]||B.EMPTY_STRING,h=e.errors[t]||B.EMPTY_STRING;if(o+=c.toString().length+d.toString().length+h.length+3,o<Kt.MAX_LAST_HEADER_BYTES)r+=1;else break}return r}getRegionDiscoveryFields(){const e=[];return e.push(this.regionUsed||B.EMPTY_STRING),e.push(this.regionSource||B.EMPTY_STRING),e.push(this.regionOutcome||B.EMPTY_STRING),e.join(",")}updateRegionDiscoveryMetadata(e){this.regionUsed=e.region_used,this.regionSource=e.region_source,this.regionOutcome=e.region_outcome}setCacheOutcome(e){this.cacheOutcome=e}setNativeBrokerErrorCode(e){const t=this.getLastRequests();t.nativeBrokerErrorCode=e,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t)}getNativeBrokerErrorCode(){return this.getLastRequests().nativeBrokerErrorCode}clearNativeBrokerErrorCode(){const e=this.getLastRequests();delete e.nativeBrokerErrorCode,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e)}static makeExtraSkuString(e){return S2(e)}}/*! @azure/msal-common v14.16.0 2024-11-05 */const Lw="missing_kid_error",xw="missing_alg_error";/*! @azure/msal-common v14.16.0 2024-11-05 */const k2={[Lw]:"The JOSE Header for the requested JWT, JWS or JWK object requires a keyId to be configured as the 'kid' header claim. No 'kid' value was provided.",[xw]:"The JOSE Header for the requested JWT, JWS or JWK object requires an algorithm to be specified as the 'alg' header claim. No 'alg' value was provided."};class lm extends ct{constructor(e,t){super(e,t),this.name="JoseHeaderError",Object.setPrototypeOf(this,lm.prototype)}}function Zv(n){return new lm(n,k2[n])}/*! @azure/msal-common v14.16.0 2024-11-05 */class um{constructor(e){this.typ=e.typ,this.alg=e.alg,this.kid=e.kid}static getShrHeaderString(e){if(!e.kid)throw Zv(Lw);if(!e.alg)throw Zv(xw);const t=new um({typ:e.typ||UB.Pop,kid:e.kid,alg:e.alg});return JSON.stringify(t)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class ey{startMeasurement(){}endMeasurement(){}flushMeasurement(){return null}}class N2{generateId(){return"callback-id"}startMeasurement(e,t){return{end:()=>null,discard:()=>{},add:()=>{},increment:()=>{},event:{eventId:this.generateId(),status:h2.InProgress,authority:"",libraryName:"",libraryVersion:"",clientId:"",name:e,startTimeMs:Date.now(),correlationId:t||""},measurement:new ey}}startPerformanceMeasurement(){return new ey}calculateQueuedTime(){return 0}addQueueMeasurement(){}setPreQueueTime(){}endMeasurement(){return null}discardMeasurements(){}removePerformanceCallback(){return!0}addPerformanceCallback(){return""}emitEvents(){}addFields(){}incrementFields(){}cacheEventByCorrelationId(){}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const dm="pkce_not_created",ef="crypto_nonexistent",uu="empty_navigate_uri",Uw="hash_empty_error",hm="no_state_in_hash",Fw="hash_does_not_contain_known_properties",Bw="unable_to_parse_state",Vw="state_interaction_type_mismatch",Hw="interaction_in_progress",$w="popup_window_error",Kw="empty_window_error",Ti="user_cancelled",R2="monitor_popup_timeout",Ww="monitor_window_timeout",zw="redirect_in_iframe",Gw="block_iframe_reload",qw="block_nested_popups",O2="iframe_closed_prematurely",du="silent_logout_unsupported",Yw="no_account_error",P2="silent_prompt_value_error",jw="no_token_request_cache_error",Jw="unable_to_parse_token_request_cache_error",fm="no_cached_authority_error",M2="auth_request_not_set_error",D2="invalid_cache_type",hu="non_browser_environment",oa="database_not_open",Ml="no_network_connectivity",Qw="post_request_failed",Xw="get_request_failed",tf="failed_to_parse_response",Zw="unable_to_load_token",mm="crypto_key_not_found",eT="auth_code_required",tT="auth_code_or_nativeAccountId_required",nT="spa_code_and_nativeAccountId_present",gm="database_unavailable",rT="unable_to_acquire_token_from_native_platform",oT="native_handshake_timeout",iT="native_extension_not_installed",Hs="native_connection_not_established",aT="uninitialized_public_client_application",sT="native_prompt_not_supported",cT="invalid_base64_string",lT="invalid_pop_token_request",uT="failed_to_build_headers",dT="failed_to_parse_headers";/*! @azure/msal-browser v3.28.1 2025-01-14 */const oo="For more visit: aka.ms/msaljs/browser-errors",L2={[dm]:"The PKCE code challenge and verifier could not be generated.",[ef]:"The crypto object or function is not available.",[uu]:"Navigation URI is empty. Please check stack trace for more info.",[Uw]:`Hash value cannot be processed because it is empty. Please verify that your redirectUri is not clearing the hash. ${oo}`,[hm]:"Hash does not contain state. Please verify that the request originated from msal.",[Fw]:`Hash does not contain known properites. Please verify that your redirectUri is not changing the hash. ${oo}`,[Bw]:"Unable to parse state. Please verify that the request originated from msal.",[Vw]:"Hash contains state but the interaction type does not match the caller.",[Hw]:`Interaction is currently in progress. Please ensure that this interaction has been completed before calling an interactive API. ${oo}`,[$w]:"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser.",[Kw]:"window.open returned null or undefined window object.",[Ti]:"User cancelled the flow.",[R2]:`Token acquisition in popup failed due to timeout. ${oo}`,[Ww]:`Token acquisition in iframe failed due to timeout. ${oo}`,[zw]:"Redirects are not supported for iframed or brokered applications. Please ensure you are using MSAL.js in a top frame of the window if using the redirect APIs, or use the popup APIs.",[Gw]:`Request was blocked inside an iframe because MSAL detected an authentication response. ${oo}`,[qw]:"Request was blocked inside a popup because MSAL detected it was running in a popup.",[O2]:"The iframe being monitored was closed prematurely.",[du]:"Silent logout not supported. Please call logoutRedirect or logoutPopup instead.",[Yw]:"No account object provided to acquireTokenSilent and no active account has been set. Please call setActiveAccount or provide an account on the request.",[P2]:"The value given for the prompt value is not valid for silent requests - must be set to 'none' or 'no_session'.",[jw]:"No token request found in cache.",[Jw]:"The cached token request could not be parsed.",[fm]:"No cached authority found.",[M2]:"Auth Request not set. Please ensure initiateAuthRequest was called from the InteractionHandler",[D2]:"Invalid cache type",[hu]:"Login and token requests are not supported in non-browser environments.",[oa]:"Database is not open!",[Ml]:"No network connectivity. Check your internet connection.",[Qw]:"Network request failed: If the browser threw a CORS error, check that the redirectUri is registered in the Azure App Portal as type 'SPA'",[Xw]:"Network request failed. Please check the network trace to determine root cause.",[tf]:"Failed to parse network response. Check network trace.",[Zw]:"Error loading token to cache.",[mm]:"Cryptographic Key or Keypair not found in browser storage.",[eT]:"An authorization code must be provided (as the `code` property on the request) to this flow.",[tT]:"An authorization code or nativeAccountId must be provided to this flow.",[nT]:"Request cannot contain both spa code and native account id.",[gm]:"IndexedDB, which is required for persistent cryptographic key storage, is unavailable. This may be caused by browser privacy features which block persistent storage in third-party contexts.",[rT]:`Unable to acquire token from native platform. ${oo}`,[oT]:"Timed out while attempting to establish connection to browser extension",[iT]:"Native extension is not installed. If you think this is a mistake call the initialize function.",[Hs]:`Connection to native platform has not been established. Please install a compatible browser extension and run initialize(). ${oo}`,[aT]:`You must call and await the initialize function before attempting to call any other MSAL API. ${oo}`,[sT]:"The provided prompt is not supported by the native platform. This request should be routed to the web based flow.",[cT]:"Invalid base64 encoded string.",[lT]:"Invalid PoP token request. The request should not have both a popKid value and signPopToken set to true.",[uT]:"Failed to build request headers object.",[dT]:"Failed to parse response headers"};class $s extends ct{constructor(e,t){super(e,L2[e],t),Object.setPrototypeOf(this,$s.prototype),this.name="BrowserAuthError"}}function oe(n,e){return new $s(n,e)}/*! @azure/msal-browser v3.28.1 2025-01-14 */const Mn={INTERACTION_IN_PROGRESS_VALUE:"interaction_in_progress",INVALID_GRANT_ERROR:"invalid_grant",POPUP_WIDTH:483,POPUP_HEIGHT:600,POPUP_NAME_PREFIX:"msal",DEFAULT_POLL_INTERVAL_MS:30,MSAL_SKU:"msal.js.browser"},ha={CHANNEL_ID:"53ee284d-920a-4b59-9d30-a60315b26836",PREFERRED_EXTENSION_ID:"ppnbnpeolgkicgegkbkbjmhlideopiji",MATS_TELEMETRY:"MATS"},mi={HandshakeRequest:"Handshake",HandshakeResponse:"HandshakeResponse",GetToken:"GetToken",Response:"Response"},_n={LocalStorage:"localStorage",SessionStorage:"sessionStorage",MemoryStorage:"memoryStorage"},ty={GET:"GET",POST:"POST"},$e={AUTHORITY:"authority",ACQUIRE_TOKEN_ACCOUNT:"acquireToken.account",SESSION_STATE:"session.state",REQUEST_STATE:"request.state",NONCE_IDTOKEN:"nonce.id_token",ORIGIN_URI:"request.origin",RENEW_STATUS:"token.renew.status",URL_HASH:"urlHash",REQUEST_PARAMS:"request.params",SCOPES:"scopes",INTERACTION_STATUS_KEY:"interaction.status",CCS_CREDENTIAL:"ccs.credential",CORRELATION_ID:"request.correlationId",NATIVE_REQUEST:"request.native",REDIRECT_CONTEXT:"request.redirect.context"},Oo={ACCOUNT_KEYS:"msal.account.keys",TOKEN_KEYS:"msal.token.keys"},zc={WRAPPER_SKU:"wrapper.sku",WRAPPER_VER:"wrapper.version"},rt={acquireTokenRedirect:861,acquireTokenPopup:862,ssoSilent:863,acquireTokenSilent_authCode:864,handleRedirectPromise:865,acquireTokenByCode:866,acquireTokenSilent_silentFlow:61,logout:961,logoutPopup:962};var ce;(function(n){n.Redirect="redirect",n.Popup="popup",n.Silent="silent",n.None="none"})(ce||(ce={}));const ny={scopes:Ra},hT="jwk",nf="msal.db",x2=1,U2=`${nf}.keys`,On={Default:0,AccessToken:1,AccessTokenAndRefreshToken:2,RefreshToken:3,RefreshTokenAndNetwork:4,Skip:5},F2=[On.Default,On.Skip,On.RefreshTokenAndNetwork],B2="msal.browser.log.level",V2="msal.browser.log.pii";/*! @azure/msal-browser v3.28.1 2025-01-14 */function Gc(n){return encodeURIComponent(pm(n).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"))}function fu(n){return fT(n).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function pm(n){return fT(new TextEncoder().encode(n))}function fT(n){const e=Array.from(n,t=>String.fromCodePoint(t)).join("");return btoa(e)}/*! @azure/msal-browser v3.28.1 2025-01-14 */const H2="RSASSA-PKCS1-v1_5",mT="SHA-256",$2=2048,K2=new Uint8Array([1,0,1]),ry="0123456789abcdef",oy=new Uint32Array(1),W2="crypto_subtle_undefined",_m={name:H2,hash:mT,modulusLength:$2,publicExponent:K2};function z2(n){if(!window)throw oe(hu);if(!window.crypto)throw oe(ef);if(!n&&!window.crypto.subtle)throw oe(ef,W2)}async function gT(n,e,t){e==null||e.addQueueMeasurement(x.Sha256Digest,t);const o=new TextEncoder().encode(n);return window.crypto.subtle.digest(mT,o)}function G2(n){return window.crypto.getRandomValues(n)}function ih(){return window.crypto.getRandomValues(oy),oy[0]}function mo(){const n=Date.now(),e=ih()*1024+(ih()&1023),t=new Uint8Array(16),r=Math.trunc(e/2**30),o=e&2**30-1,a=ih();t[0]=n/2**40,t[1]=n/2**32,t[2]=n/2**24,t[3]=n/2**16,t[4]=n/2**8,t[5]=n,t[6]=112|r>>>8,t[7]=r,t[8]=128|o>>>24,t[9]=o>>>16,t[10]=o>>>8,t[11]=o,t[12]=a>>>24,t[13]=a>>>16,t[14]=a>>>8,t[15]=a;let c="";for(let d=0;d<t.length;d++)c+=ry.charAt(t[d]>>>4),c+=ry.charAt(t[d]&15),(d===3||d===5||d===7||d===9)&&(c+="-");return c}async function q2(n,e){return window.crypto.subtle.generateKey(_m,n,e)}async function ah(n){return window.crypto.subtle.exportKey(hT,n)}async function Y2(n,e,t){return window.crypto.subtle.importKey(hT,n,_m,e,t)}async function j2(n,e){return window.crypto.subtle.sign(_m,n,e)}async function pT(n){const e=await gT(n),t=new Uint8Array(e);return fu(t)}/*! @azure/msal-browser v3.28.1 2025-01-14 */const Rs="storage_not_supported",rf="stubbed_public_client_application_called",Dl="in_mem_redirect_unavailable";/*! @azure/msal-browser v3.28.1 2025-01-14 */const fl={[Rs]:"Given storage configuration option was not supported.",[rf]:"Stub instance of Public Client Application was called. If using msal-react, please ensure context is not used without a provider. For more visit: aka.ms/msaljs/browser-errors",[Dl]:"Redirect cannot be supported. In-memory storage was selected and storeAuthStateInCookie=false, which would cause the library to be unable to handle the incoming hash. If you would like to use the redirect API, please use session/localStorage or set storeAuthStateInCookie=true."};fl[Rs],fl[rf],fl[Dl];class vm extends ct{constructor(e,t){super(e,t),this.name="BrowserConfigurationAuthError",Object.setPrototypeOf(this,vm.prototype)}}function ym(n){return new vm(n,fl[n])}/*! @azure/msal-browser v3.28.1 2025-01-14 */function J2(n){n.location.hash="",typeof n.history.replaceState=="function"&&n.history.replaceState(null,"",`${n.location.origin}${n.location.pathname}${n.location.search}`)}function Q2(n){const e=n.split("#");e.shift(),window.location.hash=e.length>0?e.join("#"):""}function Cm(){return window.parent!==window}function X2(){return typeof window<"u"&&!!window.opener&&window.opener!==window&&typeof window.name=="string"&&window.name.indexOf(`${Mn.POPUP_NAME_PREFIX}.`)===0}function co(){return typeof window<"u"&&window.location?window.location.href.split("?")[0].split("#")[0]:""}function Z2(){const e=new Me(window.location.href).getUrlComponents();return`${e.Protocol}//${e.HostNameAndPort}/`}function eH(){if(Me.hashContainsKnownProperties(window.location.hash)&&Cm())throw oe(Gw)}function tH(n){if(Cm()&&!n)throw oe(zw)}function nH(){if(X2())throw oe(qw)}function _T(){if(typeof window>"u")throw oe(hu)}function vT(n){if(!n)throw oe(aT)}function Em(n){_T(),eH(),nH(),vT(n)}function iy(n,e){if(Em(n),tH(e.system.allowRedirectInIframe),e.cache.cacheLocation===_n.MemoryStorage&&!e.cache.storeAuthStateInCookie)throw ym(Dl)}function yT(n){const e=document.createElement("link");e.rel="preconnect",e.href=new URL(n).origin,e.crossOrigin="anonymous",document.head.appendChild(e),window.setTimeout(()=>{try{document.head.removeChild(e)}catch{}},1e4)}function rH(){return mo()}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Ll{navigateInternal(e,t){return Ll.defaultNavigateWindow(e,t)}navigateExternal(e,t){return Ll.defaultNavigateWindow(e,t)}static defaultNavigateWindow(e,t){return t.noHistory?window.location.replace(e):window.location.assign(e),new Promise(r=>{setTimeout(()=>{r(!0)},t.timeout)})}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class oH{async sendGetRequestAsync(e,t){let r,o={},a=0;const c=ay(t);try{r=await fetch(e,{method:ty.GET,headers:c})}catch{throw oe(window.navigator.onLine?Xw:Ml)}o=sy(r.headers);try{return a=r.status,{headers:o,body:await r.json(),status:a}}catch{throw jv(oe(tf),a,o)}}async sendPostRequestAsync(e,t){const r=t&&t.body||"",o=ay(t);let a,c=0,d={};try{a=await fetch(e,{method:ty.POST,headers:o,body:r})}catch{throw oe(window.navigator.onLine?Qw:Ml)}d=sy(a.headers);try{return c=a.status,{headers:d,body:await a.json(),status:c}}catch{throw jv(oe(tf),c,d)}}}function ay(n){try{const e=new Headers;if(!(n&&n.headers))return e;const t=n.headers;return Object.entries(t).forEach(([r,o])=>{e.append(r,o)}),e}catch{throw oe(uT)}}function sy(n){try{const e={};return n.forEach((t,r)=>{e[r]=t}),e}catch{throw oe(dT)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const iH=6e4,of=1e4,aH=3e4,sH=2e3;function cH({auth:n,cache:e,system:t,telemetry:r},o){const a={clientId:B.EMPTY_STRING,authority:`${B.DEFAULT_AUTHORITY}`,knownAuthorities:[],cloudDiscoveryMetadata:B.EMPTY_STRING,authorityMetadata:B.EMPTY_STRING,redirectUri:typeof window<"u"?co():"",postLogoutRedirectUri:B.EMPTY_STRING,navigateToLoginRequestUrl:!0,clientCapabilities:[],protocolMode:ho.AAD,OIDCOptions:{serverResponseType:Vs.FRAGMENT,defaultScopes:[B.OPENID_SCOPE,B.PROFILE_SCOPE,B.OFFLINE_ACCESS_SCOPE]},azureCloudOptions:{azureCloudInstance:jf.None,tenant:B.EMPTY_STRING},skipAuthorityMetadataCache:!1,supportsNestedAppAuth:!1,instanceAware:!1},c={cacheLocation:_n.SessionStorage,temporaryCacheLocation:_n.SessionStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!!(e&&e.cacheLocation===_n.LocalStorage),claimsBasedCachingEnabled:!1},d={loggerCallback:()=>{},logLevel:et.Info,piiLoggingEnabled:!1},f={...{...Aw,loggerOptions:d,networkClient:o?new oH:I2,navigationClient:new Ll,loadFrameTimeout:0,windowHashTimeout:(t==null?void 0:t.loadFrameTimeout)||iH,iframeHashTimeout:(t==null?void 0:t.loadFrameTimeout)||of,navigateFrameWait:0,redirectNavigationTimeout:aH,asyncPopups:!1,allowRedirectInIframe:!1,allowNativeBroker:!1,nativeBrokerHandshakeTimeout:(t==null?void 0:t.nativeBrokerHandshakeTimeout)||sH,pollIntervalMilliseconds:Mn.DEFAULT_POLL_INTERVAL_MS},...t,loggerOptions:(t==null?void 0:t.loggerOptions)||d},g={application:{appName:B.EMPTY_STRING,appVersion:B.EMPTY_STRING},client:new N2};if((n==null?void 0:n.protocolMode)!==ho.OIDC&&(n!=null&&n.OIDCOptions)&&new $o(f.loggerOptions).warning(JSON.stringify(Qe(yw))),n!=null&&n.protocolMode&&n.protocolMode!==ho.AAD&&(f!=null&&f.allowNativeBroker))throw Qe(Cw);return{auth:{...a,...n,OIDCOptions:{...a.OIDCOptions,...n==null?void 0:n.OIDCOptions}},cache:{...c,...e},system:f,telemetry:{...g,...r}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const lH="@azure/msal-browser",mu="3.28.1";/*! @azure/msal-browser v3.28.1 2025-01-14 */class wm{static loggerCallback(e,t){switch(e){case et.Error:console.error(t);return;case et.Info:console.info(t);return;case et.Verbose:console.debug(t);return;case et.Warning:console.warn(t);return;default:console.log(t);return}}constructor(e){var h;this.browserEnvironment=typeof window<"u",this.config=cH(e,this.browserEnvironment);let t;try{t=window[_n.SessionStorage]}catch{}const r=t==null?void 0:t.getItem(B2),o=(h=t==null?void 0:t.getItem(V2))==null?void 0:h.toLowerCase(),a=o==="true"?!0:o==="false"?!1:void 0,c={...this.config.system.loggerOptions},d=r&&Object.keys(et).includes(r)?et[r]:void 0;d&&(c.loggerCallback=wm.loggerCallback,c.logLevel=d),a!==void 0&&(c.piiLoggingEnabled=a),this.logger=new $o(c,lH,mu),this.available=!1}getConfig(){return this.config}getLogger(){return this.logger}isAvailable(){return this.available}isBrowserEnvironment(){return this.browserEnvironment}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class bi extends wm{getModuleName(){return bi.MODULE_NAME}getId(){return bi.ID}async initialize(){return this.available=typeof window<"u",this.available}}bi.MODULE_NAME="";bi.ID="StandardOperatingContext";/*! @azure/msal-browser v3.28.1 2025-01-14 */function $r(n){return new TextDecoder().decode(uH(n))}function uH(n){let e=n.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw oe(cT)}const t=atob(e);return Uint8Array.from(t,r=>r.codePointAt(0)||0)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class dH{constructor(){this.dbName=nf,this.version=x2,this.tableName=U2,this.dbOpen=!1}async open(){return new Promise((e,t)=>{const r=window.indexedDB.open(this.dbName,this.version);r.addEventListener("upgradeneeded",o=>{o.target.result.createObjectStore(this.tableName)}),r.addEventListener("success",o=>{const a=o;this.db=a.target.result,this.dbOpen=!0,e()}),r.addEventListener("error",()=>t(oe(gm)))})}closeConnection(){const e=this.db;e&&this.dbOpen&&(e.close(),this.dbOpen=!1)}async validateDbIsOpen(){if(!this.dbOpen)return this.open()}async getItem(e){return await this.validateDbIsOpen(),new Promise((t,r)=>{if(!this.db)return r(oe(oa));const c=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).get(e);c.addEventListener("success",d=>{const h=d;this.closeConnection(),t(h.target.result)}),c.addEventListener("error",d=>{this.closeConnection(),r(d)})})}async setItem(e,t){return await this.validateDbIsOpen(),new Promise((r,o)=>{if(!this.db)return o(oe(oa));const d=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).put(t,e);d.addEventListener("success",()=>{this.closeConnection(),r()}),d.addEventListener("error",h=>{this.closeConnection(),o(h)})})}async removeItem(e){return await this.validateDbIsOpen(),new Promise((t,r)=>{if(!this.db)return r(oe(oa));const c=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).delete(e);c.addEventListener("success",()=>{this.closeConnection(),t()}),c.addEventListener("error",d=>{this.closeConnection(),r(d)})})}async getKeys(){return await this.validateDbIsOpen(),new Promise((e,t)=>{if(!this.db)return t(oe(oa));const a=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).getAllKeys();a.addEventListener("success",c=>{const d=c;this.closeConnection(),e(d.target.result)}),a.addEventListener("error",c=>{this.closeConnection(),t(c)})})}async containsKey(e){return await this.validateDbIsOpen(),new Promise((t,r)=>{if(!this.db)return r(oe(oa));const c=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).count(e);c.addEventListener("success",d=>{const h=d;this.closeConnection(),t(h.target.result===1)}),c.addEventListener("error",d=>{this.closeConnection(),r(d)})})}async deleteDatabase(){return this.db&&this.dbOpen&&this.closeConnection(),new Promise((e,t)=>{const r=window.indexedDB.deleteDatabase(nf),o=setTimeout(()=>t(!1),200);r.addEventListener("success",()=>(clearTimeout(o),e(!0))),r.addEventListener("blocked",()=>(clearTimeout(o),e(!0))),r.addEventListener("error",()=>(clearTimeout(o),t(!1)))})}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class af{constructor(){this.cache=new Map}getItem(e){return this.cache.get(e)||null}setItem(e,t){this.cache.set(e,t)}removeItem(e){this.cache.delete(e)}getKeys(){const e=[];return this.cache.forEach((t,r)=>{e.push(r)}),e}containsKey(e){return this.cache.has(e)}clear(){this.cache.clear()}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class hH{constructor(e){this.inMemoryCache=new af,this.indexedDBCache=new dH,this.logger=e}handleDatabaseAccessError(e){if(e instanceof $s&&e.errorCode===gm)this.logger.error("Could not access persistent storage. This may be caused by browser privacy features which block persistent storage in third-party contexts.");else throw e}async getItem(e){const t=this.inMemoryCache.getItem(e);if(!t)try{return this.logger.verbose("Queried item not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.getItem(e)}catch(r){this.handleDatabaseAccessError(r)}return t}async setItem(e,t){this.inMemoryCache.setItem(e,t);try{await this.indexedDBCache.setItem(e,t)}catch(r){this.handleDatabaseAccessError(r)}}async removeItem(e){this.inMemoryCache.removeItem(e);try{await this.indexedDBCache.removeItem(e)}catch(t){this.handleDatabaseAccessError(t)}}async getKeys(){const e=this.inMemoryCache.getKeys();if(e.length===0)try{return this.logger.verbose("In-memory cache is empty, now querying persistent storage."),await this.indexedDBCache.getKeys()}catch(t){this.handleDatabaseAccessError(t)}return e}async containsKey(e){const t=this.inMemoryCache.containsKey(e);if(!t)try{return this.logger.verbose("Key not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.containsKey(e)}catch(r){this.handleDatabaseAccessError(r)}return t}clearInMemory(){this.logger.verbose("Deleting in-memory keystore"),this.inMemoryCache.clear(),this.logger.verbose("In-memory keystore deleted")}async clearPersistent(){try{this.logger.verbose("Deleting persistent keystore");const e=await this.indexedDBCache.deleteDatabase();return e&&this.logger.verbose("Persistent keystore deleted"),e}catch(e){return this.handleDatabaseAccessError(e),!1}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Ta{constructor(e,t,r){this.logger=e,z2(r??!1),this.cache=new hH(this.logger),this.performanceClient=t}createNewGuid(){return mo()}base64Encode(e){return pm(e)}base64Decode(e){return $r(e)}base64UrlEncode(e){return Gc(e)}encodeKid(e){return this.base64UrlEncode(JSON.stringify({kid:e}))}async getPublicKeyThumbprint(e){var g;const t=(g=this.performanceClient)==null?void 0:g.startMeasurement(x.CryptoOptsGetPublicKeyThumbprint,e.correlationId),r=await q2(Ta.EXTRACTABLE,Ta.POP_KEY_USAGES),o=await ah(r.publicKey),a={e:o.e,kty:o.kty,n:o.n},c=cy(a),d=await this.hashString(c),h=await ah(r.privateKey),f=await Y2(h,!1,["sign"]);return await this.cache.setItem(d,{privateKey:f,publicKey:r.publicKey,requestMethod:e.resourceRequestMethod,requestUri:e.resourceRequestUri}),t&&t.end({success:!0}),d}async removeTokenBindingKey(e){return await this.cache.removeItem(e),!await this.cache.containsKey(e)}async clearKeystore(){this.cache.clearInMemory();try{return await this.cache.clearPersistent(),!0}catch(e){return e instanceof Error?this.logger.error(`Clearing keystore failed with error: ${e.message}`):this.logger.error("Clearing keystore failed with unknown error"),!1}}async signJwt(e,t,r,o){var O;const a=(O=this.performanceClient)==null?void 0:O.startMeasurement(x.CryptoOptsSignJwt,o),c=await this.cache.getItem(t);if(!c)throw oe(mm);const d=await ah(c.publicKey),h=cy(d),f=Gc(JSON.stringify({kid:t})),g=um.getShrHeaderString({...r==null?void 0:r.header,alg:d.alg,kid:f}),v=Gc(g);e.cnf={jwk:JSON.parse(h)};const p=Gc(JSON.stringify(e)),w=`${v}.${p}`,T=new TextEncoder().encode(w),k=await j2(c.privateKey,T),I=fu(new Uint8Array(k)),N=`${w}.${I}`;return a&&a.end({success:!0}),N}async hashString(e){return pT(e)}}Ta.POP_KEY_USAGES=["sign","verify"];Ta.EXTRACTABLE=!0;function cy(n){return JSON.stringify(n,Object.keys(n).sort())}/*! @azure/msal-browser v3.28.1 2025-01-14 */class fH{constructor(){if(!window.localStorage)throw ym(Rs)}getItem(e){return window.localStorage.getItem(e)}setItem(e,t){window.localStorage.setItem(e,t)}removeItem(e){window.localStorage.removeItem(e)}getKeys(){return Object.keys(window.localStorage)}containsKey(e){return window.localStorage.hasOwnProperty(e)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class mH{constructor(){if(!window.sessionStorage)throw ym(Rs)}getItem(e){return window.sessionStorage.getItem(e)}setItem(e,t){window.sessionStorage.setItem(e,t)}removeItem(e){window.sessionStorage.removeItem(e)}getKeys(){return Object.keys(window.sessionStorage)}containsKey(e){return window.sessionStorage.hasOwnProperty(e)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function CT(n,e){if(!e)return null;try{return vr.parseRequestState(n,e).libraryState.meta}catch{throw Y(Ca)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const gH=24*60*60*1e3;class pH{getItem(e){const t=`${encodeURIComponent(e)}`,r=document.cookie.split(";");for(let o=0;o<r.length;o++){const a=r[o],[c,...d]=decodeURIComponent(a).trim().split("="),h=d.join("=");if(c===t)return h}return""}setItem(e,t,r,o=!0){let a=`${encodeURIComponent(e)}=${encodeURIComponent(t)};path=/;SameSite=Lax;`;if(r){const c=_H(r);a+=`expires=${c};`}o&&(a+="Secure;"),document.cookie=a}removeItem(e){this.setItem(e,"",-1)}getKeys(){const e=document.cookie.split(";"),t=[];return e.forEach(r=>{const o=decodeURIComponent(r).trim().split("=");t.push(o[0])}),t}containsKey(e){return this.getKeys().includes(e)}}function _H(n){const e=new Date;return new Date(e.getTime()+n*gH).toUTCString()}/*! @azure/msal-browser v3.28.1 2025-01-14 */class sf extends Ea{constructor(e,t,r,o,a,c){super(e,r,o,a),this.cacheConfig=t,this.logger=o,this.internalStorage=new af,this.browserStorage=this.setupBrowserStorage(this.cacheConfig.cacheLocation),this.temporaryCacheStorage=this.setupBrowserStorage(this.cacheConfig.temporaryCacheLocation),this.cookieStorage=new pH,t.cacheMigrationEnabled&&(this.migrateCacheEntries(),this.createKeyMaps()),this.performanceClient=c}setupBrowserStorage(e){try{switch(e){case _n.LocalStorage:return new fH;case _n.SessionStorage:return new mH;case _n.MemoryStorage:default:break}}catch(t){this.logger.error(t)}return this.cacheConfig.cacheLocation=_n.MemoryStorage,new af}migrateCacheEntries(){const e=`${B.CACHE_PREFIX}.${Dt.ID_TOKEN}`,t=`${B.CACHE_PREFIX}.${Dt.CLIENT_INFO}`,r=`${B.CACHE_PREFIX}.${Dt.ERROR}`,o=`${B.CACHE_PREFIX}.${Dt.ERROR_DESC}`,a=this.browserStorage.getItem(e),c=this.browserStorage.getItem(t),d=this.browserStorage.getItem(r),h=this.browserStorage.getItem(o),f=[a,c,d,h];[Dt.ID_TOKEN,Dt.CLIENT_INFO,Dt.ERROR,Dt.ERROR_DESC].forEach((v,p)=>{const w=f[p];w&&this.setTemporaryCache(v,w,!0)})}createKeyMaps(){this.logger.trace("BrowserCacheManager - createKeyMaps called.");const e=this.getItem(Oo.ACCOUNT_KEYS),t=this.getItem(`${Oo.TOKEN_KEYS}.${this.clientId}`);if(e&&t){this.logger.verbose("BrowserCacheManager:createKeyMaps - account and token key maps already exist, skipping migration.");return}this.browserStorage.getKeys().forEach(o=>{if(this.isCredentialKey(o)){const a=this.getItem(o);if(a){const c=this.validateAndParseJson(a);if(c&&c.hasOwnProperty("credentialType"))switch(c.credentialType){case me.ID_TOKEN:if(Bv(c)){this.logger.trace("BrowserCacheManager:createKeyMaps - idToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - idToken with key: ${o} found, saving key to token key map`);const d=c,h=this.updateCredentialCacheKey(o,d);this.addTokenKey(h,me.ID_TOKEN);return}else this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching idToken schema with value containing idToken credentialType field but value failed IdTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed idToken validation on key: ${o}`);break;case me.ACCESS_TOKEN:case me.ACCESS_TOKEN_WITH_AUTH_SCHEME:if(Fv(c)){this.logger.trace("BrowserCacheManager:createKeyMaps - accessToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - accessToken with key: ${o} found, saving key to token key map`);const d=c,h=this.updateCredentialCacheKey(o,d);this.addTokenKey(h,me.ACCESS_TOKEN);return}else this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching accessToken schema with value containing accessToken credentialType field but value failed AccessTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed accessToken validation on key: ${o}`);break;case me.REFRESH_TOKEN:if(Vv(c)){this.logger.trace("BrowserCacheManager:createKeyMaps - refreshToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - refreshToken with key: ${o} found, saving key to token key map`);const d=c,h=this.updateCredentialCacheKey(o,d);this.addTokenKey(h,me.REFRESH_TOKEN);return}else this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching refreshToken schema with value containing refreshToken credentialType field but value failed RefreshTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed refreshToken validation on key: ${o}`);break}}}if(this.isAccountKey(o)){const a=this.getItem(o);if(a){const c=this.validateAndParseJson(a);c&&Ot.isAccountEntity(c)&&(this.logger.trace("BrowserCacheManager:createKeyMaps - account found, saving key to account key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - account with key: ${o} found, saving key to account key map`),this.addAccountKeyToMap(o))}}})}validateAndParseJson(e){try{const t=JSON.parse(e);return t&&typeof t=="object"?t:null}catch{return null}}getItem(e){return this.browserStorage.getItem(e)}setItem(e,t){this.browserStorage.setItem(e,t)}getAccount(e,t){this.logger.trace("BrowserCacheManager.getAccount called");const r=this.getCachedAccountEntity(e);return this.updateOutdatedCachedAccount(e,r,t)}getCachedAccountEntity(e){const t=this.getItem(e);if(!t)return this.removeAccountKeyFromMap(e),null;const r=this.validateAndParseJson(t);return!r||!Ot.isAccountEntity(r)?(this.removeAccountKeyFromMap(e),null):Ea.toObject(new Ot,r)}setAccount(e){this.logger.trace("BrowserCacheManager.setAccount called");const t=e.generateAccountKey();this.setItem(t,JSON.stringify(e)),this.addAccountKeyToMap(t)}getAccountKeys(){this.logger.trace("BrowserCacheManager.getAccountKeys called");const e=this.getItem(Oo.ACCOUNT_KEYS);return e?JSON.parse(e):(this.logger.verbose("BrowserCacheManager.getAccountKeys - No account keys found"),[])}addAccountKeyToMap(e){this.logger.trace("BrowserCacheManager.addAccountKeyToMap called"),this.logger.tracePii(`BrowserCacheManager.addAccountKeyToMap called with key: ${e}`);const t=this.getAccountKeys();t.indexOf(e)===-1?(t.push(e),this.setItem(Oo.ACCOUNT_KEYS,JSON.stringify(t)),this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key added")):this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key already exists in map")}removeAccountKeyFromMap(e){this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap called"),this.logger.tracePii(`BrowserCacheManager.removeAccountKeyFromMap called with key: ${e}`);const t=this.getAccountKeys(),r=t.indexOf(e);r>-1?(t.splice(r,1),this.setItem(Oo.ACCOUNT_KEYS,JSON.stringify(t)),this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap account key removed")):this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap key not found in existing map")}async removeAccount(e){super.removeAccount(e),this.removeAccountKeyFromMap(e)}removeOutdatedAccount(e){this.removeItem(e),this.removeAccountKeyFromMap(e)}removeIdToken(e){super.removeIdToken(e),this.removeTokenKey(e,me.ID_TOKEN)}async removeAccessToken(e){super.removeAccessToken(e),this.removeTokenKey(e,me.ACCESS_TOKEN)}removeRefreshToken(e){super.removeRefreshToken(e),this.removeTokenKey(e,me.REFRESH_TOKEN)}getTokenKeys(){this.logger.trace("BrowserCacheManager.getTokenKeys called");const e=this.getItem(`${Oo.TOKEN_KEYS}.${this.clientId}`);if(e){const t=this.validateAndParseJson(e);if(t&&t.hasOwnProperty("idToken")&&t.hasOwnProperty("accessToken")&&t.hasOwnProperty("refreshToken"))return t;this.logger.error("BrowserCacheManager.getTokenKeys - Token keys found but in an unknown format. Returning empty key map.")}else this.logger.verbose("BrowserCacheManager.getTokenKeys - No token keys found");return{idToken:[],accessToken:[],refreshToken:[]}}addTokenKey(e,t){this.logger.trace("BrowserCacheManager addTokenKey called");const r=this.getTokenKeys();switch(t){case me.ID_TOKEN:r.idToken.indexOf(e)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - idToken added to map"),r.idToken.push(e));break;case me.ACCESS_TOKEN:r.accessToken.indexOf(e)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - accessToken added to map"),r.accessToken.push(e));break;case me.REFRESH_TOKEN:r.refreshToken.indexOf(e)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - refreshToken added to map"),r.refreshToken.push(e));break;default:throw this.logger.error(`BrowserCacheManager:addTokenKey - CredentialType provided invalid. CredentialType: ${t}`),Y(Yh)}this.setItem(`${Oo.TOKEN_KEYS}.${this.clientId}`,JSON.stringify(r))}removeTokenKey(e,t){this.logger.trace("BrowserCacheManager removeTokenKey called");const r=this.getTokenKeys();switch(t){case me.ID_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove idToken with key: ${e} from map`);const o=r.idToken.indexOf(e);o>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - idToken removed from map"),r.idToken.splice(o,1)):this.logger.info("BrowserCacheManager: removeTokenKey - idToken does not exist in map. Either it was previously removed or it was never added.");break;case me.ACCESS_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove accessToken with key: ${e} from map`);const a=r.accessToken.indexOf(e);a>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - accessToken removed from map"),r.accessToken.splice(a,1)):this.logger.info("BrowserCacheManager: removeTokenKey - accessToken does not exist in map. Either it was previously removed or it was never added.");break;case me.REFRESH_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove refreshToken with key: ${e} from map`);const c=r.refreshToken.indexOf(e);c>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken removed from map"),r.refreshToken.splice(c,1)):this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken does not exist in map. Either it was previously removed or it was never added.");break;default:throw this.logger.error(`BrowserCacheManager:removeTokenKey - CredentialType provided invalid. CredentialType: ${t}`),Y(Yh)}this.setItem(`${Oo.TOKEN_KEYS}.${this.clientId}`,JSON.stringify(r))}getIdTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeTokenKey(e,me.ID_TOKEN),null;const r=this.validateAndParseJson(t);return!r||!Bv(r)?(this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeTokenKey(e,me.ID_TOKEN),null):(this.logger.trace("BrowserCacheManager.getIdTokenCredential: cache hit"),r)}setIdTokenCredential(e){this.logger.trace("BrowserCacheManager.setIdTokenCredential called");const t=ua(e);this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,me.ID_TOKEN)}getAccessTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeTokenKey(e,me.ACCESS_TOKEN),null;const r=this.validateAndParseJson(t);return!r||!Fv(r)?(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeTokenKey(e,me.ACCESS_TOKEN),null):(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: cache hit"),r)}setAccessTokenCredential(e){this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");const t=ua(e);this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,me.ACCESS_TOKEN)}getRefreshTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeTokenKey(e,me.REFRESH_TOKEN),null;const r=this.validateAndParseJson(t);return!r||!Vv(r)?(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeTokenKey(e,me.REFRESH_TOKEN),null):(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: cache hit"),r)}setRefreshTokenCredential(e){this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");const t=ua(e);this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,me.REFRESH_TOKEN)}getAppMetadata(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(t);return!r||!cV(e,r)?(this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAppMetadata: cache hit"),r)}setAppMetadata(e){this.logger.trace("BrowserCacheManager.setAppMetadata called");const t=sV(e);this.setItem(t,JSON.stringify(e))}getServerTelemetry(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null;const r=this.validateAndParseJson(t);return!r||!iV(e,r)?(this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit"),r)}setServerTelemetry(e,t){this.logger.trace("BrowserCacheManager.setServerTelemetry called"),this.setItem(e,JSON.stringify(t))}getAuthorityMetadata(e){const t=this.internalStorage.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAuthorityMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(t);return r&&lV(e,r)?(this.logger.trace("BrowserCacheManager.getAuthorityMetadata: cache hit"),r):null}getAuthorityMetadataKeys(){return this.internalStorage.getKeys().filter(t=>this.isAuthorityMetadata(t))}setWrapperMetadata(e,t){this.internalStorage.setItem(zc.WRAPPER_SKU,e),this.internalStorage.setItem(zc.WRAPPER_VER,t)}getWrapperMetadata(){const e=this.internalStorage.getItem(zc.WRAPPER_SKU)||B.EMPTY_STRING,t=this.internalStorage.getItem(zc.WRAPPER_VER)||B.EMPTY_STRING;return[e,t]}setAuthorityMetadata(e,t){this.logger.trace("BrowserCacheManager.setAuthorityMetadata called"),this.internalStorage.setItem(e,JSON.stringify(t))}getActiveAccount(){const e=this.generateCacheKey(Dt.ACTIVE_ACCOUNT_FILTERS),t=this.getItem(e);if(!t){this.logger.trace("BrowserCacheManager.getActiveAccount: No active account filters cache schema found, looking for legacy schema");const o=this.generateCacheKey(Dt.ACTIVE_ACCOUNT),a=this.getItem(o);if(!a)return this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null;const c=this.getAccountInfoFilteredBy({localAccountId:a});return c?(this.logger.trace("BrowserCacheManager.getActiveAccount: Legacy active account cache schema found"),this.logger.trace("BrowserCacheManager.getActiveAccount: Adding active account filters cache schema"),this.setActiveAccount(c),c):null}const r=this.validateAndParseJson(t);return r?(this.logger.trace("BrowserCacheManager.getActiveAccount: Active account filters schema found"),this.getAccountInfoFilteredBy({homeAccountId:r.homeAccountId,localAccountId:r.localAccountId,tenantId:r.tenantId})):(this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null)}setActiveAccount(e){const t=this.generateCacheKey(Dt.ACTIVE_ACCOUNT_FILTERS),r=this.generateCacheKey(Dt.ACTIVE_ACCOUNT);if(e){this.logger.verbose("setActiveAccount: Active account set");const o={homeAccountId:e.homeAccountId,localAccountId:e.localAccountId,tenantId:e.tenantId};this.browserStorage.setItem(t,JSON.stringify(o)),this.browserStorage.setItem(r,e.localAccountId)}else this.logger.verbose("setActiveAccount: No account passed, active account not set"),this.browserStorage.removeItem(t),this.browserStorage.removeItem(r)}getThrottlingCache(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null;const r=this.validateAndParseJson(t);return!r||!aV(e,r)?(this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getThrottlingCache: cache hit"),r)}setThrottlingCache(e,t){this.logger.trace("BrowserCacheManager.setThrottlingCache called"),this.setItem(e,JSON.stringify(t))}getTemporaryCache(e,t){const r=t?this.generateCacheKey(e):e;if(this.cacheConfig.storeAuthStateInCookie){const a=this.cookieStorage.getItem(r);if(a)return this.logger.trace("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies"),a}const o=this.temporaryCacheStorage.getItem(r);if(!o){if(this.cacheConfig.cacheLocation===_n.LocalStorage){const a=this.browserStorage.getItem(r);if(a)return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage"),a}return this.logger.trace("BrowserCacheManager.getTemporaryCache: No cache item found in local storage"),null}return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item returned"),o}setTemporaryCache(e,t,r){const o=r?this.generateCacheKey(e):e;this.temporaryCacheStorage.setItem(o,t),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie"),this.cookieStorage.setItem(o,t,void 0,this.cacheConfig.secureCookies))}removeItem(e){this.browserStorage.removeItem(e)}removeTemporaryItem(e){this.temporaryCacheStorage.removeItem(e),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie"),this.cookieStorage.removeItem(e))}getKeys(){return this.browserStorage.getKeys()}async clear(){await this.removeAllAccounts(),this.removeAppMetadata(),this.temporaryCacheStorage.getKeys().forEach(e=>{(e.indexOf(B.CACHE_PREFIX)!==-1||e.indexOf(this.clientId)!==-1)&&this.removeTemporaryItem(e)}),this.browserStorage.getKeys().forEach(e=>{(e.indexOf(B.CACHE_PREFIX)!==-1||e.indexOf(this.clientId)!==-1)&&this.browserStorage.removeItem(e)}),this.internalStorage.clear()}async clearTokensAndKeysWithClaims(e,t){e.addQueueMeasurement(x.ClearTokensAndKeysWithClaims,t);const r=this.getTokenKeys(),o=[];r.accessToken.forEach(a=>{const c=this.getAccessTokenCredential(a);c!=null&&c.requestedClaimsHash&&a.includes(c.requestedClaimsHash.toLowerCase())&&o.push(this.removeAccessToken(a))}),await Promise.all(o),o.length>0&&this.logger.warning(`${o.length} access tokens with claims in the cache keys have been removed from the cache.`)}generateCacheKey(e){return this.validateAndParseJson(e)?JSON.stringify(e):_r.startsWith(e,B.CACHE_PREFIX)||_r.startsWith(e,Dt.ADAL_ID_TOKEN)?e:`${B.CACHE_PREFIX}.${this.clientId}.${e}`}generateAuthorityKey(e){const{libraryState:{id:t}}=vr.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${$e.AUTHORITY}.${t}`)}generateNonceKey(e){const{libraryState:{id:t}}=vr.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${$e.NONCE_IDTOKEN}.${t}`)}generateStateKey(e){const{libraryState:{id:t}}=vr.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${$e.REQUEST_STATE}.${t}`)}getCachedAuthority(e){const t=this.generateStateKey(e),r=this.getTemporaryCache(t);if(!r)return null;const o=this.generateAuthorityKey(r);return this.getTemporaryCache(o)}updateCacheEntries(e,t,r,o,a){this.logger.trace("BrowserCacheManager.updateCacheEntries called");const c=this.generateStateKey(e);this.setTemporaryCache(c,e,!1);const d=this.generateNonceKey(e);this.setTemporaryCache(d,t,!1);const h=this.generateAuthorityKey(e);if(this.setTemporaryCache(h,r,!1),a){const f={credential:a.homeAccountId,type:Un.HOME_ACCOUNT_ID};this.setTemporaryCache($e.CCS_CREDENTIAL,JSON.stringify(f),!0)}else if(o){const f={credential:o,type:Un.UPN};this.setTemporaryCache($e.CCS_CREDENTIAL,JSON.stringify(f),!0)}}resetRequestCache(e){this.logger.trace("BrowserCacheManager.resetRequestCache called"),e&&(this.temporaryCacheStorage.getKeys().forEach(t=>{t.indexOf(e)!==-1&&this.removeTemporaryItem(t)}),this.removeTemporaryItem(this.generateStateKey(e)),this.removeTemporaryItem(this.generateNonceKey(e)),this.removeTemporaryItem(this.generateAuthorityKey(e))),this.removeTemporaryItem(this.generateCacheKey($e.REQUEST_PARAMS)),this.removeTemporaryItem(this.generateCacheKey($e.ORIGIN_URI)),this.removeTemporaryItem(this.generateCacheKey($e.URL_HASH)),this.removeTemporaryItem(this.generateCacheKey($e.CORRELATION_ID)),this.removeTemporaryItem(this.generateCacheKey($e.CCS_CREDENTIAL)),this.removeTemporaryItem(this.generateCacheKey($e.NATIVE_REQUEST)),this.setInteractionInProgress(!1)}cleanRequestByState(e){if(this.logger.trace("BrowserCacheManager.cleanRequestByState called"),e){const t=this.generateStateKey(e),r=this.temporaryCacheStorage.getItem(t);this.logger.infoPii(`BrowserCacheManager.cleanRequestByState: Removing temporary cache items for state: ${r}`),this.resetRequestCache(r||B.EMPTY_STRING)}}cleanRequestByInteractionType(e){this.logger.trace("BrowserCacheManager.cleanRequestByInteractionType called"),this.temporaryCacheStorage.getKeys().forEach(t=>{if(t.indexOf($e.REQUEST_STATE)===-1)return;const r=this.temporaryCacheStorage.getItem(t);if(!r)return;const o=CT(this.cryptoImpl,r);o&&o.interactionType===e&&(this.logger.infoPii(`BrowserCacheManager.cleanRequestByInteractionType: Removing temporary cache items for state: ${r}`),this.resetRequestCache(r))}),this.setInteractionInProgress(!1)}cacheCodeRequest(e){this.logger.trace("BrowserCacheManager.cacheCodeRequest called");const t=pm(JSON.stringify(e));this.setTemporaryCache($e.REQUEST_PARAMS,t,!0)}getCachedRequest(e){this.logger.trace("BrowserCacheManager.getCachedRequest called");const t=this.getTemporaryCache($e.REQUEST_PARAMS,!0);if(!t)throw oe(jw);let r;try{r=JSON.parse($r(t))}catch(o){throw this.logger.errorPii(`Attempted to parse: ${t}`),this.logger.error(`Parsing cached token request threw with error: ${o}`),oe(Jw)}if(this.removeTemporaryItem(this.generateCacheKey($e.REQUEST_PARAMS)),!r.authority){const o=this.generateAuthorityKey(e),a=this.getTemporaryCache(o);if(!a)throw oe(fm);r.authority=a}return r}getCachedNativeRequest(){this.logger.trace("BrowserCacheManager.getCachedNativeRequest called");const e=this.getTemporaryCache($e.NATIVE_REQUEST,!0);if(!e)return this.logger.trace("BrowserCacheManager.getCachedNativeRequest: No cached native request found"),null;const t=this.validateAndParseJson(e);return t||(this.logger.error("BrowserCacheManager.getCachedNativeRequest: Unable to parse native request"),null)}isInteractionInProgress(e){const t=this.getInteractionInProgress();return e?t===this.clientId:!!t}getInteractionInProgress(){const e=`${B.CACHE_PREFIX}.${$e.INTERACTION_STATUS_KEY}`;return this.getTemporaryCache(e,!1)}setInteractionInProgress(e){const t=`${B.CACHE_PREFIX}.${$e.INTERACTION_STATUS_KEY}`;if(e){if(this.getInteractionInProgress())throw oe(Hw);this.setTemporaryCache(t,this.clientId,!1)}else!e&&this.getInteractionInProgress()===this.clientId&&this.removeTemporaryItem(t)}getLegacyLoginHint(){const e=this.getTemporaryCache(Dt.ADAL_ID_TOKEN);e&&(this.browserStorage.removeItem(Dt.ADAL_ID_TOKEN),this.logger.verbose("Cached ADAL id token retrieved."));const t=this.getTemporaryCache(Dt.ID_TOKEN,!0);t&&(this.browserStorage.removeItem(this.generateCacheKey(Dt.ID_TOKEN)),this.logger.verbose("Cached MSAL.js v1 id token retrieved"));const r=t||e;if(r){const o=Ii(r,$r);if(o.preferred_username)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 preferred_username as loginHint"),o.preferred_username;if(o.upn)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 upn as loginHint"),o.upn;this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, however, no account hint claim found. Enable preferred_username or upn id token claim to get SSO.")}return null}updateCredentialCacheKey(e,t){const r=ua(t);if(e!==r){const o=this.getItem(e);if(o)return this.browserStorage.removeItem(e),this.setItem(r,o),this.logger.verbose(`Updated an outdated ${t.credentialType} cache key`),r;this.logger.error(`Attempted to update an outdated ${t.credentialType} cache key but no item matching the outdated key was found in storage`)}return e}async hydrateCache(e,t){var d,h,f;const r=ou((d=e.account)==null?void 0:d.homeAccountId,(h=e.account)==null?void 0:h.environment,e.idToken,this.clientId,e.tenantId);let o;t.claims&&(o=await this.cryptoImpl.hashString(t.claims));const a=iu((f=e.account)==null?void 0:f.homeAccountId,e.account.environment,e.accessToken,this.clientId,e.tenantId,e.scopes.join(" "),e.expiresOn?e.expiresOn.getTime()/1e3:0,e.extExpiresOn?e.extExpiresOn.getTime()/1e3:0,$r,void 0,e.tokenType,void 0,t.sshKid,t.claims,o),c={idToken:r,accessToken:a};return this.saveCacheRecord(c)}async saveCacheRecord(e,t,r){try{await super.saveCacheRecord(e,t,r)}catch(o){if(o instanceof ma&&this.performanceClient&&r)try{const a=this.getTokenKeys();this.performanceClient.addFields({cacheRtCount:a.refreshToken.length,cacheIdCount:a.idToken.length,cacheAtCount:a.accessToken.length},r)}catch{}throw o}}}const vH=(n,e)=>{const t={cacheLocation:_n.MemoryStorage,temporaryCacheLocation:_n.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};return new sf(n,t,Al,e)};/*! @azure/msal-browser v3.28.1 2025-01-14 */function yH(n,e,t,r){return n.verbose("getAllAccounts called"),t?e.getAllAccounts(r):[]}function CH(n,e,t){if(e.trace("getAccount called"),Object.keys(n).length===0)return e.warning("getAccount: No accountFilter provided"),null;const r=t.getAccountInfoFilteredBy(n);return r?(e.verbose("getAccount: Account matching provided filter found, returning"),r):(e.verbose("getAccount: No matching account found, returning null"),null)}function EH(n,e,t){if(e.trace("getAccountByUsername called"),!n)return e.warning("getAccountByUsername: No username provided"),null;const r=t.getAccountInfoFilteredBy({username:n});return r?(e.verbose("getAccountByUsername: Account matching username found, returning"),e.verbosePii(`getAccountByUsername: Returning signed-in accounts matching username: ${n}`),r):(e.verbose("getAccountByUsername: No matching account found, returning null"),null)}function wH(n,e,t){if(e.trace("getAccountByHomeId called"),!n)return e.warning("getAccountByHomeId: No homeAccountId provided"),null;const r=t.getAccountInfoFilteredBy({homeAccountId:n});return r?(e.verbose("getAccountByHomeId: Account matching homeAccountId found, returning"),e.verbosePii(`getAccountByHomeId: Returning signed-in accounts matching homeAccountId: ${n}`),r):(e.verbose("getAccountByHomeId: No matching account found, returning null"),null)}function TH(n,e,t){if(e.trace("getAccountByLocalId called"),!n)return e.warning("getAccountByLocalId: No localAccountId provided"),null;const r=t.getAccountInfoFilteredBy({localAccountId:n});return r?(e.verbose("getAccountByLocalId: Account matching localAccountId found, returning"),e.verbosePii(`getAccountByLocalId: Returning signed-in accounts matching localAccountId: ${n}`),r):(e.verbose("getAccountByLocalId: No matching account found, returning null"),null)}function bH(n,e){e.setActiveAccount(n)}function IH(n){return n.getActiveAccount()}/*! @azure/msal-browser v3.28.1 2025-01-14 */const fe={INITIALIZE_START:"msal:initializeStart",INITIALIZE_END:"msal:initializeEnd",ACCOUNT_ADDED:"msal:accountAdded",ACCOUNT_REMOVED:"msal:accountRemoved",ACTIVE_ACCOUNT_CHANGED:"msal:activeAccountChanged",LOGIN_START:"msal:loginStart",LOGIN_SUCCESS:"msal:loginSuccess",LOGIN_FAILURE:"msal:loginFailure",ACQUIRE_TOKEN_START:"msal:acquireTokenStart",ACQUIRE_TOKEN_SUCCESS:"msal:acquireTokenSuccess",ACQUIRE_TOKEN_FAILURE:"msal:acquireTokenFailure",ACQUIRE_TOKEN_NETWORK_START:"msal:acquireTokenFromNetworkStart",SSO_SILENT_START:"msal:ssoSilentStart",SSO_SILENT_SUCCESS:"msal:ssoSilentSuccess",SSO_SILENT_FAILURE:"msal:ssoSilentFailure",ACQUIRE_TOKEN_BY_CODE_START:"msal:acquireTokenByCodeStart",ACQUIRE_TOKEN_BY_CODE_SUCCESS:"msal:acquireTokenByCodeSuccess",ACQUIRE_TOKEN_BY_CODE_FAILURE:"msal:acquireTokenByCodeFailure",HANDLE_REDIRECT_START:"msal:handleRedirectStart",HANDLE_REDIRECT_END:"msal:handleRedirectEnd",POPUP_OPENED:"msal:popupOpened",LOGOUT_START:"msal:logoutStart",LOGOUT_SUCCESS:"msal:logoutSuccess",LOGOUT_FAILURE:"msal:logoutFailure",LOGOUT_END:"msal:logoutEnd",RESTORE_FROM_BFCACHE:"msal:restoreFromBFCache"};/*! @azure/msal-browser v3.28.1 2025-01-14 */class SH{constructor(e){this.eventCallbacks=new Map,this.logger=e||new $o({})}addEventCallback(e,t,r){if(typeof window<"u"){const o=r||rH();return this.eventCallbacks.has(o)?(this.logger.error(`Event callback with id: ${o} is already registered. Please provide a unique id or remove the existing callback and try again.`),null):(this.eventCallbacks.set(o,[e,t||[]]),this.logger.verbose(`Event callback registered with id: ${o}`),o)}return null}removeEventCallback(e){this.eventCallbacks.delete(e),this.logger.verbose(`Event callback ${e} removed.`)}emitEvent(e,t,r,o){if(typeof window<"u"){const a={eventType:e,interactionType:t||null,payload:r||null,error:o||null,timestamp:Date.now()};this.eventCallbacks.forEach(([c,d],h)=>{(d.length===0||d.includes(e))&&(this.logger.verbose(`Emitting event to callback ${h}: ${e}`),c.apply(null,[a]))})}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class ET{constructor(e,t,r,o,a,c,d,h,f){this.config=e,this.browserStorage=t,this.browserCrypto=r,this.networkClient=this.config.system.networkClient,this.eventHandler=a,this.navigationClient=c,this.nativeMessageHandler=h,this.correlationId=f||mo(),this.logger=o.clone(Mn.MSAL_SKU,mu,this.correlationId),this.performanceClient=d}async clearCacheOnLogout(e){if(e){Ot.accountInfoIsEqual(e,this.browserStorage.getActiveAccount(),!1)&&(this.logger.verbose("Setting active account to null"),this.browserStorage.setActiveAccount(null));try{await this.browserStorage.removeAccount(Ot.generateAccountCacheKey(e)),this.logger.verbose("Cleared cache items belonging to the account provided in the logout request.")}catch{this.logger.error("Account provided in logout request was not found. Local cache unchanged.")}}else try{this.logger.verbose("No account provided in logout request, clearing all cache items.",this.correlationId),await this.browserStorage.clear(),await this.browserCrypto.clearKeystore()}catch{this.logger.error("Attempted to clear all MSAL cache items and failed. Local cache unchanged.")}}getRedirectUri(e){this.logger.verbose("getRedirectUri called");const t=e||this.config.auth.redirectUri;return Me.getAbsoluteUrl(t,co())}initializeServerTelemetryManager(e,t){this.logger.verbose("initializeServerTelemetryManager called");const r={clientId:this.config.auth.clientId,correlationId:this.correlationId,apiId:e,forceRefresh:t||!1,wrapperSKU:this.browserStorage.getWrapperMetadata()[0],wrapperVer:this.browserStorage.getWrapperMetadata()[1]};return new Ns(r,this.browserStorage)}async getDiscoveredAuthority(e){const{account:t}=e,r=e.requestExtraQueryParameters&&e.requestExtraQueryParameters.hasOwnProperty("instance_aware")?e.requestExtraQueryParameters.instance_aware:void 0;this.performanceClient.addQueueMeasurement(x.StandardInteractionClientGetDiscoveredAuthority,this.correlationId);const o={protocolMode:this.config.auth.protocolMode,OIDCOptions:this.config.auth.OIDCOptions,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},a=e.requestAuthority||this.config.auth.authority,c=r!=null&&r.length?r==="true":this.config.auth.instanceAware,d=t&&c?this.config.auth.authority.replace(Me.getDomainFromUrl(a),t.environment):a,h=Qt.generateAuthority(d,e.requestAzureCloudOptions||this.config.auth.azureCloudOptions),f=await J(Rw,x.AuthorityFactoryCreateDiscoveredInstance,this.logger,this.performanceClient,this.correlationId)(h,this.config.system.networkClient,this.browserStorage,o,this.logger,this.correlationId,this.performanceClient);if(t&&!f.isAlias(t.environment))throw Qe(Ew);return f}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const AH=32;async function kH(n,e,t){n.addQueueMeasurement(x.GeneratePkceCodes,t);const r=Si(NH,x.GenerateCodeVerifier,e,n,t)(n,e,t),o=await J(RH,x.GenerateCodeChallengeFromVerifier,e,n,t)(r,n,e,t);return{verifier:r,challenge:o}}function NH(n,e,t){try{const r=new Uint8Array(AH);return Si(G2,x.GetRandomValues,e,n,t)(r),fu(r)}catch{throw oe(dm)}}async function RH(n,e,t,r){e.addQueueMeasurement(x.GenerateCodeChallengeFromVerifier,r);try{const o=await J(gT,x.Sha256Digest,t,e,r)(n,e,r);return fu(new Uint8Array(o))}catch{throw oe(dm)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */async function Tm(n,e,t,r){t.addQueueMeasurement(x.InitializeBaseRequest,n.correlationId);const o=n.authority||e.auth.authority,a=[...n&&n.scopes||[]],c={...n,correlationId:n.correlationId,authority:o,scopes:a};if(!c.authenticationScheme)c.authenticationScheme=ze.BEARER,r.verbose(`Authentication Scheme wasn't explicitly set in request, defaulting to "Bearer" request`);else{if(c.authenticationScheme===ze.SSH){if(!n.sshJwk)throw Qe(au);if(!n.sshKid)throw Qe(vw)}r.verbose(`Authentication Scheme set to "${c.authenticationScheme}" as configured in Auth request`)}return e.cache.claimsBasedCachingEnabled&&n.claims&&!_r.isEmptyObj(n.claims)&&(c.requestedClaimsHash=await pT(n.claims)),c}async function OH(n,e,t,r,o){r.addQueueMeasurement(x.InitializeSilentRequest,n.correlationId);const a=await J(Tm,x.InitializeBaseRequest,o,r,n.correlationId)(n,t,r,o);return{...n,...a,account:e,forceRefresh:n.forceRefresh||!1}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Oa extends ET{async initializeAuthorizationCodeRequest(e){this.performanceClient.addQueueMeasurement(x.StandardInteractionClientInitializeAuthorizationCodeRequest,this.correlationId);const t=await J(kH,x.GeneratePkceCodes,this.logger,this.performanceClient,this.correlationId)(this.performanceClient,this.logger,this.correlationId),r={...e,redirectUri:e.redirectUri,code:B.EMPTY_STRING,codeVerifier:t.verifier};return e.codeChallenge=t.challenge,e.codeChallengeMethod=B.S256_CODE_CHALLENGE_METHOD,r}initializeLogoutRequest(e){this.logger.verbose("initializeLogoutRequest called",e==null?void 0:e.correlationId);const t={correlationId:this.correlationId||mo(),...e};if(e)if(e.logoutHint)this.logger.verbose("logoutHint has already been set in logoutRequest");else if(e.account){const r=this.getLogoutHintFromIdTokenClaims(e.account);r&&(this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided"),t.logoutHint=r)}else this.logger.verbose("logoutHint was not set and account was not passed into logout request, logoutHint will not be set");else this.logger.verbose("logoutHint will not be set since no logout request was configured");return!e||e.postLogoutRedirectUri!==null?e&&e.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to uri set on logout request",t.correlationId),t.postLogoutRedirectUri=Me.getAbsoluteUrl(e.postLogoutRedirectUri,co())):this.config.auth.postLogoutRedirectUri===null?this.logger.verbose("postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect",t.correlationId):this.config.auth.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to configured uri",t.correlationId),t.postLogoutRedirectUri=Me.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri,co())):(this.logger.verbose("Setting postLogoutRedirectUri to current page",t.correlationId),t.postLogoutRedirectUri=Me.getAbsoluteUrl(co(),co())):this.logger.verbose("postLogoutRedirectUri passed as null, not setting post logout redirect uri",t.correlationId),t}getLogoutHintFromIdTokenClaims(e){const t=e.idTokenClaims;if(t){if(t.login_hint)return t.login_hint;this.logger.verbose("The ID Token Claims tied to the provided account do not contain a login_hint claim, logoutHint will not be added to logout request")}else this.logger.verbose("The provided account does not contain ID Token Claims, logoutHint will not be added to logout request");return null}async createAuthCodeClient(e){this.performanceClient.addQueueMeasurement(x.StandardInteractionClientCreateAuthCodeClient,this.correlationId);const t=await J(this.getClientConfiguration.bind(this),x.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)(e);return new Mw(t,this.performanceClient)}async getClientConfiguration(e){const{serverTelemetryManager:t,requestAuthority:r,requestAzureCloudOptions:o,requestExtraQueryParameters:a,account:c}=e;this.performanceClient.addQueueMeasurement(x.StandardInteractionClientGetClientConfiguration,this.correlationId);const d=await J(this.getDiscoveredAuthority.bind(this),x.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,this.correlationId)({requestAuthority:r,requestAzureCloudOptions:o,requestExtraQueryParameters:a,account:c}),h=this.config.system.loggerOptions;return{authOptions:{clientId:this.config.auth.clientId,authority:d,clientCapabilities:this.config.auth.clientCapabilities,redirectUri:this.config.auth.redirectUri},systemOptions:{tokenRenewalOffsetSeconds:this.config.system.tokenRenewalOffsetSeconds,preventCorsPreflight:!0},loggerOptions:{loggerCallback:h.loggerCallback,piiLoggingEnabled:h.piiLoggingEnabled,logLevel:h.logLevel,correlationId:this.correlationId},cacheOptions:{claimsBasedCachingEnabled:this.config.cache.claimsBasedCachingEnabled},cryptoInterface:this.browserCrypto,networkInterface:this.networkClient,storageInterface:this.browserStorage,serverTelemetryManager:t,libraryInfo:{sku:Mn.MSAL_SKU,version:mu,cpu:B.EMPTY_STRING,os:B.EMPTY_STRING},telemetry:this.config.telemetry}}async initializeAuthorizationRequest(e,t){this.performanceClient.addQueueMeasurement(x.StandardInteractionClientInitializeAuthorizationRequest,this.correlationId);const r=this.getRedirectUri(e.redirectUri),o={interactionType:t},a=vr.setRequestState(this.browserCrypto,e&&e.state||B.EMPTY_STRING,o),d={...await J(Tm,x.InitializeBaseRequest,this.logger,this.performanceClient,this.correlationId)({...e,correlationId:this.correlationId},this.config,this.performanceClient,this.logger),redirectUri:r,state:a,nonce:e.nonce||mo(),responseMode:this.config.auth.OIDCOptions.serverResponseType};if(e.loginHint||e.sid)return d;const h=e.account||this.browserStorage.getActiveAccount();if(h&&(this.logger.verbose("Setting validated request account",this.correlationId),this.logger.verbosePii(`Setting validated request account: ${h.homeAccountId}`,this.correlationId),d.account=h),!d.loginHint&&!h){const f=this.browserStorage.getLegacyLoginHint();f&&(d.loginHint=f)}return d}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const PH="ContentError",wT="user_switch";/*! @azure/msal-browser v3.28.1 2025-01-14 */const MH="USER_INTERACTION_REQUIRED",DH="USER_CANCEL",LH="NO_NETWORK",xH="PERSISTENT_ERROR",UH="DISABLED",FH="ACCOUNT_UNAVAILABLE";/*! @azure/msal-browser v3.28.1 2025-01-14 */const BH=-2147186943,VH={[wT]:"User attempted to switch accounts in the native broker, which is not allowed. All new accounts must sign-in through the standard web flow first, please try again."};class Ur extends ct{constructor(e,t,r){super(e,t),Object.setPrototypeOf(this,Ur.prototype),this.name="NativeAuthError",this.ext=r}}function ia(n){if(n.ext&&n.ext.status&&(n.ext.status===xH||n.ext.status===UH)||n.ext&&n.ext.error&&n.ext.error===BH)return!0;switch(n.errorCode){case PH:return!0;default:return!1}}function cf(n,e,t){if(t&&t.status)switch(t.status){case FH:return Xh(Ow);case MH:return new Cr(n,e);case DH:return oe(Ti);case LH:return oe(Ml)}return new Ur(n,VH[n]||e,t)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class TT extends Oa{async acquireToken(e){this.performanceClient.addQueueMeasurement(x.SilentCacheClientAcquireToken,e.correlationId);const t=this.initializeServerTelemetryManager(rt.acquireTokenSilent_silentFlow),r=await J(this.getClientConfiguration.bind(this),x.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:t,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,account:e.account}),o=new b2(r,this.performanceClient);this.logger.verbose("Silent auth client created");try{const c=(await J(o.acquireCachedToken.bind(o),x.SilentFlowClientAcquireCachedToken,this.logger,this.performanceClient,e.correlationId)(e))[0];return this.performanceClient.addFields({fromCache:!0},e.correlationId),c}catch(a){throw a instanceof $s&&a.errorCode===mm&&this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair."),a}}logout(e){this.logger.verbose("logoutRedirect called");const t=this.initializeLogoutRequest(e);return this.clearCacheOnLogout(t==null?void 0:t.account)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class ga extends ET{constructor(e,t,r,o,a,c,d,h,f,g,v,p){var C;super(e,t,r,o,a,c,h,f,p),this.apiId=d,this.accountId=g,this.nativeMessageHandler=f,this.nativeStorageManager=v,this.silentCacheClient=new TT(e,this.nativeStorageManager,r,o,a,c,h,f,p),this.serverTelemetryManager=this.initializeServerTelemetryManager(this.apiId);const w=this.nativeMessageHandler.getExtensionId()===ha.PREFERRED_EXTENSION_ID?"chrome":(C=this.nativeMessageHandler.getExtensionId())!=null&&C.length?"unknown":void 0;this.skus=Ns.makeExtraSkuString({libraryName:Mn.MSAL_SKU,libraryVersion:mu,extensionName:w,extensionVersion:this.nativeMessageHandler.getExtensionVersion()})}addRequestSKUs(e){e.extraParameters={...e.extraParameters,[s2]:this.skus}}async acquireToken(e){this.performanceClient.addQueueMeasurement(x.NativeInteractionClientAcquireToken,e.correlationId),this.logger.trace("NativeInteractionClient - acquireToken called.");const t=this.performanceClient.startMeasurement(x.NativeInteractionClientAcquireToken,e.correlationId),r=Wr();try{const o=await this.initializeNativeRequest(e);try{const f=await this.acquireTokensFromCache(this.accountId,o);return t.end({success:!0,isNativeBroker:!1,fromCache:!0}),f}catch{this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call")}const{...a}=o,c={method:mi.GetToken,request:a},d=await this.nativeMessageHandler.sendMessage(c),h=this.validateNativeResponse(d);return await this.handleNativeResponse(h,o,r).then(f=>(t.end({success:!0,isNativeBroker:!0,requestId:f.requestId}),this.serverTelemetryManager.clearNativeBrokerErrorCode(),f)).catch(f=>{throw t.end({success:!1,errorCode:f.errorCode,subErrorCode:f.subError,isNativeBroker:!0}),f})}catch(o){throw o instanceof Ur&&this.serverTelemetryManager.setNativeBrokerErrorCode(o.errorCode),o}}createSilentCacheRequest(e,t){return{authority:e.authority,correlationId:this.correlationId,scopes:_t.fromString(e.scope).asArray(),account:t,forceRefresh:!1}}async acquireTokensFromCache(e,t){if(!e)throw this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided"),Y(Gh);const r=this.browserStorage.getBaseAccountInfo({nativeAccountId:e});if(!r)throw Y(Gh);try{const o=this.createSilentCacheRequest(t,r),a=await this.silentCacheClient.acquireToken(o),c={...r,idTokenClaims:a==null?void 0:a.idTokenClaims,idToken:a==null?void 0:a.idToken};return{...a,account:c}}catch(o){throw o}}async acquireTokenRedirect(e,t){this.logger.trace("NativeInteractionClient - acquireTokenRedirect called.");const{...r}=e;delete r.onRedirectNavigate;const o=await this.initializeNativeRequest(r),a={method:mi.GetToken,request:o};try{const h=await this.nativeMessageHandler.sendMessage(a);this.validateNativeResponse(h)}catch(h){if(h instanceof Ur&&(this.serverTelemetryManager.setNativeBrokerErrorCode(h.errorCode),ia(h)))throw h}this.browserStorage.setTemporaryCache($e.NATIVE_REQUEST,JSON.stringify(o),!0);const c={apiId:rt.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},d=this.config.auth.navigateToLoginRequestUrl?window.location.href:this.getRedirectUri(e.redirectUri);t.end({success:!0}),await this.navigationClient.navigateExternal(d,c)}async handleRedirectPromise(e,t){if(this.logger.trace("NativeInteractionClient - handleRedirectPromise called."),!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const r=this.browserStorage.getCachedNativeRequest();if(!r)return this.logger.verbose("NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null."),e&&t&&(e==null||e.addFields({errorCode:"no_cached_request"},t)),null;const{prompt:o,...a}=r;o&&this.logger.verbose("NativeInteractionClient - handleRedirectPromise called and prompt was included in the original request, removing prompt from cached request to prevent second interaction with native broker window."),this.browserStorage.removeItem(this.browserStorage.generateCacheKey($e.NATIVE_REQUEST));const c={method:mi.GetToken,request:a},d=Wr();try{this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker.");const h=await this.nativeMessageHandler.sendMessage(c);this.validateNativeResponse(h);const f=this.handleNativeResponse(h,a,d);this.browserStorage.setInteractionInProgress(!1);const g=await f;return this.serverTelemetryManager.clearNativeBrokerErrorCode(),g}catch(h){throw this.browserStorage.setInteractionInProgress(!1),h}}logout(){return this.logger.trace("NativeInteractionClient - logout called."),Promise.reject("Logout not implemented yet")}async handleNativeResponse(e,t,r){var g;this.logger.trace("NativeInteractionClient - handleNativeResponse called.");const o=Ii(e.id_token,$r),a=this.createHomeAccountIdentifier(e,o),c=(g=this.browserStorage.getAccountInfoFilteredBy({nativeAccountId:t.accountId}))==null?void 0:g.homeAccountId;if(a!==c&&e.account.id!==t.accountId)throw cf(wT);const d=await this.getDiscoveredAuthority({requestAuthority:t.authority}),h=cm(this.browserStorage,d,a,$r,o,e.client_info,void 0,o.tid,void 0,e.account.id,this.logger),f=await this.generateAuthenticationResult(e,t,o,h,d.canonicalAuthority,r);return this.cacheAccount(h),this.cacheNativeTokens(e,t,a,o,e.access_token,f.tenantId,r),f}createHomeAccountIdentifier(e,t){return Ot.generateHomeAccountId(e.client_info||B.EMPTY_STRING,fr.Default,this.logger,this.browserCrypto,t)}generateScopes(e,t){return e.scope?_t.fromString(e.scope):_t.fromString(t.scope)}async generatePopAccessToken(e,t){if(t.tokenType===ze.POP&&t.signPopToken){if(e.shr)return this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer"),e.shr;const r=new wa(this.browserCrypto),o={resourceRequestMethod:t.resourceRequestMethod,resourceRequestUri:t.resourceRequestUri,shrClaims:t.shrClaims,shrNonce:t.shrNonce};if(!t.keyId)throw Y(qf);return r.signPopToken(e.access_token,t.keyId,o)}else return e.access_token}async generateAuthenticationResult(e,t,r,o,a,c){const d=this.addTelemetryFromNativeResponse(e),h=e.scope?_t.fromString(e.scope):_t.fromString(t.scope),f=e.account.properties||{},g=f.UID||r.oid||r.sub||B.EMPTY_STRING,v=f.TenantId||r.tid||B.EMPTY_STRING,p=nm(o.getAccountInfo(),void 0,r,e.id_token);p.nativeAccountId!==e.account.id&&(p.nativeAccountId=e.account.id);const w=await this.generatePopAccessToken(e,t),C=t.tokenType===ze.POP?ze.POP:ze.BEARER;return{authority:a,uniqueId:g,tenantId:v,scopes:h.asArray(),account:p,idToken:e.id_token,idTokenClaims:r,accessToken:w,fromCache:d?this.isResponseFromCache(d):!1,expiresOn:new Date(Number(c+e.expires_in)*1e3),tokenType:C,correlationId:this.correlationId,state:e.state,fromNativeBroker:!0}}cacheAccount(e){this.browserStorage.setAccount(e),this.browserStorage.removeAccountContext(e).catch(t=>{this.logger.error(`Error occurred while removing account context from browser storage. ${t}`)})}cacheNativeTokens(e,t,r,o,a,c,d){const h=ou(r,t.authority,e.id_token||"",t.clientId,o.tid||""),f=t.tokenType===ze.POP?B.SHR_NONCE_VALIDITY:(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,g=d+f,v=this.generateScopes(e,t),p=iu(r,t.authority,a,t.clientId,o.tid||c,v.printScopes(),g,0,$r,void 0,t.tokenType,void 0,t.keyId),w={idToken:h,accessToken:p};this.nativeStorageManager.saveCacheRecord(w,t.storeInCache)}addTelemetryFromNativeResponse(e){const t=this.getMATSFromResponse(e);return t?(this.performanceClient.addFields({extensionId:this.nativeMessageHandler.getExtensionId(),extensionVersion:this.nativeMessageHandler.getExtensionVersion(),matsBrokerVersion:t.broker_version,matsAccountJoinOnStart:t.account_join_on_start,matsAccountJoinOnEnd:t.account_join_on_end,matsDeviceJoin:t.device_join,matsPromptBehavior:t.prompt_behavior,matsApiErrorCode:t.api_error_code,matsUiVisible:t.ui_visible,matsSilentCode:t.silent_code,matsSilentBiSubCode:t.silent_bi_sub_code,matsSilentMessage:t.silent_message,matsSilentStatus:t.silent_status,matsHttpStatus:t.http_status,matsHttpEventCount:t.http_event_count},this.correlationId),t):null}validateNativeResponse(e){if(e.hasOwnProperty("access_token")&&e.hasOwnProperty("id_token")&&e.hasOwnProperty("client_info")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scope")&&e.hasOwnProperty("expires_in"))return e;throw HE(Hf,"Response missing expected properties.")}getMATSFromResponse(e){if(e.properties.MATS)try{return JSON.parse(e.properties.MATS)}catch{this.logger.error("NativeInteractionClient - Error parsing MATS telemetry, returning null instead")}return null}isResponseFromCache(e){return typeof e.is_cached>"u"?(this.logger.verbose("NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false."),!1):!!e.is_cached}async initializeNativeRequest(e){this.logger.trace("NativeInteractionClient - initializeNativeRequest called");const t=e.authority||this.config.auth.authority;e.account&&await this.getDiscoveredAuthority({requestAuthority:t,requestAzureCloudOptions:e.azureCloudOptions,account:e.account});const r=new Me(t);r.validateAsUri();const{scopes:o,...a}=e,c=new _t(o||[]);c.appendScopes(Ra);const d=()=>{switch(this.apiId){case rt.ssoSilent:case rt.acquireTokenSilent_silentFlow:return this.logger.trace("initializeNativeRequest: silent request sets prompt to none"),Ut.NONE}if(!e.prompt){this.logger.trace("initializeNativeRequest: prompt was not provided");return}switch(e.prompt){case Ut.NONE:case Ut.CONSENT:case Ut.LOGIN:return this.logger.trace("initializeNativeRequest: prompt is compatible with native flow"),e.prompt;default:throw this.logger.trace(`initializeNativeRequest: prompt = ${e.prompt} is not compatible with native flow`),oe(sT)}},h={...a,accountId:this.accountId,clientId:this.config.auth.clientId,authority:r.urlString,scope:c.printScopes(),redirectUri:this.getRedirectUri(e.redirectUri),prompt:d(),correlationId:this.correlationId,tokenType:e.authenticationScheme,windowTitleSubstring:document.title,extraParameters:{...e.extraQueryParameters,...e.tokenQueryParameters},extendedExpiryToken:!1,keyId:e.popKid};if(h.signPopToken&&e.popKid)throw oe(lT);if(this.handleExtraBrokerParams(h),h.extraParameters=h.extraParameters||{},h.extraParameters.telemetry=ha.MATS_TELEMETRY,e.authenticationScheme===ze.POP){const f={resourceRequestUri:e.resourceRequestUri,resourceRequestMethod:e.resourceRequestMethod,shrClaims:e.shrClaims,shrNonce:e.shrNonce},g=new wa(this.browserCrypto);let v;if(h.keyId)v=this.browserCrypto.base64UrlEncode(JSON.stringify({kid:h.keyId})),h.signPopToken=!1;else{const p=await J(g.generateCnf.bind(g),x.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(f,this.logger);v=p.reqCnfString,h.keyId=p.kid,h.signPopToken=!0}h.reqCnf=v}return this.addRequestSKUs(h),h}handleExtraBrokerParams(e){var a;const t=e.extraParameters&&e.extraParameters.hasOwnProperty(im)&&e.extraParameters.hasOwnProperty(Qh)&&e.extraParameters.hasOwnProperty(Ei);if(!e.embeddedClientId&&!t)return;let r="";const o=e.redirectUri;e.embeddedClientId?(e.redirectUri=this.config.auth.redirectUri,r=e.embeddedClientId):e.extraParameters&&(e.redirectUri=e.extraParameters[Qh],r=e.extraParameters[Ei]),e.extraParameters={child_client_id:r,child_redirect_uri:o},(a=this.performanceClient)==null||a.addFields({embeddedClientId:r,embeddedRedirectUri:o},e.correlationId)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Fr{constructor(e,t,r,o){this.logger=e,this.handshakeTimeoutMs=t,this.extensionId=o,this.resolvers=new Map,this.handshakeResolvers=new Map,this.messageChannel=new MessageChannel,this.windowListener=this.onWindowMessage.bind(this),this.performanceClient=r,this.handshakeEvent=r.startMeasurement(x.NativeMessageHandlerHandshake)}async sendMessage(e){this.logger.trace("NativeMessageHandler - sendMessage called.");const t={channel:ha.CHANNEL_ID,extensionId:this.extensionId,responseId:mo(),body:e};return this.logger.trace("NativeMessageHandler - Sending request to browser extension"),this.logger.tracePii(`NativeMessageHandler - Sending request to browser extension: ${JSON.stringify(t)}`),this.messageChannel.port1.postMessage(t),new Promise((r,o)=>{this.resolvers.set(t.responseId,{resolve:r,reject:o})})}static async createProvider(e,t,r){e.trace("NativeMessageHandler - createProvider called.");try{const o=new Fr(e,t,r,ha.PREFERRED_EXTENSION_ID);return await o.sendHandshakeRequest(),o}catch{const a=new Fr(e,t,r);return await a.sendHandshakeRequest(),a}}async sendHandshakeRequest(){this.logger.trace("NativeMessageHandler - sendHandshakeRequest called."),window.addEventListener("message",this.windowListener,!1);const e={channel:ha.CHANNEL_ID,extensionId:this.extensionId,responseId:mo(),body:{method:mi.HandshakeRequest}};return this.handshakeEvent.add({extensionId:this.extensionId,extensionHandshakeTimeoutMs:this.handshakeTimeoutMs}),this.messageChannel.port1.onmessage=t=>{this.onChannelMessage(t)},window.postMessage(e,window.origin,[this.messageChannel.port2]),new Promise((t,r)=>{this.handshakeResolvers.set(e.responseId,{resolve:t,reject:r}),this.timeoutId=window.setTimeout(()=>{window.removeEventListener("message",this.windowListener,!1),this.messageChannel.port1.close(),this.messageChannel.port2.close(),this.handshakeEvent.end({extensionHandshakeTimedOut:!0,success:!1}),r(oe(oT)),this.handshakeResolvers.delete(e.responseId)},this.handshakeTimeoutMs)})}onWindowMessage(e){if(this.logger.trace("NativeMessageHandler - onWindowMessage called"),e.source!==window)return;const t=e.data;if(!(!t.channel||t.channel!==ha.CHANNEL_ID)&&!(t.extensionId&&t.extensionId!==this.extensionId)&&t.body.method===mi.HandshakeRequest){const r=this.handshakeResolvers.get(t.responseId);if(!r){this.logger.trace(`NativeMessageHandler.onWindowMessage - resolver can't be found for request ${t.responseId}`);return}this.logger.verbose(t.extensionId?`Extension with id: ${t.extensionId} not installed`:"No extension installed"),clearTimeout(this.timeoutId),this.messageChannel.port1.close(),this.messageChannel.port2.close(),window.removeEventListener("message",this.windowListener,!1),this.handshakeEvent.end({success:!1,extensionInstalled:!1}),r.reject(oe(iT))}}onChannelMessage(e){this.logger.trace("NativeMessageHandler - onChannelMessage called.");const t=e.data,r=this.resolvers.get(t.responseId),o=this.handshakeResolvers.get(t.responseId);try{const a=t.body.method;if(a===mi.Response){if(!r)return;const c=t.body.response;if(this.logger.trace("NativeMessageHandler - Received response from browser extension"),this.logger.tracePii(`NativeMessageHandler - Received response from browser extension: ${JSON.stringify(c)}`),c.status!=="Success")r.reject(cf(c.code,c.description,c.ext));else if(c.result)c.result.code&&c.result.description?r.reject(cf(c.result.code,c.result.description,c.result.ext)):r.resolve(c.result);else throw HE(Hf,"Event does not contain result.");this.resolvers.delete(t.responseId)}else if(a===mi.HandshakeResponse){if(!o){this.logger.trace(`NativeMessageHandler.onChannelMessage - resolver can't be found for request ${t.responseId}`);return}clearTimeout(this.timeoutId),window.removeEventListener("message",this.windowListener,!1),this.extensionId=t.extensionId,this.extensionVersion=t.body.version,this.logger.verbose(`NativeMessageHandler - Received HandshakeResponse from extension: ${this.extensionId}`),this.handshakeEvent.end({extensionInstalled:!0,success:!0}),o.resolve(),this.handshakeResolvers.delete(t.responseId)}}catch(a){this.logger.error("Error parsing response from WAM Extension"),this.logger.errorPii(`Error parsing response from WAM Extension: ${a}`),this.logger.errorPii(`Unable to parse ${e}`),r?r.reject(a):o&&o.reject(a)}}getExtensionId(){return this.extensionId}getExtensionVersion(){return this.extensionVersion}static isNativeAvailable(e,t,r,o){if(t.trace("isNativeAvailable called"),!e.system.allowNativeBroker)return t.trace("isNativeAvailable: allowNativeBroker is not enabled, returning false"),!1;if(!r)return t.trace("isNativeAvailable: WAM extension provider is not initialized, returning false"),!1;if(o)switch(o){case ze.BEARER:case ze.POP:return t.trace("isNativeAvailable: authenticationScheme is supported, returning true"),!0;default:return t.trace("isNativeAvailable: authenticationScheme is not supported, returning false"),!1}return!0}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class bm{constructor(e,t,r,o,a){this.authModule=e,this.browserStorage=t,this.authCodeRequest=r,this.logger=o,this.performanceClient=a}async handleCodeResponse(e,t){this.performanceClient.addQueueMeasurement(x.HandleCodeResponse,t.correlationId);let r;try{r=this.authModule.handleFragmentResponse(e,t.state)}catch(o){throw o instanceof Ko&&o.subError===Ti?oe(Ti):o}return J(this.handleCodeResponseFromServer.bind(this),x.HandleCodeResponseFromServer,this.logger,this.performanceClient,t.correlationId)(r,t)}async handleCodeResponseFromServer(e,t,r=!0){if(this.performanceClient.addQueueMeasurement(x.HandleCodeResponseFromServer,t.correlationId),this.logger.trace("InteractionHandler.handleCodeResponseFromServer called"),this.authCodeRequest.code=e.code,e.cloud_instance_host_name&&await J(this.authModule.updateAuthority.bind(this.authModule),x.UpdateTokenEndpointAuthority,this.logger,this.performanceClient,t.correlationId)(e.cloud_instance_host_name,t.correlationId),r&&(e.nonce=t.nonce||void 0),e.state=t.state,e.client_info)this.authCodeRequest.clientInfo=e.client_info;else{const a=this.createCcsCredentials(t);a&&(this.authCodeRequest.ccsCredential=a)}return await J(this.authModule.acquireToken.bind(this.authModule),x.AuthClientAcquireToken,this.logger,this.performanceClient,t.correlationId)(this.authCodeRequest,e)}createCcsCredentials(e){return e.account?{credential:e.account.homeAccountId,type:Un.HOME_ACCOUNT_ID}:e.loginHint?{credential:e.loginHint,type:Un.UPN}:null}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function bT(n,e,t){const r=Rl(n);if(!r)throw Tw(n)?(t.error(`A ${e} is present in the iframe but it does not contain known properties. It's likely that the ${e} has been replaced by code running on the redirectUri page.`),t.errorPii(`The ${e} detected is: ${n}`),oe(Fw)):(t.error(`The request has returned to the redirectUri but a ${e} is not present. It's likely that the ${e} has been removed or the page has been redirected by code running on the redirectUri page.`),oe(Uw));return r}function HH(n,e,t){if(!n.state)throw oe(hm);const r=CT(e,n.state);if(!r)throw oe(Bw);if(r.interactionType!==t)throw oe(Vw)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class $H extends Oa{constructor(e,t,r,o,a,c,d,h,f,g){super(e,t,r,o,a,c,d,f,g),this.unloadWindow=this.unloadWindow.bind(this),this.nativeStorage=h}acquireToken(e){try{const r={popupName:this.generatePopupName(e.scopes||Ra,e.authority||this.config.auth.authority),popupWindowAttributes:e.popupWindowAttributes||{},popupWindowParent:e.popupWindowParent??window};return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true, acquiring token"),this.acquireTokenPopupAsync(e,r)):(this.logger.verbose("asyncPopup set to false, opening popup before acquiring token"),r.popup=this.openSizedPopup("about:blank",r),this.acquireTokenPopupAsync(e,r))}catch(t){return Promise.reject(t)}}logout(e){try{this.logger.verbose("logoutPopup called");const t=this.initializeLogoutRequest(e),r={popupName:this.generateLogoutPopupName(t),popupWindowAttributes:(e==null?void 0:e.popupWindowAttributes)||{},popupWindowParent:(e==null?void 0:e.popupWindowParent)??window},o=e&&e.authority,a=e&&e.mainWindowRedirectUri;return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true"),this.logoutPopupAsync(t,r,o,a)):(this.logger.verbose("asyncPopup set to false, opening popup"),r.popup=this.openSizedPopup("about:blank",r),this.logoutPopupAsync(t,r,o,a))}catch(t){return Promise.reject(t)}}async acquireTokenPopupAsync(e,t){var a;this.logger.verbose("acquireTokenPopupAsync called");const r=this.initializeServerTelemetryManager(rt.acquireTokenPopup),o=await J(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,ce.Popup);yT(o.authority);try{const c=await J(this.initializeAuthorizationCodeRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationCodeRequest,this.logger,this.performanceClient,this.correlationId)(o),d=await J(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:o.authority,requestAzureCloudOptions:o.azureCloudOptions,requestExtraQueryParameters:o.extraQueryParameters,account:o.account}),h=Fr.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,e.authenticationScheme);let f;h&&(f=this.performanceClient.startMeasurement(x.FetchAccountIdWithNativeBroker,e.correlationId));const g=await d.getAuthCodeUrl({...o,nativeBroker:h}),v=new bm(d,this.browserStorage,c,this.logger,this.performanceClient),p=this.initiateAuthRequest(g,t);this.eventHandler.emitEvent(fe.POPUP_OPENED,ce.Popup,{popupWindow:p},null);const w=await this.monitorPopupForHash(p,t.popupWindowParent),C=Si(bT,x.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(w,this.config.auth.OIDCOptions.serverResponseType,this.logger);if(xr.removeThrottle(this.browserStorage,this.config.auth.clientId,c),C.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),f&&f.end({success:!0,isNativeBroker:!0}),!this.nativeMessageHandler)throw oe(Hs);const k=new ga(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,rt.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,C.accountId,this.nativeStorage,o.correlationId),{userRequestState:I}=vr.parseRequestState(this.browserCrypto,o.state);return await k.acquireToken({...o,state:I,prompt:void 0})}return await v.handleCodeResponse(C,o)}catch(c){throw(a=t.popup)==null||a.close(),c instanceof ct&&(c.setCorrelationId(this.correlationId),r.cacheFailedRequest(c)),c}}async logoutPopupAsync(e,t,r,o){var c,d,h,f;this.logger.verbose("logoutPopupAsync called"),this.eventHandler.emitEvent(fe.LOGOUT_START,ce.Popup,e);const a=this.initializeServerTelemetryManager(rt.logoutPopup);try{await this.clearCacheOnLogout(e.account);const g=await J(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:a,requestAuthority:r,account:e.account||void 0});try{g.authority.endSessionEndpoint}catch{if((c=e.account)!=null&&c.homeAccountId&&e.postLogoutRedirectUri&&g.authority.protocolMode===ho.OIDC){if(this.browserStorage.removeAccount((d=e.account)==null?void 0:d.homeAccountId),this.eventHandler.emitEvent(fe.LOGOUT_SUCCESS,ce.Popup,e),o){const w={apiId:rt.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},C=Me.getAbsoluteUrl(o,co());await this.navigationClient.navigateInternal(C,w)}(h=t.popup)==null||h.close();return}}const v=g.getLogoutUri(e);this.eventHandler.emitEvent(fe.LOGOUT_SUCCESS,ce.Popup,e);const p=this.openPopup(v,t);if(this.eventHandler.emitEvent(fe.POPUP_OPENED,ce.Popup,{popupWindow:p},null),await this.monitorPopupForHash(p,t.popupWindowParent).catch(()=>{}),o){const w={apiId:rt.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},C=Me.getAbsoluteUrl(o,co());this.logger.verbose("Redirecting main window to url specified in the request"),this.logger.verbosePii(`Redirecting main window to: ${C}`),await this.navigationClient.navigateInternal(C,w)}else this.logger.verbose("No main window navigation requested")}catch(g){throw(f=t.popup)==null||f.close(),g instanceof ct&&(g.setCorrelationId(this.correlationId),a.cacheFailedRequest(g)),this.browserStorage.setInteractionInProgress(!1),this.eventHandler.emitEvent(fe.LOGOUT_FAILURE,ce.Popup,null,g),this.eventHandler.emitEvent(fe.LOGOUT_END,ce.Popup),g}this.eventHandler.emitEvent(fe.LOGOUT_END,ce.Popup)}initiateAuthRequest(e,t){if(e)return this.logger.infoPii(`Navigate to: ${e}`),this.openPopup(e,t);throw this.logger.error("Navigate url is empty"),oe(uu)}monitorPopupForHash(e,t){return new Promise((r,o)=>{this.logger.verbose("PopupHandler.monitorPopupForHash - polling started");const a=setInterval(()=>{if(e.closed){this.logger.error("PopupHandler.monitorPopupForHash - window closed"),clearInterval(a),o(oe(Ti));return}let c="";try{c=e.location.href}catch{}if(!c||c==="about:blank")return;clearInterval(a);let d="";const h=this.config.auth.OIDCOptions.serverResponseType;e&&(h===Vs.QUERY?d=e.location.search:d=e.location.hash),this.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller"),r(d)},this.config.system.pollIntervalMilliseconds)}).finally(()=>{this.cleanPopup(e,t)})}openPopup(e,t){try{let r;if(t.popup?(r=t.popup,this.logger.verbosePii(`Navigating popup window to: ${e}`),r.location.assign(e)):typeof t.popup>"u"&&(this.logger.verbosePii(`Opening popup window to: ${e}`),r=this.openSizedPopup(e,t)),!r)throw oe(Kw);return r.focus&&r.focus(),this.currentWindow=r,t.popupWindowParent.addEventListener("beforeunload",this.unloadWindow),r}catch(r){throw this.logger.error("error opening popup "+r.message),this.browserStorage.setInteractionInProgress(!1),oe($w)}}openSizedPopup(e,{popupName:t,popupWindowAttributes:r,popupWindowParent:o}){var w,C,T,k;const a=o.screenLeft?o.screenLeft:o.screenX,c=o.screenTop?o.screenTop:o.screenY,d=o.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,h=o.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;let f=(w=r.popupSize)==null?void 0:w.width,g=(C=r.popupSize)==null?void 0:C.height,v=(T=r.popupPosition)==null?void 0:T.top,p=(k=r.popupPosition)==null?void 0:k.left;return(!f||f<0||f>d)&&(this.logger.verbose("Default popup window width used. Window width not configured or invalid."),f=Mn.POPUP_WIDTH),(!g||g<0||g>h)&&(this.logger.verbose("Default popup window height used. Window height not configured or invalid."),g=Mn.POPUP_HEIGHT),(!v||v<0||v>h)&&(this.logger.verbose("Default popup window top position used. Window top not configured or invalid."),v=Math.max(0,h/2-Mn.POPUP_HEIGHT/2+c)),(!p||p<0||p>d)&&(this.logger.verbose("Default popup window left position used. Window left not configured or invalid."),p=Math.max(0,d/2-Mn.POPUP_WIDTH/2+a)),o.open(e,t,`width=${f}, height=${g}, top=${v}, left=${p}, scrollbars=yes`)}unloadWindow(e){this.browserStorage.cleanRequestByInteractionType(ce.Popup),this.currentWindow&&this.currentWindow.close(),e.preventDefault()}cleanPopup(e,t){e.close(),t.removeEventListener("beforeunload",this.unloadWindow),this.browserStorage.setInteractionInProgress(!1)}generatePopupName(e,t){return`${Mn.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${e.join("-")}.${t}.${this.correlationId}`}generateLogoutPopupName(e){const t=e.account&&e.account.homeAccountId;return`${Mn.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${t}.${this.correlationId}`}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class ly{constructor(e,t,r,o,a){this.authModule=e,this.browserStorage=t,this.authCodeRequest=r,this.logger=o,this.performanceClient=a}async initiateAuthRequest(e,t){if(this.logger.verbose("RedirectHandler.initiateAuthRequest called"),e){t.redirectStartPage&&(this.logger.verbose("RedirectHandler.initiateAuthRequest: redirectStartPage set, caching start page"),this.browserStorage.setTemporaryCache($e.ORIGIN_URI,t.redirectStartPage,!0)),this.browserStorage.setTemporaryCache($e.CORRELATION_ID,this.authCodeRequest.correlationId,!0),this.browserStorage.cacheCodeRequest(this.authCodeRequest),this.logger.infoPii(`RedirectHandler.initiateAuthRequest: Navigate to: ${e}`);const r={apiId:rt.acquireTokenRedirect,timeout:t.redirectTimeout,noHistory:!1};if(typeof t.onRedirectNavigate=="function")if(this.logger.verbose("RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback"),t.onRedirectNavigate(e)!==!1){this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating"),await t.navigationClient.navigateExternal(e,r);return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate returned false, stopping navigation");return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: Navigating window to navigate url"),await t.navigationClient.navigateExternal(e,r);return}}else throw this.logger.info("RedirectHandler.initiateAuthRequest: Navigate url is empty"),oe(uu)}async handleCodeResponse(e,t){this.logger.verbose("RedirectHandler.handleCodeResponse called"),this.browserStorage.setInteractionInProgress(!1);const r=this.browserStorage.generateStateKey(t),o=this.browserStorage.getTemporaryCache(r);if(!o)throw Y(Sl,"Cached State");let a;try{a=this.authModule.handleFragmentResponse(e,o)}catch(f){throw f instanceof Ko&&f.subError===Ti?oe(Ti):f}const c=this.browserStorage.generateNonceKey(o),d=this.browserStorage.getTemporaryCache(c);if(this.authCodeRequest.code=a.code,a.cloud_instance_host_name&&await J(this.authModule.updateAuthority.bind(this.authModule),x.UpdateTokenEndpointAuthority,this.logger,this.performanceClient,this.authCodeRequest.correlationId)(a.cloud_instance_host_name,this.authCodeRequest.correlationId),a.nonce=d||void 0,a.state=o,a.client_info)this.authCodeRequest.clientInfo=a.client_info;else{const f=this.checkCcsCredentials();f&&(this.authCodeRequest.ccsCredential=f)}const h=await this.authModule.acquireToken(this.authCodeRequest,a);return this.browserStorage.cleanRequestByState(t),h}checkCcsCredentials(){const e=this.browserStorage.getTemporaryCache($e.CCS_CREDENTIAL,!0);if(e)try{return JSON.parse(e)}catch{this.authModule.logger.error("Cache credential could not be parsed"),this.authModule.logger.errorPii(`Cache credential could not be parsed: ${e}`)}return null}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function KH(){if(typeof window>"u"||typeof window.performance>"u"||typeof window.performance.getEntriesByType!="function")return;const n=window.performance.getEntriesByType("navigation"),e=n.length?n[0]:void 0;return e==null?void 0:e.type}class WH extends Oa{constructor(e,t,r,o,a,c,d,h,f,g){super(e,t,r,o,a,c,d,f,g),this.nativeStorage=h}async acquireToken(e){const t=await J(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,ce.Redirect);this.browserStorage.updateCacheEntries(t.state,t.nonce,t.authority,t.loginHint||"",t.account||null);const r=this.initializeServerTelemetryManager(rt.acquireTokenRedirect),o=a=>{a.persisted&&(this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache."),this.browserStorage.cleanRequestByState(t.state),this.eventHandler.emitEvent(fe.RESTORE_FROM_BFCACHE,ce.Redirect))};try{const a=await J(this.initializeAuthorizationCodeRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationCodeRequest,this.logger,this.performanceClient,this.correlationId)(t),c=await J(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:t.authority,requestAzureCloudOptions:t.azureCloudOptions,requestExtraQueryParameters:t.extraQueryParameters,account:t.account}),d=new ly(c,this.browserStorage,a,this.logger,this.performanceClient),h=await c.getAuthCodeUrl({...t,nativeBroker:Fr.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,e.authenticationScheme)}),f=this.getRedirectStartPage(e.redirectStartPage);return this.logger.verbosePii(`Redirect start page: ${f}`),window.addEventListener("pageshow",o),await d.initiateAuthRequest(h,{navigationClient:this.navigationClient,redirectTimeout:this.config.system.redirectNavigationTimeout,redirectStartPage:f,onRedirectNavigate:e.onRedirectNavigate||this.config.auth.onRedirectNavigate})}catch(a){throw a instanceof ct&&(a.setCorrelationId(this.correlationId),r.cacheFailedRequest(a)),window.removeEventListener("pageshow",o),this.browserStorage.cleanRequestByState(t.state),a}}async handleRedirectPromise(e="",t){const r=this.initializeServerTelemetryManager(rt.handleRedirectPromise);try{if(!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const[o,a]=this.getRedirectResponse(e||"");if(!o)return this.logger.info("handleRedirectPromise did not detect a response as a result of a redirect. Cleaning temporary cache."),this.browserStorage.cleanRequestByInteractionType(ce.Redirect),KH()!=="back_forward"?t.event.errorCode="no_server_response":this.logger.verbose("Back navigation event detected. Muting no_server_response error"),null;const c=this.browserStorage.getTemporaryCache($e.ORIGIN_URI,!0)||B.EMPTY_STRING,d=Me.removeHashFromUrl(c),h=Me.removeHashFromUrl(window.location.href);if(d===h&&this.config.auth.navigateToLoginRequestUrl)return this.logger.verbose("Current page is loginRequestUrl, handling response"),c.indexOf("#")>-1&&Q2(c),await this.handleResponse(o,r);if(this.config.auth.navigateToLoginRequestUrl){if(!Cm()||this.config.system.allowRedirectInIframe){this.browserStorage.setTemporaryCache($e.URL_HASH,a,!0);const f={apiId:rt.handleRedirectPromise,timeout:this.config.system.redirectNavigationTimeout,noHistory:!0};let g=!0;if(!c||c==="null"){const v=Z2();this.browserStorage.setTemporaryCache($e.ORIGIN_URI,v,!0),this.logger.warning("Unable to get valid login request url from cache, redirecting to home page"),g=await this.navigationClient.navigateInternal(v,f)}else this.logger.verbose(`Navigating to loginRequestUrl: ${c}`),g=await this.navigationClient.navigateInternal(c,f);if(!g)return await this.handleResponse(o,r)}}else return this.logger.verbose("NavigateToLoginRequestUrl set to false, handling response"),await this.handleResponse(o,r);return null}catch(o){throw o instanceof ct&&(o.setCorrelationId(this.correlationId),r.cacheFailedRequest(o)),this.browserStorage.cleanRequestByInteractionType(ce.Redirect),o}}getRedirectResponse(e){this.logger.verbose("getRedirectResponseHash called");let t=e;t||(this.config.auth.OIDCOptions.serverResponseType===Vs.QUERY?t=window.location.search:t=window.location.hash);let r=Rl(t);if(r){try{HH(r,this.browserCrypto,ce.Redirect)}catch(a){return a instanceof ct&&this.logger.error(`Interaction type validation failed due to ${a.errorCode}: ${a.errorMessage}`),[null,""]}return J2(window),this.logger.verbose("Hash contains known properties, returning response hash"),[r,t]}const o=this.browserStorage.getTemporaryCache($e.URL_HASH,!0);return this.browserStorage.removeItem(this.browserStorage.generateCacheKey($e.URL_HASH)),o&&(r=Rl(o),r)?(this.logger.verbose("Hash does not contain known properties, returning cached hash"),[r,o]):[null,""]}async handleResponse(e,t){const r=e.state;if(!r)throw oe(hm);const o=this.browserStorage.getCachedRequest(r);if(this.logger.verbose("handleResponse called, retrieved cached request"),e.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw oe(Hs);const h=new ga(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,rt.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,e.accountId,this.nativeStorage,o.correlationId),{userRequestState:f}=vr.parseRequestState(this.browserCrypto,r);return h.acquireToken({...o,state:f,prompt:void 0}).finally(()=>{this.browserStorage.cleanRequestByState(r)})}const a=this.browserStorage.getCachedAuthority(r);if(!a)throw oe(fm);const c=await J(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:t,requestAuthority:a});return xr.removeThrottle(this.browserStorage,this.config.auth.clientId,o),new ly(c,this.browserStorage,o,this.logger,this.performanceClient).handleCodeResponse(e,r)}async logout(e){var o,a;this.logger.verbose("logoutRedirect called");const t=this.initializeLogoutRequest(e),r=this.initializeServerTelemetryManager(rt.logout);try{this.eventHandler.emitEvent(fe.LOGOUT_START,ce.Redirect,e),await this.clearCacheOnLogout(t.account);const c={apiId:rt.logout,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},d=await J(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:e&&e.authority,requestExtraQueryParameters:e==null?void 0:e.extraQueryParameters,account:e&&e.account||void 0});if(d.authority.protocolMode===ho.OIDC)try{d.authority.endSessionEndpoint}catch{if((o=t.account)!=null&&o.homeAccountId){this.browserStorage.removeAccount((a=t.account)==null?void 0:a.homeAccountId),this.eventHandler.emitEvent(fe.LOGOUT_SUCCESS,ce.Redirect,t);return}}const h=d.getLogoutUri(t);if(this.eventHandler.emitEvent(fe.LOGOUT_SUCCESS,ce.Redirect,t),e&&typeof e.onRedirectNavigate=="function")if(e.onRedirectNavigate(h)!==!1){this.logger.verbose("Logout onRedirectNavigate did not return false, navigating"),this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),await this.navigationClient.navigateExternal(h,c);return}else this.browserStorage.setInteractionInProgress(!1),this.logger.verbose("Logout onRedirectNavigate returned false, stopping navigation");else{this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),await this.navigationClient.navigateExternal(h,c);return}}catch(c){throw c instanceof ct&&(c.setCorrelationId(this.correlationId),r.cacheFailedRequest(c)),this.eventHandler.emitEvent(fe.LOGOUT_FAILURE,ce.Redirect,null,c),this.eventHandler.emitEvent(fe.LOGOUT_END,ce.Redirect),c}this.eventHandler.emitEvent(fe.LOGOUT_END,ce.Redirect)}getRedirectStartPage(e){const t=e||window.location.href;return Me.getAbsoluteUrl(t,co())}}/*! @azure/msal-browser v3.28.1 2025-01-14 */async function zH(n,e,t,r,o){if(e.addQueueMeasurement(x.SilentHandlerInitiateAuthRequest,r),!n)throw t.info("Navigate url is empty"),oe(uu);return o?J(qH,x.SilentHandlerLoadFrame,t,e,r)(n,o,e,r):Si(YH,x.SilentHandlerLoadFrameSync,t,e,r)(n)}async function GH(n,e,t,r,o,a,c){return r.addQueueMeasurement(x.SilentHandlerMonitorIframeForHash,a),new Promise((d,h)=>{e<of&&o.warning(`system.loadFrameTimeout or system.iframeHashTimeout set to lower (${e}ms) than the default (${of}ms). This may result in timeouts.`);const f=window.setTimeout(()=>{window.clearInterval(g),h(oe(Ww))},e),g=window.setInterval(()=>{let v="";const p=n.contentWindow;try{v=p?p.location.href:""}catch{}if(!v||v==="about:blank")return;let w="";p&&(c===Vs.QUERY?w=p.location.search:w=p.location.hash),window.clearTimeout(f),window.clearInterval(g),d(w)},t)}).finally(()=>{Si(jH,x.RemoveHiddenIframe,o,r,a)(n)})}function qH(n,e,t,r){return t.addQueueMeasurement(x.SilentHandlerLoadFrame,r),new Promise((o,a)=>{const c=IT();window.setTimeout(()=>{if(!c){a("Unable to load iframe");return}c.src=n,o(c)},e)})}function YH(n){const e=IT();return e.src=n,e}function IT(){const n=document.createElement("iframe");return n.className="msalSilentIframe",n.style.visibility="hidden",n.style.position="absolute",n.style.width=n.style.height="0",n.style.border="0",n.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),document.body.appendChild(n),n}function jH(n){document.body===n.parentNode&&document.body.removeChild(n)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class JH extends Oa{constructor(e,t,r,o,a,c,d,h,f,g,v){super(e,t,r,o,a,c,h,g,v),this.apiId=d,this.nativeStorage=f}async acquireToken(e){this.performanceClient.addQueueMeasurement(x.SilentIframeClientAcquireToken,e.correlationId),!e.loginHint&&!e.sid&&(!e.account||!e.account.username)&&this.logger.warning("No user hint provided. The authorization server may need more information to complete this request.");const t={...e};t.prompt?t.prompt!==Ut.NONE&&t.prompt!==Ut.NO_SESSION&&(this.logger.warning(`SilentIframeClient. Replacing invalid prompt ${t.prompt} with ${Ut.NONE}`),t.prompt=Ut.NONE):t.prompt=Ut.NONE;const r=await J(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(t,ce.Silent);yT(r.authority);const o=this.initializeServerTelemetryManager(this.apiId);let a;try{return a=await J(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:o,requestAuthority:r.authority,requestAzureCloudOptions:r.azureCloudOptions,requestExtraQueryParameters:r.extraQueryParameters,account:r.account}),await J(this.silentTokenHelper.bind(this),x.SilentIframeClientTokenHelper,this.logger,this.performanceClient,e.correlationId)(a,r)}catch(c){if(c instanceof ct&&(c.setCorrelationId(this.correlationId),o.cacheFailedRequest(c)),!a||!(c instanceof ct)||c.errorCode!==Mn.INVALID_GRANT_ERROR)throw c;this.performanceClient.addFields({retryError:c.errorCode},this.correlationId);const d=await J(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(t,ce.Silent);return await J(this.silentTokenHelper.bind(this),x.SilentIframeClientTokenHelper,this.logger,this.performanceClient,this.correlationId)(a,d)}}logout(){return Promise.reject(oe(du))}async silentTokenHelper(e,t){const r=t.correlationId;this.performanceClient.addQueueMeasurement(x.SilentIframeClientTokenHelper,r);const o=await J(this.initializeAuthorizationCodeRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationCodeRequest,this.logger,this.performanceClient,r)(t),a=await J(e.getAuthCodeUrl.bind(e),x.GetAuthCodeUrl,this.logger,this.performanceClient,r)({...t,nativeBroker:Fr.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,t.authenticationScheme)}),c=new bm(e,this.browserStorage,o,this.logger,this.performanceClient),d=await J(zH,x.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,r)(a,this.performanceClient,this.logger,r,this.config.system.navigateFrameWait),h=this.config.auth.OIDCOptions.serverResponseType,f=await J(GH,x.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,r)(d,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,r,h),g=Si(bT,x.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(f,h,this.logger);if(g.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw oe(Hs);const v=new ga(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.apiId,this.performanceClient,this.nativeMessageHandler,g.accountId,this.browserStorage,r),{userRequestState:p}=vr.parseRequestState(this.browserCrypto,t.state);return J(v.acquireToken.bind(v),x.NativeInteractionClientAcquireToken,this.logger,this.performanceClient,r)({...t,state:p,prompt:t.prompt||Ut.NONE})}return J(c.handleCodeResponse.bind(c),x.HandleCodeResponse,this.logger,this.performanceClient,r)(g,t)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class QH extends Oa{async acquireToken(e){this.performanceClient.addQueueMeasurement(x.SilentRefreshClientAcquireToken,e.correlationId);const t=await J(Tm,x.InitializeBaseRequest,this.logger,this.performanceClient,e.correlationId)(e,this.config,this.performanceClient,this.logger),r={...e,...t};e.redirectUri&&(r.redirectUri=this.getRedirectUri(e.redirectUri));const o=this.initializeServerTelemetryManager(rt.acquireTokenSilent_silentFlow),a=await this.createRefreshTokenClient({serverTelemetryManager:o,authorityUrl:r.authority,azureCloudOptions:r.azureCloudOptions,account:r.account});return J(a.acquireTokenByRefreshToken.bind(a),x.RefreshTokenClientAcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(r).catch(c=>{throw c.setCorrelationId(this.correlationId),o.cacheFailedRequest(c),c})}logout(){return Promise.reject(oe(du))}async createRefreshTokenClient(e){const t=await J(this.getClientConfiguration.bind(this),x.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:e.serverTelemetryManager,requestAuthority:e.authorityUrl,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return new Zh(t,this.performanceClient)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class XH{constructor(e,t,r,o){this.isBrowserEnvironment=typeof window<"u",this.config=e,this.storage=t,this.logger=r,this.cryptoObj=o}loadExternalTokens(e,t,r){if(!this.isBrowserEnvironment)throw oe(hu);const o=t.id_token?Ii(t.id_token,$r):void 0,a={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},c=e.authority?new Qt(Qt.generateAuthority(e.authority,e.azureCloudOptions),this.config.system.networkClient,this.storage,a,this.logger,e.correlationId||mo()):void 0,d=this.loadAccount(e,r.clientInfo||t.client_info||"",o,c),h=this.loadIdToken(t,d.homeAccountId,d.environment,d.realm),f=this.loadAccessToken(e,t,d.homeAccountId,d.environment,d.realm,r),g=this.loadRefreshToken(t,d.homeAccountId,d.environment);return this.generateAuthenticationResult(e,{account:d,idToken:h,accessToken:f,refreshToken:g},o,c)}loadAccount(e,t,r,o){if(this.logger.verbose("TokenCache - loading account"),e.account){const h=Ot.createFromAccountInfo(e.account);return this.storage.setAccount(h),h}else if(!o||!t&&!r)throw this.logger.error("TokenCache - if an account is not provided on the request, authority and either clientInfo or idToken must be provided instead."),oe(Zw);const a=Ot.generateHomeAccountId(t,o.authorityType,this.logger,this.cryptoObj,r),c=r==null?void 0:r.tid,d=cm(this.storage,o,a,$r,r,t,o.hostnameAndPort,c,void 0,void 0,this.logger);return this.storage.setAccount(d),d}loadIdToken(e,t,r,o){if(!e.id_token)return this.logger.verbose("TokenCache - no id token found in response"),null;this.logger.verbose("TokenCache - loading id token");const a=ou(t,r,e.id_token,this.config.auth.clientId,o);return this.storage.setIdTokenCredential(a),a}loadAccessToken(e,t,r,o,a,c){if(t.access_token)if(t.expires_in){if(!t.scope&&(!e.scopes||!e.scopes.length))return this.logger.error("TokenCache - scopes not specified in the request or response. Cannot add token to the cache."),null}else return this.logger.error("TokenCache - no expiration set on the access token. Cannot add it to the cache."),null;else return this.logger.verbose("TokenCache - no access token found in response"),null;this.logger.verbose("TokenCache - loading access token");const d=t.scope?_t.fromString(t.scope):new _t(e.scopes),h=c.expiresOn||t.expires_in+new Date().getTime()/1e3,f=c.extendedExpiresOn||(t.ext_expires_in||t.expires_in)+new Date().getTime()/1e3,g=iu(r,o,t.access_token,this.config.auth.clientId,a,d.printScopes(),h,f,$r);return this.storage.setAccessTokenCredential(g),g}loadRefreshToken(e,t,r){if(!e.refresh_token)return this.logger.verbose("TokenCache - no refresh token found in response"),null;this.logger.verbose("TokenCache - loading refresh token");const o=sw(t,r,e.refresh_token,this.config.auth.clientId,e.foci,void 0,e.refresh_token_expires_in);return this.storage.setRefreshTokenCredential(o),o}generateAuthenticationResult(e,t,r,o){var g,v,p;let a="",c=[],d=null,h;t!=null&&t.accessToken&&(a=t.accessToken.secret,c=_t.fromString(t.accessToken.target).asArray(),d=new Date(Number(t.accessToken.expiresOn)*1e3),h=new Date(Number(t.accessToken.extendedExpiresOn)*1e3));const f=t.account;return{authority:o?o.canonicalAuthority:"",uniqueId:t.account.localAccountId,tenantId:t.account.realm,scopes:c,account:f.getAccountInfo(),idToken:((g=t.idToken)==null?void 0:g.secret)||"",idTokenClaims:r||{},accessToken:a,fromCache:!0,expiresOn:d,correlationId:e.correlationId||"",requestId:"",extExpiresOn:h,familyId:((v=t.refreshToken)==null?void 0:v.familyId)||"",tokenType:((p=t==null?void 0:t.accessToken)==null?void 0:p.tokenType)||"",state:e.state||"",cloudGraphHostName:f.cloudGraphHostName||"",msGraphHost:f.msGraphHost||"",fromNativeBroker:!1}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class ZH extends Mw{constructor(e){super(e),this.includeRedirectUri=!1}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class e$ extends Oa{constructor(e,t,r,o,a,c,d,h,f,g){super(e,t,r,o,a,c,h,f,g),this.apiId=d}async acquireToken(e){if(!e.code)throw oe(eT);const t=await J(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(e,ce.Silent),r=this.initializeServerTelemetryManager(this.apiId);try{const o={...t,code:e.code},a=await J(this.getClientConfiguration.bind(this),x.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:r,requestAuthority:t.authority,requestAzureCloudOptions:t.azureCloudOptions,requestExtraQueryParameters:t.extraQueryParameters,account:t.account}),c=new ZH(a);this.logger.verbose("Auth code client created");const d=new bm(c,this.browserStorage,o,this.logger,this.performanceClient);return await J(d.handleCodeResponseFromServer.bind(d),x.HandleCodeResponseFromServer,this.logger,this.performanceClient,e.correlationId)({code:e.code,msgraph_host:e.msGraphHost,cloud_graph_host_name:e.cloudGraphHostName,cloud_instance_host_name:e.cloudInstanceHostName},t,!1)}catch(o){throw o instanceof ct&&(o.setCorrelationId(this.correlationId),r.cacheFailedRequest(o)),o}}logout(){return Promise.reject(oe(du))}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function Mr(n){const e=n==null?void 0:n.idTokenClaims;if(e!=null&&e.tfp||e!=null&&e.acr)return"B2C";if(e!=null&&e.tid){if((e==null?void 0:e.tid)==="9188040d-6c67-4c5b-b112-36a304b66dad")return"MSA"}else return;return"AAD"}function qc(n,e){try{Em(n)}catch(t){throw e.end({success:!1},t),t}}class gu{constructor(e){this.operatingContext=e,this.isBrowserEnvironment=this.operatingContext.isBrowserEnvironment(),this.config=e.getConfig(),this.initialized=!1,this.logger=this.operatingContext.getLogger(),this.networkClient=this.config.system.networkClient,this.navigationClient=this.config.system.navigationClient,this.redirectResponse=new Map,this.hybridAuthCodeResponses=new Map,this.performanceClient=this.config.telemetry.client,this.browserCrypto=this.isBrowserEnvironment?new Ta(this.logger,this.performanceClient):Al,this.eventHandler=new SH(this.logger),this.browserStorage=this.isBrowserEnvironment?new sf(this.config.auth.clientId,this.config.cache,this.browserCrypto,this.logger,m2(this.config.auth),this.performanceClient):vH(this.config.auth.clientId,this.logger);const t={cacheLocation:_n.MemoryStorage,temporaryCacheLocation:_n.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};this.nativeInternalStorage=new sf(this.config.auth.clientId,t,this.browserCrypto,this.logger,void 0,this.performanceClient),this.tokenCache=new XH(this.config,this.browserStorage,this.logger,this.browserCrypto),this.activeSilentTokenRequests=new Map,this.trackPageVisibility=this.trackPageVisibility.bind(this),this.trackPageVisibilityWithMeasurement=this.trackPageVisibilityWithMeasurement.bind(this),this.listeningToStorageEvents=!1,this.handleAccountCacheChange=this.handleAccountCacheChange.bind(this)}static async createController(e,t){const r=new gu(e);return await r.initialize(t),r}trackPageVisibility(e){e&&(this.logger.info("Perf: Visibility change detected"),this.performanceClient.incrementFields({visibilityChangeCount:1},e))}async initialize(e){if(this.logger.trace("initialize called"),this.initialized){this.logger.info("initialize has already been called, exiting early.");return}if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, exiting early."),this.initialized=!0,this.eventHandler.emitEvent(fe.INITIALIZE_END);return}const t=(e==null?void 0:e.correlationId)||this.getRequestCorrelationId(),r=this.config.system.allowNativeBroker,o=this.performanceClient.startMeasurement(x.InitializeClientApplication,t);if(this.eventHandler.emitEvent(fe.INITIALIZE_START),r)try{this.nativeExtensionProvider=await Fr.createProvider(this.logger,this.config.system.nativeBrokerHandshakeTimeout,this.performanceClient)}catch(a){this.logger.verbose(a)}this.config.cache.claimsBasedCachingEnabled||(this.logger.verbose("Claims-based caching is disabled. Clearing the previous cache with claims"),await J(this.browserStorage.clearTokensAndKeysWithClaims.bind(this.browserStorage),x.ClearTokensAndKeysWithClaims,this.logger,this.performanceClient,t)(this.performanceClient,t)),this.initialized=!0,this.eventHandler.emitEvent(fe.INITIALIZE_END),o.end({allowNativeBroker:r,success:!0})}async handleRedirectPromise(e){if(this.logger.verbose("handleRedirectPromise called"),vT(this.initialized),this.isBrowserEnvironment){const t=e||"";let r=this.redirectResponse.get(t);return typeof r>"u"?(r=this.handleRedirectPromiseInternal(e),this.redirectResponse.set(t,r),this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise")):this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call"),r}return this.logger.verbose("handleRedirectPromise returns null, not browser environment"),null}async handleRedirectPromiseInternal(e){const t=this.getAllAccounts(),r=this.browserStorage.getCachedNativeRequest(),o=r&&Fr.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider)&&this.nativeExtensionProvider&&!e,a=o?r==null?void 0:r.correlationId:this.browserStorage.getTemporaryCache($e.CORRELATION_ID,!0)||"",c=this.performanceClient.startMeasurement(x.AcquireTokenRedirect,a);this.eventHandler.emitEvent(fe.HANDLE_REDIRECT_START,ce.Redirect);let d;if(o&&this.nativeExtensionProvider){this.logger.trace("handleRedirectPromise - acquiring token from native platform");const h=new ga(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,rt.handleRedirectPromise,this.performanceClient,this.nativeExtensionProvider,r.accountId,this.nativeInternalStorage,r.correlationId);d=J(h.handleRedirectPromise.bind(h),x.HandleNativeRedirectPromiseMeasurement,this.logger,this.performanceClient,c.event.correlationId)(this.performanceClient,c.event.correlationId)}else{this.logger.trace("handleRedirectPromise - acquiring token from web flow");const h=this.createRedirectClient(a);d=J(h.handleRedirectPromise.bind(h),x.HandleRedirectPromiseMeasurement,this.logger,this.performanceClient,c.event.correlationId)(e,c)}return d.then(h=>(h?(t.length<this.getAllAccounts().length?(this.eventHandler.emitEvent(fe.LOGIN_SUCCESS,ce.Redirect,h),this.logger.verbose("handleRedirectResponse returned result, login success")):(this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_SUCCESS,ce.Redirect,h),this.logger.verbose("handleRedirectResponse returned result, acquire token success")),c.end({success:!0,accountType:Mr(h.account)})):c.event.errorCode?c.end({success:!1}):c.discard(),this.eventHandler.emitEvent(fe.HANDLE_REDIRECT_END,ce.Redirect),h)).catch(h=>{const f=h;throw t.length>0?this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_FAILURE,ce.Redirect,null,f):this.eventHandler.emitEvent(fe.LOGIN_FAILURE,ce.Redirect,null,f),this.eventHandler.emitEvent(fe.HANDLE_REDIRECT_END,ce.Redirect),c.end({success:!1},f),h})}async acquireTokenRedirect(e){const t=this.getRequestCorrelationId(e);this.logger.verbose("acquireTokenRedirect called",t);const r=this.performanceClient.startMeasurement(x.AcquireTokenPreRedirect,t);r.add({accountType:Mr(e.account),scenarioId:e.scenarioId});const o=e.onRedirectNavigate;if(o)e.onRedirectNavigate=c=>{const d=typeof o=="function"?o(c):void 0;return d!==!1?r.end({success:!0}):r.discard(),d};else{const c=this.config.auth.onRedirectNavigate;this.config.auth.onRedirectNavigate=d=>{const h=typeof c=="function"?c(d):void 0;return h!==!1?r.end({success:!0}):r.discard(),h}}const a=this.getAllAccounts().length>0;try{iy(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0),a?this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_START,ce.Redirect,e):this.eventHandler.emitEvent(fe.LOGIN_START,ce.Redirect,e);let c;return this.nativeExtensionProvider&&this.canUseNative(e)?c=new ga(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,rt.acquireTokenRedirect,this.performanceClient,this.nativeExtensionProvider,this.getNativeAccountId(e),this.nativeInternalStorage,t).acquireTokenRedirect(e,r).catch(h=>{if(h instanceof Ur&&ia(h))return this.nativeExtensionProvider=void 0,this.createRedirectClient(t).acquireToken(e);if(h instanceof Cr)return this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createRedirectClient(t).acquireToken(e);throw this.browserStorage.setInteractionInProgress(!1),h}):c=this.createRedirectClient(t).acquireToken(e),await c}catch(c){throw r.end({success:!1},c),a?this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_FAILURE,ce.Redirect,null,c):this.eventHandler.emitEvent(fe.LOGIN_FAILURE,ce.Redirect,null,c),c}}acquireTokenPopup(e){const t=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(x.AcquireTokenPopup,t);r.add({scenarioId:e.scenarioId,accountType:Mr(e.account)});try{this.logger.verbose("acquireTokenPopup called",t),qc(this.initialized,r),this.browserStorage.setInteractionInProgress(!0)}catch(c){return Promise.reject(c)}const o=this.getAllAccounts();o.length>0?this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_START,ce.Popup,e):this.eventHandler.emitEvent(fe.LOGIN_START,ce.Popup,e);let a;return this.canUseNative(e)?a=this.acquireTokenNative({...e,correlationId:t},rt.acquireTokenPopup).then(c=>(this.browserStorage.setInteractionInProgress(!1),r.end({success:!0,isNativeBroker:!0,accountType:Mr(c.account)}),c)).catch(c=>{if(c instanceof Ur&&ia(c))return this.nativeExtensionProvider=void 0,this.createPopupClient(t).acquireToken(e);if(c instanceof Cr)return this.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createPopupClient(t).acquireToken(e);throw this.browserStorage.setInteractionInProgress(!1),c}):a=this.createPopupClient(t).acquireToken(e),a.then(c=>(o.length<this.getAllAccounts().length?this.eventHandler.emitEvent(fe.LOGIN_SUCCESS,ce.Popup,c):this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_SUCCESS,ce.Popup,c),r.end({success:!0,accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length,accountType:Mr(c.account)}),c)).catch(c=>(o.length>0?this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_FAILURE,ce.Popup,null,c):this.eventHandler.emitEvent(fe.LOGIN_FAILURE,ce.Popup,null,c),r.end({success:!1},c),Promise.reject(c)))}trackPageVisibilityWithMeasurement(){const e=this.ssoSilentMeasurement||this.acquireTokenByCodeAsyncMeasurement;e&&(this.logger.info("Perf: Visibility change detected in ",e.event.name),e.increment({visibilityChangeCount:1}))}async ssoSilent(e){var a,c;const t=this.getRequestCorrelationId(e),r={...e,prompt:e.prompt,correlationId:t};this.ssoSilentMeasurement=this.performanceClient.startMeasurement(x.SsoSilent,t),(a=this.ssoSilentMeasurement)==null||a.add({scenarioId:e.scenarioId,accountType:Mr(e.account)}),qc(this.initialized,this.ssoSilentMeasurement),(c=this.ssoSilentMeasurement)==null||c.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),this.logger.verbose("ssoSilent called",t),this.eventHandler.emitEvent(fe.SSO_SILENT_START,ce.Silent,r);let o;return this.canUseNative(r)?o=this.acquireTokenNative(r,rt.ssoSilent).catch(d=>{if(d instanceof Ur&&ia(d))return this.nativeExtensionProvider=void 0,this.createSilentIframeClient(r.correlationId).acquireToken(r);throw d}):o=this.createSilentIframeClient(r.correlationId).acquireToken(r),o.then(d=>{var h;return this.eventHandler.emitEvent(fe.SSO_SILENT_SUCCESS,ce.Silent,d),(h=this.ssoSilentMeasurement)==null||h.end({success:!0,isNativeBroker:d.fromNativeBroker,accessTokenSize:d.accessToken.length,idTokenSize:d.idToken.length,accountType:Mr(d.account)}),d}).catch(d=>{var h;throw this.eventHandler.emitEvent(fe.SSO_SILENT_FAILURE,ce.Silent,null,d),(h=this.ssoSilentMeasurement)==null||h.end({success:!1},d),d}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenByCode(e){const t=this.getRequestCorrelationId(e);this.logger.trace("acquireTokenByCode called",t);const r=this.performanceClient.startMeasurement(x.AcquireTokenByCode,t);qc(this.initialized,r),this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_BY_CODE_START,ce.Silent,e),r.add({scenarioId:e.scenarioId});try{if(e.code&&e.nativeAccountId)throw oe(nT);if(e.code){const o=e.code;let a=this.hybridAuthCodeResponses.get(o);return a?(this.logger.verbose("Existing acquireTokenByCode request found",t),r.discard()):(this.logger.verbose("Initiating new acquireTokenByCode request",t),a=this.acquireTokenByCodeAsync({...e,correlationId:t}).then(c=>(this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_BY_CODE_SUCCESS,ce.Silent,c),this.hybridAuthCodeResponses.delete(o),r.end({success:!0,isNativeBroker:c.fromNativeBroker,accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length,accountType:Mr(c.account)}),c)).catch(c=>{throw this.hybridAuthCodeResponses.delete(o),this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_BY_CODE_FAILURE,ce.Silent,null,c),r.end({success:!1},c),c}),this.hybridAuthCodeResponses.set(o,a)),await a}else if(e.nativeAccountId)if(this.canUseNative(e,e.nativeAccountId)){const o=await this.acquireTokenNative({...e,correlationId:t},rt.acquireTokenByCode,e.nativeAccountId).catch(a=>{throw a instanceof Ur&&ia(a)&&(this.nativeExtensionProvider=void 0),a});return r.end({accountType:Mr(o.account),success:!0}),o}else throw oe(rT);else throw oe(tT)}catch(o){throw this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_BY_CODE_FAILURE,ce.Silent,null,o),r.end({success:!1},o),o}}async acquireTokenByCodeAsync(e){var o;return this.logger.trace("acquireTokenByCodeAsync called",e.correlationId),this.acquireTokenByCodeAsyncMeasurement=this.performanceClient.startMeasurement(x.AcquireTokenByCodeAsync,e.correlationId),(o=this.acquireTokenByCodeAsyncMeasurement)==null||o.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),await this.createSilentAuthCodeClient(e.correlationId).acquireToken(e).then(a=>{var c;return(c=this.acquireTokenByCodeAsyncMeasurement)==null||c.end({success:!0,fromCache:a.fromCache,isNativeBroker:a.fromNativeBroker}),a}).catch(a=>{var c;throw(c=this.acquireTokenByCodeAsyncMeasurement)==null||c.end({success:!1},a),a}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenFromCache(e,t){switch(this.performanceClient.addQueueMeasurement(x.AcquireTokenFromCache,e.correlationId),t){case On.Default:case On.AccessToken:case On.AccessTokenAndRefreshToken:const r=this.createSilentCacheClient(e.correlationId);return J(r.acquireToken.bind(r),x.SilentCacheClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw Y(so)}}async acquireTokenByRefreshToken(e,t){switch(this.performanceClient.addQueueMeasurement(x.AcquireTokenByRefreshToken,e.correlationId),t){case On.Default:case On.AccessTokenAndRefreshToken:case On.RefreshToken:case On.RefreshTokenAndNetwork:const r=this.createSilentRefreshClient(e.correlationId);return J(r.acquireToken.bind(r),x.SilentRefreshClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw Y(so)}}async acquireTokenBySilentIframe(e){this.performanceClient.addQueueMeasurement(x.AcquireTokenBySilentIframe,e.correlationId);const t=this.createSilentIframeClient(e.correlationId);return J(t.acquireToken.bind(t),x.SilentIframeClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e)}async logout(e){const t=this.getRequestCorrelationId(e);return this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.",t),this.logoutRedirect({correlationId:t,...e})}async logoutRedirect(e){const t=this.getRequestCorrelationId(e);return iy(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0),this.createRedirectClient(t).logout(e)}logoutPopup(e){try{const t=this.getRequestCorrelationId(e);return Em(this.initialized),this.browserStorage.setInteractionInProgress(!0),this.createPopupClient(t).logout(e)}catch(t){return Promise.reject(t)}}async clearCache(e){if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, returning early.");return}const t=this.getRequestCorrelationId(e);return this.createSilentCacheClient(t).logout(e)}getAllAccounts(e){return yH(this.logger,this.browserStorage,this.isBrowserEnvironment,e)}getAccount(e){return CH(e,this.logger,this.browserStorage)}getAccountByUsername(e){return EH(e,this.logger,this.browserStorage)}getAccountByHomeId(e){return wH(e,this.logger,this.browserStorage)}getAccountByLocalId(e){return TH(e,this.logger,this.browserStorage)}setActiveAccount(e){bH(e,this.browserStorage)}getActiveAccount(){return IH(this.browserStorage)}async hydrateCache(e,t){this.logger.verbose("hydrateCache called");const r=Ot.createFromAccountInfo(e.account,e.cloudGraphHostName,e.msGraphHost);return this.browserStorage.setAccount(r),e.fromNativeBroker?(this.logger.verbose("Response was from native broker, storing in-memory"),this.nativeInternalStorage.hydrateCache(e,t)):this.browserStorage.hydrateCache(e,t)}async acquireTokenNative(e,t,r){if(this.logger.trace("acquireTokenNative called"),!this.nativeExtensionProvider)throw oe(Hs);return new ga(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,t,this.performanceClient,this.nativeExtensionProvider,r||this.getNativeAccountId(e),this.nativeInternalStorage,e.correlationId).acquireToken(e)}canUseNative(e,t){if(this.logger.trace("canUseNative called"),!Fr.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,e.authenticationScheme))return this.logger.trace("canUseNative: isNativeAvailable returned false, returning false"),!1;if(e.prompt)switch(e.prompt){case Ut.NONE:case Ut.CONSENT:case Ut.LOGIN:this.logger.trace("canUseNative: prompt is compatible with native flow");break;default:return this.logger.trace(`canUseNative: prompt = ${e.prompt} is not compatible with native flow, returning false`),!1}return!t&&!this.getNativeAccountId(e)?(this.logger.trace("canUseNative: nativeAccountId is not available, returning false"),!1):!0}getNativeAccountId(e){const t=e.account||this.getAccount({loginHint:e.loginHint,sid:e.sid})||this.getActiveAccount();return t&&t.nativeAccountId||""}createPopupClient(e){return new $H(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createRedirectClient(e){return new WH(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createSilentIframeClient(e){return new JH(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,rt.ssoSilent,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createSilentCacheClient(e){return new TT(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)}createSilentRefreshClient(e){return new QH(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)}createSilentAuthCodeClient(e){return new e$(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,rt.acquireTokenByCode,this.performanceClient,this.nativeExtensionProvider,e)}addEventCallback(e,t){return this.eventHandler.addEventCallback(e,t)}removeEventCallback(e){this.eventHandler.removeEventCallback(e)}addPerformanceCallback(e){return _T(),this.performanceClient.addPerformanceCallback(e)}removePerformanceCallback(e){return this.performanceClient.removePerformanceCallback(e)}enableAccountStorageEvents(){typeof window>"u"||(this.listeningToStorageEvents?this.logger.verbose("Account storage listener already registered."):(this.logger.verbose("Adding account storage listener."),this.listeningToStorageEvents=!0,window.addEventListener("storage",this.handleAccountCacheChange)))}disableAccountStorageEvents(){typeof window>"u"||(this.listeningToStorageEvents?(this.logger.verbose("Removing account storage listener."),window.removeEventListener("storage",this.handleAccountCacheChange),this.listeningToStorageEvents=!1):this.logger.verbose("No account storage listener registered."))}handleAccountCacheChange(e){var t;try{(t=e.key)!=null&&t.includes(Dt.ACTIVE_ACCOUNT_FILTERS)&&this.eventHandler.emitEvent(fe.ACTIVE_ACCOUNT_CHANGED);const r=e.newValue||e.oldValue;if(!r)return;const o=JSON.parse(r);if(typeof o!="object"||!Ot.isAccountEntity(o))return;const c=Ea.toObject(new Ot,o).getAccountInfo();!e.oldValue&&e.newValue?(this.logger.info("Account was added to cache in a different window"),this.eventHandler.emitEvent(fe.ACCOUNT_ADDED,void 0,c)):!e.newValue&&e.oldValue&&(this.logger.info("Account was removed from cache in a different window"),this.eventHandler.emitEvent(fe.ACCOUNT_REMOVED,void 0,c))}catch{return}}getTokenCache(){return this.tokenCache}getLogger(){return this.logger}setLogger(e){this.logger=e}initializeWrapperLibrary(e,t){this.browserStorage.setWrapperMetadata(e,t)}setNavigationClient(e){this.navigationClient=e}getConfiguration(){return this.config}getPerformanceClient(){return this.performanceClient}isBrowserEnv(){return this.isBrowserEnvironment}getRequestCorrelationId(e){return e!=null&&e.correlationId?e.correlationId:this.isBrowserEnvironment?mo():B.EMPTY_STRING}async loginRedirect(e){const t=this.getRequestCorrelationId(e);return this.logger.verbose("loginRedirect called",t),this.acquireTokenRedirect({correlationId:t,...e||ny})}loginPopup(e){const t=this.getRequestCorrelationId(e);return this.logger.verbose("loginPopup called",t),this.acquireTokenPopup({correlationId:t,...e||ny})}async acquireTokenSilent(e){const t=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(x.AcquireTokenSilent,t);r.add({cacheLookupPolicy:e.cacheLookupPolicy,scenarioId:e.scenarioId}),qc(this.initialized,r),this.logger.verbose("acquireTokenSilent called",t);const o=e.account||this.getActiveAccount();if(!o)throw oe(Yw);r.add({accountType:Mr(o)});const a={clientId:this.config.auth.clientId,authority:e.authority||B.EMPTY_STRING,scopes:e.scopes,homeAccountIdentifier:o.homeAccountId,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid,shrOptions:e.shrOptions},c=JSON.stringify(a),d=this.activeSilentTokenRequests.get(c);if(typeof d>"u"){this.logger.verbose("acquireTokenSilent called for the first time, storing active request",t);const h=J(this.acquireTokenSilentAsync.bind(this),x.AcquireTokenSilentAsync,this.logger,this.performanceClient,t)({...e,correlationId:t},o).then(f=>(this.activeSilentTokenRequests.delete(c),r.end({success:!0,fromCache:f.fromCache,isNativeBroker:f.fromNativeBroker,cacheLookupPolicy:e.cacheLookupPolicy,accessTokenSize:f.accessToken.length,idTokenSize:f.idToken.length}),f)).catch(f=>{throw this.activeSilentTokenRequests.delete(c),r.end({success:!1},f),f});return this.activeSilentTokenRequests.set(c,h),{...await h,state:e.state}}else return this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call",t),r.discard(),{...await d,state:e.state}}async acquireTokenSilentAsync(e,t){const r=()=>this.trackPageVisibility(e.correlationId);this.performanceClient.addQueueMeasurement(x.AcquireTokenSilentAsync,e.correlationId),this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_START,ce.Silent,e),e.correlationId&&this.performanceClient.incrementFields({visibilityChangeCount:0},e.correlationId),document.addEventListener("visibilitychange",r);const o=await J(OH,x.InitializeSilentRequest,this.logger,this.performanceClient,e.correlationId)(e,t,this.config,this.performanceClient,this.logger),a=e.cacheLookupPolicy||On.Default;return this.acquireTokenSilentNoIframe(o,a).catch(async d=>{if(t$(d,a))if(this.activeIframeRequest)if(a!==On.Skip){const[f,g]=this.activeIframeRequest;this.logger.verbose(`Iframe request is already in progress, awaiting resolution for request with correlationId: ${g}`,o.correlationId);const v=this.performanceClient.startMeasurement(x.AwaitConcurrentIframe,o.correlationId);v.add({awaitIframeCorrelationId:g});const p=await f;if(v.end({success:p}),p)return this.logger.verbose(`Parallel iframe request with correlationId: ${g} succeeded. Retrying cache and/or RT redemption`,o.correlationId),this.acquireTokenSilentNoIframe(o,a);throw this.logger.info(`Iframe request with correlationId: ${g} failed. Interaction is required.`),d}else return this.logger.warning("Another iframe request is currently in progress and CacheLookupPolicy is set to Skip. This may result in degraded performance and/or reliability for both calls. Please consider changing the CacheLookupPolicy to take advantage of request queuing and token cache.",o.correlationId),J(this.acquireTokenBySilentIframe.bind(this),x.AcquireTokenBySilentIframe,this.logger,this.performanceClient,o.correlationId)(o);else{let f;return this.activeIframeRequest=[new Promise(g=>{f=g}),o.correlationId],this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",o.correlationId),J(this.acquireTokenBySilentIframe.bind(this),x.AcquireTokenBySilentIframe,this.logger,this.performanceClient,o.correlationId)(o).then(g=>(f(!0),g)).catch(g=>{throw f(!1),g}).finally(()=>{this.activeIframeRequest=void 0})}else throw d}).then(d=>(this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_SUCCESS,ce.Silent,d),e.correlationId&&this.performanceClient.addFields({fromCache:d.fromCache,isNativeBroker:d.fromNativeBroker},e.correlationId),d)).catch(d=>{throw this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_FAILURE,ce.Silent,null,d),d}).finally(()=>{document.removeEventListener("visibilitychange",r)})}async acquireTokenSilentNoIframe(e,t){return Fr.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,e.authenticationScheme)&&e.account.nativeAccountId?(this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform"),this.acquireTokenNative(e,rt.acquireTokenSilent_silentFlow).catch(async r=>{throw r instanceof Ur&&ia(r)?(this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow"),this.nativeExtensionProvider=void 0,Y(so)):r})):(this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow"),J(this.acquireTokenFromCache.bind(this),x.AcquireTokenFromCache,this.logger,this.performanceClient,e.correlationId)(e,t).catch(r=>{if(t===On.AccessToken)throw r;return this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_NETWORK_START,ce.Silent,e),J(this.acquireTokenByRefreshToken.bind(this),x.AcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,t)}))}}function t$(n,e){const t=!(n instanceof Cr&&n.subError!==lu),r=n.errorCode===Mn.INVALID_GRANT_ERROR||n.errorCode===so,o=t&&r||n.errorCode===Pl||n.errorCode===sm,a=F2.includes(e);return o&&a}/*! @azure/msal-browser v3.28.1 2025-01-14 */async function n$(n,e){const t=new bi(n);return await t.initialize(),gu.createController(t,e)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Im{static async createPublicClientApplication(e){const t=await n$(e);return new Im(e,t)}constructor(e,t){this.controller=t||new gu(new bi(e))}async initialize(e){return this.controller.initialize(e)}async acquireTokenPopup(e){return this.controller.acquireTokenPopup(e)}acquireTokenRedirect(e){return this.controller.acquireTokenRedirect(e)}acquireTokenSilent(e){return this.controller.acquireTokenSilent(e)}acquireTokenByCode(e){return this.controller.acquireTokenByCode(e)}addEventCallback(e,t){return this.controller.addEventCallback(e,t)}removeEventCallback(e){return this.controller.removeEventCallback(e)}addPerformanceCallback(e){return this.controller.addPerformanceCallback(e)}removePerformanceCallback(e){return this.controller.removePerformanceCallback(e)}enableAccountStorageEvents(){this.controller.enableAccountStorageEvents()}disableAccountStorageEvents(){this.controller.disableAccountStorageEvents()}getAccount(e){return this.controller.getAccount(e)}getAccountByHomeId(e){return this.controller.getAccountByHomeId(e)}getAccountByLocalId(e){return this.controller.getAccountByLocalId(e)}getAccountByUsername(e){return this.controller.getAccountByUsername(e)}getAllAccounts(e){return this.controller.getAllAccounts(e)}handleRedirectPromise(e){return this.controller.handleRedirectPromise(e)}loginPopup(e){return this.controller.loginPopup(e)}loginRedirect(e){return this.controller.loginRedirect(e)}logout(e){return this.controller.logout(e)}logoutRedirect(e){return this.controller.logoutRedirect(e)}logoutPopup(e){return this.controller.logoutPopup(e)}ssoSilent(e){return this.controller.ssoSilent(e)}getTokenCache(){return this.controller.getTokenCache()}getLogger(){return this.controller.getLogger()}setLogger(e){this.controller.setLogger(e)}setActiveAccount(e){this.controller.setActiveAccount(e)}getActiveAccount(){return this.controller.getActiveAccount()}initializeWrapperLibrary(e,t){return this.controller.initializeWrapperLibrary(e,t)}setNavigationClient(e){this.controller.setNavigationClient(e)}getConfiguration(){return this.controller.getConfiguration()}async hydrateCache(e,t){return this.controller.hydrateCache(e,t)}clearCache(e){return this.controller.clearCache(e)}}const sh=process.env.JPLAN_WEBAPP__APP_PROXY_TENANT_NAME??"",r$=process.env.JPLAN_WEBAPP__APP_PROXY_CLIENT_ID??"",o$=process.env.JPLAN_WEBAPP__APP_PROXY_USER_FLOW??"",lf=process.env.JPLAN_WEBAPP__URL_AUTH??process.env.JPLAN_WEBAPP__URL_BASE??"",i$={auth:{clientId:r$,authority:`https://${sh}.b2clogin.com/${sh}.onmicrosoft.com/${o$}`,knownAuthorities:[`${sh}.b2clogin.com`],redirectUri:process.env.JPLAN_AUTOMATION_ENVIRONMENT?`${lf}/_/dashboard`:lf},cache:{cacheLocation:"localStorage",storeAuthStateInCookie:!1},system:{loggerOptions:{loggerCallback:(n,e)=>{n===et.Error&&console.error(e)},logLevel:et.Warning}}},ST=(n,e)=>({scopes:["https://graph.microsoft.com/.default","openid","profile"],redirectStartPage:`${lf}${n}`,extraQueryParameters:e}),zt=new Im(i$),uy=l.ref(null);function AT(){async function n(e){var t;if(e)try{const r=e.idTokenClaims;if(!(r!=null&&r.aud))throw new Error("User audience (aud) is missing in ID token claims");const o=localStorage.getItem(`msal.token.keys.${r.aud}`);if(!o)throw new Error(`Token keys para ${r.aud} não encontrados no localStorage`);const a=JSON.parse(o),c=(t=a==null?void 0:a.idToken)==null?void 0:t[0];if(!c)throw new Error("idToken não encontrado nos token keys");const d=localStorage.getItem(c);if(!d)throw new Error(`Dados do token para ID ${c} não encontrados no localStorage`);const h=JSON.parse(d),f=h==null?void 0:h.secret;if(!f)throw new Error("Secret não encontrado nos dados do token");sessionStorage.setItem("isAuthenticated","true"),uy.value=f}catch(r){console.error("Erro ao obter token de acesso:",r)}}return{jToken:uy,setJToken:n}}let Yc=null;const er=l.ref(null),ji=l.ref(null),kT=l.ref(Math.floor(Date.now()/1e3));uf.useIntervalFn(()=>a$(),1e3);function a$(){var r,o;if(!((o=(r=er.value)==null?void 0:r.idTokenClaims)!=null&&o.exp))return;const n=Math.floor(Date.now()/1e3),e=300,t=er.value.idTokenClaims.exp;kT.value=t-n-e}function Sm(){if(Yc)return Yc;const{setJToken:n,jToken:e}=AT(),t=l.computed(()=>!!er.value),r=l.computed(()=>er.value);let o;async function a(p,w){if(!t.value)switch(p){case"redirect":if(w){o=w,await h();break}case"tab":default:await c();break}}const c=async()=>new Promise((p,w)=>{try{localStorage.clear();const C=process.env.JPLAN_WEBAPP__URL_AUTH,T=window.open(C);if(!T){console.error("Failed to open authentication window"),w("Failed to open authentication window");return}const k=Date.now(),I=6e4,N=setInterval(()=>{if(Date.now()-k>I||T.closed){clearInterval(N),console.error("Authentication canceled or timeout reached."),w("Authentication canceled or timeout reached.");return}Object.keys(localStorage).some(L=>L.startsWith("msal.account.keys"))&&(clearInterval(N),d(),T.close(),p())},500)}catch(C){console.error("Error in handleRedirect:",C),w(C)}}),d=async()=>{try{await zt.initialize();const p=zt.getActiveAccount();if(p)er.value=p;else{const w=await zt.handleRedirectPromise();w?(zt.setActiveAccount(w.account),er.value=zt.getActiveAccount()):console.error("Falha na autenticação")}}catch(p){console.error("Erro no processo de autenticação:",p)}er.value&&await n(er.value)},h=async()=>{try{await zt.initialize();const p=await zt.handleRedirectPromise();if(!p||zt.getAllAccounts().length===0){const w=ST(o);await zt.loginRedirect(w);return}zt.setActiveAccount(p.account),er.value=zt.getActiveAccount(),er.value&&await n(er.value),ji.value="updated"}catch(p){console.error("handleRedirect failed",p)}};async function f(){_e.value=!0,ji.value="updating";try{const p=await zt.acquireTokenSilent({scopes:["https://graph.microsoft.com/.default","openid","profile"]});zt.setActiveAccount(p.account),await n(er.value),ji.value="updated"}catch(p){console.error("Failed to refresh token, forcing new login.",p),ji.value="error",localStorage.clear(),window.location.reload()}_e.value=!1}const g=async()=>{try{await zt.initialize(),localStorage.clear(),await zt.logoutRedirect({postLogoutRedirectUri:"/"})}catch(p){console.error("Logout error",p)}};l.watch(kT,async p=>{p<=0&&ji.value==="updated"&&await f()});const v=l.computed(()=>e.value);return Yc={isAuthenticated:t,authState:ji,account:r,token:v,refreshToken:f,handleRedirect:a,logout:g},Yc}const{jToken:dy}=AT(),Am=()=>{const n=ut.create({headers:{"Content-Type":"application/json"}});l.watch(dy,o=>{n.interceptors.request.use(a=>(o&&(a.headers.Authorization=`Bearer ${o}`),a))},{immediate:!0});let e=1;n.interceptors.response.use(async o=>o,async o=>{var a;if(o.config&&o.config.headers){const c=o.config;if(((a=o.response)==null?void 0:a.status)===401&&e>0){e--;try{return c.headers.Authorization=`Bearer ${dy.value}`,await n(c)}catch(d){return Promise.reject(d)}}}return Promise.reject(o)});async function t({url:o,method:a,header:c={},body:d,baseURL:h}){try{return h&&(n.defaults.baseURL=h),(await n({url:o,method:a,headers:c,data:d})).data}catch(f){if(console.error(`Request error [${a} ${o}]:`,f),ut.isAxiosError(f)){const{response:g,message:v}=f;throw new Error(`Axios error: ${v}, Status: ${g==null?void 0:g.status}, URL: ${o}`)}throw f}}async function r({url:o,method:a,header:c,body:d,baseURL:h}){try{h&&(n.defaults.baseURL=h);const f=await n({url:o,method:a,headers:c,data:d});return{status:f.status,header:f.headers,body:f.data}}catch(f){if(ut.isAxiosError(f)){const{response:g,message:v}=f;console.error(`Raw Request Error: ${v}, Status: ${g==null?void 0:g.status}`)}return Promise.reject(f)}}return Object.assign(n,{_request:t,rawRequest:r})},{request:hy}=Am(),fy=l.ref(null),my=l.ref("default"),ch=l.ref(null),lh=l.ref({scope_type:"org"});function pu(){var v,p;const{handleRedirect:n,account:e,logout:t}=Sm();(p=(v=e.value)==null?void 0:v.idTokenClaims)==null||p.domain;const r=l.computed(()=>{var w,C;return{domain:(C=(w=e.value)==null?void 0:w.idTokenClaims)==null?void 0:C.domain,environment:my.value,...lh.value}}),o=l.computed(()=>lh.value);async function a(){var w;(!e.value||!((w=e.value.idTokenClaims)!=null&&w.email))&&await n();try{await c(),await d()}catch{}}async function c(){var w,C;try{const T=(C=(w=e.value)==null?void 0:w.idTokenClaims)==null?void 0:C.email;if(!T)throw new Error("Email is undefined");const k=await hy({url:`https://api.jplan.com.br/platform/user/profile/?email=${T}`,method:"GET"});ch.value=k.data??null}catch(T){console.error("Failed to fetch user profile:",T)}}async function d(){var w;try{if(!((w=ch.value)!=null&&w.email))throw new Error("User email is undefined");const C=await hy({url:"https://api.jplan.com.br/platform/user/domain/",method:"GET"});fy.value=C.data.data??[]}catch(C){console.error("Failed to fetch user domains:",C)}}function h(w){lh.value=w}function f(w){my.value=w,h(r.value)}async function g(w,C){const T=ST(w,{request_domain:C});await zt.loginRedirect(T)}return{__init__:a,user:ch,userDomains:fy,setEnv:f,setScope:h,changeDomain:g,session:r,scope:o,logout:t}}const s$={path:"/_/dashboard",component:()=>Promise.resolve().then(()=>require("./AuthRoute-fNo2KFNW.js")),meta:{requiresAuth:!1}},c$={path:"/jplan-auth-fail",component:()=>Promise.resolve().then(()=>require("./AuthFailRoute-D0neuLsM.js")),meta:{requiresAuth:!1}},{isAuthenticated:gy,handleRedirect:l$}=Sm(),u$=pu();function d$(n,e){n.addRoute(s$),n.addRoute(c$),n.beforeEach(async(t,r,o)=>{function a(d){return d.matched.some(h=>h.meta.requiresAuth)}if(!a(t))return o();if(!gy.value){_e.value=!0;try{await l$(e,t.fullPath),await u$.__init__()}catch(d){console.error("Fail to authenticate",d),await n.push("/jplan-auth-fail")}_e.value=!1}if(gy.value){if(localStorage.getItem("returnRoute")&&localStorage.getItem("returnRoute")!==null){const d=localStorage.getItem("returnRoute")??"/";console.log("trying to go to saved route:",d),o(d),localStorage.removeItem("returnRoute");return}o()}})}const{scope:py}=pu();function h$(){const n=Am(),e=l.ref({scope_type:"org"});async function t(r){e.value=r}return l.watch(py,()=>{n.interceptors.request.use(r=>{const o=r.headers,a=o.Authorization;a&&(o.Authorization=a);const c=py.value;return c&&(c.scope_type&&(o["j-scope-type"]=c.scope_type,c.organization&&(o["j-scope-organization"]=c.organization),c.team&&(o["j-scope-team"]=c.team)),c.environment&&(o["j-scope-environment"]=c.environment)),r})},{immediate:!0}),Object.assign(n,{setScope:t,scope:e})}function Pa(n){const e=h$();e.defaults.baseURL=n;const t=l.ref({scope_type:"org"});async function r(o){t.value=o}return l.watch(t,()=>{e.interceptors.request.use(o=>{const a=t.value;return delete o.headers["j-scope-type"],delete o.headers["j-scope-organization"],delete o.headers["j-scope-team"],a!=null&&a.scope_type&&(o.headers["j-scope-type"]=a.scope_type),a!=null&&a.organization&&(o.headers["j-scope-organization"]=a.organization),a!=null&&a.team&&(o.headers["j-scope-team"]=a.team),o})},{immediate:!0}),Object.assign(e,{setScope:r,scope:t})}function f$(){const n=Pa("https://api.jplan.com.br/management/organization"),{error:e}=Er();return{async getOrgList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error)throw e("Failed to fetch Organization list"),new Error(o.data.error);return o.data.data}catch(r){console.error("Error in getOrgList:",r),e("Failed to fetch Organization list");return}},async createOrg(t){var r,o;try{const a=await n.post("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){throw console.error("Error in createOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to create Organization"),a}},async updateOrg(t){var r,o;try{const a=await n.patch("/item",t);if(a.data.error)throw e("Failed to update Organization"),new Error(a.data.error);return a}catch(a){throw console.error("Error in updateOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to update Organization"),a}},async getOrg(t){var r,o;try{const a=await n.get(`/item/${t}`);if(a.data.error)throw e("Failed to fetch Organization"),new Error(a.data.error);return a.data}catch(a){throw console.error("Error in getOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to fetch Organization"),a}},async activateOrg(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error)throw e("Failed to activate Organization"),new Error(a.data.error)}catch(a){throw console.error("Error in activateOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to activate Organization"),a}},async deactivateOrg(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error)throw e("Failed to deactivate Organization"),new Error(a.data.error)}catch(a){throw console.error("Error in deactivateOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to deactivate Organization"),a}}}}const Lo=f$();function m$(){const n=Pa("https://api.jplan.com.br/management/branch/"),{error:e}=Er();return{async getBranchList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error){e("Failed to fetch Branch list");return}return o.data.data}catch(r){console.error("Error in getBranchList:",r),e("Failed to fetch Branch list")}},async createBranch(t){var r,o;try{const a=await n.post("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){console.error("Error in createBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to create Branch")}},async updateBranch(t){var r,o;try{const a=await n.patch("/item",t);if(a.data.error){e(a.data.error||"Failed to update Branch");return}return a}catch(a){console.error("Error in updateBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to update Branch")}},async getBranch(t){var r,o;try{const a=await n.get(`/item/${t}`);if(a.data.error){e(a.data.error||"Failed to fetch Branch");return}return a.data}catch(a){console.error("Error in getBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to fetch Branch")}},async activateBranch(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error){e(a.data.error||"Failed to activate Branch");return}}catch(a){console.error("Error in activateBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to activate Branch")}},async deactivateBranch(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error){e(a.data.error||"Failed to deactivate Branch");return}}catch(a){console.error("Error in deactivateBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to deactivate Branch")}}}}const xo=m$();function g$(){const n=Pa("https://api.jplan.com.br/management/team"),{error:e}=Er();return{async getTeamList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error)throw e("Failed to fetch Team list"),new Error(o.data.error);return o.data.data}catch(r){console.error("Error in getTeamList:",r),e("Failed to fetch Team list");return}},async createTeam(t){var r,o;try{const a=await n.post("/item",t);if(a.data.error)throw e("Failed to create Team"),new Error(a.data.error);return a}catch(a){throw console.error("Error in createTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to create Team"),a}},async updateTeam(t){var r,o;try{const a=await n.patch("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){throw console.error("Error in updateTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to update Team"),a}},async getTeam(t){var r,o;try{const a=await n.get(`/item/${t}`);return a.data.error&&e("Failed to fetch Team"),a.data}catch(a){console.error("Error in getTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to fetch Team");return}},async activateTeam(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error)throw e("Failed to activate Team"),new Error(a.data.error)}catch(a){throw console.error("Error in activateTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to activate Team"),a}},async deactivateTeam(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error)throw e("Failed to deactivate Team"),new Error(a.data.error)}catch(a){throw console.error("Error in deactivateTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to deactivate Team"),a}},async getTeamUserList(t,r){try{const o=r?`?filter_query=${r}`:"",a=await n.get(`/item/${t}/user/list/${o}`);if(a.data.error)throw e("Failed to fetch Team User list"),new Error(a.data.error);return a.data.data}catch(o){console.error("Error in getTeamUserList:",o),e("Failed to fetch Team User list");return}},async linkManageUser(t,r){try{const o=await n.post(`/item/${t}/user/item/`,r);if(o.data.error)throw e("Failed to link User"),new Error(o.data.error);return o.data}catch(o){console.error("Error in link User:",o),e("Failed to link User");return}},async updateManageUser(t,r){try{const o=await n.patch(`/item/${t}/user/item/`,r);if(o.data.error)throw e("Failed to update User"),new Error(o.data.error);return o.data.data}catch(o){throw console.error("Error in update User:",o),e("Failed to update User"),o}},async getManageUser(t,r,o){try{const a=o?`?filter_query=${o}`:"",c=await n.get(`/item/${t}/user/item/${r}/${a}`);if(c.data.error)throw e("Failed to fetch User"),new Error(c.data.error);return c.data.data}catch(a){console.error("Error in getUser:",a),e("Failed to fetch User");return}},async unlinkManageUser(t,r,o){try{const a=o?`?filter_query=${o}`:"";await n.delete(`/item/${t}/user/item/${r}/${a}`)}catch(a){throw console.error("Error in unlink User:",a),e("Failed to unlink User"),a}}}}const Pn=g$();let jc=!1;const uh=l.ref(!1),qn=l.ref([]),_y=l.ref([]),ht=l.ref(null),Ji=l.ref([]),Qi=l.ref([]),NT=()=>{const n=Er(),e=async C=>{uh.value=!0;const T=C?`_active eq true and ${C}`:"_active eq true",k=await Lo.getOrgList(T);k&&(qn.value=k,jc=!0),uh.value=!1},t=async C=>{var T;return(T=qn.value)!=null&&T.length||await e(C),qn.value};function r(C){if(!qn.value)throw new Error("Data not stored yet");const T=Na(qn.value,C,["name","description"]);return C!==""?T:qn.value}const o=C=>{_y.value=C},a=C=>{ht.value=ka.cloneDeep(C)},c=async C=>await Lo.getOrg(C),d=async()=>{if(ht.value!=null){const C=await Lo.createOrg(ht.value);return C!=null&&C.data.created_at&&(n.success("Organization created."),jc&&qn.value.push(C.data)),C==null?void 0:C.data}},h=async()=>{if(_e.value=!0,ht.value&&ht.value.__id){const C=await Lo.updateOrg(ht.value);if(jc&&(C!=null&&C.data.__id)){const T=qn.value.findIndex(k=>k.__id===C.data.__id);return T!==-1?(qn.value[T]=C.data,n.success("Organization updated.")):n.error("Unable to update item"),_e.value=!1,C.data}}else _e.value=!1,n.error("Unable to update item")},f=async()=>{if(_e.value=!0,ht.value&&ht.value.created_at){if(await Lo.deactivateOrg(ht.value.__id),jc){const C=qn.value.findIndex(T=>{var k;return T.__id===((k=ht.value)==null?void 0:k.__id)});if(C!==-1)return qn.value.splice(C,1),ht.value;n.error("Unable to deactivate organization")}_e.value=!1}};async function g(C){_e.value=!0;try{if(ht.value&&ht.value.__id){const T={...C,organization:ht.value.__id};if(!await xo.updateBranch(T)){_e.value=!1;return}if(Ji.value.findIndex(N=>N.__id===C.__id)===-1)return n.success("Branch added successfully."),Ji.value.push(T),T;n.info("Branch already added.")}}catch(T){console.error(T)}finally{_e.value=!1}}async function v(C){if(_e.value=!0,ht.value&&ht.value.__id){const T={...C,organization:null};if(!await xo.updateBranch(T)){_e.value=!1;return}const I=Ji.value.findIndex(N=>N.__id===C.__id);if(I!==-1)return Ji.value.splice(I,1),_e.value=!1,Ji.value;throw new Error("Item not found to remove")}_e.value=!1}async function p(C){_e.value=!0;try{if(ht.value&&ht.value.__id){const T={...C,organization:ht.value.__id};if(!await Pn.updateTeam(T)){_e.value=!1;return}if(Qi.value.findIndex(N=>N.__id===C.__id)===-1)return n.success("Team added successfully."),Qi.value.push(T),T;n.info("Team already added.")}}catch(T){console.error(T)}finally{_e.value=!1}}async function w(C){if(_e.value=!0,ht.value&&ht.value.__id){const T={...C,organization:null};if(!await Pn.updateTeam(T)){_e.value=!1;return}const I=Qi.value.findIndex(N=>N.__id===C.__id);if(I!==-1)return Qi.value.splice(I,1),_e.value=!1,Qi.value;throw new Error("Item not found to remove")}_e.value=!1}return{data:qn,loading:uh,columns:_y,item:ht,filterData:r,__init__:e,getData:t,setColumns:o,setItem:a,getItem:c,createItem:d,updateItem:h,removeItem:f,orgBranches:Ji,orgTeams:Qi,linkBranch:g,unlinkBranch:v,linkTeam:p,unlinkTeam:w}};let Jc=!1;const Yn=l.ref([]),vy=l.ref([]),kt=l.ref(null),dh=l.ref(!1),Xi=l.ref([]),RT=()=>{const n=Er(),e=async p=>{dh.value=!0;const w=p?`_active eq true and ${p}`:"_active eq true",C=await Pn.getTeamList(w);C&&(Yn.value=C,Jc=!0),dh.value=!1},t=async p=>(Yn.value.length||await e(p),Yn.value);function r(p){if(!Yn.value)throw new Error("Data not stored yet");const w=Na(Yn.value,p,["name","description"]);return p!==""?w:Yn.value}const o=p=>{vy.value=p},a=p=>{kt.value=ka.cloneDeep(p)},c=async p=>await Pn.getTeam(p),d=async()=>{if(kt.value!=null){const p=await Pn.createTeam(kt.value);return p!=null&&p.data.created_at&&(n.success("Team created."),Jc&&Yn.value.push(p.data)),p==null?void 0:p.data}},h=async()=>{if(_e.value=!0,kt.value&&kt.value.__id){const p=await Pn.updateTeam(kt.value);if(Jc&&(p!=null&&p.data.__id)){const w=Yn.value.findIndex(C=>C.__id===p.data.__id);return w!==-1?(Yn.value[w]=p.data,n.success("Team updated.")):n.error("Unable to update item"),p.data}}else n.error("Unable to update item")},f=async()=>{if(kt.value&&kt.value.created_at&&(await Pn.deactivateTeam(kt.value.__id),Jc)){const p=Yn.value.findIndex(w=>{var C;return w.__id===((C=kt.value)==null?void 0:C.__id)});if(p!==-1)return Yn.value.splice(p,1),kt.value;n.error("Unable to deactivate organization")}};async function g(p){var w;if(_e.value=!0,(w=kt.value)!=null&&w.__id)if(Xi.value.findIndex(T=>T.__id===p.__id)===-1)try{const T=await Pn.linkManageUser(kt.value.__id,{team:kt.value.__id,user:p.__id,role:"string",joined_at:"string",comments:"string"}),k=await Pn.getTeamUserList(kt.value.__id);return k&&(Xi.value=k),n.success("User added successfully."),T}catch(T){console.error(T),n.error("Unable to add User.")}finally{_e.value=!1}else n.info("User already added.");else console.warn("No item selected or item ID is missing."),n.info("Please select a valid item.");_e.value=!1}async function v(p){if(_e.value=!0,kt.value&&kt.value.__id){const w=Xi.value.findIndex(C=>C.__id===p);if(w!==-1)return await Pn.unlinkManageUser(kt.value.__id,p),Xi.value.splice(w,1),_e.value=!1,Xi.value;throw new Error("Item not found to remove")}_e.value=!1}return{data:Yn,loading:dh,columns:vy,item:kt,usersTeam:Xi,__init__:e,getData:t,filterData:r,setColumns:o,setItem:a,getItem:c,createItem:d,updateItem:h,removeItem:f,linkUser:g,unlinkUser:v}},OT=l.defineComponent({__name:"GlobalScopeFilter",setup(n){var T,k,I;const{openDialog:e}=Os("global-scope__J-"),{user:t,scope:r,session:o,setScope:a}=pu(),{getData:c,data:d}=NT(),{getData:h,data:f}=RT(),g=l.ref(!1);l.onBeforeMount(async()=>{g.value=!0,await c(),await h(),g.value=!1});const v=l.ref({scope_type:(T=r.value)==null?void 0:T.scope_type,organization:((k=r.value)==null?void 0:k.organization)??"org",team:(I=r.value)==null?void 0:I.team});function p(){var N,O,L;v.value={...r.value,scope_type:(N=r.value)==null?void 0:N.scope_type,organization:((O=r.value)==null?void 0:O.organization)??"",team:(L=r.value)==null?void 0:L.team},e()}const w=l.computed(()=>{var N;switch((N=r.value)==null?void 0:N.scope_type){case"user":return PB;case"org":return RB;case"team":return MB;default:return OB}});async function C(){var N;((N=r.value)==null?void 0:N.scope_type)!==""&&a(v.value)}return(N,O)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createVNode(ot.VBtn,{onClick:p,icon:"",class:"text-secondary",color:"surface",rounded:"sm",size:"small",variant:"flat"},{default:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(w.value),{size:"20"}))]),_:1}),l.createVNode(l.unref(Ms),{loading:g.value,title:"Scope","dd-id":"global-scope__J-",onOnSave:C},{default:l.withCtx(()=>[l.createElementVNode("div",null,[l.createVNode(Je.VRow,null,{default:l.withCtx(()=>[l.createVNode(Je.VCol,{cols:"4",class:"d-flex flex-row align-center"},{default:l.withCtx(()=>[l.createVNode(Jt.VListItem,null,{default:l.withCtx(()=>[l.createVNode(Jt.VListItemTitle,null,{default:l.withCtx(()=>O[3]||(O[3]=[l.createTextVNode(" User")])),_:1}),l.createVNode(Jt.VListItemSubtitle,null,{default:l.withCtx(()=>{var L;return[l.createTextVNode(l.toDisplayString(((L=l.unref(t))==null?void 0:L.name)||"Unknown"),1)]}),_:1})]),_:1})]),_:1}),l.createVNode(Je.VCol,{cols:"4"},{default:l.withCtx(()=>[l.createVNode(Jt.VListItem,null,{default:l.withCtx(()=>[l.createVNode(Jt.VListItemTitle,null,{default:l.withCtx(()=>O[4]||(O[4]=[l.createTextVNode(" Domain")])),_:1}),l.createVNode(Jt.VListItemSubtitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(o).domain),1)]),_:1})]),_:1})]),_:1}),l.createVNode(Je.VCol,{cols:"4"},{default:l.withCtx(()=>[l.createVNode(Jt.VListItem,null,{default:l.withCtx(()=>[l.createVNode(Jt.VListItemTitle,null,{default:l.withCtx(()=>O[5]||(O[5]=[l.createTextVNode(" Environment")])),_:1}),l.createVNode(Jt.VListItemSubtitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(o).environment),1)]),_:1})]),_:1})]),_:1})]),_:1}),l.createVNode(yO.VBtnToggle,{density:"compact",variant:"outlined",modelValue:v.value.scope_type,"onUpdate:modelValue":O[0]||(O[0]=L=>v.value.scope_type=L),class:"d-flex justify-center my-4"},{default:l.withCtx(()=>[l.createVNode(ot.VBtn,{value:"org",label:"Organizational",color:"secondary",class:""},{default:l.withCtx(()=>O[6]||(O[6]=[l.createTextVNode("Organizational")])),_:1}),l.createVNode(ot.VBtn,{value:"team",label:"Team",color:"secondary",class:""},{default:l.withCtx(()=>O[7]||(O[7]=[l.createTextVNode("Team")])),_:1}),l.createVNode(ot.VBtn,{value:"user",label:"User",color:"secondary",class:""},{default:l.withCtx(()=>O[8]||(O[8]=[l.createTextVNode("User")])),_:1}),l.createVNode(ot.VBtn,{value:"",label:"None",color:"lightext",class:""},{default:l.withCtx(()=>O[9]||(O[9]=[l.createTextVNode("None")])),_:1})]),_:1},8,["modelValue"]),l.createElementVNode("div",null,[l.createVNode(_s.VLabel,{class:"text-subtitle-1 text-high-emphasis mb-2"},{default:l.withCtx(()=>O[10]||(O[10]=[l.createTextVNode("Organization")])),_:1}),l.createVNode(ss.VSelect,{items:l.unref(d),"item-title":"name","item-value":"__id",variant:"solo","bg-color":"containerBg",rounded:"false",placeholder:"Select a Organization",class:"min-w-50",modelValue:v.value.organization,"onUpdate:modelValue":O[1]||(O[1]=L=>v.value.organization=L),clearable:""},null,8,["items","modelValue"]),l.createVNode(_s.VLabel,{class:"text-subtitle-1 text-high-emphasis mb-2"},{default:l.withCtx(()=>O[11]||(O[11]=[l.createTextVNode("Team")])),_:1}),l.createVNode(ss.VSelect,{items:l.unref(f),"item-title":"name","item-value":"__id",variant:"solo","bg-color":"containerBg",rounded:"false",placeholder:"Select a Team",class:"min-w-50",modelValue:v.value.team,"onUpdate:modelValue":O[2]||(O[2]=L=>v.value.team=L),clearable:""},null,8,["items","modelValue"])])])]),_:1},8,["loading"])],64))}}),p$={},_$={class:"double-ring-spinner-container"};function v$(n,e){return l.openBlock(),l.createElementBlock("div",_$,e[0]||(e[0]=[l.createElementVNode("div",{class:"spinner-loading"},[l.createElementVNode("div"),l.createElementVNode("div"),l.createElementVNode("div",null,[l.createElementVNode("div")]),l.createElementVNode("div",null,[l.createElementVNode("div")])],-1)]))}const PT=ba(p$,[["render",v$],["__scopeId","data-v-00d7a69f"]]),y$={key:0,class:"_jspinner-overlay_jj"},MT=l.defineComponent({__name:"GlobalSpinner",setup(n){return(e,t)=>l.unref(_e)?(l.openBlock(),l.createElementBlock("div",y$,t[0]||(t[0]=[l.createElementVNode("div",{class:"j-double-ring-spinner-container"},[l.createElementVNode("div",{class:"j-global-spinner-loading"},[l.createElementVNode("div"),l.createElementVNode("div"),l.createElementVNode("div",null,[l.createElementVNode("div")]),l.createElementVNode("div",null,[l.createElementVNode("div")])])],-1)]))):l.createCommentVNode("",!0)}}),DT=l.defineComponent({__name:"SubMenu",props:{title:{}},setup(n,{expose:e}){return e({props:n}),(r,o)=>(l.openBlock(),l.createBlock(Jt.VListItem,{onClick:o[0]||(o[0]=()=>{}),density:"compact"},{append:l.withCtx(()=>[l.createVNode(l.unref(DB))]),default:l.withCtx(()=>[l.createVNode(Jt.VListItemTitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(r.title),1)]),_:1}),l.createVNode(hf.VMenu,{activator:"parent","open-on-hover":"",submenu:"",density:"compact"},{default:l.withCtx(()=>[l.renderSlot(r.$slots,"default")]),_:3})]),_:3}))}}),C$=Object.freeze(Object.defineProperty({__proto__:null,AvatarPicture:aC,ColumnSettingsDialog:Df,ConfirmDialog:oC,ContextMenu:sC,CopyButton:xl,DeleteAllBtn:_f,DotsMenu:rC,EditButton:nC,FormHeadless:BE,FormMetadata:nu,GlobalScopeFilter:OT,GlobalSpinner:MT,JAvatar:iC,JBtn:Iy,JDialog:Ms,JForm:UE,JIconBtn:by,JSelect:ME,JTextArea:DE,JTextField:cE,ParentCard:Hl,SearchFilter:Yl,SpinnerLoader:PT,SubMenu:DT,TabFormHeader:FE,TableAdvanced:zC,TableCard:Lf,TableCardsView:aE,TableHeader:GC,UiTable:cC},Symbol.toStringTag,{value:"Module"})),E$=YO(),w$={transition:"Vue-Toastification__fade",maxToasts:20,newestOnTop:!0},T$={"pt-BR":{placeholders:{selectFilter:"Selecionar filtro",visualize:"Visualizar",actions:"Ações",search:"Pesquisar"},dialogs:{columnSettings:{title:"Configurações de coluna"}},actions:{save:"Salvar",cancel:"Cancelar",edit:"Editar",delete:"Deletar",disable:"Desabilitar",back:"Voltar"},forms:{metadata:{created:"Criado",updated:"Atualizado",modified:"Modificado",delegated:"Delegado"}},$vuetify:{dataFooter:{itemsPerPageAll:"Todos",itemsPerPageText:"Itens por página:",pageText:"{0}-{1} de {2}"}}},"en-US":{placeholders:{selectFilter:"Select a filter",visualize:"Visualize",actions:"Actions",search:"Search"},dialogs:{columnSettings:{title:"Column Settings"}},actions:{save:"Save",cancel:"Cancel",edit:"Edit",delete:"Delete",disable:"Disable",back:"Back"},forms:{metadata:{created:"Created",updated:"Updated",modified:"Modified",delegated:"Delegated"}},$vuetify:{dataFooter:{itemsPerPageAll:"All",itemsPerPageText:"Items per page:",pageText:"{0}-{1} of {2}"}}}},LT=mx({locale:"pt-BR",fallbackLocale:"en-US",messages:T$});let hh=!1;const fh=l.ref(!1),jn=l.ref([]),yy=l.ref([]),Ht=l.ref(null),Zi=l.ref([]),b$=()=>{const n=Er(),e=async p=>{fh.value=!0;const w=p?`_active eq true and ${p}`:"_active eq true",C=await xo.getBranchList(w);C&&(jn.value=C,hh=!0),fh.value=!1},t=async p=>(jn.value.length||await e(p),jn.value);function r(p){if(!jn.value)throw new Error("Data not stored yet");const w=Na(jn.value,p,["name","description"]);return p!==""?w:jn.value}const o=p=>{yy.value=p},a=p=>{Ht.value=ka.cloneDeep(p)},c=async p=>await xo.getBranch(p),d=async()=>{if(Ht.value!=null){const p=await xo.createBranch(Ht.value);return p!=null&&p.data.created_at&&(n.success("Branch created."),hh&&jn.value.push(p.data)),p==null?void 0:p.data}},h=async()=>{if(Ht.value&&Ht.value.__id){const p=await xo.updateBranch(Ht.value);if(hh&&p){const w=jn.value.findIndex(C=>C.__id===p.data.__id);return w!==-1?(jn.value[w]=p.data,n.success("Branch updated.")):n.error("Unable to update item"),p}}else n.error("Unable to update item")},f=async()=>{if(Ht.value&&Ht.value.created_at){await xo.deactivateBranch(Ht.value.__id);const p=jn.value.findIndex(w=>{var C;return w.__id===((C=Ht.value)==null?void 0:C.__id)});if(p!==-1)return jn.value.splice(p,1),Ht.value;n.error("Unable to deactivate Domain")}};async function g(p){_e.value=!0;try{if(Ht.value&&Ht.value.__id){const w={...p,branch:Ht.value.__id};if(!await Pn.updateTeam(w)){n.error("Unable to link team");return}if(Zi.value.findIndex(k=>k.__id===p.__id)===-1)return n.success("Team added successfully."),Zi.value.push(w),w;n.info("Team already added.")}else throw new Error("Item is not defined")}catch(w){console.error(w)}finally{_e.value=!1}}async function v(p){if(_e.value=!0,Ht.value&&Ht.value.__id){const w={...p,branch:null};if(!await Pn.updateTeam(w))return;const T=Zi.value.findIndex(k=>k.__id===p.__id);if(T!==-1)return Zi.value.splice(T,1),_e.value=!1,Zi.value;throw new Error("Item not found to remove")}_e.value=!1}return{data:jn,columns:yy,item:Ht,loading:fh,__init__:e,getData:t,filterData:r,setColumns:o,setItem:a,getItem:c,createItem:d,updateItem:h,removeItem:f,branchTeams:Zi,linkTeam:g,unlinkTeam:v}};function I$(){const n=Pa("https://api.jplan.com.br/management/division"),{error:e}=Er();return{async getDivisionList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error)throw e("Failed to fetch Division list"),new Error(o.data.error);return o.data.data}catch(r){console.error("Error in getDivisionList:",r),e("Failed to fetch Division list");return}},async createDivision(t){var r,o;try{const a=await n.post("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){throw console.error("Error in createDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to create Division"),a}},async updateDivision(t){var r,o;try{const a=await n.patch("/item",t);if(a.data.error)throw e("Failed to update Division"),new Error(a.data.error);return a}catch(a){throw console.error("Error in updateDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to update Division"),a}},async getDivision(t){var r,o;try{const a=await n.get(`/item/${t}`);if(a.data.error)throw e("Failed to fetch Division"),new Error(a.data.error);return a.data}catch(a){throw console.error("Error in getDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to fetch Division"),a}},async activateDivision(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error)throw e("Failed to activate Division"),new Error(a.data.error)}catch(a){throw console.error("Error in activateDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to activate Division"),a}},async deactivateDivision(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error)throw e("Failed to deactivate Division"),new Error(a.data.error)}catch(a){throw console.error("Error in deactivateDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to deactivate Division"),a}}}}const aa=I$();let mh=!1;const gh=l.ref(!1),Jn=l.ref([]),Cy=l.ref([]),$t=l.ref(null),ea=l.ref([]),S$=()=>{const n=Er(),e=async p=>{gh.value=!0;const w=p?`_active eq true and ${p}`:"_active eq true",C=await aa.getDivisionList(w);C&&(Jn.value=C,mh=!0),gh.value=!1},t=async p=>(Jn.value.length||await e(p),Jn.value);function r(p){if(!Jn.value)throw new Error("Data not stored yet");const w=Na(Jn.value,p,["name","description"]);return p!==""?w:Jn.value}const o=p=>{Cy.value=p},a=p=>{$t.value=ka.cloneDeep(p)},c=async p=>await aa.getDivision(p),d=async()=>{if($t.value!=null){const p=await aa.createDivision($t.value);return p!=null&&p.data.created_at&&(n.success("Division created."),mh&&Jn.value.push(p.data)),p==null?void 0:p.data}},h=async()=>{if(_e.value=!0,$t.value&&$t.value.__id){const p=await aa.updateDivision($t.value);if(mh&&(p!=null&&p.data.__id)){const w=Jn.value.findIndex(C=>C.__id===p.data.__id);return w!==-1?(Jn.value[w]=p.data,n.success("Updated Division.")):n.error("Unable to update item"),_e.value=!1,p}}else _e.value=!1,n.error("Unable to update item")},f=async()=>{if(_e.value=!0,$t.value&&$t.value.created_at){await aa.deactivateDivision($t.value.__id);const p=Jn.value.findIndex(w=>{var C;return w.__id===((C=$t.value)==null?void 0:C.__id)});if(p!==-1)return Jn.value.splice(p,1),$t.value;n.error("Unable to deactivate Division")}_e.value=!1};async function g(p){_e.value=!0;try{if($t.value&&$t.value.__id){const w={...p,division:$t.value.__id};return await Lo.updateOrg(w)?(ea.value.findIndex(k=>k.__id===p.__id)===-1?(n.success("Organization added successfully."),ea.value.push(w)):n.info("Organization already added."),w):void 0}else throw new Error("Item is not defined")}catch(w){console.error(w)}finally{_e.value=!1}}async function v(p){if(_e.value=!0,$t.value&&$t.value.__id){const w={...p,division:null};if(!await Lo.updateOrg(w))return;const T=ea.value.findIndex(k=>k.__id===p.__id);if(T!==-1)ea.value.splice(T,1);else throw new Error("Item não encontrado para remoção")}else throw new Error("Item não está definido");return _e.value=!1,ea.value}return{data:Jn,columns:Cy,item:$t,loading:gh,__init__:e,filterData:r,getData:t,setColumns:o,setItem:a,getItem:c,createItem:d,updateItem:h,removeItem:f,orgs:ea,linkDivision:g,unlinkDivision:v}};function A$(){const n=Pa("https://api.jplan.com.br/management/user"),{error:e}=Er();return{async getManageUserList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error)throw e("Failed to fetch User list"),new Error(o.data.error);return o.data.data}catch(r){console.error("Error in getManageUserList:",r),e("Failed to fetch User list");return}},async createManageUser(t){var r,o;try{const a=await n.post("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){throw console.error("Error in createManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to create User"),a}},async updateManageUser(t){var r,o;try{const a=await n.patch("/item",t);if(a.data.error)throw e("Failed to update User"),new Error(a.data.error);return a}catch(a){throw console.error("Error in updateManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to update User"),a}},async getManageUser(t){var r,o;try{const a=await n.get(`/item/${t}`);if(a.data.error)throw e("Failed to fetch User"),new Error(a.data.error);return a.data}catch(a){console.error("Error in getManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to fetch User");return}},async activateManageUser(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error)throw e("Failed to activate User"),new Error(a.data.error)}catch(a){throw console.error("Error in activateManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to activate User"),a}},async deactivateManageUser(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error)throw e("Failed to deactivate User"),new Error(a.data.error)}catch(a){throw console.error("Error in deactivateManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to deactivate User"),a}}}}const sa=A$();let ph=!1,_h=l.ref(!1);const Qn=l.ref([]),Ey=l.ref([]),Xn=l.ref(null),k$=l.ref(null),N$=l.ref([]),R$=()=>{const n=Er(),e=async g=>{_h.value=!0;const v=g?`_active eq true and ${g}`:"_active eq true",p=await sa.getManageUserList(v);p&&(Qn.value=p,ph=!0),_h.value=!1},t=async g=>(Qn.value.length||await e(g),Qn.value);function r(g){if(!Qn.value)throw new Error("Data not stored yet");const v=Na(Qn.value,g,["name","description"]);return g!==""?v:Qn.value}return{data:Qn,loading:_h,columns:Ey,item:Xn,filterData:r,__init__:e,getData:t,setColumns:g=>{Ey.value=g},setItem:g=>{Xn.value=ka.cloneDeep(g)},getItem:async g=>await sa.getManageUser(g),createItem:async()=>{if(Xn.value!=null){const g=crypto.randomUUID(),v=await sa.createManageUser({...Xn.value,__id:g});return v!=null&&v.data.created_at&&(n.success("User created."),ph&&Qn.value.push(v.data)),v==null?void 0:v.data}},updateItem:async()=>{if(_e.value=!0,Xn.value&&Xn.value.created_at){const g=await sa.updateManageUser(Xn.value);if(ph&&(g!=null&&g.data)){const v=Qn.value.findIndex(p=>p.__id===(g==null?void 0:g.data.__id));if(v!==-1)Qn.value[v]=g==null?void 0:g.data,n.success("User created.");else throw new Error("Unable to find item after update")}return _e.value=!1,g==null?void 0:g.data}},removeItem:async()=>{if(Xn.value&&Xn.value.created_at){try{await sa.deactivateManageUser(Xn.value.__id)}catch{n.error("Unable to deactivate user");return}const g=Qn.value.findIndex(v=>{var p;return v.__id===((p=Xn.value)==null?void 0:p.__id)});if(g!==-1)return Qn.value.splice(g,1),Xn.value}},userOrg:k$,userTeams:N$}},O$=n=>{n.use(E$),n.use(J0,w$),n.use(LT),Object.entries(C$).forEach(([e,t])=>{n.component(e,t)}),Object.entries(EO).forEach(([e,t])=>{n.provide(e,t)})},P$={install:O$};exports.ContextMenu=sC;exports.EmptyListImg=Ph;exports.EventBus=Bl;exports.FormHeadless=BE;exports.HttpCore=rB;exports.SpinnerLoader=PT;exports.TableCardsView=aE;exports.TableHeader=GC;exports.__spinner=_e;exports._export_sfc=ba;exports._sfc_main=cC;exports._sfc_main$1=zC;exports._sfc_main$10=_f;exports._sfc_main$11=nC;exports._sfc_main$12=by;exports._sfc_main$13=ME;exports._sfc_main$14=DE;exports._sfc_main$15=cE;exports._sfc_main$16=UE;exports._sfc_main$17=FE;exports._sfc_main$18=Hl;exports._sfc_main$19=iC;exports._sfc_main$2=Df;exports._sfc_main$20=aC;exports._sfc_main$21=Ms;exports._sfc_main$22=DT;exports._sfc_main$23=OT;exports._sfc_main$24=MT;exports._sfc_main$3=Lf;exports._sfc_main$4=Yl;exports._sfc_main$5=oC;exports._sfc_main$6=xl;exports._sfc_main$7=rC;exports._sfc_main$8=nu;exports._sfc_main$9=Iy;exports.branchInstance=xo;exports.coreClient=Am;exports.createToastInterface=Cs;exports.dateFormat=cs;exports.divisionInstance=aa;exports.filterQuery=Na;exports.globalEventBus=pf;exports.i18n=LT;exports.index=P$;exports.manageUserInstance=sa;exports.msal=zt;exports.orgInstance=Lo;exports.provideToast=j0;exports.scopedClient=Pa;exports.setupAuthGuard=d$;exports.teamInstance=Pn;exports.toastInjectionKey=Vl;exports.useAuth=Sm;exports.useBranchStore=b$;exports.useCustomizer=ZO;exports.useDialog=Os;exports.useDivisionStore=S$;exports.useManageUserStore=R$;exports.useOrganizationStore=NT;exports.useSession=pu;exports.useTeamStore=RT;exports.useToast=Er;
|
113
|
+
${c}`);return}throw Qv(e.error,e.error_description,e.suberror)?new Cr(e.error,e.error_description,e.suberror,e.timestamp||B.EMPTY_STRING,e.trace_id||B.EMPTY_STRING,e.correlation_id||B.EMPTY_STRING,e.claims||B.EMPTY_STRING,a):c}}async handleServerTokenResponse(e,t,r,o,a,c,d,h,f){var C;(C=this.performanceClient)==null||C.addQueueMeasurement(x.HandleServerTokenResponse,e.correlation_id);let g;if(e.id_token){if(g=Ii(e.id_token||B.EMPTY_STRING,this.cryptoObj.base64Decode),a&&a.nonce&&g.nonce!==a.nonce)throw Y(YE);if(o.maxAge||o.maxAge===0){const T=g.auth_time;if(!T)throw Y(Wf);aw(T,o.maxAge)}}this.homeAccountIdentifier=Ot.generateHomeAccountId(e.client_info||B.EMPTY_STRING,t.authorityType,this.logger,this.cryptoObj,g);let v;a&&a.state&&(v=vr.parseRequestState(this.cryptoObj,a.state)),e.key_id=e.key_id||o.sshKid||void 0;const p=this.generateCacheRecord(e,t,r,o,g,c,a);let w;try{if(this.persistencePlugin&&this.serializableCache&&(this.logger.verbose("Persistence enabled, calling beforeCacheAccess"),w=new E2(this.serializableCache,!0),await this.persistencePlugin.beforeCacheAccess(w)),d&&!h&&p.account){const T=p.account.generateAccountKey();if(!this.cacheStorage.getAccount(T,this.logger))return this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache"),await wi.generateAuthenticationResult(this.cryptoObj,t,p,!1,o,g,v,void 0,f)}await this.cacheStorage.saveCacheRecord(p,o.storeInCache,o.correlationId)}finally{this.persistencePlugin&&this.serializableCache&&w&&(this.logger.verbose("Persistence enabled, calling afterCacheAccess"),await this.persistencePlugin.afterCacheAccess(w))}return wi.generateAuthenticationResult(this.cryptoObj,t,p,!1,o,g,v,e,f)}generateCacheRecord(e,t,r,o,a,c,d){const h=t.getPreferredCache();if(!h)throw Y(Gf);const f=ww(a);let g,v;e.id_token&&a&&(g=ou(this.homeAccountIdentifier,h,e.id_token,this.clientId,f||""),v=cm(this.cacheStorage,t,this.homeAccountIdentifier,this.cryptoObj.base64Decode,a,e.client_info,h,f,d,void 0,this.logger));let p=null;if(e.access_token){const T=e.scope?_t.fromString(e.scope):new _t(o.scopes||[]),k=(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,I=(typeof e.ext_expires_in=="string"?parseInt(e.ext_expires_in,10):e.ext_expires_in)||0,N=(typeof e.refresh_in=="string"?parseInt(e.refresh_in,10):e.refresh_in)||void 0,O=r+k,L=O+I,$=N&&N>0?r+N:void 0;p=iu(this.homeAccountIdentifier,h,e.access_token,this.clientId,f||t.tenant||"",T.printScopes(),O,L,this.cryptoObj.base64Decode,$,e.token_type,c,e.key_id,o.claims,o.requestedClaimsHash)}let w=null;if(e.refresh_token){let T;if(e.refresh_token_expires_in){const k=typeof e.refresh_token_expires_in=="string"?parseInt(e.refresh_token_expires_in,10):e.refresh_token_expires_in;T=r+k}w=sw(this.homeAccountIdentifier,h,e.refresh_token,this.clientId,e.foci,c,T)}let C=null;return e.foci&&(C={clientId:this.clientId,environment:h,familyId:e.foci}),{account:v,idToken:g,accessToken:p,refreshToken:w,appMetadata:C}}static async generateAuthenticationResult(e,t,r,o,a,c,d,h,f){var O,L,$,G,D;let g=B.EMPTY_STRING,v=[],p=null,w,C,T=B.EMPTY_STRING;if(r.accessToken){if(r.accessToken.tokenType===ze.POP&&!a.popKid){const se=new wa(e),{secret:ie,keyId:Q}=r.accessToken;if(!Q)throw Y(qf);g=await se.signPopToken(ie,Q,a)}else g=r.accessToken.secret;v=_t.fromString(r.accessToken.target).asArray(),p=new Date(Number(r.accessToken.expiresOn)*1e3),w=new Date(Number(r.accessToken.extendedExpiresOn)*1e3),r.accessToken.refreshOn&&(C=new Date(Number(r.accessToken.refreshOn)*1e3))}r.appMetadata&&(T=r.appMetadata.familyId===ms?ms:"");const k=(c==null?void 0:c.oid)||(c==null?void 0:c.sub)||"",I=(c==null?void 0:c.tid)||"";h!=null&&h.spa_accountid&&r.account&&(r.account.nativeAccountId=h==null?void 0:h.spa_accountid);const N=r.account?nm(r.account.getAccountInfo(),void 0,c,(O=r.idToken)==null?void 0:O.secret):null;return{authority:t.canonicalAuthority,uniqueId:k,tenantId:I,scopes:v,account:N,idToken:((L=r==null?void 0:r.idToken)==null?void 0:L.secret)||"",idTokenClaims:c||{},accessToken:g,fromCache:o,expiresOn:p,extExpiresOn:w,refreshOn:C,correlationId:a.correlationId,requestId:f||B.EMPTY_STRING,familyId:T,tokenType:(($=r.accessToken)==null?void 0:$.tokenType)||B.EMPTY_STRING,state:d?d.userRequestState:B.EMPTY_STRING,cloudGraphHostName:((G=r.account)==null?void 0:G.cloudGraphHostName)||B.EMPTY_STRING,msGraphHost:((D=r.account)==null?void 0:D.msGraphHost)||B.EMPTY_STRING,code:h==null?void 0:h.spa_code,fromNativeBroker:!1}}}function cm(n,e,t,r,o,a,c,d,h,f,g){g==null||g.verbose("setCachedAccount called");const p=n.getAccountKeys().find(I=>I.startsWith(t));let w=null;p&&(w=n.getAccount(p,g));const C=w||Ot.createAccount({homeAccountId:t,idTokenClaims:o,clientInfo:a,environment:c,cloudGraphHostName:h==null?void 0:h.cloud_graph_host_name,msGraphHost:h==null?void 0:h.msgraph_host,nativeAccountId:f},e,r),T=C.tenantProfiles||[],k=d||C.realm;if(k&&!T.find(I=>I.tenantId===k)){const I=tm(t,C.localAccountId,k,o);T.push(I)}return C.tenantProfiles=T,C}/*! @azure/msal-common v14.16.0 2024-11-05 */async function Pw(n,e,t){return typeof n=="string"?n:n({clientId:e,tokenEndpoint:t})}/*! @azure/msal-common v14.16.0 2024-11-05 */class Mw extends am{constructor(e,t){var r;super(e,t),this.includeRedirectUri=!0,this.oidcDefaultScopes=(r=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:r.defaultScopes}async getAuthCodeUrl(e){var r;(r=this.performanceClient)==null||r.addQueueMeasurement(x.GetAuthCodeUrl,e.correlationId);const t=await J(this.createAuthCodeUrlQueryString.bind(this),x.AuthClientCreateQueryString,this.logger,this.performanceClient,e.correlationId)(e);return Me.appendQueryString(this.authority.authorizationEndpoint,t)}async acquireToken(e,t){var d,h;if((d=this.performanceClient)==null||d.addQueueMeasurement(x.AuthClientAcquireToken,e.correlationId),!e.code)throw Y(QE);const r=Wr(),o=await J(this.executeTokenRequest.bind(this),x.AuthClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(this.authority,e),a=(h=o.headers)==null?void 0:h[un.X_MS_REQUEST_ID],c=new wi(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin,this.performanceClient);return c.validateTokenResponse(o.body),J(c.handleServerTokenResponse.bind(c),x.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(o.body,this.authority,r,e,t,void 0,void 0,void 0,a)}handleFragmentResponse(e,t){if(new wi(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,null,null).validateServerAuthorizationCodeResponse(e,t),!e.code)throw Y(nw);return e}getLogoutUri(e){if(!e)throw Qe(mw);const t=this.createLogoutUrlQueryString(e);return Me.appendQueryString(this.authority.endSessionEndpoint,t)}async executeTokenRequest(e,t){var f,g;(f=this.performanceClient)==null||f.addQueueMeasurement(x.AuthClientExecuteTokenRequest,t.correlationId);const r=this.createTokenQueryParameters(t),o=Me.appendQueryString(e.tokenEndpoint,r),a=await J(this.createTokenRequestBody.bind(this),x.AuthClientCreateTokenRequestBody,this.logger,this.performanceClient,t.correlationId)(t);let c;if(t.clientInfo)try{const v=kl(t.clientInfo,this.cryptoUtils.base64Decode);c={credential:`${v.uid}${en.CLIENT_INFO_SEPARATOR}${v.utid}`,type:Un.HOME_ACCOUNT_ID}}catch(v){this.logger.verbose("Could not parse client info for CCS Header: "+v)}const d=this.createTokenRequestHeaders(c||t.ccsCredential),h={clientId:((g=t.tokenBodyParameters)==null?void 0:g.clientId)||this.config.authOptions.clientId,authority:e.canonicalAuthority,scopes:t.scopes,claims:t.claims,authenticationScheme:t.authenticationScheme,resourceRequestMethod:t.resourceRequestMethod,resourceRequestUri:t.resourceRequestUri,shrClaims:t.shrClaims,sshKid:t.sshKid};return J(this.executePostToTokenEndpoint.bind(this),x.AuthorizationCodeClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,t.correlationId)(o,a,d,h,t.correlationId,x.AuthorizationCodeClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var o,a;(o=this.performanceClient)==null||o.addQueueMeasurement(x.AuthClientCreateTokenRequestBody,e.correlationId);const t=new ps(e.correlationId,this.performanceClient);if(t.addClientId(e.embeddedClientId||((a=e.tokenBodyParameters)==null?void 0:a[Ei])||this.config.authOptions.clientId),this.includeRedirectUri?t.addRedirectUri(e.redirectUri):ra.validateRedirectUri(e.redirectUri),t.addScopes(e.scopes,!0,this.oidcDefaultScopes),t.addAuthorizationCode(e.code),t.addLibraryInfo(this.config.libraryInfo),t.addApplicationTelemetry(this.config.telemetry.application),t.addThrottling(),this.serverTelemetryManager&&!Jh(this.config)&&t.addServerTelemetry(this.serverTelemetryManager),e.codeVerifier&&t.addCodeVerifier(e.codeVerifier),this.config.clientCredentials.clientSecret&&t.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const c=this.config.clientCredentials.clientAssertion;t.addClientAssertion(await Pw(c.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),t.addClientAssertionType(c.assertionType)}if(t.addGrantType(VE.AUTHORIZATION_CODE_GRANT),t.addClientInfo(),e.authenticationScheme===ze.POP){const c=new wa(this.cryptoUtils,this.performanceClient);let d;e.popKid?d=this.cryptoUtils.encodeKid(e.popKid):d=(await J(c.generateCnf.bind(c),x.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,t.addPopToken(d)}else if(e.authenticationScheme===ze.SSH)if(e.sshJwk)t.addSshJwk(e.sshJwk);else throw Qe(au);(!_r.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&t.addClaims(e.claims,this.config.authOptions.clientCapabilities);let r;if(e.clientInfo)try{const c=kl(e.clientInfo,this.cryptoUtils.base64Decode);r={credential:`${c.uid}${en.CLIENT_INFO_SEPARATOR}${c.utid}`,type:Un.HOME_ACCOUNT_ID}}catch(c){this.logger.verbose("Could not parse client info for CCS Header: "+c)}else r=e.ccsCredential;if(this.config.systemOptions.preventCorsPreflight&&r)switch(r.type){case Un.HOME_ACCOUNT_ID:try{const c=da(r.credential);t.addCcsOid(c)}catch(c){this.logger.verbose("Could not parse home account ID for CCS Header: "+c)}break;case Un.UPN:t.addCcsUpn(r.credential);break}return e.embeddedClientId&&t.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenBodyParameters&&t.addExtraQueryParameters(e.tokenBodyParameters),e.enableSpaAuthorizationCode&&(!e.tokenBodyParameters||!e.tokenBodyParameters[Yv])&&t.addExtraQueryParameters({[Yv]:"1"}),t.createQueryString()}async createAuthCodeUrlQueryString(e){var a,c;const t=e.correlationId||this.config.cryptoInterface.createNewGuid();(a=this.performanceClient)==null||a.addQueueMeasurement(x.AuthClientCreateQueryString,t);const r=new ps(t,this.performanceClient);r.addClientId(e.embeddedClientId||((c=e.extraQueryParameters)==null?void 0:c[Ei])||this.config.authOptions.clientId);const o=[...e.scopes||[],...e.extraScopesToConsent||[]];if(r.addScopes(o,!0,this.oidcDefaultScopes),r.addRedirectUri(e.redirectUri),r.addCorrelationId(t),r.addResponseMode(e.responseMode),r.addResponseTypeCode(),r.addLibraryInfo(this.config.libraryInfo),Jh(this.config)||r.addApplicationTelemetry(this.config.telemetry.application),r.addClientInfo(),e.codeChallenge&&e.codeChallengeMethod&&r.addCodeChallengeParams(e.codeChallenge,e.codeChallengeMethod),e.prompt&&r.addPrompt(e.prompt),e.domainHint&&r.addDomainHint(e.domainHint),e.prompt!==Ut.SELECT_ACCOUNT)if(e.sid&&e.prompt===Ut.NONE)this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request"),r.addSid(e.sid);else if(e.account){const d=this.extractAccountSid(e.account);let h=this.extractLoginHint(e.account);if(h&&e.domainHint&&(this.logger.warning('AuthorizationCodeClient.createAuthCodeUrlQueryString: "domainHint" param is set, skipping opaque "login_hint" claim. Please consider not passing domainHint'),h=null),h){this.logger.verbose("createAuthCodeUrlQueryString: login_hint claim present on account"),r.addLoginHint(h);try{const f=da(e.account.homeAccountId);r.addCcsOid(f)}catch{this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(d&&e.prompt===Ut.NONE){this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account"),r.addSid(d);try{const f=da(e.account.homeAccountId);r.addCcsOid(f)}catch{this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(e.loginHint)this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from request"),r.addLoginHint(e.loginHint),r.addCcsUpn(e.loginHint);else if(e.account.username){this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from account"),r.addLoginHint(e.account.username);try{const f=da(e.account.homeAccountId);r.addCcsOid(f)}catch{this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}}else e.loginHint&&(this.logger.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request"),r.addLoginHint(e.loginHint),r.addCcsUpn(e.loginHint));else this.logger.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");if(e.nonce&&r.addNonce(e.nonce),e.state&&r.addState(e.state),(e.claims||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&r.addClaims(e.claims,this.config.authOptions.clientCapabilities),e.embeddedClientId&&r.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),this.addExtraQueryParams(e,r),e.nativeBroker&&(r.addNativeBroker(),e.authenticationScheme===ze.POP)){const d=new wa(this.cryptoUtils);let h;e.popKid?h=this.cryptoUtils.encodeKid(e.popKid):h=(await J(d.generateCnf.bind(d),x.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,r.addPopToken(h)}return r.createQueryString()}createLogoutUrlQueryString(e){const t=new ps(e.correlationId,this.performanceClient);return e.postLogoutRedirectUri&&t.addPostLogoutRedirectUri(e.postLogoutRedirectUri),e.correlationId&&t.addCorrelationId(e.correlationId),e.idTokenHint&&t.addIdTokenHint(e.idTokenHint),e.state&&t.addState(e.state),e.logoutHint&&t.addLogoutHint(e.logoutHint),this.addExtraQueryParams(e,t),t.createQueryString()}addExtraQueryParams(e,t){!(e.extraQueryParameters&&e.extraQueryParameters.hasOwnProperty("instance_aware"))&&this.config.authOptions.instanceAware&&(e.extraQueryParameters=e.extraQueryParameters||{},e.extraQueryParameters.instance_aware="true"),e.extraQueryParameters&&t.addExtraQueryParameters(e.extraQueryParameters)}extractAccountSid(e){var t;return((t=e.idTokenClaims)==null?void 0:t.sid)||null}extractLoginHint(e){var t;return((t=e.idTokenClaims)==null?void 0:t.login_hint)||null}}/*! @azure/msal-common v14.16.0 2024-11-05 */const T2=300;class Zh extends am{constructor(e,t){super(e,t)}async acquireToken(e){var c,d;(c=this.performanceClient)==null||c.addQueueMeasurement(x.RefreshTokenClientAcquireToken,e.correlationId);const t=Wr(),r=await J(this.executeTokenRequest.bind(this),x.RefreshTokenClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(e,this.authority),o=(d=r.headers)==null?void 0:d[un.X_MS_REQUEST_ID],a=new wi(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin);return a.validateTokenResponse(r.body),J(a.handleServerTokenResponse.bind(a),x.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(r.body,this.authority,t,e,void 0,void 0,!0,e.forceCache,o)}async acquireTokenByRefreshToken(e){var r;if(!e)throw Qe(fw);if((r=this.performanceClient)==null||r.addQueueMeasurement(x.RefreshTokenClientAcquireTokenByRefreshToken,e.correlationId),!e.account)throw Y(zf);if(this.cacheManager.isAppMetadataFOCI(e.account.environment))try{return await J(this.acquireTokenWithCachedRefreshToken.bind(this),x.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!0)}catch(o){const a=o instanceof Cr&&o.errorCode===Pl,c=o instanceof Ko&&o.errorCode===Dv.INVALID_GRANT_ERROR&&o.subError===Dv.CLIENT_MISMATCH_ERROR;if(a||c)return J(this.acquireTokenWithCachedRefreshToken.bind(this),x.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1);throw o}return J(this.acquireTokenWithCachedRefreshToken.bind(this),x.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1)}async acquireTokenWithCachedRefreshToken(e,t){var a;(a=this.performanceClient)==null||a.addQueueMeasurement(x.RefreshTokenClientAcquireTokenWithCachedRefreshToken,e.correlationId);const r=Si(this.cacheManager.getRefreshToken.bind(this.cacheManager),x.CacheManagerGetRefreshToken,this.logger,this.performanceClient,e.correlationId)(e.account,t,void 0,this.performanceClient,e.correlationId);if(!r)throw Xh(Pl);if(r.expiresOn&&jh(r.expiresOn,e.refreshTokenExpirationOffsetSeconds||T2))throw Xh(sm);const o={...e,refreshToken:r.secret,authenticationScheme:e.authenticationScheme||ze.BEARER,ccsCredential:{credential:e.account.homeAccountId,type:Un.HOME_ACCOUNT_ID}};try{return await J(this.acquireToken.bind(this),x.RefreshTokenClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(o)}catch(c){if(c instanceof Cr&&c.subError===lu){this.logger.verbose("acquireTokenWithRefreshToken: bad refresh token, removing from cache");const d=ua(r);this.cacheManager.removeRefreshToken(d)}throw c}}async executeTokenRequest(e,t){var h,f;(h=this.performanceClient)==null||h.addQueueMeasurement(x.RefreshTokenClientExecuteTokenRequest,e.correlationId);const r=this.createTokenQueryParameters(e),o=Me.appendQueryString(t.tokenEndpoint,r),a=await J(this.createTokenRequestBody.bind(this),x.RefreshTokenClientCreateTokenRequestBody,this.logger,this.performanceClient,e.correlationId)(e),c=this.createTokenRequestHeaders(e.ccsCredential),d={clientId:((f=e.tokenBodyParameters)==null?void 0:f.clientId)||this.config.authOptions.clientId,authority:t.canonicalAuthority,scopes:e.scopes,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid};return J(this.executePostToTokenEndpoint.bind(this),x.RefreshTokenClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,e.correlationId)(o,a,c,d,e.correlationId,x.RefreshTokenClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var o,a,c;(o=this.performanceClient)==null||o.addQueueMeasurement(x.RefreshTokenClientCreateTokenRequestBody,e.correlationId);const t=e.correlationId,r=new ps(t,this.performanceClient);if(r.addClientId(e.embeddedClientId||((a=e.tokenBodyParameters)==null?void 0:a[Ei])||this.config.authOptions.clientId),e.redirectUri&&r.addRedirectUri(e.redirectUri),r.addScopes(e.scopes,!0,(c=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:c.defaultScopes),r.addGrantType(VE.REFRESH_TOKEN_GRANT),r.addClientInfo(),r.addLibraryInfo(this.config.libraryInfo),r.addApplicationTelemetry(this.config.telemetry.application),r.addThrottling(),this.serverTelemetryManager&&!Jh(this.config)&&r.addServerTelemetry(this.serverTelemetryManager),r.addRefreshToken(e.refreshToken),this.config.clientCredentials.clientSecret&&r.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const d=this.config.clientCredentials.clientAssertion;r.addClientAssertion(await Pw(d.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),r.addClientAssertionType(d.assertionType)}if(e.authenticationScheme===ze.POP){const d=new wa(this.cryptoUtils,this.performanceClient);let h;e.popKid?h=this.cryptoUtils.encodeKid(e.popKid):h=(await J(d.generateCnf.bind(d),x.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,r.addPopToken(h)}else if(e.authenticationScheme===ze.SSH)if(e.sshJwk)r.addSshJwk(e.sshJwk);else throw Qe(au);if((!_r.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&r.addClaims(e.claims,this.config.authOptions.clientCapabilities),this.config.systemOptions.preventCorsPreflight&&e.ccsCredential)switch(e.ccsCredential.type){case Un.HOME_ACCOUNT_ID:try{const d=da(e.ccsCredential.credential);r.addCcsOid(d)}catch(d){this.logger.verbose("Could not parse home account ID for CCS Header: "+d)}break;case Un.UPN:r.addCcsUpn(e.ccsCredential.credential);break}return e.embeddedClientId&&r.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenBodyParameters&&r.addExtraQueryParameters(e.tokenBodyParameters),r.createQueryString()}}/*! @azure/msal-common v14.16.0 2024-11-05 */class b2 extends am{constructor(e,t){super(e,t)}async acquireToken(e){var t;try{const[r,o]=await this.acquireCachedToken({...e,scopes:(t=e.scopes)!=null&&t.length?e.scopes:[...Ra]});return o===Po.PROACTIVELY_REFRESHED&&(this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed."),new Zh(this.config,this.performanceClient).acquireTokenByRefreshToken(e).catch(()=>{})),r}catch(r){if(r instanceof ru&&r.errorCode===so)return new Zh(this.config,this.performanceClient).acquireTokenByRefreshToken(e);throw r}}async acquireCachedToken(e){var h;(h=this.performanceClient)==null||h.addQueueMeasurement(x.SilentFlowClientAcquireCachedToken,e.correlationId);let t=Po.NOT_APPLICABLE;if(e.forceRefresh||!this.config.cacheOptions.claimsBasedCachingEnabled&&!_r.isEmptyObj(e.claims))throw this.setCacheOutcome(Po.FORCE_REFRESH_OR_CLAIMS,e.correlationId),Y(so);if(!e.account)throw Y(zf);const r=e.account.tenantId||f2(e.authority),o=this.cacheManager.getTokenKeys(),a=this.cacheManager.getAccessToken(e.account,e,o,r,this.performanceClient,e.correlationId);if(a){if(ZB(a.cachedAt)||jh(a.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))throw this.setCacheOutcome(Po.CACHED_ACCESS_TOKEN_EXPIRED,e.correlationId),Y(so);a.refreshOn&&jh(a.refreshOn,0)&&(t=Po.PROACTIVELY_REFRESHED)}else throw this.setCacheOutcome(Po.NO_CACHED_ACCESS_TOKEN,e.correlationId),Y(so);const c=e.authority||this.authority.getPreferredCache(),d={account:this.cacheManager.readAccountFromCache(e.account),accessToken:a,idToken:this.cacheManager.getIdToken(e.account,o,r,this.performanceClient,e.correlationId),refreshToken:null,appMetadata:this.cacheManager.readAppMetadataFromCache(c)};return this.setCacheOutcome(t,e.correlationId),this.config.serverTelemetryManager&&this.config.serverTelemetryManager.incrementCacheHits(),[await J(this.generateResultFromCacheRecord.bind(this),x.SilentFlowClientGenerateResultFromCacheRecord,this.logger,this.performanceClient,e.correlationId)(d,e),t]}setCacheOutcome(e,t){var r,o;(r=this.serverTelemetryManager)==null||r.setCacheOutcome(e),(o=this.performanceClient)==null||o.addFields({cacheOutcome:e},t),e!==Po.NOT_APPLICABLE&&this.logger.info(`Token refresh is required due to cache outcome: ${e}`)}async generateResultFromCacheRecord(e,t){var o;(o=this.performanceClient)==null||o.addQueueMeasurement(x.SilentFlowClientGenerateResultFromCacheRecord,t.correlationId);let r;if(e.idToken&&(r=Ii(e.idToken.secret,this.config.cryptoInterface.base64Decode)),t.maxAge||t.maxAge===0){const a=r==null?void 0:r.auth_time;if(!a)throw Y(Wf);aw(a,t.maxAge)}return wi.generateAuthenticationResult(this.cryptoUtils,this.authority,e,!0,t,r)}}/*! @azure/msal-common v14.16.0 2024-11-05 */const I2={sendGetRequestAsync:()=>Promise.reject(Y(Se)),sendPostRequestAsync:()=>Promise.reject(Y(Se))};/*! @azure/msal-common v14.16.0 2024-11-05 */const Xv=",",Dw="|";function S2(n){const{skus:e,libraryName:t,libraryVersion:r,extensionName:o,extensionVersion:a}=n,c=new Map([[0,[t,r]],[2,[o,a]]]);let d=[];if(e!=null&&e.length){if(d=e.split(Xv),d.length<4)return e}else d=Array.from({length:4},()=>Dw);return c.forEach((h,f)=>{var g,v;h.length===2&&((g=h[0])!=null&&g.length)&&((v=h[1])!=null&&v.length)&&A2({skuArr:d,index:f,skuName:h[0],skuVersion:h[1]})}),d.join(Xv)}function A2(n){const{skuArr:e,index:t,skuName:r,skuVersion:o}=n;t>=e.length||(e[t]=[r,o].join(Dw))}class Ns{constructor(e,t){this.cacheOutcome=Po.NOT_APPLICABLE,this.cacheManager=t,this.apiId=e.apiId,this.correlationId=e.correlationId,this.wrapperSKU=e.wrapperSKU||B.EMPTY_STRING,this.wrapperVer=e.wrapperVer||B.EMPTY_STRING,this.telemetryCacheKey=Kt.CACHE_KEY+en.CACHE_KEY_SEPARATOR+e.clientId}generateCurrentRequestHeaderValue(){const e=`${this.apiId}${Kt.VALUE_SEPARATOR}${this.cacheOutcome}`,t=[this.wrapperSKU,this.wrapperVer],r=this.getNativeBrokerErrorCode();r!=null&&r.length&&t.push(`broker_error=${r}`);const o=t.join(Kt.VALUE_SEPARATOR),a=this.getRegionDiscoveryFields(),c=[e,a].join(Kt.VALUE_SEPARATOR);return[Kt.SCHEMA_VERSION,c,o].join(Kt.CATEGORY_SEPARATOR)}generateLastRequestHeaderValue(){const e=this.getLastRequests(),t=Ns.maxErrorsToSend(e),r=e.failedRequests.slice(0,2*t).join(Kt.VALUE_SEPARATOR),o=e.errors.slice(0,t).join(Kt.VALUE_SEPARATOR),a=e.errors.length,c=t<a?Kt.OVERFLOW_TRUE:Kt.OVERFLOW_FALSE,d=[a,c].join(Kt.VALUE_SEPARATOR);return[Kt.SCHEMA_VERSION,e.cacheHits,r,o,d].join(Kt.CATEGORY_SEPARATOR)}cacheFailedRequest(e){const t=this.getLastRequests();t.errors.length>=Kt.MAX_CACHED_ERRORS&&(t.failedRequests.shift(),t.failedRequests.shift(),t.errors.shift()),t.failedRequests.push(this.apiId,this.correlationId),e instanceof Error&&e&&e.toString()?e instanceof ct?e.subError?t.errors.push(e.subError):e.errorCode?t.errors.push(e.errorCode):t.errors.push(e.toString()):t.errors.push(e.toString()):t.errors.push(Kt.UNKNOWN_ERROR),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t)}incrementCacheHits(){const e=this.getLastRequests();return e.cacheHits+=1,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e),e.cacheHits}getLastRequests(){const e={failedRequests:[],errors:[],cacheHits:0};return this.cacheManager.getServerTelemetry(this.telemetryCacheKey)||e}clearTelemetryCache(){const e=this.getLastRequests(),t=Ns.maxErrorsToSend(e),r=e.errors.length;if(t===r)this.cacheManager.removeItem(this.telemetryCacheKey);else{const o={failedRequests:e.failedRequests.slice(t*2),errors:e.errors.slice(t),cacheHits:0};this.cacheManager.setServerTelemetry(this.telemetryCacheKey,o)}}static maxErrorsToSend(e){let t,r=0,o=0;const a=e.errors.length;for(t=0;t<a;t++){const c=e.failedRequests[2*t]||B.EMPTY_STRING,d=e.failedRequests[2*t+1]||B.EMPTY_STRING,h=e.errors[t]||B.EMPTY_STRING;if(o+=c.toString().length+d.toString().length+h.length+3,o<Kt.MAX_LAST_HEADER_BYTES)r+=1;else break}return r}getRegionDiscoveryFields(){const e=[];return e.push(this.regionUsed||B.EMPTY_STRING),e.push(this.regionSource||B.EMPTY_STRING),e.push(this.regionOutcome||B.EMPTY_STRING),e.join(",")}updateRegionDiscoveryMetadata(e){this.regionUsed=e.region_used,this.regionSource=e.region_source,this.regionOutcome=e.region_outcome}setCacheOutcome(e){this.cacheOutcome=e}setNativeBrokerErrorCode(e){const t=this.getLastRequests();t.nativeBrokerErrorCode=e,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t)}getNativeBrokerErrorCode(){return this.getLastRequests().nativeBrokerErrorCode}clearNativeBrokerErrorCode(){const e=this.getLastRequests();delete e.nativeBrokerErrorCode,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e)}static makeExtraSkuString(e){return S2(e)}}/*! @azure/msal-common v14.16.0 2024-11-05 */const Lw="missing_kid_error",xw="missing_alg_error";/*! @azure/msal-common v14.16.0 2024-11-05 */const k2={[Lw]:"The JOSE Header for the requested JWT, JWS or JWK object requires a keyId to be configured as the 'kid' header claim. No 'kid' value was provided.",[xw]:"The JOSE Header for the requested JWT, JWS or JWK object requires an algorithm to be specified as the 'alg' header claim. No 'alg' value was provided."};class lm extends ct{constructor(e,t){super(e,t),this.name="JoseHeaderError",Object.setPrototypeOf(this,lm.prototype)}}function Zv(n){return new lm(n,k2[n])}/*! @azure/msal-common v14.16.0 2024-11-05 */class um{constructor(e){this.typ=e.typ,this.alg=e.alg,this.kid=e.kid}static getShrHeaderString(e){if(!e.kid)throw Zv(Lw);if(!e.alg)throw Zv(xw);const t=new um({typ:e.typ||UB.Pop,kid:e.kid,alg:e.alg});return JSON.stringify(t)}}/*! @azure/msal-common v14.16.0 2024-11-05 */class ey{startMeasurement(){}endMeasurement(){}flushMeasurement(){return null}}class N2{generateId(){return"callback-id"}startMeasurement(e,t){return{end:()=>null,discard:()=>{},add:()=>{},increment:()=>{},event:{eventId:this.generateId(),status:h2.InProgress,authority:"",libraryName:"",libraryVersion:"",clientId:"",name:e,startTimeMs:Date.now(),correlationId:t||""},measurement:new ey}}startPerformanceMeasurement(){return new ey}calculateQueuedTime(){return 0}addQueueMeasurement(){}setPreQueueTime(){}endMeasurement(){return null}discardMeasurements(){}removePerformanceCallback(){return!0}addPerformanceCallback(){return""}emitEvents(){}addFields(){}incrementFields(){}cacheEventByCorrelationId(){}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const dm="pkce_not_created",ef="crypto_nonexistent",uu="empty_navigate_uri",Uw="hash_empty_error",hm="no_state_in_hash",Fw="hash_does_not_contain_known_properties",Bw="unable_to_parse_state",Vw="state_interaction_type_mismatch",Hw="interaction_in_progress",$w="popup_window_error",Kw="empty_window_error",Ti="user_cancelled",R2="monitor_popup_timeout",Ww="monitor_window_timeout",zw="redirect_in_iframe",Gw="block_iframe_reload",qw="block_nested_popups",O2="iframe_closed_prematurely",du="silent_logout_unsupported",Yw="no_account_error",P2="silent_prompt_value_error",jw="no_token_request_cache_error",Jw="unable_to_parse_token_request_cache_error",fm="no_cached_authority_error",M2="auth_request_not_set_error",D2="invalid_cache_type",hu="non_browser_environment",oa="database_not_open",Ml="no_network_connectivity",Qw="post_request_failed",Xw="get_request_failed",tf="failed_to_parse_response",Zw="unable_to_load_token",mm="crypto_key_not_found",eT="auth_code_required",tT="auth_code_or_nativeAccountId_required",nT="spa_code_and_nativeAccountId_present",gm="database_unavailable",rT="unable_to_acquire_token_from_native_platform",oT="native_handshake_timeout",iT="native_extension_not_installed",Hs="native_connection_not_established",aT="uninitialized_public_client_application",sT="native_prompt_not_supported",cT="invalid_base64_string",lT="invalid_pop_token_request",uT="failed_to_build_headers",dT="failed_to_parse_headers";/*! @azure/msal-browser v3.28.1 2025-01-14 */const oo="For more visit: aka.ms/msaljs/browser-errors",L2={[dm]:"The PKCE code challenge and verifier could not be generated.",[ef]:"The crypto object or function is not available.",[uu]:"Navigation URI is empty. Please check stack trace for more info.",[Uw]:`Hash value cannot be processed because it is empty. Please verify that your redirectUri is not clearing the hash. ${oo}`,[hm]:"Hash does not contain state. Please verify that the request originated from msal.",[Fw]:`Hash does not contain known properites. Please verify that your redirectUri is not changing the hash. ${oo}`,[Bw]:"Unable to parse state. Please verify that the request originated from msal.",[Vw]:"Hash contains state but the interaction type does not match the caller.",[Hw]:`Interaction is currently in progress. Please ensure that this interaction has been completed before calling an interactive API. ${oo}`,[$w]:"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser.",[Kw]:"window.open returned null or undefined window object.",[Ti]:"User cancelled the flow.",[R2]:`Token acquisition in popup failed due to timeout. ${oo}`,[Ww]:`Token acquisition in iframe failed due to timeout. ${oo}`,[zw]:"Redirects are not supported for iframed or brokered applications. Please ensure you are using MSAL.js in a top frame of the window if using the redirect APIs, or use the popup APIs.",[Gw]:`Request was blocked inside an iframe because MSAL detected an authentication response. ${oo}`,[qw]:"Request was blocked inside a popup because MSAL detected it was running in a popup.",[O2]:"The iframe being monitored was closed prematurely.",[du]:"Silent logout not supported. Please call logoutRedirect or logoutPopup instead.",[Yw]:"No account object provided to acquireTokenSilent and no active account has been set. Please call setActiveAccount or provide an account on the request.",[P2]:"The value given for the prompt value is not valid for silent requests - must be set to 'none' or 'no_session'.",[jw]:"No token request found in cache.",[Jw]:"The cached token request could not be parsed.",[fm]:"No cached authority found.",[M2]:"Auth Request not set. Please ensure initiateAuthRequest was called from the InteractionHandler",[D2]:"Invalid cache type",[hu]:"Login and token requests are not supported in non-browser environments.",[oa]:"Database is not open!",[Ml]:"No network connectivity. Check your internet connection.",[Qw]:"Network request failed: If the browser threw a CORS error, check that the redirectUri is registered in the Azure App Portal as type 'SPA'",[Xw]:"Network request failed. Please check the network trace to determine root cause.",[tf]:"Failed to parse network response. Check network trace.",[Zw]:"Error loading token to cache.",[mm]:"Cryptographic Key or Keypair not found in browser storage.",[eT]:"An authorization code must be provided (as the `code` property on the request) to this flow.",[tT]:"An authorization code or nativeAccountId must be provided to this flow.",[nT]:"Request cannot contain both spa code and native account id.",[gm]:"IndexedDB, which is required for persistent cryptographic key storage, is unavailable. This may be caused by browser privacy features which block persistent storage in third-party contexts.",[rT]:`Unable to acquire token from native platform. ${oo}`,[oT]:"Timed out while attempting to establish connection to browser extension",[iT]:"Native extension is not installed. If you think this is a mistake call the initialize function.",[Hs]:`Connection to native platform has not been established. Please install a compatible browser extension and run initialize(). ${oo}`,[aT]:`You must call and await the initialize function before attempting to call any other MSAL API. ${oo}`,[sT]:"The provided prompt is not supported by the native platform. This request should be routed to the web based flow.",[cT]:"Invalid base64 encoded string.",[lT]:"Invalid PoP token request. The request should not have both a popKid value and signPopToken set to true.",[uT]:"Failed to build request headers object.",[dT]:"Failed to parse response headers"};class $s extends ct{constructor(e,t){super(e,L2[e],t),Object.setPrototypeOf(this,$s.prototype),this.name="BrowserAuthError"}}function oe(n,e){return new $s(n,e)}/*! @azure/msal-browser v3.28.1 2025-01-14 */const Mn={INTERACTION_IN_PROGRESS_VALUE:"interaction_in_progress",INVALID_GRANT_ERROR:"invalid_grant",POPUP_WIDTH:483,POPUP_HEIGHT:600,POPUP_NAME_PREFIX:"msal",DEFAULT_POLL_INTERVAL_MS:30,MSAL_SKU:"msal.js.browser"},ha={CHANNEL_ID:"53ee284d-920a-4b59-9d30-a60315b26836",PREFERRED_EXTENSION_ID:"ppnbnpeolgkicgegkbkbjmhlideopiji",MATS_TELEMETRY:"MATS"},mi={HandshakeRequest:"Handshake",HandshakeResponse:"HandshakeResponse",GetToken:"GetToken",Response:"Response"},_n={LocalStorage:"localStorage",SessionStorage:"sessionStorage",MemoryStorage:"memoryStorage"},ty={GET:"GET",POST:"POST"},$e={AUTHORITY:"authority",ACQUIRE_TOKEN_ACCOUNT:"acquireToken.account",SESSION_STATE:"session.state",REQUEST_STATE:"request.state",NONCE_IDTOKEN:"nonce.id_token",ORIGIN_URI:"request.origin",RENEW_STATUS:"token.renew.status",URL_HASH:"urlHash",REQUEST_PARAMS:"request.params",SCOPES:"scopes",INTERACTION_STATUS_KEY:"interaction.status",CCS_CREDENTIAL:"ccs.credential",CORRELATION_ID:"request.correlationId",NATIVE_REQUEST:"request.native",REDIRECT_CONTEXT:"request.redirect.context"},Oo={ACCOUNT_KEYS:"msal.account.keys",TOKEN_KEYS:"msal.token.keys"},zc={WRAPPER_SKU:"wrapper.sku",WRAPPER_VER:"wrapper.version"},rt={acquireTokenRedirect:861,acquireTokenPopup:862,ssoSilent:863,acquireTokenSilent_authCode:864,handleRedirectPromise:865,acquireTokenByCode:866,acquireTokenSilent_silentFlow:61,logout:961,logoutPopup:962};var ce;(function(n){n.Redirect="redirect",n.Popup="popup",n.Silent="silent",n.None="none"})(ce||(ce={}));const ny={scopes:Ra},hT="jwk",nf="msal.db",x2=1,U2=`${nf}.keys`,On={Default:0,AccessToken:1,AccessTokenAndRefreshToken:2,RefreshToken:3,RefreshTokenAndNetwork:4,Skip:5},F2=[On.Default,On.Skip,On.RefreshTokenAndNetwork],B2="msal.browser.log.level",V2="msal.browser.log.pii";/*! @azure/msal-browser v3.28.1 2025-01-14 */function Gc(n){return encodeURIComponent(pm(n).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"))}function fu(n){return fT(n).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function pm(n){return fT(new TextEncoder().encode(n))}function fT(n){const e=Array.from(n,t=>String.fromCodePoint(t)).join("");return btoa(e)}/*! @azure/msal-browser v3.28.1 2025-01-14 */const H2="RSASSA-PKCS1-v1_5",mT="SHA-256",$2=2048,K2=new Uint8Array([1,0,1]),ry="0123456789abcdef",oy=new Uint32Array(1),W2="crypto_subtle_undefined",_m={name:H2,hash:mT,modulusLength:$2,publicExponent:K2};function z2(n){if(!window)throw oe(hu);if(!window.crypto)throw oe(ef);if(!n&&!window.crypto.subtle)throw oe(ef,W2)}async function gT(n,e,t){e==null||e.addQueueMeasurement(x.Sha256Digest,t);const o=new TextEncoder().encode(n);return window.crypto.subtle.digest(mT,o)}function G2(n){return window.crypto.getRandomValues(n)}function ih(){return window.crypto.getRandomValues(oy),oy[0]}function mo(){const n=Date.now(),e=ih()*1024+(ih()&1023),t=new Uint8Array(16),r=Math.trunc(e/2**30),o=e&2**30-1,a=ih();t[0]=n/2**40,t[1]=n/2**32,t[2]=n/2**24,t[3]=n/2**16,t[4]=n/2**8,t[5]=n,t[6]=112|r>>>8,t[7]=r,t[8]=128|o>>>24,t[9]=o>>>16,t[10]=o>>>8,t[11]=o,t[12]=a>>>24,t[13]=a>>>16,t[14]=a>>>8,t[15]=a;let c="";for(let d=0;d<t.length;d++)c+=ry.charAt(t[d]>>>4),c+=ry.charAt(t[d]&15),(d===3||d===5||d===7||d===9)&&(c+="-");return c}async function q2(n,e){return window.crypto.subtle.generateKey(_m,n,e)}async function ah(n){return window.crypto.subtle.exportKey(hT,n)}async function Y2(n,e,t){return window.crypto.subtle.importKey(hT,n,_m,e,t)}async function j2(n,e){return window.crypto.subtle.sign(_m,n,e)}async function pT(n){const e=await gT(n),t=new Uint8Array(e);return fu(t)}/*! @azure/msal-browser v3.28.1 2025-01-14 */const Rs="storage_not_supported",rf="stubbed_public_client_application_called",Dl="in_mem_redirect_unavailable";/*! @azure/msal-browser v3.28.1 2025-01-14 */const fl={[Rs]:"Given storage configuration option was not supported.",[rf]:"Stub instance of Public Client Application was called. If using msal-react, please ensure context is not used without a provider. For more visit: aka.ms/msaljs/browser-errors",[Dl]:"Redirect cannot be supported. In-memory storage was selected and storeAuthStateInCookie=false, which would cause the library to be unable to handle the incoming hash. If you would like to use the redirect API, please use session/localStorage or set storeAuthStateInCookie=true."};fl[Rs],fl[rf],fl[Dl];class vm extends ct{constructor(e,t){super(e,t),this.name="BrowserConfigurationAuthError",Object.setPrototypeOf(this,vm.prototype)}}function ym(n){return new vm(n,fl[n])}/*! @azure/msal-browser v3.28.1 2025-01-14 */function J2(n){n.location.hash="",typeof n.history.replaceState=="function"&&n.history.replaceState(null,"",`${n.location.origin}${n.location.pathname}${n.location.search}`)}function Q2(n){const e=n.split("#");e.shift(),window.location.hash=e.length>0?e.join("#"):""}function Cm(){return window.parent!==window}function X2(){return typeof window<"u"&&!!window.opener&&window.opener!==window&&typeof window.name=="string"&&window.name.indexOf(`${Mn.POPUP_NAME_PREFIX}.`)===0}function co(){return typeof window<"u"&&window.location?window.location.href.split("?")[0].split("#")[0]:""}function Z2(){const e=new Me(window.location.href).getUrlComponents();return`${e.Protocol}//${e.HostNameAndPort}/`}function eH(){if(Me.hashContainsKnownProperties(window.location.hash)&&Cm())throw oe(Gw)}function tH(n){if(Cm()&&!n)throw oe(zw)}function nH(){if(X2())throw oe(qw)}function _T(){if(typeof window>"u")throw oe(hu)}function vT(n){if(!n)throw oe(aT)}function Em(n){_T(),eH(),nH(),vT(n)}function iy(n,e){if(Em(n),tH(e.system.allowRedirectInIframe),e.cache.cacheLocation===_n.MemoryStorage&&!e.cache.storeAuthStateInCookie)throw ym(Dl)}function yT(n){const e=document.createElement("link");e.rel="preconnect",e.href=new URL(n).origin,e.crossOrigin="anonymous",document.head.appendChild(e),window.setTimeout(()=>{try{document.head.removeChild(e)}catch{}},1e4)}function rH(){return mo()}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Ll{navigateInternal(e,t){return Ll.defaultNavigateWindow(e,t)}navigateExternal(e,t){return Ll.defaultNavigateWindow(e,t)}static defaultNavigateWindow(e,t){return t.noHistory?window.location.replace(e):window.location.assign(e),new Promise(r=>{setTimeout(()=>{r(!0)},t.timeout)})}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class oH{async sendGetRequestAsync(e,t){let r,o={},a=0;const c=ay(t);try{r=await fetch(e,{method:ty.GET,headers:c})}catch{throw oe(window.navigator.onLine?Xw:Ml)}o=sy(r.headers);try{return a=r.status,{headers:o,body:await r.json(),status:a}}catch{throw jv(oe(tf),a,o)}}async sendPostRequestAsync(e,t){const r=t&&t.body||"",o=ay(t);let a,c=0,d={};try{a=await fetch(e,{method:ty.POST,headers:o,body:r})}catch{throw oe(window.navigator.onLine?Qw:Ml)}d=sy(a.headers);try{return c=a.status,{headers:d,body:await a.json(),status:c}}catch{throw jv(oe(tf),c,d)}}}function ay(n){try{const e=new Headers;if(!(n&&n.headers))return e;const t=n.headers;return Object.entries(t).forEach(([r,o])=>{e.append(r,o)}),e}catch{throw oe(uT)}}function sy(n){try{const e={};return n.forEach((t,r)=>{e[r]=t}),e}catch{throw oe(dT)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const iH=6e4,of=1e4,aH=3e4,sH=2e3;function cH({auth:n,cache:e,system:t,telemetry:r},o){const a={clientId:B.EMPTY_STRING,authority:`${B.DEFAULT_AUTHORITY}`,knownAuthorities:[],cloudDiscoveryMetadata:B.EMPTY_STRING,authorityMetadata:B.EMPTY_STRING,redirectUri:typeof window<"u"?co():"",postLogoutRedirectUri:B.EMPTY_STRING,navigateToLoginRequestUrl:!0,clientCapabilities:[],protocolMode:ho.AAD,OIDCOptions:{serverResponseType:Vs.FRAGMENT,defaultScopes:[B.OPENID_SCOPE,B.PROFILE_SCOPE,B.OFFLINE_ACCESS_SCOPE]},azureCloudOptions:{azureCloudInstance:jf.None,tenant:B.EMPTY_STRING},skipAuthorityMetadataCache:!1,supportsNestedAppAuth:!1,instanceAware:!1},c={cacheLocation:_n.SessionStorage,temporaryCacheLocation:_n.SessionStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!!(e&&e.cacheLocation===_n.LocalStorage),claimsBasedCachingEnabled:!1},d={loggerCallback:()=>{},logLevel:et.Info,piiLoggingEnabled:!1},f={...{...Aw,loggerOptions:d,networkClient:o?new oH:I2,navigationClient:new Ll,loadFrameTimeout:0,windowHashTimeout:(t==null?void 0:t.loadFrameTimeout)||iH,iframeHashTimeout:(t==null?void 0:t.loadFrameTimeout)||of,navigateFrameWait:0,redirectNavigationTimeout:aH,asyncPopups:!1,allowRedirectInIframe:!1,allowNativeBroker:!1,nativeBrokerHandshakeTimeout:(t==null?void 0:t.nativeBrokerHandshakeTimeout)||sH,pollIntervalMilliseconds:Mn.DEFAULT_POLL_INTERVAL_MS},...t,loggerOptions:(t==null?void 0:t.loggerOptions)||d},g={application:{appName:B.EMPTY_STRING,appVersion:B.EMPTY_STRING},client:new N2};if((n==null?void 0:n.protocolMode)!==ho.OIDC&&(n!=null&&n.OIDCOptions)&&new $o(f.loggerOptions).warning(JSON.stringify(Qe(yw))),n!=null&&n.protocolMode&&n.protocolMode!==ho.AAD&&(f!=null&&f.allowNativeBroker))throw Qe(Cw);return{auth:{...a,...n,OIDCOptions:{...a.OIDCOptions,...n==null?void 0:n.OIDCOptions}},cache:{...c,...e},system:f,telemetry:{...g,...r}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const lH="@azure/msal-browser",mu="3.28.1";/*! @azure/msal-browser v3.28.1 2025-01-14 */class wm{static loggerCallback(e,t){switch(e){case et.Error:console.error(t);return;case et.Info:console.info(t);return;case et.Verbose:console.debug(t);return;case et.Warning:console.warn(t);return;default:console.log(t);return}}constructor(e){var h;this.browserEnvironment=typeof window<"u",this.config=cH(e,this.browserEnvironment);let t;try{t=window[_n.SessionStorage]}catch{}const r=t==null?void 0:t.getItem(B2),o=(h=t==null?void 0:t.getItem(V2))==null?void 0:h.toLowerCase(),a=o==="true"?!0:o==="false"?!1:void 0,c={...this.config.system.loggerOptions},d=r&&Object.keys(et).includes(r)?et[r]:void 0;d&&(c.loggerCallback=wm.loggerCallback,c.logLevel=d),a!==void 0&&(c.piiLoggingEnabled=a),this.logger=new $o(c,lH,mu),this.available=!1}getConfig(){return this.config}getLogger(){return this.logger}isAvailable(){return this.available}isBrowserEnvironment(){return this.browserEnvironment}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class bi extends wm{getModuleName(){return bi.MODULE_NAME}getId(){return bi.ID}async initialize(){return this.available=typeof window<"u",this.available}}bi.MODULE_NAME="";bi.ID="StandardOperatingContext";/*! @azure/msal-browser v3.28.1 2025-01-14 */function $r(n){return new TextDecoder().decode(uH(n))}function uH(n){let e=n.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw oe(cT)}const t=atob(e);return Uint8Array.from(t,r=>r.codePointAt(0)||0)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class dH{constructor(){this.dbName=nf,this.version=x2,this.tableName=U2,this.dbOpen=!1}async open(){return new Promise((e,t)=>{const r=window.indexedDB.open(this.dbName,this.version);r.addEventListener("upgradeneeded",o=>{o.target.result.createObjectStore(this.tableName)}),r.addEventListener("success",o=>{const a=o;this.db=a.target.result,this.dbOpen=!0,e()}),r.addEventListener("error",()=>t(oe(gm)))})}closeConnection(){const e=this.db;e&&this.dbOpen&&(e.close(),this.dbOpen=!1)}async validateDbIsOpen(){if(!this.dbOpen)return this.open()}async getItem(e){return await this.validateDbIsOpen(),new Promise((t,r)=>{if(!this.db)return r(oe(oa));const c=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).get(e);c.addEventListener("success",d=>{const h=d;this.closeConnection(),t(h.target.result)}),c.addEventListener("error",d=>{this.closeConnection(),r(d)})})}async setItem(e,t){return await this.validateDbIsOpen(),new Promise((r,o)=>{if(!this.db)return o(oe(oa));const d=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).put(t,e);d.addEventListener("success",()=>{this.closeConnection(),r()}),d.addEventListener("error",h=>{this.closeConnection(),o(h)})})}async removeItem(e){return await this.validateDbIsOpen(),new Promise((t,r)=>{if(!this.db)return r(oe(oa));const c=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).delete(e);c.addEventListener("success",()=>{this.closeConnection(),t()}),c.addEventListener("error",d=>{this.closeConnection(),r(d)})})}async getKeys(){return await this.validateDbIsOpen(),new Promise((e,t)=>{if(!this.db)return t(oe(oa));const a=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).getAllKeys();a.addEventListener("success",c=>{const d=c;this.closeConnection(),e(d.target.result)}),a.addEventListener("error",c=>{this.closeConnection(),t(c)})})}async containsKey(e){return await this.validateDbIsOpen(),new Promise((t,r)=>{if(!this.db)return r(oe(oa));const c=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).count(e);c.addEventListener("success",d=>{const h=d;this.closeConnection(),t(h.target.result===1)}),c.addEventListener("error",d=>{this.closeConnection(),r(d)})})}async deleteDatabase(){return this.db&&this.dbOpen&&this.closeConnection(),new Promise((e,t)=>{const r=window.indexedDB.deleteDatabase(nf),o=setTimeout(()=>t(!1),200);r.addEventListener("success",()=>(clearTimeout(o),e(!0))),r.addEventListener("blocked",()=>(clearTimeout(o),e(!0))),r.addEventListener("error",()=>(clearTimeout(o),t(!1)))})}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class af{constructor(){this.cache=new Map}getItem(e){return this.cache.get(e)||null}setItem(e,t){this.cache.set(e,t)}removeItem(e){this.cache.delete(e)}getKeys(){const e=[];return this.cache.forEach((t,r)=>{e.push(r)}),e}containsKey(e){return this.cache.has(e)}clear(){this.cache.clear()}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class hH{constructor(e){this.inMemoryCache=new af,this.indexedDBCache=new dH,this.logger=e}handleDatabaseAccessError(e){if(e instanceof $s&&e.errorCode===gm)this.logger.error("Could not access persistent storage. This may be caused by browser privacy features which block persistent storage in third-party contexts.");else throw e}async getItem(e){const t=this.inMemoryCache.getItem(e);if(!t)try{return this.logger.verbose("Queried item not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.getItem(e)}catch(r){this.handleDatabaseAccessError(r)}return t}async setItem(e,t){this.inMemoryCache.setItem(e,t);try{await this.indexedDBCache.setItem(e,t)}catch(r){this.handleDatabaseAccessError(r)}}async removeItem(e){this.inMemoryCache.removeItem(e);try{await this.indexedDBCache.removeItem(e)}catch(t){this.handleDatabaseAccessError(t)}}async getKeys(){const e=this.inMemoryCache.getKeys();if(e.length===0)try{return this.logger.verbose("In-memory cache is empty, now querying persistent storage."),await this.indexedDBCache.getKeys()}catch(t){this.handleDatabaseAccessError(t)}return e}async containsKey(e){const t=this.inMemoryCache.containsKey(e);if(!t)try{return this.logger.verbose("Key not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.containsKey(e)}catch(r){this.handleDatabaseAccessError(r)}return t}clearInMemory(){this.logger.verbose("Deleting in-memory keystore"),this.inMemoryCache.clear(),this.logger.verbose("In-memory keystore deleted")}async clearPersistent(){try{this.logger.verbose("Deleting persistent keystore");const e=await this.indexedDBCache.deleteDatabase();return e&&this.logger.verbose("Persistent keystore deleted"),e}catch(e){return this.handleDatabaseAccessError(e),!1}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Ta{constructor(e,t,r){this.logger=e,z2(r??!1),this.cache=new hH(this.logger),this.performanceClient=t}createNewGuid(){return mo()}base64Encode(e){return pm(e)}base64Decode(e){return $r(e)}base64UrlEncode(e){return Gc(e)}encodeKid(e){return this.base64UrlEncode(JSON.stringify({kid:e}))}async getPublicKeyThumbprint(e){var g;const t=(g=this.performanceClient)==null?void 0:g.startMeasurement(x.CryptoOptsGetPublicKeyThumbprint,e.correlationId),r=await q2(Ta.EXTRACTABLE,Ta.POP_KEY_USAGES),o=await ah(r.publicKey),a={e:o.e,kty:o.kty,n:o.n},c=cy(a),d=await this.hashString(c),h=await ah(r.privateKey),f=await Y2(h,!1,["sign"]);return await this.cache.setItem(d,{privateKey:f,publicKey:r.publicKey,requestMethod:e.resourceRequestMethod,requestUri:e.resourceRequestUri}),t&&t.end({success:!0}),d}async removeTokenBindingKey(e){return await this.cache.removeItem(e),!await this.cache.containsKey(e)}async clearKeystore(){this.cache.clearInMemory();try{return await this.cache.clearPersistent(),!0}catch(e){return e instanceof Error?this.logger.error(`Clearing keystore failed with error: ${e.message}`):this.logger.error("Clearing keystore failed with unknown error"),!1}}async signJwt(e,t,r,o){var O;const a=(O=this.performanceClient)==null?void 0:O.startMeasurement(x.CryptoOptsSignJwt,o),c=await this.cache.getItem(t);if(!c)throw oe(mm);const d=await ah(c.publicKey),h=cy(d),f=Gc(JSON.stringify({kid:t})),g=um.getShrHeaderString({...r==null?void 0:r.header,alg:d.alg,kid:f}),v=Gc(g);e.cnf={jwk:JSON.parse(h)};const p=Gc(JSON.stringify(e)),w=`${v}.${p}`,T=new TextEncoder().encode(w),k=await j2(c.privateKey,T),I=fu(new Uint8Array(k)),N=`${w}.${I}`;return a&&a.end({success:!0}),N}async hashString(e){return pT(e)}}Ta.POP_KEY_USAGES=["sign","verify"];Ta.EXTRACTABLE=!0;function cy(n){return JSON.stringify(n,Object.keys(n).sort())}/*! @azure/msal-browser v3.28.1 2025-01-14 */class fH{constructor(){if(!window.localStorage)throw ym(Rs)}getItem(e){return window.localStorage.getItem(e)}setItem(e,t){window.localStorage.setItem(e,t)}removeItem(e){window.localStorage.removeItem(e)}getKeys(){return Object.keys(window.localStorage)}containsKey(e){return window.localStorage.hasOwnProperty(e)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class mH{constructor(){if(!window.sessionStorage)throw ym(Rs)}getItem(e){return window.sessionStorage.getItem(e)}setItem(e,t){window.sessionStorage.setItem(e,t)}removeItem(e){window.sessionStorage.removeItem(e)}getKeys(){return Object.keys(window.sessionStorage)}containsKey(e){return window.sessionStorage.hasOwnProperty(e)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function CT(n,e){if(!e)return null;try{return vr.parseRequestState(n,e).libraryState.meta}catch{throw Y(Ca)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const gH=24*60*60*1e3;class pH{getItem(e){const t=`${encodeURIComponent(e)}`,r=document.cookie.split(";");for(let o=0;o<r.length;o++){const a=r[o],[c,...d]=decodeURIComponent(a).trim().split("="),h=d.join("=");if(c===t)return h}return""}setItem(e,t,r,o=!0){let a=`${encodeURIComponent(e)}=${encodeURIComponent(t)};path=/;SameSite=Lax;`;if(r){const c=_H(r);a+=`expires=${c};`}o&&(a+="Secure;"),document.cookie=a}removeItem(e){this.setItem(e,"",-1)}getKeys(){const e=document.cookie.split(";"),t=[];return e.forEach(r=>{const o=decodeURIComponent(r).trim().split("=");t.push(o[0])}),t}containsKey(e){return this.getKeys().includes(e)}}function _H(n){const e=new Date;return new Date(e.getTime()+n*gH).toUTCString()}/*! @azure/msal-browser v3.28.1 2025-01-14 */class sf extends Ea{constructor(e,t,r,o,a,c){super(e,r,o,a),this.cacheConfig=t,this.logger=o,this.internalStorage=new af,this.browserStorage=this.setupBrowserStorage(this.cacheConfig.cacheLocation),this.temporaryCacheStorage=this.setupBrowserStorage(this.cacheConfig.temporaryCacheLocation),this.cookieStorage=new pH,t.cacheMigrationEnabled&&(this.migrateCacheEntries(),this.createKeyMaps()),this.performanceClient=c}setupBrowserStorage(e){try{switch(e){case _n.LocalStorage:return new fH;case _n.SessionStorage:return new mH;case _n.MemoryStorage:default:break}}catch(t){this.logger.error(t)}return this.cacheConfig.cacheLocation=_n.MemoryStorage,new af}migrateCacheEntries(){const e=`${B.CACHE_PREFIX}.${Dt.ID_TOKEN}`,t=`${B.CACHE_PREFIX}.${Dt.CLIENT_INFO}`,r=`${B.CACHE_PREFIX}.${Dt.ERROR}`,o=`${B.CACHE_PREFIX}.${Dt.ERROR_DESC}`,a=this.browserStorage.getItem(e),c=this.browserStorage.getItem(t),d=this.browserStorage.getItem(r),h=this.browserStorage.getItem(o),f=[a,c,d,h];[Dt.ID_TOKEN,Dt.CLIENT_INFO,Dt.ERROR,Dt.ERROR_DESC].forEach((v,p)=>{const w=f[p];w&&this.setTemporaryCache(v,w,!0)})}createKeyMaps(){this.logger.trace("BrowserCacheManager - createKeyMaps called.");const e=this.getItem(Oo.ACCOUNT_KEYS),t=this.getItem(`${Oo.TOKEN_KEYS}.${this.clientId}`);if(e&&t){this.logger.verbose("BrowserCacheManager:createKeyMaps - account and token key maps already exist, skipping migration.");return}this.browserStorage.getKeys().forEach(o=>{if(this.isCredentialKey(o)){const a=this.getItem(o);if(a){const c=this.validateAndParseJson(a);if(c&&c.hasOwnProperty("credentialType"))switch(c.credentialType){case me.ID_TOKEN:if(Bv(c)){this.logger.trace("BrowserCacheManager:createKeyMaps - idToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - idToken with key: ${o} found, saving key to token key map`);const d=c,h=this.updateCredentialCacheKey(o,d);this.addTokenKey(h,me.ID_TOKEN);return}else this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching idToken schema with value containing idToken credentialType field but value failed IdTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed idToken validation on key: ${o}`);break;case me.ACCESS_TOKEN:case me.ACCESS_TOKEN_WITH_AUTH_SCHEME:if(Fv(c)){this.logger.trace("BrowserCacheManager:createKeyMaps - accessToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - accessToken with key: ${o} found, saving key to token key map`);const d=c,h=this.updateCredentialCacheKey(o,d);this.addTokenKey(h,me.ACCESS_TOKEN);return}else this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching accessToken schema with value containing accessToken credentialType field but value failed AccessTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed accessToken validation on key: ${o}`);break;case me.REFRESH_TOKEN:if(Vv(c)){this.logger.trace("BrowserCacheManager:createKeyMaps - refreshToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - refreshToken with key: ${o} found, saving key to token key map`);const d=c,h=this.updateCredentialCacheKey(o,d);this.addTokenKey(h,me.REFRESH_TOKEN);return}else this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching refreshToken schema with value containing refreshToken credentialType field but value failed RefreshTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed refreshToken validation on key: ${o}`);break}}}if(this.isAccountKey(o)){const a=this.getItem(o);if(a){const c=this.validateAndParseJson(a);c&&Ot.isAccountEntity(c)&&(this.logger.trace("BrowserCacheManager:createKeyMaps - account found, saving key to account key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - account with key: ${o} found, saving key to account key map`),this.addAccountKeyToMap(o))}}})}validateAndParseJson(e){try{const t=JSON.parse(e);return t&&typeof t=="object"?t:null}catch{return null}}getItem(e){return this.browserStorage.getItem(e)}setItem(e,t){this.browserStorage.setItem(e,t)}getAccount(e,t){this.logger.trace("BrowserCacheManager.getAccount called");const r=this.getCachedAccountEntity(e);return this.updateOutdatedCachedAccount(e,r,t)}getCachedAccountEntity(e){const t=this.getItem(e);if(!t)return this.removeAccountKeyFromMap(e),null;const r=this.validateAndParseJson(t);return!r||!Ot.isAccountEntity(r)?(this.removeAccountKeyFromMap(e),null):Ea.toObject(new Ot,r)}setAccount(e){this.logger.trace("BrowserCacheManager.setAccount called");const t=e.generateAccountKey();this.setItem(t,JSON.stringify(e)),this.addAccountKeyToMap(t)}getAccountKeys(){this.logger.trace("BrowserCacheManager.getAccountKeys called");const e=this.getItem(Oo.ACCOUNT_KEYS);return e?JSON.parse(e):(this.logger.verbose("BrowserCacheManager.getAccountKeys - No account keys found"),[])}addAccountKeyToMap(e){this.logger.trace("BrowserCacheManager.addAccountKeyToMap called"),this.logger.tracePii(`BrowserCacheManager.addAccountKeyToMap called with key: ${e}`);const t=this.getAccountKeys();t.indexOf(e)===-1?(t.push(e),this.setItem(Oo.ACCOUNT_KEYS,JSON.stringify(t)),this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key added")):this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key already exists in map")}removeAccountKeyFromMap(e){this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap called"),this.logger.tracePii(`BrowserCacheManager.removeAccountKeyFromMap called with key: ${e}`);const t=this.getAccountKeys(),r=t.indexOf(e);r>-1?(t.splice(r,1),this.setItem(Oo.ACCOUNT_KEYS,JSON.stringify(t)),this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap account key removed")):this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap key not found in existing map")}async removeAccount(e){super.removeAccount(e),this.removeAccountKeyFromMap(e)}removeOutdatedAccount(e){this.removeItem(e),this.removeAccountKeyFromMap(e)}removeIdToken(e){super.removeIdToken(e),this.removeTokenKey(e,me.ID_TOKEN)}async removeAccessToken(e){super.removeAccessToken(e),this.removeTokenKey(e,me.ACCESS_TOKEN)}removeRefreshToken(e){super.removeRefreshToken(e),this.removeTokenKey(e,me.REFRESH_TOKEN)}getTokenKeys(){this.logger.trace("BrowserCacheManager.getTokenKeys called");const e=this.getItem(`${Oo.TOKEN_KEYS}.${this.clientId}`);if(e){const t=this.validateAndParseJson(e);if(t&&t.hasOwnProperty("idToken")&&t.hasOwnProperty("accessToken")&&t.hasOwnProperty("refreshToken"))return t;this.logger.error("BrowserCacheManager.getTokenKeys - Token keys found but in an unknown format. Returning empty key map.")}else this.logger.verbose("BrowserCacheManager.getTokenKeys - No token keys found");return{idToken:[],accessToken:[],refreshToken:[]}}addTokenKey(e,t){this.logger.trace("BrowserCacheManager addTokenKey called");const r=this.getTokenKeys();switch(t){case me.ID_TOKEN:r.idToken.indexOf(e)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - idToken added to map"),r.idToken.push(e));break;case me.ACCESS_TOKEN:r.accessToken.indexOf(e)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - accessToken added to map"),r.accessToken.push(e));break;case me.REFRESH_TOKEN:r.refreshToken.indexOf(e)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - refreshToken added to map"),r.refreshToken.push(e));break;default:throw this.logger.error(`BrowserCacheManager:addTokenKey - CredentialType provided invalid. CredentialType: ${t}`),Y(Yh)}this.setItem(`${Oo.TOKEN_KEYS}.${this.clientId}`,JSON.stringify(r))}removeTokenKey(e,t){this.logger.trace("BrowserCacheManager removeTokenKey called");const r=this.getTokenKeys();switch(t){case me.ID_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove idToken with key: ${e} from map`);const o=r.idToken.indexOf(e);o>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - idToken removed from map"),r.idToken.splice(o,1)):this.logger.info("BrowserCacheManager: removeTokenKey - idToken does not exist in map. Either it was previously removed or it was never added.");break;case me.ACCESS_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove accessToken with key: ${e} from map`);const a=r.accessToken.indexOf(e);a>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - accessToken removed from map"),r.accessToken.splice(a,1)):this.logger.info("BrowserCacheManager: removeTokenKey - accessToken does not exist in map. Either it was previously removed or it was never added.");break;case me.REFRESH_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove refreshToken with key: ${e} from map`);const c=r.refreshToken.indexOf(e);c>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken removed from map"),r.refreshToken.splice(c,1)):this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken does not exist in map. Either it was previously removed or it was never added.");break;default:throw this.logger.error(`BrowserCacheManager:removeTokenKey - CredentialType provided invalid. CredentialType: ${t}`),Y(Yh)}this.setItem(`${Oo.TOKEN_KEYS}.${this.clientId}`,JSON.stringify(r))}getIdTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeTokenKey(e,me.ID_TOKEN),null;const r=this.validateAndParseJson(t);return!r||!Bv(r)?(this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeTokenKey(e,me.ID_TOKEN),null):(this.logger.trace("BrowserCacheManager.getIdTokenCredential: cache hit"),r)}setIdTokenCredential(e){this.logger.trace("BrowserCacheManager.setIdTokenCredential called");const t=ua(e);this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,me.ID_TOKEN)}getAccessTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeTokenKey(e,me.ACCESS_TOKEN),null;const r=this.validateAndParseJson(t);return!r||!Fv(r)?(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeTokenKey(e,me.ACCESS_TOKEN),null):(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: cache hit"),r)}setAccessTokenCredential(e){this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");const t=ua(e);this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,me.ACCESS_TOKEN)}getRefreshTokenCredential(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeTokenKey(e,me.REFRESH_TOKEN),null;const r=this.validateAndParseJson(t);return!r||!Vv(r)?(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeTokenKey(e,me.REFRESH_TOKEN),null):(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: cache hit"),r)}setRefreshTokenCredential(e){this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");const t=ua(e);this.setItem(t,JSON.stringify(e)),this.addTokenKey(t,me.REFRESH_TOKEN)}getAppMetadata(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(t);return!r||!cV(e,r)?(this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAppMetadata: cache hit"),r)}setAppMetadata(e){this.logger.trace("BrowserCacheManager.setAppMetadata called");const t=sV(e);this.setItem(t,JSON.stringify(e))}getServerTelemetry(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null;const r=this.validateAndParseJson(t);return!r||!iV(e,r)?(this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit"),r)}setServerTelemetry(e,t){this.logger.trace("BrowserCacheManager.setServerTelemetry called"),this.setItem(e,JSON.stringify(t))}getAuthorityMetadata(e){const t=this.internalStorage.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAuthorityMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(t);return r&&lV(e,r)?(this.logger.trace("BrowserCacheManager.getAuthorityMetadata: cache hit"),r):null}getAuthorityMetadataKeys(){return this.internalStorage.getKeys().filter(t=>this.isAuthorityMetadata(t))}setWrapperMetadata(e,t){this.internalStorage.setItem(zc.WRAPPER_SKU,e),this.internalStorage.setItem(zc.WRAPPER_VER,t)}getWrapperMetadata(){const e=this.internalStorage.getItem(zc.WRAPPER_SKU)||B.EMPTY_STRING,t=this.internalStorage.getItem(zc.WRAPPER_VER)||B.EMPTY_STRING;return[e,t]}setAuthorityMetadata(e,t){this.logger.trace("BrowserCacheManager.setAuthorityMetadata called"),this.internalStorage.setItem(e,JSON.stringify(t))}getActiveAccount(){const e=this.generateCacheKey(Dt.ACTIVE_ACCOUNT_FILTERS),t=this.getItem(e);if(!t){this.logger.trace("BrowserCacheManager.getActiveAccount: No active account filters cache schema found, looking for legacy schema");const o=this.generateCacheKey(Dt.ACTIVE_ACCOUNT),a=this.getItem(o);if(!a)return this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null;const c=this.getAccountInfoFilteredBy({localAccountId:a});return c?(this.logger.trace("BrowserCacheManager.getActiveAccount: Legacy active account cache schema found"),this.logger.trace("BrowserCacheManager.getActiveAccount: Adding active account filters cache schema"),this.setActiveAccount(c),c):null}const r=this.validateAndParseJson(t);return r?(this.logger.trace("BrowserCacheManager.getActiveAccount: Active account filters schema found"),this.getAccountInfoFilteredBy({homeAccountId:r.homeAccountId,localAccountId:r.localAccountId,tenantId:r.tenantId})):(this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null)}setActiveAccount(e){const t=this.generateCacheKey(Dt.ACTIVE_ACCOUNT_FILTERS),r=this.generateCacheKey(Dt.ACTIVE_ACCOUNT);if(e){this.logger.verbose("setActiveAccount: Active account set");const o={homeAccountId:e.homeAccountId,localAccountId:e.localAccountId,tenantId:e.tenantId};this.browserStorage.setItem(t,JSON.stringify(o)),this.browserStorage.setItem(r,e.localAccountId)}else this.logger.verbose("setActiveAccount: No account passed, active account not set"),this.browserStorage.removeItem(t),this.browserStorage.removeItem(r)}getThrottlingCache(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null;const r=this.validateAndParseJson(t);return!r||!aV(e,r)?(this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getThrottlingCache: cache hit"),r)}setThrottlingCache(e,t){this.logger.trace("BrowserCacheManager.setThrottlingCache called"),this.setItem(e,JSON.stringify(t))}getTemporaryCache(e,t){const r=t?this.generateCacheKey(e):e;if(this.cacheConfig.storeAuthStateInCookie){const a=this.cookieStorage.getItem(r);if(a)return this.logger.trace("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies"),a}const o=this.temporaryCacheStorage.getItem(r);if(!o){if(this.cacheConfig.cacheLocation===_n.LocalStorage){const a=this.browserStorage.getItem(r);if(a)return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage"),a}return this.logger.trace("BrowserCacheManager.getTemporaryCache: No cache item found in local storage"),null}return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item returned"),o}setTemporaryCache(e,t,r){const o=r?this.generateCacheKey(e):e;this.temporaryCacheStorage.setItem(o,t),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie"),this.cookieStorage.setItem(o,t,void 0,this.cacheConfig.secureCookies))}removeItem(e){this.browserStorage.removeItem(e)}removeTemporaryItem(e){this.temporaryCacheStorage.removeItem(e),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie"),this.cookieStorage.removeItem(e))}getKeys(){return this.browserStorage.getKeys()}async clear(){await this.removeAllAccounts(),this.removeAppMetadata(),this.temporaryCacheStorage.getKeys().forEach(e=>{(e.indexOf(B.CACHE_PREFIX)!==-1||e.indexOf(this.clientId)!==-1)&&this.removeTemporaryItem(e)}),this.browserStorage.getKeys().forEach(e=>{(e.indexOf(B.CACHE_PREFIX)!==-1||e.indexOf(this.clientId)!==-1)&&this.browserStorage.removeItem(e)}),this.internalStorage.clear()}async clearTokensAndKeysWithClaims(e,t){e.addQueueMeasurement(x.ClearTokensAndKeysWithClaims,t);const r=this.getTokenKeys(),o=[];r.accessToken.forEach(a=>{const c=this.getAccessTokenCredential(a);c!=null&&c.requestedClaimsHash&&a.includes(c.requestedClaimsHash.toLowerCase())&&o.push(this.removeAccessToken(a))}),await Promise.all(o),o.length>0&&this.logger.warning(`${o.length} access tokens with claims in the cache keys have been removed from the cache.`)}generateCacheKey(e){return this.validateAndParseJson(e)?JSON.stringify(e):_r.startsWith(e,B.CACHE_PREFIX)||_r.startsWith(e,Dt.ADAL_ID_TOKEN)?e:`${B.CACHE_PREFIX}.${this.clientId}.${e}`}generateAuthorityKey(e){const{libraryState:{id:t}}=vr.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${$e.AUTHORITY}.${t}`)}generateNonceKey(e){const{libraryState:{id:t}}=vr.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${$e.NONCE_IDTOKEN}.${t}`)}generateStateKey(e){const{libraryState:{id:t}}=vr.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${$e.REQUEST_STATE}.${t}`)}getCachedAuthority(e){const t=this.generateStateKey(e),r=this.getTemporaryCache(t);if(!r)return null;const o=this.generateAuthorityKey(r);return this.getTemporaryCache(o)}updateCacheEntries(e,t,r,o,a){this.logger.trace("BrowserCacheManager.updateCacheEntries called");const c=this.generateStateKey(e);this.setTemporaryCache(c,e,!1);const d=this.generateNonceKey(e);this.setTemporaryCache(d,t,!1);const h=this.generateAuthorityKey(e);if(this.setTemporaryCache(h,r,!1),a){const f={credential:a.homeAccountId,type:Un.HOME_ACCOUNT_ID};this.setTemporaryCache($e.CCS_CREDENTIAL,JSON.stringify(f),!0)}else if(o){const f={credential:o,type:Un.UPN};this.setTemporaryCache($e.CCS_CREDENTIAL,JSON.stringify(f),!0)}}resetRequestCache(e){this.logger.trace("BrowserCacheManager.resetRequestCache called"),e&&(this.temporaryCacheStorage.getKeys().forEach(t=>{t.indexOf(e)!==-1&&this.removeTemporaryItem(t)}),this.removeTemporaryItem(this.generateStateKey(e)),this.removeTemporaryItem(this.generateNonceKey(e)),this.removeTemporaryItem(this.generateAuthorityKey(e))),this.removeTemporaryItem(this.generateCacheKey($e.REQUEST_PARAMS)),this.removeTemporaryItem(this.generateCacheKey($e.ORIGIN_URI)),this.removeTemporaryItem(this.generateCacheKey($e.URL_HASH)),this.removeTemporaryItem(this.generateCacheKey($e.CORRELATION_ID)),this.removeTemporaryItem(this.generateCacheKey($e.CCS_CREDENTIAL)),this.removeTemporaryItem(this.generateCacheKey($e.NATIVE_REQUEST)),this.setInteractionInProgress(!1)}cleanRequestByState(e){if(this.logger.trace("BrowserCacheManager.cleanRequestByState called"),e){const t=this.generateStateKey(e),r=this.temporaryCacheStorage.getItem(t);this.logger.infoPii(`BrowserCacheManager.cleanRequestByState: Removing temporary cache items for state: ${r}`),this.resetRequestCache(r||B.EMPTY_STRING)}}cleanRequestByInteractionType(e){this.logger.trace("BrowserCacheManager.cleanRequestByInteractionType called"),this.temporaryCacheStorage.getKeys().forEach(t=>{if(t.indexOf($e.REQUEST_STATE)===-1)return;const r=this.temporaryCacheStorage.getItem(t);if(!r)return;const o=CT(this.cryptoImpl,r);o&&o.interactionType===e&&(this.logger.infoPii(`BrowserCacheManager.cleanRequestByInteractionType: Removing temporary cache items for state: ${r}`),this.resetRequestCache(r))}),this.setInteractionInProgress(!1)}cacheCodeRequest(e){this.logger.trace("BrowserCacheManager.cacheCodeRequest called");const t=pm(JSON.stringify(e));this.setTemporaryCache($e.REQUEST_PARAMS,t,!0)}getCachedRequest(e){this.logger.trace("BrowserCacheManager.getCachedRequest called");const t=this.getTemporaryCache($e.REQUEST_PARAMS,!0);if(!t)throw oe(jw);let r;try{r=JSON.parse($r(t))}catch(o){throw this.logger.errorPii(`Attempted to parse: ${t}`),this.logger.error(`Parsing cached token request threw with error: ${o}`),oe(Jw)}if(this.removeTemporaryItem(this.generateCacheKey($e.REQUEST_PARAMS)),!r.authority){const o=this.generateAuthorityKey(e),a=this.getTemporaryCache(o);if(!a)throw oe(fm);r.authority=a}return r}getCachedNativeRequest(){this.logger.trace("BrowserCacheManager.getCachedNativeRequest called");const e=this.getTemporaryCache($e.NATIVE_REQUEST,!0);if(!e)return this.logger.trace("BrowserCacheManager.getCachedNativeRequest: No cached native request found"),null;const t=this.validateAndParseJson(e);return t||(this.logger.error("BrowserCacheManager.getCachedNativeRequest: Unable to parse native request"),null)}isInteractionInProgress(e){const t=this.getInteractionInProgress();return e?t===this.clientId:!!t}getInteractionInProgress(){const e=`${B.CACHE_PREFIX}.${$e.INTERACTION_STATUS_KEY}`;return this.getTemporaryCache(e,!1)}setInteractionInProgress(e){const t=`${B.CACHE_PREFIX}.${$e.INTERACTION_STATUS_KEY}`;if(e){if(this.getInteractionInProgress())throw oe(Hw);this.setTemporaryCache(t,this.clientId,!1)}else!e&&this.getInteractionInProgress()===this.clientId&&this.removeTemporaryItem(t)}getLegacyLoginHint(){const e=this.getTemporaryCache(Dt.ADAL_ID_TOKEN);e&&(this.browserStorage.removeItem(Dt.ADAL_ID_TOKEN),this.logger.verbose("Cached ADAL id token retrieved."));const t=this.getTemporaryCache(Dt.ID_TOKEN,!0);t&&(this.browserStorage.removeItem(this.generateCacheKey(Dt.ID_TOKEN)),this.logger.verbose("Cached MSAL.js v1 id token retrieved"));const r=t||e;if(r){const o=Ii(r,$r);if(o.preferred_username)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 preferred_username as loginHint"),o.preferred_username;if(o.upn)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 upn as loginHint"),o.upn;this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, however, no account hint claim found. Enable preferred_username or upn id token claim to get SSO.")}return null}updateCredentialCacheKey(e,t){const r=ua(t);if(e!==r){const o=this.getItem(e);if(o)return this.browserStorage.removeItem(e),this.setItem(r,o),this.logger.verbose(`Updated an outdated ${t.credentialType} cache key`),r;this.logger.error(`Attempted to update an outdated ${t.credentialType} cache key but no item matching the outdated key was found in storage`)}return e}async hydrateCache(e,t){var d,h,f;const r=ou((d=e.account)==null?void 0:d.homeAccountId,(h=e.account)==null?void 0:h.environment,e.idToken,this.clientId,e.tenantId);let o;t.claims&&(o=await this.cryptoImpl.hashString(t.claims));const a=iu((f=e.account)==null?void 0:f.homeAccountId,e.account.environment,e.accessToken,this.clientId,e.tenantId,e.scopes.join(" "),e.expiresOn?e.expiresOn.getTime()/1e3:0,e.extExpiresOn?e.extExpiresOn.getTime()/1e3:0,$r,void 0,e.tokenType,void 0,t.sshKid,t.claims,o),c={idToken:r,accessToken:a};return this.saveCacheRecord(c)}async saveCacheRecord(e,t,r){try{await super.saveCacheRecord(e,t,r)}catch(o){if(o instanceof ma&&this.performanceClient&&r)try{const a=this.getTokenKeys();this.performanceClient.addFields({cacheRtCount:a.refreshToken.length,cacheIdCount:a.idToken.length,cacheAtCount:a.accessToken.length},r)}catch{}throw o}}}const vH=(n,e)=>{const t={cacheLocation:_n.MemoryStorage,temporaryCacheLocation:_n.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};return new sf(n,t,Al,e)};/*! @azure/msal-browser v3.28.1 2025-01-14 */function yH(n,e,t,r){return n.verbose("getAllAccounts called"),t?e.getAllAccounts(r):[]}function CH(n,e,t){if(e.trace("getAccount called"),Object.keys(n).length===0)return e.warning("getAccount: No accountFilter provided"),null;const r=t.getAccountInfoFilteredBy(n);return r?(e.verbose("getAccount: Account matching provided filter found, returning"),r):(e.verbose("getAccount: No matching account found, returning null"),null)}function EH(n,e,t){if(e.trace("getAccountByUsername called"),!n)return e.warning("getAccountByUsername: No username provided"),null;const r=t.getAccountInfoFilteredBy({username:n});return r?(e.verbose("getAccountByUsername: Account matching username found, returning"),e.verbosePii(`getAccountByUsername: Returning signed-in accounts matching username: ${n}`),r):(e.verbose("getAccountByUsername: No matching account found, returning null"),null)}function wH(n,e,t){if(e.trace("getAccountByHomeId called"),!n)return e.warning("getAccountByHomeId: No homeAccountId provided"),null;const r=t.getAccountInfoFilteredBy({homeAccountId:n});return r?(e.verbose("getAccountByHomeId: Account matching homeAccountId found, returning"),e.verbosePii(`getAccountByHomeId: Returning signed-in accounts matching homeAccountId: ${n}`),r):(e.verbose("getAccountByHomeId: No matching account found, returning null"),null)}function TH(n,e,t){if(e.trace("getAccountByLocalId called"),!n)return e.warning("getAccountByLocalId: No localAccountId provided"),null;const r=t.getAccountInfoFilteredBy({localAccountId:n});return r?(e.verbose("getAccountByLocalId: Account matching localAccountId found, returning"),e.verbosePii(`getAccountByLocalId: Returning signed-in accounts matching localAccountId: ${n}`),r):(e.verbose("getAccountByLocalId: No matching account found, returning null"),null)}function bH(n,e){e.setActiveAccount(n)}function IH(n){return n.getActiveAccount()}/*! @azure/msal-browser v3.28.1 2025-01-14 */const fe={INITIALIZE_START:"msal:initializeStart",INITIALIZE_END:"msal:initializeEnd",ACCOUNT_ADDED:"msal:accountAdded",ACCOUNT_REMOVED:"msal:accountRemoved",ACTIVE_ACCOUNT_CHANGED:"msal:activeAccountChanged",LOGIN_START:"msal:loginStart",LOGIN_SUCCESS:"msal:loginSuccess",LOGIN_FAILURE:"msal:loginFailure",ACQUIRE_TOKEN_START:"msal:acquireTokenStart",ACQUIRE_TOKEN_SUCCESS:"msal:acquireTokenSuccess",ACQUIRE_TOKEN_FAILURE:"msal:acquireTokenFailure",ACQUIRE_TOKEN_NETWORK_START:"msal:acquireTokenFromNetworkStart",SSO_SILENT_START:"msal:ssoSilentStart",SSO_SILENT_SUCCESS:"msal:ssoSilentSuccess",SSO_SILENT_FAILURE:"msal:ssoSilentFailure",ACQUIRE_TOKEN_BY_CODE_START:"msal:acquireTokenByCodeStart",ACQUIRE_TOKEN_BY_CODE_SUCCESS:"msal:acquireTokenByCodeSuccess",ACQUIRE_TOKEN_BY_CODE_FAILURE:"msal:acquireTokenByCodeFailure",HANDLE_REDIRECT_START:"msal:handleRedirectStart",HANDLE_REDIRECT_END:"msal:handleRedirectEnd",POPUP_OPENED:"msal:popupOpened",LOGOUT_START:"msal:logoutStart",LOGOUT_SUCCESS:"msal:logoutSuccess",LOGOUT_FAILURE:"msal:logoutFailure",LOGOUT_END:"msal:logoutEnd",RESTORE_FROM_BFCACHE:"msal:restoreFromBFCache"};/*! @azure/msal-browser v3.28.1 2025-01-14 */class SH{constructor(e){this.eventCallbacks=new Map,this.logger=e||new $o({})}addEventCallback(e,t,r){if(typeof window<"u"){const o=r||rH();return this.eventCallbacks.has(o)?(this.logger.error(`Event callback with id: ${o} is already registered. Please provide a unique id or remove the existing callback and try again.`),null):(this.eventCallbacks.set(o,[e,t||[]]),this.logger.verbose(`Event callback registered with id: ${o}`),o)}return null}removeEventCallback(e){this.eventCallbacks.delete(e),this.logger.verbose(`Event callback ${e} removed.`)}emitEvent(e,t,r,o){if(typeof window<"u"){const a={eventType:e,interactionType:t||null,payload:r||null,error:o||null,timestamp:Date.now()};this.eventCallbacks.forEach(([c,d],h)=>{(d.length===0||d.includes(e))&&(this.logger.verbose(`Emitting event to callback ${h}: ${e}`),c.apply(null,[a]))})}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class ET{constructor(e,t,r,o,a,c,d,h,f){this.config=e,this.browserStorage=t,this.browserCrypto=r,this.networkClient=this.config.system.networkClient,this.eventHandler=a,this.navigationClient=c,this.nativeMessageHandler=h,this.correlationId=f||mo(),this.logger=o.clone(Mn.MSAL_SKU,mu,this.correlationId),this.performanceClient=d}async clearCacheOnLogout(e){if(e){Ot.accountInfoIsEqual(e,this.browserStorage.getActiveAccount(),!1)&&(this.logger.verbose("Setting active account to null"),this.browserStorage.setActiveAccount(null));try{await this.browserStorage.removeAccount(Ot.generateAccountCacheKey(e)),this.logger.verbose("Cleared cache items belonging to the account provided in the logout request.")}catch{this.logger.error("Account provided in logout request was not found. Local cache unchanged.")}}else try{this.logger.verbose("No account provided in logout request, clearing all cache items.",this.correlationId),await this.browserStorage.clear(),await this.browserCrypto.clearKeystore()}catch{this.logger.error("Attempted to clear all MSAL cache items and failed. Local cache unchanged.")}}getRedirectUri(e){this.logger.verbose("getRedirectUri called");const t=e||this.config.auth.redirectUri;return Me.getAbsoluteUrl(t,co())}initializeServerTelemetryManager(e,t){this.logger.verbose("initializeServerTelemetryManager called");const r={clientId:this.config.auth.clientId,correlationId:this.correlationId,apiId:e,forceRefresh:t||!1,wrapperSKU:this.browserStorage.getWrapperMetadata()[0],wrapperVer:this.browserStorage.getWrapperMetadata()[1]};return new Ns(r,this.browserStorage)}async getDiscoveredAuthority(e){const{account:t}=e,r=e.requestExtraQueryParameters&&e.requestExtraQueryParameters.hasOwnProperty("instance_aware")?e.requestExtraQueryParameters.instance_aware:void 0;this.performanceClient.addQueueMeasurement(x.StandardInteractionClientGetDiscoveredAuthority,this.correlationId);const o={protocolMode:this.config.auth.protocolMode,OIDCOptions:this.config.auth.OIDCOptions,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},a=e.requestAuthority||this.config.auth.authority,c=r!=null&&r.length?r==="true":this.config.auth.instanceAware,d=t&&c?this.config.auth.authority.replace(Me.getDomainFromUrl(a),t.environment):a,h=Qt.generateAuthority(d,e.requestAzureCloudOptions||this.config.auth.azureCloudOptions),f=await J(Rw,x.AuthorityFactoryCreateDiscoveredInstance,this.logger,this.performanceClient,this.correlationId)(h,this.config.system.networkClient,this.browserStorage,o,this.logger,this.correlationId,this.performanceClient);if(t&&!f.isAlias(t.environment))throw Qe(Ew);return f}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const AH=32;async function kH(n,e,t){n.addQueueMeasurement(x.GeneratePkceCodes,t);const r=Si(NH,x.GenerateCodeVerifier,e,n,t)(n,e,t),o=await J(RH,x.GenerateCodeChallengeFromVerifier,e,n,t)(r,n,e,t);return{verifier:r,challenge:o}}function NH(n,e,t){try{const r=new Uint8Array(AH);return Si(G2,x.GetRandomValues,e,n,t)(r),fu(r)}catch{throw oe(dm)}}async function RH(n,e,t,r){e.addQueueMeasurement(x.GenerateCodeChallengeFromVerifier,r);try{const o=await J(gT,x.Sha256Digest,t,e,r)(n,e,r);return fu(new Uint8Array(o))}catch{throw oe(dm)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */async function Tm(n,e,t,r){t.addQueueMeasurement(x.InitializeBaseRequest,n.correlationId);const o=n.authority||e.auth.authority,a=[...n&&n.scopes||[]],c={...n,correlationId:n.correlationId,authority:o,scopes:a};if(!c.authenticationScheme)c.authenticationScheme=ze.BEARER,r.verbose(`Authentication Scheme wasn't explicitly set in request, defaulting to "Bearer" request`);else{if(c.authenticationScheme===ze.SSH){if(!n.sshJwk)throw Qe(au);if(!n.sshKid)throw Qe(vw)}r.verbose(`Authentication Scheme set to "${c.authenticationScheme}" as configured in Auth request`)}return e.cache.claimsBasedCachingEnabled&&n.claims&&!_r.isEmptyObj(n.claims)&&(c.requestedClaimsHash=await pT(n.claims)),c}async function OH(n,e,t,r,o){r.addQueueMeasurement(x.InitializeSilentRequest,n.correlationId);const a=await J(Tm,x.InitializeBaseRequest,o,r,n.correlationId)(n,t,r,o);return{...n,...a,account:e,forceRefresh:n.forceRefresh||!1}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Oa extends ET{async initializeAuthorizationCodeRequest(e){this.performanceClient.addQueueMeasurement(x.StandardInteractionClientInitializeAuthorizationCodeRequest,this.correlationId);const t=await J(kH,x.GeneratePkceCodes,this.logger,this.performanceClient,this.correlationId)(this.performanceClient,this.logger,this.correlationId),r={...e,redirectUri:e.redirectUri,code:B.EMPTY_STRING,codeVerifier:t.verifier};return e.codeChallenge=t.challenge,e.codeChallengeMethod=B.S256_CODE_CHALLENGE_METHOD,r}initializeLogoutRequest(e){this.logger.verbose("initializeLogoutRequest called",e==null?void 0:e.correlationId);const t={correlationId:this.correlationId||mo(),...e};if(e)if(e.logoutHint)this.logger.verbose("logoutHint has already been set in logoutRequest");else if(e.account){const r=this.getLogoutHintFromIdTokenClaims(e.account);r&&(this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided"),t.logoutHint=r)}else this.logger.verbose("logoutHint was not set and account was not passed into logout request, logoutHint will not be set");else this.logger.verbose("logoutHint will not be set since no logout request was configured");return!e||e.postLogoutRedirectUri!==null?e&&e.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to uri set on logout request",t.correlationId),t.postLogoutRedirectUri=Me.getAbsoluteUrl(e.postLogoutRedirectUri,co())):this.config.auth.postLogoutRedirectUri===null?this.logger.verbose("postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect",t.correlationId):this.config.auth.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to configured uri",t.correlationId),t.postLogoutRedirectUri=Me.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri,co())):(this.logger.verbose("Setting postLogoutRedirectUri to current page",t.correlationId),t.postLogoutRedirectUri=Me.getAbsoluteUrl(co(),co())):this.logger.verbose("postLogoutRedirectUri passed as null, not setting post logout redirect uri",t.correlationId),t}getLogoutHintFromIdTokenClaims(e){const t=e.idTokenClaims;if(t){if(t.login_hint)return t.login_hint;this.logger.verbose("The ID Token Claims tied to the provided account do not contain a login_hint claim, logoutHint will not be added to logout request")}else this.logger.verbose("The provided account does not contain ID Token Claims, logoutHint will not be added to logout request");return null}async createAuthCodeClient(e){this.performanceClient.addQueueMeasurement(x.StandardInteractionClientCreateAuthCodeClient,this.correlationId);const t=await J(this.getClientConfiguration.bind(this),x.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)(e);return new Mw(t,this.performanceClient)}async getClientConfiguration(e){const{serverTelemetryManager:t,requestAuthority:r,requestAzureCloudOptions:o,requestExtraQueryParameters:a,account:c}=e;this.performanceClient.addQueueMeasurement(x.StandardInteractionClientGetClientConfiguration,this.correlationId);const d=await J(this.getDiscoveredAuthority.bind(this),x.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,this.correlationId)({requestAuthority:r,requestAzureCloudOptions:o,requestExtraQueryParameters:a,account:c}),h=this.config.system.loggerOptions;return{authOptions:{clientId:this.config.auth.clientId,authority:d,clientCapabilities:this.config.auth.clientCapabilities,redirectUri:this.config.auth.redirectUri},systemOptions:{tokenRenewalOffsetSeconds:this.config.system.tokenRenewalOffsetSeconds,preventCorsPreflight:!0},loggerOptions:{loggerCallback:h.loggerCallback,piiLoggingEnabled:h.piiLoggingEnabled,logLevel:h.logLevel,correlationId:this.correlationId},cacheOptions:{claimsBasedCachingEnabled:this.config.cache.claimsBasedCachingEnabled},cryptoInterface:this.browserCrypto,networkInterface:this.networkClient,storageInterface:this.browserStorage,serverTelemetryManager:t,libraryInfo:{sku:Mn.MSAL_SKU,version:mu,cpu:B.EMPTY_STRING,os:B.EMPTY_STRING},telemetry:this.config.telemetry}}async initializeAuthorizationRequest(e,t){this.performanceClient.addQueueMeasurement(x.StandardInteractionClientInitializeAuthorizationRequest,this.correlationId);const r=this.getRedirectUri(e.redirectUri),o={interactionType:t},a=vr.setRequestState(this.browserCrypto,e&&e.state||B.EMPTY_STRING,o),d={...await J(Tm,x.InitializeBaseRequest,this.logger,this.performanceClient,this.correlationId)({...e,correlationId:this.correlationId},this.config,this.performanceClient,this.logger),redirectUri:r,state:a,nonce:e.nonce||mo(),responseMode:this.config.auth.OIDCOptions.serverResponseType};if(e.loginHint||e.sid)return d;const h=e.account||this.browserStorage.getActiveAccount();if(h&&(this.logger.verbose("Setting validated request account",this.correlationId),this.logger.verbosePii(`Setting validated request account: ${h.homeAccountId}`,this.correlationId),d.account=h),!d.loginHint&&!h){const f=this.browserStorage.getLegacyLoginHint();f&&(d.loginHint=f)}return d}}/*! @azure/msal-browser v3.28.1 2025-01-14 */const PH="ContentError",wT="user_switch";/*! @azure/msal-browser v3.28.1 2025-01-14 */const MH="USER_INTERACTION_REQUIRED",DH="USER_CANCEL",LH="NO_NETWORK",xH="PERSISTENT_ERROR",UH="DISABLED",FH="ACCOUNT_UNAVAILABLE";/*! @azure/msal-browser v3.28.1 2025-01-14 */const BH=-2147186943,VH={[wT]:"User attempted to switch accounts in the native broker, which is not allowed. All new accounts must sign-in through the standard web flow first, please try again."};class Ur extends ct{constructor(e,t,r){super(e,t),Object.setPrototypeOf(this,Ur.prototype),this.name="NativeAuthError",this.ext=r}}function ia(n){if(n.ext&&n.ext.status&&(n.ext.status===xH||n.ext.status===UH)||n.ext&&n.ext.error&&n.ext.error===BH)return!0;switch(n.errorCode){case PH:return!0;default:return!1}}function cf(n,e,t){if(t&&t.status)switch(t.status){case FH:return Xh(Ow);case MH:return new Cr(n,e);case DH:return oe(Ti);case LH:return oe(Ml)}return new Ur(n,VH[n]||e,t)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class TT extends Oa{async acquireToken(e){this.performanceClient.addQueueMeasurement(x.SilentCacheClientAcquireToken,e.correlationId);const t=this.initializeServerTelemetryManager(rt.acquireTokenSilent_silentFlow),r=await J(this.getClientConfiguration.bind(this),x.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:t,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,account:e.account}),o=new b2(r,this.performanceClient);this.logger.verbose("Silent auth client created");try{const c=(await J(o.acquireCachedToken.bind(o),x.SilentFlowClientAcquireCachedToken,this.logger,this.performanceClient,e.correlationId)(e))[0];return this.performanceClient.addFields({fromCache:!0},e.correlationId),c}catch(a){throw a instanceof $s&&a.errorCode===mm&&this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair."),a}}logout(e){this.logger.verbose("logoutRedirect called");const t=this.initializeLogoutRequest(e);return this.clearCacheOnLogout(t==null?void 0:t.account)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class ga extends ET{constructor(e,t,r,o,a,c,d,h,f,g,v,p){var C;super(e,t,r,o,a,c,h,f,p),this.apiId=d,this.accountId=g,this.nativeMessageHandler=f,this.nativeStorageManager=v,this.silentCacheClient=new TT(e,this.nativeStorageManager,r,o,a,c,h,f,p),this.serverTelemetryManager=this.initializeServerTelemetryManager(this.apiId);const w=this.nativeMessageHandler.getExtensionId()===ha.PREFERRED_EXTENSION_ID?"chrome":(C=this.nativeMessageHandler.getExtensionId())!=null&&C.length?"unknown":void 0;this.skus=Ns.makeExtraSkuString({libraryName:Mn.MSAL_SKU,libraryVersion:mu,extensionName:w,extensionVersion:this.nativeMessageHandler.getExtensionVersion()})}addRequestSKUs(e){e.extraParameters={...e.extraParameters,[s2]:this.skus}}async acquireToken(e){this.performanceClient.addQueueMeasurement(x.NativeInteractionClientAcquireToken,e.correlationId),this.logger.trace("NativeInteractionClient - acquireToken called.");const t=this.performanceClient.startMeasurement(x.NativeInteractionClientAcquireToken,e.correlationId),r=Wr();try{const o=await this.initializeNativeRequest(e);try{const f=await this.acquireTokensFromCache(this.accountId,o);return t.end({success:!0,isNativeBroker:!1,fromCache:!0}),f}catch{this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call")}const{...a}=o,c={method:mi.GetToken,request:a},d=await this.nativeMessageHandler.sendMessage(c),h=this.validateNativeResponse(d);return await this.handleNativeResponse(h,o,r).then(f=>(t.end({success:!0,isNativeBroker:!0,requestId:f.requestId}),this.serverTelemetryManager.clearNativeBrokerErrorCode(),f)).catch(f=>{throw t.end({success:!1,errorCode:f.errorCode,subErrorCode:f.subError,isNativeBroker:!0}),f})}catch(o){throw o instanceof Ur&&this.serverTelemetryManager.setNativeBrokerErrorCode(o.errorCode),o}}createSilentCacheRequest(e,t){return{authority:e.authority,correlationId:this.correlationId,scopes:_t.fromString(e.scope).asArray(),account:t,forceRefresh:!1}}async acquireTokensFromCache(e,t){if(!e)throw this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided"),Y(Gh);const r=this.browserStorage.getBaseAccountInfo({nativeAccountId:e});if(!r)throw Y(Gh);try{const o=this.createSilentCacheRequest(t,r),a=await this.silentCacheClient.acquireToken(o),c={...r,idTokenClaims:a==null?void 0:a.idTokenClaims,idToken:a==null?void 0:a.idToken};return{...a,account:c}}catch(o){throw o}}async acquireTokenRedirect(e,t){this.logger.trace("NativeInteractionClient - acquireTokenRedirect called.");const{...r}=e;delete r.onRedirectNavigate;const o=await this.initializeNativeRequest(r),a={method:mi.GetToken,request:o};try{const h=await this.nativeMessageHandler.sendMessage(a);this.validateNativeResponse(h)}catch(h){if(h instanceof Ur&&(this.serverTelemetryManager.setNativeBrokerErrorCode(h.errorCode),ia(h)))throw h}this.browserStorage.setTemporaryCache($e.NATIVE_REQUEST,JSON.stringify(o),!0);const c={apiId:rt.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},d=this.config.auth.navigateToLoginRequestUrl?window.location.href:this.getRedirectUri(e.redirectUri);t.end({success:!0}),await this.navigationClient.navigateExternal(d,c)}async handleRedirectPromise(e,t){if(this.logger.trace("NativeInteractionClient - handleRedirectPromise called."),!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const r=this.browserStorage.getCachedNativeRequest();if(!r)return this.logger.verbose("NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null."),e&&t&&(e==null||e.addFields({errorCode:"no_cached_request"},t)),null;const{prompt:o,...a}=r;o&&this.logger.verbose("NativeInteractionClient - handleRedirectPromise called and prompt was included in the original request, removing prompt from cached request to prevent second interaction with native broker window."),this.browserStorage.removeItem(this.browserStorage.generateCacheKey($e.NATIVE_REQUEST));const c={method:mi.GetToken,request:a},d=Wr();try{this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker.");const h=await this.nativeMessageHandler.sendMessage(c);this.validateNativeResponse(h);const f=this.handleNativeResponse(h,a,d);this.browserStorage.setInteractionInProgress(!1);const g=await f;return this.serverTelemetryManager.clearNativeBrokerErrorCode(),g}catch(h){throw this.browserStorage.setInteractionInProgress(!1),h}}logout(){return this.logger.trace("NativeInteractionClient - logout called."),Promise.reject("Logout not implemented yet")}async handleNativeResponse(e,t,r){var g;this.logger.trace("NativeInteractionClient - handleNativeResponse called.");const o=Ii(e.id_token,$r),a=this.createHomeAccountIdentifier(e,o),c=(g=this.browserStorage.getAccountInfoFilteredBy({nativeAccountId:t.accountId}))==null?void 0:g.homeAccountId;if(a!==c&&e.account.id!==t.accountId)throw cf(wT);const d=await this.getDiscoveredAuthority({requestAuthority:t.authority}),h=cm(this.browserStorage,d,a,$r,o,e.client_info,void 0,o.tid,void 0,e.account.id,this.logger),f=await this.generateAuthenticationResult(e,t,o,h,d.canonicalAuthority,r);return this.cacheAccount(h),this.cacheNativeTokens(e,t,a,o,e.access_token,f.tenantId,r),f}createHomeAccountIdentifier(e,t){return Ot.generateHomeAccountId(e.client_info||B.EMPTY_STRING,fr.Default,this.logger,this.browserCrypto,t)}generateScopes(e,t){return e.scope?_t.fromString(e.scope):_t.fromString(t.scope)}async generatePopAccessToken(e,t){if(t.tokenType===ze.POP&&t.signPopToken){if(e.shr)return this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer"),e.shr;const r=new wa(this.browserCrypto),o={resourceRequestMethod:t.resourceRequestMethod,resourceRequestUri:t.resourceRequestUri,shrClaims:t.shrClaims,shrNonce:t.shrNonce};if(!t.keyId)throw Y(qf);return r.signPopToken(e.access_token,t.keyId,o)}else return e.access_token}async generateAuthenticationResult(e,t,r,o,a,c){const d=this.addTelemetryFromNativeResponse(e),h=e.scope?_t.fromString(e.scope):_t.fromString(t.scope),f=e.account.properties||{},g=f.UID||r.oid||r.sub||B.EMPTY_STRING,v=f.TenantId||r.tid||B.EMPTY_STRING,p=nm(o.getAccountInfo(),void 0,r,e.id_token);p.nativeAccountId!==e.account.id&&(p.nativeAccountId=e.account.id);const w=await this.generatePopAccessToken(e,t),C=t.tokenType===ze.POP?ze.POP:ze.BEARER;return{authority:a,uniqueId:g,tenantId:v,scopes:h.asArray(),account:p,idToken:e.id_token,idTokenClaims:r,accessToken:w,fromCache:d?this.isResponseFromCache(d):!1,expiresOn:new Date(Number(c+e.expires_in)*1e3),tokenType:C,correlationId:this.correlationId,state:e.state,fromNativeBroker:!0}}cacheAccount(e){this.browserStorage.setAccount(e),this.browserStorage.removeAccountContext(e).catch(t=>{this.logger.error(`Error occurred while removing account context from browser storage. ${t}`)})}cacheNativeTokens(e,t,r,o,a,c,d){const h=ou(r,t.authority,e.id_token||"",t.clientId,o.tid||""),f=t.tokenType===ze.POP?B.SHR_NONCE_VALIDITY:(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,g=d+f,v=this.generateScopes(e,t),p=iu(r,t.authority,a,t.clientId,o.tid||c,v.printScopes(),g,0,$r,void 0,t.tokenType,void 0,t.keyId),w={idToken:h,accessToken:p};this.nativeStorageManager.saveCacheRecord(w,t.storeInCache)}addTelemetryFromNativeResponse(e){const t=this.getMATSFromResponse(e);return t?(this.performanceClient.addFields({extensionId:this.nativeMessageHandler.getExtensionId(),extensionVersion:this.nativeMessageHandler.getExtensionVersion(),matsBrokerVersion:t.broker_version,matsAccountJoinOnStart:t.account_join_on_start,matsAccountJoinOnEnd:t.account_join_on_end,matsDeviceJoin:t.device_join,matsPromptBehavior:t.prompt_behavior,matsApiErrorCode:t.api_error_code,matsUiVisible:t.ui_visible,matsSilentCode:t.silent_code,matsSilentBiSubCode:t.silent_bi_sub_code,matsSilentMessage:t.silent_message,matsSilentStatus:t.silent_status,matsHttpStatus:t.http_status,matsHttpEventCount:t.http_event_count},this.correlationId),t):null}validateNativeResponse(e){if(e.hasOwnProperty("access_token")&&e.hasOwnProperty("id_token")&&e.hasOwnProperty("client_info")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scope")&&e.hasOwnProperty("expires_in"))return e;throw HE(Hf,"Response missing expected properties.")}getMATSFromResponse(e){if(e.properties.MATS)try{return JSON.parse(e.properties.MATS)}catch{this.logger.error("NativeInteractionClient - Error parsing MATS telemetry, returning null instead")}return null}isResponseFromCache(e){return typeof e.is_cached>"u"?(this.logger.verbose("NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false."),!1):!!e.is_cached}async initializeNativeRequest(e){this.logger.trace("NativeInteractionClient - initializeNativeRequest called");const t=e.authority||this.config.auth.authority;e.account&&await this.getDiscoveredAuthority({requestAuthority:t,requestAzureCloudOptions:e.azureCloudOptions,account:e.account});const r=new Me(t);r.validateAsUri();const{scopes:o,...a}=e,c=new _t(o||[]);c.appendScopes(Ra);const d=()=>{switch(this.apiId){case rt.ssoSilent:case rt.acquireTokenSilent_silentFlow:return this.logger.trace("initializeNativeRequest: silent request sets prompt to none"),Ut.NONE}if(!e.prompt){this.logger.trace("initializeNativeRequest: prompt was not provided");return}switch(e.prompt){case Ut.NONE:case Ut.CONSENT:case Ut.LOGIN:return this.logger.trace("initializeNativeRequest: prompt is compatible with native flow"),e.prompt;default:throw this.logger.trace(`initializeNativeRequest: prompt = ${e.prompt} is not compatible with native flow`),oe(sT)}},h={...a,accountId:this.accountId,clientId:this.config.auth.clientId,authority:r.urlString,scope:c.printScopes(),redirectUri:this.getRedirectUri(e.redirectUri),prompt:d(),correlationId:this.correlationId,tokenType:e.authenticationScheme,windowTitleSubstring:document.title,extraParameters:{...e.extraQueryParameters,...e.tokenQueryParameters},extendedExpiryToken:!1,keyId:e.popKid};if(h.signPopToken&&e.popKid)throw oe(lT);if(this.handleExtraBrokerParams(h),h.extraParameters=h.extraParameters||{},h.extraParameters.telemetry=ha.MATS_TELEMETRY,e.authenticationScheme===ze.POP){const f={resourceRequestUri:e.resourceRequestUri,resourceRequestMethod:e.resourceRequestMethod,shrClaims:e.shrClaims,shrNonce:e.shrNonce},g=new wa(this.browserCrypto);let v;if(h.keyId)v=this.browserCrypto.base64UrlEncode(JSON.stringify({kid:h.keyId})),h.signPopToken=!1;else{const p=await J(g.generateCnf.bind(g),x.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(f,this.logger);v=p.reqCnfString,h.keyId=p.kid,h.signPopToken=!0}h.reqCnf=v}return this.addRequestSKUs(h),h}handleExtraBrokerParams(e){var a;const t=e.extraParameters&&e.extraParameters.hasOwnProperty(im)&&e.extraParameters.hasOwnProperty(Qh)&&e.extraParameters.hasOwnProperty(Ei);if(!e.embeddedClientId&&!t)return;let r="";const o=e.redirectUri;e.embeddedClientId?(e.redirectUri=this.config.auth.redirectUri,r=e.embeddedClientId):e.extraParameters&&(e.redirectUri=e.extraParameters[Qh],r=e.extraParameters[Ei]),e.extraParameters={child_client_id:r,child_redirect_uri:o},(a=this.performanceClient)==null||a.addFields({embeddedClientId:r,embeddedRedirectUri:o},e.correlationId)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Fr{constructor(e,t,r,o){this.logger=e,this.handshakeTimeoutMs=t,this.extensionId=o,this.resolvers=new Map,this.handshakeResolvers=new Map,this.messageChannel=new MessageChannel,this.windowListener=this.onWindowMessage.bind(this),this.performanceClient=r,this.handshakeEvent=r.startMeasurement(x.NativeMessageHandlerHandshake)}async sendMessage(e){this.logger.trace("NativeMessageHandler - sendMessage called.");const t={channel:ha.CHANNEL_ID,extensionId:this.extensionId,responseId:mo(),body:e};return this.logger.trace("NativeMessageHandler - Sending request to browser extension"),this.logger.tracePii(`NativeMessageHandler - Sending request to browser extension: ${JSON.stringify(t)}`),this.messageChannel.port1.postMessage(t),new Promise((r,o)=>{this.resolvers.set(t.responseId,{resolve:r,reject:o})})}static async createProvider(e,t,r){e.trace("NativeMessageHandler - createProvider called.");try{const o=new Fr(e,t,r,ha.PREFERRED_EXTENSION_ID);return await o.sendHandshakeRequest(),o}catch{const a=new Fr(e,t,r);return await a.sendHandshakeRequest(),a}}async sendHandshakeRequest(){this.logger.trace("NativeMessageHandler - sendHandshakeRequest called."),window.addEventListener("message",this.windowListener,!1);const e={channel:ha.CHANNEL_ID,extensionId:this.extensionId,responseId:mo(),body:{method:mi.HandshakeRequest}};return this.handshakeEvent.add({extensionId:this.extensionId,extensionHandshakeTimeoutMs:this.handshakeTimeoutMs}),this.messageChannel.port1.onmessage=t=>{this.onChannelMessage(t)},window.postMessage(e,window.origin,[this.messageChannel.port2]),new Promise((t,r)=>{this.handshakeResolvers.set(e.responseId,{resolve:t,reject:r}),this.timeoutId=window.setTimeout(()=>{window.removeEventListener("message",this.windowListener,!1),this.messageChannel.port1.close(),this.messageChannel.port2.close(),this.handshakeEvent.end({extensionHandshakeTimedOut:!0,success:!1}),r(oe(oT)),this.handshakeResolvers.delete(e.responseId)},this.handshakeTimeoutMs)})}onWindowMessage(e){if(this.logger.trace("NativeMessageHandler - onWindowMessage called"),e.source!==window)return;const t=e.data;if(!(!t.channel||t.channel!==ha.CHANNEL_ID)&&!(t.extensionId&&t.extensionId!==this.extensionId)&&t.body.method===mi.HandshakeRequest){const r=this.handshakeResolvers.get(t.responseId);if(!r){this.logger.trace(`NativeMessageHandler.onWindowMessage - resolver can't be found for request ${t.responseId}`);return}this.logger.verbose(t.extensionId?`Extension with id: ${t.extensionId} not installed`:"No extension installed"),clearTimeout(this.timeoutId),this.messageChannel.port1.close(),this.messageChannel.port2.close(),window.removeEventListener("message",this.windowListener,!1),this.handshakeEvent.end({success:!1,extensionInstalled:!1}),r.reject(oe(iT))}}onChannelMessage(e){this.logger.trace("NativeMessageHandler - onChannelMessage called.");const t=e.data,r=this.resolvers.get(t.responseId),o=this.handshakeResolvers.get(t.responseId);try{const a=t.body.method;if(a===mi.Response){if(!r)return;const c=t.body.response;if(this.logger.trace("NativeMessageHandler - Received response from browser extension"),this.logger.tracePii(`NativeMessageHandler - Received response from browser extension: ${JSON.stringify(c)}`),c.status!=="Success")r.reject(cf(c.code,c.description,c.ext));else if(c.result)c.result.code&&c.result.description?r.reject(cf(c.result.code,c.result.description,c.result.ext)):r.resolve(c.result);else throw HE(Hf,"Event does not contain result.");this.resolvers.delete(t.responseId)}else if(a===mi.HandshakeResponse){if(!o){this.logger.trace(`NativeMessageHandler.onChannelMessage - resolver can't be found for request ${t.responseId}`);return}clearTimeout(this.timeoutId),window.removeEventListener("message",this.windowListener,!1),this.extensionId=t.extensionId,this.extensionVersion=t.body.version,this.logger.verbose(`NativeMessageHandler - Received HandshakeResponse from extension: ${this.extensionId}`),this.handshakeEvent.end({extensionInstalled:!0,success:!0}),o.resolve(),this.handshakeResolvers.delete(t.responseId)}}catch(a){this.logger.error("Error parsing response from WAM Extension"),this.logger.errorPii(`Error parsing response from WAM Extension: ${a}`),this.logger.errorPii(`Unable to parse ${e}`),r?r.reject(a):o&&o.reject(a)}}getExtensionId(){return this.extensionId}getExtensionVersion(){return this.extensionVersion}static isNativeAvailable(e,t,r,o){if(t.trace("isNativeAvailable called"),!e.system.allowNativeBroker)return t.trace("isNativeAvailable: allowNativeBroker is not enabled, returning false"),!1;if(!r)return t.trace("isNativeAvailable: WAM extension provider is not initialized, returning false"),!1;if(o)switch(o){case ze.BEARER:case ze.POP:return t.trace("isNativeAvailable: authenticationScheme is supported, returning true"),!0;default:return t.trace("isNativeAvailable: authenticationScheme is not supported, returning false"),!1}return!0}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class bm{constructor(e,t,r,o,a){this.authModule=e,this.browserStorage=t,this.authCodeRequest=r,this.logger=o,this.performanceClient=a}async handleCodeResponse(e,t){this.performanceClient.addQueueMeasurement(x.HandleCodeResponse,t.correlationId);let r;try{r=this.authModule.handleFragmentResponse(e,t.state)}catch(o){throw o instanceof Ko&&o.subError===Ti?oe(Ti):o}return J(this.handleCodeResponseFromServer.bind(this),x.HandleCodeResponseFromServer,this.logger,this.performanceClient,t.correlationId)(r,t)}async handleCodeResponseFromServer(e,t,r=!0){if(this.performanceClient.addQueueMeasurement(x.HandleCodeResponseFromServer,t.correlationId),this.logger.trace("InteractionHandler.handleCodeResponseFromServer called"),this.authCodeRequest.code=e.code,e.cloud_instance_host_name&&await J(this.authModule.updateAuthority.bind(this.authModule),x.UpdateTokenEndpointAuthority,this.logger,this.performanceClient,t.correlationId)(e.cloud_instance_host_name,t.correlationId),r&&(e.nonce=t.nonce||void 0),e.state=t.state,e.client_info)this.authCodeRequest.clientInfo=e.client_info;else{const a=this.createCcsCredentials(t);a&&(this.authCodeRequest.ccsCredential=a)}return await J(this.authModule.acquireToken.bind(this.authModule),x.AuthClientAcquireToken,this.logger,this.performanceClient,t.correlationId)(this.authCodeRequest,e)}createCcsCredentials(e){return e.account?{credential:e.account.homeAccountId,type:Un.HOME_ACCOUNT_ID}:e.loginHint?{credential:e.loginHint,type:Un.UPN}:null}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function bT(n,e,t){const r=Rl(n);if(!r)throw Tw(n)?(t.error(`A ${e} is present in the iframe but it does not contain known properties. It's likely that the ${e} has been replaced by code running on the redirectUri page.`),t.errorPii(`The ${e} detected is: ${n}`),oe(Fw)):(t.error(`The request has returned to the redirectUri but a ${e} is not present. It's likely that the ${e} has been removed or the page has been redirected by code running on the redirectUri page.`),oe(Uw));return r}function HH(n,e,t){if(!n.state)throw oe(hm);const r=CT(e,n.state);if(!r)throw oe(Bw);if(r.interactionType!==t)throw oe(Vw)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class $H extends Oa{constructor(e,t,r,o,a,c,d,h,f,g){super(e,t,r,o,a,c,d,f,g),this.unloadWindow=this.unloadWindow.bind(this),this.nativeStorage=h}acquireToken(e){try{const r={popupName:this.generatePopupName(e.scopes||Ra,e.authority||this.config.auth.authority),popupWindowAttributes:e.popupWindowAttributes||{},popupWindowParent:e.popupWindowParent??window};return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true, acquiring token"),this.acquireTokenPopupAsync(e,r)):(this.logger.verbose("asyncPopup set to false, opening popup before acquiring token"),r.popup=this.openSizedPopup("about:blank",r),this.acquireTokenPopupAsync(e,r))}catch(t){return Promise.reject(t)}}logout(e){try{this.logger.verbose("logoutPopup called");const t=this.initializeLogoutRequest(e),r={popupName:this.generateLogoutPopupName(t),popupWindowAttributes:(e==null?void 0:e.popupWindowAttributes)||{},popupWindowParent:(e==null?void 0:e.popupWindowParent)??window},o=e&&e.authority,a=e&&e.mainWindowRedirectUri;return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true"),this.logoutPopupAsync(t,r,o,a)):(this.logger.verbose("asyncPopup set to false, opening popup"),r.popup=this.openSizedPopup("about:blank",r),this.logoutPopupAsync(t,r,o,a))}catch(t){return Promise.reject(t)}}async acquireTokenPopupAsync(e,t){var a;this.logger.verbose("acquireTokenPopupAsync called");const r=this.initializeServerTelemetryManager(rt.acquireTokenPopup),o=await J(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,ce.Popup);yT(o.authority);try{const c=await J(this.initializeAuthorizationCodeRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationCodeRequest,this.logger,this.performanceClient,this.correlationId)(o),d=await J(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:o.authority,requestAzureCloudOptions:o.azureCloudOptions,requestExtraQueryParameters:o.extraQueryParameters,account:o.account}),h=Fr.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,e.authenticationScheme);let f;h&&(f=this.performanceClient.startMeasurement(x.FetchAccountIdWithNativeBroker,e.correlationId));const g=await d.getAuthCodeUrl({...o,nativeBroker:h}),v=new bm(d,this.browserStorage,c,this.logger,this.performanceClient),p=this.initiateAuthRequest(g,t);this.eventHandler.emitEvent(fe.POPUP_OPENED,ce.Popup,{popupWindow:p},null);const w=await this.monitorPopupForHash(p,t.popupWindowParent),C=Si(bT,x.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(w,this.config.auth.OIDCOptions.serverResponseType,this.logger);if(xr.removeThrottle(this.browserStorage,this.config.auth.clientId,c),C.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),f&&f.end({success:!0,isNativeBroker:!0}),!this.nativeMessageHandler)throw oe(Hs);const k=new ga(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,rt.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,C.accountId,this.nativeStorage,o.correlationId),{userRequestState:I}=vr.parseRequestState(this.browserCrypto,o.state);return await k.acquireToken({...o,state:I,prompt:void 0})}return await v.handleCodeResponse(C,o)}catch(c){throw(a=t.popup)==null||a.close(),c instanceof ct&&(c.setCorrelationId(this.correlationId),r.cacheFailedRequest(c)),c}}async logoutPopupAsync(e,t,r,o){var c,d,h,f;this.logger.verbose("logoutPopupAsync called"),this.eventHandler.emitEvent(fe.LOGOUT_START,ce.Popup,e);const a=this.initializeServerTelemetryManager(rt.logoutPopup);try{await this.clearCacheOnLogout(e.account);const g=await J(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:a,requestAuthority:r,account:e.account||void 0});try{g.authority.endSessionEndpoint}catch{if((c=e.account)!=null&&c.homeAccountId&&e.postLogoutRedirectUri&&g.authority.protocolMode===ho.OIDC){if(this.browserStorage.removeAccount((d=e.account)==null?void 0:d.homeAccountId),this.eventHandler.emitEvent(fe.LOGOUT_SUCCESS,ce.Popup,e),o){const w={apiId:rt.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},C=Me.getAbsoluteUrl(o,co());await this.navigationClient.navigateInternal(C,w)}(h=t.popup)==null||h.close();return}}const v=g.getLogoutUri(e);this.eventHandler.emitEvent(fe.LOGOUT_SUCCESS,ce.Popup,e);const p=this.openPopup(v,t);if(this.eventHandler.emitEvent(fe.POPUP_OPENED,ce.Popup,{popupWindow:p},null),await this.monitorPopupForHash(p,t.popupWindowParent).catch(()=>{}),o){const w={apiId:rt.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},C=Me.getAbsoluteUrl(o,co());this.logger.verbose("Redirecting main window to url specified in the request"),this.logger.verbosePii(`Redirecting main window to: ${C}`),await this.navigationClient.navigateInternal(C,w)}else this.logger.verbose("No main window navigation requested")}catch(g){throw(f=t.popup)==null||f.close(),g instanceof ct&&(g.setCorrelationId(this.correlationId),a.cacheFailedRequest(g)),this.browserStorage.setInteractionInProgress(!1),this.eventHandler.emitEvent(fe.LOGOUT_FAILURE,ce.Popup,null,g),this.eventHandler.emitEvent(fe.LOGOUT_END,ce.Popup),g}this.eventHandler.emitEvent(fe.LOGOUT_END,ce.Popup)}initiateAuthRequest(e,t){if(e)return this.logger.infoPii(`Navigate to: ${e}`),this.openPopup(e,t);throw this.logger.error("Navigate url is empty"),oe(uu)}monitorPopupForHash(e,t){return new Promise((r,o)=>{this.logger.verbose("PopupHandler.monitorPopupForHash - polling started");const a=setInterval(()=>{if(e.closed){this.logger.error("PopupHandler.monitorPopupForHash - window closed"),clearInterval(a),o(oe(Ti));return}let c="";try{c=e.location.href}catch{}if(!c||c==="about:blank")return;clearInterval(a);let d="";const h=this.config.auth.OIDCOptions.serverResponseType;e&&(h===Vs.QUERY?d=e.location.search:d=e.location.hash),this.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller"),r(d)},this.config.system.pollIntervalMilliseconds)}).finally(()=>{this.cleanPopup(e,t)})}openPopup(e,t){try{let r;if(t.popup?(r=t.popup,this.logger.verbosePii(`Navigating popup window to: ${e}`),r.location.assign(e)):typeof t.popup>"u"&&(this.logger.verbosePii(`Opening popup window to: ${e}`),r=this.openSizedPopup(e,t)),!r)throw oe(Kw);return r.focus&&r.focus(),this.currentWindow=r,t.popupWindowParent.addEventListener("beforeunload",this.unloadWindow),r}catch(r){throw this.logger.error("error opening popup "+r.message),this.browserStorage.setInteractionInProgress(!1),oe($w)}}openSizedPopup(e,{popupName:t,popupWindowAttributes:r,popupWindowParent:o}){var w,C,T,k;const a=o.screenLeft?o.screenLeft:o.screenX,c=o.screenTop?o.screenTop:o.screenY,d=o.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,h=o.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;let f=(w=r.popupSize)==null?void 0:w.width,g=(C=r.popupSize)==null?void 0:C.height,v=(T=r.popupPosition)==null?void 0:T.top,p=(k=r.popupPosition)==null?void 0:k.left;return(!f||f<0||f>d)&&(this.logger.verbose("Default popup window width used. Window width not configured or invalid."),f=Mn.POPUP_WIDTH),(!g||g<0||g>h)&&(this.logger.verbose("Default popup window height used. Window height not configured or invalid."),g=Mn.POPUP_HEIGHT),(!v||v<0||v>h)&&(this.logger.verbose("Default popup window top position used. Window top not configured or invalid."),v=Math.max(0,h/2-Mn.POPUP_HEIGHT/2+c)),(!p||p<0||p>d)&&(this.logger.verbose("Default popup window left position used. Window left not configured or invalid."),p=Math.max(0,d/2-Mn.POPUP_WIDTH/2+a)),o.open(e,t,`width=${f}, height=${g}, top=${v}, left=${p}, scrollbars=yes`)}unloadWindow(e){this.browserStorage.cleanRequestByInteractionType(ce.Popup),this.currentWindow&&this.currentWindow.close(),e.preventDefault()}cleanPopup(e,t){e.close(),t.removeEventListener("beforeunload",this.unloadWindow),this.browserStorage.setInteractionInProgress(!1)}generatePopupName(e,t){return`${Mn.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${e.join("-")}.${t}.${this.correlationId}`}generateLogoutPopupName(e){const t=e.account&&e.account.homeAccountId;return`${Mn.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${t}.${this.correlationId}`}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class ly{constructor(e,t,r,o,a){this.authModule=e,this.browserStorage=t,this.authCodeRequest=r,this.logger=o,this.performanceClient=a}async initiateAuthRequest(e,t){if(this.logger.verbose("RedirectHandler.initiateAuthRequest called"),e){t.redirectStartPage&&(this.logger.verbose("RedirectHandler.initiateAuthRequest: redirectStartPage set, caching start page"),this.browserStorage.setTemporaryCache($e.ORIGIN_URI,t.redirectStartPage,!0)),this.browserStorage.setTemporaryCache($e.CORRELATION_ID,this.authCodeRequest.correlationId,!0),this.browserStorage.cacheCodeRequest(this.authCodeRequest),this.logger.infoPii(`RedirectHandler.initiateAuthRequest: Navigate to: ${e}`);const r={apiId:rt.acquireTokenRedirect,timeout:t.redirectTimeout,noHistory:!1};if(typeof t.onRedirectNavigate=="function")if(this.logger.verbose("RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback"),t.onRedirectNavigate(e)!==!1){this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating"),await t.navigationClient.navigateExternal(e,r);return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate returned false, stopping navigation");return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: Navigating window to navigate url"),await t.navigationClient.navigateExternal(e,r);return}}else throw this.logger.info("RedirectHandler.initiateAuthRequest: Navigate url is empty"),oe(uu)}async handleCodeResponse(e,t){this.logger.verbose("RedirectHandler.handleCodeResponse called"),this.browserStorage.setInteractionInProgress(!1);const r=this.browserStorage.generateStateKey(t),o=this.browserStorage.getTemporaryCache(r);if(!o)throw Y(Sl,"Cached State");let a;try{a=this.authModule.handleFragmentResponse(e,o)}catch(f){throw f instanceof Ko&&f.subError===Ti?oe(Ti):f}const c=this.browserStorage.generateNonceKey(o),d=this.browserStorage.getTemporaryCache(c);if(this.authCodeRequest.code=a.code,a.cloud_instance_host_name&&await J(this.authModule.updateAuthority.bind(this.authModule),x.UpdateTokenEndpointAuthority,this.logger,this.performanceClient,this.authCodeRequest.correlationId)(a.cloud_instance_host_name,this.authCodeRequest.correlationId),a.nonce=d||void 0,a.state=o,a.client_info)this.authCodeRequest.clientInfo=a.client_info;else{const f=this.checkCcsCredentials();f&&(this.authCodeRequest.ccsCredential=f)}const h=await this.authModule.acquireToken(this.authCodeRequest,a);return this.browserStorage.cleanRequestByState(t),h}checkCcsCredentials(){const e=this.browserStorage.getTemporaryCache($e.CCS_CREDENTIAL,!0);if(e)try{return JSON.parse(e)}catch{this.authModule.logger.error("Cache credential could not be parsed"),this.authModule.logger.errorPii(`Cache credential could not be parsed: ${e}`)}return null}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function KH(){if(typeof window>"u"||typeof window.performance>"u"||typeof window.performance.getEntriesByType!="function")return;const n=window.performance.getEntriesByType("navigation"),e=n.length?n[0]:void 0;return e==null?void 0:e.type}class WH extends Oa{constructor(e,t,r,o,a,c,d,h,f,g){super(e,t,r,o,a,c,d,f,g),this.nativeStorage=h}async acquireToken(e){const t=await J(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,ce.Redirect);this.browserStorage.updateCacheEntries(t.state,t.nonce,t.authority,t.loginHint||"",t.account||null);const r=this.initializeServerTelemetryManager(rt.acquireTokenRedirect),o=a=>{a.persisted&&(this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache."),this.browserStorage.cleanRequestByState(t.state),this.eventHandler.emitEvent(fe.RESTORE_FROM_BFCACHE,ce.Redirect))};try{const a=await J(this.initializeAuthorizationCodeRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationCodeRequest,this.logger,this.performanceClient,this.correlationId)(t),c=await J(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:t.authority,requestAzureCloudOptions:t.azureCloudOptions,requestExtraQueryParameters:t.extraQueryParameters,account:t.account}),d=new ly(c,this.browserStorage,a,this.logger,this.performanceClient),h=await c.getAuthCodeUrl({...t,nativeBroker:Fr.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,e.authenticationScheme)}),f=this.getRedirectStartPage(e.redirectStartPage);return this.logger.verbosePii(`Redirect start page: ${f}`),window.addEventListener("pageshow",o),await d.initiateAuthRequest(h,{navigationClient:this.navigationClient,redirectTimeout:this.config.system.redirectNavigationTimeout,redirectStartPage:f,onRedirectNavigate:e.onRedirectNavigate||this.config.auth.onRedirectNavigate})}catch(a){throw a instanceof ct&&(a.setCorrelationId(this.correlationId),r.cacheFailedRequest(a)),window.removeEventListener("pageshow",o),this.browserStorage.cleanRequestByState(t.state),a}}async handleRedirectPromise(e="",t){const r=this.initializeServerTelemetryManager(rt.handleRedirectPromise);try{if(!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const[o,a]=this.getRedirectResponse(e||"");if(!o)return this.logger.info("handleRedirectPromise did not detect a response as a result of a redirect. Cleaning temporary cache."),this.browserStorage.cleanRequestByInteractionType(ce.Redirect),KH()!=="back_forward"?t.event.errorCode="no_server_response":this.logger.verbose("Back navigation event detected. Muting no_server_response error"),null;const c=this.browserStorage.getTemporaryCache($e.ORIGIN_URI,!0)||B.EMPTY_STRING,d=Me.removeHashFromUrl(c),h=Me.removeHashFromUrl(window.location.href);if(d===h&&this.config.auth.navigateToLoginRequestUrl)return this.logger.verbose("Current page is loginRequestUrl, handling response"),c.indexOf("#")>-1&&Q2(c),await this.handleResponse(o,r);if(this.config.auth.navigateToLoginRequestUrl){if(!Cm()||this.config.system.allowRedirectInIframe){this.browserStorage.setTemporaryCache($e.URL_HASH,a,!0);const f={apiId:rt.handleRedirectPromise,timeout:this.config.system.redirectNavigationTimeout,noHistory:!0};let g=!0;if(!c||c==="null"){const v=Z2();this.browserStorage.setTemporaryCache($e.ORIGIN_URI,v,!0),this.logger.warning("Unable to get valid login request url from cache, redirecting to home page"),g=await this.navigationClient.navigateInternal(v,f)}else this.logger.verbose(`Navigating to loginRequestUrl: ${c}`),g=await this.navigationClient.navigateInternal(c,f);if(!g)return await this.handleResponse(o,r)}}else return this.logger.verbose("NavigateToLoginRequestUrl set to false, handling response"),await this.handleResponse(o,r);return null}catch(o){throw o instanceof ct&&(o.setCorrelationId(this.correlationId),r.cacheFailedRequest(o)),this.browserStorage.cleanRequestByInteractionType(ce.Redirect),o}}getRedirectResponse(e){this.logger.verbose("getRedirectResponseHash called");let t=e;t||(this.config.auth.OIDCOptions.serverResponseType===Vs.QUERY?t=window.location.search:t=window.location.hash);let r=Rl(t);if(r){try{HH(r,this.browserCrypto,ce.Redirect)}catch(a){return a instanceof ct&&this.logger.error(`Interaction type validation failed due to ${a.errorCode}: ${a.errorMessage}`),[null,""]}return J2(window),this.logger.verbose("Hash contains known properties, returning response hash"),[r,t]}const o=this.browserStorage.getTemporaryCache($e.URL_HASH,!0);return this.browserStorage.removeItem(this.browserStorage.generateCacheKey($e.URL_HASH)),o&&(r=Rl(o),r)?(this.logger.verbose("Hash does not contain known properties, returning cached hash"),[r,o]):[null,""]}async handleResponse(e,t){const r=e.state;if(!r)throw oe(hm);const o=this.browserStorage.getCachedRequest(r);if(this.logger.verbose("handleResponse called, retrieved cached request"),e.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw oe(Hs);const h=new ga(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,rt.acquireTokenPopup,this.performanceClient,this.nativeMessageHandler,e.accountId,this.nativeStorage,o.correlationId),{userRequestState:f}=vr.parseRequestState(this.browserCrypto,r);return h.acquireToken({...o,state:f,prompt:void 0}).finally(()=>{this.browserStorage.cleanRequestByState(r)})}const a=this.browserStorage.getCachedAuthority(r);if(!a)throw oe(fm);const c=await J(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:t,requestAuthority:a});return xr.removeThrottle(this.browserStorage,this.config.auth.clientId,o),new ly(c,this.browserStorage,o,this.logger,this.performanceClient).handleCodeResponse(e,r)}async logout(e){var o,a;this.logger.verbose("logoutRedirect called");const t=this.initializeLogoutRequest(e),r=this.initializeServerTelemetryManager(rt.logout);try{this.eventHandler.emitEvent(fe.LOGOUT_START,ce.Redirect,e),await this.clearCacheOnLogout(t.account);const c={apiId:rt.logout,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},d=await J(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:e&&e.authority,requestExtraQueryParameters:e==null?void 0:e.extraQueryParameters,account:e&&e.account||void 0});if(d.authority.protocolMode===ho.OIDC)try{d.authority.endSessionEndpoint}catch{if((o=t.account)!=null&&o.homeAccountId){this.browserStorage.removeAccount((a=t.account)==null?void 0:a.homeAccountId),this.eventHandler.emitEvent(fe.LOGOUT_SUCCESS,ce.Redirect,t);return}}const h=d.getLogoutUri(t);if(this.eventHandler.emitEvent(fe.LOGOUT_SUCCESS,ce.Redirect,t),e&&typeof e.onRedirectNavigate=="function")if(e.onRedirectNavigate(h)!==!1){this.logger.verbose("Logout onRedirectNavigate did not return false, navigating"),this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),await this.navigationClient.navigateExternal(h,c);return}else this.browserStorage.setInteractionInProgress(!1),this.logger.verbose("Logout onRedirectNavigate returned false, stopping navigation");else{this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),await this.navigationClient.navigateExternal(h,c);return}}catch(c){throw c instanceof ct&&(c.setCorrelationId(this.correlationId),r.cacheFailedRequest(c)),this.eventHandler.emitEvent(fe.LOGOUT_FAILURE,ce.Redirect,null,c),this.eventHandler.emitEvent(fe.LOGOUT_END,ce.Redirect),c}this.eventHandler.emitEvent(fe.LOGOUT_END,ce.Redirect)}getRedirectStartPage(e){const t=e||window.location.href;return Me.getAbsoluteUrl(t,co())}}/*! @azure/msal-browser v3.28.1 2025-01-14 */async function zH(n,e,t,r,o){if(e.addQueueMeasurement(x.SilentHandlerInitiateAuthRequest,r),!n)throw t.info("Navigate url is empty"),oe(uu);return o?J(qH,x.SilentHandlerLoadFrame,t,e,r)(n,o,e,r):Si(YH,x.SilentHandlerLoadFrameSync,t,e,r)(n)}async function GH(n,e,t,r,o,a,c){return r.addQueueMeasurement(x.SilentHandlerMonitorIframeForHash,a),new Promise((d,h)=>{e<of&&o.warning(`system.loadFrameTimeout or system.iframeHashTimeout set to lower (${e}ms) than the default (${of}ms). This may result in timeouts.`);const f=window.setTimeout(()=>{window.clearInterval(g),h(oe(Ww))},e),g=window.setInterval(()=>{let v="";const p=n.contentWindow;try{v=p?p.location.href:""}catch{}if(!v||v==="about:blank")return;let w="";p&&(c===Vs.QUERY?w=p.location.search:w=p.location.hash),window.clearTimeout(f),window.clearInterval(g),d(w)},t)}).finally(()=>{Si(jH,x.RemoveHiddenIframe,o,r,a)(n)})}function qH(n,e,t,r){return t.addQueueMeasurement(x.SilentHandlerLoadFrame,r),new Promise((o,a)=>{const c=IT();window.setTimeout(()=>{if(!c){a("Unable to load iframe");return}c.src=n,o(c)},e)})}function YH(n){const e=IT();return e.src=n,e}function IT(){const n=document.createElement("iframe");return n.className="msalSilentIframe",n.style.visibility="hidden",n.style.position="absolute",n.style.width=n.style.height="0",n.style.border="0",n.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),document.body.appendChild(n),n}function jH(n){document.body===n.parentNode&&document.body.removeChild(n)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class JH extends Oa{constructor(e,t,r,o,a,c,d,h,f,g,v){super(e,t,r,o,a,c,h,g,v),this.apiId=d,this.nativeStorage=f}async acquireToken(e){this.performanceClient.addQueueMeasurement(x.SilentIframeClientAcquireToken,e.correlationId),!e.loginHint&&!e.sid&&(!e.account||!e.account.username)&&this.logger.warning("No user hint provided. The authorization server may need more information to complete this request.");const t={...e};t.prompt?t.prompt!==Ut.NONE&&t.prompt!==Ut.NO_SESSION&&(this.logger.warning(`SilentIframeClient. Replacing invalid prompt ${t.prompt} with ${Ut.NONE}`),t.prompt=Ut.NONE):t.prompt=Ut.NONE;const r=await J(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(t,ce.Silent);yT(r.authority);const o=this.initializeServerTelemetryManager(this.apiId);let a;try{return a=await J(this.createAuthCodeClient.bind(this),x.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:o,requestAuthority:r.authority,requestAzureCloudOptions:r.azureCloudOptions,requestExtraQueryParameters:r.extraQueryParameters,account:r.account}),await J(this.silentTokenHelper.bind(this),x.SilentIframeClientTokenHelper,this.logger,this.performanceClient,e.correlationId)(a,r)}catch(c){if(c instanceof ct&&(c.setCorrelationId(this.correlationId),o.cacheFailedRequest(c)),!a||!(c instanceof ct)||c.errorCode!==Mn.INVALID_GRANT_ERROR)throw c;this.performanceClient.addFields({retryError:c.errorCode},this.correlationId);const d=await J(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(t,ce.Silent);return await J(this.silentTokenHelper.bind(this),x.SilentIframeClientTokenHelper,this.logger,this.performanceClient,this.correlationId)(a,d)}}logout(){return Promise.reject(oe(du))}async silentTokenHelper(e,t){const r=t.correlationId;this.performanceClient.addQueueMeasurement(x.SilentIframeClientTokenHelper,r);const o=await J(this.initializeAuthorizationCodeRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationCodeRequest,this.logger,this.performanceClient,r)(t),a=await J(e.getAuthCodeUrl.bind(e),x.GetAuthCodeUrl,this.logger,this.performanceClient,r)({...t,nativeBroker:Fr.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,t.authenticationScheme)}),c=new bm(e,this.browserStorage,o,this.logger,this.performanceClient),d=await J(zH,x.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,r)(a,this.performanceClient,this.logger,r,this.config.system.navigateFrameWait),h=this.config.auth.OIDCOptions.serverResponseType,f=await J(GH,x.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,r)(d,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,r,h),g=Si(bT,x.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(f,h,this.logger);if(g.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw oe(Hs);const v=new ga(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.apiId,this.performanceClient,this.nativeMessageHandler,g.accountId,this.browserStorage,r),{userRequestState:p}=vr.parseRequestState(this.browserCrypto,t.state);return J(v.acquireToken.bind(v),x.NativeInteractionClientAcquireToken,this.logger,this.performanceClient,r)({...t,state:p,prompt:t.prompt||Ut.NONE})}return J(c.handleCodeResponse.bind(c),x.HandleCodeResponse,this.logger,this.performanceClient,r)(g,t)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class QH extends Oa{async acquireToken(e){this.performanceClient.addQueueMeasurement(x.SilentRefreshClientAcquireToken,e.correlationId);const t=await J(Tm,x.InitializeBaseRequest,this.logger,this.performanceClient,e.correlationId)(e,this.config,this.performanceClient,this.logger),r={...e,...t};e.redirectUri&&(r.redirectUri=this.getRedirectUri(e.redirectUri));const o=this.initializeServerTelemetryManager(rt.acquireTokenSilent_silentFlow),a=await this.createRefreshTokenClient({serverTelemetryManager:o,authorityUrl:r.authority,azureCloudOptions:r.azureCloudOptions,account:r.account});return J(a.acquireTokenByRefreshToken.bind(a),x.RefreshTokenClientAcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(r).catch(c=>{throw c.setCorrelationId(this.correlationId),o.cacheFailedRequest(c),c})}logout(){return Promise.reject(oe(du))}async createRefreshTokenClient(e){const t=await J(this.getClientConfiguration.bind(this),x.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:e.serverTelemetryManager,requestAuthority:e.authorityUrl,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return new Zh(t,this.performanceClient)}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class XH{constructor(e,t,r,o){this.isBrowserEnvironment=typeof window<"u",this.config=e,this.storage=t,this.logger=r,this.cryptoObj=o}loadExternalTokens(e,t,r){if(!this.isBrowserEnvironment)throw oe(hu);const o=t.id_token?Ii(t.id_token,$r):void 0,a={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},c=e.authority?new Qt(Qt.generateAuthority(e.authority,e.azureCloudOptions),this.config.system.networkClient,this.storage,a,this.logger,e.correlationId||mo()):void 0,d=this.loadAccount(e,r.clientInfo||t.client_info||"",o,c),h=this.loadIdToken(t,d.homeAccountId,d.environment,d.realm),f=this.loadAccessToken(e,t,d.homeAccountId,d.environment,d.realm,r),g=this.loadRefreshToken(t,d.homeAccountId,d.environment);return this.generateAuthenticationResult(e,{account:d,idToken:h,accessToken:f,refreshToken:g},o,c)}loadAccount(e,t,r,o){if(this.logger.verbose("TokenCache - loading account"),e.account){const h=Ot.createFromAccountInfo(e.account);return this.storage.setAccount(h),h}else if(!o||!t&&!r)throw this.logger.error("TokenCache - if an account is not provided on the request, authority and either clientInfo or idToken must be provided instead."),oe(Zw);const a=Ot.generateHomeAccountId(t,o.authorityType,this.logger,this.cryptoObj,r),c=r==null?void 0:r.tid,d=cm(this.storage,o,a,$r,r,t,o.hostnameAndPort,c,void 0,void 0,this.logger);return this.storage.setAccount(d),d}loadIdToken(e,t,r,o){if(!e.id_token)return this.logger.verbose("TokenCache - no id token found in response"),null;this.logger.verbose("TokenCache - loading id token");const a=ou(t,r,e.id_token,this.config.auth.clientId,o);return this.storage.setIdTokenCredential(a),a}loadAccessToken(e,t,r,o,a,c){if(t.access_token)if(t.expires_in){if(!t.scope&&(!e.scopes||!e.scopes.length))return this.logger.error("TokenCache - scopes not specified in the request or response. Cannot add token to the cache."),null}else return this.logger.error("TokenCache - no expiration set on the access token. Cannot add it to the cache."),null;else return this.logger.verbose("TokenCache - no access token found in response"),null;this.logger.verbose("TokenCache - loading access token");const d=t.scope?_t.fromString(t.scope):new _t(e.scopes),h=c.expiresOn||t.expires_in+new Date().getTime()/1e3,f=c.extendedExpiresOn||(t.ext_expires_in||t.expires_in)+new Date().getTime()/1e3,g=iu(r,o,t.access_token,this.config.auth.clientId,a,d.printScopes(),h,f,$r);return this.storage.setAccessTokenCredential(g),g}loadRefreshToken(e,t,r){if(!e.refresh_token)return this.logger.verbose("TokenCache - no refresh token found in response"),null;this.logger.verbose("TokenCache - loading refresh token");const o=sw(t,r,e.refresh_token,this.config.auth.clientId,e.foci,void 0,e.refresh_token_expires_in);return this.storage.setRefreshTokenCredential(o),o}generateAuthenticationResult(e,t,r,o){var g,v,p;let a="",c=[],d=null,h;t!=null&&t.accessToken&&(a=t.accessToken.secret,c=_t.fromString(t.accessToken.target).asArray(),d=new Date(Number(t.accessToken.expiresOn)*1e3),h=new Date(Number(t.accessToken.extendedExpiresOn)*1e3));const f=t.account;return{authority:o?o.canonicalAuthority:"",uniqueId:t.account.localAccountId,tenantId:t.account.realm,scopes:c,account:f.getAccountInfo(),idToken:((g=t.idToken)==null?void 0:g.secret)||"",idTokenClaims:r||{},accessToken:a,fromCache:!0,expiresOn:d,correlationId:e.correlationId||"",requestId:"",extExpiresOn:h,familyId:((v=t.refreshToken)==null?void 0:v.familyId)||"",tokenType:((p=t==null?void 0:t.accessToken)==null?void 0:p.tokenType)||"",state:e.state||"",cloudGraphHostName:f.cloudGraphHostName||"",msGraphHost:f.msGraphHost||"",fromNativeBroker:!1}}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class ZH extends Mw{constructor(e){super(e),this.includeRedirectUri=!1}}/*! @azure/msal-browser v3.28.1 2025-01-14 */class e$ extends Oa{constructor(e,t,r,o,a,c,d,h,f,g){super(e,t,r,o,a,c,h,f,g),this.apiId=d}async acquireToken(e){if(!e.code)throw oe(eT);const t=await J(this.initializeAuthorizationRequest.bind(this),x.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(e,ce.Silent),r=this.initializeServerTelemetryManager(this.apiId);try{const o={...t,code:e.code},a=await J(this.getClientConfiguration.bind(this),x.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:r,requestAuthority:t.authority,requestAzureCloudOptions:t.azureCloudOptions,requestExtraQueryParameters:t.extraQueryParameters,account:t.account}),c=new ZH(a);this.logger.verbose("Auth code client created");const d=new bm(c,this.browserStorage,o,this.logger,this.performanceClient);return await J(d.handleCodeResponseFromServer.bind(d),x.HandleCodeResponseFromServer,this.logger,this.performanceClient,e.correlationId)({code:e.code,msgraph_host:e.msGraphHost,cloud_graph_host_name:e.cloudGraphHostName,cloud_instance_host_name:e.cloudInstanceHostName},t,!1)}catch(o){throw o instanceof ct&&(o.setCorrelationId(this.correlationId),r.cacheFailedRequest(o)),o}}logout(){return Promise.reject(oe(du))}}/*! @azure/msal-browser v3.28.1 2025-01-14 */function Mr(n){const e=n==null?void 0:n.idTokenClaims;if(e!=null&&e.tfp||e!=null&&e.acr)return"B2C";if(e!=null&&e.tid){if((e==null?void 0:e.tid)==="9188040d-6c67-4c5b-b112-36a304b66dad")return"MSA"}else return;return"AAD"}function qc(n,e){try{Em(n)}catch(t){throw e.end({success:!1},t),t}}class gu{constructor(e){this.operatingContext=e,this.isBrowserEnvironment=this.operatingContext.isBrowserEnvironment(),this.config=e.getConfig(),this.initialized=!1,this.logger=this.operatingContext.getLogger(),this.networkClient=this.config.system.networkClient,this.navigationClient=this.config.system.navigationClient,this.redirectResponse=new Map,this.hybridAuthCodeResponses=new Map,this.performanceClient=this.config.telemetry.client,this.browserCrypto=this.isBrowserEnvironment?new Ta(this.logger,this.performanceClient):Al,this.eventHandler=new SH(this.logger),this.browserStorage=this.isBrowserEnvironment?new sf(this.config.auth.clientId,this.config.cache,this.browserCrypto,this.logger,m2(this.config.auth),this.performanceClient):vH(this.config.auth.clientId,this.logger);const t={cacheLocation:_n.MemoryStorage,temporaryCacheLocation:_n.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};this.nativeInternalStorage=new sf(this.config.auth.clientId,t,this.browserCrypto,this.logger,void 0,this.performanceClient),this.tokenCache=new XH(this.config,this.browserStorage,this.logger,this.browserCrypto),this.activeSilentTokenRequests=new Map,this.trackPageVisibility=this.trackPageVisibility.bind(this),this.trackPageVisibilityWithMeasurement=this.trackPageVisibilityWithMeasurement.bind(this),this.listeningToStorageEvents=!1,this.handleAccountCacheChange=this.handleAccountCacheChange.bind(this)}static async createController(e,t){const r=new gu(e);return await r.initialize(t),r}trackPageVisibility(e){e&&(this.logger.info("Perf: Visibility change detected"),this.performanceClient.incrementFields({visibilityChangeCount:1},e))}async initialize(e){if(this.logger.trace("initialize called"),this.initialized){this.logger.info("initialize has already been called, exiting early.");return}if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, exiting early."),this.initialized=!0,this.eventHandler.emitEvent(fe.INITIALIZE_END);return}const t=(e==null?void 0:e.correlationId)||this.getRequestCorrelationId(),r=this.config.system.allowNativeBroker,o=this.performanceClient.startMeasurement(x.InitializeClientApplication,t);if(this.eventHandler.emitEvent(fe.INITIALIZE_START),r)try{this.nativeExtensionProvider=await Fr.createProvider(this.logger,this.config.system.nativeBrokerHandshakeTimeout,this.performanceClient)}catch(a){this.logger.verbose(a)}this.config.cache.claimsBasedCachingEnabled||(this.logger.verbose("Claims-based caching is disabled. Clearing the previous cache with claims"),await J(this.browserStorage.clearTokensAndKeysWithClaims.bind(this.browserStorage),x.ClearTokensAndKeysWithClaims,this.logger,this.performanceClient,t)(this.performanceClient,t)),this.initialized=!0,this.eventHandler.emitEvent(fe.INITIALIZE_END),o.end({allowNativeBroker:r,success:!0})}async handleRedirectPromise(e){if(this.logger.verbose("handleRedirectPromise called"),vT(this.initialized),this.isBrowserEnvironment){const t=e||"";let r=this.redirectResponse.get(t);return typeof r>"u"?(r=this.handleRedirectPromiseInternal(e),this.redirectResponse.set(t,r),this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise")):this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call"),r}return this.logger.verbose("handleRedirectPromise returns null, not browser environment"),null}async handleRedirectPromiseInternal(e){const t=this.getAllAccounts(),r=this.browserStorage.getCachedNativeRequest(),o=r&&Fr.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider)&&this.nativeExtensionProvider&&!e,a=o?r==null?void 0:r.correlationId:this.browserStorage.getTemporaryCache($e.CORRELATION_ID,!0)||"",c=this.performanceClient.startMeasurement(x.AcquireTokenRedirect,a);this.eventHandler.emitEvent(fe.HANDLE_REDIRECT_START,ce.Redirect);let d;if(o&&this.nativeExtensionProvider){this.logger.trace("handleRedirectPromise - acquiring token from native platform");const h=new ga(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,rt.handleRedirectPromise,this.performanceClient,this.nativeExtensionProvider,r.accountId,this.nativeInternalStorage,r.correlationId);d=J(h.handleRedirectPromise.bind(h),x.HandleNativeRedirectPromiseMeasurement,this.logger,this.performanceClient,c.event.correlationId)(this.performanceClient,c.event.correlationId)}else{this.logger.trace("handleRedirectPromise - acquiring token from web flow");const h=this.createRedirectClient(a);d=J(h.handleRedirectPromise.bind(h),x.HandleRedirectPromiseMeasurement,this.logger,this.performanceClient,c.event.correlationId)(e,c)}return d.then(h=>(h?(t.length<this.getAllAccounts().length?(this.eventHandler.emitEvent(fe.LOGIN_SUCCESS,ce.Redirect,h),this.logger.verbose("handleRedirectResponse returned result, login success")):(this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_SUCCESS,ce.Redirect,h),this.logger.verbose("handleRedirectResponse returned result, acquire token success")),c.end({success:!0,accountType:Mr(h.account)})):c.event.errorCode?c.end({success:!1}):c.discard(),this.eventHandler.emitEvent(fe.HANDLE_REDIRECT_END,ce.Redirect),h)).catch(h=>{const f=h;throw t.length>0?this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_FAILURE,ce.Redirect,null,f):this.eventHandler.emitEvent(fe.LOGIN_FAILURE,ce.Redirect,null,f),this.eventHandler.emitEvent(fe.HANDLE_REDIRECT_END,ce.Redirect),c.end({success:!1},f),h})}async acquireTokenRedirect(e){const t=this.getRequestCorrelationId(e);this.logger.verbose("acquireTokenRedirect called",t);const r=this.performanceClient.startMeasurement(x.AcquireTokenPreRedirect,t);r.add({accountType:Mr(e.account),scenarioId:e.scenarioId});const o=e.onRedirectNavigate;if(o)e.onRedirectNavigate=c=>{const d=typeof o=="function"?o(c):void 0;return d!==!1?r.end({success:!0}):r.discard(),d};else{const c=this.config.auth.onRedirectNavigate;this.config.auth.onRedirectNavigate=d=>{const h=typeof c=="function"?c(d):void 0;return h!==!1?r.end({success:!0}):r.discard(),h}}const a=this.getAllAccounts().length>0;try{iy(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0),a?this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_START,ce.Redirect,e):this.eventHandler.emitEvent(fe.LOGIN_START,ce.Redirect,e);let c;return this.nativeExtensionProvider&&this.canUseNative(e)?c=new ga(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,rt.acquireTokenRedirect,this.performanceClient,this.nativeExtensionProvider,this.getNativeAccountId(e),this.nativeInternalStorage,t).acquireTokenRedirect(e,r).catch(h=>{if(h instanceof Ur&&ia(h))return this.nativeExtensionProvider=void 0,this.createRedirectClient(t).acquireToken(e);if(h instanceof Cr)return this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createRedirectClient(t).acquireToken(e);throw this.browserStorage.setInteractionInProgress(!1),h}):c=this.createRedirectClient(t).acquireToken(e),await c}catch(c){throw r.end({success:!1},c),a?this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_FAILURE,ce.Redirect,null,c):this.eventHandler.emitEvent(fe.LOGIN_FAILURE,ce.Redirect,null,c),c}}acquireTokenPopup(e){const t=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(x.AcquireTokenPopup,t);r.add({scenarioId:e.scenarioId,accountType:Mr(e.account)});try{this.logger.verbose("acquireTokenPopup called",t),qc(this.initialized,r),this.browserStorage.setInteractionInProgress(!0)}catch(c){return Promise.reject(c)}const o=this.getAllAccounts();o.length>0?this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_START,ce.Popup,e):this.eventHandler.emitEvent(fe.LOGIN_START,ce.Popup,e);let a;return this.canUseNative(e)?a=this.acquireTokenNative({...e,correlationId:t},rt.acquireTokenPopup).then(c=>(this.browserStorage.setInteractionInProgress(!1),r.end({success:!0,isNativeBroker:!0,accountType:Mr(c.account)}),c)).catch(c=>{if(c instanceof Ur&&ia(c))return this.nativeExtensionProvider=void 0,this.createPopupClient(t).acquireToken(e);if(c instanceof Cr)return this.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createPopupClient(t).acquireToken(e);throw this.browserStorage.setInteractionInProgress(!1),c}):a=this.createPopupClient(t).acquireToken(e),a.then(c=>(o.length<this.getAllAccounts().length?this.eventHandler.emitEvent(fe.LOGIN_SUCCESS,ce.Popup,c):this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_SUCCESS,ce.Popup,c),r.end({success:!0,accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length,accountType:Mr(c.account)}),c)).catch(c=>(o.length>0?this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_FAILURE,ce.Popup,null,c):this.eventHandler.emitEvent(fe.LOGIN_FAILURE,ce.Popup,null,c),r.end({success:!1},c),Promise.reject(c)))}trackPageVisibilityWithMeasurement(){const e=this.ssoSilentMeasurement||this.acquireTokenByCodeAsyncMeasurement;e&&(this.logger.info("Perf: Visibility change detected in ",e.event.name),e.increment({visibilityChangeCount:1}))}async ssoSilent(e){var a,c;const t=this.getRequestCorrelationId(e),r={...e,prompt:e.prompt,correlationId:t};this.ssoSilentMeasurement=this.performanceClient.startMeasurement(x.SsoSilent,t),(a=this.ssoSilentMeasurement)==null||a.add({scenarioId:e.scenarioId,accountType:Mr(e.account)}),qc(this.initialized,this.ssoSilentMeasurement),(c=this.ssoSilentMeasurement)==null||c.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),this.logger.verbose("ssoSilent called",t),this.eventHandler.emitEvent(fe.SSO_SILENT_START,ce.Silent,r);let o;return this.canUseNative(r)?o=this.acquireTokenNative(r,rt.ssoSilent).catch(d=>{if(d instanceof Ur&&ia(d))return this.nativeExtensionProvider=void 0,this.createSilentIframeClient(r.correlationId).acquireToken(r);throw d}):o=this.createSilentIframeClient(r.correlationId).acquireToken(r),o.then(d=>{var h;return this.eventHandler.emitEvent(fe.SSO_SILENT_SUCCESS,ce.Silent,d),(h=this.ssoSilentMeasurement)==null||h.end({success:!0,isNativeBroker:d.fromNativeBroker,accessTokenSize:d.accessToken.length,idTokenSize:d.idToken.length,accountType:Mr(d.account)}),d}).catch(d=>{var h;throw this.eventHandler.emitEvent(fe.SSO_SILENT_FAILURE,ce.Silent,null,d),(h=this.ssoSilentMeasurement)==null||h.end({success:!1},d),d}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenByCode(e){const t=this.getRequestCorrelationId(e);this.logger.trace("acquireTokenByCode called",t);const r=this.performanceClient.startMeasurement(x.AcquireTokenByCode,t);qc(this.initialized,r),this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_BY_CODE_START,ce.Silent,e),r.add({scenarioId:e.scenarioId});try{if(e.code&&e.nativeAccountId)throw oe(nT);if(e.code){const o=e.code;let a=this.hybridAuthCodeResponses.get(o);return a?(this.logger.verbose("Existing acquireTokenByCode request found",t),r.discard()):(this.logger.verbose("Initiating new acquireTokenByCode request",t),a=this.acquireTokenByCodeAsync({...e,correlationId:t}).then(c=>(this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_BY_CODE_SUCCESS,ce.Silent,c),this.hybridAuthCodeResponses.delete(o),r.end({success:!0,isNativeBroker:c.fromNativeBroker,accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length,accountType:Mr(c.account)}),c)).catch(c=>{throw this.hybridAuthCodeResponses.delete(o),this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_BY_CODE_FAILURE,ce.Silent,null,c),r.end({success:!1},c),c}),this.hybridAuthCodeResponses.set(o,a)),await a}else if(e.nativeAccountId)if(this.canUseNative(e,e.nativeAccountId)){const o=await this.acquireTokenNative({...e,correlationId:t},rt.acquireTokenByCode,e.nativeAccountId).catch(a=>{throw a instanceof Ur&&ia(a)&&(this.nativeExtensionProvider=void 0),a});return r.end({accountType:Mr(o.account),success:!0}),o}else throw oe(rT);else throw oe(tT)}catch(o){throw this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_BY_CODE_FAILURE,ce.Silent,null,o),r.end({success:!1},o),o}}async acquireTokenByCodeAsync(e){var o;return this.logger.trace("acquireTokenByCodeAsync called",e.correlationId),this.acquireTokenByCodeAsyncMeasurement=this.performanceClient.startMeasurement(x.AcquireTokenByCodeAsync,e.correlationId),(o=this.acquireTokenByCodeAsyncMeasurement)==null||o.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),await this.createSilentAuthCodeClient(e.correlationId).acquireToken(e).then(a=>{var c;return(c=this.acquireTokenByCodeAsyncMeasurement)==null||c.end({success:!0,fromCache:a.fromCache,isNativeBroker:a.fromNativeBroker}),a}).catch(a=>{var c;throw(c=this.acquireTokenByCodeAsyncMeasurement)==null||c.end({success:!1},a),a}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenFromCache(e,t){switch(this.performanceClient.addQueueMeasurement(x.AcquireTokenFromCache,e.correlationId),t){case On.Default:case On.AccessToken:case On.AccessTokenAndRefreshToken:const r=this.createSilentCacheClient(e.correlationId);return J(r.acquireToken.bind(r),x.SilentCacheClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw Y(so)}}async acquireTokenByRefreshToken(e,t){switch(this.performanceClient.addQueueMeasurement(x.AcquireTokenByRefreshToken,e.correlationId),t){case On.Default:case On.AccessTokenAndRefreshToken:case On.RefreshToken:case On.RefreshTokenAndNetwork:const r=this.createSilentRefreshClient(e.correlationId);return J(r.acquireToken.bind(r),x.SilentRefreshClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw Y(so)}}async acquireTokenBySilentIframe(e){this.performanceClient.addQueueMeasurement(x.AcquireTokenBySilentIframe,e.correlationId);const t=this.createSilentIframeClient(e.correlationId);return J(t.acquireToken.bind(t),x.SilentIframeClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e)}async logout(e){const t=this.getRequestCorrelationId(e);return this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.",t),this.logoutRedirect({correlationId:t,...e})}async logoutRedirect(e){const t=this.getRequestCorrelationId(e);return iy(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0),this.createRedirectClient(t).logout(e)}logoutPopup(e){try{const t=this.getRequestCorrelationId(e);return Em(this.initialized),this.browserStorage.setInteractionInProgress(!0),this.createPopupClient(t).logout(e)}catch(t){return Promise.reject(t)}}async clearCache(e){if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, returning early.");return}const t=this.getRequestCorrelationId(e);return this.createSilentCacheClient(t).logout(e)}getAllAccounts(e){return yH(this.logger,this.browserStorage,this.isBrowserEnvironment,e)}getAccount(e){return CH(e,this.logger,this.browserStorage)}getAccountByUsername(e){return EH(e,this.logger,this.browserStorage)}getAccountByHomeId(e){return wH(e,this.logger,this.browserStorage)}getAccountByLocalId(e){return TH(e,this.logger,this.browserStorage)}setActiveAccount(e){bH(e,this.browserStorage)}getActiveAccount(){return IH(this.browserStorage)}async hydrateCache(e,t){this.logger.verbose("hydrateCache called");const r=Ot.createFromAccountInfo(e.account,e.cloudGraphHostName,e.msGraphHost);return this.browserStorage.setAccount(r),e.fromNativeBroker?(this.logger.verbose("Response was from native broker, storing in-memory"),this.nativeInternalStorage.hydrateCache(e,t)):this.browserStorage.hydrateCache(e,t)}async acquireTokenNative(e,t,r){if(this.logger.trace("acquireTokenNative called"),!this.nativeExtensionProvider)throw oe(Hs);return new ga(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,t,this.performanceClient,this.nativeExtensionProvider,r||this.getNativeAccountId(e),this.nativeInternalStorage,e.correlationId).acquireToken(e)}canUseNative(e,t){if(this.logger.trace("canUseNative called"),!Fr.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,e.authenticationScheme))return this.logger.trace("canUseNative: isNativeAvailable returned false, returning false"),!1;if(e.prompt)switch(e.prompt){case Ut.NONE:case Ut.CONSENT:case Ut.LOGIN:this.logger.trace("canUseNative: prompt is compatible with native flow");break;default:return this.logger.trace(`canUseNative: prompt = ${e.prompt} is not compatible with native flow, returning false`),!1}return!t&&!this.getNativeAccountId(e)?(this.logger.trace("canUseNative: nativeAccountId is not available, returning false"),!1):!0}getNativeAccountId(e){const t=e.account||this.getAccount({loginHint:e.loginHint,sid:e.sid})||this.getActiveAccount();return t&&t.nativeAccountId||""}createPopupClient(e){return new $H(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createRedirectClient(e){return new WH(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createSilentIframeClient(e){return new JH(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,rt.ssoSilent,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createSilentCacheClient(e){return new TT(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)}createSilentRefreshClient(e){return new QH(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)}createSilentAuthCodeClient(e){return new e$(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,rt.acquireTokenByCode,this.performanceClient,this.nativeExtensionProvider,e)}addEventCallback(e,t){return this.eventHandler.addEventCallback(e,t)}removeEventCallback(e){this.eventHandler.removeEventCallback(e)}addPerformanceCallback(e){return _T(),this.performanceClient.addPerformanceCallback(e)}removePerformanceCallback(e){return this.performanceClient.removePerformanceCallback(e)}enableAccountStorageEvents(){typeof window>"u"||(this.listeningToStorageEvents?this.logger.verbose("Account storage listener already registered."):(this.logger.verbose("Adding account storage listener."),this.listeningToStorageEvents=!0,window.addEventListener("storage",this.handleAccountCacheChange)))}disableAccountStorageEvents(){typeof window>"u"||(this.listeningToStorageEvents?(this.logger.verbose("Removing account storage listener."),window.removeEventListener("storage",this.handleAccountCacheChange),this.listeningToStorageEvents=!1):this.logger.verbose("No account storage listener registered."))}handleAccountCacheChange(e){var t;try{(t=e.key)!=null&&t.includes(Dt.ACTIVE_ACCOUNT_FILTERS)&&this.eventHandler.emitEvent(fe.ACTIVE_ACCOUNT_CHANGED);const r=e.newValue||e.oldValue;if(!r)return;const o=JSON.parse(r);if(typeof o!="object"||!Ot.isAccountEntity(o))return;const c=Ea.toObject(new Ot,o).getAccountInfo();!e.oldValue&&e.newValue?(this.logger.info("Account was added to cache in a different window"),this.eventHandler.emitEvent(fe.ACCOUNT_ADDED,void 0,c)):!e.newValue&&e.oldValue&&(this.logger.info("Account was removed from cache in a different window"),this.eventHandler.emitEvent(fe.ACCOUNT_REMOVED,void 0,c))}catch{return}}getTokenCache(){return this.tokenCache}getLogger(){return this.logger}setLogger(e){this.logger=e}initializeWrapperLibrary(e,t){this.browserStorage.setWrapperMetadata(e,t)}setNavigationClient(e){this.navigationClient=e}getConfiguration(){return this.config}getPerformanceClient(){return this.performanceClient}isBrowserEnv(){return this.isBrowserEnvironment}getRequestCorrelationId(e){return e!=null&&e.correlationId?e.correlationId:this.isBrowserEnvironment?mo():B.EMPTY_STRING}async loginRedirect(e){const t=this.getRequestCorrelationId(e);return this.logger.verbose("loginRedirect called",t),this.acquireTokenRedirect({correlationId:t,...e||ny})}loginPopup(e){const t=this.getRequestCorrelationId(e);return this.logger.verbose("loginPopup called",t),this.acquireTokenPopup({correlationId:t,...e||ny})}async acquireTokenSilent(e){const t=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(x.AcquireTokenSilent,t);r.add({cacheLookupPolicy:e.cacheLookupPolicy,scenarioId:e.scenarioId}),qc(this.initialized,r),this.logger.verbose("acquireTokenSilent called",t);const o=e.account||this.getActiveAccount();if(!o)throw oe(Yw);r.add({accountType:Mr(o)});const a={clientId:this.config.auth.clientId,authority:e.authority||B.EMPTY_STRING,scopes:e.scopes,homeAccountIdentifier:o.homeAccountId,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid,shrOptions:e.shrOptions},c=JSON.stringify(a),d=this.activeSilentTokenRequests.get(c);if(typeof d>"u"){this.logger.verbose("acquireTokenSilent called for the first time, storing active request",t);const h=J(this.acquireTokenSilentAsync.bind(this),x.AcquireTokenSilentAsync,this.logger,this.performanceClient,t)({...e,correlationId:t},o).then(f=>(this.activeSilentTokenRequests.delete(c),r.end({success:!0,fromCache:f.fromCache,isNativeBroker:f.fromNativeBroker,cacheLookupPolicy:e.cacheLookupPolicy,accessTokenSize:f.accessToken.length,idTokenSize:f.idToken.length}),f)).catch(f=>{throw this.activeSilentTokenRequests.delete(c),r.end({success:!1},f),f});return this.activeSilentTokenRequests.set(c,h),{...await h,state:e.state}}else return this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call",t),r.discard(),{...await d,state:e.state}}async acquireTokenSilentAsync(e,t){const r=()=>this.trackPageVisibility(e.correlationId);this.performanceClient.addQueueMeasurement(x.AcquireTokenSilentAsync,e.correlationId),this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_START,ce.Silent,e),e.correlationId&&this.performanceClient.incrementFields({visibilityChangeCount:0},e.correlationId),document.addEventListener("visibilitychange",r);const o=await J(OH,x.InitializeSilentRequest,this.logger,this.performanceClient,e.correlationId)(e,t,this.config,this.performanceClient,this.logger),a=e.cacheLookupPolicy||On.Default;return this.acquireTokenSilentNoIframe(o,a).catch(async d=>{if(t$(d,a))if(this.activeIframeRequest)if(a!==On.Skip){const[f,g]=this.activeIframeRequest;this.logger.verbose(`Iframe request is already in progress, awaiting resolution for request with correlationId: ${g}`,o.correlationId);const v=this.performanceClient.startMeasurement(x.AwaitConcurrentIframe,o.correlationId);v.add({awaitIframeCorrelationId:g});const p=await f;if(v.end({success:p}),p)return this.logger.verbose(`Parallel iframe request with correlationId: ${g} succeeded. Retrying cache and/or RT redemption`,o.correlationId),this.acquireTokenSilentNoIframe(o,a);throw this.logger.info(`Iframe request with correlationId: ${g} failed. Interaction is required.`),d}else return this.logger.warning("Another iframe request is currently in progress and CacheLookupPolicy is set to Skip. This may result in degraded performance and/or reliability for both calls. Please consider changing the CacheLookupPolicy to take advantage of request queuing and token cache.",o.correlationId),J(this.acquireTokenBySilentIframe.bind(this),x.AcquireTokenBySilentIframe,this.logger,this.performanceClient,o.correlationId)(o);else{let f;return this.activeIframeRequest=[new Promise(g=>{f=g}),o.correlationId],this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",o.correlationId),J(this.acquireTokenBySilentIframe.bind(this),x.AcquireTokenBySilentIframe,this.logger,this.performanceClient,o.correlationId)(o).then(g=>(f(!0),g)).catch(g=>{throw f(!1),g}).finally(()=>{this.activeIframeRequest=void 0})}else throw d}).then(d=>(this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_SUCCESS,ce.Silent,d),e.correlationId&&this.performanceClient.addFields({fromCache:d.fromCache,isNativeBroker:d.fromNativeBroker},e.correlationId),d)).catch(d=>{throw this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_FAILURE,ce.Silent,null,d),d}).finally(()=>{document.removeEventListener("visibilitychange",r)})}async acquireTokenSilentNoIframe(e,t){return Fr.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,e.authenticationScheme)&&e.account.nativeAccountId?(this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform"),this.acquireTokenNative(e,rt.acquireTokenSilent_silentFlow).catch(async r=>{throw r instanceof Ur&&ia(r)?(this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow"),this.nativeExtensionProvider=void 0,Y(so)):r})):(this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow"),J(this.acquireTokenFromCache.bind(this),x.AcquireTokenFromCache,this.logger,this.performanceClient,e.correlationId)(e,t).catch(r=>{if(t===On.AccessToken)throw r;return this.eventHandler.emitEvent(fe.ACQUIRE_TOKEN_NETWORK_START,ce.Silent,e),J(this.acquireTokenByRefreshToken.bind(this),x.AcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,t)}))}}function t$(n,e){const t=!(n instanceof Cr&&n.subError!==lu),r=n.errorCode===Mn.INVALID_GRANT_ERROR||n.errorCode===so,o=t&&r||n.errorCode===Pl||n.errorCode===sm,a=F2.includes(e);return o&&a}/*! @azure/msal-browser v3.28.1 2025-01-14 */async function n$(n,e){const t=new bi(n);return await t.initialize(),gu.createController(t,e)}/*! @azure/msal-browser v3.28.1 2025-01-14 */class Im{static async createPublicClientApplication(e){const t=await n$(e);return new Im(e,t)}constructor(e,t){this.controller=t||new gu(new bi(e))}async initialize(e){return this.controller.initialize(e)}async acquireTokenPopup(e){return this.controller.acquireTokenPopup(e)}acquireTokenRedirect(e){return this.controller.acquireTokenRedirect(e)}acquireTokenSilent(e){return this.controller.acquireTokenSilent(e)}acquireTokenByCode(e){return this.controller.acquireTokenByCode(e)}addEventCallback(e,t){return this.controller.addEventCallback(e,t)}removeEventCallback(e){return this.controller.removeEventCallback(e)}addPerformanceCallback(e){return this.controller.addPerformanceCallback(e)}removePerformanceCallback(e){return this.controller.removePerformanceCallback(e)}enableAccountStorageEvents(){this.controller.enableAccountStorageEvents()}disableAccountStorageEvents(){this.controller.disableAccountStorageEvents()}getAccount(e){return this.controller.getAccount(e)}getAccountByHomeId(e){return this.controller.getAccountByHomeId(e)}getAccountByLocalId(e){return this.controller.getAccountByLocalId(e)}getAccountByUsername(e){return this.controller.getAccountByUsername(e)}getAllAccounts(e){return this.controller.getAllAccounts(e)}handleRedirectPromise(e){return this.controller.handleRedirectPromise(e)}loginPopup(e){return this.controller.loginPopup(e)}loginRedirect(e){return this.controller.loginRedirect(e)}logout(e){return this.controller.logout(e)}logoutRedirect(e){return this.controller.logoutRedirect(e)}logoutPopup(e){return this.controller.logoutPopup(e)}ssoSilent(e){return this.controller.ssoSilent(e)}getTokenCache(){return this.controller.getTokenCache()}getLogger(){return this.controller.getLogger()}setLogger(e){this.controller.setLogger(e)}setActiveAccount(e){this.controller.setActiveAccount(e)}getActiveAccount(){return this.controller.getActiveAccount()}initializeWrapperLibrary(e,t){return this.controller.initializeWrapperLibrary(e,t)}setNavigationClient(e){this.controller.setNavigationClient(e)}getConfiguration(){return this.controller.getConfiguration()}async hydrateCache(e,t){return this.controller.hydrateCache(e,t)}clearCache(e){return this.controller.clearCache(e)}}const sh=process.env.JPLAN_WEBAPP__APP_PROXY_TENANT_NAME??"",r$=process.env.JPLAN_WEBAPP__APP_PROXY_CLIENT_ID??"",o$=process.env.JPLAN_WEBAPP__APP_PROXY_USER_FLOW??"",lf=process.env.JPLAN_WEBAPP__URL_AUTH??process.env.JPLAN_WEBAPP__URL_BASE??"",i$={auth:{clientId:r$,authority:`https://${sh}.b2clogin.com/${sh}.onmicrosoft.com/${o$}`,knownAuthorities:[`${sh}.b2clogin.com`],redirectUri:process.env.JPLAN_AUTOMATION_ENVIRONMENT?`${lf}/_/dashboard`:lf},cache:{cacheLocation:"localStorage",storeAuthStateInCookie:!1},system:{loggerOptions:{loggerCallback:(n,e)=>{n===et.Error&&console.error(e)},logLevel:et.Warning}}},ST=(n,e)=>({scopes:["https://graph.microsoft.com/.default","openid","profile"],redirectStartPage:`${lf}${n}`,extraQueryParameters:e}),zt=new Im(i$),uy=l.ref(null);function AT(){async function n(e){var t;if(e)try{const r=e.idTokenClaims;if(!(r!=null&&r.aud))throw new Error("User audience (aud) is missing in ID token claims");const o=localStorage.getItem(`msal.token.keys.${r.aud}`);if(!o)throw new Error(`Token keys para ${r.aud} não encontrados no localStorage`);const a=JSON.parse(o),c=(t=a==null?void 0:a.idToken)==null?void 0:t[0];if(!c)throw new Error("idToken não encontrado nos token keys");const d=localStorage.getItem(c);if(!d)throw new Error(`Dados do token para ID ${c} não encontrados no localStorage`);const h=JSON.parse(d),f=h==null?void 0:h.secret;if(!f)throw new Error("Secret não encontrado nos dados do token");sessionStorage.setItem("isAuthenticated","true"),uy.value=f}catch(r){console.error("Erro ao obter token de acesso:",r)}}return{jToken:uy,setJToken:n}}let Yc=null;const er=l.ref(null),ji=l.ref(null),kT=l.ref(Math.floor(Date.now()/1e3));uf.useIntervalFn(()=>a$(),1e3);function a$(){var r,o;if(!((o=(r=er.value)==null?void 0:r.idTokenClaims)!=null&&o.exp))return;const n=Math.floor(Date.now()/1e3),e=300,t=er.value.idTokenClaims.exp;kT.value=t-n-e}function Sm(){if(Yc)return Yc;const{setJToken:n,jToken:e}=AT(),t=l.computed(()=>!!er.value),r=l.computed(()=>er.value);let o;async function a(p,w){if(!t.value)switch(p){case"redirect":if(w){o=w,await h();break}case"tab":default:await c();break}}const c=async()=>new Promise((p,w)=>{try{localStorage.clear();const C=process.env.JPLAN_WEBAPP__URL_AUTH,T=window.open(C);if(!T){console.error("Failed to open authentication window"),w("Failed to open authentication window");return}const k=Date.now(),I=6e4,N=setInterval(()=>{if(Date.now()-k>I||T.closed){clearInterval(N),console.error("Authentication canceled or timeout reached."),w("Authentication canceled or timeout reached.");return}Object.keys(localStorage).some(L=>L.startsWith("msal.account.keys"))&&(clearInterval(N),d(),T.close(),p())},500)}catch(C){console.error("Error in handleRedirect:",C),w(C)}}),d=async()=>{try{await zt.initialize();const p=zt.getActiveAccount();if(p)er.value=p;else{const w=await zt.handleRedirectPromise();w?(zt.setActiveAccount(w.account),er.value=zt.getActiveAccount()):console.error("Falha na autenticação")}}catch(p){console.error("Erro no processo de autenticação:",p)}er.value&&await n(er.value)},h=async()=>{try{await zt.initialize();const p=await zt.handleRedirectPromise();if(!p||zt.getAllAccounts().length===0){const w=ST(o);await zt.loginRedirect(w);return}zt.setActiveAccount(p.account),er.value=zt.getActiveAccount(),er.value&&await n(er.value),ji.value="updated"}catch(p){console.error("handleRedirect failed",p)}};async function f(){_e.value=!0,ji.value="updating";try{const p=await zt.acquireTokenSilent({scopes:["https://graph.microsoft.com/.default","openid","profile"]});zt.setActiveAccount(p.account),await n(er.value),ji.value="updated"}catch(p){console.error("Failed to refresh token, forcing new login.",p),ji.value="error",localStorage.clear(),window.location.reload()}_e.value=!1}const g=async()=>{try{await zt.initialize(),localStorage.clear(),await zt.logoutRedirect({postLogoutRedirectUri:"/"})}catch(p){console.error("Logout error",p)}};l.watch(kT,async p=>{p<=0&&ji.value==="updated"&&await f()});const v=l.computed(()=>e.value);return Yc={isAuthenticated:t,authState:ji,account:r,token:v,refreshToken:f,handleRedirect:a,logout:g},Yc}const{jToken:dy}=AT(),Am=()=>{const n=ut.create({headers:{"Content-Type":"application/json"}});l.watch(dy,o=>{n.interceptors.request.use(a=>(o&&(a.headers.Authorization=`Bearer ${o}`),a))},{immediate:!0});let e=1;n.interceptors.response.use(async o=>o,async o=>{var a;if(o.config&&o.config.headers){const c=o.config;if(((a=o.response)==null?void 0:a.status)===401&&e>0){e--;try{return c.headers.Authorization=`Bearer ${dy.value}`,await n(c)}catch(d){return Promise.reject(d)}}}return Promise.reject(o)});async function t({url:o,method:a,header:c={},body:d,baseURL:h}){try{return h&&(n.defaults.baseURL=h),(await n({url:o,method:a,headers:c,data:d})).data}catch(f){if(console.error(`Request error [${a} ${o}]:`,f),ut.isAxiosError(f)){const{response:g,message:v}=f;throw new Error(`Axios error: ${v}, Status: ${g==null?void 0:g.status}, URL: ${o}`)}throw f}}async function r({url:o,method:a,header:c,body:d,baseURL:h}){try{h&&(n.defaults.baseURL=h);const f=await n({url:o,method:a,headers:c,data:d});return{status:f.status,header:f.headers,body:f.data}}catch(f){if(ut.isAxiosError(f)){const{response:g,message:v}=f;console.error(`Raw Request Error: ${v}, Status: ${g==null?void 0:g.status}`)}return Promise.reject(f)}}return Object.assign(n,{_request:t,rawRequest:r})},{request:hy}=Am(),fy=l.ref(null),my=l.ref("default"),ch=l.ref(null),lh=l.ref({scope_type:"org"});function pu(){var v,p;const{handleRedirect:n,account:e,logout:t}=Sm();(p=(v=e.value)==null?void 0:v.idTokenClaims)==null||p.domain;const r=l.computed(()=>{var w,C;return{domain:(C=(w=e.value)==null?void 0:w.idTokenClaims)==null?void 0:C.domain,environment:my.value,...lh.value}}),o=l.computed(()=>lh.value);async function a(){var w;(!e.value||!((w=e.value.idTokenClaims)!=null&&w.email))&&await n();try{await c(),await d()}catch{}}async function c(){var w,C;try{const T=(C=(w=e.value)==null?void 0:w.idTokenClaims)==null?void 0:C.email;if(!T)throw new Error("Email is undefined");const k=await hy({url:`https://api.jplan.com.br/platform/user/profile/?email=${T}`,method:"GET"});ch.value=k.data??null}catch(T){console.error("Failed to fetch user profile:",T)}}async function d(){var w;try{if(!((w=ch.value)!=null&&w.email))throw new Error("User email is undefined");const C=await hy({url:"https://api.jplan.com.br/platform/user/domain/",method:"GET"});fy.value=C.data.data??[]}catch(C){console.error("Failed to fetch user domains:",C)}}function h(w){lh.value=w}function f(w){my.value=w,h(r.value)}async function g(w,C){const T=ST(w,{request_domain:C});await zt.loginRedirect(T)}return{__init__:a,user:ch,userDomains:fy,setEnv:f,setScope:h,changeDomain:g,session:r,scope:o,logout:t}}const s$={path:"/_/dashboard",component:()=>Promise.resolve().then(()=>require("./AuthRoute-BukX2xM4.js")),meta:{requiresAuth:!1}},c$={path:"/jplan-auth-fail",component:()=>Promise.resolve().then(()=>require("./AuthFailRoute-300Chibi.js")),meta:{requiresAuth:!1}},{isAuthenticated:gy,handleRedirect:l$}=Sm(),u$=pu();function d$(n,e){n.addRoute(s$),n.addRoute(c$),n.beforeEach(async(t,r,o)=>{function a(d){return d.matched.some(h=>h.meta.requiresAuth)}if(!a(t))return o();if(!gy.value){_e.value=!0;try{await l$(e,t.fullPath),await u$.__init__()}catch(d){console.error("Fail to authenticate",d),await n.push("/jplan-auth-fail")}_e.value=!1}if(gy.value){if(localStorage.getItem("returnRoute")&&localStorage.getItem("returnRoute")!==null){const d=localStorage.getItem("returnRoute")??"/";console.log("trying to go to saved route:",d),o(d),localStorage.removeItem("returnRoute");return}o()}})}const{scope:py}=pu();function h$(){const n=Am(),e=l.ref({scope_type:"org"});async function t(r){e.value=r}return l.watch(py,()=>{n.interceptors.request.use(r=>{const o=r.headers,a=o.Authorization;a&&(o.Authorization=a);const c=py.value;return c&&(c.scope_type&&(o["j-scope-type"]=c.scope_type,c.organization&&(o["j-scope-organization"]=c.organization),c.team&&(o["j-scope-team"]=c.team)),c.environment&&(o["j-scope-environment"]=c.environment)),r})},{immediate:!0}),Object.assign(n,{setScope:t,scope:e})}function Pa(n){const e=h$();e.defaults.baseURL=n;const t=l.ref({scope_type:"org"});async function r(o){t.value=o}return l.watch(t,()=>{e.interceptors.request.use(o=>{const a=t.value;return delete o.headers["j-scope-type"],delete o.headers["j-scope-organization"],delete o.headers["j-scope-team"],a!=null&&a.scope_type&&(o.headers["j-scope-type"]=a.scope_type),a!=null&&a.organization&&(o.headers["j-scope-organization"]=a.organization),a!=null&&a.team&&(o.headers["j-scope-team"]=a.team),o})},{immediate:!0}),Object.assign(e,{setScope:r,scope:t})}function f$(){const n=Pa("https://api.jplan.com.br/management/organization"),{error:e}=Er();return{async getOrgList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error)throw e("Failed to fetch Organization list"),new Error(o.data.error);return o.data.data}catch(r){console.error("Error in getOrgList:",r),e("Failed to fetch Organization list");return}},async createOrg(t){var r,o;try{const a=await n.post("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){throw console.error("Error in createOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to create Organization"),a}},async updateOrg(t){var r,o;try{const a=await n.patch("/item",t);if(a.data.error)throw e("Failed to update Organization"),new Error(a.data.error);return a}catch(a){throw console.error("Error in updateOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to update Organization"),a}},async getOrg(t){var r,o;try{const a=await n.get(`/item/${t}`);if(a.data.error)throw e("Failed to fetch Organization"),new Error(a.data.error);return a.data}catch(a){throw console.error("Error in getOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to fetch Organization"),a}},async activateOrg(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error)throw e("Failed to activate Organization"),new Error(a.data.error)}catch(a){throw console.error("Error in activateOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to activate Organization"),a}},async deactivateOrg(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error)throw e("Failed to deactivate Organization"),new Error(a.data.error)}catch(a){throw console.error("Error in deactivateOrg:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to deactivate Organization"),a}}}}const Lo=f$();function m$(){const n=Pa("https://api.jplan.com.br/management/branch/"),{error:e}=Er();return{async getBranchList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error){e("Failed to fetch Branch list");return}return o.data.data}catch(r){console.error("Error in getBranchList:",r),e("Failed to fetch Branch list")}},async createBranch(t){var r,o;try{const a=await n.post("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){console.error("Error in createBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to create Branch")}},async updateBranch(t){var r,o;try{const a=await n.patch("/item",t);if(a.data.error){e(a.data.error||"Failed to update Branch");return}return a}catch(a){console.error("Error in updateBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to update Branch")}},async getBranch(t){var r,o;try{const a=await n.get(`/item/${t}`);if(a.data.error){e(a.data.error||"Failed to fetch Branch");return}return a.data}catch(a){console.error("Error in getBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to fetch Branch")}},async activateBranch(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error){e(a.data.error||"Failed to activate Branch");return}}catch(a){console.error("Error in activateBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to activate Branch")}},async deactivateBranch(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error){e(a.data.error||"Failed to deactivate Branch");return}}catch(a){console.error("Error in deactivateBranch:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to deactivate Branch")}}}}const xo=m$();function g$(){const n=Pa("https://api.jplan.com.br/management/team"),{error:e}=Er();return{async getTeamList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error)throw e("Failed to fetch Team list"),new Error(o.data.error);return o.data.data}catch(r){console.error("Error in getTeamList:",r),e("Failed to fetch Team list");return}},async createTeam(t){var r,o;try{const a=await n.post("/item",t);if(a.data.error)throw e("Failed to create Team"),new Error(a.data.error);return a}catch(a){throw console.error("Error in createTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to create Team"),a}},async updateTeam(t){var r,o;try{const a=await n.patch("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){throw console.error("Error in updateTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to update Team"),a}},async getTeam(t){var r,o;try{const a=await n.get(`/item/${t}`);return a.data.error&&e("Failed to fetch Team"),a.data}catch(a){console.error("Error in getTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to fetch Team");return}},async activateTeam(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error)throw e("Failed to activate Team"),new Error(a.data.error)}catch(a){throw console.error("Error in activateTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to activate Team"),a}},async deactivateTeam(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error)throw e("Failed to deactivate Team"),new Error(a.data.error)}catch(a){throw console.error("Error in deactivateTeam:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to deactivate Team"),a}},async getTeamUserList(t,r){try{const o=r?`?filter_query=${r}`:"",a=await n.get(`/item/${t}/user/list/${o}`);if(a.data.error)throw e("Failed to fetch Team User list"),new Error(a.data.error);return a.data.data}catch(o){console.error("Error in getTeamUserList:",o),e("Failed to fetch Team User list");return}},async linkManageUser(t,r){try{const o=await n.post(`/item/${t}/user/item/`,r);if(o.data.error)throw e("Failed to link User"),new Error(o.data.error);return o.data}catch(o){console.error("Error in link User:",o),e("Failed to link User");return}},async updateManageUser(t,r){try{const o=await n.patch(`/item/${t}/user/item/`,r);if(o.data.error)throw e("Failed to update User"),new Error(o.data.error);return o.data.data}catch(o){throw console.error("Error in update User:",o),e("Failed to update User"),o}},async getManageUser(t,r,o){try{const a=o?`?filter_query=${o}`:"",c=await n.get(`/item/${t}/user/item/${r}/${a}`);if(c.data.error)throw e("Failed to fetch User"),new Error(c.data.error);return c.data.data}catch(a){console.error("Error in getUser:",a),e("Failed to fetch User");return}},async unlinkManageUser(t,r,o){try{const a=o?`?filter_query=${o}`:"";await n.delete(`/item/${t}/user/item/${r}/${a}`)}catch(a){throw console.error("Error in unlink User:",a),e("Failed to unlink User"),a}}}}const Pn=g$();let jc=!1;const uh=l.ref(!1),qn=l.ref([]),_y=l.ref([]),ht=l.ref(null),Ji=l.ref([]),Qi=l.ref([]),NT=()=>{const n=Er(),e=async C=>{uh.value=!0;const T=C?`_active eq true and ${C}`:"_active eq true",k=await Lo.getOrgList(T);k&&(qn.value=k,jc=!0),uh.value=!1},t=async C=>{var T;return(T=qn.value)!=null&&T.length||await e(C),qn.value};function r(C){if(!qn.value)throw new Error("Data not stored yet");const T=Na(qn.value,C,["name","description"]);return C!==""?T:qn.value}const o=C=>{_y.value=C},a=C=>{ht.value=ka.cloneDeep(C)},c=async C=>await Lo.getOrg(C),d=async()=>{if(ht.value!=null){const C=await Lo.createOrg(ht.value);return C!=null&&C.data.created_at&&(n.success("Organization created."),jc&&qn.value.push(C.data)),C==null?void 0:C.data}},h=async()=>{if(_e.value=!0,ht.value&&ht.value.__id){const C=await Lo.updateOrg(ht.value);if(jc&&(C!=null&&C.data.__id)){const T=qn.value.findIndex(k=>k.__id===C.data.__id);return T!==-1?(qn.value[T]=C.data,n.success("Organization updated.")):n.error("Unable to update item"),_e.value=!1,C.data}}else _e.value=!1,n.error("Unable to update item")},f=async()=>{if(_e.value=!0,ht.value&&ht.value.created_at){if(await Lo.deactivateOrg(ht.value.__id),jc){const C=qn.value.findIndex(T=>{var k;return T.__id===((k=ht.value)==null?void 0:k.__id)});if(C!==-1)return qn.value.splice(C,1),ht.value;n.error("Unable to deactivate organization")}_e.value=!1}};async function g(C){_e.value=!0;try{if(ht.value&&ht.value.__id){const T={...C,organization:ht.value.__id};if(!await xo.updateBranch(T)){_e.value=!1;return}if(Ji.value.findIndex(N=>N.__id===C.__id)===-1)return n.success("Branch added successfully."),Ji.value.push(T),T;n.info("Branch already added.")}}catch(T){console.error(T)}finally{_e.value=!1}}async function v(C){if(_e.value=!0,ht.value&&ht.value.__id){const T={...C,organization:null};if(!await xo.updateBranch(T)){_e.value=!1;return}const I=Ji.value.findIndex(N=>N.__id===C.__id);if(I!==-1)return Ji.value.splice(I,1),_e.value=!1,Ji.value;throw new Error("Item not found to remove")}_e.value=!1}async function p(C){_e.value=!0;try{if(ht.value&&ht.value.__id){const T={...C,organization:ht.value.__id};if(!await Pn.updateTeam(T)){_e.value=!1;return}if(Qi.value.findIndex(N=>N.__id===C.__id)===-1)return n.success("Team added successfully."),Qi.value.push(T),T;n.info("Team already added.")}}catch(T){console.error(T)}finally{_e.value=!1}}async function w(C){if(_e.value=!0,ht.value&&ht.value.__id){const T={...C,organization:null};if(!await Pn.updateTeam(T)){_e.value=!1;return}const I=Qi.value.findIndex(N=>N.__id===C.__id);if(I!==-1)return Qi.value.splice(I,1),_e.value=!1,Qi.value;throw new Error("Item not found to remove")}_e.value=!1}return{data:qn,loading:uh,columns:_y,item:ht,filterData:r,__init__:e,getData:t,setColumns:o,setItem:a,getItem:c,createItem:d,updateItem:h,removeItem:f,orgBranches:Ji,orgTeams:Qi,linkBranch:g,unlinkBranch:v,linkTeam:p,unlinkTeam:w}};let Jc=!1;const Yn=l.ref([]),vy=l.ref([]),kt=l.ref(null),dh=l.ref(!1),Xi=l.ref([]),RT=()=>{const n=Er(),e=async p=>{dh.value=!0;const w=p?`_active eq true and ${p}`:"_active eq true",C=await Pn.getTeamList(w);C&&(Yn.value=C,Jc=!0),dh.value=!1},t=async p=>(Yn.value.length||await e(p),Yn.value);function r(p){if(!Yn.value)throw new Error("Data not stored yet");const w=Na(Yn.value,p,["name","description"]);return p!==""?w:Yn.value}const o=p=>{vy.value=p},a=p=>{kt.value=ka.cloneDeep(p)},c=async p=>await Pn.getTeam(p),d=async()=>{if(kt.value!=null){const p=await Pn.createTeam(kt.value);return p!=null&&p.data.created_at&&(n.success("Team created."),Jc&&Yn.value.push(p.data)),p==null?void 0:p.data}},h=async()=>{if(_e.value=!0,kt.value&&kt.value.__id){const p=await Pn.updateTeam(kt.value);if(Jc&&(p!=null&&p.data.__id)){const w=Yn.value.findIndex(C=>C.__id===p.data.__id);return w!==-1?(Yn.value[w]=p.data,n.success("Team updated.")):n.error("Unable to update item"),p.data}}else n.error("Unable to update item")},f=async()=>{if(kt.value&&kt.value.created_at&&(await Pn.deactivateTeam(kt.value.__id),Jc)){const p=Yn.value.findIndex(w=>{var C;return w.__id===((C=kt.value)==null?void 0:C.__id)});if(p!==-1)return Yn.value.splice(p,1),kt.value;n.error("Unable to deactivate organization")}};async function g(p){var w;if(_e.value=!0,(w=kt.value)!=null&&w.__id)if(Xi.value.findIndex(T=>T.__id===p.__id)===-1)try{const T=await Pn.linkManageUser(kt.value.__id,{team:kt.value.__id,user:p.__id,role:"string",joined_at:"string",comments:"string"}),k=await Pn.getTeamUserList(kt.value.__id);return k&&(Xi.value=k),n.success("User added successfully."),T}catch(T){console.error(T),n.error("Unable to add User.")}finally{_e.value=!1}else n.info("User already added.");else console.warn("No item selected or item ID is missing."),n.info("Please select a valid item.");_e.value=!1}async function v(p){if(_e.value=!0,kt.value&&kt.value.__id){const w=Xi.value.findIndex(C=>C.__id===p);if(w!==-1)return await Pn.unlinkManageUser(kt.value.__id,p),Xi.value.splice(w,1),_e.value=!1,Xi.value;throw new Error("Item not found to remove")}_e.value=!1}return{data:Yn,loading:dh,columns:vy,item:kt,usersTeam:Xi,__init__:e,getData:t,filterData:r,setColumns:o,setItem:a,getItem:c,createItem:d,updateItem:h,removeItem:f,linkUser:g,unlinkUser:v}},OT=l.defineComponent({__name:"GlobalScopeFilter",setup(n){var T,k,I;const{openDialog:e}=Os("global-scope__J-"),{user:t,scope:r,session:o,setScope:a}=pu(),{getData:c,data:d}=NT(),{getData:h,data:f}=RT(),g=l.ref(!1);l.onBeforeMount(async()=>{g.value=!0,await c(),await h(),g.value=!1});const v=l.ref({scope_type:(T=r.value)==null?void 0:T.scope_type,organization:((k=r.value)==null?void 0:k.organization)??"org",team:(I=r.value)==null?void 0:I.team});function p(){var N,O,L;v.value={...r.value,scope_type:(N=r.value)==null?void 0:N.scope_type,organization:((O=r.value)==null?void 0:O.organization)??"",team:(L=r.value)==null?void 0:L.team},e()}const w=l.computed(()=>{var N;switch((N=r.value)==null?void 0:N.scope_type){case"user":return PB;case"org":return RB;case"team":return MB;default:return OB}});async function C(){var N;((N=r.value)==null?void 0:N.scope_type)!==""&&a(v.value)}return(N,O)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createVNode(ot.VBtn,{onClick:p,icon:"",class:"text-secondary",color:"surface",rounded:"sm",size:"small",variant:"flat"},{default:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(w.value),{size:"20"}))]),_:1}),l.createVNode(l.unref(Ms),{loading:g.value,title:"Scope","dd-id":"global-scope__J-",onOnSave:C},{default:l.withCtx(()=>[l.createElementVNode("div",null,[l.createVNode(Je.VRow,null,{default:l.withCtx(()=>[l.createVNode(Je.VCol,{cols:"4",class:"d-flex flex-row align-center"},{default:l.withCtx(()=>[l.createVNode(Jt.VListItem,null,{default:l.withCtx(()=>[l.createVNode(Jt.VListItemTitle,null,{default:l.withCtx(()=>O[3]||(O[3]=[l.createTextVNode(" User")])),_:1}),l.createVNode(Jt.VListItemSubtitle,null,{default:l.withCtx(()=>{var L;return[l.createTextVNode(l.toDisplayString(((L=l.unref(t))==null?void 0:L.name)||"Unknown"),1)]}),_:1})]),_:1})]),_:1}),l.createVNode(Je.VCol,{cols:"4"},{default:l.withCtx(()=>[l.createVNode(Jt.VListItem,null,{default:l.withCtx(()=>[l.createVNode(Jt.VListItemTitle,null,{default:l.withCtx(()=>O[4]||(O[4]=[l.createTextVNode(" Domain")])),_:1}),l.createVNode(Jt.VListItemSubtitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(o).domain),1)]),_:1})]),_:1})]),_:1}),l.createVNode(Je.VCol,{cols:"4"},{default:l.withCtx(()=>[l.createVNode(Jt.VListItem,null,{default:l.withCtx(()=>[l.createVNode(Jt.VListItemTitle,null,{default:l.withCtx(()=>O[5]||(O[5]=[l.createTextVNode(" Environment")])),_:1}),l.createVNode(Jt.VListItemSubtitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(l.unref(o).environment),1)]),_:1})]),_:1})]),_:1})]),_:1}),l.createVNode(yO.VBtnToggle,{density:"compact",variant:"outlined",modelValue:v.value.scope_type,"onUpdate:modelValue":O[0]||(O[0]=L=>v.value.scope_type=L),class:"d-flex justify-center my-4"},{default:l.withCtx(()=>[l.createVNode(ot.VBtn,{value:"org",label:"Organizational",color:"secondary",class:""},{default:l.withCtx(()=>O[6]||(O[6]=[l.createTextVNode("Organizational")])),_:1}),l.createVNode(ot.VBtn,{value:"team",label:"Team",color:"secondary",class:""},{default:l.withCtx(()=>O[7]||(O[7]=[l.createTextVNode("Team")])),_:1}),l.createVNode(ot.VBtn,{value:"user",label:"User",color:"secondary",class:""},{default:l.withCtx(()=>O[8]||(O[8]=[l.createTextVNode("User")])),_:1}),l.createVNode(ot.VBtn,{value:"",label:"None",color:"lightext",class:""},{default:l.withCtx(()=>O[9]||(O[9]=[l.createTextVNode("None")])),_:1})]),_:1},8,["modelValue"]),l.createElementVNode("div",null,[l.createVNode(_s.VLabel,{class:"text-subtitle-1 text-high-emphasis mb-2"},{default:l.withCtx(()=>O[10]||(O[10]=[l.createTextVNode("Organization")])),_:1}),l.createVNode(ss.VSelect,{items:l.unref(d),"item-title":"name","item-value":"__id",variant:"solo","bg-color":"containerBg",rounded:"false",placeholder:"Select a Organization",class:"min-w-50",modelValue:v.value.organization,"onUpdate:modelValue":O[1]||(O[1]=L=>v.value.organization=L),clearable:""},null,8,["items","modelValue"]),l.createVNode(_s.VLabel,{class:"text-subtitle-1 text-high-emphasis mb-2"},{default:l.withCtx(()=>O[11]||(O[11]=[l.createTextVNode("Team")])),_:1}),l.createVNode(ss.VSelect,{items:l.unref(f),"item-title":"name","item-value":"__id",variant:"solo","bg-color":"containerBg",rounded:"false",placeholder:"Select a Team",class:"min-w-50",modelValue:v.value.team,"onUpdate:modelValue":O[2]||(O[2]=L=>v.value.team=L),clearable:""},null,8,["items","modelValue"])])])]),_:1},8,["loading"])],64))}}),p$={},_$={class:"double-ring-spinner-container"};function v$(n,e){return l.openBlock(),l.createElementBlock("div",_$,e[0]||(e[0]=[l.createElementVNode("div",{class:"spinner-loading"},[l.createElementVNode("div"),l.createElementVNode("div"),l.createElementVNode("div",null,[l.createElementVNode("div")]),l.createElementVNode("div",null,[l.createElementVNode("div")])],-1)]))}const PT=ba(p$,[["render",v$],["__scopeId","data-v-00d7a69f"]]),y$={key:0,class:"_jspinner-overlay_jj"},MT=l.defineComponent({__name:"GlobalSpinner",setup(n){return(e,t)=>l.unref(_e)?(l.openBlock(),l.createElementBlock("div",y$,t[0]||(t[0]=[l.createElementVNode("div",{class:"j-double-ring-spinner-container"},[l.createElementVNode("div",{class:"j-global-spinner-loading"},[l.createElementVNode("div"),l.createElementVNode("div"),l.createElementVNode("div",null,[l.createElementVNode("div")]),l.createElementVNode("div",null,[l.createElementVNode("div")])])],-1)]))):l.createCommentVNode("",!0)}}),DT=l.defineComponent({__name:"SubMenu",props:{title:{}},setup(n,{expose:e}){return e({props:n}),(r,o)=>(l.openBlock(),l.createBlock(Jt.VListItem,{onClick:o[0]||(o[0]=()=>{}),density:"compact"},{append:l.withCtx(()=>[l.createVNode(l.unref(DB))]),default:l.withCtx(()=>[l.createVNode(Jt.VListItemTitle,null,{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(r.title),1)]),_:1}),l.createVNode(hf.VMenu,{activator:"parent","open-on-hover":"",submenu:"",density:"compact"},{default:l.withCtx(()=>[l.renderSlot(r.$slots,"default")]),_:3})]),_:3}))}}),C$=Object.freeze(Object.defineProperty({__proto__:null,AvatarPicture:aC,ColumnSettingsDialog:Df,ConfirmDialog:oC,ContextMenu:sC,CopyButton:xl,DeleteAllBtn:_f,DotsMenu:rC,EditButton:nC,FormHeadless:BE,FormMetadata:nu,GlobalScopeFilter:OT,GlobalSpinner:MT,JAvatar:iC,JBtn:Iy,JDialog:Ms,JForm:UE,JIconBtn:by,JSelect:ME,JTextArea:DE,JTextField:cE,ParentCard:Hl,SearchFilter:Yl,SpinnerLoader:PT,SubMenu:DT,TabFormHeader:FE,TableAdvanced:zC,TableCard:Lf,TableCardsView:aE,TableHeader:GC,UiTable:cC},Symbol.toStringTag,{value:"Module"})),E$=YO(),w$={transition:"Vue-Toastification__fade",maxToasts:20,newestOnTop:!0},T$={"pt-BR":{placeholders:{selectFilter:"Selecionar filtro",visualize:"Visualizar",actions:"Ações",search:"Pesquisar"},dialogs:{columnSettings:{title:"Configurações de coluna"}},actions:{save:"Salvar",cancel:"Cancelar",edit:"Editar",delete:"Deletar",disable:"Desabilitar",back:"Voltar"},forms:{metadata:{created:"Criado",updated:"Atualizado",modified:"Modificado",delegated:"Delegado"}},$vuetify:{dataFooter:{itemsPerPageAll:"Todos",itemsPerPageText:"Itens por página:",pageText:"{0}-{1} de {2}"}}},"en-US":{placeholders:{selectFilter:"Select a filter",visualize:"Visualize",actions:"Actions",search:"Search"},dialogs:{columnSettings:{title:"Column Settings"}},actions:{save:"Save",cancel:"Cancel",edit:"Edit",delete:"Delete",disable:"Disable",back:"Back"},forms:{metadata:{created:"Created",updated:"Updated",modified:"Modified",delegated:"Delegated"}},$vuetify:{dataFooter:{itemsPerPageAll:"All",itemsPerPageText:"Items per page:",pageText:"{0}-{1} of {2}"}}}},LT=mx({locale:"pt-BR",fallbackLocale:"en-US",messages:T$});let hh=!1;const fh=l.ref(!1),jn=l.ref([]),yy=l.ref([]),Ht=l.ref(null),Zi=l.ref([]),b$=()=>{const n=Er(),e=async p=>{fh.value=!0;const w=p?`_active eq true and ${p}`:"_active eq true",C=await xo.getBranchList(w);C&&(jn.value=C,hh=!0),fh.value=!1},t=async p=>(jn.value.length||await e(p),jn.value);function r(p){if(!jn.value)throw new Error("Data not stored yet");const w=Na(jn.value,p,["name","description"]);return p!==""?w:jn.value}const o=p=>{yy.value=p},a=p=>{Ht.value=ka.cloneDeep(p)},c=async p=>await xo.getBranch(p),d=async()=>{if(Ht.value!=null){const p=await xo.createBranch(Ht.value);return p!=null&&p.data.created_at&&(n.success("Branch created."),hh&&jn.value.push(p.data)),p==null?void 0:p.data}},h=async()=>{if(Ht.value&&Ht.value.__id){const p=await xo.updateBranch(Ht.value);if(hh&&p){const w=jn.value.findIndex(C=>C.__id===p.data.__id);return w!==-1?(jn.value[w]=p.data,n.success("Branch updated.")):n.error("Unable to update item"),p}}else n.error("Unable to update item")},f=async()=>{if(Ht.value&&Ht.value.created_at){await xo.deactivateBranch(Ht.value.__id);const p=jn.value.findIndex(w=>{var C;return w.__id===((C=Ht.value)==null?void 0:C.__id)});if(p!==-1)return jn.value.splice(p,1),Ht.value;n.error("Unable to deactivate Domain")}};async function g(p){_e.value=!0;try{if(Ht.value&&Ht.value.__id){const w={...p,branch:Ht.value.__id};if(!await Pn.updateTeam(w)){n.error("Unable to link team");return}if(Zi.value.findIndex(k=>k.__id===p.__id)===-1)return n.success("Team added successfully."),Zi.value.push(w),w;n.info("Team already added.")}else throw new Error("Item is not defined")}catch(w){console.error(w)}finally{_e.value=!1}}async function v(p){if(_e.value=!0,Ht.value&&Ht.value.__id){const w={...p,branch:null};if(!await Pn.updateTeam(w))return;const T=Zi.value.findIndex(k=>k.__id===p.__id);if(T!==-1)return Zi.value.splice(T,1),_e.value=!1,Zi.value;throw new Error("Item not found to remove")}_e.value=!1}return{data:jn,columns:yy,item:Ht,loading:fh,__init__:e,getData:t,filterData:r,setColumns:o,setItem:a,getItem:c,createItem:d,updateItem:h,removeItem:f,branchTeams:Zi,linkTeam:g,unlinkTeam:v}};function I$(){const n=Pa("https://api.jplan.com.br/management/division"),{error:e}=Er();return{async getDivisionList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error)throw e("Failed to fetch Division list"),new Error(o.data.error);return o.data.data}catch(r){console.error("Error in getDivisionList:",r),e("Failed to fetch Division list");return}},async createDivision(t){var r,o;try{const a=await n.post("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){throw console.error("Error in createDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to create Division"),a}},async updateDivision(t){var r,o;try{const a=await n.patch("/item",t);if(a.data.error)throw e("Failed to update Division"),new Error(a.data.error);return a}catch(a){throw console.error("Error in updateDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to update Division"),a}},async getDivision(t){var r,o;try{const a=await n.get(`/item/${t}`);if(a.data.error)throw e("Failed to fetch Division"),new Error(a.data.error);return a.data}catch(a){throw console.error("Error in getDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to fetch Division"),a}},async activateDivision(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error)throw e("Failed to activate Division"),new Error(a.data.error)}catch(a){throw console.error("Error in activateDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to activate Division"),a}},async deactivateDivision(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error)throw e("Failed to deactivate Division"),new Error(a.data.error)}catch(a){throw console.error("Error in deactivateDivision:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to deactivate Division"),a}}}}const aa=I$();let mh=!1;const gh=l.ref(!1),Jn=l.ref([]),Cy=l.ref([]),$t=l.ref(null),ea=l.ref([]),S$=()=>{const n=Er(),e=async p=>{gh.value=!0;const w=p?`_active eq true and ${p}`:"_active eq true",C=await aa.getDivisionList(w);C&&(Jn.value=C,mh=!0),gh.value=!1},t=async p=>(Jn.value.length||await e(p),Jn.value);function r(p){if(!Jn.value)throw new Error("Data not stored yet");const w=Na(Jn.value,p,["name","description"]);return p!==""?w:Jn.value}const o=p=>{Cy.value=p},a=p=>{$t.value=ka.cloneDeep(p)},c=async p=>await aa.getDivision(p),d=async()=>{if($t.value!=null){const p=await aa.createDivision($t.value);return p!=null&&p.data.created_at&&(n.success("Division created."),mh&&Jn.value.push(p.data)),p==null?void 0:p.data}},h=async()=>{if(_e.value=!0,$t.value&&$t.value.__id){const p=await aa.updateDivision($t.value);if(mh&&(p!=null&&p.data.__id)){const w=Jn.value.findIndex(C=>C.__id===p.data.__id);return w!==-1?(Jn.value[w]=p.data,n.success("Updated Division.")):n.error("Unable to update item"),_e.value=!1,p}}else _e.value=!1,n.error("Unable to update item")},f=async()=>{if(_e.value=!0,$t.value&&$t.value.created_at){await aa.deactivateDivision($t.value.__id);const p=Jn.value.findIndex(w=>{var C;return w.__id===((C=$t.value)==null?void 0:C.__id)});if(p!==-1)return Jn.value.splice(p,1),$t.value;n.error("Unable to deactivate Division")}_e.value=!1};async function g(p){_e.value=!0;try{if($t.value&&$t.value.__id){const w={...p,division:$t.value.__id};return await Lo.updateOrg(w)?(ea.value.findIndex(k=>k.__id===p.__id)===-1?(n.success("Organization added successfully."),ea.value.push(w)):n.info("Organization already added."),w):void 0}else throw new Error("Item is not defined")}catch(w){console.error(w)}finally{_e.value=!1}}async function v(p){if(_e.value=!0,$t.value&&$t.value.__id){const w={...p,division:null};if(!await Lo.updateOrg(w))return;const T=ea.value.findIndex(k=>k.__id===p.__id);if(T!==-1)ea.value.splice(T,1);else throw new Error("Item não encontrado para remoção")}else throw new Error("Item não está definido");return _e.value=!1,ea.value}return{data:Jn,columns:Cy,item:$t,loading:gh,__init__:e,filterData:r,getData:t,setColumns:o,setItem:a,getItem:c,createItem:d,updateItem:h,removeItem:f,orgs:ea,linkDivision:g,unlinkDivision:v}};function A$(){const n=Pa("https://api.jplan.com.br/management/user"),{error:e}=Er();return{async getManageUserList(t){try{const r=t?`?filter_query=${t}`:"",o=await n.get(`/list/${r}`);if(o.data.error)throw e("Failed to fetch User list"),new Error(o.data.error);return o.data.data}catch(r){console.error("Error in getManageUserList:",r),e("Failed to fetch User list");return}},async createManageUser(t){var r,o;try{const a=await n.post("/item",t);return a.status>=200&&a.status<300?a:void 0}catch(a){throw console.error("Error in createManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to create User"),a}},async updateManageUser(t){var r,o;try{const a=await n.patch("/item",t);if(a.data.error)throw e("Failed to update User"),new Error(a.data.error);return a}catch(a){throw console.error("Error in updateManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to update User"),a}},async getManageUser(t){var r,o;try{const a=await n.get(`/item/${t}`);if(a.data.error)throw e("Failed to fetch User"),new Error(a.data.error);return a.data}catch(a){console.error("Error in getManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to fetch User");return}},async activateManageUser(t){var r,o;try{const a=await n.post(`/item/${t}/activate`);if(a.data.error)throw e("Failed to activate User"),new Error(a.data.error)}catch(a){throw console.error("Error in activateManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to activate User"),a}},async deactivateManageUser(t){var r,o;try{const a=await n.post(`/item/${t}/deactivate`);if(a.data.error)throw e("Failed to deactivate User"),new Error(a.data.error)}catch(a){throw console.error("Error in deactivateManageUser:",a),e(((o=(r=a.response)==null?void 0:r.data)==null?void 0:o.message)||"Failed to deactivate User"),a}}}}const sa=A$();let ph=!1,_h=l.ref(!1);const Qn=l.ref([]),Ey=l.ref([]),Xn=l.ref(null),k$=l.ref(null),N$=l.ref([]),R$=()=>{const n=Er(),e=async g=>{_h.value=!0;const v=g?`_active eq true and ${g}`:"_active eq true",p=await sa.getManageUserList(v);p&&(Qn.value=p,ph=!0),_h.value=!1},t=async g=>(Qn.value.length||await e(g),Qn.value);function r(g){if(!Qn.value)throw new Error("Data not stored yet");const v=Na(Qn.value,g,["name","description"]);return g!==""?v:Qn.value}return{data:Qn,loading:_h,columns:Ey,item:Xn,filterData:r,__init__:e,getData:t,setColumns:g=>{Ey.value=g},setItem:g=>{Xn.value=ka.cloneDeep(g)},getItem:async g=>await sa.getManageUser(g),createItem:async()=>{if(Xn.value!=null){const g=crypto.randomUUID(),v=await sa.createManageUser({...Xn.value,__id:g});return v!=null&&v.data.created_at&&(n.success("User created."),ph&&Qn.value.push(v.data)),v==null?void 0:v.data}},updateItem:async()=>{if(_e.value=!0,Xn.value&&Xn.value.created_at){const g=await sa.updateManageUser(Xn.value);if(ph&&(g!=null&&g.data)){const v=Qn.value.findIndex(p=>p.__id===(g==null?void 0:g.data.__id));if(v!==-1)Qn.value[v]=g==null?void 0:g.data,n.success("User created.");else throw new Error("Unable to find item after update")}return _e.value=!1,g==null?void 0:g.data}},removeItem:async()=>{if(Xn.value&&Xn.value.created_at){try{await sa.deactivateManageUser(Xn.value.__id)}catch{n.error("Unable to deactivate user");return}const g=Qn.value.findIndex(v=>{var p;return v.__id===((p=Xn.value)==null?void 0:p.__id)});if(g!==-1)return Qn.value.splice(g,1),Xn.value}},userOrg:k$,userTeams:N$}},O$=n=>{n.use(E$),n.use(J0,w$),n.use(LT),Object.entries(C$).forEach(([e,t])=>{n.component(e,t)}),Object.entries(EO).forEach(([e,t])=>{n.provide(e,t)})},P$={install:O$};exports.ContextMenu=sC;exports.EmptyListImg=Ph;exports.EventBus=Bl;exports.FormHeadless=BE;exports.HttpCore=rB;exports.SpinnerLoader=PT;exports.TableCardsView=aE;exports.TableHeader=GC;exports.__spinner=_e;exports._export_sfc=ba;exports._sfc_main=cC;exports._sfc_main$1=zC;exports._sfc_main$10=_f;exports._sfc_main$11=nC;exports._sfc_main$12=by;exports._sfc_main$13=ME;exports._sfc_main$14=DE;exports._sfc_main$15=cE;exports._sfc_main$16=UE;exports._sfc_main$17=FE;exports._sfc_main$18=Hl;exports._sfc_main$19=iC;exports._sfc_main$2=Df;exports._sfc_main$20=aC;exports._sfc_main$21=Ms;exports._sfc_main$22=DT;exports._sfc_main$23=OT;exports._sfc_main$24=MT;exports._sfc_main$3=Lf;exports._sfc_main$4=Yl;exports._sfc_main$5=oC;exports._sfc_main$6=xl;exports._sfc_main$7=rC;exports._sfc_main$8=nu;exports._sfc_main$9=Iy;exports.branchInstance=xo;exports.coreClient=Am;exports.createToastInterface=Cs;exports.dateFormat=cs;exports.divisionInstance=aa;exports.filterQuery=Na;exports.globalEventBus=pf;exports.i18n=LT;exports.index=P$;exports.manageUserInstance=sa;exports.msal=zt;exports.orgInstance=Lo;exports.provideToast=j0;exports.scopedClient=Pa;exports.setupAuthGuard=d$;exports.teamInstance=Pn;exports.toastInjectionKey=Vl;exports.useAuth=Sm;exports.useBranchStore=b$;exports.useCustomizer=ZO;exports.useDialog=Os;exports.useDivisionStore=S$;exports.useManageUserStore=R$;exports.useOrganizationStore=NT;exports.useSession=pu;exports.useTeamStore=RT;exports.useToast=Er;
|