@wraps.dev/cli 3.13.2 → 3.15.0

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.
@@ -1 +1 @@
1
- Built at: 2026-09-28T16:48:18.025Z
1
+ Built at: 2026-09-29T21:45:54.899Z
@@ -1 +1 @@
1
- Built at: 2026-09-28T16:48:17.825Z
1
+ Built at: 2026-09-29T21:45:54.715Z
@@ -1,17 +1,17 @@
1
- "use strict";var La=Object.create;var mt=Object.defineProperty;var Fa=Object.getOwnPropertyDescriptor;var za=Object.getOwnPropertyNames;var Ha=Object.getPrototypeOf,ja=Object.prototype.hasOwnProperty;var u=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(o){throw r=[o],o}};var Go=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},ut=(t,e)=>{for(var r in e)mt(t,r,{get:e[r],enumerable:!0})},Wo=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of za(e))!ja.call(t,n)&&n!==r&&mt(t,n,{get:()=>e[n],enumerable:!(o=Fa(e,n))||o.enumerable});return t};var we=(t,e,r)=>(r=t!=null?La(Ha(t)):{},Wo(e||!t||!t.__esModule?mt(r,"default",{value:t,enumerable:!0}):r,t)),gr=t=>Wo(mt({},"__esModule",{value:!0}),t);var dt,yr=u(()=>{dt=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]"});var $,ee,te=u(()=>{yr();$=(t,e=0,r=t.byteLength-e)=>{if(!dt(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return Buffer.from(t,e,r)},ee=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?Buffer.from(t,e):Buffer.from(t)}});var Va,xe,Jo=u(()=>{te();Va=/^[A-Za-z0-9+/]*={0,2}$/,xe=t=>{if(t.length*3%4!==0)throw new TypeError("Incorrect padding on base64 string.");if(!Va.exec(t))throw new TypeError("Invalid base64 string.");let e=ee(t,"base64");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}});var B,lt=u(()=>{te();B=t=>{let e=ee(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)}});var re,Sr=u(()=>{te();lt();re=t=>{let e;if(typeof t=="string"?e=B(t):e=t,typeof e!="object"||typeof e.byteOffset!="number"||typeof e.byteLength!="number")throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");return $(e.buffer,e.byteOffset,e.byteLength).toString("base64")}});function Qo(t,e,r,o){return class ht extends Uint8Array{static fromString(s,i="utf-8"){if(typeof s=="string")return i==="base64"?ht.mutate(o(s)):ht.mutate(e(s));throw new Error(`Unsupported conversion from ${typeof s} to Uint8ArrayBlobAdapter.`)}static mutate(s){return Object.setPrototypeOf(s,ht.prototype),s}transformToString(s="utf-8"){return s==="base64"?r(this):t(this)}}}var Xo=u(()=>{});var G,Ko=u(()=>{te();G=t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return $(t.buffer,t.byteOffset,t.byteLength).toString("utf8")}});function Zo(t){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?()=>crypto.randomUUID():()=>{let e=new Uint8Array(16);return t(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128,I[e[0]]+I[e[1]]+I[e[2]]+I[e[3]]+"-"+I[e[4]]+I[e[5]]+"-"+I[e[6]]+I[e[7]]+"-"+I[e[8]]+I[e[9]]+"-"+I[e[10]]+I[e[11]]+I[e[12]]+I[e[13]]+I[e[14]]+I[e[15]]}}var I,Yo=u(()=>{I=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"))});var en,tn=u(()=>{en=(t,e,r=o=>o)=>t});var rn,on,Ee,qa,Ge,Te,nn,pt,gt,yt,br,Ga,sn,wr,an,cn,We,fn,bt,Wa,ve,wt,mn,un,dn,ln,xr,hn,pn,oe,xt,St,Ce,Er=u(()=>{rn=t=>{switch(t){case"true":return!0;case"false":return!1;default:throw new Error(`Unable to parse boolean value "${t}"`)}},on=t=>{if(t!=null){if(typeof t=="number"){if((t===0||t===1)&&Ce.warn(St(`Expected boolean, got ${typeof t}: ${t}`)),t===0)return!1;if(t===1)return!0}if(typeof t=="string"){let e=t.toLowerCase();if((e==="false"||e==="true")&&Ce.warn(St(`Expected boolean, got ${typeof t}: ${t}`)),e==="false")return!1;if(e==="true")return!0}if(typeof t=="boolean")return t;throw new TypeError(`Expected boolean, got ${typeof t}: ${t}`)}},Ee=t=>{if(t!=null){if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return String(e)!==String(t)&&Ce.warn(St(`Expected number but observed string: ${t}`)),e}if(typeof t=="number")return t;throw new TypeError(`Expected number, got ${typeof t}: ${t}`)}},qa=Math.ceil(34028234663852886e22),Ge=t=>{let e=Ee(t);if(e!==void 0&&!Number.isNaN(e)&&e!==1/0&&e!==-1/0&&Math.abs(e)>qa)throw new TypeError(`Expected 32-bit float, got ${t}`);return e},Te=t=>{if(t!=null){if(Number.isInteger(t)&&!Number.isNaN(t))return t;throw new TypeError(`Expected integer, got ${typeof t}: ${t}`)}},nn=Te,pt=t=>br(t,32),gt=t=>br(t,16),yt=t=>br(t,8),br=(t,e)=>{let r=Te(t);if(r!==void 0&&Ga(r,e)!==r)throw new TypeError(`Expected ${e}-bit integer, got ${t}`);return r},Ga=(t,e)=>{switch(e){case 32:return Int32Array.of(t)[0];case 16:return Int16Array.of(t)[0];case 8:return Int8Array.of(t)[0]}},sn=(t,e)=>{if(t==null)throw e?new TypeError(`Expected a non-null value for ${e}`):new TypeError("Expected a non-null value");return t},wr=t=>{if(t==null)return;if(typeof t=="object"&&!Array.isArray(t))return t;let e=Array.isArray(t)?"array":typeof t;throw new TypeError(`Expected object, got ${e}: ${t}`)},an=t=>{if(t!=null){if(typeof t=="string")return t;if(["boolean","number","bigint"].includes(typeof t))return Ce.warn(St(`Expected string, got ${typeof t}: ${t}`)),String(t);throw new TypeError(`Expected string, got ${typeof t}: ${t}`)}},cn=t=>{if(t==null)return;let e=wr(t),r=[];for(let o in e)e[o]!=null&&r.push(o);if(r.length===0)throw new TypeError("Unions must have exactly one non-null member. None were found.");if(r.length>1)throw new TypeError(`Unions must have exactly one non-null member. Keys ${r} were not null.`);return e},We=t=>Ee(typeof t=="string"?ve(t):t),fn=We,bt=t=>Ge(typeof t=="string"?ve(t):t),Wa=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,ve=t=>{let e=t.match(Wa);if(e===null||e[0].length!==t.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(t)},wt=t=>typeof t=="string"?ln(t):Ee(t),mn=wt,un=wt,dn=t=>typeof t=="string"?ln(t):Ge(t),ln=t=>{switch(t){case"NaN":return NaN;case"Infinity":return 1/0;case"-Infinity":return-1/0;default:throw new Error(`Unable to parse float value: ${t}`)}},xr=t=>Te(typeof t=="string"?ve(t):t),hn=xr,pn=t=>pt(typeof t=="string"?ve(t):t),oe=t=>gt(typeof t=="string"?ve(t):t),xt=t=>yt(typeof t=="string"?ve(t):t),St=t=>String(new TypeError(t).stack||t).split(`
1
+ "use strict";var Ha=Object.create;var dt=Object.defineProperty;var ja=Object.getOwnPropertyDescriptor;var Va=Object.getOwnPropertyNames;var qa=Object.getPrototypeOf,Ga=Object.prototype.hasOwnProperty;var u=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(o){throw r=[o],o}};var Go=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},lt=(t,e)=>{for(var r in e)dt(t,r,{get:e[r],enumerable:!0})},Wo=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Va(e))!Ga.call(t,n)&&n!==r&&dt(t,n,{get:()=>e[n],enumerable:!(o=ja(e,n))||o.enumerable});return t};var we=(t,e,r)=>(r=t!=null?Ha(qa(t)):{},Wo(e||!t||!t.__esModule?dt(r,"default",{value:t,enumerable:!0}):r,t)),gr=t=>Wo(dt({},"__esModule",{value:!0}),t);var pt,yr=u(()=>{pt=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]"});var B,te,re=u(()=>{yr();B=(t,e=0,r=t.byteLength-e)=>{if(!pt(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return Buffer.from(t,e,r)},te=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?Buffer.from(t,e):Buffer.from(t)}});var Wa,xe,Jo=u(()=>{re();Wa=/^[A-Za-z0-9+/]*={0,2}$/,xe=t=>{if(t.length*3%4!==0)throw new TypeError("Incorrect padding on base64 string.");if(!Wa.exec(t))throw new TypeError("Invalid base64 string.");let e=te(t,"base64");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}});var L,ht=u(()=>{re();L=t=>{let e=te(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)}});var oe,br=u(()=>{re();ht();oe=t=>{let e;if(typeof t=="string"?e=L(t):e=t,typeof e!="object"||typeof e.byteOffset!="number"||typeof e.byteLength!="number")throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");return B(e.buffer,e.byteOffset,e.byteLength).toString("base64")}});function Qo(t,e,r,o){return class gt extends Uint8Array{static fromString(s,i="utf-8"){if(typeof s=="string")return i==="base64"?gt.mutate(o(s)):gt.mutate(e(s));throw new Error(`Unsupported conversion from ${typeof s} to Uint8ArrayBlobAdapter.`)}static mutate(s){return Object.setPrototypeOf(s,gt.prototype),s}transformToString(s="utf-8"){return s==="base64"?r(this):t(this)}}}var Xo=u(()=>{});var J,Ko=u(()=>{re();J=t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return B(t.buffer,t.byteOffset,t.byteLength).toString("utf8")}});function Zo(t){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?()=>crypto.randomUUID():()=>{let e=new Uint8Array(16);return t(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128,R[e[0]]+R[e[1]]+R[e[2]]+R[e[3]]+"-"+R[e[4]]+R[e[5]]+"-"+R[e[6]]+R[e[7]]+"-"+R[e[8]]+R[e[9]]+"-"+R[e[10]]+R[e[11]]+R[e[12]]+R[e[13]]+R[e[14]]+R[e[15]]}}var R,Yo=u(()=>{R=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"))});var en,tn=u(()=>{en=(t,e,r=o=>o)=>t});var rn,on,Ee,Ja,Je,Te,nn,yt,bt,St,Sr,Qa,sn,wr,an,cn,Qe,fn,xt,Xa,ve,Et,mn,un,dn,ln,xr,pn,hn,ne,Tt,wt,Ce,Er=u(()=>{rn=t=>{switch(t){case"true":return!0;case"false":return!1;default:throw new Error(`Unable to parse boolean value "${t}"`)}},on=t=>{if(t!=null){if(typeof t=="number"){if((t===0||t===1)&&Ce.warn(wt(`Expected boolean, got ${typeof t}: ${t}`)),t===0)return!1;if(t===1)return!0}if(typeof t=="string"){let e=t.toLowerCase();if((e==="false"||e==="true")&&Ce.warn(wt(`Expected boolean, got ${typeof t}: ${t}`)),e==="false")return!1;if(e==="true")return!0}if(typeof t=="boolean")return t;throw new TypeError(`Expected boolean, got ${typeof t}: ${t}`)}},Ee=t=>{if(t!=null){if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return String(e)!==String(t)&&Ce.warn(wt(`Expected number but observed string: ${t}`)),e}if(typeof t=="number")return t;throw new TypeError(`Expected number, got ${typeof t}: ${t}`)}},Ja=Math.ceil(34028234663852886e22),Je=t=>{let e=Ee(t);if(e!==void 0&&!Number.isNaN(e)&&e!==1/0&&e!==-1/0&&Math.abs(e)>Ja)throw new TypeError(`Expected 32-bit float, got ${t}`);return e},Te=t=>{if(t!=null){if(Number.isInteger(t)&&!Number.isNaN(t))return t;throw new TypeError(`Expected integer, got ${typeof t}: ${t}`)}},nn=Te,yt=t=>Sr(t,32),bt=t=>Sr(t,16),St=t=>Sr(t,8),Sr=(t,e)=>{let r=Te(t);if(r!==void 0&&Qa(r,e)!==r)throw new TypeError(`Expected ${e}-bit integer, got ${t}`);return r},Qa=(t,e)=>{switch(e){case 32:return Int32Array.of(t)[0];case 16:return Int16Array.of(t)[0];case 8:return Int8Array.of(t)[0]}},sn=(t,e)=>{if(t==null)throw e?new TypeError(`Expected a non-null value for ${e}`):new TypeError("Expected a non-null value");return t},wr=t=>{if(t==null)return;if(typeof t=="object"&&!Array.isArray(t))return t;let e=Array.isArray(t)?"array":typeof t;throw new TypeError(`Expected object, got ${e}: ${t}`)},an=t=>{if(t!=null){if(typeof t=="string")return t;if(["boolean","number","bigint"].includes(typeof t))return Ce.warn(wt(`Expected string, got ${typeof t}: ${t}`)),String(t);throw new TypeError(`Expected string, got ${typeof t}: ${t}`)}},cn=t=>{if(t==null)return;let e=wr(t),r=[];for(let o in e)e[o]!=null&&r.push(o);if(r.length===0)throw new TypeError("Unions must have exactly one non-null member. None were found.");if(r.length>1)throw new TypeError(`Unions must have exactly one non-null member. Keys ${r} were not null.`);return e},Qe=t=>Ee(typeof t=="string"?ve(t):t),fn=Qe,xt=t=>Je(typeof t=="string"?ve(t):t),Xa=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,ve=t=>{let e=t.match(Xa);if(e===null||e[0].length!==t.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(t)},Et=t=>typeof t=="string"?ln(t):Ee(t),mn=Et,un=Et,dn=t=>typeof t=="string"?ln(t):Je(t),ln=t=>{switch(t){case"NaN":return NaN;case"Infinity":return 1/0;case"-Infinity":return-1/0;default:throw new Error(`Unable to parse float value: ${t}`)}},xr=t=>Te(typeof t=="string"?ve(t):t),pn=xr,hn=t=>yt(typeof t=="string"?ve(t):t),ne=t=>bt(typeof t=="string"?ve(t):t),Tt=t=>St(typeof t=="string"?ve(t):t),wt=t=>String(new TypeError(t).stack||t).split(`
2
2
  `).slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join(`
3
- `),Ce={warn:console.warn}});function Et(t){let e=t.getUTCFullYear(),r=t.getUTCMonth(),o=t.getUTCDay(),n=t.getUTCDate(),s=t.getUTCHours(),i=t.getUTCMinutes(),a=t.getUTCSeconds(),c=n<10?`0${n}`:`${n}`,m=s<10?`0${s}`:`${s}`,f=i<10?`0${i}`:`${i}`,d=a<10?`0${a}`:`${a}`;return`${Ja[o]}, ${c} ${Cr[r]} ${e} ${m}:${f}:${d} GMT`}var Ja,Cr,Qa,gn,Xa,yn,Ka,Za,Ya,Sn,bn,Je,ec,tc,rc,Tr,oc,nc,sc,H,ic,ac,Ae,wn=u(()=>{Er();Ja=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Cr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];Qa=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),gn=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=Qa.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,o,n,s,i,a,c,m]=e,f=oe(Ae(o)),d=H(n,"month",1,12),l=H(s,"day",1,31);return Je(f,d,l,{hours:i,minutes:a,seconds:c,fractionalMilliseconds:m})},Xa=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}:\d{2})|[zZ])$/),yn=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=Xa.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,o,n,s,i,a,c,m,f]=e,d=oe(Ae(o)),l=H(n,"month",1,12),p=H(s,"day",1,31),h=Je(d,l,p,{hours:i,minutes:a,seconds:c,fractionalMilliseconds:m});return f.toUpperCase()!="Z"&&h.setTime(h.getTime()-ac(f)),h},Ka=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),Za=new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),Ya=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/),Sn=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-7231 date-times must be expressed as strings");let e=Ka.exec(t);if(e){let[r,o,n,s,i,a,c,m]=e;return Je(oe(Ae(s)),Tr(n),H(o,"day",1,31),{hours:i,minutes:a,seconds:c,fractionalMilliseconds:m})}if(e=Za.exec(t),e){let[r,o,n,s,i,a,c,m]=e;return rc(Je(ec(s),Tr(n),H(o,"day",1,31),{hours:i,minutes:a,seconds:c,fractionalMilliseconds:m}))}if(e=Ya.exec(t),e){let[r,o,n,s,i,a,c,m]=e;return Je(oe(Ae(m)),Tr(o),H(n.trimLeft(),"day",1,31),{hours:s,minutes:i,seconds:a,fractionalMilliseconds:c})}throw new TypeError("Invalid RFC-7231 date-time value")},bn=t=>{if(t==null)return;let e;if(typeof t=="number")e=t;else if(typeof t=="string")e=We(t);else if(typeof t=="object"&&t.tag===1)e=t.value;else throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");if(Number.isNaN(e)||e===1/0||e===-1/0)throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(e*1e3))},Je=(t,e,r,o)=>{let n=e-1;return nc(t,n,r),new Date(Date.UTC(t,n,r,H(o.hours,"hour",0,23),H(o.minutes,"minute",0,59),H(o.seconds,"seconds",0,60),ic(o.fractionalMilliseconds)))},ec=t=>{let e=new Date().getUTCFullYear(),r=Math.floor(e/100)*100+oe(Ae(t));return r<e?r+100:r},tc=50*365*24*60*60*1e3,rc=t=>t.getTime()-new Date().getTime()>tc?new Date(Date.UTC(t.getUTCFullYear()-100,t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds())):t,Tr=t=>{let e=Cr.indexOf(t);if(e<0)throw new TypeError(`Invalid month: ${t}`);return e+1},oc=[31,28,31,30,31,30,31,31,30,31,30,31],nc=(t,e,r)=>{let o=oc[e];if(e===1&&sc(t)&&(o=29),r>o)throw new TypeError(`Invalid day for ${Cr[e]} in ${t}: ${r}`)},sc=t=>t%4===0&&(t%100!==0||t%400===0),H=(t,e,r,o)=>{let n=xt(Ae(t));if(n<r||n>o)throw new TypeError(`${e} must be between ${r} and ${o}, inclusive`);return n},ic=t=>t==null?0:bt("0."+t)*1e3,ac=t=>{let e=t[0],r=1;if(e=="+")r=1;else if(e=="-")r=-1;else throw new TypeError(`Offset direction, ${e}, must be "+" or "-"`);let o=Number(t.substring(1,3)),n=Number(t.substring(4,6));return r*(o*60+n)*60*1e3},Ae=t=>{let e=0;for(;e<t.length-1&&t.charAt(e)==="0";)e++;return e===0?t:t.slice(e)}});var k,xn=u(()=>{k=function(e){return Object.assign(new String(e),{deserializeJSON(){return JSON.parse(String(e))},toString(){return String(e)},toJSON(){return String(e)}})};k.from=t=>t&&typeof t=="object"&&(t instanceof k||"deserializeJSON"in t)?t:typeof t=="string"||Object.getPrototypeOf(t)===String.prototype?k(String(t)):k(JSON.stringify(t));k.fromObject=k.from});function Tt(t){return(t.includes(",")||t.includes('"'))&&(t=`"${t.replace(/"/g,'\\"')}"`),t}var En=u(()=>{});function W(t,e,r){let o=Number(t);if(o<e||o>r)throw new Error(`Value ${o} out of range [${e}, ${r}]`)}var vr,Ar,Nr,Tn,Cn,cc,fc,mc,uc,dc,Ct,vt,At,vn=u(()=>{vr="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?",Ar="(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)",Nr="(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?",Tn="(\\d?\\d)",Cn="(\\d{4})",cc=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/),fc=new RegExp(`^${vr}, ${Tn} ${Ar} ${Cn} ${Nr} GMT$`),mc=new RegExp(`^${vr}, ${Tn}-${Ar}-(\\d\\d) ${Nr} GMT$`),uc=new RegExp(`^${vr} ${Ar} ( [1-9]|\\d\\d) ${Nr} ${Cn}$`),dc=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ct=t=>{if(t==null)return;let e=NaN;if(typeof t=="number")e=t;else if(typeof t=="string"){if(!/^-?\d*\.?\d+$/.test(t))throw new TypeError("parseEpochTimestamp - numeric string invalid.");e=Number.parseFloat(t)}else typeof t=="object"&&t.tag===1&&(e=t.value);if(isNaN(e)||Math.abs(e)===1/0)throw new TypeError("Epoch timestamps must be valid finite numbers.");return new Date(Math.round(e*1e3))},vt=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC3339 timestamps must be strings");let e=cc.exec(t);if(!e)throw new TypeError(`Invalid RFC3339 timestamp format ${t}`);let[,r,o,n,s,i,a,,c,m]=e;W(o,1,12),W(n,1,31),W(s,0,23),W(i,0,59),W(a,0,60);let f=new Date(Date.UTC(Number(r),Number(o)-1,Number(n),Number(s),Number(i),Number(a),Number(c)?Math.round(parseFloat(`0.${c}`)*1e3):0));if(f.setUTCFullYear(Number(r)),m.toUpperCase()!="Z"){let[,d,l,p]=/([+-])(\d\d):(\d\d)/.exec(m)||[void 0,"+",0,0],h=d==="-"?1:-1;f.setTime(f.getTime()+h*(Number(l)*60*60*1e3+Number(p)*60*1e3))}return f},At=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC7231 timestamps must be strings.");let e,r,o,n,s,i,a,c;if((c=fc.exec(t))?[,e,r,o,n,s,i,a]=c:(c=mc.exec(t))?([,e,r,o,n,s,i,a]=c,o=(Number(o)+1900).toString()):(c=uc.exec(t))&&([,r,e,n,s,i,a,o]=c),o&&i){let m=Date.UTC(Number(o),dc.indexOf(r),Number(e),Number(n),Number(s),Number(i),a?Math.round(parseFloat(`0.${a}`)*1e3):0);W(e,1,31),W(n,0,23),W(s,0,59),W(i,0,60);let f=new Date(m);return f.setUTCFullYear(Number(o)),f}throw new TypeError(`Invalid RFC7231 date-time value ${t}.`)}});function Nt(t,e,r){if(r<=0||!Number.isInteger(r))throw new Error("Invalid number of delimiters ("+r+") for splitEvery.");let o=t.split(e);if(r===1)return o;let n=[],s="";for(let i=0;i<o.length;i++)s===""?s=o[i]:s+=e+o[i],(i+1)%r===0&&(n.push(s),s="");return s!==""&&n.push(s),n}var An=u(()=>{});var Ne,Nn=u(()=>{Ne=t=>{let e=t.length,r=[],o=!1,n,s=0;for(let i=0;i<e;++i){let a=t[i];switch(a){case'"':n!=="\\"&&(o=!o);break;case",":o||(r.push(t.slice(s,i)),s=i+1);break;default:}n=a}return r.push(t.slice(s)),r.map(i=>{i=i.trim();let a=i.length;return a<2?i:(i[0]==='"'&&i[a-1]==='"'&&(i=i.slice(1,a-1)),i.replace(/\\"/g,'"'))})}});function Rn(t){return new de(String(t),"bigDecimal")}var In,de,Mn=u(()=>{In=/^-?((0|[1-9]\d*)(\.\d+)?|\.\d+)([eE][+-]?\d+)?$/,de=class t{string;type;constructor(e,r){if(this.string=e,this.type=r,!In.test(e))throw new Error(`@smithy/core/serde - NumericValue string must conform to the Smithy bigDecimal format. Received: "${e}"`)}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"&&In.test(r.string)}}});function It(t){if(t.length%2!==0)throw new Error("Hex encoded strings must have an even number length");let e=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2){let o=t.slice(r,r+2).toLowerCase();if(o in Ir)e[r/2]=Ir[o];else throw new Error(`Cannot decode unrecognized sequence ${o} as hexadecimal`)}return e}function D(t){let e="";for(let r=0;r<t.byteLength;r++)e+=On[t[r]];return e}var On,Ir,Rr=u(()=>{On={},Ir={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),On[t]=e,Ir[e]=t}});var Ie,Pn,Un=u(()=>{Ie=require("node:fs"),Pn=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 Ie.ReadStream){if(t.path!=null)return(0,Ie.lstatSync)(t.path).size;if(typeof t.fd=="number")return(0,Ie.fstatSync)(t.fd).size}throw new Error(`Body Length computation failed for ${t}`)}});var Rt,Mr=u(()=>{lt();Rt=t=>t instanceof Uint8Array?t:typeof t=="string"?B(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)});function ne(t,e){if(e===void 0){e=0;for(let n of t)e+=n.byteLength}let r=new Uint8Array(e),o=0;for(let n of t)r.set(n,o),o+=n.byteLength;return r}var Qe=u(()=>{});var Ke=Go(L=>{var Or;(function(t){t.HEADER="header",t.QUERY="query"})(Or||(Or={}));var Pr;(function(t){t.HEADER="header",t.QUERY="query"})(Pr||(Pr={}));var Ur;(function(t){t.HTTP="http",t.HTTPS="https"})(Ur||(Ur={}));var Xe;(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(Xe||(Xe={}));var lc=t=>{let e=[];return t.sha256!==void 0&&e.push({algorithmId:()=>Xe.SHA256,checksumConstructor:()=>t.sha256}),t.md5!=null&&e.push({algorithmId:()=>Xe.MD5,checksumConstructor:()=>t.md5}),{addChecksumAlgorithm(r){e.push(r)},checksumAlgorithms(){return e}}},hc=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e},pc=t=>lc(t),gc=t=>hc(t),kr;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(kr||(kr={}));var yc="__smithy_context",Dr;(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(Dr||(Dr={}));var _r;(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(_r||(_r={}));L.AlgorithmId=Xe;L.EndpointURLScheme=Ur;L.FieldPosition=kr;L.HttpApiKeyAuthLocation=Pr;L.HttpAuthLocation=Or;L.IniSectionType=Dr;L.RequestHandlerProtocol=_r;L.SMITHY_CONTEXT_KEY=yc;L.getDefaultClientConfiguration=pc;L.resolveDefaultRuntimeConfig=gc});var $r,Br,kn=u(()=>{$r=we(Ke()),Br=t=>t[$r.SMITHY_CONTEXT_KEY]||(t[$r.SMITHY_CONTEXT_KEY]={})});function Sc(t){return Object.keys(t).reduce((e,r)=>{let o=t[r];return{...e,[r]:Array.isArray(o)?[...o]:o}},{})}var U,Dn=u(()=>{U=class t{method;protocol;hostname;port;path;query;headers;username;password;fragment;body;constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=Sc(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var J,_n=u(()=>{J=class{statusCode;reason;headers;body;constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;let r=e;return typeof r.statusCode=="number"&&typeof r.headers=="object"}}});function Ze(t){return/^[a-z0-9][a-z0-9.-]*[a-z0-9]$/.test(t)}var $n=u(()=>{});var Ye,Bn=u(()=>{Ye=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});function et(t){let e={};if(t=t.replace(/^\?/,""),t)for(let r of t.split("&")){let[o,n=null]=r.split("=");o=decodeURIComponent(o),n&&(n=decodeURIComponent(n)),o in e?Array.isArray(e[o])?e[o].push(n):e[o]=[e[o],n]:e[o]=n}return e}var Lr=u(()=>{});var le,Fr=u(()=>{Lr();le=t=>{if(typeof t=="string")return le(new URL(t));let{hostname:e,pathname:r,port:o,protocol:n,search:s}=t,i;return s&&(i=et(s)),{hostname:e,port:o?parseInt(o):void 0,protocol:n,path:r,query:i}}});var Q,Ln=u(()=>{Fr();Q=t=>{if(typeof t=="object"){if("url"in t){let e=le(t.url);if(t.headers){e.headers={};for(let r in t.headers)e.headers[r.toLowerCase()]=t.headers[r].join(", ")}return e}return t}return le(t)}});var R=u(()=>{kn();Dn();_n();$n();Bn();Lr();Fr();Ln()});var Mt,zr,Hr=u(()=>{R();Mt=(t,e)=>(r,o)=>async n=>{let{response:s}=await r(n);try{let i=await e(s,t);return{response:s,output:i}}catch(i){if(Object.defineProperty(i,"$response",{value:s,enumerable:!1,writable:!1,configurable:!1}),!("$metadata"in i)){let a="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";try{i.message+=`
4
- `+a}catch{!o.logger||o.logger?.constructor?.name==="NoOpLogger"?console.warn(a):o.logger?.warn?.(a)}typeof i.$responseBodyText<"u"&&i.$response&&(i.$response.body=i.$responseBodyText);try{if(J.isInstance(s)){let{headers:c={}}=s,m=Object.entries(c);i.$metadata={httpStatusCode:s.statusCode,requestId:zr(/^x-[\w-]+-request-?id$/,m),extendedRequestId:zr(/^x-[\w-]+-id-2$/,m),cfId:zr(/^x-[\w-]+-cf-id$/,m)}}}catch{}}throw i}},zr=(t,e)=>(e.find(([r])=>r.match(t))||[void 0,void 0])[1]});var Re,jr=u(()=>{Re=class t extends Error{name="ProviderError";tryNextLink;constructor(e,r=!0){let o,n=!0;typeof r=="boolean"?(o=void 0,n=r):r!=null&&typeof r=="object"&&(o=r.logger,n=r.tryNextLink??!0),super(e),this.tryNextLink=n,Object.setPrototypeOf(this,t.prototype),o?.debug?.(`@smithy/property-provider ${n?"->":"(!)"} ${e}`)}static from(e,r=!0){return Object.assign(new this(e.message,r),e)}}});var Me,Vr=u(()=>{jr();Me=class t extends Re{name="CredentialsProviderError";constructor(e,r=!0){super(e,r),Object.setPrototypeOf(this,t.prototype)}}});var Fn,zn=u(()=>{jr();Fn=(...t)=>async()=>{if(t.length===0)throw new Re("No providers in chain");let e;for(let r of t)try{return await r()}catch(o){if(e=o,o?.tryNextLink)continue;throw o}throw e}});var Hn,jn=u(()=>{Hn=t=>()=>Promise.resolve(t)});var Vn,qn=u(()=>{Vn=(t,e,r)=>{let o,n,s,i=!1,a=async()=>{n||(n=t());try{o=await n,s=!0,i=!1}finally{n=void 0}return o};return e===void 0?async c=>((!s||c?.forceRefresh)&&(o=await a()),o):async c=>((!s||c?.forceRefresh)&&(o=await a()),i?o:r&&!r(o)?(i=!0,o):(e(o)&&await a(),o))}});var Ot,Gn=u(()=>{Ot=(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 Oe,Wn=u(()=>{(function(t){t.ENV="env",t.CONFIG="shared config entry"})(Oe||(Oe={}))});var Jn,Qn,qr,bc,Pe,Pt=u(()=>{Jn=require("node:os"),Qn=require("node:path"),qr={},bc=()=>process&&process.geteuid?`${process.geteuid()}`:"DEFAULT",Pe=()=>{let{HOME:t,USERPROFILE:e,HOMEPATH:r,HOMEDRIVE:o=`C:${Qn.sep}`}=process.env;if(t)return t;if(e)return e;if(r)return`${o}${r}`;let n=bc();return qr[n]||(qr[n]=(0,Jn.homedir)()),qr[n]}});var wc,xc,Xn,Kn=u(()=>{wc="AWS_PROFILE",xc="default",Xn=t=>t.profile||process.env[wc]||xc});var Gr,Zn,Yn=u(()=>{Gr=we(Ke()),Zn=t=>Object.entries(t).filter(([e])=>{let r=e.indexOf(".");return r===-1?!1:Object.values(Gr.IniSectionType).includes(e.substring(0,r))}).reduce((e,[r,o])=>{let n=r.indexOf("."),s=r.substring(0,n)===Gr.IniSectionType.PROFILE?r.substring(n+1):r;return e[s]=o,e},{...t.default&&{default:t.default}})});var es,Ec,ts,rs=u(()=>{es=require("node:path");Pt();Ec="AWS_CONFIG_FILE",ts=()=>process.env[Ec]||(0,es.join)(Pe(),".aws","config")});var os,Tc,ns,ss=u(()=>{os=require("node:path");Pt();Tc="AWS_SHARED_CREDENTIALS_FILE",ns=()=>process.env[Tc]||(0,os.join)(Pe(),".aws","credentials")});var is,Cc,vc,Wr,as=u(()=>{is=we(Ke()),Cc=/^([\w-]+)\s(["'])?([\w-@+.%:/]+)\2$/,vc=["__proto__","profile __proto__"],Wr=t=>{let e={},r,o;for(let n of t.split(/\r?\n/)){let s=n.split(/(^|\s)[;#]/)[0].trim();if(s[0]==="["&&s[s.length-1]==="]"){r=void 0,o=void 0;let a=s.substring(1,s.length-1),c=Cc.exec(a);if(c){let[,m,,f]=c;Object.values(is.IniSectionType).includes(m)&&(r=[m,f].join("."))}else r=a;if(vc.includes(a))throw new Error(`Found invalid profile name "${a}"`)}else if(r){let a=s.indexOf("=");if(![0,-1].includes(a)){let[c,m]=[s.substring(0,a).trim(),s.substring(a+1).trim()];if(m==="")o=c;else{o&&n.trimStart()===n&&(o=void 0),e[r]=e[r]||{};let f=o?[o,c].join("."):c;e[r][f]=m}}}}return e}});var fs,Jr,cs,Qr,ms=u(()=>{fs=require("node:fs/promises"),Jr={},cs={},Qr=(t,e)=>cs[t]!==void 0?cs[t]:((!Jr[t]||e?.ignoreCache)&&(Jr[t]=(0,fs.readFile)(t,"utf8")),Jr[t])});var Xr,us,ds,ls=u(()=>{Xr=require("node:path");Yn();rs();ss();Pt();as();ms();us=()=>({}),ds=async(t={})=>{let{filepath:e=ns(),configFilepath:r=ts()}=t,o=Pe(),n="~/",s=e;e.startsWith(n)&&(s=(0,Xr.join)(o,e.slice(2)));let i=r;r.startsWith(n)&&(i=(0,Xr.join)(o,r.slice(2)));let a=await Promise.all([Qr(i,{ignoreCache:t.ignoreCache}).then(Wr).then(Zn).catch(us),Qr(s,{ignoreCache:t.ignoreCache}).then(Wr).catch(us)]);return{configFile:a[0],credentialsFile:a[1]}}});function Ut(t){try{let e=new Set(Array.from(t.match(/([A-Z_]){3,}/g)??[]));return e.delete("CONFIG"),e.delete("CONFIG_PREFIX_SEPARATOR"),e.delete("ENV"),[...e].join(", ")}catch{return t}}var Kr=u(()=>{});var hs,ps=u(()=>{Vr();Kr();hs=(t,e)=>async()=>{try{let r=t(process.env,e);if(r===void 0)throw new Error;return r}catch(r){throw new Me(r.message||`Not found in ENV: ${Ut(t.toString())}`,{logger:e?.logger})}}});var gs,ys=u(()=>{Vr();Kn();ls();Kr();gs=(t,{preferredFile:e="config",...r}={})=>async()=>{let o=Xn(r),{configFile:n,credentialsFile:s}=await ds(r),i=s[o]||{},a=n[o]||{},c=e==="config"?{...i,...a}:{...a,...i};try{let f=t(c,e==="config"?n:s);if(f===void 0)throw new Error;return f}catch(m){throw new Me(m.message||`Not found in config files w/ profile [${o}]: ${Ut(t.toString())}`,{logger:r.logger})}}});var Ac,Ss,bs=u(()=>{jn();Ac=t=>typeof t=="function",Ss=t=>Ac(t)?async()=>await t():Hn(t)});var kt,ws=u(()=>{zn();qn();ps();ys();bs();kt=({environmentVariableSelector:t,configFileSelector:e,default:r},o={})=>{let{signingName:n,logger:s}=o;return Vn(Fn(hs(t,{signingName:n,logger:s}),gs(e,o),Ss(r)))}});var Dt,xs=u(()=>{Dt=t=>typeof t=="function"?t():t});function j(t){if(typeof t=="object")return t;if(t=t|0,_t[t])return _t[t];let e={},r=0;for(let o of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"])(t>>r++&1)===1&&(e[o]=1);return _t[t]=e}var _t,Zr=u(()=>{_t=[]});function ot(t,e){if(t instanceof T)return Object.assign(t,{memberName:e,_isMemberSchema:!0});let r=T;return new r(t,e)}var rt,$t,Bt,T,Yr,Es,Ts=u(()=>{xs();Zr();rt={it:Symbol.for("@smithy/nor-struct-it"),ns:Symbol.for("@smithy/ns")},$t=[],Bt={},T=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 o=[],n=e,s=e;for(this._isMemberSchema=!1;Yr(n);)o.push(n[1]),n=n[0],s=Dt(n),this._isMemberSchema=!0;if(o.length>0){this.memberTraits={};for(let i=o.length-1;i>=0;--i){let a=o[i];Object.assign(this.memberTraits,j(a))}}else this.memberTraits=0;if(s instanceof t){let i=this.memberTraits;Object.assign(this,s),this.memberTraits=Object.assign({},i,s.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,this.memberName=r??s.memberName;return}if(this.schema=Dt(s),Es(this.schema)?(this.name=`${this.schema[1]}#${this.schema[2]}`,this.traits=this.schema[3]):(this.name=this.memberName??String(s),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($t[e])return $t[e]}else if(typeof e=="string"){if(Bt[e])return Bt[e]}else if(r&&e[rt.ns])return e[rt.ns];let o=Dt(e);if(o instanceof t)return o;if(Yr(o)){let[s,i]=o;if(s instanceof t)return Object.assign(s.getMergedTraits(),j(i)),s;throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(e,null,2)}.`)}let n=new t(o);return r?e[rt.ns]=n:typeof o=="string"?Bt[o]=n:typeof o=="number"?$t[o]=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 j(this.memberTraits)}getOwnTraits(){return j(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 o=this.getSchema(),n=e?15:o[4]??0;return ot([n,0],"key")}getValueSchema(){let e=this.getSchema(),[r,o,n]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()],s=typeof e=="number"?63&e:e&&typeof e=="object"&&(o||n)?e[3+e[0]]:r?15:void 0;if(s!=null)return ot([s,0],o?"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 o=r[4].indexOf(e),n=r[5][o];return ot(Yr(n)?n:[n,0],e)}if(this.isDocumentSchema())return ot([15,0],e);throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no member=${e}.`)}getMemberSchemas(){let e={};try{for(let[r,o]of this.structIterator())e[r]=o}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,o=e[rt.it];if(o&&r===o.length){yield*o;return}o=Array(r);for(let n=0;n<r;++n){let s=e[4][n],i=ot([e[5][n],0],s);yield o[n]=[s,i]}e[rt.it]=o}};Yr=t=>Array.isArray(t)&&t.length===2,Es=t=>Array.isArray(t)&&t.length>=5});var he,Cs=u(()=>{he=class t{namespace;schemas;exceptions;static registries=new Map;constructor(e,r=new Map,o=new Map){this.namespace=e,this.schemas=r,this.exceptions=o}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:o}=this;for(let[n,s]of e.schemas)r.has(n)||r.set(n,s);for(let[n,s]of e.exceptions)o.has(n)||o.set(n,s)}register(e,r){let o=this.normalizeShapeId(e);for(let n of[this,t.for(o.split("#")[0])])n.schemas.set(o,r)}getSchema(e){let r=this.normalizeShapeId(e);if(!this.schemas.has(r)){if(!e.includes("#")){let o="#"+e,n=[];for(let[s,i]of this.schemas.entries())s.endsWith(o)&&n.push(i);if(n.length===1)return n[0]}throw new Error(`@smithy/core/schema - schema not found for ${r}`)}return this.schemas.get(r)}registerError(e,r){let o=e,n=o[1];for(let s of[this,t.for(n)])s.schemas.set(n+"#"+o[2],o),s.exceptions.set(o,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,o]=e,n=r+"#"+o;if(n.startsWith("smithy.ts.sdk.synthetic.")&&n.endsWith("ServiceException"))return e}}find(e){for(let r of this.schemas.values())if(e(r))return r}clear(){this.schemas.clear(),this.exceptions.clear()}normalizeShapeId(e){return e.includes("#")?e:this.namespace+"#"+e}}});var X=u(()=>{Ts();Zr();Cs()});var eo=u(()=>{Gn();Wn();ws()});var vs,As,Ns,Is=u(()=>{vs="AWS_ENDPOINT_URL",As="endpoint_url",Ns=t=>({environmentVariableSelector:e=>{let r=t.split(" ").map(s=>s.toUpperCase()),o=e[[vs,...r].join("_")];if(o)return o;let n=e[vs];if(n)return n},configFileSelector:(e,r)=>{if(e.services){let n=["services",e.services].join(".");if(!r||!r[n])throw new Error(`The services section "${e.services}" specified in the profile is not present in the shared configuration file.`);let s=r[n],i=t.split(" ").map(c=>c.toLowerCase()),a=s[[i.join("_"),As].join(".")];if(a)return a}let o=e[As];if(o)return o},default:void 0})});var Nc,Ic,Rs,Ms=u(()=>{eo();Nc="AWS_IGNORE_CONFIGURED_ENDPOINT_URLS",Ic="ignore_configured_endpoint_urls",Rs={environmentVariableSelector:t=>Ot(t,Nc,Oe.ENV),configFileSelector:t=>Ot(t,Ic,Oe.CONFIG),default:!1}});var nt,Os=u(()=>{eo();Is();Ms();nt=async t=>{if(!await kt(Rs)())return kt(Ns(t??""))()}});var to,Rc,Mc,Oc,Ps,Us,ks=u(()=>{to=async t=>{let e=t?.Bucket||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),Us(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!Ps(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},Rc=/^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$/,Mc=/(\d+\.){3}\d+/,Oc=/\.\./,Ps=t=>Rc.test(t)&&!Mc.test(t)&&!Oc.test(t),Us=t=>{let[e,r,o,,,n]=t.split(":"),s=e==="arn"&&t.split(":").length>=6,i=!!(s&&r&&o&&n);if(s&&!i)throw new Error(`Invalid ARN: ${t} was an invalid ARN.`);return i}});var Ds=u(()=>{ks()});var _s,$s=u(()=>{_s=(t,e,r,o=!1)=>{let n=async()=>{let s;return o?s=r.clientContextParams?.[t]??r[t]??r[e]:s=r[t]??r[e],typeof s=="function"?s():s};return t==="credentialScope"||e==="CredentialScope"?async()=>{let s=typeof r.credentials=="function"?await r.credentials():r.credentials;return s?.credentialScope??s?.CredentialScope}:t==="accountId"||e==="AccountId"?async()=>{let s=typeof r.credentials=="function"?await r.credentials():r.credentials;return s?.accountId??s?.AccountId}:t==="endpoint"||e==="endpoint"?async()=>{if(r.isCustomEndpoint===!1)return;let s=await n();if(s&&typeof s=="object"){if("url"in s)return s.url.href;if("hostname"in s){let{protocol:i,hostname:a,port:c,path:m}=s;return`${i}//${a}${c?":"+c:""}${m}`}}return s}:n}});var ro=u(()=>{R()});function Lt(t){return async(e,r,o,n)=>{if(!o.isCustomEndpoint&&!o.ignoreConfiguredEndpointUrls){let a;o.serviceConfiguredEndpoint?a=await o.serviceConfiguredEndpoint():a=await t(o.serviceId),a&&(o.endpoint=()=>Promise.resolve(Q(a)),o.isCustomEndpoint=!0,n?.logger?.debug?.(`@smithy/core/endpoints - resolved endpoint from config: ${a}`))}let s=await Pc(e,r,o);if(typeof o.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");let i=o.endpointProvider(s,n);if(o.isCustomEndpoint&&o.endpoint){let a=await o.endpoint();if(a?.headers){i.headers??={};for(let[c,m]of Object.entries(a.headers))i.headers[c]=Array.isArray(m)?m:[m]}}return i}}var Pc,oo=u(()=>{Ds();$s();ro();Pc=async(t,e,r)=>{let o={},n=e?.getEndpointParameterInstructions?.()||{};for(let[s,i]of Object.entries(n))switch(i.type){case"staticContextParams":o[s]=i.value;break;case"contextParams":o[s]=t[i.name];break;case"clientContextParams":case"builtInParams":o[s]=await _s(i.name,s,r,i.type!=="builtInParams")();break;case"operationContextParams":o[s]=i.get(t);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(i))}return Object.keys(n).length===0&&Object.assign(o,r),String(r.serviceId).toLowerCase()==="s3"&&await to(o),o}});function Uc(t,e,r){t.__smithy_context?t.__smithy_context.features||(t.__smithy_context.features={}):t.__smithy_context={features:{}},t.__smithy_context.features[e]=r}function Ft(t){let e=Lt(t);return({config:r,instructions:o})=>(n,s)=>async i=>{r.isCustomEndpoint&&Uc(s,"ENDPOINT_OVERRIDE","N");let a=await e(i.input,{getEndpointParameterInstructions(){return o}},{...r},s);s.endpointV2=a,s.authSchemes=a.properties?.authSchemes;let c=s.authSchemes?.[0];if(c){s.signing_region=c.signingRegion,s.signing_service=c.signingName;let f=Br(s)?.selectedHttpAuthScheme?.httpAuthOption;f&&(f.signingProperties=Object.assign(f.signingProperties||{},{signing_region:c.signingRegion,signingRegion:c.signingRegion,signing_service:c.signingName,signingName:c.signingName,signingRegionSet:c.signingRegionSet},c.properties))}return n({...i})}}var no=u(()=>{R();oo()});function Bs(t){let e=Ft(t);return(r,o)=>({applyToStack:n=>{n.addRelativeTo(e({config:r,instructions:o}),Dc)}})}var kc,Dc,Ls=u(()=>{no();kc={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0},Dc={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:kc.name}});function Fs(t){return e=>{let r=e.tls??!0,{endpoint:o,useDualstackEndpoint:n,useFipsEndpoint:s}=e,i=o!=null?async()=>Q(await Ye(o)()):void 0,c=Object.assign(e,{endpoint:i,tls:r,isCustomEndpoint:!!o,useDualstackEndpoint:Ye(n??!1),useFipsEndpoint:Ye(s??!1),ignoreConfiguredEndpointUrls:!!e.ignoreConfiguredEndpointUrls}),m;return c.serviceConfiguredEndpoint=async()=>(e.serviceId&&!m&&(m=t(e.serviceId)),m),c}}var zs=u(()=>{R();ro()});var qu,Gu,Wu,Ju,Hs=u(()=>{Os();oo();no();Ls();zs();R();qu=Lt(nt),Gu=Fs(nt),Wu=Ft(nt),Ju=Bs(nt)});var zt,so=u(()=>{Hs();zt=(t,e)=>(r,o)=>async n=>{let s=t,i=o.endpointV2?async()=>Q(o.endpointV2):s.endpoint;if(!i)throw new Error("No valid endpoint provider available.");let a=await e(n.input,{...t,endpoint:i});return r({...n,request:a})}});function js(t,e,r){return{applyToStack:o=>{o.add(Mt(t,r),io),o.add(zt(t,e),ao)}}}var io,ao,Vs=u(()=>{Hr();so();io={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},ao={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0}});function qs(t,e){return Buffer.isBuffer(t)?t:typeof t=="string"?ee(t,e):ArrayBuffer.isView(t)?$(t.buffer,t.byteOffset,t.byteLength):$(t)}var jt,Ht,Gs=u(()=>{jt=require("node:crypto");te();Mr();Ht=class{algorithmIdentifier;secret;hash;constructor(e,r){this.algorithmIdentifier=e,this.secret=r,this.reset()}update(e,r){this.hash.update(Rt(qs(e,r)))}digest(){return Promise.resolve(this.hash.digest())}reset(){this.hash=this.secret?(0,jt.createHmac)(this.algorithmIdentifier,qs(this.secret)):(0,jt.createHash)(this.algorithmIdentifier)}}});var Ws,Ue,co=u(()=>{Ws=require("node:stream");Sr();Ue=class extends Ws.Readable{expectedChecksum;checksumSourceLocation;checksum;source;base64Encoder;constructor({expectedChecksum:e,checksum:r,source:o,checksumSourceLocation:n,base64Encoder:s}){if(super(),typeof o.pipe!="function")throw new Error(`@smithy/util-stream: unsupported source type ${o?.constructor?.name??o} in ChecksumStream.`);this.source=o,this.base64Encoder=s??re,this.expectedChecksum=e,this.checksum=r,this.checksumSourceLocation=n,this.source.on("data",this.onSourceData),this.source.on("end",this.onSourceEnd),this.source.on("error",this.onSourceError),this.source.on("close",this.onSourceClose),this.source.pause()}onSourceData=e=>{if(!this.destroyed){try{this.checksum.update(e)}catch(r){this.destroy(r);return}this.push(e)||this.source.pause()}};onSourceEnd=async()=>{if(!this.destroyed){try{let e=await this.checksum.digest(),r=this.base64Encoder(e);if(this.expectedChecksum!==r){this.destroy(new Error(`Checksum mismatch: expected "${this.expectedChecksum}" but received "${r}" in response header "${this.checksumSourceLocation}".`));return}}catch(e){this.destroy(e);return}this.push(null)}};onSourceError=e=>{this.destroy(e)};onSourceClose=()=>{!this.destroyed&&!this.source.readableEnded&&this.destroy(new Error("Connection lost or stream closed before all data was received."))};_read(e){this.source.resume()}_destroy(e,r){this.source?.removeListener("data",this.onSourceData),this.source?.removeListener("end",this.onSourceEnd),this.source?.removeListener("error",this.onSourceError),this.source?.removeListener("close",this.onSourceClose),this.source?.destroy(),r(e)}}});var v,se,F=u(()=>{v=t=>typeof ReadableStream=="function"&&(t?.constructor?.name===ReadableStream.name||t instanceof ReadableStream),se=t=>typeof Blob=="function"&&(t?.constructor?.name===Blob.name||t instanceof Blob)});var Js,Qs=u(()=>{Js=t=>new TextEncoder().encode(t)});var Xs,fd,Ks,Vt,fo,Zs,Ys=u(()=>{Xs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fd=Object.entries(Xs).reduce((t,[e,r])=>(t[r]=Number(e),t),{}),Ks=Xs.split(""),Vt=6,fo=8,Zs=63});function qt(t){let e;typeof t=="string"?e=Js(t):e=t;let r=typeof e=="object"&&typeof e.length=="number",o=typeof e=="object"&&typeof e.byteOffset=="number"&&typeof e.byteLength=="number";if(!r&&!o)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let n="";for(let s=0;s<e.length;s+=3){let i=0,a=0;for(let m=s,f=Math.min(s+3,e.length);m<f;m++)i|=e[m]<<(f-m-1)*fo,a+=fo;let c=Math.ceil(a/Vt);i<<=c*Vt-a;for(let m=1;m<=c;m++){let f=(c-m)*Vt;n+=Ks[(i&Zs<<f)>>f]}n+="==".slice(0,4-c)}return n}var mo=u(()=>{Qs();Ys()});var _c,Gt,ei=u(()=>{_c=typeof ReadableStream=="function"?ReadableStream:function(){},Gt=class extends _c{}});var ti,ri=u(()=>{mo();F();ei();ti=({expectedChecksum:t,checksum:e,source:r,checksumSourceLocation:o,base64Encoder:n})=>{if(!v(r))throw new Error(`@smithy/util-stream: unsupported source type ${r?.constructor?.name??r} in ChecksumStream.`);let s=n??qt;if(typeof TransformStream!="function")throw new Error("@smithy/util-stream: unable to instantiate ChecksumStream because API unavailable: ReadableStream/TransformStream.");let i=new TransformStream({start(){},async transform(c,m){e.update(c),m.enqueue(c)},async flush(c){let m=await e.digest(),f=s(m);if(t!==f){let d=new Error(`Checksum mismatch: expected "${t}" but received "${f}" in response header "${o}".`);c.error(d)}else c.terminate()}});r.pipeThrough(i);let a=i.readable;return Object.setPrototypeOf(a,Gt.prototype),a}});function oi(t){return typeof ReadableStream=="function"&&v(t.source)?ti(t):new Ue(t)}var ni=u(()=>{F();co();ri()});var pe,uo=u(()=>{pe=class{allocByteArray;byteLength=0;byteArrays=[];constructor(e){this.allocByteArray=e}push(e){this.byteArrays.push(e),this.byteLength+=e.byteLength}flush(){if(this.byteArrays.length===1){let o=this.byteArrays[0];return this.reset(),o}let e=this.allocByteArray(this.byteLength),r=0;for(let o=0;o<this.byteArrays.length;++o){let n=this.byteArrays[o];e.set(n,r),r+=n.byteLength}return this.reset(),e}reset(){this.byteArrays=[],this.byteLength=0}}});function si(t,e,r){let o=t.getReader(),n=!1,s=0,i=["",new pe(m=>new Uint8Array(m))],a=-1,c=async m=>{let{value:f,done:d}=await o.read(),l=f;if(d){if(a!==-1){let p=ge(i,a);K(p)>0&&m.enqueue(p)}m.close()}else{let p=ho(l,!1);if(a!==p&&(a>=0&&m.enqueue(ge(i,a)),a=p),a===-1){m.enqueue(l);return}let h=K(l);s+=h;let g=K(i[a]);if(h>=e&&g===0)m.enqueue(l);else{let y=lo(i,a,l);!n&&s>e*2&&(n=!0,r?.warn(`@smithy/util-stream - stream chunk size ${h} is below threshold of ${e}, automatically buffering.`)),y>=e?m.enqueue(ge(i,a)):await c(m)}}};return new ReadableStream({pull:c})}function lo(t,e,r){switch(e){case 0:return t[0]+=r,K(t[0]);case 1:case 2:return t[e].push(r),K(t[e])}}function ge(t,e){switch(e){case 0:let r=t[0];return t[0]="",r;case 1:case 2:return t[e].flush()}throw new Error(`@smithy/util-stream - invalid index ${e} given to flush()`)}function K(t){return t?.byteLength??t?.length??0}function ho(t,e=!0){return e&&typeof Buffer<"u"&&t instanceof Buffer?2:t instanceof Uint8Array?1:typeof t=="string"?0:-1}var ii=u(()=>{uo()});function ci(t,e,r){if(v(t))return si(t,e,r);let o=new ai.Readable({read(){}}),n=!1,s=0,i=["",new pe(c=>new Uint8Array(c)),new pe(c=>Buffer.from(new Uint8Array(c)))],a=-1;return t.on("data",c=>{let m=ho(c,!0);if(a!==m&&(a>=0&&o.push(ge(i,a)),a=m),a===-1){o.push(c);return}let f=K(c);s+=f;let d=K(i[a]);if(f>=e&&d===0)o.push(c);else{let l=lo(i,a,c);!n&&s>e*2&&(n=!0,r?.warn(`@smithy/util-stream - stream chunk size ${f} is below threshold of ${e}, automatically buffering.`)),l>=e&&o.push(ge(i,a))}}),t.on("end",()=>{if(a!==-1){let c=ge(i,a);K(c)>0&&o.push(c)}o.push(null)}),o}var ai,fi=u(()=>{ai=require("node:stream");uo();ii();F()});var mi,ui=u(()=>{mi=(t,e)=>{let{base64Encoder:r,bodyLengthChecker:o,checksumAlgorithmFn:n,checksumLocationName:s,streamHasher:i}=e,a=r!==void 0&&o!==void 0&&n!==void 0&&s!==void 0&&i!==void 0,c=a?i(n,t):void 0,m=t.getReader();return new ReadableStream({async pull(f){let{value:d,done:l}=await m.read();if(l){if(f.enqueue(`0\r
3
+ `),Ce={warn:console.warn}});function Ct(t){let e=t.getUTCFullYear(),r=t.getUTCMonth(),o=t.getUTCDay(),n=t.getUTCDate(),s=t.getUTCHours(),i=t.getUTCMinutes(),a=t.getUTCSeconds(),c=n<10?`0${n}`:`${n}`,m=s<10?`0${s}`:`${s}`,f=i<10?`0${i}`:`${i}`,d=a<10?`0${a}`:`${a}`;return`${Ka[o]}, ${c} ${Cr[r]} ${e} ${m}:${f}:${d} GMT`}var Ka,Cr,Za,gn,Ya,yn,ec,tc,rc,bn,Sn,Xe,oc,nc,sc,Tr,ic,ac,cc,V,fc,mc,Ae,wn=u(()=>{Er();Ka=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Cr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];Za=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),gn=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=Za.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,o,n,s,i,a,c,m]=e,f=ne(Ae(o)),d=V(n,"month",1,12),l=V(s,"day",1,31);return Xe(f,d,l,{hours:i,minutes:a,seconds:c,fractionalMilliseconds:m})},Ya=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}:\d{2})|[zZ])$/),yn=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=Ya.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,o,n,s,i,a,c,m,f]=e,d=ne(Ae(o)),l=V(n,"month",1,12),p=V(s,"day",1,31),h=Xe(d,l,p,{hours:i,minutes:a,seconds:c,fractionalMilliseconds:m});return f.toUpperCase()!="Z"&&h.setTime(h.getTime()-mc(f)),h},ec=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),tc=new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),rc=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/),bn=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-7231 date-times must be expressed as strings");let e=ec.exec(t);if(e){let[r,o,n,s,i,a,c,m]=e;return Xe(ne(Ae(s)),Tr(n),V(o,"day",1,31),{hours:i,minutes:a,seconds:c,fractionalMilliseconds:m})}if(e=tc.exec(t),e){let[r,o,n,s,i,a,c,m]=e;return sc(Xe(oc(s),Tr(n),V(o,"day",1,31),{hours:i,minutes:a,seconds:c,fractionalMilliseconds:m}))}if(e=rc.exec(t),e){let[r,o,n,s,i,a,c,m]=e;return Xe(ne(Ae(m)),Tr(o),V(n.trimLeft(),"day",1,31),{hours:s,minutes:i,seconds:a,fractionalMilliseconds:c})}throw new TypeError("Invalid RFC-7231 date-time value")},Sn=t=>{if(t==null)return;let e;if(typeof t=="number")e=t;else if(typeof t=="string")e=Qe(t);else if(typeof t=="object"&&t.tag===1)e=t.value;else throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");if(Number.isNaN(e)||e===1/0||e===-1/0)throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(e*1e3))},Xe=(t,e,r,o)=>{let n=e-1;return ac(t,n,r),new Date(Date.UTC(t,n,r,V(o.hours,"hour",0,23),V(o.minutes,"minute",0,59),V(o.seconds,"seconds",0,60),fc(o.fractionalMilliseconds)))},oc=t=>{let e=new Date().getUTCFullYear(),r=Math.floor(e/100)*100+ne(Ae(t));return r<e?r+100:r},nc=50*365*24*60*60*1e3,sc=t=>t.getTime()-new Date().getTime()>nc?new Date(Date.UTC(t.getUTCFullYear()-100,t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds())):t,Tr=t=>{let e=Cr.indexOf(t);if(e<0)throw new TypeError(`Invalid month: ${t}`);return e+1},ic=[31,28,31,30,31,30,31,31,30,31,30,31],ac=(t,e,r)=>{let o=ic[e];if(e===1&&cc(t)&&(o=29),r>o)throw new TypeError(`Invalid day for ${Cr[e]} in ${t}: ${r}`)},cc=t=>t%4===0&&(t%100!==0||t%400===0),V=(t,e,r,o)=>{let n=Tt(Ae(t));if(n<r||n>o)throw new TypeError(`${e} must be between ${r} and ${o}, inclusive`);return n},fc=t=>t==null?0:xt("0."+t)*1e3,mc=t=>{let e=t[0],r=1;if(e=="+")r=1;else if(e=="-")r=-1;else throw new TypeError(`Offset direction, ${e}, must be "+" or "-"`);let o=Number(t.substring(1,3)),n=Number(t.substring(4,6));return r*(o*60+n)*60*1e3},Ae=t=>{let e=0;for(;e<t.length-1&&t.charAt(e)==="0";)e++;return e===0?t:t.slice(e)}});var D,xn=u(()=>{D=function(e){return Object.assign(new String(e),{deserializeJSON(){return JSON.parse(String(e))},toString(){return String(e)},toJSON(){return String(e)}})};D.from=t=>t&&typeof t=="object"&&(t instanceof D||"deserializeJSON"in t)?t:typeof t=="string"||Object.getPrototypeOf(t)===String.prototype?D(String(t)):D(JSON.stringify(t));D.fromObject=D.from});function vt(t){return(t.includes(",")||t.includes('"'))&&(t=`"${t.replace(/"/g,'\\"')}"`),t}var En=u(()=>{});function Q(t,e,r){let o=Number(t);if(o<e||o>r)throw new Error(`Value ${o} out of range [${e}, ${r}]`)}var vr,Ar,Nr,Tn,Cn,uc,dc,lc,pc,hc,At,Nt,It,vn=u(()=>{vr="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?",Ar="(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)",Nr="(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?",Tn="(\\d?\\d)",Cn="(\\d{4})",uc=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/),dc=new RegExp(`^${vr}, ${Tn} ${Ar} ${Cn} ${Nr} GMT$`),lc=new RegExp(`^${vr}, ${Tn}-${Ar}-(\\d\\d) ${Nr} GMT$`),pc=new RegExp(`^${vr} ${Ar} ( [1-9]|\\d\\d) ${Nr} ${Cn}$`),hc=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],At=t=>{if(t==null)return;let e=NaN;if(typeof t=="number")e=t;else if(typeof t=="string"){if(!/^-?\d*\.?\d+$/.test(t))throw new TypeError("parseEpochTimestamp - numeric string invalid.");e=Number.parseFloat(t)}else typeof t=="object"&&t.tag===1&&(e=t.value);if(isNaN(e)||Math.abs(e)===1/0)throw new TypeError("Epoch timestamps must be valid finite numbers.");return new Date(Math.round(e*1e3))},Nt=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC3339 timestamps must be strings");let e=uc.exec(t);if(!e)throw new TypeError(`Invalid RFC3339 timestamp format ${t}`);let[,r,o,n,s,i,a,,c,m]=e;Q(o,1,12),Q(n,1,31),Q(s,0,23),Q(i,0,59),Q(a,0,60);let f=new Date(Date.UTC(Number(r),Number(o)-1,Number(n),Number(s),Number(i),Number(a),Number(c)?Math.round(parseFloat(`0.${c}`)*1e3):0));if(f.setUTCFullYear(Number(r)),m.toUpperCase()!="Z"){let[,d,l,p]=/([+-])(\d\d):(\d\d)/.exec(m)||[void 0,"+",0,0],h=d==="-"?1:-1;f.setTime(f.getTime()+h*(Number(l)*60*60*1e3+Number(p)*60*1e3))}return f},It=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC7231 timestamps must be strings.");let e,r,o,n,s,i,a,c;if((c=dc.exec(t))?[,e,r,o,n,s,i,a]=c:(c=lc.exec(t))?([,e,r,o,n,s,i,a]=c,o=(Number(o)+1900).toString()):(c=pc.exec(t))&&([,r,e,n,s,i,a,o]=c),o&&i){let m=Date.UTC(Number(o),hc.indexOf(r),Number(e),Number(n),Number(s),Number(i),a?Math.round(parseFloat(`0.${a}`)*1e3):0);Q(e,1,31),Q(n,0,23),Q(s,0,59),Q(i,0,60);let f=new Date(m);return f.setUTCFullYear(Number(o)),f}throw new TypeError(`Invalid RFC7231 date-time value ${t}.`)}});function Rt(t,e,r){if(r<=0||!Number.isInteger(r))throw new Error("Invalid number of delimiters ("+r+") for splitEvery.");let o=t.split(e);if(r===1)return o;let n=[],s="";for(let i=0;i<o.length;i++)s===""?s=o[i]:s+=e+o[i],(i+1)%r===0&&(n.push(s),s="");return s!==""&&n.push(s),n}var An=u(()=>{});var Ne,Nn=u(()=>{Ne=t=>{let e=t.length,r=[],o=!1,n,s=0;for(let i=0;i<e;++i){let a=t[i];switch(a){case'"':n!=="\\"&&(o=!o);break;case",":o||(r.push(t.slice(s,i)),s=i+1);break;default:}n=a}return r.push(t.slice(s)),r.map(i=>{i=i.trim();let a=i.length;return a<2?i:(i[0]==='"'&&i[a-1]==='"'&&(i=i.slice(1,a-1)),i.replace(/\\"/g,'"'))})}});function Rn(t){return new de(String(t),"bigDecimal")}var In,de,Mn=u(()=>{In=/^-?((0|[1-9]\d*)(\.\d+)?|\.\d+)([eE][+-]?\d+)?$/,de=class t{string;type;constructor(e,r){if(this.string=e,this.type=r,!In.test(e))throw new Error(`@smithy/core/serde - NumericValue string must conform to the Smithy bigDecimal format. Received: "${e}"`)}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"&&In.test(r.string)}}});function Mt(t){if(t.length%2!==0)throw new Error("Hex encoded strings must have an even number length");let e=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2){let o=t.slice(r,r+2).toLowerCase();if(o in Ir)e[r/2]=Ir[o];else throw new Error(`Cannot decode unrecognized sequence ${o} as hexadecimal`)}return e}function _(t){let e="";for(let r=0;r<t.byteLength;r++)e+=On[t[r]];return e}var On,Ir,Rr=u(()=>{On={},Ir={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),On[t]=e,Ir[e]=t}});var Ie,Pn,Un=u(()=>{Ie=require("node:fs"),Pn=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 Ie.ReadStream){if(t.path!=null)return(0,Ie.lstatSync)(t.path).size;if(typeof t.fd=="number")return(0,Ie.fstatSync)(t.fd).size}throw new Error(`Body Length computation failed for ${t}`)}});var Ot,Mr=u(()=>{ht();Ot=t=>t instanceof Uint8Array?t:typeof t=="string"?L(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)});function se(t,e){if(e===void 0){e=0;for(let n of t)e+=n.byteLength}let r=new Uint8Array(e),o=0;for(let n of t)r.set(n,o),o+=n.byteLength;return r}var Ke=u(()=>{});var Ye=Go(F=>{var Or;(function(t){t.HEADER="header",t.QUERY="query"})(Or||(Or={}));var Pr;(function(t){t.HEADER="header",t.QUERY="query"})(Pr||(Pr={}));var Ur;(function(t){t.HTTP="http",t.HTTPS="https"})(Ur||(Ur={}));var Ze;(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(Ze||(Ze={}));var gc=t=>{let e=[];return t.sha256!==void 0&&e.push({algorithmId:()=>Ze.SHA256,checksumConstructor:()=>t.sha256}),t.md5!=null&&e.push({algorithmId:()=>Ze.MD5,checksumConstructor:()=>t.md5}),{addChecksumAlgorithm(r){e.push(r)},checksumAlgorithms(){return e}}},yc=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e},bc=t=>gc(t),Sc=t=>yc(t),kr;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(kr||(kr={}));var wc="__smithy_context",Dr;(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(Dr||(Dr={}));var _r;(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(_r||(_r={}));F.AlgorithmId=Ze;F.EndpointURLScheme=Ur;F.FieldPosition=kr;F.HttpApiKeyAuthLocation=Pr;F.HttpAuthLocation=Or;F.IniSectionType=Dr;F.RequestHandlerProtocol=_r;F.SMITHY_CONTEXT_KEY=wc;F.getDefaultClientConfiguration=bc;F.resolveDefaultRuntimeConfig=Sc});var $r,Br,kn=u(()=>{$r=we(Ye()),Br=t=>t[$r.SMITHY_CONTEXT_KEY]||(t[$r.SMITHY_CONTEXT_KEY]={})});function xc(t){return Object.keys(t).reduce((e,r)=>{let o=t[r];return{...e,[r]:Array.isArray(o)?[...o]:o}},{})}var U,Dn=u(()=>{U=class t{method;protocol;hostname;port;path;query;headers;username;password;fragment;body;constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=xc(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}}});var X,_n=u(()=>{X=class{statusCode;reason;headers;body;constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;let r=e;return typeof r.statusCode=="number"&&typeof r.headers=="object"}}});function et(t){return/^[a-z0-9][a-z0-9.-]*[a-z0-9]$/.test(t)}var $n=u(()=>{});var tt,Bn=u(()=>{tt=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});function rt(t){let e={};if(t=t.replace(/^\?/,""),t)for(let r of t.split("&")){let[o,n=null]=r.split("=");o=decodeURIComponent(o),n&&(n=decodeURIComponent(n)),o in e?Array.isArray(e[o])?e[o].push(n):e[o]=[e[o],n]:e[o]=n}return e}var Lr=u(()=>{});var le,Fr=u(()=>{Lr();le=t=>{if(typeof t=="string")return le(new URL(t));let{hostname:e,pathname:r,port:o,protocol:n,search:s}=t,i;return s&&(i=rt(s)),{hostname:e,port:o?parseInt(o):void 0,protocol:n,path:r,query:i}}});var K,Ln=u(()=>{Fr();K=t=>{if(typeof t=="object"){if("url"in t){let e=le(t.url);if(t.headers){e.headers={};for(let r in t.headers)e.headers[r.toLowerCase()]=t.headers[r].join(", ")}return e}return t}return le(t)}});var M=u(()=>{kn();Dn();_n();$n();Bn();Lr();Fr();Ln()});var Pt,zr,Hr=u(()=>{M();Pt=(t,e)=>(r,o)=>async n=>{let{response:s}=await r(n);try{let i=await e(s,t);return{response:s,output:i}}catch(i){if(Object.defineProperty(i,"$response",{value:s,enumerable:!1,writable:!1,configurable:!1}),!("$metadata"in i)){let a="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";try{i.message+=`
4
+ `+a}catch{!o.logger||o.logger?.constructor?.name==="NoOpLogger"?console.warn(a):o.logger?.warn?.(a)}typeof i.$responseBodyText<"u"&&i.$response&&(i.$response.body=i.$responseBodyText);try{if(X.isInstance(s)){let{headers:c={}}=s,m=Object.entries(c);i.$metadata={httpStatusCode:s.statusCode,requestId:zr(/^x-[\w-]+-request-?id$/,m),extendedRequestId:zr(/^x-[\w-]+-id-2$/,m),cfId:zr(/^x-[\w-]+-cf-id$/,m)}}}catch{}}throw i}},zr=(t,e)=>(e.find(([r])=>r.match(t))||[void 0,void 0])[1]});var Re,jr=u(()=>{Re=class t extends Error{name="ProviderError";tryNextLink;constructor(e,r=!0){let o,n=!0;typeof r=="boolean"?(o=void 0,n=r):r!=null&&typeof r=="object"&&(o=r.logger,n=r.tryNextLink??!0),super(e),this.tryNextLink=n,Object.setPrototypeOf(this,t.prototype),o?.debug?.(`@smithy/property-provider ${n?"->":"(!)"} ${e}`)}static from(e,r=!0){return Object.assign(new this(e.message,r),e)}}});var Me,Vr=u(()=>{jr();Me=class t extends Re{name="CredentialsProviderError";constructor(e,r=!0){super(e,r),Object.setPrototypeOf(this,t.prototype)}}});var Fn,zn=u(()=>{jr();Fn=(...t)=>async()=>{if(t.length===0)throw new Re("No providers in chain");let e;for(let r of t)try{return await r()}catch(o){if(e=o,o?.tryNextLink)continue;throw o}throw e}});var Hn,jn=u(()=>{Hn=t=>()=>Promise.resolve(t)});var Vn,qn=u(()=>{Vn=(t,e,r)=>{let o,n,s,i=!1,a=async()=>{n||(n=t());try{o=await n,s=!0,i=!1}finally{n=void 0}return o};return e===void 0?async c=>((!s||c?.forceRefresh)&&(o=await a()),o):async c=>((!s||c?.forceRefresh)&&(o=await a()),i?o:r&&!r(o)?(i=!0,o):(e(o)&&await a(),o))}});var Ut,Gn=u(()=>{Ut=(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 Oe,Wn=u(()=>{(function(t){t.ENV="env",t.CONFIG="shared config entry"})(Oe||(Oe={}))});var Jn,Qn,qr,Ec,Pe,kt=u(()=>{Jn=require("node:os"),Qn=require("node:path"),qr={},Ec=()=>process&&process.geteuid?`${process.geteuid()}`:"DEFAULT",Pe=()=>{let{HOME:t,USERPROFILE:e,HOMEPATH:r,HOMEDRIVE:o=`C:${Qn.sep}`}=process.env;if(t)return t;if(e)return e;if(r)return`${o}${r}`;let n=Ec();return qr[n]||(qr[n]=(0,Jn.homedir)()),qr[n]}});var Tc,Cc,Xn,Kn=u(()=>{Tc="AWS_PROFILE",Cc="default",Xn=t=>t.profile||process.env[Tc]||Cc});var Gr,Zn,Yn=u(()=>{Gr=we(Ye()),Zn=t=>Object.entries(t).filter(([e])=>{let r=e.indexOf(".");return r===-1?!1:Object.values(Gr.IniSectionType).includes(e.substring(0,r))}).reduce((e,[r,o])=>{let n=r.indexOf("."),s=r.substring(0,n)===Gr.IniSectionType.PROFILE?r.substring(n+1):r;return e[s]=o,e},{...t.default&&{default:t.default}})});var es,vc,ts,rs=u(()=>{es=require("node:path");kt();vc="AWS_CONFIG_FILE",ts=()=>process.env[vc]||(0,es.join)(Pe(),".aws","config")});var os,Ac,ns,ss=u(()=>{os=require("node:path");kt();Ac="AWS_SHARED_CREDENTIALS_FILE",ns=()=>process.env[Ac]||(0,os.join)(Pe(),".aws","credentials")});var is,Nc,Ic,Wr,as=u(()=>{is=we(Ye()),Nc=/^([\w-]+)\s(["'])?([\w-@+.%:/]+)\2$/,Ic=["__proto__","profile __proto__"],Wr=t=>{let e={},r,o;for(let n of t.split(/\r?\n/)){let s=n.split(/(^|\s)[;#]/)[0].trim();if(s[0]==="["&&s[s.length-1]==="]"){r=void 0,o=void 0;let a=s.substring(1,s.length-1),c=Nc.exec(a);if(c){let[,m,,f]=c;Object.values(is.IniSectionType).includes(m)&&(r=[m,f].join("."))}else r=a;if(Ic.includes(a))throw new Error(`Found invalid profile name "${a}"`)}else if(r){let a=s.indexOf("=");if(![0,-1].includes(a)){let[c,m]=[s.substring(0,a).trim(),s.substring(a+1).trim()];if(m==="")o=c;else{o&&n.trimStart()===n&&(o=void 0),e[r]=e[r]||{};let f=o?[o,c].join("."):c;e[r][f]=m}}}}return e}});var fs,Jr,cs,Qr,ms=u(()=>{fs=require("node:fs/promises"),Jr={},cs={},Qr=(t,e)=>cs[t]!==void 0?cs[t]:((!Jr[t]||e?.ignoreCache)&&(Jr[t]=(0,fs.readFile)(t,"utf8")),Jr[t])});var Xr,us,ds,ls=u(()=>{Xr=require("node:path");Yn();rs();ss();kt();as();ms();us=()=>({}),ds=async(t={})=>{let{filepath:e=ns(),configFilepath:r=ts()}=t,o=Pe(),n="~/",s=e;e.startsWith(n)&&(s=(0,Xr.join)(o,e.slice(2)));let i=r;r.startsWith(n)&&(i=(0,Xr.join)(o,r.slice(2)));let a=await Promise.all([Qr(i,{ignoreCache:t.ignoreCache}).then(Wr).then(Zn).catch(us),Qr(s,{ignoreCache:t.ignoreCache}).then(Wr).catch(us)]);return{configFile:a[0],credentialsFile:a[1]}}});function Dt(t){try{let e=new Set(Array.from(t.match(/([A-Z_]){3,}/g)??[]));return e.delete("CONFIG"),e.delete("CONFIG_PREFIX_SEPARATOR"),e.delete("ENV"),[...e].join(", ")}catch{return t}}var Kr=u(()=>{});var ps,hs=u(()=>{Vr();Kr();ps=(t,e)=>async()=>{try{let r=t(process.env,e);if(r===void 0)throw new Error;return r}catch(r){throw new Me(r.message||`Not found in ENV: ${Dt(t.toString())}`,{logger:e?.logger})}}});var gs,ys=u(()=>{Vr();Kn();ls();Kr();gs=(t,{preferredFile:e="config",...r}={})=>async()=>{let o=Xn(r),{configFile:n,credentialsFile:s}=await ds(r),i=s[o]||{},a=n[o]||{},c=e==="config"?{...i,...a}:{...a,...i};try{let f=t(c,e==="config"?n:s);if(f===void 0)throw new Error;return f}catch(m){throw new Me(m.message||`Not found in config files w/ profile [${o}]: ${Dt(t.toString())}`,{logger:r.logger})}}});var Rc,bs,Ss=u(()=>{jn();Rc=t=>typeof t=="function",bs=t=>Rc(t)?async()=>await t():Hn(t)});var _t,ws=u(()=>{zn();qn();hs();ys();Ss();_t=({environmentVariableSelector:t,configFileSelector:e,default:r},o={})=>{let{signingName:n,logger:s}=o;return Vn(Fn(ps(t,{signingName:n,logger:s}),gs(e,o),bs(r)))}});var $t,xs=u(()=>{$t=t=>typeof t=="function"?t():t});function q(t){if(typeof t=="object")return t;if(t=t|0,Bt[t])return Bt[t];let e={},r=0;for(let o of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"])(t>>r++&1)===1&&(e[o]=1);return Bt[t]=e}var Bt,Zr=u(()=>{Bt=[]});function st(t,e){if(t instanceof C)return Object.assign(t,{memberName:e,_isMemberSchema:!0});let r=C;return new r(t,e)}var nt,Lt,Ft,C,Yr,Es,Ts=u(()=>{xs();Zr();nt={it:Symbol.for("@smithy/nor-struct-it"),ns:Symbol.for("@smithy/ns")},Lt=[],Ft={},C=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 o=[],n=e,s=e;for(this._isMemberSchema=!1;Yr(n);)o.push(n[1]),n=n[0],s=$t(n),this._isMemberSchema=!0;if(o.length>0){this.memberTraits={};for(let i=o.length-1;i>=0;--i){let a=o[i];Object.assign(this.memberTraits,q(a))}}else this.memberTraits=0;if(s instanceof t){let i=this.memberTraits;Object.assign(this,s),this.memberTraits=Object.assign({},i,s.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,this.memberName=r??s.memberName;return}if(this.schema=$t(s),Es(this.schema)?(this.name=`${this.schema[1]}#${this.schema[2]}`,this.traits=this.schema[3]):(this.name=this.memberName??String(s),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(Lt[e])return Lt[e]}else if(typeof e=="string"){if(Ft[e])return Ft[e]}else if(r&&e[nt.ns])return e[nt.ns];let o=$t(e);if(o instanceof t)return o;if(Yr(o)){let[s,i]=o;if(s instanceof t)return Object.assign(s.getMergedTraits(),q(i)),s;throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(e,null,2)}.`)}let n=new t(o);return r?e[nt.ns]=n:typeof o=="string"?Ft[o]=n:typeof o=="number"?Lt[o]=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 q(this.memberTraits)}getOwnTraits(){return q(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 o=this.getSchema(),n=e?15:o[4]??0;return st([n,0],"key")}getValueSchema(){let e=this.getSchema(),[r,o,n]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()],s=typeof e=="number"?63&e:e&&typeof e=="object"&&(o||n)?e[3+e[0]]:r?15:void 0;if(s!=null)return st([s,0],o?"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 o=r[4].indexOf(e),n=r[5][o];return st(Yr(n)?n:[n,0],e)}if(this.isDocumentSchema())return st([15,0],e);throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no member=${e}.`)}getMemberSchemas(){let e={};try{for(let[r,o]of this.structIterator())e[r]=o}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,o=e[nt.it];if(o&&r===o.length){yield*o;return}o=Array(r);for(let n=0;n<r;++n){let s=e[4][n],i=st([e[5][n],0],s);yield o[n]=[s,i]}e[nt.it]=o}};Yr=t=>Array.isArray(t)&&t.length===2,Es=t=>Array.isArray(t)&&t.length>=5});var pe,Cs=u(()=>{pe=class t{namespace;schemas;exceptions;static registries=new Map;constructor(e,r=new Map,o=new Map){this.namespace=e,this.schemas=r,this.exceptions=o}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:o}=this;for(let[n,s]of e.schemas)r.has(n)||r.set(n,s);for(let[n,s]of e.exceptions)o.has(n)||o.set(n,s)}register(e,r){let o=this.normalizeShapeId(e);for(let n of[this,t.for(o.split("#")[0])])n.schemas.set(o,r)}getSchema(e){let r=this.normalizeShapeId(e);if(!this.schemas.has(r)){if(!e.includes("#")){let o="#"+e,n=[];for(let[s,i]of this.schemas.entries())s.endsWith(o)&&n.push(i);if(n.length===1)return n[0]}throw new Error(`@smithy/core/schema - schema not found for ${r}`)}return this.schemas.get(r)}registerError(e,r){let o=e,n=o[1];for(let s of[this,t.for(n)])s.schemas.set(n+"#"+o[2],o),s.exceptions.set(o,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,o]=e,n=r+"#"+o;if(n.startsWith("smithy.ts.sdk.synthetic.")&&n.endsWith("ServiceException"))return e}}find(e){for(let r of this.schemas.values())if(e(r))return r}clear(){this.schemas.clear(),this.exceptions.clear()}normalizeShapeId(e){return e.includes("#")?e:this.namespace+"#"+e}}});var Z=u(()=>{Ts();Zr();Cs()});var eo=u(()=>{Gn();Wn();ws()});var vs,As,Ns,Is=u(()=>{vs="AWS_ENDPOINT_URL",As="endpoint_url",Ns=t=>({environmentVariableSelector:e=>{let r=t.split(" ").map(s=>s.toUpperCase()),o=e[[vs,...r].join("_")];if(o)return o;let n=e[vs];if(n)return n},configFileSelector:(e,r)=>{if(e.services){let n=["services",e.services].join(".");if(!r||!r[n])throw new Error(`The services section "${e.services}" specified in the profile is not present in the shared configuration file.`);let s=r[n],i=t.split(" ").map(c=>c.toLowerCase()),a=s[[i.join("_"),As].join(".")];if(a)return a}let o=e[As];if(o)return o},default:void 0})});var Mc,Oc,Rs,Ms=u(()=>{eo();Mc="AWS_IGNORE_CONFIGURED_ENDPOINT_URLS",Oc="ignore_configured_endpoint_urls",Rs={environmentVariableSelector:t=>Ut(t,Mc,Oe.ENV),configFileSelector:t=>Ut(t,Oc,Oe.CONFIG),default:!1}});var it,Os=u(()=>{eo();Is();Ms();it=async t=>{if(!await _t(Rs)())return _t(Ns(t??""))()}});var to,Pc,Uc,kc,Ps,Us,ks=u(()=>{to=async t=>{let e=t?.Bucket||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),Us(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!Ps(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},Pc=/^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$/,Uc=/(\d+\.){3}\d+/,kc=/\.\./,Ps=t=>Pc.test(t)&&!Uc.test(t)&&!kc.test(t),Us=t=>{let[e,r,o,,,n]=t.split(":"),s=e==="arn"&&t.split(":").length>=6,i=!!(s&&r&&o&&n);if(s&&!i)throw new Error(`Invalid ARN: ${t} was an invalid ARN.`);return i}});var Ds=u(()=>{ks()});var _s,$s=u(()=>{_s=(t,e,r,o=!1)=>{let n=async()=>{let s;return o?s=r.clientContextParams?.[t]??r[t]??r[e]:s=r[t]??r[e],typeof s=="function"?s():s};return t==="credentialScope"||e==="CredentialScope"?async()=>{let s=typeof r.credentials=="function"?await r.credentials():r.credentials;return s?.credentialScope??s?.CredentialScope}:t==="accountId"||e==="AccountId"?async()=>{let s=typeof r.credentials=="function"?await r.credentials():r.credentials;return s?.accountId??s?.AccountId}:t==="endpoint"||e==="endpoint"?async()=>{if(r.isCustomEndpoint===!1)return;let s=await n();if(s&&typeof s=="object"){if("url"in s)return s.url.href;if("hostname"in s){let{protocol:i,hostname:a,port:c,path:m}=s;return`${i}//${a}${c?":"+c:""}${m}`}}return s}:n}});var ro=u(()=>{M()});function zt(t){return async(e,r,o,n)=>{if(!o.isCustomEndpoint&&!o.ignoreConfiguredEndpointUrls){let a;o.serviceConfiguredEndpoint?a=await o.serviceConfiguredEndpoint():a=await t(o.serviceId),a&&(o.endpoint=()=>Promise.resolve(K(a)),o.isCustomEndpoint=!0,n?.logger?.debug?.(`@smithy/core/endpoints - resolved endpoint from config: ${a}`))}let s=await Dc(e,r,o);if(typeof o.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");let i=o.endpointProvider(s,n);if(o.isCustomEndpoint&&o.endpoint){let a=await o.endpoint();if(a?.headers){i.headers??={};for(let[c,m]of Object.entries(a.headers))i.headers[c]=Array.isArray(m)?m:[m]}}return i}}var Dc,oo=u(()=>{Ds();$s();ro();Dc=async(t,e,r)=>{let o={},n=e?.getEndpointParameterInstructions?.()||{};for(let[s,i]of Object.entries(n))switch(i.type){case"staticContextParams":o[s]=i.value;break;case"contextParams":o[s]=t[i.name];break;case"clientContextParams":case"builtInParams":o[s]=await _s(i.name,s,r,i.type!=="builtInParams")();break;case"operationContextParams":o[s]=i.get(t);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(i))}return Object.keys(n).length===0&&Object.assign(o,r),String(r.serviceId).toLowerCase()==="s3"&&await to(o),o}});function _c(t,e,r){t.__smithy_context?t.__smithy_context.features||(t.__smithy_context.features={}):t.__smithy_context={features:{}},t.__smithy_context.features[e]=r}function Ht(t){let e=zt(t);return({config:r,instructions:o})=>(n,s)=>async i=>{r.isCustomEndpoint&&_c(s,"ENDPOINT_OVERRIDE","N");let a=await e(i.input,{getEndpointParameterInstructions(){return o}},{...r},s);s.endpointV2=a,s.authSchemes=a.properties?.authSchemes;let c=s.authSchemes?.[0];if(c){s.signing_region=c.signingRegion,s.signing_service=c.signingName;let f=Br(s)?.selectedHttpAuthScheme?.httpAuthOption;f&&(f.signingProperties=Object.assign(f.signingProperties||{},{signing_region:c.signingRegion,signingRegion:c.signingRegion,signing_service:c.signingName,signingName:c.signingName,signingRegionSet:c.signingRegionSet},c.properties))}return n({...i})}}var no=u(()=>{M();oo()});function Bs(t){let e=Ht(t);return(r,o)=>({applyToStack:n=>{n.addRelativeTo(e({config:r,instructions:o}),Bc)}})}var $c,Bc,Ls=u(()=>{no();$c={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0},Bc={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:$c.name}});function Fs(t){return e=>{let r=e.tls??!0,{endpoint:o,useDualstackEndpoint:n,useFipsEndpoint:s}=e,i=o!=null?async()=>K(await tt(o)()):void 0,c=Object.assign(e,{endpoint:i,tls:r,isCustomEndpoint:!!o,useDualstackEndpoint:tt(n??!1),useFipsEndpoint:tt(s??!1),ignoreConfiguredEndpointUrls:!!e.ignoreConfiguredEndpointUrls}),m;return c.serviceConfiguredEndpoint=async()=>(e.serviceId&&!m&&(m=t(e.serviceId)),m),c}}var zs=u(()=>{M();ro()});var Wu,Ju,Qu,Xu,Hs=u(()=>{Os();oo();no();Ls();zs();M();Wu=zt(it),Ju=Fs(it),Qu=Ht(it),Xu=Bs(it)});var jt,so=u(()=>{Hs();jt=(t,e)=>(r,o)=>async n=>{let s=t,i=o.endpointV2?async()=>K(o.endpointV2):s.endpoint;if(!i)throw new Error("No valid endpoint provider available.");let a=await e(n.input,{...t,endpoint:i});return r({...n,request:a})}});function js(t,e,r){return{applyToStack:o=>{o.add(Pt(t,r),io),o.add(jt(t,e),ao)}}}var io,ao,Vs=u(()=>{Hr();so();io={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},ao={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0}});function qs(t,e){return Buffer.isBuffer(t)?t:typeof t=="string"?te(t,e):ArrayBuffer.isView(t)?B(t.buffer,t.byteOffset,t.byteLength):B(t)}var qt,Vt,Gs=u(()=>{qt=require("node:crypto");re();Mr();Vt=class{algorithmIdentifier;secret;hash;constructor(e,r){this.algorithmIdentifier=e,this.secret=r,this.reset()}update(e,r){this.hash.update(Ot(qs(e,r)))}digest(){return Promise.resolve(this.hash.digest())}reset(){this.hash=this.secret?(0,qt.createHmac)(this.algorithmIdentifier,qs(this.secret)):(0,qt.createHash)(this.algorithmIdentifier)}}});var Ws,Ue,co=u(()=>{Ws=require("node:stream");br();Ue=class extends Ws.Readable{expectedChecksum;checksumSourceLocation;checksum;source;base64Encoder;constructor({expectedChecksum:e,checksum:r,source:o,checksumSourceLocation:n,base64Encoder:s}){if(super(),typeof o.pipe!="function")throw new Error(`@smithy/util-stream: unsupported source type ${o?.constructor?.name??o} in ChecksumStream.`);this.source=o,this.base64Encoder=s??oe,this.expectedChecksum=e,this.checksum=r,this.checksumSourceLocation=n,this.source.on("data",this.onSourceData),this.source.on("end",this.onSourceEnd),this.source.on("error",this.onSourceError),this.source.on("close",this.onSourceClose),this.source.pause()}onSourceData=e=>{if(!this.destroyed){try{this.checksum.update(e)}catch(r){this.destroy(r);return}this.push(e)||this.source.pause()}};onSourceEnd=async()=>{if(!this.destroyed){try{let e=await this.checksum.digest(),r=this.base64Encoder(e);if(this.expectedChecksum!==r){this.destroy(new Error(`Checksum mismatch: expected "${this.expectedChecksum}" but received "${r}" in response header "${this.checksumSourceLocation}".`));return}}catch(e){this.destroy(e);return}this.push(null)}};onSourceError=e=>{this.destroy(e)};onSourceClose=()=>{!this.destroyed&&!this.source.readableEnded&&this.destroy(new Error("Connection lost or stream closed before all data was received."))};_read(e){this.source.resume()}_destroy(e,r){this.source?.removeListener("data",this.onSourceData),this.source?.removeListener("end",this.onSourceEnd),this.source?.removeListener("error",this.onSourceError),this.source?.removeListener("close",this.onSourceClose),this.source?.destroy(),r(e)}}});var N,ie,z=u(()=>{N=t=>typeof ReadableStream=="function"&&(t?.constructor?.name===ReadableStream.name||t instanceof ReadableStream),ie=t=>typeof Blob=="function"&&(t?.constructor?.name===Blob.name||t instanceof Blob)});var Js,Qs=u(()=>{Js=t=>new TextEncoder().encode(t)});var Xs,ud,Ks,Gt,fo,Zs,Ys=u(()=>{Xs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ud=Object.entries(Xs).reduce((t,[e,r])=>(t[r]=Number(e),t),{}),Ks=Xs.split(""),Gt=6,fo=8,Zs=63});function Wt(t){let e;typeof t=="string"?e=Js(t):e=t;let r=typeof e=="object"&&typeof e.length=="number",o=typeof e=="object"&&typeof e.byteOffset=="number"&&typeof e.byteLength=="number";if(!r&&!o)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let n="";for(let s=0;s<e.length;s+=3){let i=0,a=0;for(let m=s,f=Math.min(s+3,e.length);m<f;m++)i|=e[m]<<(f-m-1)*fo,a+=fo;let c=Math.ceil(a/Gt);i<<=c*Gt-a;for(let m=1;m<=c;m++){let f=(c-m)*Gt;n+=Ks[(i&Zs<<f)>>f]}n+="==".slice(0,4-c)}return n}var mo=u(()=>{Qs();Ys()});var Lc,Jt,ei=u(()=>{Lc=typeof ReadableStream=="function"?ReadableStream:function(){},Jt=class extends Lc{}});var ti,ri=u(()=>{mo();z();ei();ti=({expectedChecksum:t,checksum:e,source:r,checksumSourceLocation:o,base64Encoder:n})=>{if(!N(r))throw new Error(`@smithy/util-stream: unsupported source type ${r?.constructor?.name??r} in ChecksumStream.`);let s=n??Wt;if(typeof TransformStream!="function")throw new Error("@smithy/util-stream: unable to instantiate ChecksumStream because API unavailable: ReadableStream/TransformStream.");let i=new TransformStream({start(){},async transform(c,m){e.update(c),m.enqueue(c)},async flush(c){let m=await e.digest(),f=s(m);if(t!==f){let d=new Error(`Checksum mismatch: expected "${t}" but received "${f}" in response header "${o}".`);c.error(d)}else c.terminate()}});r.pipeThrough(i);let a=i.readable;return Object.setPrototypeOf(a,Jt.prototype),a}});function oi(t){return typeof ReadableStream=="function"&&N(t.source)?ti(t):new Ue(t)}var ni=u(()=>{z();co();ri()});var he,uo=u(()=>{he=class{allocByteArray;byteLength=0;byteArrays=[];constructor(e){this.allocByteArray=e}push(e){this.byteArrays.push(e),this.byteLength+=e.byteLength}flush(){if(this.byteArrays.length===1){let o=this.byteArrays[0];return this.reset(),o}let e=this.allocByteArray(this.byteLength),r=0;for(let o=0;o<this.byteArrays.length;++o){let n=this.byteArrays[o];e.set(n,r),r+=n.byteLength}return this.reset(),e}reset(){this.byteArrays=[],this.byteLength=0}}});function si(t,e,r){let o=t.getReader(),n=!1,s=0,i=["",new he(m=>new Uint8Array(m))],a=-1,c=async m=>{let{value:f,done:d}=await o.read(),l=f;if(d){if(a!==-1){let p=ge(i,a);Y(p)>0&&m.enqueue(p)}m.close()}else{let p=po(l,!1);if(a!==p&&(a>=0&&m.enqueue(ge(i,a)),a=p),a===-1){m.enqueue(l);return}let h=Y(l);s+=h;let g=Y(i[a]);if(h>=e&&g===0)m.enqueue(l);else{let y=lo(i,a,l);!n&&s>e*2&&(n=!0,r?.warn(`@smithy/util-stream - stream chunk size ${h} is below threshold of ${e}, automatically buffering.`)),y>=e?m.enqueue(ge(i,a)):await c(m)}}};return new ReadableStream({pull:c})}function lo(t,e,r){switch(e){case 0:return t[0]+=r,Y(t[0]);case 1:case 2:return t[e].push(r),Y(t[e])}}function ge(t,e){switch(e){case 0:let r=t[0];return t[0]="",r;case 1:case 2:return t[e].flush()}throw new Error(`@smithy/util-stream - invalid index ${e} given to flush()`)}function Y(t){return t?.byteLength??t?.length??0}function po(t,e=!0){return e&&typeof Buffer<"u"&&t instanceof Buffer?2:t instanceof Uint8Array?1:typeof t=="string"?0:-1}var ii=u(()=>{uo()});function ci(t,e,r){if(N(t))return si(t,e,r);let o=new ai.Readable({read(){}}),n=!1,s=0,i=["",new he(c=>new Uint8Array(c)),new he(c=>Buffer.from(new Uint8Array(c)))],a=-1;return t.on("data",c=>{let m=po(c,!0);if(a!==m&&(a>=0&&o.push(ge(i,a)),a=m),a===-1){o.push(c);return}let f=Y(c);s+=f;let d=Y(i[a]);if(f>=e&&d===0)o.push(c);else{let l=lo(i,a,c);!n&&s>e*2&&(n=!0,r?.warn(`@smithy/util-stream - stream chunk size ${f} is below threshold of ${e}, automatically buffering.`)),l>=e&&o.push(ge(i,a))}}),t.on("end",()=>{if(a!==-1){let c=ge(i,a);Y(c)>0&&o.push(c)}o.push(null)}),o}var ai,fi=u(()=>{ai=require("node:stream");uo();ii();z()});var mi,ui=u(()=>{mi=(t,e)=>{let{base64Encoder:r,bodyLengthChecker:o,checksumAlgorithmFn:n,checksumLocationName:s,streamHasher:i}=e,a=r!==void 0&&o!==void 0&&n!==void 0&&s!==void 0&&i!==void 0,c=a?i(n,t):void 0,m=t.getReader();return new ReadableStream({async pull(f){let{value:d,done:l}=await m.read();if(l){if(f.enqueue(`0\r
5
5
  `),a){let p=r(await c);f.enqueue(`${s}:${p}\r
6
6
  `),f.enqueue(`\r
7
7
  `)}f.close()}else f.enqueue(`${(o(d)||0).toString(16)}\r
8
8
  ${d}\r
9
- `)}})}});function li(t,e){let r=t,o=t;if(v(o))return mi(o,e);let{base64Encoder:n,bodyLengthChecker:s,checksumAlgorithmFn:i,checksumLocationName:a,streamHasher:c}=e,m=n!==void 0&&i!==void 0&&a!==void 0&&c!==void 0,f=m?c(i,r):void 0,d=new di.Readable({read:()=>{}});return r.on("data",l=>{let p=s(l)||0;p!==0&&(d.push(`${p.toString(16)}\r
9
+ `)}})}});function li(t,e){let r=t,o=t;if(N(o))return mi(o,e);let{base64Encoder:n,bodyLengthChecker:s,checksumAlgorithmFn:i,checksumLocationName:a,streamHasher:c}=e,m=n!==void 0&&i!==void 0&&a!==void 0&&c!==void 0,f=m?c(i,r):void 0,d=new di.Readable({read:()=>{}});return r.on("data",l=>{let p=s(l)||0;p!==0&&(d.push(`${p.toString(16)}\r
10
10
  `),d.push(l),d.push(`\r
11
11
  `))}),r.on("end",async()=>{if(d.push(`0\r
12
12
  `),m){let l=n(await f);d.push(`${a}:${l}\r
13
13
  `),d.push(`\r
14
- `)}d.push(null)}),d}var di,hi=u(()=>{di=require("node:stream");ui();F()});async function pi(t,e){let r=0,o=[],n=t.getReader(),s=!1;for(;!s;){let{done:c,value:m}=await n.read();if(m&&(o.push(m),r+=m?.byteLength??0),r>=e)break;s=c}n.releaseLock();let i=new Uint8Array(Math.min(e,r)),a=0;for(let c of o){if(c.byteLength>i.byteLength-a){i.set(c.subarray(0,i.byteLength-a),a);break}else i.set(c,a);a+=c.length}return i}var gi=u(()=>{});var yi,Si,po,bi=u(()=>{yi=require("node:stream");Qe();gi();F();Si=(t,e)=>v(t)?pi(t,e):new Promise((r,o)=>{let n=new po;n.limit=e,t.pipe(n),t.on("error",s=>{n.end(),o(s)}),n.on("error",o),n.on("finish",function(){let s=ne(this.buffers);r(s)})}),po=class extends yi.Writable{buffers=[];limit=1/0;bytesBuffered=0;_write(e,r,o){if(this.buffers.push(e),this.bytesBuffered+=e.byteLength??0,this.bytesBuffered>=this.limit){let n=this.bytesBuffered-this.limit,s=this.buffers[this.buffers.length-1];this.buffers[this.buffers.length-1]=s.subarray(0,s.byteLength-n),this.emit("finish")}o()}}});var wi,xi=u(()=>{wi=t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(t)}});async function go(t){return t.arrayBuffer().then(e=>new Uint8Array(e))}async function yo(t){let e=[],r=t.getReader(),o=0;for(;;){let{done:n,value:s}=await r.read();if(s&&(e.push(s),o+=s.length),n)break}return ne(e,o)}var Ei,So=u(()=>{Qe();F();Ei=async t=>se(t)?go(t):yo(t)});var Ti,vi,Ci,Ai=u(()=>{mo();Rr();xi();So();F();Ti="The stream has already been transformed.",vi=t=>{if(!Ci(t)&&!v(t)){let n=t?.__proto__?.constructor?.name||t;throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${n}`)}let e=!1,r=async()=>{if(e)throw new Error(Ti);return e=!0,await Ei(t)},o=n=>{if(typeof n.stream!="function")throw new Error(`Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.
15
- If you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body`);return n.stream()};return Object.assign(t,{transformToByteArray:r,transformToString:async n=>{let s=await r();if(n==="base64")return qt(s);if(n==="hex")return D(s);if(n===void 0||n==="utf8"||n==="utf-8")return wi(s);if(typeof TextDecoder=="function")return new TextDecoder(n).decode(s);throw new Error("TextDecoder is not available, please make sure polyfill is provided.")},transformToWebStream:()=>{if(e)throw new Error(Ti);if(e=!0,Ci(t))return o(t);if(v(t))return t;throw new Error(`Cannot transform payload to web stream, got ${t}`)}})},Ci=t=>typeof Blob=="function"&&t instanceof Blob});var Ni,Wt,bo,wo=u(()=>{Ni=require("node:stream");Qe();So();F();Wt=t=>se(t)?go(t):v(t)?yo(t):new Promise((e,r)=>{let o=new bo,n=t;n.pipe(o),n.on("error",s=>{o.end(),r(s)}),o.on("error",r),o.on("finish",function(){let s=ne(this.bufferedBytes);e(s)})}),bo=class extends Ni.Writable{bufferedBytes=[];_write(e,r,o){this.bufferedBytes.push(e),o()}}});var Jt,Ii,Qt,Ri=u(()=>{Jt=require("node:stream");te();Ai();wo();Ii="The stream has already been transformed.",Qt=t=>{if(!(t instanceof Jt.Readable))try{return vi(t)}catch{let n=t?.__proto__?.constructor?.name||t;throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${n}`)}let e=!1,r=async()=>{if(e)throw new Error(Ii);return e=!0,await Wt(t)};return Object.assign(t,{transformToByteArray:r,transformToString:async o=>{let n=await r();return o===void 0||Buffer.isEncoding(o)?$(n.buffer,n.byteOffset,n.byteLength).toString(o):new TextDecoder(o).decode(n)},transformToWebStream:()=>{if(e)throw new Error(Ii);if(t.readableFlowing!==null)throw new Error("The stream has been consumed by other callbacks.");if(typeof Jt.Readable.toWeb!="function")throw new Error("Readable.toWeb() is not supported. Please ensure a polyfill is available.");return e=!0,Jt.Readable.toWeb(t)}})}});async function Mi(t){return typeof t.stream=="function"&&(t=t.stream()),t.tee()}var Oi=u(()=>{});async function Pi(t){if(v(t)||se(t))return Mi(t);let e=new xo.PassThrough,r=new xo.PassThrough;return t.pipe(e),t.pipe(r),[e,r]}var xo,Ui=u(()=>{xo=require("node:stream");Oi();F()});var _i={};ut(_i,{ChecksumStream:()=>Ue,Hash:()=>Ht,LazyJsonString:()=>k,NumericValue:()=>de,Uint8ArrayBlobAdapter:()=>ye,_parseEpochTimestamp:()=>Ct,_parseRfc3339DateTimeWithOffset:()=>vt,_parseRfc7231DateTime:()=>At,calculateBodyLength:()=>Pn,concatBytes:()=>ne,copyDocumentWithTransform:()=>en,createBufferedReadable:()=>ci,createChecksumStream:()=>oi,dateToUtcString:()=>Et,deserializerMiddleware:()=>Mt,deserializerMiddlewareOption:()=>io,expectBoolean:()=>on,expectByte:()=>yt,expectFloat32:()=>Ge,expectInt:()=>nn,expectInt32:()=>pt,expectLong:()=>Te,expectNonNull:()=>sn,expectNumber:()=>Ee,expectObject:()=>wr,expectShort:()=>gt,expectString:()=>an,expectUnion:()=>cn,fromArrayBuffer:()=>$,fromBase64:()=>xe,fromHex:()=>It,fromString:()=>ee,fromUtf8:()=>B,generateIdempotencyToken:()=>Eo,getAwsChunkedEncodingStream:()=>li,getSerdePlugin:()=>js,handleFloat:()=>mn,headStream:()=>Si,isArrayBuffer:()=>dt,isBlob:()=>se,isReadableStream:()=>v,limitedParseDouble:()=>wt,limitedParseFloat:()=>un,limitedParseFloat32:()=>dn,logger:()=>Ce,nv:()=>Rn,parseBoolean:()=>rn,parseEpochTimestamp:()=>bn,parseRfc3339DateTime:()=>gn,parseRfc3339DateTimeWithOffset:()=>yn,parseRfc7231DateTime:()=>Sn,quoteHeader:()=>Tt,sdkStreamMixin:()=>Qt,serializerMiddleware:()=>zt,serializerMiddlewareOption:()=>ao,splitEvery:()=>Nt,splitHeader:()=>Ne,splitStream:()=>Pi,streamCollector:()=>Wt,strictParseByte:()=>xt,strictParseDouble:()=>We,strictParseFloat:()=>fn,strictParseFloat32:()=>bt,strictParseInt:()=>hn,strictParseInt32:()=>pn,strictParseLong:()=>xr,strictParseShort:()=>oe,toBase64:()=>re,toHex:()=>D,toUint8Array:()=>Rt,toUtf8:()=>G,v4:()=>Di});var ki,ye,$c,Di,Eo,V=u(()=>{ki=require("node:crypto");Jo();Sr();Xo();lt();Ko();Yo();tn();wn();xn();Er();En();vn();An();Nn();Mn();Rr();Un();Mr();Qe();te();yr();Hr();Vs();so();Gs();co();ni();fi();hi();bi();Ri();Ui();F();wo();ye=class extends Qo(G,B,re,xe){},$c=ki.getRandomValues,Di=Zo($c),Eo=Di});var q,Xt=u(()=>{V();q=async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return ye.mutate(t);if(!t)return ye.mutate(new Uint8Array);let r=e.streamCollector(t);return ye.mutate(await r)}});function ie(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}var Kt=u(()=>{});var _,ke=u(()=>{_=class{serdeContext;setSerdeContext(e){this.serdeContext=e}}});var $i,To,Zt,Bi=u(()=>{$i=new Uint32Array(256);for(let t=0;t<256;++t){let e=t;for(let r=0;r<8;++r)e=e&1?3988292384^e>>>1:e>>>1;$i[t]=e>>>0}To=4294967295,Zt=class{digestLength=4;checksum=To;update(e){for(let r=0;r<e.length;++r)this.checksum=this.checksum>>>8^$i[(this.checksum^e[r])&255]}digestSync(){return(this.checksum^To)>>>0}async digest(){let e=this.digestSync(),r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,e,!1),r}reset(){this.checksum=To}}});function Bc(t){return class{digestLength=4;value=0;update(r){this.value=t(r,this.value)}digestSync(){return this.value>>>0}async digest(){let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,this.digestSync(),!1),r}reset(){this.value=0}}}var Co,Li,De,Fi=u(()=>{Co=we(require("node:zlib"));Bi();Li=typeof Co.crc32=="function"?Co.crc32:void 0,De=Li?Bc(Li):Zt});var vo=u(()=>{Fi()});function zi(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var ae,Ao=u(()=>{V();ae=class t{bytes;constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let r=new Uint8Array(8);for(let o=7,n=Math.abs(Math.round(e));o>-1&&n>0;o--,n/=256)r[o]=n;return e<0&&zi(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&zi(e),parseInt(D(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}});var _e,C,Hi,Lc,Fc,zc,Hc,jc,Vc,qc,Gc,Wc,No=u(()=>{V();Ao();_e=class{toUtf8;fromUtf8;constructor(e,r){this.toUtf8=e,this.fromUtf8=r}format(e){let r=[];for(let s of Object.keys(e)){let i=this.fromUtf8(s);r.push(Uint8Array.from([i.byteLength]),i,this.formatHeaderValue(e[s]))}let o=new Uint8Array(r.reduce((s,i)=>s+i.byteLength,0)),n=0;for(let s of r)o.set(s,n),n+=s.byteLength;return o}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?C.boolTrue:C.boolFalse]);case"byte":return Uint8Array.from([C.byte,e.value]);case"short":let r=new DataView(new ArrayBuffer(3));return r.setUint8(0,C.short),r.setInt16(1,e.value,!1),new Uint8Array(r.buffer);case"integer":let o=new DataView(new ArrayBuffer(5));return o.setUint8(0,C.integer),o.setInt32(1,e.value,!1),new Uint8Array(o.buffer);case"long":let n=new Uint8Array(9);return n[0]=C.long,n.set(e.value.bytes,1),n;case"binary":let s=new DataView(new ArrayBuffer(3+e.value.byteLength));s.setUint8(0,C.byteArray),s.setUint16(1,e.value.byteLength,!1);let i=new Uint8Array(s.buffer);return i.set(e.value,3),i;case"string":let a=this.fromUtf8(e.value),c=new DataView(new ArrayBuffer(3+a.byteLength));c.setUint8(0,C.string),c.setUint16(1,a.byteLength,!1);let m=new Uint8Array(c.buffer);return m.set(a,3),m;case"timestamp":let f=new Uint8Array(9);return f[0]=C.timestamp,f.set(ae.fromNumber(e.value.valueOf()).bytes,1),f;case"uuid":if(!Wc.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=C.uuid,d.set(It(e.value.replace(/-/g,"")),1),d}}parse(e){let r={},o=0;for(;o<e.byteLength;){let n=e.getUint8(o++),s=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+o,n));switch(o+=n,e.getUint8(o++)){case C.boolTrue:r[s]={type:Hi,value:!0};break;case C.boolFalse:r[s]={type:Hi,value:!1};break;case C.byte:r[s]={type:Lc,value:e.getInt8(o++)};break;case C.short:r[s]={type:Fc,value:e.getInt16(o,!1)},o+=2;break;case C.integer:r[s]={type:zc,value:e.getInt32(o,!1)},o+=4;break;case C.long:r[s]={type:Hc,value:new ae(new Uint8Array(e.buffer,e.byteOffset+o,8))},o+=8;break;case C.byteArray:let i=e.getUint16(o,!1);o+=2,r[s]={type:jc,value:new Uint8Array(e.buffer,e.byteOffset+o,i)},o+=i;break;case C.string:let a=e.getUint16(o,!1);o+=2,r[s]={type:Vc,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+o,a))},o+=a;break;case C.timestamp:r[s]={type:qc,value:new Date(new ae(new Uint8Array(e.buffer,e.byteOffset+o,8)).valueOf())},o+=8;break;case C.uuid:let c=new Uint8Array(e.buffer,e.byteOffset+o,16);o+=16,r[s]={type:Gc,value:`${D(c.subarray(0,4))}-${D(c.subarray(4,6))}-${D(c.subarray(6,8))}-${D(c.subarray(8,10))}-${D(c.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return r}};(function(t){t[t.boolTrue=0]="boolTrue",t[t.boolFalse=1]="boolFalse",t[t.byte=2]="byte",t[t.short=3]="short",t[t.integer=4]="integer",t[t.long=5]="long",t[t.byteArray=6]="byteArray",t[t.string=7]="string",t[t.timestamp=8]="timestamp",t[t.uuid=9]="uuid"})(C||(C={}));Hi="boolean",Lc="byte",Fc="short",zc="integer",Hc="long",jc="binary",Vc="string",qc="timestamp",Gc="uuid",Wc=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/});function Vi({byteLength:t,byteOffset:e,buffer:r}){if(t<Jc)throw new Error("Provided message too short to accommodate event stream message overhead");let o=new DataView(r,e,t),n=o.getUint32(0,!1);if(t!==n)throw new Error("Reported message length does not match received message length");let s=o.getUint32(ji,!1),i=o.getUint32(ce,!1),a=o.getUint32(t-Se,!1),c=new De;if(c.update(new Uint8Array(r,e,ce)),i!==c.digestSync())throw new Error(`The prelude checksum specified in the message (${i}) does not match the calculated CRC32 checksum (${c.digestSync()})`);if(c.update(new Uint8Array(r,e+ce,t-(ce+Se))),a!==c.digestSync())throw new Error(`The message checksum (${c.digestSync()}) did not match the expected value of ${a}`);return{headers:new DataView(r,e+ce+Se,s),body:new Uint8Array(r,e+ce+Se+s,n-s-(ce+Se+Se))}}var ji,ce,Se,Jc,qi=u(()=>{vo();ji=4,ce=ji*2,Se=4,Jc=ce+Se*2});var $e,Io=u(()=>{vo();No();qi();$e=class{headerMarshaller;messageBuffer;isEndOfStream;constructor(e,r){this.headerMarshaller=new _e(e,r),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){let e=this.messageBuffer.pop(),r=this.isEndOfStream;return{getMessage(){return e},isEndOfStream(){return r}}}getAvailableMessages(){let e=this.messageBuffer;this.messageBuffer=[];let r=this.isEndOfStream;return{getMessages(){return e},isEndOfStream(){return r}}}encode({headers:e,body:r}){let o=this.headerMarshaller.format(e),n=o.byteLength+r.byteLength+16,s=new Uint8Array(n),i=new DataView(s.buffer,s.byteOffset,s.byteLength),a=new De;return i.setUint32(0,n,!1),i.setUint32(4,o.byteLength,!1),a.update(s.subarray(0,8)),i.setUint32(8,a.digestSync(),!1),s.set(o,12),s.set(r,o.byteLength+12),a.update(s.subarray(8,n-4)),i.setUint32(n-4,a.digestSync(),!1),s}decode(e){let{headers:r,body:o}=Vi(e);return{headers:this.headerMarshaller.parse(r),body:o}}formatHeaders(e){return this.headerMarshaller.format(e)}}});var Be,Ro=u(()=>{Be=class{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.decoder.decode(e)}}});var Le,Mo=u(()=>{Le=class{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream)yield this.options.encoder.encode(e);this.options.includeEndFrame&&(yield new Uint8Array(0))}}});var Fe,Oo=u(()=>{Fe=class{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream){let r=await this.options.deserializer(e);r!==void 0&&(yield r)}}}});var ze,Po=u(()=>{ze=class{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.serializer(e)}}});function Yt(t){let e=0,r=0,o=null,n=null,s=a=>{if(typeof a!="number")throw new Error("Attempted to allocate an event message where size was not a number: "+a);e=a,r=4,o=new Uint8Array(a),new DataView(o.buffer).setUint32(0,a,!1)},i=async function*(){let a=t[Symbol.asyncIterator]();for(;;){let{value:c,done:m}=await a.next();if(m){if(e)if(e===r)yield o;else throw new Error("Truncated event message received.");else return;return}let f=c.length,d=0;for(;d<f;){if(!o){let p=f-d;n||(n=new Uint8Array(4));let h=Math.min(4-r,p);if(n.set(c.slice(d,d+h),r),r+=h,d+=h,r<4)break;s(new DataView(n.buffer).getUint32(0,!1)),n=null}let l=Math.min(e-r,f-d);o.set(c.slice(d,d+l),r),r+=l,d+=l,e&&e===r&&(yield o,o=null,e=0,r=0)}}};return{[Symbol.asyncIterator]:i}}var Uo=u(()=>{});function Gi(t,e){let r=st(e.deserializer,e.toUtf8);return{[Symbol.asyncIterator]:async function*(){for await(let o of t){let n=e.eventStreamCodec.decode(o),s=await r(n);s!==void 0&&(yield s)}}}}function st(t,e){return async function(r){let{value:o}=r.headers[":message-type"];if(o==="error"){let n=new Error(r.headers[":error-message"].value||"UnknownError");throw n.name=r.headers[":error-code"].value,n}else if(o==="exception"){let n=r.headers[":exception-type"].value,s={[n]:r},i=await t(s);if(i.$unknown){let a=new Error(e(r.body));throw a.name=n,a}throw i[n]}else if(o==="event"){let n={[r.headers[":event-type"].value]:r},s=await t(n);return s.$unknown?void 0:s}else throw Error(`Unrecognizable event type: ${r.headers[":event-type"].value}`)}}var ko=u(()=>{});var be,Wi,Do=u(()=>{Io();Ro();Mo();Oo();Po();Uo();ko();be=class{eventStreamCodec;utfEncoder;constructor({utf8Encoder:e,utf8Decoder:r}){this.eventStreamCodec=new $e(e,r),this.utfEncoder=e}deserialize(e,r){let o=Yt(e);return new Fe({messageStream:new Be({inputStream:o,decoder:this.eventStreamCodec}),deserializer:st(r,this.utfEncoder)})}serialize(e,r){return new Le({messageStream:new ze({inputStream:e,serializer:r}),encoder:this.eventStreamCodec,includeEndFrame:!0})}},Wi=t=>new be(t)});async function*Qc(t){let e=!1,r=!1,o=new Array;for(t.on("error",n=>{if(e||(e=!0),n)throw n}),t.on("data",n=>{o.push(n)}),t.on("end",()=>{e=!0});!r;){let n=await new Promise(s=>setTimeout(()=>s(o.shift()),0));n&&(yield n),r=e&&o.length===0}}var Ji,it,Qi,Xi=u(()=>{Ji=require("node:stream");Do();it=class{universalMarshaller;constructor({utf8Encoder:e,utf8Decoder:r}){this.universalMarshaller=new be({utf8Decoder:r,utf8Encoder:e})}deserialize(e,r){let o=typeof e[Symbol.asyncIterator]=="function"?e:Qc(e);return this.universalMarshaller.deserialize(o,r)}serialize(e,r){return Ji.Readable.from(this.universalMarshaller.serialize(e,r))}},Qi=t=>new it(t)});var Ki,Zi,Yi=u(()=>{Ki=t=>({[Symbol.asyncIterator]:async function*(){let e=t.getReader();try{for(;;){let{done:r,value:o}=await e.read();if(r)return;yield o}}finally{e.releaseLock()}}}),Zi=t=>{let e=t[Symbol.asyncIterator]();return new ReadableStream({async pull(r){let{done:o,value:n}=await e.next();if(o)return r.close();r.enqueue(n)}})}});var ea,ta=u(()=>{ea=t=>Object.assign(t,{eventStreamMarshaller:t.eventStreamSerdeProvider(t)})});var er,ra=u(()=>{X();V();er=class{marshaller;serializer;deserializer;serdeContext;defaultContentType;compositeErrorRegistry;constructor({marshaller:e,serializer:r,deserializer:o,serdeContext:n,defaultContentType:s,compositeErrorRegistry:i}){this.marshaller=e,this.serializer=r,this.deserializer=o,this.serdeContext=n,this.defaultContentType=s,this.compositeErrorRegistry=i}async serializeEventStream({eventStream:e,requestSchema:r,initialRequest:o}){let n=this.marshaller,s=r.getEventStreamMember(),i=r.getMemberSchema(s),a=this.serializer,c=this.defaultContentType,m=Symbol("initialRequestMarker"),f={async*[Symbol.asyncIterator](){if(o){let d={":event-type":{type:"string",value:"initial-request"},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:c}};a.write(r,o);let l=a.flush();yield{[m]:!0,headers:d,body:l}}for await(let d of e)yield d}};return n.serialize(f,d=>{if(d[m])return{headers:d.headers,body:d.body};let l="";for(let S in d)if(S!=="__type"){l=S;break}let{additionalHeaders:p,body:h,eventType:g,explicitPayloadContentType:y}=this.writeEventBody(l,i,d);return{headers:{":event-type":{type:"string",value:g},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:y??c},...p},body:h}})}async deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:o}){let n=this.marshaller,s=r.getEventStreamMember(),a=r.getMemberSchema(s).getMemberSchemas(),c=Symbol("initialResponseMarker"),m=n.deserialize(e.body,async l=>{let p="";for(let g in l)if(g!=="__type"){p=g;break}let h=l[p].body;if(p==="initial-response"){let g=await this.deserializer.read(r,h);return delete g[s],{[c]:!0,...g}}else if(p in a){let g=a[p];if(g.isStructSchema()){let y={},b=!1;for(let[S,x]of g.structIterator()){let{eventHeader:M,eventPayload:N}=x.getMergedTraits();if(b=b||!!(M||N),N)x.isBlobSchema()?y[S]=h:x.isStringSchema()?y[S]=(this.serdeContext?.utf8Encoder??G)(h):x.isStructSchema()&&(y[S]=await this.deserializer.read(x,h));else if(M){let O=l[p].headers[S]?.value;O!=null&&(x.isNumericSchema()?O&&typeof O=="object"&&"bytes"in O?y[S]=BigInt(O.toString()):y[S]=Number(O):y[S]=O)}}return{[p]:await this.readEventMember(g,h,b,y)}}return{[p]:await this.deserializer.read(g,h)}}else return{$unknown:l}}),f=m[Symbol.asyncIterator](),d=await f.next();if(d.done)return m;if(d.value?.[c]){if(!r)throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");for(let l in d.value)o[l]=d.value[l]}return{async*[Symbol.asyncIterator](){for(d?.value?.[c]||(yield d.value);;){let{done:l,value:p}=await f.next();if(l)break;yield p}}}}async readEventMember(e,r,o,n){let s,i=e.getSchema();if(Array.isArray(i)&&i[0]===-3){let c=i[1],m=he.for(c);this.compositeErrorRegistry?.copyFrom(m),s=(this.compositeErrorRegistry??m)?.getErrorCtor(i)}let a=o?n:r.byteLength===0?{}:await this.deserializer.read(e,r);if(s){let c=a.message??a.Message??"Unknown",m={},f=e.getMergedTraits().error;return f&&(m.$fault=f),Object.assign(new s({}),m,{message:c},a)}return a}writeEventBody(e,r,o){let n=this.serializer,s=e,i=null,a,c=r.getSchema()[4].includes(e),m={};if(c){let l=r.getMemberSchema(e);if(l.isStructSchema()){for(let[p,h]of l.structIterator()){let{eventHeader:g,eventPayload:y}=h.getMergedTraits();if(y)i=p;else if(g){let b=o[e][p],S="binary";h.isNumericSchema()?(-2)**31<=b&&b<=2**31-1?S="integer":S="long":h.isTimestampSchema()?S="timestamp":h.isStringSchema()?S="string":h.isBooleanSchema()&&(S="boolean"),b!=null&&(m[p]={type:S,value:b},delete o[e][p])}}if(i!==null){let p=l.getMemberSchema(i);p.isBlobSchema()?a="application/octet-stream":p.isStringSchema()&&(a="text/plain"),n.write(p,o[e][i])}else n.write(l,o[e])}else if(l.isUnitSchema())n.write(l,{});else throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.")}else{let[l,p]=o[e];s=l,n.write(15,p)}let f=n.flush()??new Uint8Array;return{body:typeof f=="string"?(this.serdeContext?.utf8Decoder??B)(f):f,eventType:s,explicitPayloadContentType:a,additionalHeaders:m}}}});var oa={};ut(oa,{EventStreamCodec:()=>$e,EventStreamMarshaller:()=>it,EventStreamSerde:()=>er,HeaderMarshaller:()=>_e,Int64:()=>ae,MessageDecoderStream:()=>Be,MessageEncoderStream:()=>Le,SmithyMessageDecoderStream:()=>Fe,SmithyMessageEncoderStream:()=>ze,UniversalEventStreamMarshaller:()=>be,eventStreamSerdeProvider:()=>Qi,getChunkedStream:()=>Yt,getMessageUnmarshaller:()=>st,getUnmarshalledStream:()=>Gi,iterableToReadableStream:()=>Zi,readableStreamToIterable:()=>Ki,resolveEventStreamSerdeConfig:()=>ea,universalEventStreamSerdeProvider:()=>Wi});var na=u(()=>{Io();No();Ao();Ro();Mo();Oo();Po();Xi();Yi();Do();Uo();ko();ta();ra()});var fe,tr=u(()=>{X();R();ke();fe=class extends _{options;compositeErrorRegistry;constructor(e){super(),this.options=e,this.compositeErrorRegistry=he.for(e.defaultNamespace);for(let r of e.errorTypeRegistries??[])this.compositeErrorRegistry.copyFrom(r)}getRequestType(){return U}getResponseType(){return J}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[o,n]of r.url.searchParams.entries())e.query[o]=n;if(r.headers)for(let o in r.headers)e.headers[o]=r.headers[o].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 o in r.headers)e.headers[o]=r.headers[o];return e}}setHostPrefix(e,r,o){if(this.serdeContext?.disableHostPrefix)return;let n=T.of(r.input),s=j(r.traits??{});if(s.endpoint){let i=s.endpoint?.[0];if(typeof i=="string"){for(let[a,c]of n.structIterator()){if(!c.getMergedTraits().hostLabel)continue;let m=o[a];if(typeof m!="string")throw new Error(`@smithy/core/schema - ${a} in input must be a string as hostLabel.`);i=i.replace(`{${a}}`,m)}if(e.hostname=i+e.hostname,!Ze(e.hostname))throw new Error(`[${e.hostname}] is not a valid hostname.`)}}}deserializeMetadata(e){return{httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}}async serializeEventStream({eventStream:e,requestSchema:r,initialRequest:o}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:e,requestSchema:r,initialRequest:o})}async deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:o}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:o})}async loadEventStreamCapability(){let{EventStreamSerde:e,eventStreamSerdeProvider:r}=await Promise.resolve().then(()=>(na(),oa)),o=this.resolveEventStreamMarshaller(r);return new e({marshaller:o,serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType(),compositeErrorRegistry:this.compositeErrorRegistry})}resolveEventStreamMarshaller(e){let r=this.serdeContext;return r.eventStreamMarshaller?r.eventStreamMarshaller:e(this.serdeContext)}getDefaultContentType(){throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(e,r,o,n,s){return[]}getEventStreamMarshaller(){let e=this.serdeContext;if(!e.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return e.eventStreamMarshaller}}});var rr,sa=u(()=>{X();V();R();tr();Xt();Kt();rr=class extends fe{async serializeRequest(e,r,o){let n=r&&typeof r=="object"?r:{},s=this.serializer,i={},a={},c=await o.endpoint(),m=T.of(e?.input),f=[],d=[],l=!1,p,h=new U({protocol:"",hostname:"",port:void 0,path:"",fragment:void 0,query:i,headers:a,body:void 0});if(c){this.updateServiceEndpoint(h,c),this.setHostPrefix(h,e,n);let g=j(e.traits);if(g.http){h.method=g.http[0];let[y,b]=g.http[1].split("?");h.path=="/"?h.path=y:h.path+=y;let S=new URLSearchParams(b??"");for(let[x,M]of S)i[x]=M}}for(let[g,y]of m.structIterator()){let b=y.getMergedTraits()??{},S=n[g];if(S==null&&!y.isIdempotencyToken()){if(b.httpLabel&&(h.path.includes(`{${g}+}`)||h.path.includes(`{${g}}`)))throw new Error(`No value provided for input HTTP label: ${g}.`);continue}if(b.httpPayload)y.isStreaming()?y.isStructSchema()?n[g]&&(p=await this.serializeEventStream({eventStream:n[g],requestSchema:m})):p=S:(s.write(y,S),p=s.flush());else if(b.httpLabel){s.write(y,S);let x=s.flush();h.path.includes(`{${g}+}`)?h.path=h.path.replace(`{${g}+}`,x.split("/").map(ie).join("/")):h.path.includes(`{${g}}`)&&(h.path=h.path.replace(`{${g}}`,ie(x)))}else if(b.httpHeader)s.write(y,S),a[b.httpHeader.toLowerCase()]=String(s.flush());else if(typeof b.httpPrefixHeaders=="string")for(let x in S){let M=S[x],N=b.httpPrefixHeaders+x;s.write([y.getValueSchema(),{httpHeader:N}],M),a[N.toLowerCase()]=s.flush()}else b.httpQuery||b.httpQueryParams?this.serializeQuery(y,S,i):(l=!0,f.push(g),d.push(y))}if(l&&n){let[g,y]=(m.getName(!0)??"#Unknown").split("#"),b=m.getSchema()[6],S=[3,g,y,m.getMergedTraits(),f,d,void 0];b?S[6]=b:S.pop(),s.write(S,n),p=s.flush()}return h.headers=a,h.query=i,h.body=p,h}serializeQuery(e,r,o){let n=this.serializer,s=e.getMergedTraits();if(s.httpQueryParams){for(let i in r)if(!(i in o)){let a=r[i],c=e.getValueSchema();Object.assign(c.getMergedTraits(),{...s,httpQuery:i,httpQueryParams:void 0}),this.serializeQuery(c,a,o)}return}if(e.isListSchema()){let i=!!e.getMergedTraits().sparse,a=[];for(let c of r){n.write([e.getValueSchema(),s],c);let m=n.flush();(i||m!==void 0)&&a.push(m)}o[s.httpQuery]=a}else n.write([e,s],r),o[s.httpQuery]=n.flush()}async deserializeResponse(e,r,o){let n=this.deserializer,s=T.of(e.output),i={};if(o.statusCode>=300){let c=await q(o.body,r);throw c.byteLength>0&&Object.assign(i,await n.read(15,c)),await this.handleError(e,r,o,i,this.deserializeMetadata(o)),new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(let c in o.headers){let m=o.headers[c];delete o.headers[c],o.headers[c.toLowerCase()]=m}let a=await this.deserializeHttpMessage(s,r,o,i);if(a.length){let c=await q(o.body,r);if(c.byteLength>0){let m=await n.read(s,c);for(let f of a)m[f]!=null&&(i[f]=m[f])}}else a.discardResponseBody&&await q(o.body,r);return i.$metadata=this.deserializeMetadata(o),i}async deserializeHttpMessage(e,r,o,n,s){let i;n instanceof Set?i=s:i=n;let a=!0,c=this.deserializer,m=T.of(e),f=[];for(let[d,l]of m.structIterator()){let p=l.getMemberTraits();if(p.httpPayload){if(a=!1,l.isStreaming())l.isStructSchema()?i[d]=await this.deserializeEventStream({response:o,responseSchema:m}):i[d]=Qt(o.body);else if(o.body){let g=await q(o.body,r);g.byteLength>0&&(i[d]=await c.read(l,g))}}else if(p.httpHeader){let h=String(p.httpHeader).toLowerCase(),g=o.headers[h];if(g!=null)if(l.isListSchema()){let y=l.getValueSchema();y.getMergedTraits().httpHeader=h;let b;y.isTimestampSchema()&&y.getSchema()===4?b=Nt(g,",",2):b=Ne(g);let S=[];for(let x of b)S.push(await c.read(y,x.trim()));i[d]=S}else i[d]=await c.read(l,g)}else if(p.httpPrefixHeaders!==void 0){i[d]={};for(let h in o.headers)if(h.startsWith(p.httpPrefixHeaders)){let g=o.headers[h],y=l.getValueSchema();y.getMergedTraits().httpHeader=h,i[d][h.slice(p.httpPrefixHeaders.length)]=await c.read(y,g)}}else p.httpResponseCode?i[d]=o.statusCode:f.push(d)}return f.discardResponseBody=a,f}}});var or,ia=u(()=>{X();R();tr();Xt();or=class extends fe{async serializeRequest(e,r,o){let n=this.serializer,s={},i={},a=await o.endpoint(),c=T.of(e?.input),m=c.getSchema(),f,d=r&&typeof r=="object"?r:{},l=new U({protocol:"",hostname:"",port:void 0,path:"/",fragment:void 0,query:s,headers:i,body:void 0});if(a&&(this.updateServiceEndpoint(l,a),this.setHostPrefix(l,e,d)),d){let p=c.getEventStreamMember();if(p){if(d[p]){let h={};for(let[g,y]of c.structIterator())g!==p&&d[g]&&(n.write(y,d[g]),h[g]=n.flush());f=await this.serializeEventStream({eventStream:d[p],requestSchema:c,initialRequest:h})}}else n.write(m,d),f=n.flush()}return l.headers=Object.assign(l.headers,i),l.query=s,l.body=f,l.method="POST",l}async deserializeResponse(e,r,o){let n=this.deserializer,s=T.of(e.output),i={};if(o.statusCode>=300){let c=await q(o.body,r);throw c.byteLength>0&&Object.assign(i,await n.read(15,c)),await this.handleError(e,r,o,i,this.deserializeMetadata(o)),new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.")}for(let c in o.headers){let m=o.headers[c];delete o.headers[c],o.headers[c.toLowerCase()]=m}let a=s.getEventStreamMember();if(a)i[a]=await this.deserializeEventStream({response:o,responseSchema:s,initialResponseContainer:i});else{let c=await q(o.body,r);c.byteLength>0&&Object.assign(i,await n.read(s,c))}return i.$metadata=this.deserializeMetadata(o),i}}});var nr,_o=u(()=>{Kt();nr=(t,e,r,o,n,s)=>{if(e!=null&&e[r]!==void 0){let i=o();if(i==null||i.length<=0)throw new Error("Empty value provided for input HTTP label: "+r+".");t=t.replace(n,s?i.split("/").map(a=>ie(a)).join("/"):ie(i))}else throw new Error("No value provided for input HTTP label: "+r+".");return t}});function aa(t,e){return new at(t,e)}var at,ca=u(()=>{R();_o();at=class{input;context;query={};method="";headers={};path="";body=null;hostname="";resolvePathStack=[];constructor(e,r){this.input=e,this.context=r}async build(){let{hostname:e,protocol:r="https",port:o,path:n}=await this.context.endpoint();this.path=n;for(let s of this.resolvePathStack)s(this.path);return new U({protocol:r,hostname:this.hostname||e,port:o,method:this.method,path:this.path,query:this.query,body:this.body,headers:this.headers})}hn(e){return this.hostname=e,this}bp(e){return this.resolvePathStack.push(r=>{this.path=`${r?.endsWith("/")?r.slice(0,-1):r||""}`+e}),this}p(e,r,o,n){return this.resolvePathStack.push(s=>{this.path=nr(s,this.input,e,r,o,n)}),this}h(e){return this.headers=e,this}q(e){return this.query=e,this}b(e){return this.body=e,this}m(e){return this.method=e,this}}});function He(t,e){if(e.timestampFormat.useTrait&&t.isTimestampSchema()&&(t.getSchema()===5||t.getSchema()===6||t.getSchema()===7))return t.getSchema();let{httpLabel:r,httpPrefixHeaders:o,httpHeader:n,httpQuery:s}=t.getMergedTraits();return(e.httpBindings?typeof o=="string"||n?6:s||r?5:void 0:void 0)??e.timestampFormat.default}var sr=u(()=>{});var je,$o=u(()=>{X();V();ke();sr();je=class extends _{settings;constructor(e){super(),this.settings=e}read(e,r){let o=T.of(e);if(o.isListSchema())return Ne(r).map(n=>this.read(o.getValueSchema(),n));if(o.isBlobSchema())return(this.serdeContext?.base64Decoder??xe)(r);if(o.isTimestampSchema())switch(He(o,this.settings)){case 5:return vt(r);case 6:return At(r);case 7:return Ct(r);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",r),new Date(r)}if(o.isStringSchema()){let n=o.getMergedTraits().mediaType,s=r;if(n)return o.getMergedTraits().httpHeader&&(s=this.base64ToUtf8(s)),(n==="application/json"||n.endsWith("+json"))&&(s=k.from(s)),s}return o.isNumericSchema()?Number(r):o.isBigIntegerSchema()?BigInt(r):o.isBigDecimalSchema()?new de(r,"bigDecimal"):o.isBooleanSchema()?String(r).toLowerCase()==="true":r}base64ToUtf8(e){return(this.serdeContext?.utf8Encoder??G)((this.serdeContext?.base64Decoder??xe)(e))}}});var ir,fa=u(()=>{X();V();ke();$o();ir=class extends _{codecDeserializer;stringDeserializer;constructor(e,r){super(),this.codecDeserializer=e,this.stringDeserializer=new je(r)}setSerdeContext(e){this.stringDeserializer.setSerdeContext(e),this.codecDeserializer.setSerdeContext(e),this.serdeContext=e}read(e,r){let o=T.of(e),n=o.getMergedTraits(),s=this.serdeContext?.utf8Encoder??G;if(n.httpHeader||n.httpResponseCode)return this.stringDeserializer.read(o,s(r));if(n.httpPayload){if(o.isBlobSchema()){let i=this.serdeContext?.utf8Decoder??B;return typeof r=="string"?i(r):r}else if(o.isStringSchema())return"byteLength"in r?s(r):r}return this.codecDeserializer.read(o,r)}}});var Ve,Bo=u(()=>{X();V();ke();sr();Ve=class extends _{settings;stringBuffer="";constructor(e){super(),this.settings=e}write(e,r){let o=T.of(e);switch(typeof r){case"object":if(r===null){this.stringBuffer="null";return}if(o.isTimestampSchema()){if(!(r instanceof Date))throw new Error(`@smithy/core/protocols - received non-Date value ${r} when schema expected Date in ${o.getName(!0)}`);switch(He(o,this.settings)){case 5:this.stringBuffer=r.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=Et(r);break;case 7:this.stringBuffer=String(r.getTime()/1e3);break;default:console.warn("Missing timestamp format, using epoch seconds",r),this.stringBuffer=String(r.getTime()/1e3)}return}if(o.isBlobSchema()&&"byteLength"in r){this.stringBuffer=(this.serdeContext?.base64Encoder??re)(r);return}if(o.isListSchema()&&Array.isArray(r)){let i="";for(let a of r){this.write([o.getValueSchema(),o.getMergedTraits()],a);let c=this.flush(),m=o.getValueSchema().isTimestampSchema()?c:Tt(c);i!==""&&(i+=", "),i+=m}this.stringBuffer=i;return}this.stringBuffer=JSON.stringify(r,null,2);break;case"string":let n=o.getMergedTraits().mediaType,s=r;if(n&&((n==="application/json"||n.endsWith("+json"))&&(s=k.from(s)),o.getMergedTraits().httpHeader)){this.stringBuffer=(this.serdeContext?.base64Encoder??re)(s.toString());return}this.stringBuffer=r;break;default:o.isIdempotencyToken()?this.stringBuffer=Eo():this.stringBuffer=String(r)}}flush(){let e=this.stringBuffer;return this.stringBuffer="",e}}});var ar,ma=u(()=>{X();Bo();ar=class{codecSerializer;stringSerializer;buffer;constructor(e,r,o=new Ve(r)){this.codecSerializer=e,this.stringSerializer=o}setSerdeContext(e){this.codecSerializer.setSerdeContext(e),this.stringSerializer.setSerdeContext(e)}write(e,r){let o=T.of(e),n=o.getMergedTraits();if(n.httpHeader||n.httpLabel||n.httpQuery){this.stringSerializer.write(o,r),this.buffer=this.stringSerializer.flush();return}return this.codecSerializer.write(o,r)}flush(){if(this.buffer!==void 0){let e=this.buffer;return this.buffer=void 0,e}return this.codecSerializer.flush()}}});var ua,cr,da=u(()=>{ua=we(Ke()),cr=class{name;kind;values;constructor({name:e,kind:r=ua.FieldPosition.HEADER,values:o=[]}){this.name=e,this.kind=r,this.values=o}add(e){this.values.push(e)}set(e){this.values=e}remove(e){this.values=this.values.filter(r=>r!==e)}toString(){return this.values.map(e=>e.includes(",")||e.includes(" ")?`"${e}"`:e).join(", ")}get(){return this.values}}});var fr,la=u(()=>{fr=class{entries={};encoding;constructor({fields:e=[],encoding:r="utf-8"}){e.forEach(this.setField.bind(this)),this.encoding=r}setField(e){this.entries[e.name.toLowerCase()]=e}getField(e){return this.entries[e.toLowerCase()]}removeField(e){delete this.entries[e.toLowerCase()]}getByType(e){return Object.values(this.entries).filter(r=>r.kind===e)}}});var ha,pa,ga=u(()=>{ha=t=>({setHttpHandler(e){t.httpHandler=e},httpHandler(){return t.httpHandler},updateHttpClientConfig(e,r){t.httpHandler?.updateHttpClientConfig(e,r)},httpHandlerConfigs(){return t.httpHandler.httpHandlerConfigs()}}),pa=t=>({httpHandler:t.httpHandler()})});function Lo(t){return e=>async r=>{let o=r.request;if(U.isInstance(o)){let{body:n,headers:s}=o;if(n&&Object.keys(s).map(i=>i.toLowerCase()).indexOf(ya)===-1)try{let i=t(n);o.headers={...o.headers,[ya]:String(i)}}catch{}}return e({...r,request:o})}}var ya,Fo,Sa,ba=u(()=>{R();ya="content-length";Fo={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},Sa=t=>({applyToStack:e=>{e.add(Lo(t.bodyLengthChecker),Fo)}})});var me,Xc,mr=u(()=>{me=t=>encodeURIComponent(t).replace(/[!'()*]/g,Xc),Xc=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var wa,xa=u(()=>{mr();wa=t=>t.split("/").map(me).join("/")});function Ea(t){let e=[];for(let r of Object.keys(t).sort()){let o=t[r];if(r=me(r),Array.isArray(o))for(let n=0,s=o.length;n<s;n++)e.push(`${r}=${me(o[n])}`);else{let n=r;(o||typeof o=="string")&&(n+=`=${me(o)}`),e.push(n)}}return e.join("&")}var Ta=u(()=>{mr()});var Ca={};ut(Ca,{Field:()=>cr,Fields:()=>fr,FromStringShapeDeserializer:()=>je,HttpBindingProtocol:()=>rr,HttpInterceptingShapeDeserializer:()=>ir,HttpInterceptingShapeSerializer:()=>ar,HttpProtocol:()=>fe,HttpRequest:()=>U,HttpResponse:()=>J,RequestBuilder:()=>at,RpcProtocol:()=>or,SerdeContext:()=>_,ToStringShapeSerializer:()=>Ve,buildQueryString:()=>Ea,collectBody:()=>q,contentLengthMiddleware:()=>Lo,contentLengthMiddlewareOptions:()=>Fo,determineTimestampFormat:()=>He,escapeUri:()=>me,escapeUriPath:()=>wa,extendedEncodeURIComponent:()=>ie,getContentLengthPlugin:()=>Sa,getHttpHandlerExtensionConfiguration:()=>ha,isValidHostname:()=>Ze,parseQueryString:()=>et,parseUrl:()=>le,requestBuilder:()=>aa,resolveHttpHandlerRuntimeConfig:()=>pa,resolvedPath:()=>nr});var va=u(()=>{Xt();Kt();sa();tr();ia();ca();_o();$o();fa();ma();Bo();sr();ke();da();la();R();R();R();ga();ba();mr();xa();Ta();R();R()});var Da=Go(ft=>{var{buildQueryString:Oa,HttpResponse:Pa}=(va(),gr(Ca)),ur=require("node:https"),{Readable:Kc}=require("node:stream"),zo=require("node:http2"),{streamCollector:Zc}=(V(),gr(_i));ft.streamCollector=Zc;function lr(t){let e=t&&typeof t=="object"&&"reason"in t?t.reason:void 0;if(e){if(e instanceof Error){let n=new Error("Request aborted");return n.name="AbortError",n.cause=e,n}let o=new Error(String(e));return o.name="AbortError",o}let r=new Error("Request aborted");return r.name="AbortError",r}var Yc=["ECONNRESET","EPIPE","ETIMEDOUT"],Ua=t=>{let e={};for(let r in t){let o=t[r];e[r]=Array.isArray(o)?o.join(","):o}return e},A={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t)},Aa=1e3,ef=(t,e,r=0)=>{if(!r)return-1;let o=n=>{let s=A.setTimeout(()=>{t.destroy(),e(Object.assign(new Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${r} ms.`),{name:"TimeoutError"}))},r-n),i=a=>{a?.connecting?a.on("connect",()=>{A.clearTimeout(s)}):A.clearTimeout(s)};t.socket?i(t.socket):t.on("socket",i)};return r<2e3?(o(0),0):A.setTimeout(o.bind(null,Aa),Aa)},tf=(t,e,r=0,o,n)=>r?A.setTimeout(()=>{let s=`@smithy/node-http-handler - [${o?"ERROR":"WARN"}] a request has exceeded the configured ${r} ms requestTimeout.`;if(o){let i=Object.assign(new Error(s),{name:"TimeoutError",code:"ETIMEDOUT"});t.destroy(i),e(i)}else s+=" Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.",n?.warn?.(s)},r):-1,rf=3e3,of=(t,{keepAlive:e,keepAliveMsecs:r},o=rf)=>{if(e!==!0)return-1;let n=()=>{t.socket?t.socket.setKeepAlive(e,r||0):t.on("socket",s=>{s.setKeepAlive(e,r||0)})};return o===0?(n(),0):A.setTimeout(n,o)},Na=3e3,nf=(t,e,r=0)=>{let o=n=>{let s=r-n,i=()=>{t.destroy(),e(Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${r} ms of inactivity (configured by client requestHandler).`),{name:"TimeoutError"}))};t.socket?(t.socket.setTimeout(s,i),t.on("close",()=>t.socket?.removeListener("timeout",i))):t.setTimeout(s,i)};return 0<r&&r<6e3?(o(0),0):A.setTimeout(o.bind(null,r===0?0:Na),Na)},Ia=6e3;async function ka(t,e,r=Ia,o=!1){let n=e.headers,s=n?n.Expect||n.expect:void 0,i=-1,a=!0;!o&&s==="100-continue"&&(a=await Promise.race([new Promise(c=>{i=Number(A.setTimeout(()=>c(!0),Math.max(Ia,r)))}),new Promise(c=>{t.on("continue",()=>{A.clearTimeout(i),c(!0)}),t.on("response",()=>{A.clearTimeout(i),c(!1)}),t.on("error",()=>{A.clearTimeout(i),c(!1)})})])),a&&sf(t,e.body)}function sf(t,e){if(e instanceof Kc){e.pipe(t);return}if(e){let r=Buffer.isBuffer(e);if(r||typeof e=="string"){r&&e.byteLength===0?t.end():t.end(e);return}let n=e;if(typeof n=="object"&&n.buffer&&typeof n.byteOffset=="number"&&typeof n.byteLength=="number"){t.end(Buffer.from(n.buffer,n.byteOffset,n.byteLength));return}t.end(Buffer.from(e));return}t.end()}var af=0,dr,Ra,Ho=class t{config;configProvider;socketWarningTimestamp=0;externalAgent=!1;metadata={handlerProtocol:"http/1.1"};static create(e){return typeof e?.handle=="function"?e:new t(e)}static checkSocketUsage(e,r,o=console){let{sockets:n,requests:s,maxSockets:i}=e;if(typeof i!="number"||i===1/0||Date.now()-15e3<r)return r;if(n&&s)for(let c in n){let m=n[c]?.length??0,f=s[c]?.length??0;if(m>=i&&f>=2*i)return o?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${m} and ${f} additional requests are enqueued.
14
+ `)}d.push(null)}),d}var di,pi=u(()=>{di=require("node:stream");ui();z()});async function hi(t,e){let r=0,o=[],n=t.getReader(),s=!1;for(;!s;){let{done:c,value:m}=await n.read();if(m&&(o.push(m),r+=m?.byteLength??0),r>=e)break;s=c}n.releaseLock();let i=new Uint8Array(Math.min(e,r)),a=0;for(let c of o){if(c.byteLength>i.byteLength-a){i.set(c.subarray(0,i.byteLength-a),a);break}else i.set(c,a);a+=c.length}return i}var gi=u(()=>{});var yi,bi,ho,Si=u(()=>{yi=require("node:stream");Ke();gi();z();bi=(t,e)=>N(t)?hi(t,e):new Promise((r,o)=>{let n=new ho;n.limit=e,t.pipe(n),t.on("error",s=>{n.end(),o(s)}),n.on("error",o),n.on("finish",function(){let s=se(this.buffers);r(s)})}),ho=class extends yi.Writable{buffers=[];limit=1/0;bytesBuffered=0;_write(e,r,o){if(this.buffers.push(e),this.bytesBuffered+=e.byteLength??0,this.bytesBuffered>=this.limit){let n=this.bytesBuffered-this.limit,s=this.buffers[this.buffers.length-1];this.buffers[this.buffers.length-1]=s.subarray(0,s.byteLength-n),this.emit("finish")}o()}}});var wi,xi=u(()=>{wi=t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(t)}});async function go(t){return t.arrayBuffer().then(e=>new Uint8Array(e))}async function yo(t){let e=[],r=t.getReader(),o=0;for(;;){let{done:n,value:s}=await r.read();if(s&&(e.push(s),o+=s.length),n)break}return se(e,o)}var Ei,bo=u(()=>{Ke();z();Ei=async t=>ie(t)?go(t):yo(t)});var Ti,vi,Ci,Ai=u(()=>{mo();Rr();xi();bo();z();Ti="The stream has already been transformed.",vi=t=>{if(!Ci(t)&&!N(t)){let n=t?.__proto__?.constructor?.name||t;throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${n}`)}let e=!1,r=async()=>{if(e)throw new Error(Ti);return e=!0,await Ei(t)},o=n=>{if(typeof n.stream!="function")throw new Error(`Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.
15
+ If you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body`);return n.stream()};return Object.assign(t,{transformToByteArray:r,transformToString:async n=>{let s=await r();if(n==="base64")return Wt(s);if(n==="hex")return _(s);if(n===void 0||n==="utf8"||n==="utf-8")return wi(s);if(typeof TextDecoder=="function")return new TextDecoder(n).decode(s);throw new Error("TextDecoder is not available, please make sure polyfill is provided.")},transformToWebStream:()=>{if(e)throw new Error(Ti);if(e=!0,Ci(t))return o(t);if(N(t))return t;throw new Error(`Cannot transform payload to web stream, got ${t}`)}})},Ci=t=>typeof Blob=="function"&&t instanceof Blob});var Ni,Qt,So,wo=u(()=>{Ni=require("node:stream");Ke();bo();z();Qt=t=>ie(t)?go(t):N(t)?yo(t):new Promise((e,r)=>{let o=new So,n=t;n.pipe(o),n.on("error",s=>{o.end(),r(s)}),o.on("error",r),o.on("finish",function(){let s=se(this.bufferedBytes);e(s)})}),So=class extends Ni.Writable{bufferedBytes=[];_write(e,r,o){this.bufferedBytes.push(e),o()}}});var Xt,Ii,Kt,Ri=u(()=>{Xt=require("node:stream");re();Ai();wo();Ii="The stream has already been transformed.",Kt=t=>{if(!(t instanceof Xt.Readable))try{return vi(t)}catch{let n=t?.__proto__?.constructor?.name||t;throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${n}`)}let e=!1,r=async()=>{if(e)throw new Error(Ii);return e=!0,await Qt(t)};return Object.assign(t,{transformToByteArray:r,transformToString:async o=>{let n=await r();return o===void 0||Buffer.isEncoding(o)?B(n.buffer,n.byteOffset,n.byteLength).toString(o):new TextDecoder(o).decode(n)},transformToWebStream:()=>{if(e)throw new Error(Ii);if(t.readableFlowing!==null)throw new Error("The stream has been consumed by other callbacks.");if(typeof Xt.Readable.toWeb!="function")throw new Error("Readable.toWeb() is not supported. Please ensure a polyfill is available.");return e=!0,Xt.Readable.toWeb(t)}})}});async function Mi(t){return typeof t.stream=="function"&&(t=t.stream()),t.tee()}var Oi=u(()=>{});async function Pi(t){if(N(t)||ie(t))return Mi(t);let e=new xo.PassThrough,r=new xo.PassThrough;return t.pipe(e),t.pipe(r),[e,r]}var xo,Ui=u(()=>{xo=require("node:stream");Oi();z()});var _i={};lt(_i,{ChecksumStream:()=>Ue,Hash:()=>Vt,LazyJsonString:()=>D,NumericValue:()=>de,Uint8ArrayBlobAdapter:()=>ye,_parseEpochTimestamp:()=>At,_parseRfc3339DateTimeWithOffset:()=>Nt,_parseRfc7231DateTime:()=>It,calculateBodyLength:()=>Pn,concatBytes:()=>se,copyDocumentWithTransform:()=>en,createBufferedReadable:()=>ci,createChecksumStream:()=>oi,dateToUtcString:()=>Ct,deserializerMiddleware:()=>Pt,deserializerMiddlewareOption:()=>io,expectBoolean:()=>on,expectByte:()=>St,expectFloat32:()=>Je,expectInt:()=>nn,expectInt32:()=>yt,expectLong:()=>Te,expectNonNull:()=>sn,expectNumber:()=>Ee,expectObject:()=>wr,expectShort:()=>bt,expectString:()=>an,expectUnion:()=>cn,fromArrayBuffer:()=>B,fromBase64:()=>xe,fromHex:()=>Mt,fromString:()=>te,fromUtf8:()=>L,generateIdempotencyToken:()=>Eo,getAwsChunkedEncodingStream:()=>li,getSerdePlugin:()=>js,handleFloat:()=>mn,headStream:()=>bi,isArrayBuffer:()=>pt,isBlob:()=>ie,isReadableStream:()=>N,limitedParseDouble:()=>Et,limitedParseFloat:()=>un,limitedParseFloat32:()=>dn,logger:()=>Ce,nv:()=>Rn,parseBoolean:()=>rn,parseEpochTimestamp:()=>Sn,parseRfc3339DateTime:()=>gn,parseRfc3339DateTimeWithOffset:()=>yn,parseRfc7231DateTime:()=>bn,quoteHeader:()=>vt,sdkStreamMixin:()=>Kt,serializerMiddleware:()=>jt,serializerMiddlewareOption:()=>ao,splitEvery:()=>Rt,splitHeader:()=>Ne,splitStream:()=>Pi,streamCollector:()=>Qt,strictParseByte:()=>Tt,strictParseDouble:()=>Qe,strictParseFloat:()=>fn,strictParseFloat32:()=>xt,strictParseInt:()=>pn,strictParseInt32:()=>hn,strictParseLong:()=>xr,strictParseShort:()=>ne,toBase64:()=>oe,toHex:()=>_,toUint8Array:()=>Ot,toUtf8:()=>J,v4:()=>Di});var ki,ye,Fc,Di,Eo,G=u(()=>{ki=require("node:crypto");Jo();br();Xo();ht();Ko();Yo();tn();wn();xn();Er();En();vn();An();Nn();Mn();Rr();Un();Mr();Ke();re();yr();Hr();Vs();so();Gs();co();ni();fi();pi();Si();Ri();Ui();z();wo();ye=class extends Qo(J,L,oe,xe){},Fc=ki.getRandomValues,Di=Zo(Fc),Eo=Di});var W,Zt=u(()=>{G();W=async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return ye.mutate(t);if(!t)return ye.mutate(new Uint8Array);let r=e.streamCollector(t);return ye.mutate(await r)}});function ae(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}var Yt=u(()=>{});var $,ke=u(()=>{$=class{serdeContext;setSerdeContext(e){this.serdeContext=e}}});var $i,To,er,Bi=u(()=>{$i=new Uint32Array(256);for(let t=0;t<256;++t){let e=t;for(let r=0;r<8;++r)e=e&1?3988292384^e>>>1:e>>>1;$i[t]=e>>>0}To=4294967295,er=class{digestLength=4;checksum=To;update(e){for(let r=0;r<e.length;++r)this.checksum=this.checksum>>>8^$i[(this.checksum^e[r])&255]}digestSync(){return(this.checksum^To)>>>0}async digest(){let e=this.digestSync(),r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,e,!1),r}reset(){this.checksum=To}}});function zc(t){return class{digestLength=4;value=0;update(r){this.value=t(r,this.value)}digestSync(){return this.value>>>0}async digest(){let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,this.digestSync(),!1),r}reset(){this.value=0}}}var Co,Li,De,Fi=u(()=>{Co=we(require("node:zlib"));Bi();Li=typeof Co.crc32=="function"?Co.crc32:void 0,De=Li?zc(Li):er});var vo=u(()=>{Fi()});function zi(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var ce,Ao=u(()=>{G();ce=class t{bytes;constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let r=new Uint8Array(8);for(let o=7,n=Math.abs(Math.round(e));o>-1&&n>0;o--,n/=256)r[o]=n;return e<0&&zi(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&zi(e),parseInt(_(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}});var _e,v,Hi,Hc,jc,Vc,qc,Gc,Wc,Jc,Qc,Xc,No=u(()=>{G();Ao();_e=class{toUtf8;fromUtf8;constructor(e,r){this.toUtf8=e,this.fromUtf8=r}format(e){let r=[];for(let s of Object.keys(e)){let i=this.fromUtf8(s);r.push(Uint8Array.from([i.byteLength]),i,this.formatHeaderValue(e[s]))}let o=new Uint8Array(r.reduce((s,i)=>s+i.byteLength,0)),n=0;for(let s of r)o.set(s,n),n+=s.byteLength;return o}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?v.boolTrue:v.boolFalse]);case"byte":return Uint8Array.from([v.byte,e.value]);case"short":let r=new DataView(new ArrayBuffer(3));return r.setUint8(0,v.short),r.setInt16(1,e.value,!1),new Uint8Array(r.buffer);case"integer":let o=new DataView(new ArrayBuffer(5));return o.setUint8(0,v.integer),o.setInt32(1,e.value,!1),new Uint8Array(o.buffer);case"long":let n=new Uint8Array(9);return n[0]=v.long,n.set(e.value.bytes,1),n;case"binary":let s=new DataView(new ArrayBuffer(3+e.value.byteLength));s.setUint8(0,v.byteArray),s.setUint16(1,e.value.byteLength,!1);let i=new Uint8Array(s.buffer);return i.set(e.value,3),i;case"string":let a=this.fromUtf8(e.value),c=new DataView(new ArrayBuffer(3+a.byteLength));c.setUint8(0,v.string),c.setUint16(1,a.byteLength,!1);let m=new Uint8Array(c.buffer);return m.set(a,3),m;case"timestamp":let f=new Uint8Array(9);return f[0]=v.timestamp,f.set(ce.fromNumber(e.value.valueOf()).bytes,1),f;case"uuid":if(!Xc.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=v.uuid,d.set(Mt(e.value.replace(/-/g,"")),1),d}}parse(e){let r={},o=0;for(;o<e.byteLength;){let n=e.getUint8(o++),s=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+o,n));switch(o+=n,e.getUint8(o++)){case v.boolTrue:r[s]={type:Hi,value:!0};break;case v.boolFalse:r[s]={type:Hi,value:!1};break;case v.byte:r[s]={type:Hc,value:e.getInt8(o++)};break;case v.short:r[s]={type:jc,value:e.getInt16(o,!1)},o+=2;break;case v.integer:r[s]={type:Vc,value:e.getInt32(o,!1)},o+=4;break;case v.long:r[s]={type:qc,value:new ce(new Uint8Array(e.buffer,e.byteOffset+o,8))},o+=8;break;case v.byteArray:let i=e.getUint16(o,!1);o+=2,r[s]={type:Gc,value:new Uint8Array(e.buffer,e.byteOffset+o,i)},o+=i;break;case v.string:let a=e.getUint16(o,!1);o+=2,r[s]={type:Wc,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+o,a))},o+=a;break;case v.timestamp:r[s]={type:Jc,value:new Date(new ce(new Uint8Array(e.buffer,e.byteOffset+o,8)).valueOf())},o+=8;break;case v.uuid:let c=new Uint8Array(e.buffer,e.byteOffset+o,16);o+=16,r[s]={type:Qc,value:`${_(c.subarray(0,4))}-${_(c.subarray(4,6))}-${_(c.subarray(6,8))}-${_(c.subarray(8,10))}-${_(c.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return r}};(function(t){t[t.boolTrue=0]="boolTrue",t[t.boolFalse=1]="boolFalse",t[t.byte=2]="byte",t[t.short=3]="short",t[t.integer=4]="integer",t[t.long=5]="long",t[t.byteArray=6]="byteArray",t[t.string=7]="string",t[t.timestamp=8]="timestamp",t[t.uuid=9]="uuid"})(v||(v={}));Hi="boolean",Hc="byte",jc="short",Vc="integer",qc="long",Gc="binary",Wc="string",Jc="timestamp",Qc="uuid",Xc=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/});function Vi({byteLength:t,byteOffset:e,buffer:r}){if(t<Kc)throw new Error("Provided message too short to accommodate event stream message overhead");let o=new DataView(r,e,t),n=o.getUint32(0,!1);if(t!==n)throw new Error("Reported message length does not match received message length");let s=o.getUint32(ji,!1),i=o.getUint32(fe,!1),a=o.getUint32(t-be,!1),c=new De;if(c.update(new Uint8Array(r,e,fe)),i!==c.digestSync())throw new Error(`The prelude checksum specified in the message (${i}) does not match the calculated CRC32 checksum (${c.digestSync()})`);if(c.update(new Uint8Array(r,e+fe,t-(fe+be))),a!==c.digestSync())throw new Error(`The message checksum (${c.digestSync()}) did not match the expected value of ${a}`);return{headers:new DataView(r,e+fe+be,s),body:new Uint8Array(r,e+fe+be+s,n-s-(fe+be+be))}}var ji,fe,be,Kc,qi=u(()=>{vo();ji=4,fe=ji*2,be=4,Kc=fe+be*2});var $e,Io=u(()=>{vo();No();qi();$e=class{headerMarshaller;messageBuffer;isEndOfStream;constructor(e,r){this.headerMarshaller=new _e(e,r),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){let e=this.messageBuffer.pop(),r=this.isEndOfStream;return{getMessage(){return e},isEndOfStream(){return r}}}getAvailableMessages(){let e=this.messageBuffer;this.messageBuffer=[];let r=this.isEndOfStream;return{getMessages(){return e},isEndOfStream(){return r}}}encode({headers:e,body:r}){let o=this.headerMarshaller.format(e),n=o.byteLength+r.byteLength+16,s=new Uint8Array(n),i=new DataView(s.buffer,s.byteOffset,s.byteLength),a=new De;return i.setUint32(0,n,!1),i.setUint32(4,o.byteLength,!1),a.update(s.subarray(0,8)),i.setUint32(8,a.digestSync(),!1),s.set(o,12),s.set(r,o.byteLength+12),a.update(s.subarray(8,n-4)),i.setUint32(n-4,a.digestSync(),!1),s}decode(e){let{headers:r,body:o}=Vi(e);return{headers:this.headerMarshaller.parse(r),body:o}}formatHeaders(e){return this.headerMarshaller.format(e)}}});var Be,Ro=u(()=>{Be=class{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.decoder.decode(e)}}});var Le,Mo=u(()=>{Le=class{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream)yield this.options.encoder.encode(e);this.options.includeEndFrame&&(yield new Uint8Array(0))}}});var Fe,Oo=u(()=>{Fe=class{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream){let r=await this.options.deserializer(e);r!==void 0&&(yield r)}}}});var ze,Po=u(()=>{ze=class{options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.serializer(e)}}});function tr(t){let e=0,r=0,o=null,n=null,s=a=>{if(typeof a!="number")throw new Error("Attempted to allocate an event message where size was not a number: "+a);e=a,r=4,o=new Uint8Array(a),new DataView(o.buffer).setUint32(0,a,!1)},i=async function*(){let a=t[Symbol.asyncIterator]();for(;;){let{value:c,done:m}=await a.next();if(m){if(e)if(e===r)yield o;else throw new Error("Truncated event message received.");else return;return}let f=c.length,d=0;for(;d<f;){if(!o){let p=f-d;n||(n=new Uint8Array(4));let h=Math.min(4-r,p);if(n.set(c.slice(d,d+h),r),r+=h,d+=h,r<4)break;s(new DataView(n.buffer).getUint32(0,!1)),n=null}let l=Math.min(e-r,f-d);o.set(c.slice(d,d+l),r),r+=l,d+=l,e&&e===r&&(yield o,o=null,e=0,r=0)}}};return{[Symbol.asyncIterator]:i}}var Uo=u(()=>{});function Gi(t,e){let r=at(e.deserializer,e.toUtf8);return{[Symbol.asyncIterator]:async function*(){for await(let o of t){let n=e.eventStreamCodec.decode(o),s=await r(n);s!==void 0&&(yield s)}}}}function at(t,e){return async function(r){let{value:o}=r.headers[":message-type"];if(o==="error"){let n=new Error(r.headers[":error-message"].value||"UnknownError");throw n.name=r.headers[":error-code"].value,n}else if(o==="exception"){let n=r.headers[":exception-type"].value,s={[n]:r},i=await t(s);if(i.$unknown){let a=new Error(e(r.body));throw a.name=n,a}throw i[n]}else if(o==="event"){let n={[r.headers[":event-type"].value]:r},s=await t(n);return s.$unknown?void 0:s}else throw Error(`Unrecognizable event type: ${r.headers[":event-type"].value}`)}}var ko=u(()=>{});var Se,Wi,Do=u(()=>{Io();Ro();Mo();Oo();Po();Uo();ko();Se=class{eventStreamCodec;utfEncoder;constructor({utf8Encoder:e,utf8Decoder:r}){this.eventStreamCodec=new $e(e,r),this.utfEncoder=e}deserialize(e,r){let o=tr(e);return new Fe({messageStream:new Be({inputStream:o,decoder:this.eventStreamCodec}),deserializer:at(r,this.utfEncoder)})}serialize(e,r){return new Le({messageStream:new ze({inputStream:e,serializer:r}),encoder:this.eventStreamCodec,includeEndFrame:!0})}},Wi=t=>new Se(t)});async function*Zc(t){let e=!1,r=!1,o=new Array;for(t.on("error",n=>{if(e||(e=!0),n)throw n}),t.on("data",n=>{o.push(n)}),t.on("end",()=>{e=!0});!r;){let n=await new Promise(s=>setTimeout(()=>s(o.shift()),0));n&&(yield n),r=e&&o.length===0}}var Ji,ct,Qi,Xi=u(()=>{Ji=require("node:stream");Do();ct=class{universalMarshaller;constructor({utf8Encoder:e,utf8Decoder:r}){this.universalMarshaller=new Se({utf8Decoder:r,utf8Encoder:e})}deserialize(e,r){let o=typeof e[Symbol.asyncIterator]=="function"?e:Zc(e);return this.universalMarshaller.deserialize(o,r)}serialize(e,r){return Ji.Readable.from(this.universalMarshaller.serialize(e,r))}},Qi=t=>new ct(t)});var Ki,Zi,Yi=u(()=>{Ki=t=>({[Symbol.asyncIterator]:async function*(){let e=t.getReader();try{for(;;){let{done:r,value:o}=await e.read();if(r)return;yield o}}finally{e.releaseLock()}}}),Zi=t=>{let e=t[Symbol.asyncIterator]();return new ReadableStream({async pull(r){let{done:o,value:n}=await e.next();if(o)return r.close();r.enqueue(n)}})}});var ea,ta=u(()=>{ea=t=>Object.assign(t,{eventStreamMarshaller:t.eventStreamSerdeProvider(t)})});var rr,ra=u(()=>{Z();G();rr=class{marshaller;serializer;deserializer;serdeContext;defaultContentType;compositeErrorRegistry;constructor({marshaller:e,serializer:r,deserializer:o,serdeContext:n,defaultContentType:s,compositeErrorRegistry:i}){this.marshaller=e,this.serializer=r,this.deserializer=o,this.serdeContext=n,this.defaultContentType=s,this.compositeErrorRegistry=i}async serializeEventStream({eventStream:e,requestSchema:r,initialRequest:o}){let n=this.marshaller,s=r.getEventStreamMember(),i=r.getMemberSchema(s),a=this.serializer,c=this.defaultContentType,m=Symbol("initialRequestMarker"),f={async*[Symbol.asyncIterator](){if(o){let d={":event-type":{type:"string",value:"initial-request"},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:c}};a.write(r,o);let l=a.flush();yield{[m]:!0,headers:d,body:l}}for await(let d of e)yield d}};return n.serialize(f,d=>{if(d[m])return{headers:d.headers,body:d.body};let l="";for(let b in d)if(b!=="__type"){l=b;break}let{additionalHeaders:p,body:h,eventType:g,explicitPayloadContentType:y}=this.writeEventBody(l,i,d);return{headers:{":event-type":{type:"string",value:g},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:y??c},...p},body:h}})}async deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:o}){let n=this.marshaller,s=r.getEventStreamMember(),a=r.getMemberSchema(s).getMemberSchemas(),c=Symbol("initialResponseMarker"),m=n.deserialize(e.body,async l=>{let p="";for(let g in l)if(g!=="__type"){p=g;break}let h=l[p].body;if(p==="initial-response"){let g=await this.deserializer.read(r,h);return delete g[s],{[c]:!0,...g}}else if(p in a){let g=a[p];if(g.isStructSchema()){let y={},S=!1;for(let[b,w]of g.structIterator()){let{eventHeader:O,eventPayload:A}=w.getMergedTraits();if(S=S||!!(O||A),A)w.isBlobSchema()?y[b]=h:w.isStringSchema()?y[b]=(this.serdeContext?.utf8Encoder??J)(h):w.isStructSchema()&&(y[b]=await this.deserializer.read(w,h));else if(O){let T=l[p].headers[b]?.value;T!=null&&(w.isNumericSchema()?T&&typeof T=="object"&&"bytes"in T?y[b]=BigInt(T.toString()):y[b]=Number(T):y[b]=T)}}return{[p]:await this.readEventMember(g,h,S,y)}}return{[p]:await this.deserializer.read(g,h)}}else return{$unknown:l}}),f=m[Symbol.asyncIterator](),d=await f.next();if(d.done)return m;if(d.value?.[c]){if(!r)throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");for(let l in d.value)o[l]=d.value[l]}return{async*[Symbol.asyncIterator](){for(d?.value?.[c]||(yield d.value);;){let{done:l,value:p}=await f.next();if(l)break;yield p}}}}async readEventMember(e,r,o,n){let s,i=e.getSchema();if(Array.isArray(i)&&i[0]===-3){let c=i[1],m=pe.for(c);this.compositeErrorRegistry?.copyFrom(m),s=(this.compositeErrorRegistry??m)?.getErrorCtor(i)}let a=o?n:r.byteLength===0?{}:await this.deserializer.read(e,r);if(s){let c=a.message??a.Message??"Unknown",m={},f=e.getMergedTraits().error;return f&&(m.$fault=f),Object.assign(new s({}),m,{message:c},a)}return a}writeEventBody(e,r,o){let n=this.serializer,s=e,i=null,a,c=r.getSchema()[4].includes(e),m={};if(c){let l=r.getMemberSchema(e);if(l.isStructSchema()){for(let[p,h]of l.structIterator()){let{eventHeader:g,eventPayload:y}=h.getMergedTraits();if(y)i=p;else if(g){let S=o[e][p],b="binary";h.isNumericSchema()?(-2)**31<=S&&S<=2**31-1?b="integer":b="long":h.isTimestampSchema()?b="timestamp":h.isStringSchema()?b="string":h.isBooleanSchema()&&(b="boolean"),S!=null&&(m[p]={type:b,value:S},delete o[e][p])}}if(i!==null){let p=l.getMemberSchema(i);p.isBlobSchema()?a="application/octet-stream":p.isStringSchema()&&(a="text/plain"),n.write(p,o[e][i])}else n.write(l,o[e])}else if(l.isUnitSchema())n.write(l,{});else throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.")}else{let[l,p]=o[e];s=l,n.write(15,p)}let f=n.flush()??new Uint8Array;return{body:typeof f=="string"?(this.serdeContext?.utf8Decoder??L)(f):f,eventType:s,explicitPayloadContentType:a,additionalHeaders:m}}}});var oa={};lt(oa,{EventStreamCodec:()=>$e,EventStreamMarshaller:()=>ct,EventStreamSerde:()=>rr,HeaderMarshaller:()=>_e,Int64:()=>ce,MessageDecoderStream:()=>Be,MessageEncoderStream:()=>Le,SmithyMessageDecoderStream:()=>Fe,SmithyMessageEncoderStream:()=>ze,UniversalEventStreamMarshaller:()=>Se,eventStreamSerdeProvider:()=>Qi,getChunkedStream:()=>tr,getMessageUnmarshaller:()=>at,getUnmarshalledStream:()=>Gi,iterableToReadableStream:()=>Zi,readableStreamToIterable:()=>Ki,resolveEventStreamSerdeConfig:()=>ea,universalEventStreamSerdeProvider:()=>Wi});var na=u(()=>{Io();No();Ao();Ro();Mo();Oo();Po();Xi();Yi();Do();Uo();ko();ta();ra()});var me,or=u(()=>{Z();M();ke();me=class extends ${options;compositeErrorRegistry;constructor(e){super(),this.options=e,this.compositeErrorRegistry=pe.for(e.defaultNamespace);for(let r of e.errorTypeRegistries??[])this.compositeErrorRegistry.copyFrom(r)}getRequestType(){return U}getResponseType(){return X}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[o,n]of r.url.searchParams.entries())e.query[o]=n;if(r.headers)for(let o in r.headers)e.headers[o]=r.headers[o].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 o in r.headers)e.headers[o]=r.headers[o];return e}}setHostPrefix(e,r,o){if(this.serdeContext?.disableHostPrefix)return;let n=C.of(r.input),s=q(r.traits??{});if(s.endpoint){let i=s.endpoint?.[0];if(typeof i=="string"){for(let[a,c]of n.structIterator()){if(!c.getMergedTraits().hostLabel)continue;let m=o[a];if(typeof m!="string")throw new Error(`@smithy/core/schema - ${a} in input must be a string as hostLabel.`);i=i.replace(`{${a}}`,m)}if(e.hostname=i+e.hostname,!et(e.hostname))throw new Error(`[${e.hostname}] is not a valid hostname.`)}}}deserializeMetadata(e){return{httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}}async serializeEventStream({eventStream:e,requestSchema:r,initialRequest:o}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:e,requestSchema:r,initialRequest:o})}async deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:o}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:o})}async loadEventStreamCapability(){let{EventStreamSerde:e,eventStreamSerdeProvider:r}=await Promise.resolve().then(()=>(na(),oa)),o=this.resolveEventStreamMarshaller(r);return new e({marshaller:o,serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType(),compositeErrorRegistry:this.compositeErrorRegistry})}resolveEventStreamMarshaller(e){let r=this.serdeContext;return r.eventStreamMarshaller?r.eventStreamMarshaller:e(this.serdeContext)}getDefaultContentType(){throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(e,r,o,n,s){return[]}getEventStreamMarshaller(){let e=this.serdeContext;if(!e.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return e.eventStreamMarshaller}}});var nr,sa=u(()=>{Z();G();M();or();Zt();Yt();nr=class extends me{async serializeRequest(e,r,o){let n=r&&typeof r=="object"?r:{},s=this.serializer,i={},a={},c=await o.endpoint(),m=C.of(e?.input),f=[],d=[],l=!1,p,h=new U({protocol:"",hostname:"",port:void 0,path:"",fragment:void 0,query:i,headers:a,body:void 0});if(c){this.updateServiceEndpoint(h,c),this.setHostPrefix(h,e,n);let g=q(e.traits);if(g.http){h.method=g.http[0];let[y,S]=g.http[1].split("?");h.path=="/"?h.path=y:h.path+=y;let b=new URLSearchParams(S??"");for(let[w,O]of b)i[w]=O}}for(let[g,y]of m.structIterator()){let S=y.getMergedTraits()??{},b=n[g];if(b==null&&!y.isIdempotencyToken()){if(S.httpLabel&&(h.path.includes(`{${g}+}`)||h.path.includes(`{${g}}`)))throw new Error(`No value provided for input HTTP label: ${g}.`);continue}if(S.httpPayload)y.isStreaming()?y.isStructSchema()?n[g]&&(p=await this.serializeEventStream({eventStream:n[g],requestSchema:m})):p=b:(s.write(y,b),p=s.flush());else if(S.httpLabel){s.write(y,b);let w=s.flush();h.path.includes(`{${g}+}`)?h.path=h.path.replace(`{${g}+}`,w.split("/").map(ae).join("/")):h.path.includes(`{${g}}`)&&(h.path=h.path.replace(`{${g}}`,ae(w)))}else if(S.httpHeader)s.write(y,b),a[S.httpHeader.toLowerCase()]=String(s.flush());else if(typeof S.httpPrefixHeaders=="string")for(let w in b){let O=b[w],A=S.httpPrefixHeaders+w;s.write([y.getValueSchema(),{httpHeader:A}],O),a[A.toLowerCase()]=s.flush()}else S.httpQuery||S.httpQueryParams?this.serializeQuery(y,b,i):(l=!0,f.push(g),d.push(y))}if(l&&n){let[g,y]=(m.getName(!0)??"#Unknown").split("#"),S=m.getSchema()[6],b=[3,g,y,m.getMergedTraits(),f,d,void 0];S?b[6]=S:b.pop(),s.write(b,n),p=s.flush()}return h.headers=a,h.query=i,h.body=p,h}serializeQuery(e,r,o){let n=this.serializer,s=e.getMergedTraits();if(s.httpQueryParams){for(let i in r)if(!(i in o)){let a=r[i],c=e.getValueSchema();Object.assign(c.getMergedTraits(),{...s,httpQuery:i,httpQueryParams:void 0}),this.serializeQuery(c,a,o)}return}if(e.isListSchema()){let i=!!e.getMergedTraits().sparse,a=[];for(let c of r){n.write([e.getValueSchema(),s],c);let m=n.flush();(i||m!==void 0)&&a.push(m)}o[s.httpQuery]=a}else n.write([e,s],r),o[s.httpQuery]=n.flush()}async deserializeResponse(e,r,o){let n=this.deserializer,s=C.of(e.output),i={};if(o.statusCode>=300){let c=await W(o.body,r);throw c.byteLength>0&&Object.assign(i,await n.read(15,c)),await this.handleError(e,r,o,i,this.deserializeMetadata(o)),new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(let c in o.headers){let m=o.headers[c];delete o.headers[c],o.headers[c.toLowerCase()]=m}let a=await this.deserializeHttpMessage(s,r,o,i);if(a.length){let c=await W(o.body,r);if(c.byteLength>0){let m=await n.read(s,c);for(let f of a)m[f]!=null&&(i[f]=m[f])}}else a.discardResponseBody&&await W(o.body,r);return i.$metadata=this.deserializeMetadata(o),i}async deserializeHttpMessage(e,r,o,n,s){let i;n instanceof Set?i=s:i=n;let a=!0,c=this.deserializer,m=C.of(e),f=[];for(let[d,l]of m.structIterator()){let p=l.getMemberTraits();if(p.httpPayload){if(a=!1,l.isStreaming())l.isStructSchema()?i[d]=await this.deserializeEventStream({response:o,responseSchema:m}):i[d]=Kt(o.body);else if(o.body){let g=await W(o.body,r);g.byteLength>0&&(i[d]=await c.read(l,g))}}else if(p.httpHeader){let h=String(p.httpHeader).toLowerCase(),g=o.headers[h];if(g!=null)if(l.isListSchema()){let y=l.getValueSchema();y.getMergedTraits().httpHeader=h;let S;y.isTimestampSchema()&&y.getSchema()===4?S=Rt(g,",",2):S=Ne(g);let b=[];for(let w of S)b.push(await c.read(y,w.trim()));i[d]=b}else i[d]=await c.read(l,g)}else if(p.httpPrefixHeaders!==void 0){i[d]={};for(let h in o.headers)if(h.startsWith(p.httpPrefixHeaders)){let g=o.headers[h],y=l.getValueSchema();y.getMergedTraits().httpHeader=h,i[d][h.slice(p.httpPrefixHeaders.length)]=await c.read(y,g)}}else p.httpResponseCode?i[d]=o.statusCode:f.push(d)}return f.discardResponseBody=a,f}}});var sr,ia=u(()=>{Z();M();or();Zt();sr=class extends me{async serializeRequest(e,r,o){let n=this.serializer,s={},i={},a=await o.endpoint(),c=C.of(e?.input),m=c.getSchema(),f,d=r&&typeof r=="object"?r:{},l=new U({protocol:"",hostname:"",port:void 0,path:"/",fragment:void 0,query:s,headers:i,body:void 0});if(a&&(this.updateServiceEndpoint(l,a),this.setHostPrefix(l,e,d)),d){let p=c.getEventStreamMember();if(p){if(d[p]){let h={};for(let[g,y]of c.structIterator())g!==p&&d[g]&&(n.write(y,d[g]),h[g]=n.flush());f=await this.serializeEventStream({eventStream:d[p],requestSchema:c,initialRequest:h})}}else n.write(m,d),f=n.flush()}return l.headers=Object.assign(l.headers,i),l.query=s,l.body=f,l.method="POST",l}async deserializeResponse(e,r,o){let n=this.deserializer,s=C.of(e.output),i={};if(o.statusCode>=300){let c=await W(o.body,r);throw c.byteLength>0&&Object.assign(i,await n.read(15,c)),await this.handleError(e,r,o,i,this.deserializeMetadata(o)),new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.")}for(let c in o.headers){let m=o.headers[c];delete o.headers[c],o.headers[c.toLowerCase()]=m}let a=s.getEventStreamMember();if(a)i[a]=await this.deserializeEventStream({response:o,responseSchema:s,initialResponseContainer:i});else{let c=await W(o.body,r);c.byteLength>0&&Object.assign(i,await n.read(s,c))}return i.$metadata=this.deserializeMetadata(o),i}}});var ir,_o=u(()=>{Yt();ir=(t,e,r,o,n,s)=>{if(e!=null&&e[r]!==void 0){let i=o();if(i==null||i.length<=0)throw new Error("Empty value provided for input HTTP label: "+r+".");t=t.replace(n,s?i.split("/").map(a=>ae(a)).join("/"):ae(i))}else throw new Error("No value provided for input HTTP label: "+r+".");return t}});function aa(t,e){return new ft(t,e)}var ft,ca=u(()=>{M();_o();ft=class{input;context;query={};method="";headers={};path="";body=null;hostname="";resolvePathStack=[];constructor(e,r){this.input=e,this.context=r}async build(){let{hostname:e,protocol:r="https",port:o,path:n}=await this.context.endpoint();this.path=n;for(let s of this.resolvePathStack)s(this.path);return new U({protocol:r,hostname:this.hostname||e,port:o,method:this.method,path:this.path,query:this.query,body:this.body,headers:this.headers})}hn(e){return this.hostname=e,this}bp(e){return this.resolvePathStack.push(r=>{this.path=`${r?.endsWith("/")?r.slice(0,-1):r||""}`+e}),this}p(e,r,o,n){return this.resolvePathStack.push(s=>{this.path=ir(s,this.input,e,r,o,n)}),this}h(e){return this.headers=e,this}q(e){return this.query=e,this}b(e){return this.body=e,this}m(e){return this.method=e,this}}});function He(t,e){if(e.timestampFormat.useTrait&&t.isTimestampSchema()&&(t.getSchema()===5||t.getSchema()===6||t.getSchema()===7))return t.getSchema();let{httpLabel:r,httpPrefixHeaders:o,httpHeader:n,httpQuery:s}=t.getMergedTraits();return(e.httpBindings?typeof o=="string"||n?6:s||r?5:void 0:void 0)??e.timestampFormat.default}var ar=u(()=>{});var je,$o=u(()=>{Z();G();ke();ar();je=class extends ${settings;constructor(e){super(),this.settings=e}read(e,r){let o=C.of(e);if(o.isListSchema())return Ne(r).map(n=>this.read(o.getValueSchema(),n));if(o.isBlobSchema())return(this.serdeContext?.base64Decoder??xe)(r);if(o.isTimestampSchema())switch(He(o,this.settings)){case 5:return Nt(r);case 6:return It(r);case 7:return At(r);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",r),new Date(r)}if(o.isStringSchema()){let n=o.getMergedTraits().mediaType,s=r;if(n)return o.getMergedTraits().httpHeader&&(s=this.base64ToUtf8(s)),(n==="application/json"||n.endsWith("+json"))&&(s=D.from(s)),s}return o.isNumericSchema()?Number(r):o.isBigIntegerSchema()?BigInt(r):o.isBigDecimalSchema()?new de(r,"bigDecimal"):o.isBooleanSchema()?String(r).toLowerCase()==="true":r}base64ToUtf8(e){return(this.serdeContext?.utf8Encoder??J)((this.serdeContext?.base64Decoder??xe)(e))}}});var cr,fa=u(()=>{Z();G();ke();$o();cr=class extends ${codecDeserializer;stringDeserializer;constructor(e,r){super(),this.codecDeserializer=e,this.stringDeserializer=new je(r)}setSerdeContext(e){this.stringDeserializer.setSerdeContext(e),this.codecDeserializer.setSerdeContext(e),this.serdeContext=e}read(e,r){let o=C.of(e),n=o.getMergedTraits(),s=this.serdeContext?.utf8Encoder??J;if(n.httpHeader||n.httpResponseCode)return this.stringDeserializer.read(o,s(r));if(n.httpPayload){if(o.isBlobSchema()){let i=this.serdeContext?.utf8Decoder??L;return typeof r=="string"?i(r):r}else if(o.isStringSchema())return"byteLength"in r?s(r):r}return this.codecDeserializer.read(o,r)}}});var Ve,Bo=u(()=>{Z();G();ke();ar();Ve=class extends ${settings;stringBuffer="";constructor(e){super(),this.settings=e}write(e,r){let o=C.of(e);switch(typeof r){case"object":if(r===null){this.stringBuffer="null";return}if(o.isTimestampSchema()){if(!(r instanceof Date))throw new Error(`@smithy/core/protocols - received non-Date value ${r} when schema expected Date in ${o.getName(!0)}`);switch(He(o,this.settings)){case 5:this.stringBuffer=r.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=Ct(r);break;case 7:this.stringBuffer=String(r.getTime()/1e3);break;default:console.warn("Missing timestamp format, using epoch seconds",r),this.stringBuffer=String(r.getTime()/1e3)}return}if(o.isBlobSchema()&&"byteLength"in r){this.stringBuffer=(this.serdeContext?.base64Encoder??oe)(r);return}if(o.isListSchema()&&Array.isArray(r)){let i="";for(let a of r){this.write([o.getValueSchema(),o.getMergedTraits()],a);let c=this.flush(),m=o.getValueSchema().isTimestampSchema()?c:vt(c);i!==""&&(i+=", "),i+=m}this.stringBuffer=i;return}this.stringBuffer=JSON.stringify(r,null,2);break;case"string":let n=o.getMergedTraits().mediaType,s=r;if(n&&((n==="application/json"||n.endsWith("+json"))&&(s=D.from(s)),o.getMergedTraits().httpHeader)){this.stringBuffer=(this.serdeContext?.base64Encoder??oe)(s.toString());return}this.stringBuffer=r;break;default:o.isIdempotencyToken()?this.stringBuffer=Eo():this.stringBuffer=String(r)}}flush(){let e=this.stringBuffer;return this.stringBuffer="",e}}});var fr,ma=u(()=>{Z();Bo();fr=class{codecSerializer;stringSerializer;buffer;constructor(e,r,o=new Ve(r)){this.codecSerializer=e,this.stringSerializer=o}setSerdeContext(e){this.codecSerializer.setSerdeContext(e),this.stringSerializer.setSerdeContext(e)}write(e,r){let o=C.of(e),n=o.getMergedTraits();if(n.httpHeader||n.httpLabel||n.httpQuery){this.stringSerializer.write(o,r),this.buffer=this.stringSerializer.flush();return}return this.codecSerializer.write(o,r)}flush(){if(this.buffer!==void 0){let e=this.buffer;return this.buffer=void 0,e}return this.codecSerializer.flush()}}});var ua,mr,da=u(()=>{ua=we(Ye()),mr=class{name;kind;values;constructor({name:e,kind:r=ua.FieldPosition.HEADER,values:o=[]}){this.name=e,this.kind=r,this.values=o}add(e){this.values.push(e)}set(e){this.values=e}remove(e){this.values=this.values.filter(r=>r!==e)}toString(){return this.values.map(e=>e.includes(",")||e.includes(" ")?`"${e}"`:e).join(", ")}get(){return this.values}}});var ur,la=u(()=>{ur=class{entries={};encoding;constructor({fields:e=[],encoding:r="utf-8"}){e.forEach(this.setField.bind(this)),this.encoding=r}setField(e){this.entries[e.name.toLowerCase()]=e}getField(e){return this.entries[e.toLowerCase()]}removeField(e){delete this.entries[e.toLowerCase()]}getByType(e){return Object.values(this.entries).filter(r=>r.kind===e)}}});var pa,ha,ga=u(()=>{pa=t=>({setHttpHandler(e){t.httpHandler=e},httpHandler(){return t.httpHandler},updateHttpClientConfig(e,r){t.httpHandler?.updateHttpClientConfig(e,r)},httpHandlerConfigs(){return t.httpHandler.httpHandlerConfigs()}}),ha=t=>({httpHandler:t.httpHandler()})});function Lo(t){return e=>async r=>{let o=r.request;if(U.isInstance(o)){let{body:n,headers:s}=o;if(n&&Object.keys(s).map(i=>i.toLowerCase()).indexOf(ya)===-1)try{let i=t(n);o.headers={...o.headers,[ya]:String(i)}}catch{}}return e({...r,request:o})}}var ya,Fo,ba,Sa=u(()=>{M();ya="content-length";Fo={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},ba=t=>({applyToStack:e=>{e.add(Lo(t.bodyLengthChecker),Fo)}})});var ue,Yc,dr=u(()=>{ue=t=>encodeURIComponent(t).replace(/[!'()*]/g,Yc),Yc=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var wa,xa=u(()=>{dr();wa=t=>t.split("/").map(ue).join("/")});function Ea(t){let e=[];for(let r of Object.keys(t).sort()){let o=t[r];if(r=ue(r),Array.isArray(o))for(let n=0,s=o.length;n<s;n++)e.push(`${r}=${ue(o[n])}`);else{let n=r;(o||typeof o=="string")&&(n+=`=${ue(o)}`),e.push(n)}}return e.join("&")}var Ta=u(()=>{dr()});var Ca={};lt(Ca,{Field:()=>mr,Fields:()=>ur,FromStringShapeDeserializer:()=>je,HttpBindingProtocol:()=>nr,HttpInterceptingShapeDeserializer:()=>cr,HttpInterceptingShapeSerializer:()=>fr,HttpProtocol:()=>me,HttpRequest:()=>U,HttpResponse:()=>X,RequestBuilder:()=>ft,RpcProtocol:()=>sr,SerdeContext:()=>$,ToStringShapeSerializer:()=>Ve,buildQueryString:()=>Ea,collectBody:()=>W,contentLengthMiddleware:()=>Lo,contentLengthMiddlewareOptions:()=>Fo,determineTimestampFormat:()=>He,escapeUri:()=>ue,escapeUriPath:()=>wa,extendedEncodeURIComponent:()=>ae,getContentLengthPlugin:()=>ba,getHttpHandlerExtensionConfiguration:()=>pa,isValidHostname:()=>et,parseQueryString:()=>rt,parseUrl:()=>le,requestBuilder:()=>aa,resolveHttpHandlerRuntimeConfig:()=>ha,resolvedPath:()=>ir});var va=u(()=>{Zt();Yt();sa();or();ia();ca();_o();$o();fa();ma();Bo();ar();ke();da();la();M();M();M();ga();Sa();dr();xa();Ta();M();M()});var Da=Go(ut=>{var{buildQueryString:Oa,HttpResponse:Pa}=(va(),gr(Ca)),lr=require("node:https"),{Readable:ef}=require("node:stream"),zo=require("node:http2"),{streamCollector:tf}=(G(),gr(_i));ut.streamCollector=tf;function hr(t){let e=t&&typeof t=="object"&&"reason"in t?t.reason:void 0;if(e){if(e instanceof Error){let n=new Error("Request aborted");return n.name="AbortError",n.cause=e,n}let o=new Error(String(e));return o.name="AbortError",o}let r=new Error("Request aborted");return r.name="AbortError",r}var rf=["ECONNRESET","EPIPE","ETIMEDOUT"],Ua=t=>{let e={};for(let r in t){let o=t[r];e[r]=Array.isArray(o)?o.join(","):o}return e},I={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t)},Aa=1e3,of=(t,e,r=0)=>{if(!r)return-1;let o=n=>{let s=I.setTimeout(()=>{t.destroy(),e(Object.assign(new Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${r} ms.`),{name:"TimeoutError"}))},r-n),i=a=>{a?.connecting?a.on("connect",()=>{I.clearTimeout(s)}):I.clearTimeout(s)};t.socket?i(t.socket):t.on("socket",i)};return r<2e3?(o(0),0):I.setTimeout(o.bind(null,Aa),Aa)},nf=(t,e,r=0,o,n)=>r?I.setTimeout(()=>{let s=`@smithy/node-http-handler - [${o?"ERROR":"WARN"}] a request has exceeded the configured ${r} ms requestTimeout.`;if(o){let i=Object.assign(new Error(s),{name:"TimeoutError",code:"ETIMEDOUT"});t.destroy(i),e(i)}else s+=" Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.",n?.warn?.(s)},r):-1,sf=3e3,af=(t,{keepAlive:e,keepAliveMsecs:r},o=sf)=>{if(e!==!0)return-1;let n=()=>{t.socket?t.socket.setKeepAlive(e,r||0):t.on("socket",s=>{s.setKeepAlive(e,r||0)})};return o===0?(n(),0):I.setTimeout(n,o)},Na=3e3,cf=(t,e,r=0)=>{let o=n=>{let s=r-n,i=()=>{t.destroy(),e(Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${r} ms of inactivity (configured by client requestHandler).`),{name:"TimeoutError"}))};t.socket?(t.socket.setTimeout(s,i),t.on("close",()=>t.socket?.removeListener("timeout",i))):t.setTimeout(s,i)};return 0<r&&r<6e3?(o(0),0):I.setTimeout(o.bind(null,r===0?0:Na),Na)},Ia=6e3;async function ka(t,e,r=Ia,o=!1){let n=e.headers,s=n?n.Expect||n.expect:void 0,i=-1,a=!0;!o&&s==="100-continue"&&(a=await Promise.race([new Promise(c=>{i=Number(I.setTimeout(()=>c(!0),Math.max(Ia,r)))}),new Promise(c=>{t.on("continue",()=>{I.clearTimeout(i),c(!0)}),t.on("response",()=>{I.clearTimeout(i),c(!1)}),t.on("error",()=>{I.clearTimeout(i),c(!1)})})])),a&&ff(t,e.body)}function ff(t,e){if(e instanceof ef){e.pipe(t);return}if(e){let r=Buffer.isBuffer(e);if(r||typeof e=="string"){r&&e.byteLength===0?t.end():t.end(e);return}let n=e;if(typeof n=="object"&&n.buffer&&typeof n.byteOffset=="number"&&typeof n.byteLength=="number"){t.end(Buffer.from(n.buffer,n.byteOffset,n.byteLength));return}t.end(Buffer.from(e));return}t.end()}var mf=0,pr,Ra,Ho=class t{config;configProvider;socketWarningTimestamp=0;externalAgent=!1;metadata={handlerProtocol:"http/1.1"};static create(e){return typeof e?.handle=="function"?e:new t(e)}static checkSocketUsage(e,r,o=console){let{sockets:n,requests:s,maxSockets:i}=e;if(typeof i!="number"||i===1/0||Date.now()-15e3<r)return r;if(n&&s)for(let c in n){let m=n[c]?.length??0,f=s[c]?.length??0;if(m>=i&&f>=2*i)return o?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${m} and ${f} additional requests are enqueued.
16
16
  See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
17
- or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`),Date.now()}return r}constructor(e){this.configProvider=new Promise((r,o)=>{typeof e=="function"?e().then(n=>{r(this.resolveDefaultConfig(n))}).catch(o):r(this.resolveDefaultConfig(e))})}destroy(){this.config?.httpAgent?.destroy(),this.config?.httpsAgent?.destroy()}async handle(e,{abortSignal:r,requestTimeout:o}={}){this.config||(this.config=await this.configProvider);let n=this.config,s=e.protocol==="https:";return!s&&!this.config.httpAgent&&(this.config.httpAgent=await this.config.httpAgentProvider()),new Promise((i,a)=>{let c,m=-1,f=-1,d=-1,l=-1,p=-1,h=()=>{A.clearTimeout(m),A.clearTimeout(f),A.clearTimeout(d),A.clearTimeout(l),A.clearTimeout(p)},g=async w=>{await c,h(),i(w)},y=async w=>{await c,h(),a(w)};if(r?.aborted){let w=lr(r);y(w);return}let b=e.headers,S=b?(b.Expect??b.expect)==="100-continue":!1,x=s?n.httpsAgent:n.httpAgent;S&&!this.externalAgent&&(x=new(s?ur.Agent:dr)({keepAlive:!1,maxSockets:1/0})),m=A.setTimeout(()=>{this.socketWarningTimestamp=t.checkSocketUsage(x,this.socketWarningTimestamp,n.logger)},n.socketAcquisitionWarningTimeout??(n.requestTimeout??2e3)+(n.connectionTimeout??1e3));let M=e.query?Oa(e.query):"",N;if(e.username!=null||e.password!=null){let w=e.username??"",E=e.password??"";N=`${w}:${E}`}let O=e.path;M&&(O+=`?${M}`),e.fragment&&(O+=`#${e.fragment}`);let Z=e.hostname??"";Z[0]==="["&&Z.endsWith("]")?Z=e.hostname.slice(1,-1):Z=e.hostname;let ue={headers:e.headers,host:Z,method:e.method,path:O,port:e.port,agent:x,auth:N},P=(s?ur.request:Ra)(ue,w=>{let E=new Pa({statusCode:w.statusCode||-1,reason:w.statusMessage,headers:Ua(w.headers),body:w});g({response:E})});if(P.on("error",w=>{Yc.includes(w.code)?y(Object.assign(w,{name:"TimeoutError"})):y(w)}),r){let w=()=>{P.destroy();let E=lr(r);y(E)};if(typeof r.addEventListener=="function"){let E=r;E.addEventListener("abort",w,{once:!0}),P.once("close",()=>E.removeEventListener("abort",w))}else r.onabort=w}let qe=o??n.requestTimeout;f=ef(P,y,n.connectionTimeout),d=tf(P,y,qe,n.throwOnRequestTimeout,n.logger??console),l=nf(P,y,n.socketTimeout);let Y=ue.agent;typeof Y=="object"&&"keepAlive"in Y&&(p=of(P,{keepAlive:Y.keepAlive,keepAliveMsecs:Y.keepAliveMsecs})),c=ka(P,e,qe,this.externalAgent).catch(w=>(h(),a(w)))})}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(o=>({...o,[e]:r}))}httpHandlerConfigs(){return this.config??{}}resolveDefaultConfig(e){let{requestTimeout:r,connectionTimeout:o,socketTimeout:n,socketAcquisitionWarningTimeout:s,httpAgent:i,httpsAgent:a,throwOnRequestTimeout:c,logger:m}=e||{},f=!0,d=50;return{connectionTimeout:o,requestTimeout:r,socketTimeout:n,socketAcquisitionWarningTimeout:s,throwOnRequestTimeout:c,httpAgentProvider:async()=>{let l=require("node:http"),{Agent:p,request:h}=l.default??l;return Ra=h,dr=p,i instanceof dr||typeof i?.destroy=="function"?(this.externalAgent=!0,i):new dr({keepAlive:f,maxSockets:d,...i})},httpsAgent:a instanceof ur.Agent||typeof a?.destroy=="function"?(this.externalAgent=!0,a):new ur.Agent({keepAlive:f,maxSockets:d,...a}),logger:m}}},cf=new Uint16Array(1),ct=class{id=cf[0]++;total=0;max=0;session;refs=0;constructor(e){e.unref(),this.session=e}retain(){if(this.session.destroyed)throw new Error("@smithy/node-http-handler - cannot acquire reference to destroyed session.");this.refs+=1,this.total+=1,this.max=Math.max(this.refs,this.max),this.session.ref()}free(){if(!this.session.destroyed&&(this.refs-=1,this.refs===0&&this.session.unref(),this.refs<0))throw new Error("@smithy/node-http-handler - ClientHttp2Session refcount at zero, cannot decrement.")}deref(){return this.session}close(){this.session.closed||this.session.close()}destroy(){this.refs=0,this.session.destroyed||this.session.destroy()}useCount(){return this.refs}},jo=class{sessions=[];maxConcurrency=0;constructor(e){this.sessions=(e??[]).map(r=>new ct(r))}poll(){let e=!1;for(let r of this.sessions){if(r.deref().destroyed){e=!0;continue}if(!this.maxConcurrency||r.useCount()<this.maxConcurrency)return r}if(e)for(let r of this.sessions)r.deref().destroyed&&this.remove(r)}offerLast(e){this.sessions.push(e)}remove(e){let r=this.sessions.indexOf(e);r>-1&&this.sessions.splice(r,1)}[Symbol.iterator](){return this.sessions[Symbol.iterator]()}setMaxConcurrency(e){this.maxConcurrency=e}destroy(e){this.remove(e),e.destroy()}},Vo=class{config;connectOptions;connectionPools=new Map;constructor(e){if(this.config=e,this.config.maxConcurrency&&this.config.maxConcurrency<=0)throw new RangeError("maxConcurrency must be greater than zero.")}lease(e,r){let o=this.getUrlString(e),n=this.getPool(o);if(!this.config.disableConcurrency&&!r.isEventStream){let m=n.poll();if(m)return m.retain(),m}let s=new ct(this.connect(o)),i=s.deref();this.config.maxConcurrency&&i.settings({maxConcurrentStreams:this.config.maxConcurrency},m=>{if(m)throw new Error("Fail to set maxConcurrentStreams to "+this.config.maxConcurrency+"when creating new session for "+e.destination.toString())});let a=()=>{this.removeFromPoolAndClose(o,s)},c=()=>{this.removeFromPoolAndCheckedDestroy(o,s)};return i.on("goaway",a),i.on("error",c),i.on("frameError",c),i.on("close",c),r.requestTimeout&&i.setTimeout(r.requestTimeout,c),n.offerLast(s),s.retain(),s}release(e,r){r.free()}createIsolatedSession(e,r){let o=this.getUrlString(e),n=new ct(this.connect(o)),s=n.deref();s.settings({maxConcurrentStreams:1});let i=()=>{n.destroy()};return s.on("error",i),s.on("frameError",i),s.on("close",i),r.requestTimeout&&s.setTimeout(r.requestTimeout,i),n.retain(),n}destroy(){for(let[e,r]of this.connectionPools){for(let o of[...r])o.destroy();this.connectionPools.delete(e)}}setMaxConcurrentStreams(e){if(e&&e<=0)throw new RangeError("maxConcurrentStreams must be greater than zero.");this.config.maxConcurrency=e;for(let r of this.connectionPools.values())r.setMaxConcurrency(e)}setDisableConcurrentStreams(e){this.config.disableConcurrency=e}setNodeHttp2ConnectOptions(e){this.connectOptions=e}debug(){let e={};for(let[r,o]of this.connectionPools){let n=[];for(let s of o)n.push({id:s.id,active:s.useCount(),maxConcurrent:s.max,totalRequests:s.total});e[r]={sessions:n}}return e}removeFromPoolAndClose(e,r){this.connectionPools.get(e)?.remove(r),r.close()}removeFromPoolAndCheckedDestroy(e,r){this.connectionPools.get(e)?.remove(r),r.destroy()}getPool(e){if(!this.connectionPools.has(e)){let r=new jo;this.config.maxConcurrency&&r.setMaxConcurrency(this.config.maxConcurrency),this.connectionPools.set(e,r)}return this.connectionPools.get(e)}getUrlString(e){return e.destination.toString()}connect(e){return this.connectOptions===void 0?zo.connect(e):zo.connect(e,this.connectOptions)}},{constants:Ma}=zo,qo=class t{config;configProvider;metadata={handlerProtocol:"h2"};connectionManager=new Vo({});static create(e){return typeof e?.handle=="function"?e:new t(e)}constructor(e){this.configProvider=new Promise((r,o)=>{typeof e=="function"?e().then(n=>{r(n||{})}).catch(o):r(e||{})})}destroy(){this.connectionManager.destroy()}async handle(e,{abortSignal:r,requestTimeout:o,isEventStream:n}={}){if(!this.config){this.config=await this.configProvider;let{disableConcurrentStreams:m,maxConcurrentStreams:f,nodeHttp2ConnectOptions:d}=this.config;this.connectionManager.setDisableConcurrentStreams(m??!1),f&&this.connectionManager.setMaxConcurrentStreams(f),d&&this.connectionManager.setNodeHttp2ConnectOptions(d)}let{requestTimeout:s,disableConcurrentStreams:i}=this.config,a=i||n,c=o??s;return new Promise((m,f)=>{let d=!1,l,p=async E=>{await l,m(E)},h=async E=>{await l,f(E)};if(r?.aborted){d=!0;let E=lr(r);h(E);return}let{hostname:g,method:y,port:b,protocol:S,query:x}=e,M="";if(e.username!=null||e.password!=null){let E=e.username??"",z=e.password??"";M=`${E}:${z}@`}let N=`${S}//${M}${g}${b?`:${b}`:""}`,O={destination:new URL(N)},Z={requestTimeout:this.config?.sessionTimeout,isEventStream:n},ue=a?this.connectionManager.createIsolatedSession(O,Z):this.connectionManager.lease(O,Z),pr=ue.deref(),P=E=>{a&&ue.destroy(),d=!0,h(E)},qe=x?Oa(x):"",Y=e.path;qe&&(Y+=`?${qe}`),e.fragment&&(Y+=`#${e.fragment}`);let w=pr.request({...e.headers,[Ma.HTTP2_HEADER_PATH]:Y,[Ma.HTTP2_HEADER_METHOD]:y});if(c&&w.setTimeout(c,()=>{w.close();let E=new Error(`Stream timed out because of no activity for ${c} ms`);E.name="TimeoutError",P(E)}),r){let E=()=>{w.close();let z=lr(r);P(z)};if(typeof r.addEventListener=="function"){let z=r;z.addEventListener("abort",E,{once:!0}),w.once("close",()=>z.removeEventListener("abort",E))}else r.onabort=E}w.on("frameError",(E,z,Ba)=>{P(new Error(`Frame type id ${E} in stream id ${Ba} has failed with code ${z}.`))}),w.on("error",P),w.on("aborted",()=>{P(new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${w.rstCode}.`))}),w.on("response",E=>{let z=new Pa({statusCode:E[":status"]??-1,headers:Ua(E),body:w});d=!0,p({response:z}),a&&pr.close()}),w.on("close",()=>{a?ue.destroy():this.connectionManager.release(O,ue),d||P(new Error("Unexpected error: http2 request did not get a response"))}),l=ka(w,e,c)})}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(o=>({...o,[e]:r}))}httpHandlerConfigs(){return this.config??{}}};ft.DEFAULT_REQUEST_TIMEOUT=af;ft.NodeHttp2Handler=qo;ft.NodeHttpHandler=Ho});var df={};ut(df,{handler:()=>uf});module.exports=gr(df);var _a=require("node:crypto"),hr=require("@aws-sdk/client-dynamodb"),$a=we(Da(),1),ff={requestHandler:new $a.NodeHttpHandler({requestTimeout:1e4,connectionTimeout:5e3}),maxAttempts:5},mf=new hr.DynamoDBClient(ff);async function uf(t,e){let r=e.awsRequestId,o=(0,_a.randomUUID)().slice(0,8),n=(c,m)=>{console.info(JSON.stringify({requestId:r,batchId:o,msg:c,...m}))},s=(c,m,f)=>{console.error(JSON.stringify({requestId:r,batchId:o,msg:c,error:String(m),...f}))};n("Processing SES batch",{recordCount:t.Records.length});let i=process.env.TABLE_NAME;if(!i)throw new Error("TABLE_NAME environment variable not set");let a=Number.parseInt(process.env.RETENTION_DAYS||"90",10);for(let c of t.Records)try{let f=JSON.parse(c.body).detail,d=f.eventType||f.notificationType,l=f.mail,p=l.messageId,h=new Date(l.timestamp).getTime(),g=l.source,y=l.destination||[],b=l.commonHeaders?.subject||"";n("Processing email event",{messageId:p,eventType:d,recipientCount:y.length});let S={},x=h;if(d==="Send"&&f.send)S={tags:l.tags||{}};else if(d==="Delivery"&&f.delivery)x=new Date(f.delivery.timestamp).getTime(),S={timestamp:f.delivery.timestamp,processingTimeMillis:f.delivery.processingTimeMillis,recipients:f.delivery.recipients,smtpResponse:f.delivery.smtpResponse,remoteMtaIp:f.delivery.remoteMtaIp};else if(d==="Open"&&f.open)x=new Date(f.open.timestamp).getTime(),S={timestamp:f.open.timestamp,userAgent:f.open.userAgent,ipAddress:f.open.ipAddress};else if(d==="Click"&&f.click)x=new Date(f.click.timestamp).getTime(),S={timestamp:f.click.timestamp,link:f.click.link,linkTags:f.click.linkTags||{},userAgent:f.click.userAgent,ipAddress:f.click.ipAddress};else if(d==="Bounce"&&f.bounce){let N=f.bounce.bounceSubType;N==="Suppressed"||N==="OnAccountSuppressionList"?(d="Suppressed",x=new Date(f.bounce.timestamp).getTime(),S={reason:N,suppressedRecipients:f.bounce.bouncedRecipients,timestamp:f.bounce.timestamp,feedbackId:f.bounce.feedbackId}):(x=new Date(f.bounce.timestamp).getTime(),S={bounceType:f.bounce.bounceType,bounceSubType:f.bounce.bounceSubType,bouncedRecipients:f.bounce.bouncedRecipients,timestamp:f.bounce.timestamp,feedbackId:f.bounce.feedbackId})}else d==="Complaint"&&f.complaint?(x=new Date(f.complaint.timestamp).getTime(),S={complainedRecipients:f.complaint.complainedRecipients,timestamp:f.complaint.timestamp,feedbackId:f.complaint.feedbackId,complaintFeedbackType:f.complaint.complaintFeedbackType,userAgent:f.complaint.userAgent}):d==="Reject"&&f.reject?S={reason:f.reject.reason}:d==="Rendering Failure"&&f.failure?S={errorMessage:f.failure.errorMessage,templateName:f.failure.templateName}:d==="DeliveryDelay"&&f.deliveryDelay?(x=new Date(f.deliveryDelay.timestamp).getTime(),S={timestamp:f.deliveryDelay.timestamp,delayType:f.deliveryDelay.delayType,expirationTime:f.deliveryDelay.expirationTime,delayedRecipients:f.deliveryDelay.delayedRecipients}):d==="Subscription"&&f.subscription&&(x=new Date(f.subscription.timestamp).getTime(),S={contactList:f.subscription.contactList,timestamp:f.subscription.timestamp,source:f.subscription.source,newTopicPreferences:f.subscription.newTopicPreferences,oldTopicPreferences:f.subscription.oldTopicPreferences});let M=a>0?Date.now()+a*24*60*60*1e3:Date.now()+365*24*60*60*1e3;await mf.send(new hr.PutItemCommand({TableName:i,Item:{messageId:{S:p},sentAt:{N:x.toString()},mailSentAt:{N:h.toString()},accountId:{S:process.env.AWS_ACCOUNT_ID||"unknown"},from:{S:g},to:{L:y.map(N=>({S:N}))},subject:{S:b},eventType:{S:d},eventData:{S:JSON.stringify(f)},additionalData:{S:JSON.stringify(S)},createdAt:{N:Date.now().toString()},expiresAt:{N:M.toString()}}})),n("Stored event",{eventType:d,messageId:p})}catch(m){s("Error processing record",m,{sqsMessageId:c.messageId})}return{statusCode:200,body:JSON.stringify({message:"Events processed successfully"})}}0&&(module.exports={handler});
17
+ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`),Date.now()}return r}constructor(e){this.configProvider=new Promise((r,o)=>{typeof e=="function"?e().then(n=>{r(this.resolveDefaultConfig(n))}).catch(o):r(this.resolveDefaultConfig(e))})}destroy(){this.config?.httpAgent?.destroy(),this.config?.httpsAgent?.destroy()}async handle(e,{abortSignal:r,requestTimeout:o}={}){this.config||(this.config=await this.configProvider);let n=this.config,s=e.protocol==="https:";return!s&&!this.config.httpAgent&&(this.config.httpAgent=await this.config.httpAgentProvider()),new Promise((i,a)=>{let c,m=-1,f=-1,d=-1,l=-1,p=-1,h=()=>{I.clearTimeout(m),I.clearTimeout(f),I.clearTimeout(d),I.clearTimeout(l),I.clearTimeout(p)},g=async x=>{await c,h(),i(x)},y=async x=>{await c,h(),a(x)};if(r?.aborted){let x=hr(r);y(x);return}let S=e.headers,b=S?(S.Expect??S.expect)==="100-continue":!1,w=s?n.httpsAgent:n.httpAgent;b&&!this.externalAgent&&(w=new(s?lr.Agent:pr)({keepAlive:!1,maxSockets:1/0})),m=I.setTimeout(()=>{this.socketWarningTimestamp=t.checkSocketUsage(w,this.socketWarningTimestamp,n.logger)},n.socketAcquisitionWarningTimeout??(n.requestTimeout??2e3)+(n.connectionTimeout??1e3));let O=e.query?Oa(e.query):"",A;if(e.username!=null||e.password!=null){let x=e.username??"",E=e.password??"";A=`${x}:${E}`}let T=e.path;O&&(T+=`?${O}`),e.fragment&&(T+=`#${e.fragment}`);let k=e.hostname??"";k[0]==="["&&k.endsWith("]")?k=e.hostname.slice(1,-1):k=e.hostname;let H={headers:e.headers,host:k,method:e.method,path:T,port:e.port,agent:w,auth:A},P=(s?lr.request:Ra)(H,x=>{let E=new Pa({statusCode:x.statusCode||-1,reason:x.statusMessage,headers:Ua(x.headers),body:x});g({response:E})});if(P.on("error",x=>{rf.includes(x.code)?y(Object.assign(x,{name:"TimeoutError"})):y(x)}),r){let x=()=>{P.destroy();let E=hr(r);y(E)};if(typeof r.addEventListener=="function"){let E=r;E.addEventListener("abort",x,{once:!0}),P.once("close",()=>E.removeEventListener("abort",x))}else r.onabort=x}let We=o??n.requestTimeout;f=of(P,y,n.connectionTimeout),d=nf(P,y,We,n.throwOnRequestTimeout,n.logger??console),l=cf(P,y,n.socketTimeout);let ee=H.agent;typeof ee=="object"&&"keepAlive"in ee&&(p=af(P,{keepAlive:ee.keepAlive,keepAliveMsecs:ee.keepAliveMsecs})),c=ka(P,e,We,this.externalAgent).catch(x=>(h(),a(x)))})}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(o=>({...o,[e]:r}))}httpHandlerConfigs(){return this.config??{}}resolveDefaultConfig(e){let{requestTimeout:r,connectionTimeout:o,socketTimeout:n,socketAcquisitionWarningTimeout:s,httpAgent:i,httpsAgent:a,throwOnRequestTimeout:c,logger:m}=e||{},f=!0,d=50;return{connectionTimeout:o,requestTimeout:r,socketTimeout:n,socketAcquisitionWarningTimeout:s,throwOnRequestTimeout:c,httpAgentProvider:async()=>{let l=require("node:http"),{Agent:p,request:h}=l.default??l;return Ra=h,pr=p,i instanceof pr||typeof i?.destroy=="function"?(this.externalAgent=!0,i):new pr({keepAlive:f,maxSockets:d,...i})},httpsAgent:a instanceof lr.Agent||typeof a?.destroy=="function"?(this.externalAgent=!0,a):new lr.Agent({keepAlive:f,maxSockets:d,...a}),logger:m}}},uf=new Uint16Array(1),mt=class{id=uf[0]++;total=0;max=0;session;refs=0;constructor(e){e.unref(),this.session=e}retain(){if(this.session.destroyed)throw new Error("@smithy/node-http-handler - cannot acquire reference to destroyed session.");this.refs+=1,this.total+=1,this.max=Math.max(this.refs,this.max),this.session.ref()}free(){if(!this.session.destroyed&&(this.refs-=1,this.refs===0&&this.session.unref(),this.refs<0))throw new Error("@smithy/node-http-handler - ClientHttp2Session refcount at zero, cannot decrement.")}deref(){return this.session}close(){this.session.closed||this.session.close()}destroy(){this.refs=0,this.session.destroyed||this.session.destroy()}useCount(){return this.refs}},jo=class{sessions=[];maxConcurrency=0;constructor(e){this.sessions=(e??[]).map(r=>new mt(r))}poll(){let e=!1;for(let r of this.sessions){if(r.deref().destroyed){e=!0;continue}if(!this.maxConcurrency||r.useCount()<this.maxConcurrency)return r}if(e)for(let r of this.sessions)r.deref().destroyed&&this.remove(r)}offerLast(e){this.sessions.push(e)}remove(e){let r=this.sessions.indexOf(e);r>-1&&this.sessions.splice(r,1)}[Symbol.iterator](){return this.sessions[Symbol.iterator]()}setMaxConcurrency(e){this.maxConcurrency=e}destroy(e){this.remove(e),e.destroy()}},Vo=class{config;connectOptions;connectionPools=new Map;constructor(e){if(this.config=e,this.config.maxConcurrency&&this.config.maxConcurrency<=0)throw new RangeError("maxConcurrency must be greater than zero.")}lease(e,r){let o=this.getUrlString(e),n=this.getPool(o);if(!this.config.disableConcurrency&&!r.isEventStream){let m=n.poll();if(m)return m.retain(),m}let s=new mt(this.connect(o)),i=s.deref();this.config.maxConcurrency&&i.settings({maxConcurrentStreams:this.config.maxConcurrency},m=>{if(m)throw new Error("Fail to set maxConcurrentStreams to "+this.config.maxConcurrency+"when creating new session for "+e.destination.toString())});let a=()=>{this.removeFromPoolAndClose(o,s)},c=()=>{this.removeFromPoolAndCheckedDestroy(o,s)};return i.on("goaway",a),i.on("error",c),i.on("frameError",c),i.on("close",c),r.requestTimeout&&i.setTimeout(r.requestTimeout,c),n.offerLast(s),s.retain(),s}release(e,r){r.free()}createIsolatedSession(e,r){let o=this.getUrlString(e),n=new mt(this.connect(o)),s=n.deref();s.settings({maxConcurrentStreams:1});let i=()=>{n.destroy()};return s.on("error",i),s.on("frameError",i),s.on("close",i),r.requestTimeout&&s.setTimeout(r.requestTimeout,i),n.retain(),n}destroy(){for(let[e,r]of this.connectionPools){for(let o of[...r])o.destroy();this.connectionPools.delete(e)}}setMaxConcurrentStreams(e){if(e&&e<=0)throw new RangeError("maxConcurrentStreams must be greater than zero.");this.config.maxConcurrency=e;for(let r of this.connectionPools.values())r.setMaxConcurrency(e)}setDisableConcurrentStreams(e){this.config.disableConcurrency=e}setNodeHttp2ConnectOptions(e){this.connectOptions=e}debug(){let e={};for(let[r,o]of this.connectionPools){let n=[];for(let s of o)n.push({id:s.id,active:s.useCount(),maxConcurrent:s.max,totalRequests:s.total});e[r]={sessions:n}}return e}removeFromPoolAndClose(e,r){this.connectionPools.get(e)?.remove(r),r.close()}removeFromPoolAndCheckedDestroy(e,r){this.connectionPools.get(e)?.remove(r),r.destroy()}getPool(e){if(!this.connectionPools.has(e)){let r=new jo;this.config.maxConcurrency&&r.setMaxConcurrency(this.config.maxConcurrency),this.connectionPools.set(e,r)}return this.connectionPools.get(e)}getUrlString(e){return e.destination.toString()}connect(e){return this.connectOptions===void 0?zo.connect(e):zo.connect(e,this.connectOptions)}},{constants:Ma}=zo,qo=class t{config;configProvider;metadata={handlerProtocol:"h2"};connectionManager=new Vo({});static create(e){return typeof e?.handle=="function"?e:new t(e)}constructor(e){this.configProvider=new Promise((r,o)=>{typeof e=="function"?e().then(n=>{r(n||{})}).catch(o):r(e||{})})}destroy(){this.connectionManager.destroy()}async handle(e,{abortSignal:r,requestTimeout:o,isEventStream:n}={}){if(!this.config){this.config=await this.configProvider;let{disableConcurrentStreams:m,maxConcurrentStreams:f,nodeHttp2ConnectOptions:d}=this.config;this.connectionManager.setDisableConcurrentStreams(m??!1),f&&this.connectionManager.setMaxConcurrentStreams(f),d&&this.connectionManager.setNodeHttp2ConnectOptions(d)}let{requestTimeout:s,disableConcurrentStreams:i}=this.config,a=i||n,c=o??s;return new Promise((m,f)=>{let d=!1,l,p=async E=>{await l,m(E)},h=async E=>{await l,f(E)};if(r?.aborted){d=!0;let E=hr(r);h(E);return}let{hostname:g,method:y,port:S,protocol:b,query:w}=e,O="";if(e.username!=null||e.password!=null){let E=e.username??"",j=e.password??"";O=`${E}:${j}@`}let A=`${b}//${O}${g}${S?`:${S}`:""}`,T={destination:new URL(A)},k={requestTimeout:this.config?.sessionTimeout,isEventStream:n},H=a?this.connectionManager.createIsolatedSession(T,k):this.connectionManager.lease(T,k),Ge=H.deref(),P=E=>{a&&H.destroy(),d=!0,h(E)},We=w?Oa(w):"",ee=e.path;We&&(ee+=`?${We}`),e.fragment&&(ee+=`#${e.fragment}`);let x=Ge.request({...e.headers,[Ma.HTTP2_HEADER_PATH]:ee,[Ma.HTTP2_HEADER_METHOD]:y});if(c&&x.setTimeout(c,()=>{x.close();let E=new Error(`Stream timed out because of no activity for ${c} ms`);E.name="TimeoutError",P(E)}),r){let E=()=>{x.close();let j=hr(r);P(j)};if(typeof r.addEventListener=="function"){let j=r;j.addEventListener("abort",E,{once:!0}),x.once("close",()=>j.removeEventListener("abort",E))}else r.onabort=E}x.on("frameError",(E,j,za)=>{P(new Error(`Frame type id ${E} in stream id ${za} has failed with code ${j}.`))}),x.on("error",P),x.on("aborted",()=>{P(new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${x.rstCode}.`))}),x.on("response",E=>{let j=new Pa({statusCode:E[":status"]??-1,headers:Ua(E),body:x});d=!0,p({response:j}),a&&Ge.close()}),x.on("close",()=>{a?H.destroy():this.connectionManager.release(T,H),d||P(new Error("Unexpected error: http2 request did not get a response"))}),l=ka(x,e,c)})}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(o=>({...o,[e]:r}))}httpHandlerConfigs(){return this.config??{}}};ut.DEFAULT_REQUEST_TIMEOUT=mf;ut.NodeHttp2Handler=qo;ut.NodeHttpHandler=Ho});var pf={};lt(pf,{handler:()=>lf,ledgerEntryFor:()=>La,recipientEmails:()=>Fa});module.exports=gr(pf);var $a=require("node:crypto"),qe=require("@aws-sdk/client-dynamodb"),Ba=we(Da(),1),df={requestHandler:new Ba.NodeHttpHandler({requestTimeout:1e4,connectionTimeout:5e3}),maxAttempts:5},_a=new qe.DynamoDBClient(df);function La(t){let e=t.eventType||t.notificationType;if(e==="Bounce"&&t.bounce){let r=t.bounce.bounceSubType;return r==="EmailValidationSuppressed"?{reason:"validation",detail:r}:r==="Suppressed"||r==="OnAccountSuppressionList"?{reason:"bounce",detail:r}:t.bounce.bounceType==="Permanent"?{reason:"bounce",detail:r}:null}return e==="Complaint"&&t.complaint?{reason:"complaint",detail:t.complaint.complaintFeedbackType}:null}function Fa(t){return Array.isArray(t)?t.map(e=>e&&typeof e=="object"?e.emailAddress:void 0).filter(e=>typeof e=="string").map(e=>e.toLowerCase().trim()).filter(e=>e.length>0):[]}async function lf(t,e){let r=e.awsRequestId,o=(0,$a.randomUUID)().slice(0,8),n=(c,m)=>{console.info(JSON.stringify({requestId:r,batchId:o,msg:c,...m}))},s=(c,m,f)=>{console.error(JSON.stringify({requestId:r,batchId:o,msg:c,error:String(m),...f}))};n("Processing SES batch",{recordCount:t.Records.length});let i=process.env.TABLE_NAME;if(!i)throw new Error("TABLE_NAME environment variable not set");let a=Number.parseInt(process.env.RETENTION_DAYS||"90",10);for(let c of t.Records)try{let f=JSON.parse(c.body).detail,d=f.eventType||f.notificationType,l=f.mail,p=l.messageId,h=new Date(l.timestamp).getTime(),g=l.source,y=l.destination||[],S=l.commonHeaders?.subject||"";n("Processing email event",{messageId:p,eventType:d,recipientCount:y.length});let b={},w=h;if(d==="Send"&&f.send)b={tags:l.tags||{}};else if(d==="Delivery"&&f.delivery)w=new Date(f.delivery.timestamp).getTime(),b={timestamp:f.delivery.timestamp,processingTimeMillis:f.delivery.processingTimeMillis,recipients:f.delivery.recipients,smtpResponse:f.delivery.smtpResponse,remoteMtaIp:f.delivery.remoteMtaIp};else if(d==="Open"&&f.open)w=new Date(f.open.timestamp).getTime(),b={timestamp:f.open.timestamp,userAgent:f.open.userAgent,ipAddress:f.open.ipAddress};else if(d==="Click"&&f.click)w=new Date(f.click.timestamp).getTime(),b={timestamp:f.click.timestamp,link:f.click.link,linkTags:f.click.linkTags||{},userAgent:f.click.userAgent,ipAddress:f.click.ipAddress};else if(d==="Bounce"&&f.bounce){let T=f.bounce.bounceSubType;T==="Suppressed"||T==="OnAccountSuppressionList"?(d="Suppressed",w=new Date(f.bounce.timestamp).getTime(),b={reason:T,suppressedRecipients:f.bounce.bouncedRecipients,timestamp:f.bounce.timestamp,feedbackId:f.bounce.feedbackId}):(w=new Date(f.bounce.timestamp).getTime(),b={bounceType:f.bounce.bounceType,bounceSubType:f.bounce.bounceSubType,bouncedRecipients:f.bounce.bouncedRecipients,timestamp:f.bounce.timestamp,feedbackId:f.bounce.feedbackId})}else d==="Complaint"&&f.complaint?(w=new Date(f.complaint.timestamp).getTime(),b={complainedRecipients:f.complaint.complainedRecipients,timestamp:f.complaint.timestamp,feedbackId:f.complaint.feedbackId,complaintFeedbackType:f.complaint.complaintFeedbackType,userAgent:f.complaint.userAgent}):d==="Reject"&&f.reject?b={reason:f.reject.reason}:d==="Rendering Failure"&&f.failure?b={errorMessage:f.failure.errorMessage,templateName:f.failure.templateName}:d==="DeliveryDelay"&&f.deliveryDelay?(w=new Date(f.deliveryDelay.timestamp).getTime(),b={timestamp:f.deliveryDelay.timestamp,delayType:f.deliveryDelay.delayType,expirationTime:f.deliveryDelay.expirationTime,delayedRecipients:f.deliveryDelay.delayedRecipients}):d==="Subscription"&&f.subscription&&(w=new Date(f.subscription.timestamp).getTime(),b={contactList:f.subscription.contactList,timestamp:f.subscription.timestamp,source:f.subscription.source,newTopicPreferences:f.subscription.newTopicPreferences,oldTopicPreferences:f.subscription.oldTopicPreferences});let O=a>0?Date.now()+a*24*60*60*1e3:Date.now()+365*24*60*60*1e3;await _a.send(new qe.PutItemCommand({TableName:i,Item:{messageId:{S:p},sentAt:{N:w.toString()},mailSentAt:{N:h.toString()},accountId:{S:process.env.AWS_ACCOUNT_ID||"unknown"},from:{S:g},to:{L:y.map(T=>({S:T}))},subject:{S},eventType:{S:d},eventData:{S:JSON.stringify(f)},additionalData:{S:JSON.stringify(b)},createdAt:{N:Date.now().toString()},expiresAt:{N:O.toString()}}})),n("Stored event",{eventType:d,messageId:p});let A=La(f);if(A){let T=Fa(A.reason==="complaint"?f.complaint?.complainedRecipients:f.bounce?.bouncedRecipients),k=f.bounce?.feedbackId||f.complaint?.feedbackId;T.length===0&&n("No recipients for suppression ledger",{messageId:p,reason:A.reason});for(let H of T)try{await _a.send(new qe.UpdateItemCommand({TableName:i,Key:{messageId:{S:`SUPPRESSION#${H}`},sentAt:{N:"0"}},UpdateExpression:"SET #et = :et, #em = :em, #r = :r, #src = :src, #sa = :sa, #fsa = if_not_exists(#fsa, :sa)"+(A.detail?", #d = :d":"")+(k?", #fid = :fid":""),ExpressionAttributeNames:{"#et":"eventType","#em":"email","#r":"reason","#src":"source","#sa":"suppressedAt","#fsa":"firstSuppressedAt",...A.detail?{"#d":"detail"}:{},...k?{"#fid":"feedbackId"}:{}},ExpressionAttributeValues:{":et":{S:"Suppressed"},":em":{S:H},":r":{S:A.reason},":src":{S:"ses_event"},":sa":{N:w.toString()},...A.detail?{":d":{S:A.detail}}:{},...k?{":fid":{S:k}}:{}}})),n("Recorded suppression ledger entry",{messageId:p,reason:A.reason})}catch(Ge){s("Error recording suppression ledger entry",Ge,{messageId:p,reason:A.reason})}}}catch(m){s("Error processing record",m,{sqsMessageId:c.messageId})}return{statusCode:200,body:JSON.stringify({message:"Events processed successfully"})}}0&&(module.exports={handler,ledgerEntryFor,recipientEmails});