create-sailor 1.3.4 → 1.3.6

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 (50) hide show
  1. package/README.md +18 -11
  2. package/dist/aws-kms-ZX6CTY62.js +1 -0
  3. package/dist/{chunk-6EI2BXXZ.js → chunk-4NVBWJ2Q.js} +1 -1
  4. package/dist/chunk-A2KGYHAM.js +1 -0
  5. package/dist/{chunk-ZEEOYOWD.js → chunk-A75AMTOI.js} +1 -1
  6. package/dist/{chunk-KIX47M2V.js → chunk-B5RLHF2U.js} +1 -1
  7. package/dist/chunk-FSRPMVAS.js +1 -0
  8. package/dist/{chunk-O3WYNHSC.js → chunk-J7NVVT5I.js} +2 -2
  9. package/dist/{chunk-EA5HU2X4.js → chunk-LDOHSEAR.js} +2 -2
  10. package/dist/{chunk-4F23MJOI.js → chunk-NK255JZN.js} +1 -1
  11. package/dist/chunk-SDX64WW4.js +23 -0
  12. package/dist/{chunk-2VIWVVHK.js → chunk-YR32FZAX.js} +1 -1
  13. package/dist/{credits-L2HL2UEU.js → credits-6AUSU6X6.js} +2 -2
  14. package/dist/{dist-XS6SQF6X.js → dist-B4YTE2SQ.js} +2 -2
  15. package/dist/{dist-es-M3FWVZJF.js → dist-es-4EORLV5B.js} +1 -1
  16. package/dist/{dist-es-VHZAJVLW.js → dist-es-7IMKW7US.js} +1 -1
  17. package/dist/{dist-es-WTYBIVJ2.js → dist-es-FJUQ4DBK.js} +1 -1
  18. package/dist/{dist-es-OUTR3NFA.js → dist-es-GP7DK3S3.js} +1 -1
  19. package/dist/{dist-es-UGE2JJUB.js → dist-es-JXNWCJHW.js} +1 -1
  20. package/dist/{dist-es-NVFYVK4E.js → dist-es-YKXA2GQ2.js} +1 -1
  21. package/dist/{dist-es-NDZJSZR3.js → dist-es-ZA2NRM7G.js} +1 -1
  22. package/dist/{event-streams-WTP73PI5.js → event-streams-T5RU6C4N.js} +1 -1
  23. package/dist/index.js +181 -164
  24. package/dist/{loadSso-O5OGD76B.js → loadSso-YQ73JVR6.js} +1 -1
  25. package/dist/local-WW37QOXE.js +1 -0
  26. package/dist/{query_compiler_fast_bg.postgresql-7BFUBDOL.js → query_compiler_fast_bg.postgresql-PN2AWLCP.js} +1 -1
  27. package/dist/{query_compiler_fast_bg.postgresql.wasm-base64-I4FAC6EL.js → query_compiler_fast_bg.postgresql.wasm-base64-CASS54LO.js} +1 -1
  28. package/dist/{signin-DZIPNQBV.js → signin-LD4OP44K.js} +1 -1
  29. package/dist/src-MVDQLN5F.js +1 -0
  30. package/dist/{sso-oidc-SYBBWZG3.js → sso-oidc-4BAF7BYK.js} +1 -1
  31. package/dist/{sts-DREA5KZD.js → sts-3V5Q4UTA.js} +1 -1
  32. package/package.json +15 -14
  33. package/dist/aws-kms-BRGZLC2X.js +0 -1
  34. package/dist/chunk-7Z3O7WJM.js +0 -49
  35. package/dist/chunk-B35GFLVZ.js +0 -5
  36. package/dist/chunk-BAI5W3AB.js +0 -1
  37. package/dist/chunk-DGJUBN33.js +0 -1
  38. package/dist/chunk-HC3S5NWW.js +0 -1
  39. package/dist/chunk-LOPYJ44X.js +0 -31
  40. package/dist/chunk-YW4FFW47.js +0 -1
  41. package/dist/dist-Z6UUHTH2.js +0 -8
  42. package/dist/getMachineId-bsd-DVN24SFH.js +0 -1
  43. package/dist/getMachineId-darwin-LMU6AYNV.js +0 -2
  44. package/dist/getMachineId-linux-BHWLMOUW.js +0 -1
  45. package/dist/getMachineId-unsupported-G5LY7Y3J.js +0 -1
  46. package/dist/getMachineId-win-CWK62SDK.js +0 -1
  47. package/dist/local-V5XPOCXA.js +0 -1
  48. package/dist/multipart-parser-73SROTP5.js +0 -2
  49. package/dist/src-BFSJ5KFS.js +0 -3
  50. package/dist/src-ERQKJBBE.js +0 -1
@@ -1,6 +1,6 @@
1
1
  import{a as q,b as Ut,c as re}from"./chunk-PXU2OOBT.js";import{a as k,b as Ot,c as Pt,d as W,g as Mt,h as T}from"./chunk-7DCGNQSQ.js";import{a as R}from"./chunk-XSSPJU77.js";import{a as vt,b as He,c as Nt,d as L,e as Dt}from"./chunk-QEIMNOY2.js";import{a as kt}from"./chunk-QMKVUKS6.js";var F=(t,e)=>{let r=[];if(t&&r.push(t),e)for(let s of e)r.push(s);return r},U=(t,e)=>`${t||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,Y=()=>{let t=[],e=[],r=!1,s=new Set,n=u=>u.sort((l,p)=>$t[p.step]-$t[l.step]||Lt[p.priority||"normal"]-Lt[l.priority||"normal"]),o=u=>{let l=!1,p=h=>{let g=F(h.name,h.aliases);if(g.includes(u)){l=!0;for(let m of g)s.delete(m);return!1}return!0};return t=t.filter(p),e=e.filter(p),l},i=u=>{let l=!1,p=h=>{if(h.middleware===u){l=!0;for(let g of F(h.name,h.aliases))s.delete(g);return!1}return!0};return t=t.filter(p),e=e.filter(p),l},a=u=>(t.forEach(l=>{u.add(l.middleware,{...l})}),e.forEach(l=>{u.addRelativeTo(l.middleware,{...l})}),u.identifyOnResolve?.(f.identifyOnResolve()),u),c=u=>{let l=[];return u.before.forEach(p=>{p.before.length===0&&p.after.length===0?l.push(p):l.push(...c(p))}),l.push(u),u.after.reverse().forEach(p=>{p.before.length===0&&p.after.length===0?l.push(p):l.push(...c(p))}),l},d=(u=!1)=>{let l=[],p=[],h={};return t.forEach(m=>{let E={...m,before:[],after:[]};for(let y of F(E.name,E.aliases))h[y]=E;l.push(E)}),e.forEach(m=>{let E={...m,before:[],after:[]};for(let y of F(E.name,E.aliases))h[y]=E;p.push(E)}),p.forEach(m=>{if(m.toMiddleware){let E=h[m.toMiddleware];if(E===void 0){if(u)return;throw new Error(`${m.toMiddleware} is not found when adding ${U(m.name,m.aliases)} middleware ${m.relation} ${m.toMiddleware}`)}m.relation==="after"&&E.after.push(m),m.relation==="before"&&E.before.push(m)}}),n(l).map(c).reduce((m,E)=>(m.push(...E),m),[])},f={add:(u,l={})=>{let{name:p,override:h,aliases:g}=l,m={step:"initialize",priority:"normal",middleware:u,...l},E=F(p,g);if(E.length>0){if(E.some(y=>s.has(y))){if(!h)throw new Error(`Duplicate middleware name '${U(p,g)}'`);for(let y of E){let C=t.findIndex(te=>te.name===y||te.aliases?.some(Fe=>Fe===y));if(C===-1)continue;let A=t[C];if(A.step!==m.step||m.priority!==A.priority)throw new Error(`"${U(A.name,A.aliases)}" middleware with ${A.priority} priority in ${A.step} step cannot be overridden by "${U(p,g)}" middleware with ${m.priority} priority in ${m.step} step.`);t.splice(C,1)}}for(let y of E)s.add(y)}t.push(m)},addRelativeTo:(u,l)=>{let{name:p,override:h,aliases:g}=l,m={middleware:u,...l},E=F(p,g);if(E.length>0){if(E.some(y=>s.has(y))){if(!h)throw new Error(`Duplicate middleware name '${U(p,g)}'`);for(let y of E){let C=e.findIndex(te=>te.name===y||te.aliases?.some(Fe=>Fe===y));if(C===-1)continue;let A=e[C];if(A.toMiddleware!==m.toMiddleware||A.relation!==m.relation)throw new Error(`"${U(A.name,A.aliases)}" middleware ${A.relation} "${A.toMiddleware}" middleware cannot be overridden by "${U(p,g)}" middleware ${m.relation} "${m.toMiddleware}" middleware.`);e.splice(C,1)}}for(let y of E)s.add(y)}e.push(m)},clone:()=>a(Y()),use:u=>{u.applyToStack(f)},remove:u=>typeof u=="string"?o(u):i(u),removeByTag:u=>{let l=!1,p=h=>{let{tags:g,name:m,aliases:E}=h;if(g&&g.includes(u)){let y=F(m,E);for(let C of y)s.delete(C);return l=!0,!1}return!0};return t=t.filter(p),e=e.filter(p),l},concat:u=>{let l=a(Y());return l.use(u),l.identifyOnResolve(r||l.identifyOnResolve()||(u.identifyOnResolve?.()??!1)),l},applyToStack:a,identify:()=>d(!0).map(u=>{let l=u.step??u.relation+" "+u.toMiddleware;return U(u.name,u.aliases)+" - "+l}),identifyOnResolve(u){return typeof u=="boolean"&&(r=u),r},resolve:(u,l)=>{for(let p of d().map(h=>h.middleware).reverse())u=p(u,l);return r&&console.log(f.identify()),u}};return f},$t={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},Lt={high:3,normal:2,low:1};var Ft=class{config;middlewareStack=Y();initConfig;handlers;constructor(e){this.config=e;let{protocol:r,protocolSettings:s}=e;s&&typeof r=="function"&&(e.protocol=new r(s))}send(e,r,s){let n=typeof r!="function"?r:void 0,o=typeof r=="function"?r:s,i=n===void 0&&this.config.cacheMiddleware===!0,a;if(i){this.handlers||(this.handlers=new WeakMap);let c=this.handlers;c.has(e.constructor)?a=c.get(e.constructor):(a=e.resolveMiddleware(this.middlewareStack,this.config,n),c.set(e.constructor,a))}else delete this.handlers,a=e.resolveMiddleware(this.middlewareStack,this.config,n);if(o)a(e).then(c=>o(null,c.output),c=>o(c)).catch(()=>{});else return a(e).then(c=>c.output)}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}};var K;(function(t){t.HTTP="http",t.HTTPS="https"})(K||(K={}));var H;(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(H||(H={}));var se="__smithy_context";var pe=t=>typeof t=="function"?t():t;var Wo=t=>({setHttpHandler(e){t.httpHandler=e},httpHandler(){return t.httpHandler},updateHttpClientConfig(e,r){t.httpHandler?.updateHttpClientConfig(e,r)},httpHandlerConfigs(){return t.httpHandler.httpHandlerConfigs()}}),qo=t=>({httpHandler:t.httpHandler()});var b=t=>t[se]||(t[se]={});var v=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e};var fe=(t,e,r,s,n)=>({name:e,namespace:t,traits:r,input:s,output:n});var Ht=t=>(e,r)=>async s=>{let{response:n}=await e(s),{operationSchema:o}=b(r),[,i,a,c,d,f]=o??[];try{let u=await t.protocol.deserializeResponse(fe(i,a,c,d,f),{...t,...r},n);return{response:n,output:u}}catch(u){if(Object.defineProperty(u,"$response",{value:n,enumerable:!1,writable:!1,configurable:!1}),!("$metadata"in u)){let l="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";try{u.message+=`
2
2
  `+l}catch{!r.logger||r.logger?.constructor?.name==="NoOpLogger"?console.warn(l):r.logger?.warn?.(l)}typeof u.$responseBodyText<"u"&&u.$response&&(u.$response.body=u.$responseBodyText);try{if(k.isInstance(n)){let{headers:p={}}=n,h=Object.entries(p);u.$metadata={httpStatusCode:n.statusCode,requestId:ze(/^x-[\w-]+-request-?id$/,h),extendedRequestId:ze(/^x-[\w-]+-id-2$/,h),cfId:ze(/^x-[\w-]+-cf-id$/,h)}}}catch{}}throw u}},ze=(t,e)=>(e.find(([r])=>r.match(t))||[void 0,void 0])[1];var zt=t=>{if(typeof t=="object"){if("url"in t){let e=q(t.url);if(t.headers){e.headers={};for(let[r,s]of Object.entries(t.headers))e.headers[r.toLowerCase()]=s.join(", ")}return e}return t}return q(t)};var Bt=t=>(e,r)=>async s=>{let{operationSchema:n}=b(r),[,o,i,a,c,d]=n??[],f=r.endpointV2?async()=>zt(r.endpointV2):t.endpoint,u=await t.protocol.serializeRequest(fe(o,i,a,c,d),s.input,{...t,...r,endpoint:f});return e({...s,request:u})};var an={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},cn={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function li(t){return{applyToStack:e=>{e.add(Bt(t),cn),e.add(Ht(t),an),t.protocol.setSerdeContext(t)}}}var Be=[];function z(t){if(typeof t=="object")return t;if(t=t|0,Be[t])return Be[t];let e={},r=0;for(let s of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"])(t>>r++&1)===1&&(e[s]=1);return Be[t]=e}var ne={it:Symbol.for("@smithy/nor-struct-it"),ns:Symbol.for("@smithy/ns")},Ve=[],je={},N=class t{ref;memberName;static symbol=Symbol.for("@smithy/nor");symbol=t.symbol;name;schema;_isMemberSchema;traits;memberTraits;normalizedTraits;constructor(e,r){this.ref=e,this.memberName=r;let s=[],n=e,o=e;for(this._isMemberSchema=!1;Ge(n);)s.push(n[1]),n=n[0],o=pe(n),this._isMemberSchema=!0;if(s.length>0){this.memberTraits={};for(let i=s.length-1;i>=0;--i){let a=s[i];Object.assign(this.memberTraits,z(a))}}else this.memberTraits=0;if(o instanceof t){let i=this.memberTraits;Object.assign(this,o),this.memberTraits=Object.assign({},i,o.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,this.memberName=r??o.memberName;return}if(this.schema=pe(o),un(this.schema)?(this.name=`${this.schema[1]}#${this.schema[2]}`,this.traits=this.schema[3]):(this.name=this.memberName??String(o),this.traits=0),this._isMemberSchema&&!r)throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(!0)} missing member name.`)}static[Symbol.hasInstance](e){let r=this.prototype.isPrototypeOf(e);return!r&&typeof e=="object"&&e!==null?e.symbol===this.symbol:r}static of(e){let r=typeof e=="function"||typeof e=="object"&&e!==null;if(typeof e=="number"){if(Ve[e])return Ve[e]}else if(typeof e=="string"){if(je[e])return je[e]}else if(r&&e[ne.ns])return e[ne.ns];let s=pe(e);if(s instanceof t)return s;if(Ge(s)){let[o,i]=s;if(o instanceof t)return Object.assign(o.getMergedTraits(),z(i)),o;throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(e,null,2)}.`)}let n=new t(s);return r?e[ne.ns]=n:typeof s=="string"?je[s]=n:typeof s=="number"?Ve[s]=n:n}getSchema(){let e=this.schema;return Array.isArray(e)&&e[0]===0?e[4]:e}getName(e=!1){let{name:r}=this;return!e&&r&&r.includes("#")?r.split("#")[1]:r||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 r=e[0];return r===3||r===-3||r===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 z(this.memberTraits)}getOwnTraits(){return z(this.traits)}getKeySchema(){let[e,r]=[this.isDocumentSchema(),this.isMapSchema()];if(!e&&!r)throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(!0)}`);let s=this.getSchema(),n=e?15:s[4]??0;return oe([n,0],"key")}getValueSchema(){let e=this.getSchema(),[r,s,n]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()],o=typeof e=="number"?63&e:e&&typeof e=="object"&&(s||n)?e[3+e[0]]:r?15:void 0;if(o!=null)return oe([o,0],s?"value":"member");throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no value member.`)}getMemberSchema(e){let r=this.getSchema();if(this.isStructSchema()&&r[4].includes(e)){let s=r[4].indexOf(e),n=r[5][s];return oe(Ge(n)?n:[n,0],e)}if(this.isDocumentSchema())return oe([15,0],e);throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no member=${e}.`)}getMemberSchemas(){let e={};try{for(let[r,s]of this.structIterator())e[r]=s}catch{}return e}getEventStreamMember(){if(this.isStructSchema()){for(let[e,r]of this.structIterator())if(r.isStreaming()&&r.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(),r=e[4].length,s=e[ne.it];if(s&&r===s.length){yield*s;return}s=Array(r);for(let n=0;n<r;++n){let o=e[4][n],i=oe([e[5][n],0],o);yield s[n]=[o,i]}e[ne.it]=s}};function oe(t,e){if(t instanceof N)return Object.assign(t,{memberName:e,_isMemberSchema:!0});let r=N;return new r(t,e)}var Ge=t=>Array.isArray(t)&&t.length===2,un=t=>Array.isArray(t)&&t.length>=5;var B=class t{namespace;schemas;exceptions;static registries=new Map;constructor(e,r=new Map,s=new Map){this.namespace=e,this.schemas=r,this.exceptions=s}static for(e){return t.registries.has(e)||t.registries.set(e,new t(e)),t.registries.get(e)}copyFrom(e){let{schemas:r,exceptions:s}=this;for(let[n,o]of e.schemas)r.has(n)||r.set(n,o);for(let[n,o]of e.exceptions)s.has(n)||s.set(n,o)}register(e,r){let s=this.normalizeShapeId(e);for(let n of[this,t.for(s.split("#")[0])])n.schemas.set(s,r)}getSchema(e){let r=this.normalizeShapeId(e);if(!this.schemas.has(r))throw new Error(`@smithy/core/schema - schema not found for ${r}`);return this.schemas.get(r)}registerError(e,r){let s=e,n=s[1];for(let o of[this,t.for(n)])o.schemas.set(n+"#"+s[2],s),o.exceptions.set(s,r)}getErrorCtor(e){let r=e;return this.exceptions.has(r)?this.exceptions.get(r):t.for(r[1]).exceptions.get(r)}getBaseException(){for(let e of this.exceptions.keys())if(Array.isArray(e)){let[,r,s]=e,n=r+"#"+s;if(n.startsWith("smithy.ts.sdk.synthetic.")&&n.endsWith("ServiceException"))return e}}find(e){return[...this.schemas.values()].find(e)}clear(){this.schemas.clear(),this.exceptions.clear()}normalizeShapeId(e){return e.includes("#")?e:this.namespace+"#"+e}};var We="***SensitiveInformation***";function me(t,e){if(e==null)return e;let r=N.of(t);if(r.getMergedTraits().sensitive)return We;if(r.isListSchema()){if(!!r.getValueSchema().getMergedTraits().sensitive)return We}else if(r.isMapSchema()){if(!!r.getKeySchema().getMergedTraits().sensitive||!!r.getValueSchema().getMergedTraits().sensitive)return We}else if(r.isStructSchema()&&typeof e=="object"){let s=e,n={};for(let[o,i]of r.structIterator())s[o]!=null&&(n[o]=me(i,s[o]));return n}return e}var qe=class{middlewareStack=Y();schema;static classBuilder(){return new Ye}resolveMiddlewareWithContext(e,r,s,{middlewareFn:n,clientName:o,commandName:i,inputFilterSensitiveLog:a,outputFilterSensitiveLog:c,smithyContext:d,additionalContext:f,CommandCtor:u}){for(let m of n.bind(this)(u,e,r,s))this.middlewareStack.use(m);let l=e.concat(this.middlewareStack),{logger:p}=r,h={logger:p,clientName:o,commandName:i,inputFilterSensitiveLog:a,outputFilterSensitiveLog:c,[se]:{commandInstance:this,...d},...f},{requestHandler:g}=r;return l.resolve(m=>g.handle(m.request,s||{}),h)}},Ye=class{_init=()=>{};_ep={};_middlewareFn=()=>[];_commandName="";_clientName="";_additionalContext={};_smithyContext={};_inputFilterSensitiveLog=void 0;_outputFilterSensitiveLog=void 0;_serializer=null;_deserializer=null;_operationSchema;init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,r,s={}){return this._smithyContext={service:e,operation:r,...s},this}c(e={}){return this._additionalContext=e,this}n(e,r){return this._clientName=e,this._commandName=r,this}f(e=s=>s,r=s=>s){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=r,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}sc(e){return this._operationSchema=e,this._smithyContext.operationSchema=e,this}build(){let e=this,r;return r=class extends qe{input;static getEndpointParameterInstructions(){return e._ep}constructor(...[s]){super(),this.input=s??{},e._init(this),this.schema=e._operationSchema}resolveMiddleware(s,n,o){let i=e._operationSchema,a=i?.[4]??i?.input,c=i?.[5]??i?.output;return this.resolveMiddlewareWithContext(s,n,o,{CommandCtor:r,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog??(i?me.bind(null,a):d=>d),outputFilterSensitiveLog:e._outputFilterSensitiveLog??(i?me.bind(null,c):d=>d),smithyContext:e._smithyContext,additionalContext:e._additionalContext})}serialize=e._serializer;deserialize=e._deserializer}}};var dn=t=>e=>async r=>{if(!R.isInstance(r.request))return e(r);let{request:s}=r,{handlerProtocol:n=""}=t.requestHandler.metadata||{};if(n.indexOf("h2")>=0&&!s.headers[":authority"])delete s.headers.host,s.headers[":authority"]=s.hostname+(s.port?":"+s.port:"");else if(!s.headers.host){let o=s.hostname;s.port!=null&&(o+=`:${s.port}`),s.headers.host=o}return e(r)},ln={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},Ci=t=>({applyToStack:e=>{e.add(dn(t),ln)}});var pn=()=>(t,e)=>async r=>{try{let s=await t(r),{clientName:n,commandName:o,logger:i,dynamoDbDocumentClientOptions:a={}}=e,{overrideInputFilterSensitiveLog:c,overrideOutputFilterSensitiveLog:d}=a,f=c??e.inputFilterSensitiveLog,u=d??e.outputFilterSensitiveLog,{$metadata:l,...p}=s.output;return i?.info?.({clientName:n,commandName:o,input:f(r.input),output:u(p),metadata:l}),s}catch(s){let{clientName:n,commandName:o,logger:i,dynamoDbDocumentClientOptions:a={}}=e,{overrideInputFilterSensitiveLog:c}=a,d=c??e.inputFilterSensitiveLog;throw i?.error?.({clientName:n,commandName:o,input:d(r.input),error:s,metadata:s.$metadata}),s}},fn={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},bi=t=>({applyToStack:e=>{e.add(pn(),fn)}});var Vt={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"};var ie={REQUEST_ID:Symbol.for("_AWS_LAMBDA_REQUEST_ID"),X_RAY_TRACE_ID:Symbol.for("_AWS_LAMBDA_X_RAY_TRACE_ID"),TENANT_ID:Symbol.for("_AWS_LAMBDA_TENANT_ID")},Ke=["true","1"].includes(process.env?.AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA??"");Ke||(globalThis.awslambda=globalThis.awslambda||{});var he=class{static PROTECTED_KEYS=ie;isProtectedKey(e){return Object.values(ie).includes(e)}getRequestId(){return this.get(ie.REQUEST_ID)??"-"}getXRayTraceId(){return this.get(ie.X_RAY_TRACE_ID)}getTenantId(){return this.get(ie.TENANT_ID)}},Xe=class extends he{currentContext;getContext(){return this.currentContext}hasContext(){return this.currentContext!==void 0}get(e){return this.currentContext?.[e]}set(e,r){if(this.isProtectedKey(e))throw new Error(`Cannot modify protected Lambda context field: ${String(e)}`);this.currentContext=this.currentContext||{},this.currentContext[e]=r}run(e,r){return this.currentContext=e,r()}},Qe=class t extends he{als;static async create(){let e=new t,r=await import("async_hooks");return e.als=new r.AsyncLocalStorage,e}getContext(){return this.als.getStore()}hasContext(){return this.als.getStore()!==void 0}get(e){return this.als.getStore()?.[e]}set(e,r){if(this.isProtectedKey(e))throw new Error(`Cannot modify protected Lambda context field: ${String(e)}`);let s=this.als.getStore();if(!s)throw new Error("No context available");s[e]=r}run(e,r){return this.als.run(e,r)}},ge;(function(t){let e=null;async function r(){return e||(e=(async()=>{let n="AWS_LAMBDA_MAX_CONCURRENCY"in process.env?await Qe.create():new Xe;return!Ke&&globalThis.awslambda?.InvokeStore?globalThis.awslambda.InvokeStore:(!Ke&&globalThis.awslambda&&(globalThis.awslambda.InvokeStore=n),n)})()),e}t.getInstanceAsync=r,t._testing=process.env.AWS_LAMBDA_BENCHMARK_MODE==="1"?{reset:()=>{e=null,globalThis.awslambda?.InvokeStore&&delete globalThis.awslambda.InvokeStore,globalThis.awslambda={InvokeStore:void 0}}}:void 0})(ge||(ge={}));var Je="X-Amzn-Trace-Id",mn="AWS_LAMBDA_FUNCTION_NAME",hn="_X_AMZN_TRACE_ID",jt=()=>t=>async e=>{let{request:r}=e;if(!R.isInstance(r))return t(e);let s=Object.keys(r.headers??{}).find(f=>f.toLowerCase()===Je.toLowerCase())??Je;if(r.headers.hasOwnProperty(s))return t(e);let n=process.env[mn],o=process.env[hn],c=(await ge.getInstanceAsync())?.getXRayTraceId()??o,d=f=>typeof f=="string"&&f.length>0;return d(n)&&d(c)&&(r.headers[Je]=c),t({...e,request:r})};var $i=t=>({applyToStack:e=>{e.add(jt(),Vt)}});var Gt=(t,e)=>{if(!e||e.length===0)return t;let r=[];for(let s of e)for(let n of t)n.schemeId.split("#")[1]===s&&r.push(n);for(let s of t)r.find(({schemeId:n})=>n===s.schemeId)||r.push(s);return r};function gn(t){let e=new Map;for(let r of t)e.set(r.schemeId,r);return e}var Wt=(t,e)=>(r,s)=>async n=>{let o=t.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(t,s,n.input)),i=t.authSchemePreference?await t.authSchemePreference():[],a=Gt(o,i),c=gn(t.httpAuthSchemes),d=b(s),f=[];for(let u of a){let l=c.get(u.schemeId);if(!l){f.push(`HttpAuthScheme \`${u.schemeId}\` was not enabled for this service.`);continue}let p=l.identityProvider(await e.identityProviderConfigProvider(t));if(!p){f.push(`HttpAuthScheme \`${u.schemeId}\` did not have an IdentityProvider configured.`);continue}let{identityProperties:h={},signingProperties:g={}}=u.propertiesExtractor?.(t,s)||{};u.identityProperties=Object.assign(u.identityProperties||{},h),u.signingProperties=Object.assign(u.signingProperties||{},g),d.selectedHttpAuthScheme={httpAuthOption:u,identity:await p(u.identityProperties),signer:l.signer};break}if(!d.selectedHttpAuthScheme)throw new Error(f.join(`
