@beesolve/analytics-processor 0.2.6 → 0.4.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,2 +1,2 @@
1
1
  /* CommonJS polyfills */import { fileURLToPath } from 'node:url';import { createRequire } from 'node:module';const __filename = fileURLToPath(import.meta.url);const __dirname = fileURLToPath(new URL('.', import.meta.url));const require = createRequire(import.meta.url);/* end of CommonJS polyfills */
2
- import{a as vr}from"./chunk-U7KUF4SE.mjs";import"./chunk-VYXCTSUL.mjs";import{a as cr,c as lr,h as pr,i as fr,j as dr,k as yr,l as hr}from"./chunk-2C6L2MOS.mjs";import{b as Fn}from"./chunk-LB33VBGK.mjs";import{a as mr}from"./chunk-YY2HYMK3.mjs";import{A as oe,B as Wn,C as Ut,D as qn,E as zn,F as Hn,G as Xn,L as Jn,O as Qn,R as Zn,S as Yn,T as er,V as Ce,W as tr,a as De,aa as nr,b as hn,d as vn,f as xn,g as bn,h as In,ha as rr,i as gn,ja as ir,k as En,l as Sn,n as _n,na as sr,r as Nn,s as On,sa as or,u as Ln,w as Un,xa as ar,y as Mn,ya as ur,z as Bn}from"./chunk-C3D3OF2Y.mjs";import{i as Kn,j as Vn,k as jn}from"./chunk-YMGL4RSC.mjs";import{n as N,o as kn,p as wn,s as Cn,t as Rn,u as Pn,v as $n}from"./chunk-KRS5YV2Z.mjs";import{B as Gn,b as yn,d as Ot,e as Lt,g as ke,h as Tn,i as we,j as An,z as Dn}from"./chunk-3UGRDNDZ.mjs";import{e as fn,k as se,l as dn}from"./chunk-OC3UN3OS.mjs";import{a as r,b as ie,c as Ns}from"./chunk-CFZ5JWD3.mjs";var Fr=ie((ap,Gr)=>{function B(e){Object.defineProperty(this,"_next",{writable:!1,enumerable:!1,value:e}),this.done=!1}r(B,"Iterator");B.prototype.next=function(){if(this.done)return{done:!0};var e=this._next();return e.done&&(this.done=!0),e};typeof Symbol<"u"&&(B.prototype[Symbol.iterator]=function(){return this});B.of=function(){var e=arguments,t=e.length,n=0;return new B(function(){return n>=t?{done:!0}:{done:!1,value:e[n++]}})};B.empty=function(){var e=new B(null);return e.done=!0,e};B.is=function(e){return e instanceof B?!0:typeof e=="object"&&e!==null&&typeof e.next=="function"};Gr.exports=B});var qt=ie((cp,Wr)=>{var Kr=typeof ArrayBuffer<"u",Vr=typeof Symbol<"u";function jr(e,t){var n,i,s,o,a;if(!e)throw new Error("obliterator/forEach: invalid iterable.");if(typeof t!="function")throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(e)||Kr&&ArrayBuffer.isView(e)||typeof e=="string"||e.toString()==="[object Arguments]"){for(s=0,o=e.length;s<o;s++)t(e[s],s);return}if(typeof e.forEach=="function"){e.forEach(t);return}if(Vr&&Symbol.iterator in e&&typeof e.next!="function"&&(e=e[Symbol.iterator]()),typeof e.next=="function"){for(n=e,s=0;a=n.next(),a.done!==!0;)t(a.value,s),s++;return}for(i in e)e.hasOwnProperty(i)&&t(e[i],i)}r(jr,"forEach");jr.forEachWithNullKeys=function(e,t){var n,i,s,o,a;if(!e)throw new Error("obliterator/forEachWithNullKeys: invalid iterable.");if(typeof t!="function")throw new Error("obliterator/forEachWithNullKeys: expecting a callback.");if(Array.isArray(e)||Kr&&ArrayBuffer.isView(e)||typeof e=="string"||e.toString()==="[object Arguments]"){for(s=0,o=e.length;s<o;s++)t(e[s],null);return}if(e instanceof Set){e.forEach(function(c){t(c,null)});return}if(typeof e.forEach=="function"){e.forEach(t);return}if(Vr&&Symbol.iterator in e&&typeof e.next!="function"&&(e=e[Symbol.iterator]()),typeof e.next=="function"){for(n=e,s=0;a=n.next(),a.done!==!0;)t(a.value,null),s++;return}for(i in e)e.hasOwnProperty(i)&&t(e[i],i)};Wr.exports=jr});var zt=ie(O=>{var Ys=Math.pow(2,8)-1,eo=Math.pow(2,16)-1,to=Math.pow(2,32)-1,no=Math.pow(2,7)-1,ro=Math.pow(2,15)-1,io=Math.pow(2,31)-1;O.getPointerArray=function(e){var t=e-1;return t<=Ys?Uint8Array:t<=eo?Uint16Array:t<=to?Uint32Array:Float64Array};O.getSignedPointerArray=function(e){var t=e-1;return t<=no?Int8Array:t<=ro?Int16Array:t<=io?Int32Array:Float64Array};O.getNumberType=function(e){return e===(e|0)?Math.sign(e)===-1?e<=127&&e>=-128?Int8Array:e<=32767&&e>=-32768?Int16Array:Int32Array:e<=255?Uint8Array:e<=65535?Uint16Array:Uint32Array:Float64Array};var so={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};O.getMinimalRepresentation=function(e,t){var n=null,i=0,s,o,a,c,d;for(c=0,d=e.length;c<d;c++)a=t?t(e[c]):e[c],o=O.getNumberType(a),s=so[o.name],s>i&&(i=s,n=o);return n};O.isTypedArray=function(e){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView(e)};O.concat=function(){var e=0,t,n,i;for(t=0,i=arguments.length;t<i;t++)e+=arguments[t].length;var s=new arguments[0].constructor(e);for(t=0,n=0;t<i;t++)s.set(arguments[t],n),n+=arguments[t].length;return s};O.indices=function(e){for(var t=O.getPointerArray(e),n=new t(e),i=0;i<e;i++)n[i]=i;return n}});var Hr=ie(me=>{var qr=qt(),zr=zt();function oo(e){return Array.isArray(e)||zr.isTypedArray(e)}r(oo,"isArrayLike");function Ht(e){if(typeof e.length=="number")return e.length;if(typeof e.size=="number")return e.size}r(Ht,"guessLength");function ao(e){var t=Ht(e),n=typeof t=="number"?new Array(t):[],i=0;return qr(e,function(s){n[i++]=s}),n}r(ao,"toArray");function uo(e){var t=Ht(e),n=typeof t=="number"?zr.getPointerArray(t):Array,i=typeof t=="number"?new Array(t):[],s=typeof t=="number"?new n(t):[],o=0;return qr(e,function(a){i[o]=a,s[o]=o++}),[i,s]}r(uo,"toArrayWithIndices");me.isArrayLike=oo;me.guessLength=Ht;me.toArray=ao;me.toArrayWithIndices=uo});var Jr=ie((dp,Xr)=>{var Xt=Fr(),co=qt(),lo=zt(),po=Hr();function I(e,t,n){if(arguments.length<2&&(n=e,e=null,t=null),this.capacity=n,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-cache: capacity should be positive number.");var i=lo.getPointerArray(n);this.forward=new i(n),this.backward=new i(n),this.K=typeof e=="function"?new e(n):new Array(n),this.V=typeof t=="function"?new t(n):new Array(n),this.size=0,this.head=0,this.tail=0,this.items={}}r(I,"LRUCache");I.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items={}};I.prototype.splayOnTop=function(e){var t=this.head;if(this.head===e)return this;var n=this.backward[e],i=this.forward[e];return this.tail===e?this.tail=n:this.backward[i]=n,this.forward[n]=i,this.backward[t]=e,this.head=e,this.forward[e]=t,this};I.prototype.set=function(e,t){var n=this.items[e];if(typeof n<"u"){this.splayOnTop(n),this.V[n]=t;return}this.size<this.capacity?n=this.size++:(n=this.tail,this.tail=this.backward[n],delete this.items[this.K[n]]),this.items[e]=n,this.K[n]=e,this.V[n]=t,this.forward[n]=this.head,this.backward[this.head]=n,this.head=n};I.prototype.setpop=function(e,t){var n=null,i=null,s=this.items[e];return typeof s<"u"?(this.splayOnTop(s),n=this.V[s],this.V[s]=t,{evicted:!1,key:e,value:n}):(this.size<this.capacity?s=this.size++:(s=this.tail,this.tail=this.backward[s],n=this.V[s],i=this.K[s],delete this.items[this.K[s]]),this.items[e]=s,this.K[s]=e,this.V[s]=t,this.forward[s]=this.head,this.backward[this.head]=s,this.head=s,i?{evicted:!0,key:i,value:n}:null)};I.prototype.has=function(e){return e in this.items};I.prototype.get=function(e){var t=this.items[e];if(!(typeof t>"u"))return this.splayOnTop(t),this.V[t]};I.prototype.peek=function(e){var t=this.items[e];if(!(typeof t>"u"))return this.V[t]};I.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var n=0,i=this.size,s=this.head,o=this.K,a=this.V,c=this.forward;n<i;)e.call(t,a[s],o[s],this),s=c[s],n++};I.prototype.keys=function(){var e=0,t=this.size,n=this.head,i=this.K,s=this.forward;return new Xt(function(){if(e>=t)return{done:!0};var o=i[n];return e++,e<t&&(n=s[n]),{done:!1,value:o}})};I.prototype.values=function(){var e=0,t=this.size,n=this.head,i=this.V,s=this.forward;return new Xt(function(){if(e>=t)return{done:!0};var o=i[n];return e++,e<t&&(n=s[n]),{done:!1,value:o}})};I.prototype.entries=function(){var e=0,t=this.size,n=this.head,i=this.K,s=this.V,o=this.forward;return new Xt(function(){if(e>=t)return{done:!0};var a=i[n],c=s[n];return e++,e<t&&(n=o[n]),{done:!1,value:[a,c]}})};typeof Symbol<"u"&&(I.prototype[Symbol.iterator]=I.prototype.entries);I.prototype.inspect=function(){for(var e=new Map,t=this.entries(),n;n=t.next(),!n.done;)e.set(n.value[0],n.value[1]);return Object.defineProperty(e,"constructor",{value:I,enumerable:!1}),e};typeof Symbol<"u"&&(I.prototype[Symbol.for("nodejs.util.inspect.custom")]=I.prototype.inspect);I.from=function(e,t,n,i){if(arguments.length<2){if(i=po.guessLength(e),typeof i!="number")throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(i=t,t=null,n=null);var s=new I(t,n,i);return co(e,function(o,a){s.set(a,o)}),s};Xr.exports=I});var Re,Os={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function Mt(e){return!e&&!Re?Os:{lang:e?.lang??Re?.lang,message:e?.message,abortEarly:e?.abortEarly??Re?.abortEarly,abortPipeEarly:e?.abortPipeEarly??Re?.abortPipeEarly}}r(Mt,"getGlobalConfig");var Ls;function Us(e){return Ls?.get(e)}r(Us,"getGlobalMessage");var Ms;function Bs(e){return Ms?.get(e)}r(Bs,"getSchemaMessage");var Gs;function Fs(e,t){return Gs?.get(e)?.get(t)}r(Fs,"getSpecificMessage");function xr(e){let t=typeof e;return t==="string"?`"${e}"`:t==="number"||t==="bigint"||t==="boolean"?`${e}`:t==="object"||t==="function"?(e&&Object.getPrototypeOf(e)?.constructor?.name)??"null":t}r(xr,"_stringify");function ae(e,t,n,i,s){let o=s&&"input"in s?s.input:n.value,a=s?.expected??e.expects??null,c=s?.received??xr(o),d={kind:e.kind,type:e.type,input:o,expected:a,received:c,message:`Invalid ${t}: ${a?`Expected ${a} but r`:"R"}eceived ${c}`,requirement:e.requirement,path:s?.path,issues:s?.issues,lang:i.lang,abortEarly:i.abortEarly,abortPipeEarly:i.abortPipeEarly},g=e.kind==="schema",E=s?.message??e.message??Fs(e.reference,d.lang)??(g?Bs(d.lang):null)??i.message??Us(d.lang);E!==void 0&&(d.message=typeof E=="function"?E(d):E),g&&(n.typed=!1),n.issues?n.issues.push(d):n.issues=[d]}r(ae,"_addIssue");function Ks(e,t){let n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:n[0]??"never"}r(Ks,"_joinExpects");function ue(e){return e["~standard"]={version:1,vendor:"valibot",validate:r(t=>e["~run"]({value:t},Mt()),"validate")},e}r(ue,"_standardSchema");function Vs(e){if(e.path){let t="";for(let n of e.path)if(typeof n.key=="string"||typeof n.key=="number")t?t+=`.${n.key}`:t+=n.key;else return null;return t}return null}r(Vs,"getDotPath");var js=class extends Error{static{r(this,"ValiError")}constructor(e){super(e[0].message),this.name="ValiError",this.issues=e}};var bl=new RegExp("^(?:[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation}))*)+$","u");function Ws(e,t,n){return typeof e.fallback=="function"?e.fallback(t,n):e.fallback}r(Ws,"getFallback");function Pe(e){let t={};for(let n of e)if(n.path){let i=Vs(n);i?(t.nested||(t.nested={}),Object.prototype.hasOwnProperty.call(t.nested,i)?t.nested[i].push(n.message):t.nested[i]=[n.message]):t.other?t.other.push(n.message):t.other=[n.message]}else t.root?t.root.push(n.message):t.root=[n.message];return t}r(Pe,"flatten");function br(e,t,n){return typeof e.default=="function"?e.default(t,n):e.default}r(br,"getDefault");function b(e){return ue({kind:"schema",type:"number",reference:b,expects:"number",async:!1,message:e,"~run"(t,n){return typeof t.value=="number"&&!isNaN(t.value)?t.typed=!0:ae(this,"type",t,n),t}})}r(b,"number");function M(e,t){return ue({kind:"schema",type:"object",reference:M,expects:"Object",async:!1,entries:e,message:t,"~run"(n,i){let s=n.value;if(s&&typeof s=="object"){n.typed=!0,n.value={};for(let o in this.entries){let a=this.entries[o];if(o in s||(a.type==="exact_optional"||a.type==="optional"||a.type==="nullish")&&a.default!==void 0){let c=o in s?s[o]:br(a),d=a["~run"]({value:c},i);if(d.issues){let g={type:"object",origin:"value",input:s,key:o,value:c};for(let E of d.issues)E.path?E.path.unshift(g):E.path=[g],n.issues?.push(E);if(n.issues||(n.issues=d.issues),i.abortEarly){n.typed=!1;break}}d.typed||(n.typed=!1),n.value[o]=d.value}else if(a.fallback!==void 0)n.value[o]=Ws(a);else if(a.type!=="exact_optional"&&a.type!=="optional"&&a.type!=="nullish"&&(ae(this,"key",n,i,{input:void 0,expected:`"${o}"`,path:[{type:"object",origin:"key",input:s,key:o,value:s[o]}]}),i.abortEarly))break}}else ae(this,"type",n,i);return n}})}r(M,"object");function C(e,t){return ue({kind:"schema",type:"optional",reference:C,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,"~run"(n,i){return n.value===void 0&&(this.default!==void 0&&(n.value=br(this,n,i)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,i)}})}r(C,"optional");function V(e,t){return ue({kind:"schema",type:"picklist",reference:V,expects:Ks(e.map(xr),"|"),async:!1,options:e,message:t,"~run"(n,i){return this.options.includes(n.value)?n.typed=!0:ae(this,"type",n,i),n}})}r(V,"picklist");function S(e){return ue({kind:"schema",type:"string",reference:S,expects:"string",async:!1,message:e,"~run"(t,n){return typeof t.value=="string"?t.typed=!0:ae(this,"type",t,n),t}})}r(S,"string");function Ir(e,t,n){let i=e["~run"]({value:t},Mt(n));if(i.issues)throw new js(i.issues);return i.value}r(Ir,"parse");function $e(e,t,n){let i=e["~run"]({value:t},Mt(n));return{typed:i.typed,success:!i.issues,output:i.value,issues:i.issues}}r($e,"safeParse");var z=class e{static{r(this,"NumberValue")}value;constructor(t){typeof t=="object"&&"N"in t?this.value=String(t.N):this.value=String(t);let n=typeof t.valueOf()=="number"?t.valueOf():0;if(n>Number.MAX_SAFE_INTEGER||n<Number.MIN_SAFE_INTEGER||Math.abs(n)===1/0||Number.isNaN(n))throw new Error(`NumberValue should not be initialized with an imprecise number=${n}. Use a string instead.`)}static from(t){return new e(t)}toAttributeValue(){return{N:this.toString()}}toBigInt(){let t=this.toString();return BigInt(t)}toString(){return String(this.value)}valueOf(){return this.toString()}};var ce=r((e,t)=>{if(e===void 0)throw new Error("Pass options.removeUndefinedValues=true to remove undefined values from map/array/set.");if(e===null&&typeof e=="object")return Oe();if(Array.isArray(e))return qs(e,t);if(e?.constructor?.name==="Set")return zs(e,t);if(e?.constructor?.name==="Map")return Hs(e,t);if(e?.constructor?.name==="Object"||!e.constructor&&typeof e=="object")return gr(e,t);if(Dr(e))return e.length===0&&t?.convertEmptyValues?Oe():Sr(e);if(typeof e=="boolean"||e?.constructor?.name==="Boolean")return{BOOL:e.valueOf()};if(typeof e=="number"||e?.constructor?.name==="Number")return Ar(e,t);if(e instanceof z)return e.toAttributeValue();if(typeof e=="bigint")return Tr(e);if(typeof e=="string"||e?.constructor?.name==="String")return e.length===0&&t?.convertEmptyValues?Oe():_r(e);if(t?.convertClassInstanceToMap&&typeof e=="object")return gr(e,t);throw new Error(`Unsupported type passed: ${e}. Pass options.convertClassInstanceToMap=true to marshall typeof object as map attribute.`)},"convertToAttr"),qs=r((e,t)=>({L:e.filter(n=>typeof n!="function"&&(!t?.removeUndefinedValues||t?.removeUndefinedValues&&n!==void 0)).map(n=>ce(n,t))}),"convertToListAttr"),zs=r((e,t)=>{let n=t?.removeUndefinedValues?new Set([...e].filter(s=>s!==void 0)):e;if(!t?.removeUndefinedValues&&n.has(void 0))throw new Error("Pass options.removeUndefinedValues=true to remove undefined values from map/array/set.");if(n.size===0){if(t?.convertEmptyValues)return Oe();throw new Error("Pass a non-empty set, or options.convertEmptyValues=true.")}let i=n.values().next().value;if(i instanceof z)return{NS:Array.from(n).map(s=>s.toString())};if(typeof i=="number")return{NS:Array.from(n).map(s=>Ar(s,t)).map(s=>s.N)};if(typeof i=="bigint")return{NS:Array.from(n).map(Tr).map(s=>s.N)};if(typeof i=="string")return{SS:Array.from(n).map(_r).map(s=>s.S)};if(Dr(i))return{BS:Array.from(n).map(Sr).map(s=>s.B)};throw new Error("Only Number Set (NS), Binary Set (BS) or String Set (SS) are allowed.")},"convertToSetAttr"),Hs=r((e,t)=>({M:(n=>{let i={};for(let[s,o]of n)typeof o!="function"&&(o!==void 0||!t?.removeUndefinedValues)&&(i[s]=ce(o,t));return i})(e)}),"convertToMapAttrFromIterable"),gr=r((e,t)=>({M:(n=>{let i={};for(let s in n){let o=n[s];typeof o!="function"&&(o!==void 0||!t?.removeUndefinedValues)&&(i[s]=ce(o,t))}return i})(e)}),"convertToMapAttrFromEnumerableProps"),Oe=r(()=>({NULL:!0}),"convertToNullAttr"),Sr=r(e=>({B:e}),"convertToBinaryAttr"),_r=r(e=>({S:e.toString()}),"convertToStringAttr"),Tr=r(e=>({N:e.toString()}),"convertToBigIntAttr"),Er=r(e=>{throw new Error(`${e} Use NumberValue from @aws-sdk/lib-dynamodb.`)},"validateBigIntAndThrow"),Ar=r((e,t)=>{if([Number.NaN,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY].map(n=>n.toString()).includes(e.toString()))throw new Error(`Special numeric value ${e.toString()} is not allowed`);return t?.allowImpreciseNumbers||(Number(e)>Number.MAX_SAFE_INTEGER?Er(`Number ${e.toString()} is greater than Number.MAX_SAFE_INTEGER.`):Number(e)<Number.MIN_SAFE_INTEGER&&Er(`Number ${e.toString()} is lesser than Number.MIN_SAFE_INTEGER.`)),{N:e.toString()}},"convertToNumberAttr"),Dr=r(e=>{let t=["ArrayBuffer","Blob","Buffer","DataView","File","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];return e?.constructor?t.includes(e.constructor.name):!1},"isBinary");var le=r((e,t)=>{for(let[n,i]of Object.entries(e))if(i!==void 0)switch(n){case"NULL":return null;case"BOOL":return!!i;case"N":return kr(i,t);case"B":return Cr(i);case"S":return wr(i);case"L":return Xs(i,t);case"M":return Js(i,t);case"NS":return new Set(i.map(s=>kr(s,t)));case"BS":return new Set(i.map(Cr));case"SS":return new Set(i.map(wr));default:throw new Error(`Unsupported type passed: ${n}`)}throw new Error(`No value defined: ${JSON.stringify(e)}`)},"convertToNative"),kr=r((e,t)=>{if(typeof t?.wrapNumbers=="function")return t?.wrapNumbers(e);if(t?.wrapNumbers)return z.from(e);let n=Number(e),i=[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY];if((n>Number.MAX_SAFE_INTEGER||n<Number.MIN_SAFE_INTEGER)&&!i.includes(n))if(typeof BigInt=="function")try{return BigInt(e)}catch{throw new Error(`${e} can't be converted to BigInt. Set options.wrapNumbers to get string value.`)}else throw new Error(`${e} is outside SAFE_INTEGER bounds. Set options.wrapNumbers to get string value.`);return n},"convertNumber"),wr=r(e=>e,"convertString"),Cr=r(e=>e,"convertBinary"),Xs=r((e,t)=>e.map(n=>le(n,t)),"convertList"),Js=r((e,t)=>Object.entries(e).reduce((n,[i,s])=>(n[i]=le(s,t),n),{}),"convertMap");function Bt(e,t){let n=ce(e,t),[i,s]=Object.entries(n)[0];switch(i){case"M":case"L":return t?.convertTopLevelContainer?n:s;default:return n}}r(Bt,"marshall");var Gt=r((e,t)=>t?.convertWithoutMapWrapper?le(e,t):le({M:e},t),"unmarshall");var Z=null,m={},A=[],Rr="*",Le=r((e,t,n)=>{if(e!==void 0){if(n==null)return t(e);{let i=Object.keys(n),s=i.length===1&&i[0]===Rr,o=i.length>=1&&!s,a=i.length===0;if(o)return Ft(e,t,n);if(a)return Qs(e,t,Z);if(s)return Object.entries(e??{}).reduce((c,[d,g])=>(typeof g!="function"&&(c[d]=Le(g,t,n[Rr])),c),Array.isArray(e)?[]:{})}}},"processObj"),Ft=r((e,t,n)=>{let i;if(Array.isArray(e))i=e.filter(s=>typeof s!="function");else{i={};for(let[s,o]of Object.entries(e))typeof o!="function"&&(i[s]=o)}for(let[s,o]of Object.entries(n)){if(typeof e[s]=="function")continue;let a=Le(e[s],t,o);a!==void 0&&typeof a!="function"&&(i[s]=a)}return i},"processKeysInObj"),Qs=r((e,t,n)=>Array.isArray(e)?e.filter(i=>typeof i!="function").map(i=>Le(i,t,n)):Object.entries(e).reduce((i,[s,o])=>{if(typeof o=="function")return i;let a=Le(o,t,n);return a!==void 0&&typeof a!="function"&&(i[s]=a),i},{}),"processAllKeysInObj"),Pr=r((e,t,n)=>Ft(e,r(s=>Bt(s,n),"marshallFunc"),t),"marshallInput"),$r=r((e,t,n)=>Ft(e,r(s=>Gt(s,n),"unmarshallFunc"),t),"unmarshallOutput");var x=class extends hn{static{r(this,"DynamoDBDocumentClientCommand")}addMarshallingMiddleware(t){let{marshallOptions:n={},unmarshallOptions:i={}}=t.translateConfig||{};n.convertTopLevelContainer=n.convertTopLevelContainer??!0,i.convertWithoutMapWrapper=i.convertWithoutMapWrapper??!0,this.clientCommand.middlewareStack.addRelativeTo((s,o)=>async a=>(Xn(o,"DDB_MAPPER","d"),s({...a,input:Pr(a.input,this.inputKeyNodes,n)})),{name:"DocumentMarshall",relation:"before",toMiddleware:"serializerMiddleware",override:!0}),this.clientCommand.middlewareStack.addRelativeTo((s,o)=>async a=>{let c=await s(a);return c.output=$r(c.output,this.outputKeyNodes,i),c},{name:"DocumentUnmarshall",relation:"before",toMiddleware:"deserializerMiddleware",override:!0})}};var Ue="preferred",Zs=["disabled","preferred","required"];function pe(e){return Zs.includes(e)}r(pe,"validateAccountIdEndpointMode");var Kt=r(e=>{let{accountIdEndpointMode:t}=e,n=se(t??Ue);return Object.assign(e,{accountIdEndpointMode:r(async()=>{let i=await n();if(!pe(i))throw new Error(`Invalid value for accountIdEndpointMode: ${i}. Valid values are: "required", "preferred", "disabled".`);return i},"accountIdEndpointMode")})},"resolveAccountIdEndpointModeConfig");var Nr="Invalid AccountIdEndpointMode value",Or=r(e=>{throw new Error(e)},"_throw"),Lr="AWS_ACCOUNT_ID_ENDPOINT_MODE",Ur="account_id_endpoint_mode",Vt={environmentVariableSelector:r(e=>{let t=e[Lr];return t&&!pe(t)&&Or(Nr),t},"environmentVariableSelector"),configFileSelector:r(e=>{let t=e[Ur];return t&&!pe(t)&&Or(Nr),t},"configFileSelector"),default:Ue};var Mr=["AWS_ENABLE_ENDPOINT_DISCOVERY","AWS_ENDPOINT_DISCOVERY_ENABLED"],jt="endpoint_discovery_enabled",Br=r(e=>["false","0"].indexOf(e)>=0,"isFalsy"),Wt={environmentVariableSelector:r(e=>{for(let t=0;t<Mr.length;t++){let n=Mr[t];if(n in e){let i=e[n];if(i==="")throw Error(`Environment variable ${n} can't be empty of undefined, got "${i}"`);return!Br(i)}}},"environmentVariableSelector"),configFileSelector:r(e=>{if(jt in e){let t=e[jt];if(t===void 0)throw Error(`Shared config entry ${jt} can't be undefined, got "${t}"`);return!Br(t)}},"configFileSelector"),default:void 0};var Qr=Ns(Jr());var fe=class{static{r(this,"EndpointCache")}cache;constructor(t){this.cache=new Qr.default(t)}getEndpoint(t){let n=this.get(t);if(!n||n.length===0)return;let i=n.map(s=>s.Address);return i[Math.floor(Math.random()*i.length)]}get(t){if(!this.has(t))return;let n=this.cache.get(t);if(!n)return;let i=Date.now(),s=n.filter(o=>i<o.Expires);if(s.length===0){this.delete(t);return}return s}set(t,n){let i=Date.now();this.cache.set(t,n.map(({Address:s,CachePeriodInMinutes:o})=>({Address:s,Expires:i+o*60*1e3})))}delete(t){this.cache.set(t,[])}has(t){if(!this.cache.has(t))return!1;let n=this.cache.peek(t);return n?n.length>0:!1}clear(){this.cache.clear()}};var Jt=r((e,{endpointDiscoveryCommandCtor:t})=>{let{endpointCacheSize:n,endpointDiscoveryEnabled:i,endpointDiscoveryEnabledProvider:s}=e;return Object.assign(e,{endpointDiscoveryCommandCtor:t,endpointCache:new fe(n??1e3),endpointDiscoveryEnabled:i!==void 0?()=>Promise.resolve(i):s,isClientEndpointDiscoveryEnabled:i!==void 0})},"resolveEndpointDiscoveryConfig");var Zr=r(async(e,t,n)=>({operation:fn(t).operation,region:await se(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()}),"defaultDynamoDBHttpAuthSchemeParametersProvider");function mo(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"dynamodb",region:e.region},propertiesExtractor:r((t,n)=>({signingProperties:{config:t,context:n}}),"propertiesExtractor")}}r(mo,"createAwsAuthSigv4HttpAuthOption");var Yr=r(e=>{let t=[];switch(e.operation){default:t.push(mo(e))}return t},"defaultDynamoDBHttpAuthSchemeProvider"),ei=r(e=>{let t=pr(e);return Object.assign(t,{authSchemePreference:se(e.authSchemePreference??[])})},"resolveHttpAuthSchemeConfig");var ti=r(e=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"dynamodb"}),"resolveClientEndpointParameters"),ni={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},AccountId:{type:"builtInParams",name:"accountId"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"},AccountIdEndpointMode:{type:"builtInParams",name:"accountIdEndpointMode"}};var D=Sn(ni,"DynamoDB_20120810","DynamoDBClient",Bn),ri={};var j={ResourceArn:{type:"contextParams",name:"TableName"}};var ii={ResourceArnList:{type:"operationContextParams",get:r(e=>e?.TransactItems?.map(t=>[t?.ConditionCheck?.TableName,t?.Put?.TableName,t?.Delete?.TableName,t?.Update?.TableName].filter(n=>n)).flat(),"get")}},k=r((e,t,n,i)=>[],"_mw0");var p=class e extends vn{static{r(this,"DynamoDBServiceException")}static shapeId="smithy.ts.sdk.synthetic.com.amazonaws.dynamodb#DynamoDBServiceException";constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};var Me=class e extends p{static{r(this,"BackupInUseException")}static shapeId="com.amazonaws.dynamodb#BackupInUseException";name="BackupInUseException";$fault="client";constructor(t){super({name:"BackupInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Be=class e extends p{static{r(this,"BackupNotFoundException")}static shapeId="com.amazonaws.dynamodb#BackupNotFoundException";name="BackupNotFoundException";$fault="client";constructor(t){super({name:"BackupNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Ge=class e extends p{static{r(this,"InternalServerError")}static shapeId="com.amazonaws.dynamodb#InternalServerError";name="InternalServerError";$fault="server";constructor(t){super({name:"InternalServerError",$fault:"server",...t}),Object.setPrototypeOf(this,e.prototype)}},Fe=class e extends p{static{r(this,"RequestLimitExceeded")}static shapeId="com.amazonaws.dynamodb#RequestLimitExceeded";name="RequestLimitExceeded";$fault="client";ThrottlingReasons;constructor(t){super({name:"RequestLimitExceeded",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.ThrottlingReasons=t.ThrottlingReasons}},Ke=class e extends p{static{r(this,"ThrottlingException")}static shapeId="com.amazonaws.dynamodb#ThrottlingException";name="ThrottlingException";$fault="client";throttlingReasons;constructor(t){super({name:"ThrottlingException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.throttlingReasons=t.throttlingReasons}},Ve=class e extends p{static{r(this,"InvalidEndpointException")}static shapeId="com.amazonaws.dynamodb#InvalidEndpointException";name="InvalidEndpointException";$fault="client";Message;constructor(t){super({name:"InvalidEndpointException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.Message=t.Message}},je=class e extends p{static{r(this,"ProvisionedThroughputExceededException")}static shapeId="com.amazonaws.dynamodb#ProvisionedThroughputExceededException";name="ProvisionedThroughputExceededException";$fault="client";ThrottlingReasons;constructor(t){super({name:"ProvisionedThroughputExceededException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.ThrottlingReasons=t.ThrottlingReasons}},We=class e extends p{static{r(this,"ResourceNotFoundException")}static shapeId="com.amazonaws.dynamodb#ResourceNotFoundException";name="ResourceNotFoundException";$fault="client";constructor(t){super({name:"ResourceNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},qe=class e extends p{static{r(this,"ItemCollectionSizeLimitExceededException")}static shapeId="com.amazonaws.dynamodb#ItemCollectionSizeLimitExceededException";name="ItemCollectionSizeLimitExceededException";$fault="client";constructor(t){super({name:"ItemCollectionSizeLimitExceededException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ze=class e extends p{static{r(this,"ReplicatedWriteConflictException")}static shapeId="com.amazonaws.dynamodb#ReplicatedWriteConflictException";name="ReplicatedWriteConflictException";$fault="client";$retryable={};constructor(t){super({name:"ReplicatedWriteConflictException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},He=class e extends p{static{r(this,"ContinuousBackupsUnavailableException")}static shapeId="com.amazonaws.dynamodb#ContinuousBackupsUnavailableException";name="ContinuousBackupsUnavailableException";$fault="client";constructor(t){super({name:"ContinuousBackupsUnavailableException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Xe=class e extends p{static{r(this,"LimitExceededException")}static shapeId="com.amazonaws.dynamodb#LimitExceededException";name="LimitExceededException";$fault="client";constructor(t){super({name:"LimitExceededException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Je=class e extends p{static{r(this,"TableInUseException")}static shapeId="com.amazonaws.dynamodb#TableInUseException";name="TableInUseException";$fault="client";constructor(t){super({name:"TableInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Qe=class e extends p{static{r(this,"TableNotFoundException")}static shapeId="com.amazonaws.dynamodb#TableNotFoundException";name="TableNotFoundException";$fault="client";constructor(t){super({name:"TableNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Ze=class e extends p{static{r(this,"GlobalTableAlreadyExistsException")}static shapeId="com.amazonaws.dynamodb#GlobalTableAlreadyExistsException";name="GlobalTableAlreadyExistsException";$fault="client";constructor(t){super({name:"GlobalTableAlreadyExistsException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Ye=class e extends p{static{r(this,"ResourceInUseException")}static shapeId="com.amazonaws.dynamodb#ResourceInUseException";name="ResourceInUseException";$fault="client";constructor(t){super({name:"ResourceInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},et=class e extends p{static{r(this,"TransactionConflictException")}static shapeId="com.amazonaws.dynamodb#TransactionConflictException";name="TransactionConflictException";$fault="client";constructor(t){super({name:"TransactionConflictException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},tt=class e extends p{static{r(this,"PolicyNotFoundException")}static shapeId="com.amazonaws.dynamodb#PolicyNotFoundException";name="PolicyNotFoundException";$fault="client";constructor(t){super({name:"PolicyNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},nt=class e extends p{static{r(this,"ExportNotFoundException")}static shapeId="com.amazonaws.dynamodb#ExportNotFoundException";name="ExportNotFoundException";$fault="client";constructor(t){super({name:"ExportNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},rt=class e extends p{static{r(this,"GlobalTableNotFoundException")}static shapeId="com.amazonaws.dynamodb#GlobalTableNotFoundException";name="GlobalTableNotFoundException";$fault="client";constructor(t){super({name:"GlobalTableNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},it=class e extends p{static{r(this,"ImportNotFoundException")}static shapeId="com.amazonaws.dynamodb#ImportNotFoundException";name="ImportNotFoundException";$fault="client";constructor(t){super({name:"ImportNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},st=class e extends p{static{r(this,"DuplicateItemException")}static shapeId="com.amazonaws.dynamodb#DuplicateItemException";name="DuplicateItemException";$fault="client";constructor(t){super({name:"DuplicateItemException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ot=class e extends p{static{r(this,"IdempotentParameterMismatchException")}static shapeId="com.amazonaws.dynamodb#IdempotentParameterMismatchException";name="IdempotentParameterMismatchException";$fault="client";Message;constructor(t){super({name:"IdempotentParameterMismatchException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.Message=t.Message}},at=class e extends p{static{r(this,"TransactionInProgressException")}static shapeId="com.amazonaws.dynamodb#TransactionInProgressException";name="TransactionInProgressException";$fault="client";Message;constructor(t){super({name:"TransactionInProgressException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.Message=t.Message}},ut=class e extends p{static{r(this,"ExportConflictException")}static shapeId="com.amazonaws.dynamodb#ExportConflictException";name="ExportConflictException";$fault="client";constructor(t){super({name:"ExportConflictException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ct=class e extends p{static{r(this,"InvalidExportTimeException")}static shapeId="com.amazonaws.dynamodb#InvalidExportTimeException";name="InvalidExportTimeException";$fault="client";constructor(t){super({name:"InvalidExportTimeException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},lt=class e extends p{static{r(this,"PointInTimeRecoveryUnavailableException")}static shapeId="com.amazonaws.dynamodb#PointInTimeRecoveryUnavailableException";name="PointInTimeRecoveryUnavailableException";$fault="client";constructor(t){super({name:"PointInTimeRecoveryUnavailableException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},pt=class e extends p{static{r(this,"ImportConflictException")}static shapeId="com.amazonaws.dynamodb#ImportConflictException";name="ImportConflictException";$fault="client";constructor(t){super({name:"ImportConflictException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},mt=class e extends p{static{r(this,"TableAlreadyExistsException")}static shapeId="com.amazonaws.dynamodb#TableAlreadyExistsException";name="TableAlreadyExistsException";$fault="client";constructor(t){super({name:"TableAlreadyExistsException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ft=class e extends p{static{r(this,"InvalidRestoreTimeException")}static shapeId="com.amazonaws.dynamodb#InvalidRestoreTimeException";name="InvalidRestoreTimeException";$fault="client";constructor(t){super({name:"InvalidRestoreTimeException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},dt=class e extends p{static{r(this,"ReplicaAlreadyExistsException")}static shapeId="com.amazonaws.dynamodb#ReplicaAlreadyExistsException";name="ReplicaAlreadyExistsException";$fault="client";constructor(t){super({name:"ReplicaAlreadyExistsException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},yt=class e extends p{static{r(this,"ReplicaNotFoundException")}static shapeId="com.amazonaws.dynamodb#ReplicaNotFoundException";name="ReplicaNotFoundException";$fault="client";constructor(t){super({name:"ReplicaNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ht=class e extends p{static{r(this,"IndexNotFoundException")}static shapeId="com.amazonaws.dynamodb#IndexNotFoundException";name="IndexNotFoundException";$fault="client";constructor(t){super({name:"IndexNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},vt=class e extends p{static{r(this,"ConditionalCheckFailedException")}static shapeId="com.amazonaws.dynamodb#ConditionalCheckFailedException";name="ConditionalCheckFailedException";$fault="client";Item;constructor(t){super({name:"ConditionalCheckFailedException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.Item=t.Item}},xt=class e extends p{static{r(this,"TransactionCanceledException")}static shapeId="com.amazonaws.dynamodb#TransactionCanceledException";name="TransactionCanceledException";$fault="client";Message;CancellationReasons;constructor(t){super({name:"TransactionCanceledException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.Message=t.Message,this.CancellationReasons=t.CancellationReasons}};var fo="Action";var yo="AttributeMap";var Qt="AttributesToGet",oi="AttributeUpdates",ho="AttributeValue",Zt="AttributeValueList",vo="AttributeValueUpdate",xo="Address",bo="Attributes";var Io="BackupInUseException";var go="BackupNotFoundException",Eo="BOOL";var So="BS";var _o="B",To="Code";var Ao="ContinuousBackupsUnavailableException",Y="ConsumedCapacity",Do="ConditionalCheckFailedException",ko="ConsumedCapacityMultiple",ai="ConditionCheck";var de="ConditionExpression";var ui="ComparisonOperator",Yt="ConditionalOperator";var wo="CachePeriodInMinutes",Co="CancellationReasons";var Ro="CancellationReasonList",Po="ConfirmRemoveSelfResourceAccess",$o="ClientRequestToken",No="CancellationReason",en="ConsistentRead";var ci="CapacityUnits";var Oo="Capacity",Lo="Condition",li="Count";var Uo="DescribeEndpoints";var Mo="DescribeEndpointsRequest",Bo="DescribeEndpointsResponse";var Go="DuplicateItemException";var pi="Delete";var Fo="ExpectedAttributeMap",W="ExpressionAttributeNames",H="ExpressionAttributeValues",Ko="ExpressionAttributeValueMap",Vo="ExpectedAttributeValue";var jo="ExportConflictException";var Wo="ExportNotFoundException";var qo="ExpectedRevisionId";var mi="ExclusiveStartKey";var fi="Endpoints";var zo="Endpoint",Ho="Expected",Xo="Exists";var Jo="FilterConditionMap";var di="FilterExpression";var Qo="GetItem",Zo="GetItemInput",Yo="GetItemOutput";var ea="GlobalSecondaryIndexes";var ta="GlobalTableAlreadyExistsException";var na="GlobalTableNotFoundException";var bt="Item";var ra="ImportConflictException",ia="ItemCollectionKey",sa="ItemCollectionKeyAttributeMap",tn="ItemCollectionMetrics",oa="ItemCollectionMetricsMultiple",aa="ItemCollectionMetricsPerTable",ua="ItemCollectionSizeLimitExceededException";var ca="InvalidEndpointException";var la="InvalidExportTimeException";var pa="ItemList",yi="IndexName",ma="ImportNotFoundException",fa="IndexNotFoundException",da="IdempotentParameterMismatchException";var ya="InvalidRestoreTimeException";var ha="InternalServerError";var hi="Items",ee="Key";var vi="KeyConditions",va="KeyConditionExpression";var xi="Limit",xa="ListAttributeValue";var ba="LimitExceededException";var bi="LastEvaluatedKey";var Ia="LocalSecondaryIndexes";var ga="L",ye="Message",Ea="MapAttributeValue";var Sa="M",_a="N";var Ta="NS";var Aa="NULL";var nn="ProjectionExpression";var Da="PutItemInputAttributeMap";var ka="PointInTimeRecoveryUnavailableException";var wa="PolicyNotFoundException";var Ca="PutResourcePolicyInput";var Ra="ProvisionedThroughputExceededException";var Pa="Policy";var Ii="Put",$a="Query",Na="QueryFilter",Oa="QueryInput",La="QueryOutput";var Ua="ResourceArn",Ma="ReplicaAlreadyExistsException";var he="ReturnConsumedCapacity",gi="ReadCapacityUnits";var Ei="ReturnItemCollectionMetrics";var Ba="ResourceInUseException";var Ga="RequestLimitExceeded";var Fa="ReplicaNotFoundException",Ka="ResourceNotFoundException";var Va="ReturnValues",ve="ReturnValuesOnConditionCheckFailure",ja="ReplicatedWriteConflictException";var Si="ScannedCount";var Wa="SizeEstimateRangeGB",qa="ScanFilter",za="ScanInput";var Ha="SecondaryIndexesCapacityMap",Xa="ScanIndexForward";var Ja="ScanOutput";var Qa="SS";var Za="S";var Ya="Scan",_i="Select",eu="Segment";var tu="Table";var nu="TableAlreadyExistsException";var ru="TransactionCanceledException",iu="TransactionConflictException";var su="ThrottlingException";var ou="TransactionInProgressException",au="TableInUseException",uu="TransactItems";var G="TableName",cu="TableNotFoundException";var Ti="ThrottlingReasons";var lu="ThrottlingReasonList";var pu="ThrottlingReason";var mu="TotalSegments";var fu="TransactWriteItem",du="TransactWriteItemsInput",yu="TransactWriteItemList",hu="TransactWriteItemsOutput",vu="TransactWriteItems";var Ai="Update";var Di="UpdateExpression";var xu="UpdateItemInput",bu="UpdateItemOutput",Iu="UpdateItem";var ki="Value";var gu="VectorCapacity",Eu="VectorIndexes",Su="VectorIndexesCapacityMap";var _u="VectorSearchRequestBytes",Tu="VectorWriteRequestBytes",wi="WriteCapacityUnits";var Au="awsQueryError",h="client",y="error",Ci="httpError",Du="httpHeader",v="message",ku="reason",wu="resource",Ri="smithy.ts.sdk.synthetic.com.amazonaws.dynamodb",Cu="server",Ru="throttlingReasons",Pu="x-amz-confirm-remove-self-resource-access",u="com.amazonaws.dynamodb",Pi=new Lt(Ri),$u=[-3,Ri,"DynamoDBServiceException",0,[],[]];Pi.registerError($u,p);var f=new Lt(u),Nu=[-3,u,Io,{[y]:h},[v],[0]];f.registerError(Nu,Me);var Ou=[-3,u,go,{[y]:h},[v],[0]];f.registerError(Ou,Be);var Lu=[-3,u,Do,{[y]:h},[v,bt],[0,()=>be]];f.registerError(Lu,vt);var Uu=[-3,u,Ao,{[y]:h},[v],[0]];f.registerError(Uu,He);var Mu=[-3,u,Go,{[y]:h},[v],[0]];f.registerError(Mu,st);var Bu=[-3,u,jo,{[y]:h},[v],[0]];f.registerError(Bu,ut);var Gu=[-3,u,Wo,{[y]:h},[v],[0]];f.registerError(Gu,nt);var Fu=[-3,u,ta,{[y]:h},[v],[0]];f.registerError(Fu,Ze);var Ku=[-3,u,na,{[y]:h},[v],[0]];f.registerError(Ku,rt);var Vu=[-3,u,da,{[y]:h},[ye],[0]];f.registerError(Vu,ot);var ju=[-3,u,ra,{[y]:h},[v],[0]];f.registerError(ju,pt);var Wu=[-3,u,ma,{[y]:h},[v],[0]];f.registerError(Wu,it);var qu=[-3,u,fa,{[y]:h},[v],[0]];f.registerError(qu,ht);var zu=[-3,u,ha,{[y]:Cu},[v],[0]];f.registerError(zu,Ge);var Hu=[-3,u,ca,{[y]:h,[Ci]:421},[ye],[0]];f.registerError(Hu,Ve);var Xu=[-3,u,la,{[y]:h},[v],[0]];f.registerError(Xu,ct);var Ju=[-3,u,ya,{[y]:h},[v],[0]];f.registerError(Ju,ft);var Qu=[-3,u,ua,{[y]:h},[v],[0]];f.registerError(Qu,qe);var Zu=[-3,u,ba,{[y]:h},[v],[0]];f.registerError(Zu,Xe);var Yu=[-3,u,ka,{[y]:h},[v],[0]];f.registerError(Yu,lt);var ec=[-3,u,wa,{[y]:h},[v],[0]];f.registerError(ec,tt);var tc=[-3,u,Ra,{[y]:h},[v,Ti],[0,()=>rn]];f.registerError(tc,je);var nc=[-3,u,Ma,{[y]:h},[v],[0]];f.registerError(nc,dt);var rc=[-3,u,Fa,{[y]:h},[v],[0]];f.registerError(rc,yt);var ic=[-3,u,ja,{[y]:h},[v],[0]];f.registerError(ic,ze);var sc=[-3,u,Ga,{[y]:h},[v,Ti],[0,()=>rn]];f.registerError(sc,Fe);var oc=[-3,u,Ba,{[y]:h},[v],[0]];f.registerError(oc,Ye);var ac=[-3,u,Ka,{[y]:h},[v],[0]];f.registerError(ac,We);var uc=[-3,u,nu,{[y]:h},[v],[0]];f.registerError(uc,mt);var cc=[-3,u,au,{[y]:h},[v],[0]];f.registerError(cc,Je);var lc=[-3,u,cu,{[y]:h},[v],[0]];f.registerError(lc,Qe);var pc=[-3,u,su,{[Au]:["Throttling",400],[y]:h,[Ci]:400},[v,Ru],[0,()=>rn]];f.registerError(pc,Ke);var mc=[-3,u,ru,{[y]:h},[ye,Co],[0,()=>Mc]];f.registerError(mc,xt);var fc=[-3,u,iu,{[y]:h},[v],[0]];f.registerError(fc,et);var dc=[-3,u,ou,{[y]:h},[ye],[0]];f.registerError(dc,at);var $i=[Pi,f];var yc=[3,u,vo,0,[ki,fo],[()=>L,0]];var hc=[3,u,No,0,[bt,To,ye],[()=>be,0,0]],Ni=[3,u,Oo,0,[gi,wi,ci],[1,1,1]],Oi=[3,u,Lo,0,[ui,Zt],[0,()=>Ui],1],vc=[3,u,ai,0,[ee,G,de,W,H,ve],[()=>F,0,0,128,()=>X,0],3],xe=[3,u,Y,0,[G,ci,gi,wi,tu,Ia,ea,Eu],[0,1,1,1,()=>Ni,()=>si,()=>si,()=>Qc]];var xc=[3,u,pi,0,[ee,G,de,W,H,ve],[()=>F,0,0,128,()=>X,0],2];var bc=[3,u,Mo,0,[],[]],Ic=[3,u,Bo,0,[fi],[()=>Gc],1];var gc=[3,u,zo,0,[xo,wo],[0,1],2];var Ec=[3,u,Vo,0,[ki,Xo,ui,Zt],[()=>L,2,0,()=>Ui]];var Sc=[3,u,Zo,0,[G,ee,Qt,en,he,nn,W],[0,()=>F,64,2,0,0,128],2],_c=[3,u,Yo,0,[bt,Y],[()=>be,()=>xe]];var Li=[3,u,tn,0,[ia,Wa],[()=>qc,65]];var Tc=[3,u,Ii,0,[bt,G,de,W,H,ve],[()=>Jc,0,0,128,()=>X,0],2];var qp=[3,u,Ca,0,[Ua,Pa,qo,Po],[0,0,0,[2,{[Du]:Pu}]],2];var Ac=[3,u,Oa,0,[G,yi,_i,Qt,xi,en,vi,Na,Yt,Xa,mi,he,nn,di,va,W,H],[0,0,0,64,1,2,()=>Hc,()=>Bi,0,2,()=>F,0,0,0,0,128,()=>X],1],Dc=[3,u,La,0,[hi,li,Si,bi,Y],[()=>Mi,1,1,()=>F,()=>xe]];var kc=[3,u,za,0,[G,yi,Qt,xi,_i,qa,Yt,mi,he,mu,eu,nn,di,W,H,en],[0,0,64,1,0,()=>Bi,0,()=>F,0,1,1,0,0,128,()=>X,2],1],wc=[3,u,Ja,0,[hi,li,Si,bi,Y],[()=>Mi,1,1,()=>F,()=>xe]];var Cc=[3,u,pu,0,[ku,wu],[0,0]];var Rc=[3,u,fu,0,[ai,Ii,pi,Ai],[()=>vc,()=>Tc,()=>xc,()=>Nc]],Pc=[3,u,du,0,[uu,he,Ei,$o],[()=>Vc,0,0,[0,4]],1],$c=[3,u,hu,0,[Y,tn],[()=>Bc,()=>zc]];var Nc=[3,u,Ai,0,[ee,Di,G,de,W,H,ve],[()=>F,0,0,0,128,()=>X,0],3];var Oc=[3,u,xu,0,[G,ee,oi,Ho,Yt,Va,he,Ei,Di,de,W,H,ve],[0,()=>F,()=>jc,()=>Wc,0,0,0,0,0,0,128,()=>X,0],2],Lc=[3,u,bu,0,[bo,Y,tn],[()=>be,()=>xe,()=>Li]];var Uc=[3,u,gu,0,[_u,Tu],[1,1]];var Ui=[1,u,Zt,0,()=>L];var Mc=[1,u,Ro,0,()=>hc],Bc=[1,u,ko,0,()=>xe];var Gc=[1,u,fi,0,()=>gc];var Fc=[1,u,oa,0,()=>Li];var Mi=[1,u,pa,0,()=>be];var Kc=[1,u,xa,0,()=>L];var rn=[1,u,lu,0,()=>Cc];var Vc=[1,u,yu,0,()=>Rc];var be=[2,u,yo,0,0,()=>L],jc=[2,u,oi,0,0,()=>yc];var Wc=[2,u,Fo,0,0,()=>Ec];var X=[2,u,Ko,0,0,()=>L],Bi=[2,u,Jo,0,0,()=>Oi],qc=[2,u,sa,0,0,()=>L],zc=[2,u,aa,0,0,()=>Fc],F=[2,u,ee,0,0,()=>L],Hc=[2,u,vi,0,0,()=>Oi],Xc=[2,u,Ea,0,0,()=>L],Jc=[2,u,Da,0,0,()=>L],si=[2,u,Ha,0,0,()=>Ni],Qc=[2,u,Su,0,0,()=>Uc],L=[4,u,ho,0,[Za,_a,_o,Qa,Ta,So,Sa,ga,Aa,Eo],[0,0,21,64,64,85,()=>Xc,()=>Kc,2,2]];var Gi=[9,u,Uo,0,()=>bc,()=>Ic];var Fi=[9,u,Qo,0,()=>Sc,()=>_c];var Ki=[9,u,$a,0,()=>Ac,()=>Dc];var Vi=[9,u,Ya,0,()=>kc,()=>wc];var ji=[9,u,vu,0,()=>Pc,()=>$c];var Wi=[9,u,Iu,0,()=>Oc,()=>Lc];var It=class extends D(ri,k,"DescribeEndpoints",Gi){static{r(this,"DescribeEndpointsCommand")}};var qi={name:"@aws-sdk/client-dynamodb",version:"3.1150.0",description:"AWS SDK for JavaScript Dynamodb Client for Node.js, Browser and React Native",homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-dynamodb",license:"Apache-2.0",author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/sdk-for-javascript/"},repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-dynamodb"},files:["dist-*/**"],sideEffects:!1,main:"./dist-cjs/index.js",module:"./dist-es/index.js",browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},types:"./dist-types/index.d.ts",typesVersions:{"<4.5":{"dist-types/*":["dist-types/ts3.4/*"]}},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},scripts:{build:"concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs","build:cjs":"node ../../scripts/compilation/inline","build:es":"premove dist-es && tsc -p tsconfig.es.json","build:include:deps":'yarn g:turbo run build -F="$npm_package_name"',"build:types":"premove dist-types && tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"premove dist-cjs dist-es dist-types","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service",test:"yarn g:vitest run --passWithNoTests","test:watch":"yarn g:vitest watch --passWithNoTests","test:integration":"yarn g:vitest run --passWithNoTests -c vitest.config.integ.mts","test:integration:watch":"yarn g:vitest watch --passWithNoTests -c vitest.config.integ.mts","test:e2e":"yarn g:vitest run -c vitest.config.e2e.mts","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.mts","test:index":"tsc -p tsconfig.test.json && node ./test/index-objects.spec.mjs"},dependencies:{"@aws-sdk/core":"^3.978.3","@aws-sdk/credential-provider-node":"^3.972.86","@aws-sdk/dynamodb-codec":"^3.973.48","@aws-sdk/middleware-endpoint-discovery":"^3.972.32","@aws-sdk/types":"^3.974.6","@smithy/core":"^3.35.2","@smithy/fetch-http-handler":"^5.8.0","@smithy/node-http-handler":"^4.12.1","@smithy/types":"^4.19.0",tslib:"^2.6.2"},devDependencies:{"@smithy/snapshot-testing":"^2.3.2","@tsconfig/node20":"20.1.8","@types/node":"^20.14.8",concurrently:"7.0.0","downlevel-dts":"0.10.1",premove:"4.0.0",typescript:"~7.0.2",vitest:"^4.0.17"},engines:{node:">=20.0.0"}};var zi="com.amazonaws.dynamodb#AttributeValue",sn=class extends dr{static{r(this,"DynamoDBJsonShapeSerializer2")}writeValue(t,n,i){if(n!=null&&typeof n=="object"){let s=Ot.of(t);if(s.isStructSchema()&&s.getName(!0)===zi){this.writeAttributeValue(n);return}}super.writeValue(t,n,i)}writeAttributeValue(t){let n=this.serdeContext?.base64Encoder??we;this.writeAscii("{");let i=!0;for(let s in t){let o=t[s];if(o!=null)switch(i||this.writeAscii(","),i=!1,this.writeAsciiQuoted(s),this.writeAscii(":"),s){case"B":o instanceof Uint8Array?this.writeBase64(o):this.writeJsonString(o);break;case"BS":this.writeAscii("[");{let a=o;for(let c=0;c<a.length;c++){c>0&&this.writeAscii(",");let d=a[c];d instanceof Uint8Array?this.writeBase64(d):this.writeJsonString(n(d))}}this.writeAscii("]");break;case"L":this.writeAscii("[");{let a=o;for(let c=0;c<a.length;c++)c>0&&this.writeAscii(","),a[c]!=null?this.writeAttributeValue(a[c]):this.writeAscii("null")}this.writeAscii("]");break;case"M":this.writeAscii("{");{let a=o,c=!0;for(let d in a)a[d]!=null&&(c||this.writeAscii(","),c=!1,this.writeJsonString(d),this.writeAscii(":"),this.writeAttributeValue(a[d]))}this.writeAscii("}");break;case"SS":case"NS":this.writeAscii("[");{let a=o;for(let c=0;c<a.length;c++)c>0&&this.writeAscii(","),this.writeJsonString(a[c])}this.writeAscii("]");break;case"S":case"N":this.writeJsonString(o);break;case"BOOL":this.writeAscii(o?"true":"false");break;case"NULL":this.writeAscii(o?"true":"false");break;default:this.writeAscii(JSON.stringify(o));break}}this.writeAscii("}")}},on=class extends fr{static{r(this,"DynamoDBJsonShapeDeserializer2")}_read(t,n){let i=Ot.of(t);return i.isStructSchema()&&i.getName(!0)===zi&&n&&typeof n=="object"?this.readAttributeValue(n):super._read(i,n)}readAttributeValue(t){let n=this.serdeContext?.base64Decoder??ke,i=t;if(typeof t.B=="string"&&(i.B=n(t.B)),Array.isArray(t.BS)&&(i.BS=t.BS.map(n)),Array.isArray(t.L)&&(i.L=t.L.map(s=>this.readAttributeValue(s))),t.M&&typeof t.M=="object"){let s=t.M;for(let o in s)s[o]=this.readAttributeValue(s[o])}return i}},Ie=class extends yr{static{r(this,"DynamoDBJsonCodec2")}constructor(){super({timestampFormat:{useTrait:!0,default:7},jsonName:!1})}createSerializer(){let t=new sn(this.settings);return t.setSerdeContext(this.serdeContext),t}createDeserializer(){let t=new on(this.settings);return t.setSerdeContext(this.serdeContext),t}};var _="ref",P="argv",T=-1,ge=!0,te=!1,ne="isSet",Ee="booleanEquals",ys="PartitionResult",R="stringEquals",$="getAttr",hs="parsedEndpoint",Hi="aws.parseArn",Xi=r(e=>"ParsedArn_ssa_"+e,"k"),Ji="service",an="dynamodb",Se="isValidHostLabel",Qi="accountId",Zi="FirstArn",Yi=r(e=>"https://{ParsedArn_ssa_"+e+"#accountId}.search-ddb.{Region}.{PartitionResult#dualStackDnsSuffix}","q"),es=r(e=>"https://{ParsedArn_ssa_"+e+"#accountId}.ddb.{Region}.{PartitionResult#dualStackDnsSuffix}","s"),ts=r(e=>"https://{ParsedArn_ssa_"+e+"#accountId}.search-ddb.{Region}.{PartitionResult#dnsSuffix}","t"),ns=r(e=>"https://{ParsedArn_ssa_"+e+"#accountId}.ddb.{Region}.{PartitionResult#dnsSuffix}","u"),gt={[_]:"Region"},cn={[_]:ys},rs={fn:$,[P]:[{[_]:hs},"authority"]},un={[_]:"AccountIdEndpointMode"},is={fn:$,[P]:[cn,"name"]},ss={fn:$,[P]:[{[_]:"ParsedArn_ssa_2"},"region"]},os={[_]:"ParsedArn_ssa_2"},as={[_]:"ResourceArnList"},us={fn:$,[P]:[{[_]:"ParsedArn_ssa_1"},"region"]},cs={[_]:"ParsedArn_ssa_1"},ls={[_]:"AccountId"},K={},w={metricValues:["O"]},ps=[gt],ms=[{[_]:"Endpoint"}],fs=[{[_]:"ResourceArn"}],ds={conditions:[[ne,ps],[ne,ms],[Ee,[{[_]:"UseFIPS"},ge]],[Ee,[{[_]:"UseDualStack"},ge]],["aws.partition",ps,ys],[R,[gt,"local"]],[Ee,[{fn:$,[P]:[cn,"supportsFIPS"]},ge]],["parseURL",ms,hs],[R,["dynamodb.{Region}.{PartitionResult#dualStackDnsSuffix}",rs]],[Ee,[{fn:$,[P]:[cn,"supportsDualStack"]},ge]],[R,["search-dynamodb.{Region}.{PartitionResult#dualStackDnsSuffix}",rs]],[ne,[un]],[R,[is,"aws"]],[R,[un,"disabled"]],[ne,fs],[Hi,fs,Xi(2)],[R,[ss,gt]],[R,[{fn:$,[P]:[os,Ji]},an]],[Se,[ss,te]],[Se,[{fn:$,[P]:[os,Qi]},te]],[ne,[as]],[$,[as,"[0]"],Zi],[Hi,[{[_]:Zi}],Xi(1)],[R,[us,gt]],[R,[{fn:$,[P]:[cs,Ji]},an]],[Se,[{fn:$,[P]:[cs,Qi]},te]],[Se,[us,te]],[ne,[ls]],[R,[un,"required"]],[Se,[ls,te]],[R,[is,"aws-us-gov"]],[Ee,[{fn:"coalesce",[P]:[{[_]:"IsSearchOperation"},te]},ge]]],results:[[T],[T,"Invalid Configuration: FIPS and custom endpoint are not supported"],[T,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[T,"Endpoint override is not supported for dual-stack endpoints. Please enable dual-stack functionality by enabling the configuration. For more details, see: https://docs.aws.amazon.com/sdkref/latest/guide/feature-endpoints.html"],["{Endpoint}",K],[T,"Invalid Configuration: FIPS and local endpoint are not supported"],[T,"Invalid Configuration: Dualstack and local endpoint are not supported"],["http://localhost:8000",{authSchemes:[{signingRegion:"us-east-1",signingName:an,name:"sigv4"}]}],[T,"Invalid Configuration: AccountIdEndpointMode is required and FIPS is enabled, but FIPS account endpoints are not supported"],["https://search-dynamodb-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",K],["https://dynamodb-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",K],[T,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://search-dynamodb.{Region}.{PartitionResult#dnsSuffix}",K],["https://dynamodb.{Region}.{PartitionResult#dnsSuffix}",K],["https://search-dynamodb-fips.{Region}.{PartitionResult#dnsSuffix}",K],["https://dynamodb-fips.{Region}.{PartitionResult#dnsSuffix}",K],[T,"FIPS is enabled but this partition does not support FIPS"],[Yi(2),w],[es(2),w],[Yi(1),w],[es(1),w],["https://{AccountId}.search-ddb.{Region}.{PartitionResult#dualStackDnsSuffix}",w],["https://{AccountId}.ddb.{Region}.{PartitionResult#dualStackDnsSuffix}",w],[T,"Credentials-sourced account ID parameter is invalid"],[T,"AccountIdEndpointMode is required but no AccountID was provided or able to be loaded"],[T,"Invalid Configuration: AccountIdEndpointMode is required but account endpoints are not supported in this partition"],["https://search-dynamodb.{Region}.{PartitionResult#dualStackDnsSuffix}",K],["https://dynamodb.{Region}.{PartitionResult#dualStackDnsSuffix}",K],[T,"DualStack is enabled but this partition does not support DualStack"],[ts(2),w],[ns(2),w],[ts(1),w],[ns(1),w],["https://{AccountId}.search-ddb.{Region}.{PartitionResult#dnsSuffix}",w],["https://{AccountId}.ddb.{Region}.{PartitionResult#dnsSuffix}",w],[T,"Invalid Configuration: Missing Region"]]},Yc=2,l=1e8,el=new Int32Array([-1,1,-1,0,6,3,1,4,l+35,2,l+1,5,3,l+2,l+4,1,77,7,2,61,8,3,34,9,4,10,l+35,5,l+7,11,11,12,69,12,14,13,28,l+25,69,13,33,15,14,16,21,15,17,21,16,18,21,17,19,21,18,20,21,19,32,21,20,22,28,21,23,28,22,24,28,23,25,28,24,26,28,25,27,28,26,31,28,27,29,33,29,30,l+23,31,l+33,l+34,31,l+31,l+32,31,l+29,l+30,28,l+24,69,4,35,l+35,5,l+6,36,9,37,l+28,11,38,60,12,40,39,28,l+25,60,13,59,41,14,42,47,15,43,47,16,44,47,17,45,47,18,46,47,19,58,47,20,48,54,21,49,54,22,50,54,23,51,54,24,52,54,25,53,54,26,57,54,27,55,59,29,56,l+23,31,l+21,l+22,31,l+19,l+20,31,l+17,l+18,28,l+24,60,31,l+26,l+27,3,70,62,4,63,l+35,5,l+5,64,6,65,l+16,11,66,67,28,l+8,67,30,69,68,31,l+14,l+15,31,l+12,l+13,4,71,l+35,5,l+5,72,6,73,l+11,9,74,l+11,11,75,76,28,l+8,76,31,l+9,l+10,2,l+1,78,3,l+2,79,4,80,l+4,7,81,l+4,8,l+3,82,10,l+3,l+4]),vs=Nn.from(el,Yc,ds.conditions,ds.results);var tl=new On({size:50,params:["AccountId","AccountIdEndpointMode","Endpoint","IsSearchOperation","Region","ResourceArn","ResourceArnList","UseDualStack","UseFIPS"]}),xs=r((e,t={})=>tl.get(e,()=>Un(vs,{endpointParams:e,logger:t.logger})),"defaultEndpointResolver");Ln.aws=or;var bs=r(e=>({apiVersion:"2012-08-10",base64Decoder:e?.base64Decoder??ke,base64Encoder:e?.base64Encoder??we,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??xs,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Yr,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:r(t=>t.getIdentityProvider("aws.auth#sigv4"),"identityProvider"),signer:new cr}],logger:e?.logger??new En,protocol:e?.protocol??hr,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.dynamodb",errorTypeRegistries:$i,xmlNamespace:"http://dynamodb.amazonaws.com/doc/2012-08-10/",version:"2012-08-10",serviceTarget:"DynamoDB_20120810",jsonCodec:new Ie},serviceId:e?.serviceId??"DynamoDB",sha256:e?.sha256??Fn,urlParser:e?.urlParser??dn,utf8Decoder:e?.utf8Decoder??Tn,utf8Encoder:e?.utf8Encoder??An}),"getRuntimeConfig");var Is=r(e=>{bn(process.version);let t=$n(e),n=r(()=>t().then(xn),"defaultConfigProvider"),i=bs(e);_n(process.version);let s={profile:e?.profile,logger:i.logger};return{...i,...e,runtime:"node",defaultsMode:t,accountIdEndpointMode:e?.accountIdEndpointMode??N(Vt,s),authSchemePreference:e?.authSchemePreference??N(lr,s),bodyLengthChecker:e?.bodyLengthChecker??Dn,credentialDefaultProvider:e?.credentialDefaultProvider??vr,defaultUserAgentProvider:e?.defaultUserAgentProvider??ir({serviceId:i.serviceId,clientVersion:qi.version}),endpointDiscoveryEnabledProvider:e?.endpointDiscoveryEnabledProvider??N(Wt,s),maxAttempts:e?.maxAttempts??N(oe.v2026?{...Ut,default:4}:Ut,e),region:e?.region??N(Cn,{...Rn,...s}),requestHandler:mr.create(e?.requestHandler??n),retryMode:e?.retryMode??N({...zn,default:r(async()=>(await n()).retryMode||Wn,"default")},e),streamCollector:e?.streamCollector??Gn,useDualstackEndpoint:e?.useDualstackEndpoint??N(kn,s),useFipsEndpoint:e?.useFipsEndpoint??N(wn,s),userAgentAppId:e?.userAgentAppId??N(sr,s)}},"getRuntimeConfig");var gs=r(e=>{let t=e.httpAuthSchemes,n=e.httpAuthSchemeProvider,i=e.credentials;return{setHttpAuthScheme(s){let o=t.findIndex(a=>a.schemeId===s.schemeId);o===-1?t.push(s):t.splice(o,1,s)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(s){n=s},httpAuthSchemeProvider(){return n},setCredentials(s){i=s},credentials(){return i}}},"getHttpAuthExtensionConfiguration"),Es=r(e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}),"resolveHttpAuthRuntimeConfig");var Ss=r((e,t)=>{let n=Object.assign(ar(e),In(e),Kn(e),gs(e));return t.forEach(i=>i.configure(n)),Object.assign(e,ur(n),gn(n),Vn(n),Es(n))},"resolveRuntimeExtensions");var re=class extends De{static{r(this,"DynamoDBClient")}config;constructor(...[t]){let n=Is(t||{});super(n),this.initConfig=n;let i=ti(n),s=Kt(i),o=nr(s),a=qn(o,{defaultBaseDelay:oe.v2026?25:void 0,defaultMaxAttempts:oe.v2026?4:void 0}),c=Pn(a),d=c,g=Mn(d),E=ei(g),Nt=Jt(E,{endpointDiscoveryCommandCtor:It}),Ps=Ss(Nt,t?.extensions||[]);this.config=Ps,this.middlewareStack.use(yn(this.config)),this.middlewareStack.use(rr(this.config)),this.middlewareStack.use(Hn(this.config)),this.middlewareStack.use(jn(this.config)),this.middlewareStack.use(Jn(this.config)),this.middlewareStack.use(Qn(this.config)),this.middlewareStack.use(Zn(this.config)),this.middlewareStack.use(Yn(this.config,{httpAuthSchemeParametersProvider:Zr,identityProviderConfigProvider:r(async $s=>new tr({"aws.auth#sigv4":$s.credentials}),"identityProviderConfigProvider")})),this.middlewareStack.use(er(this.config))}destroy(){super.destroy()}};var Et=class extends D(j,k,"GetItem",Fi){static{r(this,"GetItemCommand")}};var St=class extends D(j,k,"Query",Ki){static{r(this,"QueryCommand")}};var _t=class extends D(j,k,"Scan",Vi){static{r(this,"ScanCommand")}};var Tt=class extends D(ii,k,"TransactWriteItems",ji){static{r(this,"TransactWriteItemsCommand")}};var At=class extends D(j,k,"UpdateItem",Wi){static{r(this,"UpdateItemCommand")}};var J=class extends x{static{r(this,"GetCommand")}input;inputKeyNodes={Key:m};outputKeyNodes={Item:m};clientCommand;middlewareStack;constructor(t){super(),this.input=t,this.clientCommand=new Et(this.input),this.middlewareStack=this.clientCommand.middlewareStack}resolveMiddleware(t,n,i){this.addMarshallingMiddleware(n);let s=t.concat(this.middlewareStack),o=this.clientCommand.resolveMiddleware(s,n,i);return async()=>o(this.clientCommand)}};var Q=class extends x{static{r(this,"QueryCommand")}input;inputKeyNodes={KeyConditions:{"*":{AttributeValueList:A}},QueryFilter:{"*":{AttributeValueList:A}},ExclusiveStartKey:m,ExpressionAttributeValues:m};outputKeyNodes={Items:{"*":m},LastEvaluatedKey:m};clientCommand;middlewareStack;constructor(t){super(),this.input=t,this.clientCommand=new St(this.input),this.middlewareStack=this.clientCommand.middlewareStack}resolveMiddleware(t,n,i){this.addMarshallingMiddleware(n);let s=t.concat(this.middlewareStack),o=this.clientCommand.resolveMiddleware(s,n,i);return async()=>o(this.clientCommand)}};var _e=class extends x{static{r(this,"ScanCommand")}input;inputKeyNodes={ScanFilter:{"*":{AttributeValueList:A}},ExclusiveStartKey:m,ExpressionAttributeValues:m};outputKeyNodes={Items:{"*":m},LastEvaluatedKey:m};clientCommand;middlewareStack;constructor(t){super(),this.input=t,this.clientCommand=new _t(this.input),this.middlewareStack=this.clientCommand.middlewareStack}resolveMiddleware(t,n,i){this.addMarshallingMiddleware(n);let s=t.concat(this.middlewareStack),o=this.clientCommand.resolveMiddleware(s,n,i);return async()=>o(this.clientCommand)}};var Te=class extends x{static{r(this,"TransactWriteCommand")}input;inputKeyNodes={TransactItems:{"*":{ConditionCheck:{Key:m,ExpressionAttributeValues:m},Put:{Item:m,ExpressionAttributeValues:m},Delete:{Key:m,ExpressionAttributeValues:m},Update:{Key:m,ExpressionAttributeValues:m}}}};outputKeyNodes={ItemCollectionMetrics:{"*":{"*":{ItemCollectionKey:m}}}};clientCommand;middlewareStack;constructor(t){super(),this.input=t,this.clientCommand=new Tt(this.input),this.middlewareStack=this.clientCommand.middlewareStack}resolveMiddleware(t,n,i){this.addMarshallingMiddleware(n);let s=t.concat(this.middlewareStack),o=this.clientCommand.resolveMiddleware(s,n,i);return async()=>o(this.clientCommand)}};var q=class extends x{static{r(this,"UpdateCommand")}input;inputKeyNodes={Key:m,AttributeUpdates:{"*":{Value:Z}},Expected:{"*":{Value:Z,AttributeValueList:A}},ExpressionAttributeValues:m};outputKeyNodes={Attributes:m,ItemCollectionMetrics:{ItemCollectionKey:m}};clientCommand;middlewareStack;constructor(t){super(),this.input=t,this.clientCommand=new At(this.input),this.middlewareStack=this.clientCommand.middlewareStack}resolveMiddleware(t,n,i){this.addMarshallingMiddleware(n);let s=t.concat(this.middlewareStack),o=this.clientCommand.resolveMiddleware(s,n,i);return async()=>o(this.clientCommand)}};var U=class e extends De{static{r(this,"DynamoDBDocumentClient")}config;constructor(t,n){if(super(t.config),this.config=t.config,this.config.translateConfig=n,this.middlewareStack=t.middlewareStack,this.config?.cacheMiddleware)throw new Error("@aws-sdk/lib-dynamodb - cacheMiddleware=true is not compatible with the DynamoDBDocumentClient. This option must be set to false.");if(!(t.middlewareStack.identify?.()??[]).some(o=>o.includes?.("serializerMiddleware"))){let o=this.config.logger,a=o&&!o.constructor?.name.includes("NoOp")?o:console,c=new re(Object.assign({},this.config,{defaultUserAgentProvider:void 0,retryStrategy:void 0,extensions:void 0}));if(c.middlewareStack.identify?.().some(g=>g.includes?.("serializerMiddleware")))this.middlewareStack=c.middlewareStack,this.config=c.config,this.config.translateConfig=n,a.warn("@aws-sdk/lib-dynamodb - WARN: incompatible version of DynamoDBClient given to DynamoDBDocumentClient. We have forwarded your client's configuration to a newer version of DynamoDBClient in the dependency closure to instantiate DynamoDBDocumentClient.");else throw new Error("@aws-sdk/lib-dynamodb - ERROR: incompatible version of DynamoDBClient given to DynamoDBDocumentClient. Check @aws-sdk/lib-dynamodb package.json requirements.")}}static from(t,n){return new e(t,n)}destroy(){}};var xy=Ce(U,Q,"ExclusiveStartKey","LastEvaluatedKey","Limit");var Sy=Ce(U,_e,"ExclusiveStartKey","LastEvaluatedKey","Limit");var Dt=["hour","day","month"],_s=["status","country","device","path"],Ts=["v1","v2"];var mh=M({pk:S(),sk:S(),source:V(Ts),appliedAt:b(),ttl:C(b())}),kt=class{constructor(t){this.props=t}props;static{r(this,"AppliedMarkers")}isApplied=r(async t=>{let{Item:n}=await this.props.dynamo.send(new J({TableName:this.props.tableName,Key:{pk:As(t),sk:"applied"}}));return n!=null},"isApplied");buildMarkerPut=r(t=>{let n={pk:As(t),sk:"applied",source:t.source,appliedAt:Date.now()};return t.ttl!=null&&(n.ttl=t.ttl),{Put:{TableName:this.props.tableName,Item:n,ConditionExpression:"attribute_not_exists(pk) AND attribute_not_exists(sk)"}}},"buildMarkerPut")};function As(e){return`applied#${e.grain}#${e.periodKey}`}r(As,"partitionKey");function ln(e,t=100){let n=[],i=Math.ceil(e.length/t),s=0,o=t;for(let a=0;a<i;a++)n.push(e.slice(s,o)),s+=t,o+=t;return n}r(ln,"splitArrayToChunks");async function wt(e){let t=[],n;do{let{Items:i=[],LastEvaluatedKey:s}=await e.dynamo.send(new Q({...e.input,ExclusiveStartKey:n}));n=s,t.push(...i)}while(n!=null);return t}r(wt,"queryAll");var rl=M({pk:S(),sk:S(),dimension:V(_s),grain:V(Dt),periodKey:S(),value:S(),hits:b(),bytes:b(),ttl:C(b())}),Ct=class{constructor(t){this.props=t}props;static{r(this,"Breakdowns")}addMany=r(async t=>{let n=this.buildUpdates(t);for(let i of n)await this.props.dynamo.send(new q(i.Update))},"addMany");buildUpdates=r(t=>t.items.map(n=>({Update:this.buildUpdateMembers({dimension:t.dimension,grain:t.grain,periodKey:t.periodKey,item:n,ttl:t.ttl})})),"buildUpdates");getForPeriod=r(async t=>(await wt({dynamo:this.props.dynamo,input:{TableName:this.props.tableName,KeyConditionExpression:"#pk = :pk",ExpressionAttributeNames:{"#pk":"pk"},ExpressionAttributeValues:{":pk":Ds({dimension:t.dimension,grain:t.grain,periodKey:t.periodKey})}}})).map(i=>this.parseOne(i)),"getForPeriod");buildUpdateMembers=r(t=>{let n={"#dimension":"dimension","#grain":"grain","#periodKey":"periodKey","#value":"value","#hits":"hits","#bytes":"bytes"},i={":dimension":t.dimension,":grain":t.grain,":periodKey":t.periodKey,":value":t.item.value,":hits":t.item.hits,":bytes":t.item.bytes},s=["#dimension = :dimension","#grain = :grain","#periodKey = :periodKey","#value = :value"];return t.ttl!=null&&(n["#ttl"]="ttl",i[":ttl"]=t.ttl,s.push("#ttl = :ttl")),{TableName:this.props.tableName,Key:{pk:Ds({dimension:t.dimension,grain:t.grain,periodKey:t.periodKey}),sk:t.item.value},UpdateExpression:`SET ${s.join(", ")} ADD #hits :hits, #bytes :bytes`,ExpressionAttributeNames:n,ExpressionAttributeValues:i}},"buildUpdateMembers");parseOne=r(t=>{let n=$e(rl,t);if(!n.success)throw console.error(Pe(n.issues)),new Error("Malformed stored breakdown record");return n.output},"parseOne")};function Ds(e){return`breakdown#${e.dimension}#${e.grain}#${e.periodKey}`}r(Ds,"partitionKey");function ks(){return U.from(new re,{marshallOptions:{removeUndefinedValues:!0,convertEmptyValues:!1}})}r(ks,"toDynamoClient");function ws(e){let t={hits:0,success:0,errors:0,errors4xx:0,errors5xx:0,bytesSent:0,bytesReceived:0};return e.reduce((n,i)=>({hits:n.hits+i.hits,success:n.success+i.success,errors:n.errors+i.errors,errors4xx:n.errors4xx+i.errors4xx,errors5xx:n.errors5xx+i.errors5xx,bytesSent:n.bytesSent+i.bytesSent,bytesReceived:n.bytesReceived+i.bytesReceived}),t)}r(ws,"sumTotals");function Ae(e){let t={};for(let n of e){let i=t[n.value];i==null?t[n.value]={value:n.value,hits:n.hits,bytes:n.bytes}:t[n.value]={value:n.value,hits:i.hits+n.hits,bytes:i.bytes+n.bytes}}return Object.values(t)}r(Ae,"sumBreakdown");var il=100;async function Cs({monthKey:e,models:t,dynamo:n}){if(await t.markers.isApplied({grain:"month",periodKey:e}))return{status:"skipped"};let s=await t.totals.queryWindow({grain:"day",startKey:`${e}-01`,endKey:`${e}-31`}),o=ws(s),a=await cl({breakdowns:t.breakdowns,grain:"day",periodKeys:s.map(E=>E.timeKey)}),c=t.totals.buildAggregateUpdate({grain:"month",item:{timeKey:e,...o}}),d=ul({breakdowns:t.breakdowns,grain:"month",periodKey:e,byStatus:a.status,byDevice:a.device,byPath:a.path,byCountry:a.country}),g=t.markers.buildMarkerPut({grain:"month",periodKey:e,source:"v2"});return ol({dynamo:n,leading:[g,c],rest:d})}r(Cs,"applyMonthlyRollup");function sl({leading:e,rest:t,limit:n=il}){let i=Math.max(n-e.length,0),s=[...e,...t.slice(0,i)],o=ln(t.slice(i),n);return[s,...o]}r(sl,"chunkTransactItems");async function ol({dynamo:e,leading:t,rest:n}){let i=sl({leading:t,rest:n});try{for(let s of i)s.length!==0&&await e.send(new Te({TransactItems:s}))}catch(s){if(al(s))return{status:"skipped"};throw s}return{status:"applied"}}r(ol,"sendTransacted");function al(e){if(e==null||typeof e!="object")return!1;let t="name"in e?e.name:void 0;return t==="TransactionCanceledException"||t==="ConditionalCheckFailedException"}r(al,"isMarkerRaceError");function ul({breakdowns:e,grain:t,periodKey:n,ttl:i,byStatus:s,byDevice:o,byPath:a,byCountry:c}){let d=[{dimension:"status",items:s},{dimension:"device",items:o},{dimension:"country",items:c},{dimension:"path",items:a}],g=[];for(let E of d)E.items.length!==0&&g.push(...e.buildUpdates({dimension:E.dimension,grain:t,periodKey:n,items:E.items,ttl:i}));return g}r(ul,"buildBreakdownUpdates");async function cl({breakdowns:e,grain:t,periodKeys:n}){let i=[],s=[],o=[],a=[];for(let c of n){let[d,g,E,Nt]=await Promise.all([e.getForPeriod({dimension:"status",grain:t,periodKey:c}),e.getForPeriod({dimension:"device",grain:t,periodKey:c}),e.getForPeriod({dimension:"path",grain:t,periodKey:c}),e.getForPeriod({dimension:"country",grain:t,periodKey:c})]);i.push(...d.map(Rt)),s.push(...g.map(Rt)),o.push(...E.map(Rt)),a.push(...Nt.map(Rt))}return{status:Ae(i),device:Ae(s),path:Ae(o),country:Ae(a)}}r(cl,"aggregateFinerBreakdowns");function Rt(e){return{value:e.value,hits:e.hits,bytes:e.bytes}}r(Rt,"toBreakdownRow");function ll(e){return e.toString().padStart(2,"0")}r(ll,"pad2");function pl(e){return e.toString().padStart(4,"0")}r(pl,"pad4");function Rs(e){return`${pl(e.getUTCFullYear())}-${ll(e.getUTCMonth()+1)}`}r(Rs,"monthKey");var ml=["hits","success","errors","errors4xx","errors5xx","bytesSent","bytesReceived"],fl=["p50TimeTaken","p95TimeTaken","cacheHitRatio","uniqueIpCount"],dl=M({pk:S(),sk:S(),grain:V(Dt),timeKey:S(),hits:b(),success:b(),errors:b(),errors4xx:b(),errors5xx:b(),bytesSent:b(),bytesReceived:b(),p50TimeTaken:C(b()),p95TimeTaken:C(b()),cacheHitRatio:C(b()),uniqueIpCount:C(b()),ttl:C(b())}),Pt=class{constructor(t){this.props=t}props;static{r(this,"Totals")}addHourly=r(async t=>{let n=this.buildHourlyUpdate(t);await this.props.dynamo.send(new q(n.Update))},"addHourly");addAggregate=r(async t=>{let n=this.buildAggregateUpdate(t);await this.props.dynamo.send(new q(n.Update))},"addAggregate");buildHourlyUpdate=r(t=>({Update:this.buildUpdateMembers({grain:"hour",item:t.item,ttl:t.ttl,includeHourlyDetail:!0})}),"buildHourlyUpdate");buildAggregateUpdate=r(t=>({Update:this.buildUpdateMembers({grain:t.grain,item:t.item,includeHourlyDetail:!1})}),"buildAggregateUpdate");queryWindow=r(async t=>(await wt({dynamo:this.props.dynamo,input:{TableName:this.props.tableName,KeyConditionExpression:"#pk = :pk AND #sk BETWEEN :start AND :end",ExpressionAttributeNames:{"#pk":"pk","#sk":"sk"},ExpressionAttributeValues:{":pk":pn(t.grain),":start":t.startKey,":end":t.endKey}}})).map(i=>this.parseOne(i)),"queryWindow");getOne=r(async t=>{let{Item:n}=await this.props.dynamo.send(new J({TableName:this.props.tableName,Key:{pk:pn(t.grain),sk:t.timeKey}}));if(n!=null)return this.parseOne(n)},"getOne");buildUpdateMembers=r(t=>{let n={"#grain":"grain","#timeKey":"timeKey"},i={":grain":t.grain,":timeKey":t.item.timeKey},s=["#grain = :grain","#timeKey = :timeKey"],o=[];for(let a of ml)n[`#${a}`]=a,i[`:${a}`]=t.item[a],o.push(`#${a} :${a}`);if(t.includeHourlyDetail)for(let a of fl){let c=t.item[a];c!=null&&(n[`#${a}`]=a,i[`:${a}`]=c,s.push(`#${a} = :${a}`))}return t.ttl!=null&&(n["#ttl"]="ttl",i[":ttl"]=t.ttl,s.push("#ttl = :ttl")),{TableName:this.props.tableName,Key:{pk:pn(t.grain),sk:t.item.timeKey},UpdateExpression:`SET ${s.join(", ")} ADD ${o.join(", ")}`,ExpressionAttributeNames:n,ExpressionAttributeValues:i}},"buildUpdateMembers");parseOne=r(t=>{let n=$e(dl,t);if(!n.success)throw console.error(Pe(n.issues)),new Error("Malformed stored totals record");return n.output},"parseOne")};function pn(e){return`totals#${e}`}r(pn,"partitionKey");var yl=M({TABLE_NAME:S(),REVERSE_INDEX_NAME:S()}),mn=Ir(yl,process.env),$t=ks(),hl=new Pt({dynamo:$t,tableName:mn.TABLE_NAME}),vl=new Ct({dynamo:$t,tableName:mn.TABLE_NAME}),xl=new kt({dynamo:$t,tableName:mn.TABLE_NAME});async function nv(){let e=new Date;e.setUTCDate(1),e.setUTCMonth(e.getUTCMonth()-1);let t=Rs(e),n=await Cs({monthKey:t,models:{totals:hl,breakdowns:vl,markers:xl},dynamo:$t});console.log(`monthlyRollup ${t} ${n.status}`)}r(nv,"handler");export{nv as handler};
2
+ import{a as vr}from"./chunk-U7KUF4SE.mjs";import"./chunk-VYXCTSUL.mjs";import{a as cr,c as lr,h as pr,i as fr,j as dr,k as yr,l as hr}from"./chunk-2C6L2MOS.mjs";import{b as Fn}from"./chunk-LB33VBGK.mjs";import{a as mr}from"./chunk-YY2HYMK3.mjs";import{A as oe,B as Wn,C as Ut,D as qn,E as zn,F as Hn,G as Xn,L as Jn,O as Qn,R as Zn,S as Yn,T as er,V as Ce,W as tr,a as De,aa as nr,b as hn,d as vn,f as xn,g as bn,h as gn,ha as rr,i as In,ja as ir,k as En,l as Sn,n as _n,na as sr,r as Nn,s as On,sa as or,u as Ln,w as Un,xa as ar,y as Mn,ya as ur,z as Bn}from"./chunk-C3D3OF2Y.mjs";import{i as Kn,j as Vn,k as jn}from"./chunk-YMGL4RSC.mjs";import{n as N,o as kn,p as wn,s as Cn,t as Rn,u as Pn,v as $n}from"./chunk-KRS5YV2Z.mjs";import{B as Gn,b as yn,d as Ot,e as Lt,g as ke,h as Tn,i as we,j as An,z as Dn}from"./chunk-3UGRDNDZ.mjs";import{e as fn,k as se,l as dn}from"./chunk-OC3UN3OS.mjs";import{a as r,b as ie,c as Ns}from"./chunk-CFZ5JWD3.mjs";var Fr=ie((ap,Gr)=>{function B(e){Object.defineProperty(this,"_next",{writable:!1,enumerable:!1,value:e}),this.done=!1}r(B,"Iterator");B.prototype.next=function(){if(this.done)return{done:!0};var e=this._next();return e.done&&(this.done=!0),e};typeof Symbol<"u"&&(B.prototype[Symbol.iterator]=function(){return this});B.of=function(){var e=arguments,t=e.length,n=0;return new B(function(){return n>=t?{done:!0}:{done:!1,value:e[n++]}})};B.empty=function(){var e=new B(null);return e.done=!0,e};B.is=function(e){return e instanceof B?!0:typeof e=="object"&&e!==null&&typeof e.next=="function"};Gr.exports=B});var qt=ie((cp,Wr)=>{var Kr=typeof ArrayBuffer<"u",Vr=typeof Symbol<"u";function jr(e,t){var n,i,s,o,a;if(!e)throw new Error("obliterator/forEach: invalid iterable.");if(typeof t!="function")throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(e)||Kr&&ArrayBuffer.isView(e)||typeof e=="string"||e.toString()==="[object Arguments]"){for(s=0,o=e.length;s<o;s++)t(e[s],s);return}if(typeof e.forEach=="function"){e.forEach(t);return}if(Vr&&Symbol.iterator in e&&typeof e.next!="function"&&(e=e[Symbol.iterator]()),typeof e.next=="function"){for(n=e,s=0;a=n.next(),a.done!==!0;)t(a.value,s),s++;return}for(i in e)e.hasOwnProperty(i)&&t(e[i],i)}r(jr,"forEach");jr.forEachWithNullKeys=function(e,t){var n,i,s,o,a;if(!e)throw new Error("obliterator/forEachWithNullKeys: invalid iterable.");if(typeof t!="function")throw new Error("obliterator/forEachWithNullKeys: expecting a callback.");if(Array.isArray(e)||Kr&&ArrayBuffer.isView(e)||typeof e=="string"||e.toString()==="[object Arguments]"){for(s=0,o=e.length;s<o;s++)t(e[s],null);return}if(e instanceof Set){e.forEach(function(c){t(c,null)});return}if(typeof e.forEach=="function"){e.forEach(t);return}if(Vr&&Symbol.iterator in e&&typeof e.next!="function"&&(e=e[Symbol.iterator]()),typeof e.next=="function"){for(n=e,s=0;a=n.next(),a.done!==!0;)t(a.value,null),s++;return}for(i in e)e.hasOwnProperty(i)&&t(e[i],i)};Wr.exports=jr});var zt=ie(O=>{var Ys=Math.pow(2,8)-1,eo=Math.pow(2,16)-1,to=Math.pow(2,32)-1,no=Math.pow(2,7)-1,ro=Math.pow(2,15)-1,io=Math.pow(2,31)-1;O.getPointerArray=function(e){var t=e-1;return t<=Ys?Uint8Array:t<=eo?Uint16Array:t<=to?Uint32Array:Float64Array};O.getSignedPointerArray=function(e){var t=e-1;return t<=no?Int8Array:t<=ro?Int16Array:t<=io?Int32Array:Float64Array};O.getNumberType=function(e){return e===(e|0)?Math.sign(e)===-1?e<=127&&e>=-128?Int8Array:e<=32767&&e>=-32768?Int16Array:Int32Array:e<=255?Uint8Array:e<=65535?Uint16Array:Uint32Array:Float64Array};var so={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};O.getMinimalRepresentation=function(e,t){var n=null,i=0,s,o,a,c,d;for(c=0,d=e.length;c<d;c++)a=t?t(e[c]):e[c],o=O.getNumberType(a),s=so[o.name],s>i&&(i=s,n=o);return n};O.isTypedArray=function(e){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView(e)};O.concat=function(){var e=0,t,n,i;for(t=0,i=arguments.length;t<i;t++)e+=arguments[t].length;var s=new arguments[0].constructor(e);for(t=0,n=0;t<i;t++)s.set(arguments[t],n),n+=arguments[t].length;return s};O.indices=function(e){for(var t=O.getPointerArray(e),n=new t(e),i=0;i<e;i++)n[i]=i;return n}});var Hr=ie(me=>{var qr=qt(),zr=zt();function oo(e){return Array.isArray(e)||zr.isTypedArray(e)}r(oo,"isArrayLike");function Ht(e){if(typeof e.length=="number")return e.length;if(typeof e.size=="number")return e.size}r(Ht,"guessLength");function ao(e){var t=Ht(e),n=typeof t=="number"?new Array(t):[],i=0;return qr(e,function(s){n[i++]=s}),n}r(ao,"toArray");function uo(e){var t=Ht(e),n=typeof t=="number"?zr.getPointerArray(t):Array,i=typeof t=="number"?new Array(t):[],s=typeof t=="number"?new n(t):[],o=0;return qr(e,function(a){i[o]=a,s[o]=o++}),[i,s]}r(uo,"toArrayWithIndices");me.isArrayLike=oo;me.guessLength=Ht;me.toArray=ao;me.toArrayWithIndices=uo});var Jr=ie((dp,Xr)=>{var Xt=Fr(),co=qt(),lo=zt(),po=Hr();function g(e,t,n){if(arguments.length<2&&(n=e,e=null,t=null),this.capacity=n,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-cache: capacity should be positive number.");var i=lo.getPointerArray(n);this.forward=new i(n),this.backward=new i(n),this.K=typeof e=="function"?new e(n):new Array(n),this.V=typeof t=="function"?new t(n):new Array(n),this.size=0,this.head=0,this.tail=0,this.items={}}r(g,"LRUCache");g.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items={}};g.prototype.splayOnTop=function(e){var t=this.head;if(this.head===e)return this;var n=this.backward[e],i=this.forward[e];return this.tail===e?this.tail=n:this.backward[i]=n,this.forward[n]=i,this.backward[t]=e,this.head=e,this.forward[e]=t,this};g.prototype.set=function(e,t){var n=this.items[e];if(typeof n<"u"){this.splayOnTop(n),this.V[n]=t;return}this.size<this.capacity?n=this.size++:(n=this.tail,this.tail=this.backward[n],delete this.items[this.K[n]]),this.items[e]=n,this.K[n]=e,this.V[n]=t,this.forward[n]=this.head,this.backward[this.head]=n,this.head=n};g.prototype.setpop=function(e,t){var n=null,i=null,s=this.items[e];return typeof s<"u"?(this.splayOnTop(s),n=this.V[s],this.V[s]=t,{evicted:!1,key:e,value:n}):(this.size<this.capacity?s=this.size++:(s=this.tail,this.tail=this.backward[s],n=this.V[s],i=this.K[s],delete this.items[this.K[s]]),this.items[e]=s,this.K[s]=e,this.V[s]=t,this.forward[s]=this.head,this.backward[this.head]=s,this.head=s,i?{evicted:!0,key:i,value:n}:null)};g.prototype.has=function(e){return e in this.items};g.prototype.get=function(e){var t=this.items[e];if(!(typeof t>"u"))return this.splayOnTop(t),this.V[t]};g.prototype.peek=function(e){var t=this.items[e];if(!(typeof t>"u"))return this.V[t]};g.prototype.forEach=function(e,t){t=arguments.length>1?t:this;for(var n=0,i=this.size,s=this.head,o=this.K,a=this.V,c=this.forward;n<i;)e.call(t,a[s],o[s],this),s=c[s],n++};g.prototype.keys=function(){var e=0,t=this.size,n=this.head,i=this.K,s=this.forward;return new Xt(function(){if(e>=t)return{done:!0};var o=i[n];return e++,e<t&&(n=s[n]),{done:!1,value:o}})};g.prototype.values=function(){var e=0,t=this.size,n=this.head,i=this.V,s=this.forward;return new Xt(function(){if(e>=t)return{done:!0};var o=i[n];return e++,e<t&&(n=s[n]),{done:!1,value:o}})};g.prototype.entries=function(){var e=0,t=this.size,n=this.head,i=this.K,s=this.V,o=this.forward;return new Xt(function(){if(e>=t)return{done:!0};var a=i[n],c=s[n];return e++,e<t&&(n=o[n]),{done:!1,value:[a,c]}})};typeof Symbol<"u"&&(g.prototype[Symbol.iterator]=g.prototype.entries);g.prototype.inspect=function(){for(var e=new Map,t=this.entries(),n;n=t.next(),!n.done;)e.set(n.value[0],n.value[1]);return Object.defineProperty(e,"constructor",{value:g,enumerable:!1}),e};typeof Symbol<"u"&&(g.prototype[Symbol.for("nodejs.util.inspect.custom")]=g.prototype.inspect);g.from=function(e,t,n,i){if(arguments.length<2){if(i=po.guessLength(e),typeof i!="number")throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(i=t,t=null,n=null);var s=new g(t,n,i);return co(e,function(o,a){s.set(a,o)}),s};Xr.exports=g});var Re,Os={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function Mt(e){return!e&&!Re?Os:{lang:e?.lang??Re?.lang,message:e?.message,abortEarly:e?.abortEarly??Re?.abortEarly,abortPipeEarly:e?.abortPipeEarly??Re?.abortPipeEarly}}r(Mt,"getGlobalConfig");var Ls;function Us(e){return Ls?.get(e)}r(Us,"getGlobalMessage");var Ms;function Bs(e){return Ms?.get(e)}r(Bs,"getSchemaMessage");var Gs;function Fs(e,t){return Gs?.get(e)?.get(t)}r(Fs,"getSpecificMessage");function xr(e){let t=typeof e;return t==="string"?`"${e}"`:t==="number"||t==="bigint"||t==="boolean"?`${e}`:t==="object"||t==="function"?(e&&Object.getPrototypeOf(e)?.constructor?.name)??"null":t}r(xr,"_stringify");function ae(e,t,n,i,s){let o=s&&"input"in s?s.input:n.value,a=s?.expected??e.expects??null,c=s?.received??xr(o),d={kind:e.kind,type:e.type,input:o,expected:a,received:c,message:`Invalid ${t}: ${a?`Expected ${a} but r`:"R"}eceived ${c}`,requirement:e.requirement,path:s?.path,issues:s?.issues,lang:i.lang,abortEarly:i.abortEarly,abortPipeEarly:i.abortPipeEarly},I=e.kind==="schema",E=s?.message??e.message??Fs(e.reference,d.lang)??(I?Bs(d.lang):null)??i.message??Us(d.lang);E!==void 0&&(d.message=typeof E=="function"?E(d):E),I&&(n.typed=!1),n.issues?n.issues.push(d):n.issues=[d]}r(ae,"_addIssue");function Ks(e,t){let n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:n[0]??"never"}r(Ks,"_joinExpects");function ue(e){return e["~standard"]={version:1,vendor:"valibot",validate:r(t=>e["~run"]({value:t},Mt()),"validate")},e}r(ue,"_standardSchema");function Vs(e){if(e.path){let t="";for(let n of e.path)if(typeof n.key=="string"||typeof n.key=="number")t?t+=`.${n.key}`:t+=n.key;else return null;return t}return null}r(Vs,"getDotPath");var js=class extends Error{static{r(this,"ValiError")}constructor(e){super(e[0].message),this.name="ValiError",this.issues=e}};var bl=new RegExp("^(?:[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation}))*)+$","u");function Ws(e,t,n){return typeof e.fallback=="function"?e.fallback(t,n):e.fallback}r(Ws,"getFallback");function Pe(e){let t={};for(let n of e)if(n.path){let i=Vs(n);i?(t.nested||(t.nested={}),Object.prototype.hasOwnProperty.call(t.nested,i)?t.nested[i].push(n.message):t.nested[i]=[n.message]):t.other?t.other.push(n.message):t.other=[n.message]}else t.root?t.root.push(n.message):t.root=[n.message];return t}r(Pe,"flatten");function br(e,t,n){return typeof e.default=="function"?e.default(t,n):e.default}r(br,"getDefault");function b(e){return ue({kind:"schema",type:"number",reference:b,expects:"number",async:!1,message:e,"~run"(t,n){return typeof t.value=="number"&&!isNaN(t.value)?t.typed=!0:ae(this,"type",t,n),t}})}r(b,"number");function M(e,t){return ue({kind:"schema",type:"object",reference:M,expects:"Object",async:!1,entries:e,message:t,"~run"(n,i){let s=n.value;if(s&&typeof s=="object"){n.typed=!0,n.value={};for(let o in this.entries){let a=this.entries[o];if(o in s||(a.type==="exact_optional"||a.type==="optional"||a.type==="nullish")&&a.default!==void 0){let c=o in s?s[o]:br(a),d=a["~run"]({value:c},i);if(d.issues){let I={type:"object",origin:"value",input:s,key:o,value:c};for(let E of d.issues)E.path?E.path.unshift(I):E.path=[I],n.issues?.push(E);if(n.issues||(n.issues=d.issues),i.abortEarly){n.typed=!1;break}}d.typed||(n.typed=!1),n.value[o]=d.value}else if(a.fallback!==void 0)n.value[o]=Ws(a);else if(a.type!=="exact_optional"&&a.type!=="optional"&&a.type!=="nullish"&&(ae(this,"key",n,i,{input:void 0,expected:`"${o}"`,path:[{type:"object",origin:"key",input:s,key:o,value:s[o]}]}),i.abortEarly))break}}else ae(this,"type",n,i);return n}})}r(M,"object");function C(e,t){return ue({kind:"schema",type:"optional",reference:C,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,"~run"(n,i){return n.value===void 0&&(this.default!==void 0&&(n.value=br(this,n,i)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,i)}})}r(C,"optional");function V(e,t){return ue({kind:"schema",type:"picklist",reference:V,expects:Ks(e.map(xr),"|"),async:!1,options:e,message:t,"~run"(n,i){return this.options.includes(n.value)?n.typed=!0:ae(this,"type",n,i),n}})}r(V,"picklist");function S(e){return ue({kind:"schema",type:"string",reference:S,expects:"string",async:!1,message:e,"~run"(t,n){return typeof t.value=="string"?t.typed=!0:ae(this,"type",t,n),t}})}r(S,"string");function gr(e,t,n){let i=e["~run"]({value:t},Mt(n));if(i.issues)throw new js(i.issues);return i.value}r(gr,"parse");function $e(e,t,n){let i=e["~run"]({value:t},Mt(n));return{typed:i.typed,success:!i.issues,output:i.value,issues:i.issues}}r($e,"safeParse");var z=class e{static{r(this,"NumberValue")}value;constructor(t){typeof t=="object"&&"N"in t?this.value=String(t.N):this.value=String(t);let n=typeof t.valueOf()=="number"?t.valueOf():0;if(n>Number.MAX_SAFE_INTEGER||n<Number.MIN_SAFE_INTEGER||Math.abs(n)===1/0||Number.isNaN(n))throw new Error(`NumberValue should not be initialized with an imprecise number=${n}. Use a string instead.`)}static from(t){return new e(t)}toAttributeValue(){return{N:this.toString()}}toBigInt(){let t=this.toString();return BigInt(t)}toString(){return String(this.value)}valueOf(){return this.toString()}};var ce=r((e,t)=>{if(e===void 0)throw new Error("Pass options.removeUndefinedValues=true to remove undefined values from map/array/set.");if(e===null&&typeof e=="object")return Oe();if(Array.isArray(e))return qs(e,t);if(e?.constructor?.name==="Set")return zs(e,t);if(e?.constructor?.name==="Map")return Hs(e,t);if(e?.constructor?.name==="Object"||!e.constructor&&typeof e=="object")return Ir(e,t);if(Dr(e))return e.length===0&&t?.convertEmptyValues?Oe():Sr(e);if(typeof e=="boolean"||e?.constructor?.name==="Boolean")return{BOOL:e.valueOf()};if(typeof e=="number"||e?.constructor?.name==="Number")return Ar(e,t);if(e instanceof z)return e.toAttributeValue();if(typeof e=="bigint")return Tr(e);if(typeof e=="string"||e?.constructor?.name==="String")return e.length===0&&t?.convertEmptyValues?Oe():_r(e);if(t?.convertClassInstanceToMap&&typeof e=="object")return Ir(e,t);throw new Error(`Unsupported type passed: ${e}. Pass options.convertClassInstanceToMap=true to marshall typeof object as map attribute.`)},"convertToAttr"),qs=r((e,t)=>({L:e.filter(n=>typeof n!="function"&&(!t?.removeUndefinedValues||t?.removeUndefinedValues&&n!==void 0)).map(n=>ce(n,t))}),"convertToListAttr"),zs=r((e,t)=>{let n=t?.removeUndefinedValues?new Set([...e].filter(s=>s!==void 0)):e;if(!t?.removeUndefinedValues&&n.has(void 0))throw new Error("Pass options.removeUndefinedValues=true to remove undefined values from map/array/set.");if(n.size===0){if(t?.convertEmptyValues)return Oe();throw new Error("Pass a non-empty set, or options.convertEmptyValues=true.")}let i=n.values().next().value;if(i instanceof z)return{NS:Array.from(n).map(s=>s.toString())};if(typeof i=="number")return{NS:Array.from(n).map(s=>Ar(s,t)).map(s=>s.N)};if(typeof i=="bigint")return{NS:Array.from(n).map(Tr).map(s=>s.N)};if(typeof i=="string")return{SS:Array.from(n).map(_r).map(s=>s.S)};if(Dr(i))return{BS:Array.from(n).map(Sr).map(s=>s.B)};throw new Error("Only Number Set (NS), Binary Set (BS) or String Set (SS) are allowed.")},"convertToSetAttr"),Hs=r((e,t)=>({M:(n=>{let i={};for(let[s,o]of n)typeof o!="function"&&(o!==void 0||!t?.removeUndefinedValues)&&(i[s]=ce(o,t));return i})(e)}),"convertToMapAttrFromIterable"),Ir=r((e,t)=>({M:(n=>{let i={};for(let s in n){let o=n[s];typeof o!="function"&&(o!==void 0||!t?.removeUndefinedValues)&&(i[s]=ce(o,t))}return i})(e)}),"convertToMapAttrFromEnumerableProps"),Oe=r(()=>({NULL:!0}),"convertToNullAttr"),Sr=r(e=>({B:e}),"convertToBinaryAttr"),_r=r(e=>({S:e.toString()}),"convertToStringAttr"),Tr=r(e=>({N:e.toString()}),"convertToBigIntAttr"),Er=r(e=>{throw new Error(`${e} Use NumberValue from @aws-sdk/lib-dynamodb.`)},"validateBigIntAndThrow"),Ar=r((e,t)=>{if([Number.NaN,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY].map(n=>n.toString()).includes(e.toString()))throw new Error(`Special numeric value ${e.toString()} is not allowed`);return t?.allowImpreciseNumbers||(Number(e)>Number.MAX_SAFE_INTEGER?Er(`Number ${e.toString()} is greater than Number.MAX_SAFE_INTEGER.`):Number(e)<Number.MIN_SAFE_INTEGER&&Er(`Number ${e.toString()} is lesser than Number.MIN_SAFE_INTEGER.`)),{N:e.toString()}},"convertToNumberAttr"),Dr=r(e=>{let t=["ArrayBuffer","Blob","Buffer","DataView","File","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];return e?.constructor?t.includes(e.constructor.name):!1},"isBinary");var le=r((e,t)=>{for(let[n,i]of Object.entries(e))if(i!==void 0)switch(n){case"NULL":return null;case"BOOL":return!!i;case"N":return kr(i,t);case"B":return Cr(i);case"S":return wr(i);case"L":return Xs(i,t);case"M":return Js(i,t);case"NS":return new Set(i.map(s=>kr(s,t)));case"BS":return new Set(i.map(Cr));case"SS":return new Set(i.map(wr));default:throw new Error(`Unsupported type passed: ${n}`)}throw new Error(`No value defined: ${JSON.stringify(e)}`)},"convertToNative"),kr=r((e,t)=>{if(typeof t?.wrapNumbers=="function")return t?.wrapNumbers(e);if(t?.wrapNumbers)return z.from(e);let n=Number(e),i=[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY];if((n>Number.MAX_SAFE_INTEGER||n<Number.MIN_SAFE_INTEGER)&&!i.includes(n))if(typeof BigInt=="function")try{return BigInt(e)}catch{throw new Error(`${e} can't be converted to BigInt. Set options.wrapNumbers to get string value.`)}else throw new Error(`${e} is outside SAFE_INTEGER bounds. Set options.wrapNumbers to get string value.`);return n},"convertNumber"),wr=r(e=>e,"convertString"),Cr=r(e=>e,"convertBinary"),Xs=r((e,t)=>e.map(n=>le(n,t)),"convertList"),Js=r((e,t)=>Object.entries(e).reduce((n,[i,s])=>(n[i]=le(s,t),n),{}),"convertMap");function Bt(e,t){let n=ce(e,t),[i,s]=Object.entries(n)[0];switch(i){case"M":case"L":return t?.convertTopLevelContainer?n:s;default:return n}}r(Bt,"marshall");var Gt=r((e,t)=>t?.convertWithoutMapWrapper?le(e,t):le({M:e},t),"unmarshall");var Z=null,m={},A=[],Rr="*",Le=r((e,t,n)=>{if(e!==void 0){if(n==null)return t(e);{let i=Object.keys(n),s=i.length===1&&i[0]===Rr,o=i.length>=1&&!s,a=i.length===0;if(o)return Ft(e,t,n);if(a)return Qs(e,t,Z);if(s)return Object.entries(e??{}).reduce((c,[d,I])=>(typeof I!="function"&&(c[d]=Le(I,t,n[Rr])),c),Array.isArray(e)?[]:{})}}},"processObj"),Ft=r((e,t,n)=>{let i;if(Array.isArray(e))i=e.filter(s=>typeof s!="function");else{i={};for(let[s,o]of Object.entries(e))typeof o!="function"&&(i[s]=o)}for(let[s,o]of Object.entries(n)){if(typeof e[s]=="function")continue;let a=Le(e[s],t,o);a!==void 0&&typeof a!="function"&&(i[s]=a)}return i},"processKeysInObj"),Qs=r((e,t,n)=>Array.isArray(e)?e.filter(i=>typeof i!="function").map(i=>Le(i,t,n)):Object.entries(e).reduce((i,[s,o])=>{if(typeof o=="function")return i;let a=Le(o,t,n);return a!==void 0&&typeof a!="function"&&(i[s]=a),i},{}),"processAllKeysInObj"),Pr=r((e,t,n)=>Ft(e,r(s=>Bt(s,n),"marshallFunc"),t),"marshallInput"),$r=r((e,t,n)=>Ft(e,r(s=>Gt(s,n),"unmarshallFunc"),t),"unmarshallOutput");var x=class extends hn{static{r(this,"DynamoDBDocumentClientCommand")}addMarshallingMiddleware(t){let{marshallOptions:n={},unmarshallOptions:i={}}=t.translateConfig||{};n.convertTopLevelContainer=n.convertTopLevelContainer??!0,i.convertWithoutMapWrapper=i.convertWithoutMapWrapper??!0,this.clientCommand.middlewareStack.addRelativeTo((s,o)=>async a=>(Xn(o,"DDB_MAPPER","d"),s({...a,input:Pr(a.input,this.inputKeyNodes,n)})),{name:"DocumentMarshall",relation:"before",toMiddleware:"serializerMiddleware",override:!0}),this.clientCommand.middlewareStack.addRelativeTo((s,o)=>async a=>{let c=await s(a);return c.output=$r(c.output,this.outputKeyNodes,i),c},{name:"DocumentUnmarshall",relation:"before",toMiddleware:"deserializerMiddleware",override:!0})}};var Ue="preferred",Zs=["disabled","preferred","required"];function pe(e){return Zs.includes(e)}r(pe,"validateAccountIdEndpointMode");var Kt=r(e=>{let{accountIdEndpointMode:t}=e,n=se(t??Ue);return Object.assign(e,{accountIdEndpointMode:r(async()=>{let i=await n();if(!pe(i))throw new Error(`Invalid value for accountIdEndpointMode: ${i}. Valid values are: "required", "preferred", "disabled".`);return i},"accountIdEndpointMode")})},"resolveAccountIdEndpointModeConfig");var Nr="Invalid AccountIdEndpointMode value",Or=r(e=>{throw new Error(e)},"_throw"),Lr="AWS_ACCOUNT_ID_ENDPOINT_MODE",Ur="account_id_endpoint_mode",Vt={environmentVariableSelector:r(e=>{let t=e[Lr];return t&&!pe(t)&&Or(Nr),t},"environmentVariableSelector"),configFileSelector:r(e=>{let t=e[Ur];return t&&!pe(t)&&Or(Nr),t},"configFileSelector"),default:Ue};var Mr=["AWS_ENABLE_ENDPOINT_DISCOVERY","AWS_ENDPOINT_DISCOVERY_ENABLED"],jt="endpoint_discovery_enabled",Br=r(e=>["false","0"].indexOf(e)>=0,"isFalsy"),Wt={environmentVariableSelector:r(e=>{for(let t=0;t<Mr.length;t++){let n=Mr[t];if(n in e){let i=e[n];if(i==="")throw Error(`Environment variable ${n} can't be empty of undefined, got "${i}"`);return!Br(i)}}},"environmentVariableSelector"),configFileSelector:r(e=>{if(jt in e){let t=e[jt];if(t===void 0)throw Error(`Shared config entry ${jt} can't be undefined, got "${t}"`);return!Br(t)}},"configFileSelector"),default:void 0};var Qr=Ns(Jr());var fe=class{static{r(this,"EndpointCache")}cache;constructor(t){this.cache=new Qr.default(t)}getEndpoint(t){let n=this.get(t);if(!n||n.length===0)return;let i=n.map(s=>s.Address);return i[Math.floor(Math.random()*i.length)]}get(t){if(!this.has(t))return;let n=this.cache.get(t);if(!n)return;let i=Date.now(),s=n.filter(o=>i<o.Expires);if(s.length===0){this.delete(t);return}return s}set(t,n){let i=Date.now();this.cache.set(t,n.map(({Address:s,CachePeriodInMinutes:o})=>({Address:s,Expires:i+o*60*1e3})))}delete(t){this.cache.set(t,[])}has(t){if(!this.cache.has(t))return!1;let n=this.cache.peek(t);return n?n.length>0:!1}clear(){this.cache.clear()}};var Jt=r((e,{endpointDiscoveryCommandCtor:t})=>{let{endpointCacheSize:n,endpointDiscoveryEnabled:i,endpointDiscoveryEnabledProvider:s}=e;return Object.assign(e,{endpointDiscoveryCommandCtor:t,endpointCache:new fe(n??1e3),endpointDiscoveryEnabled:i!==void 0?()=>Promise.resolve(i):s,isClientEndpointDiscoveryEnabled:i!==void 0})},"resolveEndpointDiscoveryConfig");var Zr=r(async(e,t,n)=>({operation:fn(t).operation,region:await se(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()}),"defaultDynamoDBHttpAuthSchemeParametersProvider");function mo(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"dynamodb",region:e.region},propertiesExtractor:r((t,n)=>({signingProperties:{config:t,context:n}}),"propertiesExtractor")}}r(mo,"createAwsAuthSigv4HttpAuthOption");var Yr=r(e=>{let t=[];switch(e.operation){default:t.push(mo(e))}return t},"defaultDynamoDBHttpAuthSchemeProvider"),ei=r(e=>{let t=pr(e);return Object.assign(t,{authSchemePreference:se(e.authSchemePreference??[])})},"resolveHttpAuthSchemeConfig");var ti=r(e=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"dynamodb"}),"resolveClientEndpointParameters"),ni={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},AccountId:{type:"builtInParams",name:"accountId"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"},AccountIdEndpointMode:{type:"builtInParams",name:"accountIdEndpointMode"}};var D=Sn(ni,"DynamoDB_20120810","DynamoDBClient",Bn),ri={};var j={ResourceArn:{type:"contextParams",name:"TableName"}};var ii={ResourceArnList:{type:"operationContextParams",get:r(e=>e?.TransactItems?.map(t=>[t?.ConditionCheck?.TableName,t?.Put?.TableName,t?.Delete?.TableName,t?.Update?.TableName].filter(n=>n)).flat(),"get")}},k=r((e,t,n,i)=>[],"_mw0");var p=class e extends vn{static{r(this,"DynamoDBServiceException")}static shapeId="smithy.ts.sdk.synthetic.com.amazonaws.dynamodb#DynamoDBServiceException";constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};var Me=class e extends p{static{r(this,"BackupInUseException")}static shapeId="com.amazonaws.dynamodb#BackupInUseException";name="BackupInUseException";$fault="client";constructor(t){super({name:"BackupInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Be=class e extends p{static{r(this,"BackupNotFoundException")}static shapeId="com.amazonaws.dynamodb#BackupNotFoundException";name="BackupNotFoundException";$fault="client";constructor(t){super({name:"BackupNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Ge=class e extends p{static{r(this,"InternalServerError")}static shapeId="com.amazonaws.dynamodb#InternalServerError";name="InternalServerError";$fault="server";constructor(t){super({name:"InternalServerError",$fault:"server",...t}),Object.setPrototypeOf(this,e.prototype)}},Fe=class e extends p{static{r(this,"RequestLimitExceeded")}static shapeId="com.amazonaws.dynamodb#RequestLimitExceeded";name="RequestLimitExceeded";$fault="client";ThrottlingReasons;constructor(t){super({name:"RequestLimitExceeded",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.ThrottlingReasons=t.ThrottlingReasons}},Ke=class e extends p{static{r(this,"ThrottlingException")}static shapeId="com.amazonaws.dynamodb#ThrottlingException";name="ThrottlingException";$fault="client";throttlingReasons;constructor(t){super({name:"ThrottlingException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.throttlingReasons=t.throttlingReasons}},Ve=class e extends p{static{r(this,"InvalidEndpointException")}static shapeId="com.amazonaws.dynamodb#InvalidEndpointException";name="InvalidEndpointException";$fault="client";Message;constructor(t){super({name:"InvalidEndpointException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.Message=t.Message}},je=class e extends p{static{r(this,"ProvisionedThroughputExceededException")}static shapeId="com.amazonaws.dynamodb#ProvisionedThroughputExceededException";name="ProvisionedThroughputExceededException";$fault="client";ThrottlingReasons;constructor(t){super({name:"ProvisionedThroughputExceededException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.ThrottlingReasons=t.ThrottlingReasons}},We=class e extends p{static{r(this,"ResourceNotFoundException")}static shapeId="com.amazonaws.dynamodb#ResourceNotFoundException";name="ResourceNotFoundException";$fault="client";constructor(t){super({name:"ResourceNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},qe=class e extends p{static{r(this,"ItemCollectionSizeLimitExceededException")}static shapeId="com.amazonaws.dynamodb#ItemCollectionSizeLimitExceededException";name="ItemCollectionSizeLimitExceededException";$fault="client";constructor(t){super({name:"ItemCollectionSizeLimitExceededException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ze=class e extends p{static{r(this,"ReplicatedWriteConflictException")}static shapeId="com.amazonaws.dynamodb#ReplicatedWriteConflictException";name="ReplicatedWriteConflictException";$fault="client";$retryable={};constructor(t){super({name:"ReplicatedWriteConflictException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},He=class e extends p{static{r(this,"ContinuousBackupsUnavailableException")}static shapeId="com.amazonaws.dynamodb#ContinuousBackupsUnavailableException";name="ContinuousBackupsUnavailableException";$fault="client";constructor(t){super({name:"ContinuousBackupsUnavailableException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Xe=class e extends p{static{r(this,"LimitExceededException")}static shapeId="com.amazonaws.dynamodb#LimitExceededException";name="LimitExceededException";$fault="client";constructor(t){super({name:"LimitExceededException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Je=class e extends p{static{r(this,"TableInUseException")}static shapeId="com.amazonaws.dynamodb#TableInUseException";name="TableInUseException";$fault="client";constructor(t){super({name:"TableInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Qe=class e extends p{static{r(this,"TableNotFoundException")}static shapeId="com.amazonaws.dynamodb#TableNotFoundException";name="TableNotFoundException";$fault="client";constructor(t){super({name:"TableNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Ze=class e extends p{static{r(this,"GlobalTableAlreadyExistsException")}static shapeId="com.amazonaws.dynamodb#GlobalTableAlreadyExistsException";name="GlobalTableAlreadyExistsException";$fault="client";constructor(t){super({name:"GlobalTableAlreadyExistsException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},Ye=class e extends p{static{r(this,"ResourceInUseException")}static shapeId="com.amazonaws.dynamodb#ResourceInUseException";name="ResourceInUseException";$fault="client";constructor(t){super({name:"ResourceInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},et=class e extends p{static{r(this,"TransactionConflictException")}static shapeId="com.amazonaws.dynamodb#TransactionConflictException";name="TransactionConflictException";$fault="client";constructor(t){super({name:"TransactionConflictException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},tt=class e extends p{static{r(this,"PolicyNotFoundException")}static shapeId="com.amazonaws.dynamodb#PolicyNotFoundException";name="PolicyNotFoundException";$fault="client";constructor(t){super({name:"PolicyNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},nt=class e extends p{static{r(this,"ExportNotFoundException")}static shapeId="com.amazonaws.dynamodb#ExportNotFoundException";name="ExportNotFoundException";$fault="client";constructor(t){super({name:"ExportNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},rt=class e extends p{static{r(this,"GlobalTableNotFoundException")}static shapeId="com.amazonaws.dynamodb#GlobalTableNotFoundException";name="GlobalTableNotFoundException";$fault="client";constructor(t){super({name:"GlobalTableNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},it=class e extends p{static{r(this,"ImportNotFoundException")}static shapeId="com.amazonaws.dynamodb#ImportNotFoundException";name="ImportNotFoundException";$fault="client";constructor(t){super({name:"ImportNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},st=class e extends p{static{r(this,"DuplicateItemException")}static shapeId="com.amazonaws.dynamodb#DuplicateItemException";name="DuplicateItemException";$fault="client";constructor(t){super({name:"DuplicateItemException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ot=class e extends p{static{r(this,"IdempotentParameterMismatchException")}static shapeId="com.amazonaws.dynamodb#IdempotentParameterMismatchException";name="IdempotentParameterMismatchException";$fault="client";Message;constructor(t){super({name:"IdempotentParameterMismatchException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.Message=t.Message}},at=class e extends p{static{r(this,"TransactionInProgressException")}static shapeId="com.amazonaws.dynamodb#TransactionInProgressException";name="TransactionInProgressException";$fault="client";Message;constructor(t){super({name:"TransactionInProgressException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.Message=t.Message}},ut=class e extends p{static{r(this,"ExportConflictException")}static shapeId="com.amazonaws.dynamodb#ExportConflictException";name="ExportConflictException";$fault="client";constructor(t){super({name:"ExportConflictException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ct=class e extends p{static{r(this,"InvalidExportTimeException")}static shapeId="com.amazonaws.dynamodb#InvalidExportTimeException";name="InvalidExportTimeException";$fault="client";constructor(t){super({name:"InvalidExportTimeException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},lt=class e extends p{static{r(this,"PointInTimeRecoveryUnavailableException")}static shapeId="com.amazonaws.dynamodb#PointInTimeRecoveryUnavailableException";name="PointInTimeRecoveryUnavailableException";$fault="client";constructor(t){super({name:"PointInTimeRecoveryUnavailableException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},pt=class e extends p{static{r(this,"ImportConflictException")}static shapeId="com.amazonaws.dynamodb#ImportConflictException";name="ImportConflictException";$fault="client";constructor(t){super({name:"ImportConflictException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},mt=class e extends p{static{r(this,"TableAlreadyExistsException")}static shapeId="com.amazonaws.dynamodb#TableAlreadyExistsException";name="TableAlreadyExistsException";$fault="client";constructor(t){super({name:"TableAlreadyExistsException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ft=class e extends p{static{r(this,"InvalidRestoreTimeException")}static shapeId="com.amazonaws.dynamodb#InvalidRestoreTimeException";name="InvalidRestoreTimeException";$fault="client";constructor(t){super({name:"InvalidRestoreTimeException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},dt=class e extends p{static{r(this,"ReplicaAlreadyExistsException")}static shapeId="com.amazonaws.dynamodb#ReplicaAlreadyExistsException";name="ReplicaAlreadyExistsException";$fault="client";constructor(t){super({name:"ReplicaAlreadyExistsException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},yt=class e extends p{static{r(this,"ReplicaNotFoundException")}static shapeId="com.amazonaws.dynamodb#ReplicaNotFoundException";name="ReplicaNotFoundException";$fault="client";constructor(t){super({name:"ReplicaNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},ht=class e extends p{static{r(this,"IndexNotFoundException")}static shapeId="com.amazonaws.dynamodb#IndexNotFoundException";name="IndexNotFoundException";$fault="client";constructor(t){super({name:"IndexNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype)}},vt=class e extends p{static{r(this,"ConditionalCheckFailedException")}static shapeId="com.amazonaws.dynamodb#ConditionalCheckFailedException";name="ConditionalCheckFailedException";$fault="client";Item;constructor(t){super({name:"ConditionalCheckFailedException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.Item=t.Item}},xt=class e extends p{static{r(this,"TransactionCanceledException")}static shapeId="com.amazonaws.dynamodb#TransactionCanceledException";name="TransactionCanceledException";$fault="client";Message;CancellationReasons;constructor(t){super({name:"TransactionCanceledException",$fault:"client",...t}),Object.setPrototypeOf(this,e.prototype),this.Message=t.Message,this.CancellationReasons=t.CancellationReasons}};var fo="Action";var yo="AttributeMap";var Qt="AttributesToGet",oi="AttributeUpdates",ho="AttributeValue",Zt="AttributeValueList",vo="AttributeValueUpdate",xo="Address",bo="Attributes";var go="BackupInUseException";var Io="BackupNotFoundException",Eo="BOOL";var So="BS";var _o="B",To="Code";var Ao="ContinuousBackupsUnavailableException",Y="ConsumedCapacity",Do="ConditionalCheckFailedException",ko="ConsumedCapacityMultiple",ai="ConditionCheck";var de="ConditionExpression";var ui="ComparisonOperator",Yt="ConditionalOperator";var wo="CachePeriodInMinutes",Co="CancellationReasons";var Ro="CancellationReasonList",Po="ConfirmRemoveSelfResourceAccess",$o="ClientRequestToken",No="CancellationReason",en="ConsistentRead";var ci="CapacityUnits";var Oo="Capacity",Lo="Condition",li="Count";var Uo="DescribeEndpoints";var Mo="DescribeEndpointsRequest",Bo="DescribeEndpointsResponse";var Go="DuplicateItemException";var pi="Delete";var Fo="ExpectedAttributeMap",W="ExpressionAttributeNames",H="ExpressionAttributeValues",Ko="ExpressionAttributeValueMap",Vo="ExpectedAttributeValue";var jo="ExportConflictException";var Wo="ExportNotFoundException";var qo="ExpectedRevisionId";var mi="ExclusiveStartKey";var fi="Endpoints";var zo="Endpoint",Ho="Expected",Xo="Exists";var Jo="FilterConditionMap";var di="FilterExpression";var Qo="GetItem",Zo="GetItemInput",Yo="GetItemOutput";var ea="GlobalSecondaryIndexes";var ta="GlobalTableAlreadyExistsException";var na="GlobalTableNotFoundException";var bt="Item";var ra="ImportConflictException",ia="ItemCollectionKey",sa="ItemCollectionKeyAttributeMap",tn="ItemCollectionMetrics",oa="ItemCollectionMetricsMultiple",aa="ItemCollectionMetricsPerTable",ua="ItemCollectionSizeLimitExceededException";var ca="InvalidEndpointException";var la="InvalidExportTimeException";var pa="ItemList",yi="IndexName",ma="ImportNotFoundException",fa="IndexNotFoundException",da="IdempotentParameterMismatchException";var ya="InvalidRestoreTimeException";var ha="InternalServerError";var hi="Items",ee="Key";var vi="KeyConditions",va="KeyConditionExpression";var xi="Limit",xa="ListAttributeValue";var ba="LimitExceededException";var bi="LastEvaluatedKey";var ga="LocalSecondaryIndexes";var Ia="L",ye="Message",Ea="MapAttributeValue";var Sa="M",_a="N";var Ta="NS";var Aa="NULL";var nn="ProjectionExpression";var Da="PutItemInputAttributeMap";var ka="PointInTimeRecoveryUnavailableException";var wa="PolicyNotFoundException";var Ca="PutResourcePolicyInput";var Ra="ProvisionedThroughputExceededException";var Pa="Policy";var gi="Put",$a="Query",Na="QueryFilter",Oa="QueryInput",La="QueryOutput";var Ua="ResourceArn",Ma="ReplicaAlreadyExistsException";var he="ReturnConsumedCapacity",Ii="ReadCapacityUnits";var Ei="ReturnItemCollectionMetrics";var Ba="ResourceInUseException";var Ga="RequestLimitExceeded";var Fa="ReplicaNotFoundException",Ka="ResourceNotFoundException";var Va="ReturnValues",ve="ReturnValuesOnConditionCheckFailure",ja="ReplicatedWriteConflictException";var Si="ScannedCount";var Wa="SizeEstimateRangeGB",qa="ScanFilter",za="ScanInput";var Ha="SecondaryIndexesCapacityMap",Xa="ScanIndexForward";var Ja="ScanOutput";var Qa="SS";var Za="S";var Ya="Scan",_i="Select",eu="Segment";var tu="Table";var nu="TableAlreadyExistsException";var ru="TransactionCanceledException",iu="TransactionConflictException";var su="ThrottlingException";var ou="TransactionInProgressException",au="TableInUseException",uu="TransactItems";var G="TableName",cu="TableNotFoundException";var Ti="ThrottlingReasons";var lu="ThrottlingReasonList";var pu="ThrottlingReason";var mu="TotalSegments";var fu="TransactWriteItem",du="TransactWriteItemsInput",yu="TransactWriteItemList",hu="TransactWriteItemsOutput",vu="TransactWriteItems";var Ai="Update";var Di="UpdateExpression";var xu="UpdateItemInput",bu="UpdateItemOutput",gu="UpdateItem";var ki="Value";var Iu="VectorCapacity",Eu="VectorIndexes",Su="VectorIndexesCapacityMap";var _u="VectorSearchRequestBytes",Tu="VectorWriteRequestBytes",wi="WriteCapacityUnits";var Au="awsQueryError",h="client",y="error",Ci="httpError",Du="httpHeader",v="message",ku="reason",wu="resource",Ri="smithy.ts.sdk.synthetic.com.amazonaws.dynamodb",Cu="server",Ru="throttlingReasons",Pu="x-amz-confirm-remove-self-resource-access",u="com.amazonaws.dynamodb",Pi=new Lt(Ri),$u=[-3,Ri,"DynamoDBServiceException",0,[],[]];Pi.registerError($u,p);var f=new Lt(u),Nu=[-3,u,go,{[y]:h},[v],[0]];f.registerError(Nu,Me);var Ou=[-3,u,Io,{[y]:h},[v],[0]];f.registerError(Ou,Be);var Lu=[-3,u,Do,{[y]:h},[v,bt],[0,()=>be]];f.registerError(Lu,vt);var Uu=[-3,u,Ao,{[y]:h},[v],[0]];f.registerError(Uu,He);var Mu=[-3,u,Go,{[y]:h},[v],[0]];f.registerError(Mu,st);var Bu=[-3,u,jo,{[y]:h},[v],[0]];f.registerError(Bu,ut);var Gu=[-3,u,Wo,{[y]:h},[v],[0]];f.registerError(Gu,nt);var Fu=[-3,u,ta,{[y]:h},[v],[0]];f.registerError(Fu,Ze);var Ku=[-3,u,na,{[y]:h},[v],[0]];f.registerError(Ku,rt);var Vu=[-3,u,da,{[y]:h},[ye],[0]];f.registerError(Vu,ot);var ju=[-3,u,ra,{[y]:h},[v],[0]];f.registerError(ju,pt);var Wu=[-3,u,ma,{[y]:h},[v],[0]];f.registerError(Wu,it);var qu=[-3,u,fa,{[y]:h},[v],[0]];f.registerError(qu,ht);var zu=[-3,u,ha,{[y]:Cu},[v],[0]];f.registerError(zu,Ge);var Hu=[-3,u,ca,{[y]:h,[Ci]:421},[ye],[0]];f.registerError(Hu,Ve);var Xu=[-3,u,la,{[y]:h},[v],[0]];f.registerError(Xu,ct);var Ju=[-3,u,ya,{[y]:h},[v],[0]];f.registerError(Ju,ft);var Qu=[-3,u,ua,{[y]:h},[v],[0]];f.registerError(Qu,qe);var Zu=[-3,u,ba,{[y]:h},[v],[0]];f.registerError(Zu,Xe);var Yu=[-3,u,ka,{[y]:h},[v],[0]];f.registerError(Yu,lt);var ec=[-3,u,wa,{[y]:h},[v],[0]];f.registerError(ec,tt);var tc=[-3,u,Ra,{[y]:h},[v,Ti],[0,()=>rn]];f.registerError(tc,je);var nc=[-3,u,Ma,{[y]:h},[v],[0]];f.registerError(nc,dt);var rc=[-3,u,Fa,{[y]:h},[v],[0]];f.registerError(rc,yt);var ic=[-3,u,ja,{[y]:h},[v],[0]];f.registerError(ic,ze);var sc=[-3,u,Ga,{[y]:h},[v,Ti],[0,()=>rn]];f.registerError(sc,Fe);var oc=[-3,u,Ba,{[y]:h},[v],[0]];f.registerError(oc,Ye);var ac=[-3,u,Ka,{[y]:h},[v],[0]];f.registerError(ac,We);var uc=[-3,u,nu,{[y]:h},[v],[0]];f.registerError(uc,mt);var cc=[-3,u,au,{[y]:h},[v],[0]];f.registerError(cc,Je);var lc=[-3,u,cu,{[y]:h},[v],[0]];f.registerError(lc,Qe);var pc=[-3,u,su,{[Au]:["Throttling",400],[y]:h,[Ci]:400},[v,Ru],[0,()=>rn]];f.registerError(pc,Ke);var mc=[-3,u,ru,{[y]:h},[ye,Co],[0,()=>Mc]];f.registerError(mc,xt);var fc=[-3,u,iu,{[y]:h},[v],[0]];f.registerError(fc,et);var dc=[-3,u,ou,{[y]:h},[ye],[0]];f.registerError(dc,at);var $i=[Pi,f];var yc=[3,u,vo,0,[ki,fo],[()=>L,0]];var hc=[3,u,No,0,[bt,To,ye],[()=>be,0,0]],Ni=[3,u,Oo,0,[Ii,wi,ci],[1,1,1]],Oi=[3,u,Lo,0,[ui,Zt],[0,()=>Ui],1],vc=[3,u,ai,0,[ee,G,de,W,H,ve],[()=>F,0,0,128,()=>X,0],3],xe=[3,u,Y,0,[G,ci,Ii,wi,tu,ga,ea,Eu],[0,1,1,1,()=>Ni,()=>si,()=>si,()=>Qc]];var xc=[3,u,pi,0,[ee,G,de,W,H,ve],[()=>F,0,0,128,()=>X,0],2];var bc=[3,u,Mo,0,[],[]],gc=[3,u,Bo,0,[fi],[()=>Gc],1];var Ic=[3,u,zo,0,[xo,wo],[0,1],2];var Ec=[3,u,Vo,0,[ki,Xo,ui,Zt],[()=>L,2,0,()=>Ui]];var Sc=[3,u,Zo,0,[G,ee,Qt,en,he,nn,W],[0,()=>F,64,2,0,0,128],2],_c=[3,u,Yo,0,[bt,Y],[()=>be,()=>xe]];var Li=[3,u,tn,0,[ia,Wa],[()=>qc,65]];var Tc=[3,u,gi,0,[bt,G,de,W,H,ve],[()=>Jc,0,0,128,()=>X,0],2];var qp=[3,u,Ca,0,[Ua,Pa,qo,Po],[0,0,0,[2,{[Du]:Pu}]],2];var Ac=[3,u,Oa,0,[G,yi,_i,Qt,xi,en,vi,Na,Yt,Xa,mi,he,nn,di,va,W,H],[0,0,0,64,1,2,()=>Hc,()=>Bi,0,2,()=>F,0,0,0,0,128,()=>X],1],Dc=[3,u,La,0,[hi,li,Si,bi,Y],[()=>Mi,1,1,()=>F,()=>xe]];var kc=[3,u,za,0,[G,yi,Qt,xi,_i,qa,Yt,mi,he,mu,eu,nn,di,W,H,en],[0,0,64,1,0,()=>Bi,0,()=>F,0,1,1,0,0,128,()=>X,2],1],wc=[3,u,Ja,0,[hi,li,Si,bi,Y],[()=>Mi,1,1,()=>F,()=>xe]];var Cc=[3,u,pu,0,[ku,wu],[0,0]];var Rc=[3,u,fu,0,[ai,gi,pi,Ai],[()=>vc,()=>Tc,()=>xc,()=>Nc]],Pc=[3,u,du,0,[uu,he,Ei,$o],[()=>Vc,0,0,[0,4]],1],$c=[3,u,hu,0,[Y,tn],[()=>Bc,()=>zc]];var Nc=[3,u,Ai,0,[ee,Di,G,de,W,H,ve],[()=>F,0,0,0,128,()=>X,0],3];var Oc=[3,u,xu,0,[G,ee,oi,Ho,Yt,Va,he,Ei,Di,de,W,H,ve],[0,()=>F,()=>jc,()=>Wc,0,0,0,0,0,0,128,()=>X,0],2],Lc=[3,u,bu,0,[bo,Y,tn],[()=>be,()=>xe,()=>Li]];var Uc=[3,u,Iu,0,[_u,Tu],[1,1]];var Ui=[1,u,Zt,0,()=>L];var Mc=[1,u,Ro,0,()=>hc],Bc=[1,u,ko,0,()=>xe];var Gc=[1,u,fi,0,()=>Ic];var Fc=[1,u,oa,0,()=>Li];var Mi=[1,u,pa,0,()=>be];var Kc=[1,u,xa,0,()=>L];var rn=[1,u,lu,0,()=>Cc];var Vc=[1,u,yu,0,()=>Rc];var be=[2,u,yo,0,0,()=>L],jc=[2,u,oi,0,0,()=>yc];var Wc=[2,u,Fo,0,0,()=>Ec];var X=[2,u,Ko,0,0,()=>L],Bi=[2,u,Jo,0,0,()=>Oi],qc=[2,u,sa,0,0,()=>L],zc=[2,u,aa,0,0,()=>Fc],F=[2,u,ee,0,0,()=>L],Hc=[2,u,vi,0,0,()=>Oi],Xc=[2,u,Ea,0,0,()=>L],Jc=[2,u,Da,0,0,()=>L],si=[2,u,Ha,0,0,()=>Ni],Qc=[2,u,Su,0,0,()=>Uc],L=[4,u,ho,0,[Za,_a,_o,Qa,Ta,So,Sa,Ia,Aa,Eo],[0,0,21,64,64,85,()=>Xc,()=>Kc,2,2]];var Gi=[9,u,Uo,0,()=>bc,()=>gc];var Fi=[9,u,Qo,0,()=>Sc,()=>_c];var Ki=[9,u,$a,0,()=>Ac,()=>Dc];var Vi=[9,u,Ya,0,()=>kc,()=>wc];var ji=[9,u,vu,0,()=>Pc,()=>$c];var Wi=[9,u,gu,0,()=>Oc,()=>Lc];var gt=class extends D(ri,k,"DescribeEndpoints",Gi){static{r(this,"DescribeEndpointsCommand")}};var qi={name:"@aws-sdk/client-dynamodb",version:"3.1150.0",description:"AWS SDK for JavaScript Dynamodb Client for Node.js, Browser and React Native",homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-dynamodb",license:"Apache-2.0",author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/sdk-for-javascript/"},repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-dynamodb"},files:["dist-*/**"],sideEffects:!1,main:"./dist-cjs/index.js",module:"./dist-es/index.js",browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},types:"./dist-types/index.d.ts",typesVersions:{"<4.5":{"dist-types/*":["dist-types/ts3.4/*"]}},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},scripts:{build:"concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs","build:cjs":"node ../../scripts/compilation/inline","build:es":"premove dist-es && tsc -p tsconfig.es.json","build:include:deps":'yarn g:turbo run build -F="$npm_package_name"',"build:types":"premove dist-types && tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"premove dist-cjs dist-es dist-types","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service",test:"yarn g:vitest run --passWithNoTests","test:watch":"yarn g:vitest watch --passWithNoTests","test:integration":"yarn g:vitest run --passWithNoTests -c vitest.config.integ.mts","test:integration:watch":"yarn g:vitest watch --passWithNoTests -c vitest.config.integ.mts","test:e2e":"yarn g:vitest run -c vitest.config.e2e.mts","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.mts","test:index":"tsc -p tsconfig.test.json && node ./test/index-objects.spec.mjs"},dependencies:{"@aws-sdk/core":"^3.978.3","@aws-sdk/credential-provider-node":"^3.972.86","@aws-sdk/dynamodb-codec":"^3.973.48","@aws-sdk/middleware-endpoint-discovery":"^3.972.32","@aws-sdk/types":"^3.974.6","@smithy/core":"^3.35.2","@smithy/fetch-http-handler":"^5.8.0","@smithy/node-http-handler":"^4.12.1","@smithy/types":"^4.19.0",tslib:"^2.6.2"},devDependencies:{"@smithy/snapshot-testing":"^2.3.2","@tsconfig/node20":"20.1.8","@types/node":"^20.14.8",concurrently:"7.0.0","downlevel-dts":"0.10.1",premove:"4.0.0",typescript:"~7.0.2",vitest:"^4.0.17"},engines:{node:">=20.0.0"}};var zi="com.amazonaws.dynamodb#AttributeValue",sn=class extends dr{static{r(this,"DynamoDBJsonShapeSerializer2")}writeValue(t,n,i){if(n!=null&&typeof n=="object"){let s=Ot.of(t);if(s.isStructSchema()&&s.getName(!0)===zi){this.writeAttributeValue(n);return}}super.writeValue(t,n,i)}writeAttributeValue(t){let n=this.serdeContext?.base64Encoder??we;this.writeAscii("{");let i=!0;for(let s in t){let o=t[s];if(o!=null)switch(i||this.writeAscii(","),i=!1,this.writeAsciiQuoted(s),this.writeAscii(":"),s){case"B":o instanceof Uint8Array?this.writeBase64(o):this.writeJsonString(o);break;case"BS":this.writeAscii("[");{let a=o;for(let c=0;c<a.length;c++){c>0&&this.writeAscii(",");let d=a[c];d instanceof Uint8Array?this.writeBase64(d):this.writeJsonString(n(d))}}this.writeAscii("]");break;case"L":this.writeAscii("[");{let a=o;for(let c=0;c<a.length;c++)c>0&&this.writeAscii(","),a[c]!=null?this.writeAttributeValue(a[c]):this.writeAscii("null")}this.writeAscii("]");break;case"M":this.writeAscii("{");{let a=o,c=!0;for(let d in a)a[d]!=null&&(c||this.writeAscii(","),c=!1,this.writeJsonString(d),this.writeAscii(":"),this.writeAttributeValue(a[d]))}this.writeAscii("}");break;case"SS":case"NS":this.writeAscii("[");{let a=o;for(let c=0;c<a.length;c++)c>0&&this.writeAscii(","),this.writeJsonString(a[c])}this.writeAscii("]");break;case"S":case"N":this.writeJsonString(o);break;case"BOOL":this.writeAscii(o?"true":"false");break;case"NULL":this.writeAscii(o?"true":"false");break;default:this.writeAscii(JSON.stringify(o));break}}this.writeAscii("}")}},on=class extends fr{static{r(this,"DynamoDBJsonShapeDeserializer2")}_read(t,n){let i=Ot.of(t);return i.isStructSchema()&&i.getName(!0)===zi&&n&&typeof n=="object"?this.readAttributeValue(n):super._read(i,n)}readAttributeValue(t){let n=this.serdeContext?.base64Decoder??ke,i=t;if(typeof t.B=="string"&&(i.B=n(t.B)),Array.isArray(t.BS)&&(i.BS=t.BS.map(n)),Array.isArray(t.L)&&(i.L=t.L.map(s=>this.readAttributeValue(s))),t.M&&typeof t.M=="object"){let s=t.M;for(let o in s)s[o]=this.readAttributeValue(s[o])}return i}},ge=class extends yr{static{r(this,"DynamoDBJsonCodec2")}constructor(){super({timestampFormat:{useTrait:!0,default:7},jsonName:!1})}createSerializer(){let t=new sn(this.settings);return t.setSerdeContext(this.serdeContext),t}createDeserializer(){let t=new on(this.settings);return t.setSerdeContext(this.serdeContext),t}};var _="ref",P="argv",T=-1,Ie=!0,te=!1,ne="isSet",Ee="booleanEquals",ys="PartitionResult",R="stringEquals",$="getAttr",hs="parsedEndpoint",Hi="aws.parseArn",Xi=r(e=>"ParsedArn_ssa_"+e,"k"),Ji="service",an="dynamodb",Se="isValidHostLabel",Qi="accountId",Zi="FirstArn",Yi=r(e=>"https://{ParsedArn_ssa_"+e+"#accountId}.search-ddb.{Region}.{PartitionResult#dualStackDnsSuffix}","q"),es=r(e=>"https://{ParsedArn_ssa_"+e+"#accountId}.ddb.{Region}.{PartitionResult#dualStackDnsSuffix}","s"),ts=r(e=>"https://{ParsedArn_ssa_"+e+"#accountId}.search-ddb.{Region}.{PartitionResult#dnsSuffix}","t"),ns=r(e=>"https://{ParsedArn_ssa_"+e+"#accountId}.ddb.{Region}.{PartitionResult#dnsSuffix}","u"),It={[_]:"Region"},cn={[_]:ys},rs={fn:$,[P]:[{[_]:hs},"authority"]},un={[_]:"AccountIdEndpointMode"},is={fn:$,[P]:[cn,"name"]},ss={fn:$,[P]:[{[_]:"ParsedArn_ssa_2"},"region"]},os={[_]:"ParsedArn_ssa_2"},as={[_]:"ResourceArnList"},us={fn:$,[P]:[{[_]:"ParsedArn_ssa_1"},"region"]},cs={[_]:"ParsedArn_ssa_1"},ls={[_]:"AccountId"},K={},w={metricValues:["O"]},ps=[It],ms=[{[_]:"Endpoint"}],fs=[{[_]:"ResourceArn"}],ds={conditions:[[ne,ps],[ne,ms],[Ee,[{[_]:"UseFIPS"},Ie]],[Ee,[{[_]:"UseDualStack"},Ie]],["aws.partition",ps,ys],[R,[It,"local"]],[Ee,[{fn:$,[P]:[cn,"supportsFIPS"]},Ie]],["parseURL",ms,hs],[R,["dynamodb.{Region}.{PartitionResult#dualStackDnsSuffix}",rs]],[Ee,[{fn:$,[P]:[cn,"supportsDualStack"]},Ie]],[R,["search-dynamodb.{Region}.{PartitionResult#dualStackDnsSuffix}",rs]],[ne,[un]],[R,[is,"aws"]],[R,[un,"disabled"]],[ne,fs],[Hi,fs,Xi(2)],[R,[ss,It]],[R,[{fn:$,[P]:[os,Ji]},an]],[Se,[ss,te]],[Se,[{fn:$,[P]:[os,Qi]},te]],[ne,[as]],[$,[as,"[0]"],Zi],[Hi,[{[_]:Zi}],Xi(1)],[R,[us,It]],[R,[{fn:$,[P]:[cs,Ji]},an]],[Se,[{fn:$,[P]:[cs,Qi]},te]],[Se,[us,te]],[ne,[ls]],[R,[un,"required"]],[Se,[ls,te]],[R,[is,"aws-us-gov"]],[Ee,[{fn:"coalesce",[P]:[{[_]:"IsSearchOperation"},te]},Ie]]],results:[[T],[T,"Invalid Configuration: FIPS and custom endpoint are not supported"],[T,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[T,"Endpoint override is not supported for dual-stack endpoints. Please enable dual-stack functionality by enabling the configuration. For more details, see: https://docs.aws.amazon.com/sdkref/latest/guide/feature-endpoints.html"],["{Endpoint}",K],[T,"Invalid Configuration: FIPS and local endpoint are not supported"],[T,"Invalid Configuration: Dualstack and local endpoint are not supported"],["http://localhost:8000",{authSchemes:[{signingRegion:"us-east-1",signingName:an,name:"sigv4"}]}],[T,"Invalid Configuration: AccountIdEndpointMode is required and FIPS is enabled, but FIPS account endpoints are not supported"],["https://search-dynamodb-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",K],["https://dynamodb-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",K],[T,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://search-dynamodb.{Region}.{PartitionResult#dnsSuffix}",K],["https://dynamodb.{Region}.{PartitionResult#dnsSuffix}",K],["https://search-dynamodb-fips.{Region}.{PartitionResult#dnsSuffix}",K],["https://dynamodb-fips.{Region}.{PartitionResult#dnsSuffix}",K],[T,"FIPS is enabled but this partition does not support FIPS"],[Yi(2),w],[es(2),w],[Yi(1),w],[es(1),w],["https://{AccountId}.search-ddb.{Region}.{PartitionResult#dualStackDnsSuffix}",w],["https://{AccountId}.ddb.{Region}.{PartitionResult#dualStackDnsSuffix}",w],[T,"Credentials-sourced account ID parameter is invalid"],[T,"AccountIdEndpointMode is required but no AccountID was provided or able to be loaded"],[T,"Invalid Configuration: AccountIdEndpointMode is required but account endpoints are not supported in this partition"],["https://search-dynamodb.{Region}.{PartitionResult#dualStackDnsSuffix}",K],["https://dynamodb.{Region}.{PartitionResult#dualStackDnsSuffix}",K],[T,"DualStack is enabled but this partition does not support DualStack"],[ts(2),w],[ns(2),w],[ts(1),w],[ns(1),w],["https://{AccountId}.search-ddb.{Region}.{PartitionResult#dnsSuffix}",w],["https://{AccountId}.ddb.{Region}.{PartitionResult#dnsSuffix}",w],[T,"Invalid Configuration: Missing Region"]]},Yc=2,l=1e8,el=new Int32Array([-1,1,-1,0,6,3,1,4,l+35,2,l+1,5,3,l+2,l+4,1,77,7,2,61,8,3,34,9,4,10,l+35,5,l+7,11,11,12,69,12,14,13,28,l+25,69,13,33,15,14,16,21,15,17,21,16,18,21,17,19,21,18,20,21,19,32,21,20,22,28,21,23,28,22,24,28,23,25,28,24,26,28,25,27,28,26,31,28,27,29,33,29,30,l+23,31,l+33,l+34,31,l+31,l+32,31,l+29,l+30,28,l+24,69,4,35,l+35,5,l+6,36,9,37,l+28,11,38,60,12,40,39,28,l+25,60,13,59,41,14,42,47,15,43,47,16,44,47,17,45,47,18,46,47,19,58,47,20,48,54,21,49,54,22,50,54,23,51,54,24,52,54,25,53,54,26,57,54,27,55,59,29,56,l+23,31,l+21,l+22,31,l+19,l+20,31,l+17,l+18,28,l+24,60,31,l+26,l+27,3,70,62,4,63,l+35,5,l+5,64,6,65,l+16,11,66,67,28,l+8,67,30,69,68,31,l+14,l+15,31,l+12,l+13,4,71,l+35,5,l+5,72,6,73,l+11,9,74,l+11,11,75,76,28,l+8,76,31,l+9,l+10,2,l+1,78,3,l+2,79,4,80,l+4,7,81,l+4,8,l+3,82,10,l+3,l+4]),vs=Nn.from(el,Yc,ds.conditions,ds.results);var tl=new On({size:50,params:["AccountId","AccountIdEndpointMode","Endpoint","IsSearchOperation","Region","ResourceArn","ResourceArnList","UseDualStack","UseFIPS"]}),xs=r((e,t={})=>tl.get(e,()=>Un(vs,{endpointParams:e,logger:t.logger})),"defaultEndpointResolver");Ln.aws=or;var bs=r(e=>({apiVersion:"2012-08-10",base64Decoder:e?.base64Decoder??ke,base64Encoder:e?.base64Encoder??we,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??xs,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Yr,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:r(t=>t.getIdentityProvider("aws.auth#sigv4"),"identityProvider"),signer:new cr}],logger:e?.logger??new En,protocol:e?.protocol??hr,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.dynamodb",errorTypeRegistries:$i,xmlNamespace:"http://dynamodb.amazonaws.com/doc/2012-08-10/",version:"2012-08-10",serviceTarget:"DynamoDB_20120810",jsonCodec:new ge},serviceId:e?.serviceId??"DynamoDB",sha256:e?.sha256??Fn,urlParser:e?.urlParser??dn,utf8Decoder:e?.utf8Decoder??Tn,utf8Encoder:e?.utf8Encoder??An}),"getRuntimeConfig");var gs=r(e=>{bn(process.version);let t=$n(e),n=r(()=>t().then(xn),"defaultConfigProvider"),i=bs(e);_n(process.version);let s={profile:e?.profile,logger:i.logger};return{...i,...e,runtime:"node",defaultsMode:t,accountIdEndpointMode:e?.accountIdEndpointMode??N(Vt,s),authSchemePreference:e?.authSchemePreference??N(lr,s),bodyLengthChecker:e?.bodyLengthChecker??Dn,credentialDefaultProvider:e?.credentialDefaultProvider??vr,defaultUserAgentProvider:e?.defaultUserAgentProvider??ir({serviceId:i.serviceId,clientVersion:qi.version}),endpointDiscoveryEnabledProvider:e?.endpointDiscoveryEnabledProvider??N(Wt,s),maxAttempts:e?.maxAttempts??N(oe.v2026?{...Ut,default:4}:Ut,e),region:e?.region??N(Cn,{...Rn,...s}),requestHandler:mr.create(e?.requestHandler??n),retryMode:e?.retryMode??N({...zn,default:r(async()=>(await n()).retryMode||Wn,"default")},e),streamCollector:e?.streamCollector??Gn,useDualstackEndpoint:e?.useDualstackEndpoint??N(kn,s),useFipsEndpoint:e?.useFipsEndpoint??N(wn,s),userAgentAppId:e?.userAgentAppId??N(sr,s)}},"getRuntimeConfig");var Is=r(e=>{let t=e.httpAuthSchemes,n=e.httpAuthSchemeProvider,i=e.credentials;return{setHttpAuthScheme(s){let o=t.findIndex(a=>a.schemeId===s.schemeId);o===-1?t.push(s):t.splice(o,1,s)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(s){n=s},httpAuthSchemeProvider(){return n},setCredentials(s){i=s},credentials(){return i}}},"getHttpAuthExtensionConfiguration"),Es=r(e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}),"resolveHttpAuthRuntimeConfig");var Ss=r((e,t)=>{let n=Object.assign(ar(e),gn(e),Kn(e),Is(e));return t.forEach(i=>i.configure(n)),Object.assign(e,ur(n),In(n),Vn(n),Es(n))},"resolveRuntimeExtensions");var re=class extends De{static{r(this,"DynamoDBClient")}config;constructor(...[t]){let n=gs(t||{});super(n),this.initConfig=n;let i=ti(n),s=Kt(i),o=nr(s),a=qn(o,{defaultBaseDelay:oe.v2026?25:void 0,defaultMaxAttempts:oe.v2026?4:void 0}),c=Pn(a),d=c,I=Mn(d),E=ei(I),Nt=Jt(E,{endpointDiscoveryCommandCtor:gt}),Ps=Ss(Nt,t?.extensions||[]);this.config=Ps,this.middlewareStack.use(yn(this.config)),this.middlewareStack.use(rr(this.config)),this.middlewareStack.use(Hn(this.config)),this.middlewareStack.use(jn(this.config)),this.middlewareStack.use(Jn(this.config)),this.middlewareStack.use(Qn(this.config)),this.middlewareStack.use(Zn(this.config)),this.middlewareStack.use(Yn(this.config,{httpAuthSchemeParametersProvider:Zr,identityProviderConfigProvider:r(async $s=>new tr({"aws.auth#sigv4":$s.credentials}),"identityProviderConfigProvider")})),this.middlewareStack.use(er(this.config))}destroy(){super.destroy()}};var Et=class extends D(j,k,"GetItem",Fi){static{r(this,"GetItemCommand")}};var St=class extends D(j,k,"Query",Ki){static{r(this,"QueryCommand")}};var _t=class extends D(j,k,"Scan",Vi){static{r(this,"ScanCommand")}};var Tt=class extends D(ii,k,"TransactWriteItems",ji){static{r(this,"TransactWriteItemsCommand")}};var At=class extends D(j,k,"UpdateItem",Wi){static{r(this,"UpdateItemCommand")}};var J=class extends x{static{r(this,"GetCommand")}input;inputKeyNodes={Key:m};outputKeyNodes={Item:m};clientCommand;middlewareStack;constructor(t){super(),this.input=t,this.clientCommand=new Et(this.input),this.middlewareStack=this.clientCommand.middlewareStack}resolveMiddleware(t,n,i){this.addMarshallingMiddleware(n);let s=t.concat(this.middlewareStack),o=this.clientCommand.resolveMiddleware(s,n,i);return async()=>o(this.clientCommand)}};var Q=class extends x{static{r(this,"QueryCommand")}input;inputKeyNodes={KeyConditions:{"*":{AttributeValueList:A}},QueryFilter:{"*":{AttributeValueList:A}},ExclusiveStartKey:m,ExpressionAttributeValues:m};outputKeyNodes={Items:{"*":m},LastEvaluatedKey:m};clientCommand;middlewareStack;constructor(t){super(),this.input=t,this.clientCommand=new St(this.input),this.middlewareStack=this.clientCommand.middlewareStack}resolveMiddleware(t,n,i){this.addMarshallingMiddleware(n);let s=t.concat(this.middlewareStack),o=this.clientCommand.resolveMiddleware(s,n,i);return async()=>o(this.clientCommand)}};var _e=class extends x{static{r(this,"ScanCommand")}input;inputKeyNodes={ScanFilter:{"*":{AttributeValueList:A}},ExclusiveStartKey:m,ExpressionAttributeValues:m};outputKeyNodes={Items:{"*":m},LastEvaluatedKey:m};clientCommand;middlewareStack;constructor(t){super(),this.input=t,this.clientCommand=new _t(this.input),this.middlewareStack=this.clientCommand.middlewareStack}resolveMiddleware(t,n,i){this.addMarshallingMiddleware(n);let s=t.concat(this.middlewareStack),o=this.clientCommand.resolveMiddleware(s,n,i);return async()=>o(this.clientCommand)}};var Te=class extends x{static{r(this,"TransactWriteCommand")}input;inputKeyNodes={TransactItems:{"*":{ConditionCheck:{Key:m,ExpressionAttributeValues:m},Put:{Item:m,ExpressionAttributeValues:m},Delete:{Key:m,ExpressionAttributeValues:m},Update:{Key:m,ExpressionAttributeValues:m}}}};outputKeyNodes={ItemCollectionMetrics:{"*":{"*":{ItemCollectionKey:m}}}};clientCommand;middlewareStack;constructor(t){super(),this.input=t,this.clientCommand=new Tt(this.input),this.middlewareStack=this.clientCommand.middlewareStack}resolveMiddleware(t,n,i){this.addMarshallingMiddleware(n);let s=t.concat(this.middlewareStack),o=this.clientCommand.resolveMiddleware(s,n,i);return async()=>o(this.clientCommand)}};var q=class extends x{static{r(this,"UpdateCommand")}input;inputKeyNodes={Key:m,AttributeUpdates:{"*":{Value:Z}},Expected:{"*":{Value:Z,AttributeValueList:A}},ExpressionAttributeValues:m};outputKeyNodes={Attributes:m,ItemCollectionMetrics:{ItemCollectionKey:m}};clientCommand;middlewareStack;constructor(t){super(),this.input=t,this.clientCommand=new At(this.input),this.middlewareStack=this.clientCommand.middlewareStack}resolveMiddleware(t,n,i){this.addMarshallingMiddleware(n);let s=t.concat(this.middlewareStack),o=this.clientCommand.resolveMiddleware(s,n,i);return async()=>o(this.clientCommand)}};var U=class e extends De{static{r(this,"DynamoDBDocumentClient")}config;constructor(t,n){if(super(t.config),this.config=t.config,this.config.translateConfig=n,this.middlewareStack=t.middlewareStack,this.config?.cacheMiddleware)throw new Error("@aws-sdk/lib-dynamodb - cacheMiddleware=true is not compatible with the DynamoDBDocumentClient. This option must be set to false.");if(!(t.middlewareStack.identify?.()??[]).some(o=>o.includes?.("serializerMiddleware"))){let o=this.config.logger,a=o&&!o.constructor?.name.includes("NoOp")?o:console,c=new re(Object.assign({},this.config,{defaultUserAgentProvider:void 0,retryStrategy:void 0,extensions:void 0}));if(c.middlewareStack.identify?.().some(I=>I.includes?.("serializerMiddleware")))this.middlewareStack=c.middlewareStack,this.config=c.config,this.config.translateConfig=n,a.warn("@aws-sdk/lib-dynamodb - WARN: incompatible version of DynamoDBClient given to DynamoDBDocumentClient. We have forwarded your client's configuration to a newer version of DynamoDBClient in the dependency closure to instantiate DynamoDBDocumentClient.");else throw new Error("@aws-sdk/lib-dynamodb - ERROR: incompatible version of DynamoDBClient given to DynamoDBDocumentClient. Check @aws-sdk/lib-dynamodb package.json requirements.")}}static from(t,n){return new e(t,n)}destroy(){}};var xy=Ce(U,Q,"ExclusiveStartKey","LastEvaluatedKey","Limit");var Sy=Ce(U,_e,"ExclusiveStartKey","LastEvaluatedKey","Limit");var Dt=["hour","day","month"],_s=["status","country","device","path"],Ts=["v1","v2"];var mh=M({pk:S(),sk:S(),source:V(Ts),appliedAt:b(),ttl:C(b())}),kt=class{constructor(t){this.props=t}props;static{r(this,"AppliedMarkers")}isApplied=r(async t=>{let{Item:n}=await this.props.dynamo.send(new J({TableName:this.props.tableName,Key:{pk:As(t),sk:"applied"}}));return n!=null},"isApplied");buildMarkerPut=r(t=>{let n={pk:As(t),sk:"applied",source:t.source,appliedAt:Date.now()};return t.ttl!=null&&(n.ttl=t.ttl),{Put:{TableName:this.props.tableName,Item:n,ConditionExpression:"attribute_not_exists(pk) AND attribute_not_exists(sk)"}}},"buildMarkerPut")};function As(e){return`applied#${e.grain}#${e.periodKey}`}r(As,"partitionKey");function ln(e,t=100){let n=[],i=Math.ceil(e.length/t),s=0,o=t;for(let a=0;a<i;a++)n.push(e.slice(s,o)),s+=t,o+=t;return n}r(ln,"splitArrayToChunks");async function wt(e){let t=[],n;do{let{Items:i=[],LastEvaluatedKey:s}=await e.dynamo.send(new Q({...e.input,ExclusiveStartKey:n}));n=s,t.push(...i)}while(n!=null);return t}r(wt,"queryAll");var rl=M({pk:S(),sk:S(),dimension:V(_s),grain:V(Dt),periodKey:S(),value:S(),hits:b(),bytes:b(),ttl:C(b())}),Ct=class{constructor(t){this.props=t}props;static{r(this,"Breakdowns")}addMany=r(async t=>{let n=this.buildUpdates(t);for(let i of n)await this.props.dynamo.send(new q(i.Update))},"addMany");buildUpdates=r(t=>t.items.map(n=>({Update:this.buildUpdateMembers({dimension:t.dimension,grain:t.grain,periodKey:t.periodKey,item:n,ttl:t.ttl})})),"buildUpdates");getForPeriod=r(async t=>(await wt({dynamo:this.props.dynamo,input:{TableName:this.props.tableName,KeyConditionExpression:"#pk = :pk",ExpressionAttributeNames:{"#pk":"pk"},ExpressionAttributeValues:{":pk":Ds({dimension:t.dimension,grain:t.grain,periodKey:t.periodKey})}}})).map(i=>this.parseOne(i)),"getForPeriod");buildUpdateMembers=r(t=>{let n={"#dimension":"dimension","#grain":"grain","#periodKey":"periodKey","#value":"value","#hits":"hits","#bytes":"bytes"},i={":dimension":t.dimension,":grain":t.grain,":periodKey":t.periodKey,":value":t.item.value,":hits":t.item.hits,":bytes":t.item.bytes},s=["#dimension = :dimension","#grain = :grain","#periodKey = :periodKey","#value = :value"];return t.ttl!=null&&(n["#ttl"]="ttl",i[":ttl"]=t.ttl,s.push("#ttl = :ttl")),{TableName:this.props.tableName,Key:{pk:Ds({dimension:t.dimension,grain:t.grain,periodKey:t.periodKey}),sk:t.item.value},UpdateExpression:`SET ${s.join(", ")} ADD #hits :hits, #bytes :bytes`,ExpressionAttributeNames:n,ExpressionAttributeValues:i}},"buildUpdateMembers");parseOne=r(t=>{let n=$e(rl,t);if(!n.success)throw console.error(Pe(n.issues)),new Error("Malformed stored breakdown record");return n.output},"parseOne")};function Ds(e){return`breakdown#${e.dimension}#${e.grain}#${e.periodKey}`}r(Ds,"partitionKey");function ks(){return U.from(new re,{marshallOptions:{removeUndefinedValues:!0,convertEmptyValues:!1}})}r(ks,"toDynamoClient");function ws(e){let t={hits:0,success:0,errors:0,errors4xx:0,errors5xx:0,bytesSent:0,bytesReceived:0};return e.reduce((n,i)=>({hits:n.hits+i.hits,success:n.success+i.success,errors:n.errors+i.errors,errors4xx:n.errors4xx+i.errors4xx,errors5xx:n.errors5xx+i.errors5xx,bytesSent:n.bytesSent+i.bytesSent,bytesReceived:n.bytesReceived+i.bytesReceived}),t)}r(ws,"sumTotals");function Ae(e){let t={};for(let n of e){let i=t[n.value];i==null?t[n.value]={value:n.value,hits:n.hits,bytes:n.bytes}:t[n.value]={value:n.value,hits:i.hits+n.hits,bytes:i.bytes+n.bytes}}return Object.values(t)}r(Ae,"sumBreakdown");var il=100;async function Cs({monthKey:e,models:t,dynamo:n}){if(await t.markers.isApplied({grain:"month",periodKey:e}))return{status:"skipped"};let s=await t.totals.queryWindow({grain:"day",startKey:`${e}-01`,endKey:`${e}-31`}),o=ws(s),a=await cl({breakdowns:t.breakdowns,grain:"day",periodKeys:s.map(E=>E.timeKey)}),c=t.totals.buildAggregateUpdate({grain:"month",item:{timeKey:e,...o}}),d=ul({breakdowns:t.breakdowns,grain:"month",periodKey:e,byStatus:a.status,byDevice:a.device,byPath:a.path,byCountry:a.country}),I=t.markers.buildMarkerPut({grain:"month",periodKey:e,source:"v2"});return ol({dynamo:n,leading:[I,c],rest:d})}r(Cs,"applyMonthlyRollup");function sl({leading:e,rest:t,limit:n=il}){let i=Math.max(n-e.length,0),s=[...e,...t.slice(0,i)],o=ln(t.slice(i),n);return[s,...o]}r(sl,"chunkTransactItems");async function ol({dynamo:e,leading:t,rest:n}){let i=sl({leading:t,rest:n});try{for(let s of i)s.length!==0&&await e.send(new Te({TransactItems:s}))}catch(s){if(al(s))return{status:"skipped"};throw s}return{status:"applied"}}r(ol,"sendTransacted");function al(e){if(e==null||typeof e!="object")return!1;let t="name"in e?e.name:void 0;return t==="TransactionCanceledException"||t==="ConditionalCheckFailedException"}r(al,"isMarkerRaceError");function ul({breakdowns:e,grain:t,periodKey:n,ttl:i,byStatus:s,byDevice:o,byPath:a,byCountry:c}){let d=[{dimension:"status",items:s},{dimension:"device",items:o},{dimension:"country",items:c},{dimension:"path",items:a}],I=[];for(let E of d)E.items.length!==0&&I.push(...e.buildUpdates({dimension:E.dimension,grain:t,periodKey:n,items:E.items,ttl:i}));return I}r(ul,"buildBreakdownUpdates");async function cl({breakdowns:e,grain:t,periodKeys:n}){let i=[],s=[],o=[],a=[];for(let c of n){let[d,I,E,Nt]=await Promise.all([e.getForPeriod({dimension:"status",grain:t,periodKey:c}),e.getForPeriod({dimension:"device",grain:t,periodKey:c}),e.getForPeriod({dimension:"path",grain:t,periodKey:c}),e.getForPeriod({dimension:"country",grain:t,periodKey:c})]);i.push(...d.map(Rt)),s.push(...I.map(Rt)),o.push(...E.map(Rt)),a.push(...Nt.map(Rt))}return{status:Ae(i),device:Ae(s),path:Ae(o),country:Ae(a)}}r(cl,"aggregateFinerBreakdowns");function Rt(e){return{value:e.value,hits:e.hits,bytes:e.bytes}}r(Rt,"toBreakdownRow");function ll(e){return e.toString().padStart(2,"0")}r(ll,"pad2");function pl(e){return e.toString().padStart(4,"0")}r(pl,"pad4");function Rs(e){return`${pl(e.getUTCFullYear())}-${ll(e.getUTCMonth()+1)}`}r(Rs,"monthKey");var ml=["hits","success","errors","errors4xx","errors5xx","bytesSent","bytesReceived"],fl=["p50TimeTaken","p95TimeTaken","cacheHitRatio","uniqueIpCount"],dl=M({pk:S(),sk:S(),grain:V(Dt),timeKey:S(),hits:b(),success:b(),errors:b(),errors4xx:b(),errors5xx:b(),bytesSent:b(),bytesReceived:b(),p50TimeTaken:C(b()),p95TimeTaken:C(b()),cacheHitRatio:C(b()),uniqueIpCount:C(b()),ttl:C(b())}),Pt=class{constructor(t){this.props=t}props;static{r(this,"Totals")}addHourly=r(async t=>{let n=this.buildHourlyUpdate(t);await this.props.dynamo.send(new q(n.Update))},"addHourly");addAggregate=r(async t=>{let n=this.buildAggregateUpdate(t);await this.props.dynamo.send(new q(n.Update))},"addAggregate");buildHourlyUpdate=r(t=>({Update:this.buildUpdateMembers({grain:"hour",item:t.item,ttl:t.ttl,includeHourlyDetail:!0})}),"buildHourlyUpdate");buildAggregateUpdate=r(t=>({Update:this.buildUpdateMembers({grain:t.grain,item:t.item,includeHourlyDetail:!1})}),"buildAggregateUpdate");queryWindow=r(async t=>(await wt({dynamo:this.props.dynamo,input:{TableName:this.props.tableName,KeyConditionExpression:"#pk = :pk AND #sk BETWEEN :start AND :end",ExpressionAttributeNames:{"#pk":"pk","#sk":"sk"},ExpressionAttributeValues:{":pk":pn(t.grain),":start":t.startKey,":end":t.endKey}}})).map(i=>this.parseOne(i)),"queryWindow");getOne=r(async t=>{let{Item:n}=await this.props.dynamo.send(new J({TableName:this.props.tableName,Key:{pk:pn(t.grain),sk:t.timeKey}}));if(n!=null)return this.parseOne(n)},"getOne");buildUpdateMembers=r(t=>{let n={"#grain":"grain","#timeKey":"timeKey"},i={":grain":t.grain,":timeKey":t.item.timeKey},s=["#grain = :grain","#timeKey = :timeKey"],o=[];for(let a of ml)n[`#${a}`]=a,i[`:${a}`]=t.item[a],o.push(`#${a} :${a}`);if(t.includeHourlyDetail)for(let a of fl){let c=t.item[a];c!=null&&(n[`#${a}`]=a,i[`:${a}`]=c,s.push(`#${a} = :${a}`))}return t.ttl!=null&&(n["#ttl"]="ttl",i[":ttl"]=t.ttl,s.push("#ttl = :ttl")),{TableName:this.props.tableName,Key:{pk:pn(t.grain),sk:t.item.timeKey},UpdateExpression:`SET ${s.join(", ")} ADD ${o.join(", ")}`,ExpressionAttributeNames:n,ExpressionAttributeValues:i}},"buildUpdateMembers");parseOne=r(t=>{let n=$e(dl,t);if(!n.success)throw console.error(Pe(n.issues)),new Error("Malformed stored totals record");return n.output},"parseOne")};function pn(e){return`totals#${e}`}r(pn,"partitionKey");var yl=M({TABLE_NAME:S(),REVERSE_INDEX_NAME:S()}),mn=gr(yl,process.env),$t=ks(),hl=new Pt({dynamo:$t,tableName:mn.TABLE_NAME}),vl=new Ct({dynamo:$t,tableName:mn.TABLE_NAME}),xl=new kt({dynamo:$t,tableName:mn.TABLE_NAME});async function nv(){let e=new Date;e.setUTCDate(1),e.setUTCMonth(e.getUTCMonth()-1);let t=Rs(e),n=await Cs({monthKey:t,models:{totals:hl,breakdowns:vl,markers:xl},dynamo:$t});console.log(`monthlyRollup ${t} ${n.status}`)}r(nv,"handler");export{nv as handler};