aws-secrets-manager-wrapper
Version:
A TypeScript wrapper for AWS Secrets Manager that simplifies common operations and provides a more user-friendly interface.
1 lines • 47.4 kB
JavaScript
exports.id=36,exports.ids=[36],exports.modules={8036:(t,e,n)=>{"use strict";n.d(e,{getDefaultRoleAssumer:()=>xn,getDefaultRoleAssumerWithWebIdentity:()=>bn});var s=n(244),i=n(9389),o=n(1208),r=n(1540);const a={UseGlobalEndpoint:{type:"builtInParams",name:"useGlobalEndpoint"},UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};class l extends r.TJ{constructor(t){super(t),Object.setPrototypeOf(this,l.prototype)}}class c extends l{constructor(t){super({name:"ExpiredTokenException",$fault:"client",...t}),this.name="ExpiredTokenException",this.$fault="client",Object.setPrototypeOf(this,c.prototype)}}class u extends l{constructor(t){super({name:"MalformedPolicyDocumentException",$fault:"client",...t}),this.name="MalformedPolicyDocumentException",this.$fault="client",Object.setPrototypeOf(this,u.prototype)}}class d extends l{constructor(t){super({name:"PackedPolicyTooLargeException",$fault:"client",...t}),this.name="PackedPolicyTooLargeException",this.$fault="client",Object.setPrototypeOf(this,d.prototype)}}class p extends l{constructor(t){super({name:"RegionDisabledException",$fault:"client",...t}),this.name="RegionDisabledException",this.$fault="client",Object.setPrototypeOf(this,p.prototype)}}class h extends l{constructor(t){super({name:"IDPRejectedClaimException",$fault:"client",...t}),this.name="IDPRejectedClaimException",this.$fault="client",Object.setPrototypeOf(this,h.prototype)}}class g extends l{constructor(t){super({name:"InvalidIdentityTokenException",$fault:"client",...t}),this.name="InvalidIdentityTokenException",this.$fault="client",Object.setPrototypeOf(this,g.prototype)}}class f extends l{constructor(t){super({name:"IDPCommunicationErrorException",$fault:"client",...t}),this.name="IDPCommunicationErrorException",this.$fault="client",Object.setPrototypeOf(this,f.prototype)}}class m extends l{constructor(t){super({name:"InvalidAuthorizationMessageException",$fault:"client",...t}),this.name="InvalidAuthorizationMessageException",this.$fault="client",Object.setPrototypeOf(this,m.prototype)}}const x=t=>({...t,...t.SecretAccessKey&&{SecretAccessKey:r.$H}}),b=t=>({...t,...t.Credentials&&{Credentials:x(t.Credentials)}}),y=t=>({...t,...t.WebIdentityToken&&{WebIdentityToken:r.$H}}),E=t=>({...t,...t.Credentials&&{Credentials:x(t.Credentials)}});var v=n(6454),N=n(8218);const w=(t,e)=>(0,N.w)(t,e).then((t=>{if(t.length){const e=new v.XMLParser({attributeNamePrefix:"",htmlEntities:!0,ignoreAttributes:!1,ignoreDeclaration:!0,parseTagValue:!1,trimValues:!1,tagValueProcessor:(t,e)=>""===e.trim()&&e.includes("\n")?"":void 0});let n;e.addEntity("#xD","\r"),e.addEntity("#10","\n");try{n=e.parse(t,!0)}catch(e){throw e&&"object"==typeof e&&Object.defineProperty(e,"$responseBodyText",{value:t}),e}const s="#text",i=Object.keys(n)[0],o=n[i];return o[s]&&(o[i]=o[s],delete o[s]),(0,r.rm)(o)}return{}})),P=async(t,e)=>{const n=await w(t,e);return n.Error&&(n.Error.message=n.Error.message??n.Error.Message),n};var A=n(5479);const S=async(t,e)=>{const n=ct;let s;return s=Gt({...K(t,e),[dt]:ht,[zt]:ut}),lt(e,n,"/",void 0,s)},I=async(t,e)=>{const n=ct;let s;return s=Gt({..._(t,e),[dt]:mt,[zt]:ut}),lt(e,n,"/",void 0,s)},T=async(t,e)=>{if(t.statusCode>=300)return O(t,e);const n=await w(t.body,e);let s={};return s=X(n.AssumeRoleResult,e),{$metadata:rt(t),...s}},C=async(t,e)=>{if(t.statusCode>=300)return O(t,e);const n=await w(t.body,e);let s={};return s=Z(n.AssumeRoleWithWebIdentityResult,e),{$metadata:rt(t),...s}},O=async(t,e)=>{const n={...t,body:await P(t.body,e)},s=Ht(t,n.body);switch(s){case"ExpiredTokenException":case"com.amazonaws.sts#ExpiredTokenException":throw await k(n,e);case"MalformedPolicyDocument":case"com.amazonaws.sts#MalformedPolicyDocumentException":throw await V(n,e);case"PackedPolicyTooLarge":case"com.amazonaws.sts#PackedPolicyTooLargeException":throw await F(n,e);case"RegionDisabledException":case"com.amazonaws.sts#RegionDisabledException":throw await M(n,e);case"IDPRejectedClaim":case"com.amazonaws.sts#IDPRejectedClaimException":throw await D(n,e);case"InvalidIdentityToken":case"com.amazonaws.sts#InvalidIdentityTokenException":throw await j(n,e);case"IDPCommunicationError":case"com.amazonaws.sts#IDPCommunicationErrorException":throw await $(n,e);case"InvalidAuthorizationMessageException":case"com.amazonaws.sts#InvalidAuthorizationMessageException":throw await R(n,e);default:const i=n.body;return at({output:t,parsedBody:i.Error,errorCode:s})}},k=async(t,e)=>{const n=t.body,s=J(n.Error,e),i=new c({$metadata:rt(t),...s});return(0,r.Mw)(i,n)},$=async(t,e)=>{const n=t.body,s=Q(n.Error,e),i=new f({$metadata:rt(t),...s});return(0,r.Mw)(i,n)},D=async(t,e)=>{const n=t.body,s=tt(n.Error,e),i=new h({$metadata:rt(t),...s});return(0,r.Mw)(i,n)},R=async(t,e)=>{const n=t.body,s=et(n.Error,e),i=new m({$metadata:rt(t),...s});return(0,r.Mw)(i,n)},j=async(t,e)=>{const n=t.body,s=nt(n.Error,e),i=new g({$metadata:rt(t),...s});return(0,r.Mw)(i,n)},V=async(t,e)=>{const n=t.body,s=st(n.Error,e),i=new u({$metadata:rt(t),...s});return(0,r.Mw)(i,n)},F=async(t,e)=>{const n=t.body,s=it(n.Error,e),i=new d({$metadata:rt(t),...s});return(0,r.Mw)(i,n)},M=async(t,e)=>{const n=t.body,s=ot(n.Error,e),i=new p({$metadata:rt(t),...s});return(0,r.Mw)(i,n)},K=(t,e)=>{const n={};if(null!=t[$t]&&(n[$t]=t[$t]),null!=t[Dt]&&(n[Dt]=t[Dt]),null!=t[St]){const s=L(t[St],e);0===t[St]?.length&&(n.PolicyArns=[]),Object.entries(s).forEach((([t,e])=>{n[`PolicyArns.${t}`]=e}))}if(null!=t[At]&&(n[At]=t[At]),null!=t[vt]&&(n[vt]=t[vt]),null!=t[Kt]){const s=G(t[Kt],e);0===t[Kt]?.length&&(n.Tags=[]),Object.entries(s).forEach((([t,e])=>{n[`Tags.${t}`]=e}))}if(null!=t[Lt]){const s=q(t[Lt],e);0===t[Lt]?.length&&(n.TransitiveTagKeys=[]),Object.entries(s).forEach((([t,e])=>{n[`TransitiveTagKeys.${t}`]=e}))}if(null!=t[wt]&&(n[wt]=t[wt]),null!=t[Ft]&&(n[Ft]=t[Ft]),null!=t[_t]&&(n[_t]=t[_t]),null!=t[Vt]&&(n[Vt]=t[Vt]),null!=t[Tt]){const s=W(t[Tt],e);0===t[Tt]?.length&&(n.ProvidedContexts=[]),Object.entries(s).forEach((([t,e])=>{n[`ProvidedContexts.${t}`]=e}))}return n},_=(t,e)=>{const n={};if(null!=t[$t]&&(n[$t]=t[$t]),null!=t[Dt]&&(n[Dt]=t[Dt]),null!=t[Wt]&&(n[Wt]=t[Wt]),null!=t[Ct]&&(n[Ct]=t[Ct]),null!=t[St]){const s=L(t[St],e);0===t[St]?.length&&(n.PolicyArns=[]),Object.entries(s).forEach((([t,e])=>{n[`PolicyArns.${t}`]=e}))}return null!=t[At]&&(n[At]=t[At]),null!=t[vt]&&(n[vt]=t[vt]),n},L=(t,e)=>{const n={};let s=1;for(const i of t){if(null===i)continue;const t=z(i,e);Object.entries(t).forEach((([t,e])=>{n[`member.${s}.${t}`]=e})),s++}return n},z=(t,e)=>{const n={};return null!=t[Bt]&&(n[Bt]=t[Bt]),n},U=(t,e)=>{const n={};return null!=t[It]&&(n[It]=t[It]),null!=t[Et]&&(n[Et]=t[Et]),n},W=(t,e)=>{const n={};let s=1;for(const e of t){if(null===e)continue;const t=U(e);Object.entries(t).forEach((([t,e])=>{n[`member.${s}.${t}`]=e})),s++}return n},B=(t,e)=>{const n={};return null!=t[Pt]&&(n[Pt]=t[Pt]),null!=t[Ut]&&(n[Ut]=t[Ut]),n},q=(t,e)=>{const n={};let s=1;for(const e of t)null!==e&&(n[`member.${s}`]=e,s++);return n},G=(t,e)=>{const n={};let s=1;for(const e of t){if(null===e)continue;const t=B(e);Object.entries(t).forEach((([t,e])=>{n[`member.${s}.${t}`]=e})),s++}return n},H=(t,e)=>{const n={};return null!=t[gt]&&(n[gt]=(0,r.lK)(t[gt])),null!=t[xt]&&(n[xt]=(0,r.lK)(t[xt])),n},X=(t,e)=>{const n={};return null!=t[yt]&&(n[yt]=Y(t[yt],e)),null!=t[ft]&&(n[ft]=H(t[ft])),null!=t[Ot]&&(n[Ot]=(0,r.xW)(t[Ot])),null!=t[Vt]&&(n[Vt]=(0,r.lK)(t[Vt])),n},Z=(t,e)=>{const n={};return null!=t[yt]&&(n[yt]=Y(t[yt],e)),null!=t[jt]&&(n[jt]=(0,r.lK)(t[jt])),null!=t[ft]&&(n[ft]=H(t[ft])),null!=t[Ot]&&(n[Ot]=(0,r.xW)(t[Ot])),null!=t[kt]&&(n[kt]=(0,r.lK)(t[kt])),null!=t[bt]&&(n[bt]=(0,r.lK)(t[bt])),null!=t[Vt]&&(n[Vt]=(0,r.lK)(t[Vt])),n},Y=(t,e)=>{const n={};return null!=t[pt]&&(n[pt]=(0,r.lK)(t[pt])),null!=t[Rt]&&(n[Rt]=(0,r.lK)(t[Rt])),null!=t[Mt]&&(n[Mt]=(0,r.lK)(t[Mt])),null!=t[Nt]&&(n[Nt]=(0,r.Y0)((0,r.t_)(t[Nt]))),n},J=(t,e)=>{const n={};return null!=t[qt]&&(n[qt]=(0,r.lK)(t[qt])),n},Q=(t,e)=>{const n={};return null!=t[qt]&&(n[qt]=(0,r.lK)(t[qt])),n},tt=(t,e)=>{const n={};return null!=t[qt]&&(n[qt]=(0,r.lK)(t[qt])),n},et=(t,e)=>{const n={};return null!=t[qt]&&(n[qt]=(0,r.lK)(t[qt])),n},nt=(t,e)=>{const n={};return null!=t[qt]&&(n[qt]=(0,r.lK)(t[qt])),n},st=(t,e)=>{const n={};return null!=t[qt]&&(n[qt]=(0,r.lK)(t[qt])),n},it=(t,e)=>{const n={};return null!=t[qt]&&(n[qt]=(0,r.lK)(t[qt])),n},ot=(t,e)=>{const n={};return null!=t[qt]&&(n[qt]=(0,r.lK)(t[qt])),n},rt=t=>({httpStatusCode:t.statusCode,requestId:t.headers["x-amzn-requestid"]??t.headers["x-amzn-request-id"]??t.headers["x-amz-request-id"],extendedRequestId:t.headers["x-amz-id-2"],cfId:t.headers["x-amz-cf-id"]}),at=(0,r.jr)(l),lt=async(t,e,n,s,i)=>{const{hostname:o,protocol:r="https",port:a,path:l}=await t.endpoint(),c={protocol:r,hostname:o,port:a,method:"POST",path:l.endsWith("/")?l.slice(0,-1)+n:l+n,headers:e};return void 0!==s&&(c.hostname=s),void 0!==i&&(c.body=i),new A.Kd(c)},ct={"content-type":"application/x-www-form-urlencoded"},ut="2011-06-15",dt="Action",pt="AccessKeyId",ht="AssumeRole",gt="AssumedRoleId",ft="AssumedRoleUser",mt="AssumeRoleWithWebIdentity",xt="Arn",bt="Audience",yt="Credentials",Et="ContextAssertion",vt="DurationSeconds",Nt="Expiration",wt="ExternalId",Pt="Key",At="Policy",St="PolicyArns",It="ProviderArn",Tt="ProvidedContexts",Ct="ProviderId",Ot="PackedPolicySize",kt="Provider",$t="RoleArn",Dt="RoleSessionName",Rt="SecretAccessKey",jt="SubjectFromWebIdentityToken",Vt="SourceIdentity",Ft="SerialNumber",Mt="SessionToken",Kt="Tags",_t="TokenCode",Lt="TransitiveTagKeys",zt="Version",Ut="Value",Wt="WebIdentityToken",Bt="arn",qt="message",Gt=t=>Object.entries(t).map((([t,e])=>(0,r.$6)(t)+"="+(0,r.$6)(e))).join("&"),Ht=(t,e)=>void 0!==e.Error?.Code?e.Error.Code:404==t.statusCode?"NotFound":void 0;class Xt extends(r.uB.classBuilder().ep(a).m((function(t,e,n,s){return[(0,o.TM)(n,this.serialize,this.deserialize),(0,i.rD)(n,t.getEndpointParameterInstructions())]})).s("AWSSecurityTokenServiceV20110615","AssumeRole",{}).n("STSClient","AssumeRoleCommand").f(void 0,b).ser(S).de(T).build()){}class Zt extends(r.uB.classBuilder().ep(a).m((function(t,e,n,s){return[(0,o.TM)(n,this.serialize,this.deserialize),(0,i.rD)(n,t.getEndpointParameterInstructions())]})).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").f(y,E).ser(I).de(C).build()){}const Yt="us-east-1",Jt=t=>{if("string"==typeof t?.Arn){const e=t.Arn.split(":");if(e.length>4&&""!==e[4])return e[4]}},Qt=async(t,e,n)=>{const s="function"==typeof t?await t():t,i="function"==typeof e?await e():e;return n?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${s} (provider)`,`${i} (parent client)`,`${Yt} (STS default)`),s??i??Yt},te=t=>"h2"===t?.metadata?.handlerProtocol;var ee=n(1095),ne=n(9359),se=n(8377),ie=n(6961),oe=n(1487),re=n(3847),ae=n(649),le=n(3594),ce=n(3448),ue=n(7135);const de=async(t,e,n)=>({operation:(0,ue.u)(e).operation,region:await(0,ue.t)(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()}),pe=t=>{const e=[];switch(t.operation){case"AssumeRoleWithSAML":case"AssumeRoleWithWebIdentity":e.push({schemeId:"smithy.api#noAuth"});break;default:e.push(function(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(t,e)=>({signingProperties:{config:t,context:e}})}}(t))}return e};var he=n(5122),ge=n(6228),fe=n(8257),me=n(3410),xe=n(1701),be=n(9987),ye=n(4029),Ee=n(7809),ve=n(3323),Ne=n(2641),we=n(4572),Pe=n(3197),Ae=n(6652),Se=n(8545);const Ie="required",Te="type",Ce="fn",Oe="argv",ke="ref",$e=!1,De=!0,Re="booleanEquals",je="stringEquals",Ve="sigv4",Fe="us-east-1",Me="endpoint",Ke="https://sts.{Region}.{PartitionResult#dnsSuffix}",_e="tree",Le="error",ze="getAttr",Ue={[Ie]:!1,[Te]:"String"},We={[Ie]:!0,default:!1,[Te]:"Boolean"},Be={[ke]:"Endpoint"},qe={[Ce]:"isSet",[Oe]:[{[ke]:"Region"}]},Ge={[ke]:"Region"},He={[Ce]:"aws.partition",[Oe]:[Ge],assign:"PartitionResult"},Xe={[ke]:"UseFIPS"},Ze={[ke]:"UseDualStack"},Ye={url:"https://sts.amazonaws.com",properties:{authSchemes:[{name:Ve,signingName:"sts",signingRegion:Fe}]},headers:{}},Je={},Qe={conditions:[{[Ce]:je,[Oe]:[Ge,"aws-global"]}],[Me]:Ye,[Te]:Me},tn={[Ce]:Re,[Oe]:[Xe,!0]},en={[Ce]:Re,[Oe]:[Ze,!0]},nn={[Ce]:ze,[Oe]:[{[ke]:"PartitionResult"},"supportsFIPS"]},sn={[ke]:"PartitionResult"},on={[Ce]:Re,[Oe]:[!0,{[Ce]:ze,[Oe]:[sn,"supportsDualStack"]}]},rn=[{[Ce]:"isSet",[Oe]:[Be]}],an=[tn],ln=[en],cn={version:"1.0",parameters:{Region:Ue,UseDualStack:We,UseFIPS:We,Endpoint:Ue,UseGlobalEndpoint:We},rules:[{conditions:[{[Ce]:Re,[Oe]:[{[ke]:"UseGlobalEndpoint"},De]},{[Ce]:"not",[Oe]:rn},qe,He,{[Ce]:Re,[Oe]:[Xe,$e]},{[Ce]:Re,[Oe]:[Ze,$e]}],rules:[{conditions:[{[Ce]:je,[Oe]:[Ge,"ap-northeast-1"]}],endpoint:Ye,[Te]:Me},{conditions:[{[Ce]:je,[Oe]:[Ge,"ap-south-1"]}],endpoint:Ye,[Te]:Me},{conditions:[{[Ce]:je,[Oe]:[Ge,"ap-southeast-1"]}],endpoint:Ye,[Te]:Me},{conditions:[{[Ce]:je,[Oe]:[Ge,"ap-southeast-2"]}],endpoint:Ye,[Te]:Me},Qe,{conditions:[{[Ce]:je,[Oe]:[Ge,"ca-central-1"]}],endpoint:Ye,[Te]:Me},{conditions:[{[Ce]:je,[Oe]:[Ge,"eu-central-1"]}],endpoint:Ye,[Te]:Me},{conditions:[{[Ce]:je,[Oe]:[Ge,"eu-north-1"]}],endpoint:Ye,[Te]:Me},{conditions:[{[Ce]:je,[Oe]:[Ge,"eu-west-1"]}],endpoint:Ye,[Te]:Me},{conditions:[{[Ce]:je,[Oe]:[Ge,"eu-west-2"]}],endpoint:Ye,[Te]:Me},{conditions:[{[Ce]:je,[Oe]:[Ge,"eu-west-3"]}],endpoint:Ye,[Te]:Me},{conditions:[{[Ce]:je,[Oe]:[Ge,"sa-east-1"]}],endpoint:Ye,[Te]:Me},{conditions:[{[Ce]:je,[Oe]:[Ge,Fe]}],endpoint:Ye,[Te]:Me},{conditions:[{[Ce]:je,[Oe]:[Ge,"us-east-2"]}],endpoint:Ye,[Te]:Me},{conditions:[{[Ce]:je,[Oe]:[Ge,"us-west-1"]}],endpoint:Ye,[Te]:Me},{conditions:[{[Ce]:je,[Oe]:[Ge,"us-west-2"]}],endpoint:Ye,[Te]:Me},{endpoint:{url:Ke,properties:{authSchemes:[{name:Ve,signingName:"sts",signingRegion:"{Region}"}]},headers:Je},[Te]:Me}],[Te]:_e},{conditions:rn,rules:[{conditions:an,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[Te]:Le},{conditions:ln,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[Te]:Le},{endpoint:{url:Be,properties:Je,headers:Je},[Te]:Me}],[Te]:_e},{conditions:[qe],rules:[{conditions:[He],rules:[{conditions:[tn,en],rules:[{conditions:[{[Ce]:Re,[Oe]:[De,nn]},on],rules:[{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Je,headers:Je},[Te]:Me}],[Te]:_e},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[Te]:Le}],[Te]:_e},{conditions:an,rules:[{conditions:[{[Ce]:Re,[Oe]:[nn,De]}],rules:[{conditions:[{[Ce]:je,[Oe]:[{[Ce]:ze,[Oe]:[sn,"name"]},"aws-us-gov"]}],endpoint:{url:"https://sts.{Region}.amazonaws.com",properties:Je,headers:Je},[Te]:Me},{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Je,headers:Je},[Te]:Me}],[Te]:_e},{error:"FIPS is enabled but this partition does not support FIPS",[Te]:Le}],[Te]:_e},{conditions:ln,rules:[{conditions:[on],rules:[{endpoint:{url:"https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Je,headers:Je},[Te]:Me}],[Te]:_e},{error:"DualStack is enabled but this partition does not support DualStack",[Te]:Le}],[Te]:_e},Qe,{endpoint:{url:Ke,properties:Je,headers:Je},[Te]:Me}],[Te]:_e}],[Te]:_e},{error:"Invalid Configuration: Missing Region",[Te]:Le}]},un=new Se.kS({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS","UseGlobalEndpoint"]}),dn=(t,e={})=>un.get(t,(()=>(0,Se.sO)(cn,{endpointParams:t,logger:e.logger})));Se.mw.aws=Ae.UF;var pn=n(4321);var hn=n(6928);const gn=t=>{const e=t.httpAuthSchemes;let n=t.httpAuthSchemeProvider,s=t.credentials;return{setHttpAuthScheme(t){const n=e.findIndex((e=>e.schemeId===t.schemeId));-1===n?e.push(t):e.splice(n,1,t)},httpAuthSchemes:()=>e,setHttpAuthSchemeProvider(t){n=t},httpAuthSchemeProvider:()=>n,setCredentials(t){s=t},credentials:()=>s}};class fn extends r.Kj{constructor(...[t]){const e=(n=(t=>{(0,r.I9)(process.version);const e=(0,pn.I)(t),n=()=>e().then(r.lT),s=(t=>({apiVersion:"2011-06-15",base64Decoder:t?.base64Decoder??we.E,base64Encoder:t?.base64Encoder??we.n,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??dn,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??pe,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new ge.f2},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new re.mR}],logger:t?.logger??new r.N4,serviceId:t?.serviceId??"STS",urlParser:t?.urlParser??Ne.D,utf8Decoder:t?.utf8Decoder??Pe.ar,utf8Encoder:t?.utf8Encoder??Pe.Pq}))(t);return(0,he.I)(process.version),{...s,...t,runtime:"node",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??Ee.n,credentialDefaultProvider:t?.credentialDefaultProvider??fe.v6,defaultUserAgentProvider:t?.defaultUserAgentProvider??(0,me.pf)({serviceId:s.serviceId,clientVersion:"3.670.0"}),httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4")||(async t=>await(0,fe.v6)(t?.__config||{})()),signer:new ge.f2},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new re.mR}],maxAttempts:t?.maxAttempts??(0,be.Z)(le.qs),region:t?.region??(0,be.Z)(oe.GG,oe.zH),requestHandler:ye.$c.create(t?.requestHandler??n),retryMode:t?.retryMode??(0,be.Z)({...le.kN,default:async()=>(await n()).retryMode||ve.L0}),sha256:t?.sha256??xe.V.bind(null,"sha256"),streamCollector:t?.streamCollector??ye.kv,useDualstackEndpoint:t?.useDualstackEndpoint??(0,be.Z)(oe.e$),useFipsEndpoint:t?.useFipsEndpoint??(0,be.Z)(oe.Ko),userAgentAppId:t?.userAgentAppId??(0,be.Z)(me.hV)}})(t||{}),{...n,useDualstackEndpoint:n.useDualstackEndpoint??!1,useFipsEndpoint:n.useFipsEndpoint??!1,useGlobalEndpoint:n.useGlobalEndpoint??!1,defaultSigningName:"sts"});var n;const s=(0,ie.Dc)(e),o=(0,le.$z)(s),a=(0,oe.TD)(o),l=(0,ee.OV)(a),c=((t,e)=>{const n={...(0,hn.Rq)(t),...(0,r.xA)(t),...(0,A.eS)(t),...gn(t)};return e.forEach((t=>t.configure(n))),{...t,...(0,hn.$3)(n),...(0,r.uv)(n),...(0,A.jt)(n),...(s=n,{httpAuthSchemes:s.httpAuthSchemes(),httpAuthSchemeProvider:s.httpAuthSchemeProvider(),credentials:s.credentials()})};var s})((t=>{const e=(n=t,{...n,stsClientCtor:fn});var n;return{...(0,ce.h)(e)}})((0,i.Co)(l)),t?.extensions||[]);super(c),this.config=c,this.middlewareStack.use((0,ie.sM)(this.config)),this.middlewareStack.use((0,le.ey)(this.config)),this.middlewareStack.use((0,ae.vK)(this.config)),this.middlewareStack.use((0,ee.TC)(this.config)),this.middlewareStack.use((0,ne.Y7)(this.config)),this.middlewareStack.use((0,se.n4)(this.config)),this.middlewareStack.use((0,re.wB)(this.config,{httpAuthSchemeParametersProvider:de,identityProviderConfigProvider:async t=>new re.h$({"aws.auth#sigv4":t.credentials})})),this.middlewareStack.use((0,re.lW)(this.config))}destroy(){super.destroy()}}const mn=(t,e)=>e?class extends t{constructor(t){super(t);for(const t of e)this.middlewareStack.use(t)}}:t,xn=(t={},e)=>((t,e)=>{let n,i;return async(o,r)=>{if(i=o,!n){const{logger:s=t?.parentClientConfig?.logger,region:o,requestHandler:r=t?.parentClientConfig?.requestHandler,credentialProviderLogger:a}=t,l=await Qt(o,t?.parentClientConfig?.region,a),c=!te(r);n=new e({credentialDefaultProvider:()=>async()=>i,region:l,requestHandler:c?r:void 0,logger:s})}const{Credentials:a,AssumedRoleUser:l}=await n.send(new Xt(r));if(!a||!a.AccessKeyId||!a.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRole call with role ${r.RoleArn}`);const c=Jt(l),u={accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,sessionToken:a.SessionToken,expiration:a.Expiration,...a.CredentialScope&&{credentialScope:a.CredentialScope},...c&&{accountId:c}};return(0,s.g)(u,"CREDENTIALS_STS_ASSUME_ROLE","i"),u}})(t,mn(fn,e)),bn=(t={},e)=>((t,e)=>{let n;return async i=>{if(!n){const{logger:s=t?.parentClientConfig?.logger,region:i,requestHandler:o=t?.parentClientConfig?.requestHandler,credentialProviderLogger:r}=t,a=await Qt(i,t?.parentClientConfig?.region,r),l=!te(o);n=new e({region:a,requestHandler:l?o:void 0,logger:s})}const{Credentials:o,AssumedRoleUser:r}=await n.send(new Zt(i));if(!o||!o.AccessKeyId||!o.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${i.RoleArn}`);const a=Jt(r),l={accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.SessionToken,expiration:o.Expiration,...o.CredentialScope&&{credentialScope:o.CredentialScope},...a&&{accountId:a}};return a&&(0,s.g)(l,"RESOLVED_ACCOUNT_ID","T"),(0,s.g)(l,"CREDENTIALS_STS_ASSUME_ROLE_WEB_ID","k"),l}})(t,mn(fn,e))},6454:(t,e,n)=>{"use strict";const s=n(3918),i=n(2923),o=n(8904);t.exports={XMLParser:i,XMLValidator:s,XMLBuilder:o}},5334:(t,e)=>{"use strict";const n=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",s="["+n+"]["+n+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*",i=new RegExp("^"+s+"$");e.isExist=function(t){return void 0!==t},e.isEmptyObject=function(t){return 0===Object.keys(t).length},e.merge=function(t,e,n){if(e){const s=Object.keys(e),i=s.length;for(let o=0;o<i;o++)t[s[o]]="strict"===n?[e[s[o]]]:e[s[o]]}},e.getValue=function(t){return e.isExist(t)?t:""},e.isName=function(t){return!(null==i.exec(t))},e.getAllMatches=function(t,e){const n=[];let s=e.exec(t);for(;s;){const i=[];i.startIndex=e.lastIndex-s[0].length;const o=s.length;for(let t=0;t<o;t++)i.push(s[t]);n.push(i),s=e.exec(t)}return n},e.nameRegexp=s},3918:(t,e,n)=>{"use strict";const s=n(5334),i={allowBooleanAttributes:!1,unpairedTags:[]};function o(t){return" "===t||"\t"===t||"\n"===t||"\r"===t}function r(t,e){const n=e;for(;e<t.length;e++)if("?"!=t[e]&&" "!=t[e]);else{const s=t.substr(n,e-n);if(e>5&&"xml"===s)return g("InvalidXml","XML declaration allowed only at the start of the document.",m(t,e));if("?"==t[e]&&">"==t[e+1]){e++;break}}return e}function a(t,e){if(t.length>e+5&&"-"===t[e+1]&&"-"===t[e+2]){for(e+=3;e<t.length;e++)if("-"===t[e]&&"-"===t[e+1]&&">"===t[e+2]){e+=2;break}}else if(t.length>e+8&&"D"===t[e+1]&&"O"===t[e+2]&&"C"===t[e+3]&&"T"===t[e+4]&&"Y"===t[e+5]&&"P"===t[e+6]&&"E"===t[e+7]){let n=1;for(e+=8;e<t.length;e++)if("<"===t[e])n++;else if(">"===t[e]&&(n--,0===n))break}else if(t.length>e+9&&"["===t[e+1]&&"C"===t[e+2]&&"D"===t[e+3]&&"A"===t[e+4]&&"T"===t[e+5]&&"A"===t[e+6]&&"["===t[e+7])for(e+=8;e<t.length;e++)if("]"===t[e]&&"]"===t[e+1]&&">"===t[e+2]){e+=2;break}return e}e.validate=function(t,e){e=Object.assign({},i,e);const n=[];let l=!1,c=!1;"\ufeff"===t[0]&&(t=t.substr(1));for(let i=0;i<t.length;i++)if("<"===t[i]&&"?"===t[i+1]){if(i+=2,i=r(t,i),i.err)return i}else{if("<"!==t[i]){if(o(t[i]))continue;return g("InvalidChar","char '"+t[i]+"' is not expected.",m(t,i))}{let f=i;if(i++,"!"===t[i]){i=a(t,i);continue}{let x=!1;"/"===t[i]&&(x=!0,i++);let b="";for(;i<t.length&&">"!==t[i]&&" "!==t[i]&&"\t"!==t[i]&&"\n"!==t[i]&&"\r"!==t[i];i++)b+=t[i];if(b=b.trim(),"/"===b[b.length-1]&&(b=b.substring(0,b.length-1),i--),d=b,!s.isName(d)){let e;return e=0===b.trim().length?"Invalid space after '<'.":"Tag '"+b+"' is an invalid name.",g("InvalidTag",e,m(t,i))}const y=u(t,i);if(!1===y)return g("InvalidAttr","Attributes for '"+b+"' have open quote.",m(t,i));let E=y.value;if(i=y.index,"/"===E[E.length-1]){const n=i-E.length;E=E.substring(0,E.length-1);const s=p(E,e);if(!0!==s)return g(s.err.code,s.err.msg,m(t,n+s.err.line));l=!0}else if(x){if(!y.tagClosed)return g("InvalidTag","Closing tag '"+b+"' doesn't have proper closing.",m(t,i));if(E.trim().length>0)return g("InvalidTag","Closing tag '"+b+"' can't have attributes or invalid starting.",m(t,f));if(0===n.length)return g("InvalidTag","Closing tag '"+b+"' has not been opened.",m(t,f));{const e=n.pop();if(b!==e.tagName){let n=m(t,e.tagStartPos);return g("InvalidTag","Expected closing tag '"+e.tagName+"' (opened in line "+n.line+", col "+n.col+") instead of closing tag '"+b+"'.",m(t,f))}0==n.length&&(c=!0)}}else{const s=p(E,e);if(!0!==s)return g(s.err.code,s.err.msg,m(t,i-E.length+s.err.line));if(!0===c)return g("InvalidXml","Multiple possible root nodes found.",m(t,i));-1!==e.unpairedTags.indexOf(b)||n.push({tagName:b,tagStartPos:f}),l=!0}for(i++;i<t.length;i++)if("<"===t[i]){if("!"===t[i+1]){i++,i=a(t,i);continue}if("?"!==t[i+1])break;if(i=r(t,++i),i.err)return i}else if("&"===t[i]){const e=h(t,i);if(-1==e)return g("InvalidChar","char '&' is not expected.",m(t,i));i=e}else if(!0===c&&!o(t[i]))return g("InvalidXml","Extra text at the end",m(t,i));"<"===t[i]&&i--}}}var d;return l?1==n.length?g("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",m(t,n[0].tagStartPos)):!(n.length>0)||g("InvalidXml","Invalid '"+JSON.stringify(n.map((t=>t.tagName)),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):g("InvalidXml","Start tag expected.",1)};const l='"',c="'";function u(t,e){let n="",s="",i=!1;for(;e<t.length;e++){if(t[e]===l||t[e]===c)""===s?s=t[e]:s!==t[e]||(s="");else if(">"===t[e]&&""===s){i=!0;break}n+=t[e]}return""===s&&{value:n,index:e,tagClosed:i}}const d=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function p(t,e){const n=s.getAllMatches(t,d),i={};for(let t=0;t<n.length;t++){if(0===n[t][1].length)return g("InvalidAttr","Attribute '"+n[t][2]+"' has no space in starting.",x(n[t]));if(void 0!==n[t][3]&&void 0===n[t][4])return g("InvalidAttr","Attribute '"+n[t][2]+"' is without value.",x(n[t]));if(void 0===n[t][3]&&!e.allowBooleanAttributes)return g("InvalidAttr","boolean attribute '"+n[t][2]+"' is not allowed.",x(n[t]));const s=n[t][2];if(!f(s))return g("InvalidAttr","Attribute '"+s+"' is an invalid name.",x(n[t]));if(i.hasOwnProperty(s))return g("InvalidAttr","Attribute '"+s+"' is repeated.",x(n[t]));i[s]=1}return!0}function h(t,e){if(";"===t[++e])return-1;if("#"===t[e])return function(t,e){let n=/\d/;for("x"===t[e]&&(e++,n=/[\da-fA-F]/);e<t.length;e++){if(";"===t[e])return e;if(!t[e].match(n))break}return-1}(t,++e);let n=0;for(;e<t.length;e++,n++)if(!(t[e].match(/\w/)&&n<20)){if(";"===t[e])break;return-1}return e}function g(t,e,n){return{err:{code:t,msg:e,line:n.line||n,col:n.col}}}function f(t){return s.isName(t)}function m(t,e){const n=t.substring(0,e).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function x(t){return t.startIndex+t[1].length}},8904:(t,e,n)=>{"use strict";const s=n(2788),i={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function o(t){this.options=Object.assign({},i,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=l),this.processTextOrObjNode=r,this.options.format?(this.indentate=a,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function r(t,e,n){const s=this.j2x(t,n+1);return void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,s.attrStr,n):this.buildObjectNode(s.val,e,s.attrStr,n)}function a(t){return this.options.indentBy.repeat(t)}function l(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}o.prototype.build=function(t){return this.options.preserveOrder?s(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)},o.prototype.j2x=function(t,e){let n="",s="";for(let i in t)if(Object.prototype.hasOwnProperty.call(t,i))if(void 0===t[i])this.isAttribute(i)&&(s+="");else if(null===t[i])this.isAttribute(i)?s+="":"?"===i[0]?s+=this.indentate(e)+"<"+i+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+i+"/"+this.tagEndChar;else if(t[i]instanceof Date)s+=this.buildTextValNode(t[i],i,"",e);else if("object"!=typeof t[i]){const o=this.isAttribute(i);if(o)n+=this.buildAttrPairStr(o,""+t[i]);else if(i===this.options.textNodeName){let e=this.options.tagValueProcessor(i,""+t[i]);s+=this.replaceEntitiesValue(e)}else s+=this.buildTextValNode(t[i],i,"",e)}else if(Array.isArray(t[i])){const n=t[i].length;let o="",r="";for(let a=0;a<n;a++){const n=t[i][a];if(void 0===n);else if(null===n)"?"===i[0]?s+=this.indentate(e)+"<"+i+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+i+"/"+this.tagEndChar;else if("object"==typeof n)if(this.options.oneListGroup){const t=this.j2x(n,e+1);o+=t.val,this.options.attributesGroupName&&n.hasOwnProperty(this.options.attributesGroupName)&&(r+=t.attrStr)}else o+=this.processTextOrObjNode(n,i,e);else if(this.options.oneListGroup){let t=this.options.tagValueProcessor(i,n);t=this.replaceEntitiesValue(t),o+=t}else o+=this.buildTextValNode(n,i,"",e)}this.options.oneListGroup&&(o=this.buildObjectNode(o,i,r,e)),s+=o}else if(this.options.attributesGroupName&&i===this.options.attributesGroupName){const e=Object.keys(t[i]),s=e.length;for(let o=0;o<s;o++)n+=this.buildAttrPairStr(e[o],""+t[i][e[o]])}else s+=this.processTextOrObjNode(t[i],i,e);return{attrStr:n,val:s}},o.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&"true"===e?" "+t:" "+t+'="'+e+'"'},o.prototype.buildObjectNode=function(t,e,n,s){if(""===t)return"?"===e[0]?this.indentate(s)+"<"+e+n+"?"+this.tagEndChar:this.indentate(s)+"<"+e+n+this.closeTag(e)+this.tagEndChar;{let i="</"+e+this.tagEndChar,o="";return"?"===e[0]&&(o="?",i=""),!n&&""!==n||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&e===this.options.commentPropName&&0===o.length?this.indentate(s)+`\x3c!--${t}--\x3e`+this.newLine:this.indentate(s)+"<"+e+n+o+this.tagEndChar+t+this.indentate(s)+i:this.indentate(s)+"<"+e+n+o+">"+t+i}},o.prototype.closeTag=function(t){let e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":`></${t}`,e},o.prototype.buildTextValNode=function(t,e,n,s){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName)return this.indentate(s)+`<![CDATA[${t}]]>`+this.newLine;if(!1!==this.options.commentPropName&&e===this.options.commentPropName)return this.indentate(s)+`\x3c!--${t}--\x3e`+this.newLine;if("?"===e[0])return this.indentate(s)+"<"+e+n+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(e,t);return i=this.replaceEntitiesValue(i),""===i?this.indentate(s)+"<"+e+n+this.closeTag(e)+this.tagEndChar:this.indentate(s)+"<"+e+n+">"+i+"</"+e+this.tagEndChar}},o.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const n=this.options.entities[e];t=t.replace(n.regex,n.val)}return t},t.exports=o},2788:t=>{function e(t,r,a,l){let c="",u=!1;for(let d=0;d<t.length;d++){const p=t[d],h=n(p);if(void 0===h)continue;let g="";if(g=0===a.length?h:`${a}.${h}`,h===r.textNodeName){let t=p[h];i(g,r)||(t=r.tagValueProcessor(h,t),t=o(t,r)),u&&(c+=l),c+=t,u=!1;continue}if(h===r.cdataPropName){u&&(c+=l),c+=`<![CDATA[${p[h][0][r.textNodeName]}]]>`,u=!1;continue}if(h===r.commentPropName){c+=l+`\x3c!--${p[h][0][r.textNodeName]}--\x3e`,u=!0;continue}if("?"===h[0]){const t=s(p[":@"],r),e="?xml"===h?"":l;let n=p[h][0][r.textNodeName];n=0!==n.length?" "+n:"",c+=e+`<${h}${n}${t}?>`,u=!0;continue}let f=l;""!==f&&(f+=r.indentBy);const m=l+`<${h}${s(p[":@"],r)}`,x=e(p[h],r,g,f);-1!==r.unpairedTags.indexOf(h)?r.suppressUnpairedNode?c+=m+">":c+=m+"/>":x&&0!==x.length||!r.suppressEmptyNode?x&&x.endsWith(">")?c+=m+`>${x}${l}</${h}>`:(c+=m+">",x&&""!==l&&(x.includes("/>")||x.includes("</"))?c+=l+r.indentBy+x+l:c+=x,c+=`</${h}>`):c+=m+"/>",u=!0}return c}function n(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const s=e[n];if(t.hasOwnProperty(s)&&":@"!==s)return s}}function s(t,e){let n="";if(t&&!e.ignoreAttributes)for(let s in t){if(!t.hasOwnProperty(s))continue;let i=e.attributeValueProcessor(s,t[s]);i=o(i,e),!0===i&&e.suppressBooleanAttributes?n+=` ${s.substr(e.attributeNamePrefix.length)}`:n+=` ${s.substr(e.attributeNamePrefix.length)}="${i}"`}return n}function i(t,e){let n=(t=t.substr(0,t.length-e.textNodeName.length-1)).substr(t.lastIndexOf(".")+1);for(let s in e.stopNodes)if(e.stopNodes[s]===t||e.stopNodes[s]==="*."+n)return!0;return!1}function o(t,e){if(t&&t.length>0&&e.processEntities)for(let n=0;n<e.entities.length;n++){const s=e.entities[n];t=t.replace(s.regex,s.val)}return t}t.exports=function(t,n){let s="";return n.format&&n.indentBy.length>0&&(s="\n"),e(t,n,"",s)}},9400:(t,e,n)=>{const s=n(5334);function i(t,e){let n="";for(;e<t.length&&"'"!==t[e]&&'"'!==t[e];e++)n+=t[e];if(n=n.trim(),-1!==n.indexOf(" "))throw new Error("External entites are not supported");const s=t[e++];let i="";for(;e<t.length&&t[e]!==s;e++)i+=t[e];return[n,i,e]}function o(t,e){return"!"===t[e+1]&&"-"===t[e+2]&&"-"===t[e+3]}function r(t,e){return"!"===t[e+1]&&"E"===t[e+2]&&"N"===t[e+3]&&"T"===t[e+4]&&"I"===t[e+5]&&"T"===t[e+6]&&"Y"===t[e+7]}function a(t,e){return"!"===t[e+1]&&"E"===t[e+2]&&"L"===t[e+3]&&"E"===t[e+4]&&"M"===t[e+5]&&"E"===t[e+6]&&"N"===t[e+7]&&"T"===t[e+8]}function l(t,e){return"!"===t[e+1]&&"A"===t[e+2]&&"T"===t[e+3]&&"T"===t[e+4]&&"L"===t[e+5]&&"I"===t[e+6]&&"S"===t[e+7]&&"T"===t[e+8]}function c(t,e){return"!"===t[e+1]&&"N"===t[e+2]&&"O"===t[e+3]&&"T"===t[e+4]&&"A"===t[e+5]&&"T"===t[e+6]&&"I"===t[e+7]&&"O"===t[e+8]&&"N"===t[e+9]}function u(t){if(s.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}t.exports=function(t,e){const n={};if("O"!==t[e+3]||"C"!==t[e+4]||"T"!==t[e+5]||"Y"!==t[e+6]||"P"!==t[e+7]||"E"!==t[e+8])throw new Error("Invalid Tag instead of DOCTYPE");{e+=9;let s=1,d=!1,p=!1,h="";for(;e<t.length;e++)if("<"!==t[e]||p)if(">"===t[e]){if(p?"-"===t[e-1]&&"-"===t[e-2]&&(p=!1,s--):s--,0===s)break}else"["===t[e]?d=!0:h+=t[e];else{if(d&&r(t,e))e+=7,[entityName,val,e]=i(t,e+1),-1===val.indexOf("&")&&(n[u(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(d&&a(t,e))e+=8;else if(d&&l(t,e))e+=8;else if(d&&c(t,e))e+=9;else{if(!o)throw new Error("Invalid DOCTYPE");p=!0}s++,h=""}if(0!==s)throw new Error("Unclosed DOCTYPE")}return{entities:n,i:e}}},460:(t,e)=>{const n={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,n){return t}};e.buildOptions=function(t){return Object.assign({},n,t)},e.defaultOptions=n},7680:(t,e,n)=>{"use strict";const s=n(5334),i=n(3832),o=n(9400),r=n(7983);function a(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const s=e[n];this.lastEntities[s]={regex:new RegExp("&"+s+";","g"),val:t[s]}}}function l(t,e,n,s,i,o,r){if(void 0!==t&&(this.options.trimValues&&!s&&(t=t.trim()),t.length>0)){r||(t=this.replaceEntitiesValue(t));const s=this.options.tagValueProcessor(e,t,n,i,o);return null==s?t:typeof s!=typeof t||s!==t?s:this.options.trimValues||t.trim()===t?E(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function c(t){if(this.options.removeNSPrefix){const e=t.split(":"),n="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=n+e[1])}return t}const u=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function d(t,e,n){if(!this.options.ignoreAttributes&&"string"==typeof t){const n=s.getAllMatches(t,u),i=n.length,o={};for(let t=0;t<i;t++){const s=this.resolveNameSpace(n[t][1]);let i=n[t][4],r=this.options.attributeNamePrefix+s;if(s.length)if(this.options.transformAttributeName&&(r=this.options.transformAttributeName(r)),"__proto__"===r&&(r="#__proto__"),void 0!==i){this.options.trimValues&&(i=i.trim()),i=this.replaceEntitiesValue(i);const t=this.options.attributeValueProcessor(s,i,e);o[r]=null==t?i:typeof t!=typeof i||t!==i?t:E(i,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[r]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const t={};return t[this.options.attributesGroupName]=o,t}return o}}const p=function(t){t=t.replace(/\r\n?/g,"\n");const e=new i("!xml");let n=e,s="",r="";for(let a=0;a<t.length;a++)if("<"===t[a])if("/"===t[a+1]){const e=x(t,">",a,"Closing Tag is not closed.");let i=t.substring(a+2,e).trim();if(this.options.removeNSPrefix){const t=i.indexOf(":");-1!==t&&(i=i.substr(t+1))}this.options.transformTagName&&(i=this.options.transformTagName(i)),n&&(s=this.saveTextToParentTag(s,n,r));const o=r.substring(r.lastIndexOf(".")+1);if(i&&-1!==this.options.unpairedTags.indexOf(i))throw new Error(`Unpaired tag can not be used as closing tag: </${i}>`);let l=0;o&&-1!==this.options.unpairedTags.indexOf(o)?(l=r.lastIndexOf(".",r.lastIndexOf(".")-1),this.tagsNodeStack.pop()):l=r.lastIndexOf("."),r=r.substring(0,l),n=this.tagsNodeStack.pop(),s="",a=e}else if("?"===t[a+1]){let e=b(t,a,!1,"?>");if(!e)throw new Error("Pi Tag is not closed.");if(s=this.saveTextToParentTag(s,n,r),this.options.ignoreDeclaration&&"?xml"===e.tagName||this.options.ignorePiTags);else{const t=new i(e.tagName);t.add(this.options.textNodeName,""),e.tagName!==e.tagExp&&e.attrExpPresent&&(t[":@"]=this.buildAttributesMap(e.tagExp,r,e.tagName)),this.addChild(n,t,r)}a=e.closeIndex+1}else if("!--"===t.substr(a+1,3)){const e=x(t,"--\x3e",a+4,"Comment is not closed.");if(this.options.commentPropName){const i=t.substring(a+4,e-2);s=this.saveTextToParentTag(s,n,r),n.add(this.options.commentPropName,[{[this.options.textNodeName]:i}])}a=e}else if("!D"===t.substr(a+1,2)){const e=o(t,a);this.docTypeEntities=e.entities,a=e.i}else if("!["===t.substr(a+1,2)){const e=x(t,"]]>",a,"CDATA is not closed.")-2,i=t.substring(a+9,e);s=this.saveTextToParentTag(s,n,r);let o=this.parseTextData(i,n.tagname,r,!0,!1,!0,!0);null==o&&(o=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:i}]):n.add(this.options.textNodeName,o),a=e+2}else{let o=b(t,a,this.options.removeNSPrefix),l=o.tagName;const c=o.rawTagName;let u=o.tagExp,d=o.attrExpPresent,p=o.closeIndex;this.options.transformTagName&&(l=this.options.transformTagName(l)),n&&s&&"!xml"!==n.tagname&&(s=this.saveTextToParentTag(s,n,r,!1));const h=n;if(h&&-1!==this.options.unpairedTags.indexOf(h.tagname)&&(n=this.tagsNodeStack.pop(),r=r.substring(0,r.lastIndexOf("."))),l!==e.tagname&&(r+=r?"."+l:l),this.isItStopNode(this.options.stopNodes,r,l)){let e="";if(u.length>0&&u.lastIndexOf("/")===u.length-1)"/"===l[l.length-1]?(l=l.substr(0,l.length-1),r=r.substr(0,r.length-1),u=l):u=u.substr(0,u.length-1),a=o.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(l))a=o.closeIndex;else{const n=this.readStopNodeData(t,c,p+1);if(!n)throw new Error(`Unexpected end of ${c}`);a=n.i,e=n.tagContent}const s=new i(l);l!==u&&d&&(s[":@"]=this.buildAttributesMap(u,r,l)),e&&(e=this.parseTextData(e,l,r,!0,d,!0,!0)),r=r.substr(0,r.lastIndexOf(".")),s.add(this.options.textNodeName,e),this.addChild(n,s,r)}else{if(u.length>0&&u.lastIndexOf("/")===u.length-1){"/"===l[l.length-1]?(l=l.substr(0,l.length-1),r=r.substr(0,r.length-1),u=l):u=u.substr(0,u.length-1),this.options.transformTagName&&(l=this.options.transformTagName(l));const t=new i(l);l!==u&&d&&(t[":@"]=this.buildAttributesMap(u,r,l)),this.addChild(n,t,r),r=r.substr(0,r.lastIndexOf("."))}else{const t=new i(l);this.tagsNodeStack.push(n),l!==u&&d&&(t[":@"]=this.buildAttributesMap(u,r,l)),this.addChild(n,t,r),n=t}s="",a=p}}else s+=t[a];return e.child};function h(t,e,n){const s=this.options.updateTag(e.tagname,n,e[":@"]);!1===s||("string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e))}const g=function(t){if(this.options.processEntities){for(let e in this.docTypeEntities){const n=this.docTypeEntities[e];t=t.replace(n.regx,n.val)}for(let e in this.lastEntities){const n=this.lastEntities[e];t=t.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const n=this.htmlEntities[e];t=t.replace(n.regex,n.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function f(t,e,n,s){return t&&(void 0===s&&(s=0===Object.keys(e.child).length),void 0!==(t=this.parseTextData(t,e.tagname,n,!1,!!e[":@"]&&0!==Object.keys(e[":@"]).length,s))&&""!==t&&e.add(this.options.textNodeName,t),t=""),t}function m(t,e,n){const s="*."+n;for(const n in t){const i=t[n];if(s===i||e===i)return!0}return!1}function x(t,e,n,s){const i=t.indexOf(e,n);if(-1===i)throw new Error(s);return i+e.length-1}function b(t,e,n,s=">"){const i=function(t,e,n=">"){let s,i="";for(let o=e;o<t.length;o++){let e=t[o];if(s)e===s&&(s="");else if('"'===e||"'"===e)s=e;else if(e===n[0]){if(!n[1])return{data:i,index:o};if(t[o+1]===n[1])return{data:i,index:o}}else"\t"===e&&(e=" ");i+=e}}(t,e+1,s);if(!i)return;let o=i.data;const r=i.index,a=o.search(/\s/);let l=o,c=!0;-1!==a&&(l=o.substring(0,a),o=o.substring(a+1).trimStart());const u=l;if(n){const t=l.indexOf(":");-1!==t&&(l=l.substr(t+1),c=l!==i.data.substr(t+1))}return{tagName:l,tagExp:o,closeIndex:r,attrExpPresent:c,rawTagName:u}}function y(t,e,n){const s=n;let i=1;for(;n<t.length;n++)if("<"===t[n])if("/"===t[n+1]){const o=x(t,">",n,`${e} is not closed`);if(t.substring(n+2,o).trim()===e&&(i--,0===i))return{tagContent:t.substring(s,n),i:o};n=o}else if("?"===t[n+1])n=x(t,"?>",n+1,"StopNode is not closed.");else if("!--"===t.substr(n+1,3))n=x(t,"--\x3e",n+3,"StopNode is not closed.");else if("!["===t.substr(n+1,2))n=x(t,"]]>",n,"StopNode is not closed.")-2;else{const s=b(t,n,">");s&&((s&&s.tagName)===e&&"/"!==s.tagExp[s.tagExp.length-1]&&i++,n=s.closeIndex)}}function E(t,e,n){if(e&&"string"==typeof t){const e=t.trim();return"true"===e||"false"!==e&&r(t,n)}return s.isExist(t)?t:""}t.exports=class{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,e)=>String.fromCharCode(Number.parseInt(e,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,e)=>String.fromCharCode(Number.parseInt(e,16))}},this.addExternalEntities=a,this.parseXml=p,this.parseTextData=l,this.resolveNameSpace=c,this.buildAttributesMap=d,this.isItStopNode=m,this.replaceEntitiesValue=g,this.readStopNodeData=y,this.saveTextToParentTag=f,this.addChild=h}}},2923:(t,e,n)=>{const{buildOptions:s}=n(460),i=n(7680),{prettify:o}=n(5629),r=n(3918);t.exports=class{constructor(t){this.externalEntities={},this.options=s(t)}parse(t,e){if("string"==typeof t);else{if(!t.toString)throw new Error("XML data is accepted in String or Bytes[] form.");t=t.toString()}if(e){!0===e&&(e={});const n=r.validate(t,e);if(!0!==n)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}const n=new i(this.options);n.addExternalEntities(this.externalEntities);const s=n.parseXml(t);return this.options.preserveOrder||void 0===s?s:o(s,this.options)}addEntity(t,e){if(-1!==e.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==t.indexOf("&")||-1!==t.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if("&"===e)throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=e}}},5629:(t,e)=>{"use strict";function n(t,e,r){let a;const l={};for(let c=0;c<t.length;c++){const u=t[c],d=s(u);let p="";if(p=void 0===r?d:r+"."+d,d===e.textNodeName)void 0===a?a=u[d]:a+=""+u[d];else{if(void 0===d)continue;if(u[d]){let t=n(u[d],e,p);const s=o(t,e);u[":@"]?i(t,u[":@"],p,e):1!==Object.keys(t).length||void 0===t[e.textNodeName]||e.alwaysCreateTextNode?0===Object.keys(t).length&&(e.alwaysCreateTextNode?t[e.textNodeName]="":t=""):t=t[e.textNodeName],void 0!==l[d]&&l.hasOwnProperty(d)?(Array.isArray(l[d])||(l[d]=[l[d]]),l[d].push(t)):e.isArray(d,p,s)?l[d]=[t]:l[d]=t}}}return"string"==typeof a?a.length>0&&(l[e.textNodeName]=a):void 0!==a&&(l[e.textNodeName]=a),l}function s(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const n=e[t];if(":@"!==n)return n}}function i(t,e,n,s){if(e){const i=Object.keys(e),o=i.length;for(let r=0;r<o;r++){const o=i[r];s.isArray(o,n+"."+o,!0,!0)?t[o]=[e[o]]:t[o]=e[o]}}}function o(t,e){const{textNodeName:n}=e,s=Object.keys(t).length;return 0===s||!(1!==s||!t[n]&&"boolean"!=typeof t[n]&&0!==t[n])}e.prettify=function(t,e){return n(t,e)}},3832:t=>{"use strict";t.exports=class{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}},7983:t=>{const e=/^[-+]?0x[a-fA-F0-9]+$/,n=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const s={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};t.exports=function(t,i={}){if(i=Object.assign({},s,i),!t||"string"!=typeof t)return t;let o=t.trim();if(void 0!==i.skipLike&&i.skipLike.test(o))return t;if(i.hex&&e.test(o))return Number.parseInt(o,16);{const e=n.exec(o);if(e){const n=e[1],s=e[2];let a=(r=e[3])&&-1!==r.indexOf(".")?("."===(r=r.replace(/0+$/,""))?r="0":"."===r[0]?r="0"+r:"."===r[r.length-1]&&(r=r.substr(0,r.length-1)),r):r;const l=e[4]||e[6];if(!i.leadingZeros&&s.length>0&&n&&"."!==o[2])return t;if(!i.leadingZeros&&s.length>0&&!n&&"."!==o[1])return t;{const e=Number(o),r=""+e;return-1!==r.search(/[eE]/)||l?i.eNotation?e:t:-1!==o.indexOf(".")?"0"===r&&""===a||r===a||n&&r==="-"+a?e:t:s?a===r||n+a===r?e:t:o===r||o===n+r?e:t}}return t}var r}}};