3
- `));return r(n)};var En={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"},ji=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:s=>{s.addRelativeTo(Wt(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),En)}});var Sn=t=>e=>{throw e},yn=(t,e)=>{},qt=t=>(e,r)=>async s=>{if(!R.isInstance(s.request))return e(s);let o=b(r).selectedHttpAuthScheme;if(!o)throw new Error("No HttpAuthScheme was selected: unable to sign request");let{httpAuthOption:{signingProperties:i={}},identity:a,signer:c}=o,d=await e({...s,request:await c.sign(s.request,a,i)}).catch((c.errorHandler||Sn)(i));return(c.successHandler||yn)(d.response,i),d};var Rn={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},Xi=t=>({applyToStack:e=>{e.addRelativeTo(qt(t),Rn)}});var Yt=class{authSchemes=new Map;constructor(e){for(let[r,s]of Object.entries(e))s!==void 0&&this.authSchemes.set(r,s)}getIdentityProvider(e){return this.authSchemes.get(e)}};var V=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e};var I=t=>typeof t=="string"?L(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t);var X=class t extends Uint8Array{static fromString(e,r="utf-8"){if(typeof e=="string")return r==="base64"?t.mutate(Ot(e)):t.mutate(L(e));throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}static mutate(e){return Object.setPrototypeOf(e,t.prototype),e}transformToString(e="utf-8"){return e==="base64"?Pt(this):Dt(this)}};var ia=async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return X.mutate(t);if(!t)return X.mutate(new Uint8Array);let r=e.streamCollector(t);return X.mutate(await r)};import Kt from"crypto";var Ze=Kt.randomUUID.bind(Kt);var w=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0")),et=()=>{if(Ze)return Ze();let t=new Uint8Array(16);return crypto.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128,w[t[0]]+w[t[1]]+w[t[2]]+w[t[3]]+"-"+w[t[4]]+w[t[5]]+"-"+w[t[6]]+w[t[7]]+"-"+w[t[8]]+w[t[9]]+"-"+w[t[10]]+w[t[11]]+w[t[12]]+w[t[13]]+w[t[14]]+w[t[15]]};var Q=function(e){return Object.assign(new String(e),{deserializeJSON(){return JSON.parse(String(e))},toString(){return String(e)},toJSON(){return String(e)}})};Q.from=t=>t&&typeof t=="object"&&(t instanceof Q||"deserializeJSON"in t)?t:typeof t=="string"||Object.getPrototypeOf(t)===String.prototype?Q(String(t)):Q(JSON.stringify(t));Q.fromObject=Q.from;var Xt=/^-?\d*(\.\d+)?$/,Qt=class t{string;type;constructor(e,r){if(this.string=e,this.type=r,!Xt.test(e))throw new Error('@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".')}toString(){return this.string}static[Symbol.hasInstance](e){if(!e||typeof e!="object")return!1;let r=e;return t.prototype.isPrototypeOf(e)||r.type==="bigDecimal"&&Xt.test(r.string)}};var Ee=class{serdeContext;setSerdeContext(e){this.serdeContext=e}};var Jt=class extends Ee{options;compositeErrorRegistry;constructor(e){super(),this.options=e,this.compositeErrorRegistry=B.for(e.defaultNamespace);for(let r of e.errorTypeRegistries??[])this.compositeErrorRegistry.copyFrom(r)}getRequestType(){return R}getResponseType(){return k}setSerdeContext(e){this.serdeContext=e,this.serializer.setSerdeContext(e),this.deserializer.setSerdeContext(e),this.getPayloadCodec()&&this.getPayloadCodec().setSerdeContext(e)}updateServiceEndpoint(e,r){if("url"in r){e.protocol=r.url.protocol,e.hostname=r.url.hostname,e.port=r.url.port?Number(r.url.port):void 0,e.path=r.url.pathname,e.fragment=r.url.hash||void 0,e.username=r.url.username||void 0,e.password=r.url.password||void 0,e.query||(e.query={});for(let[s,n]of r.url.searchParams.entries())e.query[s]=n;if(r.headers)for(let[s,n]of Object.entries(r.headers))e.headers[s]=n.join(", ");return e}else{if(e.protocol=r.protocol,e.hostname=r.hostname,e.port=r.port?Number(r.port):void 0,e.path=r.path,e.query={...r.query},r.headers)for(let[s,n]of Object.entries(r.headers))e.headers[s]=n;return e}}setHostPrefix(e,r,s){if(this.serdeContext?.disableHostPrefix)return;let n=N.of(r.input),o=z(r.traits??{});if(o.endpoint){let i=o.endpoint?.[0];if(typeof i=="string"){let a=[...n.structIterator()].filter(([,c])=>c.getMergedTraits().hostLabel);for(let[c]of a){let d=s[c];if(typeof d!="string")throw new Error(`@smithy/core/schema - ${c} in input must be a string as hostLabel.`);i=i.replace(`{${c}}`,d)}e.hostname=i+e.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:r,initialRequest:s}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:e,requestSchema:r,initialRequest:s})}async deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:s}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:s})}async loadEventStreamCapability(){let{EventStreamSerde:e}=await import("./event-streams-WTP73PI5.js");return new e({marshaller:this.getEventStreamMarshaller(),serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType()})}getDefaultContentType(){throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(e,r,s,n,o){return[]}getEventStreamMarshaller(){let e=this.serdeContext;if(!e.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return e.eventStreamMarshaller}};function wa(t,e){if(e.timestampFormat.useTrait&&t.isTimestampSchema()&&(t.getSchema()===5||t.getSchema()===6||t.getSchema()===7))return t.getSchema();let{httpLabel:r,httpPrefixHeaders:s,httpHeader:n,httpQuery:o}=t.getMergedTraits();return(e.httpBindings?typeof s=="string"||n?6:o||r?5:void 0:void 0)??e.timestampFormat.default}function Zt(t,e,r){t.__smithy_context?t.__smithy_context.features||(t.__smithy_context.features={}):t.__smithy_context={features:{}},t.__smithy_context.features[e]=r}var wn=t=>function(r){return tt(r)&&r.expiration.getTime()-Date.now()<t};var er=wn(3e5),tt=t=>t.expiration!==void 0,tr=(t,e,r)=>{if(t===void 0)return;let s=typeof t!="function"?async()=>Promise.resolve(t):t,n,o,i,a=!1,c=async d=>{o||(o=s(d));try{n=await o,i=!0,a=!1}finally{o=void 0}return n};return e===void 0?async d=>((!i||d?.forceRefresh)&&(n=await c(d)),n):async d=>((!i||d?.forceRefresh)&&(n=await c(d)),a?n:r(n)?(e(n)&&await c(d),n):(a=!0,n))};var rt=void 0;function An(t){return t===void 0?!0:typeof t=="string"&&t.length<=50}function Ca(t){let e=V(t.userAgentAppId??rt),{customUserAgent:r}=t;return Object.assign(t,{customUserAgent:typeof r=="string"?[[r]]:r,userAgentAppId:async()=>{let s=await e();if(!An(s)){let n=t.logger?.constructor?.name==="NoOpLogger"||!t.logger?console:t.logger;typeof s!="string"?n?.warn("userAgentAppId must be a string or undefined."):s.length>50&&n?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}return s}})}var rr=class t extends Error{$fault;$response;$retryable;$metadata;constructor(e){super(e.message),Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}static isInstance(e){if(!e)return!1;let r=e;return t.prototype.isPrototypeOf(r)||!!r.$fault&&!!r.$metadata&&(r.$fault==="client"||r.$fault==="server")}static[Symbol.hasInstance](e){if(!e)return!1;let r=e;return this===t?t.isInstance(e):t.isInstance(e)?r.name&&this.name?this.prototype.isPrototypeOf(e)||r.name===this.name:this.prototype.isPrototypeOf(e):!1}},st=(t,e={})=>{Object.entries(e).filter(([,s])=>s!==void 0).forEach(([s,n])=>{(t[s]==null||t[s]==="")&&(t[s]=n)});let r=t.message||t.Message||"UnknownError";return t.message=r,delete t.Message,t};var sr=class{capacity;data=new Map;parameters=[];constructor({size:e,params:r}){this.capacity=e??50,r&&(this.parameters=r)}get(e,r){let s=this.hash(e);if(s===!1)return r();if(!this.data.has(s)){if(this.data.size>this.capacity+10){let n=this.data.keys(),o=0;for(;;){let{value:i,done:a}=n.next();if(this.data.delete(i),a||++o>10)break}}this.data.set(s,r())}return this.data.get(s)}size(){return this.data.size}hash(e){let r="",{parameters:s}=this;if(s.length===0)return!1;for(let n of s){let o=String(e[n]??"");if(o.includes("|;"))return!1;r+=o+"|;"}return r}};var Tn=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}$"),ae=t=>Tn.test(t)||t.startsWith("[")&&t.endsWith("]");var _n=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),j=(t,e=!1)=>{if(!e)return _n.test(t);let r=t.split(".");for(let s of r)if(!j(s))return!1;return!0};var ce={};var M="endpoints";function _(t){return typeof t!="object"||t==null?t:"ref"in t?`$${_(t.ref)}`:"fn"in t?`${t.fn}(${(t.argv||[]).map(_).join(", ")})`:JSON.stringify(t,null,2)}var S=class extends Error{constructor(e){super(e),this.name="EndpointError"}};var nr=(t,e)=>t===e;var or=t=>{let e=t.split("."),r=[];for(let s of e){let n=s.indexOf("[");if(n!==-1){if(s.indexOf("]")!==s.length-1)throw new S(`Path: '${t}' does not end with ']'`);let o=s.slice(n+1,-1);if(Number.isNaN(parseInt(o)))throw new S(`Invalid array index: '${o}' in path: '${t}'`);n!==0&&r.push(s.slice(0,n)),r.push(o)}else r.push(s)}return r};var Se=(t,e)=>or(e).reduce((r,s)=>{if(typeof r!="object")throw new S(`Index '${s}' in '${e}' not found in '${JSON.stringify(t)}'`);return Array.isArray(r)?r[parseInt(s)]:r[s]},t);var ir=t=>t!=null;var ar=t=>!t;var nt={[K.HTTP]:80,[K.HTTPS]:443},cr=t=>{let e=(()=>{try{if(t instanceof URL)return t;if(typeof t=="object"&&"hostname"in t){let{hostname:l,port:p,protocol:h="",path:g="",query:m={}}=t,E=new URL(`${h}//${l}${p?`:${p}`:""}${g}`);return E.search=Object.entries(m).map(([y,C])=>`${y}=${C}`).join("&"),E}return new URL(t)}catch{return null}})();if(!e)return console.error(`Unable to parse ${JSON.stringify(t)} as a whatwg URL.`),null;let r=e.href,{host:s,hostname:n,pathname:o,protocol:i,search:a}=e;if(a)return null;let c=i.slice(0,-1);if(!Object.values(K).includes(c))return null;let d=ae(n),f=r.includes(`${s}:${nt[c]}`)||typeof t=="string"&&t.includes(`${s}:${nt[c]}`),u=`${s}${f?`:${nt[c]}`:""}`;return{scheme:c,authority:u,path:o,normalizedPath:o.endsWith("/")?o:`${o}/`,isIp:d}};var ur=(t,e)=>t===e;var dr=(t,e,r,s)=>e>=r||t.length<r||/[^\u0000-\u007f]/.test(t)?null:s?t.substring(t.length-r,t.length-e):t.substring(e,r);var lr=t=>encodeURIComponent(t).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`);var pr={booleanEquals:nr,getAttr:Se,isSet:ir,isValidHostLabel:j,not:ar,parseURL:cr,stringEquals:ur,substring:dr,uriEncode:lr};var ye=(t,e)=>{let r=[],s={...e.endpointParams,...e.referenceRecord},n=0;for(;n<t.length;){let o=t.indexOf("{",n);if(o===-1){r.push(t.slice(n));break}r.push(t.slice(n,o));let i=t.indexOf("}",o);if(i===-1){r.push(t.slice(o));break}t[o+1]==="{"&&t[i+1]==="}"&&(r.push(t.slice(o+1,i)),n=i+2);let a=t.substring(o+1,i);if(a.includes("#")){let[c,d]=a.split("#");r.push(Se(s[c],d))}else r.push(s[a]);n=i+1}return r.join("")};var fr=({ref:t},e)=>({...e.endpointParams,...e.referenceRecord})[t];var G=(t,e,r)=>{if(typeof t=="string")return ye(t,r);if(t.fn)return mr.callFunction(t,r);if(t.ref)return fr(t,r);throw new S(`'${e}': ${String(t)} is not a string, function or reference.`)},Re=({fn:t,argv:e},r)=>{let s=e.map(o=>["boolean","number"].includes(typeof o)?o:mr.evaluateExpression(o,"arg",r)),n=t.split(".");return n[0]in ce&&n[1]!=null?ce[n[0]][n[1]](...s):pr[t](...s)},mr={evaluateExpression:G,callFunction:Re};var hr=({assign:t,...e},r)=>{if(t&&t in r.referenceRecord)throw new S(`'${t}' is already defined in Reference Record.`);let s=Re(e,r);return r.logger?.debug?.(`${M} evaluateCondition: ${_(e)} = ${_(s)}`),{result:s===""?!0:!!s,...t!=null&&{toAssign:{name:t,value:s}}}};var J=(t=[],e)=>{let r={};for(let s of t){let{result:n,toAssign:o}=hr(s,{...e,referenceRecord:{...e.referenceRecord,...r}});if(!n)return{result:n};o&&(r[o.name]=o.value,e.logger?.debug?.(`${M} assign: ${o.name} := ${_(o.value)}`))}return{result:!0,referenceRecord:r}};var gr=(t,e)=>Object.entries(t).reduce((r,[s,n])=>({...r,[s]:n.map(o=>{let i=G(o,"Header value entry",e);if(typeof i!="string")throw new S(`Header '${s}' value '${i}' is not a string`);return i})}),{});var ot=(t,e)=>Object.entries(t).reduce((r,[s,n])=>({...r,[s]:Sr.getEndpointProperty(n,e)}),{}),Er=(t,e)=>{if(Array.isArray(t))return t.map(r=>Er(r,e));switch(typeof t){case"string":return ye(t,e);case"object":if(t===null)throw new S(`Unexpected endpoint property: ${t}`);return Sr.getEndpointProperties(t,e);case"boolean":return t;default:throw new S(`Unexpected endpoint property type: ${typeof t}`)}},Sr={getEndpointProperty:Er,getEndpointProperties:ot};var yr=(t,e)=>{let r=G(t,"Endpoint URL",e);if(typeof r=="string")try{return new URL(r)}catch(s){throw console.error(`Failed to construct URL with ${r}`,s),s}throw new S(`Endpoint URL must be a string, got ${typeof r}`)};var Rr=(t,e)=>{let{conditions:r,endpoint:s}=t,{result:n,referenceRecord:o}=J(r,e);if(!n)return;let i={...e,referenceRecord:{...e.referenceRecord,...o}},{url:a,properties:c,headers:d}=s;return e.logger?.debug?.(`${M} Resolving endpoint from template: ${_(s)}`),{...d!=null&&{headers:gr(d,i)},...c!=null&&{properties:ot(c,i)},url:yr(a,i)}};var wr=(t,e)=>{let{conditions:r,error:s}=t,{result:n,referenceRecord:o}=J(r,e);if(n)throw new S(G(s,"Error",{...e,referenceRecord:{...e.referenceRecord,...o}}))};var it=(t,e)=>{for(let r of t)if(r.type==="endpoint"){let s=Rr(r,e);if(s)return s}else if(r.type==="error")wr(r,e);else if(r.type==="tree"){let s=Ar.evaluateTreeRule(r,e);if(s)return s}else throw new S(`Unknown endpoint rule: ${r}`);throw new S("Rules evaluation failed")},xn=(t,e)=>{let{conditions:r,rules:s}=t,{result:n,referenceRecord:o}=J(r,e);if(n)return Ar.evaluateRules(s,{...e,referenceRecord:{...e.referenceRecord,...o}})},Ar={evaluateRules:it,evaluateTreeRule:xn};var Vc=(t,e)=>{let{endpointParams:r,logger:s}=e,{parameters:n,rules:o}=t;e.logger?.debug?.(`${M} Initial EndpointParams: ${_(r)}`);let i=Object.entries(n).filter(([,d])=>d.default!=null).map(([d,f])=>[d,f.default]);if(i.length>0)for(let[d,f]of i)r[d]=r[d]??f;let a=Object.entries(n).filter(([,d])=>d.required).map(([d])=>d);for(let d of a)if(r[d]==null)throw new S(`Missing required parameter: '${d}'`);let c=it(o,{endpointParams:r,logger:s,referenceRecord:{}});return e.logger?.debug?.(`${M} Resolved endpoint: ${_(c)}`),c};var at=(t,e=!1)=>{if(e){for(let r of t.split("."))if(!at(r))return!1;return!0}return!(!j(t)||t.length<3||t.length>63||t!==t.toLowerCase()||ae(t))};var Tr=t=>{let e=t.split(":");if(e.length<6)return null;let[r,s,n,o,i,...a]=e;if(r!=="arn"||s===""||n===""||a.join(":")==="")return null;let c=a.map(d=>d.split("/")).flat();return{partition:s,service:n,region:o,accountId:i,resourceId:c}};var _r={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 In=_r,bn="",xr=t=>{let{partitions:e}=In;for(let s of e){let{regions:n,outputs:o}=s;for(let[i,a]of Object.entries(n))if(i===t)return{...o,...a}}for(let s of e){let{regionRegex:n,outputs:o}=s;if(new RegExp(n).test(t))return{...o}}let r=e.find(s=>s.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 Cr=()=>bn;var vn={isVirtualHostableS3Bucket:at,parseArn:Tr,partition:xr};ce.aws=vn;var Ir={warningEmitted:!1},Au=t=>{t&&!Ir.warningEmitted&&parseInt(t.substring(1,t.indexOf(".")))<20&&(Ir.warningEmitted=!0,process.emitWarning(`NodeDeprecationWarning: The AWS SDK for JavaScript (v3) will
3
+ `));return r(n)};var En={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"},ji=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:s=>{s.addRelativeTo(Wt(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),En)}});var Sn=t=>e=>{throw e},yn=(t,e)=>{},qt=t=>(e,r)=>async s=>{if(!R.isInstance(s.request))return e(s);let o=b(r).selectedHttpAuthScheme;if(!o)throw new Error("No HttpAuthScheme was selected: unable to sign request");let{httpAuthOption:{signingProperties:i={}},identity:a,signer:c}=o,d=await e({...s,request:await c.sign(s.request,a,i)}).catch((c.errorHandler||Sn)(i));return(c.successHandler||yn)(d.response,i),d};var Rn={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},Xi=t=>({applyToStack:e=>{e.addRelativeTo(qt(t),Rn)}});var Yt=class{authSchemes=new Map;constructor(e){for(let[r,s]of Object.entries(e))s!==void 0&&this.authSchemes.set(r,s)}getIdentityProvider(e){return this.authSchemes.get(e)}};var V=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e};var I=t=>typeof t=="string"?L(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t);var X=class t extends Uint8Array{static fromString(e,r="utf-8"){if(typeof e=="string")return r==="base64"?t.mutate(Ot(e)):t.mutate(L(e));throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}static mutate(e){return Object.setPrototypeOf(e,t.prototype),e}transformToString(e="utf-8"){return e==="base64"?Pt(this):Dt(this)}};var ia=async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return X.mutate(t);if(!t)return X.mutate(new Uint8Array);let r=e.streamCollector(t);return X.mutate(await r)};import Kt from"crypto";var Ze=Kt.randomUUID.bind(Kt);var w=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0")),et=()=>{if(Ze)return Ze();let t=new Uint8Array(16);return crypto.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128,w[t[0]]+w[t[1]]+w[t[2]]+w[t[3]]+"-"+w[t[4]]+w[t[5]]+"-"+w[t[6]]+w[t[7]]+"-"+w[t[8]]+w[t[9]]+"-"+w[t[10]]+w[t[11]]+w[t[12]]+w[t[13]]+w[t[14]]+w[t[15]]};var Q=function(e){return Object.assign(new String(e),{deserializeJSON(){return JSON.parse(String(e))},toString(){return String(e)},toJSON(){return String(e)}})};Q.from=t=>t&&typeof t=="object"&&(t instanceof Q||"deserializeJSON"in t)?t:typeof t=="string"||Object.getPrototypeOf(t)===String.prototype?Q(String(t)):Q(JSON.stringify(t));Q.fromObject=Q.from;var Xt=/^-?\d*(\.\d+)?$/,Qt=class t{string;type;constructor(e,r){if(this.string=e,this.type=r,!Xt.test(e))throw new Error('@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".')}toString(){return this.string}static[Symbol.hasInstance](e){if(!e||typeof e!="object")return!1;let r=e;return t.prototype.isPrototypeOf(e)||r.type==="bigDecimal"&&Xt.test(r.string)}};var Ee=class{serdeContext;setSerdeContext(e){this.serdeContext=e}};var Jt=class extends Ee{options;compositeErrorRegistry;constructor(e){super(),this.options=e,this.compositeErrorRegistry=B.for(e.defaultNamespace);for(let r of e.errorTypeRegistries??[])this.compositeErrorRegistry.copyFrom(r)}getRequestType(){return R}getResponseType(){return k}setSerdeContext(e){this.serdeContext=e,this.serializer.setSerdeContext(e),this.deserializer.setSerdeContext(e),this.getPayloadCodec()&&this.getPayloadCodec().setSerdeContext(e)}updateServiceEndpoint(e,r){if("url"in r){e.protocol=r.url.protocol,e.hostname=r.url.hostname,e.port=r.url.port?Number(r.url.port):void 0,e.path=r.url.pathname,e.fragment=r.url.hash||void 0,e.username=r.url.username||void 0,e.password=r.url.password||void 0,e.query||(e.query={});for(let[s,n]of r.url.searchParams.entries())e.query[s]=n;if(r.headers)for(let[s,n]of Object.entries(r.headers))e.headers[s]=n.join(", ");return e}else{if(e.protocol=r.protocol,e.hostname=r.hostname,e.port=r.port?Number(r.port):void 0,e.path=r.path,e.query={...r.query},r.headers)for(let[s,n]of Object.entries(r.headers))e.headers[s]=n;return e}}setHostPrefix(e,r,s){if(this.serdeContext?.disableHostPrefix)return;let n=N.of(r.input),o=z(r.traits??{});if(o.endpoint){let i=o.endpoint?.[0];if(typeof i=="string"){let a=[...n.structIterator()].filter(([,c])=>c.getMergedTraits().hostLabel);for(let[c]of a){let d=s[c];if(typeof d!="string")throw new Error(`@smithy/core/schema - ${c} in input must be a string as hostLabel.`);i=i.replace(`{${c}}`,d)}e.hostname=i+e.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:r,initialRequest:s}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:e,requestSchema:r,initialRequest:s})}async deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:s}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:s})}async loadEventStreamCapability(){let{EventStreamSerde:e}=await import("./event-streams-T5RU6C4N.js");return new e({marshaller:this.getEventStreamMarshaller(),serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType()})}getDefaultContentType(){throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(e,r,s,n,o){return[]}getEventStreamMarshaller(){let e=this.serdeContext;if(!e.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return e.eventStreamMarshaller}};function wa(t,e){if(e.timestampFormat.useTrait&&t.isTimestampSchema()&&(t.getSchema()===5||t.getSchema()===6||t.getSchema()===7))return t.getSchema();let{httpLabel:r,httpPrefixHeaders:s,httpHeader:n,httpQuery:o}=t.getMergedTraits();return(e.httpBindings?typeof s=="string"||n?6:o||r?5:void 0:void 0)??e.timestampFormat.default}function Zt(t,e,r){t.__smithy_context?t.__smithy_context.features||(t.__smithy_context.features={}):t.__smithy_context={features:{}},t.__smithy_context.features[e]=r}var wn=t=>function(r){return tt(r)&&r.expiration.getTime()-Date.now()<t};var er=wn(3e5),tt=t=>t.expiration!==void 0,tr=(t,e,r)=>{if(t===void 0)return;let s=typeof t!="function"?async()=>Promise.resolve(t):t,n,o,i,a=!1,c=async d=>{o||(o=s(d));try{n=await o,i=!0,a=!1}finally{o=void 0}return n};return e===void 0?async d=>((!i||d?.forceRefresh)&&(n=await c(d)),n):async d=>((!i||d?.forceRefresh)&&(n=await c(d)),a?n:r(n)?(e(n)&&await c(d),n):(a=!0,n))};var rt=void 0;function An(t){return t===void 0?!0:typeof t=="string"&&t.length<=50}function Ca(t){let e=V(t.userAgentAppId??rt),{customUserAgent:r}=t;return Object.assign(t,{customUserAgent:typeof r=="string"?[[r]]:r,userAgentAppId:async()=>{let s=await e();if(!An(s)){let n=t.logger?.constructor?.name==="NoOpLogger"||!t.logger?console:t.logger;typeof s!="string"?n?.warn("userAgentAppId must be a string or undefined."):s.length>50&&n?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}return s}})}var rr=class t extends Error{$fault;$response;$retryable;$metadata;constructor(e){super(e.message),Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}static isInstance(e){if(!e)return!1;let r=e;return t.prototype.isPrototypeOf(r)||!!r.$fault&&!!r.$metadata&&(r.$fault==="client"||r.$fault==="server")}static[Symbol.hasInstance](e){if(!e)return!1;let r=e;return this===t?t.isInstance(e):t.isInstance(e)?r.name&&this.name?this.prototype.isPrototypeOf(e)||r.name===this.name:this.prototype.isPrototypeOf(e):!1}},st=(t,e={})=>{Object.entries(e).filter(([,s])=>s!==void 0).forEach(([s,n])=>{(t[s]==null||t[s]==="")&&(t[s]=n)});let r=t.message||t.Message||"UnknownError";return t.message=r,delete t.Message,t};var sr=class{capacity;data=new Map;parameters=[];constructor({size:e,params:r}){this.capacity=e??50,r&&(this.parameters=r)}get(e,r){let s=this.hash(e);if(s===!1)return r();if(!this.data.has(s)){if(this.data.size>this.capacity+10){let n=this.data.keys(),o=0;for(;;){let{value:i,done:a}=n.next();if(this.data.delete(i),a||++o>10)break}}this.data.set(s,r())}return this.data.get(s)}size(){return this.data.size}hash(e){let r="",{parameters:s}=this;if(s.length===0)return!1;for(let n of s){let o=String(e[n]??"");if(o.includes("|;"))return!1;r+=o+"|;"}return r}};var Tn=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}$"),ae=t=>Tn.test(t)||t.startsWith("[")&&t.endsWith("]");var _n=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),j=(t,e=!1)=>{if(!e)return _n.test(t);let r=t.split(".");for(let s of r)if(!j(s))return!1;return!0};var ce={};var M="endpoints";function _(t){return typeof t!="object"||t==null?t:"ref"in t?`$${_(t.ref)}`:"fn"in t?`${t.fn}(${(t.argv||[]).map(_).join(", ")})`:JSON.stringify(t,null,2)}var S=class extends Error{constructor(e){super(e),this.name="EndpointError"}};var nr=(t,e)=>t===e;var or=t=>{let e=t.split("."),r=[];for(let s of e){let n=s.indexOf("[");if(n!==-1){if(s.indexOf("]")!==s.length-1)throw new S(`Path: '${t}' does not end with ']'`);let o=s.slice(n+1,-1);if(Number.isNaN(parseInt(o)))throw new S(`Invalid array index: '${o}' in path: '${t}'`);n!==0&&r.push(s.slice(0,n)),r.push(o)}else r.push(s)}return r};var Se=(t,e)=>or(e).reduce((r,s)=>{if(typeof r!="object")throw new S(`Index '${s}' in '${e}' not found in '${JSON.stringify(t)}'`);return Array.isArray(r)?r[parseInt(s)]:r[s]},t);var ir=t=>t!=null;var ar=t=>!t;var nt={[K.HTTP]:80,[K.HTTPS]:443},cr=t=>{let e=(()=>{try{if(t instanceof URL)return t;if(typeof t=="object"&&"hostname"in t){let{hostname:l,port:p,protocol:h="",path:g="",query:m={}}=t,E=new URL(`${h}//${l}${p?`:${p}`:""}${g}`);return E.search=Object.entries(m).map(([y,C])=>`${y}=${C}`).join("&"),E}return new URL(t)}catch{return null}})();if(!e)return console.error(`Unable to parse ${JSON.stringify(t)} as a whatwg URL.`),null;let r=e.href,{host:s,hostname:n,pathname:o,protocol:i,search:a}=e;if(a)return null;let c=i.slice(0,-1);if(!Object.values(K).includes(c))return null;let d=ae(n),f=r.includes(`${s}:${nt[c]}`)||typeof t=="string"&&t.includes(`${s}:${nt[c]}`),u=`${s}${f?`:${nt[c]}`:""}`;return{scheme:c,authority:u,path:o,normalizedPath:o.endsWith("/")?o:`${o}/`,isIp:d}};var ur=(t,e)=>t===e;var dr=(t,e,r,s)=>e>=r||t.length<r||/[^\u0000-\u007f]/.test(t)?null:s?t.substring(t.length-r,t.length-e):t.substring(e,r);var lr=t=>encodeURIComponent(t).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`);var pr={booleanEquals:nr,getAttr:Se,isSet:ir,isValidHostLabel:j,not:ar,parseURL:cr,stringEquals:ur,substring:dr,uriEncode:lr};var ye=(t,e)=>{let r=[],s={...e.endpointParams,...e.referenceRecord},n=0;for(;n<t.length;){let o=t.indexOf("{",n);if(o===-1){r.push(t.slice(n));break}r.push(t.slice(n,o));let i=t.indexOf("}",o);if(i===-1){r.push(t.slice(o));break}t[o+1]==="{"&&t[i+1]==="}"&&(r.push(t.slice(o+1,i)),n=i+2);let a=t.substring(o+1,i);if(a.includes("#")){let[c,d]=a.split("#");r.push(Se(s[c],d))}else r.push(s[a]);n=i+1}return r.join("")};var fr=({ref:t},e)=>({...e.endpointParams,...e.referenceRecord})[t];var G=(t,e,r)=>{if(typeof t=="string")return ye(t,r);if(t.fn)return mr.callFunction(t,r);if(t.ref)return fr(t,r);throw new S(`'${e}': ${String(t)} is not a string, function or reference.`)},Re=({fn:t,argv:e},r)=>{let s=e.map(o=>["boolean","number"].includes(typeof o)?o:mr.evaluateExpression(o,"arg",r)),n=t.split(".");return n[0]in ce&&n[1]!=null?ce[n[0]][n[1]](...s):pr[t](...s)},mr={evaluateExpression:G,callFunction:Re};var hr=({assign:t,...e},r)=>{if(t&&t in r.referenceRecord)throw new S(`'${t}' is already defined in Reference Record.`);let s=Re(e,r);return r.logger?.debug?.(`${M} evaluateCondition: ${_(e)} = ${_(s)}`),{result:s===""?!0:!!s,...t!=null&&{toAssign:{name:t,value:s}}}};var J=(t=[],e)=>{let r={};for(let s of t){let{result:n,toAssign:o}=hr(s,{...e,referenceRecord:{...e.referenceRecord,...r}});if(!n)return{result:n};o&&(r[o.name]=o.value,e.logger?.debug?.(`${M} assign: ${o.name} := ${_(o.value)}`))}return{result:!0,referenceRecord:r}};var gr=(t,e)=>Object.entries(t).reduce((r,[s,n])=>({...r,[s]:n.map(o=>{let i=G(o,"Header value entry",e);if(typeof i!="string")throw new S(`Header '${s}' value '${i}' is not a string`);return i})}),{});var ot=(t,e)=>Object.entries(t).reduce((r,[s,n])=>({...r,[s]:Sr.getEndpointProperty(n,e)}),{}),Er=(t,e)=>{if(Array.isArray(t))return t.map(r=>Er(r,e));switch(typeof t){case"string":return ye(t,e);case"object":if(t===null)throw new S(`Unexpected endpoint property: ${t}`);return Sr.getEndpointProperties(t,e);case"boolean":return t;default:throw new S(`Unexpected endpoint property type: ${typeof t}`)}},Sr={getEndpointProperty:Er,getEndpointProperties:ot};var yr=(t,e)=>{let r=G(t,"Endpoint URL",e);if(typeof r=="string")try{return new URL(r)}catch(s){throw console.error(`Failed to construct URL with ${r}`,s),s}throw new S(`Endpoint URL must be a string, got ${typeof r}`)};var Rr=(t,e)=>{let{conditions:r,endpoint:s}=t,{result:n,referenceRecord:o}=J(r,e);if(!n)return;let i={...e,referenceRecord:{...e.referenceRecord,...o}},{url:a,properties:c,headers:d}=s;return e.logger?.debug?.(`${M} Resolving endpoint from template: ${_(s)}`),{...d!=null&&{headers:gr(d,i)},...c!=null&&{properties:ot(c,i)},url:yr(a,i)}};var wr=(t,e)=>{let{conditions:r,error:s}=t,{result:n,referenceRecord:o}=J(r,e);if(n)throw new S(G(s,"Error",{...e,referenceRecord:{...e.referenceRecord,...o}}))};var it=(t,e)=>{for(let r of t)if(r.type==="endpoint"){let s=Rr(r,e);if(s)return s}else if(r.type==="error")wr(r,e);else if(r.type==="tree"){let s=Ar.evaluateTreeRule(r,e);if(s)return s}else throw new S(`Unknown endpoint rule: ${r}`);throw new S("Rules evaluation failed")},xn=(t,e)=>{let{conditions:r,rules:s}=t,{result:n,referenceRecord:o}=J(r,e);if(n)return Ar.evaluateRules(s,{...e,referenceRecord:{...e.referenceRecord,...o}})},Ar={evaluateRules:it,evaluateTreeRule:xn};var Vc=(t,e)=>{let{endpointParams:r,logger:s}=e,{parameters:n,rules:o}=t;e.logger?.debug?.(`${M} Initial EndpointParams: ${_(r)}`);let i=Object.entries(n).filter(([,d])=>d.default!=null).map(([d,f])=>[d,f.default]);if(i.length>0)for(let[d,f]of i)r[d]=r[d]??f;let a=Object.entries(n).filter(([,d])=>d.required).map(([d])=>d);for(let d of a)if(r[d]==null)throw new S(`Missing required parameter: '${d}'`);let c=it(o,{endpointParams:r,logger:s,referenceRecord:{}});return e.logger?.debug?.(`${M} Resolved endpoint: ${_(c)}`),c};var at=(t,e=!1)=>{if(e){for(let r of t.split("."))if(!at(r))return!1;return!0}return!(!j(t)||t.length<3||t.length>63||t!==t.toLowerCase()||ae(t))};var Tr=t=>{let e=t.split(":");if(e.length<6)return null;let[r,s,n,o,i,...a]=e;if(r!=="arn"||s===""||n===""||a.join(":")==="")return null;let c=a.map(d=>d.split("/")).flat();return{partition:s,service:n,region:o,accountId:i,resourceId:c}};var _r={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 In=_r,bn="",xr=t=>{let{partitions:e}=In;for(let s of e){let{regions:n,outputs:o}=s;for(let[i,a]of Object.entries(n))if(i===t)return{...o,...a}}for(let s of e){let{regionRegex:n,outputs:o}=s;if(new RegExp(n).test(t))return{...o}}let r=e.find(s=>s.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 Cr=()=>bn;var vn={isVirtualHostableS3Bucket:at,parseArn:Tr,partition:xr};ce.aws=vn;var Ir={warningEmitted:!1},Au=t=>{t&&!Ir.warningEmitted&&parseInt(t.substring(1,t.indexOf(".")))<20&&(Ir.warningEmitted=!0,process.emitWarning(`NodeDeprecationWarning: The AWS SDK for JavaScript (v3) will
4
4
  no longer support Node.js ${t} in January 2026.
