create-sailor 1.9.1 → 1.9.2

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.
Files changed (71) hide show
  1. package/dist/aws-kms-FFRN23DK.js +1 -0
  2. package/dist/bowser-2VXD6AQS.js +11 -0
  3. package/dist/chunk-6MSNEPUX.js +0 -0
  4. package/dist/chunk-A3H5SUSR.js +8 -0
  5. package/dist/chunk-AN6QWW3N.js +1 -0
  6. package/dist/chunk-CVCZBECH.js +1 -0
  7. package/dist/chunk-GA44DNS2.js +1 -0
  8. package/dist/chunk-LDZWCNWB.js +0 -0
  9. package/dist/chunk-M3NEWJ7L.js +1 -0
  10. package/dist/{chunk-P2WEIQRQ.js → chunk-MGGNSWUA.js} +1 -1
  11. package/dist/chunk-MYIHTCRS.js +4 -0
  12. package/dist/chunk-PA4CKDRJ.js +1 -0
  13. package/dist/chunk-SYWJHPRX.js +0 -0
  14. package/dist/chunk-UWHWNXNX.js +19 -0
  15. package/dist/chunk-X6LE6K3W.js +0 -0
  16. package/dist/chunk-Z4YWESTY.js +2 -0
  17. package/dist/chunk-ZJ3BTCD6.js +17 -0
  18. package/dist/{credits-OHCRPX6E.js → credits-UUPQKRQZ.js} +2 -2
  19. package/dist/dist-23KDUT4O.js +1 -0
  20. package/dist/{dist-NHX3PJTW.js → dist-ZZCU5PKC.js} +2 -2
  21. package/dist/dist-es-7HF5URFJ.js +1 -0
  22. package/dist/dist-es-BORZTE76.js +1 -0
  23. package/dist/dist-es-CN2GMFBK.js +1 -0
  24. package/dist/dist-es-FQ6CEUEU.js +1 -0
  25. package/dist/dist-es-FSE4MSDA.js +5 -0
  26. package/dist/dist-es-H47VUS6Q.js +2 -0
  27. package/dist/dist-es-JCIK4C4M.js +2 -0
  28. package/dist/dist-es-MFZXYPBY.js +1 -0
  29. package/dist/dist-es-PREZ4TU2.js +1 -0
  30. package/dist/dist-es-TCZQ4KMP.js +2 -0
  31. package/dist/dist-es-Y7VP7FI6.js +2 -0
  32. package/dist/dist-es-YN4LRIZR.js +5 -0
  33. package/dist/event-streams-TNY7XPBF.js +1 -0
  34. package/dist/index.js +71 -71
  35. package/dist/loadSso-2XZQIDZP.js +1 -0
  36. package/dist/loadSso-FBBI5PDJ.js +1 -0
  37. package/dist/signin-CJMG23UU.js +1 -0
  38. package/dist/sso-oidc-26OCCRMC.js +1 -0
  39. package/dist/sts-4U2U3ZK4.js +1 -0
  40. package/dist/sts-CP4OREEC.js +1 -0
  41. package/package.json +14 -15
  42. package/dist/aws-kms-3GX7ZOSJ.js +0 -1
  43. package/dist/chunk-FNDUJLS6.js +0 -1
  44. package/dist/chunk-HGJYEXMU.js +0 -1
  45. package/dist/chunk-HX3EZBGO.js +0 -30
  46. package/dist/chunk-JTXBZ2SU.js +0 -1
  47. package/dist/chunk-KRX2KWWT.js +0 -1
  48. package/dist/chunk-OIQB5F6Y.js +0 -1
  49. package/dist/chunk-RH2FFVSB.js +0 -1
  50. package/dist/chunk-SPHQRDN5.js +0 -1
  51. package/dist/chunk-STX7THHW.js +0 -21
  52. package/dist/chunk-TX7AAHER.js +0 -1
  53. package/dist/chunk-VFREGXHN.js +0 -1
  54. package/dist/chunk-W5TBFCWY.js +0 -4
  55. package/dist/chunk-WU3IV4WF.js +0 -1
  56. package/dist/chunk-XB6R2VIU.js +0 -1
  57. package/dist/chunk-ZCWB3HFB.js +0 -1
  58. package/dist/dist-UXDXDLES.js +0 -1
  59. package/dist/dist-es-B5M7V6O6.js +0 -1
  60. package/dist/dist-es-FU66ZQS5.js +0 -1
  61. package/dist/dist-es-KE65J6GC.js +0 -1
  62. package/dist/dist-es-PFLN3FTL.js +0 -5
  63. package/dist/dist-es-U3NYQORW.js +0 -1
  64. package/dist/dist-es-VG3XXJ7M.js +0 -2
  65. package/dist/dist-es-WAHVDQ3F.js +0 -2
  66. package/dist/event-streams-BXAP5G2H.js +0 -1
  67. package/dist/event-streams-SGW54BDO.js +0 -1
  68. package/dist/loadSso-WRXP2HXL.js +0 -1
  69. package/dist/signin-JB7STGTR.js +0 -1
  70. package/dist/sso-oidc-LTNOJMPI.js +0 -1
  71. package/dist/sts-RKUL4Q47.js +0 -5
