gemi 0.4.37 → 0.4.40
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.
- package/dist/chunk-00f16704831dd8b0.js +2 -0
- package/dist/chunk-11a75566ff74db17.js +6 -0
- package/dist/chunk-2672477bf396bad8.js +2 -0
- package/dist/chunk-28bb1e70f39736ee.js +2 -0
- package/dist/chunk-2a101fb25d52469b.js +2 -0
- package/dist/chunk-2a48e0098ccd4249.js +1 -1
- package/dist/chunk-38237d1b01b0db25.js +3 -0
- package/dist/chunk-3a9fcddbd219223b.js +3 -0
- package/dist/chunk-3c83d6762f7e56b3.js +2 -0
- package/dist/chunk-442a5b1ec74c72f8.js +2 -0
- package/dist/chunk-5128de1a65ba6ce1.js +2 -0
- package/dist/chunk-5190b38f06507ee1.js +18 -0
- package/dist/chunk-552bdaee8c03e091.js +1 -1
- package/dist/chunk-59e951812cb019e6.js +2 -0
- package/dist/chunk-5b54843712abde58.js +2 -0
- package/dist/chunk-5c2a5156f6bef0f5.js +2 -0
- package/dist/chunk-5defd55c3c97bdb2.js +2 -0
- package/dist/chunk-648dff766091372e.js +2 -0
- package/dist/chunk-682b01231754a121.js +1 -1
- package/dist/chunk-6afe097e13ebdf55.js +1 -1
- package/dist/chunk-733513f9c9e8b50f.js +2 -0
- package/dist/chunk-73c97da8ac4f1d30.js +1 -0
- package/dist/chunk-73c9d39f58a30fe2.js +6 -0
- package/dist/chunk-8b944ecefa1b832c.js +18 -0
- package/dist/chunk-8f547b919361fdf4.js +2 -0
- package/dist/chunk-9238196d4889d660.js +1 -0
- package/dist/chunk-92a55add20b5d7ac.js +9 -0
- package/dist/chunk-9f6199bc705fc395.js +18 -0
- package/dist/chunk-a02b2d564bdb603d.js +6 -0
- package/dist/chunk-a8310ad9bad32329.js +1 -1
- package/dist/chunk-aafdd9bfb5bde8bf.js +2 -0
- package/dist/chunk-ab79a2f0d89fbeae.js +1 -0
- package/dist/chunk-abd0b68c299eebfc.js +1 -1
- package/dist/chunk-b66a9e50afbac035.js +9 -0
- package/dist/chunk-bee6075c5738d87a.js +1 -1
- package/dist/chunk-bf4fa1d9864332a8.js +2 -0
- package/dist/chunk-c8b00b645df96ed5.js +1 -1
- package/dist/chunk-cb65fe402653c65e.js +1 -1
- package/dist/chunk-cce7de7e81895807.js +2 -0
- package/dist/chunk-d7457cb6aae3b29b.js +2 -0
- package/dist/chunk-dad55fcc32d05b69.js +2 -0
- package/dist/chunk-dd21f367f8029793.js +2 -0
- package/dist/chunk-ee4ff285d7f4ccdf.js +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/types.d.ts +5 -2
- package/dist/client/types.d.ts.map +1 -1
- package/dist/http/ViewRouter.d.ts +1 -1
- package/dist/http/ViewRouter.d.ts.map +1 -1
- package/dist/http/index.js +1 -1
- package/dist/server/index.js +1 -1
- package/dist/storage/index.js +3 -3
- package/package.json +2 -2
package/dist/storage/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"../chunk-70bb003c03f21dad.js";import{x as M} from"../chunk-a5c18c07abe8fd9c.js";import{$ as yr,A as Dm,B as L,C as _r,D as Or,F as Km,K as hr,L as Nl,M as ja,N as Ir,O as B,Q as ys,T as Sr,U as ia,V as Rr,W as ba,X as Ms,Y as Fr,_ as xf,aa as Fa,ba as O,ca as xa,da as sm,ea as fm,fa as Mm,ga as ym,ia as G,ka as oa,ma as p,na as Am,oa as Sm,z as $m} from"../chunk-088ed28ebed2b009.js";import{pa as ZA} from"../chunk-464cce477d8a56e0.js";import{$a as dm,Aa as t,Ba as ef,Ca as Fm,Da as Ma,Ea as ya,Fa as Ua,Ga as Lm,Ha as em,Ia as lm,Ja as am,Ka as hm,La as Wm,Ma as Xm,Na as Ta,Oa as Er,Pa as kr,Qa as Zm,Ra as mm,Sa as ce,Ta as gm,Ua as Qm,Va as wm,Wa as Vm,Xa as RA,Ya as As,Za as Rm,_a as Qs,ab as ph,bb as uh,cb as Im,db as Um,eb as Tm,qa as cm,ra as zm,sa as Gm,ta as Hm,ua as ts,va as xr,wa as Cr,xa as v,ya as nh,za as u} from"../chunk-b07249c949a284d2.js";import{fb as dg} from"../chunk-bbd36ce62b950ee5.js";import{gb as GA,hb as i} from"../chunk-5c3681fb029d7588.js";import{ib as Em} from"../chunk-552bdaee8c03e091.js";import"../chunk-6943b50bd0a3ac84.js";import"../chunk-100b76ab0ca3e14d.js";function rg(r){return(s)=>async(f)=>{const{request:e}=f;if(L.isInstance(e)&&e.body&&r.runtime==="node"){if(r.requestHandler?.constructor?.name!=="FetchHttpHandler")e.headers={...e.headers,Expect:"100-continue"}}return s({...f,request:e})}}var sg={step:"build",tags:["SET_EXPECT_HEADER","EXPECT_HEADER"],name:"addExpectContinueMiddleware",override:!0},ze=(r)=>({applyToStack:(s)=>{s.add(rg(r),sg)}});function eg(){return(r,s)=>async(f)=>{const{request:e}=f;if(L.isInstance(e)){if(!(fg in e.headers))if(typeof s?.logger?.warn==="function"&&!(s.logger instanceof Or))s.logger.warn("Are you using a Stream of unknown length as the Body of a PutObject request? Consider using Upload instead from @aws-sdk/lib-storage.");else console.warn("Are you using a Stream of unknown length as the Body of a PutObject request? Consider using Upload instead from @aws-sdk/lib-storage.")}return r({...f})}}var fg="content-length",lg={step:"finalizeRequest",tags:["CHECK_CONTENT_LENGTH_HEADER"],name:"getCheckContentLengthHeaderPlugin",override:!0},Ge=(r)=>({applyToStack:(s)=>{s.add(eg(),lg)}});var He=(r)=>{return(s,f)=>async(e)=>{const l=await r.region(),a=r.region;let h=()=>{};if(f.__s3RegionRedirect)Object.defineProperty(r,"region",{writable:!1,value:async()=>{return f.__s3RegionRedirect}}),h=()=>Object.defineProperty(r,"region",{writable:!0,value:a});try{const m=await s(e);if(f.__s3RegionRedirect){h();const g=await r.region();if(l!==g)throw new Error("Region was not restored following S3 region redirect.")}return m}catch(m){throw h(),m}}},Ke={tags:["REGION_REDIRECT","S3"],name:"regionRedirectEndpointMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"};function ag(r){return(s,f)=>async(e)=>{try{return await s(e)}catch(l){if(r.followRegionRedirects&&l?.$metadata?.httpStatusCode===301){try{const a=l.$response.headers["x-amz-bucket-region"];f.logger?.debug(`Redirecting from ${await r.region()} to ${a}`),f.__s3RegionRedirect=a}catch(a){throw new Error("Region redirect failed: "+a)}return s(e)}else throw l}}}var hg={step:"initialize",tags:["REGION_REDIRECT","S3"],name:"regionRedirectMiddleware",override:!0},Fe=(r)=>({applyToStack:(s)=>{s.add(ag(r),hg),s.addRelativeTo(He(r),Ke)}});var mg=(r)=>{return(s,f)=>async(e)=>{const l=await s(e),{response:a}=l;if(_r.isInstance(a)){if(a.headers.expires){a.headers.expiresstring=a.headers.expires;try{yr(a.headers.expires)}catch(h){f.logger?.warn(`AWS SDK Warning for ${f.clientName}::${f.commandName} response parsing (${a.headers.expires}): ${h}`),delete a.headers.expires}}}return l}},gg={tags:["S3"],name:"s3ExpiresMiddleware",override:!0,relation:"after",toMiddleware:"deserializerMiddleware"},Le=(r)=>({applyToStack:(s)=>{s.addRelativeTo(mg(r),gg)}});class er{constructor(r={}){this.data=r,this.lastPurgeTime=Date.now()}get(r){const s=this.data[r];if(!s)return;return s}set(r,s){return this.data[r]=s,s}delete(r){delete this.data[r]}async purgeExpired(){const r=Date.now();if(this.lastPurgeTime+er.EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS>r)return;for(let s in this.data){const f=this.data[s];if(!f.isRefreshing){const e=await f.identity;if(e.expiration){if(e.expiration.getTime()<r)delete this.data[s]}}}}}er.EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS=30000;class lr{constructor(r,s=!1,f=Date.now()){this._identity=r,this.isRefreshing=s,this.accessed=f}get identity(){return this.accessed=Date.now(),this._identity}}class ar{constructor(r,s=new er){this.createSessionFn=r,this.cache=s}async getS3ExpressIdentity(r,s){const f=s.Bucket,{cache:e}=this,l=e.get(f);if(l)return l.identity.then((a)=>{if((a.expiration?.getTime()??0)<Date.now())return e.set(f,new lr(this.getIdentity(f))).identity;if((a.expiration?.getTime()??0)<Date.now()+ar.REFRESH_WINDOW_MS&&!l.isRefreshing)l.isRefreshing=!0,this.getIdentity(f).then((g)=>{e.set(f,new lr(Promise.resolve(g)))});return a});return e.set(f,new lr(this.getIdentity(f))).identity}async getIdentity(r){await this.cache.purgeExpired().catch((e)=>{console.warn("Error while clearing expired entries in S3ExpressIdentityCache: \n"+e)});const s=await this.createSessionFn(r);if(!s.Credentials?.AccessKeyId||!s.Credentials?.SecretAccessKey)throw new Error("s3#createSession response credential missing AccessKeyId or SecretAccessKey.");return{accessKeyId:s.Credentials.AccessKeyId,secretAccessKey:s.Credentials.SecretAccessKey,sessionToken:s.Credentials.SessionToken,expiration:s.Credentials.Expiration?new Date(s.Credentials.Expiration):void 0}}}ar.REFRESH_WINDOW_MS=60000;var cr=M(hr(),1),us=M(ts(),1);var We="X-Amz-Algorithm",Xe="X-Amz-Credential",Ze="X-Amz-Date",Qe="X-Amz-SignedHeaders",Ve="X-Amz-Expires",ve="X-Amz-Signature",Je="X-Amz-Security-Token";var Ye="authorization",js="X-Amz-Date".toLowerCase();var Be=["authorization",js,"date"],Oe="X-Amz-Signature".toLowerCase(),Ur="x-amz-content-sha256",_e="X-Amz-Security-Token".toLowerCase();var qe={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},je=/^proxy-/,ie=/^sec-/;var qr="AWS4-HMAC-SHA256";var be="AWS4-HMAC-SHA256-PAYLOAD",xe="UNSIGNED-PAYLOAD",oe=50,is="aws4_request",ne=604800;var ue=M(hr(),1);var jr={},bs=[],ir=(r,s,f)=>`${r}/${s}/${f}/${is}`,te=async(r,s,f,e,l)=>{const a=await pe(r,s.secretAccessKey,s.accessKeyId),h=`${f}:${e}:${l}:${ue.toHex(a)}:${s.sessionToken}`;if(h in jr)return jr[h];bs.push(h);while(bs.length>oe)delete jr[bs.shift()];let m=`AWS4${s.secretAccessKey}`;for(let g of[f,e,l,is])m=await pe(r,m,g);return jr[h]=m};var pe=(r,s,f)=>{const e=new r(s);return e.update(v(f)),e.digest()};var br=({headers:r},s,f)=>{const e={};for(let l of Object.keys(r).sort()){if(r[l]==null)continue;const a=l.toLowerCase();if(a in qe||s?.has(a)||je.test(a)||ie.test(a)){if(!f||f&&!f.has(a))continue}e[a]=r[l].trim().replace(/\s+/g," ")}return e};var xs=({query:r={}})=>{const s=[],f={};for(let e of Object.keys(r).sort()){if(e.toLowerCase()===Oe)continue;s.push(e);const l=r[e];if(typeof l==="string")f[e]=`${p(e)}=${p(l)}`;else if(Array.isArray(l))f[e]=l.slice(0).reduce((a,h)=>a.concat([`${p(e)}=${p(h)}`]),[]).sort().join("&")}return s.map((e)=>f[e]).filter((e)=>e).join("&")};var rl=M(hr(),1);var Tr=async({headers:r,body:s},f)=>{for(let e of Object.keys(r))if(e.toLowerCase()===Ur)return r[e];if(s==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";else if(typeof s==="string"||ArrayBuffer.isView(s)||xr(s)){const e=new f;return e.update(v(s)),rl.toHex(await e.digest())}return xe};var or=M(hr(),1);var fl=function(r){for(let s=0;s<8;s++)r[s]^=255;for(let s=7;s>-1;s--)if(r[s]++,r[s]!==0)break};class os{format(r){const s=[];for(let l of Object.keys(r)){const a=Cr(l);s.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(r[l]))}const f=new Uint8Array(s.reduce((l,a)=>l+a.byteLength,0));let e=0;for(let l of s)f.set(l,e),e+=l.byteLength;return f}formatHeaderValue(r){switch(r.type){case"boolean":return Uint8Array.from([r.value?0:1]);case"byte":return Uint8Array.from([2,r.value]);case"short":const s=new DataView(new ArrayBuffer(3));return s.setUint8(0,3),s.setInt16(1,r.value,!1),new Uint8Array(s.buffer);case"integer":const f=new DataView(new ArrayBuffer(5));return f.setUint8(0,4),f.setInt32(1,r.value,!1),new Uint8Array(f.buffer);case"long":const e=new Uint8Array(9);return e[0]=5,e.set(r.value.bytes,1),e;case"binary":const l=new DataView(new ArrayBuffer(3+r.value.byteLength));l.setUint8(0,6),l.setUint16(1,r.value.byteLength,!1);const a=new Uint8Array(l.buffer);return a.set(r.value,3),a;case"string":const h=Cr(r.value),m=new DataView(new ArrayBuffer(3+h.byteLength));m.setUint8(0,7),m.setUint16(1,h.byteLength,!1);const g=new Uint8Array(m.buffer);return g.set(h,3),g;case"timestamp":const S=new Uint8Array(9);return S[0]=8,S.set(ns.fromNumber(r.value.valueOf()).bytes,1),S;case"uuid":if(!wg.test(r.value))throw new Error(`Invalid UUID received: ${r.value}`);const d=new Uint8Array(17);return d[0]=9,d.set(or.fromHex(r.value.replace(/\-/g,"")),1),d}}}var sl;(function(r){r[r.boolTrue=0]="boolTrue",r[r.boolFalse=1]="boolFalse",r[r.byte=2]="byte",r[r.short=3]="short",r[r.integer=4]="integer",r[r.long=5]="long",r[r.byteArray=6]="byteArray",r[r.string=7]="string",r[r.timestamp=8]="timestamp",r[r.uuid=9]="uuid"})(sl||(sl={}));var wg=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class ns{constructor(r){if(this.bytes=r,r.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(r){if(r>9223372036854776000||r<-9223372036854776000)throw new Error(`${r} is too large (or, if negative, too small) to represent as an Int64`);const s=new Uint8Array(8);for(let f=7,e=Math.abs(Math.round(r));f>-1&&e>0;f--,e/=256)s[f]=e;if(r<0)fl(s);return new ns(s)}valueOf(){const r=this.bytes.slice(0),s=r[0]&128;if(s)fl(r);return parseInt(or.toHex(r),16)*(s?-1:1)}toString(){return String(this.valueOf())}}var el=(r,s)=>{r=r.toLowerCase();for(let f of Object.keys(s))if(r===f.toLowerCase())return!0;return!1};var ps=(r,s={})=>{const{headers:f,query:e={}}=L.clone(r);for(let l of Object.keys(f)){const a=l.toLowerCase();if(a.slice(0,6)==="x-amz-"&&!s.unhoistableHeaders?.has(a))e[l]=f[l],delete f[l]}return{...r,headers:f,query:e}};var nr=(r)=>{r=L.clone(r);for(let s of Object.keys(r.headers))if(Be.indexOf(s.toLowerCase())>-1)delete r.headers[s];return r};var ll=(r)=>Ag(r).toISOString().replace(/\.\d{3}Z$/,"Z"),Ag=(r)=>{if(typeof r==="number")return new Date(r*1000);if(typeof r==="string"){if(Number(r))return new Date(Number(r)*1000);return new Date(r)}return r};class rf{constructor({applyChecksum:r,credentials:s,region:f,service:e,sha256:l,uriEscapePath:a=!0}){this.headerFormatter=new os,this.service=e,this.sha256=l,this.uriEscapePath=a,this.applyChecksum=typeof r==="boolean"?r:!0,this.regionProvider=us.normalizeProvider(f),this.credentialProvider=us.normalizeProvider(s)}async presign(r,s={}){const{signingDate:f=new Date,expiresIn:e=3600,unsignableHeaders:l,unhoistableHeaders:a,signableHeaders:h,signingRegion:m,signingService:g}=s,S=await this.credentialProvider();this.validateResolvedCredentials(S);const d=m??await this.regionProvider(),{longDate:k,shortDate:P}=pr(f);if(e>ne)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const U=ir(P,d,g??this.service),D=ps(nr(r),{unhoistableHeaders:a});if(S.sessionToken)D.query[Je]=S.sessionToken;D.query[We]=qr,D.query[Xe]=`${S.accessKeyId}/${U}`,D.query[Ze]=k,D.query[Ve]=e.toString(10);const Q=br(D,l,h);return D.query[Qe]=al(Q),D.query[ve]=await this.getSignature(k,U,this.getSigningKey(S,d,P,g),this.createCanonicalRequest(D,Q,await Tr(r,this.sha256))),D}async sign(r,s){if(typeof r==="string")return this.signString(r,s);else if(r.headers&&r.payload)return this.signEvent(r,s);else if(r.message)return this.signMessage(r,s);else return this.signRequest(r,s)}async signEvent({headers:r,payload:s},{signingDate:f=new Date,priorSignature:e,signingRegion:l,signingService:a}){const h=l??await this.regionProvider(),{shortDate:m,longDate:g}=pr(f),S=ir(m,h,a??this.service),d=await Tr({headers:{},body:s},this.sha256),k=new this.sha256;k.update(r);const P=cr.toHex(await k.digest()),U=[be,g,S,e,P,d].join("\n");return this.signString(U,{signingDate:f,signingRegion:h,signingService:a})}async signMessage(r,{signingDate:s=new Date,signingRegion:f,signingService:e}){return this.signEvent({headers:this.headerFormatter.format(r.message.headers),payload:r.message.body},{signingDate:s,signingRegion:f,signingService:e,priorSignature:r.priorSignature}).then((a)=>{return{message:r.message,signature:a}})}async signString(r,{signingDate:s=new Date,signingRegion:f,signingService:e}={}){const l=await this.credentialProvider();this.validateResolvedCredentials(l);const a=f??await this.regionProvider(),{shortDate:h}=pr(s),m=new this.sha256(await this.getSigningKey(l,a,h,e));return m.update(v(r)),cr.toHex(await m.digest())}async signRequest(r,{signingDate:s=new Date,signableHeaders:f,unsignableHeaders:e,signingRegion:l,signingService:a}={}){const h=await this.credentialProvider();this.validateResolvedCredentials(h);const m=l??await this.regionProvider(),g=nr(r),{longDate:S,shortDate:d}=pr(s),k=ir(d,m,a??this.service);if(g.headers[js]=S,h.sessionToken)g.headers[_e]=h.sessionToken;const P=await Tr(g,this.sha256);if(!el(Ur,g.headers)&&this.applyChecksum)g.headers[Ur]=P;const U=br(g,e,f),D=await this.getSignature(S,k,this.getSigningKey(h,m,d,a),this.createCanonicalRequest(g,U,P));return g.headers[Ye]=`${qr} `+`Credential=${h.accessKeyId}/${k}, `+`SignedHeaders=${al(U)}, `+`Signature=${D}`,g}createCanonicalRequest(r,s,f){const e=Object.keys(s).sort();return`${r.method}
|
|
2
|
+
import"../chunk-70bb003c03f21dad.js";import{x as M} from"../chunk-a5c18c07abe8fd9c.js";import{A as Um,B as L,C as _r,D as Or,E as Wm,F as xr,I as ph,J as Cr,K as v,L as uh,M as th,N as rm,O as ue,P as lm,Q as am,R as ar,S as sm,T as Nl,U as $l,V as ia,W as dr,X as B,Z as Ms,aa as Ar,ba,ca as Sr,da as xa,ea as Ds,fa as Fr,ha as jf,ia as Mr,ja as La,ka as O,la as oa,ma as hm,na as mm,oa as Tm,pa as Cm,ra as G,ta as na,z as ym} from"../chunk-7a318e738fec6c2b.js";import{va as vA} from"../chunk-7399f06d840a1449.js";import{$a as Em,Aa as ps,Ba as p,Ca as u,Da as sf,Ea as Xm,Fa as ya,Ga as Ua,Ha as Ta,Ia as Zm,Ja as gm,Ka as wm,La as Am,Ma as Sm,Na as Qm,Oa as Vm,Pa as Ca,Qa as Ir,Ra as Er,Sa as vm,Ta as Rm,Ua as Te,Va as dm,Wa as Jm,Xa as Im,Ya as Ym,Za as EA,_a as ws,ab as Xs,bb as km,cb as Pm,db as cm,eb as zm,wa as Hm,xa as Km,ya as Fm,za as Lm} from"../chunk-9f6199bc705fc395.js";import{fb as kg} from"../chunk-bbd36ce62b950ee5.js";import{gb as FA,hb as i} from"../chunk-5c3681fb029d7588.js";import{ib as Nm} from"../chunk-552bdaee8c03e091.js";import"../chunk-6943b50bd0a3ac84.js";import"../chunk-100b76ab0ca3e14d.js";function eg(r){return(s)=>async(f)=>{const{request:e}=f;if(L.isInstance(e)&&e.body&&r.runtime==="node"){if(r.requestHandler?.constructor?.name!=="FetchHttpHandler")e.headers={...e.headers,Expect:"100-continue"}}return s({...f,request:e})}}var lg={step:"build",tags:["SET_EXPECT_HEADER","EXPECT_HEADER"],name:"addExpectContinueMiddleware",override:!0},Ce=(r)=>({applyToStack:(s)=>{s.add(eg(r),lg)}});function hg(){return(r,s)=>async(f)=>{const{request:e}=f;if(L.isInstance(e)){if(!(ag in e.headers))if(typeof s?.logger?.warn==="function"&&!(s.logger instanceof Or))s.logger.warn("Are you using a Stream of unknown length as the Body of a PutObject request? Consider using Upload instead from @aws-sdk/lib-storage.");else console.warn("Are you using a Stream of unknown length as the Body of a PutObject request? Consider using Upload instead from @aws-sdk/lib-storage.")}return r({...f})}}var ag="content-length",mg={step:"finalizeRequest",tags:["CHECK_CONTENT_LENGTH_HEADER"],name:"getCheckContentLengthHeaderPlugin",override:!0},ce=(r)=>({applyToStack:(s)=>{s.add(hg(),mg)}});var ze=(r)=>{return(s,f)=>async(e)=>{const l=await r.region(),a=r.region;let h=()=>{};if(f.__s3RegionRedirect)Object.defineProperty(r,"region",{writable:!1,value:async()=>{return f.__s3RegionRedirect}}),h=()=>Object.defineProperty(r,"region",{writable:!0,value:a});try{const m=await s(e);if(f.__s3RegionRedirect){h();const g=await r.region();if(l!==g)throw new Error("Region was not restored following S3 region redirect.")}return m}catch(m){throw h(),m}}},Ge={tags:["REGION_REDIRECT","S3"],name:"regionRedirectEndpointMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"};function gg(r){return(s,f)=>async(e)=>{try{return await s(e)}catch(l){if(r.followRegionRedirects&&l?.$metadata?.httpStatusCode===301){try{const a=l.$response.headers["x-amz-bucket-region"];f.logger?.debug(`Redirecting from ${await r.region()} to ${a}`),f.__s3RegionRedirect=a}catch(a){throw new Error("Region redirect failed: "+a)}return s(e)}else throw l}}}var wg={step:"initialize",tags:["REGION_REDIRECT","S3"],name:"regionRedirectMiddleware",override:!0},He=(r)=>({applyToStack:(s)=>{s.add(gg(r),wg),s.addRelativeTo(ze(r),Ge)}});var Ag=(r)=>{return(s,f)=>async(e)=>{const l=await s(e),{response:a}=l;if(_r.isInstance(a)){if(a.headers.expires){a.headers.expiresstring=a.headers.expires;try{Mr(a.headers.expires)}catch(h){f.logger?.warn(`AWS SDK Warning for ${f.clientName}::${f.commandName} response parsing (${a.headers.expires}): ${h}`),delete a.headers.expires}}}return l}},Sg={tags:["S3"],name:"s3ExpiresMiddleware",override:!0,relation:"after",toMiddleware:"deserializerMiddleware"},Ke=(r)=>({applyToStack:(s)=>{s.addRelativeTo(Ag(r),Sg)}});class fr{constructor(r={}){this.data=r,this.lastPurgeTime=Date.now()}get(r){const s=this.data[r];if(!s)return;return s}set(r,s){return this.data[r]=s,s}delete(r){delete this.data[r]}async purgeExpired(){const r=Date.now();if(this.lastPurgeTime+fr.EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS>r)return;for(let s in this.data){const f=this.data[s];if(!f.isRefreshing){const e=await f.identity;if(e.expiration){if(e.expiration.getTime()<r)delete this.data[s]}}}}}fr.EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS=30000;class er{constructor(r,s=!1,f=Date.now()){this._identity=r,this.isRefreshing=s,this.accessed=f}get identity(){return this.accessed=Date.now(),this._identity}}class lr{constructor(r,s=new fr){this.createSessionFn=r,this.cache=s}async getS3ExpressIdentity(r,s){const f=s.Bucket,{cache:e}=this,l=e.get(f);if(l)return l.identity.then((a)=>{if((a.expiration?.getTime()??0)<Date.now())return e.set(f,new er(this.getIdentity(f))).identity;if((a.expiration?.getTime()??0)<Date.now()+lr.REFRESH_WINDOW_MS&&!l.isRefreshing)l.isRefreshing=!0,this.getIdentity(f).then((g)=>{e.set(f,new er(Promise.resolve(g)))});return a});return e.set(f,new er(this.getIdentity(f))).identity}async getIdentity(r){await this.cache.purgeExpired().catch((e)=>{console.warn("Error while clearing expired entries in S3ExpressIdentityCache: \n"+e)});const s=await this.createSessionFn(r);if(!s.Credentials?.AccessKeyId||!s.Credentials?.SecretAccessKey)throw new Error("s3#createSession response credential missing AccessKeyId or SecretAccessKey.");return{accessKeyId:s.Credentials.AccessKeyId,secretAccessKey:s.Credentials.SecretAccessKey,sessionToken:s.Credentials.SessionToken,expiration:s.Credentials.Expiration?new Date(s.Credentials.Expiration):void 0}}}lr.REFRESH_WINDOW_MS=60000;var cr=M(ar(),1),ns=M(ps(),1),al=M(ue(),1);var Fe="X-Amz-Algorithm",Le="X-Amz-Credential",We="X-Amz-Date",Xe="X-Amz-SignedHeaders",Ze="X-Amz-Expires",Qe="X-Amz-Signature",Ve="X-Amz-Security-Token";var ve="authorization",_s="X-Amz-Date".toLowerCase();var Je=["authorization",_s,"date"],Ye="X-Amz-Signature".toLowerCase(),yr="x-amz-content-sha256",Be="X-Amz-Security-Token".toLowerCase();var Oe={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},_e=/^proxy-/,qe=/^sec-/;var qr="AWS4-HMAC-SHA256";var je="AWS4-HMAC-SHA256-PAYLOAD",ie="UNSIGNED-PAYLOAD",be=50,qs="aws4_request",xe=604800;var ne=M(ar(),1);var jr={},js=[],ir=(r,s,f)=>`${r}/${s}/${f}/${qs}`,pe=async(r,s,f,e,l)=>{const a=await oe(r,s.secretAccessKey,s.accessKeyId),h=`${f}:${e}:${l}:${ne.toHex(a)}:${s.sessionToken}`;if(h in jr)return jr[h];js.push(h);while(js.length>be)delete jr[js.shift()];let m=`AWS4${s.secretAccessKey}`;for(let g of[f,e,l,qs])m=await oe(r,m,g);return jr[h]=m};var oe=(r,s,f)=>{const e=new r(s);return e.update(v(f)),e.digest()};var br=({headers:r},s,f)=>{const e={};for(let l of Object.keys(r).sort()){if(r[l]==null)continue;const a=l.toLowerCase();if(a in Oe||s?.has(a)||_e.test(a)||qe.test(a)){if(!f||f&&!f.has(a))continue}e[a]=r[l].trim().replace(/\s+/g," ")}return e};var Ur=M(ue(),1);var is=({query:r={}})=>{const s=[],f={};for(let e of Object.keys(r).sort()){if(e.toLowerCase()===Ye)continue;s.push(e);const l=r[e];if(typeof l==="string")f[e]=`${Ur.escapeUri(e)}=${Ur.escapeUri(l)}`;else if(Array.isArray(l))f[e]=l.slice(0).reduce((a,h)=>a.concat([`${Ur.escapeUri(e)}=${Ur.escapeUri(h)}`]),[]).sort().join("&")}return s.map((e)=>f[e]).filter((e)=>e).join("&")};var te=M(ar(),1);var Tr=async({headers:r,body:s},f)=>{for(let e of Object.keys(r))if(e.toLowerCase()===yr)return r[e];if(s==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";else if(typeof s==="string"||ArrayBuffer.isView(s)||xr(s)){const e=new f;return e.update(v(s)),te.toHex(await e.digest())}return ie};var or=M(ar(),1);var sl=function(r){for(let s=0;s<8;s++)r[s]^=255;for(let s=7;s>-1;s--)if(r[s]++,r[s]!==0)break};class bs{format(r){const s=[];for(let l of Object.keys(r)){const a=Cr(l);s.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(r[l]))}const f=new Uint8Array(s.reduce((l,a)=>l+a.byteLength,0));let e=0;for(let l of s)f.set(l,e),e+=l.byteLength;return f}formatHeaderValue(r){switch(r.type){case"boolean":return Uint8Array.from([r.value?0:1]);case"byte":return Uint8Array.from([2,r.value]);case"short":const s=new DataView(new ArrayBuffer(3));return s.setUint8(0,3),s.setInt16(1,r.value,!1),new Uint8Array(s.buffer);case"integer":const f=new DataView(new ArrayBuffer(5));return f.setUint8(0,4),f.setInt32(1,r.value,!1),new Uint8Array(f.buffer);case"long":const e=new Uint8Array(9);return e[0]=5,e.set(r.value.bytes,1),e;case"binary":const l=new DataView(new ArrayBuffer(3+r.value.byteLength));l.setUint8(0,6),l.setUint16(1,r.value.byteLength,!1);const a=new Uint8Array(l.buffer);return a.set(r.value,3),a;case"string":const h=Cr(r.value),m=new DataView(new ArrayBuffer(3+h.byteLength));m.setUint8(0,7),m.setUint16(1,h.byteLength,!1);const g=new Uint8Array(m.buffer);return g.set(h,3),g;case"timestamp":const S=new Uint8Array(9);return S[0]=8,S.set(xs.fromNumber(r.value.valueOf()).bytes,1),S;case"uuid":if(!Rg.test(r.value))throw new Error(`Invalid UUID received: ${r.value}`);const d=new Uint8Array(17);return d[0]=9,d.set(or.fromHex(r.value.replace(/\-/g,"")),1),d}}}var rl;(function(r){r[r.boolTrue=0]="boolTrue",r[r.boolFalse=1]="boolFalse",r[r.byte=2]="byte",r[r.short=3]="short",r[r.integer=4]="integer",r[r.long=5]="long",r[r.byteArray=6]="byteArray",r[r.string=7]="string",r[r.timestamp=8]="timestamp",r[r.uuid=9]="uuid"})(rl||(rl={}));var Rg=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class xs{constructor(r){if(this.bytes=r,r.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(r){if(r>9223372036854776000||r<-9223372036854776000)throw new Error(`${r} is too large (or, if negative, too small) to represent as an Int64`);const s=new Uint8Array(8);for(let f=7,e=Math.abs(Math.round(r));f>-1&&e>0;f--,e/=256)s[f]=e;if(r<0)sl(s);return new xs(s)}valueOf(){const r=this.bytes.slice(0),s=r[0]&128;if(s)sl(r);return parseInt(or.toHex(r),16)*(s?-1:1)}toString(){return String(this.valueOf())}}var fl=(r,s)=>{r=r.toLowerCase();for(let f of Object.keys(s))if(r===f.toLowerCase())return!0;return!1};var os=(r,s={})=>{const{headers:f,query:e={}}=L.clone(r);for(let l of Object.keys(f)){const a=l.toLowerCase();if(a.slice(0,6)==="x-amz-"&&!s.unhoistableHeaders?.has(a))e[l]=f[l],delete f[l]}return{...r,headers:f,query:e}};var nr=(r)=>{r=L.clone(r);for(let s of Object.keys(r.headers))if(Je.indexOf(s.toLowerCase())>-1)delete r.headers[s];return r};var el=(r)=>dg(r).toISOString().replace(/\.\d{3}Z$/,"Z"),dg=(r)=>{if(typeof r==="number")return new Date(r*1000);if(typeof r==="string"){if(Number(r))return new Date(Number(r)*1000);return new Date(r)}return r};class us{constructor({applyChecksum:r,credentials:s,region:f,service:e,sha256:l,uriEscapePath:a=!0}){this.headerFormatter=new bs,this.service=e,this.sha256=l,this.uriEscapePath=a,this.applyChecksum=typeof r==="boolean"?r:!0,this.regionProvider=ns.normalizeProvider(f),this.credentialProvider=ns.normalizeProvider(s)}async presign(r,s={}){const{signingDate:f=new Date,expiresIn:e=3600,unsignableHeaders:l,unhoistableHeaders:a,signableHeaders:h,signingRegion:m,signingService:g}=s,S=await this.credentialProvider();this.validateResolvedCredentials(S);const d=m??await this.regionProvider(),{longDate:k,shortDate:P}=pr(f);if(e>xe)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const U=ir(P,d,g??this.service),D=os(nr(r),{unhoistableHeaders:a});if(S.sessionToken)D.query[Ve]=S.sessionToken;D.query[Fe]=qr,D.query[Le]=`${S.accessKeyId}/${U}`,D.query[We]=k,D.query[Ze]=e.toString(10);const Q=br(D,l,h);return D.query[Xe]=ll(Q),D.query[Qe]=await this.getSignature(k,U,this.getSigningKey(S,d,P,g),this.createCanonicalRequest(D,Q,await Tr(r,this.sha256))),D}async sign(r,s){if(typeof r==="string")return this.signString(r,s);else if(r.headers&&r.payload)return this.signEvent(r,s);else if(r.message)return this.signMessage(r,s);else return this.signRequest(r,s)}async signEvent({headers:r,payload:s},{signingDate:f=new Date,priorSignature:e,signingRegion:l,signingService:a}){const h=l??await this.regionProvider(),{shortDate:m,longDate:g}=pr(f),S=ir(m,h,a??this.service),d=await Tr({headers:{},body:s},this.sha256),k=new this.sha256;k.update(r);const P=cr.toHex(await k.digest()),U=[je,g,S,e,P,d].join("\n");return this.signString(U,{signingDate:f,signingRegion:h,signingService:a})}async signMessage(r,{signingDate:s=new Date,signingRegion:f,signingService:e}){return this.signEvent({headers:this.headerFormatter.format(r.message.headers),payload:r.message.body},{signingDate:s,signingRegion:f,signingService:e,priorSignature:r.priorSignature}).then((a)=>{return{message:r.message,signature:a}})}async signString(r,{signingDate:s=new Date,signingRegion:f,signingService:e}={}){const l=await this.credentialProvider();this.validateResolvedCredentials(l);const a=f??await this.regionProvider(),{shortDate:h}=pr(s),m=new this.sha256(await this.getSigningKey(l,a,h,e));return m.update(v(r)),cr.toHex(await m.digest())}async signRequest(r,{signingDate:s=new Date,signableHeaders:f,unsignableHeaders:e,signingRegion:l,signingService:a}={}){const h=await this.credentialProvider();this.validateResolvedCredentials(h);const m=l??await this.regionProvider(),g=nr(r),{longDate:S,shortDate:d}=pr(s),k=ir(d,m,a??this.service);if(g.headers[_s]=S,h.sessionToken)g.headers[Be]=h.sessionToken;const P=await Tr(g,this.sha256);if(!fl(yr,g.headers)&&this.applyChecksum)g.headers[yr]=P;const U=br(g,e,f),D=await this.getSignature(S,k,this.getSigningKey(h,m,d,a),this.createCanonicalRequest(g,U,P));return g.headers[ve]=`${qr} `+`Credential=${h.accessKeyId}/${k}, `+`SignedHeaders=${ll(U)}, `+`Signature=${D}`,g}createCanonicalRequest(r,s,f){const e=Object.keys(s).sort();return`${r.method}
|
|
3
3
|
${this.getCanonicalPath(r)}
|
|
4
|
-
${
|
|
4
|
+
${is(r)}
|
|
5
5
|
${e.map((l)=>`${l}:${s[l]}`).join("\n")}
|
|
6
6
|
|
|
7
7
|
${e.join(";")}
|
|
8
8
|
${f}`}async createStringToSign(r,s,f){const e=new this.sha256;e.update(v(f));const l=await e.digest();return`${qr}
|
|
9
9
|
${r}
|
|
10
10
|
${s}
|
|
11
|
-
${cr.toHex(l)}`}getCanonicalPath({path:r}){if(this.uriEscapePath){const s=[];for(let l of r.split("/")){if(l?.length===0)continue;if(l===".")continue;if(l==="..")s.pop();else s.push(l)}const f=`${r?.startsWith("/")?"/":""}${s.join("/")}${s.length>0&&r?.endsWith("/")?"/":""}`;return p(f).replace(/%2F/g,"/")}return r}async getSignature(r,s,f,e){const l=await this.createStringToSign(r,s,e),a=new this.sha256(await f);return a.update(v(l)),cr.toHex(await a.digest())}getSigningKey(r,s,f,e){return te(this.sha256,r,f,s,e||this.service)}validateResolvedCredentials(r){if(typeof r!=="object"||typeof r.accessKeyId!=="string"||typeof r.secretAccessKey!=="string")throw new Error("Resolved credential object is not valid")}}var pr=(r)=>{const s=ll(r).replace(/[\-:]/g,"");return{longDate:s,shortDate:s.slice(0,8)}},al=(r)=>Object.keys(r).sort().join(";");var hl="Directory",ml="S3Express",gl="sigv4-s3express",ur="X-Amz-S3session-Token",zr=ur.toLowerCase(),Sg="AWS_S3_DISABLE_EXPRESS_SESSION_AUTH",Rg="s3_disable_express_session_auth",sf={environmentVariableSelector:(r)=>u(r,Sg,t.ENV),configFileSelector:(r)=>u(r,Rg,t.CONFIG),default:!1};var wl=function(r){return{accessKeyId:r.accessKeyId,secretAccessKey:r.secretAccessKey,expiration:r.expiration}},Al=function(r,s){const f=setTimeout(()=>{throw new Error("SignatureV4S3Express credential override was created but not called.")},10),e=r.credentialProvider,l=()=>{return clearTimeout(f),r.credentialProvider=e,Promise.resolve(s)};r.credentialProvider=l};class tr extends rf{async signWithCredentials(r,s,f){const e=wl(s);r.headers[zr]=s.sessionToken;const l=this;return Al(l,e),l.signRequest(r,f??{})}async presignWithCredentials(r,s,f){const e=wl(s);return delete r.headers[zr],r.headers[ur]=s.sessionToken,r.query=r.query??{},r.query[ur]=s.sessionToken,Al(this,e),this.presign(r,f)}}var Sl=(r)=>{return(s,f)=>async(e)=>{if(f.endpointV2){const l=f.endpointV2,a=l.properties?.authSchemes?.[0]?.name===gl;if(l.properties?.backend===ml||l.properties?.bucketType===hl)f.isS3ExpressBucket=!0;if(a){const m=e.input.Bucket;if(m){const g=await r.s3ExpressIdentityProvider.getS3ExpressIdentity(await r.credentials(),{Bucket:m});if(f.s3ExpressIdentity=g,L.isInstance(e.request)&&g.sessionToken)e.request.headers[zr]=g.sessionToken}}}return s(e)}},Rl={name:"s3ExpressMiddleware",step:"build",tags:["S3","S3_EXPRESS"],override:!0},ff=(r)=>({applyToStack:(s)=>{s.add(Sl(r),Rl)}});var Il=M(ef(),1);var Ig=M(dg(),1),El=M(ts(),1);var dl=async(r,s,f,e)=>{const l=await e.signWithCredentials(f,r,{});if(l.headers["X-Amz-Security-Token"]||l.headers["x-amz-security-token"])throw new Error("X-Amz-Security-Token must not be set for s3-express requests.");return l};var Eg=(r)=>(s)=>{throw s},kg=(r,s)=>{};var kl=(r)=>(s,f)=>async(e)=>{if(!L.isInstance(e.request))return s(e);const a=El.getSmithyContext(f).selectedHttpAuthScheme;if(!a)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:h={}},identity:m,signer:g}=a;let S;if(f.s3ExpressIdentity)S=await dl(f.s3ExpressIdentity,h,e.request,await r.signer());else S=await g.sign(e.request,m,h);const d=await s({...e,request:S}).catch((g.errorHandler||Eg)(h));return(g.successHandler||kg)(d.response,h),d},lf=(r)=>({applyToStack:(s)=>{s.addRelativeTo(kl(r),Il.httpSigningMiddlewareOptions)}});var Pl=(r,{session:s})=>{const[f,e]=s;return{...r,forcePathStyle:r.forcePathStyle??!1,useAccelerateEndpoint:r.useAccelerateEndpoint??!1,disableMultiregionAccessPoints:r.disableMultiregionAccessPoints??!1,followRegionRedirects:r.followRegionRedirects??!1,s3ExpressIdentityProvider:r.s3ExpressIdentityProvider??new ar(async(l)=>f().send(new e({Bucket:l,SessionMode:"ReadWrite"}))),bucketEndpoint:r.bucketEndpoint??!1}};var rs=M(Nl(),1),Pg={CopyObjectCommand:!0,UploadPartCopyCommand:!0,CompleteMultipartUploadCommand:!0},Ng=3000,$g=(r)=>(s,f)=>async(e)=>{const l=await s(e),{response:a}=l;if(!_r.isInstance(a))return l;const{statusCode:h,body:m}=a;if(h<200||h>=300)return l;let g=m,S=m;if(m&&typeof m==="object"&&!(m instanceof Uint8Array))[g,S]=await rs.splitStream(m);a.body=S;const d=await Dg(g,{streamCollector:async(P)=>{return rs.headStream(P,Ng)}});if(typeof g?.destroy==="function")g.destroy();const k=r.utf8Encoder(d.subarray(d.length-16));if(d.length===0&&Pg[f.commandName]){const P=new Error("S3 aborted request");throw P.name="InternalError",P}if(k&&k.endsWith("</Error>"))a.statusCode=400;return l},Dg=(r=new Uint8Array,s)=>{if(r instanceof Uint8Array)return Promise.resolve(r);return s.streamCollector(r)||Promise.resolve(new Uint8Array)},Mg={relation:"after",toMiddleware:"deserializerMiddleware",tags:["THROW_200_EXCEPTIONS","S3"],name:"throw200ExceptionsMiddleware",override:!0},ss=(r)=>({applyToStack:(s)=>{s.addRelativeTo($g(r),Mg)}});var af=(r)=>typeof r==="string"&&r.indexOf("arn:")===0&&r.split(":").length>=6;function $l(r){return(s,f)=>async(e)=>{if(r.bucketEndpoint){const l=f.endpointV2;if(l){const a=e.input.Bucket;if(typeof a==="string")try{const h=new URL(a);l.url=h}catch(h){const m=`@aws-sdk/middleware-sdk-s3: bucketEndpoint=true was set but Bucket=${a} could not be parsed as URL.`;if(f.logger?.constructor?.name==="NoOpLogger")console.warn(m);else f.logger?.warn?.(m);throw h}}}return s(e)}}var Dl={name:"bucketEndpointMiddleware",override:!0,relation:"after",toMiddleware:"endpointV2Middleware"};function yg({bucketEndpoint:r}){return(s)=>async(f)=>{const{input:{Bucket:e}}=f;if(!r&&typeof e==="string"&&!af(e)&&e.indexOf("/")>=0){const l=new Error(`Bucket name shouldn't contain '/', received '${e}'`);throw l.name="InvalidBucketName",l}return s({...f})}}var Ug={step:"initialize",tags:["VALIDATE_BUCKET_NAME"],name:"validateBucketNameMiddleware",override:!0},Ml=(r)=>({applyToStack:(s)=>{s.add(yg(r),Ug),s.addRelativeTo($l(r),Dl)}});var Nr=M(ef(),1);var yl=(r)=>({...r,eventStreamMarshaller:r.eventStreamSerdeProvider(r)});var Ss=M(As(),1);var fs={CrtSignerV4:null};class hf{constructor(r){this.sigv4Signer=new tr(r),this.signerOptions=r}async sign(r,s={}){if(s.signingRegion==="*"){if(this.signerOptions.runtime!=="node")throw new Error("This request requires signing with SigV4Asymmetric algorithm. It's only available in Node.js");return this.getSigv4aSigner().sign(r,s)}return this.sigv4Signer.sign(r,s)}async signWithCredentials(r,s,f={}){if(f.signingRegion==="*"){if(this.signerOptions.runtime!=="node")throw new Error("This request requires signing with SigV4Asymmetric algorithm. It's only available in Node.js");return this.getSigv4aSigner().signWithCredentials(r,s,f)}return this.sigv4Signer.signWithCredentials(r,s,f)}async presign(r,s={}){if(s.signingRegion==="*"){if(this.signerOptions.runtime!=="node")throw new Error("This request requires signing with SigV4Asymmetric algorithm. It's only available in Node.js");return this.getSigv4aSigner().presign(r,s)}return this.sigv4Signer.presign(r,s)}async presignWithCredentials(r,s,f={}){if(f.signingRegion==="*")throw new Error("Method presignWithCredentials is not supported for [signingRegion=*].");return this.sigv4Signer.presignWithCredentials(r,s,f)}getSigv4aSigner(){if(!this.sigv4aSigner){let r=null;try{if(r=fs.CrtSignerV4,typeof r!=="function")throw new Error}catch(s){throw s.message=`${s.message}\n`+'Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. \nYou must also register the package by calling [require("@aws-sdk/signature-v4-crt");] or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. \nFor more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt',s}this.sigv4aSigner=new r({...this.signerOptions,signingAlgorithm:1})}return this.sigv4aSigner}}var Kr=M(ts(),1);var mr={["required"]:!1,["type"]:"String"},gr={["required"]:!0,default:!1,["type"]:"Boolean"},Gr={["required"]:!1,["type"]:"Boolean"},Y={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"Accelerate"},!0]},$={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseFIPS"},!0]},N={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseDualStack"},!0]},C={["fn"]:"isSet",["argv"]:[{["ref"]:"Endpoint"}]},da={["fn"]:"aws.partition",["argv"]:[{["ref"]:"Region"}],["assign"]:"partitionResult"},Ul={["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[{["ref"]:"partitionResult"},"name"]},"aws-cn"]},ms={["fn"]:"isSet",["argv"]:[{["ref"]:"Bucket"}]},X={["ref"]:"Bucket"},W={["fn"]:"parseURL",["argv"]:[{["ref"]:"Endpoint"}],["assign"]:"url"},hs={["fn"]:"booleanEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[{["ref"]:"url"},"isIp"]},!0]},Ia={["ref"]:"url"},Ea={["fn"]:"uriEncode",["argv"]:[X],["assign"]:"uri_encoded_bucket"},q={["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},w={},ka={["fn"]:"aws.isVirtualHostableS3Bucket",["argv"]:[X,!1]},mf={["error"]:"S3Express bucket name is not a valid virtual hostable name.",["type"]:"error"},gs={["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4-s3express",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},Tl={["fn"]:"isSet",["argv"]:[{["ref"]:"UseS3ExpressControlEndpoint"}]},Cl={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseS3ExpressControlEndpoint"},!0]},A={["fn"]:"not",["argv"]:[C]},cl={["error"]:"Unrecognized S3Express bucket name format.",["type"]:"error"},zl={["fn"]:"not",["argv"]:[ms]},Gl={["ref"]:"hardwareType"},Hl={["conditions"]:[A],["error"]:"Expected a endpoint to be specified but no endpoint was found",["type"]:"error"},es={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4a",["signingName"]:"s3-outposts",["signingRegionSet"]:["*"]},{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3-outposts",["signingRegion"]:"{Region}"}]},gf={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"ForcePathStyle"},!1]},Tg={["ref"]:"ForcePathStyle"},T={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"Accelerate"},!1]},z={["fn"]:"stringEquals",["argv"]:[{["ref"]:"Region"},"aws-global"]},H={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3",["signingRegion"]:"us-east-1"}]},E={["fn"]:"not",["argv"]:[z]},K={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseGlobalEndpoint"},!0]},Kl={["url"]:"https://{Bucket}.s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:{["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3",["signingRegion"]:"{Region}"}]},["headers"]:{}},c={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3",["signingRegion"]:"{Region}"}]},F={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseGlobalEndpoint"},!1]},I={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseDualStack"},!1]},Fl={["url"]:"https://{Bucket}.s3-fips.{Region}.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},R={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseFIPS"},!1]},Ll={["url"]:"https://{Bucket}.s3-accelerate.dualstack.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},Wl={["url"]:"https://{Bucket}.s3.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},wf={["fn"]:"booleanEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[Ia,"isIp"]},!1]},Af={["url"]:"{url#scheme}://{url#authority}{url#normalizedPath}{Bucket}",["properties"]:c,["headers"]:{}},Kf={["url"]:"{url#scheme}://{Bucket}.{url#authority}{url#path}",["properties"]:c,["headers"]:{}},Xl={["endpoint"]:Kf,["type"]:"endpoint"},Sf={["url"]:"https://{Bucket}.s3-accelerate.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},Zl={["url"]:"https://{Bucket}.s3.{Region}.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},ls={["error"]:"Invalid region: region was not a valid DNS name.",["type"]:"error"},V={["ref"]:"bucketArn"},Pa={["ref"]:"arnType"},Rf={["fn"]:"getAttr",["argv"]:[V,"service"]},Ff={["ref"]:"accessPointName"},Ql={["conditions"]:[N],["error"]:"S3 Object Lambda does not support Dual-stack",["type"]:"error"},Vl={["conditions"]:[Y],["error"]:"S3 Object Lambda does not support S3 Accelerate",["type"]:"error"},vl={["conditions"]:[{["fn"]:"isSet",["argv"]:[{["ref"]:"DisableAccessPoints"}]},{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"DisableAccessPoints"},!0]}],["error"]:"Access points are not supported for this operation",["type"]:"error"},df={["conditions"]:[{["fn"]:"isSet",["argv"]:[{["ref"]:"UseArnRegion"}]},{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseArnRegion"},!1]},{["fn"]:"not",["argv"]:[{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[V,"region"]},"{Region}"]}]}],["error"]:"Invalid configuration: region from ARN `{bucketArn#region}` does not match client region `{Region}` and UseArnRegion is `false`",["type"]:"error"},Na={["fn"]:"getAttr",["argv"]:[{["ref"]:"bucketPartition"},"name"]},$a={["fn"]:"getAttr",["argv"]:[V,"accountId"]},If={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3-object-lambda",["signingRegion"]:"{bucketArn#region}"}]},Jl={["error"]:"Invalid ARN: The access point name may only contain a-z, A-Z, 0-9 and `-`. Found: `{accessPointName}`",["type"]:"error"},Ef={["error"]:"Invalid ARN: The account id may only contain a-z, A-Z, 0-9 and `-`. Found: `{bucketArn#accountId}`",["type"]:"error"},kf={["error"]:"Invalid region in ARN: `{bucketArn#region}` (invalid DNS name)",["type"]:"error"},Pf={["error"]:"Client was configured for partition `{partitionResult#name}` but ARN (`{Bucket}`) has `{bucketPartition#name}`",["type"]:"error"},Yl={["error"]:"Invalid ARN: The ARN may only contain a single resource component after `accesspoint`.",["type"]:"error"},Bl={["error"]:"Invalid ARN: Expected a resource of the format `accesspoint:<accesspoint name>` but no name was provided",["type"]:"error"},Hr={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3",["signingRegion"]:"{bucketArn#region}"}]},Ol={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4a",["signingName"]:"s3-outposts",["signingRegionSet"]:["*"]},{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3-outposts",["signingRegion"]:"{bucketArn#region}"}]},_l={["fn"]:"aws.parseArn",["argv"]:[X]},ql={["url"]:"https://s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:c,["headers"]:{}},jl={["url"]:"https://s3-fips.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:c,["headers"]:{}},il={["url"]:"https://s3.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:c,["headers"]:{}},Nf={["url"]:"{url#scheme}://{url#authority}{url#normalizedPath}{uri_encoded_bucket}",["properties"]:c,["headers"]:{}},bl={["url"]:"https://s3.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:c,["headers"]:{}},xl={["ref"]:"UseObjectLambdaEndpoint"},$f={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3-object-lambda",["signingRegion"]:"{Region}"}]},ol={["url"]:"https://s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},nl={["url"]:"https://s3-fips.{Region}.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},pl={["url"]:"https://s3.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},Df={["url"]:"{url#scheme}://{url#authority}{url#path}",["properties"]:c,["headers"]:{}},ul={["url"]:"https://s3.{Region}.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},Mf=[{["ref"]:"Region"}],Cg=[{["ref"]:"Endpoint"}],cg=[X],yf=[N],as=[Y],rr=[C,W],tl=[{["fn"]:"isSet",["argv"]:[{["ref"]:"DisableS3ExpressSessionAuth"}]},{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"DisableS3ExpressSessionAuth"},!0]}],ra=[hs],Uf=[Ea],Tf=[ka],wr=[$],sa=[{["fn"]:"substring",["argv"]:[X,6,14,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[X,14,16,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],fa=[{["conditions"]:[$],["endpoint"]:{["url"]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.{Region}.amazonaws.com",["properties"]:q,["headers"]:{}},["type"]:"endpoint"},{["endpoint"]:{["url"]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.{Region}.amazonaws.com",["properties"]:q,["headers"]:{}},["type"]:"endpoint"}],ea=[{["fn"]:"substring",["argv"]:[X,6,15,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[X,15,17,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],la=[{["conditions"]:[$],["endpoint"]:{["url"]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.{Region}.amazonaws.com",["properties"]:gs,["headers"]:{}},["type"]:"endpoint"},{["endpoint"]:{["url"]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.{Region}.amazonaws.com",["properties"]:gs,["headers"]:{}},["type"]:"endpoint"}],zg=[ms],aa=[{["fn"]:"isValidHostLabel",["argv"]:[{["ref"]:"outpostId"},!1]}],ha=[{["fn"]:"stringEquals",["argv"]:[{["ref"]:"regionPrefix"},"beta"]}],Gg=["*"],b=[da],ma=[{["fn"]:"isValidHostLabel",["argv"]:[{["ref"]:"Region"},!1]}],x=[{["fn"]:"stringEquals",["argv"]:[{["ref"]:"Region"},"us-east-1"]}],Cf=[{["fn"]:"stringEquals",["argv"]:[Pa,"accesspoint"]}],ga=[{["fn"]:"getAttr",["argv"]:[V,"resourceId[1]"],["assign"]:"accessPointName"},{["fn"]:"not",["argv"]:[{["fn"]:"stringEquals",["argv"]:[Ff,""]}]}],Hg=[V,"resourceId[1]"],cf=[{["fn"]:"not",["argv"]:[{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[V,"region"]},""]}]}],wa=[{["fn"]:"not",["argv"]:[{["fn"]:"isSet",["argv"]:[{["fn"]:"getAttr",["argv"]:[V,"resourceId[2]"]}]}]}],Kg=[V,"resourceId[2]"],zf=[{["fn"]:"aws.partition",["argv"]:[{["fn"]:"getAttr",["argv"]:[V,"region"]}],["assign"]:"bucketPartition"}],Aa=[{["fn"]:"stringEquals",["argv"]:[Na,{["fn"]:"getAttr",["argv"]:[{["ref"]:"partitionResult"},"name"]}]}],Gf=[{["fn"]:"isValidHostLabel",["argv"]:[{["fn"]:"getAttr",["argv"]:[V,"region"]},!0]}],Hf=[{["fn"]:"isValidHostLabel",["argv"]:[$a,!1]}],Sa=[{["fn"]:"isValidHostLabel",["argv"]:[Ff,!1]}],Ra=[{["fn"]:"isValidHostLabel",["argv"]:[{["ref"]:"Region"},!0]}],Fg={version:"1.0",parameters:{Bucket:mr,Region:mr,UseFIPS:gr,UseDualStack:gr,Endpoint:mr,ForcePathStyle:gr,Accelerate:gr,UseGlobalEndpoint:gr,UseObjectLambdaEndpoint:Gr,Key:mr,Prefix:mr,CopySource:mr,DisableAccessPoints:Gr,DisableMultiRegionAccessPoints:gr,UseArnRegion:Gr,UseS3ExpressControlEndpoint:Gr,DisableS3ExpressSessionAuth:Gr},rules:[{["conditions"]:[{["fn"]:"isSet",["argv"]:Mf}],rules:[{["conditions"]:[Y,$],error:"Accelerate cannot be used with FIPS",["type"]:"error"},{["conditions"]:[N,C],error:"Cannot set dual-stack in combination with a custom endpoint.",["type"]:"error"},{["conditions"]:[C,$],error:"A custom endpoint cannot be combined with FIPS",["type"]:"error"},{["conditions"]:[C,Y],error:"A custom endpoint cannot be combined with S3 Accelerate",["type"]:"error"},{["conditions"]:[$,da,Ul],error:"Partition does not support FIPS",["type"]:"error"},{["conditions"]:[ms,{["fn"]:"substring",["argv"]:[X,0,6,!0],["assign"]:"bucketSuffix"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"bucketSuffix"},"--x-s3"]}],rules:[{["conditions"]:yf,error:"S3Express does not support Dual-stack.",["type"]:"error"},{["conditions"]:as,error:"S3Express does not support S3 Accelerate.",["type"]:"error"},{["conditions"]:rr,rules:[{["conditions"]:tl,rules:[{["conditions"]:ra,rules:[{["conditions"]:Uf,rules:[{endpoint:{["url"]:"{url#scheme}://{url#authority}/{uri_encoded_bucket}{url#path}",["properties"]:q,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:Tf,rules:[{endpoint:{["url"]:"{url#scheme}://{Bucket}.{url#authority}{url#path}",["properties"]:q,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},mf],["type"]:"tree"},{["conditions"]:ra,rules:[{["conditions"]:Uf,rules:[{endpoint:{["url"]:"{url#scheme}://{url#authority}/{uri_encoded_bucket}{url#path}",["properties"]:gs,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:Tf,rules:[{endpoint:{["url"]:"{url#scheme}://{Bucket}.{url#authority}{url#path}",["properties"]:gs,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},mf],["type"]:"tree"},{["conditions"]:[Tl,Cl],rules:[{["conditions"]:[Ea,A],rules:[{["conditions"]:wr,endpoint:{["url"]:"https://s3express-control-fips.{Region}.amazonaws.com/{uri_encoded_bucket}",["properties"]:q,["headers"]:w},["type"]:"endpoint"},{endpoint:{["url"]:"https://s3express-control.{Region}.amazonaws.com/{uri_encoded_bucket}",["properties"]:q,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:Tf,rules:[{["conditions"]:tl,rules:[{["conditions"]:sa,rules:fa,["type"]:"tree"},{["conditions"]:ea,rules:fa,["type"]:"tree"},cl],["type"]:"tree"},{["conditions"]:sa,rules:la,["type"]:"tree"},{["conditions"]:ea,rules:la,["type"]:"tree"},cl],["type"]:"tree"},mf],["type"]:"tree"},{["conditions"]:[zl,Tl,Cl],rules:[{["conditions"]:rr,endpoint:{["url"]:"{url#scheme}://{url#authority}{url#path}",["properties"]:q,["headers"]:w},["type"]:"endpoint"},{["conditions"]:wr,endpoint:{["url"]:"https://s3express-control-fips.{Region}.amazonaws.com",["properties"]:q,["headers"]:w},["type"]:"endpoint"},{endpoint:{["url"]:"https://s3express-control.{Region}.amazonaws.com",["properties"]:q,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[ms,{["fn"]:"substring",["argv"]:[X,49,50,!0],["assign"]:"hardwareType"},{["fn"]:"substring",["argv"]:[X,8,12,!0],["assign"]:"regionPrefix"},{["fn"]:"substring",["argv"]:[X,0,7,!0],["assign"]:"bucketAliasSuffix"},{["fn"]:"substring",["argv"]:[X,32,49,!0],["assign"]:"outpostId"},{["fn"]:"aws.partition",["argv"]:Mf,["assign"]:"regionPartition"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"bucketAliasSuffix"},"--op-s3"]}],rules:[{["conditions"]:aa,rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Gl,"e"]}],rules:[{["conditions"]:ha,rules:[Hl,{["conditions"]:rr,endpoint:{["url"]:"https://{Bucket}.ec2.{url#authority}",["properties"]:es,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},{endpoint:{["url"]:"https://{Bucket}.ec2.s3-outposts.{Region}.{regionPartition#dnsSuffix}",["properties"]:es,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Gl,"o"]}],rules:[{["conditions"]:ha,rules:[Hl,{["conditions"]:rr,endpoint:{["url"]:"https://{Bucket}.op-{outpostId}.{url#authority}",["properties"]:es,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},{endpoint:{["url"]:"https://{Bucket}.op-{outpostId}.s3-outposts.{Region}.{regionPartition#dnsSuffix}",["properties"]:es,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},{error:"Unrecognized hardware type: \"Expected hardware type o or e but got {hardwareType}\"",["type"]:"error"}],["type"]:"tree"},{error:"Invalid ARN: The outpost Id must only contain a-z, A-Z, 0-9 and `-`.",["type"]:"error"}],["type"]:"tree"},{["conditions"]:zg,rules:[{["conditions"]:[C,{["fn"]:"not",["argv"]:[{["fn"]:"isSet",["argv"]:[{["fn"]:"parseURL",["argv"]:Cg}]}]}],error:"Custom endpoint `{Endpoint}` was not a valid URI",["type"]:"error"},{["conditions"]:[gf,ka],rules:[{["conditions"]:b,rules:[{["conditions"]:ma,rules:[{["conditions"]:[Y,Ul],error:"S3 Accelerate cannot be used in this region",["type"]:"error"},{["conditions"]:[N,$,T,A,z],endpoint:{["url"]:"https://{Bucket}.s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[N,$,T,A,E,K],rules:[{endpoint:Kl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[N,$,T,A,E,F],endpoint:Kl,["type"]:"endpoint"},{["conditions"]:[I,$,T,A,z],endpoint:{["url"]:"https://{Bucket}.s3-fips.us-east-1.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[I,$,T,A,E,K],rules:[{endpoint:Fl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,$,T,A,E,F],endpoint:Fl,["type"]:"endpoint"},{["conditions"]:[N,R,Y,A,z],endpoint:{["url"]:"https://{Bucket}.s3-accelerate.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[N,R,Y,A,E,K],rules:[{endpoint:Ll,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[N,R,Y,A,E,F],endpoint:Ll,["type"]:"endpoint"},{["conditions"]:[N,R,T,A,z],endpoint:{["url"]:"https://{Bucket}.s3.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[N,R,T,A,E,K],rules:[{endpoint:Wl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[N,R,T,A,E,F],endpoint:Wl,["type"]:"endpoint"},{["conditions"]:[I,R,T,C,W,hs,z],endpoint:{["url"]:"{url#scheme}://{url#authority}{url#normalizedPath}{Bucket}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[I,R,T,C,W,wf,z],endpoint:{["url"]:"{url#scheme}://{Bucket}.{url#authority}{url#path}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[I,R,T,C,W,hs,E,K],rules:[{["conditions"]:x,endpoint:Af,["type"]:"endpoint"},{endpoint:Af,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,R,T,C,W,wf,E,K],rules:[{["conditions"]:x,endpoint:Kf,["type"]:"endpoint"},Xl],["type"]:"tree"},{["conditions"]:[I,R,T,C,W,hs,E,F],endpoint:Af,["type"]:"endpoint"},{["conditions"]:[I,R,T,C,W,wf,E,F],endpoint:Kf,["type"]:"endpoint"},{["conditions"]:[I,R,Y,A,z],endpoint:{["url"]:"https://{Bucket}.s3-accelerate.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[I,R,Y,A,E,K],rules:[{["conditions"]:x,endpoint:Sf,["type"]:"endpoint"},{endpoint:Sf,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,R,Y,A,E,F],endpoint:Sf,["type"]:"endpoint"},{["conditions"]:[I,R,T,A,z],endpoint:{["url"]:"https://{Bucket}.s3.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[I,R,T,A,E,K],rules:[{["conditions"]:x,endpoint:{["url"]:"https://{Bucket}.s3.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:w},["type"]:"endpoint"},{endpoint:Zl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,R,T,A,E,F],endpoint:Zl,["type"]:"endpoint"}],["type"]:"tree"},ls],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[C,W,{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[Ia,"scheme"]},"http"]},{["fn"]:"aws.isVirtualHostableS3Bucket",["argv"]:[X,!0]},gf,R,I,T],rules:[{["conditions"]:b,rules:[{["conditions"]:ma,rules:[Xl],["type"]:"tree"},ls],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[gf,{["fn"]:"aws.parseArn",["argv"]:cg,["assign"]:"bucketArn"}],rules:[{["conditions"]:[{["fn"]:"getAttr",["argv"]:[V,"resourceId[0]"],["assign"]:"arnType"},{["fn"]:"not",["argv"]:[{["fn"]:"stringEquals",["argv"]:[Pa,""]}]}],rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Rf,"s3-object-lambda"]}],rules:[{["conditions"]:Cf,rules:[{["conditions"]:ga,rules:[Ql,Vl,{["conditions"]:cf,rules:[vl,{["conditions"]:wa,rules:[df,{["conditions"]:zf,rules:[{["conditions"]:b,rules:[{["conditions"]:Aa,rules:[{["conditions"]:Gf,rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[$a,""]}],error:"Invalid ARN: Missing account id",["type"]:"error"},{["conditions"]:Hf,rules:[{["conditions"]:Sa,rules:[{["conditions"]:rr,endpoint:{["url"]:"{url#scheme}://{accessPointName}-{bucketArn#accountId}.{url#authority}{url#path}",["properties"]:If,["headers"]:w},["type"]:"endpoint"},{["conditions"]:wr,endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-object-lambda-fips.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:If,["headers"]:w},["type"]:"endpoint"},{endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-object-lambda.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:If,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},Jl],["type"]:"tree"},Ef],["type"]:"tree"},kf],["type"]:"tree"},Pf],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},Yl],["type"]:"tree"},{error:"Invalid ARN: bucket ARN is missing a region",["type"]:"error"}],["type"]:"tree"},Bl],["type"]:"tree"},{error:"Invalid ARN: Object Lambda ARNs only support `accesspoint` arn types, but found: `{arnType}`",["type"]:"error"}],["type"]:"tree"},{["conditions"]:Cf,rules:[{["conditions"]:ga,rules:[{["conditions"]:cf,rules:[{["conditions"]:Cf,rules:[{["conditions"]:cf,rules:[vl,{["conditions"]:wa,rules:[df,{["conditions"]:zf,rules:[{["conditions"]:b,rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Na,"{partitionResult#name}"]}],rules:[{["conditions"]:Gf,rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Rf,"s3"]}],rules:[{["conditions"]:Hf,rules:[{["conditions"]:Sa,rules:[{["conditions"]:as,error:"Access Points do not support S3 Accelerate",["type"]:"error"},{["conditions"]:[$,N],endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint-fips.dualstack.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:Hr,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[$,I],endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint-fips.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:Hr,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[R,N],endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint.dualstack.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:Hr,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[R,I,C,W],endpoint:{["url"]:"{url#scheme}://{accessPointName}-{bucketArn#accountId}.{url#authority}{url#path}",["properties"]:Hr,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[R,I],endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:Hr,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},Jl],["type"]:"tree"},Ef],["type"]:"tree"},{error:"Invalid ARN: The ARN was not for the S3 service, found: {bucketArn#service}",["type"]:"error"}],["type"]:"tree"},kf],["type"]:"tree"},Pf],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},Yl],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"isValidHostLabel",["argv"]:[Ff,!0]}],rules:[{["conditions"]:yf,error:"S3 MRAP does not support dual-stack",["type"]:"error"},{["conditions"]:wr,error:"S3 MRAP does not support FIPS",["type"]:"error"},{["conditions"]:as,error:"S3 MRAP does not support S3 Accelerate",["type"]:"error"},{["conditions"]:[{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"DisableMultiRegionAccessPoints"},!0]}],error:"Invalid configuration: Multi-Region Access Point ARNs are disabled.",["type"]:"error"},{["conditions"]:[{["fn"]:"aws.partition",["argv"]:Mf,["assign"]:"mrapPartition"}],rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[{["ref"]:"mrapPartition"},"name"]},{["fn"]:"getAttr",["argv"]:[V,"partition"]}]}],rules:[{endpoint:{["url"]:"https://{accessPointName}.accesspoint.s3-global.{mrapPartition#dnsSuffix}",["properties"]:{["authSchemes"]:[{["disableDoubleEncoding"]:!0,name:"sigv4a",["signingName"]:"s3",["signingRegionSet"]:Gg}]},["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},{error:"Client was configured for partition `{mrapPartition#name}` but bucket referred to partition `{bucketArn#partition}`",["type"]:"error"}],["type"]:"tree"}],["type"]:"tree"},{error:"Invalid Access Point Name",["type"]:"error"}],["type"]:"tree"},Bl],["type"]:"tree"},{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Rf,"s3-outposts"]}],rules:[{["conditions"]:yf,error:"S3 Outposts does not support Dual-stack",["type"]:"error"},{["conditions"]:wr,error:"S3 Outposts does not support FIPS",["type"]:"error"},{["conditions"]:as,error:"S3 Outposts does not support S3 Accelerate",["type"]:"error"},{["conditions"]:[{["fn"]:"isSet",["argv"]:[{["fn"]:"getAttr",["argv"]:[V,"resourceId[4]"]}]}],error:"Invalid Arn: Outpost Access Point ARN contains sub resources",["type"]:"error"},{["conditions"]:[{["fn"]:"getAttr",["argv"]:Hg,["assign"]:"outpostId"}],rules:[{["conditions"]:aa,rules:[df,{["conditions"]:zf,rules:[{["conditions"]:b,rules:[{["conditions"]:Aa,rules:[{["conditions"]:Gf,rules:[{["conditions"]:Hf,rules:[{["conditions"]:[{["fn"]:"getAttr",["argv"]:Kg,["assign"]:"outpostType"}],rules:[{["conditions"]:[{["fn"]:"getAttr",["argv"]:[V,"resourceId[3]"],["assign"]:"accessPointName"}],rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[{["ref"]:"outpostType"},"accesspoint"]}],rules:[{["conditions"]:rr,endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.{outpostId}.{url#authority}",["properties"]:Ol,["headers"]:w},["type"]:"endpoint"},{endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.{outpostId}.s3-outposts.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:Ol,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},{error:"Expected an outpost type `accesspoint`, found {outpostType}",["type"]:"error"}],["type"]:"tree"},{error:"Invalid ARN: expected an access point name",["type"]:"error"}],["type"]:"tree"},{error:"Invalid ARN: Expected a 4-component resource",["type"]:"error"}],["type"]:"tree"},Ef],["type"]:"tree"},kf],["type"]:"tree"},Pf],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},{error:"Invalid ARN: The outpost Id may only contain a-z, A-Z, 0-9 and `-`. Found: `{outpostId}`",["type"]:"error"}],["type"]:"tree"},{error:"Invalid ARN: The Outpost Id was not set",["type"]:"error"}],["type"]:"tree"},{error:"Invalid ARN: Unrecognized format: {Bucket} (type: {arnType})",["type"]:"error"}],["type"]:"tree"},{error:"Invalid ARN: No ARN type specified",["type"]:"error"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"substring",["argv"]:[X,0,4,!1],["assign"]:"arnPrefix"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"arnPrefix"},"arn:"]},{["fn"]:"not",["argv"]:[{["fn"]:"isSet",["argv"]:[_l]}]}],error:"Invalid ARN: `{Bucket}` was not a valid ARN",["type"]:"error"},{["conditions"]:[{["fn"]:"booleanEquals",["argv"]:[Tg,!0]},_l],error:"Path-style addressing cannot be used with ARN buckets",["type"]:"error"},{["conditions"]:Uf,rules:[{["conditions"]:b,rules:[{["conditions"]:[T],rules:[{["conditions"]:[N,A,$,z],endpoint:{["url"]:"https://s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[N,A,$,E,K],rules:[{endpoint:ql,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[N,A,$,E,F],endpoint:ql,["type"]:"endpoint"},{["conditions"]:[I,A,$,z],endpoint:{["url"]:"https://s3-fips.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[I,A,$,E,K],rules:[{endpoint:jl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,A,$,E,F],endpoint:jl,["type"]:"endpoint"},{["conditions"]:[N,A,R,z],endpoint:{["url"]:"https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[N,A,R,E,K],rules:[{endpoint:il,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[N,A,R,E,F],endpoint:il,["type"]:"endpoint"},{["conditions"]:[I,C,W,R,z],endpoint:{["url"]:"{url#scheme}://{url#authority}{url#normalizedPath}{uri_encoded_bucket}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[I,C,W,R,E,K],rules:[{["conditions"]:x,endpoint:Nf,["type"]:"endpoint"},{endpoint:Nf,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,C,W,R,E,F],endpoint:Nf,["type"]:"endpoint"},{["conditions"]:[I,A,R,z],endpoint:{["url"]:"https://s3.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[I,A,R,E,K],rules:[{["conditions"]:x,endpoint:{["url"]:"https://s3.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:c,["headers"]:w},["type"]:"endpoint"},{endpoint:bl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,A,R,E,F],endpoint:bl,["type"]:"endpoint"}],["type"]:"tree"},{error:"Path-style addressing cannot be used with S3 Accelerate",["type"]:"error"}],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"isSet",["argv"]:[xl]},{["fn"]:"booleanEquals",["argv"]:[xl,!0]}],rules:[{["conditions"]:b,rules:[{["conditions"]:Ra,rules:[Ql,Vl,{["conditions"]:rr,endpoint:{["url"]:"{url#scheme}://{url#authority}{url#path}",["properties"]:$f,["headers"]:w},["type"]:"endpoint"},{["conditions"]:wr,endpoint:{["url"]:"https://s3-object-lambda-fips.{Region}.{partitionResult#dnsSuffix}",["properties"]:$f,["headers"]:w},["type"]:"endpoint"},{endpoint:{["url"]:"https://s3-object-lambda.{Region}.{partitionResult#dnsSuffix}",["properties"]:$f,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},ls],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[zl],rules:[{["conditions"]:b,rules:[{["conditions"]:Ra,rules:[{["conditions"]:[$,N,A,z],endpoint:{["url"]:"https://s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[$,N,A,E,K],rules:[{endpoint:ol,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[$,N,A,E,F],endpoint:ol,["type"]:"endpoint"},{["conditions"]:[$,I,A,z],endpoint:{["url"]:"https://s3-fips.us-east-1.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[$,I,A,E,K],rules:[{endpoint:nl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[$,I,A,E,F],endpoint:nl,["type"]:"endpoint"},{["conditions"]:[R,N,A,z],endpoint:{["url"]:"https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[R,N,A,E,K],rules:[{endpoint:pl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[R,N,A,E,F],endpoint:pl,["type"]:"endpoint"},{["conditions"]:[R,I,C,W,z],endpoint:{["url"]:"{url#scheme}://{url#authority}{url#path}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[R,I,C,W,E,K],rules:[{["conditions"]:x,endpoint:Df,["type"]:"endpoint"},{endpoint:Df,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[R,I,C,W,E,F],endpoint:Df,["type"]:"endpoint"},{["conditions"]:[R,I,A,z],endpoint:{["url"]:"https://s3.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[R,I,A,E,K],rules:[{["conditions"]:x,endpoint:{["url"]:"https://s3.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:w},["type"]:"endpoint"},{endpoint:ul,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[R,I,A,E,F],endpoint:ul,["type"]:"endpoint"}],["type"]:"tree"},ls],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},{error:"A region must be set when sending requests to S3.",["type"]:"error"}]},Da=Fg;var ws=(r,s={})=>{return ya(Da,{endpointParams:r,logger:s.logger})};Ma.aws=Ua;var ca=function(r){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"s3",region:r.region},propertiesExtractor:(s,f)=>({signingProperties:{config:s,context:f}})}},za=function(r){return{schemeId:"aws.auth#sigv4a",signingProperties:{name:"s3",region:r.region},propertiesExtractor:(s,f)=>({signingProperties:{config:s,context:f}})}},Lg=(r)=>async(s,f,e)=>{if(!e)throw new Error("Could not find \`input\` for \`defaultEndpointRuleSetHttpAuthSchemeParametersProvider\`");const l=await r(s,f,e),a=Kr.getSmithyContext(f)?.commandInstance?.constructor?.getEndpointParameterInstructions;if(!a)throw new Error(`getEndpointParameterInstructions() is not defined on \`${f.commandName}\``);const h=await Ta(e,{getEndpointParameterInstructions:a},s);return Object.assign(l,h)},Wg=async(r,s,f)=>{return{operation:Kr.getSmithyContext(s).operation,region:await Kr.normalizeProvider(r.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()}},Ca=Lg(Wg),Xg=(r,s,f)=>{return(l)=>{const h=r(l).properties?.authSchemes;if(!h)return s(l);const m=[];for(let g of h){const{name:S,properties:d={},...k}=g,P=S.toLowerCase();if(S!==P)console.warn(`HttpAuthScheme has been normalized with lowercasing: \`${S}\` to \`${P}\``);let U;if(P==="sigv4a"){U="aws.auth#sigv4a";const Br=h.find((_)=>{const Mr=_.name.toLowerCase();return Mr!=="sigv4a"&&Mr.startsWith("sigv4")});if(!fs.CrtSignerV4&&Br)continue}else if(P.startsWith("sigv4"))U="aws.auth#sigv4";else throw new Error(`Unknown HttpAuthScheme found in \`@smithy.rules#endpointRuleSet\`: \`${P}\``);const D=f[U];if(!D)throw new Error(`Could not find HttpAuthOption create function for \`${U}\``);const Q=D(l);Q.schemeId=U,Q.signingProperties={...Q.signingProperties||{},...k,...d},m.push(Q)}return m}},Zg=(r)=>{const s=[];switch(r.operation){default:s.push(ca(r)),s.push(za(r))}return s},Ga=Xg(ws,Zg,{"aws.auth#sigv4":ca,"aws.auth#sigv4a":za}),Ha=(r)=>{const s=Ss.resolveAwsSdkSigV4Config(r);return{...Ss.resolveAwsSdkSigV4AConfig(s)}};var Ka=(r)=>{return{...r,useFipsEndpoint:r.useFipsEndpoint??!1,useDualstackEndpoint:r.useDualstackEndpoint??!1,forcePathStyle:r.forcePathStyle??!1,useAccelerateEndpoint:r.useAccelerateEndpoint??!1,useGlobalEndpoint:r.useGlobalEndpoint??!1,disableMultiregionAccessPoints:r.disableMultiregionAccessPoints??!1,defaultSigningName:"s3"}},Ar={ForcePathStyle:{type:"clientContextParams",name:"forcePathStyle"},UseArnRegion:{type:"clientContextParams",name:"useArnRegion"},DisableMultiRegionAccessPoints:{type:"clientContextParams",name:"disableMultiregionAccessPoints"},Accelerate:{type:"clientContextParams",name:"useAccelerateEndpoint"},DisableS3ExpressSessionAuth:{type:"clientContextParams",name:"disableS3ExpressSessionAuth"},UseGlobalEndpoint:{type:"builtInParams",name:"useGlobalEndpoint"},UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};class Z extends Fa{constructor(r){super(r);Object.setPrototypeOf(this,Z.prototype)}}class Rs extends Z{constructor(r){super({name:"NoSuchUpload",$fault:"client",...r});this.name="NoSuchUpload",this.$fault="client",Object.setPrototypeOf(this,Rs.prototype)}}class ds extends Z{constructor(r){super({name:"ObjectNotInActiveTierError",$fault:"client",...r});this.name="ObjectNotInActiveTierError",this.$fault="client",Object.setPrototypeOf(this,ds.prototype)}}class Is extends Z{constructor(r){super({name:"BucketAlreadyExists",$fault:"client",...r});this.name="BucketAlreadyExists",this.$fault="client",Object.setPrototypeOf(this,Is.prototype)}}class Es extends Z{constructor(r){super({name:"BucketAlreadyOwnedByYou",$fault:"client",...r});this.name="BucketAlreadyOwnedByYou",this.$fault="client",Object.setPrototypeOf(this,Es.prototype)}}class ks extends Z{constructor(r){super({name:"NoSuchBucket",$fault:"client",...r});this.name="NoSuchBucket",this.$fault="client",Object.setPrototypeOf(this,ks.prototype)}}var Lf;(function(r){r.visit=(s,f)=>{if(s.Prefix!==void 0)return f.Prefix(s.Prefix);if(s.Tag!==void 0)return f.Tag(s.Tag);if(s.And!==void 0)return f.And(s.And);return f._(s.$unknown[0],s.$unknown[1])}})(Lf||(Lf={}));var Wf;(function(r){r.visit=(s,f)=>{if(s.Prefix!==void 0)return f.Prefix(s.Prefix);if(s.Tag!==void 0)return f.Tag(s.Tag);if(s.ObjectSizeGreaterThan!==void 0)return f.ObjectSizeGreaterThan(s.ObjectSizeGreaterThan);if(s.ObjectSizeLessThan!==void 0)return f.ObjectSizeLessThan(s.ObjectSizeLessThan);if(s.And!==void 0)return f.And(s.And);return f._(s.$unknown[0],s.$unknown[1])}})(Wf||(Wf={}));var Xf;(function(r){r.visit=(s,f)=>{if(s.Prefix!==void 0)return f.Prefix(s.Prefix);if(s.Tag!==void 0)return f.Tag(s.Tag);if(s.AccessPointArn!==void 0)return f.AccessPointArn(s.AccessPointArn);if(s.And!==void 0)return f.And(s.And);return f._(s.$unknown[0],s.$unknown[1])}})(Xf||(Xf={}));var Zf;(function(r){r.visit=(s,f)=>{if(s.Prefix!==void 0)return f.Prefix(s.Prefix);if(s.Tag!==void 0)return f.Tag(s.Tag);if(s.And!==void 0)return f.And(s.And);return f._(s.$unknown[0],s.$unknown[1])}})(Zf||(Zf={}));class Ps extends Z{constructor(r){super({name:"InvalidObjectState",$fault:"client",...r});this.name="InvalidObjectState",this.$fault="client",Object.setPrototypeOf(this,Ps.prototype),this.StorageClass=r.StorageClass,this.AccessTier=r.AccessTier}}class Ns extends Z{constructor(r){super({name:"NoSuchKey",$fault:"client",...r});this.name="NoSuchKey",this.$fault="client",Object.setPrototypeOf(this,Ns.prototype)}}class $s extends Z{constructor(r){super({name:"NotFound",$fault:"client",...r});this.name="NotFound",this.$fault="client",Object.setPrototypeOf(this,$s.prototype)}}var Qg=(r)=>({...r,...r.SecretAccessKey&&{SecretAccessKey:B},...r.SessionToken&&{SessionToken:B}}),La=(r)=>({...r,...r.Credentials&&{Credentials:Qg(r.Credentials)}});var Wa=(r)=>({...r,...r.SSEKMSKeyId&&{SSEKMSKeyId:B}}),Xa=(r)=>({...r,...r.SSECustomerKey&&{SSECustomerKey:B}});var dr=M(As(),1);var Ts=M(ef(),1);class Ds extends Z{constructor(r){super({name:"ObjectAlreadyInActiveTierError",$fault:"client",...r});this.name="ObjectAlreadyInActiveTierError",this.$fault="client",Object.setPrototypeOf(this,Ds.prototype)}}var Za;(function(r){r.visit=(s,f)=>{if(s.Records!==void 0)return f.Records(s.Records);if(s.Stats!==void 0)return f.Stats(s.Stats);if(s.Progress!==void 0)return f.Progress(s.Progress);if(s.Cont!==void 0)return f.Cont(s.Cont);if(s.End!==void 0)return f.End(s.End);return f._(s.$unknown[0],s.$unknown[1])}})(Za||(Za={}));var Qa=(r)=>({...r,...r.SSEKMSKeyId&&{SSEKMSKeyId:B},...r.SSEKMSEncryptionContext&&{SSEKMSEncryptionContext:B}}),Va=(r)=>({...r,...r.SSECustomerKey&&{SSECustomerKey:B},...r.SSEKMSKeyId&&{SSEKMSKeyId:B},...r.SSEKMSEncryptionContext&&{SSEKMSEncryptionContext:B}});var na=async(r,s)=>{const f=Ts.requestBuilder(r,s),e=G({},j,{[jw]:r[yw]});f.bp("/"),f.p("Bucket",()=>r.Bucket,"{Bucket}",!1);const l=G({[Bw]:[,""]});let a;return f.m("GET").h(e).q(l).b(a),f.build()};var pa=async(r,s)=>{const f=Ts.requestBuilder(r,s),e=G({},j,{[Hw]:r[mw],[Kw]:[()=>j(r[va]),()=>Fr(r[va]).toString()],[Fw]:r[gw],[Lw]:[()=>j(r[Ja]),()=>Fr(r[Ja]).toString()],[Xw]:r[dw],[zs]:r[Cs],[Kh]:r[dh],[Gs]:r[cs],[zh]:r[Rh],[Uh]:r[mh],[qw]:r[ug]});f.bp("/{Key+}"),f.p("Bucket",()=>r.Bucket,"{Bucket}",!1),f.p("Key",()=>r.Key,"{Key+}",!0);const l=G({[Wh]:[,"GetObject"],[Zw]:[,r[Iw]],[Qw]:[,r[Ew]],[Vw]:[,r[kw]],[vw]:[,r[Pw]],[Jw]:[,r[Nw]],[Yw]:[()=>r.ResponseExpires!==void 0,()=>Fr(r[$w]).toString()],[Ow]:[,r[fe]],[Ww]:[()=>r.PartNumber!==void 0,()=>r[Rw].toString()]});let a;return f.m("GET").h(e).q(l).b(a),f.build()};var ua=async(r,s)=>{const f=Ts.requestBuilder(r,s),e=G({},j,{[Dh]:r[hh]||"application/octet-stream",[_w]:r[og],[kh]:r[fh],[Ph]:r[eh],[Nh]:r[lh],[$h]:r[ah],[qf]:[()=>j(r[Bf]),()=>r[Bf].toString()],[cw]:r[tg],[uw]:r[pg],[ee]:r[nf],[le]:r[pf],[ae]:r[uf],[he]:r[tf],[jf]:[()=>j(r[Of]),()=>Fr(r[Of]).toString()],[iw]:r[ew],[bw]:r[lw],[xw]:r[aw],[ow]:r[hw],[me]:r[re],[Gh]:r[Wr],[Lh]:r[Eh],[zs]:r[Cs],[Kh]:r[dh],[Gs]:r[cs],[ge]:r[se],[Hh]:r[Ih],[Xr]:[()=>j(r[Us]),()=>r[Us].toString()],[zh]:r[Rh],[tw]:r[Uw],[Ch]:r[Ah],[bf]:[()=>j(r[_f]),()=>oa(r[_f]).toString()],[Th]:r[wh],[Uh]:r[mh],...r.Metadata!==void 0&&Object.keys(r.Metadata).reduce((m,g)=>{return m[`x-amz-meta-${g.toLowerCase()}`]=r.Metadata[g],m},{})});f.bp("/{Key+}"),f.p("Bucket",()=>r.Bucket,"{Bucket}",!1),f.p("Key",()=>r.Key,"{Key+}",!0);const l=G({[Wh]:[,"PutObject"]});let a,h;if(r.Body!==void 0)h=r.Body,a=h;return f.m("PUT").h(e).q(l).b(a),f.build()};var ta=async(r,s)=>{if(r.statusCode!==200&&r.statusCode>=300)return of(r,s);const f=G({$metadata:J(r)}),e=Sr(ia(await dr.parseXmlBody(r.body,s)),"body");if(e[vf]!=null)f[vf]=xg(e[vf],s);return f};var rh=async(r,s)=>{if(r.statusCode!==200&&r.statusCode>=300)return of(r,s);const f=G({$metadata:J(r),[sw]:[()=>r.headers[Ba]!==void 0,()=>ys(r.headers[Ba])],[ng]:[,r.headers[Cw]],[Lr]:[,r.headers[yh]],[Mw]:[,r.headers[nw]],[ww]:[()=>r.headers[Ya]!==void 0,()=>Sr(yr(r.headers[Ya]))],[Bf]:[()=>r.headers[qf]!==void 0,()=>ba(r.headers[qf])],[gh]:[,r.headers[Mh]],[nf]:[,r.headers[ee]],[pf]:[,r.headers[le]],[uf]:[,r.headers[ae]],[tf]:[,r.headers[he]],[Aw]:[()=>r.headers[Oa]!==void 0,()=>Ms(r.headers[Oa])],[fe]:[,r.headers[Fh]],[fh]:[,r.headers[kh]],[eh]:[,r.headers[Ph]],[lh]:[,r.headers[Nh]],[ah]:[,r.headers[$h]],[rw]:[,r.headers[zw]],[hh]:[,r.headers[Dh]],[Of]:[()=>r.headers[jf]!==void 0,()=>Sr(yr(r.headers[jf]))],[fw]:[,r.headers[Gw]],[Eh]:[,r.headers[Lh]],[re]:[,r.headers[me]],[Cs]:[,r.headers[zs]],[cs]:[,r.headers[Gs]],[se]:[,r.headers[ge]],[Us]:[()=>r.headers[Xr]!==void 0,()=>ys(r.headers[Xr])],[Wr]:[,r.headers[Gh]],[Sh]:[,r.headers[ch]],[Dw]:[,r.headers[pw]],[Sw]:[()=>r.headers[_a]!==void 0,()=>Ms(r.headers[_a])],[Tw]:[()=>r.headers[qa]!==void 0,()=>Ms(r.headers[qa])],[Ah]:[,r.headers[Ch]],[_f]:[()=>r.headers[bf]!==void 0,()=>Sr(xf(r.headers[bf]))],[wh]:[,r.headers[Th]],Metadata:[,Object.keys(r.headers).filter((l)=>l.startsWith("x-amz-meta-")).reduce((l,a)=>{return l[a.substring(11)]=r.headers[a],l},{})]}),e=r.body;return s.sdkStreamMixin(e),f.Body=e,f};var sh=async(r,s)=>{if(r.statusCode!==200&&r.statusCode>=300)return of(r,s);const f=G({$metadata:J(r),[Lr]:[,r.headers[yh]],[gh]:[,r.headers[Mh]],[nf]:[,r.headers[ee]],[pf]:[,r.headers[le]],[uf]:[,r.headers[ae]],[tf]:[,r.headers[he]],[re]:[,r.headers[me]],[fe]:[,r.headers[Fh]],[Cs]:[,r.headers[zs]],[cs]:[,r.headers[Gs]],[se]:[,r.headers[ge]],[Ih]:[,r.headers[Hh]],[Us]:[()=>r.headers[Xr]!==void 0,()=>ys(r.headers[Xr])],[Sh]:[,r.headers[ch]]});return await ja(r.body,s),f};var of=async(r,s)=>{const f={...r,body:await dr.parseXmlErrorBody(r.body,s)},e=dr.loadRestXmlErrorCode(r,f.body);switch(e){case"NoSuchUpload":case"com.amazonaws.s3#NoSuchUpload":throw await qg(f,s);case"ObjectNotInActiveTierError":case"com.amazonaws.s3#ObjectNotInActiveTierError":throw await bg(f,s);case"BucketAlreadyExists":case"com.amazonaws.s3#BucketAlreadyExists":throw await Jg(f,s);case"BucketAlreadyOwnedByYou":case"com.amazonaws.s3#BucketAlreadyOwnedByYou":throw await Yg(f,s);case"NoSuchBucket":case"com.amazonaws.s3#NoSuchBucket":throw await Og(f,s);case"InvalidObjectState":case"com.amazonaws.s3#InvalidObjectState":throw await Bg(f,s);case"NoSuchKey":case"com.amazonaws.s3#NoSuchKey":throw await _g(f,s);case"NotFound":case"com.amazonaws.s3#NotFound":throw await jg(f,s);case"ObjectAlreadyInActiveTierError":case"com.amazonaws.s3#ObjectAlreadyInActiveTierError":throw await ig(f,s);default:const l=f.body;return vg({output:r,parsedBody:l,errorCode:e})}},vg=xa(Z),Jg=async(r,s)=>{const f=G({}),e=r.body,l=new Is({$metadata:J(r),...f});return O(l,r.body)},Yg=async(r,s)=>{const f=G({}),e=r.body,l=new Es({$metadata:J(r),...f});return O(l,r.body)},Bg=async(r,s)=>{const f=G({}),e=r.body;if(e[Vf]!=null)f[Vf]=Rr(e[Vf]);if(e[Wr]!=null)f[Wr]=Rr(e[Wr]);const l=new Ps({$metadata:J(r),...f});return O(l,r.body)},Og=async(r,s)=>{const f=G({}),e=r.body,l=new ks({$metadata:J(r),...f});return O(l,r.body)},_g=async(r,s)=>{const f=G({}),e=r.body,l=new Ns({$metadata:J(r),...f});return O(l,r.body)},qg=async(r,s)=>{const f=G({}),e=r.body,l=new Rs({$metadata:J(r),...f});return O(l,r.body)},jg=async(r,s)=>{const f=G({}),e=r.body,l=new $s({$metadata:J(r),...f});return O(l,r.body)},ig=async(r,s)=>{const f=G({}),e=r.body,l=new Ds({$metadata:J(r),...f});return O(l,r.body)},bg=async(r,s)=>{const f=G({}),e=r.body,l=new ds({$metadata:J(r),...f});return O(l,r.body)};var xg=(r,s)=>{const f={};if(r[Qf]!=null)f[Qf]=Rr(r[Qf]);if(r[Jf]!=null)f[Jf]=Rr(r[Jf]);if(r[Yf]!=null)f[Yf]=Rr(r[Yf]);if(r[Lr]!=null)f[Lr]=Sr(xf(r[Lr]));return f};var J=(r)=>({httpStatusCode:r.statusCode,requestId:r.headers["x-amzn-requestid"]??r.headers["x-amzn-request-id"]??r.headers["x-amz-request-id"],extendedRequestId:r.headers["x-amz-id-2"],cfId:r.headers["x-amz-cf-id"]});var j=(r)=>r!==void 0&&r!==null&&r!==""&&(!Object.getOwnPropertyNames(r).includes("length")||r.length!=0)&&(!Object.getOwnPropertyNames(r).includes("size")||r.size!=0);var og="ACL";var Qf="AccessKeyId";var ng="AcceptRanges";var Vf="AccessTier";var Us="BucketKeyEnabled";var vf="Credentials",pg="ChecksumAlgorithm";var fh="CacheControl",nf="ChecksumCRC32",pf="ChecksumCRC32C",eh="ContentDisposition";var lh="ContentEncoding";var ah="ContentLanguage",Bf="ContentLength",ug="ChecksumMode",tg="ContentMD5";var rw="ContentRange";var uf="ChecksumSHA1",tf="ChecksumSHA256";var hh="ContentType";var sw="DeleteMarker";var Of="Expires";var mh="ExpectedBucketOwner";var fw="ExpiresString";var gh="ETag";var Lr="Expiration";var ew="GrantFullControl";var lw="GrantRead",aw="GrantReadACP";var hw="GrantWriteACP";var mw="IfMatch",va="IfModifiedSince",gw="IfNoneMatch";var Ja="IfUnmodifiedSince";var ww="LastModified";var Aw="MissingMeta";var wh="ObjectLockLegalHoldStatus",Ah="ObjectLockMode";var _f="ObjectLockRetainUntilDate";var Sw="PartsCount";var Rw="PartNumber";var dw="Range";var Sh="RequestCharged",Iw="ResponseCacheControl",Ew="ResponseContentDisposition",kw="ResponseContentEncoding",Pw="ResponseContentLanguage",Nw="ResponseContentType";var $w="ResponseExpires";var Rh="RequestPayer";var Dw="ReplicationStatus";var Mw="Restore";var Jf="SecretAccessKey";var Wr="StorageClass";var yw="SessionMode";var re="ServerSideEncryption";var Cs="SSECustomerAlgorithm",dh="SSECustomerKey",cs="SSECustomerKeyMD5";var Ih="SSEKMSEncryptionContext",se="SSEKMSKeyId";var Yf="SessionToken";var Uw="Tagging";var Tw="TagCount";var fe="VersionId";var Eh="WebsiteRedirectLocation";var Cw="accept-ranges";var kh="cache-control",Ph="content-disposition",Nh="content-encoding",$h="content-language",qf="content-length",cw="content-md5",zw="content-range",Dh="content-type";var jf="expires";var Mh="etag",Gw="expiresstring";var Hw="if-match",Kw="if-modified-since";var Fw="if-none-match";var Lw="if-unmodified-since";var Ya="last-modified";var Ww="partNumber";var Xw="range",Zw="response-cache-control",Qw="response-content-disposition",Vw="response-content-encoding",vw="response-content-language",Jw="response-content-type",Yw="response-expires";var Bw="session";var Ow="versionId";var _w="x-amz-acl";var ee="x-amz-checksum-crc32",le="x-amz-checksum-crc32c",qw="x-amz-checksum-mode";var ae="x-amz-checksum-sha1",he="x-amz-checksum-sha256";var jw="x-amz-create-session-mode";var Ba="x-amz-delete-marker",yh="x-amz-expiration",Uh="x-amz-expected-bucket-owner";var iw="x-amz-grant-full-control",bw="x-amz-grant-read",xw="x-amz-grant-read-acp";var ow="x-amz-grant-write-acp";var Oa="x-amz-missing-meta";var _a="x-amz-mp-parts-count";var Th="x-amz-object-lock-legal-hold",Ch="x-amz-object-lock-mode",bf="x-amz-object-lock-retain-until-date";var nw="x-amz-restore",ch="x-amz-request-charged";var zh="x-amz-request-payer";var pw="x-amz-replication-status";var Gh="x-amz-storage-class",uw="x-amz-sdk-checksum-algorithm";var me="x-amz-server-side-encryption",ge="x-amz-server-side-encryption-aws-kms-key-id",Xr="x-amz-server-side-encryption-bucket-key-enabled",Hh="x-amz-server-side-encryption-context",zs="x-amz-server-side-encryption-customer-algorithm",Kh="x-amz-server-side-encryption-customer-key",Gs="x-amz-server-side-encryption-customer-key-md5",tw="x-amz-tagging",qa="x-amz-tagging-count";var Fh="x-amz-version-id",Lh="x-amz-website-redirect-location",Wh="x-id";class we extends Ir.classBuilder().ep({...Ar,DisableS3ExpressSessionAuth:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function(r,s,f,e){return[Er(f,this.serialize,this.deserialize),kr(f,r.getEndpointParameterInstructions()),ss(f)]}).s("AmazonS3","CreateSession",{}).n("S3Client","CreateSessionCommand").f(void 0,La).ser(na).de(ta).build(){}var Xh={name:"@aws-sdk/client-s3",description:"AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native",version:"3.629.0",scripts:{build:"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-s3","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo s3",test:"yarn test:unit","test:e2e":"yarn test:e2e:node && yarn test:e2e:browser","test:e2e:browser":"ts-mocha test/**/*.browser.ispec.ts && karma start karma.conf.js","test:e2e:node":"jest --c jest.config.e2e.js","test:unit":"ts-mocha test/unit/**/*.spec.ts"},main:"./dist-cjs/index.js",types:"./dist-types/index.d.ts",module:"./dist-es/index.js",sideEffects:!1,dependencies:{"@aws-crypto/sha1-browser":"5.2.0","@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.629.0","@aws-sdk/client-sts":"3.629.0","@aws-sdk/core":"3.629.0","@aws-sdk/credential-provider-node":"3.629.0","@aws-sdk/middleware-bucket-endpoint":"3.620.0","@aws-sdk/middleware-expect-continue":"3.620.0","@aws-sdk/middleware-flexible-checksums":"3.620.0","@aws-sdk/middleware-host-header":"3.620.0","@aws-sdk/middleware-location-constraint":"3.609.0","@aws-sdk/middleware-logger":"3.609.0","@aws-sdk/middleware-recursion-detection":"3.620.0","@aws-sdk/middleware-sdk-s3":"3.629.0","@aws-sdk/middleware-ssec":"3.609.0","@aws-sdk/middleware-user-agent":"3.620.0","@aws-sdk/region-config-resolver":"3.614.0","@aws-sdk/signature-v4-multi-region":"3.629.0","@aws-sdk/types":"3.609.0","@aws-sdk/util-endpoints":"3.614.0","@aws-sdk/util-user-agent-browser":"3.609.0","@aws-sdk/util-user-agent-node":"3.614.0","@aws-sdk/xml-builder":"3.609.0","@smithy/config-resolver":"^3.0.5","@smithy/core":"^2.3.2","@smithy/eventstream-serde-browser":"^3.0.6","@smithy/eventstream-serde-config-resolver":"^3.0.3","@smithy/eventstream-serde-node":"^3.0.5","@smithy/fetch-http-handler":"^3.2.4","@smithy/hash-blob-browser":"^3.1.2","@smithy/hash-node":"^3.0.3","@smithy/hash-stream-node":"^3.1.2","@smithy/invalid-dependency":"^3.0.3","@smithy/md5-js":"^3.0.3","@smithy/middleware-content-length":"^3.0.5","@smithy/middleware-endpoint":"^3.1.0","@smithy/middleware-retry":"^3.0.14","@smithy/middleware-serde":"^3.0.3","@smithy/middleware-stack":"^3.0.3","@smithy/node-config-provider":"^3.1.4","@smithy/node-http-handler":"^3.1.4","@smithy/protocol-http":"^4.1.0","@smithy/smithy-client":"^3.1.12","@smithy/types":"^3.3.0","@smithy/url-parser":"^3.0.3","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.14","@smithy/util-defaults-mode-node":"^3.0.14","@smithy/util-endpoints":"^2.0.5","@smithy/util-middleware":"^3.0.3","@smithy/util-retry":"^3.0.3","@smithy/util-stream":"^3.1.3","@smithy/util-utf8":"^3.0.0","@smithy/util-waiter":"^3.1.2",tslib:"^2.6.2"},devDependencies:{"@aws-sdk/signature-v4-crt":"3.629.0","@tsconfig/node16":"16.1.3","@types/chai":"^4.2.11","@types/mocha":"^8.0.4","@types/node":"^16.18.96",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"3.0.2",typescript:"~4.9.5"},engines:{node:">=16.0.0"},typesVersions:{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["dist-*/**"],author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license:"Apache-2.0",browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-s3",repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-s3"}};var Vs=M(As(),1);var sA="AWS_S3_USE_ARN_REGION",fA="s3_use_arn_region",Zh={environmentVariableSelector:(r)=>u(r,sA,t.ENV),configFileSelector:(r)=>u(r,fA,t.CONFIG),default:!1};var Qh=M(RA(),1),{__extends:wd,__assign:Ad,__rest:Sd,__decorate:Rd,__param:dd,__esDecorate:Id,__runInitializers:Ed,__propKey:kd,__setFunctionName:Pd,__metadata:Nd,__awaiter:Hs,__generator:Ks,__exportStar:$d,__createBinding:Dd,__values:Fs,__read:Md,__spread:yd,__spreadArrays:Ud,__spreadArray:Td,__await:Cd,__asyncGenerator:cd,__asyncDelegator:zd,__asyncValues:Gd,__makeTemplateObject:Hd,__importStar:Kd,__importDefault:Fd,__classPrivateFieldGet:Ld,__classPrivateFieldSet:Wd,__classPrivateFieldIn:Xd,__addDisposableResource:Zd,__disposeResources:Qd}=Qh.default;import{Buffer as Vh} from"buffer";var vh=(r,s)=>{if(typeof r!=="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof r} (${r})`);return s?Vh.from(r,s):Vh.from(r)};var Ae=(r)=>{const s=vh(r,"utf8");return new Uint8Array(s.buffer,s.byteOffset,s.byteLength/Uint8Array.BYTES_PER_ELEMENT)};function Zr(r){if(r instanceof Uint8Array)return r;if(typeof r==="string")return dA(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength/Uint8Array.BYTES_PER_ELEMENT);return new Uint8Array(r)}var dA=typeof Buffer!=="undefined"&&Buffer.from?function(r){return Buffer.from(r,"utf8")}:Ae;function Qr(r){if(typeof r==="string")return r.length===0;return r.byteLength===0}function Vr(r){return new Uint8Array([(r&4278190080)>>24,(r&16711680)>>16,(r&65280)>>8,r&255])}function vr(r){if(!Uint32Array.from){var s=new Uint32Array(r.length),f=0;while(f<r.length)s[f]=r[f],f+=1;return s}return Uint32Array.from(r)}var Se=function(){function r(){this.crc32=new sr}return r.prototype.update=function(s){if(Qr(s))return;this.crc32.update(Zr(s))},r.prototype.digest=function(){return Hs(this,void 0,void 0,function(){return Ks(this,function(s){return[2,Vr(this.crc32.digest())]})})},r.prototype.reset=function(){this.crc32=new sr},r}();var sr=function(){function r(){this.checksum=4294967295}return r.prototype.update=function(s){var f,e;try{for(var l=Fs(s),a=l.next();!a.done;a=l.next()){var h=a.value;this.checksum=this.checksum>>>8^EA[(this.checksum^h)&255]}}catch(m){f={error:m}}finally{try{if(a&&!a.done&&(e=l.return))e.call(l)}finally{if(f)throw f.error}}return this},r.prototype.digest=function(){return(this.checksum^4294967295)>>>0},r}();var IA=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],EA=vr(IA);var o=M(hr(),1);var Yh=M(hr(),1),Jh=function(r){for(let s=0;s<8;s++)r[s]^=255;for(let s=7;s>-1;s--)if(r[s]++,r[s]!==0)break};class Pr{constructor(r){if(this.bytes=r,r.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(r){if(r>9223372036854776000||r<-9223372036854776000)throw new Error(`${r} is too large (or, if negative, too small) to represent as an Int64`);const s=new Uint8Array(8);for(let f=7,e=Math.abs(Math.round(r));f>-1&&e>0;f--,e/=256)s[f]=e;if(r<0)Jh(s);return new Pr(s)}valueOf(){const r=this.bytes.slice(0),s=r[0]&128;if(s)Jh(r);return parseInt(Yh.toHex(r),16)*(s?-1:1)}toString(){return String(this.valueOf())}}class Re{constructor(r,s){this.toUtf8=r,this.fromUtf8=s}format(r){const s=[];for(let l of Object.keys(r)){const a=this.fromUtf8(l);s.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(r[l]))}const f=new Uint8Array(s.reduce((l,a)=>l+a.byteLength,0));let e=0;for(let l of s)f.set(l,e),e+=l.byteLength;return f}formatHeaderValue(r){switch(r.type){case"boolean":return Uint8Array.from([r.value?0:1]);case"byte":return Uint8Array.from([2,r.value]);case"short":const s=new DataView(new ArrayBuffer(3));return s.setUint8(0,3),s.setInt16(1,r.value,!1),new Uint8Array(s.buffer);case"integer":const f=new DataView(new ArrayBuffer(5));return f.setUint8(0,4),f.setInt32(1,r.value,!1),new Uint8Array(f.buffer);case"long":const e=new Uint8Array(9);return e[0]=5,e.set(r.value.bytes,1),e;case"binary":const l=new DataView(new ArrayBuffer(3+r.value.byteLength));l.setUint8(0,6),l.setUint16(1,r.value.byteLength,!1);const a=new Uint8Array(l.buffer);return a.set(r.value,3),a;case"string":const h=this.fromUtf8(r.value),m=new DataView(new ArrayBuffer(3+h.byteLength));m.setUint8(0,7),m.setUint16(1,h.byteLength,!1);const g=new Uint8Array(m.buffer);return g.set(h,3),g;case"timestamp":const S=new Uint8Array(9);return S[0]=8,S.set(Pr.fromNumber(r.value.valueOf()).bytes,1),S;case"uuid":if(!TA.test(r.value))throw new Error(`Invalid UUID received: ${r.value}`);const d=new Uint8Array(17);return d[0]=9,d.set(o.fromHex(r.value.replace(/\-/g,"")),1),d}}parse(r){const s={};let f=0;while(f<r.byteLength){const e=r.getUint8(f++),l=this.toUtf8(new Uint8Array(r.buffer,r.byteOffset+f,e));switch(f+=e,r.getUint8(f++)){case 0:s[l]={type:Oh,value:!0};break;case 1:s[l]={type:Oh,value:!1};break;case 2:s[l]={type:kA,value:r.getInt8(f++)};break;case 3:s[l]={type:PA,value:r.getInt16(f,!1)},f+=2;break;case 4:s[l]={type:NA,value:r.getInt32(f,!1)},f+=4;break;case 5:s[l]={type:$A,value:new Pr(new Uint8Array(r.buffer,r.byteOffset+f,8))},f+=8;break;case 6:const a=r.getUint16(f,!1);f+=2,s[l]={type:DA,value:new Uint8Array(r.buffer,r.byteOffset+f,a)},f+=a;break;case 7:const h=r.getUint16(f,!1);f+=2,s[l]={type:MA,value:this.toUtf8(new Uint8Array(r.buffer,r.byteOffset+f,h))},f+=h;break;case 8:s[l]={type:yA,value:new Date(new Pr(new Uint8Array(r.buffer,r.byteOffset+f,8)).valueOf())},f+=8;break;case 9:const m=new Uint8Array(r.buffer,r.byteOffset+f,16);f+=16,s[l]={type:UA,value:`${o.toHex(m.subarray(0,4))}-${o.toHex(m.subarray(4,6))}-${o.toHex(m.subarray(6,8))}-${o.toHex(m.subarray(8,10))}-${o.toHex(m.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return s}}var Bh;(function(r){r[r.boolTrue=0]="boolTrue",r[r.boolFalse=1]="boolFalse",r[r.byte=2]="byte",r[r.short=3]="short",r[r.integer=4]="integer",r[r.long=5]="long",r[r.byteArray=6]="byteArray",r[r.string=7]="string",r[r.timestamp=8]="timestamp",r[r.uuid=9]="uuid"})(Bh||(Bh={}));var Oh="boolean",kA="byte",PA="short",NA="integer",$A="long",DA="binary",MA="string",yA="timestamp",UA="uuid",TA=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;function qh({byteLength:r,byteOffset:s,buffer:f}){if(r<CA)throw new Error("Provided message too short to accommodate event stream message overhead");const e=new DataView(f,s,r),l=e.getUint32(0,!1);if(r!==l)throw new Error("Reported message length does not match received message length");const a=e.getUint32(_h,!1),h=e.getUint32(n,!1),m=e.getUint32(r-fr,!1),g=new sr().update(new Uint8Array(f,s,n));if(h!==g.digest())throw new Error(`The prelude checksum specified in the message (${h}) does not match the calculated CRC32 checksum (${g.digest()})`);if(g.update(new Uint8Array(f,s+n,r-(n+fr))),m!==g.digest())throw new Error(`The message checksum (${g.digest()}) did not match the expected value of ${m}`);return{headers:new DataView(f,s+n+fr,a),body:new Uint8Array(f,s+n+fr+a,l-a-(n+fr+fr))}}var _h=4,n=_h*2,fr=4,CA=n+fr*2;class de{constructor(r,s){this.headerMarshaller=new Re(r,s),this.messageBuffer=[],this.isEndOfStream=!1}feed(r){this.messageBuffer.push(this.decode(r))}endOfStream(){this.isEndOfStream=!0}getMessage(){const r=this.messageBuffer.pop(),s=this.isEndOfStream;return{getMessage(){return r},isEndOfStream(){return s}}}getAvailableMessages(){const r=this.messageBuffer;this.messageBuffer=[];const s=this.isEndOfStream;return{getMessages(){return r},isEndOfStream(){return s}}}encode({headers:r,body:s}){const f=this.headerMarshaller.format(r),e=f.byteLength+s.byteLength+16,l=new Uint8Array(e),a=new DataView(l.buffer,l.byteOffset,l.byteLength),h=new sr;return a.setUint32(0,e,!1),a.setUint32(4,f.byteLength,!1),a.setUint32(8,h.update(l.subarray(0,8)).digest(),!1),l.set(f,12),l.set(s,f.byteLength+12),a.setUint32(e-4,h.update(l.subarray(8,e-4)).digest(),!1),l}decode(r){const{headers:s,body:f}=qh(r);return{headers:this.headerMarshaller.parse(s),body:f}}formatHeaders(r){return this.headerMarshaller.format(r)}}class Ie{constructor(r){this.options=r}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let r of this.options.inputStream)yield this.options.decoder.decode(r)}}class Ee{constructor(r){this.options=r}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let r of this.options.messageStream)yield this.options.encoder.encode(r);if(this.options.includeEndFrame)yield new Uint8Array(0)}}class ke{constructor(r){this.options=r}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let r of this.options.messageStream){const s=await this.options.deserializer(r);if(s===void 0)continue;yield s}}}class Pe{constructor(r){this.options=r}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let r of this.options.inputStream)yield this.options.serializer(r)}}function jh(r){let s=0,f=0,e=null,l=null;const a=(m)=>{if(typeof m!=="number")throw new Error("Attempted to allocate an event message where size was not a number: "+m);s=m,f=4,e=new Uint8Array(m),new DataView(e.buffer).setUint32(0,m,!1)},h=async function*(){const m=r[Symbol.asyncIterator]();while(!0){const{value:g,done:S}=await m.next();if(S){if(!s)return;else if(s===f)yield e;else throw new Error("Truncated event message received.");return}const d=g.length;let k=0;while(k<d){if(!e){const U=d-k;if(!l)l=new Uint8Array(4);const D=Math.min(4-f,U);if(l.set(g.slice(k,k+D),f),f+=D,k+=D,f<4)break;a(new DataView(l.buffer).getUint32(0,!1)),l=null}const P=Math.min(s-f,d-k);if(e.set(g.slice(k,k+P),f),f+=P,k+=P,s&&s===f)yield e,e=null,s=0,f=0}}};return{[Symbol.asyncIterator]:h}}function ih(r,s){return async function(f){const{value:e}=f.headers[":message-type"];if(e==="error"){const l=new Error(f.headers[":error-message"].value||"UnknownError");throw l.name=f.headers[":error-code"].value,l}else if(e==="exception"){const l=f.headers[":exception-type"].value,a={[l]:f},h=await r(a);if(h.$unknown){const m=new Error(s(f.body));throw m.name=l,m}throw h[l]}else if(e==="event"){const l={[f.headers[":event-type"].value]:f},a=await r(l);if(a.$unknown)return;return a}else throw Error(`Unrecognizable event type: ${f.headers[":event-type"].value}`)}}class Ls{constructor({utf8Encoder:r,utf8Decoder:s}){this.eventStreamCodec=new de(r,s),this.utfEncoder=r}deserialize(r,s){const f=jh(r);return new ke({messageStream:new Ie({inputStream:f,decoder:this.eventStreamCodec}),deserializer:ih(s,this.utfEncoder)})}serialize(r,s){return new Ee({messageStream:new Pe({inputStream:r,serializer:s}),encoder:this.eventStreamCodec,includeEndFrame:!0})}}import{Readable as cA} from"stream";async function*bh(r){let s=!1,f=!1;const e=new Array;r.on("error",(l)=>{if(!s)s=!0;if(l)throw l}),r.on("data",(l)=>{e.push(l)}),r.on("end",()=>{s=!0});while(!f){const l=await new Promise((a)=>setTimeout(()=>a(e.shift()),0));if(l)yield l;f=s&&e.length===0}}class Ne{constructor({utf8Encoder:r,utf8Decoder:s}){this.universalMarshaller=new Ls({utf8Decoder:s,utf8Encoder:r})}deserialize(r,s){const f=typeof r[Symbol.asyncIterator]==="function"?r:bh(r);return this.universalMarshaller.deserialize(f,s)}serialize(r,s){return cA.from(this.universalMarshaller.serialize(r,s))}}var xh=(r)=>new Ne(r);import{Writable as zA} from"stream";class Ws extends zA{constructor(r,s){super(s);this.hash=r}_write(r,s,f){try{this.hash.update(v(r))}catch(e){return f(e)}f()}}var oh=(r,s)=>{if(s.readableFlowing!==null)throw new Error("Unable to calculate hash for flowing readable stream");const f=new r,e=new Ws(f);return s.pipe(e),new Promise((l,a)=>{s.on("error",(h)=>{e.end(),a(h)}),e.on("error",a),e.on("finish",()=>{f.digest().then(l).catch(a)})})};var Xs=M(As(),1);var th=M(GA(),1);var Zs=M(Nl(),1);var rm=(r)=>{return{apiVersion:"2006-03-01",base64Decoder:r?.base64Decoder??ph,base64Encoder:r?.base64Encoder??uh,disableHostPrefix:r?.disableHostPrefix??!1,endpointProvider:r?.endpointProvider??ws,extensions:r?.extensions??[],getAwsChunkedEncodingStream:r?.getAwsChunkedEncodingStream??Zs.getAwsChunkedEncodingStream,httpAuthSchemeProvider:r?.httpAuthSchemeProvider??Ga,httpAuthSchemes:r?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(s)=>s.getIdentityProvider("aws.auth#sigv4"),signer:new Xs.AwsSdkSigV4Signer},{schemeId:"aws.auth#sigv4a",identityProvider:(s)=>s.getIdentityProvider("aws.auth#sigv4a"),signer:new Xs.AwsSdkSigV4ASigner}],logger:r?.logger??new Or,sdkStreamMixin:r?.sdkStreamMixin??Zs.sdkStreamMixin,serviceId:r?.serviceId??"S3",signerConstructor:r?.signerConstructor??hf,signingEscapePath:r?.signingEscapePath??!1,urlParser:r?.urlParser??th.parseUrl,useArnRegion:r?.useArnRegion??!1,utf8Decoder:r?.utf8Decoder??Cr,utf8Encoder:r?.utf8Encoder??nh}};var km=(r)=>{fm(process.version);const s=Im(r),f=()=>s().then(sm),e=rm(r);return Vs.emitWarningIfUnsupportedVersion(process.version),{...e,...r,runtime:"node",defaultsMode:s,bodyLengthChecker:r?.bodyLengthChecker??dm,credentialDefaultProvider:r?.credentialDefaultProvider??Em,defaultUserAgentProvider:r?.defaultUserAgentProvider??Rm({serviceId:e.serviceId,clientVersion:Xh.version}),disableS3ExpressSessionAuth:r?.disableS3ExpressSessionAuth??i(sf),eventStreamSerdeProvider:r?.eventStreamSerdeProvider??xh,maxAttempts:r?.maxAttempts??i(gm),md5:r?.md5??Qs.bind(null,"md5"),region:r?.region??i(am,hm),requestHandler:Am.create(r?.requestHandler??f),retryMode:r?.retryMode??i({...wm,default:async()=>(await f()).retryMode||mm}),sha1:r?.sha1??Qs.bind(null,"sha1"),sha256:r?.sha256??Qs.bind(null,"sha256"),sigv4aSigningRegionSet:r?.sigv4aSigningRegionSet??i(Vs.NODE_SIGV4A_CONFIG_OPTIONS),streamCollector:r?.streamCollector??Sm,streamHasher:r?.streamHasher??oh,useArnRegion:r?.useArnRegion??i(Zh),useDualstackEndpoint:r?.useDualstackEndpoint??i(em),useFipsEndpoint:r?.useFipsEndpoint??i(lm)}};var Pm=(r)=>{const s=r.httpAuthSchemes;let{httpAuthSchemeProvider:f,credentials:e}=r;return{setHttpAuthScheme(l){const a=s.findIndex((h)=>h.schemeId===l.schemeId);if(a===-1)s.push(l);else s.splice(a,1,l)},httpAuthSchemes(){return s},setHttpAuthSchemeProvider(l){f=l},httpAuthSchemeProvider(){return f},setCredentials(l){e=l},credentials(){return e}}},Nm=(r)=>{return{httpAuthSchemes:r.httpAuthSchemes(),httpAuthSchemeProvider:r.httpAuthSchemeProvider(),credentials:r.credentials()}};var vs=(r)=>r,Cm=(r,s)=>{const f={...vs(Um(r)),...vs(Mm(r)),...vs($m(r)),...vs(Pm(r))};return s.forEach((e)=>e.configure(f)),{...r,...Tm(f),...ym(f),...Dm(f),...Nm(f)}};class $e extends Km{constructor(...[r]){const s=km(r||{}),f=Ka(s),e=Fm(f),l=Qm(e),a=Wm(l),h=cm(a),m=Zm(h),g=yl(m),S=Ha(g),d=Pl(S,{session:[()=>this,we]}),k=Cm(d,r?.extensions||[]);super(k);this.config=k,this.middlewareStack.use(Lm(this.config)),this.middlewareStack.use(Vm(this.config)),this.middlewareStack.use(Xm(this.config)),this.middlewareStack.use(zm(this.config)),this.middlewareStack.use(Gm(this.config)),this.middlewareStack.use(Hm(this.config)),this.middlewareStack.use(Nr.getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:Ca,identityProviderConfigProvider:async(P)=>new Nr.DefaultIdentityProviderConfig({"aws.auth#sigv4":P.credentials,"aws.auth#sigv4a":P.credentials})})),this.middlewareStack.use(Nr.getHttpSigningPlugin(this.config)),this.middlewareStack.use(Ml(this.config)),this.middlewareStack.use(ze(this.config)),this.middlewareStack.use(Fe(this.config)),this.middlewareStack.use(ff(this.config)),this.middlewareStack.use(lf(this.config))}destroy(){super.destroy()}}function HA(r){return(s)=>async(f)=>{const e={...f.input},l=[{target:"SSECustomerKey",hash:"SSECustomerKeyMD5"},{target:"CopySourceSSECustomerKey",hash:"CopySourceSSECustomerKeyMD5"}];for(let a of l){const h=e[a.target];if(h){let m;if(typeof h==="string")if(FA(h,r))m=r.base64Decoder(h);else m=r.utf8Decoder(h),e[a.target]=r.base64Encoder(m);else m=ArrayBuffer.isView(h)?new Uint8Array(h.buffer,h.byteOffset,h.byteLength):new Uint8Array(h),e[a.target]=r.base64Encoder(m);const g=new r.md5;g.update(m),e[a.hash]=r.base64Encoder(await g.digest())}}return s({...f,input:e})}}function FA(r,s){if(!/^(?:[A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(r))return!1;try{return s.base64Decoder(r).length===32}catch{return!1}}var KA={name:"ssecMiddleware",step:"initialize",tags:["SSE"],override:!0},Js=(r)=>({applyToStack:(s)=>{s.add(HA(r),KA)}});var y;(function(r){r.MD5="MD5",r.CRC32="CRC32",r.CRC32C="CRC32C",r.SHA1="SHA1",r.SHA256="SHA256"})(y||(y={}));var vm;(function(r){r.HEADER="header",r.TRAILER="trailer"})(vm||(vm={}));var{MD5:Jm,CRC32:Ym}=y;var Jr=[y.CRC32,y.CRC32C,y.SHA1,y.SHA256],Bm=[y.CRC32,y.CRC32C,y.SHA1,y.SHA256];var Om=(r,{requestChecksumRequired:s,requestAlgorithmMember:f},e)=>{const l=e?Ym:Jm;if(!f||!r[f])return s?l:void 0;const a=r[f];if(!Jr.includes(a))throw new Error(`The checksum algorithm "${a}" is not supported by the client.`+` Select one of ${Jr}.`);return a};var $r=(r)=>r===y.MD5?"content-md5":`x-amz-checksum-${r.toLowerCase()}`;var _m=(r,s)=>{const f=r.toLowerCase();for(let e of Object.keys(s))if(f===e.toLowerCase())return!0;return!1};var Dr=(r)=>r!==void 0&&typeof r!=="string"&&!ArrayBuffer.isView(r)&&!xr(r);var Me=function(){function r(){this.crc32c=new De}return r.prototype.update=function(s){if(Qr(s))return;this.crc32c.update(Zr(s))},r.prototype.digest=function(){return Hs(this,void 0,void 0,function(){return Ks(this,function(s){return[2,Vr(this.crc32c.digest())]})})},r.prototype.reset=function(){this.crc32c=new De},r}();var De=function(){function r(){this.checksum=4294967295}return r.prototype.update=function(s){var f,e;try{for(var l=Fs(s),a=l.next();!a.done;a=l.next()){var h=a.value;this.checksum=this.checksum>>>8^WA[(this.checksum^h)&255]}}catch(m){f={error:m}}finally{try{if(a&&!a.done&&(e=l.return))e.call(l)}finally{if(f)throw f.error}}return this},r.prototype.digest=function(){return(this.checksum^4294967295)>>>0},r}();var LA=[0,4067132163,3778769143,324072436,3348797215,904991772,648144872,3570033899,2329499855,2024987596,1809983544,2575936315,1296289744,3207089363,2893594407,1578318884,274646895,3795141740,4049975192,51262619,3619967088,632279923,922689671,3298075524,2592579488,1760304291,2075979607,2312596564,1562183871,2943781820,3156637768,1313733451,549293790,3537243613,3246849577,871202090,3878099393,357341890,102525238,4101499445,2858735121,1477399826,1264559846,3107202533,1845379342,2677391885,2361733625,2125378298,820201905,3263744690,3520608582,598981189,4151959214,85089709,373468761,3827903834,3124367742,1213305469,1526817161,2842354314,2107672161,2412447074,2627466902,1861252501,1098587580,3004210879,2688576843,1378610760,2262928035,1955203488,1742404180,2511436119,3416409459,969524848,714683780,3639785095,205050476,4266873199,3976438427,526918040,1361435347,2739821008,2954799652,1114974503,2529119692,1691668175,2005155131,2247081528,3690758684,697762079,986182379,3366744552,476452099,3993867776,4250756596,255256311,1640403810,2477592673,2164122517,1922457750,2791048317,1412925310,1197962378,3037525897,3944729517,427051182,170179418,4165941337,746937522,3740196785,3451792453,1070968646,1905808397,2213795598,2426610938,1657317369,3053634322,1147748369,1463399397,2773627110,4215344322,153784257,444234805,3893493558,1021025245,3467647198,3722505002,797665321,2197175160,1889384571,1674398607,2443626636,1164749927,3070701412,2757221520,1446797203,137323447,4198817972,3910406976,461344835,3484808360,1037989803,781091935,3705997148,2460548119,1623424788,1939049696,2180517859,1429367560,2807687179,3020495871,1180866812,410100952,3927582683,4182430767,186734380,3756733383,763408580,1053836080,3434856499,2722870694,1344288421,1131464017,2971354706,1708204729,2545590714,2229949006,1988219213,680717673,3673779818,3383336350,1002577565,4010310262,493091189,238226049,4233660802,2987750089,1082061258,1395524158,2705686845,1972364758,2279892693,2494862625,1725896226,952904198,3399985413,3656866545,731699698,4283874585,222117402,510512622,3959836397,3280807620,837199303,582374963,3504198960,68661723,4135334616,3844915500,390545967,1230274059,3141532936,2825850620,1510247935,2395924756,2091215383,1878366691,2644384480,3553878443,565732008,854102364,3229815391,340358836,3861050807,4117890627,119113024,1493875044,2875275879,3090270611,1247431312,2660249211,1828433272,2141937292,2378227087,3811616794,291187481,34330861,4032846830,615137029,3603020806,3314634738,939183345,1776939221,2609017814,2295496738,2058945313,2926798794,1545135305,1330124605,3173225534,4084100981,17165430,307568514,3762199681,888469610,3332340585,3587147933,665062302,2042050490,2346497209,2559330125,1793573966,3190661285,1279665062,1595330642,2910671697],WA=vr(LA);var Ys=(r,s)=>({[y.MD5]:s.md5,[y.CRC32]:Se,[y.CRC32C]:Me,[y.SHA1]:s.sha1,[y.SHA256]:s.sha256})[r];var Bs=(r,s)=>{const f=new r;return f.update(v(s||"")),f.digest()};var qm={name:"flexibleChecksumsMiddleware",step:"build",tags:["BODY_CHECKSUM"],override:!0},jm=(r,s)=>(f,e)=>async(l)=>{if(!L.isInstance(l.request))return f(l);const{request:a}=l,{body:h,headers:m}=a,{base64Encoder:g,streamHasher:S}=r,{input:d,requestChecksumRequired:k,requestAlgorithmMember:P}=s,U=Om(d,{requestChecksumRequired:k,requestAlgorithmMember:P},!!e.isS3ExpressBucket);let D=h,Q=m;if(U){const _=$r(U),Mr=Ys(U,r);if(Dr(h)){const{getAwsChunkedEncodingStream:qs,bodyLengthChecker:tm}=r;D=qs(h,{base64Encoder:g,bodyLengthChecker:tm,checksumLocationName:_,checksumAlgorithmFn:Mr,streamHasher:S}),Q={...m,"content-encoding":m["content-encoding"]?`${m["content-encoding"]},aws-chunked`:"aws-chunked","transfer-encoding":"chunked","x-amz-decoded-content-length":m["content-length"],"x-amz-content-sha256":"STREAMING-UNSIGNED-PAYLOAD-TRAILER","x-amz-trailer":_},delete Q["content-length"]}else if(!_m(_,m)){const qs=await Bs(Mr,h);Q={...m,[_]:g(qs)}}}return await f({...l,request:{...a,headers:Q,body:D}})};var Os=(r=[])=>{const s=[];for(let f of Bm){if(!r.includes(f)||!Jr.includes(f))continue;s.push(f)}return s};var im=(r)=>{const s=r.lastIndexOf("-");if(s!==-1){const f=r.slice(s+1);if(!f.startsWith("0")){const e=parseInt(f,10);if(!isNaN(e)&&e>=1&&e<=1e4)return!0}}return!1};import{Transform as XA} from"stream";function ye(r){const s=new XA;return s.push(r),s.push(null),s}var bm=async(r,{streamHasher:s,checksumAlgorithmFn:f,base64Encoder:e})=>{const l=Dr(r)?s(f,r):Bs(f,r);return e(await l)};var xm=async(r,{config:s,responseAlgorithms:f})=>{const e=Os(f),{body:l,headers:a}=r;for(let h of e){const m=$r(h),g=a[m];if(g){const S=Ys(h,s),{streamHasher:d,base64Encoder:k}=s,P=await bm(l,{streamHasher:d,checksumAlgorithmFn:S,base64Encoder:k});if(P===g)break;throw new Error(`Checksum mismatch: expected "${P}" but received "${g}"`+` in response header "${m}".`)}}};var om={name:"flexibleChecksumsResponseMiddleware",toMiddleware:"deserializerMiddleware",relation:"after",tags:["BODY_CHECKSUM"],override:!0},nm=(r,s)=>(f,e)=>async(l)=>{if(!L.isInstance(l.request))return f(l);const a=l.input,h=await f(l),m=h.response;let g=void 0;const{requestValidationModeMember:S,responseAlgorithms:d}=s;if(S&&a[S]==="ENABLED"){const{clientName:k,commandName:P}=e;if(k==="S3Client"&&P==="GetObjectCommand"&&Os(d).every((Q)=>{const Br=$r(Q),_=m.headers[Br];return!_||im(_)}))return h;const D=Dr(m.body);if(D)g=await r.streamCollector(m.body),m.body=ye(g);if(await xm(h.response,{config:r,responseAlgorithms:d}),D&&g)m.body=ye(g)}return h};var _s=(r,s)=>({applyToStack:(f)=>{f.add(jm(r,s),qm),f.addRelativeTo(nm(r,s),om)}});class Ue extends Ir.classBuilder().ep({...Ar,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(r,s,f,e){return[Er(f,this.serialize,this.deserialize),kr(f,r.getEndpointParameterInstructions()),_s(f,{input:this.input,requestChecksumRequired:!1,requestValidationModeMember:"ChecksumMode",responseAlgorithms:["CRC32","CRC32C","SHA256","SHA1"]}),Js(f),Le(f)]}).s("AmazonS3","GetObject",{}).n("S3Client","GetObjectCommand").f(Xa,Wa).ser(pa).de(rh).build(){}class Te extends Ir.classBuilder().ep({...Ar,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(r,s,f,e){return[Er(f,this.serialize,this.deserialize),kr(f,r.getEndpointParameterInstructions()),_s(f,{input:this.input,requestAlgorithmMember:"ChecksumAlgorithm",requestChecksumRequired:!1}),Ge(f),ss(f),Js(f)]}).s("AmazonS3","PutObject",{}).n("S3Client","PutObjectCommand").f(Va,Qa).ser(ua).de(sh).build(){}var um=M(ZA(),1);import{Buffer as Ce} from"buffer";var pm=new $e;class Yr{static folder(r){if(!r||r.includes("null")||r.includes("undefined"))throw new Error("Folder path has to be specified.");return{put:async(s)=>{let f;if(s instanceof Blob)return f=`${ce()}.${s.type.split("/")[1]}`,Yr.put({body:s,name:`${r}/${f}`});return Yr.put({...s,name:`${r}/${f}`})},fetch:async(s)=>{let f=process.env.BUCKET_NAME,e;if(typeof s==="string")e=s;else f=s.bucket??f,e=s.name;if(!e)throw new Error("Object name has to be specified");return Yr.fetch({...s,name:`${r}/${e}`})}}}static async put(r){let s,f,e,l=process.env.BUCKET_NAME;if(r instanceof Blob)s=r,e=`${ce()}.${r.type.split("/")[1]}`,f=r.type;else s=r.body,e=r.name,f=r.contentType;f=s instanceof Blob||s instanceof File?s.type:void 0;const a=s instanceof Ce?s:Ce.from(await s.arrayBuffer());return await pm.send(new Te({Bucket:l,Key:e,Body:a,ContentType:f})),e}static async metadata(r){const s=Ce.from(await r.arrayBuffer());try{return await um.default(s).metadata()}catch{return{}}}static async fetch(r){let s=process.env.BUCKET_NAME,f;if(typeof r==="string")f=r;else s=r.bucket??s,f=r.name;if(!f)throw new Error("Object name has to be specified");const e=await pm.send(new Ue({Bucket:s,Key:f}));return new Response(e.Body.transformToWebStream(),{headers:{"Content-Type":e.ContentType,"Content-Length":e.ContentLength.toString(),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":e.LastModified?.toUTCString()||"",ETag:e.ETag||""}})}static delete(){}}export{Yr as Storage};
|
|
11
|
+
${cr.toHex(l)}`}getCanonicalPath({path:r}){if(this.uriEscapePath){const s=[];for(let l of r.split("/")){if(l?.length===0)continue;if(l===".")continue;if(l==="..")s.pop();else s.push(l)}const f=`${r?.startsWith("/")?"/":""}${s.join("/")}${s.length>0&&r?.endsWith("/")?"/":""}`;return al.escapeUri(f).replace(/%2F/g,"/")}return r}async getSignature(r,s,f,e){const l=await this.createStringToSign(r,s,e),a=new this.sha256(await f);return a.update(v(l)),cr.toHex(await a.digest())}getSigningKey(r,s,f,e){return pe(this.sha256,r,f,s,e||this.service)}validateResolvedCredentials(r){if(typeof r!=="object"||typeof r.accessKeyId!=="string"||typeof r.secretAccessKey!=="string")throw new Error("Resolved credential object is not valid")}}var pr=(r)=>{const s=el(r).replace(/[\-:]/g,"");return{longDate:s,shortDate:s.slice(0,8)}},ll=(r)=>Object.keys(r).sort().join(";");var hl="Directory",ml="S3Express",gl="sigv4-s3express",ur="X-Amz-S3session-Token",zr=ur.toLowerCase(),Ig="AWS_S3_DISABLE_EXPRESS_SESSION_AUTH",Eg="s3_disable_express_session_auth",ts={environmentVariableSelector:(r)=>p(r,Ig,u.ENV),configFileSelector:(r)=>p(r,Eg,u.CONFIG),default:!1};var wl=function(r){return{accessKeyId:r.accessKeyId,secretAccessKey:r.secretAccessKey,expiration:r.expiration}},Al=function(r,s){const f=setTimeout(()=>{throw new Error("SignatureV4S3Express credential override was created but not called.")},10),e=r.credentialProvider,l=()=>{return clearTimeout(f),r.credentialProvider=e,Promise.resolve(s)};r.credentialProvider=l};class tr extends us{async signWithCredentials(r,s,f){const e=wl(s);r.headers[zr]=s.sessionToken;const l=this;return Al(l,e),l.signRequest(r,f??{})}async presignWithCredentials(r,s,f){const e=wl(s);return delete r.headers[zr],r.headers[ur]=s.sessionToken,r.query=r.query??{},r.query[ur]=s.sessionToken,Al(this,e),this.presign(r,f)}}var Sl=(r)=>{return(s,f)=>async(e)=>{if(f.endpointV2){const l=f.endpointV2,a=l.properties?.authSchemes?.[0]?.name===gl;if(l.properties?.backend===ml||l.properties?.bucketType===hl)f.isS3ExpressBucket=!0;if(a){const m=e.input.Bucket;if(m){const g=await r.s3ExpressIdentityProvider.getS3ExpressIdentity(await r.credentials(),{Bucket:m});if(f.s3ExpressIdentity=g,L.isInstance(e.request)&&g.sessionToken)e.request.headers[zr]=g.sessionToken}}}return s(e)}},Rl={name:"s3ExpressMiddleware",step:"build",tags:["S3","S3_EXPRESS"],override:!0},rf=(r)=>({applyToStack:(s)=>{s.add(Sl(r),Rl)}});var Il=M(sf(),1);var Pg=M(kg(),1),El=M(ps(),1);var dl=async(r,s,f,e)=>{const l=await e.signWithCredentials(f,r,{});if(l.headers["X-Amz-Security-Token"]||l.headers["x-amz-security-token"])throw new Error("X-Amz-Security-Token must not be set for s3-express requests.");return l};var Ng=(r)=>(s)=>{throw s},$g=(r,s)=>{};var kl=(r)=>(s,f)=>async(e)=>{if(!L.isInstance(e.request))return s(e);const a=El.getSmithyContext(f).selectedHttpAuthScheme;if(!a)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:h={}},identity:m,signer:g}=a;let S;if(f.s3ExpressIdentity)S=await dl(f.s3ExpressIdentity,h,e.request,await r.signer());else S=await g.sign(e.request,m,h);const d=await s({...e,request:S}).catch((g.errorHandler||Ng)(h));return(g.successHandler||$g)(d.response,h),d},ff=(r)=>({applyToStack:(s)=>{s.addRelativeTo(kl(r),Il.httpSigningMiddlewareOptions)}});var Pl=(r,{session:s})=>{const[f,e]=s;return{...r,forcePathStyle:r.forcePathStyle??!1,useAccelerateEndpoint:r.useAccelerateEndpoint??!1,disableMultiregionAccessPoints:r.disableMultiregionAccessPoints??!1,followRegionRedirects:r.followRegionRedirects??!1,s3ExpressIdentityProvider:r.s3ExpressIdentityProvider??new lr(async(l)=>f().send(new e({Bucket:l,SessionMode:"ReadWrite"}))),bucketEndpoint:r.bucketEndpoint??!1}};var Dg={CopyObjectCommand:!0,UploadPartCopyCommand:!0,CompleteMultipartUploadCommand:!0},Mg=3000,yg=(r)=>(s,f)=>async(e)=>{const l=await s(e),{response:a}=l;if(!_r.isInstance(a))return l;const{statusCode:h,body:m}=a;if(h<200||h>=300)return l;let g=m,S=m;if(m&&typeof m==="object"&&!(m instanceof Uint8Array))[g,S]=await Nl(m);a.body=S;const d=await Ug(g,{streamCollector:async(P)=>{return $l(P,Mg)}});if(typeof g?.destroy==="function")g.destroy();const k=r.utf8Encoder(d.subarray(d.length-16));if(d.length===0&&Dg[f.commandName]){const P=new Error("S3 aborted request");throw P.name="InternalError",P}if(k&&k.endsWith("</Error>"))a.statusCode=400;return l},Ug=(r=new Uint8Array,s)=>{if(r instanceof Uint8Array)return Promise.resolve(r);return s.streamCollector(r)||Promise.resolve(new Uint8Array)},Tg={relation:"after",toMiddleware:"deserializerMiddleware",tags:["THROW_200_EXCEPTIONS","S3"],name:"throw200ExceptionsMiddleware",override:!0},rs=(r)=>({applyToStack:(s)=>{s.addRelativeTo(yg(r),Tg)}});var ef=(r)=>typeof r==="string"&&r.indexOf("arn:")===0&&r.split(":").length>=6;function Dl(r){return(s,f)=>async(e)=>{if(r.bucketEndpoint){const l=f.endpointV2;if(l){const a=e.input.Bucket;if(typeof a==="string")try{const h=new URL(a);l.url=h}catch(h){const m=`@aws-sdk/middleware-sdk-s3: bucketEndpoint=true was set but Bucket=${a} could not be parsed as URL.`;if(f.logger?.constructor?.name==="NoOpLogger")console.warn(m);else f.logger?.warn?.(m);throw h}}}return s(e)}}var Ml={name:"bucketEndpointMiddleware",override:!0,relation:"after",toMiddleware:"endpointV2Middleware"};function Cg({bucketEndpoint:r}){return(s)=>async(f)=>{const{input:{Bucket:e}}=f;if(!r&&typeof e==="string"&&!ef(e)&&e.indexOf("/")>=0){const l=new Error(`Bucket name shouldn't contain '/', received '${e}'`);throw l.name="InvalidBucketName",l}return s({...f})}}var cg={step:"initialize",tags:["VALIDATE_BUCKET_NAME"],name:"validateBucketNameMiddleware",override:!0},yl=(r)=>({applyToStack:(s)=>{s.add(Cg(r),cg),s.addRelativeTo(Dl(r),Ml)}});var Pr=M(sf(),1);var Ul=(r)=>({...r,eventStreamMarshaller:r.eventStreamSerdeProvider(r)});var As=M(ws(),1);var ss={CrtSignerV4:null};class lf{constructor(r){this.sigv4Signer=new tr(r),this.signerOptions=r}async sign(r,s={}){if(s.signingRegion==="*"){if(this.signerOptions.runtime!=="node")throw new Error("This request requires signing with SigV4Asymmetric algorithm. It's only available in Node.js");return this.getSigv4aSigner().sign(r,s)}return this.sigv4Signer.sign(r,s)}async signWithCredentials(r,s,f={}){if(f.signingRegion==="*"){if(this.signerOptions.runtime!=="node")throw new Error("This request requires signing with SigV4Asymmetric algorithm. It's only available in Node.js");return this.getSigv4aSigner().signWithCredentials(r,s,f)}return this.sigv4Signer.signWithCredentials(r,s,f)}async presign(r,s={}){if(s.signingRegion==="*"){if(this.signerOptions.runtime!=="node")throw new Error("This request requires signing with SigV4Asymmetric algorithm. It's only available in Node.js");return this.getSigv4aSigner().presign(r,s)}return this.sigv4Signer.presign(r,s)}async presignWithCredentials(r,s,f={}){if(f.signingRegion==="*")throw new Error("Method presignWithCredentials is not supported for [signingRegion=*].");return this.sigv4Signer.presignWithCredentials(r,s,f)}getSigv4aSigner(){if(!this.sigv4aSigner){let r=null;try{if(r=ss.CrtSignerV4,typeof r!=="function")throw new Error}catch(s){throw s.message=`${s.message}\n`+'Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. \nYou must also register the package by calling [require("@aws-sdk/signature-v4-crt");] or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. \nFor more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt',s}this.sigv4aSigner=new r({...this.signerOptions,signingAlgorithm:1})}return this.sigv4aSigner}}var Kr=M(ps(),1);var hr={["required"]:!1,["type"]:"String"},mr={["required"]:!0,default:!1,["type"]:"Boolean"},Gr={["required"]:!1,["type"]:"Boolean"},Y={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"Accelerate"},!0]},$={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseFIPS"},!0]},N={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseDualStack"},!0]},C={["fn"]:"isSet",["argv"]:[{["ref"]:"Endpoint"}]},Ia={["fn"]:"aws.partition",["argv"]:[{["ref"]:"Region"}],["assign"]:"partitionResult"},Tl={["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[{["ref"]:"partitionResult"},"name"]},"aws-cn"]},hs={["fn"]:"isSet",["argv"]:[{["ref"]:"Bucket"}]},X={["ref"]:"Bucket"},W={["fn"]:"parseURL",["argv"]:[{["ref"]:"Endpoint"}],["assign"]:"url"},as={["fn"]:"booleanEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[{["ref"]:"url"},"isIp"]},!0]},Ea={["ref"]:"url"},ka={["fn"]:"uriEncode",["argv"]:[X],["assign"]:"uri_encoded_bucket"},q={["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},w={},Pa={["fn"]:"aws.isVirtualHostableS3Bucket",["argv"]:[X,!1]},af={["error"]:"S3Express bucket name is not a valid virtual hostable name.",["type"]:"error"},ms={["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4-s3express",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},Cl={["fn"]:"isSet",["argv"]:[{["ref"]:"UseS3ExpressControlEndpoint"}]},cl={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseS3ExpressControlEndpoint"},!0]},A={["fn"]:"not",["argv"]:[C]},zl={["error"]:"Unrecognized S3Express bucket name format.",["type"]:"error"},Gl={["fn"]:"not",["argv"]:[hs]},Hl={["ref"]:"hardwareType"},Kl={["conditions"]:[A],["error"]:"Expected a endpoint to be specified but no endpoint was found",["type"]:"error"},fs={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4a",["signingName"]:"s3-outposts",["signingRegionSet"]:["*"]},{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3-outposts",["signingRegion"]:"{Region}"}]},hf={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"ForcePathStyle"},!1]},zg={["ref"]:"ForcePathStyle"},T={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"Accelerate"},!1]},z={["fn"]:"stringEquals",["argv"]:[{["ref"]:"Region"},"aws-global"]},H={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3",["signingRegion"]:"us-east-1"}]},E={["fn"]:"not",["argv"]:[z]},K={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseGlobalEndpoint"},!0]},Fl={["url"]:"https://{Bucket}.s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:{["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3",["signingRegion"]:"{Region}"}]},["headers"]:{}},c={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3",["signingRegion"]:"{Region}"}]},F={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseGlobalEndpoint"},!1]},I={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseDualStack"},!1]},Ll={["url"]:"https://{Bucket}.s3-fips.{Region}.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},R={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseFIPS"},!1]},Wl={["url"]:"https://{Bucket}.s3-accelerate.dualstack.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},Xl={["url"]:"https://{Bucket}.s3.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},mf={["fn"]:"booleanEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[Ea,"isIp"]},!1]},gf={["url"]:"{url#scheme}://{url#authority}{url#normalizedPath}{Bucket}",["properties"]:c,["headers"]:{}},Gf={["url"]:"{url#scheme}://{Bucket}.{url#authority}{url#path}",["properties"]:c,["headers"]:{}},Zl={["endpoint"]:Gf,["type"]:"endpoint"},wf={["url"]:"https://{Bucket}.s3-accelerate.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},Ql={["url"]:"https://{Bucket}.s3.{Region}.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},es={["error"]:"Invalid region: region was not a valid DNS name.",["type"]:"error"},V={["ref"]:"bucketArn"},Na={["ref"]:"arnType"},Af={["fn"]:"getAttr",["argv"]:[V,"service"]},Hf={["ref"]:"accessPointName"},Vl={["conditions"]:[N],["error"]:"S3 Object Lambda does not support Dual-stack",["type"]:"error"},vl={["conditions"]:[Y],["error"]:"S3 Object Lambda does not support S3 Accelerate",["type"]:"error"},Jl={["conditions"]:[{["fn"]:"isSet",["argv"]:[{["ref"]:"DisableAccessPoints"}]},{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"DisableAccessPoints"},!0]}],["error"]:"Access points are not supported for this operation",["type"]:"error"},Sf={["conditions"]:[{["fn"]:"isSet",["argv"]:[{["ref"]:"UseArnRegion"}]},{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseArnRegion"},!1]},{["fn"]:"not",["argv"]:[{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[V,"region"]},"{Region}"]}]}],["error"]:"Invalid configuration: region from ARN `{bucketArn#region}` does not match client region `{Region}` and UseArnRegion is `false`",["type"]:"error"},$a={["fn"]:"getAttr",["argv"]:[{["ref"]:"bucketPartition"},"name"]},Da={["fn"]:"getAttr",["argv"]:[V,"accountId"]},Rf={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3-object-lambda",["signingRegion"]:"{bucketArn#region}"}]},Yl={["error"]:"Invalid ARN: The access point name may only contain a-z, A-Z, 0-9 and `-`. Found: `{accessPointName}`",["type"]:"error"},df={["error"]:"Invalid ARN: The account id may only contain a-z, A-Z, 0-9 and `-`. Found: `{bucketArn#accountId}`",["type"]:"error"},If={["error"]:"Invalid region in ARN: `{bucketArn#region}` (invalid DNS name)",["type"]:"error"},Ef={["error"]:"Client was configured for partition `{partitionResult#name}` but ARN (`{Bucket}`) has `{bucketPartition#name}`",["type"]:"error"},Bl={["error"]:"Invalid ARN: The ARN may only contain a single resource component after `accesspoint`.",["type"]:"error"},Ol={["error"]:"Invalid ARN: Expected a resource of the format `accesspoint:<accesspoint name>` but no name was provided",["type"]:"error"},Hr={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3",["signingRegion"]:"{bucketArn#region}"}]},_l={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4a",["signingName"]:"s3-outposts",["signingRegionSet"]:["*"]},{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3-outposts",["signingRegion"]:"{bucketArn#region}"}]},ql={["fn"]:"aws.parseArn",["argv"]:[X]},jl={["url"]:"https://s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:c,["headers"]:{}},il={["url"]:"https://s3-fips.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:c,["headers"]:{}},bl={["url"]:"https://s3.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:c,["headers"]:{}},kf={["url"]:"{url#scheme}://{url#authority}{url#normalizedPath}{uri_encoded_bucket}",["properties"]:c,["headers"]:{}},xl={["url"]:"https://s3.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:c,["headers"]:{}},ol={["ref"]:"UseObjectLambdaEndpoint"},Pf={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3-object-lambda",["signingRegion"]:"{Region}"}]},nl={["url"]:"https://s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},pl={["url"]:"https://s3-fips.{Region}.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},ul={["url"]:"https://s3.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},Nf={["url"]:"{url#scheme}://{url#authority}{url#path}",["properties"]:c,["headers"]:{}},tl={["url"]:"https://s3.{Region}.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:{}},$f=[{["ref"]:"Region"}],Gg=[{["ref"]:"Endpoint"}],Hg=[X],Df=[N],ls=[Y],t=[C,W],ra=[{["fn"]:"isSet",["argv"]:[{["ref"]:"DisableS3ExpressSessionAuth"}]},{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"DisableS3ExpressSessionAuth"},!0]}],sa=[as],Mf=[ka],yf=[Pa],gr=[$],fa=[{["fn"]:"substring",["argv"]:[X,6,14,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[X,14,16,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],ea=[{["conditions"]:[$],["endpoint"]:{["url"]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.{Region}.amazonaws.com",["properties"]:q,["headers"]:{}},["type"]:"endpoint"},{["endpoint"]:{["url"]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.{Region}.amazonaws.com",["properties"]:q,["headers"]:{}},["type"]:"endpoint"}],la=[{["fn"]:"substring",["argv"]:[X,6,15,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[X,15,17,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],aa=[{["conditions"]:[$],["endpoint"]:{["url"]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.{Region}.amazonaws.com",["properties"]:ms,["headers"]:{}},["type"]:"endpoint"},{["endpoint"]:{["url"]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.{Region}.amazonaws.com",["properties"]:ms,["headers"]:{}},["type"]:"endpoint"}],Kg=[hs],ha=[{["fn"]:"isValidHostLabel",["argv"]:[{["ref"]:"outpostId"},!1]}],ma=[{["fn"]:"stringEquals",["argv"]:[{["ref"]:"regionPrefix"},"beta"]}],Fg=["*"],b=[Ia],ga=[{["fn"]:"isValidHostLabel",["argv"]:[{["ref"]:"Region"},!1]}],x=[{["fn"]:"stringEquals",["argv"]:[{["ref"]:"Region"},"us-east-1"]}],Uf=[{["fn"]:"stringEquals",["argv"]:[Na,"accesspoint"]}],wa=[{["fn"]:"getAttr",["argv"]:[V,"resourceId[1]"],["assign"]:"accessPointName"},{["fn"]:"not",["argv"]:[{["fn"]:"stringEquals",["argv"]:[Hf,""]}]}],Lg=[V,"resourceId[1]"],Tf=[{["fn"]:"not",["argv"]:[{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[V,"region"]},""]}]}],Aa=[{["fn"]:"not",["argv"]:[{["fn"]:"isSet",["argv"]:[{["fn"]:"getAttr",["argv"]:[V,"resourceId[2]"]}]}]}],Wg=[V,"resourceId[2]"],Cf=[{["fn"]:"aws.partition",["argv"]:[{["fn"]:"getAttr",["argv"]:[V,"region"]}],["assign"]:"bucketPartition"}],Sa=[{["fn"]:"stringEquals",["argv"]:[$a,{["fn"]:"getAttr",["argv"]:[{["ref"]:"partitionResult"},"name"]}]}],cf=[{["fn"]:"isValidHostLabel",["argv"]:[{["fn"]:"getAttr",["argv"]:[V,"region"]},!0]}],zf=[{["fn"]:"isValidHostLabel",["argv"]:[Da,!1]}],Ra=[{["fn"]:"isValidHostLabel",["argv"]:[Hf,!1]}],da=[{["fn"]:"isValidHostLabel",["argv"]:[{["ref"]:"Region"},!0]}],Xg={version:"1.0",parameters:{Bucket:hr,Region:hr,UseFIPS:mr,UseDualStack:mr,Endpoint:hr,ForcePathStyle:mr,Accelerate:mr,UseGlobalEndpoint:mr,UseObjectLambdaEndpoint:Gr,Key:hr,Prefix:hr,CopySource:hr,DisableAccessPoints:Gr,DisableMultiRegionAccessPoints:mr,UseArnRegion:Gr,UseS3ExpressControlEndpoint:Gr,DisableS3ExpressSessionAuth:Gr},rules:[{["conditions"]:[{["fn"]:"isSet",["argv"]:$f}],rules:[{["conditions"]:[Y,$],error:"Accelerate cannot be used with FIPS",["type"]:"error"},{["conditions"]:[N,C],error:"Cannot set dual-stack in combination with a custom endpoint.",["type"]:"error"},{["conditions"]:[C,$],error:"A custom endpoint cannot be combined with FIPS",["type"]:"error"},{["conditions"]:[C,Y],error:"A custom endpoint cannot be combined with S3 Accelerate",["type"]:"error"},{["conditions"]:[$,Ia,Tl],error:"Partition does not support FIPS",["type"]:"error"},{["conditions"]:[hs,{["fn"]:"substring",["argv"]:[X,0,6,!0],["assign"]:"bucketSuffix"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"bucketSuffix"},"--x-s3"]}],rules:[{["conditions"]:Df,error:"S3Express does not support Dual-stack.",["type"]:"error"},{["conditions"]:ls,error:"S3Express does not support S3 Accelerate.",["type"]:"error"},{["conditions"]:t,rules:[{["conditions"]:ra,rules:[{["conditions"]:sa,rules:[{["conditions"]:Mf,rules:[{endpoint:{["url"]:"{url#scheme}://{url#authority}/{uri_encoded_bucket}{url#path}",["properties"]:q,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:yf,rules:[{endpoint:{["url"]:"{url#scheme}://{Bucket}.{url#authority}{url#path}",["properties"]:q,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},af],["type"]:"tree"},{["conditions"]:sa,rules:[{["conditions"]:Mf,rules:[{endpoint:{["url"]:"{url#scheme}://{url#authority}/{uri_encoded_bucket}{url#path}",["properties"]:ms,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:yf,rules:[{endpoint:{["url"]:"{url#scheme}://{Bucket}.{url#authority}{url#path}",["properties"]:ms,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},af],["type"]:"tree"},{["conditions"]:[Cl,cl],rules:[{["conditions"]:[ka,A],rules:[{["conditions"]:gr,endpoint:{["url"]:"https://s3express-control-fips.{Region}.amazonaws.com/{uri_encoded_bucket}",["properties"]:q,["headers"]:w},["type"]:"endpoint"},{endpoint:{["url"]:"https://s3express-control.{Region}.amazonaws.com/{uri_encoded_bucket}",["properties"]:q,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:yf,rules:[{["conditions"]:ra,rules:[{["conditions"]:fa,rules:ea,["type"]:"tree"},{["conditions"]:la,rules:ea,["type"]:"tree"},zl],["type"]:"tree"},{["conditions"]:fa,rules:aa,["type"]:"tree"},{["conditions"]:la,rules:aa,["type"]:"tree"},zl],["type"]:"tree"},af],["type"]:"tree"},{["conditions"]:[Gl,Cl,cl],rules:[{["conditions"]:t,endpoint:{["url"]:"{url#scheme}://{url#authority}{url#path}",["properties"]:q,["headers"]:w},["type"]:"endpoint"},{["conditions"]:gr,endpoint:{["url"]:"https://s3express-control-fips.{Region}.amazonaws.com",["properties"]:q,["headers"]:w},["type"]:"endpoint"},{endpoint:{["url"]:"https://s3express-control.{Region}.amazonaws.com",["properties"]:q,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[hs,{["fn"]:"substring",["argv"]:[X,49,50,!0],["assign"]:"hardwareType"},{["fn"]:"substring",["argv"]:[X,8,12,!0],["assign"]:"regionPrefix"},{["fn"]:"substring",["argv"]:[X,0,7,!0],["assign"]:"bucketAliasSuffix"},{["fn"]:"substring",["argv"]:[X,32,49,!0],["assign"]:"outpostId"},{["fn"]:"aws.partition",["argv"]:$f,["assign"]:"regionPartition"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"bucketAliasSuffix"},"--op-s3"]}],rules:[{["conditions"]:ha,rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Hl,"e"]}],rules:[{["conditions"]:ma,rules:[Kl,{["conditions"]:t,endpoint:{["url"]:"https://{Bucket}.ec2.{url#authority}",["properties"]:fs,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},{endpoint:{["url"]:"https://{Bucket}.ec2.s3-outposts.{Region}.{regionPartition#dnsSuffix}",["properties"]:fs,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Hl,"o"]}],rules:[{["conditions"]:ma,rules:[Kl,{["conditions"]:t,endpoint:{["url"]:"https://{Bucket}.op-{outpostId}.{url#authority}",["properties"]:fs,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},{endpoint:{["url"]:"https://{Bucket}.op-{outpostId}.s3-outposts.{Region}.{regionPartition#dnsSuffix}",["properties"]:fs,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},{error:"Unrecognized hardware type: \"Expected hardware type o or e but got {hardwareType}\"",["type"]:"error"}],["type"]:"tree"},{error:"Invalid ARN: The outpost Id must only contain a-z, A-Z, 0-9 and `-`.",["type"]:"error"}],["type"]:"tree"},{["conditions"]:Kg,rules:[{["conditions"]:[C,{["fn"]:"not",["argv"]:[{["fn"]:"isSet",["argv"]:[{["fn"]:"parseURL",["argv"]:Gg}]}]}],error:"Custom endpoint `{Endpoint}` was not a valid URI",["type"]:"error"},{["conditions"]:[hf,Pa],rules:[{["conditions"]:b,rules:[{["conditions"]:ga,rules:[{["conditions"]:[Y,Tl],error:"S3 Accelerate cannot be used in this region",["type"]:"error"},{["conditions"]:[N,$,T,A,z],endpoint:{["url"]:"https://{Bucket}.s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[N,$,T,A,E,K],rules:[{endpoint:Fl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[N,$,T,A,E,F],endpoint:Fl,["type"]:"endpoint"},{["conditions"]:[I,$,T,A,z],endpoint:{["url"]:"https://{Bucket}.s3-fips.us-east-1.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[I,$,T,A,E,K],rules:[{endpoint:Ll,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,$,T,A,E,F],endpoint:Ll,["type"]:"endpoint"},{["conditions"]:[N,R,Y,A,z],endpoint:{["url"]:"https://{Bucket}.s3-accelerate.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[N,R,Y,A,E,K],rules:[{endpoint:Wl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[N,R,Y,A,E,F],endpoint:Wl,["type"]:"endpoint"},{["conditions"]:[N,R,T,A,z],endpoint:{["url"]:"https://{Bucket}.s3.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[N,R,T,A,E,K],rules:[{endpoint:Xl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[N,R,T,A,E,F],endpoint:Xl,["type"]:"endpoint"},{["conditions"]:[I,R,T,C,W,as,z],endpoint:{["url"]:"{url#scheme}://{url#authority}{url#normalizedPath}{Bucket}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[I,R,T,C,W,mf,z],endpoint:{["url"]:"{url#scheme}://{Bucket}.{url#authority}{url#path}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[I,R,T,C,W,as,E,K],rules:[{["conditions"]:x,endpoint:gf,["type"]:"endpoint"},{endpoint:gf,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,R,T,C,W,mf,E,K],rules:[{["conditions"]:x,endpoint:Gf,["type"]:"endpoint"},Zl],["type"]:"tree"},{["conditions"]:[I,R,T,C,W,as,E,F],endpoint:gf,["type"]:"endpoint"},{["conditions"]:[I,R,T,C,W,mf,E,F],endpoint:Gf,["type"]:"endpoint"},{["conditions"]:[I,R,Y,A,z],endpoint:{["url"]:"https://{Bucket}.s3-accelerate.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[I,R,Y,A,E,K],rules:[{["conditions"]:x,endpoint:wf,["type"]:"endpoint"},{endpoint:wf,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,R,Y,A,E,F],endpoint:wf,["type"]:"endpoint"},{["conditions"]:[I,R,T,A,z],endpoint:{["url"]:"https://{Bucket}.s3.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[I,R,T,A,E,K],rules:[{["conditions"]:x,endpoint:{["url"]:"https://{Bucket}.s3.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:w},["type"]:"endpoint"},{endpoint:Ql,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,R,T,A,E,F],endpoint:Ql,["type"]:"endpoint"}],["type"]:"tree"},es],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[C,W,{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[Ea,"scheme"]},"http"]},{["fn"]:"aws.isVirtualHostableS3Bucket",["argv"]:[X,!0]},hf,R,I,T],rules:[{["conditions"]:b,rules:[{["conditions"]:ga,rules:[Zl],["type"]:"tree"},es],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[hf,{["fn"]:"aws.parseArn",["argv"]:Hg,["assign"]:"bucketArn"}],rules:[{["conditions"]:[{["fn"]:"getAttr",["argv"]:[V,"resourceId[0]"],["assign"]:"arnType"},{["fn"]:"not",["argv"]:[{["fn"]:"stringEquals",["argv"]:[Na,""]}]}],rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Af,"s3-object-lambda"]}],rules:[{["conditions"]:Uf,rules:[{["conditions"]:wa,rules:[Vl,vl,{["conditions"]:Tf,rules:[Jl,{["conditions"]:Aa,rules:[Sf,{["conditions"]:Cf,rules:[{["conditions"]:b,rules:[{["conditions"]:Sa,rules:[{["conditions"]:cf,rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Da,""]}],error:"Invalid ARN: Missing account id",["type"]:"error"},{["conditions"]:zf,rules:[{["conditions"]:Ra,rules:[{["conditions"]:t,endpoint:{["url"]:"{url#scheme}://{accessPointName}-{bucketArn#accountId}.{url#authority}{url#path}",["properties"]:Rf,["headers"]:w},["type"]:"endpoint"},{["conditions"]:gr,endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-object-lambda-fips.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:Rf,["headers"]:w},["type"]:"endpoint"},{endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-object-lambda.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:Rf,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},Yl],["type"]:"tree"},df],["type"]:"tree"},If],["type"]:"tree"},Ef],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},Bl],["type"]:"tree"},{error:"Invalid ARN: bucket ARN is missing a region",["type"]:"error"}],["type"]:"tree"},Ol],["type"]:"tree"},{error:"Invalid ARN: Object Lambda ARNs only support `accesspoint` arn types, but found: `{arnType}`",["type"]:"error"}],["type"]:"tree"},{["conditions"]:Uf,rules:[{["conditions"]:wa,rules:[{["conditions"]:Tf,rules:[{["conditions"]:Uf,rules:[{["conditions"]:Tf,rules:[Jl,{["conditions"]:Aa,rules:[Sf,{["conditions"]:Cf,rules:[{["conditions"]:b,rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[$a,"{partitionResult#name}"]}],rules:[{["conditions"]:cf,rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Af,"s3"]}],rules:[{["conditions"]:zf,rules:[{["conditions"]:Ra,rules:[{["conditions"]:ls,error:"Access Points do not support S3 Accelerate",["type"]:"error"},{["conditions"]:[$,N],endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint-fips.dualstack.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:Hr,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[$,I],endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint-fips.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:Hr,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[R,N],endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint.dualstack.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:Hr,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[R,I,C,W],endpoint:{["url"]:"{url#scheme}://{accessPointName}-{bucketArn#accountId}.{url#authority}{url#path}",["properties"]:Hr,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[R,I],endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:Hr,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},Yl],["type"]:"tree"},df],["type"]:"tree"},{error:"Invalid ARN: The ARN was not for the S3 service, found: {bucketArn#service}",["type"]:"error"}],["type"]:"tree"},If],["type"]:"tree"},Ef],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},Bl],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"isValidHostLabel",["argv"]:[Hf,!0]}],rules:[{["conditions"]:Df,error:"S3 MRAP does not support dual-stack",["type"]:"error"},{["conditions"]:gr,error:"S3 MRAP does not support FIPS",["type"]:"error"},{["conditions"]:ls,error:"S3 MRAP does not support S3 Accelerate",["type"]:"error"},{["conditions"]:[{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"DisableMultiRegionAccessPoints"},!0]}],error:"Invalid configuration: Multi-Region Access Point ARNs are disabled.",["type"]:"error"},{["conditions"]:[{["fn"]:"aws.partition",["argv"]:$f,["assign"]:"mrapPartition"}],rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[{["ref"]:"mrapPartition"},"name"]},{["fn"]:"getAttr",["argv"]:[V,"partition"]}]}],rules:[{endpoint:{["url"]:"https://{accessPointName}.accesspoint.s3-global.{mrapPartition#dnsSuffix}",["properties"]:{["authSchemes"]:[{["disableDoubleEncoding"]:!0,name:"sigv4a",["signingName"]:"s3",["signingRegionSet"]:Fg}]},["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},{error:"Client was configured for partition `{mrapPartition#name}` but bucket referred to partition `{bucketArn#partition}`",["type"]:"error"}],["type"]:"tree"}],["type"]:"tree"},{error:"Invalid Access Point Name",["type"]:"error"}],["type"]:"tree"},Ol],["type"]:"tree"},{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Af,"s3-outposts"]}],rules:[{["conditions"]:Df,error:"S3 Outposts does not support Dual-stack",["type"]:"error"},{["conditions"]:gr,error:"S3 Outposts does not support FIPS",["type"]:"error"},{["conditions"]:ls,error:"S3 Outposts does not support S3 Accelerate",["type"]:"error"},{["conditions"]:[{["fn"]:"isSet",["argv"]:[{["fn"]:"getAttr",["argv"]:[V,"resourceId[4]"]}]}],error:"Invalid Arn: Outpost Access Point ARN contains sub resources",["type"]:"error"},{["conditions"]:[{["fn"]:"getAttr",["argv"]:Lg,["assign"]:"outpostId"}],rules:[{["conditions"]:ha,rules:[Sf,{["conditions"]:Cf,rules:[{["conditions"]:b,rules:[{["conditions"]:Sa,rules:[{["conditions"]:cf,rules:[{["conditions"]:zf,rules:[{["conditions"]:[{["fn"]:"getAttr",["argv"]:Wg,["assign"]:"outpostType"}],rules:[{["conditions"]:[{["fn"]:"getAttr",["argv"]:[V,"resourceId[3]"],["assign"]:"accessPointName"}],rules:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[{["ref"]:"outpostType"},"accesspoint"]}],rules:[{["conditions"]:t,endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.{outpostId}.{url#authority}",["properties"]:_l,["headers"]:w},["type"]:"endpoint"},{endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.{outpostId}.s3-outposts.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:_l,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},{error:"Expected an outpost type `accesspoint`, found {outpostType}",["type"]:"error"}],["type"]:"tree"},{error:"Invalid ARN: expected an access point name",["type"]:"error"}],["type"]:"tree"},{error:"Invalid ARN: Expected a 4-component resource",["type"]:"error"}],["type"]:"tree"},df],["type"]:"tree"},If],["type"]:"tree"},Ef],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},{error:"Invalid ARN: The outpost Id may only contain a-z, A-Z, 0-9 and `-`. Found: `{outpostId}`",["type"]:"error"}],["type"]:"tree"},{error:"Invalid ARN: The Outpost Id was not set",["type"]:"error"}],["type"]:"tree"},{error:"Invalid ARN: Unrecognized format: {Bucket} (type: {arnType})",["type"]:"error"}],["type"]:"tree"},{error:"Invalid ARN: No ARN type specified",["type"]:"error"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"substring",["argv"]:[X,0,4,!1],["assign"]:"arnPrefix"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"arnPrefix"},"arn:"]},{["fn"]:"not",["argv"]:[{["fn"]:"isSet",["argv"]:[ql]}]}],error:"Invalid ARN: `{Bucket}` was not a valid ARN",["type"]:"error"},{["conditions"]:[{["fn"]:"booleanEquals",["argv"]:[zg,!0]},ql],error:"Path-style addressing cannot be used with ARN buckets",["type"]:"error"},{["conditions"]:Mf,rules:[{["conditions"]:b,rules:[{["conditions"]:[T],rules:[{["conditions"]:[N,A,$,z],endpoint:{["url"]:"https://s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[N,A,$,E,K],rules:[{endpoint:jl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[N,A,$,E,F],endpoint:jl,["type"]:"endpoint"},{["conditions"]:[I,A,$,z],endpoint:{["url"]:"https://s3-fips.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[I,A,$,E,K],rules:[{endpoint:il,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,A,$,E,F],endpoint:il,["type"]:"endpoint"},{["conditions"]:[N,A,R,z],endpoint:{["url"]:"https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[N,A,R,E,K],rules:[{endpoint:bl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[N,A,R,E,F],endpoint:bl,["type"]:"endpoint"},{["conditions"]:[I,C,W,R,z],endpoint:{["url"]:"{url#scheme}://{url#authority}{url#normalizedPath}{uri_encoded_bucket}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[I,C,W,R,E,K],rules:[{["conditions"]:x,endpoint:kf,["type"]:"endpoint"},{endpoint:kf,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,C,W,R,E,F],endpoint:kf,["type"]:"endpoint"},{["conditions"]:[I,A,R,z],endpoint:{["url"]:"https://s3.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[I,A,R,E,K],rules:[{["conditions"]:x,endpoint:{["url"]:"https://s3.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:c,["headers"]:w},["type"]:"endpoint"},{endpoint:xl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,A,R,E,F],endpoint:xl,["type"]:"endpoint"}],["type"]:"tree"},{error:"Path-style addressing cannot be used with S3 Accelerate",["type"]:"error"}],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"isSet",["argv"]:[ol]},{["fn"]:"booleanEquals",["argv"]:[ol,!0]}],rules:[{["conditions"]:b,rules:[{["conditions"]:da,rules:[Vl,vl,{["conditions"]:t,endpoint:{["url"]:"{url#scheme}://{url#authority}{url#path}",["properties"]:Pf,["headers"]:w},["type"]:"endpoint"},{["conditions"]:gr,endpoint:{["url"]:"https://s3-object-lambda-fips.{Region}.{partitionResult#dnsSuffix}",["properties"]:Pf,["headers"]:w},["type"]:"endpoint"},{endpoint:{["url"]:"https://s3-object-lambda.{Region}.{partitionResult#dnsSuffix}",["properties"]:Pf,["headers"]:w},["type"]:"endpoint"}],["type"]:"tree"},es],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[Gl],rules:[{["conditions"]:b,rules:[{["conditions"]:da,rules:[{["conditions"]:[$,N,A,z],endpoint:{["url"]:"https://s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[$,N,A,E,K],rules:[{endpoint:nl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[$,N,A,E,F],endpoint:nl,["type"]:"endpoint"},{["conditions"]:[$,I,A,z],endpoint:{["url"]:"https://s3-fips.us-east-1.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[$,I,A,E,K],rules:[{endpoint:pl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[$,I,A,E,F],endpoint:pl,["type"]:"endpoint"},{["conditions"]:[R,N,A,z],endpoint:{["url"]:"https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[R,N,A,E,K],rules:[{endpoint:ul,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[R,N,A,E,F],endpoint:ul,["type"]:"endpoint"},{["conditions"]:[R,I,C,W,z],endpoint:{["url"]:"{url#scheme}://{url#authority}{url#path}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[R,I,C,W,E,K],rules:[{["conditions"]:x,endpoint:Nf,["type"]:"endpoint"},{endpoint:Nf,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[R,I,C,W,E,F],endpoint:Nf,["type"]:"endpoint"},{["conditions"]:[R,I,A,z],endpoint:{["url"]:"https://s3.{partitionResult#dnsSuffix}",["properties"]:H,["headers"]:w},["type"]:"endpoint"},{["conditions"]:[R,I,A,E,K],rules:[{["conditions"]:x,endpoint:{["url"]:"https://s3.{partitionResult#dnsSuffix}",["properties"]:c,["headers"]:w},["type"]:"endpoint"},{endpoint:tl,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[R,I,A,E,F],endpoint:tl,["type"]:"endpoint"}],["type"]:"tree"},es],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},{error:"A region must be set when sending requests to S3.",["type"]:"error"}]},Ma=Xg;var gs=(r,s={})=>{return Ua(Ma,{endpointParams:r,logger:s.logger})};ya.aws=Ta;var za=function(r){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"s3",region:r.region},propertiesExtractor:(s,f)=>({signingProperties:{config:s,context:f}})}},Ga=function(r){return{schemeId:"aws.auth#sigv4a",signingProperties:{name:"s3",region:r.region},propertiesExtractor:(s,f)=>({signingProperties:{config:s,context:f}})}},Zg=(r)=>async(s,f,e)=>{if(!e)throw new Error("Could not find \`input\` for \`defaultEndpointRuleSetHttpAuthSchemeParametersProvider\`");const l=await r(s,f,e),a=Kr.getSmithyContext(f)?.commandInstance?.constructor?.getEndpointParameterInstructions;if(!a)throw new Error(`getEndpointParameterInstructions() is not defined on \`${f.commandName}\``);const h=await Ca(e,{getEndpointParameterInstructions:a},s);return Object.assign(l,h)},Qg=async(r,s,f)=>{return{operation:Kr.getSmithyContext(s).operation,region:await Kr.normalizeProvider(r.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()}},ca=Zg(Qg),Vg=(r,s,f)=>{return(l)=>{const h=r(l).properties?.authSchemes;if(!h)return s(l);const m=[];for(let g of h){const{name:S,properties:d={},...k}=g,P=S.toLowerCase();if(S!==P)console.warn(`HttpAuthScheme has been normalized with lowercasing: \`${S}\` to \`${P}\``);let U;if(P==="sigv4a"){U="aws.auth#sigv4a";const Br=h.find((_)=>{const Dr=_.name.toLowerCase();return Dr!=="sigv4a"&&Dr.startsWith("sigv4")});if(!ss.CrtSignerV4&&Br)continue}else if(P.startsWith("sigv4"))U="aws.auth#sigv4";else throw new Error(`Unknown HttpAuthScheme found in \`@smithy.rules#endpointRuleSet\`: \`${P}\``);const D=f[U];if(!D)throw new Error(`Could not find HttpAuthOption create function for \`${U}\``);const Q=D(l);Q.schemeId=U,Q.signingProperties={...Q.signingProperties||{},...k,...d},m.push(Q)}return m}},vg=(r)=>{const s=[];switch(r.operation){default:s.push(za(r)),s.push(Ga(r))}return s},Ha=Vg(gs,vg,{"aws.auth#sigv4":za,"aws.auth#sigv4a":Ga}),Ka=(r)=>{const s=As.resolveAwsSdkSigV4Config(r);return{...As.resolveAwsSdkSigV4AConfig(s)}};var Fa=(r)=>{return{...r,useFipsEndpoint:r.useFipsEndpoint??!1,useDualstackEndpoint:r.useDualstackEndpoint??!1,forcePathStyle:r.forcePathStyle??!1,useAccelerateEndpoint:r.useAccelerateEndpoint??!1,useGlobalEndpoint:r.useGlobalEndpoint??!1,disableMultiregionAccessPoints:r.disableMultiregionAccessPoints??!1,defaultSigningName:"s3"}},wr={ForcePathStyle:{type:"clientContextParams",name:"forcePathStyle"},UseArnRegion:{type:"clientContextParams",name:"useArnRegion"},DisableMultiRegionAccessPoints:{type:"clientContextParams",name:"disableMultiregionAccessPoints"},Accelerate:{type:"clientContextParams",name:"useAccelerateEndpoint"},DisableS3ExpressSessionAuth:{type:"clientContextParams",name:"disableS3ExpressSessionAuth"},UseGlobalEndpoint:{type:"builtInParams",name:"useGlobalEndpoint"},UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};class Z extends La{constructor(r){super(r);Object.setPrototypeOf(this,Z.prototype)}}class Ss extends Z{constructor(r){super({name:"NoSuchUpload",$fault:"client",...r});this.name="NoSuchUpload",this.$fault="client",Object.setPrototypeOf(this,Ss.prototype)}}class Rs extends Z{constructor(r){super({name:"ObjectNotInActiveTierError",$fault:"client",...r});this.name="ObjectNotInActiveTierError",this.$fault="client",Object.setPrototypeOf(this,Rs.prototype)}}class ds extends Z{constructor(r){super({name:"BucketAlreadyExists",$fault:"client",...r});this.name="BucketAlreadyExists",this.$fault="client",Object.setPrototypeOf(this,ds.prototype)}}class Is extends Z{constructor(r){super({name:"BucketAlreadyOwnedByYou",$fault:"client",...r});this.name="BucketAlreadyOwnedByYou",this.$fault="client",Object.setPrototypeOf(this,Is.prototype)}}class Es extends Z{constructor(r){super({name:"NoSuchBucket",$fault:"client",...r});this.name="NoSuchBucket",this.$fault="client",Object.setPrototypeOf(this,Es.prototype)}}var Kf;(function(r){r.visit=(s,f)=>{if(s.Prefix!==void 0)return f.Prefix(s.Prefix);if(s.Tag!==void 0)return f.Tag(s.Tag);if(s.And!==void 0)return f.And(s.And);return f._(s.$unknown[0],s.$unknown[1])}})(Kf||(Kf={}));var Ff;(function(r){r.visit=(s,f)=>{if(s.Prefix!==void 0)return f.Prefix(s.Prefix);if(s.Tag!==void 0)return f.Tag(s.Tag);if(s.ObjectSizeGreaterThan!==void 0)return f.ObjectSizeGreaterThan(s.ObjectSizeGreaterThan);if(s.ObjectSizeLessThan!==void 0)return f.ObjectSizeLessThan(s.ObjectSizeLessThan);if(s.And!==void 0)return f.And(s.And);return f._(s.$unknown[0],s.$unknown[1])}})(Ff||(Ff={}));var Lf;(function(r){r.visit=(s,f)=>{if(s.Prefix!==void 0)return f.Prefix(s.Prefix);if(s.Tag!==void 0)return f.Tag(s.Tag);if(s.AccessPointArn!==void 0)return f.AccessPointArn(s.AccessPointArn);if(s.And!==void 0)return f.And(s.And);return f._(s.$unknown[0],s.$unknown[1])}})(Lf||(Lf={}));var Wf;(function(r){r.visit=(s,f)=>{if(s.Prefix!==void 0)return f.Prefix(s.Prefix);if(s.Tag!==void 0)return f.Tag(s.Tag);if(s.And!==void 0)return f.And(s.And);return f._(s.$unknown[0],s.$unknown[1])}})(Wf||(Wf={}));class ks extends Z{constructor(r){super({name:"InvalidObjectState",$fault:"client",...r});this.name="InvalidObjectState",this.$fault="client",Object.setPrototypeOf(this,ks.prototype),this.StorageClass=r.StorageClass,this.AccessTier=r.AccessTier}}class Ps extends Z{constructor(r){super({name:"NoSuchKey",$fault:"client",...r});this.name="NoSuchKey",this.$fault="client",Object.setPrototypeOf(this,Ps.prototype)}}class Ns extends Z{constructor(r){super({name:"NotFound",$fault:"client",...r});this.name="NotFound",this.$fault="client",Object.setPrototypeOf(this,Ns.prototype)}}var Jg=(r)=>({...r,...r.SecretAccessKey&&{SecretAccessKey:B},...r.SessionToken&&{SessionToken:B}}),Wa=(r)=>({...r,...r.Credentials&&{Credentials:Jg(r.Credentials)}});var Xa=(r)=>({...r,...r.SSEKMSKeyId&&{SSEKMSKeyId:B}}),Za=(r)=>({...r,...r.SSECustomerKey&&{SSECustomerKey:B}});var Rr=M(ws(),1);var Us=M(sf(),1);class $s extends Z{constructor(r){super({name:"ObjectAlreadyInActiveTierError",$fault:"client",...r});this.name="ObjectAlreadyInActiveTierError",this.$fault="client",Object.setPrototypeOf(this,$s.prototype)}}var Qa;(function(r){r.visit=(s,f)=>{if(s.Records!==void 0)return f.Records(s.Records);if(s.Stats!==void 0)return f.Stats(s.Stats);if(s.Progress!==void 0)return f.Progress(s.Progress);if(s.Cont!==void 0)return f.Cont(s.Cont);if(s.End!==void 0)return f.End(s.End);return f._(s.$unknown[0],s.$unknown[1])}})(Qa||(Qa={}));var Va=(r)=>({...r,...r.SSEKMSKeyId&&{SSEKMSKeyId:B},...r.SSEKMSEncryptionContext&&{SSEKMSEncryptionContext:B}}),va=(r)=>({...r,...r.SSECustomerKey&&{SSECustomerKey:B},...r.SSEKMSKeyId&&{SSEKMSKeyId:B},...r.SSEKMSEncryptionContext&&{SSEKMSEncryptionContext:B}});var pa=async(r,s)=>{const f=Us.requestBuilder(r,s),e=G({},j,{[xw]:r[Cw]});f.bp("/"),f.p("Bucket",()=>r.Bucket,"{Bucket}",!1);const l=G({[qw]:[,""]});let a;return f.m("GET").h(e).q(l).b(a),f.build()};var ua=async(r,s)=>{const f=Us.requestBuilder(r,s),e=G({},j,{[Lw]:r[Aw],[Ww]:[()=>j(r[Ja]),()=>Fr(r[Ja]).toString()],[Xw]:r[Sw],[Zw]:[()=>j(r[Ya]),()=>Fr(r[Ya]).toString()],[Vw]:r[kw],[cs]:r[Ts],[Fh]:r[Ih],[zs]:r[Cs],[Gh]:r[dh],[Th]:r[gh],[bw]:r[sw]});f.bp("/{Key+}"),f.p("Bucket",()=>r.Bucket,"{Bucket}",!1),f.p("Key",()=>r.Key,"{Key+}",!0);const l=G({[Xh]:[,"GetObject"],[vw]:[,r[Pw]],[Jw]:[,r[Nw]],[Yw]:[,r[$w]],[Bw]:[,r[Dw]],[Ow]:[,r[Mw]],[_w]:[()=>r.ResponseExpires!==void 0,()=>Fr(r[yw]).toString()],[jw]:[,r[re]],[Qw]:[()=>r.PartNumber!==void 0,()=>r[Ew].toString()]});let a;return f.m("GET").h(e).q(l).b(a),f.build()};var ta=async(r,s)=>{const f=Us.requestBuilder(r,s),e=G({},j,{[Mh]:r[mh]||"application/octet-stream",[iw]:r[ug],[Ph]:r[eh],[Nh]:r[lh],[$h]:r[ah],[Dh]:r[hh],[Of]:[()=>j(r[Jf]),()=>r[Jf].toString()],[Hw]:r[fw],[sA]:r[rw],[se]:r[xf],[fe]:r[of],[ee]:r[nf],[le]:r[pf],[_f]:[()=>j(r[Yf]),()=>Fr(r[Yf]).toString()],[ow]:r[hw],[nw]:r[mw],[pw]:r[gw],[uw]:r[ww],[ae]:r[uf],[Hh]:r[Wr],[Wh]:r[kh],[cs]:r[Ts],[Fh]:r[Ih],[zs]:r[Cs],[he]:r[tf],[Kh]:r[Eh],[Xr]:[()=>j(r[ys]),()=>r[ys].toString()],[Gh]:r[dh],[fA]:r[cw],[ch]:r[Sh],[qf]:[()=>j(r[Bf]),()=>na(r[Bf]).toString()],[Ch]:r[Ah],[Th]:r[gh],...r.Metadata!==void 0&&Object.keys(r.Metadata).reduce((m,g)=>{return m[`x-amz-meta-${g.toLowerCase()}`]=r.Metadata[g],m},{})});f.bp("/{Key+}"),f.p("Bucket",()=>r.Bucket,"{Bucket}",!1),f.p("Key",()=>r.Key,"{Key+}",!0);const l=G({[Xh]:[,"PutObject"]});let a,h;if(r.Body!==void 0)h=r.Body,a=h;return f.m("PUT").h(e).q(l).b(a),f.build()};var rh=async(r,s)=>{if(r.statusCode!==200&&r.statusCode>=300)return bf(r,s);const f=G({$metadata:J(r)}),e=Ar(ba(await Rr.parseXmlBody(r.body,s)),"body");if(e[Qf]!=null)f[Qf]=pg(e[Qf],s);return f};var sh=async(r,s)=>{if(r.statusCode!==200&&r.statusCode>=300)return bf(r,s);const f=G({$metadata:J(r),[lw]:[()=>r.headers[Oa]!==void 0,()=>Ms(r.headers[Oa])],[tg]:[,r.headers[Gw]],[Lr]:[,r.headers[Uh]],[Tw]:[,r.headers[tw]],[Rw]:[()=>r.headers[Ba]!==void 0,()=>Ar(Mr(r.headers[Ba]))],[Jf]:[()=>r.headers[Of]!==void 0,()=>xa(r.headers[Of])],[wh]:[,r.headers[yh]],[xf]:[,r.headers[se]],[of]:[,r.headers[fe]],[nf]:[,r.headers[ee]],[pf]:[,r.headers[le]],[dw]:[()=>r.headers[_a]!==void 0,()=>Ds(r.headers[_a])],[re]:[,r.headers[Lh]],[eh]:[,r.headers[Ph]],[lh]:[,r.headers[Nh]],[ah]:[,r.headers[$h]],[hh]:[,r.headers[Dh]],[ew]:[,r.headers[Kw]],[mh]:[,r.headers[Mh]],[Yf]:[()=>r.headers[_f]!==void 0,()=>Ar(Mr(r.headers[_f]))],[aw]:[,r.headers[Fw]],[kh]:[,r.headers[Wh]],[uf]:[,r.headers[ae]],[Ts]:[,r.headers[cs]],[Cs]:[,r.headers[zs]],[tf]:[,r.headers[he]],[ys]:[()=>r.headers[Xr]!==void 0,()=>Ms(r.headers[Xr])],[Wr]:[,r.headers[Hh]],[Rh]:[,r.headers[zh]],[Uw]:[,r.headers[rA]],[Iw]:[()=>r.headers[qa]!==void 0,()=>Ds(r.headers[qa])],[zw]:[()=>r.headers[ja]!==void 0,()=>Ds(r.headers[ja])],[Sh]:[,r.headers[ch]],[Bf]:[()=>r.headers[qf]!==void 0,()=>Ar(jf(r.headers[qf]))],[Ah]:[,r.headers[Ch]],Metadata:[,Object.keys(r.headers).filter((l)=>l.startsWith("x-amz-meta-")).reduce((l,a)=>{return l[a.substring(11)]=r.headers[a],l},{})]}),e=r.body;return s.sdkStreamMixin(e),f.Body=e,f};var fh=async(r,s)=>{if(r.statusCode!==200&&r.statusCode>=300)return bf(r,s);const f=G({$metadata:J(r),[Lr]:[,r.headers[Uh]],[wh]:[,r.headers[yh]],[xf]:[,r.headers[se]],[of]:[,r.headers[fe]],[nf]:[,r.headers[ee]],[pf]:[,r.headers[le]],[uf]:[,r.headers[ae]],[re]:[,r.headers[Lh]],[Ts]:[,r.headers[cs]],[Cs]:[,r.headers[zs]],[tf]:[,r.headers[he]],[Eh]:[,r.headers[Kh]],[ys]:[()=>r.headers[Xr]!==void 0,()=>Ms(r.headers[Xr])],[Rh]:[,r.headers[zh]]});return await ia(r.body,s),f};var bf=async(r,s)=>{const f={...r,body:await Rr.parseXmlErrorBody(r.body,s)},e=Rr.loadRestXmlErrorCode(r,f.body);switch(e){case"NoSuchUpload":case"com.amazonaws.s3#NoSuchUpload":throw await bg(f,s);case"ObjectNotInActiveTierError":case"com.amazonaws.s3#ObjectNotInActiveTierError":throw await ng(f,s);case"BucketAlreadyExists":case"com.amazonaws.s3#BucketAlreadyExists":throw await Og(f,s);case"BucketAlreadyOwnedByYou":case"com.amazonaws.s3#BucketAlreadyOwnedByYou":throw await _g(f,s);case"NoSuchBucket":case"com.amazonaws.s3#NoSuchBucket":throw await jg(f,s);case"InvalidObjectState":case"com.amazonaws.s3#InvalidObjectState":throw await qg(f,s);case"NoSuchKey":case"com.amazonaws.s3#NoSuchKey":throw await ig(f,s);case"NotFound":case"com.amazonaws.s3#NotFound":throw await xg(f,s);case"ObjectAlreadyInActiveTierError":case"com.amazonaws.s3#ObjectAlreadyInActiveTierError":throw await og(f,s);default:const l=f.body;return Bg({output:r,parsedBody:l,errorCode:e})}},Bg=oa(Z),Og=async(r,s)=>{const f=G({}),e=r.body,l=new ds({$metadata:J(r),...f});return O(l,r.body)},_g=async(r,s)=>{const f=G({}),e=r.body,l=new Is({$metadata:J(r),...f});return O(l,r.body)},qg=async(r,s)=>{const f=G({}),e=r.body;if(e[Zf]!=null)f[Zf]=Sr(e[Zf]);if(e[Wr]!=null)f[Wr]=Sr(e[Wr]);const l=new ks({$metadata:J(r),...f});return O(l,r.body)},jg=async(r,s)=>{const f=G({}),e=r.body,l=new Es({$metadata:J(r),...f});return O(l,r.body)},ig=async(r,s)=>{const f=G({}),e=r.body,l=new Ps({$metadata:J(r),...f});return O(l,r.body)},bg=async(r,s)=>{const f=G({}),e=r.body,l=new Ss({$metadata:J(r),...f});return O(l,r.body)},xg=async(r,s)=>{const f=G({}),e=r.body,l=new Ns({$metadata:J(r),...f});return O(l,r.body)},og=async(r,s)=>{const f=G({}),e=r.body,l=new $s({$metadata:J(r),...f});return O(l,r.body)},ng=async(r,s)=>{const f=G({}),e=r.body,l=new Rs({$metadata:J(r),...f});return O(l,r.body)};var pg=(r,s)=>{const f={};if(r[Xf]!=null)f[Xf]=Sr(r[Xf]);if(r[Vf]!=null)f[Vf]=Sr(r[Vf]);if(r[vf]!=null)f[vf]=Sr(r[vf]);if(r[Lr]!=null)f[Lr]=Ar(jf(r[Lr]));return f};var J=(r)=>({httpStatusCode:r.statusCode,requestId:r.headers["x-amzn-requestid"]??r.headers["x-amzn-request-id"]??r.headers["x-amz-request-id"],extendedRequestId:r.headers["x-amz-id-2"],cfId:r.headers["x-amz-cf-id"]});var j=(r)=>r!==void 0&&r!==null&&r!==""&&(!Object.getOwnPropertyNames(r).includes("length")||r.length!=0)&&(!Object.getOwnPropertyNames(r).includes("size")||r.size!=0);var ug="ACL";var Xf="AccessKeyId";var tg="AcceptRanges";var Zf="AccessTier";var ys="BucketKeyEnabled";var Qf="Credentials",rw="ChecksumAlgorithm";var eh="CacheControl",xf="ChecksumCRC32",of="ChecksumCRC32C",lh="ContentDisposition";var ah="ContentEncoding";var hh="ContentLanguage",Jf="ContentLength",sw="ChecksumMode",fw="ContentMD5";var ew="ContentRange";var nf="ChecksumSHA1",pf="ChecksumSHA256";var mh="ContentType";var lw="DeleteMarker";var Yf="Expires";var gh="ExpectedBucketOwner";var aw="ExpiresString";var wh="ETag";var Lr="Expiration";var hw="GrantFullControl";var mw="GrantRead",gw="GrantReadACP";var ww="GrantWriteACP";var Aw="IfMatch",Ja="IfModifiedSince",Sw="IfNoneMatch";var Ya="IfUnmodifiedSince";var Rw="LastModified";var dw="MissingMeta";var Ah="ObjectLockLegalHoldStatus",Sh="ObjectLockMode";var Bf="ObjectLockRetainUntilDate";var Iw="PartsCount";var Ew="PartNumber";var kw="Range";var Rh="RequestCharged",Pw="ResponseCacheControl",Nw="ResponseContentDisposition",$w="ResponseContentEncoding",Dw="ResponseContentLanguage",Mw="ResponseContentType";var yw="ResponseExpires";var dh="RequestPayer";var Uw="ReplicationStatus";var Tw="Restore";var Vf="SecretAccessKey";var Wr="StorageClass";var Cw="SessionMode";var uf="ServerSideEncryption";var Ts="SSECustomerAlgorithm",Ih="SSECustomerKey",Cs="SSECustomerKeyMD5";var Eh="SSEKMSEncryptionContext",tf="SSEKMSKeyId";var vf="SessionToken";var cw="Tagging";var zw="TagCount";var re="VersionId";var kh="WebsiteRedirectLocation";var Gw="accept-ranges";var Ph="cache-control",Nh="content-disposition",$h="content-encoding",Dh="content-language",Of="content-length",Hw="content-md5",Kw="content-range",Mh="content-type";var _f="expires";var yh="etag",Fw="expiresstring";var Lw="if-match",Ww="if-modified-since";var Xw="if-none-match";var Zw="if-unmodified-since";var Ba="last-modified";var Qw="partNumber";var Vw="range",vw="response-cache-control",Jw="response-content-disposition",Yw="response-content-encoding",Bw="response-content-language",Ow="response-content-type",_w="response-expires";var qw="session";var jw="versionId";var iw="x-amz-acl";var se="x-amz-checksum-crc32",fe="x-amz-checksum-crc32c",bw="x-amz-checksum-mode";var ee="x-amz-checksum-sha1",le="x-amz-checksum-sha256";var xw="x-amz-create-session-mode";var Oa="x-amz-delete-marker",Uh="x-amz-expiration",Th="x-amz-expected-bucket-owner";var ow="x-amz-grant-full-control",nw="x-amz-grant-read",pw="x-amz-grant-read-acp";var uw="x-amz-grant-write-acp";var _a="x-amz-missing-meta";var qa="x-amz-mp-parts-count";var Ch="x-amz-object-lock-legal-hold",ch="x-amz-object-lock-mode",qf="x-amz-object-lock-retain-until-date";var tw="x-amz-restore",zh="x-amz-request-charged";var Gh="x-amz-request-payer";var rA="x-amz-replication-status";var Hh="x-amz-storage-class",sA="x-amz-sdk-checksum-algorithm";var ae="x-amz-server-side-encryption",he="x-amz-server-side-encryption-aws-kms-key-id",Xr="x-amz-server-side-encryption-bucket-key-enabled",Kh="x-amz-server-side-encryption-context",cs="x-amz-server-side-encryption-customer-algorithm",Fh="x-amz-server-side-encryption-customer-key",zs="x-amz-server-side-encryption-customer-key-md5",fA="x-amz-tagging",ja="x-amz-tagging-count";var Lh="x-amz-version-id",Wh="x-amz-website-redirect-location",Xh="x-id";class me extends dr.classBuilder().ep({...wr,DisableS3ExpressSessionAuth:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function(r,s,f,e){return[Ir(f,this.serialize,this.deserialize),Er(f,r.getEndpointParameterInstructions()),rs(f)]}).s("AmazonS3","CreateSession",{}).n("S3Client","CreateSessionCommand").f(void 0,Wa).ser(pa).de(rh).build(){}var Zh={name:"@aws-sdk/client-s3",description:"AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native",version:"3.629.0",scripts:{build:"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-s3","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo s3",test:"yarn test:unit","test:e2e":"yarn test:e2e:node && yarn test:e2e:browser","test:e2e:browser":"ts-mocha test/**/*.browser.ispec.ts && karma start karma.conf.js","test:e2e:node":"jest --c jest.config.e2e.js","test:unit":"ts-mocha test/unit/**/*.spec.ts"},main:"./dist-cjs/index.js",types:"./dist-types/index.d.ts",module:"./dist-es/index.js",sideEffects:!1,dependencies:{"@aws-crypto/sha1-browser":"5.2.0","@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.629.0","@aws-sdk/client-sts":"3.629.0","@aws-sdk/core":"3.629.0","@aws-sdk/credential-provider-node":"3.629.0","@aws-sdk/middleware-bucket-endpoint":"3.620.0","@aws-sdk/middleware-expect-continue":"3.620.0","@aws-sdk/middleware-flexible-checksums":"3.620.0","@aws-sdk/middleware-host-header":"3.620.0","@aws-sdk/middleware-location-constraint":"3.609.0","@aws-sdk/middleware-logger":"3.609.0","@aws-sdk/middleware-recursion-detection":"3.620.0","@aws-sdk/middleware-sdk-s3":"3.629.0","@aws-sdk/middleware-ssec":"3.609.0","@aws-sdk/middleware-user-agent":"3.620.0","@aws-sdk/region-config-resolver":"3.614.0","@aws-sdk/signature-v4-multi-region":"3.629.0","@aws-sdk/types":"3.609.0","@aws-sdk/util-endpoints":"3.614.0","@aws-sdk/util-user-agent-browser":"3.609.0","@aws-sdk/util-user-agent-node":"3.614.0","@aws-sdk/xml-builder":"3.609.0","@smithy/config-resolver":"^3.0.5","@smithy/core":"^2.3.2","@smithy/eventstream-serde-browser":"^3.0.6","@smithy/eventstream-serde-config-resolver":"^3.0.3","@smithy/eventstream-serde-node":"^3.0.5","@smithy/fetch-http-handler":"^3.2.4","@smithy/hash-blob-browser":"^3.1.2","@smithy/hash-node":"^3.0.3","@smithy/hash-stream-node":"^3.1.2","@smithy/invalid-dependency":"^3.0.3","@smithy/md5-js":"^3.0.3","@smithy/middleware-content-length":"^3.0.5","@smithy/middleware-endpoint":"^3.1.0","@smithy/middleware-retry":"^3.0.14","@smithy/middleware-serde":"^3.0.3","@smithy/middleware-stack":"^3.0.3","@smithy/node-config-provider":"^3.1.4","@smithy/node-http-handler":"^3.1.4","@smithy/protocol-http":"^4.1.0","@smithy/smithy-client":"^3.1.12","@smithy/types":"^3.3.0","@smithy/url-parser":"^3.0.3","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.14","@smithy/util-defaults-mode-node":"^3.0.14","@smithy/util-endpoints":"^2.0.5","@smithy/util-middleware":"^3.0.3","@smithy/util-retry":"^3.0.3","@smithy/util-stream":"^3.1.3","@smithy/util-utf8":"^3.0.0","@smithy/util-waiter":"^3.1.2",tslib:"^2.6.2"},devDependencies:{"@aws-sdk/signature-v4-crt":"3.629.0","@tsconfig/node16":"16.1.3","@types/chai":"^4.2.11","@types/mocha":"^8.0.4","@types/node":"^16.18.96",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"3.0.2",typescript:"~4.9.5"},engines:{node:">=16.0.0"},typesVersions:{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["dist-*/**"],author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license:"Apache-2.0",browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-s3",repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-s3"}};var Zs=M(ws(),1);var lA="AWS_S3_USE_ARN_REGION",aA="s3_use_arn_region",Qh={environmentVariableSelector:(r)=>p(r,lA,u.ENV),configFileSelector:(r)=>p(r,aA,u.CONFIG),default:!1};var Vh=M(EA(),1),{__extends:Sd,__assign:Rd,__rest:dd,__decorate:Id,__param:Ed,__esDecorate:kd,__runInitializers:Pd,__propKey:Nd,__setFunctionName:$d,__metadata:Dd,__awaiter:Gs,__generator:Hs,__exportStar:Md,__createBinding:yd,__values:Ks,__read:Ud,__spread:Td,__spreadArrays:Cd,__spreadArray:cd,__await:zd,__asyncGenerator:Gd,__asyncDelegator:Hd,__asyncValues:Kd,__makeTemplateObject:Fd,__importStar:Ld,__importDefault:Wd,__classPrivateFieldGet:Xd,__classPrivateFieldSet:Zd,__classPrivateFieldIn:Qd,__addDisposableResource:Vd,__disposeResources:vd}=Vh.default;import{Buffer as vh} from"buffer";var Jh=(r,s)=>{if(typeof r!=="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof r} (${r})`);return s?vh.from(r,s):vh.from(r)};var ge=(r)=>{const s=Jh(r,"utf8");return new Uint8Array(s.buffer,s.byteOffset,s.byteLength/Uint8Array.BYTES_PER_ELEMENT)};function Zr(r){if(r instanceof Uint8Array)return r;if(typeof r==="string")return kA(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength/Uint8Array.BYTES_PER_ELEMENT);return new Uint8Array(r)}var kA=typeof Buffer!=="undefined"&&Buffer.from?function(r){return Buffer.from(r,"utf8")}:ge;function Qr(r){if(typeof r==="string")return r.length===0;return r.byteLength===0}function Vr(r){return new Uint8Array([(r&4278190080)>>24,(r&16711680)>>16,(r&65280)>>8,r&255])}function vr(r){if(!Uint32Array.from){var s=new Uint32Array(r.length),f=0;while(f<r.length)s[f]=r[f],f+=1;return s}return Uint32Array.from(r)}var we=function(){function r(){this.crc32=new rr}return r.prototype.update=function(s){if(Qr(s))return;this.crc32.update(Zr(s))},r.prototype.digest=function(){return Gs(this,void 0,void 0,function(){return Hs(this,function(s){return[2,Vr(this.crc32.digest())]})})},r.prototype.reset=function(){this.crc32=new rr},r}();var rr=function(){function r(){this.checksum=4294967295}return r.prototype.update=function(s){var f,e;try{for(var l=Ks(s),a=l.next();!a.done;a=l.next()){var h=a.value;this.checksum=this.checksum>>>8^NA[(this.checksum^h)&255]}}catch(m){f={error:m}}finally{try{if(a&&!a.done&&(e=l.return))e.call(l)}finally{if(f)throw f.error}}return this},r.prototype.digest=function(){return(this.checksum^4294967295)>>>0},r}();var PA=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],NA=vr(PA);var o=M(ar(),1);var Bh=M(ar(),1),Yh=function(r){for(let s=0;s<8;s++)r[s]^=255;for(let s=7;s>-1;s--)if(r[s]++,r[s]!==0)break};class kr{constructor(r){if(this.bytes=r,r.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(r){if(r>9223372036854776000||r<-9223372036854776000)throw new Error(`${r} is too large (or, if negative, too small) to represent as an Int64`);const s=new Uint8Array(8);for(let f=7,e=Math.abs(Math.round(r));f>-1&&e>0;f--,e/=256)s[f]=e;if(r<0)Yh(s);return new kr(s)}valueOf(){const r=this.bytes.slice(0),s=r[0]&128;if(s)Yh(r);return parseInt(Bh.toHex(r),16)*(s?-1:1)}toString(){return String(this.valueOf())}}class Ae{constructor(r,s){this.toUtf8=r,this.fromUtf8=s}format(r){const s=[];for(let l of Object.keys(r)){const a=this.fromUtf8(l);s.push(Uint8Array.from([a.byteLength]),a,this.formatHeaderValue(r[l]))}const f=new Uint8Array(s.reduce((l,a)=>l+a.byteLength,0));let e=0;for(let l of s)f.set(l,e),e+=l.byteLength;return f}formatHeaderValue(r){switch(r.type){case"boolean":return Uint8Array.from([r.value?0:1]);case"byte":return Uint8Array.from([2,r.value]);case"short":const s=new DataView(new ArrayBuffer(3));return s.setUint8(0,3),s.setInt16(1,r.value,!1),new Uint8Array(s.buffer);case"integer":const f=new DataView(new ArrayBuffer(5));return f.setUint8(0,4),f.setInt32(1,r.value,!1),new Uint8Array(f.buffer);case"long":const e=new Uint8Array(9);return e[0]=5,e.set(r.value.bytes,1),e;case"binary":const l=new DataView(new ArrayBuffer(3+r.value.byteLength));l.setUint8(0,6),l.setUint16(1,r.value.byteLength,!1);const a=new Uint8Array(l.buffer);return a.set(r.value,3),a;case"string":const h=this.fromUtf8(r.value),m=new DataView(new ArrayBuffer(3+h.byteLength));m.setUint8(0,7),m.setUint16(1,h.byteLength,!1);const g=new Uint8Array(m.buffer);return g.set(h,3),g;case"timestamp":const S=new Uint8Array(9);return S[0]=8,S.set(kr.fromNumber(r.value.valueOf()).bytes,1),S;case"uuid":if(!zA.test(r.value))throw new Error(`Invalid UUID received: ${r.value}`);const d=new Uint8Array(17);return d[0]=9,d.set(o.fromHex(r.value.replace(/\-/g,"")),1),d}}parse(r){const s={};let f=0;while(f<r.byteLength){const e=r.getUint8(f++),l=this.toUtf8(new Uint8Array(r.buffer,r.byteOffset+f,e));switch(f+=e,r.getUint8(f++)){case 0:s[l]={type:_h,value:!0};break;case 1:s[l]={type:_h,value:!1};break;case 2:s[l]={type:$A,value:r.getInt8(f++)};break;case 3:s[l]={type:DA,value:r.getInt16(f,!1)},f+=2;break;case 4:s[l]={type:MA,value:r.getInt32(f,!1)},f+=4;break;case 5:s[l]={type:yA,value:new kr(new Uint8Array(r.buffer,r.byteOffset+f,8))},f+=8;break;case 6:const a=r.getUint16(f,!1);f+=2,s[l]={type:UA,value:new Uint8Array(r.buffer,r.byteOffset+f,a)},f+=a;break;case 7:const h=r.getUint16(f,!1);f+=2,s[l]={type:TA,value:this.toUtf8(new Uint8Array(r.buffer,r.byteOffset+f,h))},f+=h;break;case 8:s[l]={type:CA,value:new Date(new kr(new Uint8Array(r.buffer,r.byteOffset+f,8)).valueOf())},f+=8;break;case 9:const m=new Uint8Array(r.buffer,r.byteOffset+f,16);f+=16,s[l]={type:cA,value:`${o.toHex(m.subarray(0,4))}-${o.toHex(m.subarray(4,6))}-${o.toHex(m.subarray(6,8))}-${o.toHex(m.subarray(8,10))}-${o.toHex(m.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return s}}var Oh;(function(r){r[r.boolTrue=0]="boolTrue",r[r.boolFalse=1]="boolFalse",r[r.byte=2]="byte",r[r.short=3]="short",r[r.integer=4]="integer",r[r.long=5]="long",r[r.byteArray=6]="byteArray",r[r.string=7]="string",r[r.timestamp=8]="timestamp",r[r.uuid=9]="uuid"})(Oh||(Oh={}));var _h="boolean",$A="byte",DA="short",MA="integer",yA="long",UA="binary",TA="string",CA="timestamp",cA="uuid",zA=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;function jh({byteLength:r,byteOffset:s,buffer:f}){if(r<GA)throw new Error("Provided message too short to accommodate event stream message overhead");const e=new DataView(f,s,r),l=e.getUint32(0,!1);if(r!==l)throw new Error("Reported message length does not match received message length");const a=e.getUint32(qh,!1),h=e.getUint32(n,!1),m=e.getUint32(r-sr,!1),g=new rr().update(new Uint8Array(f,s,n));if(h!==g.digest())throw new Error(`The prelude checksum specified in the message (${h}) does not match the calculated CRC32 checksum (${g.digest()})`);if(g.update(new Uint8Array(f,s+n,r-(n+sr))),m!==g.digest())throw new Error(`The message checksum (${g.digest()}) did not match the expected value of ${m}`);return{headers:new DataView(f,s+n+sr,a),body:new Uint8Array(f,s+n+sr+a,l-a-(n+sr+sr))}}var qh=4,n=qh*2,sr=4,GA=n+sr*2;class Se{constructor(r,s){this.headerMarshaller=new Ae(r,s),this.messageBuffer=[],this.isEndOfStream=!1}feed(r){this.messageBuffer.push(this.decode(r))}endOfStream(){this.isEndOfStream=!0}getMessage(){const r=this.messageBuffer.pop(),s=this.isEndOfStream;return{getMessage(){return r},isEndOfStream(){return s}}}getAvailableMessages(){const r=this.messageBuffer;this.messageBuffer=[];const s=this.isEndOfStream;return{getMessages(){return r},isEndOfStream(){return s}}}encode({headers:r,body:s}){const f=this.headerMarshaller.format(r),e=f.byteLength+s.byteLength+16,l=new Uint8Array(e),a=new DataView(l.buffer,l.byteOffset,l.byteLength),h=new rr;return a.setUint32(0,e,!1),a.setUint32(4,f.byteLength,!1),a.setUint32(8,h.update(l.subarray(0,8)).digest(),!1),l.set(f,12),l.set(s,f.byteLength+12),a.setUint32(e-4,h.update(l.subarray(8,e-4)).digest(),!1),l}decode(r){const{headers:s,body:f}=jh(r);return{headers:this.headerMarshaller.parse(s),body:f}}formatHeaders(r){return this.headerMarshaller.format(r)}}class Re{constructor(r){this.options=r}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let r of this.options.inputStream)yield this.options.decoder.decode(r)}}class de{constructor(r){this.options=r}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let r of this.options.messageStream)yield this.options.encoder.encode(r);if(this.options.includeEndFrame)yield new Uint8Array(0)}}class Ie{constructor(r){this.options=r}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let r of this.options.messageStream){const s=await this.options.deserializer(r);if(s===void 0)continue;yield s}}}class Ee{constructor(r){this.options=r}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let r of this.options.inputStream)yield this.options.serializer(r)}}function ih(r){let s=0,f=0,e=null,l=null;const a=(m)=>{if(typeof m!=="number")throw new Error("Attempted to allocate an event message where size was not a number: "+m);s=m,f=4,e=new Uint8Array(m),new DataView(e.buffer).setUint32(0,m,!1)},h=async function*(){const m=r[Symbol.asyncIterator]();while(!0){const{value:g,done:S}=await m.next();if(S){if(!s)return;else if(s===f)yield e;else throw new Error("Truncated event message received.");return}const d=g.length;let k=0;while(k<d){if(!e){const U=d-k;if(!l)l=new Uint8Array(4);const D=Math.min(4-f,U);if(l.set(g.slice(k,k+D),f),f+=D,k+=D,f<4)break;a(new DataView(l.buffer).getUint32(0,!1)),l=null}const P=Math.min(s-f,d-k);if(e.set(g.slice(k,k+P),f),f+=P,k+=P,s&&s===f)yield e,e=null,s=0,f=0}}};return{[Symbol.asyncIterator]:h}}function bh(r,s){return async function(f){const{value:e}=f.headers[":message-type"];if(e==="error"){const l=new Error(f.headers[":error-message"].value||"UnknownError");throw l.name=f.headers[":error-code"].value,l}else if(e==="exception"){const l=f.headers[":exception-type"].value,a={[l]:f},h=await r(a);if(h.$unknown){const m=new Error(s(f.body));throw m.name=l,m}throw h[l]}else if(e==="event"){const l={[f.headers[":event-type"].value]:f},a=await r(l);if(a.$unknown)return;return a}else throw Error(`Unrecognizable event type: ${f.headers[":event-type"].value}`)}}class Fs{constructor({utf8Encoder:r,utf8Decoder:s}){this.eventStreamCodec=new Se(r,s),this.utfEncoder=r}deserialize(r,s){const f=ih(r);return new Ie({messageStream:new Re({inputStream:f,decoder:this.eventStreamCodec}),deserializer:bh(s,this.utfEncoder)})}serialize(r,s){return new de({messageStream:new Ee({inputStream:r,serializer:s}),encoder:this.eventStreamCodec,includeEndFrame:!0})}}import{Readable as HA} from"stream";async function*xh(r){let s=!1,f=!1;const e=new Array;r.on("error",(l)=>{if(!s)s=!0;if(l)throw l}),r.on("data",(l)=>{e.push(l)}),r.on("end",()=>{s=!0});while(!f){const l=await new Promise((a)=>setTimeout(()=>a(e.shift()),0));if(l)yield l;f=s&&e.length===0}}class ke{constructor({utf8Encoder:r,utf8Decoder:s}){this.universalMarshaller=new Fs({utf8Decoder:s,utf8Encoder:r})}deserialize(r,s){const f=typeof r[Symbol.asyncIterator]==="function"?r:xh(r);return this.universalMarshaller.deserialize(f,s)}serialize(r,s){return HA.from(this.universalMarshaller.serialize(r,s))}}var oh=(r)=>new ke(r);import{Writable as KA} from"stream";class Ls extends KA{constructor(r,s){super(s);this.hash=r}_write(r,s,f){try{this.hash.update(v(r))}catch(e){return f(e)}f()}}var nh=(r,s)=>{if(s.readableFlowing!==null)throw new Error("Unable to calculate hash for flowing readable stream");const f=new r,e=new Ls(f);return s.pipe(e),new Promise((l,a)=>{s.on("error",(h)=>{e.end(),a(h)}),e.on("error",a),e.on("finish",()=>{f.digest().then(l).catch(a)})})};var Ws=M(ws(),1);var fm=M(FA(),1);var em=(r)=>{return{apiVersion:"2006-03-01",base64Decoder:r?.base64Decoder??ph,base64Encoder:r?.base64Encoder??th,disableHostPrefix:r?.disableHostPrefix??!1,endpointProvider:r?.endpointProvider??gs,extensions:r?.extensions??[],getAwsChunkedEncodingStream:r?.getAwsChunkedEncodingStream??rm,httpAuthSchemeProvider:r?.httpAuthSchemeProvider??Ha,httpAuthSchemes:r?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(s)=>s.getIdentityProvider("aws.auth#sigv4"),signer:new Ws.AwsSdkSigV4Signer},{schemeId:"aws.auth#sigv4a",identityProvider:(s)=>s.getIdentityProvider("aws.auth#sigv4a"),signer:new Ws.AwsSdkSigV4ASigner}],logger:r?.logger??new Or,sdkStreamMixin:r?.sdkStreamMixin??sm,serviceId:r?.serviceId??"S3",signerConstructor:r?.signerConstructor??lf,signingEscapePath:r?.signingEscapePath??!1,urlParser:r?.urlParser??fm.parseUrl,useArnRegion:r?.useArnRegion??!1,utf8Decoder:r?.utf8Decoder??Cr,utf8Encoder:r?.utf8Encoder??uh}};var $m=(r)=>{mm(process.version);const s=Pm(r),f=()=>s().then(hm),e=em(r);return Zs.emitWarningIfUnsupportedVersion(process.version),{...e,...r,runtime:"node",defaultsMode:s,bodyLengthChecker:r?.bodyLengthChecker??km,credentialDefaultProvider:r?.credentialDefaultProvider??Nm,defaultUserAgentProvider:r?.defaultUserAgentProvider??Em({serviceId:e.serviceId,clientVersion:Zh.version}),disableS3ExpressSessionAuth:r?.disableS3ExpressSessionAuth??i(ts),eventStreamSerdeProvider:r?.eventStreamSerdeProvider??oh,maxAttempts:r?.maxAttempts??i(dm),md5:r?.md5??Xs.bind(null,"md5"),region:r?.region??i(Am,Sm),requestHandler:lm.create(r?.requestHandler??f),retryMode:r?.retryMode??i({...Im,default:async()=>(await f()).retryMode||Rm}),sha1:r?.sha1??Xs.bind(null,"sha1"),sha256:r?.sha256??Xs.bind(null,"sha256"),sigv4aSigningRegionSet:r?.sigv4aSigningRegionSet??i(Zs.NODE_SIGV4A_CONFIG_OPTIONS),streamCollector:r?.streamCollector??am,streamHasher:r?.streamHasher??nh,useArnRegion:r?.useArnRegion??i(Qh),useDualstackEndpoint:r?.useDualstackEndpoint??i(gm),useFipsEndpoint:r?.useFipsEndpoint??i(wm)}};var Dm=(r)=>{const s=r.httpAuthSchemes;let{httpAuthSchemeProvider:f,credentials:e}=r;return{setHttpAuthScheme(l){const a=s.findIndex((h)=>h.schemeId===l.schemeId);if(a===-1)s.push(l);else s.splice(a,1,l)},httpAuthSchemes(){return s},setHttpAuthSchemeProvider(l){f=l},httpAuthSchemeProvider(){return f},setCredentials(l){e=l},credentials(){return e}}},Mm=(r)=>{return{httpAuthSchemes:r.httpAuthSchemes(),httpAuthSchemeProvider:r.httpAuthSchemeProvider(),credentials:r.credentials()}};var Qs=(r)=>r,Gm=(r,s)=>{const f={...Qs(cm(r)),...Qs(Tm(r)),...Qs(ym(r)),...Qs(Dm(r))};return s.forEach((e)=>e.configure(f)),{...r,...zm(f),...Cm(f),...Um(f),...Mm(f)}};class Pe extends Wm{constructor(...[r]){const s=$m(r||{}),f=Fa(s),e=Xm(f),l=Jm(e),a=Qm(l),h=Hm(a),m=vm(h),g=Ul(m),S=Ka(g),d=Pl(S,{session:[()=>this,me]}),k=Gm(d,r?.extensions||[]);super(k);this.config=k,this.middlewareStack.use(Zm(this.config)),this.middlewareStack.use(Ym(this.config)),this.middlewareStack.use(Vm(this.config)),this.middlewareStack.use(Km(this.config)),this.middlewareStack.use(Fm(this.config)),this.middlewareStack.use(Lm(this.config)),this.middlewareStack.use(Pr.getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:ca,identityProviderConfigProvider:async(P)=>new Pr.DefaultIdentityProviderConfig({"aws.auth#sigv4":P.credentials,"aws.auth#sigv4a":P.credentials})})),this.middlewareStack.use(Pr.getHttpSigningPlugin(this.config)),this.middlewareStack.use(yl(this.config)),this.middlewareStack.use(Ce(this.config)),this.middlewareStack.use(He(this.config)),this.middlewareStack.use(rf(this.config)),this.middlewareStack.use(ff(this.config))}destroy(){super.destroy()}}function LA(r){return(s)=>async(f)=>{const e={...f.input},l=[{target:"SSECustomerKey",hash:"SSECustomerKeyMD5"},{target:"CopySourceSSECustomerKey",hash:"CopySourceSSECustomerKeyMD5"}];for(let a of l){const h=e[a.target];if(h){let m;if(typeof h==="string")if(XA(h,r))m=r.base64Decoder(h);else m=r.utf8Decoder(h),e[a.target]=r.base64Encoder(m);else m=ArrayBuffer.isView(h)?new Uint8Array(h.buffer,h.byteOffset,h.byteLength):new Uint8Array(h),e[a.target]=r.base64Encoder(m);const g=new r.md5;g.update(m),e[a.hash]=r.base64Encoder(await g.digest())}}return s({...f,input:e})}}function XA(r,s){if(!/^(?:[A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(r))return!1;try{return s.base64Decoder(r).length===32}catch{return!1}}var WA={name:"ssecMiddleware",step:"initialize",tags:["SSE"],override:!0},Vs=(r)=>({applyToStack:(s)=>{s.add(LA(r),WA)}});var y;(function(r){r.MD5="MD5",r.CRC32="CRC32",r.CRC32C="CRC32C",r.SHA1="SHA1",r.SHA256="SHA256"})(y||(y={}));var Bm;(function(r){r.HEADER="header",r.TRAILER="trailer"})(Bm||(Bm={}));var{MD5:Om,CRC32:_m}=y;var Jr=[y.CRC32,y.CRC32C,y.SHA1,y.SHA256],qm=[y.CRC32,y.CRC32C,y.SHA1,y.SHA256];var jm=(r,{requestChecksumRequired:s,requestAlgorithmMember:f},e)=>{const l=e?_m:Om;if(!f||!r[f])return s?l:void 0;const a=r[f];if(!Jr.includes(a))throw new Error(`The checksum algorithm "${a}" is not supported by the client.`+` Select one of ${Jr}.`);return a};var Nr=(r)=>r===y.MD5?"content-md5":`x-amz-checksum-${r.toLowerCase()}`;var im=(r,s)=>{const f=r.toLowerCase();for(let e of Object.keys(s))if(f===e.toLowerCase())return!0;return!1};var $r=(r)=>r!==void 0&&typeof r!=="string"&&!ArrayBuffer.isView(r)&&!xr(r);var $e=function(){function r(){this.crc32c=new Ne}return r.prototype.update=function(s){if(Qr(s))return;this.crc32c.update(Zr(s))},r.prototype.digest=function(){return Gs(this,void 0,void 0,function(){return Hs(this,function(s){return[2,Vr(this.crc32c.digest())]})})},r.prototype.reset=function(){this.crc32c=new Ne},r}();var Ne=function(){function r(){this.checksum=4294967295}return r.prototype.update=function(s){var f,e;try{for(var l=Ks(s),a=l.next();!a.done;a=l.next()){var h=a.value;this.checksum=this.checksum>>>8^QA[(this.checksum^h)&255]}}catch(m){f={error:m}}finally{try{if(a&&!a.done&&(e=l.return))e.call(l)}finally{if(f)throw f.error}}return this},r.prototype.digest=function(){return(this.checksum^4294967295)>>>0},r}();var ZA=[0,4067132163,3778769143,324072436,3348797215,904991772,648144872,3570033899,2329499855,2024987596,1809983544,2575936315,1296289744,3207089363,2893594407,1578318884,274646895,3795141740,4049975192,51262619,3619967088,632279923,922689671,3298075524,2592579488,1760304291,2075979607,2312596564,1562183871,2943781820,3156637768,1313733451,549293790,3537243613,3246849577,871202090,3878099393,357341890,102525238,4101499445,2858735121,1477399826,1264559846,3107202533,1845379342,2677391885,2361733625,2125378298,820201905,3263744690,3520608582,598981189,4151959214,85089709,373468761,3827903834,3124367742,1213305469,1526817161,2842354314,2107672161,2412447074,2627466902,1861252501,1098587580,3004210879,2688576843,1378610760,2262928035,1955203488,1742404180,2511436119,3416409459,969524848,714683780,3639785095,205050476,4266873199,3976438427,526918040,1361435347,2739821008,2954799652,1114974503,2529119692,1691668175,2005155131,2247081528,3690758684,697762079,986182379,3366744552,476452099,3993867776,4250756596,255256311,1640403810,2477592673,2164122517,1922457750,2791048317,1412925310,1197962378,3037525897,3944729517,427051182,170179418,4165941337,746937522,3740196785,3451792453,1070968646,1905808397,2213795598,2426610938,1657317369,3053634322,1147748369,1463399397,2773627110,4215344322,153784257,444234805,3893493558,1021025245,3467647198,3722505002,797665321,2197175160,1889384571,1674398607,2443626636,1164749927,3070701412,2757221520,1446797203,137323447,4198817972,3910406976,461344835,3484808360,1037989803,781091935,3705997148,2460548119,1623424788,1939049696,2180517859,1429367560,2807687179,3020495871,1180866812,410100952,3927582683,4182430767,186734380,3756733383,763408580,1053836080,3434856499,2722870694,1344288421,1131464017,2971354706,1708204729,2545590714,2229949006,1988219213,680717673,3673779818,3383336350,1002577565,4010310262,493091189,238226049,4233660802,2987750089,1082061258,1395524158,2705686845,1972364758,2279892693,2494862625,1725896226,952904198,3399985413,3656866545,731699698,4283874585,222117402,510512622,3959836397,3280807620,837199303,582374963,3504198960,68661723,4135334616,3844915500,390545967,1230274059,3141532936,2825850620,1510247935,2395924756,2091215383,1878366691,2644384480,3553878443,565732008,854102364,3229815391,340358836,3861050807,4117890627,119113024,1493875044,2875275879,3090270611,1247431312,2660249211,1828433272,2141937292,2378227087,3811616794,291187481,34330861,4032846830,615137029,3603020806,3314634738,939183345,1776939221,2609017814,2295496738,2058945313,2926798794,1545135305,1330124605,3173225534,4084100981,17165430,307568514,3762199681,888469610,3332340585,3587147933,665062302,2042050490,2346497209,2559330125,1793573966,3190661285,1279665062,1595330642,2910671697],QA=vr(ZA);var vs=(r,s)=>({[y.MD5]:s.md5,[y.CRC32]:we,[y.CRC32C]:$e,[y.SHA1]:s.sha1,[y.SHA256]:s.sha256})[r];var Js=(r,s)=>{const f=new r;return f.update(v(s||"")),f.digest()};var bm={name:"flexibleChecksumsMiddleware",step:"build",tags:["BODY_CHECKSUM"],override:!0},xm=(r,s)=>(f,e)=>async(l)=>{if(!L.isInstance(l.request))return f(l);const{request:a}=l,{body:h,headers:m}=a,{base64Encoder:g,streamHasher:S}=r,{input:d,requestChecksumRequired:k,requestAlgorithmMember:P}=s,U=jm(d,{requestChecksumRequired:k,requestAlgorithmMember:P},!!e.isS3ExpressBucket);let D=h,Q=m;if(U){const _=Nr(U),Dr=vs(U,r);if($r(h)){const{getAwsChunkedEncodingStream:Os,bodyLengthChecker:fg}=r;D=Os(h,{base64Encoder:g,bodyLengthChecker:fg,checksumLocationName:_,checksumAlgorithmFn:Dr,streamHasher:S}),Q={...m,"content-encoding":m["content-encoding"]?`${m["content-encoding"]},aws-chunked`:"aws-chunked","transfer-encoding":"chunked","x-amz-decoded-content-length":m["content-length"],"x-amz-content-sha256":"STREAMING-UNSIGNED-PAYLOAD-TRAILER","x-amz-trailer":_},delete Q["content-length"]}else if(!im(_,m)){const Os=await Js(Dr,h);Q={...m,[_]:g(Os)}}}return await f({...l,request:{...a,headers:Q,body:D}})};var Ys=(r=[])=>{const s=[];for(let f of qm){if(!r.includes(f)||!Jr.includes(f))continue;s.push(f)}return s};var om=(r)=>{const s=r.lastIndexOf("-");if(s!==-1){const f=r.slice(s+1);if(!f.startsWith("0")){const e=parseInt(f,10);if(!isNaN(e)&&e>=1&&e<=1e4)return!0}}return!1};import{Transform as VA} from"stream";function De(r){const s=new VA;return s.push(r),s.push(null),s}var nm=async(r,{streamHasher:s,checksumAlgorithmFn:f,base64Encoder:e})=>{const l=$r(r)?s(f,r):Js(f,r);return e(await l)};var pm=async(r,{config:s,responseAlgorithms:f})=>{const e=Ys(f),{body:l,headers:a}=r;for(let h of e){const m=Nr(h),g=a[m];if(g){const S=vs(h,s),{streamHasher:d,base64Encoder:k}=s,P=await nm(l,{streamHasher:d,checksumAlgorithmFn:S,base64Encoder:k});if(P===g)break;throw new Error(`Checksum mismatch: expected "${P}" but received "${g}"`+` in response header "${m}".`)}}};var um={name:"flexibleChecksumsResponseMiddleware",toMiddleware:"deserializerMiddleware",relation:"after",tags:["BODY_CHECKSUM"],override:!0},tm=(r,s)=>(f,e)=>async(l)=>{if(!L.isInstance(l.request))return f(l);const a=l.input,h=await f(l),m=h.response;let g=void 0;const{requestValidationModeMember:S,responseAlgorithms:d}=s;if(S&&a[S]==="ENABLED"){const{clientName:k,commandName:P}=e;if(k==="S3Client"&&P==="GetObjectCommand"&&Ys(d).every((Q)=>{const Br=Nr(Q),_=m.headers[Br];return!_||om(_)}))return h;const D=$r(m.body);if(D)g=await r.streamCollector(m.body),m.body=De(g);if(await pm(h.response,{config:r,responseAlgorithms:d}),D&&g)m.body=De(g)}return h};var Bs=(r,s)=>({applyToStack:(f)=>{f.add(xm(r,s),bm),f.addRelativeTo(tm(r,s),um)}});class Me extends dr.classBuilder().ep({...wr,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(r,s,f,e){return[Ir(f,this.serialize,this.deserialize),Er(f,r.getEndpointParameterInstructions()),Bs(f,{input:this.input,requestChecksumRequired:!1,requestValidationModeMember:"ChecksumMode",responseAlgorithms:["CRC32","CRC32C","SHA256","SHA1"]}),Vs(f),Ke(f)]}).s("AmazonS3","GetObject",{}).n("S3Client","GetObjectCommand").f(Za,Xa).ser(ua).de(sh).build(){}class ye extends dr.classBuilder().ep({...wr,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(r,s,f,e){return[Ir(f,this.serialize,this.deserialize),Er(f,r.getEndpointParameterInstructions()),Bs(f,{input:this.input,requestAlgorithmMember:"ChecksumAlgorithm",requestChecksumRequired:!1}),ce(f),rs(f),Vs(f)]}).s("AmazonS3","PutObject",{}).n("S3Client","PutObjectCommand").f(va,Va).ser(ta).de(fh).build(){}var sg=M(vA(),1);import{Buffer as Ue} from"buffer";var rg=new Pe;class Yr{static folder(r){if(!r||r.includes("null")||r.includes("undefined"))throw new Error("Folder path has to be specified.");return{put:async(s)=>{let f;if(s instanceof Blob)return f=`${Te()}.${s.type.split("/")[1]}`,Yr.put({body:s,name:`${r}/${f}`});return Yr.put({...s,name:`${r}/${f}`})},fetch:async(s)=>{let f=process.env.BUCKET_NAME,e;if(typeof s==="string")e=s;else f=s.bucket??f,e=s.name;if(!e)throw new Error("Object name has to be specified");return Yr.fetch({...s,name:`${r}/${e}`})}}}static async put(r){let s,f,e,l=process.env.BUCKET_NAME;if(r instanceof Blob)s=r,e=`${Te()}.${r.type.split("/")[1]}`,f=r.type;else s=r.body,e=r.name,f=r.contentType;f=s instanceof Blob||s instanceof File?s.type:void 0;const a=s instanceof Ue?s:Ue.from(await s.arrayBuffer());return await rg.send(new ye({Bucket:l,Key:e,Body:a,ContentType:f})),e}static async metadata(r){const s=Ue.from(await r.arrayBuffer());try{return await sg.default(s).metadata()}catch{return{}}}static async fetch(r){let s=process.env.BUCKET_NAME,f;if(typeof r==="string")f=r;else s=r.bucket??s,f=r.name;if(!f)throw new Error("Object name has to be specified");const e=await rg.send(new Me({Bucket:s,Key:f}));return new Response(e.Body.transformToWebStream(),{headers:{"Content-Type":e.ContentType,"Content-Length":e.ContentLength.toString(),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":e.LastModified?.toUTCString()||"",ETag:e.ETag||""}})}static delete(){}}export{Yr as Storage};
|