5
5
 
6
6
  To continue receiving updates to AWS services, bug fixes, and security
@@ -17,4 +17,4 @@ ${s}`}async createStringToSign(e,r,s,n){let o=new this.sha256;o.update(I(s));let
17
17
  ${e}
18
18
  ${r}
19
19
  ${T(i)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){let r=[];for(let o of e.split("/"))o?.length!==0&&o!=="."&&(o===".."?r.pop():r.push(o));let s=`${e?.startsWith("/")?"/":""}${r.join("/")}${r.length>0&&e?.endsWith("/")?"/":""}`;return W(s).replace(/%2F/g,"/")}return e}validateResolvedCredentials(e){if(typeof e!="object"||typeof e.accessKeyId!="string"||typeof e.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}formatDate(e){let r=es(e).replace(/[\-:]/g,"");return{longDate:r,shortDate:r.slice(0,8)}}getCanonicalHeaderList(e){return Object.keys(e).sort().join(";")}};var le=class extends Ie{headerFormatter=new Ce;constructor({applyChecksum:e,credentials:r,region:s,service:n,sha256:o,uriEscapePath:i=!0}){super({applyChecksum:e,credentials:r,region:s,service:n,sha256:o,uriEscapePath:i})}async presign(e,r={}){let{signingDate:s=new Date,expiresIn:n=3600,unsignableHeaders:o,unhoistableHeaders:i,signableHeaders:a,hoistableHeaders:c,signingRegion:d,signingService:f}=r,u=await this.credentialProvider();this.validateResolvedCredentials(u);let l=d??await this.regionProvider(),{longDate:p,shortDate:h}=this.formatDate(s);if(n>Wr)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let g=_e(h,l,f??this.service),m=Jr(wt(e),{unhoistableHeaders:i,hoistableHeaders:c});u.sessionToken&&(m.query[mt]=u.sessionToken),m.query[Pr]=Ae,m.query[Mr]=`${u.accessKeyId}/${g}`,m.query[pt]=p,m.query[Ur]=n.toString(10);let E=yt(m,o,a);return m.query[kr]=this.getCanonicalHeaderList(E),m.query[ft]=await this.getSignature(p,g,this.getSigningKey(u,l,h,f),this.createCanonicalRequest(m,E,await xe(e,this.sha256))),m}async sign(e,r){return typeof e=="string"?this.signString(e,r):e.headers&&e.payload?this.signEvent(e,r):e.message?this.signMessage(e,r):this.signRequest(e,r)}async signEvent({headers:e,payload:r},{signingDate:s=new Date,priorSignature:n,signingRegion:o,signingService:i}){let a=o??await this.regionProvider(),{shortDate:c,longDate:d}=this.formatDate(s),f=_e(c,a,i??this.service),u=await xe({headers:{},body:r},this.sha256),l=new this.sha256;l.update(e);let p=T(await l.digest()),h=[Vr,d,f,n,p,u].join(`