@@ -0,0 +1,2 @@
1
+ import{A as Ge,b as de,c as Me,d as ue,e as q,f as Le,k as Q,l as ze,m as He,n as Ue,o as ke,p as $e,q as X,r as Ve,x as je,y as J}from"./chunk-MYIHTCRS.js";var Y;(function(r){r.MD5="md5",r.CRC32="crc32",r.CRC32C="crc32c",r.SHA1="sha1",r.SHA256="sha256"})(Y||(Y={}));var Z="__smithy_context";var ge;(function(r){r.HTTP="http",r.HTTPS="https"})(ge||(ge={}));var b;(function(r){r.PROFILE="profile",r.SSO_SESSION="sso-session",r.SERVICES="services"})(b||(b={}));var M=r=>r[Z]||(r[Z]={});var Pt=r=>{if(typeof r=="function")return r;let e=Promise.resolve(r);return()=>e};function Be(r){let e={};if(r=r.replace(/^\?/,""),r)for(let t of r.split("&")){let[o,s=null]=t.split("=");o=decodeURIComponent(o),s&&(s=decodeURIComponent(s)),o in e?Array.isArray(e[o])?e[o].push(s):e[o]=[e[o],s]:e[o]=s}return e}var F=r=>{if(typeof r=="string")return F(new URL(r));let{hostname:e,pathname:t,port:o,protocol:s,search:i}=r,n;return i&&(n=Be(i)),{hostname:e,port:o?parseInt(o):void 0,protocol:s,path:t,query:n}};var x=class r{method;protocol;hostname;port;path;query;headers;username;password;fragment;body;constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let t=new r({...e,headers:{...e.headers}});return t.query&&(t.query=Rt(t.query)),t}static isInstance(e){if(!e)return!1;let t=e;return"method"in t&&"protocol"in t&&"hostname"in t&&"path"in t&&typeof t.query=="object"&&typeof t.headers=="object"}clone(){return r.clone(this)}};function Rt(r){return Object.keys(r).reduce((e,t)=>{let o=r[t];return{...e,[t]:Array.isArray(o)?[...o]:o}},{})}var I=class{statusCode;reason;headers;body;constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;let t=e;return typeof t.statusCode=="number"&&typeof t.headers=="object"}};var Mt=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),ee=(r,e=!1)=>{if(!e)return Mt.test(r);let t=r.split(".");for(let o of t)if(!ee(o))return!1;return!0};function Se(r){return/^[a-z0-9][a-z0-9.-]*[a-z0-9]$/.test(r)}var Ee=r=>{if(typeof r=="object"){if("url"in r){let e=F(r.url);if(r.headers){e.headers={};for(let t in r.headers)e.headers[t.toLowerCase()]=r.headers[t].join(", ")}return e}return r}return F(r)};var _=class r extends Error{name="ProviderError";tryNextLink;constructor(e,t=!0){let o,s=!0;typeof t=="boolean"?(o=void 0,s=t):t!=null&&typeof t=="object"&&(o=t.logger,s=t.tryNextLink??!0),super(e),this.tryNextLink=s,Object.setPrototypeOf(this,r.prototype),o?.debug?.(`@smithy/property-provider ${s?"->":"(!)"} ${e}`)}static from(e,t=!0){return Object.assign(new this(e.message,t),e)}};var D=class r extends _{name="CredentialsProviderError";constructor(e,t=!0){super(e,t),Object.setPrototypeOf(this,r.prototype)}};var We="AWS_PROFILE",Ke="default",ye=r=>r.profile||process.env[We]||Ke;import{join as Ut}from"path";import{homedir as Lt}from"os";import{sep as zt}from"path";var xe={},Ht=()=>process&&process.geteuid?`${process.geteuid()}`:"DEFAULT",A=()=>{let{HOME:r,USERPROFILE:e,HOMEPATH:t,HOMEDRIVE:o=`C:${zt}`}=process.env;if(r)return r;if(e)return e;if(t)return`${o}${t}`;let s=Ht();return xe[s]||(xe[s]=Lt()),xe[s]};var kt="AWS_CONFIG_FILE",te=()=>process.env[kt]||Ut(A(),".aws","config");import{join as Xe}from"path";var qe=r=>Object.entries(r).filter(([e])=>{let t=e.indexOf(".");return t===-1?!1:Object.values(b).includes(e.substring(0,t))}).reduce((e,[t,o])=>{let s=t.indexOf("."),i=t.substring(0,s)===b.PROFILE?t.substring(s+1):t;return e[i]=o,e},{...r.default&&{default:r.default}});import{join as $t}from"path";var Vt="AWS_SHARED_CREDENTIALS_FILE",Qe=()=>process.env[Vt]||$t(A(),".aws","credentials");var jt=/^([\w-]+)\s(["'])?([\w-@+.%:/]+)\2$/,Gt=["__proto__","profile __proto__"],z=r=>{let e={},t,o;for(let s of r.split(/\r?\n/)){let i=s.split(/(^|\s)[;#]/)[0].trim();if(i[0]==="["&&i[i.length-1]==="]"){t=void 0,o=void 0;let c=i.substring(1,i.length-1),a=jt.exec(c);if(a){let[,m,,p]=a;Object.values(b).includes(m)&&(t=[m,p].join("."))}else t=c;if(Gt.includes(c))throw new Error(`Found invalid profile name "${c}"`)}else if(t){let c=i.indexOf("=");if(![0,-1].includes(c)){let[a,m]=[i.substring(0,c).trim(),i.substring(c+1).trim()];if(m==="")o=a;else{o&&s.trimStart()===s&&(o=void 0),e[t]=e[t]||{};let p=o?[o,a].join("."):a;e[t][p]=m}}}}return e};import{readFile as Bt}from"fs/promises";var Te={},H={},P=(r,e)=>H[r]!==void 0?H[r]:((!Te[r]||e?.ignoreCache)&&(Te[r]=Bt(r,"utf8")),Te[r]);var Je=()=>({}),re=async(r={})=>{let{filepath:e=Qe(),configFilepath:t=te()}=r,o=A(),s="~/",i=e;e.startsWith(s)&&(i=Xe(o,e.slice(2)));let n=t;t.startsWith(s)&&(n=Xe(o,t.slice(2)));let c=await Promise.all([P(n,{ignoreCache:r.ignoreCache}).then(z).then(qe).catch(Je),P(i,{ignoreCache:r.ignoreCache}).then(z).catch(Je)]);return{configFile:c[0],credentialsFile:c[1]}};var Ye=r=>Object.entries(r).filter(([e])=>e.startsWith(b.SSO_SESSION+".")).reduce((e,[t,o])=>({...e,[t.substring(t.indexOf(".")+1)]:o}),{});var Wt=()=>({}),Kt=async(r={})=>P(r.configFilepath??te()).then(z).then(Ye).catch(Wt);var Ze=(...r)=>{let e={};for(let t of r)for(let[o,s]of Object.entries(t))e[o]!==void 0?Object.assign(e[o],s):e[o]=s;return e};var qt=async r=>{let e=await re(r);return Ze(e.configFile,e.credentialsFile)};import{readFile as Jt}from"fs/promises";import{createHash as Qt}from"crypto";import{join as Xt}from"path";var be=r=>{let t=Qt("sha1").update(r).digest("hex");return Xt(A(),".aws","sso","cache",`${t}.json`)};var U={},Yt=async r=>{if(U[r])return U[r];let e=be(r),t=await Jt(e,"utf8");return JSON.parse(t)};var Zt={getFileRecord(){return H},interceptFile(r,e){H[r]=Promise.resolve(e)},getTokenRecord(){return U},interceptToken(r,e){U[r]=e}};var Ne=(...r)=>async()=>{if(r.length===0)throw new _("No providers in chain");let e;for(let t of r)try{return await t()}catch(o){if(e=o,o?.tryNextLink)continue;throw o}throw e};var oe=(r,e,t)=>{let o,s,i,n=!1,c=async()=>{s||(s=r());try{o=await s,i=!0,n=!1}finally{s=void 0}return o};return e===void 0?async a=>((!i||a?.forceRefresh)&&(o=await c()),o):async a=>((!i||a?.forceRefresh)&&(o=await c()),n?o:t&&!t(o)?(n=!0,o):(e(o)&&await c(),o))};function se(r){try{let e=new Set(Array.from(r.match(/([A-Z_]){3,}/g)??[]));return e.delete("CONFIG"),e.delete("CONFIG_PREFIX_SEPARATOR"),e.delete("ENV"),[...e].join(", ")}catch{return r}}var et=(r,e)=>async()=>{try{let t=r(process.env,e);if(t===void 0)throw new Error;return t}catch(t){throw new D(t.message||`Not found in ENV: ${se(r.toString())}`,{logger:e?.logger})}};var tt=(r,{preferredFile:e="config",...t}={})=>async()=>{let o=ye(t),{configFile:s,credentialsFile:i}=await re(t),n=i[o]||{},c=s[o]||{},a=e==="config"?{...n,...c}:{...c,...n};try{let p=r(a,e==="config"?s:i);if(p===void 0)throw new Error;return p}catch(m){throw new D(m.message||`Not found in config files w/ profile [${o}]: ${se(r.toString())}`,{logger:t.logger})}};var rt=r=>()=>Promise.resolve(r);var er=r=>typeof r=="function",ot=r=>er(r)?async()=>await r():rt(r);var ie=({environmentVariableSelector:r,configFileSelector:e,default:t},o={})=>{let{signingName:s,logger:i}=o;return oe(Ne(et(r,{signingName:s,logger:i}),tt(e,o),ot(t)))};var ne=(r,e,t,o,s)=>({name:e,namespace:r,traits:t,input:o,output:s});var st=r=>(e,t)=>async o=>{let{response:s}=await e(o),{operationSchema:i}=M(t),[,n,c,a,m,p]=i??[];try{let h=await r.protocol.deserializeResponse(ne(n,c,a,m,p),{...r,...t},s);return{response:s,output:h}}catch(h){if(Object.defineProperty(h,"$response",{value:s,enumerable:!1,writable:!1,configurable:!1}),!("$metadata"in h)){let u="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";try{h.message+=`
2
+ `+u}catch{!t.logger||t.logger?.constructor?.name==="NoOpLogger"?console.warn(u):t.logger?.warn?.(u)}typeof h.$responseBodyText<"u"&&h.$response&&(h.$response.body=h.$responseBodyText);try{if(I.isInstance(s)){let{headers:g={},statusCode:l}=s,f=Object.entries(g);h.$metadata={httpStatusCode:l,requestId:Ce(/^x-[\w-]+-request-?id$/,f),extendedRequestId:Ce(/^x-[\w-]+-id-2$/,f),cfId:Ce(/^x-[\w-]+-cf-id$/,f)}}}catch{}}throw h}},Ce=(r,e)=>(e.find(([t])=>t.match(r))||[void 0,void 0])[1];var it=r=>(e,t)=>async o=>{let{operationSchema:s}=M(t),[,i,n,c,a,m]=s??[],p=t.endpointV2?async()=>Ee(t.endpointV2):r.endpoint,h=await r.protocol.serializeRequest(ne(i,n,c,a,m),o.input,{...r,...t,endpoint:p});return e({...o,request:h})};var nt={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},at={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function tr(r){return{applyToStack:e=>{e.add(it(r),at),e.add(st(r),nt),r.protocol.setSerdeContext(r)}}}var k=class r{namespace;schemas;exceptions;static registries=new Map;constructor(e,t=new Map,o=new Map){this.namespace=e,this.schemas=t,this.exceptions=o}static for(e){return r.registries.has(e)||r.registries.set(e,new r(e)),r.registries.get(e)}copyFrom(e){let{schemas:t,exceptions:o}=this;for(let[s,i]of e.schemas)t.has(s)||t.set(s,i);for(let[s,i]of e.exceptions)o.has(s)||o.set(s,i)}register(e,t){let o=this.normalizeShapeId(e);for(let s of[this,r.for(o.split("#")[0])])s.schemas.set(o,t)}getSchema(e){let t=this.normalizeShapeId(e);if(!this.schemas.has(t)){if(!e.includes("#")){let o="#"+e,s=[];for(let[i,n]of this.schemas.entries())i.endsWith(o)&&s.push(n);if(s.length===1)return s[0]}throw new Error(`@smithy/core/schema - schema not found for ${t}`)}return this.schemas.get(t)}registerError(e,t){let o=e,s=o[1];for(let i of[this,r.for(s)])i.schemas.set(s+"#"+o[2],o),i.exceptions.set(o,t)}getErrorCtor(e){let t=e;return this.exceptions.has(t)?this.exceptions.get(t):r.for(t[1]).exceptions.get(t)}getBaseException(){for(let e of this.exceptions.keys())if(Array.isArray(e)){let[,t,o]=e,s=t+"#"+o;if(s.startsWith("smithy.ts.sdk.synthetic.")&&s.endsWith("ServiceException"))return e}}find(e){for(let t of this.schemas.values())if(e(t))return t}clear(){this.schemas.clear(),this.exceptions.clear()}normalizeShapeId(e){return e.includes("#")?e:this.namespace+"#"+e}};var $=r=>typeof r=="function"?r():r;var ae=[];function N(r){if(typeof r=="object")return r;if(r=r|0,ae[r])return ae[r];let e={},t=0;for(let o of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"])(r>>t++&1)===1&&(e[o]=1);return ae[r]=e}var V={it:Symbol.for("@smithy/nor-struct-it"),ns:Symbol.for("@smithy/ns")},ce=[],me={},S=class r{ref;memberName;static symbol=Symbol.for("@smithy/nor");symbol=r.symbol;name;schema;_isMemberSchema;traits;memberTraits;normalizedTraits;constructor(e,t){this.ref=e,this.memberName=t;let o=[],s=e,i=e;for(this._isMemberSchema=!1;_e(s);)o.push(s[1]),s=s[0],i=$(s),this._isMemberSchema=!0;if(o.length>0){this.memberTraits={};for(let n=o.length-1;n>=0;--n){let c=o[n];Object.assign(this.memberTraits,N(c))}}else this.memberTraits=0;if(i instanceof r){let n=this.memberTraits;Object.assign(this,i),this.memberTraits=Object.assign({},n,i.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,this.memberName=t??i.memberName;return}if(this.schema=$(i),ct(this.schema)?(this.name=`${this.schema[1]}#${this.schema[2]}`,this.traits=this.schema[3]):(this.name=this.memberName??String(i),this.traits=0),this._isMemberSchema&&!t)throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(!0)} missing member name.`)}static[Symbol.hasInstance](e){let t=this.prototype.isPrototypeOf(e);return!t&&typeof e=="object"&&e!==null?e.symbol===this.symbol:t}static of(e){let t=typeof e=="function"||typeof e=="object"&&e!==null;if(typeof e=="number"){if(ce[e])return ce[e]}else if(typeof e=="string"){if(me[e])return me[e]}else if(t&&e[V.ns])return e[V.ns];let o=$(e);if(o instanceof r)return o;if(_e(o)){let[i,n]=o;if(i instanceof r)return Object.assign(i.getMergedTraits(),N(n)),i;throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(e,null,2)}.`)}let s=new r(o);return t?e[V.ns]=s:typeof o=="string"?me[o]=s:typeof o=="number"?ce[o]=s:s}getSchema(){let e=this.schema;return Array.isArray(e)&&e[0]===0?e[4]:e}getName(e=!1){let{name:t}=this;return!e&&t&&t.includes("#")?t.split("#")[1]:t||void 0}getMemberName(){return this.memberName}isMemberSchema(){return this._isMemberSchema}isListSchema(){let e=this.getSchema();return typeof e=="number"?e>=64&&e<128:e[0]===1}isMapSchema(){let e=this.getSchema();return typeof e=="number"?e>=128&&e<=255:e[0]===2}isStructSchema(){let e=this.getSchema();if(typeof e!="object")return!1;let t=e[0];return t===3||t===-3||t===4}isUnionSchema(){let e=this.getSchema();return typeof e!="object"?!1:e[0]===4}isBlobSchema(){let e=this.getSchema();return e===21||e===42}isTimestampSchema(){let e=this.getSchema();return typeof e=="number"&&e>=4&&e<=7}isUnitSchema(){return this.getSchema()==="unit"}isDocumentSchema(){return this.getSchema()===15}isStringSchema(){return this.getSchema()===0}isBooleanSchema(){return this.getSchema()===2}isNumericSchema(){return this.getSchema()===1}isBigIntegerSchema(){return this.getSchema()===17}isBigDecimalSchema(){return this.getSchema()===19}isStreaming(){let{streaming:e}=this.getMergedTraits();return!!e||this.getSchema()===42}isIdempotencyToken(){return!!this.getMergedTraits().idempotencyToken}getMergedTraits(){return this.normalizedTraits??(this.normalizedTraits={...this.getOwnTraits(),...this.getMemberTraits()})}getMemberTraits(){return N(this.memberTraits)}getOwnTraits(){return N(this.traits)}getKeySchema(){let[e,t]=[this.isDocumentSchema(),this.isMapSchema()];if(!e&&!t)throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(!0)}`);let o=this.getSchema(),s=e?15:o[4]??0;return j([s,0],"key")}getValueSchema(){let e=this.getSchema(),[t,o,s]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()],i=typeof e=="number"?63&e:e&&typeof e=="object"&&(o||s)?e[3+e[0]]:t?15:void 0;if(i!=null)return j([i,0],o?"value":"member");throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no value member.`)}getMemberSchema(e){let t=this.getSchema();if(this.isStructSchema()&&t[4].includes(e)){let o=t[4].indexOf(e),s=t[5][o];return j(_e(s)?s:[s,0],e)}if(this.isDocumentSchema())return j([15,0],e);throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no member=${e}.`)}getMemberSchemas(){let e={};try{for(let[t,o]of this.structIterator())e[t]=o}catch{}return e}getEventStreamMember(){if(this.isStructSchema()){for(let[e,t]of this.structIterator())if(t.isStreaming()&&t.isStructSchema())return e}return""}*structIterator(){if(this.isUnitSchema())return;if(!this.isStructSchema())throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");let e=this.getSchema(),t=e[4].length,o=e[V.it];if(o&&t===o.length){yield*o;return}o=Array(t);for(let s=0;s<t;++s){let i=e[4][s],n=j([e[5][s],0],i);yield o[s]=[i,n]}e[V.it]=o}};function j(r,e){if(r instanceof S)return Object.assign(r,{memberName:e,_isMemberSchema:!0});let t=S;return new t(r,e)}var _e=r=>Array.isArray(r)&&r.length===2,ct=r=>Array.isArray(r)&&r.length>=5;var mt=new Set,ft=(r,e=ee)=>{if(!mt.has(r)&&!e(r))if(r==="*")console.warn('@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.');else throw new Error(`Region not accepted: region="${r}" is not a valid hostname component.`);else mt.add(r)};var fe=r=>typeof r=="string"&&(r.startsWith("fips-")||r.endsWith("-fips"));var ht=r=>fe(r)?["fips-aws-global","aws-fips"].includes(r)?"us-east-1":r.replace(/fips-(dkr-|prod-)?|-fips/,""):r;var rr=r=>{let{region:e,useFipsEndpoint:t}=r;if(!e)throw new Error("Region is missing");return Object.assign(r,{region:async()=>{let o=typeof e=="function"?await e():e,s=ht(o);return ft(s),s},useFipsEndpoint:async()=>{let o=typeof e=="string"?e:await e();return fe(o)?!0:typeof t!="function"?Promise.resolve(!!t):t()}})};var we=class r extends _{name="TokenProviderError";constructor(e,t=!0){super(e,t),Object.setPrototypeOf(this,r.prototype)}};var v=(r,e,t)=>{if(e in r){if(r[e]==="true")return!0;if(r[e]==="false")return!1;throw new Error(`Cannot load ${t} "${e}". Expected "true" or "false", got ${r[e]}.`)}};var w;(function(r){r.ENV="env",r.CONFIG="shared config entry"})(w||(w={}));var lt="AWS_USE_DUALSTACK_ENDPOINT",pt="use_dualstack_endpoint";var or={environmentVariableSelector:r=>v(r,lt,w.ENV),configFileSelector:r=>v(r,pt,w.CONFIG),default:!1};var dt="AWS_USE_FIPS_ENDPOINT",ut="use_fips_endpoint";var sr={environmentVariableSelector:r=>v(r,dt,w.ENV),configFileSelector:r=>v(r,ut,w.CONFIG),default:!1};var gt="AWS_EXECUTION_ENV",Oe="AWS_REGION",Ie="AWS_DEFAULT_REGION",St="AWS_EC2_METADATA_DISABLED",Et=["in-region","cross-region","mobile","standard","legacy"],yt="/latest/meta-data/placement/region",xt="/latest/api/token",Tt="x-aws-ec2-metadata-token",bt="x-aws-ec2-metadata-token-ttl-seconds";var Nt=1e3,ir=6e4,wt=0,he=async()=>{if(!process.env[St]&&!(Date.now()<wt))try{let r=nr(),e=(await _t({...r,path:xt,method:"PUT",headers:{[bt]:"21600"}})).toString();return(await _t({...r,path:yt,method:"GET",headers:{[Tt]:e}})).toString().trim()||Ct()}catch{return Ct()}},Ct=()=>{wt=Date.now()+ir},nr=()=>{let r=process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT;if(r){let e=new URL(r);return{hostname:e.hostname.replace(/^\[(.+)]$/,"$1"),port:e.port?Number(e.port):void 0}}return process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE==="IPv6"?{hostname:"fd00:ec2::254"}:{hostname:"169.254.169.254"}},_t=async r=>{let{request:e}=await import("http");return new Promise((t,o)=>{let s=e({hostname:r.hostname,port:r.port,path:r.path,method:r.method,headers:r.headers,timeout:Nt,signal:AbortSignal.timeout(Nt)});s.on("error",i=>{o(i),s.destroy()}),s.on("timeout",()=>{o(new Error("TimeoutError from instance metadata service")),s.destroy()}),s.on("response",i=>{let{statusCode:n=400}=i;if(n<200||n>=300){o(Object.assign(new Error("Error response received from instance metadata service"),{statusCode:n})),s.destroy();return}let c=[];i.on("data",a=>c.push(a)),i.on("end",()=>{t(Buffer.concat(c)),s.destroy()})}),s.end()})};var Ot="AWS_REGION",It="region",Ae={environmentVariableSelector:r=>r[Ot],configFileSelector:r=>r[It],default:async()=>{let r=await he();if(r)return r;throw new Error("Region is missing")}},ar={preferredFile:"credentials"};var cr="AWS_DEFAULTS_MODE",mr="defaults_mode",At={environmentVariableSelector:r=>r[cr],configFileSelector:r=>r[mr],default:"legacy"};var fr=({region:r=ie(Ae),defaultsMode:e=ie(At)}={})=>oe(async()=>{let t=typeof e=="function"?await e():e;switch(t?.toLowerCase()){case"auto":return hr(r);case"in-region":case"cross-region":case"mobile":case"standard":case"legacy":return Promise.resolve(t?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${Et.join(", ")}, got ${t}`)}}),hr=async r=>{if(r){let e=typeof r=="function"?await r():r,t=await lr();return t?e===t?"in-region":"cross-region":"standard"}return"standard"},lr=async()=>process.env[gt]&&(process.env[Oe]||process.env[Ie])?process.env[Oe]??process.env[Ie]:he();var O=async(r=new Uint8Array,e)=>{if(r instanceof Uint8Array)return J.mutate(r);if(!r)return J.mutate(new Uint8Array);let t=e.streamCollector(r);return J.mutate(await t)};function le(r){return encodeURIComponent(r).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}var Dt="content-length";function vt(r){return e=>async t=>{let o=t.request;if(x.isInstance(o)){let{body:s,headers:i}=o;if(s&&Object.keys(i).map(n=>n.toLowerCase()).indexOf(Dt)===-1)try{let n=r(s);o.headers={...o.headers,[Dt]:String(n)}}catch{}}return e({...t,request:o})}}var Ft={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},pr=r=>({applyToStack:e=>{e.add(vt(r.bodyLengthChecker),Ft)}});var C=class{serdeContext;setSerdeContext(e){this.serdeContext=e}};var R=class extends C{options;compositeErrorRegistry;constructor(e){super(),this.options=e,this.compositeErrorRegistry=k.for(e.defaultNamespace);for(let t of e.errorTypeRegistries??[])this.compositeErrorRegistry.copyFrom(t)}getRequestType(){return x}getResponseType(){return I}setSerdeContext(e){this.serdeContext=e,this.serializer.setSerdeContext(e),this.deserializer.setSerdeContext(e),this.getPayloadCodec()&&this.getPayloadCodec().setSerdeContext(e)}updateServiceEndpoint(e,t){if("url"in t){e.protocol=t.url.protocol,e.hostname=t.url.hostname,e.port=t.url.port?Number(t.url.port):void 0,e.path=t.url.pathname,e.fragment=t.url.hash||void 0,e.username=t.url.username||void 0,e.password=t.url.password||void 0,e.query||(e.query={});for(let[o,s]of t.url.searchParams.entries())e.query[o]=s;if(t.headers)for(let o in t.headers)e.headers[o]=t.headers[o].join(", ");return e}else{if(e.protocol=t.protocol,e.hostname=t.hostname,e.port=t.port?Number(t.port):void 0,e.path=t.path,e.query={...t.query},t.headers)for(let o in t.headers)e.headers[o]=t.headers[o];return e}}setHostPrefix(e,t,o){if(this.serdeContext?.disableHostPrefix)return;let s=S.of(t.input),i=N(t.traits??{});if(i.endpoint){let n=i.endpoint?.[0];if(typeof n=="string"){for(let[c,a]of s.structIterator()){if(!a.getMergedTraits().hostLabel)continue;let m=o[c];if(typeof m!="string")throw new Error(`@smithy/core/schema - ${c} in input must be a string as hostLabel.`);n=n.replace(`{${c}}`,m)}if(e.hostname=n+e.hostname,!Se(e.hostname))throw new Error(`[${e.hostname}] is not a valid hostname.`)}}}deserializeMetadata(e){return{httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}}async serializeEventStream({eventStream:e,requestSchema:t,initialRequest:o}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:e,requestSchema:t,initialRequest:o})}async deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:o}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:o})}async loadEventStreamCapability(){let{EventStreamSerde:e,eventStreamSerdeProvider:t}=await import("./event-streams-TNY7XPBF.js"),o=this.resolveEventStreamMarshaller(t);return new e({marshaller:o,serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType()})}resolveEventStreamMarshaller(e){let t=this.serdeContext;return t.eventStreamMarshaller?t.eventStreamMarshaller:e(this.serdeContext)}getDefaultContentType(){throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(e,t,o,s,i){return[]}getEventStreamMarshaller(){let e=this.serdeContext;if(!e.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return e.eventStreamMarshaller}};var De=class extends R{async serializeRequest(e,t,o){let s=t&&typeof t=="object"?t:{},i=this.serializer,n={},c={},a=await o.endpoint(),m=S.of(e?.input),p=[],h=[],u=!1,g,l=new x({protocol:"",hostname:"",port:void 0,path:"",fragment:void 0,query:n,headers:c,body:void 0});if(a){this.updateServiceEndpoint(l,a),this.setHostPrefix(l,e,s);let f=N(e.traits);if(f.http){l.method=f.http[0];let[d,E]=f.http[1].split("?");l.path=="/"?l.path=d:l.path+=d;let y=new URLSearchParams(E??"");for(let[T,K]of y)n[T]=K}}for(let[f,d]of m.structIterator()){let E=d.getMergedTraits()??{},y=s[f];if(y==null&&!d.isIdempotencyToken()){if(E.httpLabel&&(l.path.includes(`{${f}+}`)||l.path.includes(`{${f}}`)))throw new Error(`No value provided for input HTTP label: ${f}.`);continue}if(E.httpPayload)d.isStreaming()?d.isStructSchema()?s[f]&&(g=await this.serializeEventStream({eventStream:s[f],requestSchema:m})):g=y:(i.write(d,y),g=i.flush());else if(E.httpLabel){i.write(d,y);let T=i.flush();l.path.includes(`{${f}+}`)?l.path=l.path.replace(`{${f}+}`,T.split("/").map(le).join("/")):l.path.includes(`{${f}}`)&&(l.path=l.path.replace(`{${f}}`,le(T)))}else if(E.httpHeader)i.write(d,y),c[E.httpHeader.toLowerCase()]=String(i.flush());else if(typeof E.httpPrefixHeaders=="string")for(let T in y){let K=y[T],Re=E.httpPrefixHeaders+T;i.write([d.getValueSchema(),{httpHeader:Re}],K),c[Re.toLowerCase()]=i.flush()}else E.httpQuery||E.httpQueryParams?this.serializeQuery(d,y,n):(u=!0,p.push(f),h.push(d))}if(u&&s){let[f,d]=(m.getName(!0)??"#Unknown").split("#"),E=m.getSchema()[6],y=[3,f,d,m.getMergedTraits(),p,h,void 0];E?y[6]=E:y.pop(),i.write(y,s),g=i.flush()}return l.headers=c,l.query=n,l.body=g,l}serializeQuery(e,t,o){let s=this.serializer,i=e.getMergedTraits();if(i.httpQueryParams){for(let n in t)if(!(n in o)){let c=t[n],a=e.getValueSchema();Object.assign(a.getMergedTraits(),{...i,httpQuery:n,httpQueryParams:void 0}),this.serializeQuery(a,c,o)}return}if(e.isListSchema()){let n=!!e.getMergedTraits().sparse,c=[];for(let a of t){s.write([e.getValueSchema(),i],a);let m=s.flush();(n||m!==void 0)&&c.push(m)}o[i.httpQuery]=c}else s.write([e,i],t),o[i.httpQuery]=s.flush()}async deserializeResponse(e,t,o){let s=this.deserializer,i=S.of(e.output),n={};if(o.statusCode>=300){let a=await O(o.body,t);throw a.byteLength>0&&Object.assign(n,await s.read(15,a)),await this.handleError(e,t,o,n,this.deserializeMetadata(o)),new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(let a in o.headers){let m=o.headers[a];delete o.headers[a],o.headers[a.toLowerCase()]=m}let c=await this.deserializeHttpMessage(i,t,o,n);if(c.length){let a=await O(o.body,t);if(a.byteLength>0){let m=await s.read(i,a);for(let p of c)m[p]!=null&&(n[p]=m[p])}}else c.discardResponseBody&&await O(o.body,t);return n.$metadata=this.deserializeMetadata(o),n}async deserializeHttpMessage(e,t,o,s,i){let n;s instanceof Set?n=i:n=s;let c=!0,a=this.deserializer,m=S.of(e),p=[];for(let[h,u]of m.structIterator()){let g=u.getMemberTraits();if(g.httpPayload){if(c=!1,u.isStreaming())u.isStructSchema()?n[h]=await this.deserializeEventStream({response:o,responseSchema:m}):n[h]=je(o.body);else if(o.body){let f=await O(o.body,t);f.byteLength>0&&(n[h]=await a.read(u,f))}}else if(g.httpHeader){let l=String(g.httpHeader).toLowerCase(),f=o.headers[l];if(f!=null)if(u.isListSchema()){let d=u.getValueSchema();d.getMergedTraits().httpHeader=l;let E;d.isTimestampSchema()&&d.getSchema()===4?E=$e(f,",",2):E=X(f);let y=[];for(let T of E)y.push(await a.read(d,T.trim()));n[h]=y}else n[h]=await a.read(u,f)}else if(g.httpPrefixHeaders!==void 0){n[h]={};for(let l in o.headers)if(l.startsWith(g.httpPrefixHeaders)){let f=o.headers[l],d=u.getValueSchema();d.getMergedTraits().httpHeader=l,n[h][l.slice(g.httpPrefixHeaders.length)]=await a.read(d,f)}}else g.httpResponseCode?n[h]=o.statusCode:p.push(h)}return p.discardResponseBody=c,p}};var ve=class extends R{async serializeRequest(e,t,o){let s=this.serializer,i={},n={},c=await o.endpoint(),a=S.of(e?.input),m=a.getSchema(),p,h=t&&typeof t=="object"?t:{},u=new x({protocol:"",hostname:"",port:void 0,path:"/",fragment:void 0,query:i,headers:n,body:void 0});if(c&&(this.updateServiceEndpoint(u,c),this.setHostPrefix(u,e,h)),h){let g=a.getEventStreamMember();if(g){if(h[g]){let l={};for(let[f,d]of a.structIterator())f!==g&&h[f]&&(s.write(d,h[f]),l[f]=s.flush());p=await this.serializeEventStream({eventStream:h[g],requestSchema:a,initialRequest:l})}}else s.write(m,h),p=s.flush()}return u.headers=Object.assign(u.headers,n),u.query=i,u.body=p,u.method="POST",u}async deserializeResponse(e,t,o){let s=this.deserializer,i=S.of(e.output),n={};if(o.statusCode>=300){let a=await O(o.body,t);throw a.byteLength>0&&Object.assign(n,await s.read(15,a)),await this.handleError(e,t,o,n,this.deserializeMetadata(o)),new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.")}for(let a in o.headers){let m=o.headers[a];delete o.headers[a],o.headers[a.toLowerCase()]=m}let c=i.getEventStreamMember();if(c)n[c]=await this.deserializeEventStream({response:o,responseSchema:i,initialResponseContainer:n});else{let a=await O(o.body,t);a.byteLength>0&&Object.assign(n,await s.read(i,a))}return n.$metadata=this.deserializeMetadata(o),n}};function G(r,e){if(e.timestampFormat.useTrait&&r.isTimestampSchema()&&(r.getSchema()===5||r.getSchema()===6||r.getSchema()===7))return r.getSchema();let{httpLabel:t,httpPrefixHeaders:o,httpHeader:s,httpQuery:i}=r.getMergedTraits();return(e.httpBindings?typeof o=="string"||s?6:i||t?5:void 0:void 0)??e.timestampFormat.default}var B=class extends C{settings;constructor(e){super(),this.settings=e}read(e,t){let o=S.of(e);if(o.isListSchema())return X(t).map(s=>this.read(o.getValueSchema(),s));if(o.isBlobSchema())return(this.serdeContext?.base64Decoder??de)(t);if(o.isTimestampSchema())switch(G(o,this.settings)){case 5:return Ue(t);case 6:return ke(t);case 7:return He(t);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",t),new Date(t)}if(o.isStringSchema()){let s=o.getMergedTraits().mediaType,i=t;if(s)return o.getMergedTraits().httpHeader&&(i=this.base64ToUtf8(i)),(s==="application/json"||s.endsWith("+json"))&&(i=Q.from(i)),i}return o.isNumericSchema()?Number(t):o.isBigIntegerSchema()?BigInt(t):o.isBigDecimalSchema()?new Ve(t,"bigDecimal"):o.isBooleanSchema()?String(t).toLowerCase()==="true":t}base64ToUtf8(e){return(this.serdeContext?.utf8Encoder??q)((this.serdeContext?.base64Decoder??de)(e))}};var Fe=class extends C{codecDeserializer;stringDeserializer;constructor(e,t){super(),this.codecDeserializer=e,this.stringDeserializer=new B(t)}setSerdeContext(e){this.stringDeserializer.setSerdeContext(e),this.codecDeserializer.setSerdeContext(e),this.serdeContext=e}read(e,t){let o=S.of(e),s=o.getMergedTraits(),i=this.serdeContext?.utf8Encoder??q;if(s.httpHeader||s.httpResponseCode)return this.stringDeserializer.read(o,i(t));if(s.httpPayload){if(o.isBlobSchema()){let n=this.serdeContext?.utf8Decoder??Me;return typeof t=="string"?n(t):t}else if(o.isStringSchema())return"byteLength"in t?i(t):t}return this.codecDeserializer.read(o,t)}};var pe=class extends C{settings;stringBuffer="";constructor(e){super(),this.settings=e}write(e,t){let o=S.of(e);switch(typeof t){case"object":if(t===null){this.stringBuffer="null";return}if(o.isTimestampSchema()){if(!(t instanceof Date))throw new Error(`@smithy/core/protocols - received non-Date value ${t} when schema expected Date in ${o.getName(!0)}`);switch(G(o,this.settings)){case 5:this.stringBuffer=t.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=Le(t);break;case 7:this.stringBuffer=String(t.getTime()/1e3);break;default:console.warn("Missing timestamp format, using epoch seconds",t),this.stringBuffer=String(t.getTime()/1e3)}return}if(o.isBlobSchema()&&"byteLength"in t){this.stringBuffer=(this.serdeContext?.base64Encoder??ue)(t);return}if(o.isListSchema()&&Array.isArray(t)){let n="";for(let c of t){this.write([o.getValueSchema(),o.getMergedTraits()],c);let a=this.flush(),m=o.getValueSchema().isTimestampSchema()?a:ze(a);n!==""&&(n+=", "),n+=m}this.stringBuffer=n;return}this.stringBuffer=JSON.stringify(t,null,2);break;case"string":let s=o.getMergedTraits().mediaType,i=t;if(s&&((s==="application/json"||s.endsWith("+json"))&&(i=Q.from(i)),o.getMergedTraits().httpHeader)){this.stringBuffer=(this.serdeContext?.base64Encoder??ue)(i.toString());return}this.stringBuffer=t;break;default:o.isIdempotencyToken()?this.stringBuffer=Ge():this.stringBuffer=String(t)}}flush(){let e=this.stringBuffer;return this.stringBuffer="",e}};var Pe=class{codecSerializer;stringSerializer;buffer;constructor(e,t,o=new pe(t)){this.codecSerializer=e,this.stringSerializer=o}setSerdeContext(e){this.codecSerializer.setSerdeContext(e),this.stringSerializer.setSerdeContext(e)}write(e,t){let o=S.of(e),s=o.getMergedTraits();if(s.httpHeader||s.httpLabel||s.httpQuery){this.stringSerializer.write(o,t),this.buffer=this.stringSerializer.flush();return}return this.codecSerializer.write(o,t)}flush(){if(this.buffer!==void 0){let e=this.buffer;return this.buffer=void 0,e}return this.codecSerializer.flush()}};var dr=r=>({setHttpHandler(e){r.httpHandler=e},httpHandler(){return r.httpHandler},updateHttpClientConfig(e,t){r.httpHandler?.updateHttpClientConfig(e,t)},httpHandlerConfigs(){return r.httpHandler.httpHandlerConfigs()}}),ur=r=>({httpHandler:r.httpHandler()});var W=r=>encodeURIComponent(r).replace(/[!'()*]/g,gr),gr=r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`;function Sr(r){let e=[];for(let t of Object.keys(r).sort()){let o=r[t];if(t=W(t),Array.isArray(o))for(let s=0,i=o.length;s<i;s++)e.push(`${t}=${W(o[s])}`);else{let s=t;(o||typeof o=="string")&&(s+=`=${W(o)}`),e.push(s)}}return e.join("&")}export{ge as a,Y as b,Z as c,b as d,M as e,x as f,I as g,ee as h,Pt as i,F as j,Ee as k,_ as l,D as m,we as n,Ne as o,v as p,w as q,ye as r,be as s,Yt as t,P as u,Kt as v,qt as w,Zt as x,ie as y,or as z,sr as A,$ as B,tr as C,S as D,k as E,Ae as F,ar as G,rr as H,fr as I,O as J,le as K,De as L,ve as M,G as N,B as O,Fe as P,Pe as Q,dr as R,ur as S,pr as T,W as U,Sr as V};
@@ -0,0 +1,17 @@
1
+ import{a as Br,b as Jr,f as se,g as ie}from"./chunk-QSLKOXQ6.js";import{a as N}from"./chunk-ZIBRKYXP.js";import{A as Po,B as fr,C as wo,D as Pe,E as we,F as De,G as de,a as lo,b as mo,c as fo,d as B,e as go,f as Eo,h as yo,i as ho,j as xo,k as So,r as mr,w as H,x as j,y as Ao}from"./chunk-UWHWNXNX.js";import{A as dr,B as vo,C as Co,D as Io,I as b,a as ue,f as cr,l as so,p as ao,q as pr,w as lr,x as Ro,y as _o,z as le}from"./chunk-A3H5SUSR.js";import{B as oo,C as no,D as T,E as ee,F as io,J as po,M as uo,N as Ae,a as ve,b as Ce,c as ae,d as ce,e as to,f as D,g as Z,h as Ie,i as z,j as ar,m as ro,y as pe}from"./chunk-Z4YWESTY.js";import{A as co,f as Yr,h as Qr,i as Zr,j as eo,k as _e,r as w,v as ur}from"./chunk-MYIHTCRS.js";import{randomUUID as Zu}from"crypto";var pa=e=>t=>async r=>{if(!D.isInstance(r.request))return t(r);let{request:o}=r,{handlerProtocol:n=""}=e.requestHandler.metadata||{};if(n.indexOf("h2")>=0&&!o.headers[":authority"])delete o.headers.host,o.headers[":authority"]=o.hostname+(o.port?":"+o.port:"");else if(!o.headers.host){let s=o.hostname;o.port!=null&&(s+=`:${o.port}`),o.headers.host=s}return t(r)},ua={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},Do=e=>({applyToStack:t=>{t.add(pa(e),ua)}});var la=()=>(e,t)=>async r=>{try{let o=await e(r),{clientName:n,commandName:s,logger:i,dynamoDbDocumentClientOptions:a={}}=t,{overrideInputFilterSensitiveLog:c,overrideOutputFilterSensitiveLog:p}=a,u=c??t.inputFilterSensitiveLog,l=p??t.outputFilterSensitiveLog,{$metadata:m,...R}=o.output;return i?.info?.({clientName:n,commandName:s,input:u(r.input),output:l(R),metadata:m}),o}catch(o){let{clientName:n,commandName:s,logger:i,dynamoDbDocumentClientOptions:a={}}=t,{overrideInputFilterSensitiveLog:c}=a,p=c??t.inputFilterSensitiveLog;throw i?.error?.({clientName:n,commandName:s,input:p(r.input),error:o,metadata:o.$metadata}),o}},da={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},To=e=>({applyToStack:t=>{t.add(la(),da)}});var Oo={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"};var gr="X-Amzn-Trace-Id",ma="AWS_LAMBDA_FUNCTION_NAME",fa="_X_AMZN_TRACE_ID",Ko=()=>e=>async t=>{let{request:r}=t;if(!D.isInstance(r))return e(t);let o=Object.keys(r.headers??{}).find(u=>u.toLowerCase()===gr.toLowerCase())??gr;if(r.headers.hasOwnProperty(o))return e(t);let n=process.env[ma],s=process.env[fa],c=(await lo.getInstanceAsync())?.getXRayTraceId()??s,p=u=>typeof u=="string"&&u.length>0;return p(n)&&p(c)&&(r.headers[gr]=c),e({...t,request:r})};var No=e=>({applyToStack:t=>{t.add(Ko(),Oo)}});var ga=void 0;function Ea(e){return e===void 0?!0:typeof e=="string"&&e.length<=50}function bo(e){let t=B(e.userAgentAppId??ga),{customUserAgent:r}=e;return Object.assign(e,{customUserAgent:typeof r=="string"?[[r]]:r,userAgentAppId:async()=>{let o=await t();if(!Ea(o)){let n=e.logger?.constructor?.name==="NoOpLogger"||!e.logger?console:e.logger;typeof o!="string"?n?.warn("userAgentAppId must be a string or undefined."):o.length>50&&n?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}return o}})}var ya=/\d{12}\.ddb/;async function ko(e,t,r){if(r.request?.headers?.["smithy-protocol"]==="rpc-v2-cbor"&&b(e,"PROTOCOL_RPC_V2_CBOR","M"),typeof t.retryStrategy=="function"){let s=await t.retryStrategy();if(typeof s.mode=="string")switch(s.mode){case le.ADAPTIVE:b(e,"RETRY_MODE_ADAPTIVE","F");break;case le.STANDARD:b(e,"RETRY_MODE_STANDARD","E");break}}if(typeof t.accountIdEndpointMode=="function"){let s=e.endpointV2;switch(String(s?.url?.hostname).match(ya)&&b(e,"ACCOUNT_ID_ENDPOINT","O"),await t.accountIdEndpointMode?.()){case"disabled":b(e,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":b(e,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":b(e,"ACCOUNT_ID_MODE_REQUIRED","R");break}}let n=e.__smithy_context?.selectedHttpAuthScheme?.identity;if(n?.$source){let s=n;s.accountId&&b(e,"RESOLVED_ACCOUNT_ID","T");for(let[i,a]of Object.entries(s.$source??{}))b(e,i,a)}}var Er="user-agent",Te="x-amz-user-agent";var $o=/[^!$%&'*+\-.^_`|~\w]/g,Mo=/[^!$%&'*+\-.^_`|~\w#]/g;function Uo(e){let t="";for(let r in e){let o=e[r];if(t.length+o.length+1<=1024){t.length?t+=","+o:t+=o;continue}break}return t}var ha=e=>(t,r)=>async o=>{let{request:n}=o;if(!D.isInstance(n))return t(o);let{headers:s}=n,i=r?.userAgent?.map(Oe)||[],a=(await e.defaultUserAgentProvider()).map(Oe);await ko(r,e,o);let c=r;a.push(`m/${Uo(Object.assign({},r.__smithy_context?.features,c.__aws_sdk_context?.features))}`);let p=e?.customUserAgent?.map(Oe)||[],u=await e.userAgentAppId();u&&a.push(Oe(["app",`${u}`]));let l=So(),m=(l?[l]:[]).concat([...a,...i,...p]).join(" "),R=[...a.filter(_=>_.startsWith("aws-sdk-")),...p].join(" ");return e.runtime!=="browser"?(R&&(s[Te]=s[Te]?`${s[Er]} ${R}`:R),s[Er]=m):s[Te]=m,t({...o,request:n})},Oe=e=>{let t=e[0].split("/").map(i=>i.replace($o,"-")).join("/"),r=e[1]?.replace(Mo,"-"),o=t.indexOf("/"),n=t.substring(0,o),s=t.substring(o+1);return n==="api"&&(s=s.toLowerCase()),[n,s,r].filter(i=>i&&i.length>0).reduce((i,a,c)=>{switch(c){case 0:return a;case 1:return`${i}/${a}`;default:return`${i}#${a}`}},"")},xa={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},Go=e=>({applyToStack:t=>{t.add(ha(e),xa)}});var Sa="AWS_USE_DUALSTACK_ENDPOINT",Ra="use_dualstack_endpoint";var Vo={environmentVariableSelector:e=>H(e,Sa,j.ENV),configFileSelector:e=>H(e,Ra,j.CONFIG),default:!1};var _a="AWS_USE_FIPS_ENDPOINT",va="use_fips_endpoint";var Ho={environmentVariableSelector:e=>H(e,_a,j.ENV),configFileSelector:e=>H(e,va,j.CONFIG),default:!1};var Ca="AWS_REGION",Ia="region",jo={environmentVariableSelector:e=>e[Ca],configFileSelector:e=>e[Ia],default:()=>{throw new Error("Region is missing")}},qo={preferredFile:"credentials"};var Xo=new Set,Wo=(e,t=Ie)=>{if(!Xo.has(e)&&!t(e))if(e==="*")console.warn('@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.');else throw new Error(`Region not accepted: region="${e}" is not a valid hostname component.`);else Xo.add(e)};var Ke=e=>typeof e=="string"&&(e.startsWith("fips-")||e.endsWith("-fips"));var zo=e=>Ke(e)?["fips-aws-global","aws-fips"].includes(e)?"us-east-1":e.replace(/fips-(dkr-|prod-)?|-fips/,""):e;var Bo=e=>{let{region:t,useFipsEndpoint:r}=e;if(!t)throw new Error("Region is missing");return Object.assign(e,{region:async()=>{let o=typeof t=="function"?await t():t,n=zo(o);return Wo(n),n},useFipsEndpoint:async()=>{let o=typeof t=="string"?t:await t();return Ke(o)?!0:typeof r!="function"?Promise.resolve(!!r):r()}})};var Jo="content-length";function Aa(e){return t=>async r=>{let o=r.request;if(D.isInstance(o)){let{body:n,headers:s}=o;if(n&&Object.keys(s).map(i=>i.toLowerCase()).indexOf(Jo)===-1)try{let i=e(n);o.headers={...o.headers,[Jo]:String(i)}}catch{}}return t({...r,request:o})}}var Pa={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},Yo=e=>({applyToStack:t=>{t.add(Aa(e.bodyLengthChecker),Pa)}});var Qo=async e=>{let t=e?.Bucket||"";if(typeof e.Bucket=="string"&&(e.Bucket=t.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),Ka(t)){if(e.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!Oa(t)||t.indexOf(".")!==-1&&!String(e.Endpoint).startsWith("http:")||t.toLowerCase()!==t||t.length<3)&&(e.ForcePathStyle=!0);return e.DisableMultiRegionAccessPoints&&(e.disableMultiRegionAccessPoints=!0,e.DisableMRAP=!0),e},wa=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,Da=/(\d+\.){3}\d+/,Ta=/\.\./;var Oa=e=>wa.test(e)&&!Da.test(e)&&!Ta.test(e),Ka=e=>{let[t,r,o,,,n]=e.split(":"),s=t==="arn"&&e.split(":").length>=6,i=!!(s&&r&&o&&n);if(s&&!i)throw new Error(`Invalid ARN: ${e} was an invalid ARN.`);return i};var Zo=(e,t,r,o=!1)=>{let n=async()=>{let s;return o?s=r.clientContextParams?.[e]??r[e]??r[t]:s=r[e]??r[t],typeof s=="function"?s():s};return e==="credentialScope"||t==="CredentialScope"?async()=>{let s=typeof r.credentials=="function"?await r.credentials():r.credentials;return s?.credentialScope??s?.CredentialScope}:e==="accountId"||t==="AccountId"?async()=>{let s=typeof r.credentials=="function"?await r.credentials():r.credentials;return s?.accountId??s?.AccountId}:e==="endpoint"||t==="endpoint"?async()=>{if(r.isCustomEndpoint===!1)return;let s=await n();if(s&&typeof s=="object"){if("url"in s)return s.url.href;if("hostname"in s){let{protocol:i,hostname:a,port:c,path:p}=s;return`${i}//${a}${c?":"+c:""}${p}`}}return s}:n};import{homedir as Na}from"os";import{sep as ba}from"path";var hr={},ka=()=>process&&process.geteuid?`${process.geteuid()}`:"DEFAULT",te=()=>{let{HOME:e,USERPROFILE:t,HOMEPATH:r,HOMEDRIVE:o=`C:${ba}`}=process.env;if(e)return e;if(t)return t;if(r)return`${o}${r}`;let n=ka();return hr[n]||(hr[n]=Na()),hr[n]};var xr="AWS_PROFILE",$a="default",en=e=>e.profile||process.env[xr]||$a;import{join as sn}from"path";var tn=e=>Object.entries(e).filter(([t])=>{let r=t.indexOf(".");return r===-1?!1:Object.values(ce).includes(t.substring(0,r))}).reduce((t,[r,o])=>{let n=r.indexOf("."),s=r.substring(0,n)===ce.PROFILE?r.substring(n+1):r;return t[s]=o,t},{...e.default&&{default:e.default}});import{join as Ma}from"path";var Ua="AWS_CONFIG_FILE",rn=()=>process.env[Ua]||Ma(te(),".aws","config");import{join as La}from"path";var Fa="AWS_SHARED_CREDENTIALS_FILE",on=()=>process.env[Fa]||La(te(),".aws","credentials");var Ga=/^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/,Va=["__proto__","profile __proto__"],Sr=e=>{let t={},r,o;for(let n of e.split(/\r?\n/)){let s=n.split(/(^|\s)[;#]/)[0].trim();if(s[0]==="["&&s[s.length-1]==="]"){r=void 0,o=void 0;let a=s.substring(1,s.length-1),c=Ga.exec(a);if(c){let[,p,,u]=c;Object.values(ce).includes(p)&&(r=[p,u].join("."))}else r=a;if(Va.includes(a))throw new Error(`Found invalid profile name "${a}"`)}else if(r){let a=s.indexOf("=");if(![0,-1].includes(a)){let[c,p]=[s.substring(0,a).trim(),s.substring(a+1).trim()];if(p==="")o=c;else{o&&n.trimStart()===n&&(o=void 0),t[r]=t[r]||{};let u=o?[o,c].join("."):c;t[r][u]=p}}}}return t};import{readFile as Ha}from"fs/promises";var Rr={},nn={},_r=(e,t)=>nn[e]!==void 0?nn[e]:((!Rr[e]||t?.ignoreCache)&&(Rr[e]=Ha(e,"utf8")),Rr[e]);var an=()=>({}),cn=async(e={})=>{let{filepath:t=on(),configFilepath:r=rn()}=e,o=te(),n="~/",s=t;t.startsWith(n)&&(s=sn(o,t.slice(2)));let i=r;r.startsWith(n)&&(i=sn(o,r.slice(2)));let a=await Promise.all([_r(i,{ignoreCache:e.ignoreCache}).then(Sr).then(tn).catch(an),_r(s,{ignoreCache:e.ignoreCache}).then(Sr).catch(an)]);return{configFile:a[0],credentialsFile:a[1]}};var pn="AWS_ENDPOINT_URL",un="endpoint_url",ln=e=>({environmentVariableSelector:t=>{let r=e.split(" ").map(s=>s.toUpperCase()),o=t[[pn,...r].join("_")];if(o)return o;let n=t[pn];if(n)return n},configFileSelector:(t,r)=>{if(r&&t.services){let n=r[["services",t.services].join(".")];if(n){let s=e.split(" ").map(a=>a.toLowerCase()),i=n[[s.join("_"),un].join(".")];if(i)return i}}let o=t[un];if(o)return o},default:void 0});var Ne=async e=>pe(ln(e??""))();var be=e=>{if(typeof e=="object"){if("url"in e){let t=ar(e.url);if(e.headers){t.headers={};for(let[r,o]of Object.entries(e.headers))t.headers[r.toLowerCase()]=o.join(", ")}return t}return e}return ar(e)};var dn=async(e,t,r,o)=>{if(!r.isCustomEndpoint){let i;r.serviceConfiguredEndpoint?i=await r.serviceConfiguredEndpoint():i=await Ne(r.serviceId),i&&(r.endpoint=()=>Promise.resolve(be(i)),r.isCustomEndpoint=!0)}let n=await ja(e,t,r);if(typeof r.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");let s=r.endpointProvider(n,o);if(r.isCustomEndpoint&&r.endpoint){let i=await r.endpoint();if(i?.headers){s.headers??={};for(let[a,c]of Object.entries(i.headers))s.headers[a]=Array.isArray(c)?c:[c]}}return s},ja=async(e,t,r)=>{let o={},n=t?.getEndpointParameterInstructions?.()||{};for(let[s,i]of Object.entries(n))switch(i.type){case"staticContextParams":o[s]=i.value;break;case"contextParams":o[s]=e[i.name];break;case"clientContextParams":case"builtInParams":o[s]=await Zo(i.name,s,r,i.type!=="builtInParams")();break;case"operationContextParams":o[s]=i.get(e);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(i))}return Object.keys(n).length===0&&Object.assign(o,r),String(r.serviceId).toLowerCase()==="s3"&&await Qo(o),o};var mn=({config:e,instructions:t})=>(r,o)=>async n=>{e.isCustomEndpoint&&go(o,"ENDPOINT_OVERRIDE","N");let s=await dn(n.input,{getEndpointParameterInstructions(){return t}},{...e},o);o.endpointV2=s,o.authSchemes=s.properties?.authSchemes;let i=o.authSchemes?.[0];if(i){o.signing_region=i.signingRegion,o.signing_service=i.signingName;let c=to(o)?.selectedHttpAuthScheme?.httpAuthOption;c&&(c.signingProperties=Object.assign(c.signingProperties||{},{signing_region:i.signingRegion,signingRegion:i.signingRegion,signing_service:i.signingName,signingName:i.signingName,signingRegionSet:i.signingRegionSet},i.properties))}return r({...n})};var qa={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:ur.name},ke=(e,t)=>({applyToStack:r=>{r.addRelativeTo(mn({config:e,instructions:t}),qa)}});var fn=e=>{let t=e.tls??!0,{endpoint:r,useDualstackEndpoint:o,useFipsEndpoint:n}=e,s=r!=null?async()=>be(await z(r)()):void 0,a=Object.assign(e,{endpoint:s,tls:t,isCustomEndpoint:!!r,useDualstackEndpoint:z(o??!1),useFipsEndpoint:z(n??!1)}),c;return a.serviceConfiguredEndpoint=async()=>(e.serviceId&&!c&&(c=Ne(e.serviceId)),c),a};var gn=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],En=["TimeoutError","RequestTimeout","RequestTimeoutException"],yn=[500,502,503,504],hn=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],xn=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND"];var Xa=e=>e?.$retryable!==void 0;var Wa=e=>e.$metadata?.clockSkewCorrected,za=e=>{let t=new Set(["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Load failed","Network request failed"]);return e&&e instanceof TypeError?t.has(e.message):!1},Sn=e=>e.$metadata?.httpStatusCode===429||gn.includes(e.name)||e.$retryable?.throttling==!0,$e=(e,t=0)=>Xa(e)||Wa(e)||En.includes(e.name)||hn.includes(e?.code||"")||xn.includes(e?.code||"")||yn.includes(e.$metadata?.httpStatusCode||0)||za(e)||e.cause!==void 0&&t<=10&&$e(e.cause,t+1),Rn=e=>{if(e.$metadata?.httpStatusCode!==void 0){let t=e.$metadata.httpStatusCode;return 500<=t&&t<=599&&!$e(e)}return!1};import _n from"crypto";var vr=_n.randomUUID.bind(_n);var P=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),vn=()=>{if(vr)return vr();let e=new Uint8Array(16);return crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128,P[e[0]]+P[e[1]]+P[e[2]]+P[e[3]]+"-"+P[e[4]]+P[e[5]]+"-"+P[e[6]]+P[e[7]]+"-"+P[e[8]]+P[e[9]]+"-"+P[e[10]]+P[e[11]]+P[e[12]]+P[e[13]]+P[e[14]]+P[e[15]]};var Cn=e=>e instanceof Error?e:e instanceof Object?Object.assign(new Error,e):typeof e=="string"?new Error(e):new Error(`AWS SDK error wrapper for ${e}`);var In="AWS_MAX_ATTEMPTS",An="max_attempts",Pn={environmentVariableSelector:e=>{let t=e[In];if(!t)return;let r=parseInt(t);if(Number.isNaN(r))throw new Error(`Environment variable ${In} mast be a number, got "${t}"`);return r},configFileSelector:e=>{let t=e[An];if(!t)return;let r=parseInt(t);if(Number.isNaN(r))throw new Error(`Shared config file entry ${An} mast be a number, got "${t}"`);return r},default:dr},wn=e=>{let{retryStrategy:t,retryMode:r}=e,o=z(e.maxAttempts??dr),n=t?Promise.resolve(t):void 0,s=async()=>await z(r)()===le.ADAPTIVE?new Io(o):new Co(o);return Object.assign(e,{maxAttempts:o,retryStrategy:()=>n??=s()})},Ba="AWS_RETRY_MODE",Ja="retry_mode",Dn={environmentVariableSelector:e=>e[Ba],configFileSelector:e=>e[Ja],default:vo};import{Readable as Ya}from"stream";var Tn=e=>e?.body instanceof Ya||typeof ReadableStream<"u"&&e?.body instanceof ReadableStream;var Qa=e=>(t,r)=>async o=>{let n=await e.retryStrategy(),s=await e.maxAttempts();if(Za(n)){n=n;let i=await n.acquireInitialRetryToken(r.partition_id),a=new Error,c=0,p=0,{request:u}=o,l=D.isInstance(u);for(l&&(u.headers[Ro]=vn());;)try{l&&(u.headers[_o]=`attempt=${c+1}; max=${s}`);let{response:m,output:R}=await t(o);return n.recordSuccess(i),R.$metadata.attempts=c+1,R.$metadata.totalRetryDelay=p,{response:m,output:R}}catch(m){let R=ec(m);if(a=Cn(m),l&&Tn(u))throw(r.logger instanceof so?console:r.logger)?.warn("An error was encountered in a non-retryable streaming request."),a;try{i=await n.refreshRetryTokenForRetry(i,R)}catch{throw a.$metadata||(a.$metadata={}),a.$metadata.attempts=c+1,a.$metadata.totalRetryDelay=p,a}c=i.getRetryCount();let _=i.getRetryDelay();p+=_,await new Promise(A=>setTimeout(A,_))}}else return n=n,n?.mode&&(r.userAgent=[...r.userAgent||[],["cfg/retry-mode",n.mode]]),n.retry(t,o)},Za=e=>typeof e.acquireInitialRetryToken<"u"&&typeof e.refreshRetryTokenForRetry<"u"&&typeof e.recordSuccess<"u",ec=e=>{let t={error:e,errorType:tc(e)},r=oc(e.$response);return r&&(t.retryAfterHint=r),t},tc=e=>Sn(e)?"THROTTLING":$e(e)?"TRANSIENT":Rn(e)?"SERVER_ERROR":"CLIENT_ERROR",rc={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},On=e=>({applyToStack:t=>{t.add(Qa(e),rc)}}),oc=e=>{if(!Z.isInstance(e))return;let t=Object.keys(e.headers).find(s=>s.toLowerCase()==="retry-after");if(!t)return;let r=e.headers[t],o=Number(r);return Number.isNaN(o)?new Date(r):new Date(o*1e3)};var Me=class{config;middlewareStack=ue();initConfig;handlers;constructor(t){this.config=t;let{protocol:r,protocolSettings:o}=t;o&&typeof r=="function"&&(t.protocol=new r(o))}send(t,r,o){let n=typeof r!="function"?r:void 0,s=typeof r=="function"?r:o,i=n===void 0&&this.config.cacheMiddleware===!0,a;if(i){this.handlers||(this.handlers=new WeakMap);let c=this.handlers;c.has(t.constructor)?a=c.get(t.constructor):(a=t.resolveMiddleware(this.middlewareStack,this.config,n),c.set(t.constructor,a))}else delete this.handlers,a=t.resolveMiddleware(this.middlewareStack,this.config,n);if(s)a(t).then(c=>s(null,c.output),c=>s(c)).catch(()=>{});else return a(t).then(c=>c.output)}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}};var Cr="***SensitiveInformation***";function Ue(e,t){if(t==null)return t;let r=T.of(e);if(r.getMergedTraits().sensitive)return Cr;if(r.isListSchema()){if(!!r.getValueSchema().getMergedTraits().sensitive)return Cr}else if(r.isMapSchema()){if(!!r.getKeySchema().getMergedTraits().sensitive||!!r.getValueSchema().getMergedTraits().sensitive)return Cr}else if(r.isStructSchema()&&typeof t=="object"){let o=t,n={};for(let[s,i]of r.structIterator())o[s]!=null&&(n[s]=Ue(i,o[s]));return n}return t}var J=class{middlewareStack=ue();schema;static classBuilder(){return new Ir}resolveMiddlewareWithContext(t,r,o,{middlewareFn:n,clientName:s,commandName:i,inputFilterSensitiveLog:a,outputFilterSensitiveLog:c,smithyContext:p,additionalContext:u,CommandCtor:l}){for(let F of n.bind(this)(l,t,r,o))this.middlewareStack.use(F);let m=t.concat(this.middlewareStack),{logger:R}=r,_={logger:R,clientName:s,commandName:i,inputFilterSensitiveLog:a,outputFilterSensitiveLog:c,[ae]:{commandInstance:this,...p},...u},{requestHandler:A}=r;return m.resolve(F=>A.handle(F.request,o||{}),_)}},Ir=class{_init=()=>{};_ep={};_middlewareFn=()=>[];_commandName="";_clientName="";_additionalContext={};_smithyContext={};_inputFilterSensitiveLog=void 0;_outputFilterSensitiveLog=void 0;_serializer=null;_deserializer=null;_operationSchema;init(t){this._init=t}ep(t){return this._ep=t,this}m(t){return this._middlewareFn=t,this}s(t,r,o={}){return this._smithyContext={service:t,operation:r,...o},this}c(t={}){return this._additionalContext=t,this}n(t,r){return this._clientName=t,this._commandName=r,this}f(t=o=>o,r=o=>o){return this._inputFilterSensitiveLog=t,this._outputFilterSensitiveLog=r,this}ser(t){return this._serializer=t,this}de(t){return this._deserializer=t,this}sc(t){return this._operationSchema=t,this._smithyContext.operationSchema=t,this}build(){let t=this,r;return r=class extends J{input;static getEndpointParameterInstructions(){return t._ep}constructor(...[o]){super(),this.input=o??{},t._init(this),this.schema=t._operationSchema}resolveMiddleware(o,n,s){let i=t._operationSchema,a=i?.[4]??i?.input,c=i?.[5]??i?.output;return this.resolveMiddlewareWithContext(o,n,s,{CommandCtor:r,middlewareFn:t._middlewareFn,clientName:t._clientName,commandName:t._commandName,inputFilterSensitiveLog:t._inputFilterSensitiveLog??(i?Ue.bind(null,a):p=>p),outputFilterSensitiveLog:t._outputFilterSensitiveLog??(i?Ue.bind(null,c):p=>p),smithyContext:t._smithyContext,additionalContext:t._additionalContext})}serialize=t._serializer;deserialize=t._deserializer}}};var Le=class e extends Error{$fault;$response;$retryable;$metadata;constructor(t){super(t.message),Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=t.name,this.$fault=t.$fault,this.$metadata=t.$metadata}static isInstance(t){if(!t)return!1;let r=t;return e.prototype.isPrototypeOf(r)||!!r.$fault&&!!r.$metadata&&(r.$fault==="client"||r.$fault==="server")}static[Symbol.hasInstance](t){if(!t)return!1;let r=t;return this===e?e.isInstance(t):e.isInstance(t)?r.name&&this.name?this.prototype.isPrototypeOf(t)||r.name===this.name:this.prototype.isPrototypeOf(t):!1}};var Kn=e=>{switch(e){case"standard":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}};var Nn=!1,bn=e=>{e&&!Nn&&parseInt(e.substring(1,e.indexOf(".")))<16&&(Nn=!0)};var kn=Object.values(Ce),$n=e=>{let t=[];for(let r in Ce){let o=Ce[r];e[o]!==void 0&&t.push({algorithmId:()=>o,checksumConstructor:()=>e[o]})}for(let[r,o]of Object.entries(e.checksumAlgorithms??{}))t.push({algorithmId:()=>r,checksumConstructor:()=>o});return{addChecksumAlgorithm(r){e.checksumAlgorithms=e.checksumAlgorithms??{};let o=r.algorithmId(),n=r.checksumConstructor();kn.includes(o)?e.checksumAlgorithms[o.toUpperCase()]=n:e.checksumAlgorithms[o]=n,t.push(r)},checksumAlgorithms(){return t}}},Mn=e=>{let t={};return e.checksumAlgorithms().forEach(r=>{let o=r.algorithmId();kn.includes(o)&&(t[o]=r.checksumConstructor())}),t};var Un=e=>({setRetryStrategy(t){e.retryStrategy=t},retryStrategy(){return e.retryStrategy}}),Ln=e=>{let t={};return t.retryStrategy=e.retryStrategy(),t};var Fn=e=>Object.assign($n(e),Un(e));var Gn=e=>Object.assign(Mn(e),Ln(e));var Fe=class{trace(){}debug(){}info(){}warn(){}error(){}};var Ar=e=>Z.isInstance(e)?e.headers?.date??e.headers?.Date:void 0;var Ge=e=>new Date(Date.now()+e);var Vn=(e,t)=>Math.abs(Ge(t).getTime()-e)>=3e5;var Pr=(e,t)=>{let r=Date.parse(e);return Vn(r,t)?r-Date.now():t};var fe=(e,t)=>{if(!t)throw new Error(`Property \`${e}\` is not resolved for AWS SDK SigV4Auth`);return t},Hn=async e=>{let t=fe("context",e.context),r=fe("config",e.config),o=t.endpointV2?.properties?.authSchemes?.[0],s=await fe("signer",r.signer)(o),i=e?.signingRegion,a=e?.signingRegionSet,c=e?.signingName;return{config:r,signer:s,signingRegion:i,signingRegionSet:a,signingName:c}},ge=class{async sign(t,r,o){if(!D.isInstance(t))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let n=await Hn(o),{config:s,signer:i}=n,{signingRegion:a,signingName:c}=n,p=o.context;if(p?.authSchemes?.length??!1){let[l,m]=p.authSchemes;l?.name==="sigv4a"&&m?.name==="sigv4"&&(a=m?.signingRegion??a,c=m?.signingName??c)}return await i.sign(t,{signingDate:Ge(s.systemClockOffset),signingRegion:a,signingService:c})}errorHandler(t){return r=>{let o=r.ServerTime??Ar(r.$response);if(o){let n=fe("config",t.config),s=n.systemClockOffset;n.systemClockOffset=Pr(o,n.systemClockOffset),n.systemClockOffset!==s&&r.$metadata&&(r.$metadata.clockSkewCorrected=!0)}throw r}}successHandler(t,r){let o=Ar(t);if(o){let n=fe("config",r.config);n.systemClockOffset=Pr(o,n.systemClockOffset)}}};var wr=e=>typeof e=="string"&&e.length>0?e.split(",").map(t=>t.trim()):[];var jn=e=>`AWS_BEARER_TOKEN_${e.replace(/[\s-]/g,"_").toUpperCase()}`;var qn="AWS_AUTH_SCHEME_PREFERENCE",Xn="auth_scheme_preference",Wn={environmentVariableSelector:(e,t)=>{if(t?.signingName&&jn(t.signingName)in e)return["httpBearerAuth"];if(qn in e)return wr(e[qn])},configFileSelector:e=>{if(Xn in e)return wr(e[Xn])},default:[]};var re=class e extends Error{name="ProviderError";tryNextLink;constructor(t,r=!0){let o,n=!0;typeof r=="boolean"?(o=void 0,n=r):r!=null&&typeof r=="object"&&(o=r.logger,n=r.tryNextLink??!0),super(t),this.tryNextLink=n,Object.setPrototypeOf(this,e.prototype),o?.debug?.(`@smithy/property-provider ${n?"->":"(!)"} ${t}`)}static from(t,r=!0){return Object.assign(new this(t.message,r),t)}};var O=class e extends re{name="CredentialsProviderError";constructor(t,r=!0){super(t,r),Object.setPrototypeOf(this,e.prototype)}};var Ve=(...e)=>async()=>{if(e.length===0)throw new re("No providers in chain");let t;for(let r of e)try{return await r()}catch(o){if(t=o,o?.tryNextLink)continue;throw o}throw t};var zn=e=>()=>Promise.resolve(e);var He=(e,t,r)=>{let o,n,s,i=!1,a=async()=>{n||(n=e());try{o=await n,s=!0,i=!1}finally{n=void 0}return o};return t===void 0?async c=>((!s||c?.forceRefresh)&&(o=await a()),o):async c=>((!s||c?.forceRefresh)&&(o=await a()),i?o:r&&!r(o)?(i=!0,o):(t(o)&&await a(),o))};var Bn={warningEmitted:!1},Jn=e=>{e&&!Bn.warningEmitted&&parseInt(e.substring(1,e.indexOf(".")))<20&&(Bn.warningEmitted=!0,process.emitWarning(`NodeDeprecationWarning: The AWS SDK for JavaScript (v3) will
2
+ no longer support Node.js ${e} in January 2026.
3
+
4
+ To continue receiving updates to AWS services, bug fixes, and security
5
+ updates please upgrade to a supported Node.js LTS version.
6
+
7
+ More information can be found at: https://a.co/c895JFp`))};function Yn(e,t,r){return e.$source||(e.$source={}),e.$source[t]=r,e}var Qn=e=>{let t=e.credentials,r=!!e.credentials,o;Object.defineProperty(e,"credentials",{set(p){p&&p!==t&&p!==o&&(r=!0),t=p;let u=nc(e,{credentials:t,credentialDefaultProvider:e.credentialDefaultProvider}),l=sc(e,u);if(r&&!l.attributed){let m=typeof t=="object"&&t!==null;o=async R=>{let A=await l(R);return m&&(!A.$source||Object.keys(A.$source).length===0)?Yn(A,"CREDENTIALS_CODE","e"):A},o.memoized=l.memoized,o.configBound=l.configBound,o.attributed=!0}else o=l},get(){return o},enumerable:!0,configurable:!0}),e.credentials=t;let{signingEscapePath:n=!0,systemClockOffset:s=e.systemClockOffset||0,sha256:i}=e,a;return e.signer?a=B(e.signer):e.regionInfoProvider?a=()=>B(e.region)().then(async p=>[await e.regionInfoProvider(p,{useFipsEndpoint:await e.useFipsEndpoint(),useDualstackEndpoint:await e.useDualstackEndpoint()})||{},p]).then(([p,u])=>{let{signingRegion:l,signingService:m}=p;e.signingRegion=e.signingRegion||l||u,e.signingName=e.signingName||m||e.serviceId;let R={...e,credentials:e.credentials,region:e.signingRegion,service:e.signingName,sha256:i,uriEscapePath:n},_=e.signerConstructor||mr;return new _(R)}):a=async p=>{p=Object.assign({},{name:"sigv4",signingName:e.signingName||e.defaultSigningName,signingRegion:await B(e.region)(),properties:{}},p);let u=p.signingRegion,l=p.signingName;e.signingRegion=e.signingRegion||u,e.signingName=e.signingName||l||e.serviceId;let m={...e,credentials:e.credentials,region:e.signingRegion,service:e.signingName,sha256:i,uriEscapePath:n},R=e.signerConstructor||mr;return new R(m)},Object.assign(e,{systemClockOffset:s,signingEscapePath:n,signer:a})};function nc(e,{credentials:t,credentialDefaultProvider:r}){let o;return t?t?.memoized?o=t:o=xo(t,yo,ho):r?o=B(r(Object.assign({},e,{parentClientConfig:e}))):o=async()=>{throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")},o.memoized=!0,o}function sc(e,t){if(t.configBound)return t;let r=async o=>t({...o,callerClientConfig:e});return r.memoized=t.memoized,r.configBound=!0,r}var Zn=e=>e[ae]||(e[ae]={});var Dr=e=>{if(typeof e=="function")return e;let t=Promise.resolve(e);return()=>t};var es=async(e,t,r)=>({operation:Zn(t).operation,region:await Dr(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function ic(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"kms",region:e.region},propertiesExtractor:(t,r)=>({signingProperties:{config:t,context:r}})}}var ts=e=>{let t=[];switch(e.operation){default:t.push(ic(e))}return t},rs=e=>{let t=Qn(e);return Object.assign(t,{authSchemePreference:Dr(e.authSchemePreference??[])})};var os=e=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"kms"}),je={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var ns={name:"@aws-sdk/client-kms",description:"AWS SDK for JavaScript Kms Client for Node.js, Browser and React Native",version:"3.1019.0",scripts:{build:"concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs","build:cjs":"node ../../scripts/compilation/inline client-kms","build:es":"tsc -p tsconfig.es.json","build:include:deps":'yarn g:turbo run build -F="$npm_package_name"',"build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo kms","test:e2e":"yarn g:vitest run -c vitest.config.e2e.mts --mode development","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.mts","test:index":"tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs"},main:"./dist-cjs/index.js",types:"./dist-types/index.d.ts",module:"./dist-es/index.js",sideEffects:!1,dependencies:{"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"^3.973.25","@aws-sdk/credential-provider-node":"^3.972.27","@aws-sdk/middleware-host-header":"^3.972.8","@aws-sdk/middleware-logger":"^3.972.8","@aws-sdk/middleware-recursion-detection":"^3.972.9","@aws-sdk/middleware-user-agent":"^3.972.26","@aws-sdk/region-config-resolver":"^3.972.10","@aws-sdk/types":"^3.973.6","@aws-sdk/util-endpoints":"^3.996.5","@aws-sdk/util-user-agent-browser":"^3.972.8","@aws-sdk/util-user-agent-node":"^3.973.12","@smithy/config-resolver":"^4.4.13","@smithy/core":"^3.23.12","@smithy/fetch-http-handler":"^5.3.15","@smithy/hash-node":"^4.2.12","@smithy/invalid-dependency":"^4.2.12","@smithy/middleware-content-length":"^4.2.12","@smithy/middleware-endpoint":"^4.4.27","@smithy/middleware-retry":"^4.4.44","@smithy/middleware-serde":"^4.2.15","@smithy/middleware-stack":"^4.2.12","@smithy/node-config-provider":"^4.3.12","@smithy/node-http-handler":"^4.5.0","@smithy/protocol-http":"^5.3.12","@smithy/smithy-client":"^4.12.7","@smithy/types":"^4.13.1","@smithy/url-parser":"^4.2.12","@smithy/util-base64":"^4.3.2","@smithy/util-body-length-browser":"^4.2.2","@smithy/util-body-length-node":"^4.2.3","@smithy/util-defaults-mode-browser":"^4.3.43","@smithy/util-defaults-mode-node":"^4.2.47","@smithy/util-endpoints":"^3.3.3","@smithy/util-middleware":"^4.2.12","@smithy/util-retry":"^4.2.12","@smithy/util-utf8":"^4.2.2",tslib:"^2.6.2"},devDependencies:{"@tsconfig/node20":"20.1.8","@types/node":"^20.14.8",concurrently:"7.0.0","downlevel-dts":"0.10.1",premove:"4.0.0",typescript:"~5.8.3"},engines:{node:">=20.0.0"},typesVersions:{"<4.5":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["dist-*/**"],author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license:"Apache-2.0",browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-kms",repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-kms"}};var Tr="AWS_ACCESS_KEY_ID",Or="AWS_SECRET_ACCESS_KEY",cc="AWS_SESSION_TOKEN",pc="AWS_CREDENTIAL_EXPIRATION",uc="AWS_CREDENTIAL_SCOPE",lc="AWS_ACCOUNT_ID",ss=e=>async()=>{e?.logger?.debug("@aws-sdk/credential-provider-env - fromEnv");let t=process.env[Tr],r=process.env[Or],o=process.env[cc],n=process.env[pc],s=process.env[uc],i=process.env[lc];if(t&&r){let a={accessKeyId:t,secretAccessKey:r,...o&&{sessionToken:o},...n&&{expiration:new Date(n)},...s&&{credentialScope:s},...i&&{accountId:i}};return lr(a,"CREDENTIALS_ENV_VARS","g"),a}throw new ro("Unable to find environment variable credentials.",{logger:e?.logger})};var is="AWS_EC2_METADATA_DISABLED",as=async e=>{let{ENV_CMDS_FULL_URI:t,ENV_CMDS_RELATIVE_URI:r,fromContainerMetadata:o,fromInstanceMetadata:n}=await import("./dist-es-H47VUS6Q.js");if(process.env[r]||process.env[t]){e.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromHttp/fromContainerMetadata");let{fromHttp:s}=await import("./dist-es-YN4LRIZR.js");return Ve(s(e),o(e))}return process.env[is]&&process.env[is]!=="false"?async()=>{throw new O("EC2 Instance Metadata Service access disabled",{logger:e.logger})}:(e.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromInstanceMetadata"),n(e))};function cs(e,t){let r=dc(e),o,n,s,i=async a=>{if(a?.forceRefresh)return await r(a);if(s?.expiration&&s?.expiration?.getTime()<Date.now()&&(s=void 0),o)await o;else if(!s||t?.(s))if(s)n||(n=r(a).then(c=>{s=c}).finally(()=>{n=void 0}));else return o=r(a).then(c=>{s=c}).finally(()=>{o=void 0}),i(a);return s};return i}var dc=e=>async t=>{let r;for(let o of e)try{return await o(t)}catch(n){if(r=n,n?.tryNextLink)continue;throw n}throw r};var ps=!1,us=(e={})=>cs([async()=>{if(e.profile??process.env[xr])throw process.env[Tr]&&process.env[Or]&&(ps||((e.logger?.warn&&e.logger?.constructor?.name!=="NoOpLogger"?e.logger.warn.bind(e.logger):console.warn)(`@aws-sdk/credential-provider-node - defaultProvider::fromEnv WARNING:
8
+ Multiple credential sources detected:
9
+ Both AWS_PROFILE and the pair AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY static credentials are set.
10
+ This SDK will proceed with the AWS_PROFILE value.
11
+
12
+ However, a future version may change this behavior to prefer the ENV static credentials.
13
+ Please ensure that your environment only sets either the AWS_PROFILE or the
14
+ AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY pair.
15
+ `),ps=!0)),new O("AWS_PROFILE is set, skipping fromEnv provider.",{logger:e.logger,tryNextLink:!0});return e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromEnv"),ss(e)()},async t=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromSSO");let{ssoStartUrl:r,ssoAccountId:o,ssoRegion:n,ssoRoleName:s,ssoSession:i}=e;if(!r&&!o&&!n&&!s&&!i)throw new O("Skipping SSO provider in default chain (inputs do not include SSO fields).",{logger:e.logger});let{fromSSO:a}=await import("./dist-es-JCIK4C4M.js");return a(e)(t)},async t=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromIni");let{fromIni:r}=await import("./dist-es-MFZXYPBY.js");return r(e)(t)},async t=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromProcess");let{fromProcess:r}=await import("./dist-es-PREZ4TU2.js");return r(e)(t)},async t=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromTokenFile");let{fromTokenFile:r}=await import("./dist-es-CN2GMFBK.js");return r(e)(t)},async()=>(e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::remoteProvider"),(await as(e))()),async()=>{throw new O("Could not load credentials from any providers",{tryNextLink:!1,logger:e.logger})}],mc);var mc=e=>e?.expiration!==void 0&&e.expiration.getTime()-Date.now()<3e5;import{platform as xc,release as Sc}from"os";import{env as xs}from"process";import{versions as Kr}from"process";var ls=()=>{let e=["deno","bun","llrt"];for(let t of e)if(Kr[t])return[`md/${t}`,Kr[t]];return["md/nodejs",Kr.node]};import{readFile as gs}from"fs/promises";import{join as Nr}from"path";import{normalize as fc,sep as ds}from"path";var ms=e=>{let t=process.cwd();if(!e)return[t];let r=fc(e),o=r.split(ds),n=o.indexOf("node_modules"),s=n!==-1?o.slice(0,n).join(ds):r;return t===s?[t]:[s,t]};var gc=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/,qe=(e="")=>{let t=e.match(gc);if(!t)return;let[r,o,n,s]=[t[1],t[2],t[3],t[4]];return s?`${r}.${o}.${n}-${s}`:`${r}.${o}.${n}`};var Ec=["^","~",">=","<=",">","<"],yc=["latest","beta","dev","rc","insiders","next"],fs=(e="")=>{if(yc.includes(e))return e;let t=Ec.find(o=>e.startsWith(o))??"",r=qe(e.slice(t.length));if(r)return`${t}${r}`};var k,hc=Nr("node_modules","typescript","package.json"),Es=async()=>{if(k===null)return;if(typeof k=="string")return["md/tsc",k];let e=!1;try{e=H(process.env,"AWS_SDK_JS_TYPESCRIPT_DETECTION_DISABLED",j.ENV)||!1}catch{}if(e){k=null;return}let r=ms(typeof __dirname<"u"?__dirname:void 0),o;for(let i of r)try{let a=Nr(i,"package.json"),c=await gs(a,"utf-8"),{dependencies:p,devDependencies:u}=JSON.parse(c),l=u?.typescript??p?.typescript;if(typeof l!="string")continue;o=l;break}catch{}if(!o){k=null;return}let n;for(let i of r)try{let a=Nr(i,hc),c=await gs(a,"utf-8"),{version:p}=JSON.parse(c),u=qe(p);if(typeof u!="string")continue;n=u;break}catch{}if(n)return k=n,["md/tsc",k];let s=fs(o);if(typeof s!="string"){k=null;return}return k=`dev_${s}`,["md/tsc",k]};var ys={isCrtAvailable:!1};var hs=()=>ys.isCrtAvailable?["md/crt-avail"]:null;var Ss=({serviceId:e,clientVersion:t})=>{let r=ls();return async o=>{let n=[["aws-sdk-js",t],["ua","2.1"],[`os/${xc()}`,Sc()],["lang/js"],r],s=await Es();s&&n.push(s);let i=hs();i&&n.push(i),e&&n.push([`api/${e}`,t]),xs.AWS_EXECUTION_ENV&&n.push([`exec-env/${xs.AWS_EXECUTION_ENV}`]);let a=await o?.userAgentAppId?.();return a?[...n,[`app/${a}`]]:[...n]}};var Rc="AWS_SDK_UA_APP_ID",_c="sdk_ua_app_id",vc="sdk-ua-app-id",Rs={environmentVariableSelector:e=>e[Rc],configFileSelector:e=>e[_c]??e[vc],default:Ao};var _s=e=>typeof e=="string"?we(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e);import{Buffer as Cc}from"buffer";import{createHash as Ic,createHmac as Ac}from"crypto";var Xe=class{algorithmIdentifier;secret;hash;constructor(t,r){this.algorithmIdentifier=t,this.secret=r,this.reset()}update(t,r){this.hash.update(_s(vs(t,r)))}digest(){return Promise.resolve(this.hash.digest())}reset(){this.hash=this.secret?Ac(this.algorithmIdentifier,vs(this.secret)):Ic(this.algorithmIdentifier)}};function vs(e,t){return Cc.isBuffer(e)?e:typeof e=="string"?wo(e,t):ArrayBuffer.isView(e)?fr(e.buffer,e.byteOffset,e.byteLength):fr(e)}function We(e){try{let t=new Set(Array.from(e.match(/([A-Z_]){3,}/g)??[]));return t.delete("CONFIG"),t.delete("CONFIG_PREFIX_SEPARATOR"),t.delete("ENV"),[...t].join(", ")}catch{return e}}var Cs=(e,t)=>async()=>{try{let r=e(process.env,t);if(r===void 0)throw new Error;return r}catch(r){throw new O(r.message||`Not found in ENV: ${We(e.toString())}`,{logger:t?.logger})}};var Is=(e,{preferredFile:t="config",...r}={})=>async()=>{let o=en(r),{configFile:n,credentialsFile:s}=await cn(r),i=s[o]||{},a=n[o]||{},c=t==="config"?{...i,...a}:{...a,...i};try{let u=e(c,t==="config"?n:s);if(u===void 0)throw new Error;return u}catch(p){throw new O(p.message||`Not found in config files w/ profile [${o}]: ${We(e.toString())}`,{logger:r.logger})}};var Pc=e=>typeof e=="function",As=e=>Pc(e)?async()=>await e():zn(e);var q=({environmentVariableSelector:e,configFileSelector:t,default:r},o={})=>{let{signingName:n,logger:s}=o;return He(Ve(Cs(e,{signingName:n,logger:s}),Is(t,o),As(r)))};var ze=e=>encodeURIComponent(e).replace(/[!'()*]/g,wc),wc=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`;function Ps(e){let t=[];for(let r of Object.keys(e).sort()){let o=e[r];if(r=ze(r),Array.isArray(o))for(let n=0,s=o.length;n<s;n++)t.push(`${r}=${ze(o[n])}`);else{let n=r;(o||typeof o=="string")&&(n+=`=${ze(o)}`),t.push(n)}}return t.join("&")}import{Agent as kr,request as Kc}from"https";function br(e){let t=e&&typeof e=="object"&&"reason"in e?e.reason:void 0;if(t){if(t instanceof Error){let n=new Error("Request aborted");return n.name="AbortError",n.cause=t,n}let o=new Error(String(t));return o.name="AbortError",o}let r=new Error("Request aborted");return r.name="AbortError",r}var ws=["ECONNRESET","EPIPE","ETIMEDOUT"];var Ds=e=>{let t={};for(let r of Object.keys(e)){let o=e[r];t[r]=Array.isArray(o)?o.join(","):o}return t};var I={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)};var Ts=1e3,Os=(e,t,r=0)=>{if(!r)return-1;let o=n=>{let s=I.setTimeout(()=>{e.destroy(),t(Object.assign(new Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${r} ms.`),{name:"TimeoutError"}))},r-n),i=a=>{a?.connecting?a.on("connect",()=>{I.clearTimeout(s)}):I.clearTimeout(s)};e.socket?i(e.socket):e.on("socket",i)};return r<2e3?(o(0),0):I.setTimeout(o.bind(null,Ts),Ts)};var Ks=(e,t,r=0,o,n)=>r?I.setTimeout(()=>{let s=`@smithy/node-http-handler - [${o?"ERROR":"WARN"}] a request has exceeded the configured ${r} ms requestTimeout.`;if(o){let i=Object.assign(new Error(s),{name:"TimeoutError",code:"ETIMEDOUT"});e.destroy(i),t(i)}else s+=" Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.",n?.warn?.(s)},r):-1;var Dc=3e3,Ns=(e,{keepAlive:t,keepAliveMsecs:r},o=Dc)=>{if(t!==!0)return-1;let n=()=>{e.socket?e.socket.setKeepAlive(t,r||0):e.on("socket",s=>{s.setKeepAlive(t,r||0)})};return o===0?(n(),0):I.setTimeout(n,o)};var bs=3e3,ks=(e,t,r=0)=>{let o=n=>{let s=r-n,i=()=>{e.destroy(),t(Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${r} ms of inactivity (configured by client requestHandler).`),{name:"TimeoutError"}))};e.socket?(e.socket.setTimeout(s,i),e.on("close",()=>e.socket?.removeListener("timeout",i))):e.setTimeout(s,i)};return 0<r&&r<6e3?(o(0),0):I.setTimeout(o.bind(null,r===0?0:bs),bs)};import{Readable as Tc}from"stream";var $s=6e3;async function Ms(e,t,r=$s,o=!1){let n=t.headers??{},s=n.Expect||n.expect,i=-1,a=!0;!o&&s==="100-continue"&&(a=await Promise.race([new Promise(c=>{i=Number(I.setTimeout(()=>c(!0),Math.max($s,r)))}),new Promise(c=>{e.on("continue",()=>{I.clearTimeout(i),c(!0)}),e.on("response",()=>{I.clearTimeout(i),c(!1)}),e.on("error",()=>{I.clearTimeout(i),c(!1)})})])),a&&Oc(e,t.body)}function Oc(e,t){if(t instanceof Tc){t.pipe(e);return}if(t){let r=Buffer.isBuffer(t);if(r||typeof t=="string"){r&&t.byteLength===0?e.end():e.end(t);return}let n=t;if(typeof n=="object"&&n.buffer&&typeof n.byteOffset=="number"&&typeof n.byteLength=="number"){e.end(Buffer.from(n.buffer,n.byteOffset,n.byteLength));return}e.end(Buffer.from(t));return}e.end()}var Be,Us,Je=class e{config;configProvider;socketWarningTimestamp=0;externalAgent=!1;metadata={handlerProtocol:"http/1.1"};static create(t){return typeof t?.handle=="function"?t:new e(t)}static checkSocketUsage(t,r,o=console){let{sockets:n,requests:s,maxSockets:i}=t;if(typeof i!="number"||i===1/0||Date.now()-15e3<r)return r;if(n&&s)for(let c in n){let p=n[c]?.length??0,u=s[c]?.length??0;if(p>=i&&u>=2*i)return o?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${p} and ${u} additional requests are enqueued.
16
+ See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
17
+ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`),Date.now()}return r}constructor(t){this.configProvider=new Promise((r,o)=>{typeof t=="function"?t().then(n=>{r(this.resolveDefaultConfig(n))}).catch(o):r(this.resolveDefaultConfig(t))})}destroy(){this.config?.httpAgent?.destroy(),this.config?.httpsAgent?.destroy()}async handle(t,{abortSignal:r,requestTimeout:o}={}){this.config||(this.config=await this.configProvider);let n=this.config,s=t.protocol==="https:";return!s&&!this.config.httpAgent&&(this.config.httpAgent=await this.config.httpAgentProvider()),new Promise((i,a)=>{let c,p=[],u=async C=>{await c,p.forEach(I.clearTimeout),i(C)},l=async C=>{await c,p.forEach(I.clearTimeout),a(C)};if(r?.aborted){let C=br(r);l(C);return}let m=t.headers??{},R=(m.Expect??m.expect)==="100-continue",_=s?n.httpsAgent:n.httpAgent;R&&!this.externalAgent&&(_=new(s?kr:Be)({keepAlive:!1,maxSockets:1/0})),p.push(I.setTimeout(()=>{this.socketWarningTimestamp=e.checkSocketUsage(_,this.socketWarningTimestamp,n.logger)},n.socketAcquisitionWarningTimeout??(n.requestTimeout??2e3)+(n.connectionTimeout??1e3)));let A=Ps(t.query||{}),F;if(t.username!=null||t.password!=null){let C=t.username??"",V=t.password??"";F=`${C}:${V}`}let Q=t.path;A&&(Q+=`?${A}`),t.fragment&&(Q+=`#${t.fragment}`);let W=t.hostname??"";W[0]==="["&&W.endsWith("]")?W=t.hostname.slice(1,-1):W=t.hostname;let Se={headers:t.headers,host:W,method:t.method,path:Q,port:t.port,agent:_,auth:F},G=(s?Kc:Us)(Se,C=>{let V=new Z({statusCode:C.statusCode||-1,reason:C.statusMessage,headers:Ds(C.headers),body:C});u({response:V})});if(G.on("error",C=>{ws.includes(C.code)?l(Object.assign(C,{name:"TimeoutError"})):l(C)}),r){let C=()=>{G.destroy();let V=br(r);l(V)};if(typeof r.addEventListener=="function"){let V=r;V.addEventListener("abort",C,{once:!0}),G.once("close",()=>V.removeEventListener("abort",C))}else r.onabort=C}let zr=o??n.requestTimeout;p.push(Os(G,l,n.connectionTimeout)),p.push(Ks(G,l,zr,n.throwOnRequestTimeout,n.logger??console)),p.push(ks(G,l,n.socketTimeout));let Re=Se.agent;typeof Re=="object"&&"keepAlive"in Re&&p.push(Ns(G,{keepAlive:Re.keepAlive,keepAliveMsecs:Re.keepAliveMsecs})),c=Ms(G,t,zr,this.externalAgent).catch(C=>(p.forEach(I.clearTimeout),a(C)))})}updateHttpClientConfig(t,r){this.config=void 0,this.configProvider=this.configProvider.then(o=>({...o,[t]:r}))}httpHandlerConfigs(){return this.config??{}}resolveDefaultConfig(t){let{requestTimeout:r,connectionTimeout:o,socketTimeout:n,socketAcquisitionWarningTimeout:s,httpAgent:i,httpsAgent:a,throwOnRequestTimeout:c,logger:p}=t||{},u=!0,l=50;return{connectionTimeout:o,requestTimeout:r,socketTimeout:n,socketAcquisitionWarningTimeout:s,throwOnRequestTimeout:c,httpAgentProvider:async()=>{let{Agent:m,request:R}=await import("http");return Us=R,Be=m,i instanceof Be||typeof i?.destroy=="function"?(this.externalAgent=!0,i):new Be({keepAlive:u,maxSockets:l,...i})},httpsAgent:a instanceof kr||typeof a?.destroy=="function"?(this.externalAgent=!0,a):new kr({keepAlive:u,maxSockets:l,...a}),logger:p}}};import{Writable as Nc}from"stream";var Ye=class extends Nc{bufferedBytes=[];_write(t,r,o){this.bufferedBytes.push(t),o()}};var Ls=e=>bc(e)?kc(e):new Promise((t,r)=>{let o=new Ye;e.pipe(o),e.on("error",n=>{o.end(),r(n)}),o.on("error",r),o.on("finish",function(){let n=new Uint8Array(Buffer.concat(this.bufferedBytes));t(n)})}),bc=e=>typeof ReadableStream=="function"&&e instanceof ReadableStream;async function kc(e){let t=[],r=e.getReader(),o=!1,n=0;for(;!o;){let{done:a,value:c}=await r.read();c&&(t.push(c),n+=c.length),o=a}let s=new Uint8Array(n),i=0;for(let a of t)s.set(a,i),i+=a.length;return s}var Fs="AWS_EXECUTION_ENV",$r="AWS_REGION",Mr="AWS_DEFAULT_REGION",Gs="AWS_EC2_METADATA_DISABLED",Vs=["in-region","cross-region","mobile","standard","legacy"],Hs="/latest/meta-data/placement/region";var $c="AWS_DEFAULTS_MODE",Mc="defaults_mode",js={environmentVariableSelector:e=>e[$c],configFileSelector:e=>e[Mc],default:"legacy"};var qs=({region:e=pe(io),defaultsMode:t=pe(js)}={})=>He(async()=>{let r=typeof t=="function"?await t():t;switch(r?.toLowerCase()){case"auto":return Uc(e);case"in-region":case"cross-region":case"mobile":case"standard":case"legacy":return Promise.resolve(r?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${Vs.join(", ")}, got ${r}`)}}),Uc=async e=>{if(e){let t=typeof e=="function"?await e():e,r=await Lc();return r?t===r?"in-region":"cross-region":"standard"}return"standard"},Lc=async()=>{if(process.env[Fs]&&(process.env[$r]||process.env[Mr]))return process.env[$r]??process.env[Mr];if(!process.env[Gs])try{let{getInstanceMetadataEndpoint:e,httpRequest:t}=await import("./dist-es-H47VUS6Q.js"),r=await e();return(await t({...r,path:Hs})).toString()}catch{}};var Ur;(function(e){e.STANDARD="standard",e.ADAPTIVE="adaptive"})(Ur||(Ur={}));var Xs=Ur.STANDARD;var Qe=class{queryCompat;errorRegistry;constructor(t=!1){this.queryCompat=t}resolveRestContentType(t,r){let o=r.getMemberSchemas(),n=Object.values(o).find(s=>!!s.getMergedTraits().httpPayload);if(n){let s=n.getMergedTraits().mediaType;return s||(n.isStringSchema()?"text/plain":n.isBlobSchema()?"application/octet-stream":t)}else if(!r.isUnitSchema()&&Object.values(o).find(i=>{let{httpQuery:a,httpQueryParams:c,httpHeader:p,httpLabel:u,httpPrefixHeaders:l}=i.getMergedTraits();return!a&&!c&&!p&&!u&&l===void 0}))return t}async getErrorSchemaOrThrowBaseException(t,r,o,n,s,i){let a=t;t.includes("#")&&([,a]=t.split("#"));let c={$metadata:s,$fault:o.statusCode<500?"client":"server"};if(!this.errorRegistry)throw new Error("@aws-sdk/core/protocols - error handler not initialized.");try{return{errorSchema:i?.(this.errorRegistry,a)??this.errorRegistry.getSchema(t),errorMetadata:c}}catch{n.message=n.message??n.Message??"UnknownError";let u=this.errorRegistry,l=u.getBaseException();if(l){let _=u.getErrorCtor(l)??Error;throw this.decorateServiceException(Object.assign(new _({name:a}),c),n)}let m=n,R=m?.message??m?.Message??m?.Error?.Message??m?.Error?.message;throw this.decorateServiceException(Object.assign(new Error(R),{name:a},c),n)}}compose(t,r,o){let n=o;r.includes("#")&&([n]=r.split("#"));let s=ee.for(n),i=ee.for("smithy.ts.sdk.synthetic."+o);t.copyFrom(s),t.copyFrom(i),this.errorRegistry=t}decorateServiceException(t,r={}){if(this.queryCompat){let o=t.Message??r.Message,n=cr(t,r);o&&(n.message=o),n.Error={...n.Error,Type:n.Error?.Type,Code:n.Error?.Code,Message:n.Error?.message??n.Error?.Message??o};let s=n.$metadata.requestId;return s&&(n.RequestId=s),n}return cr(t,r)}setQueryCompatError(t,r){let o=r.headers?.["x-amzn-query-error"];if(t!==void 0&&o!=null){let[n,s]=o.split(";"),i=Object.entries(t),a={Code:n,Type:s};Object.assign(t,a);for(let[c,p]of i)a[c==="message"?"Message":c]=p;delete a.__type,t.Error=a}}queryCompatOutput(t,r){t.Error&&(r.Error=t.Error),t.Type&&(r.Type=t.Type),t.Code&&(r.Code=t.Code)}findQueryCompatibleError(t,r){try{return t.getSchema(r)}catch{return t.find(n=>T.of(n).getMergedTraits().awsQueryError?.[0]===r)}}};var X=class{serdeContext;setSerdeContext(t){this.serdeContext=t}};var Ze=class{from;to;keys;constructor(t,r){this.from=t,this.to=r,this.keys=new Set(Object.keys(this.from).filter(o=>o!=="__type"))}mark(t){this.keys.delete(t)}hasUnknown(){return this.keys.size===1&&Object.keys(this.to).length===0}writeUnknown(){if(this.hasUnknown()){let t=this.keys.values().next().value,r=this.from[t];this.to.$unknown=[t,r]}}};function Ws(e,t,r){if(r?.source){let o=r.source;if(typeof t=="number"&&(t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||o!==String(t)))return o.includes(".")?new w(o,"bigDecimal"):BigInt(o)}return t}var zs=(e,t)=>po(e,t).then(r=>(t?.utf8Encoder??De)(r));var Bs=(e,t)=>zs(e,t).then(r=>{if(r.length)try{return JSON.parse(r)}catch(o){throw o?.name==="SyntaxError"&&Object.defineProperty(o,"$responseBodyText",{value:r}),o}return{}});var Js=(e,t)=>{let r=(s,i)=>Object.keys(s).find(a=>a.toLowerCase()===i.toLowerCase()),o=s=>{let i=s;return typeof i=="number"&&(i=i.toString()),i.indexOf(",")>=0&&(i=i.split(",")[0]),i.indexOf(":")>=0&&(i=i.split(":")[0]),i.indexOf("#")>=0&&(i=i.split("#")[1]),i},n=r(e.headers,"x-amzn-errortype");if(n!==void 0)return o(e.headers[n]);if(t&&typeof t=="object"){let s=r(t,"code");if(s&&t[s]!==void 0)return o(t[s]);if(t.__type!==void 0)return o(t.__type)}};var et=class extends X{settings;constructor(t){super(),this.settings=t}async read(t,r){return this._read(t,typeof r=="string"?JSON.parse(r,Ws):await Bs(r,this.serdeContext))}readObject(t,r){return this._read(t,r)}_read(t,r){let o=r!==null&&typeof r=="object",n=T.of(t);if(o){if(n.isStructSchema()){let i=r,a=n.isUnionSchema(),c={},p,{jsonName:u}=this.settings;u&&(p={});let l;a&&(l=new Ze(i,c));for(let[m,R]of n.structIterator()){let _=m;u&&(_=R.getMergedTraits().jsonName??_,p[_]=m),a&&l.mark(_),i[_]!=null&&(c[m]=this._read(R,i[_]))}if(a)l.writeUnknown();else if(typeof i.__type=="string")for(let[m,R]of Object.entries(i)){let _=u?p[m]??m:m;_ in c||(c[_]=R)}return c}if(Array.isArray(r)&&n.isListSchema()){let i=n.getValueSchema(),a=[];for(let c of r)a.push(this._read(i,c));return a}if(n.isMapSchema()){let i=n.getValueSchema(),a={};for(let[c,p]of Object.entries(r))a[c]=this._read(i,p);return a}}if(n.isBlobSchema()&&typeof r=="string")return Pe(r);let s=n.getMergedTraits().mediaType;if(n.isStringSchema()&&typeof r=="string"&&s)return s==="application/json"||s.endsWith("+json")?_e.from(r):r;if(n.isTimestampSchema()&&r!=null)switch(Ae(n,this.settings)){case 5:return Qr(r);case 6:return Zr(r);case 7:return eo(r);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",r),new Date(r)}if(n.isBigIntegerSchema()&&(typeof r=="number"||typeof r=="string"))return BigInt(r);if(n.isBigDecimalSchema()&&r!=null){if(r instanceof w)return r;let i=r;return i.type==="bigDecimal"&&"string"in i?new w(i.string,i.type):new w(String(r),"bigDecimal")}if(n.isNumericSchema()&&typeof r=="string"){switch(r){case"Infinity":return 1/0;case"-Infinity":return-1/0;case"NaN":return NaN}return r}if(n.isDocumentSchema())if(o){let i=Array.isArray(r)?[]:{};for(let[a,c]of Object.entries(r))c instanceof w?i[a]=c:i[a]=this._read(n,c);return i}else return structuredClone(r);return r}};var Ys="\u039D",tt=class{values=new Map;counter=0;stage=0;createReplacer(){if(this.stage===1)throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");return this.stage=1,(t,r)=>{if(r instanceof w){let o=`${Ys+"nv"+this.counter++}_`+r.string;return this.values.set(`"${o}"`,r.string),o}if(typeof r=="bigint"){let o=r.toString(),n=`${Ys+"b"+this.counter++}_`+o;return this.values.set(`"${n}"`,o),n}return r}}replaceInJson(t){if(this.stage===0)throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");if(this.stage=2,this.counter===0)return t;for(let[r,o]of this.values)t=t.replace(r,o);return t}};var rt=class extends X{settings;buffer;useReplacer=!1;rootSchema;constructor(t){super(),this.settings=t}write(t,r){this.rootSchema=T.of(t),this.buffer=this._write(this.rootSchema,r)}writeDiscriminatedDocument(t,r){this.write(t,r),typeof this.buffer=="object"&&(this.buffer.__type=T.of(t).getName(!0))}flush(){let{rootSchema:t,useReplacer:r}=this;if(this.rootSchema=void 0,this.useReplacer=!1,t?.isStructSchema()||t?.isDocumentSchema()){if(!r)return JSON.stringify(this.buffer);let o=new tt;return o.replaceInJson(JSON.stringify(this.buffer,o.createReplacer(),0))}return this.buffer}_write(t,r,o){let n=r!==null&&typeof r=="object",s=T.of(t);if(n){if(s.isStructSchema()){let i=r,a={},{jsonName:c}=this.settings,p;c&&(p={});for(let[u,l]of s.structIterator()){let m=this._write(l,i[u],s);if(m!==void 0){let R=u;c&&(R=l.getMergedTraits().jsonName??u,p[u]=R),a[R]=m}}if(s.isUnionSchema()&&Object.keys(a).length===0){let{$unknown:u}=i;if(Array.isArray(u)){let[l,m]=u;a[l]=this._write(15,m)}}else if(typeof i.__type=="string")for(let[u,l]of Object.entries(i)){let m=c?p[u]??u:u;m in a||(a[m]=this._write(15,l))}return a}if(Array.isArray(r)&&s.isListSchema()){let i=s.getValueSchema(),a=[],c=!!s.getMergedTraits().sparse;for(let p of r)(c||p!=null)&&a.push(this._write(i,p));return a}if(s.isMapSchema()){let i=s.getValueSchema(),a={},c=!!s.getMergedTraits().sparse;for(let[p,u]of Object.entries(r))(c||u!=null)&&(a[p]=this._write(i,u));return a}if(r instanceof Uint8Array&&(s.isBlobSchema()||s.isDocumentSchema()))return s===this.rootSchema?r:(this.serdeContext?.base64Encoder??de)(r);if(r instanceof Date&&(s.isTimestampSchema()||s.isDocumentSchema()))switch(Ae(s,this.settings)){case 5:return r.toISOString().replace(".000Z","Z");case 6:return Yr(r);case 7:return r.getTime()/1e3;default:return console.warn("Missing timestamp format, using epoch seconds",r),r.getTime()/1e3}r instanceof w&&(this.useReplacer=!0)}if(!(r===null&&o?.isStructSchema())){if(s.isStringSchema()){if(typeof r>"u"&&s.isIdempotencyToken())return co();let i=s.getMergedTraits().mediaType;return r!=null&&i&&(i==="application/json"||i.endsWith("+json"))?_e.from(r):r}if(typeof r=="number"&&s.isNumericSchema())return Math.abs(r)===1/0||isNaN(r)?String(r):r;if(typeof r=="string"&&s.isBlobSchema())return s===this.rootSchema?r:(this.serdeContext?.base64Encoder??de)(r);if(typeof r=="bigint"&&(this.useReplacer=!0),s.isDocumentSchema())if(n){let i=Array.isArray(r)?[]:{};for(let[a,c]of Object.entries(r))c instanceof w?(this.useReplacer=!0,i[a]=c):i[a]=this._write(s,c);return i}else return structuredClone(r);return r}}};var ot=class extends X{settings;constructor(t){super(),this.settings=t}createSerializer(){let t=new rt(this.settings);return t.setSerdeContext(this.serdeContext),t}createDeserializer(){let t=new et(this.settings);return t.setSerdeContext(this.serdeContext),t}};var nt=class extends uo{serializer;deserializer;serviceTarget;codec;mixin;awsQueryCompatible;constructor({defaultNamespace:t,errorTypeRegistries:r,serviceTarget:o,awsQueryCompatible:n,jsonCodec:s}){super({defaultNamespace:t,errorTypeRegistries:r}),this.serviceTarget=o,this.codec=s??new ot({timestampFormat:{useTrait:!0,default:7},jsonName:!1}),this.serializer=this.codec.createSerializer(),this.deserializer=this.codec.createDeserializer(),this.awsQueryCompatible=!!n,this.mixin=new Qe(this.awsQueryCompatible)}async serializeRequest(t,r,o){let n=await super.serializeRequest(t,r,o);return n.path.endsWith("/")||(n.path+="/"),Object.assign(n.headers,{"content-type":`application/x-amz-json-${this.getJsonRpcVersion()}`,"x-amz-target":`${this.serviceTarget}.${t.name}`}),this.awsQueryCompatible&&(n.headers["x-amzn-query-mode"]="true"),(oo(t.input)==="unit"||!n.body)&&(n.body="{}"),n}getPayloadCodec(){return this.codec}async handleError(t,r,o,n,s){this.awsQueryCompatible&&this.mixin.setQueryCompatError(n,o);let i=Js(o,n)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,i,this.options.defaultNamespace);let{errorSchema:a,errorMetadata:c}=await this.mixin.getErrorSchemaOrThrowBaseException(i,this.options.defaultNamespace,o,n,s,this.awsQueryCompatible?this.mixin.findQueryCompatibleError:void 0),p=T.of(a),u=n.message??n.Message??"UnknownError",l=this.compositeErrorRegistry.getErrorCtor(a)??Error,m=new l(u),R={};for(let[_,A]of p.structIterator())n[_]!=null&&(R[_]=this.codec.createDeserializer().readObject(A,n[_]));throw this.awsQueryCompatible&&this.mixin.queryCompatOutput(n,R),this.mixin.decorateServiceException(Object.assign(m,c,{$fault:p.getMergedTraits().error,message:u},R),n)}};var st=class extends nt{constructor({defaultNamespace:t,errorTypeRegistries:r,serviceTarget:o,awsQueryCompatible:n,jsonCodec:s}){super({defaultNamespace:t,errorTypeRegistries:r,serviceTarget:o,awsQueryCompatible:n,jsonCodec:s})}getShapeId(){return"aws.protocols#awsJson1_1"}getJsonRpcVersion(){return"1.1"}getDefaultContentType(){return"application/x-amz-json-1.1"}};function Qs(e){let t={};if(e=e.replace(/^\?/,""),e)for(let r of e.split("&")){let[o,n=null]=r.split("=");o=decodeURIComponent(o),n&&(n=decodeURIComponent(n)),o in t?Array.isArray(t[o])?t[o].push(n):t[o]=[t[o],n]:t[o]=n}return t}var Lr=e=>{if(typeof e=="string")return Lr(new URL(e));let{hostname:t,pathname:r,port:o,protocol:n,search:s}=e,i;return s&&(i=Qs(s)),{hostname:t,port:o?parseInt(o):void 0,protocol:n,path:r,query:i}};var Fr=(e,t=!1)=>{if(t){for(let r of e.split("."))if(!Fr(r))return!1;return!0}return!(!Ie(e)||e.length<3||e.length>63||e!==e.toLowerCase()||pr(e))};var Zs=e=>{let t=e.split(":");if(t.length<6)return null;let[r,o,n,s,i,...a]=t;if(r!=="arn"||o===""||n===""||a.join(":")==="")return null;let c=a.map(p=>p.split("/")).flat();return{partition:o,service:n,region:s,accountId:i,resourceId:c}};var ei={partitions:[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-east-2":{description:"Asia Pacific (Taipei)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"ap-southeast-5":{description:"Asia Pacific (Malaysia)"},"ap-southeast-6":{description:"Asia Pacific (New Zealand)"},"ap-southeast-7":{description:"Asia Pacific (Thailand)"},"aws-global":{description:"aws global region"},"ca-central-1":{description:"Canada (Central)"},"ca-west-1":{description:"Canada West (Calgary)"},"eu-central-1":{description:"Europe (Frankfurt)"},"eu-central-2":{description:"Europe (Zurich)"},"eu-north-1":{description:"Europe (Stockholm)"},"eu-south-1":{description:"Europe (Milan)"},"eu-south-2":{description:"Europe (Spain)"},"eu-west-1":{description:"Europe (Ireland)"},"eu-west-2":{description:"Europe (London)"},"eu-west-3":{description:"Europe (Paris)"},"il-central-1":{description:"Israel (Tel Aviv)"},"me-central-1":{description:"Middle East (UAE)"},"me-south-1":{description:"Middle East (Bahrain)"},"mx-central-1":{description:"Mexico (Central)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"aws-cn global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-eusc",outputs:{dnsSuffix:"amazonaws.eu",dualStackDnsSuffix:"api.amazonwebservices.eu",implicitGlobalRegion:"eusc-de-east-1",name:"aws-eusc",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eusc\\-(de)\\-\\w+\\-\\d+$",regions:{"eusc-de-east-1":{description:"AWS European Sovereign Cloud (Germany)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"api.aws.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"aws-iso global region"},"us-iso-east-1":{description:"US ISO East"},"us-iso-west-1":{description:"US ISO WEST"}}},{id:"aws-iso-b",outputs:{dnsSuffix:"sc2s.sgov.gov",dualStackDnsSuffix:"api.aws.scloud",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"aws-iso-b global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"},"us-isob-west-1":{description:"US ISOB West"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"api.cloud-aws.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"aws-iso-e-global":{description:"aws-iso-e global region"},"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"api.aws.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{"aws-iso-f-global":{description:"aws-iso-f global region"},"us-isof-east-1":{description:"US ISOF EAST"},"us-isof-south-1":{description:"US ISOF SOUTH"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"aws-us-gov global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}}],version:"1.1"};var Gc=ei;var ti=e=>{let{partitions:t}=Gc;for(let o of t){let{regions:n,outputs:s}=o;for(let[i,a]of Object.entries(n))if(i===e)return{...s,...a}}for(let o of t){let{regionRegex:n,outputs:s}=o;if(new RegExp(n).test(e))return{...s}}let r=t.find(o=>o.id==="aws");if(!r)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...r.outputs}};var Gr={isVirtualHostableS3Bucket:Fr,parseArn:Zs,partition:ti};ao.aws=Gr;var it=class{capacity;data=new Map;parameters=[];constructor({size:t,params:r}){this.capacity=t??50,r&&(this.parameters=r)}get(t,r){let o=this.hash(t);if(o===!1)return r();if(!this.data.has(o)){if(this.data.size>this.capacity+10){let n=this.data.keys(),s=0;for(;;){let{value:i,done:a}=n.next();if(this.data.delete(i),a||++s>10)break}}this.data.set(o,r())}return this.data.get(o)}size(){return this.data.size}hash(t){let r="",{parameters:o}=this;if(o.length===0)return!1;for(let n of o){let s=String(t[n]??"");if(s.includes("|;"))return!1;r+=s+"|;"}return r}};var Vc=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),ri=e=>Vc.test(e)||e.startsWith("[")&&e.endsWith("]");var Hc=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),Vr=(e,t=!1)=>{if(!t)return Hc.test(e);let r=e.split(".");for(let o of r)if(!Vr(o))return!1;return!0};var Ee={};var U="endpoints";function K(e){return typeof e!="object"||e==null?e:"ref"in e?`$${K(e.ref)}`:"fn"in e?`${e.fn}(${(e.argv||[]).map(K).join(", ")})`:JSON.stringify(e,null,2)}var v=class extends Error{constructor(t){super(t),this.name="EndpointError"}};var oi=(e,t)=>e===t;var ni=e=>{let t=e.split("."),r=[];for(let o of t){let n=o.indexOf("[");if(n!==-1){if(o.indexOf("]")!==o.length-1)throw new v(`Path: '${e}' does not end with ']'`);let s=o.slice(n+1,-1);if(Number.isNaN(parseInt(s)))throw new v(`Invalid array index: '${s}' in path: '${e}'`);n!==0&&r.push(o.slice(0,n)),r.push(s)}else r.push(o)}return r};var at=(e,t)=>ni(t).reduce((r,o)=>{if(typeof r!="object")throw new v(`Index '${o}' in '${t}' not found in '${JSON.stringify(e)}'`);return Array.isArray(r)?r[parseInt(o)]:r[o]},e);var si=e=>e!=null;var ii=e=>!e;var Hr={[ve.HTTP]:80,[ve.HTTPS]:443},ai=e=>{let t=(()=>{try{if(e instanceof URL)return e;if(typeof e=="object"&&"hostname"in e){let{hostname:m,port:R,protocol:_="",path:A="",query:F={}}=e,Q=new URL(`${_}//${m}${R?`:${R}`:""}${A}`);return Q.search=Object.entries(F).map(([W,Se])=>`${W}=${Se}`).join("&"),Q}return new URL(e)}catch{return null}})();if(!t)return console.error(`Unable to parse ${JSON.stringify(e)} as a whatwg URL.`),null;let r=t.href,{host:o,hostname:n,pathname:s,protocol:i,search:a}=t;if(a)return null;let c=i.slice(0,-1);if(!Object.values(ve).includes(c))return null;let p=ri(n),u=r.includes(`${o}:${Hr[c]}`)||typeof e=="string"&&e.includes(`${o}:${Hr[c]}`),l=`${o}${u?`:${Hr[c]}`:""}`;return{scheme:c,authority:l,path:s,normalizedPath:s.endsWith("/")?s:`${s}/`,isIp:p}};var ci=(e,t)=>e===t;var pi=(e,t,r,o)=>t>=r||e.length<r||/[^\u0000-\u007f]/.test(e)?null:o?e.substring(e.length-r,e.length-t):e.substring(t,r);var ui=e=>encodeURIComponent(e).replace(/[!*'()]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`);var li={booleanEquals:oi,getAttr:at,isSet:si,isValidHostLabel:Vr,not:ii,parseURL:ai,stringEquals:ci,substring:pi,uriEncode:ui};var ct=(e,t)=>{let r=[],o={...t.endpointParams,...t.referenceRecord},n=0;for(;n<e.length;){let s=e.indexOf("{",n);if(s===-1){r.push(e.slice(n));break}r.push(e.slice(n,s));let i=e.indexOf("}",s);if(i===-1){r.push(e.slice(s));break}e[s+1]==="{"&&e[i+1]==="}"&&(r.push(e.slice(s+1,i)),n=i+2);let a=e.substring(s+1,i);if(a.includes("#")){let[c,p]=a.split("#");r.push(at(o[c],p))}else r.push(o[a]);n=i+1}return r.join("")};var di=({ref:e},t)=>({...t.endpointParams,...t.referenceRecord})[e];var Y=(e,t,r)=>{if(typeof e=="string")return ct(e,r);if(e.fn)return mi.callFunction(e,r);if(e.ref)return di(e,r);throw new v(`'${t}': ${String(e)} is not a string, function or reference.`)},pt=({fn:e,argv:t},r)=>{let o=t.map(s=>["boolean","number"].includes(typeof s)?s:mi.evaluateExpression(s,"arg",r)),n=e.split(".");return n[0]in Ee&&n[1]!=null?Ee[n[0]][n[1]](...o):li[e](...o)},mi={evaluateExpression:Y,callFunction:pt};var fi=({assign:e,...t},r)=>{if(e&&e in r.referenceRecord)throw new v(`'${e}' is already defined in Reference Record.`);let o=pt(t,r);return r.logger?.debug?.(`${U} evaluateCondition: ${K(t)} = ${K(o)}`),{result:o===""?!0:!!o,...e!=null&&{toAssign:{name:e,value:o}}}};var oe=(e=[],t)=>{let r={};for(let o of e){let{result:n,toAssign:s}=fi(o,{...t,referenceRecord:{...t.referenceRecord,...r}});if(!n)return{result:n};s&&(r[s.name]=s.value,t.logger?.debug?.(`${U} assign: ${s.name} := ${K(s.value)}`))}return{result:!0,referenceRecord:r}};var gi=(e,t)=>Object.entries(e).reduce((r,[o,n])=>({...r,[o]:n.map(s=>{let i=Y(s,"Header value entry",t);if(typeof i!="string")throw new v(`Header '${o}' value '${i}' is not a string`);return i})}),{});var jr=(e,t)=>Object.entries(e).reduce((r,[o,n])=>({...r,[o]:yi.getEndpointProperty(n,t)}),{}),Ei=(e,t)=>{if(Array.isArray(e))return e.map(r=>Ei(r,t));switch(typeof e){case"string":return ct(e,t);case"object":if(e===null)throw new v(`Unexpected endpoint property: ${e}`);return yi.getEndpointProperties(e,t);case"boolean":return e;default:throw new v(`Unexpected endpoint property type: ${typeof e}`)}},yi={getEndpointProperty:Ei,getEndpointProperties:jr};var hi=(e,t)=>{let r=Y(e,"Endpoint URL",t);if(typeof r=="string")try{return new URL(r)}catch(o){throw console.error(`Failed to construct URL with ${r}`,o),o}throw new v(`Endpoint URL must be a string, got ${typeof r}`)};var xi=(e,t)=>{let{conditions:r,endpoint:o}=e,{result:n,referenceRecord:s}=oe(r,t);if(!n)return;let i={...t,referenceRecord:{...t.referenceRecord,...s}},{url:a,properties:c,headers:p}=o;return t.logger?.debug?.(`${U} Resolving endpoint from template: ${K(o)}`),{...p!=null&&{headers:gi(p,i)},...c!=null&&{properties:jr(c,i)},url:hi(a,i)}};var Si=(e,t)=>{let{conditions:r,error:o}=e,{result:n,referenceRecord:s}=oe(r,t);if(n)throw new v(Y(o,"Error",{...t,referenceRecord:{...t.referenceRecord,...s}}))};var qr=(e,t)=>{for(let r of e)if(r.type==="endpoint"){let o=xi(r,t);if(o)return o}else if(r.type==="error")Si(r,t);else if(r.type==="tree"){let o=Ri.evaluateTreeRule(r,t);if(o)return o}else throw new v(`Unknown endpoint rule: ${r}`);throw new v("Rules evaluation failed")},jc=(e,t)=>{let{conditions:r,rules:o}=e,{result:n,referenceRecord:s}=oe(r,t);if(n)return Ri.evaluateRules(o,{...t,referenceRecord:{...t.referenceRecord,...s}})},Ri={evaluateRules:qr,evaluateTreeRule:jc};var _i=(e,t)=>{let{endpointParams:r,logger:o}=t,{parameters:n,rules:s}=e;t.logger?.debug?.(`${U} Initial EndpointParams: ${K(r)}`);let i=Object.entries(n).filter(([,p])=>p.default!=null).map(([p,u])=>[p,u.default]);if(i.length>0)for(let[p,u]of i)r[p]=r[p]??u;let a=Object.entries(n).filter(([,p])=>p.required).map(([p])=>p);for(let p of a)if(r[p]==null)throw new v(`Missing required parameter: '${p}'`);let c=qr(s,{endpointParams:r,logger:o,referenceRecord:{}});return t.logger?.debug?.(`${U} Resolved endpoint: ${K(c)}`),c};var Ki="required";var M="argv";var vi="isSet",he="booleanEquals",ne="error",ye="endpoint",L="tree",Xr="PartitionResult",Ci={[Ki]:!1,type:"string"},Ii={[Ki]:!0,default:!1,type:"boolean"},Ai={ref:"Endpoint"},Ni={fn:he,[M]:[{ref:"UseFIPS"},!0]},bi={fn:he,[M]:[{ref:"UseDualStack"},!0]},$={},Pi={fn:"getAttr",[M]:[{ref:Xr},"supportsFIPS"]},wi={fn:he,[M]:[!0,{fn:"getAttr",[M]:[{ref:Xr},"supportsDualStack"]}]},Di=[Ni],Ti=[bi],Oi=[{ref:"Region"}],qc={version:"1.0",parameters:{Region:Ci,UseDualStack:Ii,UseFIPS:Ii,Endpoint:Ci},rules:[{conditions:[{fn:vi,[M]:[Ai]}],rules:[{conditions:Di,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:ne},{conditions:Ti,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:ne},{endpoint:{url:Ai,properties:$,headers:$},type:ye}],type:L},{conditions:[{fn:vi,[M]:Oi}],rules:[{conditions:[{fn:"aws.partition",[M]:Oi,assign:Xr}],rules:[{conditions:[Ni,bi],rules:[{conditions:[{fn:he,[M]:[!0,Pi]},wi],rules:[{endpoint:{url:"https://kms-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:$,headers:$},type:ye}],type:L},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:ne}],type:L},{conditions:Di,rules:[{conditions:[{fn:he,[M]:[Pi,!0]}],rules:[{endpoint:{url:"https://kms-fips.{Region}.{PartitionResult#dnsSuffix}",properties:$,headers:$},type:ye}],type:L},{error:"FIPS is enabled but this partition does not support FIPS",type:ne}],type:L},{conditions:Ti,rules:[{conditions:[wi],rules:[{endpoint:{url:"https://kms.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:$,headers:$},type:ye}],type:L},{error:"DualStack is enabled but this partition does not support DualStack",type:ne}],type:L},{endpoint:{url:"https://kms.{Region}.{PartitionResult#dnsSuffix}",properties:$,headers:$},type:ye}],type:L}],type:L},{error:"Invalid Configuration: Missing Region",type:ne}]},ki=qc;var Xc=new it({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),$i=(e,t={})=>Xc.get(e,()=>_i(ki,{endpointParams:e,logger:t.logger}));Ee.aws=Gr;var f=class e extends Le{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};var ut=class e extends f{name="AlreadyExistsException";$fault="client";constructor(t){super({name:"AlreadyExistsException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},lt=class e extends f{name="DependencyTimeoutException";$fault="server";constructor(t){super({name:"DependencyTimeoutException",$fault:"server",...t}),Object.setPrototypeOf(this,e.prototype)}},dt=class e extends f{name="InvalidArnException";$fault="client";constructor(t){super({name:"InvalidArnException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},mt=class e extends f{name="KMSInternalException";$fault="server";constructor(t){super({name:"KMSInternalException",$fault:"server",...t}),Object.setPrototypeOf(this,e.prototype)}},ft=class e extends f{name="KMSInvalidStateException";$fault="client";constructor(t){super({name:"KMSInvalidStateException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},gt=class e extends f{name="NotFoundException";$fault="client";constructor(t){super({name:"NotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Et=class e extends f{name="CloudHsmClusterInUseException";$fault="client";constructor(t){super({name:"CloudHsmClusterInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},yt=class e extends f{name="CloudHsmClusterInvalidConfigurationException";$fault="client";constructor(t){super({name:"CloudHsmClusterInvalidConfigurationException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ht=class e extends f{name="CloudHsmClusterNotActiveException";$fault="client";constructor(t){super({name:"CloudHsmClusterNotActiveException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},xt=class e extends f{name="CloudHsmClusterNotFoundException";$fault="client";constructor(t){super({name:"CloudHsmClusterNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},St=class e extends f{name="CloudHsmClusterNotRelatedException";$fault="client";constructor(t){super({name:"CloudHsmClusterNotRelatedException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Rt=class e extends f{name="ConflictException";$fault="client";constructor(t){super({name:"ConflictException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},_t=class e extends f{name="CustomKeyStoreInvalidStateException";$fault="client";constructor(t){super({name:"CustomKeyStoreInvalidStateException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},vt=class e extends f{name="CustomKeyStoreNotFoundException";$fault="client";constructor(t){super({name:"CustomKeyStoreNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Ct=class e extends f{name="InvalidAliasNameException";$fault="client";constructor(t){super({name:"InvalidAliasNameException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},It=class e extends f{name="LimitExceededException";$fault="client";constructor(t){super({name:"LimitExceededException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},At=class e extends f{name="CustomKeyStoreNameInUseException";$fault="client";constructor(t){super({name:"CustomKeyStoreNameInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Pt=class e extends f{name="IncorrectTrustAnchorException";$fault="client";constructor(t){super({name:"IncorrectTrustAnchorException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},wt=class e extends f{name="XksProxyIncorrectAuthenticationCredentialException";$fault="client";constructor(t){super({name:"XksProxyIncorrectAuthenticationCredentialException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Dt=class e extends f{name="XksProxyInvalidConfigurationException";$fault="client";constructor(t){super({name:"XksProxyInvalidConfigurationException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Tt=class e extends f{name="XksProxyInvalidResponseException";$fault="client";constructor(t){super({name:"XksProxyInvalidResponseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Ot=class e extends f{name="XksProxyUriEndpointInUseException";$fault="client";constructor(t){super({name:"XksProxyUriEndpointInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Kt=class e extends f{name="XksProxyUriInUseException";$fault="client";constructor(t){super({name:"XksProxyUriInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Nt=class e extends f{name="XksProxyUriUnreachableException";$fault="client";constructor(t){super({name:"XksProxyUriUnreachableException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},bt=class e extends f{name="XksProxyVpcEndpointServiceInUseException";$fault="client";constructor(t){super({name:"XksProxyVpcEndpointServiceInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},kt=class e extends f{name="XksProxyVpcEndpointServiceInvalidConfigurationException";$fault="client";constructor(t){super({name:"XksProxyVpcEndpointServiceInvalidConfigurationException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},$t=class e extends f{name="XksProxyVpcEndpointServiceNotFoundException";$fault="client";constructor(t){super({name:"XksProxyVpcEndpointServiceNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Mt=class e extends f{name="DisabledException";$fault="client";constructor(t){super({name:"DisabledException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Ut=class e extends f{name="DryRunOperationException";$fault="client";constructor(t){super({name:"DryRunOperationException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Lt=class e extends f{name="InvalidGrantTokenException";$fault="client";constructor(t){super({name:"InvalidGrantTokenException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Ft=class e extends f{name="MalformedPolicyDocumentException";$fault="client";constructor(t){super({name:"MalformedPolicyDocumentException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Gt=class e extends f{name="TagException";$fault="client";constructor(t){super({name:"TagException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Vt=class e extends f{name="UnsupportedOperationException";$fault="client";constructor(t){super({name:"UnsupportedOperationException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Ht=class e extends f{name="XksKeyAlreadyInUseException";$fault="client";constructor(t){super({name:"XksKeyAlreadyInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},jt=class e extends f{name="XksKeyInvalidConfigurationException";$fault="client";constructor(t){super({name:"XksKeyInvalidConfigurationException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},qt=class e extends f{name="XksKeyNotFoundException";$fault="client";constructor(t){super({name:"XksKeyNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Xt=class e extends f{name="CustomKeyStoreHasCMKsException";$fault="client";constructor(t){super({name:"CustomKeyStoreHasCMKsException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Wt=class e extends f{name="IncorrectKeyException";$fault="client";constructor(t){super({name:"IncorrectKeyException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},zt=class e extends f{name="InvalidCiphertextException";$fault="client";constructor(t){super({name:"InvalidCiphertextException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Bt=class e extends f{name="InvalidKeyUsageException";$fault="client";constructor(t){super({name:"InvalidKeyUsageException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Jt=class e extends f{name="KeyUnavailableException";$fault="server";constructor(t){super({name:"KeyUnavailableException",$fault:"server",...t}),Object.setPrototypeOf(this,e.prototype)}},Yt=class e extends f{name="InvalidMarkerException";$fault="client";constructor(t){super({name:"InvalidMarkerException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Qt=class e extends f{name="ExpiredImportTokenException";$fault="client";constructor(t){super({name:"ExpiredImportTokenException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Zt=class e extends f{name="IncorrectKeyMaterialException";$fault="client";constructor(t){super({name:"IncorrectKeyMaterialException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},er=class e extends f{name="InvalidImportTokenException";$fault="client";constructor(t){super({name:"InvalidImportTokenException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},tr=class e extends f{name="InvalidGrantIdException";$fault="client";constructor(t){super({name:"InvalidGrantIdException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},rr=class e extends f{name="KMSInvalidMacException";$fault="client";constructor(t){super({name:"KMSInvalidMacException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},or=class e extends f{name="KMSInvalidSignatureException";$fault="client";constructor(t){super({name:"KMSInvalidSignatureException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}};var Wc="AttestationDocument",zc="AlreadyExistsException";var Mi="CiphertextBlob";var Bc="ConflictException";var Ui="CiphertextForRecipient";var Jc="CloudHsmClusterInvalidConfigurationException",Yc="CloudHsmClusterInUseException",Qc="CloudHsmClusterNotActiveException",Zc="CloudHsmClusterNotFoundException",ep="CloudHsmClusterNotRelatedException";var tp="CustomKeyStoreHasCMKsException";var rp="CustomKeyStoreInvalidStateException";var op="CustomKeyStoreNotFoundException",np="CustomKeyStoreNameInUseException";var sp="DisabledException";var Li="DryRun",ip="DryRunModifiers",ap="DryRunOperationException",cp="DecryptRequest",pp="DecryptResponse";var up="DependencyTimeoutException",lp="Decrypt";var Fi="EncryptionAlgorithm";var Gi="EncryptionContext";var dp="ExpiredImportTokenException";var mp="GenerateDataKey";var fp="GenerateDataKeyRequest",gp="GenerateDataKeyResponse";var Vi="GrantTokens";var Ep="InvalidArnException",yp="InvalidAliasNameException",hp="InvalidCiphertextException",xp="InvalidGrantIdException",Sp="InvalidGrantTokenException",Rp="InvalidImportTokenException",_p="IncorrectKeyException";var vp="IncorrectKeyMaterialException";var Cp="InvalidKeyUsageException",Ip="InvalidMarkerException";var Ap="IncorrectTrustAnchorException";var Pp="KeyEncryptionAlgorithm",nr="KeyId";var Hi="KeyMaterialId";var wp="KMSInternalException",Dp="KMSInvalidMacException",Tp="KMSInvalidSignatureException",Op="KMSInvalidStateException";var Kp="KeySpec";var Np="KeyUnavailableException";var bp="LimitExceededException";var kp="MalformedPolicyDocumentException";var $p="NotFoundException";var Mp="NumberOfBytes";var Up="PlaintextType";var ji="Plaintext",qi="Recipient";var Lp="RecipientInfo";var Fp="TagException";var Gp="UnsupportedOperationException";var Vp="XksKeyAlreadyInUseException";var Hp="XksKeyInvalidConfigurationException",jp="XksKeyNotFoundException";var qp="XksProxyIncorrectAuthenticationCredentialException",Xp="XksProxyInvalidConfigurationException",Wp="XksProxyInvalidResponseException";var zp="XksProxyUriEndpointInUseException",Bp="XksProxyUriInUseException";var Jp="XksProxyUriUnreachableException",Yp="XksProxyVpcEndpointServiceInvalidConfigurationException",Qp="XksProxyVpcEndpointServiceInUseException";var Zp="XksProxyVpcEndpointServiceNotFoundException";var E="awsQueryError",S="client",y="error",h="httpError",x="message",Xi="smithy.ts.sdk.synthetic.com.amazonaws.kms",Wr="server",d="com.amazonaws.kms",Wi=ee.for(Xi),eu=[-3,Xi,"KMSServiceException",0,[],[]];Wi.registerError(eu,f);var g=ee.for(d),tu=[-3,d,zc,{[E]:["AlreadyExists",409],[y]:S,[h]:409},[x],[0]];g.registerError(tu,ut);var ru=[-3,d,Yc,{[E]:["CloudHsmClusterInUseException",400],[y]:S,[h]:400},[x],[0]];g.registerError(ru,Et);var ou=[-3,d,Jc,{[E]:["CloudHsmClusterInvalidConfigurationException",400],[y]:S,[h]:400},[x],[0]];g.registerError(ou,yt);var nu=[-3,d,Qc,{[E]:["CloudHsmClusterNotActiveException",400],[y]:S,[h]:400},[x],[0]];g.registerError(nu,ht);var su=[-3,d,Zc,{[E]:["CloudHsmClusterNotFoundException",400],[y]:S,[h]:400},[x],[0]];g.registerError(su,xt);var iu=[-3,d,ep,{[E]:["CloudHsmClusterNotRelatedException",400],[y]:S,[h]:400},[x],[0]];g.registerError(iu,St);var au=[-3,d,Bc,{[E]:["ConflictException",409],[y]:S,[h]:409},[x],[0]];g.registerError(au,Rt);var cu=[-3,d,tp,{[E]:["CustomKeyStoreHasCMKsException",400],[y]:S,[h]:400},[x],[0]];g.registerError(cu,Xt);var pu=[-3,d,rp,{[E]:["CustomKeyStoreInvalidStateException",400],[y]:S,[h]:400},[x],[0]];g.registerError(pu,_t);var uu=[-3,d,np,{[E]:["CustomKeyStoreNameInUseException",400],[y]:S,[h]:400},[x],[0]];g.registerError(uu,At);var lu=[-3,d,op,{[E]:["CustomKeyStoreNotFoundException",400],[y]:S,[h]:400},[x],[0]];g.registerError(lu,vt);var du=[-3,d,up,{[E]:["DependencyTimeout",503],[y]:Wr,[h]:503},[x],[0]];g.registerError(du,lt);var mu=[-3,d,sp,{[E]:["Disabled",409],[y]:S,[h]:409},[x],[0]];g.registerError(mu,Mt);var fu=[-3,d,ap,{[E]:["DryRunOperation",412],[y]:S,[h]:412},[x],[0]];g.registerError(fu,Ut);var gu=[-3,d,dp,{[E]:["ExpiredImportTokenException",400],[y]:S,[h]:400},[x],[0]];g.registerError(gu,Qt);var Eu=[-3,d,_p,{[E]:["IncorrectKeyException",400],[y]:S,[h]:400},[x],[0]];g.registerError(Eu,Wt);var yu=[-3,d,vp,{[E]:["IncorrectKeyMaterialException",400],[y]:S,[h]:400},[x],[0]];g.registerError(yu,Zt);var hu=[-3,d,Ap,{[E]:["IncorrectTrustAnchorException",400],[y]:S,[h]:400},[x],[0]];g.registerError(hu,Pt);var xu=[-3,d,yp,{[E]:["InvalidAliasName",400],[y]:S,[h]:400},[x],[0]];g.registerError(xu,Ct);var Su=[-3,d,Ep,{[E]:["InvalidArn",400],[y]:S,[h]:400},[x],[0]];g.registerError(Su,dt);var Ru=[-3,d,hp,{[E]:["InvalidCiphertext",400],[y]:S,[h]:400},[x],[0]];g.registerError(Ru,zt);var _u=[-3,d,xp,{[E]:["InvalidGrantId",400],[y]:S,[h]:400},[x],[0]];g.registerError(_u,tr);var vu=[-3,d,Sp,{[E]:["InvalidGrantToken",400],[y]:S,[h]:400},[x],[0]];g.registerError(vu,Lt);var Cu=[-3,d,Rp,{[E]:["InvalidImportTokenException",400],[y]:S,[h]:400},[x],[0]];g.registerError(Cu,er);var Iu=[-3,d,Cp,{[E]:["InvalidKeyUsage",400],[y]:S,[h]:400},[x],[0]];g.registerError(Iu,Bt);var Au=[-3,d,Ip,{[E]:["InvalidMarker",400],[y]:S,[h]:400},[x],[0]];g.registerError(Au,Yt);var Pu=[-3,d,Np,{[E]:["KeyUnavailable",500],[y]:Wr,[h]:500},[x],[0]];g.registerError(Pu,Jt);var wu=[-3,d,wp,{[E]:["KMSInternal",500],[y]:Wr,[h]:500},[x],[0]];g.registerError(wu,mt);var Du=[-3,d,Dp,{[E]:["KMSInvalidMac",400],[y]:S,[h]:400},[x],[0]];g.registerError(Du,rr);var Tu=[-3,d,Tp,{[E]:["KMSInvalidSignature",400],[y]:S,[h]:400},[x],[0]];g.registerError(Tu,or);var Ou=[-3,d,Op,{[E]:["KMSInvalidStateException",409],[y]:S,[h]:409},[x],[0]];g.registerError(Ou,ft);var Ku=[-3,d,bp,{[E]:["LimitExceeded",400],[y]:S,[h]:400},[x],[0]];g.registerError(Ku,It);var Nu=[-3,d,kp,{[E]:["MalformedPolicyDocument",400],[y]:S,[h]:400},[x],[0]];g.registerError(Nu,Ft);var bu=[-3,d,$p,{[E]:["NotFound",404],[y]:S,[h]:404},[x],[0]];g.registerError(bu,gt);var ku=[-3,d,Fp,{[E]:["TagException",400],[y]:S,[h]:400},[x],[0]];g.registerError(ku,Gt);var $u=[-3,d,Gp,{[E]:["UnsupportedOperation",400],[y]:S,[h]:400},[x],[0]];g.registerError($u,Vt);var Mu=[-3,d,Vp,{[E]:["XksKeyAlreadyInUse",400],[y]:S,[h]:400},[x],[0]];g.registerError(Mu,Ht);var Uu=[-3,d,Hp,{[E]:["XksKeyInvalidConfiguration",400],[y]:S,[h]:400},[x],[0]];g.registerError(Uu,jt);var Lu=[-3,d,jp,{[E]:["XksKeyNotFoundException",400],[y]:S,[h]:400},[x],[0]];g.registerError(Lu,qt);var Fu=[-3,d,qp,{[E]:["XksProxyIncorrectAuthenticationCredentialException",400],[y]:S,[h]:400},[x],[0]];g.registerError(Fu,wt);var Gu=[-3,d,Xp,{[E]:["XksProxyInvalidConfigurationException",400],[y]:S,[h]:400},[x],[0]];g.registerError(Gu,Dt);var Vu=[-3,d,Wp,{[E]:["XksProxyInvalidResponseException",400],[y]:S,[h]:400},[x],[0]];g.registerError(Vu,Tt);var Hu=[-3,d,zp,{[E]:["XksProxyUriEndpointInUseException",400],[y]:S,[h]:400},[x],[0]];g.registerError(Hu,Ot);var ju=[-3,d,Bp,{[E]:["XksProxyUriInUseException",400],[y]:S,[h]:400},[x],[0]];g.registerError(ju,Kt);var qu=[-3,d,Jp,{[E]:["XksProxyUriUnreachableException",400],[y]:S,[h]:400},[x],[0]];g.registerError(qu,Nt);var Xu=[-3,d,Qp,{[E]:["XksProxyVpcEndpointServiceInUseException",400],[y]:S,[h]:400},[x],[0]];g.registerError(Xu,bt);var Wu=[-3,d,Yp,{[E]:["XksProxyVpcEndpointServiceInvalidConfigurationException",400],[y]:S,[h]:400},[x],[0]];g.registerError(Wu,kt);var zu=[-3,d,Zp,{[E]:["XksProxyVpcEndpointServiceNotFoundException",400],[y]:S,[h]:400},[x],[0]];g.registerError(zu,$t);var zi=[Wi,g];var Bi=[0,d,Up,8,21];var Bu=[3,d,cp,0,[Mi,Gi,Vi,nr,Fi,qi,Li,ip],[21,128,64,0,0,()=>Ji,2,64]],Ju=[3,d,pp,0,[nr,ji,Fi,Ui,Hi],[0,[()=>Bi,0],0,21,0]];var Yu=[3,d,fp,0,[nr,Gi,Mp,Kp,Vi,qi,Li],[0,128,1,0,64,()=>Ji,2],1],Qu=[3,d,gp,0,[Mi,ji,nr,Ui,Hi],[21,[()=>Bi,0],0,21,0]];var Ji=[3,d,Lp,0,[Pp,Wc],[0,21]];var Yi=[9,d,lp,0,()=>Bu,()=>Ju];var Qi=[9,d,mp,0,()=>Yu,()=>Qu];var Zi=e=>({apiVersion:"2014-11-01",base64Decoder:e?.base64Decoder??Pe,base64Encoder:e?.base64Encoder??de,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??$i,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??ts,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new ge}],logger:e?.logger??new Fe,protocol:e?.protocol??st,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.kms",errorTypeRegistries:zi,xmlNamespace:"https://trent.amazonaws.com/doc/2014-11-01/",version:"2014-11-01",serviceTarget:"TrentService"},serviceId:e?.serviceId??"KMS",urlParser:e?.urlParser??Lr,utf8Decoder:e?.utf8Decoder??we,utf8Encoder:e?.utf8Encoder??De});var ea=e=>{bn(process.version);let t=qs(e),r=()=>t().then(Kn),o=Zi(e);Jn(process.version);let n={profile:e?.profile,logger:o.logger};return{...o,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??q(Wn,n),bodyLengthChecker:e?.bodyLengthChecker??Po,credentialDefaultProvider:e?.credentialDefaultProvider??us,defaultUserAgentProvider:e?.defaultUserAgentProvider??Ss({serviceId:o.serviceId,clientVersion:ns.version}),maxAttempts:e?.maxAttempts??q(Pn,e),region:e?.region??q(jo,{...qo,...n}),requestHandler:Je.create(e?.requestHandler??r),retryMode:e?.retryMode??q({...Dn,default:async()=>(await r()).retryMode||Xs},e),sha256:e?.sha256??Xe.bind(null,"sha256"),streamCollector:e?.streamCollector??Ls,useDualstackEndpoint:e?.useDualstackEndpoint??q(Vo,n),useFipsEndpoint:e?.useFipsEndpoint??q(Ho,n),userAgentAppId:e?.userAgentAppId??q(Rs,n)}};var ta=e=>({setRegion(t){e.region=t},region(){return e.region}}),ra=e=>({region:e.region()});var oa=e=>({setHttpHandler(t){e.httpHandler=t},httpHandler(){return e.httpHandler},updateHttpClientConfig(t,r){e.httpHandler?.updateHttpClientConfig(t,r)},httpHandlerConfigs(){return e.httpHandler.httpHandlerConfigs()}}),na=e=>({httpHandler:e.httpHandler()});var sa=e=>{let t=e.httpAuthSchemes,r=e.httpAuthSchemeProvider,o=e.credentials;return{setHttpAuthScheme(n){let s=t.findIndex(i=>i.schemeId===n.schemeId);s===-1?t.push(n):t.splice(s,1,n)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(n){r=n},httpAuthSchemeProvider(){return r},setCredentials(n){o=n},credentials(){return o}}},ia=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()});var aa=(e,t)=>{let r=Object.assign(ta(e),Fn(e),oa(e),sa(e));return t.forEach(o=>o.configure(r)),Object.assign(e,ra(r),Gn(r),na(r),ia(r))};var sr=class extends Me{config;constructor(...[t]){let r=ea(t||{});super(r),this.initConfig=r;let o=os(r),n=bo(o),s=wn(n),i=Bo(s),a=i,c=fn(a),p=rs(c),u=aa(p,t?.extensions||[]);this.config=u,this.middlewareStack.use(no(this.config)),this.middlewareStack.use(Go(this.config)),this.middlewareStack.use(On(this.config)),this.middlewareStack.use(Yo(this.config)),this.middlewareStack.use(Do(this.config)),this.middlewareStack.use(To(this.config)),this.middlewareStack.use(No(this.config)),this.middlewareStack.use(mo(this.config,{httpAuthSchemeParametersProvider:es,identityProviderConfigProvider:async l=>new Eo({"aws.auth#sigv4":l.credentials})})),this.middlewareStack.use(fo(this.config))}destroy(){super.destroy()}};var ir=class extends J.classBuilder().ep(je).m(function(t,r,o,n){return[ke(o,t.getEndpointParameterInstructions())]}).s("TrentService","Decrypt",{}).n("KMSClient","DecryptCommand").sc(Yi).build(){};var xe=class extends J.classBuilder().ep(je).m(function(t,r,o,n){return[ke(o,t.getEndpointParameterInstructions())]}).s("TrentService","GenerateDataKey",{}).n("KMSClient","GenerateDataKeyCommand").sc(Qi).build(){};var ca=class{name="aws-kms";client;keyId;keyVersion;constructor(t){let r=t.keyId??process.env.AWS_KMS_KEY_ID??process.env.AWS_KMS_KEY_ARN;if(!r)throw new Error("AWS KMS Key ID or ARN required. Set AWS_KMS_KEY_ID or pass keyId in config.");this.keyId=r,this.keyVersion=t.keyVersion??1;let o=t.region??process.env.AWS_REGION??"us-east-1";this.client=new sr({region:o,...t.credentials&&{credentials:{accessKeyId:t.credentials.accessKeyId,secretAccessKey:t.credentials.secretAccessKey}}}),N.debug("[vault:aws-kms] Initialized",{keyId:r,region:o,keyVersion:this.keyVersion})}async encrypt(t,r){try{let o=await this.client.send(new xe({KeyId:this.keyId,KeySpec:"AES_256"})),n=o.Plaintext,s=o.CiphertextBlob;if(!n||!s)throw new Error("AWS KMS GenerateDataKey returned empty DEK");let i=Br(t,n),a={id:r?.id??Zu(),ciphertext:se(i.ciphertext),encryptedDek:se(s),iv:se(i.iv),authTag:se(i.authTag),keyVersion:this.keyVersion,algorithm:"aes-256-gcm",...r?.tenantId!==void 0?{tenantId:r.tenantId}:{},metadata:r?.metadata,createdAt:new Date().toISOString()};return N.debug("[vault:aws-kms] Secret encrypted",{id:a.id,tenantId:r?.tenantId}),a}catch(o){throw N.error("[vault:aws-kms] Encryption failed",{error:o}),new Error(`AWS KMS encryption failed: ${o instanceof Error?o.message:String(o)}`)}}async decrypt(t,r){try{if(r?.tenantId&&t.tenantId&&t.tenantId!==r.tenantId)throw new Error("Tenant ID mismatch");let n=(await this.client.send(new ir({CiphertextBlob:ie(t.encryptedDek)}))).Plaintext;if(!n)throw new Error("AWS KMS Decrypt returned empty DEK");let s=Jr(ie(t.ciphertext),n,{iv:ie(t.iv),authTag:ie(t.authTag)});return N.debug("[vault:aws-kms] Secret decrypted",{id:t.id,tenantId:r?.tenantId}),s.toString("utf-8")}catch(o){throw N.error("[vault:aws-kms] Decryption failed",{error:o}),new Error(`AWS KMS decryption failed: ${o instanceof Error?o.message:String(o)}`)}}async rotateKey(t){try{let r=await this.decrypt(t),o=await this.encrypt(r,{id:t.id,...t.tenantId!==void 0?{tenantId:t.tenantId}:{},metadata:t.metadata});return o.rotatedAt=new Date().toISOString(),N.debug("[vault:aws-kms] Key rotated",{id:t.id}),o}catch(r){throw N.error("[vault:aws-kms] Key rotation failed",{error:r}),new Error(`Key rotation failed: ${r instanceof Error?r.message:String(r)}`)}}async rotateKek(){this.keyVersion+=1,N.info("[vault:aws-kms] KEK rotated",{newVersion:this.keyVersion})}async generateDek(){try{return(await this.client.send(new xe({KeyId:this.keyId,KeySpec:"AES_256"}))).Plaintext}catch(t){throw N.error("[vault:aws-kms] DEK generation failed",{error:t}),new Error(`DEK generation failed: ${t instanceof Error?t.message:String(t)}`)}}async close(){this.client.destroy(),N.debug("[vault:aws-kms] Closed")}};export{ca as a};