import{c as S,A,S as I}from"./loadSts-D2KuE3Wg.js";import{b as Y,E as Z,e as O,I as ee,d as te,M as ne,P as oe,R as ie,a as re}from"./loadSts-D2KuE3Wg.js";import{C as y,g as E,s as l}from"./index-CPpeTRZB.js";import{a as ae}from"./index-CPpeTRZB.js";import"./normalizeProvider-EC8cbfMc.js";import"./preload-helper-BlTxHScW.js";import"./index-DcfSUfKC.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-ChvoNxcO.js";import"./__vite-browser-external-DLjrMatA.js";import"./inherits_browser-nmOknR35-Bp0mvRSL.js";import"./_commonjsHelpers-B4e78b8K-W3E8ocG7.js";import"./index-6mKfgpcs-DsgiI2lM.js";import"./index-DsIu-45t-Bejjlpz4.js";import"./index-DSosZ5sh-Ceejs_jv.js";import"./index-69shuAsh-DF18H7zf.js";import"./index-BJBOx-Z---hbiLl7B.js";import"./index.browser-BHPvGrwi-6Mh8eUw-.js";import"./_commonjs-dynamic-modules-BpilXLfW-DfYEAvWy.js";import"./_commonjs-dynamic-modules-B7n8ZNar.js";function R(){return async()=>"us-east-1"}class x extends y.classBuilder().ep(S).m(function(t,o,i,n){return[E(i,t.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").sc(A).build(){}const W=e=>{if(typeof e?.Arn=="string"){const t=e.Arn.split(":");if(t.length>4&&t[4]!=="")return t[4]}},T=async(e,t,o,i={})=>{const n=typeof e=="function"?await e():e,s=typeof t=="function"?await t():t,r=await R()();return o?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${n} (credential provider clientConfig)`,`${s} (contextual client)`,`${r} (STS default: AWS_REGION, profile region, or us-east-1)`),n??s??r},b=(e,t)=>{let o;return async i=>{if(!o){const{logger:d=e?.parentClientConfig?.logger,profile:m=e?.parentClientConfig?.profile,region:u,requestHandler:c=e?.parentClientConfig?.requestHandler,credentialProviderLogger:p,userAgentAppId:f=e?.parentClientConfig?.userAgentAppId}=e,g=await T(u,e?.parentClientConfig?.region,p,{}),C=!h(c);o=new t({...e,userAgentAppId:f,profile:m,region:g,requestHandler:C?c:void 0,logger:d})}const{Credentials:n,AssumedRoleUser:s}=await o.send(new x(i));if(!n||!n.AccessKeyId||!n.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${i.RoleArn}`);const r=W(s),a={accessKeyId:n.AccessKeyId,secretAccessKey:n.SecretAccessKey,sessionToken:n.SessionToken,expiration:n.Expiration,...n.CredentialScope&&{credentialScope:n.CredentialScope},...r&&{accountId:r}};return r&&l(a,"RESOLVED_ACCOUNT_ID","T"),l(a,"CREDENTIALS_STS_ASSUME_ROLE_WEB_ID","k"),a}},h=e=>e?.metadata?.handlerProtocol==="h2",w=(e,t)=>t?class extends e{constructor(i){super(i);for(const n of t)this.middlewareStack.use(n)}}:e,J=(e={},t)=>b(e,w(I,t));export{y as $Command,Y as AssumeRoleCommand,x as AssumeRoleWithWebIdentityCommand,Z as ExpiredTokenException,O as IDPCommunicationErrorException,ee as IDPRejectedClaimException,te as InvalidIdentityTokenException,ne as MalformedPolicyDocumentException,oe as PackedPolicyTooLargeException,ie as RegionDisabledException,I as STSClient,re as STSServiceException,ae as __Client,J as getDefaultRoleAssumerWithWebIdentity};