20
- `);return this.signString(h,{signingDate:s,signingRegion:a,signingService:i})}async signMessage(e,{signingDate:r=new Date,signingRegion:s,signingService:n}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:r,signingRegion:s,signingService:n,priorSignature:e.priorSignature}).then(i=>({message:e.message,signature:i}))}async signString(e,{signingDate:r=new Date,signingRegion:s,signingService:n}={}){let o=await this.credentialProvider();this.validateResolvedCredentials(o);let i=s??await this.regionProvider(),{shortDate:a}=this.formatDate(r),c=new this.sha256(await this.getSigningKey(o,i,a,n));return c.update(I(e)),T(await c.digest())}async signRequest(e,{signingDate:r=new Date,signableHeaders:s,unsignableHeaders:n,signingRegion:o,signingService:i}={}){let a=await this.credentialProvider();this.validateResolvedCredentials(a);let c=o??await this.regionProvider(),d=wt(e),{longDate:f,shortDate:u}=this.formatDate(r),l=_e(u,c,i??this.service);d.headers[gt]=f,a.sessionToken&&(d.headers[Fr]=a.sessionToken);let p=await xe(d,this.sha256);!Qr(de,d.headers)&&this.applyChecksum&&(d.headers[de]=p);let h=yt(d,n,s),g=await this.getSignature(f,l,this.getSigningKey(a,c,u,i),this.createCanonicalRequest(d,h,p));return d.headers[ht]=`${Ae} Credential=${a.accessKeyId}/${l}, SignedHeaders=${this.getCanonicalHeaderList(h)}, Signature=${g}`,d}async getSignature(e,r,s,n){let o=await this.createStringToSign(e,r,n,Ae),i=new this.sha256(await s);return i.update(I(o)),T(await i.digest())}getSigningKey(e,r,s,n){return Yr(this.sha256,e,s,r,n||this.service)}};var Md=t=>{let e=t.credentials,r=!!t.credentials,s;Object.defineProperty(t,"credentials",{set(d){d&&d!==e&&d!==s&&(r=!0),e=d;let f=Pn(t,{credentials:e,credentialDefaultProvider:t.credentialDefaultProvider}),u=Mn(t,f);if(r&&!u.attributed){let l=typeof e=="object"&&e!==null;s=async p=>{let g=await u(p);return l&&(!g.$source||Object.keys(g.$source).length===0)?kt(g,"CREDENTIALS_CODE","e"):g},s.memoized=u.memoized,s.configBound=u.configBound,s.attributed=!0}else s=u},get(){return s},enumerable:!0,configurable:!0}),t.credentials=e;let{signingEscapePath:n=!0,systemClockOffset:o=t.systemClockOffset||0,sha256:i}=t,a;return t.signer?a=V(t.signer):t.regionInfoProvider?a=()=>V(t.region)().then(async d=>[await t.regionInfoProvider(d,{useFipsEndpoint:await t.useFipsEndpoint(),useDualstackEndpoint:await t.useDualstackEndpoint()})||{},d]).then(([d,f])=>{let{signingRegion:u,signingService:l}=d;t.signingRegion=t.signingRegion||u||f,t.signingName=t.signingName||l||t.serviceId;let p={...t,credentials:t.credentials,region:t.signingRegion,service:t.signingName,sha256:i,uriEscapePath:n},h=t.signerConstructor||le;return new h(p)}):a=async d=>{d=Object.assign({},{name:"sigv4",signingName:t.signingName||t.defaultSigningName,signingRegion:await V(t.region)(),properties:{}},d);let f=d.signingRegion,u=d.signingName;t.signingRegion=t.signingRegion||f,t.signingName=t.signingName||u||t.serviceId;let l={...t,credentials:t.credentials,region:t.signingRegion,service:t.signingName,sha256:i,uriEscapePath:n},p=t.signerConstructor||le;return new p(l)},Object.assign(t,{systemClockOffset:o,signingEscapePath:n,signer:a})};function Pn(t,{credentials:e,credentialDefaultProvider:r}){let s;return e?e?.memoized?s=e:s=tr(e,er,tt):r?s=V(r(Object.assign({},t,{parentClientConfig:t}))):s=async()=>{throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")},s.memoized=!0,s}function Mn(t,e){if(e.configBound)return e;let r=async s=>e({...s,callerClientConfig:t});return r.memoized=e.memoized,r.configBound=!0,r}var Bd=t=>{switch(t){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 ts=!1,jd=t=>{t&&!ts&&parseInt(t.substring(1,t.indexOf(".")))<16&&(ts=!0)};var rs=Object.values(H),ss=t=>{let e=[];for(let r in H){let s=H[r];t[s]!==void 0&&e.push({algorithmId:()=>s,checksumConstructor:()=>t[s]})}for(let[r,s]of Object.entries(t.checksumAlgorithms??{}))e.push({algorithmId:()=>r,checksumConstructor:()=>s});return{addChecksumAlgorithm(r){t.checksumAlgorithms=t.checksumAlgorithms??{};let s=r.algorithmId(),n=r.checksumConstructor();rs.includes(s)?t.checksumAlgorithms[s.toUpperCase()]=n:t.checksumAlgorithms[s]=n,e.push(r)},checksumAlgorithms(){return e}}},ns=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{let s=r.algorithmId();rs.includes(s)&&(e[s]=r.checksumConstructor())}),e};var os=t=>({setRetryStrategy(e){t.retryStrategy=e},retryStrategy(){return t.retryStrategy}}),is=t=>{let e={};return e.retryStrategy=t.retryStrategy(),e};var Qd=t=>Object.assign(ss(t),os(t));var Jd=t=>Object.assign(ns(t),is(t));var be=class{trace(){}debug(){}info(){}warn(){}error(){}};var as=class{queryCompat;errorRegistry;constructor(e=!1){this.queryCompat=e}resolveRestContentType(e,r){let s=r.getMemberSchemas(),n=Object.values(s).find(o=>!!o.getMergedTraits().httpPayload);if(n){let o=n.getMergedTraits().mediaType;return o||(n.isStringSchema()?"text/plain":n.isBlobSchema()?"application/octet-stream":e)}else if(!r.isUnitSchema()&&Object.values(s).find(i=>{let{httpQuery:a,httpQueryParams:c,httpHeader:d,httpLabel:f,httpPrefixHeaders:u}=i.getMergedTraits();return!a&&!c&&!d&&!f&&u===void 0}))return e}async getErrorSchemaOrThrowBaseException(e,r,s,n,o,i){let a=e;e.includes("#")&&([,a]=e.split("#"));let c={$metadata:o,$fault:s.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(e),errorMetadata:c}}catch{n.message=n.message??n.Message??"UnknownError";let f=this.errorRegistry,u=f.getBaseException();if(u){let h=f.getErrorCtor(u)??Error;throw this.decorateServiceException(Object.assign(new h({name:a}),c),n)}let l=n,p=l?.message??l?.Message??l?.Error?.Message??l?.Error?.message;throw this.decorateServiceException(Object.assign(new Error(p),{name:a},c),n)}}compose(e,r,s){let n=s;r.includes("#")&&([n]=r.split("#"));let o=B.for(n),i=B.for("smithy.ts.sdk.synthetic."+s);e.copyFrom(o),e.copyFrom(i),this.errorRegistry=e}decorateServiceException(e,r={}){if(this.queryCompat){let s=e.Message??r.Message,n=st(e,r);s&&(n.message=s),n.Error={...n.Error,Type:n.Error?.Type,Code:n.Error?.Code,Message:n.Error?.message??n.Error?.Message??s};let o=n.$metadata.requestId;return o&&(n.RequestId=o),n}return st(e,r)}setQueryCompatError(e,r){let s=r.headers?.["x-amzn-query-error"];if(e!==void 0&&s!=null){let[n,o]=s.split(";"),i=Object.entries(e),a={Code:n,Type:o};Object.assign(e,a);for(let[c,d]of i)a[c==="message"?"Message":c]=d;delete a.__type,e.Error=a}}queryCompatOutput(e,r){e.Error&&(r.Error=e.Error),e.Type&&(r.Type=e.Type),e.Code&&(r.Code=e.Code)}findQueryCompatibleError(e,r){try{return e.getSchema(r)}catch{return e.find(n=>N.of(n).getMergedTraits().awsQueryError?.[0]===r)}}};var cs=class{serdeContext;setSerdeContext(e){this.serdeContext=e}};var us=class{from;to;keys;constructor(e,r){this.from=e,this.to=r,this.keys=new Set(Object.keys(this.from).filter(s=>s!=="__type"))}mark(e){this.keys.delete(e)}hasUnknown(){return this.keys.size===1&&Object.keys(this.to).length===0}writeUnknown(){if(this.hasUnknown()){let e=this.keys.values().next().value,r=this.from[e];this.to.$unknown=[e,r]}}};var x;(function(t){t.STANDARD="standard",t.ADAPTIVE="adaptive"})(x||(x={}));var Z=3,ds=x.STANDARD;var ls=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],ps=["TimeoutError","RequestTimeout","RequestTimeoutException"],fs=[500,502,503,504],ms=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],hs=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND"];var kn=t=>t?.$retryable!==void 0;var Un=t=>t.$metadata?.clockSkewCorrected,$n=t=>{let e=new Set(["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Load failed","Network request failed"]);return t&&t instanceof TypeError?e.has(t.message):!1},ve=t=>t.$metadata?.httpStatusCode===429||ls.includes(t.name)||t.$retryable?.throttling==!0,Ne=(t,e=0)=>kn(t)||Un(t)||ps.includes(t.name)||ms.includes(t?.code||"")||hs.includes(t?.code||"")||fs.includes(t.$metadata?.httpStatusCode||0)||$n(t)||t.cause!==void 0&&e<=10&&Ne(t.cause,e+1),gs=t=>{if(t.$metadata?.httpStatusCode!==void 0){let e=t.$metadata.httpStatusCode;return 500<=e&&e<=599&&!Ne(t)}return!1};var Oe=class t{static setTimeoutFn=setTimeout;beta;minCapacity;minFillRate;scaleConstant;smooth;currentCapacity=0;enabled=!1;lastMaxRate=0;measuredTxRate=0;requestCount=0;fillRate;lastThrottleTime;lastTimestamp=0;lastTxRateBucket;maxCapacity;timeWindow=0;constructor(e){this.beta=e?.beta??.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??.5,this.scaleConstant=e?.scaleConstant??.4,this.smooth=e?.smooth??.8;let r=this.getCurrentTimeInSeconds();this.lastThrottleTime=r,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1e3}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(e){if(this.enabled){if(this.refillTokenBucket(),e>this.currentCapacity){let r=(e-this.currentCapacity)/this.fillRate*1e3;await new Promise(s=>t.setTimeoutFn(s,r))}this.currentCapacity=this.currentCapacity-e}}refillTokenBucket(){let e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=e;return}let r=(e-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+r),this.lastTimestamp=e}updateClientSendingRate(e){let r;if(this.updateMeasuredRate(),ve(e)){let n=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=n,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),r=this.cubicThrottle(n),this.enableTokenBucket()}else this.calculateTimeWindow(),r=this.cubicSuccess(this.getCurrentTimeInSeconds());let s=Math.min(r,2*this.measuredTxRate);this.updateTokenBucketRate(s)}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.currentCapacity=Math.min(this.currentCapacity,this.maxCapacity)}updateMeasuredRate(){let e=this.getCurrentTimeInSeconds(),r=Math.floor(e*2)/2;if(this.requestCount++,r>this.lastTxRateBucket){let s=this.requestCount/(r-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(s*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=r}}getPrecise(e){return parseFloat(e.toFixed(8))}};var Es="amz-sdk-invocation-id",Ss="amz-sdk-request";var Rs=()=>{let t=100;return{computeNextBackoffDelay:s=>Math.floor(Math.min(2e4,Math.random()*2**s*t)),setDelayBase:s=>{t=s}}};var At=({retryDelay:t,retryCount:e,retryCost:r})=>({getRetryCount:()=>e,getRetryDelay:()=>Math.min(2e4,t),getRetryCost:()=>r});var ee=class{maxAttempts;mode=x.STANDARD;capacity=500;retryBackoffStrategy=Rs();maxAttemptsProvider;constructor(e){this.maxAttempts=e,this.maxAttemptsProvider=typeof e=="function"?e:async()=>e}async acquireInitialRetryToken(e){return At({retryDelay:100,retryCount:0})}async refreshRetryTokenForRetry(e,r){let s=await this.getMaxAttempts();if(this.shouldRetry(e,r,s)){let n=r.errorType;this.retryBackoffStrategy.setDelayBase(n==="THROTTLING"?500:100);let o=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),i=r.retryAfterHint?Math.max(r.retryAfterHint.getTime()-Date.now()||0,o):o,a=this.getCapacityCost(n);return this.capacity-=a,At({retryDelay:i,retryCount:e.getRetryCount()+1,retryCost:a})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.max(500,this.capacity+(e.getRetryCost()??1))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn(`Max attempts provider could not resolve. Using default of ${Z}`),Z}}shouldRetry(e,r,s){return e.getRetryCount()+1<s&&this.capacity>=this.getCapacityCost(r.errorType)&&this.isRetryableError(r.errorType)}getCapacityCost(e){return e==="TRANSIENT"?10:5}isRetryableError(e){return e==="THROTTLING"||e==="TRANSIENT"}};var De=class{maxAttemptsProvider;rateLimiter;standardRetryStrategy;mode=x.ADAPTIVE;constructor(e,r){this.maxAttemptsProvider=e;let{rateLimiter:s}=r??{};this.rateLimiter=s??new Oe,this.standardRetryStrategy=new ee(e)}async acquireInitialRetryToken(e){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(e)}async refreshRetryTokenForRetry(e,r){return this.rateLimiter.updateClientSendingRate(r),this.standardRetryStrategy.refreshRetryTokenForRetry(e,r)}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}};var Hn=/\d{12}\.ddb/;async function ws(t,e,r){if(r.request?.headers?.["smithy-protocol"]==="rpc-v2-cbor"&&O(t,"PROTOCOL_RPC_V2_CBOR","M"),typeof e.retryStrategy=="function"){let o=await e.retryStrategy();if(typeof o.mode=="string")switch(o.mode){case x.ADAPTIVE:O(t,"RETRY_MODE_ADAPTIVE","F");break;case x.STANDARD:O(t,"RETRY_MODE_STANDARD","E");break}}if(typeof e.accountIdEndpointMode=="function"){let o=t.endpointV2;switch(String(o?.url?.hostname).match(Hn)&&O(t,"ACCOUNT_ID_ENDPOINT","O"),await e.accountIdEndpointMode?.()){case"disabled":O(t,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":O(t,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":O(t,"ACCOUNT_ID_MODE_REQUIRED","R");break}}let n=t.__smithy_context?.selectedHttpAuthScheme?.identity;if(n?.$source){let o=n;o.accountId&&O(t,"RESOLVED_ACCOUNT_ID","T");for(let[i,a]of Object.entries(o.$source??{}))O(t,i,a)}}var Tt="user-agent",Pe="x-amz-user-agent";var As=/[^!$%&'*+\-.^_`|~\w]/g,Ts=/[^!$%&'*+\-.^_`|~\w#]/g;function _s(t){let e="";for(let r in t){let s=t[r];if(e.length+s.length+1<=1024){e.length?e+=","+s:e+=s;continue}break}return e}var zn=t=>(e,r)=>async s=>{let{request:n}=s;if(!R.isInstance(n))return e(s);let{headers:o}=n,i=r?.userAgent?.map(Me)||[],a=(await t.defaultUserAgentProvider()).map(Me);await ws(r,t,s);let c=r;a.push(`m/${_s(Object.assign({},r.__smithy_context?.features,c.__aws_sdk_context?.features))}`);let d=t?.customUserAgent?.map(Me)||[],f=await t.userAgentAppId();f&&a.push(Me(["app",`${f}`]));let u=Cr(),l=(u?[u]:[]).concat([...a,...i,...d]).join(" "),p=[...a.filter(h=>h.startsWith("aws-sdk-")),...d].join(" ");return t.runtime!=="browser"?(p&&(o[Pe]=o[Pe]?`${o[Tt]} ${p}`:p),o[Tt]=l):o[Pe]=l,e({...s,request:n})},Me=t=>{let e=t[0].split("/").map(i=>i.replace(As,"-")).join("/"),r=t[1]?.replace(Ts,"-"),s=e.indexOf("/"),n=e.substring(0,s),o=e.substring(s+1);return n==="api"&&(o=o.toLowerCase()),[n,o,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}`}},"")},Bn={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},Ll=t=>({applyToStack:e=>{e.add(zn(t),Bn)}});var Is=new Set,bs=(t,e=j)=>{if(!Is.has(t)&&!e(t))if(t==="*")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="${t}" is not a valid hostname component.`);else Is.add(t)};var ke=t=>typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips"));var vs=t=>ke(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t;var Yl=t=>{let{region:e,useFipsEndpoint:r}=t;if(!e)throw new Error("Region is missing");return Object.assign(t,{region:async()=>{let s=typeof e=="function"?await e():e,n=vs(s);return bs(n),n},useFipsEndpoint:async()=>{let s=typeof e=="string"?e:await e();return ke(s)?!0:typeof r!="function"?Promise.resolve(!!r):r()}})};var Ns="content-length";function Vn(t){return e=>async r=>{let s=r.request;if(R.isInstance(s)){let{body:n,headers:o}=s;if(n&&Object.keys(o).map(i=>i.toLowerCase()).indexOf(Ns)===-1)try{let i=t(n);s.headers={...s.headers,[Ns]:String(i)}}catch{}}return e({...r,request:s})}}var jn={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},Ql=t=>({applyToStack:e=>{e.add(Vn(t.bodyLengthChecker),jn)}});var Os={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};var Ds=async t=>{let e=t?.Bucket||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),Kn(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!Yn(e)||e.indexOf(".")!==-1&&!String(t.Endpoint).startsWith("http:")||e.toLowerCase()!==e||e.length<3)&&(t.ForcePathStyle=!0);return t.DisableMultiRegionAccessPoints&&(t.disableMultiRegionAccessPoints=!0,t.DisableMRAP=!0),t},Gn=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,Wn=/(\d+\.){3}\d+/,qn=/\.\./;var Yn=t=>Gn.test(t)&&!Wn.test(t)&&!qn.test(t),Kn=t=>{let[e,r,s,,,n]=t.split(":"),o=e==="arn"&&t.split(":").length>=6,i=!!(o&&r&&s&&n);if(o&&!i)throw new Error(`Invalid ARN: ${t} was an invalid ARN.`);return i};var Ps=(t,e,r,s=!1)=>{let n=async()=>{let o;return s?o=r.clientContextParams?.[t]??r[t]??r[e]:o=r[t]??r[e],typeof o=="function"?o():o};return t==="credentialScope"||e==="CredentialScope"?async()=>{let o=typeof r.credentials=="function"?await r.credentials():r.credentials;return o?.credentialScope??o?.CredentialScope}:t==="accountId"||e==="AccountId"?async()=>{let o=typeof r.credentials=="function"?await r.credentials():r.credentials;return o?.accountId??o?.AccountId}:t==="endpoint"||e==="endpoint"?async()=>{if(r.isCustomEndpoint===!1)return;let o=await n();if(o&&typeof o=="object"){if("url"in o)return o.url.href;if("hostname"in o){let{protocol:i,hostname:a,port:c,path:d}=o;return`${i}//${a}${c?":"+c:""}${d}`}}return o}:n};var Ms="AWS_ENDPOINT_URL",ks="endpoint_url",Us=t=>({environmentVariableSelector:e=>{let r=t.split(" ").map(o=>o.toUpperCase()),s=e[[Ms,...r].join("_")];if(s)return s;let n=e[Ms];if(n)return n},configFileSelector:(e,r)=>{if(r&&e.services){let n=r[["services",e.services].join(".")];if(n){let o=t.split(" ").map(a=>a.toLowerCase()),i=n[[o.join("_"),ks].join(".")];if(i)return i}}let s=e[ks];if(s)return s},default:void 0});var Ue=async t=>re(Us(t??""))();var $e=t=>{if(typeof t=="object"){if("url"in t){let e=q(t.url);if(t.headers){e.headers={};for(let[r,s]of Object.entries(t.headers))e.headers[r.toLowerCase()]=s.join(", ")}return e}return t}return q(t)};var $s=async(t,e,r,s)=>{if(!r.isCustomEndpoint){let i;r.serviceConfiguredEndpoint?i=await r.serviceConfiguredEndpoint():i=await Ue(r.serviceId),i&&(r.endpoint=()=>Promise.resolve($e(i)),r.isCustomEndpoint=!0)}let n=await Qn(t,e,r);if(typeof r.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");let o=r.endpointProvider(n,s);if(r.isCustomEndpoint&&r.endpoint){let i=await r.endpoint();if(i?.headers){o.headers??={};for(let[a,c]of Object.entries(i.headers))o.headers[a]=Array.isArray(c)?c:[c]}}return o},Qn=async(t,e,r)=>{let s={},n=e?.getEndpointParameterInstructions?.()||{};for(let[o,i]of Object.entries(n))switch(i.type){case"staticContextParams":s[o]=i.value;break;case"contextParams":s[o]=t[i.name];break;case"clientContextParams":case"builtInParams":s[o]=await Ps(i.name,o,r,i.type!=="builtInParams")();break;case"operationContextParams":s[o]=i.get(t);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(i))}return Object.keys(n).length===0&&Object.assign(s,r),String(r.serviceId).toLowerCase()==="s3"&&await Ds(s),s};var Ls=({config:t,instructions:e})=>(r,s)=>async n=>{t.isCustomEndpoint&&Zt(s,"ENDPOINT_OVERRIDE","N");let o=await $s(n.input,{getEndpointParameterInstructions(){return e}},{...t},s);s.endpointV2=o,s.authSchemes=o.properties?.authSchemes;let i=s.authSchemes?.[0];if(i){s.signing_region=i.signingRegion,s.signing_service=i.signingName;let c=b(s)?.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 Jn={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:Os.name},yp=(t,e)=>({applyToStack:r=>{r.addRelativeTo(Ls({config:t,instructions:e}),Jn)}});var _p=t=>{let e=t.tls??!0,{endpoint:r,useDualstackEndpoint:s,useFipsEndpoint:n}=t,o=r!=null?async()=>$e(await v(r)()):void 0,a=Object.assign(t,{endpoint:o,tls:e,isCustomEndpoint:!!r,useDualstackEndpoint:v(s??!1),useFipsEndpoint:v(n??!1)}),c;return a.serviceConfiguredEndpoint=async()=>(t.serviceId&&!c&&(c=Ue(t.serviceId)),c),a};var Fs="AWS_MAX_ATTEMPTS",Hs="max_attempts",bp={environmentVariableSelector:t=>{let e=t[Fs];if(!e)return;let r=parseInt(e);if(Number.isNaN(r))throw new Error(`Environment variable ${Fs} mast be a number, got "${e}"`);return r},configFileSelector:t=>{let e=t[Hs];if(!e)return;let r=parseInt(e);if(Number.isNaN(r))throw new Error(`Shared config file entry ${Hs} mast be a number, got "${e}"`);return r},default:Z},vp=t=>{let{retryStrategy:e,retryMode:r}=t,s=v(t.maxAttempts??Z),n=e?Promise.resolve(e):void 0,o=async()=>await v(r)()===x.ADAPTIVE?new De(s):new ee(s);return Object.assign(t,{maxAttempts:s,retryStrategy:()=>n??=o()})},Zn="AWS_RETRY_MODE",eo="retry_mode",Np={environmentVariableSelector:t=>t[Zn],configFileSelector:t=>t[eo],default:ds};import{Readable as to}from"stream";var zs=t=>t?.body instanceof to||typeof ReadableStream<"u"&&t?.body instanceof ReadableStream;var Bs=t=>t instanceof Error?t:t instanceof Object?Object.assign(new Error,t):typeof t=="string"?new Error(t):new Error(`AWS SDK error wrapper for ${t}`);var ro=t=>(e,r)=>async s=>{let n=await t.retryStrategy(),o=await t.maxAttempts();if(so(n)){n=n;let i=await n.acquireInitialRetryToken(r.partition_id),a=new Error,c=0,d=0,{request:f}=s,u=R.isInstance(f);for(u&&(f.headers[Es]=et());;)try{u&&(f.headers[Ss]=`attempt=${c+1}; max=${o}`);let{response:l,output:p}=await e(s);return n.recordSuccess(i),p.$metadata.attempts=c+1,p.$metadata.totalRetryDelay=d,{response:l,output:p}}catch(l){let p=no(l);if(a=Bs(l),u&&zs(f))throw(r.logger instanceof be?console:r.logger)?.warn("An error was encountered in a non-retryable streaming request."),a;try{i=await n.refreshRetryTokenForRetry(i,p)}catch{throw a.$metadata||(a.$metadata={}),a.$metadata.attempts=c+1,a.$metadata.totalRetryDelay=d,a}c=i.getRetryCount();let h=i.getRetryDelay();d+=h,await new Promise(g=>setTimeout(g,h))}}else return n=n,n?.mode&&(r.userAgent=[...r.userAgent||[],["cfg/retry-mode",n.mode]]),n.retry(e,s)},so=t=>typeof t.acquireInitialRetryToken<"u"&&typeof t.refreshRetryTokenForRetry<"u"&&typeof t.recordSuccess<"u",no=t=>{let e={error:t,errorType:oo(t)},r=ao(t.$response);return r&&(e.retryAfterHint=r),e},oo=t=>ve(t)?"THROTTLING":Ne(t)?"TRANSIENT":gs(t)?"SERVER_ERROR":"CLIENT_ERROR",io={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},Bp=t=>({applyToStack:e=>{e.add(ro(t),io)}}),ao=t=>{if(!k.isInstance(t))return;let e=Object.keys(t.headers).find(o=>o.toLowerCase()==="retry-after");if(!e)return;let r=t.headers[e],s=Number(r);return Number.isNaN(s)?new Date(r):new Date(s*1e3)};var $=(t,e,r)=>{if(e in t){if(t[e]==="true")return!0;if(t[e]==="false")return!1;throw new Error(`Cannot load ${r} "${e}". Expected "true" or "false", got ${t[e]}.`)}};var D;(function(t){t.ENV="env",t.CONFIG="shared config entry"})(D||(D={}));var co="AWS_USE_DUALSTACK_ENDPOINT",uo="use_dualstack_endpoint";var qp={environmentVariableSelector:t=>$(t,co,D.ENV),configFileSelector:t=>$(t,uo,D.CONFIG),default:!1};var lo="AWS_USE_FIPS_ENDPOINT",po="use_fips_endpoint";var Xp={environmentVariableSelector:t=>$(t,lo,D.ENV),configFileSelector:t=>$(t,po,D.CONFIG),default:!1};var fo="AWS_REGION",mo="region",Vs={environmentVariableSelector:t=>t[fo],configFileSelector:t=>t[mo],default:()=>{throw new Error("Region is missing")}},Jp={preferredFile:"credentials"};import{platform as Ro,release as wo}from"os";import{env as Js}from"process";import{versions as xt}from"process";var js=()=>{let t=["deno","bun","llrt"];for(let e of t)if(xt[e])return[`md/${e}`,xt[e]];return["md/nodejs",xt.node]};import{readFile as Ys}from"fs/promises";import{join as Ct}from"path";import{normalize as ho,sep as Gs}from"path";var Ws=t=>{let e=process.cwd();if(!t)return[e];let r=ho(t),s=r.split(Gs),n=s.indexOf("node_modules"),o=n!==-1?s.slice(0,n).join(Gs):r;return e===o?[e]:[o,e]};var go=/^(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-]+)*)?$/,Le=(t="")=>{let e=t.match(go);if(!e)return;let[r,s,n,o]=[e[1],e[2],e[3],e[4]];return o?`${r}.${s}.${n}-${o}`:`${r}.${s}.${n}`};var Eo=["^","~",">=","<=",">","<"],So=["latest","beta","dev","rc","insiders","next"],qs=(t="")=>{if(So.includes(t))return t;let e=Eo.find(s=>t.startsWith(s))??"",r=Le(t.slice(e.length));if(r)return`${e}${r}`};var P,yo=Ct("node_modules","typescript","package.json"),Ks=async()=>{if(P===null)return;if(typeof P=="string")return["md/tsc",P];let t=!1;try{t=$(process.env,"AWS_SDK_JS_TYPESCRIPT_DETECTION_DISABLED",D.ENV)||!1}catch{}if(t){P=null;return}let r=Ws(typeof __dirname<"u"?__dirname:void 0),s;for(let i of r)try{let a=Ct(i,"package.json"),c=await Ys(a,"utf-8"),{dependencies:d,devDependencies:f}=JSON.parse(c),u=f?.typescript??d?.typescript;if(typeof u!="string")continue;s=u;break}catch{}if(!s){P=null;return}let n;for(let i of r)try{let a=Ct(i,yo),c=await Ys(a,"utf-8"),{version:d}=JSON.parse(c),f=Le(d);if(typeof f!="string")continue;n=f;break}catch{}if(n)return P=n,["md/tsc",P];let o=qs(s);if(typeof o!="string"){P=null;return}return P=`dev_${o}`,["md/tsc",P]};var Xs={isCrtAvailable:!1};var Qs=()=>Xs.isCrtAvailable?["md/crt-avail"]:null;var Tf=({serviceId:t,clientVersion:e})=>{let r=js();return async s=>{let n=[["aws-sdk-js",e],["ua","2.1"],[`os/${Ro()}`,wo()],["lang/js"],r],o=await Ks();o&&n.push(o);let i=Qs();i&&n.push(i),t&&n.push([`api/${t}`,e]),Js.AWS_EXECUTION_ENV&&n.push([`exec-env/${Js.AWS_EXECUTION_ENV}`]);let a=await s?.userAgentAppId?.();return a?[...n,[`app/${a}`]]:[...n]}};var Ao="AWS_SDK_UA_APP_ID",To="sdk_ua_app_id",_o="sdk-ua-app-id",Cf={environmentVariableSelector:t=>t[Ao],configFileSelector:t=>t[To]??t[_o],default:rt};import{Buffer as xo}from"buffer";import{createHash as Co,createHmac as Io}from"crypto";var Zs=class{algorithmIdentifier;secret;hash;constructor(e,r){this.algorithmIdentifier=e,this.secret=r,this.reset()}update(e,r){this.hash.update(I(en(e,r)))}digest(){return Promise.resolve(this.hash.digest())}reset(){this.hash=this.secret?Io(this.algorithmIdentifier,en(this.secret)):Co(this.algorithmIdentifier)}};function en(t,e){return xo.isBuffer(t)?t:typeof t=="string"?Nt(t,e):ArrayBuffer.isView(t)?He(t.buffer,t.byteOffset,t.byteLength):He(t)}import{fstatSync as bo,lstatSync as vo,ReadStream as No}from"fs";var Mf=t=>{if(!t)return 0;if(typeof t=="string")return Buffer.byteLength(t);if(typeof t.byteLength=="number")return t.byteLength;if(typeof t.size=="number")return t.size;if(typeof t.start=="number"&&typeof t.end=="number")return t.end+1-t.start;if(t instanceof No){if(t.path!=null)return vo(t.path).size;if(typeof t.fd=="number")return bo(t.fd).size}throw new Error(`Body Length computation failed for ${t}`)};var tn="AWS_EXECUTION_ENV",It="AWS_REGION",bt="AWS_DEFAULT_REGION",rn="AWS_EC2_METADATA_DISABLED",sn=["in-region","cross-region","mobile","standard","legacy"],nn="/latest/meta-data/placement/region";var Oo="AWS_DEFAULTS_MODE",Do="defaults_mode",on={environmentVariableSelector:t=>t[Oo],configFileSelector:t=>t[Do],default:"legacy"};var Vf=({region:t=re(Vs),defaultsMode:e=re(on)}={})=>Ut(async()=>{let r=typeof e=="function"?await e():e;switch(r?.toLowerCase()){case"auto":return Po(t);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 ${sn.join(", ")}, got ${r}`)}}),Po=async t=>{if(t){let e=typeof t=="function"?await t():t,r=await Mo();return r?e===r?"in-region":"cross-region":"standard"}return"standard"},Mo=async()=>{if(process.env[tn]&&(process.env[It]||process.env[bt]))return process.env[It]??process.env[bt];if(!process.env[rn])try{let{getInstanceMetadataEndpoint:t,httpRequest:e}=await import("./dist-es-NDZJSZR3.js"),r=await t();return(await e({...r,path:nn})).toString()}catch{}};var Gf=t=>({setRegion(e){t.region=e},region(){return t.region}}),Wf=t=>({region:t.region()});export{Wo as a,qo as b,Ci as c,bi as d,$i as e,b as f,v as g,ji as h,Xi as i,ia as j,pe as k,li as l,z as m,N as n,B as o,et as p,Q as q,Qt as r,Ee as s,Jt as t,wa as u,Yt as v,Ca as w,sr as x,ce as y,Vc as z,vn as A,Au as B,dt as C,Fu as D,Md as E,Ft as F,qe as G,rr as H,Bd as I,jd as J,Qd as K,Jd as L,be as M,as as N,cs as O,us as P,ds as Q,Ll as R,qp as S,Xp as T,Vs as U,Jp as V,Yl as W,Ql as X,yp as Y,_p as Z,bp as _,vp as $,Np as aa,Bp as ba,Tf as ca,Cf as da,Zs as ea,Mf as fa,Vf as ga,Gf as ha,Wf as ia};
20
+ `);return this.signString(h,{signingDate:s,signingRegion:a,signingService:i})}async signMessage(e,{signingDate:r=new Date,signingRegion:s,signingService:n}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:r,signingRegion:s,signingService:n,priorSignature:e.priorSignature}).then(i=>({message:e.message,signature:i}))}async signString(e,{signingDate:r=new Date,signingRegion:s,signingService:n}={}){let o=await this.credentialProvider();this.validateResolvedCredentials(o);let i=s??await this.regionProvider(),{shortDate:a}=this.formatDate(r),c=new this.sha256(await this.getSigningKey(o,i,a,n));return c.update(I(e)),T(await c.digest())}async signRequest(e,{signingDate:r=new Date,signableHeaders:s,unsignableHeaders:n,signingRegion:o,signingService:i}={}){let a=await this.credentialProvider();this.validateResolvedCredentials(a);let c=o??await this.regionProvider(),d=wt(e),{longDate:f,shortDate:u}=this.formatDate(r),l=_e(u,c,i??this.service);d.headers[gt]=f,a.sessionToken&&(d.headers[Fr]=a.sessionToken);let p=await xe(d,this.sha256);!Qr(de,d.headers)&&this.applyChecksum&&(d.headers[de]=p);let h=yt(d,n,s),g=await this.getSignature(f,l,this.getSigningKey(a,c,u,i),this.createCanonicalRequest(d,h,p));return d.headers[ht]=`${Ae} Credential=${a.accessKeyId}/${l}, SignedHeaders=${this.getCanonicalHeaderList(h)}, Signature=${g}`,d}async getSignature(e,r,s,n){let o=await this.createStringToSign(e,r,n,Ae),i=new this.sha256(await s);return i.update(I(o)),T(await i.digest())}getSigningKey(e,r,s,n){return Yr(this.sha256,e,s,r,n||this.service)}};var Md=t=>{let e=t.credentials,r=!!t.credentials,s;Object.defineProperty(t,"credentials",{set(d){d&&d!==e&&d!==s&&(r=!0),e=d;let f=Pn(t,{credentials:e,credentialDefaultProvider:t.credentialDefaultProvider}),u=Mn(t,f);if(r&&!u.attributed){let l=typeof e=="object"&&e!==null;s=async p=>{let g=await u(p);return l&&(!g.$source||Object.keys(g.$source).length===0)?kt(g,"CREDENTIALS_CODE","e"):g},s.memoized=u.memoized,s.configBound=u.configBound,s.attributed=!0}else s=u},get(){return s},enumerable:!0,configurable:!0}),t.credentials=e;let{signingEscapePath:n=!0,systemClockOffset:o=t.systemClockOffset||0,sha256:i}=t,a;return t.signer?a=V(t.signer):t.regionInfoProvider?a=()=>V(t.region)().then(async d=>[await t.regionInfoProvider(d,{useFipsEndpoint:await t.useFipsEndpoint(),useDualstackEndpoint:await t.useDualstackEndpoint()})||{},d]).then(([d,f])=>{let{signingRegion:u,signingService:l}=d;t.signingRegion=t.signingRegion||u||f,t.signingName=t.signingName||l||t.serviceId;let p={...t,credentials:t.credentials,region:t.signingRegion,service:t.signingName,sha256:i,uriEscapePath:n},h=t.signerConstructor||le;return new h(p)}):a=async d=>{d=Object.assign({},{name:"sigv4",signingName:t.signingName||t.defaultSigningName,signingRegion:await V(t.region)(),properties:{}},d);let f=d.signingRegion,u=d.signingName;t.signingRegion=t.signingRegion||f,t.signingName=t.signingName||u||t.serviceId;let l={...t,credentials:t.credentials,region:t.signingRegion,service:t.signingName,sha256:i,uriEscapePath:n},p=t.signerConstructor||le;return new p(l)},Object.assign(t,{systemClockOffset:o,signingEscapePath:n,signer:a})};function Pn(t,{credentials:e,credentialDefaultProvider:r}){let s;return e?e?.memoized?s=e:s=tr(e,er,tt):r?s=V(r(Object.assign({},t,{parentClientConfig:t}))):s=async()=>{throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")},s.memoized=!0,s}function Mn(t,e){if(e.configBound)return e;let r=async s=>e({...s,callerClientConfig:t});return r.memoized=e.memoized,r.configBound=!0,r}var Bd=t=>{switch(t){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 ts=!1,jd=t=>{t&&!ts&&parseInt(t.substring(1,t.indexOf(".")))<16&&(ts=!0)};var rs=Object.values(H),ss=t=>{let e=[];for(let r in H){let s=H[r];t[s]!==void 0&&e.push({algorithmId:()=>s,checksumConstructor:()=>t[s]})}for(let[r,s]of Object.entries(t.checksumAlgorithms??{}))e.push({algorithmId:()=>r,checksumConstructor:()=>s});return{addChecksumAlgorithm(r){t.checksumAlgorithms=t.checksumAlgorithms??{};let s=r.algorithmId(),n=r.checksumConstructor();rs.includes(s)?t.checksumAlgorithms[s.toUpperCase()]=n:t.checksumAlgorithms[s]=n,e.push(r)},checksumAlgorithms(){return e}}},ns=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{let s=r.algorithmId();rs.includes(s)&&(e[s]=r.checksumConstructor())}),e};var os=t=>({setRetryStrategy(e){t.retryStrategy=e},retryStrategy(){return t.retryStrategy}}),is=t=>{let e={};return e.retryStrategy=t.retryStrategy(),e};var Qd=t=>Object.assign(ss(t),os(t));var Jd=t=>Object.assign(ns(t),is(t));var be=class{trace(){}debug(){}info(){}warn(){}error(){}};var as=class{queryCompat;errorRegistry;constructor(e=!1){this.queryCompat=e}resolveRestContentType(e,r){let s=r.getMemberSchemas(),n=Object.values(s).find(o=>!!o.getMergedTraits().httpPayload);if(n){let o=n.getMergedTraits().mediaType;return o||(n.isStringSchema()?"text/plain":n.isBlobSchema()?"application/octet-stream":e)}else if(!r.isUnitSchema()&&Object.values(s).find(i=>{let{httpQuery:a,httpQueryParams:c,httpHeader:d,httpLabel:f,httpPrefixHeaders:u}=i.getMergedTraits();return!a&&!c&&!d&&!f&&u===void 0}))return e}async getErrorSchemaOrThrowBaseException(e,r,s,n,o,i){let a=e;e.includes("#")&&([,a]=e.split("#"));let c={$metadata:o,$fault:s.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(e),errorMetadata:c}}catch{n.message=n.message??n.Message??"UnknownError";let f=this.errorRegistry,u=f.getBaseException();if(u){let h=f.getErrorCtor(u)??Error;throw this.decorateServiceException(Object.assign(new h({name:a}),c),n)}let l=n,p=l?.message??l?.Message??l?.Error?.Message??l?.Error?.message;throw this.decorateServiceException(Object.assign(new Error(p),{name:a},c),n)}}compose(e,r,s){let n=s;r.includes("#")&&([n]=r.split("#"));let o=B.for(n),i=B.for("smithy.ts.sdk.synthetic."+s);e.copyFrom(o),e.copyFrom(i),this.errorRegistry=e}decorateServiceException(e,r={}){if(this.queryCompat){let s=e.Message??r.Message,n=st(e,r);s&&(n.message=s),n.Error={...n.Error,Type:n.Error?.Type,Code:n.Error?.Code,Message:n.Error?.message??n.Error?.Message??s};let o=n.$metadata.requestId;return o&&(n.RequestId=o),n}return st(e,r)}setQueryCompatError(e,r){let s=r.headers?.["x-amzn-query-error"];if(e!==void 0&&s!=null){let[n,o]=s.split(";"),i=Object.entries(e),a={Code:n,Type:o};Object.assign(e,a);for(let[c,d]of i)a[c==="message"?"Message":c]=d;delete a.__type,e.Error=a}}queryCompatOutput(e,r){e.Error&&(r.Error=e.Error),e.Type&&(r.Type=e.Type),e.Code&&(r.Code=e.Code)}findQueryCompatibleError(e,r){try{return e.getSchema(r)}catch{return e.find(n=>N.of(n).getMergedTraits().awsQueryError?.[0]===r)}}};var cs=class{serdeContext;setSerdeContext(e){this.serdeContext=e}};var us=class{from;to;keys;constructor(e,r){this.from=e,this.to=r,this.keys=new Set(Object.keys(this.from).filter(s=>s!=="__type"))}mark(e){this.keys.delete(e)}hasUnknown(){return this.keys.size===1&&Object.keys(this.to).length===0}writeUnknown(){if(this.hasUnknown()){let e=this.keys.values().next().value,r=this.from[e];this.to.$unknown=[e,r]}}};var x;(function(t){t.STANDARD="standard",t.ADAPTIVE="adaptive"})(x||(x={}));var Z=3,ds=x.STANDARD;var ls=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],ps=["TimeoutError","RequestTimeout","RequestTimeoutException"],fs=[500,502,503,504],ms=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],hs=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND"];var kn=t=>t?.$retryable!==void 0;var Un=t=>t.$metadata?.clockSkewCorrected,$n=t=>{let e=new Set(["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Load failed","Network request failed"]);return t&&t instanceof TypeError?e.has(t.message):!1},ve=t=>t.$metadata?.httpStatusCode===429||ls.includes(t.name)||t.$retryable?.throttling==!0,Ne=(t,e=0)=>kn(t)||Un(t)||ps.includes(t.name)||ms.includes(t?.code||"")||hs.includes(t?.code||"")||fs.includes(t.$metadata?.httpStatusCode||0)||$n(t)||t.cause!==void 0&&e<=10&&Ne(t.cause,e+1),gs=t=>{if(t.$metadata?.httpStatusCode!==void 0){let e=t.$metadata.httpStatusCode;return 500<=e&&e<=599&&!Ne(t)}return!1};var Oe=class t{static setTimeoutFn=setTimeout;beta;minCapacity;minFillRate;scaleConstant;smooth;currentCapacity=0;enabled=!1;lastMaxRate=0;measuredTxRate=0;requestCount=0;fillRate;lastThrottleTime;lastTimestamp=0;lastTxRateBucket;maxCapacity;timeWindow=0;constructor(e){this.beta=e?.beta??.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??.5,this.scaleConstant=e?.scaleConstant??.4,this.smooth=e?.smooth??.8;let r=this.getCurrentTimeInSeconds();this.lastThrottleTime=r,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1e3}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(e){if(this.enabled){if(this.refillTokenBucket(),e>this.currentCapacity){let r=(e-this.currentCapacity)/this.fillRate*1e3;await new Promise(s=>t.setTimeoutFn(s,r))}this.currentCapacity=this.currentCapacity-e}}refillTokenBucket(){let e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=e;return}let r=(e-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+r),this.lastTimestamp=e}updateClientSendingRate(e){let r;if(this.updateMeasuredRate(),ve(e)){let n=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=n,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),r=this.cubicThrottle(n),this.enableTokenBucket()}else this.calculateTimeWindow(),r=this.cubicSuccess(this.getCurrentTimeInSeconds());let s=Math.min(r,2*this.measuredTxRate);this.updateTokenBucketRate(s)}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.currentCapacity=Math.min(this.currentCapacity,this.maxCapacity)}updateMeasuredRate(){let e=this.getCurrentTimeInSeconds(),r=Math.floor(e*2)/2;if(this.requestCount++,r>this.lastTxRateBucket){let s=this.requestCount/(r-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(s*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=r}}getPrecise(e){return parseFloat(e.toFixed(8))}};var Es="amz-sdk-invocation-id",Ss="amz-sdk-request";var Rs=()=>{let t=100;return{computeNextBackoffDelay:s=>Math.floor(Math.min(2e4,Math.random()*2**s*t)),setDelayBase:s=>{t=s}}};var At=({retryDelay:t,retryCount:e,retryCost:r})=>({getRetryCount:()=>e,getRetryDelay:()=>Math.min(2e4,t),getRetryCost:()=>r});var ee=class{maxAttempts;mode=x.STANDARD;capacity=500;retryBackoffStrategy=Rs();maxAttemptsProvider;constructor(e){this.maxAttempts=e,this.maxAttemptsProvider=typeof e=="function"?e:async()=>e}async acquireInitialRetryToken(e){return At({retryDelay:100,retryCount:0})}async refreshRetryTokenForRetry(e,r){let s=await this.getMaxAttempts();if(this.shouldRetry(e,r,s)){let n=r.errorType;this.retryBackoffStrategy.setDelayBase(n==="THROTTLING"?500:100);let o=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),i=r.retryAfterHint?Math.max(r.retryAfterHint.getTime()-Date.now()||0,o):o,a=this.getCapacityCost(n);return this.capacity-=a,At({retryDelay:i,retryCount:e.getRetryCount()+1,retryCost:a})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.max(500,this.capacity+(e.getRetryCost()??1))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn(`Max attempts provider could not resolve. Using default of ${Z}`),Z}}shouldRetry(e,r,s){return e.getRetryCount()+1<s&&this.capacity>=this.getCapacityCost(r.errorType)&&this.isRetryableError(r.errorType)}getCapacityCost(e){return e==="TRANSIENT"?10:5}isRetryableError(e){return e==="THROTTLING"||e==="TRANSIENT"}};var De=class{maxAttemptsProvider;rateLimiter;standardRetryStrategy;mode=x.ADAPTIVE;constructor(e,r){this.maxAttemptsProvider=e;let{rateLimiter:s}=r??{};this.rateLimiter=s??new Oe,this.standardRetryStrategy=new ee(e)}async acquireInitialRetryToken(e){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(e)}async refreshRetryTokenForRetry(e,r){return this.rateLimiter.updateClientSendingRate(r),this.standardRetryStrategy.refreshRetryTokenForRetry(e,r)}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}};var Hn=/\d{12}\.ddb/;async function ws(t,e,r){if(r.request?.headers?.["smithy-protocol"]==="rpc-v2-cbor"&&O(t,"PROTOCOL_RPC_V2_CBOR","M"),typeof e.retryStrategy=="function"){let o=await e.retryStrategy();if(typeof o.mode=="string")switch(o.mode){case x.ADAPTIVE:O(t,"RETRY_MODE_ADAPTIVE","F");break;case x.STANDARD:O(t,"RETRY_MODE_STANDARD","E");break}}if(typeof e.accountIdEndpointMode=="function"){let o=t.endpointV2;switch(String(o?.url?.hostname).match(Hn)&&O(t,"ACCOUNT_ID_ENDPOINT","O"),await e.accountIdEndpointMode?.()){case"disabled":O(t,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":O(t,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":O(t,"ACCOUNT_ID_MODE_REQUIRED","R");break}}let n=t.__smithy_context?.selectedHttpAuthScheme?.identity;if(n?.$source){let o=n;o.accountId&&O(t,"RESOLVED_ACCOUNT_ID","T");for(let[i,a]of Object.entries(o.$source??{}))O(t,i,a)}}var Tt="user-agent",Pe="x-amz-user-agent";var As=/[^!$%&'*+\-.^_`|~\w]/g,Ts=/[^!$%&'*+\-.^_`|~\w#]/g;function _s(t){let e="";for(let r in t){let s=t[r];if(e.length+s.length+1<=1024){e.length?e+=","+s:e+=s;continue}break}return e}var zn=t=>(e,r)=>async s=>{let{request:n}=s;if(!R.isInstance(n))return e(s);let{headers:o}=n,i=r?.userAgent?.map(Me)||[],a=(await t.defaultUserAgentProvider()).map(Me);await ws(r,t,s);let c=r;a.push(`m/${_s(Object.assign({},r.__smithy_context?.features,c.__aws_sdk_context?.features))}`);let d=t?.customUserAgent?.map(Me)||[],f=await t.userAgentAppId();f&&a.push(Me(["app",`${f}`]));let u=Cr(),l=(u?[u]:[]).concat([...a,...i,...d]).join(" "),p=[...a.filter(h=>h.startsWith("aws-sdk-")),...d].join(" ");return t.runtime!=="browser"?(p&&(o[Pe]=o[Pe]?`${o[Tt]} ${p}`:p),o[Tt]=l):o[Pe]=l,e({...s,request:n})},Me=t=>{let e=t[0].split("/").map(i=>i.replace(As,"-")).join("/"),r=t[1]?.replace(Ts,"-"),s=e.indexOf("/"),n=e.substring(0,s),o=e.substring(s+1);return n==="api"&&(o=o.toLowerCase()),[n,o,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}`}},"")},Bn={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},Ll=t=>({applyToStack:e=>{e.add(zn(t),Bn)}});var Is=new Set,bs=(t,e=j)=>{if(!Is.has(t)&&!e(t))if(t==="*")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="${t}" is not a valid hostname component.`);else Is.add(t)};var ke=t=>typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips"));var vs=t=>ke(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t;var Yl=t=>{let{region:e,useFipsEndpoint:r}=t;if(!e)throw new Error("Region is missing");return Object.assign(t,{region:async()=>{let s=typeof e=="function"?await e():e,n=vs(s);return bs(n),n},useFipsEndpoint:async()=>{let s=typeof e=="string"?e:await e();return ke(s)?!0:typeof r!="function"?Promise.resolve(!!r):r()}})};var Ns="content-length";function Vn(t){return e=>async r=>{let s=r.request;if(R.isInstance(s)){let{body:n,headers:o}=s;if(n&&Object.keys(o).map(i=>i.toLowerCase()).indexOf(Ns)===-1)try{let i=t(n);s.headers={...s.headers,[Ns]:String(i)}}catch{}}return e({...r,request:s})}}var jn={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},Ql=t=>({applyToStack:e=>{e.add(Vn(t.bodyLengthChecker),jn)}});var Os={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};var Ds=async t=>{let e=t?.Bucket||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),Kn(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!Yn(e)||e.indexOf(".")!==-1&&!String(t.Endpoint).startsWith("http:")||e.toLowerCase()!==e||e.length<3)&&(t.ForcePathStyle=!0);return t.DisableMultiRegionAccessPoints&&(t.disableMultiRegionAccessPoints=!0,t.DisableMRAP=!0),t},Gn=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,Wn=/(\d+\.){3}\d+/,qn=/\.\./;var Yn=t=>Gn.test(t)&&!Wn.test(t)&&!qn.test(t),Kn=t=>{let[e,r,s,,,n]=t.split(":"),o=e==="arn"&&t.split(":").length>=6,i=!!(o&&r&&s&&n);if(o&&!i)throw new Error(`Invalid ARN: ${t} was an invalid ARN.`);return i};var Ps=(t,e,r,s=!1)=>{let n=async()=>{let o;return s?o=r.clientContextParams?.[t]??r[t]??r[e]:o=r[t]??r[e],typeof o=="function"?o():o};return t==="credentialScope"||e==="CredentialScope"?async()=>{let o=typeof r.credentials=="function"?await r.credentials():r.credentials;return o?.credentialScope??o?.CredentialScope}:t==="accountId"||e==="AccountId"?async()=>{let o=typeof r.credentials=="function"?await r.credentials():r.credentials;return o?.accountId??o?.AccountId}:t==="endpoint"||e==="endpoint"?async()=>{if(r.isCustomEndpoint===!1)return;let o=await n();if(o&&typeof o=="object"){if("url"in o)return o.url.href;if("hostname"in o){let{protocol:i,hostname:a,port:c,path:d}=o;return`${i}//${a}${c?":"+c:""}${d}`}}return o}:n};var Ms="AWS_ENDPOINT_URL",ks="endpoint_url",Us=t=>({environmentVariableSelector:e=>{let r=t.split(" ").map(o=>o.toUpperCase()),s=e[[Ms,...r].join("_")];if(s)return s;let n=e[Ms];if(n)return n},configFileSelector:(e,r)=>{if(r&&e.services){let n=r[["services",e.services].join(".")];if(n){let o=t.split(" ").map(a=>a.toLowerCase()),i=n[[o.join("_"),ks].join(".")];if(i)return i}}let s=e[ks];if(s)return s},default:void 0});var Ue=async t=>re(Us(t??""))();var $e=t=>{if(typeof t=="object"){if("url"in t){let e=q(t.url);if(t.headers){e.headers={};for(let[r,s]of Object.entries(t.headers))e.headers[r.toLowerCase()]=s.join(", ")}return e}return t}return q(t)};var $s=async(t,e,r,s)=>{if(!r.isCustomEndpoint){let i;r.serviceConfiguredEndpoint?i=await r.serviceConfiguredEndpoint():i=await Ue(r.serviceId),i&&(r.endpoint=()=>Promise.resolve($e(i)),r.isCustomEndpoint=!0)}let n=await Qn(t,e,r);if(typeof r.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");let o=r.endpointProvider(n,s);if(r.isCustomEndpoint&&r.endpoint){let i=await r.endpoint();if(i?.headers){o.headers??={};for(let[a,c]of Object.entries(i.headers))o.headers[a]=Array.isArray(c)?c:[c]}}return o},Qn=async(t,e,r)=>{let s={},n=e?.getEndpointParameterInstructions?.()||{};for(let[o,i]of Object.entries(n))switch(i.type){case"staticContextParams":s[o]=i.value;break;case"contextParams":s[o]=t[i.name];break;case"clientContextParams":case"builtInParams":s[o]=await Ps(i.name,o,r,i.type!=="builtInParams")();break;case"operationContextParams":s[o]=i.get(t);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(i))}return Object.keys(n).length===0&&Object.assign(s,r),String(r.serviceId).toLowerCase()==="s3"&&await Ds(s),s};var Ls=({config:t,instructions:e})=>(r,s)=>async n=>{t.isCustomEndpoint&&Zt(s,"ENDPOINT_OVERRIDE","N");let o=await $s(n.input,{getEndpointParameterInstructions(){return e}},{...t},s);s.endpointV2=o,s.authSchemes=o.properties?.authSchemes;let i=s.authSchemes?.[0];if(i){s.signing_region=i.signingRegion,s.signing_service=i.signingName;let c=b(s)?.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 Jn={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:Os.name},yp=(t,e)=>({applyToStack:r=>{r.addRelativeTo(Ls({config:t,instructions:e}),Jn)}});var _p=t=>{let e=t.tls??!0,{endpoint:r,useDualstackEndpoint:s,useFipsEndpoint:n}=t,o=r!=null?async()=>$e(await v(r)()):void 0,a=Object.assign(t,{endpoint:o,tls:e,isCustomEndpoint:!!r,useDualstackEndpoint:v(s??!1),useFipsEndpoint:v(n??!1)}),c;return a.serviceConfiguredEndpoint=async()=>(t.serviceId&&!c&&(c=Ue(t.serviceId)),c),a};var Fs="AWS_MAX_ATTEMPTS",Hs="max_attempts",bp={environmentVariableSelector:t=>{let e=t[Fs];if(!e)return;let r=parseInt(e);if(Number.isNaN(r))throw new Error(`Environment variable ${Fs} mast be a number, got "${e}"`);return r},configFileSelector:t=>{let e=t[Hs];if(!e)return;let r=parseInt(e);if(Number.isNaN(r))throw new Error(`Shared config file entry ${Hs} mast be a number, got "${e}"`);return r},default:Z},vp=t=>{let{retryStrategy:e,retryMode:r}=t,s=v(t.maxAttempts??Z),n=e?Promise.resolve(e):void 0,o=async()=>await v(r)()===x.ADAPTIVE?new De(s):new ee(s);return Object.assign(t,{maxAttempts:s,retryStrategy:()=>n??=o()})},Zn="AWS_RETRY_MODE",eo="retry_mode",Np={environmentVariableSelector:t=>t[Zn],configFileSelector:t=>t[eo],default:ds};import{Readable as to}from"stream";var zs=t=>t?.body instanceof to||typeof ReadableStream<"u"&&t?.body instanceof ReadableStream;var Bs=t=>t instanceof Error?t:t instanceof Object?Object.assign(new Error,t):typeof t=="string"?new Error(t):new Error(`AWS SDK error wrapper for ${t}`);var ro=t=>(e,r)=>async s=>{let n=await t.retryStrategy(),o=await t.maxAttempts();if(so(n)){n=n;let i=await n.acquireInitialRetryToken(r.partition_id),a=new Error,c=0,d=0,{request:f}=s,u=R.isInstance(f);for(u&&(f.headers[Es]=et());;)try{u&&(f.headers[Ss]=`attempt=${c+1}; max=${o}`);let{response:l,output:p}=await e(s);return n.recordSuccess(i),p.$metadata.attempts=c+1,p.$metadata.totalRetryDelay=d,{response:l,output:p}}catch(l){let p=no(l);if(a=Bs(l),u&&zs(f))throw(r.logger instanceof be?console:r.logger)?.warn("An error was encountered in a non-retryable streaming request."),a;try{i=await n.refreshRetryTokenForRetry(i,p)}catch{throw a.$metadata||(a.$metadata={}),a.$metadata.attempts=c+1,a.$metadata.totalRetryDelay=d,a}c=i.getRetryCount();let h=i.getRetryDelay();d+=h,await new Promise(g=>setTimeout(g,h))}}else return n=n,n?.mode&&(r.userAgent=[...r.userAgent||[],["cfg/retry-mode",n.mode]]),n.retry(e,s)},so=t=>typeof t.acquireInitialRetryToken<"u"&&typeof t.refreshRetryTokenForRetry<"u"&&typeof t.recordSuccess<"u",no=t=>{let e={error:t,errorType:oo(t)},r=ao(t.$response);return r&&(e.retryAfterHint=r),e},oo=t=>ve(t)?"THROTTLING":Ne(t)?"TRANSIENT":gs(t)?"SERVER_ERROR":"CLIENT_ERROR",io={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},Bp=t=>({applyToStack:e=>{e.add(ro(t),io)}}),ao=t=>{if(!k.isInstance(t))return;let e=Object.keys(t.headers).find(o=>o.toLowerCase()==="retry-after");if(!e)return;let r=t.headers[e],s=Number(r);return Number.isNaN(s)?new Date(r):new Date(s*1e3)};var $=(t,e,r)=>{if(e in t){if(t[e]==="true")return!0;if(t[e]==="false")return!1;throw new Error(`Cannot load ${r} "${e}". Expected "true" or "false", got ${t[e]}.`)}};var D;(function(t){t.ENV="env",t.CONFIG="shared config entry"})(D||(D={}));var co="AWS_USE_DUALSTACK_ENDPOINT",uo="use_dualstack_endpoint";var qp={environmentVariableSelector:t=>$(t,co,D.ENV),configFileSelector:t=>$(t,uo,D.CONFIG),default:!1};var lo="AWS_USE_FIPS_ENDPOINT",po="use_fips_endpoint";var Xp={environmentVariableSelector:t=>$(t,lo,D.ENV),configFileSelector:t=>$(t,po,D.CONFIG),default:!1};var fo="AWS_REGION",mo="region",Vs={environmentVariableSelector:t=>t[fo],configFileSelector:t=>t[mo],default:()=>{throw new Error("Region is missing")}},Jp={preferredFile:"credentials"};import{platform as Ro,release as wo}from"os";import{env as Js}from"process";import{versions as xt}from"process";var js=()=>{let t=["deno","bun","llrt"];for(let e of t)if(xt[e])return[`md/${e}`,xt[e]];return["md/nodejs",xt.node]};import{readFile as Ys}from"fs/promises";import{join as Ct}from"path";import{normalize as ho,sep as Gs}from"path";var Ws=t=>{let e=process.cwd();if(!t)return[e];let r=ho(t),s=r.split(Gs),n=s.indexOf("node_modules"),o=n!==-1?s.slice(0,n).join(Gs):r;return e===o?[e]:[o,e]};var go=/^(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-]+)*)?$/,Le=(t="")=>{let e=t.match(go);if(!e)return;let[r,s,n,o]=[e[1],e[2],e[3],e[4]];return o?`${r}.${s}.${n}-${o}`:`${r}.${s}.${n}`};var Eo=["^","~",">=","<=",">","<"],So=["latest","beta","dev","rc","insiders","next"],qs=(t="")=>{if(So.includes(t))return t;let e=Eo.find(s=>t.startsWith(s))??"",r=Le(t.slice(e.length));if(r)return`${e}${r}`};var P,yo=Ct("node_modules","typescript","package.json"),Ks=async()=>{if(P===null)return;if(typeof P=="string")return["md/tsc",P];let t=!1;try{t=$(process.env,"AWS_SDK_JS_TYPESCRIPT_DETECTION_DISABLED",D.ENV)||!1}catch{}if(t){P=null;return}let r=Ws(typeof __dirname<"u"?__dirname:void 0),s;for(let i of r)try{let a=Ct(i,"package.json"),c=await Ys(a,"utf-8"),{dependencies:d,devDependencies:f}=JSON.parse(c),u=f?.typescript??d?.typescript;if(typeof u!="string")continue;s=u;break}catch{}if(!s){P=null;return}let n;for(let i of r)try{let a=Ct(i,yo),c=await Ys(a,"utf-8"),{version:d}=JSON.parse(c),f=Le(d);if(typeof f!="string")continue;n=f;break}catch{}if(n)return P=n,["md/tsc",P];let o=qs(s);if(typeof o!="string"){P=null;return}return P=`dev_${o}`,["md/tsc",P]};var Xs={isCrtAvailable:!1};var Qs=()=>Xs.isCrtAvailable?["md/crt-avail"]:null;var Tf=({serviceId:t,clientVersion:e})=>{let r=js();return async s=>{let n=[["aws-sdk-js",e],["ua","2.1"],[`os/${Ro()}`,wo()],["lang/js"],r],o=await Ks();o&&n.push(o);let i=Qs();i&&n.push(i),t&&n.push([`api/${t}`,e]),Js.AWS_EXECUTION_ENV&&n.push([`exec-env/${Js.AWS_EXECUTION_ENV}`]);let a=await s?.userAgentAppId?.();return a?[...n,[`app/${a}`]]:[...n]}};var Ao="AWS_SDK_UA_APP_ID",To="sdk_ua_app_id",_o="sdk-ua-app-id",Cf={environmentVariableSelector:t=>t[Ao],configFileSelector:t=>t[To]??t[_o],default:rt};import{Buffer as xo}from"buffer";import{createHash as Co,createHmac as Io}from"crypto";var Zs=class{algorithmIdentifier;secret;hash;constructor(e,r){this.algorithmIdentifier=e,this.secret=r,this.reset()}update(e,r){this.hash.update(I(en(e,r)))}digest(){return Promise.resolve(this.hash.digest())}reset(){this.hash=this.secret?Io(this.algorithmIdentifier,en(this.secret)):Co(this.algorithmIdentifier)}};function en(t,e){return xo.isBuffer(t)?t:typeof t=="string"?Nt(t,e):ArrayBuffer.isView(t)?He(t.buffer,t.byteOffset,t.byteLength):He(t)}import{fstatSync as bo,lstatSync as vo,ReadStream as No}from"fs";var Mf=t=>{if(!t)return 0;if(typeof t=="string")return Buffer.byteLength(t);if(typeof t.byteLength=="number")return t.byteLength;if(typeof t.size=="number")return t.size;if(typeof t.start=="number"&&typeof t.end=="number")return t.end+1-t.start;if(t instanceof No){if(t.path!=null)return vo(t.path).size;if(typeof t.fd=="number")return bo(t.fd).size}throw new Error(`Body Length computation failed for ${t}`)};var tn="AWS_EXECUTION_ENV",It="AWS_REGION",bt="AWS_DEFAULT_REGION",rn="AWS_EC2_METADATA_DISABLED",sn=["in-region","cross-region","mobile","standard","legacy"],nn="/latest/meta-data/placement/region";var Oo="AWS_DEFAULTS_MODE",Do="defaults_mode",on={environmentVariableSelector:t=>t[Oo],configFileSelector:t=>t[Do],default:"legacy"};var Vf=({region:t=re(Vs),defaultsMode:e=re(on)}={})=>Ut(async()=>{let r=typeof e=="function"?await e():e;switch(r?.toLowerCase()){case"auto":return Po(t);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 ${sn.join(", ")}, got ${r}`)}}),Po=async t=>{if(t){let e=typeof t=="function"?await t():t,r=await Mo();return r?e===r?"in-region":"cross-region":"standard"}return"standard"},Mo=async()=>{if(process.env[tn]&&(process.env[It]||process.env[bt]))return process.env[It]??process.env[bt];if(!process.env[rn])try{let{getInstanceMetadataEndpoint:t,httpRequest:e}=await import("./dist-es-ZA2NRM7G.js"),r=await t();return(await e({...r,path:nn})).toString()}catch{}};var Gf=t=>({setRegion(e){t.region=e},region(){return t.region}}),Wf=t=>({region:t.region()});export{Wo as a,qo as b,Ci as c,bi as d,$i as e,b as f,v as g,ji as h,Xi as i,ia as j,pe as k,li as l,z as m,N as n,B as o,et as p,Q as q,Qt as r,Ee as s,Jt as t,wa as u,Yt as v,Ca as w,sr as x,ce as y,Vc as z,vn as A,Au as B,dt as C,Fu as D,Md as E,Ft as F,qe as G,rr as H,Bd as I,jd as J,Qd as K,Jd as L,be as M,as as N,cs as O,us as P,ds as Q,Ll as R,qp as S,Xp as T,Vs as U,Jp as V,Yl as W,Ql as X,yp as Y,_p as Z,bp as _,vp as $,Np as aa,Bp as ba,Tf as ca,Cf as da,Zs as ea,Mf as fa,Vf as ga,Gf as ha,Wf as ia};
@@ -1,4 +1,4 @@
1
- import{a as Ne,b as qe,f as _,g as h}from"./chunk-RR5R4AKJ.js";import{a as E}from"./chunk-7Z3O7WJM.js";import{a as it}from"./chunk-6EI2BXXZ.js";import{a as Xt,b as Vt,g as Ft}from"./chunk-7HOF72FC.js";import{a as Pt,b as It}from"./chunk-2VIWVVHK.js";import{$ as Lt,A as dt,B as yt,C as mt,D as xt,E as vt,F as Rt,G as k,H as Kt,I as ft,J as gt,K as St,L as Ct,M as _t,N as ht,Q as $t,R as Dt,S as At,T as kt,U as Mt,V as bt,W as Ot,X as wt,Y as M,Z as Tt,_ as Ut,a as Xe,aa as Nt,b as Ve,ba as qt,c as Fe,ca as Ht,d as He,da as jt,e as je,ea as Wt,f as We,fa as Bt,g as Ge,ga as zt,h as Be,ha as Qt,i as ze,ia as Yt,k as ot,l as nt,n as st,o as Te,v as at,w as ct,x as pt,y as lt,z as ut}from"./chunk-O3WYNHSC.js";import{a as rt,c as f}from"./chunk-PXU2OOBT.js";import{a as Et}from"./chunk-DIXI4M5O.js";import{a as Gt}from"./chunk-FGJ5K4WM.js";import{b as Qe,c as Ze,e as et,f as tt}from"./chunk-7DCGNQSQ.js";import{d as Ye,e as Je}from"./chunk-QEIMNOY2.js";import{b as S}from"./chunk-EXLRPVEX.js";import{randomUUID as is}from"crypto";var b=class extends it{serializer;deserializer;serviceTarget;codec;mixin;awsQueryCompatible;constructor({defaultNamespace:t,errorTypeRegistries:o,serviceTarget:s,awsQueryCompatible:r,jsonCodec:y}){super({defaultNamespace:t,errorTypeRegistries:o}),this.serviceTarget=s,this.codec=y??new It({timestampFormat:{useTrait:!0,default:7},jsonName:!1}),this.serializer=this.codec.createSerializer(),this.deserializer=this.codec.createDeserializer(),this.awsQueryCompatible=!!r,this.mixin=new ht(this.awsQueryCompatible)}async serializeRequest(t,o,s){let r=await super.serializeRequest(t,o,s);return r.path.endsWith("/")||(r.path+="/"),Object.assign(r.headers,{"content-type":`application/x-amz-json-${this.getJsonRpcVersion()}`,"x-amz-target":`${this.serviceTarget}.${t.name}`}),this.awsQueryCompatible&&(r.headers["x-amzn-query-mode"]="true"),(ot(t.input)==="unit"||!r.body)&&(r.body="{}"),r}getPayloadCodec(){return this.codec}async handleError(t,o,s,r,y){this.awsQueryCompatible&&this.mixin.setQueryCompatError(r,s);let m=Pt(s,r)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,m,this.options.defaultNamespace);let{errorSchema:x,errorMetadata:g}=await this.mixin.getErrorSchemaOrThrowBaseException(m,this.options.defaultNamespace,s,r,y,this.awsQueryCompatible?this.mixin.findQueryCompatibleError:void 0),D=st.of(x),A=r.message??r.Message??"UnknownError",be=this.compositeErrorRegistry.getErrorCtor(x)??Error,Ho=new be(A),Oe={};for(let[we,jo]of D.structIterator())r[we]!=null&&(Oe[we]=this.codec.createDeserializer().readObject(jo,r[we]));throw this.awsQueryCompatible&&this.mixin.queryCompatOutput(r,Oe),this.mixin.decorateServiceException(Object.assign(Ho,g,{$fault:D.getMergedTraits().error,message:A},Oe),r)}};var O=class extends b{constructor({defaultNamespace:t,errorTypeRegistries:o,serviceTarget:s,awsQueryCompatible:r,jsonCodec:y}){super({defaultNamespace:t,errorTypeRegistries:o,serviceTarget:s,awsQueryCompatible:r,jsonCodec:y})}getShapeId(){return"aws.protocols#awsJson1_1"}getJsonRpcVersion(){return"1.1"}getDefaultContentType(){return"application/x-amz-json-1.1"}};var Jt=async(e,t,o)=>({operation:We(t).operation,region:await Ge(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function Wo(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"kms",region:e.region},propertiesExtractor:(t,o)=>({signingProperties:{config:t,context:o}})}}var Zt=e=>{let t=[];switch(e.operation){default:t.push(Wo(e))}return t},eo=e=>{let t=vt(e);return Object.assign(t,{authSchemePreference:Ge(e.authSchemePreference??[])})};var to=e=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"kms"}),w={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var oo={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 ro="AWS_EC2_METADATA_DISABLED",no=async e=>{let{ENV_CMDS_FULL_URI:t,ENV_CMDS_RELATIVE_URI:o,fromContainerMetadata:s,fromInstanceMetadata:r}=await import("./dist-es-NDZJSZR3.js");if(process.env[o]||process.env[t]){e.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromHttp/fromContainerMetadata");let{fromHttp:y}=await import("./dist-es-OUTR3NFA.js");return Et(y(e),s(e))}return process.env[ro]&&process.env[ro]!=="false"?async()=>{throw new S("EC2 Instance Metadata Service access disabled",{logger:e.logger})}:(e.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromInstanceMetadata"),r(e))};function so(e,t){let o=zo(e),s,r,y,m=async x=>{if(x?.forceRefresh)return await o(x);if(y?.expiration&&y?.expiration?.getTime()<Date.now()&&(y=void 0),s)await s;else if(!y||t?.(y))if(y)r||(r=o(x).then(g=>{y=g}).finally(()=>{r=void 0}));else return s=o(x).then(g=>{y=g}).finally(()=>{s=void 0}),m(x);return y};return m}var zo=e=>async t=>{let o;for(let s of e)try{return await s(t)}catch(r){if(o=r,r?.tryNextLink)continue;throw r}throw o};var io=!1,ao=(e={})=>so([async()=>{if(e.profile??process.env[Gt])throw process.env[Xt]&&process.env[Vt]&&(io||((e.logger?.warn&&e.logger?.constructor?.name!=="NoOpLogger"?e.logger.warn.bind(e.logger):console.warn)(`@aws-sdk/credential-provider-node - defaultProvider::fromEnv WARNING:
1
+ import{a as Ne,b as qe,f as _,g as h}from"./chunk-RR5R4AKJ.js";import{a as E}from"./chunk-SDX64WW4.js";import{a as it}from"./chunk-4NVBWJ2Q.js";import{a as Xt,b as Vt,g as Ft}from"./chunk-7HOF72FC.js";import{a as Pt,b as It}from"./chunk-YR32FZAX.js";import{$ as Lt,A as dt,B as yt,C as mt,D as xt,E as vt,F as Rt,G as k,H as Kt,I as ft,J as gt,K as St,L as Ct,M as _t,N as ht,Q as $t,R as Dt,S as At,T as kt,U as Mt,V as bt,W as Ot,X as wt,Y as M,Z as Tt,_ as Ut,a as Xe,aa as Nt,b as Ve,ba as qt,c as Fe,ca as Ht,d as He,da as jt,e as je,ea as Wt,f as We,fa as Bt,g as Ge,ga as zt,h as Be,ha as Qt,i as ze,ia as Yt,k as ot,l as nt,n as st,o as Te,v as at,w as ct,x as pt,y as lt,z as ut}from"./chunk-J7NVVT5I.js";import{a as rt,c as f}from"./chunk-PXU2OOBT.js";import{a as Et}from"./chunk-DIXI4M5O.js";import{a as Gt}from"./chunk-FGJ5K4WM.js";import{b as Qe,c as Ze,e as et,f as tt}from"./chunk-7DCGNQSQ.js";import{d as Ye,e as Je}from"./chunk-QEIMNOY2.js";import{b as S}from"./chunk-EXLRPVEX.js";import{randomUUID as is}from"crypto";var b=class extends it{serializer;deserializer;serviceTarget;codec;mixin;awsQueryCompatible;constructor({defaultNamespace:t,errorTypeRegistries:o,serviceTarget:s,awsQueryCompatible:r,jsonCodec:y}){super({defaultNamespace:t,errorTypeRegistries:o}),this.serviceTarget=s,this.codec=y??new It({timestampFormat:{useTrait:!0,default:7},jsonName:!1}),this.serializer=this.codec.createSerializer(),this.deserializer=this.codec.createDeserializer(),this.awsQueryCompatible=!!r,this.mixin=new ht(this.awsQueryCompatible)}async serializeRequest(t,o,s){let r=await super.serializeRequest(t,o,s);return r.path.endsWith("/")||(r.path+="/"),Object.assign(r.headers,{"content-type":`application/x-amz-json-${this.getJsonRpcVersion()}`,"x-amz-target":`${this.serviceTarget}.${t.name}`}),this.awsQueryCompatible&&(r.headers["x-amzn-query-mode"]="true"),(ot(t.input)==="unit"||!r.body)&&(r.body="{}"),r}getPayloadCodec(){return this.codec}async handleError(t,o,s,r,y){this.awsQueryCompatible&&this.mixin.setQueryCompatError(r,s);let m=Pt(s,r)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,m,this.options.defaultNamespace);let{errorSchema:x,errorMetadata:g}=await this.mixin.getErrorSchemaOrThrowBaseException(m,this.options.defaultNamespace,s,r,y,this.awsQueryCompatible?this.mixin.findQueryCompatibleError:void 0),D=st.of(x),A=r.message??r.Message??"UnknownError",be=this.compositeErrorRegistry.getErrorCtor(x)??Error,Ho=new be(A),Oe={};for(let[we,jo]of D.structIterator())r[we]!=null&&(Oe[we]=this.codec.createDeserializer().readObject(jo,r[we]));throw this.awsQueryCompatible&&this.mixin.queryCompatOutput(r,Oe),this.mixin.decorateServiceException(Object.assign(Ho,g,{$fault:D.getMergedTraits().error,message:A},Oe),r)}};var O=class extends b{constructor({defaultNamespace:t,errorTypeRegistries:o,serviceTarget:s,awsQueryCompatible:r,jsonCodec:y}){super({defaultNamespace:t,errorTypeRegistries:o,serviceTarget:s,awsQueryCompatible:r,jsonCodec:y})}getShapeId(){return"aws.protocols#awsJson1_1"}getJsonRpcVersion(){return"1.1"}getDefaultContentType(){return"application/x-amz-json-1.1"}};var Jt=async(e,t,o)=>({operation:We(t).operation,region:await Ge(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function Wo(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"kms",region:e.region},propertiesExtractor:(t,o)=>({signingProperties:{config:t,context:o}})}}var Zt=e=>{let t=[];switch(e.operation){default:t.push(Wo(e))}return t},eo=e=>{let t=vt(e);return Object.assign(t,{authSchemePreference:Ge(e.authSchemePreference??[])})};var to=e=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"kms"}),w={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var oo={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 ro="AWS_EC2_METADATA_DISABLED",no=async e=>{let{ENV_CMDS_FULL_URI:t,ENV_CMDS_RELATIVE_URI:o,fromContainerMetadata:s,fromInstanceMetadata:r}=await import("./dist-es-ZA2NRM7G.js");if(process.env[o]||process.env[t]){e.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromHttp/fromContainerMetadata");let{fromHttp:y}=await import("./dist-es-GP7DK3S3.js");return Et(y(e),s(e))}return process.env[ro]&&process.env[ro]!=="false"?async()=>{throw new S("EC2 Instance Metadata Service access disabled",{logger:e.logger})}:(e.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromInstanceMetadata"),r(e))};function so(e,t){let o=zo(e),s,r,y,m=async x=>{if(x?.forceRefresh)return await o(x);if(y?.expiration&&y?.expiration?.getTime()<Date.now()&&(y=void 0),s)await s;else if(!y||t?.(y))if(y)r||(r=o(x).then(g=>{y=g}).finally(()=>{r=void 0}));else return s=o(x).then(g=>{y=g}).finally(()=>{s=void 0}),m(x);return y};return m}var zo=e=>async t=>{let o;for(let s of e)try{return await s(t)}catch(r){if(o=r,r?.tryNextLink)continue;throw r}throw o};var io=!1,ao=(e={})=>so([async()=>{if(e.profile??process.env[Gt])throw process.env[Xt]&&process.env[Vt]&&(io||((e.logger?.warn&&e.logger?.constructor?.name!=="NoOpLogger"?e.logger.warn.bind(e.logger):console.warn)(`@aws-sdk/credential-provider-node - defaultProvider::fromEnv WARNING:
2
2
  Multiple credential sources detected:
3
3
  Both AWS_PROFILE and the pair AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY static credentials are set.
4
4
  This SDK will proceed with the AWS_PROFILE value.
@@ -6,4 +6,4 @@ import{a as Ne,b as qe,f as _,g as h}from"./chunk-RR5R4AKJ.js";import{a as E}fro
6
6
  However, a future version may change this behavior to prefer the ENV static credentials.
7
7
  Please ensure that your environment only sets either the AWS_PROFILE or the
8
8
  AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY pair.
9
- `),io=!0)),new S("AWS_PROFILE is set, skipping fromEnv provider.",{logger:e.logger,tryNextLink:!0});return e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromEnv"),Ft(e)()},async t=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromSSO");let{ssoStartUrl:o,ssoAccountId:s,ssoRegion:r,ssoRoleName:y,ssoSession:m}=e;if(!o&&!s&&!r&&!y&&!m)throw new S("Skipping SSO provider in default chain (inputs do not include SSO fields).",{logger:e.logger});let{fromSSO:x}=await import("./dist-es-WTYBIVJ2.js");return x(e)(t)},async t=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromIni");let{fromIni:o}=await import("./dist-es-NVFYVK4E.js");return o(e)(t)},async t=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromProcess");let{fromProcess:o}=await import("./dist-es-UGE2JJUB.js");return o(e)(t)},async t=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromTokenFile");let{fromTokenFile:o}=await import("./dist-es-M3FWVZJF.js");return o(e)(t)},async()=>(e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::remoteProvider"),(await no(e))()),async()=>{throw new S("Could not load credentials from any providers",{tryNextLink:!1,logger:e.logger})}],Qo);var Qo=e=>e?.expiration!==void 0&&e.expiration.getTime()-Date.now()<3e5;var Ro="required";var R="argv";var co="isSet",I="booleanEquals",C="error",P="endpoint",K="tree",Ue="PartitionResult",po={[Ro]:!1,type:"string"},lo={[Ro]:!0,default:!1,type:"boolean"},uo={ref:"Endpoint"},Ko={fn:I,[R]:[{ref:"UseFIPS"},!0]},fo={fn:I,[R]:[{ref:"UseDualStack"},!0]},v={},yo={fn:"getAttr",[R]:[{ref:Ue},"supportsFIPS"]},mo={fn:I,[R]:[!0,{fn:"getAttr",[R]:[{ref:Ue},"supportsDualStack"]}]},xo=[Ko],Eo=[fo],vo=[{ref:"Region"}],Yo={version:"1.0",parameters:{Region:po,UseDualStack:lo,UseFIPS:lo,Endpoint:po},rules:[{conditions:[{fn:co,[R]:[uo]}],rules:[{conditions:xo,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:C},{conditions:Eo,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:C},{endpoint:{url:uo,properties:v,headers:v},type:P}],type:K},{conditions:[{fn:co,[R]:vo}],rules:[{conditions:[{fn:"aws.partition",[R]:vo,assign:Ue}],rules:[{conditions:[Ko,fo],rules:[{conditions:[{fn:I,[R]:[!0,yo]},mo],rules:[{endpoint:{url:"https://kms-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:v,headers:v},type:P}],type:K},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:C}],type:K},{conditions:xo,rules:[{conditions:[{fn:I,[R]:[yo,!0]}],rules:[{endpoint:{url:"https://kms-fips.{Region}.{PartitionResult#dnsSuffix}",properties:v,headers:v},type:P}],type:K},{error:"FIPS is enabled but this partition does not support FIPS",type:C}],type:K},{conditions:Eo,rules:[{conditions:[mo],rules:[{endpoint:{url:"https://kms.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:v,headers:v},type:P}],type:K},{error:"DualStack is enabled but this partition does not support DualStack",type:C}],type:K},{endpoint:{url:"https://kms.{Region}.{PartitionResult#dnsSuffix}",properties:v,headers:v},type:P}],type:K}],type:K},{error:"Invalid Configuration: Missing Region",type:C}]},go=Yo;var Jo=new pt({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),So=(e,t={})=>Jo.get(e,()=>ut(go,{endpointParams:e,logger:t.logger}));lt.aws=dt;var i=class e extends Kt{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};var G=class e extends i{name="AlreadyExistsException";$fault="client";constructor(t){super({name:"AlreadyExistsException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},T=class e extends i{name="DependencyTimeoutException";$fault="server";constructor(t){super({name:"DependencyTimeoutException",$fault:"server",...t}),Object.setPrototypeOf(this,e.prototype)}},U=class e extends i{name="InvalidArnException";$fault="client";constructor(t){super({name:"InvalidArnException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},L=class e extends i{name="KMSInternalException";$fault="server";constructor(t){super({name:"KMSInternalException",$fault:"server",...t}),Object.setPrototypeOf(this,e.prototype)}},N=class e extends i{name="KMSInvalidStateException";$fault="client";constructor(t){super({name:"KMSInvalidStateException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},q=class e extends i{name="NotFoundException";$fault="client";constructor(t){super({name:"NotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},X=class e extends i{name="CloudHsmClusterInUseException";$fault="client";constructor(t){super({name:"CloudHsmClusterInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},V=class e extends i{name="CloudHsmClusterInvalidConfigurationException";$fault="client";constructor(t){super({name:"CloudHsmClusterInvalidConfigurationException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},F=class e extends i{name="CloudHsmClusterNotActiveException";$fault="client";constructor(t){super({name:"CloudHsmClusterNotActiveException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},H=class e extends i{name="CloudHsmClusterNotFoundException";$fault="client";constructor(t){super({name:"CloudHsmClusterNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},j=class e extends i{name="CloudHsmClusterNotRelatedException";$fault="client";constructor(t){super({name:"CloudHsmClusterNotRelatedException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},W=class e extends i{name="ConflictException";$fault="client";constructor(t){super({name:"ConflictException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},B=class e extends i{name="CustomKeyStoreInvalidStateException";$fault="client";constructor(t){super({name:"CustomKeyStoreInvalidStateException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},z=class e extends i{name="CustomKeyStoreNotFoundException";$fault="client";constructor(t){super({name:"CustomKeyStoreNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Q=class e extends i{name="InvalidAliasNameException";$fault="client";constructor(t){super({name:"InvalidAliasNameException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Y=class e extends i{name="LimitExceededException";$fault="client";constructor(t){super({name:"LimitExceededException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},J=class e extends i{name="CustomKeyStoreNameInUseException";$fault="client";constructor(t){super({name:"CustomKeyStoreNameInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Z=class e extends i{name="IncorrectTrustAnchorException";$fault="client";constructor(t){super({name:"IncorrectTrustAnchorException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ee=class e extends i{name="XksProxyIncorrectAuthenticationCredentialException";$fault="client";constructor(t){super({name:"XksProxyIncorrectAuthenticationCredentialException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},te=class e extends i{name="XksProxyInvalidConfigurationException";$fault="client";constructor(t){super({name:"XksProxyInvalidConfigurationException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},oe=class e extends i{name="XksProxyInvalidResponseException";$fault="client";constructor(t){super({name:"XksProxyInvalidResponseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},re=class e extends i{name="XksProxyUriEndpointInUseException";$fault="client";constructor(t){super({name:"XksProxyUriEndpointInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ne=class e extends i{name="XksProxyUriInUseException";$fault="client";constructor(t){super({name:"XksProxyUriInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},se=class e extends i{name="XksProxyUriUnreachableException";$fault="client";constructor(t){super({name:"XksProxyUriUnreachableException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ie=class e extends i{name="XksProxyVpcEndpointServiceInUseException";$fault="client";constructor(t){super({name:"XksProxyVpcEndpointServiceInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ae=class e extends i{name="XksProxyVpcEndpointServiceInvalidConfigurationException";$fault="client";constructor(t){super({name:"XksProxyVpcEndpointServiceInvalidConfigurationException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ce=class e extends i{name="XksProxyVpcEndpointServiceNotFoundException";$fault="client";constructor(t){super({name:"XksProxyVpcEndpointServiceNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},pe=class e extends i{name="DisabledException";$fault="client";constructor(t){super({name:"DisabledException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},le=class e extends i{name="DryRunOperationException";$fault="client";constructor(t){super({name:"DryRunOperationException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ue=class e extends i{name="InvalidGrantTokenException";$fault="client";constructor(t){super({name:"InvalidGrantTokenException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},de=class e extends i{name="MalformedPolicyDocumentException";$fault="client";constructor(t){super({name:"MalformedPolicyDocumentException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ye=class e extends i{name="TagException";$fault="client";constructor(t){super({name:"TagException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},me=class e extends i{name="UnsupportedOperationException";$fault="client";constructor(t){super({name:"UnsupportedOperationException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},xe=class e extends i{name="XksKeyAlreadyInUseException";$fault="client";constructor(t){super({name:"XksKeyAlreadyInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Ee=class e extends i{name="XksKeyInvalidConfigurationException";$fault="client";constructor(t){super({name:"XksKeyInvalidConfigurationException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ve=class e extends i{name="XksKeyNotFoundException";$fault="client";constructor(t){super({name:"XksKeyNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Re=class e extends i{name="CustomKeyStoreHasCMKsException";$fault="client";constructor(t){super({name:"CustomKeyStoreHasCMKsException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Ke=class e extends i{name="IncorrectKeyException";$fault="client";constructor(t){super({name:"IncorrectKeyException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},fe=class e extends i{name="InvalidCiphertextException";$fault="client";constructor(t){super({name:"InvalidCiphertextException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ge=class e extends i{name="InvalidKeyUsageException";$fault="client";constructor(t){super({name:"InvalidKeyUsageException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Se=class e extends i{name="KeyUnavailableException";$fault="server";constructor(t){super({name:"KeyUnavailableException",$fault:"server",...t}),Object.setPrototypeOf(this,e.prototype)}},Ce=class e extends i{name="InvalidMarkerException";$fault="client";constructor(t){super({name:"InvalidMarkerException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},_e=class e extends i{name="ExpiredImportTokenException";$fault="client";constructor(t){super({name:"ExpiredImportTokenException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},he=class e extends i{name="IncorrectKeyMaterialException";$fault="client";constructor(t){super({name:"IncorrectKeyMaterialException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Pe=class e extends i{name="InvalidImportTokenException";$fault="client";constructor(t){super({name:"InvalidImportTokenException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Ie=class e extends i{name="InvalidGrantIdException";$fault="client";constructor(t){super({name:"InvalidGrantIdException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},$e=class e extends i{name="KMSInvalidMacException";$fault="client";constructor(t){super({name:"KMSInvalidMacException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},De=class e extends i{name="KMSInvalidSignatureException";$fault="client";constructor(t){super({name:"KMSInvalidSignatureException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}};var Zo="AttestationDocument",er="AlreadyExistsException";var Co="CiphertextBlob";var tr="ConflictException";var _o="CiphertextForRecipient";var or="CloudHsmClusterInvalidConfigurationException",rr="CloudHsmClusterInUseException",nr="CloudHsmClusterNotActiveException",sr="CloudHsmClusterNotFoundException",ir="CloudHsmClusterNotRelatedException";var ar="CustomKeyStoreHasCMKsException";var cr="CustomKeyStoreInvalidStateException";var pr="CustomKeyStoreNotFoundException",lr="CustomKeyStoreNameInUseException";var ur="DisabledException";var ho="DryRun",dr="DryRunModifiers",yr="DryRunOperationException",mr="DecryptRequest",xr="DecryptResponse";var Er="DependencyTimeoutException",vr="Decrypt";var Po="EncryptionAlgorithm";var Io="EncryptionContext";var Rr="ExpiredImportTokenException";var Kr="GenerateDataKey";var fr="GenerateDataKeyRequest",gr="GenerateDataKeyResponse";var $o="GrantTokens";var Sr="InvalidArnException",Cr="InvalidAliasNameException",_r="InvalidCiphertextException",hr="InvalidGrantIdException",Pr="InvalidGrantTokenException",Ir="InvalidImportTokenException",$r="IncorrectKeyException";var Dr="IncorrectKeyMaterialException";var Ar="InvalidKeyUsageException",kr="InvalidMarkerException";var Mr="IncorrectTrustAnchorException";var br="KeyEncryptionAlgorithm",Ae="KeyId";var Do="KeyMaterialId";var Or="KMSInternalException",wr="KMSInvalidMacException",Gr="KMSInvalidSignatureException",Tr="KMSInvalidStateException";var Ur="KeySpec";var Lr="KeyUnavailableException";var Nr="LimitExceededException";var qr="MalformedPolicyDocumentException";var Xr="NotFoundException";var Vr="NumberOfBytes";var Fr="PlaintextType";var Ao="Plaintext",ko="Recipient";var Hr="RecipientInfo";var jr="TagException";var Wr="UnsupportedOperationException";var Br="XksKeyAlreadyInUseException";var zr="XksKeyInvalidConfigurationException",Qr="XksKeyNotFoundException";var Yr="XksProxyIncorrectAuthenticationCredentialException",Jr="XksProxyInvalidConfigurationException",Zr="XksProxyInvalidResponseException";var en="XksProxyUriEndpointInUseException",tn="XksProxyUriInUseException";var on="XksProxyUriUnreachableException",rn="XksProxyVpcEndpointServiceInvalidConfigurationException",nn="XksProxyVpcEndpointServiceInUseException";var sn="XksProxyVpcEndpointServiceNotFoundException";var c="awsQueryError",d="client",p="error",l="httpError",u="message",Mo="smithy.ts.sdk.synthetic.com.amazonaws.kms",Le="server",n="com.amazonaws.kms",bo=Te.for(Mo),an=[-3,Mo,"KMSServiceException",0,[],[]];bo.registerError(an,i);var a=Te.for(n),cn=[-3,n,er,{[c]:["AlreadyExists",409],[p]:d,[l]:409},[u],[0]];a.registerError(cn,G);var pn=[-3,n,rr,{[c]:["CloudHsmClusterInUseException",400],[p]:d,[l]:400},[u],[0]];a.registerError(pn,X);var ln=[-3,n,or,{[c]:["CloudHsmClusterInvalidConfigurationException",400],[p]:d,[l]:400},[u],[0]];a.registerError(ln,V);var un=[-3,n,nr,{[c]:["CloudHsmClusterNotActiveException",400],[p]:d,[l]:400},[u],[0]];a.registerError(un,F);var dn=[-3,n,sr,{[c]:["CloudHsmClusterNotFoundException",400],[p]:d,[l]:400},[u],[0]];a.registerError(dn,H);var yn=[-3,n,ir,{[c]:["CloudHsmClusterNotRelatedException",400],[p]:d,[l]:400},[u],[0]];a.registerError(yn,j);var mn=[-3,n,tr,{[c]:["ConflictException",409],[p]:d,[l]:409},[u],[0]];a.registerError(mn,W);var xn=[-3,n,ar,{[c]:["CustomKeyStoreHasCMKsException",400],[p]:d,[l]:400},[u],[0]];a.registerError(xn,Re);var En=[-3,n,cr,{[c]:["CustomKeyStoreInvalidStateException",400],[p]:d,[l]:400},[u],[0]];a.registerError(En,B);var vn=[-3,n,lr,{[c]:["CustomKeyStoreNameInUseException",400],[p]:d,[l]:400},[u],[0]];a.registerError(vn,J);var Rn=[-3,n,pr,{[c]:["CustomKeyStoreNotFoundException",400],[p]:d,[l]:400},[u],[0]];a.registerError(Rn,z);var Kn=[-3,n,Er,{[c]:["DependencyTimeout",503],[p]:Le,[l]:503},[u],[0]];a.registerError(Kn,T);var fn=[-3,n,ur,{[c]:["Disabled",409],[p]:d,[l]:409},[u],[0]];a.registerError(fn,pe);var gn=[-3,n,yr,{[c]:["DryRunOperation",412],[p]:d,[l]:412},[u],[0]];a.registerError(gn,le);var Sn=[-3,n,Rr,{[c]:["ExpiredImportTokenException",400],[p]:d,[l]:400},[u],[0]];a.registerError(Sn,_e);var Cn=[-3,n,$r,{[c]:["IncorrectKeyException",400],[p]:d,[l]:400},[u],[0]];a.registerError(Cn,Ke);var _n=[-3,n,Dr,{[c]:["IncorrectKeyMaterialException",400],[p]:d,[l]:400},[u],[0]];a.registerError(_n,he);var hn=[-3,n,Mr,{[c]:["IncorrectTrustAnchorException",400],[p]:d,[l]:400},[u],[0]];a.registerError(hn,Z);var Pn=[-3,n,Cr,{[c]:["InvalidAliasName",400],[p]:d,[l]:400},[u],[0]];a.registerError(Pn,Q);var In=[-3,n,Sr,{[c]:["InvalidArn",400],[p]:d,[l]:400},[u],[0]];a.registerError(In,U);var $n=[-3,n,_r,{[c]:["InvalidCiphertext",400],[p]:d,[l]:400},[u],[0]];a.registerError($n,fe);var Dn=[-3,n,hr,{[c]:["InvalidGrantId",400],[p]:d,[l]:400},[u],[0]];a.registerError(Dn,Ie);var An=[-3,n,Pr,{[c]:["InvalidGrantToken",400],[p]:d,[l]:400},[u],[0]];a.registerError(An,ue);var kn=[-3,n,Ir,{[c]:["InvalidImportTokenException",400],[p]:d,[l]:400},[u],[0]];a.registerError(kn,Pe);var Mn=[-3,n,Ar,{[c]:["InvalidKeyUsage",400],[p]:d,[l]:400},[u],[0]];a.registerError(Mn,ge);var bn=[-3,n,kr,{[c]:["InvalidMarker",400],[p]:d,[l]:400},[u],[0]];a.registerError(bn,Ce);var On=[-3,n,Lr,{[c]:["KeyUnavailable",500],[p]:Le,[l]:500},[u],[0]];a.registerError(On,Se);var wn=[-3,n,Or,{[c]:["KMSInternal",500],[p]:Le,[l]:500},[u],[0]];a.registerError(wn,L);var Gn=[-3,n,wr,{[c]:["KMSInvalidMac",400],[p]:d,[l]:400},[u],[0]];a.registerError(Gn,$e);var Tn=[-3,n,Gr,{[c]:["KMSInvalidSignature",400],[p]:d,[l]:400},[u],[0]];a.registerError(Tn,De);var Un=[-3,n,Tr,{[c]:["KMSInvalidStateException",409],[p]:d,[l]:409},[u],[0]];a.registerError(Un,N);var Ln=[-3,n,Nr,{[c]:["LimitExceeded",400],[p]:d,[l]:400},[u],[0]];a.registerError(Ln,Y);var Nn=[-3,n,qr,{[c]:["MalformedPolicyDocument",400],[p]:d,[l]:400},[u],[0]];a.registerError(Nn,de);var qn=[-3,n,Xr,{[c]:["NotFound",404],[p]:d,[l]:404},[u],[0]];a.registerError(qn,q);var Xn=[-3,n,jr,{[c]:["TagException",400],[p]:d,[l]:400},[u],[0]];a.registerError(Xn,ye);var Vn=[-3,n,Wr,{[c]:["UnsupportedOperation",400],[p]:d,[l]:400},[u],[0]];a.registerError(Vn,me);var Fn=[-3,n,Br,{[c]:["XksKeyAlreadyInUse",400],[p]:d,[l]:400},[u],[0]];a.registerError(Fn,xe);var Hn=[-3,n,zr,{[c]:["XksKeyInvalidConfiguration",400],[p]:d,[l]:400},[u],[0]];a.registerError(Hn,Ee);var jn=[-3,n,Qr,{[c]:["XksKeyNotFoundException",400],[p]:d,[l]:400},[u],[0]];a.registerError(jn,ve);var Wn=[-3,n,Yr,{[c]:["XksProxyIncorrectAuthenticationCredentialException",400],[p]:d,[l]:400},[u],[0]];a.registerError(Wn,ee);var Bn=[-3,n,Jr,{[c]:["XksProxyInvalidConfigurationException",400],[p]:d,[l]:400},[u],[0]];a.registerError(Bn,te);var zn=[-3,n,Zr,{[c]:["XksProxyInvalidResponseException",400],[p]:d,[l]:400},[u],[0]];a.registerError(zn,oe);var Qn=[-3,n,en,{[c]:["XksProxyUriEndpointInUseException",400],[p]:d,[l]:400},[u],[0]];a.registerError(Qn,re);var Yn=[-3,n,tn,{[c]:["XksProxyUriInUseException",400],[p]:d,[l]:400},[u],[0]];a.registerError(Yn,ne);var Jn=[-3,n,on,{[c]:["XksProxyUriUnreachableException",400],[p]:d,[l]:400},[u],[0]];a.registerError(Jn,se);var Zn=[-3,n,nn,{[c]:["XksProxyVpcEndpointServiceInUseException",400],[p]:d,[l]:400},[u],[0]];a.registerError(Zn,ie);var es=[-3,n,rn,{[c]:["XksProxyVpcEndpointServiceInvalidConfigurationException",400],[p]:d,[l]:400},[u],[0]];a.registerError(es,ae);var ts=[-3,n,sn,{[c]:["XksProxyVpcEndpointServiceNotFoundException",400],[p]:d,[l]:400},[u],[0]];a.registerError(ts,ce);var Oo=[bo,a];var wo=[0,n,Fr,8,21];var os=[3,n,mr,0,[Co,Io,$o,Ae,Po,ko,ho,dr],[21,128,64,0,0,()=>Go,2,64]],rs=[3,n,xr,0,[Ae,Ao,Po,_o,Do],[0,[()=>wo,0],0,21,0]];var ns=[3,n,fr,0,[Ae,Io,Vr,Ur,$o,ko,ho],[0,128,1,0,64,()=>Go,2],1],ss=[3,n,gr,0,[Co,Ao,Ae,_o,Do],[21,[()=>wo,0],0,21,0]];var Go=[3,n,Hr,0,[br,Zo],[0,21]];var To=[9,n,vr,0,()=>os,()=>rs];var Uo=[9,n,Kr,0,()=>ns,()=>ss];var Lo=e=>({apiVersion:"2014-11-01",base64Decoder:e?.base64Decoder??Qe,base64Encoder:e?.base64Encoder??Ze,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??So,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Zt,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new mt}],logger:e?.logger??new _t,protocol:e?.protocol??O,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.kms",errorTypeRegistries:Oo,xmlNamespace:"https://trent.amazonaws.com/doc/2014-11-01/",version:"2014-11-01",serviceTarget:"TrentService"},serviceId:e?.serviceId??"KMS",urlParser:e?.urlParser??rt,utf8Decoder:e?.utf8Decoder??Ye,utf8Encoder:e?.utf8Encoder??Je});var No=e=>{gt(process.version);let t=zt(e),o=()=>t().then(ft),s=Lo(e);yt(process.version);let r={profile:e?.profile,logger:s.logger};return{...s,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??f(xt,r),bodyLengthChecker:e?.bodyLengthChecker??Bt,credentialDefaultProvider:e?.credentialDefaultProvider??ao,defaultUserAgentProvider:e?.defaultUserAgentProvider??Ht({serviceId:s.serviceId,clientVersion:oo.version}),maxAttempts:e?.maxAttempts??f(Ut,e),region:e?.region??f(Mt,{...bt,...r}),requestHandler:et.create(e?.requestHandler??o),retryMode:e?.retryMode??f({...Nt,default:async()=>(await o()).retryMode||$t},e),sha256:e?.sha256??Wt.bind(null,"sha256"),streamCollector:e?.streamCollector??tt,useDualstackEndpoint:e?.useDualstackEndpoint??f(At,r),useFipsEndpoint:e?.useFipsEndpoint??f(kt,r),userAgentAppId:e?.userAgentAppId??f(jt,r)}};var qo=e=>{let t=e.httpAuthSchemes,o=e.httpAuthSchemeProvider,s=e.credentials;return{setHttpAuthScheme(r){let y=t.findIndex(m=>m.schemeId===r.schemeId);y===-1?t.push(r):t.splice(y,1,r)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(r){o=r},httpAuthSchemeProvider(){return o},setCredentials(r){s=r},credentials(){return s}}},Xo=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()});var Vo=(e,t)=>{let o=Object.assign(Qt(e),St(e),Xe(e),qo(e));return t.forEach(s=>s.configure(o)),Object.assign(e,Yt(o),Ct(o),Ve(o),Xo(o))};var ke=class extends Rt{config;constructor(...[t]){let o=No(t||{});super(o),this.initConfig=o;let s=to(o),r=ct(s),y=Lt(r),m=Ot(y),x=m,g=Tt(x),D=eo(g),A=Vo(D,t?.extensions||[]);this.config=A,this.middlewareStack.use(nt(this.config)),this.middlewareStack.use(Dt(this.config)),this.middlewareStack.use(qt(this.config)),this.middlewareStack.use(wt(this.config)),this.middlewareStack.use(Fe(this.config)),this.middlewareStack.use(He(this.config)),this.middlewareStack.use(je(this.config)),this.middlewareStack.use(Be(this.config,{httpAuthSchemeParametersProvider:Jt,identityProviderConfigProvider:async be=>new at({"aws.auth#sigv4":be.credentials})})),this.middlewareStack.use(ze(this.config))}destroy(){super.destroy()}};var Me=class extends k.classBuilder().ep(w).m(function(t,o,s,r){return[M(s,t.getEndpointParameterInstructions())]}).s("TrentService","Decrypt",{}).n("KMSClient","DecryptCommand").sc(To).build(){};var $=class extends k.classBuilder().ep(w).m(function(t,o,s,r){return[M(s,t.getEndpointParameterInstructions())]}).s("TrentService","GenerateDataKey",{}).n("KMSClient","GenerateDataKeyCommand").sc(Uo).build(){};var Fo=class{name="aws-kms";client;keyId;keyVersion;constructor(t){let o=t.keyId??process.env.AWS_KMS_KEY_ID??process.env.AWS_KMS_KEY_ARN;if(!o)throw new Error("AWS KMS Key ID or ARN required. Set AWS_KMS_KEY_ID or pass keyId in config.");this.keyId=o,this.keyVersion=t.keyVersion??1;let s=t.region??process.env.AWS_REGION??"us-east-1";this.client=new ke({region:s,...t.credentials&&{credentials:{accessKeyId:t.credentials.accessKeyId,secretAccessKey:t.credentials.secretAccessKey}}}),E.debug("[vault:aws-kms] Initialized",{keyId:o,region:s,keyVersion:this.keyVersion})}async encrypt(t,o){try{let s=await this.client.send(new $({KeyId:this.keyId,KeySpec:"AES_256"})),r=s.Plaintext,y=s.CiphertextBlob;if(!r||!y)throw new Error("AWS KMS GenerateDataKey returned empty DEK");let m=Ne(t,r),x={id:o?.id??is(),ciphertext:_(m.ciphertext),encryptedDek:_(y),iv:_(m.iv),authTag:_(m.authTag),keyVersion:this.keyVersion,algorithm:"aes-256-gcm",...o?.tenantId!==void 0?{tenantId:o.tenantId}:{},metadata:o?.metadata,createdAt:new Date().toISOString()};return E.debug("[vault:aws-kms] Secret encrypted",{id:x.id,tenantId:o?.tenantId}),x}catch(s){throw E.error("[vault:aws-kms] Encryption failed",{error:s}),new Error(`AWS KMS encryption failed: ${s instanceof Error?s.message:String(s)}`)}}async decrypt(t,o){try{if(o?.tenantId&&t.tenantId&&t.tenantId!==o.tenantId)throw new Error("Tenant ID mismatch");let r=(await this.client.send(new Me({CiphertextBlob:h(t.encryptedDek)}))).Plaintext;if(!r)throw new Error("AWS KMS Decrypt returned empty DEK");let y=qe(h(t.ciphertext),r,{iv:h(t.iv),authTag:h(t.authTag)});return E.debug("[vault:aws-kms] Secret decrypted",{id:t.id,tenantId:o?.tenantId}),y.toString("utf-8")}catch(s){throw E.error("[vault:aws-kms] Decryption failed",{error:s}),new Error(`AWS KMS decryption failed: ${s instanceof Error?s.message:String(s)}`)}}async rotateKey(t){try{let o=await this.decrypt(t),s=await this.encrypt(o,{id:t.id,...t.tenantId!==void 0?{tenantId:t.tenantId}:{},metadata:t.metadata});return s.rotatedAt=new Date().toISOString(),E.debug("[vault:aws-kms] Key rotated",{id:t.id}),s}catch(o){throw E.error("[vault:aws-kms] Key rotation failed",{error:o}),new Error(`Key rotation failed: ${o instanceof Error?o.message:String(o)}`)}}async rotateKek(){this.keyVersion+=1,E.info("[vault:aws-kms] KEK rotated",{newVersion:this.keyVersion})}async generateDek(){try{return(await this.client.send(new $({KeyId:this.keyId,KeySpec:"AES_256"}))).Plaintext}catch(t){throw E.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(),E.debug("[vault:aws-kms] Closed")}};export{Fo as a};
9
+ `),io=!0)),new S("AWS_PROFILE is set, skipping fromEnv provider.",{logger:e.logger,tryNextLink:!0});return e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromEnv"),Ft(e)()},async t=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromSSO");let{ssoStartUrl:o,ssoAccountId:s,ssoRegion:r,ssoRoleName:y,ssoSession:m}=e;if(!o&&!s&&!r&&!y&&!m)throw new S("Skipping SSO provider in default chain (inputs do not include SSO fields).",{logger:e.logger});let{fromSSO:x}=await import("./dist-es-FJUQ4DBK.js");return x(e)(t)},async t=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromIni");let{fromIni:o}=await import("./dist-es-YKXA2GQ2.js");return o(e)(t)},async t=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromProcess");let{fromProcess:o}=await import("./dist-es-JXNWCJHW.js");return o(e)(t)},async t=>{e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromTokenFile");let{fromTokenFile:o}=await import("./dist-es-4EORLV5B.js");return o(e)(t)},async()=>(e.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::remoteProvider"),(await no(e))()),async()=>{throw new S("Could not load credentials from any providers",{tryNextLink:!1,logger:e.logger})}],Qo);var Qo=e=>e?.expiration!==void 0&&e.expiration.getTime()-Date.now()<3e5;var Ro="required";var R="argv";var co="isSet",I="booleanEquals",C="error",P="endpoint",K="tree",Ue="PartitionResult",po={[Ro]:!1,type:"string"},lo={[Ro]:!0,default:!1,type:"boolean"},uo={ref:"Endpoint"},Ko={fn:I,[R]:[{ref:"UseFIPS"},!0]},fo={fn:I,[R]:[{ref:"UseDualStack"},!0]},v={},yo={fn:"getAttr",[R]:[{ref:Ue},"supportsFIPS"]},mo={fn:I,[R]:[!0,{fn:"getAttr",[R]:[{ref:Ue},"supportsDualStack"]}]},xo=[Ko],Eo=[fo],vo=[{ref:"Region"}],Yo={version:"1.0",parameters:{Region:po,UseDualStack:lo,UseFIPS:lo,Endpoint:po},rules:[{conditions:[{fn:co,[R]:[uo]}],rules:[{conditions:xo,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:C},{conditions:Eo,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:C},{endpoint:{url:uo,properties:v,headers:v},type:P}],type:K},{conditions:[{fn:co,[R]:vo}],rules:[{conditions:[{fn:"aws.partition",[R]:vo,assign:Ue}],rules:[{conditions:[Ko,fo],rules:[{conditions:[{fn:I,[R]:[!0,yo]},mo],rules:[{endpoint:{url:"https://kms-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:v,headers:v},type:P}],type:K},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:C}],type:K},{conditions:xo,rules:[{conditions:[{fn:I,[R]:[yo,!0]}],rules:[{endpoint:{url:"https://kms-fips.{Region}.{PartitionResult#dnsSuffix}",properties:v,headers:v},type:P}],type:K},{error:"FIPS is enabled but this partition does not support FIPS",type:C}],type:K},{conditions:Eo,rules:[{conditions:[mo],rules:[{endpoint:{url:"https://kms.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:v,headers:v},type:P}],type:K},{error:"DualStack is enabled but this partition does not support DualStack",type:C}],type:K},{endpoint:{url:"https://kms.{Region}.{PartitionResult#dnsSuffix}",properties:v,headers:v},type:P}],type:K}],type:K},{error:"Invalid Configuration: Missing Region",type:C}]},go=Yo;var Jo=new pt({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),So=(e,t={})=>Jo.get(e,()=>ut(go,{endpointParams:e,logger:t.logger}));lt.aws=dt;var i=class e extends Kt{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};var G=class e extends i{name="AlreadyExistsException";$fault="client";constructor(t){super({name:"AlreadyExistsException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},T=class e extends i{name="DependencyTimeoutException";$fault="server";constructor(t){super({name:"DependencyTimeoutException",$fault:"server",...t}),Object.setPrototypeOf(this,e.prototype)}},U=class e extends i{name="InvalidArnException";$fault="client";constructor(t){super({name:"InvalidArnException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},L=class e extends i{name="KMSInternalException";$fault="server";constructor(t){super({name:"KMSInternalException",$fault:"server",...t}),Object.setPrototypeOf(this,e.prototype)}},N=class e extends i{name="KMSInvalidStateException";$fault="client";constructor(t){super({name:"KMSInvalidStateException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},q=class e extends i{name="NotFoundException";$fault="client";constructor(t){super({name:"NotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},X=class e extends i{name="CloudHsmClusterInUseException";$fault="client";constructor(t){super({name:"CloudHsmClusterInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},V=class e extends i{name="CloudHsmClusterInvalidConfigurationException";$fault="client";constructor(t){super({name:"CloudHsmClusterInvalidConfigurationException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},F=class e extends i{name="CloudHsmClusterNotActiveException";$fault="client";constructor(t){super({name:"CloudHsmClusterNotActiveException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},H=class e extends i{name="CloudHsmClusterNotFoundException";$fault="client";constructor(t){super({name:"CloudHsmClusterNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},j=class e extends i{name="CloudHsmClusterNotRelatedException";$fault="client";constructor(t){super({name:"CloudHsmClusterNotRelatedException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},W=class e extends i{name="ConflictException";$fault="client";constructor(t){super({name:"ConflictException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},B=class e extends i{name="CustomKeyStoreInvalidStateException";$fault="client";constructor(t){super({name:"CustomKeyStoreInvalidStateException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},z=class e extends i{name="CustomKeyStoreNotFoundException";$fault="client";constructor(t){super({name:"CustomKeyStoreNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Q=class e extends i{name="InvalidAliasNameException";$fault="client";constructor(t){super({name:"InvalidAliasNameException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Y=class e extends i{name="LimitExceededException";$fault="client";constructor(t){super({name:"LimitExceededException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},J=class e extends i{name="CustomKeyStoreNameInUseException";$fault="client";constructor(t){super({name:"CustomKeyStoreNameInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Z=class e extends i{name="IncorrectTrustAnchorException";$fault="client";constructor(t){super({name:"IncorrectTrustAnchorException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ee=class e extends i{name="XksProxyIncorrectAuthenticationCredentialException";$fault="client";constructor(t){super({name:"XksProxyIncorrectAuthenticationCredentialException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},te=class e extends i{name="XksProxyInvalidConfigurationException";$fault="client";constructor(t){super({name:"XksProxyInvalidConfigurationException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},oe=class e extends i{name="XksProxyInvalidResponseException";$fault="client";constructor(t){super({name:"XksProxyInvalidResponseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},re=class e extends i{name="XksProxyUriEndpointInUseException";$fault="client";constructor(t){super({name:"XksProxyUriEndpointInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ne=class e extends i{name="XksProxyUriInUseException";$fault="client";constructor(t){super({name:"XksProxyUriInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},se=class e extends i{name="XksProxyUriUnreachableException";$fault="client";constructor(t){super({name:"XksProxyUriUnreachableException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ie=class e extends i{name="XksProxyVpcEndpointServiceInUseException";$fault="client";constructor(t){super({name:"XksProxyVpcEndpointServiceInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ae=class e extends i{name="XksProxyVpcEndpointServiceInvalidConfigurationException";$fault="client";constructor(t){super({name:"XksProxyVpcEndpointServiceInvalidConfigurationException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ce=class e extends i{name="XksProxyVpcEndpointServiceNotFoundException";$fault="client";constructor(t){super({name:"XksProxyVpcEndpointServiceNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},pe=class e extends i{name="DisabledException";$fault="client";constructor(t){super({name:"DisabledException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},le=class e extends i{name="DryRunOperationException";$fault="client";constructor(t){super({name:"DryRunOperationException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ue=class e extends i{name="InvalidGrantTokenException";$fault="client";constructor(t){super({name:"InvalidGrantTokenException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},de=class e extends i{name="MalformedPolicyDocumentException";$fault="client";constructor(t){super({name:"MalformedPolicyDocumentException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ye=class e extends i{name="TagException";$fault="client";constructor(t){super({name:"TagException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},me=class e extends i{name="UnsupportedOperationException";$fault="client";constructor(t){super({name:"UnsupportedOperationException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},xe=class e extends i{name="XksKeyAlreadyInUseException";$fault="client";constructor(t){super({name:"XksKeyAlreadyInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Ee=class e extends i{name="XksKeyInvalidConfigurationException";$fault="client";constructor(t){super({name:"XksKeyInvalidConfigurationException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ve=class e extends i{name="XksKeyNotFoundException";$fault="client";constructor(t){super({name:"XksKeyNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Re=class e extends i{name="CustomKeyStoreHasCMKsException";$fault="client";constructor(t){super({name:"CustomKeyStoreHasCMKsException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Ke=class e extends i{name="IncorrectKeyException";$fault="client";constructor(t){super({name:"IncorrectKeyException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},fe=class e extends i{name="InvalidCiphertextException";$fault="client";constructor(t){super({name:"InvalidCiphertextException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ge=class e extends i{name="InvalidKeyUsageException";$fault="client";constructor(t){super({name:"InvalidKeyUsageException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Se=class e extends i{name="KeyUnavailableException";$fault="server";constructor(t){super({name:"KeyUnavailableException",$fault:"server",...t}),Object.setPrototypeOf(this,e.prototype)}},Ce=class e extends i{name="InvalidMarkerException";$fault="client";constructor(t){super({name:"InvalidMarkerException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},_e=class e extends i{name="ExpiredImportTokenException";$fault="client";constructor(t){super({name:"ExpiredImportTokenException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},he=class e extends i{name="IncorrectKeyMaterialException";$fault="client";constructor(t){super({name:"IncorrectKeyMaterialException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Pe=class e extends i{name="InvalidImportTokenException";$fault="client";constructor(t){super({name:"InvalidImportTokenException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Ie=class e extends i{name="InvalidGrantIdException";$fault="client";constructor(t){super({name:"InvalidGrantIdException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},$e=class e extends i{name="KMSInvalidMacException";$fault="client";constructor(t){super({name:"KMSInvalidMacException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},De=class e extends i{name="KMSInvalidSignatureException";$fault="client";constructor(t){super({name:"KMSInvalidSignatureException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}};var Zo="AttestationDocument",er="AlreadyExistsException";var Co="CiphertextBlob";var tr="ConflictException";var _o="CiphertextForRecipient";var or="CloudHsmClusterInvalidConfigurationException",rr="CloudHsmClusterInUseException",nr="CloudHsmClusterNotActiveException",sr="CloudHsmClusterNotFoundException",ir="CloudHsmClusterNotRelatedException";var ar="CustomKeyStoreHasCMKsException";var cr="CustomKeyStoreInvalidStateException";var pr="CustomKeyStoreNotFoundException",lr="CustomKeyStoreNameInUseException";var ur="DisabledException";var ho="DryRun",dr="DryRunModifiers",yr="DryRunOperationException",mr="DecryptRequest",xr="DecryptResponse";var Er="DependencyTimeoutException",vr="Decrypt";var Po="EncryptionAlgorithm";var Io="EncryptionContext";var Rr="ExpiredImportTokenException";var Kr="GenerateDataKey";var fr="GenerateDataKeyRequest",gr="GenerateDataKeyResponse";var $o="GrantTokens";var Sr="InvalidArnException",Cr="InvalidAliasNameException",_r="InvalidCiphertextException",hr="InvalidGrantIdException",Pr="InvalidGrantTokenException",Ir="InvalidImportTokenException",$r="IncorrectKeyException";var Dr="IncorrectKeyMaterialException";var Ar="InvalidKeyUsageException",kr="InvalidMarkerException";var Mr="IncorrectTrustAnchorException";var br="KeyEncryptionAlgorithm",Ae="KeyId";var Do="KeyMaterialId";var Or="KMSInternalException",wr="KMSInvalidMacException",Gr="KMSInvalidSignatureException",Tr="KMSInvalidStateException";var Ur="KeySpec";var Lr="KeyUnavailableException";var Nr="LimitExceededException";var qr="MalformedPolicyDocumentException";var Xr="NotFoundException";var Vr="NumberOfBytes";var Fr="PlaintextType";var Ao="Plaintext",ko="Recipient";var Hr="RecipientInfo";var jr="TagException";var Wr="UnsupportedOperationException";var Br="XksKeyAlreadyInUseException";var zr="XksKeyInvalidConfigurationException",Qr="XksKeyNotFoundException";var Yr="XksProxyIncorrectAuthenticationCredentialException",Jr="XksProxyInvalidConfigurationException",Zr="XksProxyInvalidResponseException";var en="XksProxyUriEndpointInUseException",tn="XksProxyUriInUseException";var on="XksProxyUriUnreachableException",rn="XksProxyVpcEndpointServiceInvalidConfigurationException",nn="XksProxyVpcEndpointServiceInUseException";var sn="XksProxyVpcEndpointServiceNotFoundException";var c="awsQueryError",d="client",p="error",l="httpError",u="message",Mo="smithy.ts.sdk.synthetic.com.amazonaws.kms",Le="server",n="com.amazonaws.kms",bo=Te.for(Mo),an=[-3,Mo,"KMSServiceException",0,[],[]];bo.registerError(an,i);var a=Te.for(n),cn=[-3,n,er,{[c]:["AlreadyExists",409],[p]:d,[l]:409},[u],[0]];a.registerError(cn,G);var pn=[-3,n,rr,{[c]:["CloudHsmClusterInUseException",400],[p]:d,[l]:400},[u],[0]];a.registerError(pn,X);var ln=[-3,n,or,{[c]:["CloudHsmClusterInvalidConfigurationException",400],[p]:d,[l]:400},[u],[0]];a.registerError(ln,V);var un=[-3,n,nr,{[c]:["CloudHsmClusterNotActiveException",400],[p]:d,[l]:400},[u],[0]];a.registerError(un,F);var dn=[-3,n,sr,{[c]:["CloudHsmClusterNotFoundException",400],[p]:d,[l]:400},[u],[0]];a.registerError(dn,H);var yn=[-3,n,ir,{[c]:["CloudHsmClusterNotRelatedException",400],[p]:d,[l]:400},[u],[0]];a.registerError(yn,j);var mn=[-3,n,tr,{[c]:["ConflictException",409],[p]:d,[l]:409},[u],[0]];a.registerError(mn,W);var xn=[-3,n,ar,{[c]:["CustomKeyStoreHasCMKsException",400],[p]:d,[l]:400},[u],[0]];a.registerError(xn,Re);var En=[-3,n,cr,{[c]:["CustomKeyStoreInvalidStateException",400],[p]:d,[l]:400},[u],[0]];a.registerError(En,B);var vn=[-3,n,lr,{[c]:["CustomKeyStoreNameInUseException",400],[p]:d,[l]:400},[u],[0]];a.registerError(vn,J);var Rn=[-3,n,pr,{[c]:["CustomKeyStoreNotFoundException",400],[p]:d,[l]:400},[u],[0]];a.registerError(Rn,z);var Kn=[-3,n,Er,{[c]:["DependencyTimeout",503],[p]:Le,[l]:503},[u],[0]];a.registerError(Kn,T);var fn=[-3,n,ur,{[c]:["Disabled",409],[p]:d,[l]:409},[u],[0]];a.registerError(fn,pe);var gn=[-3,n,yr,{[c]:["DryRunOperation",412],[p]:d,[l]:412},[u],[0]];a.registerError(gn,le);var Sn=[-3,n,Rr,{[c]:["ExpiredImportTokenException",400],[p]:d,[l]:400},[u],[0]];a.registerError(Sn,_e);var Cn=[-3,n,$r,{[c]:["IncorrectKeyException",400],[p]:d,[l]:400},[u],[0]];a.registerError(Cn,Ke);var _n=[-3,n,Dr,{[c]:["IncorrectKeyMaterialException",400],[p]:d,[l]:400},[u],[0]];a.registerError(_n,he);var hn=[-3,n,Mr,{[c]:["IncorrectTrustAnchorException",400],[p]:d,[l]:400},[u],[0]];a.registerError(hn,Z);var Pn=[-3,n,Cr,{[c]:["InvalidAliasName",400],[p]:d,[l]:400},[u],[0]];a.registerError(Pn,Q);var In=[-3,n,Sr,{[c]:["InvalidArn",400],[p]:d,[l]:400},[u],[0]];a.registerError(In,U);var $n=[-3,n,_r,{[c]:["InvalidCiphertext",400],[p]:d,[l]:400},[u],[0]];a.registerError($n,fe);var Dn=[-3,n,hr,{[c]:["InvalidGrantId",400],[p]:d,[l]:400},[u],[0]];a.registerError(Dn,Ie);var An=[-3,n,Pr,{[c]:["InvalidGrantToken",400],[p]:d,[l]:400},[u],[0]];a.registerError(An,ue);var kn=[-3,n,Ir,{[c]:["InvalidImportTokenException",400],[p]:d,[l]:400},[u],[0]];a.registerError(kn,Pe);var Mn=[-3,n,Ar,{[c]:["InvalidKeyUsage",400],[p]:d,[l]:400},[u],[0]];a.registerError(Mn,ge);var bn=[-3,n,kr,{[c]:["InvalidMarker",400],[p]:d,[l]:400},[u],[0]];a.registerError(bn,Ce);var On=[-3,n,Lr,{[c]:["KeyUnavailable",500],[p]:Le,[l]:500},[u],[0]];a.registerError(On,Se);var wn=[-3,n,Or,{[c]:["KMSInternal",500],[p]:Le,[l]:500},[u],[0]];a.registerError(wn,L);var Gn=[-3,n,wr,{[c]:["KMSInvalidMac",400],[p]:d,[l]:400},[u],[0]];a.registerError(Gn,$e);var Tn=[-3,n,Gr,{[c]:["KMSInvalidSignature",400],[p]:d,[l]:400},[u],[0]];a.registerError(Tn,De);var Un=[-3,n,Tr,{[c]:["KMSInvalidStateException",409],[p]:d,[l]:409},[u],[0]];a.registerError(Un,N);var Ln=[-3,n,Nr,{[c]:["LimitExceeded",400],[p]:d,[l]:400},[u],[0]];a.registerError(Ln,Y);var Nn=[-3,n,qr,{[c]:["MalformedPolicyDocument",400],[p]:d,[l]:400},[u],[0]];a.registerError(Nn,de);var qn=[-3,n,Xr,{[c]:["NotFound",404],[p]:d,[l]:404},[u],[0]];a.registerError(qn,q);var Xn=[-3,n,jr,{[c]:["TagException",400],[p]:d,[l]:400},[u],[0]];a.registerError(Xn,ye);var Vn=[-3,n,Wr,{[c]:["UnsupportedOperation",400],[p]:d,[l]:400},[u],[0]];a.registerError(Vn,me);var Fn=[-3,n,Br,{[c]:["XksKeyAlreadyInUse",400],[p]:d,[l]:400},[u],[0]];a.registerError(Fn,xe);var Hn=[-3,n,zr,{[c]:["XksKeyInvalidConfiguration",400],[p]:d,[l]:400},[u],[0]];a.registerError(Hn,Ee);var jn=[-3,n,Qr,{[c]:["XksKeyNotFoundException",400],[p]:d,[l]:400},[u],[0]];a.registerError(jn,ve);var Wn=[-3,n,Yr,{[c]:["XksProxyIncorrectAuthenticationCredentialException",400],[p]:d,[l]:400},[u],[0]];a.registerError(Wn,ee);var Bn=[-3,n,Jr,{[c]:["XksProxyInvalidConfigurationException",400],[p]:d,[l]:400},[u],[0]];a.registerError(Bn,te);var zn=[-3,n,Zr,{[c]:["XksProxyInvalidResponseException",400],[p]:d,[l]:400},[u],[0]];a.registerError(zn,oe);var Qn=[-3,n,en,{[c]:["XksProxyUriEndpointInUseException",400],[p]:d,[l]:400},[u],[0]];a.registerError(Qn,re);var Yn=[-3,n,tn,{[c]:["XksProxyUriInUseException",400],[p]:d,[l]:400},[u],[0]];a.registerError(Yn,ne);var Jn=[-3,n,on,{[c]:["XksProxyUriUnreachableException",400],[p]:d,[l]:400},[u],[0]];a.registerError(Jn,se);var Zn=[-3,n,nn,{[c]:["XksProxyVpcEndpointServiceInUseException",400],[p]:d,[l]:400},[u],[0]];a.registerError(Zn,ie);var es=[-3,n,rn,{[c]:["XksProxyVpcEndpointServiceInvalidConfigurationException",400],[p]:d,[l]:400},[u],[0]];a.registerError(es,ae);var ts=[-3,n,sn,{[c]:["XksProxyVpcEndpointServiceNotFoundException",400],[p]:d,[l]:400},[u],[0]];a.registerError(ts,ce);var Oo=[bo,a];var wo=[0,n,Fr,8,21];var os=[3,n,mr,0,[Co,Io,$o,Ae,Po,ko,ho,dr],[21,128,64,0,0,()=>Go,2,64]],rs=[3,n,xr,0,[Ae,Ao,Po,_o,Do],[0,[()=>wo,0],0,21,0]];var ns=[3,n,fr,0,[Ae,Io,Vr,Ur,$o,ko,ho],[0,128,1,0,64,()=>Go,2],1],ss=[3,n,gr,0,[Co,Ao,Ae,_o,Do],[21,[()=>wo,0],0,21,0]];var Go=[3,n,Hr,0,[br,Zo],[0,21]];var To=[9,n,vr,0,()=>os,()=>rs];var Uo=[9,n,Kr,0,()=>ns,()=>ss];var Lo=e=>({apiVersion:"2014-11-01",base64Decoder:e?.base64Decoder??Qe,base64Encoder:e?.base64Encoder??Ze,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??So,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Zt,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new mt}],logger:e?.logger??new _t,protocol:e?.protocol??O,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.kms",errorTypeRegistries:Oo,xmlNamespace:"https://trent.amazonaws.com/doc/2014-11-01/",version:"2014-11-01",serviceTarget:"TrentService"},serviceId:e?.serviceId??"KMS",urlParser:e?.urlParser??rt,utf8Decoder:e?.utf8Decoder??Ye,utf8Encoder:e?.utf8Encoder??Je});var No=e=>{gt(process.version);let t=zt(e),o=()=>t().then(ft),s=Lo(e);yt(process.version);let r={profile:e?.profile,logger:s.logger};return{...s,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??f(xt,r),bodyLengthChecker:e?.bodyLengthChecker??Bt,credentialDefaultProvider:e?.credentialDefaultProvider??ao,defaultUserAgentProvider:e?.defaultUserAgentProvider??Ht({serviceId:s.serviceId,clientVersion:oo.version}),maxAttempts:e?.maxAttempts??f(Ut,e),region:e?.region??f(Mt,{...bt,...r}),requestHandler:et.create(e?.requestHandler??o),retryMode:e?.retryMode??f({...Nt,default:async()=>(await o()).retryMode||$t},e),sha256:e?.sha256??Wt.bind(null,"sha256"),streamCollector:e?.streamCollector??tt,useDualstackEndpoint:e?.useDualstackEndpoint??f(At,r),useFipsEndpoint:e?.useFipsEndpoint??f(kt,r),userAgentAppId:e?.userAgentAppId??f(jt,r)}};var qo=e=>{let t=e.httpAuthSchemes,o=e.httpAuthSchemeProvider,s=e.credentials;return{setHttpAuthScheme(r){let y=t.findIndex(m=>m.schemeId===r.schemeId);y===-1?t.push(r):t.splice(y,1,r)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(r){o=r},httpAuthSchemeProvider(){return o},setCredentials(r){s=r},credentials(){return s}}},Xo=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()});var Vo=(e,t)=>{let o=Object.assign(Qt(e),St(e),Xe(e),qo(e));return t.forEach(s=>s.configure(o)),Object.assign(e,Yt(o),Ct(o),Ve(o),Xo(o))};var ke=class extends Rt{config;constructor(...[t]){let o=No(t||{});super(o),this.initConfig=o;let s=to(o),r=ct(s),y=Lt(r),m=Ot(y),x=m,g=Tt(x),D=eo(g),A=Vo(D,t?.extensions||[]);this.config=A,this.middlewareStack.use(nt(this.config)),this.middlewareStack.use(Dt(this.config)),this.middlewareStack.use(qt(this.config)),this.middlewareStack.use(wt(this.config)),this.middlewareStack.use(Fe(this.config)),this.middlewareStack.use(He(this.config)),this.middlewareStack.use(je(this.config)),this.middlewareStack.use(Be(this.config,{httpAuthSchemeParametersProvider:Jt,identityProviderConfigProvider:async be=>new at({"aws.auth#sigv4":be.credentials})})),this.middlewareStack.use(ze(this.config))}destroy(){super.destroy()}};var Me=class extends k.classBuilder().ep(w).m(function(t,o,s,r){return[M(s,t.getEndpointParameterInstructions())]}).s("TrentService","Decrypt",{}).n("KMSClient","DecryptCommand").sc(To).build(){};var $=class extends k.classBuilder().ep(w).m(function(t,o,s,r){return[M(s,t.getEndpointParameterInstructions())]}).s("TrentService","GenerateDataKey",{}).n("KMSClient","GenerateDataKeyCommand").sc(Uo).build(){};var Fo=class{name="aws-kms";client;keyId;keyVersion;constructor(t){let o=t.keyId??process.env.AWS_KMS_KEY_ID??process.env.AWS_KMS_KEY_ARN;if(!o)throw new Error("AWS KMS Key ID or ARN required. Set AWS_KMS_KEY_ID or pass keyId in config.");this.keyId=o,this.keyVersion=t.keyVersion??1;let s=t.region??process.env.AWS_REGION??"us-east-1";this.client=new ke({region:s,...t.credentials&&{credentials:{accessKeyId:t.credentials.accessKeyId,secretAccessKey:t.credentials.secretAccessKey}}}),E.debug("[vault:aws-kms] Initialized",{keyId:o,region:s,keyVersion:this.keyVersion})}async encrypt(t,o){try{let s=await this.client.send(new $({KeyId:this.keyId,KeySpec:"AES_256"})),r=s.Plaintext,y=s.CiphertextBlob;if(!r||!y)throw new Error("AWS KMS GenerateDataKey returned empty DEK");let m=Ne(t,r),x={id:o?.id??is(),ciphertext:_(m.ciphertext),encryptedDek:_(y),iv:_(m.iv),authTag:_(m.authTag),keyVersion:this.keyVersion,algorithm:"aes-256-gcm",...o?.tenantId!==void 0?{tenantId:o.tenantId}:{},metadata:o?.metadata,createdAt:new Date().toISOString()};return E.debug("[vault:aws-kms] Secret encrypted",{id:x.id,tenantId:o?.tenantId}),x}catch(s){throw E.error("[vault:aws-kms] Encryption failed",{error:s}),new Error(`AWS KMS encryption failed: ${s instanceof Error?s.message:String(s)}`)}}async decrypt(t,o){try{if(o?.tenantId&&t.tenantId&&t.tenantId!==o.tenantId)throw new Error("Tenant ID mismatch");let r=(await this.client.send(new Me({CiphertextBlob:h(t.encryptedDek)}))).Plaintext;if(!r)throw new Error("AWS KMS Decrypt returned empty DEK");let y=qe(h(t.ciphertext),r,{iv:h(t.iv),authTag:h(t.authTag)});return E.debug("[vault:aws-kms] Secret decrypted",{id:t.id,tenantId:o?.tenantId}),y.toString("utf-8")}catch(s){throw E.error("[vault:aws-kms] Decryption failed",{error:s}),new Error(`AWS KMS decryption failed: ${s instanceof Error?s.message:String(s)}`)}}async rotateKey(t){try{let o=await this.decrypt(t),s=await this.encrypt(o,{id:t.id,...t.tenantId!==void 0?{tenantId:t.tenantId}:{},metadata:t.metadata});return s.rotatedAt=new Date().toISOString(),E.debug("[vault:aws-kms] Key rotated",{id:t.id}),s}catch(o){throw E.error("[vault:aws-kms] Key rotation failed",{error:o}),new Error(`Key rotation failed: ${o instanceof Error?o.message:String(o)}`)}}async rotateKek(){this.keyVersion+=1,E.info("[vault:aws-kms] KEK rotated",{newVersion:this.keyVersion})}async generateDek(){try{return(await this.client.send(new $({KeyId:this.keyId,KeySpec:"AES_256"}))).Plaintext}catch(t){throw E.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(),E.debug("[vault:aws-kms] Closed")}};export{Fo as a};
@@ -1 +1 @@
1
- import{a as H,b as q,c as O}from"./chunk-ZEEOYOWD.js";import{a as J,b as F}from"./chunk-2VIWVVHK.js";import{N as U,j as z,m as I,n as g,p as $,q as Q,s as T,t as V,u as v}from"./chunk-O3WYNHSC.js";import{a as D}from"./chunk-7VJYOZUP.js";import{c as B,i as j}from"./chunk-7DCGNQSQ.js";import{a as N}from"./chunk-XSSPJU77.js";import{d as R,e as k}from"./chunk-QEIMNOY2.js";function W(b){return(b.includes(",")||b.includes('"'))&&(b=`"${b.replace(/"/g,'\\"')}"`),b}function Z(b,i,t){if(t<=0||!Number.isInteger(t))throw new Error("Invalid number of delimiters ("+t+") for splitEvery.");let e=b.split(i);if(t===1)return e;let r=[],o="";for(let s=0;s<e.length;s++)o===""?o=e[s]:o+=i+e[s],(s+1)%t===0&&(r.push(o),o="");return o!==""&&r.push(o),r}var x=class extends V{async serializeRequest(i,t,e){let r={...t??{}},o=this.serializer,s={},h={},c=await e.endpoint(),d=g.of(i?.input),S=[],p=[],y=!1,m,n=new N({protocol:"",hostname:"",port:void 0,path:"",fragment:void 0,query:s,headers:h,body:void 0});if(c){this.updateServiceEndpoint(n,c),this.setHostPrefix(n,i,r);let a=I(i.traits);if(a.http){n.method=a.http[0];let[f,l]=a.http[1].split("?");n.path=="/"?n.path=f:n.path+=f;let u=new URLSearchParams(l??"");Object.assign(s,Object.fromEntries(u))}}for(let[a,f]of d.structIterator()){let l=f.getMergedTraits()??{},u=r[a];if(u==null&&!f.isIdempotencyToken()){if(l.httpLabel&&(n.path.includes(`{${a}+}`)||n.path.includes(`{${a}}`)))throw new Error(`No value provided for input HTTP label: ${a}.`);continue}if(l.httpPayload)f.isStreaming()?f.isStructSchema()?r[a]&&(m=await this.serializeEventStream({eventStream:r[a],requestSchema:d})):m=u:(o.write(f,u),m=o.flush()),delete r[a];else if(l.httpLabel){o.write(f,u);let w=o.flush();n.path.includes(`{${a}+}`)?n.path=n.path.replace(`{${a}+}`,w.split("/").map(H).join("/")):n.path.includes(`{${a}}`)&&(n.path=n.path.replace(`{${a}}`,H(w))),delete r[a]}else if(l.httpHeader)o.write(f,u),h[l.httpHeader.toLowerCase()]=String(o.flush()),delete r[a];else if(typeof l.httpPrefixHeaders=="string"){for(let[w,P]of Object.entries(u)){let L=l.httpPrefixHeaders+w;o.write([f.getValueSchema(),{httpHeader:L}],P),h[L.toLowerCase()]=o.flush()}delete r[a]}else l.httpQuery||l.httpQueryParams?(this.serializeQuery(f,u,s),delete r[a]):(y=!0,S.push(a),p.push(f))}if(y&&r){let[a,f]=(d.getName(!0)??"#Unknown").split("#"),l=d.getSchema()[6],u=[3,a,f,d.getMergedTraits(),S,p,void 0];l?u[6]=l:u.pop(),o.write(u,r),m=o.flush()}return n.headers=h,n.query=s,n.body=m,n}serializeQuery(i,t,e){let r=this.serializer,o=i.getMergedTraits();if(o.httpQueryParams){for(let[s,h]of Object.entries(t))if(!(s in e)){let c=i.getValueSchema();Object.assign(c.getMergedTraits(),{...o,httpQuery:s,httpQueryParams:void 0}),this.serializeQuery(c,h,e)}return}if(i.isListSchema()){let s=!!i.getMergedTraits().sparse,h=[];for(let c of t){r.write([i.getValueSchema(),o],c);let d=r.flush();(s||d!==void 0)&&h.push(d)}e[o.httpQuery]=h}else r.write([i,o],t),e[o.httpQuery]=r.flush()}async deserializeResponse(i,t,e){let r=this.deserializer,o=g.of(i.output),s={};if(e.statusCode>=300){let c=await z(e.body,t);throw c.byteLength>0&&Object.assign(s,await r.read(15,c)),await this.handleError(i,t,e,s,this.deserializeMetadata(e)),new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(let c in e.headers){let d=e.headers[c];delete e.headers[c],e.headers[c.toLowerCase()]=d}let h=await this.deserializeHttpMessage(o,t,e,s);if(h.length){let c=await z(e.body,t);if(c.byteLength>0){let d=await r.read(o,c);for(let S of h)d[S]!=null&&(s[S]=d[S])}}else h.discardResponseBody&&await z(e.body,t);return s.$metadata=this.deserializeMetadata(e),s}async deserializeHttpMessage(i,t,e,r,o){let s;r instanceof Set?s=o:s=r;let h=!0,c=this.deserializer,d=g.of(i),S=[];for(let[p,y]of d.structIterator()){let m=y.getMemberTraits();if(m.httpPayload){if(h=!1,y.isStreaming())y.isStructSchema()?s[p]=await this.deserializeEventStream({response:e,responseSchema:d}):s[p]=D(e.body);else if(e.body){let a=await z(e.body,t);a.byteLength>0&&(s[p]=await c.read(y,a))}}else if(m.httpHeader){let n=String(m.httpHeader).toLowerCase(),a=e.headers[n];if(a!=null)if(y.isListSchema()){let f=y.getValueSchema();f.getMergedTraits().httpHeader=n;let l;f.isTimestampSchema()&&f.getSchema()===4?l=Z(a,",",2):l=q(a);let u=[];for(let w of l)u.push(await c.read(f,w.trim()));s[p]=u}else s[p]=await c.read(y,a)}else if(m.httpPrefixHeaders!==void 0){s[p]={};for(let[n,a]of Object.entries(e.headers))if(n.startsWith(m.httpPrefixHeaders)){let f=y.getValueSchema();f.getMergedTraits().httpHeader=n,s[p][n.slice(m.httpPrefixHeaders.length)]=await c.read(f,a)}}else m.httpResponseCode?s[p]=e.statusCode:S.push(p)}return S.discardResponseBody=h,S}};var M=class extends T{codecDeserializer;stringDeserializer;constructor(i,t){super(),this.codecDeserializer=i,this.stringDeserializer=new O(t)}setSerdeContext(i){this.stringDeserializer.setSerdeContext(i),this.codecDeserializer.setSerdeContext(i),this.serdeContext=i}read(i,t){let e=g.of(i),r=e.getMergedTraits(),o=this.serdeContext?.utf8Encoder??k;if(r.httpHeader||r.httpResponseCode)return this.stringDeserializer.read(e,o(t));if(r.httpPayload){if(e.isBlobSchema()){let s=this.serdeContext?.utf8Decoder??R;return typeof t=="string"?s(t):t}else if(e.isStringSchema())return"byteLength"in t?o(t):t}return this.codecDeserializer.read(e,t)}};var E=class extends T{settings;stringBuffer="";constructor(i){super(),this.settings=i}write(i,t){let e=g.of(i);switch(typeof t){case"object":if(t===null){this.stringBuffer="null";return}if(e.isTimestampSchema()){if(!(t instanceof Date))throw new Error(`@smithy/core/protocols - received non-Date value ${t} when schema expected Date in ${e.getName(!0)}`);switch(v(e,this.settings)){case 5:this.stringBuffer=t.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=j(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(e.isBlobSchema()&&"byteLength"in t){this.stringBuffer=(this.serdeContext?.base64Encoder??B)(t);return}if(e.isListSchema()&&Array.isArray(t)){let s="";for(let h of t){this.write([e.getValueSchema(),e.getMergedTraits()],h);let c=this.flush(),d=e.getValueSchema().isTimestampSchema()?c:W(c);s!==""&&(s+=", "),s+=d}this.stringBuffer=s;return}this.stringBuffer=JSON.stringify(t,null,2);break;case"string":let r=e.getMergedTraits().mediaType,o=t;if(r&&((r==="application/json"||r.endsWith("+json"))&&(o=Q.from(o)),e.getMergedTraits().httpHeader)){this.stringBuffer=(this.serdeContext?.base64Encoder??B)(o.toString());return}this.stringBuffer=t;break;default:e.isIdempotencyToken()?this.stringBuffer=$():this.stringBuffer=String(t)}}flush(){let i=this.stringBuffer;return this.stringBuffer="",i}};var C=class{codecSerializer;stringSerializer;buffer;constructor(i,t,e=new E(t)){this.codecSerializer=i,this.stringSerializer=e}setSerdeContext(i){this.codecSerializer.setSerdeContext(i),this.stringSerializer.setSerdeContext(i)}write(i,t){let e=g.of(i),r=e.getMergedTraits();if(r.httpHeader||r.httpLabel||r.httpQuery){this.stringSerializer.write(e,t),this.buffer=this.stringSerializer.flush();return}return this.codecSerializer.write(e,t)}flush(){if(this.buffer!==void 0){let i=this.buffer;return this.buffer=void 0,i}return this.codecSerializer.flush()}};var A=class extends x{serializer;deserializer;codec;mixin=new U;constructor({defaultNamespace:i,errorTypeRegistries:t}){super({defaultNamespace:i,errorTypeRegistries:t});let e={timestampFormat:{useTrait:!0,default:7},httpBindings:!0,jsonName:!0};this.codec=new F(e),this.serializer=new C(this.codec.createSerializer(),e),this.deserializer=new M(this.codec.createDeserializer(),e)}getShapeId(){return"aws.protocols#restJson1"}getPayloadCodec(){return this.codec}setSerdeContext(i){this.codec.setSerdeContext(i),super.setSerdeContext(i)}async serializeRequest(i,t,e){let r=await super.serializeRequest(i,t,e),o=g.of(i.input);if(!r.headers["content-type"]){let s=this.mixin.resolveRestContentType(this.getDefaultContentType(),o);s&&(r.headers["content-type"]=s)}return r.body==null&&r.headers["content-type"]===this.getDefaultContentType()&&(r.body="{}"),r}async deserializeResponse(i,t,e){let r=await super.deserializeResponse(i,t,e),o=g.of(i.output);for(let[s,h]of o.structIterator())h.getMemberTraits().httpPayload&&!(s in r)&&(r[s]=null);return r}async handleError(i,t,e,r,o){let s=J(e,r)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,s,this.options.defaultNamespace);let{errorSchema:h,errorMetadata:c}=await this.mixin.getErrorSchemaOrThrowBaseException(s,this.options.defaultNamespace,e,r,o),d=g.of(h),S=r.message??r.Message??"UnknownError",p=this.compositeErrorRegistry.getErrorCtor(h)??Error,y=new p(S);await this.deserializeHttpMessage(h,t,e,r);let m={};for(let[n,a]of d.structIterator()){let f=a.getMergedTraits().jsonName??n;m[n]=this.codec.createDeserializer().readObject(a,r[f])}throw this.mixin.decorateServiceException(Object.assign(y,c,{$fault:d.getMergedTraits().error,message:S},m),r)}getDefaultContentType(){return"application/json"}};export{A as a};
1
+ import{a as H,b as q,c as O}from"./chunk-A75AMTOI.js";import{a as J,b as F}from"./chunk-YR32FZAX.js";import{N as U,j as z,m as I,n as g,p as $,q as Q,s as T,t as V,u as v}from"./chunk-J7NVVT5I.js";import{a as D}from"./chunk-7VJYOZUP.js";import{c as B,i as j}from"./chunk-7DCGNQSQ.js";import{a as N}from"./chunk-XSSPJU77.js";import{d as R,e as k}from"./chunk-QEIMNOY2.js";function W(b){return(b.includes(",")||b.includes('"'))&&(b=`"${b.replace(/"/g,'\\"')}"`),b}function Z(b,i,t){if(t<=0||!Number.isInteger(t))throw new Error("Invalid number of delimiters ("+t+") for splitEvery.");let e=b.split(i);if(t===1)return e;let r=[],o="";for(let s=0;s<e.length;s++)o===""?o=e[s]:o+=i+e[s],(s+1)%t===0&&(r.push(o),o="");return o!==""&&r.push(o),r}var x=class extends V{async serializeRequest(i,t,e){let r={...t??{}},o=this.serializer,s={},h={},c=await e.endpoint(),d=g.of(i?.input),S=[],p=[],y=!1,m,n=new N({protocol:"",hostname:"",port:void 0,path:"",fragment:void 0,query:s,headers:h,body:void 0});if(c){this.updateServiceEndpoint(n,c),this.setHostPrefix(n,i,r);let a=I(i.traits);if(a.http){n.method=a.http[0];let[f,l]=a.http[1].split("?");n.path=="/"?n.path=f:n.path+=f;let u=new URLSearchParams(l??"");Object.assign(s,Object.fromEntries(u))}}for(let[a,f]of d.structIterator()){let l=f.getMergedTraits()??{},u=r[a];if(u==null&&!f.isIdempotencyToken()){if(l.httpLabel&&(n.path.includes(`{${a}+}`)||n.path.includes(`{${a}}`)))throw new Error(`No value provided for input HTTP label: ${a}.`);continue}if(l.httpPayload)f.isStreaming()?f.isStructSchema()?r[a]&&(m=await this.serializeEventStream({eventStream:r[a],requestSchema:d})):m=u:(o.write(f,u),m=o.flush()),delete r[a];else if(l.httpLabel){o.write(f,u);let w=o.flush();n.path.includes(`{${a}+}`)?n.path=n.path.replace(`{${a}+}`,w.split("/").map(H).join("/")):n.path.includes(`{${a}}`)&&(n.path=n.path.replace(`{${a}}`,H(w))),delete r[a]}else if(l.httpHeader)o.write(f,u),h[l.httpHeader.toLowerCase()]=String(o.flush()),delete r[a];else if(typeof l.httpPrefixHeaders=="string"){for(let[w,P]of Object.entries(u)){let L=l.httpPrefixHeaders+w;o.write([f.getValueSchema(),{httpHeader:L}],P),h[L.toLowerCase()]=o.flush()}delete r[a]}else l.httpQuery||l.httpQueryParams?(this.serializeQuery(f,u,s),delete r[a]):(y=!0,S.push(a),p.push(f))}if(y&&r){let[a,f]=(d.getName(!0)??"#Unknown").split("#"),l=d.getSchema()[6],u=[3,a,f,d.getMergedTraits(),S,p,void 0];l?u[6]=l:u.pop(),o.write(u,r),m=o.flush()}return n.headers=h,n.query=s,n.body=m,n}serializeQuery(i,t,e){let r=this.serializer,o=i.getMergedTraits();if(o.httpQueryParams){for(let[s,h]of Object.entries(t))if(!(s in e)){let c=i.getValueSchema();Object.assign(c.getMergedTraits(),{...o,httpQuery:s,httpQueryParams:void 0}),this.serializeQuery(c,h,e)}return}if(i.isListSchema()){let s=!!i.getMergedTraits().sparse,h=[];for(let c of t){r.write([i.getValueSchema(),o],c);let d=r.flush();(s||d!==void 0)&&h.push(d)}e[o.httpQuery]=h}else r.write([i,o],t),e[o.httpQuery]=r.flush()}async deserializeResponse(i,t,e){let r=this.deserializer,o=g.of(i.output),s={};if(e.statusCode>=300){let c=await z(e.body,t);throw c.byteLength>0&&Object.assign(s,await r.read(15,c)),await this.handleError(i,t,e,s,this.deserializeMetadata(e)),new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(let c in e.headers){let d=e.headers[c];delete e.headers[c],e.headers[c.toLowerCase()]=d}let h=await this.deserializeHttpMessage(o,t,e,s);if(h.length){let c=await z(e.body,t);if(c.byteLength>0){let d=await r.read(o,c);for(let S of h)d[S]!=null&&(s[S]=d[S])}}else h.discardResponseBody&&await z(e.body,t);return s.$metadata=this.deserializeMetadata(e),s}async deserializeHttpMessage(i,t,e,r,o){let s;r instanceof Set?s=o:s=r;let h=!0,c=this.deserializer,d=g.of(i),S=[];for(let[p,y]of d.structIterator()){let m=y.getMemberTraits();if(m.httpPayload){if(h=!1,y.isStreaming())y.isStructSchema()?s[p]=await this.deserializeEventStream({response:e,responseSchema:d}):s[p]=D(e.body);else if(e.body){let a=await z(e.body,t);a.byteLength>0&&(s[p]=await c.read(y,a))}}else if(m.httpHeader){let n=String(m.httpHeader).toLowerCase(),a=e.headers[n];if(a!=null)if(y.isListSchema()){let f=y.getValueSchema();f.getMergedTraits().httpHeader=n;let l;f.isTimestampSchema()&&f.getSchema()===4?l=Z(a,",",2):l=q(a);let u=[];for(let w of l)u.push(await c.read(f,w.trim()));s[p]=u}else s[p]=await c.read(y,a)}else if(m.httpPrefixHeaders!==void 0){s[p]={};for(let[n,a]of Object.entries(e.headers))if(n.startsWith(m.httpPrefixHeaders)){let f=y.getValueSchema();f.getMergedTraits().httpHeader=n,s[p][n.slice(m.httpPrefixHeaders.length)]=await c.read(f,a)}}else m.httpResponseCode?s[p]=e.statusCode:S.push(p)}return S.discardResponseBody=h,S}};var M=class extends T{codecDeserializer;stringDeserializer;constructor(i,t){super(),this.codecDeserializer=i,this.stringDeserializer=new O(t)}setSerdeContext(i){this.stringDeserializer.setSerdeContext(i),this.codecDeserializer.setSerdeContext(i),this.serdeContext=i}read(i,t){let e=g.of(i),r=e.getMergedTraits(),o=this.serdeContext?.utf8Encoder??k;if(r.httpHeader||r.httpResponseCode)return this.stringDeserializer.read(e,o(t));if(r.httpPayload){if(e.isBlobSchema()){let s=this.serdeContext?.utf8Decoder??R;return typeof t=="string"?s(t):t}else if(e.isStringSchema())return"byteLength"in t?o(t):t}return this.codecDeserializer.read(e,t)}};var E=class extends T{settings;stringBuffer="";constructor(i){super(),this.settings=i}write(i,t){let e=g.of(i);switch(typeof t){case"object":if(t===null){this.stringBuffer="null";return}if(e.isTimestampSchema()){if(!(t instanceof Date))throw new Error(`@smithy/core/protocols - received non-Date value ${t} when schema expected Date in ${e.getName(!0)}`);switch(v(e,this.settings)){case 5:this.stringBuffer=t.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=j(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(e.isBlobSchema()&&"byteLength"in t){this.stringBuffer=(this.serdeContext?.base64Encoder??B)(t);return}if(e.isListSchema()&&Array.isArray(t)){let s="";for(let h of t){this.write([e.getValueSchema(),e.getMergedTraits()],h);let c=this.flush(),d=e.getValueSchema().isTimestampSchema()?c:W(c);s!==""&&(s+=", "),s+=d}this.stringBuffer=s;return}this.stringBuffer=JSON.stringify(t,null,2);break;case"string":let r=e.getMergedTraits().mediaType,o=t;if(r&&((r==="application/json"||r.endsWith("+json"))&&(o=Q.from(o)),e.getMergedTraits().httpHeader)){this.stringBuffer=(this.serdeContext?.base64Encoder??B)(o.toString());return}this.stringBuffer=t;break;default:e.isIdempotencyToken()?this.stringBuffer=$():this.stringBuffer=String(t)}}flush(){let i=this.stringBuffer;return this.stringBuffer="",i}};var C=class{codecSerializer;stringSerializer;buffer;constructor(i,t,e=new E(t)){this.codecSerializer=i,this.stringSerializer=e}setSerdeContext(i){this.codecSerializer.setSerdeContext(i),this.stringSerializer.setSerdeContext(i)}write(i,t){let e=g.of(i),r=e.getMergedTraits();if(r.httpHeader||r.httpLabel||r.httpQuery){this.stringSerializer.write(e,t),this.buffer=this.stringSerializer.flush();return}return this.codecSerializer.write(e,t)}flush(){if(this.buffer!==void 0){let i=this.buffer;return this.buffer=void 0,i}return this.codecSerializer.flush()}};var A=class extends x{serializer;deserializer;codec;mixin=new U;constructor({defaultNamespace:i,errorTypeRegistries:t}){super({defaultNamespace:i,errorTypeRegistries:t});let e={timestampFormat:{useTrait:!0,default:7},httpBindings:!0,jsonName:!0};this.codec=new F(e),this.serializer=new C(this.codec.createSerializer(),e),this.deserializer=new M(this.codec.createDeserializer(),e)}getShapeId(){return"aws.protocols#restJson1"}getPayloadCodec(){return this.codec}setSerdeContext(i){this.codec.setSerdeContext(i),super.setSerdeContext(i)}async serializeRequest(i,t,e){let r=await super.serializeRequest(i,t,e),o=g.of(i.input);if(!r.headers["content-type"]){let s=this.mixin.resolveRestContentType(this.getDefaultContentType(),o);s&&(r.headers["content-type"]=s)}return r.body==null&&r.headers["content-type"]===this.getDefaultContentType()&&(r.body="{}"),r}async deserializeResponse(i,t,e){let r=await super.deserializeResponse(i,t,e),o=g.of(i.output);for(let[s,h]of o.structIterator())h.getMemberTraits().httpPayload&&!(s in r)&&(r[s]=null);return r}async handleError(i,t,e,r,o){let s=J(e,r)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,s,this.options.defaultNamespace);let{errorSchema:h,errorMetadata:c}=await this.mixin.getErrorSchemaOrThrowBaseException(s,this.options.defaultNamespace,e,r,o),d=g.of(h),S=r.message??r.Message??"UnknownError",p=this.compositeErrorRegistry.getErrorCtor(h)??Error,y=new p(S);await this.deserializeHttpMessage(h,t,e,r);let m={};for(let[n,a]of d.structIterator()){let f=a.getMergedTraits().jsonName??n;m[n]=this.codec.createDeserializer().readObject(a,r[f])}throw this.mixin.decorateServiceException(Object.assign(y,c,{$fault:d.getMergedTraits().error,message:S},m),r)}getDefaultContentType(){return"application/json"}};export{A as a};