1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5292],{55292:function(e,t,r){r.r(t),r.d(t,{NestedAppAuthController:function(){return S}});var n=r(49566),o=r(90177),s=r(26516),i=r(2979),c=r(69111),a=r(16468),u=r(49279),d=r(26159),p=r(24228),h=r(47752),l=r(76831),A=r(32111),g=r(85152),E=r(10536);const m="USER_INTERACTION_REQUIRED",C="USER_CANCEL",k="NO_NETWORK",v="TRANSIENT_ERROR",w="PERSISTENT_ERROR",I="DISABLED",T="ACCOUNT_UNAVAILABLE",f="NESTED_APP_AUTH_UNAVAILABLE";class R{constructor(e,t,r,n){this.clientId=e,this.clientCapabilities=t,this.crypto=r,this.logger=n}toNaaTokenRequest(e){let t;t=void 0===e.extraQueryParameters?new Map:new Map(Object.entries(e.extraQueryParameters));const r=(new a.H).addClientCapabilitiesToClaims(e.claims,this.clientCapabilities),n=e.scopes||u.f_;return{platformBrokerId:e.account?.homeAccountId,clientId:this.clientId,authority:e.authority,scope:n.join(" "),correlationId:void 0!==e.correlationId?e.correlationId:this.crypto.createNewGuid(),claims:d.x.isEmptyObj(r)?void 0:r,state:e.state,authenticationScheme:e.authenticationScheme||u.hO.BEARER,extraParameters:t}}fromNaaTokenResponse(e,t,r){if(!t.token.id_token||!t.token.access_token)throw(0,p.zP)(h.PM);const n=new Date(1e3*(r+(t.token.expires_in||0))),o=l.Z_(t.token.id_token,this.crypto.base64Decode),s=this.fromNaaAccountInfo(t.account,o),i=t.token.scope||e.scope;return{authority:t.token.authority||s.environment,uniqueId:s.localAccountId,tenantId:s.tenantId,scopes:i.split(" "),account:s,idToken:t.token.id_token,idTokenClaims:o,accessToken:t.token.access_token,fromCache:!0,expiresOn:n,tokenType:e.authenticationScheme||u.hO.BEARER,correlationId:e.correlationId,extExpiresOn:n,state:e.state}}fromNaaAccountInfo(e,t){const r=t||e.idTokenClaims,n=e.localAccountId||r?.oid||r?.sub||"",o=e.tenantId||r?.tid||"",s=e.homeAccountId||`${n}.${o}`,i=e.username||r?.preferred_username||"",c=e.name||r?.name;return{homeAccountId:s,environment:e.environment,tenantId:o,username:i,localAccountId:n,name:c,idToken:e.idToken,idTokenClaims:r}}fromBridgeError(e){if(!function(e){return void 0!==e.status}(e))return new E.l4("unknown_error","An unknown error occurred");switch(e.status){case C:return new p.er(h.$R);case k:return new p.er(h.Mq);case T:return new p.er(h.cX);case I:return new p.er(h.Ls);case f:return new p.er(e.code||h.Ls,e.description);case v:case w:return new A.n(e.code,e.description);case m:return new g.Yo(e.code,e.description);default:return new E.l4(e.code,e.description)}}}const _={code:"unsupported_method",desc:"The PKCE code challenge and verifier could not be generated."};class y extends E.l4{constructor(e,t){super(e,t),Object.setPrototypeOf(this,y.prototype),this.name="NestedAppAuthError"}static createUnsupportedError(){return new y(_.code,_.desc)}}var N=r(18896),U=r(30882);class S{constructor(e){this.operatingContext=e;const t=this.operatingContext.getBridgeProxy();if(void 0===t)throw new Error("unexpected: bridgeProxy is undefined");this.bridgeProxy=t,this.config=e.getConfig(),this.logger=this.operatingContext.getLogger(),this.performanceClient=this.config.telemetry.client,this.browserCrypto=e.isBrowserEnvironment()?new c.Q(this.logger,this.performanceClient):n.d,this.eventHandler=new N.b(this.logger,this.browserCrypto),this.nestedAppAuthAdapter=new R(this.config.auth.clientId,this.config.auth.clientCapabilities,this.browserCrypto,this.logger)}getBrowserStorage(){throw y.createUnsupportedError()}getEventHandler(){return this.eventHandler}static async createController(e){const t=new S(e);return Promise.resolve(t)}initialize(){return Promise.resolve()}ensureValidRequest(e){return e?.correlationId?e:{...e,correlationId:this.browserCrypto.createNewGuid()}}async acquireTokenInteractive(e){const t=this.ensureValidRequest(e);this.eventHandler.emitEvent(U.t.ACQUIRE_TOKEN_START,i.s_.Popup,t);const r=this.performanceClient.startMeasurement(o.Ak.AcquireTokenPopup,t.correlationId);r?.add({nestedAppAuthRequest:!0});try{const e=this.nestedAppAuthAdapter.toNaaTokenRequest(t),n=s.HY(),o=await this.bridgeProxy.getTokenInteractive(e),c=this.nestedAppAuthAdapter.fromNaaToken
1Response(e,o,n);return this.operatingContext.setActiveAccount(c.account),this.eventHandler.emitEvent(U.t.ACQUIRE_TOKEN_SUCCESS,i.s_.Popup,c),r.add({accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length}),r.end({success:!0,requestId:c.requestId}),c}catch(n){const e=this.nestedAppAuthAdapter.fromBridgeError(n);throw this.eventHandler.emitEvent(U.t.ACQUIRE_TOKEN_FAILURE,i.s_.Popup,null,n),r.end({success:!1},n),e}}async acquireTokenSilentInternal(e){const t=this.ensureValidRequest(e);this.eventHandler.emitEvent(U.t.ACQUIRE_TOKEN_START,i.s_.Silent,t);const r=this.performanceClient.startMeasurement(o.Ak.SsoSilent,t.correlationId);r?.increment({visibilityChangeCount:0}),r?.add({nestedAppAuthRequest:!0});try{const e=this.nestedAppAuthAdapter.toNaaTokenRequest(t),n=s.HY(),o=await this.bridgeProxy.getTokenSilent(e),c=this.nestedAppAuthAdapter.fromNaaTokenResponse(e,o,n);return this.operatingContext.setActiveAccount(c.account),this.eventHandler.emitEvent(U.t.ACQUIRE_TOKEN_SUCCESS,i.s_.Silent,c),r?.add({accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length}),r?.end({success:!0,requestId:c.requestId}),c}catch(n){const e=this.nestedAppAuthAdapter.fromBridgeError(n);throw this.eventHandler.emitEvent(U.t.ACQUIRE_TOKEN_FAILURE,i.s_.Silent,null,n),r?.end({success:!1},n),e}}async acquireTokenPopup(e){return this.acquireTokenInteractive(e)}acquireTokenRedirect(e){throw y.createUnsupportedError()}async acquireTokenSilent(e){return this.acquireTokenSilentInternal(e)}acquireTokenByCode(e){throw y.createUnsupportedError()}acquireTokenNative(e,t,r){throw y.createUnsupportedError()}acquireTokenByRefreshToken(e,t){throw y.createUnsupportedError()}addEventCallback(e){return this.eventHandler.addEventCallback(e)}removeEventCallback(e){this.eventHandler.removeEventCallback(e)}addPerformanceCallback(e){throw y.createUnsupportedError()}removePerformanceCallback(e){throw y.createUnsupportedError()}enableAccountStorageEvents(){throw y.createUnsupportedError()}disableAccountStorageEvents(){throw y.createUnsupportedError()}getAccount(e){throw y.createUnsupportedError()}getAccountByHomeId(e){const t=this.operatingContext.getActiveAccount();return void 0!==t&&t.homeAccountId===e?this.nestedAppAuthAdapter.fromNaaAccountInfo(t):null}getAccountByLocalId(e){const t=this.operatingContext.getActiveAccount();return void 0!==t&&t.localAccountId===e?this.nestedAppAuthAdapter.fromNaaAccountInfo(t):null}getAccountByUsername(e){const t=this.operatingContext.getActiveAccount();return void 0!==t&&t.username===e?this.nestedAppAuthAdapter.fromNaaAccountInfo(t):null}getAllAccounts(){const e=this.operatingContext.getActiveAccount();return void 0!==e?[this.nestedAppAuthAdapter.fromNaaAccountInfo(e)]:[]}handleRedirectPromise(e){return Promise.resolve(null)}loginPopup(e){if(void 0!==e)return this.acquireTokenInteractive(e);throw y.createUnsupportedError()}loginRedirect(e){throw y.createUnsupportedError()}logout(e){throw y.createUnsupportedError()}logoutRedirect(e){throw y.createUnsupportedError()}logoutPopup(e){throw y.createUnsupportedError()}ssoSilent(e){return this.acquireTokenSilentInternal(e)}getTokenCache(){throw y.createUnsupportedError()}getLogger(){return this.logger}setLogger(e){this.logger=e}setActiveAccount(e){this.logger.warning("nestedAppAuth does not support setActiveAccount")}getActiveAccount(){const e=this.operatingContext.getActiveAccount();return void 0!==e?this.nestedAppAuthAdapter.fromNaaAccountInfo(e):null}initializeWrapperLibrary(e,t){}setNavigationClient(e){this.logger.warning("setNavigationClient is not supported in nested app auth")}getConfiguration(){return this.config}isBrowserEnv(){return this.operatingContext.isBrowserEnvironment()}getBrowserCrypto(){return this.browserCrypto}getPerformanceClient(){throw y.createUnsupportedError()}getRedirectResponse(){throw y.createUnsupportedError()}async clearCache(e){throw y.createUnsupportedError()}async hydrateCache(e,t){throw y.createUnsupportedError()}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.