gemi 0.45.0 → 0.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/app/index.js +1 -1
  2. package/dist/bin/gemi.js +185 -49
  3. package/dist/bin/gemi.js.map +10 -7
  4. package/dist/{chunk-tvp3xgfq.js → chunk-3ervqphj.js} +2 -2
  5. package/dist/{chunk-tvp3xgfq.js.map → chunk-3ervqphj.js.map} +1 -1
  6. package/dist/{chunk-v0qh5dqv.js → chunk-5hggqap1.js} +15 -15
  7. package/dist/{chunk-v0qh5dqv.js.map → chunk-5hggqap1.js.map} +3 -3
  8. package/dist/chunk-d9k245jt.js +79 -0
  9. package/dist/{chunk-jxpwexpz.js.map → chunk-d9k245jt.js.map} +8 -5
  10. package/dist/chunk-evkv0xa7.js +4 -0
  11. package/dist/{chunk-atv6nybp.js.map → chunk-evkv0xa7.js.map} +4 -4
  12. package/dist/{chunk-396qq8ge.js → chunk-qmsngk2y.js} +1 -1
  13. package/dist/{chunk-ppn0j67g.js → chunk-r64ba1pf.js} +1 -1
  14. package/dist/{chunk-63gmzy5r.js → chunk-zp9ybbp6.js} +1 -1
  15. package/dist/client/ClientRouter.d.ts.map +1 -1
  16. package/dist/client/Head.d.ts.map +1 -1
  17. package/dist/client/QueryManagerContext.d.ts +5 -2
  18. package/dist/client/QueryManagerContext.d.ts.map +1 -1
  19. package/dist/client/QueryResource.d.ts +23 -1
  20. package/dist/client/QueryResource.d.ts.map +1 -1
  21. package/dist/client/helpers/mergeCarriedSegments.d.ts +23 -0
  22. package/dist/client/helpers/mergeCarriedSegments.d.ts.map +1 -0
  23. package/dist/client/index.js +173 -27
  24. package/dist/client/index.js.map +1 -1
  25. package/dist/client/useQuery.d.ts +2 -0
  26. package/dist/client/useQuery.d.ts.map +1 -1
  27. package/dist/facades/index.js +1 -1
  28. package/dist/http/Metadata.d.ts +6 -0
  29. package/dist/http/Metadata.d.ts.map +1 -1
  30. package/dist/http/ViewRouter.d.ts +12 -0
  31. package/dist/http/ViewRouter.d.ts.map +1 -1
  32. package/dist/http/index.js +1 -1
  33. package/dist/i18n/index.js +1 -1
  34. package/dist/kernel/index.js +1 -1
  35. package/dist/server/index.js +1 -1
  36. package/dist/services/index.js +1 -1
  37. package/dist/services/router/ViewRouterServiceContainer.d.ts.map +1 -1
  38. package/dist/services/router/ViewRouterServiceProvider.d.ts +10 -0
  39. package/dist/services/router/ViewRouterServiceProvider.d.ts.map +1 -1
  40. package/dist/services/router/createFlatViewRoutes.d.ts +16 -0
  41. package/dist/services/router/createFlatViewRoutes.d.ts.map +1 -1
  42. package/dist/services/router/matchViewRoute.d.ts +12 -0
  43. package/dist/services/router/matchViewRoute.d.ts.map +1 -0
  44. package/dist/services/router/planPartialRender.d.ts +43 -0
  45. package/dist/services/router/planPartialRender.d.ts.map +1 -0
  46. package/dist/utils/partialRender.d.ts +28 -0
  47. package/dist/utils/partialRender.d.ts.map +1 -0
  48. package/package.json +1 -1
  49. package/dist/chunk-atv6nybp.js +0 -4
  50. package/dist/chunk-jxpwexpz.js +0 -79
  51. /package/dist/{chunk-396qq8ge.js.map → chunk-qmsngk2y.js.map} +0 -0
  52. /package/dist/{chunk-ppn0j67g.js.map → chunk-r64ba1pf.js.map} +0 -0
  53. /package/dist/{chunk-63gmzy5r.js.map → chunk-zp9ybbp6.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import{Ra as g6,Sa as f6,Xa as b6}from"./chunk-a3bmbfn3.js";import{$a as Ux,Ya as n4,Za as f4,_a as H0,ab as Mx,bb as Lx,cb as T4,db as $h,eb as zh,fb as Wx,gb as Ex,hb as $B,ib as Ox,jb as J0,kb as zB,lb as hx,mb as xx,nb as Hx,ob as Sx,pb as Xx,qb as Rx}from"./chunk-27tkdqp6.js";import{rb as Kx}from"./chunk-7bggj8g7.js";import{Db as R2,sb as BD,tb as Qx,vb as Yx,wb as r6,xb as ou,zb as R6}from"./chunk-jrnbyhgq.js";import{Eb as g2}from"./chunk-wtydwxgg.js";import{Fb as LK,Hb as uD}from"./chunk-1nkxmecw.js";import{Ib as vx}from"./chunk-cmnhs4mh.js";import{Jb as sh}from"./chunk-snp18f2m.js";import{Mb as I6}from"./chunk-2cew23ww.js";import{Nb as EK}from"./chunk-wjhh4pf0.js";import{Ob as TW}from"./chunk-xkrthw08.js";import{Qb as wu,Rb as pD,Sb as Uu,Zb as d2,_b as Z2,bc as JK,cc as f}from"./chunk-4z53shav.js";import{dc as mB,ec as WK}from"./chunk-m0earq80.js";import{fc as Y,gc as z,ic as f2}from"./chunk-f18weffa.js";var u3=z((pB)=>{Object.defineProperty(pB,"__esModule",{value:!0});pB.ApplicationInSerializer=void 0;pB.ApplicationInSerializer={_fromJsonObject(u){return{metadata:u.metadata,name:u.name,rateLimit:u.rateLimit,throttleRate:u.throttleRate,uid:u.uid}},_toJsonObject(u){return{metadata:u.metadata,name:u.name,rateLimit:u.rateLimit,throttleRate:u.throttleRate,uid:u.uid}}}});var F8=z((sB)=>{Object.defineProperty(sB,"__esModule",{value:!0});sB.ApplicationOutSerializer=void 0;sB.ApplicationOutSerializer={_fromJsonObject(u){return{createdAt:new Date(u.createdAt),id:u.id,metadata:u.metadata,name:u.name,rateLimit:u.rateLimit,throttleRate:u.throttleRate,uid:u.uid,updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){return{createdAt:u.createdAt,id:u.id,metadata:u.metadata,name:u.name,rateLimit:u.rateLimit,throttleRate:u.throttleRate,uid:u.uid,updatedAt:u.updatedAt}}}});var uA=z((oB)=>{Object.defineProperty(oB,"__esModule",{value:!0});oB.ApplicationPatchSerializer=void 0;oB.ApplicationPatchSerializer={_fromJsonObject(u){return{metadata:u.metadata,name:u.name,rateLimit:u.rateLimit,uid:u.uid}},_toJsonObject(u){return{metadata:u.metadata,name:u.name,rateLimit:u.rateLimit,uid:u.uid}}}});var FA=z((BA)=>{Object.defineProperty(BA,"__esModule",{value:!0});BA.ListResponseApplicationOutSerializer=void 0;var DA=F8();BA.ListResponseApplicationOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>DA.ApplicationOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>DA.ApplicationOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var w8=z((GA)=>{Object.defineProperty(GA,"__esModule",{value:!0});GA.ApiException=void 0;class wA extends Error{constructor(u,D,B){super(`HTTP-Code: ${u}
3
- Headers: ${JSON.stringify(B)}`);this.code=u,this.body=D,this.headers={},B.forEach((A,F)=>{this.headers[F]=A})}}GA.ApiException=wA});var _=z((L2)=>{var Eu=L2&&L2.__awaiter||function(u,D,B,A){function F(w){return w instanceof B?w:new B(function(G){G(w)})}return new(B||(B=Promise))(function(w,G){function N(v){try{Z(A.next(v))}catch(J){G(J)}}function $(v){try{Z(A.throw(v))}catch(J){G(J)}}function Z(v){v.done?w(v.value):F(v.value).then(N,$)}Z((A=A.apply(u,D||[])).next())})};Object.defineProperty(L2,"__esModule",{value:!0});L2.SvixRequest=L2.HttpMethod=L2.LIB_VERSION=void 0;var G8=w8();L2.LIB_VERSION="1.92.2";var tx=`svix-libs/${L2.LIB_VERSION}/javascript`,ox;(function(u){u.GET="GET",u.HEAD="HEAD",u.POST="POST",u.PUT="PUT",u.DELETE="DELETE",u.CONNECT="CONNECT",u.OPTIONS="OPTIONS",u.TRACE="TRACE",u.PATCH="PATCH"})(ox=L2.HttpMethod||(L2.HttpMethod={}));class $A{constructor(u,D){this.method=u,this.path=D,this.queryParams={},this.headerParams={}}setPathParam(u,D){let B=this.path.replace(`{${u}}`,encodeURIComponent(D));if(this.path===B)throw Error(`path parameter ${u} not found`);this.path=B}setQueryParams(u){for(let[D,B]of Object.entries(u))this.setQueryParam(D,B)}setQueryParam(u,D){if(D===void 0||D===null)return;if(typeof D==="string")this.queryParams[u]=D;else if(typeof D==="boolean"||typeof D==="number")this.queryParams[u]=D.toString();else if(D instanceof Date)this.queryParams[u]=D.toISOString();else if(Array.isArray(D)){if(D.length>0)this.queryParams[u]=D.join(",")}else{let B=D;throw Error(`query parameter ${u} has unsupported type`)}}setHeaderParam(u,D){if(D===void 0)return;this.headerParams[u]=D}setBody(u){this.body=JSON.stringify(u)}send(u,D){return Eu(this,void 0,void 0,function*(){let B=yield this.sendInner(u);if(B.status===204)return null;let A=yield B.text();return D(JSON.parse(A))})}sendNoResponseBody(u){return Eu(this,void 0,void 0,function*(){yield this.sendInner(u)})}sendInner(u){var D,B;return Eu(this,void 0,void 0,function*(){let A=new URL(u.baseUrl+this.path);for(let[N,$]of Object.entries(this.queryParams))A.searchParams.set(N,$);if(this.headerParams["idempotency-key"]===void 0&&this.method.toUpperCase()==="POST")this.headerParams["idempotency-key"]=`auto_${crypto.randomUUID()}`;let F=Math.floor(Math.random()*Number.MAX_SAFE_INTEGER);if(this.body!=null)this.headerParams["content-type"]="application/json";let w="credentials"in Request.prototype,G=yield zA(A,{method:this.method.toString(),body:this.body,headers:Object.assign({accept:"application/json, */*;q=0.8",authorization:`Bearer ${u.token}`,"user-agent":tx,"svix-req-id":F.toString()},this.headerParams),credentials:w?"same-origin":void 0,signal:u.timeout!==void 0?AbortSignal.timeout(u.timeout):void 0},u.retryScheduleInMs,(D=u.retryScheduleInMs)===null||D===void 0?void 0:D[0],((B=u.retryScheduleInMs)===null||B===void 0?void 0:B.length)||u.numRetries,u.fetch);return ex(G)})}}L2.SvixRequest=$A;function ex(u){return Eu(this,void 0,void 0,function*(){if(u.status<300)return u;let D=yield u.text();if(u.status===422)throw new G8.ApiException(u.status,JSON.parse(D),u.headers);if(u.status>=400&&u.status<=499)throw new G8.ApiException(u.status,JSON.parse(D),u.headers);throw new G8.ApiException(u.status,D,u.headers)})}function zA(u,D,B,A=50,F=2,w=fetch,G=1){return Eu(this,void 0,void 0,function*(){let N=($)=>new Promise((Z)=>setTimeout(Z,$));try{let $=yield w(u,D);if(F<=0||$.status<500)return $}catch($){if(F<=0)throw $}return yield N(A),D.headers["svix-retry-count"]=G.toString(),A=(B===null||B===void 0?void 0:B[G])||A*2,yield zA(u,D,B,A,--F,w,++G)})}});var vA=z((JA)=>{Object.defineProperty(JA,"__esModule",{value:!0});JA.Application=void 0;var N8=u3(),Ou=F8(),uH=uA(),DH=FA(),Q2=_();class ZA{constructor(u){this.requestCtx=u}list(u){let D=new Q2.SvixRequest(Q2.HttpMethod.GET,"/api/v1/app");return D.setQueryParams({exclude_apps_with_no_endpoints:u===null||u===void 0?void 0:u.excludeAppsWithNoEndpoints,exclude_apps_with_disabled_endpoints:u===null||u===void 0?void 0:u.excludeAppsWithDisabledEndpoints,exclude_apps_with_svix_play_endpoints:u===null||u===void 0?void 0:u.excludeAppsWithSvixPlayEndpoints,limit:u===null||u===void 0?void 0:u.limit,iterator:u===null||u===void 0?void 0:u.iterator,order:u===null||u===void 0?void 0:u.order}),D.send(this.requestCtx,DH.ListResponseApplicationOutSerializer._fromJsonObject)}create(u,D){let B=new Q2.SvixRequest(Q2.HttpMethod.POST,"/api/v1/app");return B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.setBody(N8.ApplicationInSerializer._toJsonObject(u)),B.send(this.requestCtx,Ou.ApplicationOutSerializer._fromJsonObject)}getOrCreate(u,D){let B=new Q2.SvixRequest(Q2.HttpMethod.POST,"/api/v1/app");return B.setQueryParam("get_if_exists",!0),B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.setBody(N8.ApplicationInSerializer._toJsonObject(u)),B.send(this.requestCtx,Ou.ApplicationOutSerializer._fromJsonObject)}get(u){let D=new Q2.SvixRequest(Q2.HttpMethod.GET,"/api/v1/app/{app_id}");return D.setPathParam("app_id",u),D.send(this.requestCtx,Ou.ApplicationOutSerializer._fromJsonObject)}update(u,D){let B=new Q2.SvixRequest(Q2.HttpMethod.PUT,"/api/v1/app/{app_id}");return B.setPathParam("app_id",u),B.setBody(N8.ApplicationInSerializer._toJsonObject(D)),B.send(this.requestCtx,Ou.ApplicationOutSerializer._fromJsonObject)}delete(u){let D=new Q2.SvixRequest(Q2.HttpMethod.DELETE,"/api/v1/app/{app_id}");return D.setPathParam("app_id",u),D.sendNoResponseBody(this.requestCtx)}patch(u,D){let B=new Q2.SvixRequest(Q2.HttpMethod.PATCH,"/api/v1/app/{app_id}");return B.setPathParam("app_id",u),B.setBody(uH.ApplicationPatchSerializer._toJsonObject(D)),B.send(this.requestCtx,Ou.ApplicationOutSerializer._fromJsonObject)}}JA.Application=ZA});var WA=z((XA)=>{Object.defineProperty(XA,"__esModule",{value:!0});XA.ApiTokenOutSerializer=void 0;XA.ApiTokenOutSerializer={_fromJsonObject(u){return{createdAt:new Date(u.createdAt),expiresAt:u.expiresAt?new Date(u.expiresAt):null,id:u.id,name:u.name,scopes:u.scopes,token:u.token}},_toJsonObject(u){return{createdAt:u.createdAt,expiresAt:u.expiresAt,id:u.id,name:u.name,scopes:u.scopes,token:u.token}}}});var $8=z((hA)=>{Object.defineProperty(hA,"__esModule",{value:!0});hA.AppPortalCapabilitySerializer=hA.AppPortalCapability=void 0;var BH;(function(u){u.ViewBase="ViewBase",u.ViewEndpointSecret="ViewEndpointSecret",u.ManageEndpointSecret="ManageEndpointSecret",u.ManageTransformations="ManageTransformations",u.CreateAttempts="CreateAttempts",u.ManageEndpoint="ManageEndpoint"})(BH=hA.AppPortalCapability||(hA.AppPortalCapability={}));hA.AppPortalCapabilitySerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var MA=z((RA)=>{Object.defineProperty(RA,"__esModule",{value:!0});RA.AppPortalAccessInSerializer=void 0;var HA=$8(),SA=u3();RA.AppPortalAccessInSerializer={_fromJsonObject(u){var D;return{application:u.application!=null?SA.ApplicationInSerializer._fromJsonObject(u.application):void 0,capabilities:(D=u.capabilities)===null||D===void 0?void 0:D.map((B)=>HA.AppPortalCapabilitySerializer._fromJsonObject(B)),expiry:u.expiry,featureFlags:u.featureFlags,readOnly:u.readOnly,sessionId:u.sessionId}},_toJsonObject(u){var D;return{application:u.application!=null?SA.ApplicationInSerializer._toJsonObject(u.application):void 0,capabilities:(D=u.capabilities)===null||D===void 0?void 0:D.map((B)=>HA.AppPortalCapabilitySerializer._toJsonObject(B)),expiry:u.expiry,featureFlags:u.featureFlags,readOnly:u.readOnly,sessionId:u.sessionId}}}});var OA=z((LA)=>{Object.defineProperty(LA,"__esModule",{value:!0});LA.AppPortalAccessOutSerializer=void 0;LA.AppPortalAccessOutSerializer={_fromJsonObject(u){return{token:u.token,url:u.url}},_toJsonObject(u){return{token:u.token,url:u.url}}}});var cA=z((CA)=>{Object.defineProperty(CA,"__esModule",{value:!0});CA.ApplicationTokenExpireInSerializer=void 0;CA.ApplicationTokenExpireInSerializer={_fromJsonObject(u){return{expiry:u.expiry,sessionIds:u.sessionIds}},_toJsonObject(u){return{expiry:u.expiry,sessionIds:u.sessionIds}}}});var yA=z((VA)=>{Object.defineProperty(VA,"__esModule",{value:!0});VA.RotatePollerTokenInSerializer=void 0;VA.RotatePollerTokenInSerializer={_fromJsonObject(u){return{expiry:u.expiry,oldTokenExpiry:u.oldTokenExpiry}},_toJsonObject(u){return{expiry:u.expiry,oldTokenExpiry:u.oldTokenExpiry}}}});var qA=z((TA)=>{Object.defineProperty(TA,"__esModule",{value:!0});TA.StreamPortalAccessInSerializer=void 0;TA.StreamPortalAccessInSerializer={_fromJsonObject(u){return{expiry:u.expiry,featureFlags:u.featureFlags,sessionId:u.sessionId}},_toJsonObject(u){return{expiry:u.expiry,featureFlags:u.featureFlags,sessionId:u.sessionId}}}});var gA=z((mA)=>{Object.defineProperty(mA,"__esModule",{value:!0});mA.StreamTokenExpireInSerializer=void 0;mA.StreamTokenExpireInSerializer={_fromJsonObject(u){return{expiry:u.expiry,sessionIds:u.sessionIds}},_toJsonObject(u){return{expiry:u.expiry,sessionIds:u.sessionIds}}}});var z8=z((fA)=>{Object.defineProperty(fA,"__esModule",{value:!0});fA.DashboardAccessOutSerializer=void 0;fA.DashboardAccessOutSerializer={_fromJsonObject(u){return{token:u.token,url:u.url}},_toJsonObject(u){return{token:u.token,url:u.url}}}});var nA=z((iA)=>{Object.defineProperty(iA,"__esModule",{value:!0});iA.Authentication=void 0;var jA=WA(),AH=MA(),lA=OA(),FH=cA(),wH=yA(),GH=qA(),NH=gA(),$H=z8(),u2=_();class dA{constructor(u){this.requestCtx=u}appPortalAccess(u,D,B){let A=new u2.SvixRequest(u2.HttpMethod.POST,"/api/v1/auth/app-portal-access/{app_id}");return A.setPathParam("app_id",u),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(AH.AppPortalAccessInSerializer._toJsonObject(D)),A.send(this.requestCtx,lA.AppPortalAccessOutSerializer._fromJsonObject)}expireAll(u,D,B){let A=new u2.SvixRequest(u2.HttpMethod.POST,"/api/v1/auth/app/{app_id}/expire-all");return A.setPathParam("app_id",u),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(FH.ApplicationTokenExpireInSerializer._toJsonObject(D)),A.sendNoResponseBody(this.requestCtx)}dashboardAccess(u,D){let B=new u2.SvixRequest(u2.HttpMethod.POST,"/api/v1/auth/dashboard-access/{app_id}");return B.setPathParam("app_id",u),B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.send(this.requestCtx,$H.DashboardAccessOutSerializer._fromJsonObject)}logout(u){let D=new u2.SvixRequest(u2.HttpMethod.POST,"/api/v1/auth/logout");return D.setHeaderParam("idempotency-key",u===null||u===void 0?void 0:u.idempotencyKey),D.sendNoResponseBody(this.requestCtx)}streamLogout(u){let D=new u2.SvixRequest(u2.HttpMethod.POST,"/api/v1/auth/stream-logout");return D.setHeaderParam("idempotency-key",u===null||u===void 0?void 0:u.idempotencyKey),D.sendNoResponseBody(this.requestCtx)}streamPortalAccess(u,D,B){let A=new u2.SvixRequest(u2.HttpMethod.POST,"/api/v1/auth/stream-portal-access/{stream_id}");return A.setPathParam("stream_id",u),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(GH.StreamPortalAccessInSerializer._toJsonObject(D)),A.send(this.requestCtx,lA.AppPortalAccessOutSerializer._fromJsonObject)}streamExpireAll(u,D,B){let A=new u2.SvixRequest(u2.HttpMethod.POST,"/api/v1/auth/stream/{stream_id}/expire-all");return A.setPathParam("stream_id",u),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(NH.StreamTokenExpireInSerializer._toJsonObject(D)),A.sendNoResponseBody(this.requestCtx)}getStreamPollerToken(u,D){let B=new u2.SvixRequest(u2.HttpMethod.GET,"/api/v1/auth/stream/{stream_id}/sink/{sink_id}/poller/token");return B.setPathParam("stream_id",u),B.setPathParam("sink_id",D),B.send(this.requestCtx,jA.ApiTokenOutSerializer._fromJsonObject)}rotateStreamPollerToken(u,D,B,A){let F=new u2.SvixRequest(u2.HttpMethod.POST,"/api/v1/auth/stream/{stream_id}/sink/{sink_id}/poller/token/rotate");return F.setPathParam("stream_id",u),F.setPathParam("sink_id",D),F.setHeaderParam("idempotency-key",A===null||A===void 0?void 0:A.idempotencyKey),F.setBody(wH.RotatePollerTokenInSerializer._toJsonObject(B)),F.send(this.requestCtx,jA.ApiTokenOutSerializer._fromJsonObject)}}iA.Authentication=dA});var e2=z((aA)=>{Object.defineProperty(aA,"__esModule",{value:!0});aA.BackgroundTaskStatusSerializer=aA.BackgroundTaskStatus=void 0;var zH;(function(u){u.Running="running",u.Finished="finished",u.Failed="failed"})(zH=aA.BackgroundTaskStatus||(aA.BackgroundTaskStatus={}));aA.BackgroundTaskStatusSerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var u0=z((oA)=>{Object.defineProperty(oA,"__esModule",{value:!0});oA.BackgroundTaskTypeSerializer=oA.BackgroundTaskType=void 0;var ZH;(function(u){u.EndpointReplay="endpoint.replay",u.EndpointRecover="endpoint.recover",u.ApplicationStats="application.stats",u.MessageBroadcast="message.broadcast",u.SdkGenerate="sdk.generate",u.EventTypeAggregate="event-type.aggregate",u.ApplicationPurgeContent="application.purge_content",u.EndpointBulkReplay="endpoint.bulk-replay"})(ZH=oA.BackgroundTaskType||(oA.BackgroundTaskType={}));oA.BackgroundTaskTypeSerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var Z8=z((B7)=>{Object.defineProperty(B7,"__esModule",{value:!0});B7.BackgroundTaskOutSerializer=void 0;var u7=e2(),D7=u0();B7.BackgroundTaskOutSerializer={_fromJsonObject(u){return{data:u.data,id:u.id,status:u7.BackgroundTaskStatusSerializer._fromJsonObject(u.status),task:D7.BackgroundTaskTypeSerializer._fromJsonObject(u.task),updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){return{data:u.data,id:u.id,status:u7.BackgroundTaskStatusSerializer._toJsonObject(u.status),task:D7.BackgroundTaskTypeSerializer._toJsonObject(u.task),updatedAt:u.updatedAt}}}});var N7=z((w7)=>{Object.defineProperty(w7,"__esModule",{value:!0});w7.ListResponseBackgroundTaskOutSerializer=void 0;var F7=Z8();w7.ListResponseBackgroundTaskOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>F7.BackgroundTaskOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>F7.BackgroundTaskOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var J7=z((z7)=>{Object.defineProperty(z7,"__esModule",{value:!0});z7.BackgroundTask=void 0;var JH=Z8(),QH=N7(),D3=_();class $7{constructor(u){this.requestCtx=u}list(u){let D=new D3.SvixRequest(D3.HttpMethod.GET,"/api/v1/background-task");return D.setQueryParams({status:u===null||u===void 0?void 0:u.status,task:u===null||u===void 0?void 0:u.task,limit:u===null||u===void 0?void 0:u.limit,iterator:u===null||u===void 0?void 0:u.iterator,order:u===null||u===void 0?void 0:u.order}),D.send(this.requestCtx,QH.ListResponseBackgroundTaskOutSerializer._fromJsonObject)}listByEndpoint(u){return this.list(u)}get(u){let D=new D3.SvixRequest(D3.HttpMethod.GET,"/api/v1/background-task/{task_id}");return D.setPathParam("task_id",u),D.send(this.requestCtx,JH.BackgroundTaskOutSerializer._fromJsonObject)}}z7.BackgroundTask=$7});var q0=z((v7)=>{Object.defineProperty(v7,"__esModule",{value:!0});v7.ConnectorKindSerializer=v7.ConnectorKind=void 0;var vH;(function(u){u.Custom="Custom",u.AgenticCommerceProtocol="AgenticCommerceProtocol",u.CloseCrm="CloseCRM",u.CustomerIo="CustomerIO",u.Discord="Discord",u.Hubspot="Hubspot",u.Inngest="Inngest",u.Loops="Loops",u.Otel="Otel",u.Resend="Resend",u.Salesforce="Salesforce",u.Segment="Segment",u.Sendgrid="Sendgrid",u.Slack="Slack",u.Teams="Teams",u.TriggerDev="TriggerDev",u.Windmill="Windmill",u.Zapier="Zapier"})(vH=v7.ConnectorKind||(v7.ConnectorKind={}));v7.ConnectorKindSerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var B3=z((W7)=>{Object.defineProperty(W7,"__esModule",{value:!0});W7.ConnectorProductSerializer=W7.ConnectorProduct=void 0;var XH;(function(u){u.Dispatch="Dispatch",u.Stream="Stream"})(XH=W7.ConnectorProduct||(W7.ConnectorProduct={}));W7.ConnectorProductSerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var J8=z((H7)=>{Object.defineProperty(H7,"__esModule",{value:!0});H7.ConnectorInSerializer=void 0;var h7=q0(),x7=B3();H7.ConnectorInSerializer={_fromJsonObject(u){return{allowedEventTypes:u.allowedEventTypes,description:u.description,featureFlags:u.featureFlags,instructions:u.instructions,kind:u.kind!=null?h7.ConnectorKindSerializer._fromJsonObject(u.kind):void 0,logo:u.logo,name:u.name,productType:u.productType!=null?x7.ConnectorProductSerializer._fromJsonObject(u.productType):void 0,transformation:u.transformation,uid:u.uid}},_toJsonObject(u){return{allowedEventTypes:u.allowedEventTypes,description:u.description,featureFlags:u.featureFlags,instructions:u.instructions,kind:u.kind!=null?h7.ConnectorKindSerializer._toJsonObject(u.kind):void 0,logo:u.logo,name:u.name,productType:u.productType!=null?x7.ConnectorProductSerializer._toJsonObject(u.productType):void 0,transformation:u.transformation,uid:u.uid}}}});var A3=z((M7)=>{Object.defineProperty(M7,"__esModule",{value:!0});M7.ConnectorOutSerializer=void 0;var R7=q0(),U7=B3();M7.ConnectorOutSerializer={_fromJsonObject(u){return{allowedEventTypes:u.allowedEventTypes,createdAt:new Date(u.createdAt),description:u.description,featureFlags:u.featureFlags,id:u.id,instructions:u.instructions,kind:R7.ConnectorKindSerializer._fromJsonObject(u.kind),logo:u.logo,name:u.name,orgId:u.orgId,productType:U7.ConnectorProductSerializer._fromJsonObject(u.productType),transformation:u.transformation,transformationUpdatedAt:new Date(u.transformationUpdatedAt),uid:u.uid,updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){return{allowedEventTypes:u.allowedEventTypes,createdAt:u.createdAt,description:u.description,featureFlags:u.featureFlags,id:u.id,instructions:u.instructions,kind:R7.ConnectorKindSerializer._toJsonObject(u.kind),logo:u.logo,name:u.name,orgId:u.orgId,productType:U7.ConnectorProductSerializer._toJsonObject(u.productType),transformation:u.transformation,transformationUpdatedAt:u.transformationUpdatedAt,uid:u.uid,updatedAt:u.updatedAt}}}});var P7=z((O7)=>{Object.defineProperty(O7,"__esModule",{value:!0});O7.ConnectorPatchSerializer=void 0;var E7=q0();O7.ConnectorPatchSerializer={_fromJsonObject(u){return{allowedEventTypes:u.allowedEventTypes,description:u.description,featureFlags:u.featureFlags,instructions:u.instructions,kind:u.kind!=null?E7.ConnectorKindSerializer._fromJsonObject(u.kind):void 0,logo:u.logo,name:u.name,transformation:u.transformation}},_toJsonObject(u){return{allowedEventTypes:u.allowedEventTypes,description:u.description,featureFlags:u.featureFlags,instructions:u.instructions,kind:u.kind!=null?E7.ConnectorKindSerializer._toJsonObject(u.kind):void 0,logo:u.logo,name:u.name,transformation:u.transformation}}}});var y7=z((V7)=>{Object.defineProperty(V7,"__esModule",{value:!0});V7.ConnectorUpdateSerializer=void 0;var c7=q0();V7.ConnectorUpdateSerializer={_fromJsonObject(u){return{allowedEventTypes:u.allowedEventTypes,description:u.description,featureFlags:u.featureFlags,instructions:u.instructions,kind:u.kind!=null?c7.ConnectorKindSerializer._fromJsonObject(u.kind):void 0,logo:u.logo,name:u.name,transformation:u.transformation}},_toJsonObject(u){return{allowedEventTypes:u.allowedEventTypes,description:u.description,featureFlags:u.featureFlags,instructions:u.instructions,kind:u.kind!=null?c7.ConnectorKindSerializer._toJsonObject(u.kind):void 0,logo:u.logo,name:u.name,transformation:u.transformation}}}});var m7=z((I7)=>{Object.defineProperty(I7,"__esModule",{value:!0});I7.ListResponseConnectorOutSerializer=void 0;var T7=A3();I7.ListResponseConnectorOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>T7.ConnectorOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>T7.ConnectorOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var b7=z((g7)=>{Object.defineProperty(g7,"__esModule",{value:!0});g7.Connector=void 0;var YH=J8(),F3=A3(),WH=P7(),KH=y7(),hH=m7(),E2=_();class _7{constructor(u){this.requestCtx=u}list(u){let D=new E2.SvixRequest(E2.HttpMethod.GET,"/api/v1/connector");return D.setQueryParams({limit:u===null||u===void 0?void 0:u.limit,iterator:u===null||u===void 0?void 0:u.iterator,order:u===null||u===void 0?void 0:u.order,product_type:u===null||u===void 0?void 0:u.productType}),D.send(this.requestCtx,hH.ListResponseConnectorOutSerializer._fromJsonObject)}create(u,D){let B=new E2.SvixRequest(E2.HttpMethod.POST,"/api/v1/connector");return B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.setBody(YH.ConnectorInSerializer._toJsonObject(u)),B.send(this.requestCtx,F3.ConnectorOutSerializer._fromJsonObject)}get(u){let D=new E2.SvixRequest(E2.HttpMethod.GET,"/api/v1/connector/{connector_id}");return D.setPathParam("connector_id",u),D.send(this.requestCtx,F3.ConnectorOutSerializer._fromJsonObject)}update(u,D){let B=new E2.SvixRequest(E2.HttpMethod.PUT,"/api/v1/connector/{connector_id}");return B.setPathParam("connector_id",u),B.setBody(KH.ConnectorUpdateSerializer._toJsonObject(D)),B.send(this.requestCtx,F3.ConnectorOutSerializer._fromJsonObject)}delete(u){let D=new E2.SvixRequest(E2.HttpMethod.DELETE,"/api/v1/connector/{connector_id}");return D.setPathParam("connector_id",u),D.sendNoResponseBody(this.requestCtx)}patch(u,D){let B=new E2.SvixRequest(E2.HttpMethod.PATCH,"/api/v1/connector/{connector_id}");return B.setPathParam("connector_id",u),B.setBody(WH.ConnectorPatchSerializer._toJsonObject(D)),B.send(this.requestCtx,F3.ConnectorOutSerializer._fromJsonObject)}}g7.Connector=_7});var m0=z((l7)=>{Object.defineProperty(l7,"__esModule",{value:!0});l7.MessageStatusSerializer=l7.MessageStatus=void 0;var xH;(function(u){u[u.Success=0]="Success",u[u.Pending=1]="Pending",u[u.Fail=2]="Fail",u[u.Sending=3]="Sending"})(xH=l7.MessageStatus||(l7.MessageStatus={}));l7.MessageStatusSerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var Q8=z((r7)=>{Object.defineProperty(r7,"__esModule",{value:!0});r7.StatusCodeClassSerializer=r7.StatusCodeClass=void 0;var HH;(function(u){u[u.CodeNone=0]="CodeNone",u[u.Code1xx=100]="Code1xx",u[u.Code2xx=200]="Code2xx",u[u.Code3xx=300]="Code3xx",u[u.Code4xx=400]="Code4xx",u[u.Code5xx=500]="Code5xx"})(HH=r7.StatusCodeClass||(r7.StatusCodeClass={}));r7.StatusCodeClassSerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var o7=z((s7)=>{Object.defineProperty(s7,"__esModule",{value:!0});s7.BulkReplayInSerializer=void 0;var p7=m0(),a7=Q8();s7.BulkReplayInSerializer={_fromJsonObject(u){return{channel:u.channel,eventTypes:u.eventTypes,since:new Date(u.since),status:u.status!=null?p7.MessageStatusSerializer._fromJsonObject(u.status):void 0,statusCodeClass:u.statusCodeClass!=null?a7.StatusCodeClassSerializer._fromJsonObject(u.statusCodeClass):void 0,tag:u.tag,until:u.until?new Date(u.until):null}},_toJsonObject(u){return{channel:u.channel,eventTypes:u.eventTypes,since:u.since,status:u.status!=null?p7.MessageStatusSerializer._toJsonObject(u.status):void 0,statusCodeClass:u.statusCodeClass!=null?a7.StatusCodeClassSerializer._toJsonObject(u.statusCodeClass):void 0,tag:u.tag,until:u.until}}}});var DF=z((e7)=>{Object.defineProperty(e7,"__esModule",{value:!0});e7.EndpointHeadersInSerializer=void 0;e7.EndpointHeadersInSerializer={_fromJsonObject(u){return{headers:u.headers}},_toJsonObject(u){return{headers:u.headers}}}});var v8=z((BF)=>{Object.defineProperty(BF,"__esModule",{value:!0});BF.EndpointHeadersOutSerializer=void 0;BF.EndpointHeadersOutSerializer={_fromJsonObject(u){return{headers:u.headers,sensitive:u.sensitive}},_toJsonObject(u){return{headers:u.headers,sensitive:u.sensitive}}}});var GF=z((FF)=>{Object.defineProperty(FF,"__esModule",{value:!0});FF.EndpointHeadersPatchInSerializer=void 0;FF.EndpointHeadersPatchInSerializer={_fromJsonObject(u){return{deleteHeaders:u.deleteHeaders,headers:u.headers}},_toJsonObject(u){return{deleteHeaders:u.deleteHeaders,headers:u.headers}}}});var zF=z((NF)=>{Object.defineProperty(NF,"__esModule",{value:!0});NF.EndpointInSerializer=void 0;NF.EndpointInSerializer={_fromJsonObject(u){return{channels:u.channels,description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,headers:u.headers,metadata:u.metadata,rateLimit:u.rateLimit,secret:u.secret,throttleRate:u.throttleRate,uid:u.uid,url:u.url,version:u.version}},_toJsonObject(u){return{channels:u.channels,description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,headers:u.headers,metadata:u.metadata,rateLimit:u.rateLimit,secret:u.secret,throttleRate:u.throttleRate,uid:u.uid,url:u.url,version:u.version}}}});var X8=z((ZF)=>{Object.defineProperty(ZF,"__esModule",{value:!0});ZF.EndpointOutSerializer=void 0;ZF.EndpointOutSerializer={_fromJsonObject(u){return{channels:u.channels,createdAt:new Date(u.createdAt),description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,id:u.id,metadata:u.metadata,rateLimit:u.rateLimit,throttleRate:u.throttleRate,uid:u.uid,updatedAt:new Date(u.updatedAt),url:u.url,version:u.version}},_toJsonObject(u){return{channels:u.channels,createdAt:u.createdAt,description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,id:u.id,metadata:u.metadata,rateLimit:u.rateLimit,throttleRate:u.throttleRate,uid:u.uid,updatedAt:u.updatedAt,url:u.url,version:u.version}}}});var XF=z((QF)=>{Object.defineProperty(QF,"__esModule",{value:!0});QF.EndpointPatchSerializer=void 0;QF.EndpointPatchSerializer={_fromJsonObject(u){return{channels:u.channels,description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,metadata:u.metadata,rateLimit:u.rateLimit,secret:u.secret,throttleRate:u.throttleRate,uid:u.uid,url:u.url,version:u.version}},_toJsonObject(u){return{channels:u.channels,description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,metadata:u.metadata,rateLimit:u.rateLimit,secret:u.secret,throttleRate:u.throttleRate,uid:u.uid,url:u.url,version:u.version}}}});var KF=z((YF)=>{Object.defineProperty(YF,"__esModule",{value:!0});YF.EndpointSecretOutSerializer=void 0;YF.EndpointSecretOutSerializer={_fromJsonObject(u){return{key:u.key}},_toJsonObject(u){return{key:u.key}}}});var Y8=z((hF)=>{Object.defineProperty(hF,"__esModule",{value:!0});hF.EndpointSecretRotateInSerializer=void 0;hF.EndpointSecretRotateInSerializer={_fromJsonObject(u){return{key:u.key}},_toJsonObject(u){return{key:u.key}}}});var RF=z((HF)=>{Object.defineProperty(HF,"__esModule",{value:!0});HF.EndpointStatsSerializer=void 0;HF.EndpointStatsSerializer={_fromJsonObject(u){return{fail:u.fail,pending:u.pending,sending:u.sending,success:u.success}},_toJsonObject(u){return{fail:u.fail,pending:u.pending,sending:u.sending,success:u.success}}}});var LF=z((UF)=>{Object.defineProperty(UF,"__esModule",{value:!0});UF.EndpointTransformationInSerializer=void 0;UF.EndpointTransformationInSerializer={_fromJsonObject(u){return{code:u.code,enabled:u.enabled}},_toJsonObject(u){return{code:u.code,enabled:u.enabled}}}});var CF=z((EF)=>{Object.defineProperty(EF,"__esModule",{value:!0});EF.EndpointTransformationOutSerializer=void 0;EF.EndpointTransformationOutSerializer={_fromJsonObject(u){return{code:u.code,enabled:u.enabled,updatedAt:u.updatedAt?new Date(u.updatedAt):null}},_toJsonObject(u){return{code:u.code,enabled:u.enabled,updatedAt:u.updatedAt}}}});var VF=z((PF)=>{Object.defineProperty(PF,"__esModule",{value:!0});PF.EndpointTransformationPatchSerializer=void 0;PF.EndpointTransformationPatchSerializer={_fromJsonObject(u){return{code:u.code,enabled:u.enabled}},_toJsonObject(u){return{code:u.code,enabled:u.enabled}}}});var TF=z((kF)=>{Object.defineProperty(kF,"__esModule",{value:!0});kF.EndpointUpdateSerializer=void 0;kF.EndpointUpdateSerializer={_fromJsonObject(u){return{channels:u.channels,description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,metadata:u.metadata,rateLimit:u.rateLimit,throttleRate:u.throttleRate,uid:u.uid,url:u.url,version:u.version}},_toJsonObject(u){return{channels:u.channels,description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,metadata:u.metadata,rateLimit:u.rateLimit,throttleRate:u.throttleRate,uid:u.uid,url:u.url,version:u.version}}}});var mF=z((IF)=>{Object.defineProperty(IF,"__esModule",{value:!0});IF.EventExampleInSerializer=void 0;IF.EventExampleInSerializer={_fromJsonObject(u){return{eventType:u.eventType,exampleIndex:u.exampleIndex}},_toJsonObject(u){return{eventType:u.eventType,exampleIndex:u.exampleIndex}}}});var bF=z((gF)=>{Object.defineProperty(gF,"__esModule",{value:!0});gF.ListResponseEndpointOutSerializer=void 0;var _F=X8();gF.ListResponseEndpointOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>_F.EndpointOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>_F.EndpointOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var Cu=z((jF)=>{Object.defineProperty(jF,"__esModule",{value:!0});jF.MessageOutSerializer=void 0;jF.MessageOutSerializer={_fromJsonObject(u){return{channels:u.channels,deliverAt:u.deliverAt?new Date(u.deliverAt):null,eventId:u.eventId,eventType:u.eventType,id:u.id,payload:u.payload,tags:u.tags,timestamp:new Date(u.timestamp)}},_toJsonObject(u){return{channels:u.channels,deliverAt:u.deliverAt,eventId:u.eventId,eventType:u.eventType,id:u.id,payload:u.payload,tags:u.tags,timestamp:u.timestamp}}}});var rF=z((dF)=>{Object.defineProperty(dF,"__esModule",{value:!0});dF.RecoverInSerializer=void 0;dF.RecoverInSerializer={_fromJsonObject(u){return{since:new Date(u.since),until:u.until?new Date(u.until):null}},_toJsonObject(u){return{since:u.since,until:u.until}}}});var tF=z((aF)=>{Object.defineProperty(aF,"__esModule",{value:!0});aF.RecoverOutSerializer=void 0;var nF=e2(),pF=u0();aF.RecoverOutSerializer={_fromJsonObject(u){return{id:u.id,status:nF.BackgroundTaskStatusSerializer._fromJsonObject(u.status),task:pF.BackgroundTaskTypeSerializer._fromJsonObject(u.task),updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){return{id:u.id,status:nF.BackgroundTaskStatusSerializer._toJsonObject(u.status),task:pF.BackgroundTaskTypeSerializer._toJsonObject(u.task),updatedAt:u.updatedAt}}}});var uw=z((oF)=>{Object.defineProperty(oF,"__esModule",{value:!0});oF.ReplayInSerializer=void 0;oF.ReplayInSerializer={_fromJsonObject(u){return{since:new Date(u.since),until:u.until?new Date(u.until):null}},_toJsonObject(u){return{since:u.since,until:u.until}}}});var ww=z((Aw)=>{Object.defineProperty(Aw,"__esModule",{value:!0});Aw.ReplayOutSerializer=void 0;var Dw=e2(),Bw=u0();Aw.ReplayOutSerializer={_fromJsonObject(u){return{id:u.id,status:Dw.BackgroundTaskStatusSerializer._fromJsonObject(u.status),task:Bw.BackgroundTaskTypeSerializer._fromJsonObject(u.task),updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){return{id:u.id,status:Dw.BackgroundTaskStatusSerializer._toJsonObject(u.status),task:Bw.BackgroundTaskTypeSerializer._toJsonObject(u.task),updatedAt:u.updatedAt}}}});var Zw=z(($w)=>{Object.defineProperty($w,"__esModule",{value:!0});$w.Endpoint=void 0;var SH=o7(),RH=DF(),UH=v8(),MH=GF(),LH=zF(),w3=X8(),EH=XF(),OH=KF(),CH=Y8(),PH=RF(),cH=LF(),VH=CF(),kH=VF(),yH=TF(),TH=mF(),IH=bF(),qH=Cu(),mH=rF(),_H=tF(),gH=uw(),Gw=ww(),R=_();class Nw{constructor(u){this.requestCtx=u}list(u,D){let B=new R.SvixRequest(R.HttpMethod.GET,"/api/v1/app/{app_id}/endpoint");return B.setPathParam("app_id",u),B.setQueryParams({limit:D===null||D===void 0?void 0:D.limit,iterator:D===null||D===void 0?void 0:D.iterator,order:D===null||D===void 0?void 0:D.order}),B.send(this.requestCtx,IH.ListResponseEndpointOutSerializer._fromJsonObject)}create(u,D,B){let A=new R.SvixRequest(R.HttpMethod.POST,"/api/v1/app/{app_id}/endpoint");return A.setPathParam("app_id",u),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(LH.EndpointInSerializer._toJsonObject(D)),A.send(this.requestCtx,w3.EndpointOutSerializer._fromJsonObject)}get(u,D){let B=new R.SvixRequest(R.HttpMethod.GET,"/api/v1/app/{app_id}/endpoint/{endpoint_id}");return B.setPathParam("app_id",u),B.setPathParam("endpoint_id",D),B.send(this.requestCtx,w3.EndpointOutSerializer._fromJsonObject)}update(u,D,B){let A=new R.SvixRequest(R.HttpMethod.PUT,"/api/v1/app/{app_id}/endpoint/{endpoint_id}");return A.setPathParam("app_id",u),A.setPathParam("endpoint_id",D),A.setBody(yH.EndpointUpdateSerializer._toJsonObject(B)),A.send(this.requestCtx,w3.EndpointOutSerializer._fromJsonObject)}delete(u,D){let B=new R.SvixRequest(R.HttpMethod.DELETE,"/api/v1/app/{app_id}/endpoint/{endpoint_id}");return B.setPathParam("app_id",u),B.setPathParam("endpoint_id",D),B.sendNoResponseBody(this.requestCtx)}patch(u,D,B){let A=new R.SvixRequest(R.HttpMethod.PATCH,"/api/v1/app/{app_id}/endpoint/{endpoint_id}");return A.setPathParam("app_id",u),A.setPathParam("endpoint_id",D),A.setBody(EH.EndpointPatchSerializer._toJsonObject(B)),A.send(this.requestCtx,w3.EndpointOutSerializer._fromJsonObject)}bulkReplay(u,D,B,A){let F=new R.SvixRequest(R.HttpMethod.POST,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/bulk-replay");return F.setPathParam("app_id",u),F.setPathParam("endpoint_id",D),F.setHeaderParam("idempotency-key",A===null||A===void 0?void 0:A.idempotencyKey),F.setBody(SH.BulkReplayInSerializer._toJsonObject(B)),F.send(this.requestCtx,Gw.ReplayOutSerializer._fromJsonObject)}getHeaders(u,D){let B=new R.SvixRequest(R.HttpMethod.GET,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/headers");return B.setPathParam("app_id",u),B.setPathParam("endpoint_id",D),B.send(this.requestCtx,UH.EndpointHeadersOutSerializer._fromJsonObject)}updateHeaders(u,D,B){let A=new R.SvixRequest(R.HttpMethod.PUT,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/headers");return A.setPathParam("app_id",u),A.setPathParam("endpoint_id",D),A.setBody(RH.EndpointHeadersInSerializer._toJsonObject(B)),A.sendNoResponseBody(this.requestCtx)}headersUpdate(u,D,B){return this.updateHeaders(u,D,B)}patchHeaders(u,D,B){let A=new R.SvixRequest(R.HttpMethod.PATCH,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/headers");return A.setPathParam("app_id",u),A.setPathParam("endpoint_id",D),A.setBody(MH.EndpointHeadersPatchInSerializer._toJsonObject(B)),A.sendNoResponseBody(this.requestCtx)}headersPatch(u,D,B){return this.patchHeaders(u,D,B)}recover(u,D,B,A){let F=new R.SvixRequest(R.HttpMethod.POST,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/recover");return F.setPathParam("app_id",u),F.setPathParam("endpoint_id",D),F.setHeaderParam("idempotency-key",A===null||A===void 0?void 0:A.idempotencyKey),F.setBody(mH.RecoverInSerializer._toJsonObject(B)),F.send(this.requestCtx,_H.RecoverOutSerializer._fromJsonObject)}replayMissing(u,D,B,A){let F=new R.SvixRequest(R.HttpMethod.POST,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/replay-missing");return F.setPathParam("app_id",u),F.setPathParam("endpoint_id",D),F.setHeaderParam("idempotency-key",A===null||A===void 0?void 0:A.idempotencyKey),F.setBody(gH.ReplayInSerializer._toJsonObject(B)),F.send(this.requestCtx,Gw.ReplayOutSerializer._fromJsonObject)}getSecret(u,D){let B=new R.SvixRequest(R.HttpMethod.GET,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/secret");return B.setPathParam("app_id",u),B.setPathParam("endpoint_id",D),B.send(this.requestCtx,OH.EndpointSecretOutSerializer._fromJsonObject)}rotateSecret(u,D,B,A){let F=new R.SvixRequest(R.HttpMethod.POST,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/secret/rotate");return F.setPathParam("app_id",u),F.setPathParam("endpoint_id",D),F.setHeaderParam("idempotency-key",A===null||A===void 0?void 0:A.idempotencyKey),F.setBody(CH.EndpointSecretRotateInSerializer._toJsonObject(B)),F.sendNoResponseBody(this.requestCtx)}sendExample(u,D,B,A){let F=new R.SvixRequest(R.HttpMethod.POST,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/send-example");return F.setPathParam("app_id",u),F.setPathParam("endpoint_id",D),F.setHeaderParam("idempotency-key",A===null||A===void 0?void 0:A.idempotencyKey),F.setBody(TH.EventExampleInSerializer._toJsonObject(B)),F.send(this.requestCtx,qH.MessageOutSerializer._fromJsonObject)}getStats(u,D,B){let A=new R.SvixRequest(R.HttpMethod.GET,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/stats");return A.setPathParam("app_id",u),A.setPathParam("endpoint_id",D),A.setQueryParams({since:B===null||B===void 0?void 0:B.since,until:B===null||B===void 0?void 0:B.until}),A.send(this.requestCtx,PH.EndpointStatsSerializer._fromJsonObject)}transformationGet(u,D){let B=new R.SvixRequest(R.HttpMethod.GET,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/transformation");return B.setPathParam("app_id",u),B.setPathParam("endpoint_id",D),B.send(this.requestCtx,VH.EndpointTransformationOutSerializer._fromJsonObject)}patchTransformation(u,D,B){let A=new R.SvixRequest(R.HttpMethod.PATCH,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/transformation");return A.setPathParam("app_id",u),A.setPathParam("endpoint_id",D),A.setBody(kH.EndpointTransformationPatchSerializer._toJsonObject(B)),A.sendNoResponseBody(this.requestCtx)}transformationPartialUpdate(u,D,B){let A=new R.SvixRequest(R.HttpMethod.PATCH,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/transformation");return A.setPathParam("app_id",u),A.setPathParam("endpoint_id",D),A.setBody(cH.EndpointTransformationInSerializer._toJsonObject(B)),A.sendNoResponseBody(this.requestCtx)}}$w.Endpoint=Nw});var W8=z((Jw)=>{Object.defineProperty(Jw,"__esModule",{value:!0});Jw.EventTypeInSerializer=void 0;Jw.EventTypeInSerializer={_fromJsonObject(u){return{archived:u.archived,deprecated:u.deprecated,description:u.description,featureFlag:u.featureFlag,featureFlags:u.featureFlags,groupName:u.groupName,name:u.name,schemas:u.schemas}},_toJsonObject(u){return{archived:u.archived,deprecated:u.deprecated,description:u.description,featureFlag:u.featureFlag,featureFlags:u.featureFlags,groupName:u.groupName,name:u.name,schemas:u.schemas}}}});var Kw=z((Yw)=>{Object.defineProperty(Yw,"__esModule",{value:!0});Yw.EnvironmentInSerializer=void 0;var vw=J8(),Xw=W8();Yw.EnvironmentInSerializer={_fromJsonObject(u){var D,B;return{connectors:(D=u.connectors)===null||D===void 0?void 0:D.map((A)=>vw.ConnectorInSerializer._fromJsonObject(A)),eventTypes:(B=u.eventTypes)===null||B===void 0?void 0:B.map((A)=>Xw.EventTypeInSerializer._fromJsonObject(A)),settings:u.settings}},_toJsonObject(u){var D,B;return{connectors:(D=u.connectors)===null||D===void 0?void 0:D.map((A)=>vw.ConnectorInSerializer._toJsonObject(A)),eventTypes:(B=u.eventTypes)===null||B===void 0?void 0:B.map((A)=>Xw.EventTypeInSerializer._toJsonObject(A)),settings:u.settings}}}});var G3=z((hw)=>{Object.defineProperty(hw,"__esModule",{value:!0});hw.EventTypeOutSerializer=void 0;hw.EventTypeOutSerializer={_fromJsonObject(u){return{archived:u.archived,createdAt:new Date(u.createdAt),deprecated:u.deprecated,description:u.description,featureFlag:u.featureFlag,featureFlags:u.featureFlags,groupName:u.groupName,name:u.name,schemas:u.schemas,updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){return{archived:u.archived,createdAt:u.createdAt,deprecated:u.deprecated,description:u.description,featureFlag:u.featureFlag,featureFlags:u.featureFlags,groupName:u.groupName,name:u.name,schemas:u.schemas,updatedAt:u.updatedAt}}}});var Mw=z((Rw)=>{Object.defineProperty(Rw,"__esModule",{value:!0});Rw.EnvironmentOutSerializer=void 0;var Hw=A3(),Sw=G3();Rw.EnvironmentOutSerializer={_fromJsonObject(u){return{connectors:u.connectors.map((D)=>Hw.ConnectorOutSerializer._fromJsonObject(D)),createdAt:new Date(u.createdAt),eventTypes:u.eventTypes.map((D)=>Sw.EventTypeOutSerializer._fromJsonObject(D)),settings:u.settings,version:u.version}},_toJsonObject(u){return{connectors:u.connectors.map((D)=>Hw.ConnectorOutSerializer._toJsonObject(D)),createdAt:u.createdAt,eventTypes:u.eventTypes.map((D)=>Sw.EventTypeOutSerializer._toJsonObject(D)),settings:u.settings,version:u.version}}}});var Cw=z((Ew)=>{Object.defineProperty(Ew,"__esModule",{value:!0});Ew.Environment=void 0;var fH=Kw(),bH=Mw(),N3=_();class Lw{constructor(u){this.requestCtx=u}export(u){let D=new N3.SvixRequest(N3.HttpMethod.POST,"/api/v1/environment/export");return D.setHeaderParam("idempotency-key",u===null||u===void 0?void 0:u.idempotencyKey),D.send(this.requestCtx,bH.EnvironmentOutSerializer._fromJsonObject)}import(u,D){let B=new N3.SvixRequest(N3.HttpMethod.POST,"/api/v1/environment/import");return B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.setBody(fH.EnvironmentInSerializer._toJsonObject(u)),B.sendNoResponseBody(this.requestCtx)}}Ew.Environment=Lw});var Vw=z((Pw)=>{Object.defineProperty(Pw,"__esModule",{value:!0});Pw.EventTypeImportOpenApiInSerializer=void 0;Pw.EventTypeImportOpenApiInSerializer={_fromJsonObject(u){return{dryRun:u.dryRun,replaceAll:u.replaceAll,spec:u.spec,specRaw:u.specRaw}},_toJsonObject(u){return{dryRun:u.dryRun,replaceAll:u.replaceAll,spec:u.spec,specRaw:u.specRaw}}}});var Tw=z((kw)=>{Object.defineProperty(kw,"__esModule",{value:!0});kw.EventTypeFromOpenApiSerializer=void 0;kw.EventTypeFromOpenApiSerializer={_fromJsonObject(u){return{deprecated:u.deprecated,description:u.description,featureFlag:u.featureFlag,featureFlags:u.featureFlags,groupName:u.groupName,name:u.name,schemas:u.schemas}},_toJsonObject(u){return{deprecated:u.deprecated,description:u.description,featureFlag:u.featureFlag,featureFlags:u.featureFlags,groupName:u.groupName,name:u.name,schemas:u.schemas}}}});var _w=z((qw)=>{Object.defineProperty(qw,"__esModule",{value:!0});qw.EventTypeImportOpenApiOutDataSerializer=void 0;var Iw=Tw();qw.EventTypeImportOpenApiOutDataSerializer={_fromJsonObject(u){var D;return{modified:u.modified,toModify:(D=u.to_modify)===null||D===void 0?void 0:D.map((B)=>Iw.EventTypeFromOpenApiSerializer._fromJsonObject(B))}},_toJsonObject(u){var D;return{modified:u.modified,to_modify:(D=u.toModify)===null||D===void 0?void 0:D.map((B)=>Iw.EventTypeFromOpenApiSerializer._toJsonObject(B))}}}});var jw=z((fw)=>{Object.defineProperty(fw,"__esModule",{value:!0});fw.EventTypeImportOpenApiOutSerializer=void 0;var gw=_w();fw.EventTypeImportOpenApiOutSerializer={_fromJsonObject(u){return{data:gw.EventTypeImportOpenApiOutDataSerializer._fromJsonObject(u.data)}},_toJsonObject(u){return{data:gw.EventTypeImportOpenApiOutDataSerializer._toJsonObject(u.data)}}}});var iw=z((lw)=>{Object.defineProperty(lw,"__esModule",{value:!0});lw.EventTypePatchSerializer=void 0;lw.EventTypePatchSerializer={_fromJsonObject(u){return{archived:u.archived,deprecated:u.deprecated,description:u.description,featureFlag:u.featureFlag,featureFlags:u.featureFlags,groupName:u.groupName,schemas:u.schemas}},_toJsonObject(u){return{archived:u.archived,deprecated:u.deprecated,description:u.description,featureFlag:u.featureFlag,featureFlags:u.featureFlags,groupName:u.groupName,schemas:u.schemas}}}});var pw=z((rw)=>{Object.defineProperty(rw,"__esModule",{value:!0});rw.EventTypeUpdateSerializer=void 0;rw.EventTypeUpdateSerializer={_fromJsonObject(u){return{archived:u.archived,deprecated:u.deprecated,description:u.description,featureFlag:u.featureFlag,featureFlags:u.featureFlags,groupName:u.groupName,schemas:u.schemas}},_toJsonObject(u){return{archived:u.archived,deprecated:u.deprecated,description:u.description,featureFlag:u.featureFlag,featureFlags:u.featureFlags,groupName:u.groupName,schemas:u.schemas}}}});var ow=z((sw)=>{Object.defineProperty(sw,"__esModule",{value:!0});sw.ListResponseEventTypeOutSerializer=void 0;var aw=G3();sw.ListResponseEventTypeOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>aw.EventTypeOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>aw.EventTypeOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var BG=z((uG)=>{Object.defineProperty(uG,"__esModule",{value:!0});uG.EventType=void 0;var jH=Vw(),lH=jw(),dH=W8(),$3=G3(),iH=iw(),rH=pw(),nH=ow(),v2=_();class ew{constructor(u){this.requestCtx=u}list(u){let D=new v2.SvixRequest(v2.HttpMethod.GET,"/api/v1/event-type");return D.setQueryParams({limit:u===null||u===void 0?void 0:u.limit,iterator:u===null||u===void 0?void 0:u.iterator,order:u===null||u===void 0?void 0:u.order,include_archived:u===null||u===void 0?void 0:u.includeArchived,with_content:u===null||u===void 0?void 0:u.withContent}),D.send(this.requestCtx,nH.ListResponseEventTypeOutSerializer._fromJsonObject)}create(u,D){let B=new v2.SvixRequest(v2.HttpMethod.POST,"/api/v1/event-type");return B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.setBody(dH.EventTypeInSerializer._toJsonObject(u)),B.send(this.requestCtx,$3.EventTypeOutSerializer._fromJsonObject)}importOpenapi(u,D){let B=new v2.SvixRequest(v2.HttpMethod.POST,"/api/v1/event-type/import/openapi");return B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.setBody(jH.EventTypeImportOpenApiInSerializer._toJsonObject(u)),B.send(this.requestCtx,lH.EventTypeImportOpenApiOutSerializer._fromJsonObject)}get(u){let D=new v2.SvixRequest(v2.HttpMethod.GET,"/api/v1/event-type/{event_type_name}");return D.setPathParam("event_type_name",u),D.send(this.requestCtx,$3.EventTypeOutSerializer._fromJsonObject)}update(u,D){let B=new v2.SvixRequest(v2.HttpMethod.PUT,"/api/v1/event-type/{event_type_name}");return B.setPathParam("event_type_name",u),B.setBody(rH.EventTypeUpdateSerializer._toJsonObject(D)),B.send(this.requestCtx,$3.EventTypeOutSerializer._fromJsonObject)}delete(u,D){let B=new v2.SvixRequest(v2.HttpMethod.DELETE,"/api/v1/event-type/{event_type_name}");return B.setPathParam("event_type_name",u),B.setQueryParams({expunge:D===null||D===void 0?void 0:D.expunge}),B.sendNoResponseBody(this.requestCtx)}patch(u,D){let B=new v2.SvixRequest(v2.HttpMethod.PATCH,"/api/v1/event-type/{event_type_name}");return B.setPathParam("event_type_name",u),B.setBody(iH.EventTypePatchSerializer._toJsonObject(D)),B.send(this.requestCtx,$3.EventTypeOutSerializer._fromJsonObject)}}uG.EventType=ew});var NG=z((wG)=>{Object.defineProperty(wG,"__esModule",{value:!0});wG.Health=void 0;var AG=_();class FG{constructor(u){this.requestCtx=u}get(){return new AG.SvixRequest(AG.HttpMethod.GET,"/api/v1/health").sendNoResponseBody(this.requestCtx)}}wG.Health=FG});var ZG=z(($G)=>{Object.defineProperty($G,"__esModule",{value:!0});$G.IngestSourceConsumerPortalAccessInSerializer=void 0;$G.IngestSourceConsumerPortalAccessInSerializer={_fromJsonObject(u){return{expiry:u.expiry,readOnly:u.readOnly}},_toJsonObject(u){return{expiry:u.expiry,readOnly:u.readOnly}}}});var vG=z((JG)=>{Object.defineProperty(JG,"__esModule",{value:!0});JG.IngestEndpointHeadersInSerializer=void 0;JG.IngestEndpointHeadersInSerializer={_fromJsonObject(u){return{headers:u.headers}},_toJsonObject(u){return{headers:u.headers}}}});var WG=z((XG)=>{Object.defineProperty(XG,"__esModule",{value:!0});XG.IngestEndpointHeadersOutSerializer=void 0;XG.IngestEndpointHeadersOutSerializer={_fromJsonObject(u){return{headers:u.headers,sensitive:u.sensitive}},_toJsonObject(u){return{headers:u.headers,sensitive:u.sensitive}}}});var xG=z((KG)=>{Object.defineProperty(KG,"__esModule",{value:!0});KG.IngestEndpointInSerializer=void 0;KG.IngestEndpointInSerializer={_fromJsonObject(u){return{description:u.description,disabled:u.disabled,metadata:u.metadata,rateLimit:u.rateLimit,secret:u.secret,uid:u.uid,url:u.url}},_toJsonObject(u){return{description:u.description,disabled:u.disabled,metadata:u.metadata,rateLimit:u.rateLimit,secret:u.secret,uid:u.uid,url:u.url}}}});var K8=z((HG)=>{Object.defineProperty(HG,"__esModule",{value:!0});HG.IngestEndpointOutSerializer=void 0;HG.IngestEndpointOutSerializer={_fromJsonObject(u){return{createdAt:new Date(u.createdAt),description:u.description,disabled:u.disabled,id:u.id,metadata:u.metadata,rateLimit:u.rateLimit,uid:u.uid,updatedAt:new Date(u.updatedAt),url:u.url}},_toJsonObject(u){return{createdAt:u.createdAt,description:u.description,disabled:u.disabled,id:u.id,metadata:u.metadata,rateLimit:u.rateLimit,uid:u.uid,updatedAt:u.updatedAt,url:u.url}}}});var MG=z((RG)=>{Object.defineProperty(RG,"__esModule",{value:!0});RG.IngestEndpointSecretInSerializer=void 0;RG.IngestEndpointSecretInSerializer={_fromJsonObject(u){return{key:u.key}},_toJsonObject(u){return{key:u.key}}}});var OG=z((LG)=>{Object.defineProperty(LG,"__esModule",{value:!0});LG.IngestEndpointSecretOutSerializer=void 0;LG.IngestEndpointSecretOutSerializer={_fromJsonObject(u){return{key:u.key}},_toJsonObject(u){return{key:u.key}}}});var cG=z((CG)=>{Object.defineProperty(CG,"__esModule",{value:!0});CG.IngestEndpointTransformationOutSerializer=void 0;CG.IngestEndpointTransformationOutSerializer={_fromJsonObject(u){return{code:u.code,enabled:u.enabled}},_toJsonObject(u){return{code:u.code,enabled:u.enabled}}}});var yG=z((VG)=>{Object.defineProperty(VG,"__esModule",{value:!0});VG.IngestEndpointTransformationPatchSerializer=void 0;VG.IngestEndpointTransformationPatchSerializer={_fromJsonObject(u){return{code:u.code,enabled:u.enabled}},_toJsonObject(u){return{code:u.code,enabled:u.enabled}}}});var qG=z((TG)=>{Object.defineProperty(TG,"__esModule",{value:!0});TG.IngestEndpointUpdateSerializer=void 0;TG.IngestEndpointUpdateSerializer={_fromJsonObject(u){return{description:u.description,disabled:u.disabled,metadata:u.metadata,rateLimit:u.rateLimit,uid:u.uid,url:u.url}},_toJsonObject(u){return{description:u.description,disabled:u.disabled,metadata:u.metadata,rateLimit:u.rateLimit,uid:u.uid,url:u.url}}}});var fG=z((_G)=>{Object.defineProperty(_G,"__esModule",{value:!0});_G.ListResponseIngestEndpointOutSerializer=void 0;var mG=K8();_G.ListResponseIngestEndpointOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>mG.IngestEndpointOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>mG.IngestEndpointOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var dG=z((jG)=>{Object.defineProperty(jG,"__esModule",{value:!0});jG.IngestEndpoint=void 0;var pH=vG(),aH=WG(),sH=xG(),h8=K8(),tH=MG(),oH=OG(),eH=cG(),uS=yG(),DS=qG(),BS=fG(),b=_();class bG{constructor(u){this.requestCtx=u}list(u,D){let B=new b.SvixRequest(b.HttpMethod.GET,"/ingest/api/v1/source/{source_id}/endpoint");return B.setPathParam("source_id",u),B.setQueryParams({limit:D===null||D===void 0?void 0:D.limit,iterator:D===null||D===void 0?void 0:D.iterator,order:D===null||D===void 0?void 0:D.order}),B.send(this.requestCtx,BS.ListResponseIngestEndpointOutSerializer._fromJsonObject)}create(u,D,B){let A=new b.SvixRequest(b.HttpMethod.POST,"/ingest/api/v1/source/{source_id}/endpoint");return A.setPathParam("source_id",u),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(sH.IngestEndpointInSerializer._toJsonObject(D)),A.send(this.requestCtx,h8.IngestEndpointOutSerializer._fromJsonObject)}get(u,D){let B=new b.SvixRequest(b.HttpMethod.GET,"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}");return B.setPathParam("source_id",u),B.setPathParam("endpoint_id",D),B.send(this.requestCtx,h8.IngestEndpointOutSerializer._fromJsonObject)}update(u,D,B){let A=new b.SvixRequest(b.HttpMethod.PUT,"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}");return A.setPathParam("source_id",u),A.setPathParam("endpoint_id",D),A.setBody(DS.IngestEndpointUpdateSerializer._toJsonObject(B)),A.send(this.requestCtx,h8.IngestEndpointOutSerializer._fromJsonObject)}delete(u,D){let B=new b.SvixRequest(b.HttpMethod.DELETE,"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}");return B.setPathParam("source_id",u),B.setPathParam("endpoint_id",D),B.sendNoResponseBody(this.requestCtx)}getHeaders(u,D){let B=new b.SvixRequest(b.HttpMethod.GET,"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/headers");return B.setPathParam("source_id",u),B.setPathParam("endpoint_id",D),B.send(this.requestCtx,aH.IngestEndpointHeadersOutSerializer._fromJsonObject)}updateHeaders(u,D,B){let A=new b.SvixRequest(b.HttpMethod.PUT,"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/headers");return A.setPathParam("source_id",u),A.setPathParam("endpoint_id",D),A.setBody(pH.IngestEndpointHeadersInSerializer._toJsonObject(B)),A.sendNoResponseBody(this.requestCtx)}getSecret(u,D){let B=new b.SvixRequest(b.HttpMethod.GET,"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/secret");return B.setPathParam("source_id",u),B.setPathParam("endpoint_id",D),B.send(this.requestCtx,oH.IngestEndpointSecretOutSerializer._fromJsonObject)}rotateSecret(u,D,B,A){let F=new b.SvixRequest(b.HttpMethod.POST,"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/secret/rotate");return F.setPathParam("source_id",u),F.setPathParam("endpoint_id",D),F.setHeaderParam("idempotency-key",A===null||A===void 0?void 0:A.idempotencyKey),F.setBody(tH.IngestEndpointSecretInSerializer._toJsonObject(B)),F.sendNoResponseBody(this.requestCtx)}getTransformation(u,D){let B=new b.SvixRequest(b.HttpMethod.GET,"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/transformation");return B.setPathParam("source_id",u),B.setPathParam("endpoint_id",D),B.send(this.requestCtx,eH.IngestEndpointTransformationOutSerializer._fromJsonObject)}setTransformation(u,D,B){let A=new b.SvixRequest(b.HttpMethod.PATCH,"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/transformation");return A.setPathParam("source_id",u),A.setPathParam("endpoint_id",D),A.setBody(uS.IngestEndpointTransformationPatchSerializer._toJsonObject(B)),A.sendNoResponseBody(this.requestCtx)}}jG.IngestEndpoint=bG});var nG=z((iG)=>{Object.defineProperty(iG,"__esModule",{value:!0});iG.AdobeSignConfigSerializer=void 0;iG.AdobeSignConfigSerializer={_fromJsonObject(u){return{clientId:u.clientId}},_toJsonObject(u){return{clientId:u.clientId}}}});var sG=z((pG)=>{Object.defineProperty(pG,"__esModule",{value:!0});pG.AirwallexConfigSerializer=void 0;pG.AirwallexConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var eG=z((tG)=>{Object.defineProperty(tG,"__esModule",{value:!0});tG.CheckbookConfigSerializer=void 0;tG.CheckbookConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var x8=z((uN)=>{Object.defineProperty(uN,"__esModule",{value:!0});uN.CronConfigSerializer=void 0;uN.CronConfigSerializer={_fromJsonObject(u){return{contentType:u.contentType,payload:u.payload,schedule:u.schedule}},_toJsonObject(u){return{contentType:u.contentType,payload:u.payload,schedule:u.schedule}}}});var FN=z((BN)=>{Object.defineProperty(BN,"__esModule",{value:!0});BN.DocusignConfigSerializer=void 0;BN.DocusignConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var NN=z((wN)=>{Object.defineProperty(wN,"__esModule",{value:!0});wN.EasypostConfigSerializer=void 0;wN.EasypostConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var ZN=z(($N)=>{Object.defineProperty($N,"__esModule",{value:!0});$N.GithubConfigSerializer=void 0;$N.GithubConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var vN=z((JN)=>{Object.defineProperty(JN,"__esModule",{value:!0});JN.HubspotConfigSerializer=void 0;JN.HubspotConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var WN=z((XN)=>{Object.defineProperty(XN,"__esModule",{value:!0});XN.MetaConfigSerializer=void 0;XN.MetaConfigSerializer={_fromJsonObject(u){return{secret:u.secret,verifyToken:u.verifyToken}},_toJsonObject(u){return{secret:u.secret,verifyToken:u.verifyToken}}}});var xN=z((KN)=>{Object.defineProperty(KN,"__esModule",{value:!0});KN.OrumIoConfigSerializer=void 0;KN.OrumIoConfigSerializer={_fromJsonObject(u){return{publicKey:u.publicKey}},_toJsonObject(u){return{publicKey:u.publicKey}}}});var RN=z((HN)=>{Object.defineProperty(HN,"__esModule",{value:!0});HN.PandaDocConfigSerializer=void 0;HN.PandaDocConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var LN=z((UN)=>{Object.defineProperty(UN,"__esModule",{value:!0});UN.PortIoConfigSerializer=void 0;UN.PortIoConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var CN=z((EN)=>{Object.defineProperty(EN,"__esModule",{value:!0});EN.RutterConfigSerializer=void 0;EN.RutterConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var VN=z((PN)=>{Object.defineProperty(PN,"__esModule",{value:!0});PN.SegmentConfigSerializer=void 0;PN.SegmentConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var TN=z((kN)=>{Object.defineProperty(kN,"__esModule",{value:!0});kN.ShopifyConfigSerializer=void 0;kN.ShopifyConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var mN=z((IN)=>{Object.defineProperty(IN,"__esModule",{value:!0});IN.SlackConfigSerializer=void 0;IN.SlackConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var fN=z((_N)=>{Object.defineProperty(_N,"__esModule",{value:!0});_N.StripeConfigSerializer=void 0;_N.StripeConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var lN=z((bN)=>{Object.defineProperty(bN,"__esModule",{value:!0});bN.SvixConfigSerializer=void 0;bN.SvixConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var rN=z((dN)=>{Object.defineProperty(dN,"__esModule",{value:!0});dN.TelnyxConfigSerializer=void 0;dN.TelnyxConfigSerializer={_fromJsonObject(u){return{publicKey:u.publicKey}},_toJsonObject(u){return{publicKey:u.publicKey}}}});var aN=z((nN)=>{Object.defineProperty(nN,"__esModule",{value:!0});nN.VapiConfigSerializer=void 0;nN.VapiConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var oN=z((sN)=>{Object.defineProperty(sN,"__esModule",{value:!0});sN.VeriffConfigSerializer=void 0;sN.VeriffConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var D$=z((eN)=>{Object.defineProperty(eN,"__esModule",{value:!0});eN.ZoomConfigSerializer=void 0;eN.ZoomConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var L$=z((U$)=>{Object.defineProperty(U$,"__esModule",{value:!0});U$.IngestSourceInSerializer=void 0;var B$=nG(),A$=sG(),F$=eG(),w$=x8(),G$=FN(),N$=NN(),$$=ZN(),z$=vN(),Z$=WN(),J$=xN(),Q$=RN(),v$=LN(),X$=CN(),Y$=VN(),W$=TN(),K$=mN(),h$=fN(),P=lN(),x$=rN(),H$=aN(),S$=oN(),R$=D$();U$.IngestSourceInSerializer={_fromJsonObject(u){let D=u.type;function B(A){switch(A){case"generic-webhook":return{};case"cron":return w$.CronConfigSerializer._fromJsonObject(u.config);case"adobe-sign":return B$.AdobeSignConfigSerializer._fromJsonObject(u.config);case"beehiiv":return P.SvixConfigSerializer._fromJsonObject(u.config);case"brex":return P.SvixConfigSerializer._fromJsonObject(u.config);case"checkbook":return F$.CheckbookConfigSerializer._fromJsonObject(u.config);case"clerk":return P.SvixConfigSerializer._fromJsonObject(u.config);case"docusign":return G$.DocusignConfigSerializer._fromJsonObject(u.config);case"easypost":return N$.EasypostConfigSerializer._fromJsonObject(u.config);case"github":return $$.GithubConfigSerializer._fromJsonObject(u.config);case"guesty":return P.SvixConfigSerializer._fromJsonObject(u.config);case"hubspot":return z$.HubspotConfigSerializer._fromJsonObject(u.config);case"incident-io":return P.SvixConfigSerializer._fromJsonObject(u.config);case"lithic":return P.SvixConfigSerializer._fromJsonObject(u.config);case"meta":return Z$.MetaConfigSerializer._fromJsonObject(u.config);case"nash":return P.SvixConfigSerializer._fromJsonObject(u.config);case"orum-io":return J$.OrumIoConfigSerializer._fromJsonObject(u.config);case"panda-doc":return Q$.PandaDocConfigSerializer._fromJsonObject(u.config);case"port-io":return v$.PortIoConfigSerializer._fromJsonObject(u.config);case"pleo":return P.SvixConfigSerializer._fromJsonObject(u.config);case"psi-fi":return P.SvixConfigSerializer._fromJsonObject(u.config);case"replicate":return P.SvixConfigSerializer._fromJsonObject(u.config);case"resend":return P.SvixConfigSerializer._fromJsonObject(u.config);case"rutter":return X$.RutterConfigSerializer._fromJsonObject(u.config);case"safebase":return P.SvixConfigSerializer._fromJsonObject(u.config);case"sardine":return P.SvixConfigSerializer._fromJsonObject(u.config);case"segment":return Y$.SegmentConfigSerializer._fromJsonObject(u.config);case"shopify":return W$.ShopifyConfigSerializer._fromJsonObject(u.config);case"slack":return K$.SlackConfigSerializer._fromJsonObject(u.config);case"stripe":return h$.StripeConfigSerializer._fromJsonObject(u.config);case"stych":return P.SvixConfigSerializer._fromJsonObject(u.config);case"svix":return P.SvixConfigSerializer._fromJsonObject(u.config);case"zoom":return R$.ZoomConfigSerializer._fromJsonObject(u.config);case"telnyx":return x$.TelnyxConfigSerializer._fromJsonObject(u.config);case"vapi":return H$.VapiConfigSerializer._fromJsonObject(u.config);case"open-ai":return P.SvixConfigSerializer._fromJsonObject(u.config);case"render":return P.SvixConfigSerializer._fromJsonObject(u.config);case"veriff":return S$.VeriffConfigSerializer._fromJsonObject(u.config);case"airwallex":return A$.AirwallexConfigSerializer._fromJsonObject(u.config);default:throw Error(`Unexpected type: ${A}`)}}return{type:D,config:B(D),metadata:u.metadata,name:u.name,uid:u.uid}},_toJsonObject(u){let D;switch(u.type){case"generic-webhook":D={};break;case"cron":D=w$.CronConfigSerializer._toJsonObject(u.config);break;case"adobe-sign":D=B$.AdobeSignConfigSerializer._toJsonObject(u.config);break;case"beehiiv":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"brex":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"checkbook":D=F$.CheckbookConfigSerializer._toJsonObject(u.config);break;case"clerk":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"docusign":D=G$.DocusignConfigSerializer._toJsonObject(u.config);break;case"easypost":D=N$.EasypostConfigSerializer._toJsonObject(u.config);break;case"github":D=$$.GithubConfigSerializer._toJsonObject(u.config);break;case"guesty":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"hubspot":D=z$.HubspotConfigSerializer._toJsonObject(u.config);break;case"incident-io":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"lithic":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"meta":D=Z$.MetaConfigSerializer._toJsonObject(u.config);break;case"nash":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"orum-io":D=J$.OrumIoConfigSerializer._toJsonObject(u.config);break;case"panda-doc":D=Q$.PandaDocConfigSerializer._toJsonObject(u.config);break;case"port-io":D=v$.PortIoConfigSerializer._toJsonObject(u.config);break;case"pleo":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"psi-fi":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"replicate":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"resend":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"rutter":D=X$.RutterConfigSerializer._toJsonObject(u.config);break;case"safebase":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"sardine":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"segment":D=Y$.SegmentConfigSerializer._toJsonObject(u.config);break;case"shopify":D=W$.ShopifyConfigSerializer._toJsonObject(u.config);break;case"slack":D=K$.SlackConfigSerializer._toJsonObject(u.config);break;case"stripe":D=h$.StripeConfigSerializer._toJsonObject(u.config);break;case"stych":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"svix":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"zoom":D=R$.ZoomConfigSerializer._toJsonObject(u.config);break;case"telnyx":D=x$.TelnyxConfigSerializer._toJsonObject(u.config);break;case"vapi":D=H$.VapiConfigSerializer._toJsonObject(u.config);break;case"open-ai":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"render":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"veriff":D=S$.VeriffConfigSerializer._toJsonObject(u.config);break;case"airwallex":D=A$.AirwallexConfigSerializer._toJsonObject(u.config);break}return{type:u.type,config:D,metadata:u.metadata,name:u.name,uid:u.uid}}}});var C$=z((E$)=>{Object.defineProperty(E$,"__esModule",{value:!0});E$.AdobeSignConfigOutSerializer=void 0;E$.AdobeSignConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var V$=z((P$)=>{Object.defineProperty(P$,"__esModule",{value:!0});P$.AirwallexConfigOutSerializer=void 0;P$.AirwallexConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var T$=z((k$)=>{Object.defineProperty(k$,"__esModule",{value:!0});k$.CheckbookConfigOutSerializer=void 0;k$.CheckbookConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var m$=z((I$)=>{Object.defineProperty(I$,"__esModule",{value:!0});I$.DocusignConfigOutSerializer=void 0;I$.DocusignConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var f$=z((_$)=>{Object.defineProperty(_$,"__esModule",{value:!0});_$.EasypostConfigOutSerializer=void 0;_$.EasypostConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var l$=z((b$)=>{Object.defineProperty(b$,"__esModule",{value:!0});b$.GithubConfigOutSerializer=void 0;b$.GithubConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var r$=z((d$)=>{Object.defineProperty(d$,"__esModule",{value:!0});d$.HubspotConfigOutSerializer=void 0;d$.HubspotConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var a$=z((n$)=>{Object.defineProperty(n$,"__esModule",{value:!0});n$.MetaConfigOutSerializer=void 0;n$.MetaConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var o$=z((s$)=>{Object.defineProperty(s$,"__esModule",{value:!0});s$.OrumIoConfigOutSerializer=void 0;s$.OrumIoConfigOutSerializer={_fromJsonObject(u){return{publicKey:u.publicKey}},_toJsonObject(u){return{publicKey:u.publicKey}}}});var Dz=z((e$)=>{Object.defineProperty(e$,"__esModule",{value:!0});e$.PandaDocConfigOutSerializer=void 0;e$.PandaDocConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var Fz=z((Bz)=>{Object.defineProperty(Bz,"__esModule",{value:!0});Bz.PortIoConfigOutSerializer=void 0;Bz.PortIoConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var Nz=z((wz)=>{Object.defineProperty(wz,"__esModule",{value:!0});wz.RutterConfigOutSerializer=void 0;wz.RutterConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var Zz=z(($z)=>{Object.defineProperty($z,"__esModule",{value:!0});$z.SegmentConfigOutSerializer=void 0;$z.SegmentConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var vz=z((Jz)=>{Object.defineProperty(Jz,"__esModule",{value:!0});Jz.ShopifyConfigOutSerializer=void 0;Jz.ShopifyConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var Wz=z((Xz)=>{Object.defineProperty(Xz,"__esModule",{value:!0});Xz.SlackConfigOutSerializer=void 0;Xz.SlackConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var xz=z((Kz)=>{Object.defineProperty(Kz,"__esModule",{value:!0});Kz.StripeConfigOutSerializer=void 0;Kz.StripeConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var Rz=z((Hz)=>{Object.defineProperty(Hz,"__esModule",{value:!0});Hz.SvixConfigOutSerializer=void 0;Hz.SvixConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var Lz=z((Uz)=>{Object.defineProperty(Uz,"__esModule",{value:!0});Uz.TelnyxConfigOutSerializer=void 0;Uz.TelnyxConfigOutSerializer={_fromJsonObject(u){return{publicKey:u.publicKey}},_toJsonObject(u){return{publicKey:u.publicKey}}}});var Cz=z((Ez)=>{Object.defineProperty(Ez,"__esModule",{value:!0});Ez.VapiConfigOutSerializer=void 0;Ez.VapiConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var Vz=z((Pz)=>{Object.defineProperty(Pz,"__esModule",{value:!0});Pz.VeriffConfigOutSerializer=void 0;Pz.VeriffConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var Tz=z((kz)=>{Object.defineProperty(kz,"__esModule",{value:!0});kz.ZoomConfigOutSerializer=void 0;kz.ZoomConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var H8=z((BZ)=>{Object.defineProperty(BZ,"__esModule",{value:!0});BZ.IngestSourceOutSerializer=void 0;var Iz=C$(),qz=V$(),mz=T$(),_z=x8(),gz=m$(),fz=f$(),bz=l$(),jz=r$(),lz=a$(),dz=o$(),iz=Dz(),rz=Fz(),nz=Nz(),pz=Zz(),az=vz(),sz=Wz(),tz=xz(),c=Rz(),oz=Lz(),ez=Cz(),uZ=Vz(),DZ=Tz();BZ.IngestSourceOutSerializer={_fromJsonObject(u){let D=u.type;function B(A){switch(A){case"generic-webhook":return{};case"cron":return _z.CronConfigSerializer._fromJsonObject(u.config);case"adobe-sign":return Iz.AdobeSignConfigOutSerializer._fromJsonObject(u.config);case"beehiiv":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"brex":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"checkbook":return mz.CheckbookConfigOutSerializer._fromJsonObject(u.config);case"clerk":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"docusign":return gz.DocusignConfigOutSerializer._fromJsonObject(u.config);case"easypost":return fz.EasypostConfigOutSerializer._fromJsonObject(u.config);case"github":return bz.GithubConfigOutSerializer._fromJsonObject(u.config);case"guesty":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"hubspot":return jz.HubspotConfigOutSerializer._fromJsonObject(u.config);case"incident-io":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"lithic":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"meta":return lz.MetaConfigOutSerializer._fromJsonObject(u.config);case"nash":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"orum-io":return dz.OrumIoConfigOutSerializer._fromJsonObject(u.config);case"panda-doc":return iz.PandaDocConfigOutSerializer._fromJsonObject(u.config);case"port-io":return rz.PortIoConfigOutSerializer._fromJsonObject(u.config);case"psi-fi":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"pleo":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"replicate":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"resend":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"rutter":return nz.RutterConfigOutSerializer._fromJsonObject(u.config);case"safebase":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"sardine":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"segment":return pz.SegmentConfigOutSerializer._fromJsonObject(u.config);case"shopify":return az.ShopifyConfigOutSerializer._fromJsonObject(u.config);case"slack":return sz.SlackConfigOutSerializer._fromJsonObject(u.config);case"stripe":return tz.StripeConfigOutSerializer._fromJsonObject(u.config);case"stych":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"svix":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"zoom":return DZ.ZoomConfigOutSerializer._fromJsonObject(u.config);case"telnyx":return oz.TelnyxConfigOutSerializer._fromJsonObject(u.config);case"vapi":return ez.VapiConfigOutSerializer._fromJsonObject(u.config);case"open-ai":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"render":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"veriff":return uZ.VeriffConfigOutSerializer._fromJsonObject(u.config);case"airwallex":return qz.AirwallexConfigOutSerializer._fromJsonObject(u.config);default:throw Error(`Unexpected type: ${A}`)}}return{type:D,config:B(D),createdAt:new Date(u.createdAt),id:u.id,ingestUrl:u.ingestUrl,metadata:u.metadata,name:u.name,uid:u.uid,updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){let D;switch(u.type){case"generic-webhook":D={};break;case"cron":D=_z.CronConfigSerializer._toJsonObject(u.config);break;case"adobe-sign":D=Iz.AdobeSignConfigOutSerializer._toJsonObject(u.config);break;case"beehiiv":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"brex":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"checkbook":D=mz.CheckbookConfigOutSerializer._toJsonObject(u.config);break;case"clerk":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"docusign":D=gz.DocusignConfigOutSerializer._toJsonObject(u.config);break;case"easypost":D=fz.EasypostConfigOutSerializer._toJsonObject(u.config);break;case"github":D=bz.GithubConfigOutSerializer._toJsonObject(u.config);break;case"guesty":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"hubspot":D=jz.HubspotConfigOutSerializer._toJsonObject(u.config);break;case"incident-io":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"lithic":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"meta":D=lz.MetaConfigOutSerializer._toJsonObject(u.config);break;case"nash":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"orum-io":D=dz.OrumIoConfigOutSerializer._toJsonObject(u.config);break;case"panda-doc":D=iz.PandaDocConfigOutSerializer._toJsonObject(u.config);break;case"port-io":D=rz.PortIoConfigOutSerializer._toJsonObject(u.config);break;case"psi-fi":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"pleo":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"replicate":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"resend":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"rutter":D=nz.RutterConfigOutSerializer._toJsonObject(u.config);break;case"safebase":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"sardine":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"segment":D=pz.SegmentConfigOutSerializer._toJsonObject(u.config);break;case"shopify":D=az.ShopifyConfigOutSerializer._toJsonObject(u.config);break;case"slack":D=sz.SlackConfigOutSerializer._toJsonObject(u.config);break;case"stripe":D=tz.StripeConfigOutSerializer._toJsonObject(u.config);break;case"stych":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"svix":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"zoom":D=DZ.ZoomConfigOutSerializer._toJsonObject(u.config);break;case"telnyx":D=oz.TelnyxConfigOutSerializer._toJsonObject(u.config);break;case"vapi":D=ez.VapiConfigOutSerializer._toJsonObject(u.config);break;case"open-ai":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"render":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"veriff":D=uZ.VeriffConfigOutSerializer._toJsonObject(u.config);break;case"airwallex":D=qz.AirwallexConfigOutSerializer._toJsonObject(u.config);break}return{type:u.type,config:D,createdAt:u.createdAt,id:u.id,ingestUrl:u.ingestUrl,metadata:u.metadata,name:u.name,uid:u.uid,updatedAt:u.updatedAt}}}});var NZ=z((wZ)=>{Object.defineProperty(wZ,"__esModule",{value:!0});wZ.ListResponseIngestSourceOutSerializer=void 0;var FZ=H8();wZ.ListResponseIngestSourceOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>FZ.IngestSourceOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>FZ.IngestSourceOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var ZZ=z(($Z)=>{Object.defineProperty($Z,"__esModule",{value:!0});$Z.RotateTokenOutSerializer=void 0;$Z.RotateTokenOutSerializer={_fromJsonObject(u){return{ingestUrl:u.ingestUrl}},_toJsonObject(u){return{ingestUrl:u.ingestUrl}}}});var YZ=z((vZ)=>{Object.defineProperty(vZ,"__esModule",{value:!0});vZ.IngestSource=void 0;var JZ=L$(),S8=H8(),AS=NZ(),FS=ZZ(),O2=_();class QZ{constructor(u){this.requestCtx=u}list(u){let D=new O2.SvixRequest(O2.HttpMethod.GET,"/ingest/api/v1/source");return D.setQueryParams({limit:u===null||u===void 0?void 0:u.limit,iterator:u===null||u===void 0?void 0:u.iterator,order:u===null||u===void 0?void 0:u.order}),D.send(this.requestCtx,AS.ListResponseIngestSourceOutSerializer._fromJsonObject)}create(u,D){let B=new O2.SvixRequest(O2.HttpMethod.POST,"/ingest/api/v1/source");return B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.setBody(JZ.IngestSourceInSerializer._toJsonObject(u)),B.send(this.requestCtx,S8.IngestSourceOutSerializer._fromJsonObject)}get(u){let D=new O2.SvixRequest(O2.HttpMethod.GET,"/ingest/api/v1/source/{source_id}");return D.setPathParam("source_id",u),D.send(this.requestCtx,S8.IngestSourceOutSerializer._fromJsonObject)}update(u,D){let B=new O2.SvixRequest(O2.HttpMethod.PUT,"/ingest/api/v1/source/{source_id}");return B.setPathParam("source_id",u),B.setBody(JZ.IngestSourceInSerializer._toJsonObject(D)),B.send(this.requestCtx,S8.IngestSourceOutSerializer._fromJsonObject)}delete(u){let D=new O2.SvixRequest(O2.HttpMethod.DELETE,"/ingest/api/v1/source/{source_id}");return D.setPathParam("source_id",u),D.sendNoResponseBody(this.requestCtx)}rotateToken(u,D){let B=new O2.SvixRequest(O2.HttpMethod.POST,"/ingest/api/v1/source/{source_id}/token/rotate");return B.setPathParam("source_id",u),B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.send(this.requestCtx,FS.RotateTokenOutSerializer._fromJsonObject)}}vZ.IngestSource=QZ});var HZ=z((hZ)=>{Object.defineProperty(hZ,"__esModule",{value:!0});hZ.Ingest=void 0;var wS=z8(),GS=ZG(),NS=dG(),$S=YZ(),WZ=_();class KZ{constructor(u){this.requestCtx=u}get endpoint(){return new NS.IngestEndpoint(this.requestCtx)}get source(){return new $S.IngestSource(this.requestCtx)}dashboard(u,D,B){let A=new WZ.SvixRequest(WZ.HttpMethod.POST,"/ingest/api/v1/source/{source_id}/dashboard");return A.setPathParam("source_id",u),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(GS.IngestSourceConsumerPortalAccessInSerializer._toJsonObject(D)),A.send(this.requestCtx,wS.DashboardAccessOutSerializer._fromJsonObject)}}hZ.Ingest=KZ});var UZ=z((SZ)=>{Object.defineProperty(SZ,"__esModule",{value:!0});SZ.IntegrationInSerializer=void 0;SZ.IntegrationInSerializer={_fromJsonObject(u){return{featureFlags:u.featureFlags,name:u.name}},_toJsonObject(u){return{featureFlags:u.featureFlags,name:u.name}}}});var EZ=z((MZ)=>{Object.defineProperty(MZ,"__esModule",{value:!0});MZ.IntegrationKeyOutSerializer=void 0;MZ.IntegrationKeyOutSerializer={_fromJsonObject(u){return{key:u.key}},_toJsonObject(u){return{key:u.key}}}});var R8=z((OZ)=>{Object.defineProperty(OZ,"__esModule",{value:!0});OZ.IntegrationOutSerializer=void 0;OZ.IntegrationOutSerializer={_fromJsonObject(u){return{createdAt:new Date(u.createdAt),featureFlags:u.featureFlags,id:u.id,name:u.name,updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){return{createdAt:u.createdAt,featureFlags:u.featureFlags,id:u.id,name:u.name,updatedAt:u.updatedAt}}}});var VZ=z((PZ)=>{Object.defineProperty(PZ,"__esModule",{value:!0});PZ.IntegrationUpdateSerializer=void 0;PZ.IntegrationUpdateSerializer={_fromJsonObject(u){return{featureFlags:u.featureFlags,name:u.name}},_toJsonObject(u){return{featureFlags:u.featureFlags,name:u.name}}}});var IZ=z((yZ)=>{Object.defineProperty(yZ,"__esModule",{value:!0});yZ.ListResponseIntegrationOutSerializer=void 0;var kZ=R8();yZ.ListResponseIntegrationOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>kZ.IntegrationOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>kZ.IntegrationOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var fZ=z((_Z)=>{Object.defineProperty(_Z,"__esModule",{value:!0});_Z.Integration=void 0;var zS=UZ(),qZ=EZ(),U8=R8(),ZS=VZ(),JS=IZ(),X2=_();class mZ{constructor(u){this.requestCtx=u}list(u,D){let B=new X2.SvixRequest(X2.HttpMethod.GET,"/api/v1/app/{app_id}/integration");return B.setPathParam("app_id",u),B.setQueryParams({limit:D===null||D===void 0?void 0:D.limit,iterator:D===null||D===void 0?void 0:D.iterator,order:D===null||D===void 0?void 0:D.order}),B.send(this.requestCtx,JS.ListResponseIntegrationOutSerializer._fromJsonObject)}create(u,D,B){let A=new X2.SvixRequest(X2.HttpMethod.POST,"/api/v1/app/{app_id}/integration");return A.setPathParam("app_id",u),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(zS.IntegrationInSerializer._toJsonObject(D)),A.send(this.requestCtx,U8.IntegrationOutSerializer._fromJsonObject)}get(u,D){let B=new X2.SvixRequest(X2.HttpMethod.GET,"/api/v1/app/{app_id}/integration/{integ_id}");return B.setPathParam("app_id",u),B.setPathParam("integ_id",D),B.send(this.requestCtx,U8.IntegrationOutSerializer._fromJsonObject)}update(u,D,B){let A=new X2.SvixRequest(X2.HttpMethod.PUT,"/api/v1/app/{app_id}/integration/{integ_id}");return A.setPathParam("app_id",u),A.setPathParam("integ_id",D),A.setBody(ZS.IntegrationUpdateSerializer._toJsonObject(B)),A.send(this.requestCtx,U8.IntegrationOutSerializer._fromJsonObject)}delete(u,D){let B=new X2.SvixRequest(X2.HttpMethod.DELETE,"/api/v1/app/{app_id}/integration/{integ_id}");return B.setPathParam("app_id",u),B.setPathParam("integ_id",D),B.sendNoResponseBody(this.requestCtx)}getKey(u,D){let B=new X2.SvixRequest(X2.HttpMethod.GET,"/api/v1/app/{app_id}/integration/{integ_id}/key");return B.setPathParam("app_id",u),B.setPathParam("integ_id",D),B.send(this.requestCtx,qZ.IntegrationKeyOutSerializer._fromJsonObject)}rotateKey(u,D,B){let A=new X2.SvixRequest(X2.HttpMethod.POST,"/api/v1/app/{app_id}/integration/{integ_id}/key/rotate");return A.setPathParam("app_id",u),A.setPathParam("integ_id",D),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.send(this.requestCtx,qZ.IntegrationKeyOutSerializer._fromJsonObject)}}_Z.Integration=mZ});var iZ=z((lZ)=>{Object.defineProperty(lZ,"__esModule",{value:!0});lZ.ExpungeAllContentsOutSerializer=void 0;var bZ=e2(),jZ=u0();lZ.ExpungeAllContentsOutSerializer={_fromJsonObject(u){return{id:u.id,status:bZ.BackgroundTaskStatusSerializer._fromJsonObject(u.status),task:jZ.BackgroundTaskTypeSerializer._fromJsonObject(u.task),updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){return{id:u.id,status:bZ.BackgroundTaskStatusSerializer._toJsonObject(u.status),task:jZ.BackgroundTaskTypeSerializer._toJsonObject(u.task),updatedAt:u.updatedAt}}}});var aZ=z((nZ)=>{Object.defineProperty(nZ,"__esModule",{value:!0});nZ.ListResponseMessageOutSerializer=void 0;var rZ=Cu();nZ.ListResponseMessageOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>rZ.MessageOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>rZ.MessageOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var oZ=z((sZ)=>{Object.defineProperty(sZ,"__esModule",{value:!0});sZ.MessagePrecheckInSerializer=void 0;sZ.MessagePrecheckInSerializer={_fromJsonObject(u){return{channels:u.channels,eventType:u.eventType}},_toJsonObject(u){return{channels:u.channels,eventType:u.eventType}}}});var DJ=z((eZ)=>{Object.defineProperty(eZ,"__esModule",{value:!0});eZ.MessagePrecheckOutSerializer=void 0;eZ.MessagePrecheckOutSerializer={_fromJsonObject(u){return{active:u.active}},_toJsonObject(u){return{active:u.active}}}});var FJ=z((BJ)=>{Object.defineProperty(BJ,"__esModule",{value:!0});BJ.PollingEndpointConsumerSeekInSerializer=void 0;BJ.PollingEndpointConsumerSeekInSerializer={_fromJsonObject(u){return{after:new Date(u.after)}},_toJsonObject(u){return{after:u.after}}}});var NJ=z((wJ)=>{Object.defineProperty(wJ,"__esModule",{value:!0});wJ.PollingEndpointConsumerSeekOutSerializer=void 0;wJ.PollingEndpointConsumerSeekOutSerializer={_fromJsonObject(u){return{iterator:u.iterator}},_toJsonObject(u){return{iterator:u.iterator}}}});var ZJ=z(($J)=>{Object.defineProperty($J,"__esModule",{value:!0});$J.PollingEndpointMessageOutSerializer=void 0;$J.PollingEndpointMessageOutSerializer={_fromJsonObject(u){return{channels:u.channels,deliverAt:u.deliverAt?new Date(u.deliverAt):null,eventId:u.eventId,eventType:u.eventType,headers:u.headers,id:u.id,payload:u.payload,tags:u.tags,timestamp:new Date(u.timestamp)}},_toJsonObject(u){return{channels:u.channels,deliverAt:u.deliverAt,eventId:u.eventId,eventType:u.eventType,headers:u.headers,id:u.id,payload:u.payload,tags:u.tags,timestamp:u.timestamp}}}});var XJ=z((QJ)=>{Object.defineProperty(QJ,"__esModule",{value:!0});QJ.PollingEndpointOutSerializer=void 0;var JJ=ZJ();QJ.PollingEndpointOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>JJ.PollingEndpointMessageOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator}},_toJsonObject(u){return{data:u.data.map((D)=>JJ.PollingEndpointMessageOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator}}}});var xJ=z((KJ)=>{Object.defineProperty(KJ,"__esModule",{value:!0});KJ.MessagePoller=void 0;var QS=FJ(),vS=NJ(),YJ=XJ(),_0=_();class WJ{constructor(u){this.requestCtx=u}poll(u,D,B){let A=new _0.SvixRequest(_0.HttpMethod.GET,"/api/v1/app/{app_id}/poller/{sink_id}");return A.setPathParam("app_id",u),A.setPathParam("sink_id",D),A.setQueryParams({limit:B===null||B===void 0?void 0:B.limit,iterator:B===null||B===void 0?void 0:B.iterator,event_type:B===null||B===void 0?void 0:B.eventType,channel:B===null||B===void 0?void 0:B.channel,after:B===null||B===void 0?void 0:B.after}),A.send(this.requestCtx,YJ.PollingEndpointOutSerializer._fromJsonObject)}consumerPoll(u,D,B,A){let F=new _0.SvixRequest(_0.HttpMethod.GET,"/api/v1/app/{app_id}/poller/{sink_id}/consumer/{consumer_id}");return F.setPathParam("app_id",u),F.setPathParam("sink_id",D),F.setPathParam("consumer_id",B),F.setQueryParams({limit:A===null||A===void 0?void 0:A.limit,iterator:A===null||A===void 0?void 0:A.iterator}),F.send(this.requestCtx,YJ.PollingEndpointOutSerializer._fromJsonObject)}consumerSeek(u,D,B,A,F){let w=new _0.SvixRequest(_0.HttpMethod.POST,"/api/v1/app/{app_id}/poller/{sink_id}/consumer/{consumer_id}/seek");return w.setPathParam("app_id",u),w.setPathParam("sink_id",D),w.setPathParam("consumer_id",B),w.setHeaderParam("idempotency-key",F===null||F===void 0?void 0:F.idempotencyKey),w.setBody(QS.PollingEndpointConsumerSeekInSerializer._toJsonObject(A)),w.send(this.requestCtx,vS.PollingEndpointConsumerSeekOutSerializer._fromJsonObject)}}KJ.MessagePoller=WJ});var UJ=z((SJ)=>{Object.defineProperty(SJ,"__esModule",{value:!0});SJ.MessageInSerializer=void 0;var HJ=u3();SJ.MessageInSerializer={_fromJsonObject(u){return{application:u.application!=null?HJ.ApplicationInSerializer._fromJsonObject(u.application):void 0,channels:u.channels,deliverAt:u.deliverAt?new Date(u.deliverAt):null,eventId:u.eventId,eventType:u.eventType,payload:u.payload,payloadRetentionHours:u.payloadRetentionHours,payloadRetentionPeriod:u.payloadRetentionPeriod,tags:u.tags,transformationsParams:u.transformationsParams}},_toJsonObject(u){return{application:u.application!=null?HJ.ApplicationInSerializer._toJsonObject(u.application):void 0,channels:u.channels,deliverAt:u.deliverAt,eventId:u.eventId,eventType:u.eventType,payload:u.payload,payloadRetentionHours:u.payloadRetentionHours,payloadRetentionPeriod:u.payloadRetentionPeriod,tags:u.tags,transformationsParams:u.transformationsParams}}}});var M8=z((EJ)=>{Object.defineProperty(EJ,"__esModule",{value:!0});EJ.messageInRaw=EJ.Message=void 0;var XS=iZ(),YS=aZ(),MJ=Cu(),WS=oZ(),KS=DJ(),hS=xJ(),C2=_(),xS=UJ();class LJ{constructor(u){this.requestCtx=u}get poller(){return new hS.MessagePoller(this.requestCtx)}list(u,D){let B=new C2.SvixRequest(C2.HttpMethod.GET,"/api/v1/app/{app_id}/msg");return B.setPathParam("app_id",u),B.setQueryParams({limit:D===null||D===void 0?void 0:D.limit,iterator:D===null||D===void 0?void 0:D.iterator,channel:D===null||D===void 0?void 0:D.channel,before:D===null||D===void 0?void 0:D.before,after:D===null||D===void 0?void 0:D.after,with_content:D===null||D===void 0?void 0:D.withContent,tag:D===null||D===void 0?void 0:D.tag,event_types:D===null||D===void 0?void 0:D.eventTypes}),B.send(this.requestCtx,YS.ListResponseMessageOutSerializer._fromJsonObject)}create(u,D,B){let A=new C2.SvixRequest(C2.HttpMethod.POST,"/api/v1/app/{app_id}/msg");return A.setPathParam("app_id",u),A.setQueryParams({with_content:B===null||B===void 0?void 0:B.withContent}),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(xS.MessageInSerializer._toJsonObject(D)),A.send(this.requestCtx,MJ.MessageOutSerializer._fromJsonObject)}expungeAllContents(u,D){let B=new C2.SvixRequest(C2.HttpMethod.POST,"/api/v1/app/{app_id}/msg/expunge-all-contents");return B.setPathParam("app_id",u),B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.send(this.requestCtx,XS.ExpungeAllContentsOutSerializer._fromJsonObject)}precheck(u,D,B){let A=new C2.SvixRequest(C2.HttpMethod.POST,"/api/v1/app/{app_id}/msg/precheck/active");return A.setPathParam("app_id",u),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(WS.MessagePrecheckInSerializer._toJsonObject(D)),A.send(this.requestCtx,KS.MessagePrecheckOutSerializer._fromJsonObject)}get(u,D,B){let A=new C2.SvixRequest(C2.HttpMethod.GET,"/api/v1/app/{app_id}/msg/{msg_id}");return A.setPathParam("app_id",u),A.setPathParam("msg_id",D),A.setQueryParams({with_content:B===null||B===void 0?void 0:B.withContent}),A.send(this.requestCtx,MJ.MessageOutSerializer._fromJsonObject)}expungeContent(u,D){let B=new C2.SvixRequest(C2.HttpMethod.DELETE,"/api/v1/app/{app_id}/msg/{msg_id}/content");return B.setPathParam("app_id",u),B.setPathParam("msg_id",D),B.sendNoResponseBody(this.requestCtx)}}EJ.Message=LJ;function HS(u,D,B){return{eventType:u,payload:{},transformationsParams:{rawPayload:D,headers:B?{"content-type":B}:void 0}}}EJ.messageInRaw=HS});var L8=z((CJ)=>{Object.defineProperty(CJ,"__esModule",{value:!0});CJ.EmptyResponseSerializer=void 0;CJ.EmptyResponseSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var Pu=z((VJ)=>{Object.defineProperty(VJ,"__esModule",{value:!0});VJ.MessageStatusTextSerializer=VJ.MessageStatusText=void 0;var RS;(function(u){u.Success="success",u.Pending="pending",u.Fail="fail",u.Sending="sending"})(RS=VJ.MessageStatusText||(VJ.MessageStatusText={}));VJ.MessageStatusTextSerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var mJ=z((IJ)=>{Object.defineProperty(IJ,"__esModule",{value:!0});IJ.EndpointMessageOutSerializer=void 0;var yJ=m0(),TJ=Pu();IJ.EndpointMessageOutSerializer={_fromJsonObject(u){return{channels:u.channels,deliverAt:u.deliverAt?new Date(u.deliverAt):null,eventId:u.eventId,eventType:u.eventType,id:u.id,nextAttempt:u.nextAttempt?new Date(u.nextAttempt):null,payload:u.payload,status:yJ.MessageStatusSerializer._fromJsonObject(u.status),statusText:TJ.MessageStatusTextSerializer._fromJsonObject(u.statusText),tags:u.tags,timestamp:new Date(u.timestamp)}},_toJsonObject(u){return{channels:u.channels,deliverAt:u.deliverAt,eventId:u.eventId,eventType:u.eventType,id:u.id,nextAttempt:u.nextAttempt,payload:u.payload,status:yJ.MessageStatusSerializer._toJsonObject(u.status),statusText:TJ.MessageStatusTextSerializer._toJsonObject(u.statusText),tags:u.tags,timestamp:u.timestamp}}}});var bJ=z((gJ)=>{Object.defineProperty(gJ,"__esModule",{value:!0});gJ.ListResponseEndpointMessageOutSerializer=void 0;var _J=mJ();gJ.ListResponseEndpointMessageOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>_J.EndpointMessageOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>_J.EndpointMessageOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var E8=z((lJ)=>{Object.defineProperty(lJ,"__esModule",{value:!0});lJ.MessageAttemptTriggerTypeSerializer=lJ.MessageAttemptTriggerType=void 0;var US;(function(u){u[u.Scheduled=0]="Scheduled",u[u.Manual=1]="Manual"})(US=lJ.MessageAttemptTriggerType||(lJ.MessageAttemptTriggerType={}));lJ.MessageAttemptTriggerTypeSerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var O8=z((aJ)=>{Object.defineProperty(aJ,"__esModule",{value:!0});aJ.MessageAttemptOutSerializer=void 0;var iJ=E8(),rJ=Cu(),nJ=m0(),pJ=Pu();aJ.MessageAttemptOutSerializer={_fromJsonObject(u){return{endpointId:u.endpointId,id:u.id,msg:u.msg!=null?rJ.MessageOutSerializer._fromJsonObject(u.msg):void 0,msgId:u.msgId,response:u.response,responseDurationMs:u.responseDurationMs,responseStatusCode:u.responseStatusCode,status:nJ.MessageStatusSerializer._fromJsonObject(u.status),statusText:pJ.MessageStatusTextSerializer._fromJsonObject(u.statusText),timestamp:new Date(u.timestamp),triggerType:iJ.MessageAttemptTriggerTypeSerializer._fromJsonObject(u.triggerType),url:u.url}},_toJsonObject(u){return{endpointId:u.endpointId,id:u.id,msg:u.msg!=null?rJ.MessageOutSerializer._toJsonObject(u.msg):void 0,msgId:u.msgId,response:u.response,responseDurationMs:u.responseDurationMs,responseStatusCode:u.responseStatusCode,status:nJ.MessageStatusSerializer._toJsonObject(u.status),statusText:pJ.MessageStatusTextSerializer._toJsonObject(u.statusText),timestamp:u.timestamp,triggerType:iJ.MessageAttemptTriggerTypeSerializer._toJsonObject(u.triggerType),url:u.url}}}});var uQ=z((oJ)=>{Object.defineProperty(oJ,"__esModule",{value:!0});oJ.ListResponseMessageAttemptOutSerializer=void 0;var tJ=O8();oJ.ListResponseMessageAttemptOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>tJ.MessageAttemptOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>tJ.MessageAttemptOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var wQ=z((AQ)=>{Object.defineProperty(AQ,"__esModule",{value:!0});AQ.MessageEndpointOutSerializer=void 0;var DQ=m0(),BQ=Pu();AQ.MessageEndpointOutSerializer={_fromJsonObject(u){return{channels:u.channels,createdAt:new Date(u.createdAt),description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,id:u.id,nextAttempt:u.nextAttempt?new Date(u.nextAttempt):null,rateLimit:u.rateLimit,status:DQ.MessageStatusSerializer._fromJsonObject(u.status),statusText:BQ.MessageStatusTextSerializer._fromJsonObject(u.statusText),throttleRate:u.throttleRate,uid:u.uid,updatedAt:new Date(u.updatedAt),url:u.url,version:u.version}},_toJsonObject(u){return{channels:u.channels,createdAt:u.createdAt,description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,id:u.id,nextAttempt:u.nextAttempt,rateLimit:u.rateLimit,status:DQ.MessageStatusSerializer._toJsonObject(u.status),statusText:BQ.MessageStatusTextSerializer._toJsonObject(u.statusText),throttleRate:u.throttleRate,uid:u.uid,updatedAt:u.updatedAt,url:u.url,version:u.version}}}});var zQ=z((NQ)=>{Object.defineProperty(NQ,"__esModule",{value:!0});NQ.ListResponseMessageEndpointOutSerializer=void 0;var GQ=wQ();NQ.ListResponseMessageEndpointOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>GQ.MessageEndpointOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>GQ.MessageEndpointOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var XQ=z((QQ)=>{Object.defineProperty(QQ,"__esModule",{value:!0});QQ.MessageAttempt=void 0;var MS=L8(),LS=bJ(),ZQ=uQ(),ES=zQ(),OS=O8(),Y2=_();class JQ{constructor(u){this.requestCtx=u}listByEndpoint(u,D,B){let A=new Y2.SvixRequest(Y2.HttpMethod.GET,"/api/v1/app/{app_id}/attempt/endpoint/{endpoint_id}");return A.setPathParam("app_id",u),A.setPathParam("endpoint_id",D),A.setQueryParams({limit:B===null||B===void 0?void 0:B.limit,iterator:B===null||B===void 0?void 0:B.iterator,status:B===null||B===void 0?void 0:B.status,status_code_class:B===null||B===void 0?void 0:B.statusCodeClass,channel:B===null||B===void 0?void 0:B.channel,tag:B===null||B===void 0?void 0:B.tag,before:B===null||B===void 0?void 0:B.before,after:B===null||B===void 0?void 0:B.after,with_content:B===null||B===void 0?void 0:B.withContent,with_msg:B===null||B===void 0?void 0:B.withMsg,event_types:B===null||B===void 0?void 0:B.eventTypes}),A.send(this.requestCtx,ZQ.ListResponseMessageAttemptOutSerializer._fromJsonObject)}listByMsg(u,D,B){let A=new Y2.SvixRequest(Y2.HttpMethod.GET,"/api/v1/app/{app_id}/attempt/msg/{msg_id}");return A.setPathParam("app_id",u),A.setPathParam("msg_id",D),A.setQueryParams({limit:B===null||B===void 0?void 0:B.limit,iterator:B===null||B===void 0?void 0:B.iterator,status:B===null||B===void 0?void 0:B.status,status_code_class:B===null||B===void 0?void 0:B.statusCodeClass,channel:B===null||B===void 0?void 0:B.channel,tag:B===null||B===void 0?void 0:B.tag,endpoint_id:B===null||B===void 0?void 0:B.endpointId,before:B===null||B===void 0?void 0:B.before,after:B===null||B===void 0?void 0:B.after,with_content:B===null||B===void 0?void 0:B.withContent,event_types:B===null||B===void 0?void 0:B.eventTypes}),A.send(this.requestCtx,ZQ.ListResponseMessageAttemptOutSerializer._fromJsonObject)}listAttemptedMessages(u,D,B){let A=new Y2.SvixRequest(Y2.HttpMethod.GET,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/msg");return A.setPathParam("app_id",u),A.setPathParam("endpoint_id",D),A.setQueryParams({limit:B===null||B===void 0?void 0:B.limit,iterator:B===null||B===void 0?void 0:B.iterator,channel:B===null||B===void 0?void 0:B.channel,tag:B===null||B===void 0?void 0:B.tag,status:B===null||B===void 0?void 0:B.status,before:B===null||B===void 0?void 0:B.before,after:B===null||B===void 0?void 0:B.after,with_content:B===null||B===void 0?void 0:B.withContent,event_types:B===null||B===void 0?void 0:B.eventTypes}),A.send(this.requestCtx,LS.ListResponseEndpointMessageOutSerializer._fromJsonObject)}get(u,D,B){let A=new Y2.SvixRequest(Y2.HttpMethod.GET,"/api/v1/app/{app_id}/msg/{msg_id}/attempt/{attempt_id}");return A.setPathParam("app_id",u),A.setPathParam("msg_id",D),A.setPathParam("attempt_id",B),A.send(this.requestCtx,OS.MessageAttemptOutSerializer._fromJsonObject)}expungeContent(u,D,B){let A=new Y2.SvixRequest(Y2.HttpMethod.DELETE,"/api/v1/app/{app_id}/msg/{msg_id}/attempt/{attempt_id}/content");return A.setPathParam("app_id",u),A.setPathParam("msg_id",D),A.setPathParam("attempt_id",B),A.sendNoResponseBody(this.requestCtx)}listAttemptedDestinations(u,D,B){let A=new Y2.SvixRequest(Y2.HttpMethod.GET,"/api/v1/app/{app_id}/msg/{msg_id}/endpoint");return A.setPathParam("app_id",u),A.setPathParam("msg_id",D),A.setQueryParams({limit:B===null||B===void 0?void 0:B.limit,iterator:B===null||B===void 0?void 0:B.iterator}),A.send(this.requestCtx,ES.ListResponseMessageEndpointOutSerializer._fromJsonObject)}resend(u,D,B,A){let F=new Y2.SvixRequest(Y2.HttpMethod.POST,"/api/v1/app/{app_id}/msg/{msg_id}/endpoint/{endpoint_id}/resend");return F.setPathParam("app_id",u),F.setPathParam("msg_id",D),F.setPathParam("endpoint_id",B),F.setHeaderParam("idempotency-key",A===null||A===void 0?void 0:A.idempotencyKey),F.send(this.requestCtx,MS.EmptyResponseSerializer._fromJsonObject)}}QQ.MessageAttempt=JQ});var C8=z((YQ)=>{Object.defineProperty(YQ,"__esModule",{value:!0});YQ.OperationalWebhookEndpointOutSerializer=void 0;YQ.OperationalWebhookEndpointOutSerializer={_fromJsonObject(u){return{createdAt:new Date(u.createdAt),description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,id:u.id,metadata:u.metadata,rateLimit:u.rateLimit,uid:u.uid,updatedAt:new Date(u.updatedAt),url:u.url}},_toJsonObject(u){return{createdAt:u.createdAt,description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,id:u.id,metadata:u.metadata,rateLimit:u.rateLimit,uid:u.uid,updatedAt:u.updatedAt,url:u.url}}}});var HQ=z((hQ)=>{Object.defineProperty(hQ,"__esModule",{value:!0});hQ.ListResponseOperationalWebhookEndpointOutSerializer=void 0;var KQ=C8();hQ.ListResponseOperationalWebhookEndpointOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>KQ.OperationalWebhookEndpointOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>KQ.OperationalWebhookEndpointOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var UQ=z((SQ)=>{Object.defineProperty(SQ,"__esModule",{value:!0});SQ.OperationalWebhookEndpointHeadersInSerializer=void 0;SQ.OperationalWebhookEndpointHeadersInSerializer={_fromJsonObject(u){return{headers:u.headers}},_toJsonObject(u){return{headers:u.headers}}}});var EQ=z((MQ)=>{Object.defineProperty(MQ,"__esModule",{value:!0});MQ.OperationalWebhookEndpointHeadersOutSerializer=void 0;MQ.OperationalWebhookEndpointHeadersOutSerializer={_fromJsonObject(u){return{headers:u.headers,sensitive:u.sensitive}},_toJsonObject(u){return{headers:u.headers,sensitive:u.sensitive}}}});var PQ=z((OQ)=>{Object.defineProperty(OQ,"__esModule",{value:!0});OQ.OperationalWebhookEndpointInSerializer=void 0;OQ.OperationalWebhookEndpointInSerializer={_fromJsonObject(u){return{description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,metadata:u.metadata,rateLimit:u.rateLimit,secret:u.secret,uid:u.uid,url:u.url}},_toJsonObject(u){return{description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,metadata:u.metadata,rateLimit:u.rateLimit,secret:u.secret,uid:u.uid,url:u.url}}}});var kQ=z((cQ)=>{Object.defineProperty(cQ,"__esModule",{value:!0});cQ.OperationalWebhookEndpointSecretInSerializer=void 0;cQ.OperationalWebhookEndpointSecretInSerializer={_fromJsonObject(u){return{key:u.key}},_toJsonObject(u){return{key:u.key}}}});var IQ=z((yQ)=>{Object.defineProperty(yQ,"__esModule",{value:!0});yQ.OperationalWebhookEndpointSecretOutSerializer=void 0;yQ.OperationalWebhookEndpointSecretOutSerializer={_fromJsonObject(u){return{key:u.key}},_toJsonObject(u){return{key:u.key}}}});var _Q=z((qQ)=>{Object.defineProperty(qQ,"__esModule",{value:!0});qQ.OperationalWebhookEndpointUpdateSerializer=void 0;qQ.OperationalWebhookEndpointUpdateSerializer={_fromJsonObject(u){return{description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,metadata:u.metadata,rateLimit:u.rateLimit,uid:u.uid,url:u.url}},_toJsonObject(u){return{description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,metadata:u.metadata,rateLimit:u.rateLimit,uid:u.uid,url:u.url}}}});var c8=z((fQ)=>{Object.defineProperty(fQ,"__esModule",{value:!0});fQ.OperationalWebhookEndpoint=void 0;var CS=HQ(),PS=UQ(),cS=EQ(),VS=PQ(),P8=C8(),kS=kQ(),yS=IQ(),TS=_Q(),D2=_();class gQ{constructor(u){this.requestCtx=u}list(u){let D=new D2.SvixRequest(D2.HttpMethod.GET,"/api/v1/operational-webhook/endpoint");return D.setQueryParams({limit:u===null||u===void 0?void 0:u.limit,iterator:u===null||u===void 0?void 0:u.iterator,order:u===null||u===void 0?void 0:u.order}),D.send(this.requestCtx,CS.ListResponseOperationalWebhookEndpointOutSerializer._fromJsonObject)}create(u,D){let B=new D2.SvixRequest(D2.HttpMethod.POST,"/api/v1/operational-webhook/endpoint");return B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.setBody(VS.OperationalWebhookEndpointInSerializer._toJsonObject(u)),B.send(this.requestCtx,P8.OperationalWebhookEndpointOutSerializer._fromJsonObject)}get(u){let D=new D2.SvixRequest(D2.HttpMethod.GET,"/api/v1/operational-webhook/endpoint/{endpoint_id}");return D.setPathParam("endpoint_id",u),D.send(this.requestCtx,P8.OperationalWebhookEndpointOutSerializer._fromJsonObject)}update(u,D){let B=new D2.SvixRequest(D2.HttpMethod.PUT,"/api/v1/operational-webhook/endpoint/{endpoint_id}");return B.setPathParam("endpoint_id",u),B.setBody(TS.OperationalWebhookEndpointUpdateSerializer._toJsonObject(D)),B.send(this.requestCtx,P8.OperationalWebhookEndpointOutSerializer._fromJsonObject)}delete(u){let D=new D2.SvixRequest(D2.HttpMethod.DELETE,"/api/v1/operational-webhook/endpoint/{endpoint_id}");return D.setPathParam("endpoint_id",u),D.sendNoResponseBody(this.requestCtx)}getHeaders(u){let D=new D2.SvixRequest(D2.HttpMethod.GET,"/api/v1/operational-webhook/endpoint/{endpoint_id}/headers");return D.setPathParam("endpoint_id",u),D.send(this.requestCtx,cS.OperationalWebhookEndpointHeadersOutSerializer._fromJsonObject)}updateHeaders(u,D){let B=new D2.SvixRequest(D2.HttpMethod.PUT,"/api/v1/operational-webhook/endpoint/{endpoint_id}/headers");return B.setPathParam("endpoint_id",u),B.setBody(PS.OperationalWebhookEndpointHeadersInSerializer._toJsonObject(D)),B.sendNoResponseBody(this.requestCtx)}getSecret(u){let D=new D2.SvixRequest(D2.HttpMethod.GET,"/api/v1/operational-webhook/endpoint/{endpoint_id}/secret");return D.setPathParam("endpoint_id",u),D.send(this.requestCtx,yS.OperationalWebhookEndpointSecretOutSerializer._fromJsonObject)}rotateSecret(u,D,B){let A=new D2.SvixRequest(D2.HttpMethod.POST,"/api/v1/operational-webhook/endpoint/{endpoint_id}/secret/rotate");return A.setPathParam("endpoint_id",u),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(kS.OperationalWebhookEndpointSecretInSerializer._toJsonObject(D)),A.sendNoResponseBody(this.requestCtx)}}fQ.OperationalWebhookEndpoint=gQ});var iQ=z((lQ)=>{Object.defineProperty(lQ,"__esModule",{value:!0});lQ.OperationalWebhook=void 0;var IS=c8();class jQ{constructor(u){this.requestCtx=u}get endpoint(){return new IS.OperationalWebhookEndpoint(this.requestCtx)}}lQ.OperationalWebhook=jQ});var sQ=z((pQ)=>{Object.defineProperty(pQ,"__esModule",{value:!0});pQ.AggregateEventTypesOutSerializer=void 0;var rQ=e2(),nQ=u0();pQ.AggregateEventTypesOutSerializer={_fromJsonObject(u){return{id:u.id,status:rQ.BackgroundTaskStatusSerializer._fromJsonObject(u.status),task:nQ.BackgroundTaskTypeSerializer._fromJsonObject(u.task),updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){return{id:u.id,status:rQ.BackgroundTaskStatusSerializer._toJsonObject(u.status),task:nQ.BackgroundTaskTypeSerializer._toJsonObject(u.task),updatedAt:u.updatedAt}}}});var eQ=z((tQ)=>{Object.defineProperty(tQ,"__esModule",{value:!0});tQ.AppUsageStatsInSerializer=void 0;tQ.AppUsageStatsInSerializer={_fromJsonObject(u){return{appIds:u.appIds,since:new Date(u.since),until:new Date(u.until)}},_toJsonObject(u){return{appIds:u.appIds,since:u.since,until:u.until}}}});var Fv=z((Bv)=>{Object.defineProperty(Bv,"__esModule",{value:!0});Bv.AppUsageStatsOutSerializer=void 0;var uv=e2(),Dv=u0();Bv.AppUsageStatsOutSerializer={_fromJsonObject(u){return{id:u.id,status:uv.BackgroundTaskStatusSerializer._fromJsonObject(u.status),task:Dv.BackgroundTaskTypeSerializer._fromJsonObject(u.task),unresolvedAppIds:u.unresolvedAppIds,updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){return{id:u.id,status:uv.BackgroundTaskStatusSerializer._toJsonObject(u.status),task:Dv.BackgroundTaskTypeSerializer._toJsonObject(u.task),unresolvedAppIds:u.unresolvedAppIds,updatedAt:u.updatedAt}}}});var $v=z((Gv)=>{Object.defineProperty(Gv,"__esModule",{value:!0});Gv.Statistics=void 0;var qS=sQ(),mS=eQ(),_S=Fv(),z3=_();class wv{constructor(u){this.requestCtx=u}aggregateAppStats(u,D){let B=new z3.SvixRequest(z3.HttpMethod.POST,"/api/v1/stats/usage/app");return B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.setBody(mS.AppUsageStatsInSerializer._toJsonObject(u)),B.send(this.requestCtx,_S.AppUsageStatsOutSerializer._fromJsonObject)}aggregateEventTypes(){return new z3.SvixRequest(z3.HttpMethod.PUT,"/api/v1/stats/usage/event-types").send(this.requestCtx,qS.AggregateEventTypesOutSerializer._fromJsonObject)}}Gv.Statistics=wv});var Jv=z((zv)=>{Object.defineProperty(zv,"__esModule",{value:!0});zv.HttpSinkHeadersPatchInSerializer=void 0;zv.HttpSinkHeadersPatchInSerializer={_fromJsonObject(u){return{headers:u.headers}},_toJsonObject(u){return{headers:u.headers}}}});var Xv=z((Qv)=>{Object.defineProperty(Qv,"__esModule",{value:!0});Qv.SinkTransformationOutSerializer=void 0;Qv.SinkTransformationOutSerializer={_fromJsonObject(u){return{code:u.code,enabled:u.enabled}},_toJsonObject(u){return{code:u.code,enabled:u.enabled}}}});var V8=z((Yv)=>{Object.defineProperty(Yv,"__esModule",{value:!0});Yv.StreamEventTypeOutSerializer=void 0;Yv.StreamEventTypeOutSerializer={_fromJsonObject(u){return{archived:u.archived,createdAt:new Date(u.createdAt),deprecated:u.deprecated,description:u.description,featureFlags:u.featureFlags,name:u.name,updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){return{archived:u.archived,createdAt:u.createdAt,deprecated:u.deprecated,description:u.description,featureFlags:u.featureFlags,name:u.name,updatedAt:u.updatedAt}}}});var Hv=z((hv)=>{Object.defineProperty(hv,"__esModule",{value:!0});hv.ListResponseStreamEventTypeOutSerializer=void 0;var Kv=V8();hv.ListResponseStreamEventTypeOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>Kv.StreamEventTypeOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>Kv.StreamEventTypeOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var Uv=z((Sv)=>{Object.defineProperty(Sv,"__esModule",{value:!0});Sv.StreamEventTypeInSerializer=void 0;Sv.StreamEventTypeInSerializer={_fromJsonObject(u){return{archived:u.archived,deprecated:u.deprecated,description:u.description,featureFlags:u.featureFlags,name:u.name}},_toJsonObject(u){return{archived:u.archived,deprecated:u.deprecated,description:u.description,featureFlags:u.featureFlags,name:u.name}}}});var Ev=z((Mv)=>{Object.defineProperty(Mv,"__esModule",{value:!0});Mv.StreamEventTypePatchSerializer=void 0;Mv.StreamEventTypePatchSerializer={_fromJsonObject(u){return{archived:u.archived,deprecated:u.deprecated,description:u.description,featureFlags:u.featureFlags,name:u.name}},_toJsonObject(u){return{archived:u.archived,deprecated:u.deprecated,description:u.description,featureFlags:u.featureFlags,name:u.name}}}});var Vv=z((Pv)=>{Object.defineProperty(Pv,"__esModule",{value:!0});Pv.StreamingEventType=void 0;var gS=Hv(),Ov=Uv(),Z3=V8(),fS=Ev(),P2=_();class Cv{constructor(u){this.requestCtx=u}list(u){let D=new P2.SvixRequest(P2.HttpMethod.GET,"/api/v1/stream/event-type");return D.setQueryParams({limit:u===null||u===void 0?void 0:u.limit,iterator:u===null||u===void 0?void 0:u.iterator,order:u===null||u===void 0?void 0:u.order,include_archived:u===null||u===void 0?void 0:u.includeArchived}),D.send(this.requestCtx,gS.ListResponseStreamEventTypeOutSerializer._fromJsonObject)}create(u,D){let B=new P2.SvixRequest(P2.HttpMethod.POST,"/api/v1/stream/event-type");return B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.setBody(Ov.StreamEventTypeInSerializer._toJsonObject(u)),B.send(this.requestCtx,Z3.StreamEventTypeOutSerializer._fromJsonObject)}get(u){let D=new P2.SvixRequest(P2.HttpMethod.GET,"/api/v1/stream/event-type/{name}");return D.setPathParam("name",u),D.send(this.requestCtx,Z3.StreamEventTypeOutSerializer._fromJsonObject)}update(u,D){let B=new P2.SvixRequest(P2.HttpMethod.PUT,"/api/v1/stream/event-type/{name}");return B.setPathParam("name",u),B.setBody(Ov.StreamEventTypeInSerializer._toJsonObject(D)),B.send(this.requestCtx,Z3.StreamEventTypeOutSerializer._fromJsonObject)}delete(u,D){let B=new P2.SvixRequest(P2.HttpMethod.DELETE,"/api/v1/stream/event-type/{name}");return B.setPathParam("name",u),B.setQueryParams({expunge:D===null||D===void 0?void 0:D.expunge}),B.sendNoResponseBody(this.requestCtx)}patch(u,D){let B=new P2.SvixRequest(P2.HttpMethod.PATCH,"/api/v1/stream/event-type/{name}");return B.setPathParam("name",u),B.setBody(fS.StreamEventTypePatchSerializer._toJsonObject(D)),B.send(this.requestCtx,Z3.StreamEventTypeOutSerializer._fromJsonObject)}}Pv.StreamingEventType=Cv});var Tv=z((kv)=>{Object.defineProperty(kv,"__esModule",{value:!0});kv.EventInSerializer=void 0;kv.EventInSerializer={_fromJsonObject(u){return{eventType:u.eventType,payload:u.payload}},_toJsonObject(u){return{eventType:u.eventType,payload:u.payload}}}});var k8=z((Iv)=>{Object.defineProperty(Iv,"__esModule",{value:!0});Iv.StreamInSerializer=void 0;Iv.StreamInSerializer={_fromJsonObject(u){return{metadata:u.metadata,name:u.name,uid:u.uid}},_toJsonObject(u){return{metadata:u.metadata,name:u.name,uid:u.uid}}}});var bv=z((gv)=>{Object.defineProperty(gv,"__esModule",{value:!0});gv.CreateStreamEventsInSerializer=void 0;var mv=Tv(),_v=k8();gv.CreateStreamEventsInSerializer={_fromJsonObject(u){return{events:u.events.map((D)=>mv.EventInSerializer._fromJsonObject(D)),stream:u.stream!=null?_v.StreamInSerializer._fromJsonObject(u.stream):void 0}},_toJsonObject(u){return{events:u.events.map((D)=>mv.EventInSerializer._toJsonObject(D)),stream:u.stream!=null?_v.StreamInSerializer._toJsonObject(u.stream):void 0}}}});var dv=z((jv)=>{Object.defineProperty(jv,"__esModule",{value:!0});jv.CreateStreamEventsOutSerializer=void 0;jv.CreateStreamEventsOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var nv=z((iv)=>{Object.defineProperty(iv,"__esModule",{value:!0});iv.EventOutSerializer=void 0;iv.EventOutSerializer={_fromJsonObject(u){return{eventType:u.eventType,payload:u.payload,timestamp:new Date(u.timestamp)}},_toJsonObject(u){return{eventType:u.eventType,payload:u.payload,timestamp:u.timestamp}}}});var tv=z((av)=>{Object.defineProperty(av,"__esModule",{value:!0});av.EventStreamOutSerializer=void 0;var pv=nv();av.EventStreamOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>pv.EventOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator}},_toJsonObject(u){return{data:u.data.map((D)=>pv.EventOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator}}}});var DX=z((ev)=>{Object.defineProperty(ev,"__esModule",{value:!0});ev.StreamingEvents=void 0;var bS=bv(),jS=dv(),lS=tv(),J3=_();class ov{constructor(u){this.requestCtx=u}create(u,D,B){let A=new J3.SvixRequest(J3.HttpMethod.POST,"/api/v1/stream/{stream_id}/events");return A.setPathParam("stream_id",u),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(bS.CreateStreamEventsInSerializer._toJsonObject(D)),A.send(this.requestCtx,jS.CreateStreamEventsOutSerializer._fromJsonObject)}get(u,D,B){let A=new J3.SvixRequest(J3.HttpMethod.GET,"/api/v1/stream/{stream_id}/sink/{sink_id}/events");return A.setPathParam("stream_id",u),A.setPathParam("sink_id",D),A.setQueryParams({limit:B===null||B===void 0?void 0:B.limit,iterator:B===null||B===void 0?void 0:B.iterator,after:B===null||B===void 0?void 0:B.after}),A.send(this.requestCtx,lS.EventStreamOutSerializer._fromJsonObject)}}ev.StreamingEvents=ov});var y8=z((BX)=>{Object.defineProperty(BX,"__esModule",{value:!0});BX.AzureBlobStorageConfigSerializer=void 0;BX.AzureBlobStorageConfigSerializer={_fromJsonObject(u){return{accessKey:u.accessKey,account:u.account,container:u.container}},_toJsonObject(u){return{accessKey:u.accessKey,account:u.account,container:u.container}}}});var T8=z((FX)=>{Object.defineProperty(FX,"__esModule",{value:!0});FX.GoogleCloudStorageConfigSerializer=void 0;FX.GoogleCloudStorageConfigSerializer={_fromJsonObject(u){return{bucket:u.bucket,credentials:u.credentials}},_toJsonObject(u){return{bucket:u.bucket,credentials:u.credentials}}}});var I8=z((GX)=>{Object.defineProperty(GX,"__esModule",{value:!0});GX.S3ConfigSerializer=void 0;GX.S3ConfigSerializer={_fromJsonObject(u){return{accessKeyId:u.accessKeyId,bucket:u.bucket,endpointUrl:u.endpointUrl,region:u.region,secretAccessKey:u.secretAccessKey}},_toJsonObject(u){return{accessKeyId:u.accessKeyId,bucket:u.bucket,endpointUrl:u.endpointUrl,region:u.region,secretAccessKey:u.secretAccessKey}}}});var q8=z(($X)=>{Object.defineProperty($X,"__esModule",{value:!0});$X.SinkHttpConfigSerializer=void 0;$X.SinkHttpConfigSerializer={_fromJsonObject(u){return{headers:u.headers,key:u.key,url:u.url}},_toJsonObject(u){return{headers:u.headers,key:u.key,url:u.url}}}});var m8=z((ZX)=>{Object.defineProperty(ZX,"__esModule",{value:!0});ZX.SinkOtelV1ConfigSerializer=void 0;ZX.SinkOtelV1ConfigSerializer={_fromJsonObject(u){return{headers:u.headers,url:u.url}},_toJsonObject(u){return{headers:u.headers,url:u.url}}}});var _8=z((vX)=>{Object.defineProperty(vX,"__esModule",{value:!0});vX.SinkStatusSerializer=vX.SinkStatus=void 0;var dS;(function(u){u.Enabled="enabled",u.Paused="paused",u.Disabled="disabled",u.Retrying="retrying"})(dS=vX.SinkStatus||(vX.SinkStatus={}));vX.SinkStatusSerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var g8=z((SX)=>{Object.defineProperty(SX,"__esModule",{value:!0});SX.StreamSinkOutSerializer=void 0;var YX=y8(),WX=T8(),KX=I8(),hX=q8(),xX=m8(),HX=_8();SX.StreamSinkOutSerializer={_fromJsonObject(u){let D=u.type;function B(A){switch(A){case"poller":return{};case"azureBlobStorage":return YX.AzureBlobStorageConfigSerializer._fromJsonObject(u.config);case"otelTracing":return xX.SinkOtelV1ConfigSerializer._fromJsonObject(u.config);case"http":return hX.SinkHttpConfigSerializer._fromJsonObject(u.config);case"amazonS3":return KX.S3ConfigSerializer._fromJsonObject(u.config);case"googleCloudStorage":return WX.GoogleCloudStorageConfigSerializer._fromJsonObject(u.config);default:throw Error(`Unexpected type: ${A}`)}}return{type:D,config:B(D),batchSize:u.batchSize,createdAt:new Date(u.createdAt),currentIterator:u.currentIterator,eventTypes:u.eventTypes,failureReason:u.failureReason,id:u.id,maxWaitSecs:u.maxWaitSecs,metadata:u.metadata,nextRetryAt:u.nextRetryAt?new Date(u.nextRetryAt):null,status:HX.SinkStatusSerializer._fromJsonObject(u.status),uid:u.uid,updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){let D;switch(u.type){case"poller":D={};break;case"azureBlobStorage":D=YX.AzureBlobStorageConfigSerializer._toJsonObject(u.config);break;case"otelTracing":D=xX.SinkOtelV1ConfigSerializer._toJsonObject(u.config);break;case"http":D=hX.SinkHttpConfigSerializer._toJsonObject(u.config);break;case"amazonS3":D=KX.S3ConfigSerializer._toJsonObject(u.config);break;case"googleCloudStorage":D=WX.GoogleCloudStorageConfigSerializer._toJsonObject(u.config);break}return{type:u.type,config:D,batchSize:u.batchSize,createdAt:u.createdAt,currentIterator:u.currentIterator,eventTypes:u.eventTypes,failureReason:u.failureReason,id:u.id,maxWaitSecs:u.maxWaitSecs,metadata:u.metadata,nextRetryAt:u.nextRetryAt,status:HX.SinkStatusSerializer._toJsonObject(u.status),uid:u.uid,updatedAt:u.updatedAt}}}});var EX=z((MX)=>{Object.defineProperty(MX,"__esModule",{value:!0});MX.ListResponseStreamSinkOutSerializer=void 0;var UX=g8();MX.ListResponseStreamSinkOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>UX.StreamSinkOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>UX.StreamSinkOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var PX=z((OX)=>{Object.defineProperty(OX,"__esModule",{value:!0});OX.SinkSecretOutSerializer=void 0;OX.SinkSecretOutSerializer={_fromJsonObject(u){return{key:u.key}},_toJsonObject(u){return{key:u.key}}}});var kX=z((cX)=>{Object.defineProperty(cX,"__esModule",{value:!0});cX.SinkTransformInSerializer=void 0;cX.SinkTransformInSerializer={_fromJsonObject(u){return{code:u.code}},_toJsonObject(u){return{code:u.code}}}});var Q3=z((TX)=>{Object.defineProperty(TX,"__esModule",{value:!0});TX.SinkStatusInSerializer=TX.SinkStatusIn=void 0;var iS;(function(u){u.Enabled="enabled",u.Disabled="disabled"})(iS=TX.SinkStatusIn||(TX.SinkStatusIn={}));TX.SinkStatusInSerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var dX=z((jX)=>{Object.defineProperty(jX,"__esModule",{value:!0});jX.StreamSinkInSerializer=void 0;var qX=y8(),mX=T8(),_X=I8(),gX=q8(),fX=m8(),bX=Q3();jX.StreamSinkInSerializer={_fromJsonObject(u){let D=u.type;function B(A){switch(A){case"poller":return{};case"azureBlobStorage":return qX.AzureBlobStorageConfigSerializer._fromJsonObject(u.config);case"otelTracing":return fX.SinkOtelV1ConfigSerializer._fromJsonObject(u.config);case"http":return gX.SinkHttpConfigSerializer._fromJsonObject(u.config);case"amazonS3":return _X.S3ConfigSerializer._fromJsonObject(u.config);case"googleCloudStorage":return mX.GoogleCloudStorageConfigSerializer._fromJsonObject(u.config);default:throw Error(`Unexpected type: ${A}`)}}return{type:D,config:B(D),batchSize:u.batchSize,eventTypes:u.eventTypes,maxWaitSecs:u.maxWaitSecs,metadata:u.metadata,status:u.status!=null?bX.SinkStatusInSerializer._fromJsonObject(u.status):void 0,uid:u.uid}},_toJsonObject(u){let D;switch(u.type){case"poller":D={};break;case"azureBlobStorage":D=qX.AzureBlobStorageConfigSerializer._toJsonObject(u.config);break;case"otelTracing":D=fX.SinkOtelV1ConfigSerializer._toJsonObject(u.config);break;case"http":D=gX.SinkHttpConfigSerializer._toJsonObject(u.config);break;case"amazonS3":D=_X.S3ConfigSerializer._toJsonObject(u.config);break;case"googleCloudStorage":D=mX.GoogleCloudStorageConfigSerializer._toJsonObject(u.config);break}return{type:u.type,config:D,batchSize:u.batchSize,eventTypes:u.eventTypes,maxWaitSecs:u.maxWaitSecs,metadata:u.metadata,status:u.status!=null?bX.SinkStatusInSerializer._toJsonObject(u.status):void 0,uid:u.uid}}}});var nX=z((iX)=>{Object.defineProperty(iX,"__esModule",{value:!0});iX.AmazonS3PatchConfigSerializer=void 0;iX.AmazonS3PatchConfigSerializer={_fromJsonObject(u){return{accessKeyId:u.accessKeyId,bucket:u.bucket,endpointUrl:u.endpointUrl,region:u.region,secretAccessKey:u.secretAccessKey}},_toJsonObject(u){return{accessKeyId:u.accessKeyId,bucket:u.bucket,endpointUrl:u.endpointUrl,region:u.region,secretAccessKey:u.secretAccessKey}}}});var sX=z((pX)=>{Object.defineProperty(pX,"__esModule",{value:!0});pX.AzureBlobStoragePatchConfigSerializer=void 0;pX.AzureBlobStoragePatchConfigSerializer={_fromJsonObject(u){return{accessKey:u.accessKey,account:u.account,container:u.container}},_toJsonObject(u){return{accessKey:u.accessKey,account:u.account,container:u.container}}}});var eX=z((tX)=>{Object.defineProperty(tX,"__esModule",{value:!0});tX.GoogleCloudStoragePatchConfigSerializer=void 0;tX.GoogleCloudStoragePatchConfigSerializer={_fromJsonObject(u){return{bucket:u.bucket,credentials:u.credentials}},_toJsonObject(u){return{bucket:u.bucket,credentials:u.credentials}}}});var BY=z((uY)=>{Object.defineProperty(uY,"__esModule",{value:!0});uY.HttpPatchConfigSerializer=void 0;uY.HttpPatchConfigSerializer={_fromJsonObject(u){return{url:u.url}},_toJsonObject(u){return{url:u.url}}}});var wY=z((AY)=>{Object.defineProperty(AY,"__esModule",{value:!0});AY.OtelTracingPatchConfigSerializer=void 0;AY.OtelTracingPatchConfigSerializer={_fromJsonObject(u){return{url:u.url}},_toJsonObject(u){return{url:u.url}}}});var XY=z((QY)=>{Object.defineProperty(QY,"__esModule",{value:!0});QY.StreamSinkPatchSerializer=void 0;var GY=nX(),NY=sX(),$Y=eX(),zY=BY(),ZY=wY(),JY=Q3();QY.StreamSinkPatchSerializer={_fromJsonObject(u){let D=u.type;function B(A){switch(A){case"poller":return{};case"azureBlobStorage":return NY.AzureBlobStoragePatchConfigSerializer._fromJsonObject(u.config);case"otelTracing":return ZY.OtelTracingPatchConfigSerializer._fromJsonObject(u.config);case"http":return zY.HttpPatchConfigSerializer._fromJsonObject(u.config);case"amazonS3":return GY.AmazonS3PatchConfigSerializer._fromJsonObject(u.config);case"googleCloudStorage":return $Y.GoogleCloudStoragePatchConfigSerializer._fromJsonObject(u.config);default:throw Error(`Unexpected type: ${A}`)}}return{type:D,config:B(D),batchSize:u.batchSize,eventTypes:u.eventTypes,maxWaitSecs:u.maxWaitSecs,metadata:u.metadata,status:u.status!=null?JY.SinkStatusInSerializer._fromJsonObject(u.status):void 0,uid:u.uid}},_toJsonObject(u){let D;switch(u.type){case"poller":D={};break;case"azureBlobStorage":D=NY.AzureBlobStoragePatchConfigSerializer._toJsonObject(u.config);break;case"otelTracing":D=ZY.OtelTracingPatchConfigSerializer._toJsonObject(u.config);break;case"http":D=zY.HttpPatchConfigSerializer._toJsonObject(u.config);break;case"amazonS3":D=GY.AmazonS3PatchConfigSerializer._toJsonObject(u.config);break;case"googleCloudStorage":D=$Y.GoogleCloudStoragePatchConfigSerializer._toJsonObject(u.config);break}return{type:u.type,config:D,batchSize:u.batchSize,eventTypes:u.eventTypes,maxWaitSecs:u.maxWaitSecs,metadata:u.metadata,status:u.status!=null?JY.SinkStatusInSerializer._toJsonObject(u.status):void 0,uid:u.uid}}}});var HY=z((hY)=>{Object.defineProperty(hY,"__esModule",{value:!0});hY.StreamingSink=void 0;var YY=L8(),rS=Y8(),nS=EX(),pS=PX(),aS=kX(),WY=dX(),v3=g8(),sS=XY(),B2=_();class KY{constructor(u){this.requestCtx=u}list(u,D){let B=new B2.SvixRequest(B2.HttpMethod.GET,"/api/v1/stream/{stream_id}/sink");return B.setPathParam("stream_id",u),B.setQueryParams({limit:D===null||D===void 0?void 0:D.limit,iterator:D===null||D===void 0?void 0:D.iterator,order:D===null||D===void 0?void 0:D.order}),B.send(this.requestCtx,nS.ListResponseStreamSinkOutSerializer._fromJsonObject)}create(u,D,B){let A=new B2.SvixRequest(B2.HttpMethod.POST,"/api/v1/stream/{stream_id}/sink");return A.setPathParam("stream_id",u),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(WY.StreamSinkInSerializer._toJsonObject(D)),A.send(this.requestCtx,v3.StreamSinkOutSerializer._fromJsonObject)}get(u,D){let B=new B2.SvixRequest(B2.HttpMethod.GET,"/api/v1/stream/{stream_id}/sink/{sink_id}");return B.setPathParam("stream_id",u),B.setPathParam("sink_id",D),B.send(this.requestCtx,v3.StreamSinkOutSerializer._fromJsonObject)}update(u,D,B){let A=new B2.SvixRequest(B2.HttpMethod.PUT,"/api/v1/stream/{stream_id}/sink/{sink_id}");return A.setPathParam("stream_id",u),A.setPathParam("sink_id",D),A.setBody(WY.StreamSinkInSerializer._toJsonObject(B)),A.send(this.requestCtx,v3.StreamSinkOutSerializer._fromJsonObject)}delete(u,D){let B=new B2.SvixRequest(B2.HttpMethod.DELETE,"/api/v1/stream/{stream_id}/sink/{sink_id}");return B.setPathParam("stream_id",u),B.setPathParam("sink_id",D),B.sendNoResponseBody(this.requestCtx)}patch(u,D,B){let A=new B2.SvixRequest(B2.HttpMethod.PATCH,"/api/v1/stream/{stream_id}/sink/{sink_id}");return A.setPathParam("stream_id",u),A.setPathParam("sink_id",D),A.setBody(sS.StreamSinkPatchSerializer._toJsonObject(B)),A.send(this.requestCtx,v3.StreamSinkOutSerializer._fromJsonObject)}getSecret(u,D){let B=new B2.SvixRequest(B2.HttpMethod.GET,"/api/v1/stream/{stream_id}/sink/{sink_id}/secret");return B.setPathParam("stream_id",u),B.setPathParam("sink_id",D),B.send(this.requestCtx,pS.SinkSecretOutSerializer._fromJsonObject)}rotateSecret(u,D,B,A){let F=new B2.SvixRequest(B2.HttpMethod.POST,"/api/v1/stream/{stream_id}/sink/{sink_id}/secret/rotate");return F.setPathParam("stream_id",u),F.setPathParam("sink_id",D),F.setHeaderParam("idempotency-key",A===null||A===void 0?void 0:A.idempotencyKey),F.setBody(rS.EndpointSecretRotateInSerializer._toJsonObject(B)),F.send(this.requestCtx,YY.EmptyResponseSerializer._fromJsonObject)}transformationPartialUpdate(u,D,B){let A=new B2.SvixRequest(B2.HttpMethod.PATCH,"/api/v1/stream/{stream_id}/sink/{sink_id}/transformation");return A.setPathParam("stream_id",u),A.setPathParam("sink_id",D),A.setBody(aS.SinkTransformInSerializer._toJsonObject(B)),A.send(this.requestCtx,YY.EmptyResponseSerializer._fromJsonObject)}}hY.StreamingSink=KY});var f8=z((SY)=>{Object.defineProperty(SY,"__esModule",{value:!0});SY.StreamOutSerializer=void 0;SY.StreamOutSerializer={_fromJsonObject(u){return{createdAt:new Date(u.createdAt),id:u.id,metadata:u.metadata,name:u.name,uid:u.uid,updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){return{createdAt:u.createdAt,id:u.id,metadata:u.metadata,name:u.name,uid:u.uid,updatedAt:u.updatedAt}}}});var EY=z((MY)=>{Object.defineProperty(MY,"__esModule",{value:!0});MY.ListResponseStreamOutSerializer=void 0;var UY=f8();MY.ListResponseStreamOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>UY.StreamOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>UY.StreamOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var PY=z((OY)=>{Object.defineProperty(OY,"__esModule",{value:!0});OY.StreamPatchSerializer=void 0;OY.StreamPatchSerializer={_fromJsonObject(u){return{description:u.description,metadata:u.metadata,uid:u.uid}},_toJsonObject(u){return{description:u.description,metadata:u.metadata,uid:u.uid}}}});var TY=z((kY)=>{Object.defineProperty(kY,"__esModule",{value:!0});kY.StreamingStream=void 0;var tS=EY(),cY=k8(),X3=f8(),oS=PY(),c2=_();class VY{constructor(u){this.requestCtx=u}list(u){let D=new c2.SvixRequest(c2.HttpMethod.GET,"/api/v1/stream");return D.setQueryParams({limit:u===null||u===void 0?void 0:u.limit,iterator:u===null||u===void 0?void 0:u.iterator,order:u===null||u===void 0?void 0:u.order}),D.send(this.requestCtx,tS.ListResponseStreamOutSerializer._fromJsonObject)}create(u,D){let B=new c2.SvixRequest(c2.HttpMethod.POST,"/api/v1/stream");return B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.setBody(cY.StreamInSerializer._toJsonObject(u)),B.send(this.requestCtx,X3.StreamOutSerializer._fromJsonObject)}get(u){let D=new c2.SvixRequest(c2.HttpMethod.GET,"/api/v1/stream/{stream_id}");return D.setPathParam("stream_id",u),D.send(this.requestCtx,X3.StreamOutSerializer._fromJsonObject)}update(u,D){let B=new c2.SvixRequest(c2.HttpMethod.PUT,"/api/v1/stream/{stream_id}");return B.setPathParam("stream_id",u),B.setBody(cY.StreamInSerializer._toJsonObject(D)),B.send(this.requestCtx,X3.StreamOutSerializer._fromJsonObject)}delete(u){let D=new c2.SvixRequest(c2.HttpMethod.DELETE,"/api/v1/stream/{stream_id}");return D.setPathParam("stream_id",u),D.sendNoResponseBody(this.requestCtx)}patch(u,D){let B=new c2.SvixRequest(c2.HttpMethod.PATCH,"/api/v1/stream/{stream_id}");return B.setPathParam("stream_id",u),B.setBody(oS.StreamPatchSerializer._toJsonObject(D)),B.send(this.requestCtx,X3.StreamOutSerializer._fromJsonObject)}}kY.StreamingStream=VY});var gY=z((mY)=>{Object.defineProperty(mY,"__esModule",{value:!0});mY.Streaming=void 0;var IY=v8(),eS=Jv(),uR=Xv(),DR=Vv(),BR=DX(),AR=HY(),FR=TY(),g0=_();class qY{constructor(u){this.requestCtx=u}get event_type(){return new DR.StreamingEventType(this.requestCtx)}get events(){return new BR.StreamingEvents(this.requestCtx)}get sink(){return new AR.StreamingSink(this.requestCtx)}get stream(){return new FR.StreamingStream(this.requestCtx)}sinkHeadersGet(u,D){let B=new g0.SvixRequest(g0.HttpMethod.GET,"/api/v1/stream/{stream_id}/sink/{sink_id}/headers");return B.setPathParam("stream_id",u),B.setPathParam("sink_id",D),B.send(this.requestCtx,IY.EndpointHeadersOutSerializer._fromJsonObject)}sinkHeadersPatch(u,D,B){let A=new g0.SvixRequest(g0.HttpMethod.PATCH,"/api/v1/stream/{stream_id}/sink/{sink_id}/headers");return A.setPathParam("stream_id",u),A.setPathParam("sink_id",D),A.setBody(eS.HttpSinkHeadersPatchInSerializer._toJsonObject(B)),A.send(this.requestCtx,IY.EndpointHeadersOutSerializer._fromJsonObject)}sinkTransformationGet(u,D){let B=new g0.SvixRequest(g0.HttpMethod.GET,"/api/v1/stream/{stream_id}/sink/{sink_id}/transformation");return B.setPathParam("stream_id",u),B.setPathParam("sink_id",D),B.send(this.requestCtx,uR.SinkTransformationOutSerializer._fromJsonObject)}}mY.Streaming=qY});var jY=z((fY)=>{Object.defineProperty(fY,"__esModule",{value:!0});fY.HTTPValidationError=fY.ValidationError=fY.HttpErrorOut=void 0;class f0{static getAttributeTypeMap(){return f0.attributeTypeMap}}fY.HttpErrorOut=f0;f0.discriminator=void 0;f0.mapping=void 0;f0.attributeTypeMap=[{name:"code",baseName:"code",type:"string",format:""},{name:"detail",baseName:"detail",type:"string",format:""}];class b0{static getAttributeTypeMap(){return b0.attributeTypeMap}}fY.ValidationError=b0;b0.discriminator=void 0;b0.mapping=void 0;b0.attributeTypeMap=[{name:"loc",baseName:"loc",type:"Array<string>",format:""},{name:"msg",baseName:"msg",type:"string",format:""},{name:"type",baseName:"type",type:"string",format:""}];class j0{static getAttributeTypeMap(){return j0.attributeTypeMap}}fY.HTTPValidationError=j0;j0.discriminator=void 0;j0.mapping=void 0;j0.attributeTypeMap=[{name:"detail",baseName:"detail",type:"Array<ValidationError>",format:""}]});var rY=z((dY)=>{Object.defineProperty(dY,"__esModule",{value:!0});dY.timingSafeEqual=void 0;function lY(u,D=""){if(!u)throw Error(D)}function NR(u,D){if(u.byteLength!==D.byteLength)return!1;if(!(u instanceof DataView))u=new DataView(ArrayBuffer.isView(u)?u.buffer:u);if(!(D instanceof DataView))D=new DataView(ArrayBuffer.isView(D)?D.buffer:D);lY(u instanceof DataView),lY(D instanceof DataView);let B=u.byteLength,A=0,F=-1;while(++F<B)A|=u.getUint8(F)^D.getUint8(F);return A===0}dY.timingSafeEqual=NR});var aY=z((h2)=>{var $R=h2&&h2.__extends||function(){var u=function(D,B){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,F){A.__proto__=F}||function(A,F){for(var w in F)if(F.hasOwnProperty(w))A[w]=F[w]},u(D,B)};return function(D,B){u(D,B);function A(){this.constructor=D}D.prototype=B===null?Object.create(B):(A.prototype=B.prototype,new A)}}();Object.defineProperty(h2,"__esModule",{value:!0});var r=256,b8=function(){function u(D){if(D===void 0)D="=";this._paddingCharacter=D}return u.prototype.encodedLength=function(D){if(!this._paddingCharacter)return(D*8+5)/6|0;return(D+2)/3*4|0},u.prototype.encode=function(D){var B="",A=0;for(;A<D.length-2;A+=3){var F=D[A]<<16|D[A+1]<<8|D[A+2];B+=this._encodeByte(F>>>18&63),B+=this._encodeByte(F>>>12&63),B+=this._encodeByte(F>>>6&63),B+=this._encodeByte(F>>>0&63)}var w=D.length-A;if(w>0){var F=D[A]<<16|(w===2?D[A+1]<<8:0);if(B+=this._encodeByte(F>>>18&63),B+=this._encodeByte(F>>>12&63),w===2)B+=this._encodeByte(F>>>6&63);else B+=this._paddingCharacter||"";B+=this._paddingCharacter||""}return B},u.prototype.maxDecodedLength=function(D){if(!this._paddingCharacter)return(D*6+7)/8|0;return D/4*3|0},u.prototype.decodedLength=function(D){return this.maxDecodedLength(D.length-this._getPaddingLength(D))},u.prototype.decode=function(D){if(D.length===0)return new Uint8Array(0);var B=this._getPaddingLength(D),A=D.length-B,F=new Uint8Array(this.maxDecodedLength(A)),w=0,G=0,N=0,$=0,Z=0,v=0,J=0;for(;G<A-4;G+=4)$=this._decodeChar(D.charCodeAt(G+0)),Z=this._decodeChar(D.charCodeAt(G+1)),v=this._decodeChar(D.charCodeAt(G+2)),J=this._decodeChar(D.charCodeAt(G+3)),F[w++]=$<<2|Z>>>4,F[w++]=Z<<4|v>>>2,F[w++]=v<<6|J,N|=$&r,N|=Z&r,N|=v&r,N|=J&r;if(G<A-1)$=this._decodeChar(D.charCodeAt(G)),Z=this._decodeChar(D.charCodeAt(G+1)),F[w++]=$<<2|Z>>>4,N|=$&r,N|=Z&r;if(G<A-2)v=this._decodeChar(D.charCodeAt(G+2)),F[w++]=Z<<4|v>>>2,N|=v&r;if(G<A-3)J=this._decodeChar(D.charCodeAt(G+3)),F[w++]=v<<6|J,N|=J&r;if(N!==0)throw Error("Base64Coder: incorrect characters for decoding");return F},u.prototype._encodeByte=function(D){var B=D;return B+=65,B+=25-D>>>8&6,B+=51-D>>>8&-75,B+=61-D>>>8&-15,B+=62-D>>>8&3,String.fromCharCode(B)},u.prototype._decodeChar=function(D){var B=r;return B+=(42-D&D-44)>>>8&-r+D-43+62,B+=(46-D&D-48)>>>8&-r+D-47+63,B+=(47-D&D-58)>>>8&-r+D-48+52,B+=(64-D&D-91)>>>8&-r+D-65+0,B+=(96-D&D-123)>>>8&-r+D-97+26,B},u.prototype._getPaddingLength=function(D){var B=0;if(this._paddingCharacter){for(var A=D.length-1;A>=0;A--){if(D[A]!==this._paddingCharacter)break;B++}if(D.length<4||B>2)throw Error("Base64Coder: incorrect padding")}return B},u}();h2.Coder=b8;var cu=new b8;function zR(u){return cu.encode(u)}h2.encode=zR;function ZR(u){return cu.decode(u)}h2.decode=ZR;var nY=function(u){$R(D,u);function D(){return u!==null&&u.apply(this,arguments)||this}return D.prototype._encodeByte=function(B){var A=B;return A+=65,A+=25-B>>>8&6,A+=51-B>>>8&-75,A+=61-B>>>8&-13,A+=62-B>>>8&49,String.fromCharCode(A)},D.prototype._decodeChar=function(B){var A=r;return A+=(44-B&B-46)>>>8&-r+B-45+62,A+=(94-B&B-96)>>>8&-r+B-95+63,A+=(47-B&B-58)>>>8&-r+B-48+52,A+=(64-B&B-91)>>>8&-r+B-65+0,A+=(96-B&B-123)>>>8&-r+B-97+26,A},D}(b8);h2.URLSafeCoder=nY;var pY=new nY;function JR(u){return pY.encode(u)}h2.encodeURLSafe=JR;function QR(u){return pY.decode(u)}h2.decodeURLSafe=QR;h2.encodedLength=function(u){return cu.encodedLength(u)};h2.maxDecodedLength=function(u){return cu.maxDecodedLength(u)};h2.decodedLength=function(u){return cu.decodedLength(u)}});var tY=z((sY,Y3)=>{(function(u,D){var B={};D(B);var A=B.default;for(var F in B)A[F]=B[F];if(typeof Y3==="object"&&typeof Y3.exports==="object")Y3.exports=A;else if(typeof define==="function"&&define.amd)define(function(){return A});else u.sha256=A})(sY,function(u){u.__esModule=!0,u.digestLength=32,u.blockSize=64;var D=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function B(J,Q,X,W,L){var x,E,H,k,g,y,H2,a,w2,s,Au,Fu,ju;while(L>=64){x=Q[0],E=Q[1],H=Q[2],k=Q[3],g=Q[4],y=Q[5],H2=Q[6],a=Q[7];for(s=0;s<16;s++)Au=W+s*4,J[s]=(X[Au]&255)<<24|(X[Au+1]&255)<<16|(X[Au+2]&255)<<8|X[Au+3]&255;for(s=16;s<64;s++)w2=J[s-2],Fu=(w2>>>17|w2<<15)^(w2>>>19|w2<<13)^w2>>>10,w2=J[s-15],ju=(w2>>>7|w2<<25)^(w2>>>18|w2<<14)^w2>>>3,J[s]=(Fu+J[s-7]|0)+(ju+J[s-16]|0);for(s=0;s<64;s++)Fu=(((g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7))+(g&y^~g&H2)|0)+(a+(D[s]+J[s]|0)|0)|0,ju=((x>>>2|x<<30)^(x>>>13|x<<19)^(x>>>22|x<<10))+(x&E^x&H^E&H)|0,a=H2,H2=y,y=g,g=k+Fu|0,k=H,H=E,E=x,x=Fu+ju|0;Q[0]+=x,Q[1]+=E,Q[2]+=H,Q[3]+=k,Q[4]+=g,Q[5]+=y,Q[6]+=H2,Q[7]+=a,W+=64,L-=64}return W}var A=function(){function J(){this.digestLength=u.digestLength,this.blockSize=u.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return J.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},J.prototype.clean=function(){for(var Q=0;Q<this.buffer.length;Q++)this.buffer[Q]=0;for(var Q=0;Q<this.temp.length;Q++)this.temp[Q]=0;this.reset()},J.prototype.update=function(Q,X){if(X===void 0)X=Q.length;if(this.finished)throw Error("SHA256: can't update because hash was finished.");var W=0;if(this.bytesHashed+=X,this.bufferLength>0){while(this.bufferLength<64&&X>0)this.buffer[this.bufferLength++]=Q[W++],X--;if(this.bufferLength===64)B(this.temp,this.state,this.buffer,0,64),this.bufferLength=0}if(X>=64)W=B(this.temp,this.state,Q,W,X),X%=64;while(X>0)this.buffer[this.bufferLength++]=Q[W++],X--;return this},J.prototype.finish=function(Q){if(!this.finished){var X=this.bytesHashed,W=this.bufferLength,L=X/536870912|0,x=X<<3,E=X%64<56?64:128;this.buffer[W]=128;for(var H=W+1;H<E-8;H++)this.buffer[H]=0;this.buffer[E-8]=L>>>24&255,this.buffer[E-7]=L>>>16&255,this.buffer[E-6]=L>>>8&255,this.buffer[E-5]=L>>>0&255,this.buffer[E-4]=x>>>24&255,this.buffer[E-3]=x>>>16&255,this.buffer[E-2]=x>>>8&255,this.buffer[E-1]=x>>>0&255,B(this.temp,this.state,this.buffer,0,E),this.finished=!0}for(var H=0;H<8;H++)Q[H*4+0]=this.state[H]>>>24&255,Q[H*4+1]=this.state[H]>>>16&255,Q[H*4+2]=this.state[H]>>>8&255,Q[H*4+3]=this.state[H]>>>0&255;return this},J.prototype.digest=function(){var Q=new Uint8Array(this.digestLength);return this.finish(Q),Q},J.prototype._saveState=function(Q){for(var X=0;X<this.state.length;X++)Q[X]=this.state[X]},J.prototype._restoreState=function(Q,X){for(var W=0;W<this.state.length;W++)this.state[W]=Q[W];this.bytesHashed=X,this.finished=!1,this.bufferLength=0},J}();u.Hash=A;var F=function(){function J(Q){this.inner=new A,this.outer=new A,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var X=new Uint8Array(this.blockSize);if(Q.length>this.blockSize)new A().update(Q).finish(X).clean();else for(var W=0;W<Q.length;W++)X[W]=Q[W];for(var W=0;W<X.length;W++)X[W]^=54;this.inner.update(X);for(var W=0;W<X.length;W++)X[W]^=106;this.outer.update(X),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var W=0;W<X.length;W++)X[W]=0}return J.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},J.prototype.clean=function(){for(var Q=0;Q<this.istate.length;Q++)this.ostate[Q]=this.istate[Q]=0;this.inner.clean(),this.outer.clean()},J.prototype.update=function(Q){return this.inner.update(Q),this},J.prototype.finish=function(Q){if(this.outer.finished)this.outer.finish(Q);else this.inner.finish(Q),this.outer.update(Q,this.digestLength).finish(Q);return this},J.prototype.digest=function(){var Q=new Uint8Array(this.digestLength);return this.finish(Q),Q},J}();u.HMAC=F;function w(J){var Q=new A().update(J),X=Q.digest();return Q.clean(),X}u.hash=w,u.default=w;function G(J,Q){var X=new F(J).update(Q),W=X.digest();return X.clean(),W}u.hmac=G;function N(J,Q,X,W){var L=W[0];if(L===0)throw Error("hkdf: cannot expand more");if(Q.reset(),L>1)Q.update(J);if(X)Q.update(X);Q.update(W),Q.finish(J),W[0]++}var $=new Uint8Array(u.digestLength);function Z(J,Q,X,W){if(Q===void 0)Q=$;if(W===void 0)W=32;var L=new Uint8Array([1]),x=G(Q,J),E=new F(x),H=new Uint8Array(E.digestLength),k=H.length,g=new Uint8Array(W);for(var y=0;y<W;y++){if(k===H.length)N(H,E,X,L),k=0;g[y]=H[k++]}return E.clean(),H.fill(0),L.fill(0),g}u.hkdf=Z;function v(J,Q,X,W){var L=new F(J),x=L.digestLength,E=new Uint8Array(4),H=new Uint8Array(x),k=new Uint8Array(x),g=new Uint8Array(W);for(var y=0;y*x<W;y++){var H2=y+1;E[0]=H2>>>24&255,E[1]=H2>>>16&255,E[2]=H2>>>8&255,E[3]=H2>>>0&255,L.reset(),L.update(Q),L.update(E),L.finish(k);for(var a=0;a<x;a++)H[a]=k[a];for(var a=2;a<=X;a++){L.reset(),L.update(k).finish(k);for(var w2=0;w2<x;w2++)H[w2]^=k[w2]}for(var a=0;a<x&&y*x+a<W;a++)g[y*x+a]=H[a]}for(var y=0;y<x;y++)H[y]=k[y]=0;for(var y=0;y<4;y++)E[y]=0;return L.clean(),g}u.pbkdf2=v})});var l8=z((uW)=>{Object.defineProperty(uW,"__esModule",{value:!0});uW.Webhook=uW.WebhookVerificationError=void 0;var vR=rY(),oY=aY(),XR=tY(),eY=300;class j8 extends Error{constructor(u){super(u);Object.setPrototypeOf(this,j8.prototype),this.name="ExtendableError",this.stack=Error(u).stack}}class D0 extends j8{constructor(u){super(u);Object.setPrototypeOf(this,D0.prototype),this.name="WebhookVerificationError"}}uW.WebhookVerificationError=D0;class Vu{constructor(u,D){if(!u)throw Error("Secret can't be empty.");if((D===null||D===void 0?void 0:D.format)==="raw")if(u instanceof Uint8Array)this.key=u;else this.key=Uint8Array.from(u,(B)=>B.charCodeAt(0));else{if(typeof u!=="string")throw Error("Expected secret to be of type string");if(u.startsWith(Vu.prefix))u=u.substring(Vu.prefix.length);this.key=oY.decode(u)}}verify(u,D){let B={};for(let J of Object.keys(D))B[J.toLowerCase()]=D[J];let A=B["webhook-id"],F=B["webhook-signature"],w=B["webhook-timestamp"];if(!F||!A||!w)throw new D0("Missing required headers");let G=this.verifyTimestamp(w),$=this.sign(A,G,u).split(",")[1],Z=F.split(" "),v=new globalThis.TextEncoder;for(let J of Z){let[Q,X]=J.split(",");if(Q!=="v1")continue;if((0,vR.timingSafeEqual)(v.encode(X),v.encode($)))return JSON.parse(u.toString())}throw new D0("No matching signature found")}sign(u,D,B){if(typeof B==="string");else if(B.constructor.name==="Buffer")B=B.toString();else throw Error("Expected payload to be of type string or Buffer.");let A=new TextEncoder,F=Math.floor(D.getTime()/1000),w=A.encode(`${u}.${F}.${B}`);return`v1,${oY.encode(XR.hmac(this.key,w))}`}verifyTimestamp(u){let D=Math.floor(Date.now()/1000),B=parseInt(u,10);if(isNaN(B))throw new D0("Invalid Signature Headers");if(D-B>eY)throw new D0("Message timestamp too old");if(B>D+eY)throw new D0("Message timestamp too new");return new Date(B*1000)}}uW.Webhook=Vu;Vu.prefix="whsec_"});var FW=z((d8)=>{Object.defineProperty(d8,"__esModule",{value:!0});d8.Webhook=d8.WebhookVerificationError=void 0;var WR=l8(),KR=l8();Object.defineProperty(d8,"WebhookVerificationError",{enumerable:!0,get:function(){return KR.WebhookVerificationError}});class BW{constructor(u,D){this.inner=new WR.Webhook(u,D)}verify(u,D){var B,A,F,w,G,N;let $={};for(let Z of Object.keys(D))$[Z.toLowerCase()]=D[Z];return $["webhook-id"]=(A=(B=$["svix-id"])!==null&&B!==void 0?B:$["webhook-id"])!==null&&A!==void 0?A:"",$["webhook-signature"]=(w=(F=$["svix-signature"])!==null&&F!==void 0?F:$["webhook-signature"])!==null&&w!==void 0?w:"",$["webhook-timestamp"]=(N=(G=$["svix-timestamp"])!==null&&G!==void 0?G:$["webhook-timestamp"])!==null&&N!==void 0?N:"",this.inner.verify(u,$)}sign(u,D,B){return this.inner.sign(u,D,B)}}d8.Webhook=BW});var $W=z((GW)=>{Object.defineProperty(GW,"__esModule",{value:!0});GW.EndpointDisabledTriggerSerializer=GW.EndpointDisabledTrigger=void 0;var hR;(function(u){u.Manual="manual",u.Automatic="automatic"})(hR=GW.EndpointDisabledTrigger||(GW.EndpointDisabledTrigger={}));GW.EndpointDisabledTriggerSerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var QW=z((ZW)=>{Object.defineProperty(ZW,"__esModule",{value:!0});ZW.OrderingSerializer=ZW.Ordering=void 0;var xR;(function(u){u.Ascending="ascending",u.Descending="descending"})(xR=ZW.Ordering||(ZW.Ordering={}));ZW.OrderingSerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var vW=z((z2)=>{Object.defineProperty(z2,"__esModule",{value:!0});z2.StatusCodeClass=z2.SinkStatusIn=z2.SinkStatus=z2.Ordering=z2.MessageStatusText=z2.MessageStatus=z2.MessageAttemptTriggerType=z2.EndpointDisabledTrigger=z2.ConnectorProduct=z2.ConnectorKind=z2.BackgroundTaskType=z2.BackgroundTaskStatus=z2.AppPortalCapability=void 0;var HR=$8();Object.defineProperty(z2,"AppPortalCapability",{enumerable:!0,get:function(){return HR.AppPortalCapability}});var SR=e2();Object.defineProperty(z2,"BackgroundTaskStatus",{enumerable:!0,get:function(){return SR.BackgroundTaskStatus}});var RR=u0();Object.defineProperty(z2,"BackgroundTaskType",{enumerable:!0,get:function(){return RR.BackgroundTaskType}});var UR=q0();Object.defineProperty(z2,"ConnectorKind",{enumerable:!0,get:function(){return UR.ConnectorKind}});var MR=B3();Object.defineProperty(z2,"ConnectorProduct",{enumerable:!0,get:function(){return MR.ConnectorProduct}});var LR=$W();Object.defineProperty(z2,"EndpointDisabledTrigger",{enumerable:!0,get:function(){return LR.EndpointDisabledTrigger}});var ER=E8();Object.defineProperty(z2,"MessageAttemptTriggerType",{enumerable:!0,get:function(){return ER.MessageAttemptTriggerType}});var OR=m0();Object.defineProperty(z2,"MessageStatus",{enumerable:!0,get:function(){return OR.MessageStatus}});var CR=Pu();Object.defineProperty(z2,"MessageStatusText",{enumerable:!0,get:function(){return CR.MessageStatusText}});var PR=QW();Object.defineProperty(z2,"Ordering",{enumerable:!0,get:function(){return PR.Ordering}});var cR=_8();Object.defineProperty(z2,"SinkStatus",{enumerable:!0,get:function(){return cR.SinkStatus}});var VR=Q3();Object.defineProperty(z2,"SinkStatusIn",{enumerable:!0,get:function(){return VR.SinkStatusIn}});var kR=Q8();Object.defineProperty(z2,"StatusCodeClass",{enumerable:!0,get:function(){return kR.StatusCodeClass}})});var WW=z((n)=>{var TR=n&&n.__createBinding||(Object.create?function(u,D,B,A){if(A===void 0)A=B;var F=Object.getOwnPropertyDescriptor(D,B);if(!F||("get"in F?!D.__esModule:F.writable||F.configurable))F={enumerable:!0,get:function(){return D[B]}};Object.defineProperty(u,A,F)}:function(u,D,B,A){if(A===void 0)A=B;u[A]=D[B]}),XW=n&&n.__exportStar||function(u,D){for(var B in u)if(B!=="default"&&!Object.prototype.hasOwnProperty.call(D,B))TR(D,u,B)};Object.defineProperty(n,"__esModule",{value:!0});n.Svix=n.messageInRaw=n.ValidationError=n.HttpErrorOut=n.HTTPValidationError=n.ApiException=void 0;var IR=vA(),qR=nA(),mR=J7(),_R=b7(),gR=Zw(),fR=Cw(),bR=BG(),jR=NG(),lR=HZ(),dR=fZ(),iR=M8(),rR=XQ(),nR=iQ(),pR=$v(),aR=gY(),sR=c8(),tR=w8();Object.defineProperty(n,"ApiException",{enumerable:!0,get:function(){return tR.ApiException}});var i8=jY();Object.defineProperty(n,"HTTPValidationError",{enumerable:!0,get:function(){return i8.HTTPValidationError}});Object.defineProperty(n,"HttpErrorOut",{enumerable:!0,get:function(){return i8.HttpErrorOut}});Object.defineProperty(n,"ValidationError",{enumerable:!0,get:function(){return i8.ValidationError}});XW(FW(),n);XW(vW(),n);var oR=M8();Object.defineProperty(n,"messageInRaw",{enumerable:!0,get:function(){return oR.messageInRaw}});var eR=[{region:"us",url:"https://api.us.svix.com"},{region:"eu",url:"https://api.eu.svix.com"},{region:"in",url:"https://api.in.svix.com"},{region:"ca",url:"https://api.ca.svix.com"},{region:"au",url:"https://api.au.svix.com"}];class YW{constructor(u,D={}){var B,A,F;let w=(B=eR.find((N)=>N.region===u.split(".")[1]))===null||B===void 0?void 0:B.url,G=(F=(A=D.serverUrl)!==null&&A!==void 0?A:w)!==null&&F!==void 0?F:"https://api.svix.com";if(D.retryScheduleInMs){this.requestCtx={baseUrl:G,token:u,timeout:D.requestTimeout,retryScheduleInMs:D.retryScheduleInMs,fetch:D.fetch};return}if(D.numRetries){this.requestCtx={baseUrl:G,token:u,timeout:D.requestTimeout,numRetries:D.numRetries,fetch:D.fetch};return}this.requestCtx={baseUrl:G,token:u,timeout:D.requestTimeout,fetch:D.fetch}}get application(){return new IR.Application(this.requestCtx)}get authentication(){return new qR.Authentication(this.requestCtx)}get backgroundTask(){return new mR.BackgroundTask(this.requestCtx)}get connector(){return new _R.Connector(this.requestCtx)}get endpoint(){return new gR.Endpoint(this.requestCtx)}get environment(){return new fR.Environment(this.requestCtx)}get eventType(){return new bR.EventType(this.requestCtx)}get health(){return new jR.Health(this.requestCtx)}get ingest(){return new lR.Ingest(this.requestCtx)}get integration(){return new dR.Integration(this.requestCtx)}get message(){return new iR.Message(this.requestCtx)}get messageAttempt(){return new rR.MessageAttempt(this.requestCtx)}get operationalWebhook(){return new nR.OperationalWebhook(this.requestCtx)}get statistics(){return new pR.Statistics(this.requestCtx)}get streaming(){return new aR.Streaming(this.requestCtx)}get operationalWebhookEndpoint(){return new sR.OperationalWebhookEndpoint(this.requestCtx)}}n.Svix=YW});class l2{async read(u){let D=typeof u==="string"?{name:u}:u,B=await this.fetch({name:D.name,bucket:D.bucket});if(!B.ok)throw new Z2(D.name);let A=B.headers.get("Content-Type")??"application/octet-stream",F=B.headers.get("ETag")??void 0,w=B.headers.get("Last-Modified"),G=w?new Date(w):void 0;if(D.range){let Z=await B.blob();return{body:Z,start:0,end:Z.size-1,total:Z.size,partial:!1,type:A,etag:F,lastModified:G,name:D.name}}let N=Number(B.headers.get("Content-Length")),$=Number.isFinite(N)?N:0;return{body:B.body,start:0,end:$-1,total:$,partial:!1,type:A,etag:F,lastModified:G,name:D.name}}async size(u){let D=typeof u==="string"?u:u.name,B=typeof u==="string"?void 0:u.bucket,A=await this.fetch({name:D,bucket:B});if(!A.ok)throw new Z2(D);let F=Number(A.headers.get("Content-Length"));if(Number.isFinite(F))return await A.body?.cancel(),F;return(await A.blob()).size}}import{readdir as hK}from"fs/promises";class lu extends l2{folderPath;constructor(u=`${process.env.ROOT_DIR}/storage`){super();this.folderPath=u}async put(u){let D,B;if(u instanceof Blob)D=u,B=`${Bun.randomUUIDv7()}.${u.type.split("/")[1].split(";")[0]}`;else D=u.body,B=u.name;let A=D instanceof Buffer?D:D instanceof Blob||D instanceof File?Buffer.from(await D.arrayBuffer()):"",F=`${this.folderPath}/${B}`;return await Bun.write(F,A),B}async fetch(u){let D=process.env.BUCKET_NAME,B;if(typeof u==="string")B=u;else D=u.bucket??D,B=u.name;if(!B)throw Error("Object name has to be specified");let A=`${this.folderPath}/${B}`,F=Bun.file(A),w=Bun.file(A).stream(),G=new Date(F.lastModified).toUTCString();return new Response(w,{headers:{"Content-Type":F.type,"Content-Length":String(F.size),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":G}})}async read(u){let D=typeof u==="string"?{name:u}:u,{name:B,range:A=null}=D;if(!B)throw Error("Object name has to be specified");let F=Bun.file(`${this.folderPath}/${B}`);if(!await F.exists())throw new Z2(B);let w=F.size,G=A?wu(A,w):null;if(A&&!G)throw new d2(w);let N=G?.start??0,$=G?G.end:w-1;return{body:G?F.slice(N,$+1):F,start:N,end:$,total:w,partial:Boolean(G),type:F.type||"application/octet-stream",lastModified:new Date(F.lastModified),name:B}}async size(u){let D=typeof u==="string"?u:u.name,B=Bun.file(`${this.folderPath}/${D}`);if(!await B.exists())throw new Z2(D);return B.size}async list(){return await hK(this.folderPath)}}class a5 extends f{driver=new lu;boot(){}}var s5=Y(g2(),1);function xK(u){return(D)=>async(B)=>{let{request:A}=B;if(u.expectContinueHeader!==!1&&s5.HttpRequest.isInstance(A)&&A.body&&u.runtime==="node"&&u.requestHandler?.constructor?.name!=="FetchHttpHandler"){let F=!0;if(typeof u.expectContinueHeader==="number")try{F=(Number(A.headers?.["content-length"])??u.bodyLengthChecker?.(A.body)??1/0)>=u.expectContinueHeader}catch(w){}else F=!!u.expectContinueHeader;if(F)A.headers.Expect="100-continue"}return D({...B,request:A})}}var HK={step:"build",tags:["SET_EXPECT_HEADER","EXPECT_HEADER"],name:"addExpectContinueMiddleware",override:!0},t5=(u)=>({applyToStack:(D)=>{D.add(xK(u),HK)}});var S2={WHEN_SUPPORTED:"WHEN_SUPPORTED",WHEN_REQUIRED:"WHEN_REQUIRED"},du=S2.WHEN_SUPPORTED,N0={WHEN_SUPPORTED:"WHEN_SUPPORTED",WHEN_REQUIRED:"WHEN_REQUIRED"},iu=S2.WHEN_SUPPORTED,V;(function(u){u.MD5="MD5",u.CRC32="CRC32",u.CRC32C="CRC32C",u.CRC64NVME="CRC64NVME",u.SHA1="SHA1",u.SHA256="SHA256"})(V||(V={}));var o5;(function(u){u.HEADER="header",u.TRAILER="trailer"})(o5||(o5={}));var Gu=V.CRC32;var i2;(function(u){u.ENV="env",u.CONFIG="shared config entry"})(i2||(i2={}));var h0=(u,D,B,A)=>{if(!(D in u))return;let F=u[D].toUpperCase();if(!Object.values(B).includes(F))throw TypeError(`Cannot load ${A} '${D}'. Expected one of ${Object.values(B)}, got '${u[D]}'.`);return F};var SK="AWS_REQUEST_CHECKSUM_CALCULATION",RK="request_checksum_calculation",e5={environmentVariableSelector:(u)=>h0(u,SK,S2,i2.ENV),configFileSelector:(u)=>h0(u,RK,S2,i2.CONFIG),default:du};var UK="AWS_RESPONSE_CHECKSUM_VALIDATION",MK="response_checksum_validation",u4={environmentVariableSelector:(u)=>h0(u,UK,N0,i2.ENV),configFileSelector:(u)=>h0(u,MK,N0,i2.CONFIG),default:iu};var x0=Y(H0(),1),Q4=Y(g2(),1),v4=Y(ou(),1);var D4=(u,{requestChecksumRequired:D,requestAlgorithmMember:B,requestChecksumCalculation:A})=>{if(!B)return A===S2.WHEN_SUPPORTED||D?Gu:void 0;if(!u[B])return;return u[B]};var $0=(u)=>u===V.MD5?"content-md5":`x-amz-checksum-${u.toLowerCase()}`;var B4=(u,D)=>{let B=u.toLowerCase();for(let A of Object.keys(D))if(B===A.toLowerCase())return!0;return!1};var A4=(u,D)=>{let B=u.toLowerCase();for(let A of Object.keys(D))if(A.toLowerCase().startsWith(B))return!0;return!1};var F4=Y(LK(),1),ru=(u)=>u!==void 0&&typeof u!=="string"&&!ArrayBuffer.isView(u)&&!F4.isArrayBuffer(u);var w4=Y(EK(),1),{__extends:YM,__assign:WM,__rest:KM,__decorate:hM,__param:xM,__esDecorate:HM,__runInitializers:SM,__propKey:RM,__setFunctionName:UM,__metadata:MM,__awaiter:nu,__generator:pu,__exportStar:LM,__createBinding:EM,__values:au,__read:OM,__spread:CM,__spreadArrays:PM,__spreadArray:cM,__await:VM,__asyncGenerator:kM,__asyncDelegator:yM,__asyncValues:TM,__makeTemplateObject:IM,__importStar:qM,__importDefault:mM,__classPrivateFieldGet:_M,__classPrivateFieldSet:gM,__classPrivateFieldIn:fM,__addDisposableResource:bM,__disposeResources:jM,__rewriteRelativeImportExtension:lM}=w4.default;import{Buffer as G4}from"buffer";var N4=(u,D)=>{if(typeof u!=="string")throw TypeError(`The "input" argument must be of type string. Received type ${typeof u} (${u})`);return D?G4.from(u,D):G4.from(u)};var _3=(u)=>{let D=N4(u,"utf8");return new Uint8Array(D.buffer,D.byteOffset,D.byteLength/Uint8Array.BYTES_PER_ELEMENT)};var OK=typeof Buffer<"u"&&Buffer.from?function(u){return Buffer.from(u,"utf8")}:_3;function Nu(u){if(u instanceof Uint8Array)return u;if(typeof u==="string")return OK(u);if(ArrayBuffer.isView(u))return new Uint8Array(u.buffer,u.byteOffset,u.byteLength/Uint8Array.BYTES_PER_ELEMENT);return new Uint8Array(u)}function $u(u){if(typeof u==="string")return u.length===0;return u.byteLength===0}function z0(u){return new Uint8Array([(u&4278190080)>>24,(u&16711680)>>16,(u&65280)>>8,u&255])}function zu(u){if(!Uint32Array.from){var D=new Uint32Array(u.length),B=0;while(B<u.length)D[B]=u[B],B+=1;return D}return Uint32Array.from(u)}var f3=function(){function u(){this.crc32c=new g3}return u.prototype.update=function(D){if($u(D))return;this.crc32c.update(Nu(D))},u.prototype.digest=function(){return nu(this,void 0,void 0,function(){return pu(this,function(D){return[2,z0(this.crc32c.digest())]})})},u.prototype.reset=function(){this.crc32c=new g3},u}();var g3=function(){function u(){this.checksum=4294967295}return u.prototype.update=function(D){var B,A;try{for(var F=au(D),w=F.next();!w.done;w=F.next()){var G=w.value;this.checksum=this.checksum>>>8^PK[(this.checksum^G)&255]}}catch(N){B={error:N}}finally{try{if(w&&!w.done&&(A=F.return))A.call(F)}finally{if(B)throw B.error}}return this},u.prototype.digest=function(){return(this.checksum^4294967295)>>>0},u}();var CK=[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],PK=zu(CK);var cK=()=>{let D=[,,,,,,,,];for(let B=0;B<8;B++){let A=Array(512);for(let F=0;F<256;F++){let w=BigInt(F);for(let G=0;G<8*(B+1);G++)if(w&1n)w=w>>1n^0x9a6c9329ac4bc9b5n;else w=w>>1n;A[F*2]=Number(w>>32n&0xffffffffn),A[F*2+1]=Number(w&0xffffffffn)}D[B]=new Uint32Array(A)}return D},b3,Zu,j3,l3,d3,i3,r3,n3,p3,VK=()=>{if(!b3)b3=cK(),[Zu,j3,l3,d3,i3,r3,n3,p3]=b3};class a3{c1=0;c2=0;constructor(){VK(),this.reset()}update(u){let D=u.length,B=0,A=this.c1,F=this.c2;while(B+8<=D){let w=((F^u[B++])&255)<<1,G=((F>>>8^u[B++])&255)<<1,N=((F>>>16^u[B++])&255)<<1,$=((F>>>24^u[B++])&255)<<1,Z=((A^u[B++])&255)<<1,v=((A>>>8^u[B++])&255)<<1,J=((A>>>16^u[B++])&255)<<1,Q=((A>>>24^u[B++])&255)<<1;A=p3[w]^n3[G]^r3[N]^i3[$]^d3[Z]^l3[v]^j3[J]^Zu[Q],F=p3[w+1]^n3[G+1]^r3[N+1]^i3[$+1]^d3[Z+1]^l3[v+1]^j3[J+1]^Zu[Q+1]}while(B<D){let w=((F^u[B])&255)<<1;F=(F>>>8|(A&255)<<24)>>>0,A=A>>>8^Zu[w],F^=Zu[w+1],B++}this.c1=A,this.c2=F}async digest(){let u=this.c1^4294967295,D=this.c2^4294967295;return new Uint8Array([u>>>24,u>>>16&255,u>>>8&255,u&255,D>>>24,D>>>16&255,D>>>8&255,D&255])}reset(){this.c1=4294967295,this.c2=4294967295}}var s3={CrtCrc64Nvme:null};var t3=function(){function u(){this.crc32=new Z0}return u.prototype.update=function(D){if($u(D))return;this.crc32.update(Nu(D))},u.prototype.digest=function(){return nu(this,void 0,void 0,function(){return pu(this,function(D){return[2,z0(this.crc32.digest())]})})},u.prototype.reset=function(){this.crc32=new Z0},u}();var Z0=function(){function u(){this.checksum=4294967295}return u.prototype.update=function(D){var B,A;try{for(var F=au(D),w=F.next();!w.done;w=F.next()){var G=w.value;this.checksum=this.checksum>>>8^yK[(this.checksum^G)&255]}}catch(N){B={error:N}}finally{try{if(w&&!w.done&&(A=F.return))A.call(F)}finally{if(B)throw B.error}}return this},u.prototype.digest=function(){return(this.checksum^4294967295)>>>0},u}();var kK=[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],yK=zu(kK);import*as o3 from"zlib";class $4{checksum=0;update(u){this.checksum=o3.crc32(u,this.checksum)}async digest(){return z0(this.checksum)}reset(){this.checksum=0}}var z4=()=>{if(typeof o3.crc32>"u")return t3;return $4};var Z4=[V.CRC32,V.CRC32C,V.CRC64NVME,V.SHA1,V.SHA256],e3=[V.SHA256,V.SHA1,V.CRC32,V.CRC32C,V.CRC64NVME];var su=(u,D)=>{let{checksumAlgorithms:B={}}=D;switch(u){case V.MD5:return B?.MD5??D.md5;case V.CRC32:return B?.CRC32??z4();case V.CRC32C:return B?.CRC32C??f3;case V.CRC64NVME:if(typeof s3.CrtCrc64Nvme!=="function")return B?.CRC64NVME??a3;return B?.CRC64NVME??s3.CrtCrc64Nvme;case V.SHA1:return B?.SHA1??D.sha1;case V.SHA256:return B?.SHA256??D.sha256;default:if(B?.[u])return B[u];throw Error(`The checksum algorithm "${u}" is not supported by the client. Select one of ${Z4}, or provide an implementation to the client constructor checksums field.`)}};var J4=Y(uD(),1),tu=(u,D)=>{let B=new u;return B.update(J4.toUint8Array(D||"")),B.digest()};var X4={name:"flexibleChecksumsMiddleware",step:"build",tags:["BODY_CHECKSUM"],override:!0},Y4=(u,D)=>(B,A)=>async(F)=>{if(!Q4.HttpRequest.isInstance(F.request))return B(F);if(A4("x-amz-checksum-",F.request.headers))return B(F);let{request:w,input:G}=F,{body:N,headers:$}=w,{base64Encoder:Z,streamHasher:v}=u,{requestChecksumRequired:J,requestAlgorithmMember:Q}=D,X=await u.requestChecksumCalculation(),W=Q?.name,L=Q?.httpHeader;if(W&&!G[W]){if(X===S2.WHEN_SUPPORTED||J){if(G[W]=Gu,L)$[L]=Gu}}let x=D4(G,{requestChecksumRequired:J,requestAlgorithmMember:Q?.name,requestChecksumCalculation:X}),E=N,H=$;if(x){switch(x){case V.CRC32:x0.setFeature(A,"FLEXIBLE_CHECKSUMS_REQ_CRC32","U");break;case V.CRC32C:x0.setFeature(A,"FLEXIBLE_CHECKSUMS_REQ_CRC32C","V");break;case V.CRC64NVME:x0.setFeature(A,"FLEXIBLE_CHECKSUMS_REQ_CRC64","W");break;case V.SHA1:x0.setFeature(A,"FLEXIBLE_CHECKSUMS_REQ_SHA1","X");break;case V.SHA256:x0.setFeature(A,"FLEXIBLE_CHECKSUMS_REQ_SHA256","Y");break}let k=$0(x),g=su(x,u);if(ru(N)){let{getAwsChunkedEncodingStream:y,bodyLengthChecker:H2}=u;E=y(typeof u.requestStreamBufferSize==="number"&&u.requestStreamBufferSize>=8192?v4.createBufferedReadable(N,u.requestStreamBufferSize,A.logger):N,{base64Encoder:Z,bodyLengthChecker:H2,checksumLocationName:k,checksumAlgorithmFn:g,streamHasher:v}),H={...$,"content-encoding":$["content-encoding"]?`${$["content-encoding"]},aws-chunked`:"aws-chunked","transfer-encoding":"chunked","x-amz-decoded-content-length":$["content-length"],"x-amz-content-sha256":"STREAMING-UNSIGNED-PAYLOAD-TRAILER","x-amz-trailer":k},delete H["content-length"]}else if(!B4(k,$)){let y=await tu(g,N);H={...$,[k]:Z(y)}}}try{return await B({...F,request:{...w,headers:H,body:E}})}catch(k){if(k instanceof Error&&k.name==="InvalidChunkSizeError")try{if(!k.message.endsWith("."))k.message+=".";k.message+=" Set [requestStreamBufferSize=number e.g. 65_536] in client constructor to instruct AWS SDK to buffer your input stream."}catch(g){}throw k}};var Ju=Y(H0(),1);var W4={name:"flexibleChecksumsInputMiddleware",toMiddleware:"serializerMiddleware",relation:"before",tags:["BODY_CHECKSUM"],override:!0},K4=(u,D)=>(B,A)=>async(F)=>{let w=F.input,{requestValidationModeMember:G}=D,N=await u.requestChecksumCalculation(),$=await u.responseChecksumValidation();switch(N){case S2.WHEN_REQUIRED:Ju.setFeature(A,"FLEXIBLE_CHECKSUMS_REQ_WHEN_REQUIRED","a");break;case S2.WHEN_SUPPORTED:Ju.setFeature(A,"FLEXIBLE_CHECKSUMS_REQ_WHEN_SUPPORTED","Z");break}switch($){case N0.WHEN_REQUIRED:Ju.setFeature(A,"FLEXIBLE_CHECKSUMS_RES_WHEN_REQUIRED","c");break;case N0.WHEN_SUPPORTED:Ju.setFeature(A,"FLEXIBLE_CHECKSUMS_RES_WHEN_SUPPORTED","b");break}if(G&&!w[G]){if($===N0.WHEN_SUPPORTED)w[G]="ENABLED"}return B(F)};var R4=Y(g2(),1);var eu=(u=[])=>{let D=[],B=e3.length;for(let A of u){let F=e3.indexOf(A);if(F!==-1)D[F]=A;else D[B++]=A}return D.filter(Boolean)};var h4=(u)=>{let D=u.lastIndexOf("-");if(D!==-1){let B=u.slice(D+1);if(!B.startsWith("0")){let A=parseInt(B,10);if(!isNaN(A)&&A>=1&&A<=1e4)return!0}}return!1};var H4=Y(ou(),1);var x4=async(u,{checksumAlgorithmFn:D,base64Encoder:B})=>B(await tu(D,u));var S4=async(u,{config:D,responseAlgorithms:B,logger:A})=>{let F=eu(B),{body:w,headers:G}=u;for(let N of F){let $=$0(N),Z=G[$];if(Z){let v;try{v=su(N,D)}catch(X){if(N===V.CRC64NVME){A?.warn(`Skipping ${V.CRC64NVME} checksum validation: ${X.message}`);continue}throw X}let{base64Encoder:J}=D;if(ru(w)){u.body=H4.createChecksumStream({expectedChecksum:Z,checksumSourceLocation:$,checksum:new v,source:w,base64Encoder:J});return}let Q=await x4(w,{checksumAlgorithmFn:v,base64Encoder:J});if(Q===Z)break;throw Error(`Checksum mismatch: expected "${Q}" but received "${Z}" in response header "${$}".`)}}};var U4={name:"flexibleChecksumsResponseMiddleware",toMiddleware:"deserializerMiddleware",relation:"after",tags:["BODY_CHECKSUM"],override:!0},M4=(u,D)=>(B,A)=>async(F)=>{if(!R4.HttpRequest.isInstance(F.request))return B(F);let w=F.input,G=await B(F),N=G.response,{requestValidationModeMember:$,responseAlgorithms:Z}=D;if($&&w[$]==="ENABLED"){let{clientName:v,commandName:J}=A,Q=Object.keys(u.checksumAlgorithms??{}).filter((L)=>{let x=$0(L);return N.headers[x]!==void 0}),X=eu([...Z??[],...Q]);if(v==="S3Client"&&J==="GetObjectCommand"&&X.every((L)=>{let x=$0(L),E=N.headers[x];return!E||h4(E)}))return G;await S4(N,{config:u,responseAlgorithms:X,logger:A.logger})}return G};var u1=(u,D)=>({applyToStack:(B)=>{B.add(Y4(u,D),X4),B.addRelativeTo(K4(u,D),W4),B.addRelativeTo(M4(u,D),U4)}});var DD=Y(BD(),1);var L4=(u)=>{let{requestChecksumCalculation:D,responseChecksumValidation:B,requestStreamBufferSize:A}=u;return Object.assign(u,{requestChecksumCalculation:DD.normalizeProvider(D??du),responseChecksumValidation:DD.normalizeProvider(B??iu),requestStreamBufferSize:Number(A??0),checksumAlgorithms:u.checksumAlgorithms??{}})};var j1=Y(Ux(),1),KB=Y(Mx(),1),hB=Y(Lx(),1);var E4=Y(g2(),1),O4=Y(R2(),1),TK="content-length",IK="x-amz-decoded-content-length";function qK(){return(u,D)=>async(B)=>{let{request:A}=B;if(E4.HttpRequest.isInstance(A)){if(!(TK in A.headers)&&!(IK in A.headers))if(typeof D?.logger?.warn==="function"&&!(D.logger instanceof O4.NoOpLogger))D.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 u({...B})}}var mK={step:"finalizeRequest",tags:["CHECK_CONTENT_LENGTH_HEADER"],name:"getCheckContentLengthHeaderPlugin",override:!0},C4=(u)=>({applyToStack:(D)=>{D.add(qK(),mK)}});var P4=(u)=>{return(D,B)=>async(A)=>{let F=await u.region(),w=u.region,G=()=>{};if(B.__s3RegionRedirect)Object.defineProperty(u,"region",{writable:!1,value:async()=>{return B.__s3RegionRedirect}}),G=()=>Object.defineProperty(u,"region",{writable:!0,value:w});try{let N=await D(A);if(B.__s3RegionRedirect){G();let $=await u.region();if(F!==$)throw Error("Region was not restored following S3 region redirect.")}return N}catch(N){throw G(),N}}},c4={tags:["REGION_REDIRECT","S3"],name:"regionRedirectEndpointMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"};function _K(u){return(D,B)=>async(A)=>{try{return await D(A)}catch(F){if(u.followRegionRedirects){let w=F?.$metadata?.httpStatusCode,G=B.commandName==="HeadBucketCommand",N=F?.$response?.headers?.["x-amz-bucket-region"];if(N){if(w===301||w===400&&(F?.name==="IllegalLocationConstraintException"||G)){try{let $=N;B.logger?.debug(`Redirecting from ${await u.region()} to ${$}`),B.__s3RegionRedirect=$}catch($){throw Error("Region redirect failed: "+$)}return D(A)}}}throw F}}}var gK={step:"initialize",tags:["REGION_REDIRECT","S3"],name:"regionRedirectMiddleware",override:!0},V4=(u)=>({applyToStack:(D)=>{D.add(_K(u),gK),D.addRelativeTo(P4(u),c4)}});var k4=Y(g2(),1),y4=Y(R2(),1),fK=(u)=>{return(D,B)=>async(A)=>{let F=await D(A),{response:w}=F;if(k4.HttpResponse.isInstance(w)){if(w.headers.expires){w.headers.expiresstring=w.headers.expires;try{y4.parseRfc7231DateTime(w.headers.expires)}catch(G){B.logger?.warn(`AWS SDK Warning for ${B.clientName}::${B.commandName} response parsing (${w.headers.expires}): ${G}`),delete w.headers.expires}}}return F}},bK={tags:["S3"],name:"s3ExpiresMiddleware",override:!0,relation:"after",toMiddleware:"deserializerMiddleware"},D1=(u)=>({applyToStack:(D)=>{D.addRelativeTo(fK(u),bK)}});class B1{data;lastPurgeTime=Date.now();static EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS=30000;constructor(u={}){this.data=u}get(u){let D=this.data[u];if(!D)return;return D}set(u,D){return this.data[u]=D,D}delete(u){delete this.data[u]}async purgeExpired(){let u=Date.now();if(this.lastPurgeTime+B1.EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS>u)return;for(let D in this.data){let B=this.data[D];if(!B.isRefreshing){let A=await B.identity;if(A.expiration){if(A.expiration.getTime()<u)delete this.data[D]}}}}}class Qu{_identity;isRefreshing;accessed;constructor(u,D=!1,B=Date.now()){this._identity=u,this.isRefreshing=D,this.accessed=B}get identity(){return this.accessed=Date.now(),this._identity}}class vu{createSessionFn;cache;static REFRESH_WINDOW_MS=60000;constructor(u,D=new B1){this.createSessionFn=u,this.cache=D}async getS3ExpressIdentity(u,D){let B=D.Bucket,{cache:A}=this,F=A.get(B);if(F)return F.identity.then((w)=>{if((w.expiration?.getTime()??0)<Date.now())return A.set(B,new Qu(this.getIdentity(B))).identity;if((w.expiration?.getTime()??0)<Date.now()+vu.REFRESH_WINDOW_MS&&!F.isRefreshing)F.isRefreshing=!0,this.getIdentity(B).then(($)=>{A.set(B,new Qu(Promise.resolve($)))});return w});return A.set(B,new Qu(this.getIdentity(B))).identity}async getIdentity(u){await this.cache.purgeExpired().catch((A)=>{console.warn(`Error while clearing expired entries in S3ExpressIdentityCache:
4
- `+A)});let D=await this.createSessionFn(u);if(!D.Credentials?.AccessKeyId||!D.Credentials?.SecretAccessKey)throw Error("s3#createSession response credential missing AccessKeyId or SecretAccessKey.");return{accessKeyId:D.Credentials.AccessKeyId,secretAccessKey:D.Credentials.SecretAccessKey,sessionToken:D.Credentials.SessionToken,expiration:D.Credentials.Expiration?new Date(D.Credentials.Expiration):void 0}}}var b4=Y(f4(),1);var S0=Y(T4(),1),I4="Directory",q4="S3Express",m4="sigv4-s3express",A1="X-Amz-S3session-Token",Xu=A1.toLowerCase(),jK="AWS_S3_DISABLE_EXPRESS_SESSION_AUTH",lK="s3_disable_express_session_auth",AD={environmentVariableSelector:(u)=>S0.booleanSelector(u,jK,S0.SelectorType.ENV),configFileSelector:(u)=>S0.booleanSelector(u,lK,S0.SelectorType.CONFIG),default:!1};class F1 extends b4.SignatureV4{async signWithCredentials(u,D,B){let A=_4(D);u.headers[Xu]=D.sessionToken;let F=this;return g4(F,A),F.signRequest(u,B??{})}async presignWithCredentials(u,D,B){let A=_4(D);return delete u.headers[Xu],u.headers[A1]=D.sessionToken,u.query=u.query??{},u.query[A1]=D.sessionToken,g4(this,A),this.presign(u,B)}}function _4(u){return{accessKeyId:u.accessKeyId,secretAccessKey:u.secretAccessKey,expiration:u.expiration}}function g4(u,D){let B=setTimeout(()=>{throw Error("SignatureV4S3Express credential override was created but not called.")},10),A=u.credentialProvider,F=()=>{return clearTimeout(B),u.credentialProvider=A,Promise.resolve(D)};u.credentialProvider=F}var j4=Y(H0(),1),l4=Y(g2(),1);var d4=(u)=>{return(D,B)=>async(A)=>{if(B.endpointV2){let F=B.endpointV2,w=F.properties?.authSchemes?.[0]?.name===m4;if(F.properties?.backend===q4||F.properties?.bucketType===I4)j4.setFeature(B,"S3_EXPRESS_BUCKET","J"),B.isS3ExpressBucket=!0;if(w){let N=A.input.Bucket;if(N){let $=await u.s3ExpressIdentityProvider.getS3ExpressIdentity(await u.credentials(),{Bucket:N});if(B.s3ExpressIdentity=$,l4.HttpRequest.isInstance(A.request)&&$.sessionToken)A.request.headers[Xu]=$.sessionToken}}}return D(A)}},i4={name:"s3ExpressMiddleware",step:"build",tags:["S3","S3_EXPRESS"],override:!0},FD=(u)=>({applyToStack:(D)=>{D.add(d4(u),i4)}});var p4=Y(n4(),1),a4=Y(g2(),1),s4=Y(BD(),1);var r4=async(u,D,B,A)=>{let F=await A.signWithCredentials(B,u,{});if(F.headers["X-Amz-Security-Token"]||F.headers["x-amz-security-token"])throw Error("X-Amz-Security-Token must not be set for s3-express requests.");return F};var dK=(u)=>(D)=>{throw D},iK=(u,D)=>{};var t4=(u)=>(D,B)=>async(A)=>{if(!a4.HttpRequest.isInstance(A.request))return D(A);let w=s4.getSmithyContext(B).selectedHttpAuthScheme;if(!w)throw Error("No HttpAuthScheme was selected: unable to sign request");let{httpAuthOption:{signingProperties:G={}},identity:N,signer:$}=w,Z;if(B.s3ExpressIdentity)Z=await r4(B.s3ExpressIdentity,G,A.request,await u.signer());else Z=await $.sign(A.request,N,G);let v=await D({...A,request:Z}).catch(($.errorHandler||dK)(G));return($.successHandler||iK)(v.response,G),v},wD=(u)=>({applyToStack:(D)=>{D.addRelativeTo(t4(u),p4.httpSigningMiddlewareOptions)}});var o4=(u,{session:D})=>{let[B,A]=D,{forcePathStyle:F,useAccelerateEndpoint:w,disableMultiregionAccessPoints:G,followRegionRedirects:N,s3ExpressIdentityProvider:$,bucketEndpoint:Z,expectContinueHeader:v}=u;return Object.assign(u,{forcePathStyle:F??!1,useAccelerateEndpoint:w??!1,disableMultiregionAccessPoints:G??!1,followRegionRedirects:N??!1,s3ExpressIdentityProvider:$??new vu(async(J)=>B().send(new A({Bucket:J}))),bucketEndpoint:Z??!1,expectContinueHeader:v??2097152})};var e4=Y(g2(),1),w1=Y(ou(),1),rK={CopyObjectCommand:!0,UploadPartCopyCommand:!0,CompleteMultipartUploadCommand:!0},nK=3000,pK=(u)=>(D,B)=>async(A)=>{let F=await D(A),{response:w}=F;if(!e4.HttpResponse.isInstance(w))return F;let{statusCode:G,body:N}=w;if(G<200||G>=300)return F;if(!(typeof N?.stream==="function"||typeof N?.pipe==="function"||typeof N?.tee==="function"))return F;let Z=N,v=N;if(N&&typeof N==="object"&&!(N instanceof Uint8Array))[Z,v]=await w1.splitStream(N);w.body=v;let J=await aK(Z,{streamCollector:async(X)=>{return w1.headStream(X,nK)}});if(typeof Z?.destroy==="function")Z.destroy();let Q=u.utf8Encoder(J.subarray(J.length-16));if(J.length===0&&rK[B.commandName]){let X=Error("S3 aborted request");throw X.name="InternalError",X}if(Q&&Q.endsWith("</Error>"))w.statusCode=400;return F},aK=(u=new Uint8Array,D)=>{if(u instanceof Uint8Array)return Promise.resolve(u);return D.streamCollector(u)||Promise.resolve(new Uint8Array)},sK={relation:"after",toMiddleware:"deserializerMiddleware",tags:["THROW_200_EXCEPTIONS","S3"],name:"throw200ExceptionsMiddleware",override:!0},r2=(u)=>({applyToStack:(D)=>{D.addRelativeTo(pK(u),sK)}});var u9=(u)=>typeof u==="string"&&u.indexOf("arn:")===0&&u.split(":").length>=6;function D9(u){return(D,B)=>async(A)=>{if(u.bucketEndpoint){let F=B.endpointV2;if(F){let w=A.input.Bucket;if(typeof w==="string")try{let G=new URL(w);B.endpointV2={...F,url:G}}catch(G){let N=`@aws-sdk/middleware-sdk-s3: bucketEndpoint=true was set but Bucket=${w} could not be parsed as URL.`;if(B.logger?.constructor?.name==="NoOpLogger")console.warn(N);else B.logger?.warn?.(N);throw G}}}return D(A)}}var B9={name:"bucketEndpointMiddleware",override:!0,relation:"after",toMiddleware:"endpointV2Middleware"};function tK({bucketEndpoint:u}){return(D)=>async(B)=>{let{input:{Bucket:A}}=B;if(!u&&typeof A==="string"&&!u9(A)&&A.indexOf("/")>=0){let F=Error(`Bucket name shouldn't contain '/', received '${A}'`);throw F.name="InvalidBucketName",F}return D({...B})}}var oK={step:"initialize",tags:["VALIDATE_BUCKET_NAME"],name:"validateBucketNameMiddleware",override:!0},A9=(u)=>({applyToStack:(D)=>{D.add(tK(u),oK),D.addRelativeTo(D9(u),B9)}});var l1=Y(Ex(),1),xB=Y($B(),1),V0=Y(n4(),1),HB=Y(R6(),1);var F9=(u)=>Object.assign(u,{eventStreamMarshaller:u.eventStreamSerdeProvider(u)});var SB=Y(Ox(),1),RB=Y(J0(),1),d1=Y(zB(),1),UB=Y(R2(),1);var J1=Y(H0(),1);var GD=Y(f4(),1);var Yu={CrtSignerV4:null};class Wu{sigv4aSigner;sigv4Signer;signerOptions;static sigv4aDependency(){if(typeof Yu.CrtSignerV4==="function")return"crt";else if(typeof GD.signatureV4aContainer.SignatureV4a==="function")return"js";return"none"}constructor(u){this.sigv4Signer=new F1(u),this.signerOptions=u}async sign(u,D={}){if(D.signingRegion==="*")return this.getSigv4aSigner().sign(u,D);return this.sigv4Signer.sign(u,D)}async signWithCredentials(u,D,B={}){if(B.signingRegion==="*"){let A=this.getSigv4aSigner(),F=Yu.CrtSignerV4;if(F&&A instanceof F)return A.signWithCredentials(u,D,B);else throw Error(`signWithCredentials with signingRegion '*' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. You 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";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt`)}return this.sigv4Signer.signWithCredentials(u,D,B)}async presign(u,D={}){if(D.signingRegion==="*"){let B=this.getSigv4aSigner(),A=Yu.CrtSignerV4;if(A&&B instanceof A)return B.presign(u,D);else throw Error(`presign with signingRegion '*' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. You 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";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt`)}return this.sigv4Signer.presign(u,D)}async presignWithCredentials(u,D,B={}){if(B.signingRegion==="*")throw Error("Method presignWithCredentials is not supported for [signingRegion=*].");return this.sigv4Signer.presignWithCredentials(u,D,B)}getSigv4aSigner(){if(!this.sigv4aSigner){let u=Yu.CrtSignerV4,D=GD.signatureV4aContainer.SignatureV4a;if(this.signerOptions.runtime==="node"){if(!u&&!D)throw Error("Neither CRT nor JS SigV4a implementation is available. Please load either @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt");if(u&&typeof u==="function")this.sigv4aSigner=new u({...this.signerOptions,signingAlgorithm:1});else if(D&&typeof D==="function")this.sigv4aSigner=new D({...this.signerOptions});else throw Error("Available SigV4a implementation is not a valid constructor. Please ensure you've properly imported @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a.For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt")}else{if(!D||typeof D!=="function")throw Error("JS SigV4a implementation is not available or not a valid constructor. Please check whether you have installed the @aws-sdk/signature-v4a package explicitly. The CRT implementation is not available for browsers. You must also register the package by calling [require('@aws-sdk/signature-v4a');] or an ESM equivalent such as [import '@aws-sdk/signature-v4a';]. For more information please go to https://github.com/aws/aws-sdk-js-v3#using-javascript-non-crt-implementation-of-sigv4a");this.sigv4aSigner=new D({...this.signerOptions})}}return this.sigv4aSigner}}var v6=Y(J0(),1),E0=Y(BD(),1);var Q6=Y(zh(),1),L0=Y($h(),1);var R0={["required"]:!1,["type"]:"string"},U0={["required"]:!0,default:!1,["type"]:"boolean"},Ku={["required"]:!1,["type"]:"boolean"},M2={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"Accelerate"},!0]},I={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseFIPS"},!0]},T={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseDualStack"},!0]},j={["fn"]:"isSet",["argv"]:[{["ref"]:"Endpoint"}]},F6={["fn"]:"aws.partition",["argv"]:[{["ref"]:"Region"}],["assign"]:"partitionResult"},w9={["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[{["ref"]:"partitionResult"},"name"]},"aws-cn"]},xu={["fn"]:"isSet",["argv"]:[{["ref"]:"Bucket"}]},C={["ref"]:"Bucket"},G9={["conditions"]:[M2],["error"]:"S3Express does not support S3 Accelerate.",["type"]:"error"},N9={["conditions"]:[j,{["fn"]:"parseURL",["argv"]:[{["ref"]:"Endpoint"}],["assign"]:"url"}],["rules"]:[{["conditions"]:[{["fn"]:"isSet",["argv"]:[{["ref"]:"DisableS3ExpressSessionAuth"}]},{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"DisableS3ExpressSessionAuth"},!0]}],["rules"]:[{["conditions"]:[{["fn"]:"booleanEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[{["ref"]:"url"},"isIp"]},!0]}],["rules"]:[{["conditions"]:[{["fn"]:"uriEncode",["argv"]:[C],["assign"]:"uri_encoded_bucket"}],["rules"]:[{["endpoint"]:{["url"]:"{url#scheme}://{url#authority}/{uri_encoded_bucket}{url#path}",["properties"]:{["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},["headers"]:{}},["type"]:"endpoint"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"aws.isVirtualHostableS3Bucket",["argv"]:[C,!1]}],["rules"]:[{["endpoint"]:{["url"]:"{url#scheme}://{Bucket}.{url#authority}{url#path}",["properties"]:{["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},["headers"]:{}},["type"]:"endpoint"}],["type"]:"tree"},{["error"]:"S3Express bucket name is not a valid virtual hostable name.",["type"]:"error"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"booleanEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[{["ref"]:"url"},"isIp"]},!0]}],["rules"]:[{["conditions"]:[{["fn"]:"uriEncode",["argv"]:[C],["assign"]:"uri_encoded_bucket"}],["rules"]:[{["endpoint"]:{["url"]:"{url#scheme}://{url#authority}/{uri_encoded_bucket}{url#path}",["properties"]:{["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4-s3express",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},["headers"]:{}},["type"]:"endpoint"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"aws.isVirtualHostableS3Bucket",["argv"]:[C,!1]}],["rules"]:[{["endpoint"]:{["url"]:"{url#scheme}://{Bucket}.{url#authority}{url#path}",["properties"]:{["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4-s3express",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},["headers"]:{}},["type"]:"endpoint"}],["type"]:"tree"},{["error"]:"S3Express bucket name is not a valid virtual hostable name.",["type"]:"error"}],["type"]:"tree"},$2={["fn"]:"parseURL",["argv"]:[{["ref"]:"Endpoint"}],["assign"]:"url"},ND={["fn"]:"booleanEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[{["ref"]:"url"},"isIp"]},!0]},w6={["ref"]:"url"},G6={["fn"]:"uriEncode",["argv"]:[C],["assign"]:"uri_encoded_bucket"},W2={["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},K={},N6={["fn"]:"aws.isVirtualHostableS3Bucket",["argv"]:[C,!1]},$9={["error"]:"S3Express bucket name is not a valid virtual hostable name.",["type"]:"error"},z9={["fn"]:"isSet",["argv"]:[{["ref"]:"UseS3ExpressControlEndpoint"}]},Z9={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseS3ExpressControlEndpoint"},!0]},h={["fn"]:"not",["argv"]:[j]},U={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseDualStack"},!1]},S={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseFIPS"},!1]},G1={["error"]:"Unrecognized S3Express bucket name format.",["type"]:"error"},J9={["fn"]:"not",["argv"]:[xu]},Q9={["ref"]:"hardwareType"},v9={["conditions"]:[h],["error"]:"Expected a endpoint to be specified but no endpoint was found",["type"]:"error"},N1={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4a",["signingName"]:"s3-outposts",["signingRegionSet"]:["*"]},{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3-outposts",["signingRegion"]:"{Region}"}]},$D={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"ForcePathStyle"},!1]},eK={["ref"]:"ForcePathStyle"},l={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"Accelerate"},!1]},p={["fn"]:"stringEquals",["argv"]:[{["ref"]:"Region"},"aws-global"]},t={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3",["signingRegion"]:"us-east-1"}]},O={["fn"]:"not",["argv"]:[p]},o={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseGlobalEndpoint"},!0]},X9={["url"]:"https://{Bucket}.s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:{["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3",["signingRegion"]:"{Region}"}]},["headers"]:{}},d={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3",["signingRegion"]:"{Region}"}]},e={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseGlobalEndpoint"},!1]},Y9={["url"]:"https://{Bucket}.s3-fips.{Region}.{partitionResult#dnsSuffix}",["properties"]:d,["headers"]:{}},W9={["url"]:"https://{Bucket}.s3-accelerate.dualstack.{partitionResult#dnsSuffix}",["properties"]:d,["headers"]:{}},K9={["url"]:"https://{Bucket}.s3.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:d,["headers"]:{}},zD={["fn"]:"booleanEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[w6,"isIp"]},!1]},ZD={["url"]:"{url#scheme}://{url#authority}{url#normalizedPath}{Bucket}",["properties"]:d,["headers"]:{}},cD={["url"]:"{url#scheme}://{Bucket}.{url#authority}{url#path}",["properties"]:d,["headers"]:{}},h9={["endpoint"]:cD,["type"]:"endpoint"},JD={["url"]:"https://{Bucket}.s3-accelerate.{partitionResult#dnsSuffix}",["properties"]:d,["headers"]:{}},x9={["url"]:"https://{Bucket}.s3.{Region}.{partitionResult#dnsSuffix}",["properties"]:d,["headers"]:{}},$1={["error"]:"Invalid region: region was not a valid DNS name.",["type"]:"error"},J2={["ref"]:"bucketArn"},$6={["ref"]:"arnType"},QD={["fn"]:"getAttr",["argv"]:[J2,"service"]},VD={["ref"]:"accessPointName"},H9={["conditions"]:[T],["error"]:"S3 Object Lambda does not support Dual-stack",["type"]:"error"},S9={["conditions"]:[M2],["error"]:"S3 Object Lambda does not support S3 Accelerate",["type"]:"error"},R9={["conditions"]:[{["fn"]:"isSet",["argv"]:[{["ref"]:"DisableAccessPoints"}]},{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"DisableAccessPoints"},!0]}],["error"]:"Access points are not supported for this operation",["type"]:"error"},vD={["conditions"]:[{["fn"]:"isSet",["argv"]:[{["ref"]:"UseArnRegion"}]},{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseArnRegion"},!1]},{["fn"]:"not",["argv"]:[{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[J2,"region"]},"{Region}"]}]}],["error"]:"Invalid configuration: region from ARN `{bucketArn#region}` does not match client region `{Region}` and UseArnRegion is `false`",["type"]:"error"},z6={["fn"]:"getAttr",["argv"]:[{["ref"]:"bucketPartition"},"name"]},Z6={["fn"]:"getAttr",["argv"]:[J2,"accountId"]},XD={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3-object-lambda",["signingRegion"]:"{bucketArn#region}"}]},U9={["error"]:"Invalid ARN: The access point name may only contain a-z, A-Z, 0-9 and `-`. Found: `{accessPointName}`",["type"]:"error"},YD={["error"]:"Invalid ARN: The account id may only contain a-z, A-Z, 0-9 and `-`. Found: `{bucketArn#accountId}`",["type"]:"error"},WD={["error"]:"Invalid region in ARN: `{bucketArn#region}` (invalid DNS name)",["type"]:"error"},KD={["error"]:"Client was configured for partition `{partitionResult#name}` but ARN (`{Bucket}`) has `{bucketPartition#name}`",["type"]:"error"},M9={["error"]:"Invalid ARN: The ARN may only contain a single resource component after `accesspoint`.",["type"]:"error"},L9={["error"]:"Invalid ARN: Expected a resource of the format `accesspoint:<accesspoint name>` but no name was provided",["type"]:"error"},hu={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3",["signingRegion"]:"{bucketArn#region}"}]},E9={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4a",["signingName"]:"s3-outposts",["signingRegionSet"]:["*"]},{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3-outposts",["signingRegion"]:"{bucketArn#region}"}]},O9={["fn"]:"aws.parseArn",["argv"]:[C]},C9={["url"]:"https://s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:d,["headers"]:{}},P9={["url"]:"https://s3-fips.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:d,["headers"]:{}},c9={["url"]:"https://s3.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:d,["headers"]:{}},hD={["url"]:"{url#scheme}://{url#authority}{url#normalizedPath}{uri_encoded_bucket}",["properties"]:d,["headers"]:{}},V9={["url"]:"https://s3.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:d,["headers"]:{}},k9={["ref"]:"UseObjectLambdaEndpoint"},xD={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3-object-lambda",["signingRegion"]:"{Region}"}]},y9={["url"]:"https://s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:d,["headers"]:{}},T9={["url"]:"https://s3-fips.{Region}.{partitionResult#dnsSuffix}",["properties"]:d,["headers"]:{}},I9={["url"]:"https://s3.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:d,["headers"]:{}},HD={["url"]:"{url#scheme}://{url#authority}{url#path}",["properties"]:d,["headers"]:{}},q9={["url"]:"https://s3.{Region}.{partitionResult#dnsSuffix}",["properties"]:d,["headers"]:{}},SD=[{["ref"]:"Region"}],uh=[{["ref"]:"Endpoint"}],Dh=[C],RD=[M2],M0=[j,$2],m9=[{["fn"]:"isSet",["argv"]:[{["ref"]:"DisableS3ExpressSessionAuth"}]},{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"DisableS3ExpressSessionAuth"},!0]}],Bh=[G6],UD=[N6],U2=[F6],MD=[I,T],Hu=[I,U],Su=[S,T],Ru=[S,U],_9=[{["fn"]:"substring",["argv"]:[C,6,14,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[C,14,16,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],I2=[{["conditions"]:[I,T],["endpoint"]:{["url"]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:W2,["headers"]:{}},["type"]:"endpoint"},{["conditions"]:Hu,["endpoint"]:{["url"]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.{Region}.{partitionResult#dnsSuffix}",["properties"]:W2,["headers"]:{}},["type"]:"endpoint"},{["conditions"]:Su,["endpoint"]:{["url"]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:W2,["headers"]:{}},["type"]:"endpoint"},{["conditions"]:Ru,["endpoint"]:{["url"]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.{Region}.{partitionResult#dnsSuffix}",["properties"]:W2,["headers"]:{}},["type"]:"endpoint"}],g9=[{["fn"]:"substring",["argv"]:[C,6,15,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[C,15,17,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],f9=[{["fn"]:"substring",["argv"]:[C,6,19,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[C,19,21,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],b9=[{["fn"]:"substring",["argv"]:[C,6,20,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[C,20,22,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],j9=[{["fn"]:"substring",["argv"]:[C,6,26,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[C,26,28,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],q2=[{["conditions"]:[I,T],["endpoint"]:{["url"]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:{["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4-s3express",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},["headers"]:{}},["type"]:"endpoint"},{["conditions"]:Hu,["endpoint"]:{["url"]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.{Region}.{partitionResult#dnsSuffix}",["properties"]:{["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4-s3express",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},["headers"]:{}},["type"]:"endpoint"},{["conditions"]:Su,["endpoint"]:{["url"]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:{["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4-s3express",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},["headers"]:{}},["type"]:"endpoint"},{["conditions"]:Ru,["endpoint"]:{["url"]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.{Region}.{partitionResult#dnsSuffix}",["properties"]:{["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4-s3express",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},["headers"]:{}},["type"]:"endpoint"}],l9=[C,0,7,!0],d9=[{["fn"]:"substring",["argv"]:[C,7,15,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[C,15,17,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],i9=[{["fn"]:"substring",["argv"]:[C,7,16,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[C,16,18,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],r9=[{["fn"]:"substring",["argv"]:[C,7,20,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[C,20,22,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],n9=[{["fn"]:"substring",["argv"]:[C,7,21,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[C,21,23,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],p9=[{["fn"]:"substring",["argv"]:[C,7,27,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[C,27,29,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],Ah=[xu],a9=[{["fn"]:"isValidHostLabel",["argv"]:[{["ref"]:"outpostId"},!1]}],s9=[{["fn"]:"stringEquals",["argv"]:[{["ref"]:"regionPrefix"},"beta"]}],Fh=["*"],t9=[{["fn"]:"isValidHostLabel",["argv"]:[{["ref"]:"Region"},!1]}],n2=[{["fn"]:"stringEquals",["argv"]:[{["ref"]:"Region"},"us-east-1"]}],LD=[{["fn"]:"stringEquals",["argv"]:[$6,"accesspoint"]}],o9=[{["fn"]:"getAttr",["argv"]:[J2,"resourceId[1]"],["assign"]:"accessPointName"},{["fn"]:"not",["argv"]:[{["fn"]:"stringEquals",["argv"]:[VD,""]}]}],wh=[J2,"resourceId[1]"],e9=[T],ED=[{["fn"]:"not",["argv"]:[{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[J2,"region"]},""]}]}],u6=[{["fn"]:"not",["argv"]:[{["fn"]:"isSet",["argv"]:[{["fn"]:"getAttr",["argv"]:[J2,"resourceId[2]"]}]}]}],Gh=[J2,"resourceId[2]"],OD=[{["fn"]:"aws.partition",["argv"]:[{["fn"]:"getAttr",["argv"]:[J2,"region"]}],["assign"]:"bucketPartition"}],D6=[{["fn"]:"stringEquals",["argv"]:[z6,{["fn"]:"getAttr",["argv"]:[{["ref"]:"partitionResult"},"name"]}]}],CD=[{["fn"]:"isValidHostLabel",["argv"]:[{["fn"]:"getAttr",["argv"]:[J2,"region"]},!0]}],PD=[{["fn"]:"isValidHostLabel",["argv"]:[Z6,!1]}],B6=[{["fn"]:"isValidHostLabel",["argv"]:[VD,!1]}],z1=[I],A6=[{["fn"]:"isValidHostLabel",["argv"]:[{["ref"]:"Region"},!0]}],Nh={version:"1.0",parameters:{Bucket:R0,Region:R0,UseFIPS:U0,UseDualStack:U0,Endpoint:R0,ForcePathStyle:U0,Accelerate:U0,UseGlobalEndpoint:U0,UseObjectLambdaEndpoint:Ku,Key:R0,Prefix:R0,CopySource:R0,DisableAccessPoints:Ku,DisableMultiRegionAccessPoints:U0,UseArnRegion:Ku,UseS3ExpressControlEndpoint:Ku,DisableS3ExpressSessionAuth:Ku},["rules"]:[{["conditions"]:[{["fn"]:"isSet",["argv"]:SD}],["rules"]:[{["conditions"]:[M2,I],error:"Accelerate cannot be used with FIPS",["type"]:"error"},{["conditions"]:[T,j],error:"Cannot set dual-stack in combination with a custom endpoint.",["type"]:"error"},{["conditions"]:[j,I],error:"A custom endpoint cannot be combined with FIPS",["type"]:"error"},{["conditions"]:[j,M2],error:"A custom endpoint cannot be combined with S3 Accelerate",["type"]:"error"},{["conditions"]:[I,F6,w9],error:"Partition does not support FIPS",["type"]:"error"},{["conditions"]:[xu,{["fn"]:"substring",["argv"]:[C,0,6,!0],["assign"]:"bucketSuffix"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"bucketSuffix"},"--x-s3"]}],["rules"]:[G9,N9,{["conditions"]:[z9,Z9],["rules"]:[{["conditions"]:U2,["rules"]:[{["conditions"]:[G6,h],["rules"]:[{["conditions"]:MD,endpoint:{["url"]:"https://s3express-control-fips.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:W2,["headers"]:K},["type"]:"endpoint"},{["conditions"]:Hu,endpoint:{["url"]:"https://s3express-control-fips.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:W2,["headers"]:K},["type"]:"endpoint"},{["conditions"]:Su,endpoint:{["url"]:"https://s3express-control.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:W2,["headers"]:K},["type"]:"endpoint"},{["conditions"]:Ru,endpoint:{["url"]:"https://s3express-control.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:W2,["headers"]:K},["type"]:"endpoint"}],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:UD,["rules"]:[{["conditions"]:U2,["rules"]:[{["conditions"]:m9,["rules"]:[{["conditions"]:_9,["rules"]:I2,["type"]:"tree"},{["conditions"]:g9,["rules"]:I2,["type"]:"tree"},{["conditions"]:f9,["rules"]:I2,["type"]:"tree"},{["conditions"]:b9,["rules"]:I2,["type"]:"tree"},{["conditions"]:j9,["rules"]:I2,["type"]:"tree"},G1],["type"]:"tree"},{["conditions"]:_9,["rules"]:q2,["type"]:"tree"},{["conditions"]:g9,["rules"]:q2,["type"]:"tree"},{["conditions"]:f9,["rules"]:q2,["type"]:"tree"},{["conditions"]:b9,["rules"]:q2,["type"]:"tree"},{["conditions"]:j9,["rules"]:q2,["type"]:"tree"},G1],["type"]:"tree"}],["type"]:"tree"},$9],["type"]:"tree"},{["conditions"]:[xu,{["fn"]:"substring",["argv"]:l9,["assign"]:"accessPointSuffix"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"accessPointSuffix"},"--xa-s3"]}],["rules"]:[G9,N9,{["conditions"]:UD,["rules"]:[{["conditions"]:U2,["rules"]:[{["conditions"]:m9,["rules"]:[{["conditions"]:d9,["rules"]:I2,["type"]:"tree"},{["conditions"]:i9,["rules"]:I2,["type"]:"tree"},{["conditions"]:r9,["rules"]:I2,["type"]:"tree"},{["conditions"]:n9,["rules"]:I2,["type"]:"tree"},{["conditions"]:p9,["rules"]:I2,["type"]:"tree"},G1],["type"]:"tree"},{["conditions"]:d9,["rules"]:q2,["type"]:"tree"},{["conditions"]:i9,["rules"]:q2,["type"]:"tree"},{["conditions"]:r9,["rules"]:q2,["type"]:"tree"},{["conditions"]:n9,["rules"]:q2,["type"]:"tree"},{["conditions"]:p9,["rules"]:q2,["type"]:"tree"},G1],["type"]:"tree"}],["type"]:"tree"},$9],["type"]:"tree"},{["conditions"]:[J9,z9,Z9],["rules"]:[{["conditions"]:U2,["rules"]:[{["conditions"]:M0,endpoint:{["url"]:"{url#scheme}://{url#authority}{url#path}",["properties"]:W2,["headers"]:K},["type"]:"endpoint"},{["conditions"]:MD,endpoint:{["url"]:"https://s3express-control-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:W2,["headers"]:K},["type"]:"endpoint"},{["conditions"]:Hu,endpoint:{["url"]:"https://s3express-control-fips.{Region}.{partitionResult#dnsSuffix}",["properties"]:W2,["headers"]:K},["type"]:"endpoint"},{["conditions"]:Su,endpoint:{["url"]:"https://s3express-control.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:W2,["headers"]:K},["type"]:"endpoint"},{["conditions"]:Ru,endpoint:{["url"]:"https://s3express-control.{Region}.{partitionResult#dnsSuffix}",["properties"]:W2,["headers"]:K},["type"]:"endpoint"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[xu,{["fn"]:"substring",["argv"]:[C,49,50,!0],["assign"]:"hardwareType"},{["fn"]:"substring",["argv"]:[C,8,12,!0],["assign"]:"regionPrefix"},{["fn"]:"substring",["argv"]:l9,["assign"]:"bucketAliasSuffix"},{["fn"]:"substring",["argv"]:[C,32,49,!0],["assign"]:"outpostId"},{["fn"]:"aws.partition",["argv"]:SD,["assign"]:"regionPartition"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"bucketAliasSuffix"},"--op-s3"]}],["rules"]:[{["conditions"]:a9,["rules"]:[{["conditions"]:UD,["rules"]:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Q9,"e"]}],["rules"]:[{["conditions"]:s9,["rules"]:[v9,{["conditions"]:M0,endpoint:{["url"]:"https://{Bucket}.ec2.{url#authority}",["properties"]:N1,["headers"]:K},["type"]:"endpoint"}],["type"]:"tree"},{endpoint:{["url"]:"https://{Bucket}.ec2.s3-outposts.{Region}.{regionPartition#dnsSuffix}",["properties"]:N1,["headers"]:K},["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Q9,"o"]}],["rules"]:[{["conditions"]:s9,["rules"]:[v9,{["conditions"]:M0,endpoint:{["url"]:"https://{Bucket}.op-{outpostId}.{url#authority}",["properties"]:N1,["headers"]:K},["type"]:"endpoint"}],["type"]:"tree"},{endpoint:{["url"]:"https://{Bucket}.op-{outpostId}.s3-outposts.{Region}.{regionPartition#dnsSuffix}",["properties"]:N1,["headers"]:K},["type"]:"endpoint"}],["type"]:"tree"},{error:'Unrecognized hardware type: "Expected hardware type o or e but got {hardwareType}"',["type"]:"error"}],["type"]:"tree"},{error:"Invalid Outposts Bucket alias - it must be a valid bucket name.",["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"]:Ah,["rules"]:[{["conditions"]:[j,{["fn"]:"not",["argv"]:[{["fn"]:"isSet",["argv"]:[{["fn"]:"parseURL",["argv"]:uh}]}]}],error:"Custom endpoint `{Endpoint}` was not a valid URI",["type"]:"error"},{["conditions"]:[$D,N6],["rules"]:[{["conditions"]:U2,["rules"]:[{["conditions"]:t9,["rules"]:[{["conditions"]:[M2,w9],error:"S3 Accelerate cannot be used in this region",["type"]:"error"},{["conditions"]:[T,I,l,h,p],endpoint:{["url"]:"https://{Bucket}.s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[T,I,l,h,O,o],["rules"]:[{endpoint:X9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[T,I,l,h,O,e],endpoint:X9,["type"]:"endpoint"},{["conditions"]:[U,I,l,h,p],endpoint:{["url"]:"https://{Bucket}.s3-fips.us-east-1.{partitionResult#dnsSuffix}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[U,I,l,h,O,o],["rules"]:[{endpoint:Y9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[U,I,l,h,O,e],endpoint:Y9,["type"]:"endpoint"},{["conditions"]:[T,S,M2,h,p],endpoint:{["url"]:"https://{Bucket}.s3-accelerate.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[T,S,M2,h,O,o],["rules"]:[{endpoint:W9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[T,S,M2,h,O,e],endpoint:W9,["type"]:"endpoint"},{["conditions"]:[T,S,l,h,p],endpoint:{["url"]:"https://{Bucket}.s3.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[T,S,l,h,O,o],["rules"]:[{endpoint:K9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[T,S,l,h,O,e],endpoint:K9,["type"]:"endpoint"},{["conditions"]:[U,S,l,j,$2,ND,p],endpoint:{["url"]:"{url#scheme}://{url#authority}{url#normalizedPath}{Bucket}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[U,S,l,j,$2,zD,p],endpoint:{["url"]:"{url#scheme}://{Bucket}.{url#authority}{url#path}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[U,S,l,j,$2,ND,O,o],["rules"]:[{["conditions"]:n2,endpoint:ZD,["type"]:"endpoint"},{endpoint:ZD,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[U,S,l,j,$2,zD,O,o],["rules"]:[{["conditions"]:n2,endpoint:cD,["type"]:"endpoint"},h9],["type"]:"tree"},{["conditions"]:[U,S,l,j,$2,ND,O,e],endpoint:ZD,["type"]:"endpoint"},{["conditions"]:[U,S,l,j,$2,zD,O,e],endpoint:cD,["type"]:"endpoint"},{["conditions"]:[U,S,M2,h,p],endpoint:{["url"]:"https://{Bucket}.s3-accelerate.{partitionResult#dnsSuffix}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[U,S,M2,h,O,o],["rules"]:[{["conditions"]:n2,endpoint:JD,["type"]:"endpoint"},{endpoint:JD,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[U,S,M2,h,O,e],endpoint:JD,["type"]:"endpoint"},{["conditions"]:[U,S,l,h,p],endpoint:{["url"]:"https://{Bucket}.s3.{partitionResult#dnsSuffix}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[U,S,l,h,O,o],["rules"]:[{["conditions"]:n2,endpoint:{["url"]:"https://{Bucket}.s3.{partitionResult#dnsSuffix}",["properties"]:d,["headers"]:K},["type"]:"endpoint"},{endpoint:x9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[U,S,l,h,O,e],endpoint:x9,["type"]:"endpoint"}],["type"]:"tree"},$1],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[j,$2,{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[w6,"scheme"]},"http"]},{["fn"]:"aws.isVirtualHostableS3Bucket",["argv"]:[C,!0]},$D,S,U,l],["rules"]:[{["conditions"]:U2,["rules"]:[{["conditions"]:t9,["rules"]:[h9],["type"]:"tree"},$1],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[$D,{["fn"]:"aws.parseArn",["argv"]:Dh,["assign"]:"bucketArn"}],["rules"]:[{["conditions"]:[{["fn"]:"getAttr",["argv"]:[J2,"resourceId[0]"],["assign"]:"arnType"},{["fn"]:"not",["argv"]:[{["fn"]:"stringEquals",["argv"]:[$6,""]}]}],["rules"]:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[QD,"s3-object-lambda"]}],["rules"]:[{["conditions"]:LD,["rules"]:[{["conditions"]:o9,["rules"]:[H9,S9,{["conditions"]:ED,["rules"]:[R9,{["conditions"]:u6,["rules"]:[vD,{["conditions"]:OD,["rules"]:[{["conditions"]:U2,["rules"]:[{["conditions"]:D6,["rules"]:[{["conditions"]:CD,["rules"]:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Z6,""]}],error:"Invalid ARN: Missing account id",["type"]:"error"},{["conditions"]:PD,["rules"]:[{["conditions"]:B6,["rules"]:[{["conditions"]:M0,endpoint:{["url"]:"{url#scheme}://{accessPointName}-{bucketArn#accountId}.{url#authority}{url#path}",["properties"]:XD,["headers"]:K},["type"]:"endpoint"},{["conditions"]:z1,endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-object-lambda-fips.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:XD,["headers"]:K},["type"]:"endpoint"},{endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-object-lambda.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:XD,["headers"]:K},["type"]:"endpoint"}],["type"]:"tree"},U9],["type"]:"tree"},YD],["type"]:"tree"},WD],["type"]:"tree"},KD],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},M9],["type"]:"tree"},{error:"Invalid ARN: bucket ARN is missing a region",["type"]:"error"}],["type"]:"tree"},L9],["type"]:"tree"},{error:"Invalid ARN: Object Lambda ARNs only support `accesspoint` arn types, but found: `{arnType}`",["type"]:"error"}],["type"]:"tree"},{["conditions"]:LD,["rules"]:[{["conditions"]:o9,["rules"]:[{["conditions"]:ED,["rules"]:[{["conditions"]:LD,["rules"]:[{["conditions"]:ED,["rules"]:[R9,{["conditions"]:u6,["rules"]:[vD,{["conditions"]:OD,["rules"]:[{["conditions"]:U2,["rules"]:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[z6,"{partitionResult#name}"]}],["rules"]:[{["conditions"]:CD,["rules"]:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[QD,"s3"]}],["rules"]:[{["conditions"]:PD,["rules"]:[{["conditions"]:B6,["rules"]:[{["conditions"]:RD,error:"Access Points do not support S3 Accelerate",["type"]:"error"},{["conditions"]:MD,endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint-fips.dualstack.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:hu,["headers"]:K},["type"]:"endpoint"},{["conditions"]:Hu,endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint-fips.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:hu,["headers"]:K},["type"]:"endpoint"},{["conditions"]:Su,endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint.dualstack.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:hu,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[S,U,j,$2],endpoint:{["url"]:"{url#scheme}://{accessPointName}-{bucketArn#accountId}.{url#authority}{url#path}",["properties"]:hu,["headers"]:K},["type"]:"endpoint"},{["conditions"]:Ru,endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:hu,["headers"]:K},["type"]:"endpoint"}],["type"]:"tree"},U9],["type"]:"tree"},YD],["type"]:"tree"},{error:"Invalid ARN: The ARN was not for the S3 service, found: {bucketArn#service}",["type"]:"error"}],["type"]:"tree"},WD],["type"]:"tree"},KD],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},M9],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"isValidHostLabel",["argv"]:[VD,!0]}],["rules"]:[{["conditions"]:e9,error:"S3 MRAP does not support dual-stack",["type"]:"error"},{["conditions"]:z1,error:"S3 MRAP does not support FIPS",["type"]:"error"},{["conditions"]:RD,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"]:SD,["assign"]:"mrapPartition"}],["rules"]:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[{["ref"]:"mrapPartition"},"name"]},{["fn"]:"getAttr",["argv"]:[J2,"partition"]}]}],["rules"]:[{endpoint:{["url"]:"https://{accessPointName}.accesspoint.s3-global.{mrapPartition#dnsSuffix}",["properties"]:{["authSchemes"]:[{["disableDoubleEncoding"]:!0,name:"sigv4a",["signingName"]:"s3",["signingRegionSet"]:Fh}]},["headers"]:K},["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"},L9],["type"]:"tree"},{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[QD,"s3-outposts"]}],["rules"]:[{["conditions"]:e9,error:"S3 Outposts does not support Dual-stack",["type"]:"error"},{["conditions"]:z1,error:"S3 Outposts does not support FIPS",["type"]:"error"},{["conditions"]:RD,error:"S3 Outposts does not support S3 Accelerate",["type"]:"error"},{["conditions"]:[{["fn"]:"isSet",["argv"]:[{["fn"]:"getAttr",["argv"]:[J2,"resourceId[4]"]}]}],error:"Invalid Arn: Outpost Access Point ARN contains sub resources",["type"]:"error"},{["conditions"]:[{["fn"]:"getAttr",["argv"]:wh,["assign"]:"outpostId"}],["rules"]:[{["conditions"]:a9,["rules"]:[vD,{["conditions"]:OD,["rules"]:[{["conditions"]:U2,["rules"]:[{["conditions"]:D6,["rules"]:[{["conditions"]:CD,["rules"]:[{["conditions"]:PD,["rules"]:[{["conditions"]:[{["fn"]:"getAttr",["argv"]:Gh,["assign"]:"outpostType"}],["rules"]:[{["conditions"]:[{["fn"]:"getAttr",["argv"]:[J2,"resourceId[3]"],["assign"]:"accessPointName"}],["rules"]:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[{["ref"]:"outpostType"},"accesspoint"]}],["rules"]:[{["conditions"]:M0,endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.{outpostId}.{url#authority}",["properties"]:E9,["headers"]:K},["type"]:"endpoint"},{endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.{outpostId}.s3-outposts.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:E9,["headers"]:K},["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"},YD],["type"]:"tree"},WD],["type"]:"tree"},KD],["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"]:[C,0,4,!1],["assign"]:"arnPrefix"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"arnPrefix"},"arn:"]},{["fn"]:"not",["argv"]:[{["fn"]:"isSet",["argv"]:[O9]}]}],error:"Invalid ARN: `{Bucket}` was not a valid ARN",["type"]:"error"},{["conditions"]:[{["fn"]:"booleanEquals",["argv"]:[eK,!0]},O9],error:"Path-style addressing cannot be used with ARN buckets",["type"]:"error"},{["conditions"]:Bh,["rules"]:[{["conditions"]:U2,["rules"]:[{["conditions"]:[l],["rules"]:[{["conditions"]:[T,h,I,p],endpoint:{["url"]:"https://s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[T,h,I,O,o],["rules"]:[{endpoint:C9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[T,h,I,O,e],endpoint:C9,["type"]:"endpoint"},{["conditions"]:[U,h,I,p],endpoint:{["url"]:"https://s3-fips.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[U,h,I,O,o],["rules"]:[{endpoint:P9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[U,h,I,O,e],endpoint:P9,["type"]:"endpoint"},{["conditions"]:[T,h,S,p],endpoint:{["url"]:"https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[T,h,S,O,o],["rules"]:[{endpoint:c9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[T,h,S,O,e],endpoint:c9,["type"]:"endpoint"},{["conditions"]:[U,j,$2,S,p],endpoint:{["url"]:"{url#scheme}://{url#authority}{url#normalizedPath}{uri_encoded_bucket}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[U,j,$2,S,O,o],["rules"]:[{["conditions"]:n2,endpoint:hD,["type"]:"endpoint"},{endpoint:hD,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[U,j,$2,S,O,e],endpoint:hD,["type"]:"endpoint"},{["conditions"]:[U,h,S,p],endpoint:{["url"]:"https://s3.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[U,h,S,O,o],["rules"]:[{["conditions"]:n2,endpoint:{["url"]:"https://s3.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:d,["headers"]:K},["type"]:"endpoint"},{endpoint:V9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[U,h,S,O,e],endpoint:V9,["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"]:[k9]},{["fn"]:"booleanEquals",["argv"]:[k9,!0]}],["rules"]:[{["conditions"]:U2,["rules"]:[{["conditions"]:A6,["rules"]:[H9,S9,{["conditions"]:M0,endpoint:{["url"]:"{url#scheme}://{url#authority}{url#path}",["properties"]:xD,["headers"]:K},["type"]:"endpoint"},{["conditions"]:z1,endpoint:{["url"]:"https://s3-object-lambda-fips.{Region}.{partitionResult#dnsSuffix}",["properties"]:xD,["headers"]:K},["type"]:"endpoint"},{endpoint:{["url"]:"https://s3-object-lambda.{Region}.{partitionResult#dnsSuffix}",["properties"]:xD,["headers"]:K},["type"]:"endpoint"}],["type"]:"tree"},$1],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[J9],["rules"]:[{["conditions"]:U2,["rules"]:[{["conditions"]:A6,["rules"]:[{["conditions"]:[I,T,h,p],endpoint:{["url"]:"https://s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[I,T,h,O,o],["rules"]:[{endpoint:y9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,T,h,O,e],endpoint:y9,["type"]:"endpoint"},{["conditions"]:[I,U,h,p],endpoint:{["url"]:"https://s3-fips.us-east-1.{partitionResult#dnsSuffix}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[I,U,h,O,o],["rules"]:[{endpoint:T9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,U,h,O,e],endpoint:T9,["type"]:"endpoint"},{["conditions"]:[S,T,h,p],endpoint:{["url"]:"https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[S,T,h,O,o],["rules"]:[{endpoint:I9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[S,T,h,O,e],endpoint:I9,["type"]:"endpoint"},{["conditions"]:[S,U,j,$2,p],endpoint:{["url"]:"{url#scheme}://{url#authority}{url#path}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[S,U,j,$2,O,o],["rules"]:[{["conditions"]:n2,endpoint:HD,["type"]:"endpoint"},{endpoint:HD,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[S,U,j,$2,O,e],endpoint:HD,["type"]:"endpoint"},{["conditions"]:[S,U,h,p],endpoint:{["url"]:"https://s3.{partitionResult#dnsSuffix}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[S,U,h,O,o],["rules"]:[{["conditions"]:n2,endpoint:{["url"]:"https://s3.{partitionResult#dnsSuffix}",["properties"]:d,["headers"]:K},["type"]:"endpoint"},{endpoint:q9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[S,U,h,O,e],endpoint:q9,["type"]:"endpoint"}],["type"]:"tree"},$1],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},{error:"A region must be set when sending requests to S3.",["type"]:"error"}]},J6=Nh;var Zh=new L0.EndpointCache({size:50,params:["Accelerate","Bucket","DisableAccessPoints","DisableMultiRegionAccessPoints","DisableS3ExpressSessionAuth","Endpoint","ForcePathStyle","Region","UseArnRegion","UseDualStack","UseFIPS","UseGlobalEndpoint","UseObjectLambdaEndpoint","UseS3ExpressControlEndpoint"]}),Z1=(u,D={})=>{return Zh.get(u,()=>L0.resolveEndpoint(J6,{endpointParams:u,logger:D.logger}))};L0.customEndpointFunctions.aws=Q6.awsEndpointFunctions;var Jh=(u)=>async(D,B,A)=>{if(!A)throw Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`");let F=await u(D,B,A),w=E0.getSmithyContext(B)?.commandInstance?.constructor?.getEndpointParameterInstructions;if(!w)throw Error(`getEndpointParameterInstructions() is not defined on '${B.commandName}'`);let G=await v6.resolveParams(A,{getEndpointParameterInstructions:w},D);return Object.assign(F,G)},Qh=async(u,D,B)=>{return{operation:E0.getSmithyContext(D).operation,region:await E0.normalizeProvider(u.region)()||(()=>{throw Error("expected `region` to be configured for `aws.auth#sigv4`")})()}},X6=Jh(Qh);function Y6(u){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"s3",region:u.region},propertiesExtractor:(D,B)=>({signingProperties:{config:D,context:B}})}}function W6(u){return{schemeId:"aws.auth#sigv4a",signingProperties:{name:"s3",region:u.region},propertiesExtractor:(D,B)=>({signingProperties:{config:D,context:B}})}}var vh=(u,D,B)=>{return(F)=>{let G=u(F).properties?.authSchemes;if(!G)return D(F);let N=[];for(let $ of G){let{name:Z,properties:v={},...J}=$,Q=Z.toLowerCase();if(Z!==Q)console.warn(`HttpAuthScheme has been normalized with lowercasing: '${Z}' to '${Q}'`);let X;if(Q==="sigv4a"){X="aws.auth#sigv4a";let x=G.find((E)=>{let H=E.name.toLowerCase();return H!=="sigv4a"&&H.startsWith("sigv4")});if(Wu.sigv4aDependency()==="none"&&x)continue}else if(Q.startsWith("sigv4"))X="aws.auth#sigv4";else throw Error(`Unknown HttpAuthScheme found in '@smithy.rules#endpointRuleSet': '${Q}'`);let W=B[X];if(!W)throw Error(`Could not find HttpAuthOption create function for '${X}'`);let L=W(F);L.schemeId=X,L.signingProperties={...L.signingProperties||{},...J,...v},N.push(L)}return N}},Xh=(u)=>{let D=[];switch(u.operation){default:D.push(Y6(u)),D.push(W6(u))}return D},K6=vh(Z1,Xh,{"aws.auth#sigv4":Y6,"aws.auth#sigv4a":W6}),h6=(u)=>{let D=J1.resolveAwsSdkSigV4Config(u),B=J1.resolveAwsSdkSigV4AConfig(D);return Object.assign(B,{authSchemePreference:E0.normalizeProvider(u.authSchemePreference??[])})};var V6=Y(J0(),1),k6=Y(R2(),1);var x6=(u)=>{return Object.assign(u,{useFipsEndpoint:u.useFipsEndpoint??!1,useDualstackEndpoint:u.useDualstackEndpoint??!1,forcePathStyle:u.forcePathStyle??!1,useAccelerateEndpoint:u.useAccelerateEndpoint??!1,useGlobalEndpoint:u.useGlobalEndpoint??!1,disableMultiregionAccessPoints:u.disableMultiregionAccessPoints??!1,defaultSigningName:"s3",clientContextParams:u.clientContextParams??{}})},m2={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"}};var kD=Y(R6(),1);var H6=Y(R2(),1);class i extends H6.ServiceException{constructor(u){super(u);Object.setPrototypeOf(this,i.prototype)}}class Q1 extends i{name="NoSuchUpload";$fault="client";constructor(u){super({name:"NoSuchUpload",$fault:"client",...u});Object.setPrototypeOf(this,Q1.prototype)}}class v1 extends i{name="AccessDenied";$fault="client";constructor(u){super({name:"AccessDenied",$fault:"client",...u});Object.setPrototypeOf(this,v1.prototype)}}class X1 extends i{name="ObjectNotInActiveTierError";$fault="client";constructor(u){super({name:"ObjectNotInActiveTierError",$fault:"client",...u});Object.setPrototypeOf(this,X1.prototype)}}class Y1 extends i{name="BucketAlreadyExists";$fault="client";constructor(u){super({name:"BucketAlreadyExists",$fault:"client",...u});Object.setPrototypeOf(this,Y1.prototype)}}class W1 extends i{name="BucketAlreadyOwnedByYou";$fault="client";constructor(u){super({name:"BucketAlreadyOwnedByYou",$fault:"client",...u});Object.setPrototypeOf(this,W1.prototype)}}class K1 extends i{name="NoSuchBucket";$fault="client";constructor(u){super({name:"NoSuchBucket",$fault:"client",...u});Object.setPrototypeOf(this,K1.prototype)}}class h1 extends i{name="InvalidObjectState";$fault="client";StorageClass;AccessTier;constructor(u){super({name:"InvalidObjectState",$fault:"client",...u});Object.setPrototypeOf(this,h1.prototype),this.StorageClass=u.StorageClass,this.AccessTier=u.AccessTier}}class x1 extends i{name="NoSuchKey";$fault="client";constructor(u){super({name:"NoSuchKey",$fault:"client",...u});Object.setPrototypeOf(this,x1.prototype)}}class H1 extends i{name="NotFound";$fault="client";constructor(u){super({name:"NotFound",$fault:"client",...u});Object.setPrototypeOf(this,H1.prototype)}}class S1 extends i{name="EncryptionTypeMismatch";$fault="client";constructor(u){super({name:"EncryptionTypeMismatch",$fault:"client",...u});Object.setPrototypeOf(this,S1.prototype)}}class R1 extends i{name="InvalidRequest";$fault="client";constructor(u){super({name:"InvalidRequest",$fault:"client",...u});Object.setPrototypeOf(this,R1.prototype)}}class U1 extends i{name="InvalidWriteOffset";$fault="client";constructor(u){super({name:"InvalidWriteOffset",$fault:"client",...u});Object.setPrototypeOf(this,U1.prototype)}}class M1 extends i{name="TooManyParts";$fault="client";constructor(u){super({name:"TooManyParts",$fault:"client",...u});Object.setPrototypeOf(this,M1.prototype)}}class L1 extends i{name="IdempotencyParameterMismatch";$fault="client";constructor(u){super({name:"IdempotencyParameterMismatch",$fault:"client",...u});Object.setPrototypeOf(this,L1.prototype)}}class E1 extends i{name="ObjectAlreadyInActiveTierError";$fault="client";constructor(u){super({name:"ObjectAlreadyInActiveTierError",$fault:"client",...u});Object.setPrototypeOf(this,E1.prototype)}}var U6=kD.TypeRegistry.for("smithy.ts.sdk.synthetic.com.amazonaws.s3"),Yh=[-3,"smithy.ts.sdk.synthetic.com.amazonaws.s3","S3ServiceException",0,[],[]];U6.registerError(Yh,i);var N2=kD.TypeRegistry.for("com.amazonaws.s3"),Wh=[-3,"com.amazonaws.s3","AccessDenied",{["error"]:"client",["httpError"]:403},[],[]];N2.registerError(Wh,v1);var Kh=[-3,"com.amazonaws.s3","BucketAlreadyExists",{["error"]:"client",["httpError"]:409},[],[]];N2.registerError(Kh,Y1);var hh=[-3,"com.amazonaws.s3","BucketAlreadyOwnedByYou",{["error"]:"client",["httpError"]:409},[],[]];N2.registerError(hh,W1);var xh=[-3,"com.amazonaws.s3","EncryptionTypeMismatch",{["error"]:"client",["httpError"]:400},[],[]];N2.registerError(xh,S1);var Hh=[-3,"com.amazonaws.s3","IdempotencyParameterMismatch",{["error"]:"client",["httpError"]:400},[],[]];N2.registerError(Hh,L1);var Sh=[-3,"com.amazonaws.s3","InvalidObjectState",{["error"]:"client",["httpError"]:403},["StorageClass","AccessTier"],[0,0]];N2.registerError(Sh,h1);var Rh=[-3,"com.amazonaws.s3","InvalidRequest",{["error"]:"client",["httpError"]:400},[],[]];N2.registerError(Rh,R1);var Uh=[-3,"com.amazonaws.s3","InvalidWriteOffset",{["error"]:"client",["httpError"]:400},[],[]];N2.registerError(Uh,U1);var Mh=[-3,"com.amazonaws.s3","NoSuchBucket",{["error"]:"client",["httpError"]:404},[],[]];N2.registerError(Mh,K1);var Lh=[-3,"com.amazonaws.s3","NoSuchKey",{["error"]:"client",["httpError"]:404},[],[]];N2.registerError(Lh,x1);var Eh=[-3,"com.amazonaws.s3","NoSuchUpload",{["error"]:"client",["httpError"]:404},[],[]];N2.registerError(Eh,Q1);var Oh=[-3,"com.amazonaws.s3","NotFound",{["error"]:"client"},[],[]];N2.registerError(Oh,H1);var Ch=[-3,"com.amazonaws.s3","ObjectAlreadyInActiveTierError",{["error"]:"client",["httpError"]:403},[],[]];N2.registerError(Ch,E1);var Ph=[-3,"com.amazonaws.s3","ObjectNotInActiveTierError",{["error"]:"client",["httpError"]:403},[],[]];N2.registerError(Ph,X1);var ch=[-3,"com.amazonaws.s3","TooManyParts",{["error"]:"client",["httpError"]:400},[],[]];N2.registerError(ch,M1);var M6=[U6,N2];var S6=[0,"com.amazonaws.s3","SessionCredentialValue",8,0],yD=[0,"com.amazonaws.s3","SSECustomerKey",8,0],O1=[0,"com.amazonaws.s3","SSEKMSEncryptionContext",8,0],O0=[0,"com.amazonaws.s3","SSEKMSKeyId",8,0],L6=[0,"com.amazonaws.s3","StreamingBlob",{["streaming"]:1},42];var Vh=[3,"com.amazonaws.s3","CommonPrefix",0,["Prefix"],[0]];var kh=[3,"com.amazonaws.s3","CreateSessionOutput",{["xmlName"]:"CreateSessionResult"},["Credentials","ServerSideEncryption","SSEKMSKeyId","SSEKMSEncryptionContext","BucketKeyEnabled"],[[()=>ih,{["xmlName"]:"Credentials"}],[0,{["httpHeader"]:"x-amz-server-side-encryption"}],[()=>O0,{["httpHeader"]:"x-amz-server-side-encryption-aws-kms-key-id"}],[()=>O1,{["httpHeader"]:"x-amz-server-side-encryption-context"}],[2,{["httpHeader"]:"x-amz-server-side-encryption-bucket-key-enabled"}]],1],yh=[3,"com.amazonaws.s3","CreateSessionRequest",0,["Bucket","SessionMode","ServerSideEncryption","SSEKMSKeyId","SSEKMSEncryptionContext","BucketKeyEnabled"],[[0,1],[0,{["httpHeader"]:"x-amz-create-session-mode"}],[0,{["httpHeader"]:"x-amz-server-side-encryption"}],[()=>O0,{["httpHeader"]:"x-amz-server-side-encryption-aws-kms-key-id"}],[()=>O1,{["httpHeader"]:"x-amz-server-side-encryption-context"}],[2,{["httpHeader"]:"x-amz-server-side-encryption-bucket-key-enabled"}]],1];var Th=[3,"com.amazonaws.s3","GetObjectOutput",0,["Body","DeleteMarker","AcceptRanges","Expiration","Restore","LastModified","ContentLength","ETag","ChecksumCRC32","ChecksumCRC32C","ChecksumCRC64NVME","ChecksumSHA1","ChecksumSHA256","ChecksumType","MissingMeta","VersionId","CacheControl","ContentDisposition","ContentEncoding","ContentLanguage","ContentRange","ContentType","Expires","ExpiresString","WebsiteRedirectLocation","ServerSideEncryption","Metadata","SSECustomerAlgorithm","SSECustomerKeyMD5","SSEKMSKeyId","BucketKeyEnabled","StorageClass","RequestCharged","ReplicationStatus","PartsCount","TagCount","ObjectLockMode","ObjectLockRetainUntilDate","ObjectLockLegalHoldStatus"],[[()=>L6,16],[2,{["httpHeader"]:"x-amz-delete-marker"}],[0,{["httpHeader"]:"accept-ranges"}],[0,{["httpHeader"]:"x-amz-expiration"}],[0,{["httpHeader"]:"x-amz-restore"}],[4,{["httpHeader"]:"Last-Modified"}],[1,{["httpHeader"]:"Content-Length"}],[0,{["httpHeader"]:"ETag"}],[0,{["httpHeader"]:"x-amz-checksum-crc32"}],[0,{["httpHeader"]:"x-amz-checksum-crc32c"}],[0,{["httpHeader"]:"x-amz-checksum-crc64nvme"}],[0,{["httpHeader"]:"x-amz-checksum-sha1"}],[0,{["httpHeader"]:"x-amz-checksum-sha256"}],[0,{["httpHeader"]:"x-amz-checksum-type"}],[1,{["httpHeader"]:"x-amz-missing-meta"}],[0,{["httpHeader"]:"x-amz-version-id"}],[0,{["httpHeader"]:"Cache-Control"}],[0,{["httpHeader"]:"Content-Disposition"}],[0,{["httpHeader"]:"Content-Encoding"}],[0,{["httpHeader"]:"Content-Language"}],[0,{["httpHeader"]:"Content-Range"}],[0,{["httpHeader"]:"Content-Type"}],[4,{["httpHeader"]:"Expires"}],[0,{["httpHeader"]:"ExpiresString"}],[0,{["httpHeader"]:"x-amz-website-redirect-location"}],[0,{["httpHeader"]:"x-amz-server-side-encryption"}],[128,{["httpPrefixHeaders"]:"x-amz-meta-"}],[0,{["httpHeader"]:"x-amz-server-side-encryption-customer-algorithm"}],[0,{["httpHeader"]:"x-amz-server-side-encryption-customer-key-MD5"}],[()=>O0,{["httpHeader"]:"x-amz-server-side-encryption-aws-kms-key-id"}],[2,{["httpHeader"]:"x-amz-server-side-encryption-bucket-key-enabled"}],[0,{["httpHeader"]:"x-amz-storage-class"}],[0,{["httpHeader"]:"x-amz-request-charged"}],[0,{["httpHeader"]:"x-amz-replication-status"}],[1,{["httpHeader"]:"x-amz-mp-parts-count"}],[1,{["httpHeader"]:"x-amz-tagging-count"}],[0,{["httpHeader"]:"x-amz-object-lock-mode"}],[5,{["httpHeader"]:"x-amz-object-lock-retain-until-date"}],[0,{["httpHeader"]:"x-amz-object-lock-legal-hold"}]]],Ih=[3,"com.amazonaws.s3","GetObjectRequest",0,["Bucket","Key","IfMatch","IfModifiedSince","IfNoneMatch","IfUnmodifiedSince","Range","ResponseCacheControl","ResponseContentDisposition","ResponseContentEncoding","ResponseContentLanguage","ResponseContentType","ResponseExpires","VersionId","SSECustomerAlgorithm","SSECustomerKey","SSECustomerKeyMD5","RequestPayer","PartNumber","ExpectedBucketOwner","ChecksumMode"],[[0,1],[0,1],[0,{["httpHeader"]:"If-Match"}],[4,{["httpHeader"]:"If-Modified-Since"}],[0,{["httpHeader"]:"If-None-Match"}],[4,{["httpHeader"]:"If-Unmodified-Since"}],[0,{["httpHeader"]:"Range"}],[0,{["httpQuery"]:"response-cache-control"}],[0,{["httpQuery"]:"response-content-disposition"}],[0,{["httpQuery"]:"response-content-encoding"}],[0,{["httpQuery"]:"response-content-language"}],[0,{["httpQuery"]:"response-content-type"}],[6,{["httpQuery"]:"response-expires"}],[0,{["httpQuery"]:"versionId"}],[0,{["httpHeader"]:"x-amz-server-side-encryption-customer-algorithm"}],[()=>yD,{["httpHeader"]:"x-amz-server-side-encryption-customer-key"}],[0,{["httpHeader"]:"x-amz-server-side-encryption-customer-key-MD5"}],[0,{["httpHeader"]:"x-amz-request-payer"}],[1,{["httpQuery"]:"partNumber"}],[0,{["httpHeader"]:"x-amz-expected-bucket-owner"}],[0,{["httpHeader"]:"x-amz-checksum-mode"}]],2];var qh=[3,"com.amazonaws.s3","HeadObjectOutput",0,["DeleteMarker","AcceptRanges","Expiration","Restore","ArchiveStatus","LastModified","ContentLength","ChecksumCRC32","ChecksumCRC32C","ChecksumCRC64NVME","ChecksumSHA1","ChecksumSHA256","ChecksumType","ETag","MissingMeta","VersionId","CacheControl","ContentDisposition","ContentEncoding","ContentLanguage","ContentType","ContentRange","Expires","ExpiresString","WebsiteRedirectLocation","ServerSideEncryption","Metadata","SSECustomerAlgorithm","SSECustomerKeyMD5","SSEKMSKeyId","BucketKeyEnabled","StorageClass","RequestCharged","ReplicationStatus","PartsCount","TagCount","ObjectLockMode","ObjectLockRetainUntilDate","ObjectLockLegalHoldStatus"],[[2,{["httpHeader"]:"x-amz-delete-marker"}],[0,{["httpHeader"]:"accept-ranges"}],[0,{["httpHeader"]:"x-amz-expiration"}],[0,{["httpHeader"]:"x-amz-restore"}],[0,{["httpHeader"]:"x-amz-archive-status"}],[4,{["httpHeader"]:"Last-Modified"}],[1,{["httpHeader"]:"Content-Length"}],[0,{["httpHeader"]:"x-amz-checksum-crc32"}],[0,{["httpHeader"]:"x-amz-checksum-crc32c"}],[0,{["httpHeader"]:"x-amz-checksum-crc64nvme"}],[0,{["httpHeader"]:"x-amz-checksum-sha1"}],[0,{["httpHeader"]:"x-amz-checksum-sha256"}],[0,{["httpHeader"]:"x-amz-checksum-type"}],[0,{["httpHeader"]:"ETag"}],[1,{["httpHeader"]:"x-amz-missing-meta"}],[0,{["httpHeader"]:"x-amz-version-id"}],[0,{["httpHeader"]:"Cache-Control"}],[0,{["httpHeader"]:"Content-Disposition"}],[0,{["httpHeader"]:"Content-Encoding"}],[0,{["httpHeader"]:"Content-Language"}],[0,{["httpHeader"]:"Content-Type"}],[0,{["httpHeader"]:"Content-Range"}],[4,{["httpHeader"]:"Expires"}],[0,{["httpHeader"]:"ExpiresString"}],[0,{["httpHeader"]:"x-amz-website-redirect-location"}],[0,{["httpHeader"]:"x-amz-server-side-encryption"}],[128,{["httpPrefixHeaders"]:"x-amz-meta-"}],[0,{["httpHeader"]:"x-amz-server-side-encryption-customer-algorithm"}],[0,{["httpHeader"]:"x-amz-server-side-encryption-customer-key-MD5"}],[()=>O0,{["httpHeader"]:"x-amz-server-side-encryption-aws-kms-key-id"}],[2,{["httpHeader"]:"x-amz-server-side-encryption-bucket-key-enabled"}],[0,{["httpHeader"]:"x-amz-storage-class"}],[0,{["httpHeader"]:"x-amz-request-charged"}],[0,{["httpHeader"]:"x-amz-replication-status"}],[1,{["httpHeader"]:"x-amz-mp-parts-count"}],[1,{["httpHeader"]:"x-amz-tagging-count"}],[0,{["httpHeader"]:"x-amz-object-lock-mode"}],[5,{["httpHeader"]:"x-amz-object-lock-retain-until-date"}],[0,{["httpHeader"]:"x-amz-object-lock-legal-hold"}]]],mh=[3,"com.amazonaws.s3","HeadObjectRequest",0,["Bucket","Key","IfMatch","IfModifiedSince","IfNoneMatch","IfUnmodifiedSince","Range","ResponseCacheControl","ResponseContentDisposition","ResponseContentEncoding","ResponseContentLanguage","ResponseContentType","ResponseExpires","VersionId","SSECustomerAlgorithm","SSECustomerKey","SSECustomerKeyMD5","RequestPayer","PartNumber","ExpectedBucketOwner","ChecksumMode"],[[0,1],[0,1],[0,{["httpHeader"]:"If-Match"}],[4,{["httpHeader"]:"If-Modified-Since"}],[0,{["httpHeader"]:"If-None-Match"}],[4,{["httpHeader"]:"If-Unmodified-Since"}],[0,{["httpHeader"]:"Range"}],[0,{["httpQuery"]:"response-cache-control"}],[0,{["httpQuery"]:"response-content-disposition"}],[0,{["httpQuery"]:"response-content-encoding"}],[0,{["httpQuery"]:"response-content-language"}],[0,{["httpQuery"]:"response-content-type"}],[6,{["httpQuery"]:"response-expires"}],[0,{["httpQuery"]:"versionId"}],[0,{["httpHeader"]:"x-amz-server-side-encryption-customer-algorithm"}],[()=>yD,{["httpHeader"]:"x-amz-server-side-encryption-customer-key"}],[0,{["httpHeader"]:"x-amz-server-side-encryption-customer-key-MD5"}],[0,{["httpHeader"]:"x-amz-request-payer"}],[1,{["httpQuery"]:"partNumber"}],[0,{["httpHeader"]:"x-amz-expected-bucket-owner"}],[0,{["httpHeader"]:"x-amz-checksum-mode"}]],2];var _h=[3,"com.amazonaws.s3","ListObjectsV2Output",{["xmlName"]:"ListBucketResult"},["IsTruncated","Contents","Name","Prefix","Delimiter","MaxKeys","CommonPrefixes","EncodingType","KeyCount","ContinuationToken","NextContinuationToken","StartAfter","RequestCharged"],[2,[()=>nh,{["xmlFlattened"]:1}],0,0,0,1,[()=>rh,{["xmlFlattened"]:1}],0,1,0,0,0,[0,{["httpHeader"]:"x-amz-request-charged"}]]],gh=[3,"com.amazonaws.s3","ListObjectsV2Request",0,["Bucket","Delimiter","EncodingType","MaxKeys","Prefix","ContinuationToken","FetchOwner","StartAfter","RequestPayer","ExpectedBucketOwner","OptionalObjectAttributes"],[[0,1],[0,{["httpQuery"]:"delimiter"}],[0,{["httpQuery"]:"encoding-type"}],[1,{["httpQuery"]:"max-keys"}],[0,{["httpQuery"]:"prefix"}],[0,{["httpQuery"]:"continuation-token"}],[2,{["httpQuery"]:"fetch-owner"}],[0,{["httpQuery"]:"start-after"}],[0,{["httpHeader"]:"x-amz-request-payer"}],[0,{["httpHeader"]:"x-amz-expected-bucket-owner"}],[64,{["httpHeader"]:"x-amz-optional-object-attributes"}]],1];var fh=[3,"com.amazonaws.s3","Object",0,["Key","LastModified","ETag","ChecksumAlgorithm","ChecksumType","Size","StorageClass","Owner","RestoreStatus"],[0,4,0,[64,{["xmlFlattened"]:1}],0,1,0,()=>bh,()=>dh]];var bh=[3,"com.amazonaws.s3","Owner",0,["DisplayName","ID"],[0,0]];var jh=[3,"com.amazonaws.s3","PutObjectOutput",0,["Expiration","ETag","ChecksumCRC32","ChecksumCRC32C","ChecksumCRC64NVME","ChecksumSHA1","ChecksumSHA256","ChecksumType","ServerSideEncryption","VersionId","SSECustomerAlgorithm","SSECustomerKeyMD5","SSEKMSKeyId","SSEKMSEncryptionContext","BucketKeyEnabled","Size","RequestCharged"],[[0,{["httpHeader"]:"x-amz-expiration"}],[0,{["httpHeader"]:"ETag"}],[0,{["httpHeader"]:"x-amz-checksum-crc32"}],[0,{["httpHeader"]:"x-amz-checksum-crc32c"}],[0,{["httpHeader"]:"x-amz-checksum-crc64nvme"}],[0,{["httpHeader"]:"x-amz-checksum-sha1"}],[0,{["httpHeader"]:"x-amz-checksum-sha256"}],[0,{["httpHeader"]:"x-amz-checksum-type"}],[0,{["httpHeader"]:"x-amz-server-side-encryption"}],[0,{["httpHeader"]:"x-amz-version-id"}],[0,{["httpHeader"]:"x-amz-server-side-encryption-customer-algorithm"}],[0,{["httpHeader"]:"x-amz-server-side-encryption-customer-key-MD5"}],[()=>O0,{["httpHeader"]:"x-amz-server-side-encryption-aws-kms-key-id"}],[()=>O1,{["httpHeader"]:"x-amz-server-side-encryption-context"}],[2,{["httpHeader"]:"x-amz-server-side-encryption-bucket-key-enabled"}],[1,{["httpHeader"]:"x-amz-object-size"}],[0,{["httpHeader"]:"x-amz-request-charged"}]]],lh=[3,"com.amazonaws.s3","PutObjectRequest",0,["Bucket","Key","ACL","Body","CacheControl","ContentDisposition","ContentEncoding","ContentLanguage","ContentLength","ContentMD5","ContentType","ChecksumAlgorithm","ChecksumCRC32","ChecksumCRC32C","ChecksumCRC64NVME","ChecksumSHA1","ChecksumSHA256","Expires","IfMatch","IfNoneMatch","GrantFullControl","GrantRead","GrantReadACP","GrantWriteACP","WriteOffsetBytes","Metadata","ServerSideEncryption","StorageClass","WebsiteRedirectLocation","SSECustomerAlgorithm","SSECustomerKey","SSECustomerKeyMD5","SSEKMSKeyId","SSEKMSEncryptionContext","BucketKeyEnabled","RequestPayer","Tagging","ObjectLockMode","ObjectLockRetainUntilDate","ObjectLockLegalHoldStatus","ExpectedBucketOwner"],[[0,1],[0,1],[0,{["httpHeader"]:"x-amz-acl"}],[()=>L6,16],[0,{["httpHeader"]:"Cache-Control"}],[0,{["httpHeader"]:"Content-Disposition"}],[0,{["httpHeader"]:"Content-Encoding"}],[0,{["httpHeader"]:"Content-Language"}],[1,{["httpHeader"]:"Content-Length"}],[0,{["httpHeader"]:"Content-MD5"}],[0,{["httpHeader"]:"Content-Type"}],[0,{["httpHeader"]:"x-amz-sdk-checksum-algorithm"}],[0,{["httpHeader"]:"x-amz-checksum-crc32"}],[0,{["httpHeader"]:"x-amz-checksum-crc32c"}],[0,{["httpHeader"]:"x-amz-checksum-crc64nvme"}],[0,{["httpHeader"]:"x-amz-checksum-sha1"}],[0,{["httpHeader"]:"x-amz-checksum-sha256"}],[4,{["httpHeader"]:"Expires"}],[0,{["httpHeader"]:"If-Match"}],[0,{["httpHeader"]:"If-None-Match"}],[0,{["httpHeader"]:"x-amz-grant-full-control"}],[0,{["httpHeader"]:"x-amz-grant-read"}],[0,{["httpHeader"]:"x-amz-grant-read-acp"}],[0,{["httpHeader"]:"x-amz-grant-write-acp"}],[1,{["httpHeader"]:"x-amz-write-offset-bytes"}],[128,{["httpPrefixHeaders"]:"x-amz-meta-"}],[0,{["httpHeader"]:"x-amz-server-side-encryption"}],[0,{["httpHeader"]:"x-amz-storage-class"}],[0,{["httpHeader"]:"x-amz-website-redirect-location"}],[0,{["httpHeader"]:"x-amz-server-side-encryption-customer-algorithm"}],[()=>yD,{["httpHeader"]:"x-amz-server-side-encryption-customer-key"}],[0,{["httpHeader"]:"x-amz-server-side-encryption-customer-key-MD5"}],[()=>O0,{["httpHeader"]:"x-amz-server-side-encryption-aws-kms-key-id"}],[()=>O1,{["httpHeader"]:"x-amz-server-side-encryption-context"}],[2,{["httpHeader"]:"x-amz-server-side-encryption-bucket-key-enabled"}],[0,{["httpHeader"]:"x-amz-request-payer"}],[0,{["httpHeader"]:"x-amz-tagging"}],[0,{["httpHeader"]:"x-amz-object-lock-mode"}],[5,{["httpHeader"]:"x-amz-object-lock-retain-until-date"}],[0,{["httpHeader"]:"x-amz-object-lock-legal-hold"}],[0,{["httpHeader"]:"x-amz-expected-bucket-owner"}]],2];var dh=[3,"com.amazonaws.s3","RestoreStatus",0,["IsRestoreInProgress","RestoreExpiryDate"],[2,4]];var ih=[3,"com.amazonaws.s3","SessionCredentials",0,["AccessKeyId","SecretAccessKey","SessionToken","Expiration"],[[0,{["xmlName"]:"AccessKeyId"}],[()=>S6,{["xmlName"]:"SecretAccessKey"}],[()=>S6,{["xmlName"]:"SessionToken"}],[4,{["xmlName"]:"Expiration"}]],4];var rh=[1,"com.amazonaws.s3","CommonPrefixList",0,()=>Vh];var nh=[1,"com.amazonaws.s3","ObjectList",0,[()=>fh,0]];var E6=[9,"com.amazonaws.s3","CreateSession",{["http"]:["GET","/?session",200]},()=>yh,()=>kh];var O6=[9,"com.amazonaws.s3","GetObject",{["httpChecksum"]:"-",["http"]:["GET","/{Key+}?x-id=GetObject",200]},()=>Ih,()=>Th];var C6=[9,"com.amazonaws.s3","HeadObject",{["http"]:["HEAD","/{Key+}",200]},()=>mh,()=>qh];var P6=[9,"com.amazonaws.s3","ListObjectsV2",{["http"]:["GET","/?list-type=2",200]},()=>gh,()=>_h];var c6=[9,"com.amazonaws.s3","PutObject",{["httpChecksum"]:"-",["http"]:["PUT","/{Key+}?x-id=PutObject",200]},()=>lh,()=>jh];class TD extends k6.Command.classBuilder().ep({...m2,DisableS3ExpressSessionAuth:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function(u,D,B,A){return[V6.getEndpointPlugin(B,u.getEndpointParameterInstructions()),r2(B)]}).s("AmazonS3","CreateSession",{}).n("S3Client","CreateSessionCommand").sc(E6).build(){}var y6={name:"@aws-sdk/client-s3",description:"AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native",version:"3.1015.0",scripts:{build:"concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs","build:cjs":"node ../../scripts/compilation/inline client-s3","build:es":"tsc -p tsconfig.es.json","build:include:deps":'yarn g:turbo run build -F="$npm_package_name"',"build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo s3",test:"yarn g:vitest run","test:browser":"node ./test/browser-build/esbuild && yarn g:vitest run -c vitest.config.browser.mts","test:browser:watch":"node ./test/browser-build/esbuild && yarn g:vitest watch -c vitest.config.browser.mts","test:e2e":"yarn g:vitest run -c vitest.config.e2e.mts && yarn test:browser","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.mts","test:index":"tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs","test:integration":"yarn g:vitest run -c vitest.config.integ.mts","test:integration:watch":"yarn g:vitest watch -c vitest.config.integ.mts","test:watch":"yarn g:vitest watch"},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/core":"^3.973.24","@aws-sdk/credential-provider-node":"^3.972.25","@aws-sdk/middleware-bucket-endpoint":"^3.972.8","@aws-sdk/middleware-expect-continue":"^3.972.8","@aws-sdk/middleware-flexible-checksums":"^3.974.4","@aws-sdk/middleware-host-header":"^3.972.8","@aws-sdk/middleware-location-constraint":"^3.972.8","@aws-sdk/middleware-logger":"^3.972.8","@aws-sdk/middleware-recursion-detection":"^3.972.8","@aws-sdk/middleware-sdk-s3":"^3.972.24","@aws-sdk/middleware-ssec":"^3.972.8","@aws-sdk/middleware-user-agent":"^3.972.25","@aws-sdk/region-config-resolver":"^3.972.9","@aws-sdk/signature-v4-multi-region":"^3.996.12","@aws-sdk/types":"^3.973.6","@aws-sdk/util-endpoints":"^3.996.5","@aws-sdk/util-user-agent-browser":"^3.972.8","@aws-sdk/util-user-agent-node":"^3.973.11","@smithy/config-resolver":"^4.4.13","@smithy/core":"^3.23.12","@smithy/eventstream-serde-browser":"^4.2.12","@smithy/eventstream-serde-config-resolver":"^4.3.12","@smithy/eventstream-serde-node":"^4.2.12","@smithy/fetch-http-handler":"^5.3.15","@smithy/hash-blob-browser":"^4.2.13","@smithy/hash-node":"^4.2.12","@smithy/hash-stream-node":"^4.2.12","@smithy/invalid-dependency":"^4.2.12","@smithy/md5-js":"^4.2.12","@smithy/middleware-content-length":"^4.2.12","@smithy/middleware-endpoint":"^4.4.27","@smithy/middleware-retry":"^4.4.44","@smithy/middleware-serde":"^4.2.15","@smithy/middleware-stack":"^4.2.12","@smithy/node-config-provider":"^4.3.12","@smithy/node-http-handler":"^4.5.0","@smithy/protocol-http":"^5.3.12","@smithy/smithy-client":"^4.12.7","@smithy/types":"^4.13.1","@smithy/url-parser":"^4.2.12","@smithy/util-base64":"^4.3.2","@smithy/util-body-length-browser":"^4.2.2","@smithy/util-body-length-node":"^4.2.3","@smithy/util-defaults-mode-browser":"^4.3.43","@smithy/util-defaults-mode-node":"^4.2.47","@smithy/util-endpoints":"^3.3.3","@smithy/util-middleware":"^4.2.12","@smithy/util-retry":"^4.2.12","@smithy/util-stream":"^4.5.20","@smithy/util-utf8":"^4.2.2","@smithy/util-waiter":"^4.2.13",tslib:"^2.6.2"},devDependencies:{"@aws-sdk/signature-v4-crt":"3.1015.0","@smithy/snapshot-testing":"^2.0.3","@tsconfig/node20":"20.1.8","@types/node":"^20.14.8",concurrently:"7.0.0","downlevel-dts":"0.10.1",premove:"4.0.0",typescript:"~5.8.3",vitest:"^4.0.17"},engines:{node:">=20.0.0"},typesVersions:{"<4.5":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["dist-*/**"],author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license:"Apache-2.0",browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-s3",repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-s3"}};var c0=Y(H0(),1);var P1=Y(I6(),1),j6=Y(sh(),1);var C1=Y(I6(),1),T6="AWS_EC2_METADATA_DISABLED",q6=async(u)=>{let{ENV_CMDS_FULL_URI:D,ENV_CMDS_RELATIVE_URI:B,fromContainerMetadata:A,fromInstanceMetadata:F}=await import("./chunk-b0ca3dzf.js");if(process.env[B]||process.env[D]){u.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromHttp/fromContainerMetadata");let{fromHttp:w}=await import("./chunk-6av6dnxx.js");return C1.chain(w(u),A(u))}if(process.env[T6]&&process.env[T6]!=="false")return async()=>{throw new C1.CredentialsProviderError("EC2 Instance Metadata Service access disabled",{logger:u.logger})};return u.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromInstanceMetadata"),F(u)};function m6(u,D){let B=ah(u),A,F,w,G=async(N)=>{if(N?.forceRefresh)return await B(N);if(w?.expiration){if(w?.expiration?.getTime()<Date.now())w=void 0}if(A)await A;else if(!w||D?.(w))if(w){if(!F)F=B(N).then(($)=>{w=$}).finally(()=>{F=void 0})}else return A=B(N).then(($)=>{w=$}).finally(()=>{A=void 0}),G(N);return w};return G}var ah=(u)=>async(D)=>{let B;for(let A of u)try{return await A(D)}catch(F){if(B=F,F?.tryNextLink)continue;throw F}throw B};var _6=!1,l6=(u={})=>m6([async()=>{if(u.profile??process.env[j6.ENV_PROFILE]){if(process.env[g6]&&process.env[f6]){if(!_6)(u.logger?.warn&&u.logger?.constructor?.name!=="NoOpLogger"?u.logger.warn.bind(u.logger):console.warn)(`@aws-sdk/credential-provider-node - defaultProvider::fromEnv WARNING:
2
+ import{Ra as g6,Sa as f6,Xa as b6}from"./chunk-a3bmbfn3.js";import{$a as Ux,Ya as n4,Za as f4,_a as H0,ab as Mx,bb as Lx,cb as T4,db as $h,eb as zh,fb as vx,gb as Ex,hb as $B,ib as Ox,jb as J0,kb as zB,lb as hx,mb as xx,nb as Hx,ob as Sx,pb as Xx,qb as Rx}from"./chunk-27tkdqp6.js";import{rb as Kx}from"./chunk-7bggj8g7.js";import{Db as R2,sb as BD,tb as Qx,vb as Wx,wb as r6,xb as ou,zb as R6}from"./chunk-jrnbyhgq.js";import{Eb as g2}from"./chunk-wtydwxgg.js";import{Fb as LK,Hb as uD}from"./chunk-1nkxmecw.js";import{Ib as Yx}from"./chunk-cmnhs4mh.js";import{Jb as sh}from"./chunk-snp18f2m.js";import{Mb as I6}from"./chunk-2cew23ww.js";import{Nb as EK}from"./chunk-wjhh4pf0.js";import{Ob as Tv}from"./chunk-xkrthw08.js";import{Qb as wu,Rb as pD,Sb as Uu,Zb as d2,_b as Z2,bc as JK,cc as f}from"./chunk-4z53shav.js";import{dc as _B,ec as vK}from"./chunk-m0earq80.js";import{fc as W,gc as z,ic as f2}from"./chunk-f18weffa.js";var u3=z((pB)=>{Object.defineProperty(pB,"__esModule",{value:!0});pB.ApplicationInSerializer=void 0;pB.ApplicationInSerializer={_fromJsonObject(u){return{metadata:u.metadata,name:u.name,rateLimit:u.rateLimit,throttleRate:u.throttleRate,uid:u.uid}},_toJsonObject(u){return{metadata:u.metadata,name:u.name,rateLimit:u.rateLimit,throttleRate:u.throttleRate,uid:u.uid}}}});var F8=z((sB)=>{Object.defineProperty(sB,"__esModule",{value:!0});sB.ApplicationOutSerializer=void 0;sB.ApplicationOutSerializer={_fromJsonObject(u){return{createdAt:new Date(u.createdAt),id:u.id,metadata:u.metadata,name:u.name,rateLimit:u.rateLimit,throttleRate:u.throttleRate,uid:u.uid,updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){return{createdAt:u.createdAt,id:u.id,metadata:u.metadata,name:u.name,rateLimit:u.rateLimit,throttleRate:u.throttleRate,uid:u.uid,updatedAt:u.updatedAt}}}});var uA=z((oB)=>{Object.defineProperty(oB,"__esModule",{value:!0});oB.ApplicationPatchSerializer=void 0;oB.ApplicationPatchSerializer={_fromJsonObject(u){return{metadata:u.metadata,name:u.name,rateLimit:u.rateLimit,uid:u.uid}},_toJsonObject(u){return{metadata:u.metadata,name:u.name,rateLimit:u.rateLimit,uid:u.uid}}}});var FA=z((BA)=>{Object.defineProperty(BA,"__esModule",{value:!0});BA.ListResponseApplicationOutSerializer=void 0;var DA=F8();BA.ListResponseApplicationOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>DA.ApplicationOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>DA.ApplicationOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var w8=z((GA)=>{Object.defineProperty(GA,"__esModule",{value:!0});GA.ApiException=void 0;class wA extends Error{constructor(u,D,B){super(`HTTP-Code: ${u}
3
+ Headers: ${JSON.stringify(B)}`);this.code=u,this.body=D,this.headers={},B.forEach((A,F)=>{this.headers[F]=A})}}GA.ApiException=wA});var m=z((L2)=>{var Eu=L2&&L2.__awaiter||function(u,D,B,A){function F(w){return w instanceof B?w:new B(function(G){G(w)})}return new(B||(B=Promise))(function(w,G){function N(Y){try{Z(A.next(Y))}catch(J){G(J)}}function $(Y){try{Z(A.throw(Y))}catch(J){G(J)}}function Z(Y){Y.done?w(Y.value):F(Y.value).then(N,$)}Z((A=A.apply(u,D||[])).next())})};Object.defineProperty(L2,"__esModule",{value:!0});L2.SvixRequest=L2.HttpMethod=L2.LIB_VERSION=void 0;var G8=w8();L2.LIB_VERSION="1.92.2";var tx=`svix-libs/${L2.LIB_VERSION}/javascript`,ox;(function(u){u.GET="GET",u.HEAD="HEAD",u.POST="POST",u.PUT="PUT",u.DELETE="DELETE",u.CONNECT="CONNECT",u.OPTIONS="OPTIONS",u.TRACE="TRACE",u.PATCH="PATCH"})(ox=L2.HttpMethod||(L2.HttpMethod={}));class $A{constructor(u,D){this.method=u,this.path=D,this.queryParams={},this.headerParams={}}setPathParam(u,D){let B=this.path.replace(`{${u}}`,encodeURIComponent(D));if(this.path===B)throw Error(`path parameter ${u} not found`);this.path=B}setQueryParams(u){for(let[D,B]of Object.entries(u))this.setQueryParam(D,B)}setQueryParam(u,D){if(D===void 0||D===null)return;if(typeof D==="string")this.queryParams[u]=D;else if(typeof D==="boolean"||typeof D==="number")this.queryParams[u]=D.toString();else if(D instanceof Date)this.queryParams[u]=D.toISOString();else if(Array.isArray(D)){if(D.length>0)this.queryParams[u]=D.join(",")}else{let B=D;throw Error(`query parameter ${u} has unsupported type`)}}setHeaderParam(u,D){if(D===void 0)return;this.headerParams[u]=D}setBody(u){this.body=JSON.stringify(u)}send(u,D){return Eu(this,void 0,void 0,function*(){let B=yield this.sendInner(u);if(B.status===204)return null;let A=yield B.text();return D(JSON.parse(A))})}sendNoResponseBody(u){return Eu(this,void 0,void 0,function*(){yield this.sendInner(u)})}sendInner(u){var D,B;return Eu(this,void 0,void 0,function*(){let A=new URL(u.baseUrl+this.path);for(let[N,$]of Object.entries(this.queryParams))A.searchParams.set(N,$);if(this.headerParams["idempotency-key"]===void 0&&this.method.toUpperCase()==="POST")this.headerParams["idempotency-key"]=`auto_${crypto.randomUUID()}`;let F=Math.floor(Math.random()*Number.MAX_SAFE_INTEGER);if(this.body!=null)this.headerParams["content-type"]="application/json";let w="credentials"in Request.prototype,G=yield zA(A,{method:this.method.toString(),body:this.body,headers:Object.assign({accept:"application/json, */*;q=0.8",authorization:`Bearer ${u.token}`,"user-agent":tx,"svix-req-id":F.toString()},this.headerParams),credentials:w?"same-origin":void 0,signal:u.timeout!==void 0?AbortSignal.timeout(u.timeout):void 0},u.retryScheduleInMs,(D=u.retryScheduleInMs)===null||D===void 0?void 0:D[0],((B=u.retryScheduleInMs)===null||B===void 0?void 0:B.length)||u.numRetries,u.fetch);return ex(G)})}}L2.SvixRequest=$A;function ex(u){return Eu(this,void 0,void 0,function*(){if(u.status<300)return u;let D=yield u.text();if(u.status===422)throw new G8.ApiException(u.status,JSON.parse(D),u.headers);if(u.status>=400&&u.status<=499)throw new G8.ApiException(u.status,JSON.parse(D),u.headers);throw new G8.ApiException(u.status,D,u.headers)})}function zA(u,D,B,A=50,F=2,w=fetch,G=1){return Eu(this,void 0,void 0,function*(){let N=($)=>new Promise((Z)=>setTimeout(Z,$));try{let $=yield w(u,D);if(F<=0||$.status<500)return $}catch($){if(F<=0)throw $}return yield N(A),D.headers["svix-retry-count"]=G.toString(),A=(B===null||B===void 0?void 0:B[G])||A*2,yield zA(u,D,B,A,--F,w,++G)})}});var YA=z((JA)=>{Object.defineProperty(JA,"__esModule",{value:!0});JA.Application=void 0;var N8=u3(),Ou=F8(),uH=uA(),DH=FA(),Q2=m();class ZA{constructor(u){this.requestCtx=u}list(u){let D=new Q2.SvixRequest(Q2.HttpMethod.GET,"/api/v1/app");return D.setQueryParams({exclude_apps_with_no_endpoints:u===null||u===void 0?void 0:u.excludeAppsWithNoEndpoints,exclude_apps_with_disabled_endpoints:u===null||u===void 0?void 0:u.excludeAppsWithDisabledEndpoints,exclude_apps_with_svix_play_endpoints:u===null||u===void 0?void 0:u.excludeAppsWithSvixPlayEndpoints,limit:u===null||u===void 0?void 0:u.limit,iterator:u===null||u===void 0?void 0:u.iterator,order:u===null||u===void 0?void 0:u.order}),D.send(this.requestCtx,DH.ListResponseApplicationOutSerializer._fromJsonObject)}create(u,D){let B=new Q2.SvixRequest(Q2.HttpMethod.POST,"/api/v1/app");return B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.setBody(N8.ApplicationInSerializer._toJsonObject(u)),B.send(this.requestCtx,Ou.ApplicationOutSerializer._fromJsonObject)}getOrCreate(u,D){let B=new Q2.SvixRequest(Q2.HttpMethod.POST,"/api/v1/app");return B.setQueryParam("get_if_exists",!0),B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.setBody(N8.ApplicationInSerializer._toJsonObject(u)),B.send(this.requestCtx,Ou.ApplicationOutSerializer._fromJsonObject)}get(u){let D=new Q2.SvixRequest(Q2.HttpMethod.GET,"/api/v1/app/{app_id}");return D.setPathParam("app_id",u),D.send(this.requestCtx,Ou.ApplicationOutSerializer._fromJsonObject)}update(u,D){let B=new Q2.SvixRequest(Q2.HttpMethod.PUT,"/api/v1/app/{app_id}");return B.setPathParam("app_id",u),B.setBody(N8.ApplicationInSerializer._toJsonObject(D)),B.send(this.requestCtx,Ou.ApplicationOutSerializer._fromJsonObject)}delete(u){let D=new Q2.SvixRequest(Q2.HttpMethod.DELETE,"/api/v1/app/{app_id}");return D.setPathParam("app_id",u),D.sendNoResponseBody(this.requestCtx)}patch(u,D){let B=new Q2.SvixRequest(Q2.HttpMethod.PATCH,"/api/v1/app/{app_id}");return B.setPathParam("app_id",u),B.setBody(uH.ApplicationPatchSerializer._toJsonObject(D)),B.send(this.requestCtx,Ou.ApplicationOutSerializer._fromJsonObject)}}JA.Application=ZA});var vA=z((XA)=>{Object.defineProperty(XA,"__esModule",{value:!0});XA.ApiTokenOutSerializer=void 0;XA.ApiTokenOutSerializer={_fromJsonObject(u){return{createdAt:new Date(u.createdAt),expiresAt:u.expiresAt?new Date(u.expiresAt):null,id:u.id,name:u.name,scopes:u.scopes,token:u.token}},_toJsonObject(u){return{createdAt:u.createdAt,expiresAt:u.expiresAt,id:u.id,name:u.name,scopes:u.scopes,token:u.token}}}});var $8=z((hA)=>{Object.defineProperty(hA,"__esModule",{value:!0});hA.AppPortalCapabilitySerializer=hA.AppPortalCapability=void 0;var BH;(function(u){u.ViewBase="ViewBase",u.ViewEndpointSecret="ViewEndpointSecret",u.ManageEndpointSecret="ManageEndpointSecret",u.ManageTransformations="ManageTransformations",u.CreateAttempts="CreateAttempts",u.ManageEndpoint="ManageEndpoint"})(BH=hA.AppPortalCapability||(hA.AppPortalCapability={}));hA.AppPortalCapabilitySerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var MA=z((RA)=>{Object.defineProperty(RA,"__esModule",{value:!0});RA.AppPortalAccessInSerializer=void 0;var HA=$8(),SA=u3();RA.AppPortalAccessInSerializer={_fromJsonObject(u){var D;return{application:u.application!=null?SA.ApplicationInSerializer._fromJsonObject(u.application):void 0,capabilities:(D=u.capabilities)===null||D===void 0?void 0:D.map((B)=>HA.AppPortalCapabilitySerializer._fromJsonObject(B)),expiry:u.expiry,featureFlags:u.featureFlags,readOnly:u.readOnly,sessionId:u.sessionId}},_toJsonObject(u){var D;return{application:u.application!=null?SA.ApplicationInSerializer._toJsonObject(u.application):void 0,capabilities:(D=u.capabilities)===null||D===void 0?void 0:D.map((B)=>HA.AppPortalCapabilitySerializer._toJsonObject(B)),expiry:u.expiry,featureFlags:u.featureFlags,readOnly:u.readOnly,sessionId:u.sessionId}}}});var OA=z((LA)=>{Object.defineProperty(LA,"__esModule",{value:!0});LA.AppPortalAccessOutSerializer=void 0;LA.AppPortalAccessOutSerializer={_fromJsonObject(u){return{token:u.token,url:u.url}},_toJsonObject(u){return{token:u.token,url:u.url}}}});var cA=z((CA)=>{Object.defineProperty(CA,"__esModule",{value:!0});CA.ApplicationTokenExpireInSerializer=void 0;CA.ApplicationTokenExpireInSerializer={_fromJsonObject(u){return{expiry:u.expiry,sessionIds:u.sessionIds}},_toJsonObject(u){return{expiry:u.expiry,sessionIds:u.sessionIds}}}});var yA=z((VA)=>{Object.defineProperty(VA,"__esModule",{value:!0});VA.RotatePollerTokenInSerializer=void 0;VA.RotatePollerTokenInSerializer={_fromJsonObject(u){return{expiry:u.expiry,oldTokenExpiry:u.oldTokenExpiry}},_toJsonObject(u){return{expiry:u.expiry,oldTokenExpiry:u.oldTokenExpiry}}}});var qA=z((TA)=>{Object.defineProperty(TA,"__esModule",{value:!0});TA.StreamPortalAccessInSerializer=void 0;TA.StreamPortalAccessInSerializer={_fromJsonObject(u){return{expiry:u.expiry,featureFlags:u.featureFlags,sessionId:u.sessionId}},_toJsonObject(u){return{expiry:u.expiry,featureFlags:u.featureFlags,sessionId:u.sessionId}}}});var gA=z((_A)=>{Object.defineProperty(_A,"__esModule",{value:!0});_A.StreamTokenExpireInSerializer=void 0;_A.StreamTokenExpireInSerializer={_fromJsonObject(u){return{expiry:u.expiry,sessionIds:u.sessionIds}},_toJsonObject(u){return{expiry:u.expiry,sessionIds:u.sessionIds}}}});var z8=z((fA)=>{Object.defineProperty(fA,"__esModule",{value:!0});fA.DashboardAccessOutSerializer=void 0;fA.DashboardAccessOutSerializer={_fromJsonObject(u){return{token:u.token,url:u.url}},_toJsonObject(u){return{token:u.token,url:u.url}}}});var nA=z((iA)=>{Object.defineProperty(iA,"__esModule",{value:!0});iA.Authentication=void 0;var jA=vA(),AH=MA(),lA=OA(),FH=cA(),wH=yA(),GH=qA(),NH=gA(),$H=z8(),u2=m();class dA{constructor(u){this.requestCtx=u}appPortalAccess(u,D,B){let A=new u2.SvixRequest(u2.HttpMethod.POST,"/api/v1/auth/app-portal-access/{app_id}");return A.setPathParam("app_id",u),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(AH.AppPortalAccessInSerializer._toJsonObject(D)),A.send(this.requestCtx,lA.AppPortalAccessOutSerializer._fromJsonObject)}expireAll(u,D,B){let A=new u2.SvixRequest(u2.HttpMethod.POST,"/api/v1/auth/app/{app_id}/expire-all");return A.setPathParam("app_id",u),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(FH.ApplicationTokenExpireInSerializer._toJsonObject(D)),A.sendNoResponseBody(this.requestCtx)}dashboardAccess(u,D){let B=new u2.SvixRequest(u2.HttpMethod.POST,"/api/v1/auth/dashboard-access/{app_id}");return B.setPathParam("app_id",u),B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.send(this.requestCtx,$H.DashboardAccessOutSerializer._fromJsonObject)}logout(u){let D=new u2.SvixRequest(u2.HttpMethod.POST,"/api/v1/auth/logout");return D.setHeaderParam("idempotency-key",u===null||u===void 0?void 0:u.idempotencyKey),D.sendNoResponseBody(this.requestCtx)}streamLogout(u){let D=new u2.SvixRequest(u2.HttpMethod.POST,"/api/v1/auth/stream-logout");return D.setHeaderParam("idempotency-key",u===null||u===void 0?void 0:u.idempotencyKey),D.sendNoResponseBody(this.requestCtx)}streamPortalAccess(u,D,B){let A=new u2.SvixRequest(u2.HttpMethod.POST,"/api/v1/auth/stream-portal-access/{stream_id}");return A.setPathParam("stream_id",u),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(GH.StreamPortalAccessInSerializer._toJsonObject(D)),A.send(this.requestCtx,lA.AppPortalAccessOutSerializer._fromJsonObject)}streamExpireAll(u,D,B){let A=new u2.SvixRequest(u2.HttpMethod.POST,"/api/v1/auth/stream/{stream_id}/expire-all");return A.setPathParam("stream_id",u),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(NH.StreamTokenExpireInSerializer._toJsonObject(D)),A.sendNoResponseBody(this.requestCtx)}getStreamPollerToken(u,D){let B=new u2.SvixRequest(u2.HttpMethod.GET,"/api/v1/auth/stream/{stream_id}/sink/{sink_id}/poller/token");return B.setPathParam("stream_id",u),B.setPathParam("sink_id",D),B.send(this.requestCtx,jA.ApiTokenOutSerializer._fromJsonObject)}rotateStreamPollerToken(u,D,B,A){let F=new u2.SvixRequest(u2.HttpMethod.POST,"/api/v1/auth/stream/{stream_id}/sink/{sink_id}/poller/token/rotate");return F.setPathParam("stream_id",u),F.setPathParam("sink_id",D),F.setHeaderParam("idempotency-key",A===null||A===void 0?void 0:A.idempotencyKey),F.setBody(wH.RotatePollerTokenInSerializer._toJsonObject(B)),F.send(this.requestCtx,jA.ApiTokenOutSerializer._fromJsonObject)}}iA.Authentication=dA});var e2=z((aA)=>{Object.defineProperty(aA,"__esModule",{value:!0});aA.BackgroundTaskStatusSerializer=aA.BackgroundTaskStatus=void 0;var zH;(function(u){u.Running="running",u.Finished="finished",u.Failed="failed"})(zH=aA.BackgroundTaskStatus||(aA.BackgroundTaskStatus={}));aA.BackgroundTaskStatusSerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var u0=z((oA)=>{Object.defineProperty(oA,"__esModule",{value:!0});oA.BackgroundTaskTypeSerializer=oA.BackgroundTaskType=void 0;var ZH;(function(u){u.EndpointReplay="endpoint.replay",u.EndpointRecover="endpoint.recover",u.ApplicationStats="application.stats",u.MessageBroadcast="message.broadcast",u.SdkGenerate="sdk.generate",u.EventTypeAggregate="event-type.aggregate",u.ApplicationPurgeContent="application.purge_content",u.EndpointBulkReplay="endpoint.bulk-replay"})(ZH=oA.BackgroundTaskType||(oA.BackgroundTaskType={}));oA.BackgroundTaskTypeSerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var Z8=z((B7)=>{Object.defineProperty(B7,"__esModule",{value:!0});B7.BackgroundTaskOutSerializer=void 0;var u7=e2(),D7=u0();B7.BackgroundTaskOutSerializer={_fromJsonObject(u){return{data:u.data,id:u.id,status:u7.BackgroundTaskStatusSerializer._fromJsonObject(u.status),task:D7.BackgroundTaskTypeSerializer._fromJsonObject(u.task),updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){return{data:u.data,id:u.id,status:u7.BackgroundTaskStatusSerializer._toJsonObject(u.status),task:D7.BackgroundTaskTypeSerializer._toJsonObject(u.task),updatedAt:u.updatedAt}}}});var N7=z((w7)=>{Object.defineProperty(w7,"__esModule",{value:!0});w7.ListResponseBackgroundTaskOutSerializer=void 0;var F7=Z8();w7.ListResponseBackgroundTaskOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>F7.BackgroundTaskOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>F7.BackgroundTaskOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var J7=z((z7)=>{Object.defineProperty(z7,"__esModule",{value:!0});z7.BackgroundTask=void 0;var JH=Z8(),QH=N7(),D3=m();class $7{constructor(u){this.requestCtx=u}list(u){let D=new D3.SvixRequest(D3.HttpMethod.GET,"/api/v1/background-task");return D.setQueryParams({status:u===null||u===void 0?void 0:u.status,task:u===null||u===void 0?void 0:u.task,limit:u===null||u===void 0?void 0:u.limit,iterator:u===null||u===void 0?void 0:u.iterator,order:u===null||u===void 0?void 0:u.order}),D.send(this.requestCtx,QH.ListResponseBackgroundTaskOutSerializer._fromJsonObject)}listByEndpoint(u){return this.list(u)}get(u){let D=new D3.SvixRequest(D3.HttpMethod.GET,"/api/v1/background-task/{task_id}");return D.setPathParam("task_id",u),D.send(this.requestCtx,JH.BackgroundTaskOutSerializer._fromJsonObject)}}z7.BackgroundTask=$7});var q0=z((Y7)=>{Object.defineProperty(Y7,"__esModule",{value:!0});Y7.ConnectorKindSerializer=Y7.ConnectorKind=void 0;var YH;(function(u){u.Custom="Custom",u.AgenticCommerceProtocol="AgenticCommerceProtocol",u.CloseCrm="CloseCRM",u.CustomerIo="CustomerIO",u.Discord="Discord",u.Hubspot="Hubspot",u.Inngest="Inngest",u.Loops="Loops",u.Otel="Otel",u.Resend="Resend",u.Salesforce="Salesforce",u.Segment="Segment",u.Sendgrid="Sendgrid",u.Slack="Slack",u.Teams="Teams",u.TriggerDev="TriggerDev",u.Windmill="Windmill",u.Zapier="Zapier"})(YH=Y7.ConnectorKind||(Y7.ConnectorKind={}));Y7.ConnectorKindSerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var B3=z((v7)=>{Object.defineProperty(v7,"__esModule",{value:!0});v7.ConnectorProductSerializer=v7.ConnectorProduct=void 0;var XH;(function(u){u.Dispatch="Dispatch",u.Stream="Stream"})(XH=v7.ConnectorProduct||(v7.ConnectorProduct={}));v7.ConnectorProductSerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var J8=z((H7)=>{Object.defineProperty(H7,"__esModule",{value:!0});H7.ConnectorInSerializer=void 0;var h7=q0(),x7=B3();H7.ConnectorInSerializer={_fromJsonObject(u){return{allowedEventTypes:u.allowedEventTypes,description:u.description,featureFlags:u.featureFlags,instructions:u.instructions,kind:u.kind!=null?h7.ConnectorKindSerializer._fromJsonObject(u.kind):void 0,logo:u.logo,name:u.name,productType:u.productType!=null?x7.ConnectorProductSerializer._fromJsonObject(u.productType):void 0,transformation:u.transformation,uid:u.uid}},_toJsonObject(u){return{allowedEventTypes:u.allowedEventTypes,description:u.description,featureFlags:u.featureFlags,instructions:u.instructions,kind:u.kind!=null?h7.ConnectorKindSerializer._toJsonObject(u.kind):void 0,logo:u.logo,name:u.name,productType:u.productType!=null?x7.ConnectorProductSerializer._toJsonObject(u.productType):void 0,transformation:u.transformation,uid:u.uid}}}});var A3=z((M7)=>{Object.defineProperty(M7,"__esModule",{value:!0});M7.ConnectorOutSerializer=void 0;var R7=q0(),U7=B3();M7.ConnectorOutSerializer={_fromJsonObject(u){return{allowedEventTypes:u.allowedEventTypes,createdAt:new Date(u.createdAt),description:u.description,featureFlags:u.featureFlags,id:u.id,instructions:u.instructions,kind:R7.ConnectorKindSerializer._fromJsonObject(u.kind),logo:u.logo,name:u.name,orgId:u.orgId,productType:U7.ConnectorProductSerializer._fromJsonObject(u.productType),transformation:u.transformation,transformationUpdatedAt:new Date(u.transformationUpdatedAt),uid:u.uid,updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){return{allowedEventTypes:u.allowedEventTypes,createdAt:u.createdAt,description:u.description,featureFlags:u.featureFlags,id:u.id,instructions:u.instructions,kind:R7.ConnectorKindSerializer._toJsonObject(u.kind),logo:u.logo,name:u.name,orgId:u.orgId,productType:U7.ConnectorProductSerializer._toJsonObject(u.productType),transformation:u.transformation,transformationUpdatedAt:u.transformationUpdatedAt,uid:u.uid,updatedAt:u.updatedAt}}}});var P7=z((O7)=>{Object.defineProperty(O7,"__esModule",{value:!0});O7.ConnectorPatchSerializer=void 0;var E7=q0();O7.ConnectorPatchSerializer={_fromJsonObject(u){return{allowedEventTypes:u.allowedEventTypes,description:u.description,featureFlags:u.featureFlags,instructions:u.instructions,kind:u.kind!=null?E7.ConnectorKindSerializer._fromJsonObject(u.kind):void 0,logo:u.logo,name:u.name,transformation:u.transformation}},_toJsonObject(u){return{allowedEventTypes:u.allowedEventTypes,description:u.description,featureFlags:u.featureFlags,instructions:u.instructions,kind:u.kind!=null?E7.ConnectorKindSerializer._toJsonObject(u.kind):void 0,logo:u.logo,name:u.name,transformation:u.transformation}}}});var y7=z((V7)=>{Object.defineProperty(V7,"__esModule",{value:!0});V7.ConnectorUpdateSerializer=void 0;var c7=q0();V7.ConnectorUpdateSerializer={_fromJsonObject(u){return{allowedEventTypes:u.allowedEventTypes,description:u.description,featureFlags:u.featureFlags,instructions:u.instructions,kind:u.kind!=null?c7.ConnectorKindSerializer._fromJsonObject(u.kind):void 0,logo:u.logo,name:u.name,transformation:u.transformation}},_toJsonObject(u){return{allowedEventTypes:u.allowedEventTypes,description:u.description,featureFlags:u.featureFlags,instructions:u.instructions,kind:u.kind!=null?c7.ConnectorKindSerializer._toJsonObject(u.kind):void 0,logo:u.logo,name:u.name,transformation:u.transformation}}}});var _7=z((I7)=>{Object.defineProperty(I7,"__esModule",{value:!0});I7.ListResponseConnectorOutSerializer=void 0;var T7=A3();I7.ListResponseConnectorOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>T7.ConnectorOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>T7.ConnectorOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var b7=z((g7)=>{Object.defineProperty(g7,"__esModule",{value:!0});g7.Connector=void 0;var WH=J8(),F3=A3(),vH=P7(),KH=y7(),hH=_7(),E2=m();class m7{constructor(u){this.requestCtx=u}list(u){let D=new E2.SvixRequest(E2.HttpMethod.GET,"/api/v1/connector");return D.setQueryParams({limit:u===null||u===void 0?void 0:u.limit,iterator:u===null||u===void 0?void 0:u.iterator,order:u===null||u===void 0?void 0:u.order,product_type:u===null||u===void 0?void 0:u.productType}),D.send(this.requestCtx,hH.ListResponseConnectorOutSerializer._fromJsonObject)}create(u,D){let B=new E2.SvixRequest(E2.HttpMethod.POST,"/api/v1/connector");return B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.setBody(WH.ConnectorInSerializer._toJsonObject(u)),B.send(this.requestCtx,F3.ConnectorOutSerializer._fromJsonObject)}get(u){let D=new E2.SvixRequest(E2.HttpMethod.GET,"/api/v1/connector/{connector_id}");return D.setPathParam("connector_id",u),D.send(this.requestCtx,F3.ConnectorOutSerializer._fromJsonObject)}update(u,D){let B=new E2.SvixRequest(E2.HttpMethod.PUT,"/api/v1/connector/{connector_id}");return B.setPathParam("connector_id",u),B.setBody(KH.ConnectorUpdateSerializer._toJsonObject(D)),B.send(this.requestCtx,F3.ConnectorOutSerializer._fromJsonObject)}delete(u){let D=new E2.SvixRequest(E2.HttpMethod.DELETE,"/api/v1/connector/{connector_id}");return D.setPathParam("connector_id",u),D.sendNoResponseBody(this.requestCtx)}patch(u,D){let B=new E2.SvixRequest(E2.HttpMethod.PATCH,"/api/v1/connector/{connector_id}");return B.setPathParam("connector_id",u),B.setBody(vH.ConnectorPatchSerializer._toJsonObject(D)),B.send(this.requestCtx,F3.ConnectorOutSerializer._fromJsonObject)}}g7.Connector=m7});var _0=z((l7)=>{Object.defineProperty(l7,"__esModule",{value:!0});l7.MessageStatusSerializer=l7.MessageStatus=void 0;var xH;(function(u){u[u.Success=0]="Success",u[u.Pending=1]="Pending",u[u.Fail=2]="Fail",u[u.Sending=3]="Sending"})(xH=l7.MessageStatus||(l7.MessageStatus={}));l7.MessageStatusSerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var Q8=z((r7)=>{Object.defineProperty(r7,"__esModule",{value:!0});r7.StatusCodeClassSerializer=r7.StatusCodeClass=void 0;var HH;(function(u){u[u.CodeNone=0]="CodeNone",u[u.Code1xx=100]="Code1xx",u[u.Code2xx=200]="Code2xx",u[u.Code3xx=300]="Code3xx",u[u.Code4xx=400]="Code4xx",u[u.Code5xx=500]="Code5xx"})(HH=r7.StatusCodeClass||(r7.StatusCodeClass={}));r7.StatusCodeClassSerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var o7=z((s7)=>{Object.defineProperty(s7,"__esModule",{value:!0});s7.BulkReplayInSerializer=void 0;var p7=_0(),a7=Q8();s7.BulkReplayInSerializer={_fromJsonObject(u){return{channel:u.channel,eventTypes:u.eventTypes,since:new Date(u.since),status:u.status!=null?p7.MessageStatusSerializer._fromJsonObject(u.status):void 0,statusCodeClass:u.statusCodeClass!=null?a7.StatusCodeClassSerializer._fromJsonObject(u.statusCodeClass):void 0,tag:u.tag,until:u.until?new Date(u.until):null}},_toJsonObject(u){return{channel:u.channel,eventTypes:u.eventTypes,since:u.since,status:u.status!=null?p7.MessageStatusSerializer._toJsonObject(u.status):void 0,statusCodeClass:u.statusCodeClass!=null?a7.StatusCodeClassSerializer._toJsonObject(u.statusCodeClass):void 0,tag:u.tag,until:u.until}}}});var DF=z((e7)=>{Object.defineProperty(e7,"__esModule",{value:!0});e7.EndpointHeadersInSerializer=void 0;e7.EndpointHeadersInSerializer={_fromJsonObject(u){return{headers:u.headers}},_toJsonObject(u){return{headers:u.headers}}}});var Y8=z((BF)=>{Object.defineProperty(BF,"__esModule",{value:!0});BF.EndpointHeadersOutSerializer=void 0;BF.EndpointHeadersOutSerializer={_fromJsonObject(u){return{headers:u.headers,sensitive:u.sensitive}},_toJsonObject(u){return{headers:u.headers,sensitive:u.sensitive}}}});var GF=z((FF)=>{Object.defineProperty(FF,"__esModule",{value:!0});FF.EndpointHeadersPatchInSerializer=void 0;FF.EndpointHeadersPatchInSerializer={_fromJsonObject(u){return{deleteHeaders:u.deleteHeaders,headers:u.headers}},_toJsonObject(u){return{deleteHeaders:u.deleteHeaders,headers:u.headers}}}});var zF=z((NF)=>{Object.defineProperty(NF,"__esModule",{value:!0});NF.EndpointInSerializer=void 0;NF.EndpointInSerializer={_fromJsonObject(u){return{channels:u.channels,description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,headers:u.headers,metadata:u.metadata,rateLimit:u.rateLimit,secret:u.secret,throttleRate:u.throttleRate,uid:u.uid,url:u.url,version:u.version}},_toJsonObject(u){return{channels:u.channels,description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,headers:u.headers,metadata:u.metadata,rateLimit:u.rateLimit,secret:u.secret,throttleRate:u.throttleRate,uid:u.uid,url:u.url,version:u.version}}}});var X8=z((ZF)=>{Object.defineProperty(ZF,"__esModule",{value:!0});ZF.EndpointOutSerializer=void 0;ZF.EndpointOutSerializer={_fromJsonObject(u){return{channels:u.channels,createdAt:new Date(u.createdAt),description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,id:u.id,metadata:u.metadata,rateLimit:u.rateLimit,throttleRate:u.throttleRate,uid:u.uid,updatedAt:new Date(u.updatedAt),url:u.url,version:u.version}},_toJsonObject(u){return{channels:u.channels,createdAt:u.createdAt,description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,id:u.id,metadata:u.metadata,rateLimit:u.rateLimit,throttleRate:u.throttleRate,uid:u.uid,updatedAt:u.updatedAt,url:u.url,version:u.version}}}});var XF=z((QF)=>{Object.defineProperty(QF,"__esModule",{value:!0});QF.EndpointPatchSerializer=void 0;QF.EndpointPatchSerializer={_fromJsonObject(u){return{channels:u.channels,description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,metadata:u.metadata,rateLimit:u.rateLimit,secret:u.secret,throttleRate:u.throttleRate,uid:u.uid,url:u.url,version:u.version}},_toJsonObject(u){return{channels:u.channels,description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,metadata:u.metadata,rateLimit:u.rateLimit,secret:u.secret,throttleRate:u.throttleRate,uid:u.uid,url:u.url,version:u.version}}}});var KF=z((WF)=>{Object.defineProperty(WF,"__esModule",{value:!0});WF.EndpointSecretOutSerializer=void 0;WF.EndpointSecretOutSerializer={_fromJsonObject(u){return{key:u.key}},_toJsonObject(u){return{key:u.key}}}});var W8=z((hF)=>{Object.defineProperty(hF,"__esModule",{value:!0});hF.EndpointSecretRotateInSerializer=void 0;hF.EndpointSecretRotateInSerializer={_fromJsonObject(u){return{key:u.key}},_toJsonObject(u){return{key:u.key}}}});var RF=z((HF)=>{Object.defineProperty(HF,"__esModule",{value:!0});HF.EndpointStatsSerializer=void 0;HF.EndpointStatsSerializer={_fromJsonObject(u){return{fail:u.fail,pending:u.pending,sending:u.sending,success:u.success}},_toJsonObject(u){return{fail:u.fail,pending:u.pending,sending:u.sending,success:u.success}}}});var LF=z((UF)=>{Object.defineProperty(UF,"__esModule",{value:!0});UF.EndpointTransformationInSerializer=void 0;UF.EndpointTransformationInSerializer={_fromJsonObject(u){return{code:u.code,enabled:u.enabled}},_toJsonObject(u){return{code:u.code,enabled:u.enabled}}}});var CF=z((EF)=>{Object.defineProperty(EF,"__esModule",{value:!0});EF.EndpointTransformationOutSerializer=void 0;EF.EndpointTransformationOutSerializer={_fromJsonObject(u){return{code:u.code,enabled:u.enabled,updatedAt:u.updatedAt?new Date(u.updatedAt):null}},_toJsonObject(u){return{code:u.code,enabled:u.enabled,updatedAt:u.updatedAt}}}});var VF=z((PF)=>{Object.defineProperty(PF,"__esModule",{value:!0});PF.EndpointTransformationPatchSerializer=void 0;PF.EndpointTransformationPatchSerializer={_fromJsonObject(u){return{code:u.code,enabled:u.enabled}},_toJsonObject(u){return{code:u.code,enabled:u.enabled}}}});var TF=z((kF)=>{Object.defineProperty(kF,"__esModule",{value:!0});kF.EndpointUpdateSerializer=void 0;kF.EndpointUpdateSerializer={_fromJsonObject(u){return{channels:u.channels,description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,metadata:u.metadata,rateLimit:u.rateLimit,throttleRate:u.throttleRate,uid:u.uid,url:u.url,version:u.version}},_toJsonObject(u){return{channels:u.channels,description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,metadata:u.metadata,rateLimit:u.rateLimit,throttleRate:u.throttleRate,uid:u.uid,url:u.url,version:u.version}}}});var _F=z((IF)=>{Object.defineProperty(IF,"__esModule",{value:!0});IF.EventExampleInSerializer=void 0;IF.EventExampleInSerializer={_fromJsonObject(u){return{eventType:u.eventType,exampleIndex:u.exampleIndex}},_toJsonObject(u){return{eventType:u.eventType,exampleIndex:u.exampleIndex}}}});var bF=z((gF)=>{Object.defineProperty(gF,"__esModule",{value:!0});gF.ListResponseEndpointOutSerializer=void 0;var mF=X8();gF.ListResponseEndpointOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>mF.EndpointOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>mF.EndpointOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var Cu=z((jF)=>{Object.defineProperty(jF,"__esModule",{value:!0});jF.MessageOutSerializer=void 0;jF.MessageOutSerializer={_fromJsonObject(u){return{channels:u.channels,deliverAt:u.deliverAt?new Date(u.deliverAt):null,eventId:u.eventId,eventType:u.eventType,id:u.id,payload:u.payload,tags:u.tags,timestamp:new Date(u.timestamp)}},_toJsonObject(u){return{channels:u.channels,deliverAt:u.deliverAt,eventId:u.eventId,eventType:u.eventType,id:u.id,payload:u.payload,tags:u.tags,timestamp:u.timestamp}}}});var rF=z((dF)=>{Object.defineProperty(dF,"__esModule",{value:!0});dF.RecoverInSerializer=void 0;dF.RecoverInSerializer={_fromJsonObject(u){return{since:new Date(u.since),until:u.until?new Date(u.until):null}},_toJsonObject(u){return{since:u.since,until:u.until}}}});var tF=z((aF)=>{Object.defineProperty(aF,"__esModule",{value:!0});aF.RecoverOutSerializer=void 0;var nF=e2(),pF=u0();aF.RecoverOutSerializer={_fromJsonObject(u){return{id:u.id,status:nF.BackgroundTaskStatusSerializer._fromJsonObject(u.status),task:pF.BackgroundTaskTypeSerializer._fromJsonObject(u.task),updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){return{id:u.id,status:nF.BackgroundTaskStatusSerializer._toJsonObject(u.status),task:pF.BackgroundTaskTypeSerializer._toJsonObject(u.task),updatedAt:u.updatedAt}}}});var uw=z((oF)=>{Object.defineProperty(oF,"__esModule",{value:!0});oF.ReplayInSerializer=void 0;oF.ReplayInSerializer={_fromJsonObject(u){return{since:new Date(u.since),until:u.until?new Date(u.until):null}},_toJsonObject(u){return{since:u.since,until:u.until}}}});var ww=z((Aw)=>{Object.defineProperty(Aw,"__esModule",{value:!0});Aw.ReplayOutSerializer=void 0;var Dw=e2(),Bw=u0();Aw.ReplayOutSerializer={_fromJsonObject(u){return{id:u.id,status:Dw.BackgroundTaskStatusSerializer._fromJsonObject(u.status),task:Bw.BackgroundTaskTypeSerializer._fromJsonObject(u.task),updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){return{id:u.id,status:Dw.BackgroundTaskStatusSerializer._toJsonObject(u.status),task:Bw.BackgroundTaskTypeSerializer._toJsonObject(u.task),updatedAt:u.updatedAt}}}});var Zw=z(($w)=>{Object.defineProperty($w,"__esModule",{value:!0});$w.Endpoint=void 0;var SH=o7(),RH=DF(),UH=Y8(),MH=GF(),LH=zF(),w3=X8(),EH=XF(),OH=KF(),CH=W8(),PH=RF(),cH=LF(),VH=CF(),kH=VF(),yH=TF(),TH=_F(),IH=bF(),qH=Cu(),_H=rF(),mH=tF(),gH=uw(),Gw=ww(),R=m();class Nw{constructor(u){this.requestCtx=u}list(u,D){let B=new R.SvixRequest(R.HttpMethod.GET,"/api/v1/app/{app_id}/endpoint");return B.setPathParam("app_id",u),B.setQueryParams({limit:D===null||D===void 0?void 0:D.limit,iterator:D===null||D===void 0?void 0:D.iterator,order:D===null||D===void 0?void 0:D.order}),B.send(this.requestCtx,IH.ListResponseEndpointOutSerializer._fromJsonObject)}create(u,D,B){let A=new R.SvixRequest(R.HttpMethod.POST,"/api/v1/app/{app_id}/endpoint");return A.setPathParam("app_id",u),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(LH.EndpointInSerializer._toJsonObject(D)),A.send(this.requestCtx,w3.EndpointOutSerializer._fromJsonObject)}get(u,D){let B=new R.SvixRequest(R.HttpMethod.GET,"/api/v1/app/{app_id}/endpoint/{endpoint_id}");return B.setPathParam("app_id",u),B.setPathParam("endpoint_id",D),B.send(this.requestCtx,w3.EndpointOutSerializer._fromJsonObject)}update(u,D,B){let A=new R.SvixRequest(R.HttpMethod.PUT,"/api/v1/app/{app_id}/endpoint/{endpoint_id}");return A.setPathParam("app_id",u),A.setPathParam("endpoint_id",D),A.setBody(yH.EndpointUpdateSerializer._toJsonObject(B)),A.send(this.requestCtx,w3.EndpointOutSerializer._fromJsonObject)}delete(u,D){let B=new R.SvixRequest(R.HttpMethod.DELETE,"/api/v1/app/{app_id}/endpoint/{endpoint_id}");return B.setPathParam("app_id",u),B.setPathParam("endpoint_id",D),B.sendNoResponseBody(this.requestCtx)}patch(u,D,B){let A=new R.SvixRequest(R.HttpMethod.PATCH,"/api/v1/app/{app_id}/endpoint/{endpoint_id}");return A.setPathParam("app_id",u),A.setPathParam("endpoint_id",D),A.setBody(EH.EndpointPatchSerializer._toJsonObject(B)),A.send(this.requestCtx,w3.EndpointOutSerializer._fromJsonObject)}bulkReplay(u,D,B,A){let F=new R.SvixRequest(R.HttpMethod.POST,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/bulk-replay");return F.setPathParam("app_id",u),F.setPathParam("endpoint_id",D),F.setHeaderParam("idempotency-key",A===null||A===void 0?void 0:A.idempotencyKey),F.setBody(SH.BulkReplayInSerializer._toJsonObject(B)),F.send(this.requestCtx,Gw.ReplayOutSerializer._fromJsonObject)}getHeaders(u,D){let B=new R.SvixRequest(R.HttpMethod.GET,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/headers");return B.setPathParam("app_id",u),B.setPathParam("endpoint_id",D),B.send(this.requestCtx,UH.EndpointHeadersOutSerializer._fromJsonObject)}updateHeaders(u,D,B){let A=new R.SvixRequest(R.HttpMethod.PUT,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/headers");return A.setPathParam("app_id",u),A.setPathParam("endpoint_id",D),A.setBody(RH.EndpointHeadersInSerializer._toJsonObject(B)),A.sendNoResponseBody(this.requestCtx)}headersUpdate(u,D,B){return this.updateHeaders(u,D,B)}patchHeaders(u,D,B){let A=new R.SvixRequest(R.HttpMethod.PATCH,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/headers");return A.setPathParam("app_id",u),A.setPathParam("endpoint_id",D),A.setBody(MH.EndpointHeadersPatchInSerializer._toJsonObject(B)),A.sendNoResponseBody(this.requestCtx)}headersPatch(u,D,B){return this.patchHeaders(u,D,B)}recover(u,D,B,A){let F=new R.SvixRequest(R.HttpMethod.POST,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/recover");return F.setPathParam("app_id",u),F.setPathParam("endpoint_id",D),F.setHeaderParam("idempotency-key",A===null||A===void 0?void 0:A.idempotencyKey),F.setBody(_H.RecoverInSerializer._toJsonObject(B)),F.send(this.requestCtx,mH.RecoverOutSerializer._fromJsonObject)}replayMissing(u,D,B,A){let F=new R.SvixRequest(R.HttpMethod.POST,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/replay-missing");return F.setPathParam("app_id",u),F.setPathParam("endpoint_id",D),F.setHeaderParam("idempotency-key",A===null||A===void 0?void 0:A.idempotencyKey),F.setBody(gH.ReplayInSerializer._toJsonObject(B)),F.send(this.requestCtx,Gw.ReplayOutSerializer._fromJsonObject)}getSecret(u,D){let B=new R.SvixRequest(R.HttpMethod.GET,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/secret");return B.setPathParam("app_id",u),B.setPathParam("endpoint_id",D),B.send(this.requestCtx,OH.EndpointSecretOutSerializer._fromJsonObject)}rotateSecret(u,D,B,A){let F=new R.SvixRequest(R.HttpMethod.POST,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/secret/rotate");return F.setPathParam("app_id",u),F.setPathParam("endpoint_id",D),F.setHeaderParam("idempotency-key",A===null||A===void 0?void 0:A.idempotencyKey),F.setBody(CH.EndpointSecretRotateInSerializer._toJsonObject(B)),F.sendNoResponseBody(this.requestCtx)}sendExample(u,D,B,A){let F=new R.SvixRequest(R.HttpMethod.POST,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/send-example");return F.setPathParam("app_id",u),F.setPathParam("endpoint_id",D),F.setHeaderParam("idempotency-key",A===null||A===void 0?void 0:A.idempotencyKey),F.setBody(TH.EventExampleInSerializer._toJsonObject(B)),F.send(this.requestCtx,qH.MessageOutSerializer._fromJsonObject)}getStats(u,D,B){let A=new R.SvixRequest(R.HttpMethod.GET,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/stats");return A.setPathParam("app_id",u),A.setPathParam("endpoint_id",D),A.setQueryParams({since:B===null||B===void 0?void 0:B.since,until:B===null||B===void 0?void 0:B.until}),A.send(this.requestCtx,PH.EndpointStatsSerializer._fromJsonObject)}transformationGet(u,D){let B=new R.SvixRequest(R.HttpMethod.GET,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/transformation");return B.setPathParam("app_id",u),B.setPathParam("endpoint_id",D),B.send(this.requestCtx,VH.EndpointTransformationOutSerializer._fromJsonObject)}patchTransformation(u,D,B){let A=new R.SvixRequest(R.HttpMethod.PATCH,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/transformation");return A.setPathParam("app_id",u),A.setPathParam("endpoint_id",D),A.setBody(kH.EndpointTransformationPatchSerializer._toJsonObject(B)),A.sendNoResponseBody(this.requestCtx)}transformationPartialUpdate(u,D,B){let A=new R.SvixRequest(R.HttpMethod.PATCH,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/transformation");return A.setPathParam("app_id",u),A.setPathParam("endpoint_id",D),A.setBody(cH.EndpointTransformationInSerializer._toJsonObject(B)),A.sendNoResponseBody(this.requestCtx)}}$w.Endpoint=Nw});var v8=z((Jw)=>{Object.defineProperty(Jw,"__esModule",{value:!0});Jw.EventTypeInSerializer=void 0;Jw.EventTypeInSerializer={_fromJsonObject(u){return{archived:u.archived,deprecated:u.deprecated,description:u.description,featureFlag:u.featureFlag,featureFlags:u.featureFlags,groupName:u.groupName,name:u.name,schemas:u.schemas}},_toJsonObject(u){return{archived:u.archived,deprecated:u.deprecated,description:u.description,featureFlag:u.featureFlag,featureFlags:u.featureFlags,groupName:u.groupName,name:u.name,schemas:u.schemas}}}});var Kw=z((Ww)=>{Object.defineProperty(Ww,"__esModule",{value:!0});Ww.EnvironmentInSerializer=void 0;var Yw=J8(),Xw=v8();Ww.EnvironmentInSerializer={_fromJsonObject(u){var D,B;return{connectors:(D=u.connectors)===null||D===void 0?void 0:D.map((A)=>Yw.ConnectorInSerializer._fromJsonObject(A)),eventTypes:(B=u.eventTypes)===null||B===void 0?void 0:B.map((A)=>Xw.EventTypeInSerializer._fromJsonObject(A)),settings:u.settings}},_toJsonObject(u){var D,B;return{connectors:(D=u.connectors)===null||D===void 0?void 0:D.map((A)=>Yw.ConnectorInSerializer._toJsonObject(A)),eventTypes:(B=u.eventTypes)===null||B===void 0?void 0:B.map((A)=>Xw.EventTypeInSerializer._toJsonObject(A)),settings:u.settings}}}});var G3=z((hw)=>{Object.defineProperty(hw,"__esModule",{value:!0});hw.EventTypeOutSerializer=void 0;hw.EventTypeOutSerializer={_fromJsonObject(u){return{archived:u.archived,createdAt:new Date(u.createdAt),deprecated:u.deprecated,description:u.description,featureFlag:u.featureFlag,featureFlags:u.featureFlags,groupName:u.groupName,name:u.name,schemas:u.schemas,updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){return{archived:u.archived,createdAt:u.createdAt,deprecated:u.deprecated,description:u.description,featureFlag:u.featureFlag,featureFlags:u.featureFlags,groupName:u.groupName,name:u.name,schemas:u.schemas,updatedAt:u.updatedAt}}}});var Mw=z((Rw)=>{Object.defineProperty(Rw,"__esModule",{value:!0});Rw.EnvironmentOutSerializer=void 0;var Hw=A3(),Sw=G3();Rw.EnvironmentOutSerializer={_fromJsonObject(u){return{connectors:u.connectors.map((D)=>Hw.ConnectorOutSerializer._fromJsonObject(D)),createdAt:new Date(u.createdAt),eventTypes:u.eventTypes.map((D)=>Sw.EventTypeOutSerializer._fromJsonObject(D)),settings:u.settings,version:u.version}},_toJsonObject(u){return{connectors:u.connectors.map((D)=>Hw.ConnectorOutSerializer._toJsonObject(D)),createdAt:u.createdAt,eventTypes:u.eventTypes.map((D)=>Sw.EventTypeOutSerializer._toJsonObject(D)),settings:u.settings,version:u.version}}}});var Cw=z((Ew)=>{Object.defineProperty(Ew,"__esModule",{value:!0});Ew.Environment=void 0;var fH=Kw(),bH=Mw(),N3=m();class Lw{constructor(u){this.requestCtx=u}export(u){let D=new N3.SvixRequest(N3.HttpMethod.POST,"/api/v1/environment/export");return D.setHeaderParam("idempotency-key",u===null||u===void 0?void 0:u.idempotencyKey),D.send(this.requestCtx,bH.EnvironmentOutSerializer._fromJsonObject)}import(u,D){let B=new N3.SvixRequest(N3.HttpMethod.POST,"/api/v1/environment/import");return B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.setBody(fH.EnvironmentInSerializer._toJsonObject(u)),B.sendNoResponseBody(this.requestCtx)}}Ew.Environment=Lw});var Vw=z((Pw)=>{Object.defineProperty(Pw,"__esModule",{value:!0});Pw.EventTypeImportOpenApiInSerializer=void 0;Pw.EventTypeImportOpenApiInSerializer={_fromJsonObject(u){return{dryRun:u.dryRun,replaceAll:u.replaceAll,spec:u.spec,specRaw:u.specRaw}},_toJsonObject(u){return{dryRun:u.dryRun,replaceAll:u.replaceAll,spec:u.spec,specRaw:u.specRaw}}}});var Tw=z((kw)=>{Object.defineProperty(kw,"__esModule",{value:!0});kw.EventTypeFromOpenApiSerializer=void 0;kw.EventTypeFromOpenApiSerializer={_fromJsonObject(u){return{deprecated:u.deprecated,description:u.description,featureFlag:u.featureFlag,featureFlags:u.featureFlags,groupName:u.groupName,name:u.name,schemas:u.schemas}},_toJsonObject(u){return{deprecated:u.deprecated,description:u.description,featureFlag:u.featureFlag,featureFlags:u.featureFlags,groupName:u.groupName,name:u.name,schemas:u.schemas}}}});var mw=z((qw)=>{Object.defineProperty(qw,"__esModule",{value:!0});qw.EventTypeImportOpenApiOutDataSerializer=void 0;var Iw=Tw();qw.EventTypeImportOpenApiOutDataSerializer={_fromJsonObject(u){var D;return{modified:u.modified,toModify:(D=u.to_modify)===null||D===void 0?void 0:D.map((B)=>Iw.EventTypeFromOpenApiSerializer._fromJsonObject(B))}},_toJsonObject(u){var D;return{modified:u.modified,to_modify:(D=u.toModify)===null||D===void 0?void 0:D.map((B)=>Iw.EventTypeFromOpenApiSerializer._toJsonObject(B))}}}});var jw=z((fw)=>{Object.defineProperty(fw,"__esModule",{value:!0});fw.EventTypeImportOpenApiOutSerializer=void 0;var gw=mw();fw.EventTypeImportOpenApiOutSerializer={_fromJsonObject(u){return{data:gw.EventTypeImportOpenApiOutDataSerializer._fromJsonObject(u.data)}},_toJsonObject(u){return{data:gw.EventTypeImportOpenApiOutDataSerializer._toJsonObject(u.data)}}}});var iw=z((lw)=>{Object.defineProperty(lw,"__esModule",{value:!0});lw.EventTypePatchSerializer=void 0;lw.EventTypePatchSerializer={_fromJsonObject(u){return{archived:u.archived,deprecated:u.deprecated,description:u.description,featureFlag:u.featureFlag,featureFlags:u.featureFlags,groupName:u.groupName,schemas:u.schemas}},_toJsonObject(u){return{archived:u.archived,deprecated:u.deprecated,description:u.description,featureFlag:u.featureFlag,featureFlags:u.featureFlags,groupName:u.groupName,schemas:u.schemas}}}});var pw=z((rw)=>{Object.defineProperty(rw,"__esModule",{value:!0});rw.EventTypeUpdateSerializer=void 0;rw.EventTypeUpdateSerializer={_fromJsonObject(u){return{archived:u.archived,deprecated:u.deprecated,description:u.description,featureFlag:u.featureFlag,featureFlags:u.featureFlags,groupName:u.groupName,schemas:u.schemas}},_toJsonObject(u){return{archived:u.archived,deprecated:u.deprecated,description:u.description,featureFlag:u.featureFlag,featureFlags:u.featureFlags,groupName:u.groupName,schemas:u.schemas}}}});var ow=z((sw)=>{Object.defineProperty(sw,"__esModule",{value:!0});sw.ListResponseEventTypeOutSerializer=void 0;var aw=G3();sw.ListResponseEventTypeOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>aw.EventTypeOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>aw.EventTypeOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var BG=z((uG)=>{Object.defineProperty(uG,"__esModule",{value:!0});uG.EventType=void 0;var jH=Vw(),lH=jw(),dH=v8(),$3=G3(),iH=iw(),rH=pw(),nH=ow(),Y2=m();class ew{constructor(u){this.requestCtx=u}list(u){let D=new Y2.SvixRequest(Y2.HttpMethod.GET,"/api/v1/event-type");return D.setQueryParams({limit:u===null||u===void 0?void 0:u.limit,iterator:u===null||u===void 0?void 0:u.iterator,order:u===null||u===void 0?void 0:u.order,include_archived:u===null||u===void 0?void 0:u.includeArchived,with_content:u===null||u===void 0?void 0:u.withContent}),D.send(this.requestCtx,nH.ListResponseEventTypeOutSerializer._fromJsonObject)}create(u,D){let B=new Y2.SvixRequest(Y2.HttpMethod.POST,"/api/v1/event-type");return B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.setBody(dH.EventTypeInSerializer._toJsonObject(u)),B.send(this.requestCtx,$3.EventTypeOutSerializer._fromJsonObject)}importOpenapi(u,D){let B=new Y2.SvixRequest(Y2.HttpMethod.POST,"/api/v1/event-type/import/openapi");return B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.setBody(jH.EventTypeImportOpenApiInSerializer._toJsonObject(u)),B.send(this.requestCtx,lH.EventTypeImportOpenApiOutSerializer._fromJsonObject)}get(u){let D=new Y2.SvixRequest(Y2.HttpMethod.GET,"/api/v1/event-type/{event_type_name}");return D.setPathParam("event_type_name",u),D.send(this.requestCtx,$3.EventTypeOutSerializer._fromJsonObject)}update(u,D){let B=new Y2.SvixRequest(Y2.HttpMethod.PUT,"/api/v1/event-type/{event_type_name}");return B.setPathParam("event_type_name",u),B.setBody(rH.EventTypeUpdateSerializer._toJsonObject(D)),B.send(this.requestCtx,$3.EventTypeOutSerializer._fromJsonObject)}delete(u,D){let B=new Y2.SvixRequest(Y2.HttpMethod.DELETE,"/api/v1/event-type/{event_type_name}");return B.setPathParam("event_type_name",u),B.setQueryParams({expunge:D===null||D===void 0?void 0:D.expunge}),B.sendNoResponseBody(this.requestCtx)}patch(u,D){let B=new Y2.SvixRequest(Y2.HttpMethod.PATCH,"/api/v1/event-type/{event_type_name}");return B.setPathParam("event_type_name",u),B.setBody(iH.EventTypePatchSerializer._toJsonObject(D)),B.send(this.requestCtx,$3.EventTypeOutSerializer._fromJsonObject)}}uG.EventType=ew});var NG=z((wG)=>{Object.defineProperty(wG,"__esModule",{value:!0});wG.Health=void 0;var AG=m();class FG{constructor(u){this.requestCtx=u}get(){return new AG.SvixRequest(AG.HttpMethod.GET,"/api/v1/health").sendNoResponseBody(this.requestCtx)}}wG.Health=FG});var ZG=z(($G)=>{Object.defineProperty($G,"__esModule",{value:!0});$G.IngestSourceConsumerPortalAccessInSerializer=void 0;$G.IngestSourceConsumerPortalAccessInSerializer={_fromJsonObject(u){return{expiry:u.expiry,readOnly:u.readOnly}},_toJsonObject(u){return{expiry:u.expiry,readOnly:u.readOnly}}}});var YG=z((JG)=>{Object.defineProperty(JG,"__esModule",{value:!0});JG.IngestEndpointHeadersInSerializer=void 0;JG.IngestEndpointHeadersInSerializer={_fromJsonObject(u){return{headers:u.headers}},_toJsonObject(u){return{headers:u.headers}}}});var vG=z((XG)=>{Object.defineProperty(XG,"__esModule",{value:!0});XG.IngestEndpointHeadersOutSerializer=void 0;XG.IngestEndpointHeadersOutSerializer={_fromJsonObject(u){return{headers:u.headers,sensitive:u.sensitive}},_toJsonObject(u){return{headers:u.headers,sensitive:u.sensitive}}}});var xG=z((KG)=>{Object.defineProperty(KG,"__esModule",{value:!0});KG.IngestEndpointInSerializer=void 0;KG.IngestEndpointInSerializer={_fromJsonObject(u){return{description:u.description,disabled:u.disabled,metadata:u.metadata,rateLimit:u.rateLimit,secret:u.secret,uid:u.uid,url:u.url}},_toJsonObject(u){return{description:u.description,disabled:u.disabled,metadata:u.metadata,rateLimit:u.rateLimit,secret:u.secret,uid:u.uid,url:u.url}}}});var K8=z((HG)=>{Object.defineProperty(HG,"__esModule",{value:!0});HG.IngestEndpointOutSerializer=void 0;HG.IngestEndpointOutSerializer={_fromJsonObject(u){return{createdAt:new Date(u.createdAt),description:u.description,disabled:u.disabled,id:u.id,metadata:u.metadata,rateLimit:u.rateLimit,uid:u.uid,updatedAt:new Date(u.updatedAt),url:u.url}},_toJsonObject(u){return{createdAt:u.createdAt,description:u.description,disabled:u.disabled,id:u.id,metadata:u.metadata,rateLimit:u.rateLimit,uid:u.uid,updatedAt:u.updatedAt,url:u.url}}}});var MG=z((RG)=>{Object.defineProperty(RG,"__esModule",{value:!0});RG.IngestEndpointSecretInSerializer=void 0;RG.IngestEndpointSecretInSerializer={_fromJsonObject(u){return{key:u.key}},_toJsonObject(u){return{key:u.key}}}});var OG=z((LG)=>{Object.defineProperty(LG,"__esModule",{value:!0});LG.IngestEndpointSecretOutSerializer=void 0;LG.IngestEndpointSecretOutSerializer={_fromJsonObject(u){return{key:u.key}},_toJsonObject(u){return{key:u.key}}}});var cG=z((CG)=>{Object.defineProperty(CG,"__esModule",{value:!0});CG.IngestEndpointTransformationOutSerializer=void 0;CG.IngestEndpointTransformationOutSerializer={_fromJsonObject(u){return{code:u.code,enabled:u.enabled}},_toJsonObject(u){return{code:u.code,enabled:u.enabled}}}});var yG=z((VG)=>{Object.defineProperty(VG,"__esModule",{value:!0});VG.IngestEndpointTransformationPatchSerializer=void 0;VG.IngestEndpointTransformationPatchSerializer={_fromJsonObject(u){return{code:u.code,enabled:u.enabled}},_toJsonObject(u){return{code:u.code,enabled:u.enabled}}}});var qG=z((TG)=>{Object.defineProperty(TG,"__esModule",{value:!0});TG.IngestEndpointUpdateSerializer=void 0;TG.IngestEndpointUpdateSerializer={_fromJsonObject(u){return{description:u.description,disabled:u.disabled,metadata:u.metadata,rateLimit:u.rateLimit,uid:u.uid,url:u.url}},_toJsonObject(u){return{description:u.description,disabled:u.disabled,metadata:u.metadata,rateLimit:u.rateLimit,uid:u.uid,url:u.url}}}});var fG=z((mG)=>{Object.defineProperty(mG,"__esModule",{value:!0});mG.ListResponseIngestEndpointOutSerializer=void 0;var _G=K8();mG.ListResponseIngestEndpointOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>_G.IngestEndpointOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>_G.IngestEndpointOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var dG=z((jG)=>{Object.defineProperty(jG,"__esModule",{value:!0});jG.IngestEndpoint=void 0;var pH=YG(),aH=vG(),sH=xG(),h8=K8(),tH=MG(),oH=OG(),eH=cG(),uS=yG(),DS=qG(),BS=fG(),b=m();class bG{constructor(u){this.requestCtx=u}list(u,D){let B=new b.SvixRequest(b.HttpMethod.GET,"/ingest/api/v1/source/{source_id}/endpoint");return B.setPathParam("source_id",u),B.setQueryParams({limit:D===null||D===void 0?void 0:D.limit,iterator:D===null||D===void 0?void 0:D.iterator,order:D===null||D===void 0?void 0:D.order}),B.send(this.requestCtx,BS.ListResponseIngestEndpointOutSerializer._fromJsonObject)}create(u,D,B){let A=new b.SvixRequest(b.HttpMethod.POST,"/ingest/api/v1/source/{source_id}/endpoint");return A.setPathParam("source_id",u),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(sH.IngestEndpointInSerializer._toJsonObject(D)),A.send(this.requestCtx,h8.IngestEndpointOutSerializer._fromJsonObject)}get(u,D){let B=new b.SvixRequest(b.HttpMethod.GET,"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}");return B.setPathParam("source_id",u),B.setPathParam("endpoint_id",D),B.send(this.requestCtx,h8.IngestEndpointOutSerializer._fromJsonObject)}update(u,D,B){let A=new b.SvixRequest(b.HttpMethod.PUT,"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}");return A.setPathParam("source_id",u),A.setPathParam("endpoint_id",D),A.setBody(DS.IngestEndpointUpdateSerializer._toJsonObject(B)),A.send(this.requestCtx,h8.IngestEndpointOutSerializer._fromJsonObject)}delete(u,D){let B=new b.SvixRequest(b.HttpMethod.DELETE,"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}");return B.setPathParam("source_id",u),B.setPathParam("endpoint_id",D),B.sendNoResponseBody(this.requestCtx)}getHeaders(u,D){let B=new b.SvixRequest(b.HttpMethod.GET,"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/headers");return B.setPathParam("source_id",u),B.setPathParam("endpoint_id",D),B.send(this.requestCtx,aH.IngestEndpointHeadersOutSerializer._fromJsonObject)}updateHeaders(u,D,B){let A=new b.SvixRequest(b.HttpMethod.PUT,"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/headers");return A.setPathParam("source_id",u),A.setPathParam("endpoint_id",D),A.setBody(pH.IngestEndpointHeadersInSerializer._toJsonObject(B)),A.sendNoResponseBody(this.requestCtx)}getSecret(u,D){let B=new b.SvixRequest(b.HttpMethod.GET,"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/secret");return B.setPathParam("source_id",u),B.setPathParam("endpoint_id",D),B.send(this.requestCtx,oH.IngestEndpointSecretOutSerializer._fromJsonObject)}rotateSecret(u,D,B,A){let F=new b.SvixRequest(b.HttpMethod.POST,"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/secret/rotate");return F.setPathParam("source_id",u),F.setPathParam("endpoint_id",D),F.setHeaderParam("idempotency-key",A===null||A===void 0?void 0:A.idempotencyKey),F.setBody(tH.IngestEndpointSecretInSerializer._toJsonObject(B)),F.sendNoResponseBody(this.requestCtx)}getTransformation(u,D){let B=new b.SvixRequest(b.HttpMethod.GET,"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/transformation");return B.setPathParam("source_id",u),B.setPathParam("endpoint_id",D),B.send(this.requestCtx,eH.IngestEndpointTransformationOutSerializer._fromJsonObject)}setTransformation(u,D,B){let A=new b.SvixRequest(b.HttpMethod.PATCH,"/ingest/api/v1/source/{source_id}/endpoint/{endpoint_id}/transformation");return A.setPathParam("source_id",u),A.setPathParam("endpoint_id",D),A.setBody(uS.IngestEndpointTransformationPatchSerializer._toJsonObject(B)),A.sendNoResponseBody(this.requestCtx)}}jG.IngestEndpoint=bG});var nG=z((iG)=>{Object.defineProperty(iG,"__esModule",{value:!0});iG.AdobeSignConfigSerializer=void 0;iG.AdobeSignConfigSerializer={_fromJsonObject(u){return{clientId:u.clientId}},_toJsonObject(u){return{clientId:u.clientId}}}});var sG=z((pG)=>{Object.defineProperty(pG,"__esModule",{value:!0});pG.AirwallexConfigSerializer=void 0;pG.AirwallexConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var eG=z((tG)=>{Object.defineProperty(tG,"__esModule",{value:!0});tG.CheckbookConfigSerializer=void 0;tG.CheckbookConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var x8=z((uN)=>{Object.defineProperty(uN,"__esModule",{value:!0});uN.CronConfigSerializer=void 0;uN.CronConfigSerializer={_fromJsonObject(u){return{contentType:u.contentType,payload:u.payload,schedule:u.schedule}},_toJsonObject(u){return{contentType:u.contentType,payload:u.payload,schedule:u.schedule}}}});var FN=z((BN)=>{Object.defineProperty(BN,"__esModule",{value:!0});BN.DocusignConfigSerializer=void 0;BN.DocusignConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var NN=z((wN)=>{Object.defineProperty(wN,"__esModule",{value:!0});wN.EasypostConfigSerializer=void 0;wN.EasypostConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var ZN=z(($N)=>{Object.defineProperty($N,"__esModule",{value:!0});$N.GithubConfigSerializer=void 0;$N.GithubConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var YN=z((JN)=>{Object.defineProperty(JN,"__esModule",{value:!0});JN.HubspotConfigSerializer=void 0;JN.HubspotConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var vN=z((XN)=>{Object.defineProperty(XN,"__esModule",{value:!0});XN.MetaConfigSerializer=void 0;XN.MetaConfigSerializer={_fromJsonObject(u){return{secret:u.secret,verifyToken:u.verifyToken}},_toJsonObject(u){return{secret:u.secret,verifyToken:u.verifyToken}}}});var xN=z((KN)=>{Object.defineProperty(KN,"__esModule",{value:!0});KN.OrumIoConfigSerializer=void 0;KN.OrumIoConfigSerializer={_fromJsonObject(u){return{publicKey:u.publicKey}},_toJsonObject(u){return{publicKey:u.publicKey}}}});var RN=z((HN)=>{Object.defineProperty(HN,"__esModule",{value:!0});HN.PandaDocConfigSerializer=void 0;HN.PandaDocConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var LN=z((UN)=>{Object.defineProperty(UN,"__esModule",{value:!0});UN.PortIoConfigSerializer=void 0;UN.PortIoConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var CN=z((EN)=>{Object.defineProperty(EN,"__esModule",{value:!0});EN.RutterConfigSerializer=void 0;EN.RutterConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var VN=z((PN)=>{Object.defineProperty(PN,"__esModule",{value:!0});PN.SegmentConfigSerializer=void 0;PN.SegmentConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var TN=z((kN)=>{Object.defineProperty(kN,"__esModule",{value:!0});kN.ShopifyConfigSerializer=void 0;kN.ShopifyConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var _N=z((IN)=>{Object.defineProperty(IN,"__esModule",{value:!0});IN.SlackConfigSerializer=void 0;IN.SlackConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var fN=z((mN)=>{Object.defineProperty(mN,"__esModule",{value:!0});mN.StripeConfigSerializer=void 0;mN.StripeConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var lN=z((bN)=>{Object.defineProperty(bN,"__esModule",{value:!0});bN.SvixConfigSerializer=void 0;bN.SvixConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var rN=z((dN)=>{Object.defineProperty(dN,"__esModule",{value:!0});dN.TelnyxConfigSerializer=void 0;dN.TelnyxConfigSerializer={_fromJsonObject(u){return{publicKey:u.publicKey}},_toJsonObject(u){return{publicKey:u.publicKey}}}});var aN=z((nN)=>{Object.defineProperty(nN,"__esModule",{value:!0});nN.VapiConfigSerializer=void 0;nN.VapiConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var oN=z((sN)=>{Object.defineProperty(sN,"__esModule",{value:!0});sN.VeriffConfigSerializer=void 0;sN.VeriffConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var D$=z((eN)=>{Object.defineProperty(eN,"__esModule",{value:!0});eN.ZoomConfigSerializer=void 0;eN.ZoomConfigSerializer={_fromJsonObject(u){return{secret:u.secret}},_toJsonObject(u){return{secret:u.secret}}}});var L$=z((U$)=>{Object.defineProperty(U$,"__esModule",{value:!0});U$.IngestSourceInSerializer=void 0;var B$=nG(),A$=sG(),F$=eG(),w$=x8(),G$=FN(),N$=NN(),$$=ZN(),z$=YN(),Z$=vN(),J$=xN(),Q$=RN(),Y$=LN(),X$=CN(),W$=VN(),v$=TN(),K$=_N(),h$=fN(),P=lN(),x$=rN(),H$=aN(),S$=oN(),R$=D$();U$.IngestSourceInSerializer={_fromJsonObject(u){let D=u.type;function B(A){switch(A){case"generic-webhook":return{};case"cron":return w$.CronConfigSerializer._fromJsonObject(u.config);case"adobe-sign":return B$.AdobeSignConfigSerializer._fromJsonObject(u.config);case"beehiiv":return P.SvixConfigSerializer._fromJsonObject(u.config);case"brex":return P.SvixConfigSerializer._fromJsonObject(u.config);case"checkbook":return F$.CheckbookConfigSerializer._fromJsonObject(u.config);case"clerk":return P.SvixConfigSerializer._fromJsonObject(u.config);case"docusign":return G$.DocusignConfigSerializer._fromJsonObject(u.config);case"easypost":return N$.EasypostConfigSerializer._fromJsonObject(u.config);case"github":return $$.GithubConfigSerializer._fromJsonObject(u.config);case"guesty":return P.SvixConfigSerializer._fromJsonObject(u.config);case"hubspot":return z$.HubspotConfigSerializer._fromJsonObject(u.config);case"incident-io":return P.SvixConfigSerializer._fromJsonObject(u.config);case"lithic":return P.SvixConfigSerializer._fromJsonObject(u.config);case"meta":return Z$.MetaConfigSerializer._fromJsonObject(u.config);case"nash":return P.SvixConfigSerializer._fromJsonObject(u.config);case"orum-io":return J$.OrumIoConfigSerializer._fromJsonObject(u.config);case"panda-doc":return Q$.PandaDocConfigSerializer._fromJsonObject(u.config);case"port-io":return Y$.PortIoConfigSerializer._fromJsonObject(u.config);case"pleo":return P.SvixConfigSerializer._fromJsonObject(u.config);case"psi-fi":return P.SvixConfigSerializer._fromJsonObject(u.config);case"replicate":return P.SvixConfigSerializer._fromJsonObject(u.config);case"resend":return P.SvixConfigSerializer._fromJsonObject(u.config);case"rutter":return X$.RutterConfigSerializer._fromJsonObject(u.config);case"safebase":return P.SvixConfigSerializer._fromJsonObject(u.config);case"sardine":return P.SvixConfigSerializer._fromJsonObject(u.config);case"segment":return W$.SegmentConfigSerializer._fromJsonObject(u.config);case"shopify":return v$.ShopifyConfigSerializer._fromJsonObject(u.config);case"slack":return K$.SlackConfigSerializer._fromJsonObject(u.config);case"stripe":return h$.StripeConfigSerializer._fromJsonObject(u.config);case"stych":return P.SvixConfigSerializer._fromJsonObject(u.config);case"svix":return P.SvixConfigSerializer._fromJsonObject(u.config);case"zoom":return R$.ZoomConfigSerializer._fromJsonObject(u.config);case"telnyx":return x$.TelnyxConfigSerializer._fromJsonObject(u.config);case"vapi":return H$.VapiConfigSerializer._fromJsonObject(u.config);case"open-ai":return P.SvixConfigSerializer._fromJsonObject(u.config);case"render":return P.SvixConfigSerializer._fromJsonObject(u.config);case"veriff":return S$.VeriffConfigSerializer._fromJsonObject(u.config);case"airwallex":return A$.AirwallexConfigSerializer._fromJsonObject(u.config);default:throw Error(`Unexpected type: ${A}`)}}return{type:D,config:B(D),metadata:u.metadata,name:u.name,uid:u.uid}},_toJsonObject(u){let D;switch(u.type){case"generic-webhook":D={};break;case"cron":D=w$.CronConfigSerializer._toJsonObject(u.config);break;case"adobe-sign":D=B$.AdobeSignConfigSerializer._toJsonObject(u.config);break;case"beehiiv":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"brex":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"checkbook":D=F$.CheckbookConfigSerializer._toJsonObject(u.config);break;case"clerk":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"docusign":D=G$.DocusignConfigSerializer._toJsonObject(u.config);break;case"easypost":D=N$.EasypostConfigSerializer._toJsonObject(u.config);break;case"github":D=$$.GithubConfigSerializer._toJsonObject(u.config);break;case"guesty":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"hubspot":D=z$.HubspotConfigSerializer._toJsonObject(u.config);break;case"incident-io":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"lithic":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"meta":D=Z$.MetaConfigSerializer._toJsonObject(u.config);break;case"nash":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"orum-io":D=J$.OrumIoConfigSerializer._toJsonObject(u.config);break;case"panda-doc":D=Q$.PandaDocConfigSerializer._toJsonObject(u.config);break;case"port-io":D=Y$.PortIoConfigSerializer._toJsonObject(u.config);break;case"pleo":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"psi-fi":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"replicate":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"resend":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"rutter":D=X$.RutterConfigSerializer._toJsonObject(u.config);break;case"safebase":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"sardine":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"segment":D=W$.SegmentConfigSerializer._toJsonObject(u.config);break;case"shopify":D=v$.ShopifyConfigSerializer._toJsonObject(u.config);break;case"slack":D=K$.SlackConfigSerializer._toJsonObject(u.config);break;case"stripe":D=h$.StripeConfigSerializer._toJsonObject(u.config);break;case"stych":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"svix":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"zoom":D=R$.ZoomConfigSerializer._toJsonObject(u.config);break;case"telnyx":D=x$.TelnyxConfigSerializer._toJsonObject(u.config);break;case"vapi":D=H$.VapiConfigSerializer._toJsonObject(u.config);break;case"open-ai":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"render":D=P.SvixConfigSerializer._toJsonObject(u.config);break;case"veriff":D=S$.VeriffConfigSerializer._toJsonObject(u.config);break;case"airwallex":D=A$.AirwallexConfigSerializer._toJsonObject(u.config);break}return{type:u.type,config:D,metadata:u.metadata,name:u.name,uid:u.uid}}}});var C$=z((E$)=>{Object.defineProperty(E$,"__esModule",{value:!0});E$.AdobeSignConfigOutSerializer=void 0;E$.AdobeSignConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var V$=z((P$)=>{Object.defineProperty(P$,"__esModule",{value:!0});P$.AirwallexConfigOutSerializer=void 0;P$.AirwallexConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var T$=z((k$)=>{Object.defineProperty(k$,"__esModule",{value:!0});k$.CheckbookConfigOutSerializer=void 0;k$.CheckbookConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var _$=z((I$)=>{Object.defineProperty(I$,"__esModule",{value:!0});I$.DocusignConfigOutSerializer=void 0;I$.DocusignConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var f$=z((m$)=>{Object.defineProperty(m$,"__esModule",{value:!0});m$.EasypostConfigOutSerializer=void 0;m$.EasypostConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var l$=z((b$)=>{Object.defineProperty(b$,"__esModule",{value:!0});b$.GithubConfigOutSerializer=void 0;b$.GithubConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var r$=z((d$)=>{Object.defineProperty(d$,"__esModule",{value:!0});d$.HubspotConfigOutSerializer=void 0;d$.HubspotConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var a$=z((n$)=>{Object.defineProperty(n$,"__esModule",{value:!0});n$.MetaConfigOutSerializer=void 0;n$.MetaConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var o$=z((s$)=>{Object.defineProperty(s$,"__esModule",{value:!0});s$.OrumIoConfigOutSerializer=void 0;s$.OrumIoConfigOutSerializer={_fromJsonObject(u){return{publicKey:u.publicKey}},_toJsonObject(u){return{publicKey:u.publicKey}}}});var Dz=z((e$)=>{Object.defineProperty(e$,"__esModule",{value:!0});e$.PandaDocConfigOutSerializer=void 0;e$.PandaDocConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var Fz=z((Bz)=>{Object.defineProperty(Bz,"__esModule",{value:!0});Bz.PortIoConfigOutSerializer=void 0;Bz.PortIoConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var Nz=z((wz)=>{Object.defineProperty(wz,"__esModule",{value:!0});wz.RutterConfigOutSerializer=void 0;wz.RutterConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var Zz=z(($z)=>{Object.defineProperty($z,"__esModule",{value:!0});$z.SegmentConfigOutSerializer=void 0;$z.SegmentConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var Yz=z((Jz)=>{Object.defineProperty(Jz,"__esModule",{value:!0});Jz.ShopifyConfigOutSerializer=void 0;Jz.ShopifyConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var vz=z((Xz)=>{Object.defineProperty(Xz,"__esModule",{value:!0});Xz.SlackConfigOutSerializer=void 0;Xz.SlackConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var xz=z((Kz)=>{Object.defineProperty(Kz,"__esModule",{value:!0});Kz.StripeConfigOutSerializer=void 0;Kz.StripeConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var Rz=z((Hz)=>{Object.defineProperty(Hz,"__esModule",{value:!0});Hz.SvixConfigOutSerializer=void 0;Hz.SvixConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var Lz=z((Uz)=>{Object.defineProperty(Uz,"__esModule",{value:!0});Uz.TelnyxConfigOutSerializer=void 0;Uz.TelnyxConfigOutSerializer={_fromJsonObject(u){return{publicKey:u.publicKey}},_toJsonObject(u){return{publicKey:u.publicKey}}}});var Cz=z((Ez)=>{Object.defineProperty(Ez,"__esModule",{value:!0});Ez.VapiConfigOutSerializer=void 0;Ez.VapiConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var Vz=z((Pz)=>{Object.defineProperty(Pz,"__esModule",{value:!0});Pz.VeriffConfigOutSerializer=void 0;Pz.VeriffConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var Tz=z((kz)=>{Object.defineProperty(kz,"__esModule",{value:!0});kz.ZoomConfigOutSerializer=void 0;kz.ZoomConfigOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var H8=z((BZ)=>{Object.defineProperty(BZ,"__esModule",{value:!0});BZ.IngestSourceOutSerializer=void 0;var Iz=C$(),qz=V$(),_z=T$(),mz=x8(),gz=_$(),fz=f$(),bz=l$(),jz=r$(),lz=a$(),dz=o$(),iz=Dz(),rz=Fz(),nz=Nz(),pz=Zz(),az=Yz(),sz=vz(),tz=xz(),c=Rz(),oz=Lz(),ez=Cz(),uZ=Vz(),DZ=Tz();BZ.IngestSourceOutSerializer={_fromJsonObject(u){let D=u.type;function B(A){switch(A){case"generic-webhook":return{};case"cron":return mz.CronConfigSerializer._fromJsonObject(u.config);case"adobe-sign":return Iz.AdobeSignConfigOutSerializer._fromJsonObject(u.config);case"beehiiv":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"brex":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"checkbook":return _z.CheckbookConfigOutSerializer._fromJsonObject(u.config);case"clerk":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"docusign":return gz.DocusignConfigOutSerializer._fromJsonObject(u.config);case"easypost":return fz.EasypostConfigOutSerializer._fromJsonObject(u.config);case"github":return bz.GithubConfigOutSerializer._fromJsonObject(u.config);case"guesty":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"hubspot":return jz.HubspotConfigOutSerializer._fromJsonObject(u.config);case"incident-io":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"lithic":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"meta":return lz.MetaConfigOutSerializer._fromJsonObject(u.config);case"nash":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"orum-io":return dz.OrumIoConfigOutSerializer._fromJsonObject(u.config);case"panda-doc":return iz.PandaDocConfigOutSerializer._fromJsonObject(u.config);case"port-io":return rz.PortIoConfigOutSerializer._fromJsonObject(u.config);case"psi-fi":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"pleo":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"replicate":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"resend":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"rutter":return nz.RutterConfigOutSerializer._fromJsonObject(u.config);case"safebase":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"sardine":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"segment":return pz.SegmentConfigOutSerializer._fromJsonObject(u.config);case"shopify":return az.ShopifyConfigOutSerializer._fromJsonObject(u.config);case"slack":return sz.SlackConfigOutSerializer._fromJsonObject(u.config);case"stripe":return tz.StripeConfigOutSerializer._fromJsonObject(u.config);case"stych":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"svix":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"zoom":return DZ.ZoomConfigOutSerializer._fromJsonObject(u.config);case"telnyx":return oz.TelnyxConfigOutSerializer._fromJsonObject(u.config);case"vapi":return ez.VapiConfigOutSerializer._fromJsonObject(u.config);case"open-ai":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"render":return c.SvixConfigOutSerializer._fromJsonObject(u.config);case"veriff":return uZ.VeriffConfigOutSerializer._fromJsonObject(u.config);case"airwallex":return qz.AirwallexConfigOutSerializer._fromJsonObject(u.config);default:throw Error(`Unexpected type: ${A}`)}}return{type:D,config:B(D),createdAt:new Date(u.createdAt),id:u.id,ingestUrl:u.ingestUrl,metadata:u.metadata,name:u.name,uid:u.uid,updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){let D;switch(u.type){case"generic-webhook":D={};break;case"cron":D=mz.CronConfigSerializer._toJsonObject(u.config);break;case"adobe-sign":D=Iz.AdobeSignConfigOutSerializer._toJsonObject(u.config);break;case"beehiiv":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"brex":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"checkbook":D=_z.CheckbookConfigOutSerializer._toJsonObject(u.config);break;case"clerk":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"docusign":D=gz.DocusignConfigOutSerializer._toJsonObject(u.config);break;case"easypost":D=fz.EasypostConfigOutSerializer._toJsonObject(u.config);break;case"github":D=bz.GithubConfigOutSerializer._toJsonObject(u.config);break;case"guesty":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"hubspot":D=jz.HubspotConfigOutSerializer._toJsonObject(u.config);break;case"incident-io":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"lithic":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"meta":D=lz.MetaConfigOutSerializer._toJsonObject(u.config);break;case"nash":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"orum-io":D=dz.OrumIoConfigOutSerializer._toJsonObject(u.config);break;case"panda-doc":D=iz.PandaDocConfigOutSerializer._toJsonObject(u.config);break;case"port-io":D=rz.PortIoConfigOutSerializer._toJsonObject(u.config);break;case"psi-fi":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"pleo":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"replicate":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"resend":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"rutter":D=nz.RutterConfigOutSerializer._toJsonObject(u.config);break;case"safebase":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"sardine":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"segment":D=pz.SegmentConfigOutSerializer._toJsonObject(u.config);break;case"shopify":D=az.ShopifyConfigOutSerializer._toJsonObject(u.config);break;case"slack":D=sz.SlackConfigOutSerializer._toJsonObject(u.config);break;case"stripe":D=tz.StripeConfigOutSerializer._toJsonObject(u.config);break;case"stych":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"svix":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"zoom":D=DZ.ZoomConfigOutSerializer._toJsonObject(u.config);break;case"telnyx":D=oz.TelnyxConfigOutSerializer._toJsonObject(u.config);break;case"vapi":D=ez.VapiConfigOutSerializer._toJsonObject(u.config);break;case"open-ai":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"render":D=c.SvixConfigOutSerializer._toJsonObject(u.config);break;case"veriff":D=uZ.VeriffConfigOutSerializer._toJsonObject(u.config);break;case"airwallex":D=qz.AirwallexConfigOutSerializer._toJsonObject(u.config);break}return{type:u.type,config:D,createdAt:u.createdAt,id:u.id,ingestUrl:u.ingestUrl,metadata:u.metadata,name:u.name,uid:u.uid,updatedAt:u.updatedAt}}}});var NZ=z((wZ)=>{Object.defineProperty(wZ,"__esModule",{value:!0});wZ.ListResponseIngestSourceOutSerializer=void 0;var FZ=H8();wZ.ListResponseIngestSourceOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>FZ.IngestSourceOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>FZ.IngestSourceOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var ZZ=z(($Z)=>{Object.defineProperty($Z,"__esModule",{value:!0});$Z.RotateTokenOutSerializer=void 0;$Z.RotateTokenOutSerializer={_fromJsonObject(u){return{ingestUrl:u.ingestUrl}},_toJsonObject(u){return{ingestUrl:u.ingestUrl}}}});var WZ=z((YZ)=>{Object.defineProperty(YZ,"__esModule",{value:!0});YZ.IngestSource=void 0;var JZ=L$(),S8=H8(),AS=NZ(),FS=ZZ(),O2=m();class QZ{constructor(u){this.requestCtx=u}list(u){let D=new O2.SvixRequest(O2.HttpMethod.GET,"/ingest/api/v1/source");return D.setQueryParams({limit:u===null||u===void 0?void 0:u.limit,iterator:u===null||u===void 0?void 0:u.iterator,order:u===null||u===void 0?void 0:u.order}),D.send(this.requestCtx,AS.ListResponseIngestSourceOutSerializer._fromJsonObject)}create(u,D){let B=new O2.SvixRequest(O2.HttpMethod.POST,"/ingest/api/v1/source");return B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.setBody(JZ.IngestSourceInSerializer._toJsonObject(u)),B.send(this.requestCtx,S8.IngestSourceOutSerializer._fromJsonObject)}get(u){let D=new O2.SvixRequest(O2.HttpMethod.GET,"/ingest/api/v1/source/{source_id}");return D.setPathParam("source_id",u),D.send(this.requestCtx,S8.IngestSourceOutSerializer._fromJsonObject)}update(u,D){let B=new O2.SvixRequest(O2.HttpMethod.PUT,"/ingest/api/v1/source/{source_id}");return B.setPathParam("source_id",u),B.setBody(JZ.IngestSourceInSerializer._toJsonObject(D)),B.send(this.requestCtx,S8.IngestSourceOutSerializer._fromJsonObject)}delete(u){let D=new O2.SvixRequest(O2.HttpMethod.DELETE,"/ingest/api/v1/source/{source_id}");return D.setPathParam("source_id",u),D.sendNoResponseBody(this.requestCtx)}rotateToken(u,D){let B=new O2.SvixRequest(O2.HttpMethod.POST,"/ingest/api/v1/source/{source_id}/token/rotate");return B.setPathParam("source_id",u),B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.send(this.requestCtx,FS.RotateTokenOutSerializer._fromJsonObject)}}YZ.IngestSource=QZ});var HZ=z((hZ)=>{Object.defineProperty(hZ,"__esModule",{value:!0});hZ.Ingest=void 0;var wS=z8(),GS=ZG(),NS=dG(),$S=WZ(),vZ=m();class KZ{constructor(u){this.requestCtx=u}get endpoint(){return new NS.IngestEndpoint(this.requestCtx)}get source(){return new $S.IngestSource(this.requestCtx)}dashboard(u,D,B){let A=new vZ.SvixRequest(vZ.HttpMethod.POST,"/ingest/api/v1/source/{source_id}/dashboard");return A.setPathParam("source_id",u),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(GS.IngestSourceConsumerPortalAccessInSerializer._toJsonObject(D)),A.send(this.requestCtx,wS.DashboardAccessOutSerializer._fromJsonObject)}}hZ.Ingest=KZ});var UZ=z((SZ)=>{Object.defineProperty(SZ,"__esModule",{value:!0});SZ.IntegrationInSerializer=void 0;SZ.IntegrationInSerializer={_fromJsonObject(u){return{featureFlags:u.featureFlags,name:u.name}},_toJsonObject(u){return{featureFlags:u.featureFlags,name:u.name}}}});var EZ=z((MZ)=>{Object.defineProperty(MZ,"__esModule",{value:!0});MZ.IntegrationKeyOutSerializer=void 0;MZ.IntegrationKeyOutSerializer={_fromJsonObject(u){return{key:u.key}},_toJsonObject(u){return{key:u.key}}}});var R8=z((OZ)=>{Object.defineProperty(OZ,"__esModule",{value:!0});OZ.IntegrationOutSerializer=void 0;OZ.IntegrationOutSerializer={_fromJsonObject(u){return{createdAt:new Date(u.createdAt),featureFlags:u.featureFlags,id:u.id,name:u.name,updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){return{createdAt:u.createdAt,featureFlags:u.featureFlags,id:u.id,name:u.name,updatedAt:u.updatedAt}}}});var VZ=z((PZ)=>{Object.defineProperty(PZ,"__esModule",{value:!0});PZ.IntegrationUpdateSerializer=void 0;PZ.IntegrationUpdateSerializer={_fromJsonObject(u){return{featureFlags:u.featureFlags,name:u.name}},_toJsonObject(u){return{featureFlags:u.featureFlags,name:u.name}}}});var IZ=z((yZ)=>{Object.defineProperty(yZ,"__esModule",{value:!0});yZ.ListResponseIntegrationOutSerializer=void 0;var kZ=R8();yZ.ListResponseIntegrationOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>kZ.IntegrationOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>kZ.IntegrationOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var fZ=z((mZ)=>{Object.defineProperty(mZ,"__esModule",{value:!0});mZ.Integration=void 0;var zS=UZ(),qZ=EZ(),U8=R8(),ZS=VZ(),JS=IZ(),X2=m();class _Z{constructor(u){this.requestCtx=u}list(u,D){let B=new X2.SvixRequest(X2.HttpMethod.GET,"/api/v1/app/{app_id}/integration");return B.setPathParam("app_id",u),B.setQueryParams({limit:D===null||D===void 0?void 0:D.limit,iterator:D===null||D===void 0?void 0:D.iterator,order:D===null||D===void 0?void 0:D.order}),B.send(this.requestCtx,JS.ListResponseIntegrationOutSerializer._fromJsonObject)}create(u,D,B){let A=new X2.SvixRequest(X2.HttpMethod.POST,"/api/v1/app/{app_id}/integration");return A.setPathParam("app_id",u),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(zS.IntegrationInSerializer._toJsonObject(D)),A.send(this.requestCtx,U8.IntegrationOutSerializer._fromJsonObject)}get(u,D){let B=new X2.SvixRequest(X2.HttpMethod.GET,"/api/v1/app/{app_id}/integration/{integ_id}");return B.setPathParam("app_id",u),B.setPathParam("integ_id",D),B.send(this.requestCtx,U8.IntegrationOutSerializer._fromJsonObject)}update(u,D,B){let A=new X2.SvixRequest(X2.HttpMethod.PUT,"/api/v1/app/{app_id}/integration/{integ_id}");return A.setPathParam("app_id",u),A.setPathParam("integ_id",D),A.setBody(ZS.IntegrationUpdateSerializer._toJsonObject(B)),A.send(this.requestCtx,U8.IntegrationOutSerializer._fromJsonObject)}delete(u,D){let B=new X2.SvixRequest(X2.HttpMethod.DELETE,"/api/v1/app/{app_id}/integration/{integ_id}");return B.setPathParam("app_id",u),B.setPathParam("integ_id",D),B.sendNoResponseBody(this.requestCtx)}getKey(u,D){let B=new X2.SvixRequest(X2.HttpMethod.GET,"/api/v1/app/{app_id}/integration/{integ_id}/key");return B.setPathParam("app_id",u),B.setPathParam("integ_id",D),B.send(this.requestCtx,qZ.IntegrationKeyOutSerializer._fromJsonObject)}rotateKey(u,D,B){let A=new X2.SvixRequest(X2.HttpMethod.POST,"/api/v1/app/{app_id}/integration/{integ_id}/key/rotate");return A.setPathParam("app_id",u),A.setPathParam("integ_id",D),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.send(this.requestCtx,qZ.IntegrationKeyOutSerializer._fromJsonObject)}}mZ.Integration=_Z});var iZ=z((lZ)=>{Object.defineProperty(lZ,"__esModule",{value:!0});lZ.ExpungeAllContentsOutSerializer=void 0;var bZ=e2(),jZ=u0();lZ.ExpungeAllContentsOutSerializer={_fromJsonObject(u){return{id:u.id,status:bZ.BackgroundTaskStatusSerializer._fromJsonObject(u.status),task:jZ.BackgroundTaskTypeSerializer._fromJsonObject(u.task),updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){return{id:u.id,status:bZ.BackgroundTaskStatusSerializer._toJsonObject(u.status),task:jZ.BackgroundTaskTypeSerializer._toJsonObject(u.task),updatedAt:u.updatedAt}}}});var aZ=z((nZ)=>{Object.defineProperty(nZ,"__esModule",{value:!0});nZ.ListResponseMessageOutSerializer=void 0;var rZ=Cu();nZ.ListResponseMessageOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>rZ.MessageOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>rZ.MessageOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var oZ=z((sZ)=>{Object.defineProperty(sZ,"__esModule",{value:!0});sZ.MessagePrecheckInSerializer=void 0;sZ.MessagePrecheckInSerializer={_fromJsonObject(u){return{channels:u.channels,eventType:u.eventType}},_toJsonObject(u){return{channels:u.channels,eventType:u.eventType}}}});var DJ=z((eZ)=>{Object.defineProperty(eZ,"__esModule",{value:!0});eZ.MessagePrecheckOutSerializer=void 0;eZ.MessagePrecheckOutSerializer={_fromJsonObject(u){return{active:u.active}},_toJsonObject(u){return{active:u.active}}}});var FJ=z((BJ)=>{Object.defineProperty(BJ,"__esModule",{value:!0});BJ.PollingEndpointConsumerSeekInSerializer=void 0;BJ.PollingEndpointConsumerSeekInSerializer={_fromJsonObject(u){return{after:new Date(u.after)}},_toJsonObject(u){return{after:u.after}}}});var NJ=z((wJ)=>{Object.defineProperty(wJ,"__esModule",{value:!0});wJ.PollingEndpointConsumerSeekOutSerializer=void 0;wJ.PollingEndpointConsumerSeekOutSerializer={_fromJsonObject(u){return{iterator:u.iterator}},_toJsonObject(u){return{iterator:u.iterator}}}});var ZJ=z(($J)=>{Object.defineProperty($J,"__esModule",{value:!0});$J.PollingEndpointMessageOutSerializer=void 0;$J.PollingEndpointMessageOutSerializer={_fromJsonObject(u){return{channels:u.channels,deliverAt:u.deliverAt?new Date(u.deliverAt):null,eventId:u.eventId,eventType:u.eventType,headers:u.headers,id:u.id,payload:u.payload,tags:u.tags,timestamp:new Date(u.timestamp)}},_toJsonObject(u){return{channels:u.channels,deliverAt:u.deliverAt,eventId:u.eventId,eventType:u.eventType,headers:u.headers,id:u.id,payload:u.payload,tags:u.tags,timestamp:u.timestamp}}}});var XJ=z((QJ)=>{Object.defineProperty(QJ,"__esModule",{value:!0});QJ.PollingEndpointOutSerializer=void 0;var JJ=ZJ();QJ.PollingEndpointOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>JJ.PollingEndpointMessageOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator}},_toJsonObject(u){return{data:u.data.map((D)=>JJ.PollingEndpointMessageOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator}}}});var xJ=z((KJ)=>{Object.defineProperty(KJ,"__esModule",{value:!0});KJ.MessagePoller=void 0;var QS=FJ(),YS=NJ(),WJ=XJ(),m0=m();class vJ{constructor(u){this.requestCtx=u}poll(u,D,B){let A=new m0.SvixRequest(m0.HttpMethod.GET,"/api/v1/app/{app_id}/poller/{sink_id}");return A.setPathParam("app_id",u),A.setPathParam("sink_id",D),A.setQueryParams({limit:B===null||B===void 0?void 0:B.limit,iterator:B===null||B===void 0?void 0:B.iterator,event_type:B===null||B===void 0?void 0:B.eventType,channel:B===null||B===void 0?void 0:B.channel,after:B===null||B===void 0?void 0:B.after}),A.send(this.requestCtx,WJ.PollingEndpointOutSerializer._fromJsonObject)}consumerPoll(u,D,B,A){let F=new m0.SvixRequest(m0.HttpMethod.GET,"/api/v1/app/{app_id}/poller/{sink_id}/consumer/{consumer_id}");return F.setPathParam("app_id",u),F.setPathParam("sink_id",D),F.setPathParam("consumer_id",B),F.setQueryParams({limit:A===null||A===void 0?void 0:A.limit,iterator:A===null||A===void 0?void 0:A.iterator}),F.send(this.requestCtx,WJ.PollingEndpointOutSerializer._fromJsonObject)}consumerSeek(u,D,B,A,F){let w=new m0.SvixRequest(m0.HttpMethod.POST,"/api/v1/app/{app_id}/poller/{sink_id}/consumer/{consumer_id}/seek");return w.setPathParam("app_id",u),w.setPathParam("sink_id",D),w.setPathParam("consumer_id",B),w.setHeaderParam("idempotency-key",F===null||F===void 0?void 0:F.idempotencyKey),w.setBody(QS.PollingEndpointConsumerSeekInSerializer._toJsonObject(A)),w.send(this.requestCtx,YS.PollingEndpointConsumerSeekOutSerializer._fromJsonObject)}}KJ.MessagePoller=vJ});var UJ=z((SJ)=>{Object.defineProperty(SJ,"__esModule",{value:!0});SJ.MessageInSerializer=void 0;var HJ=u3();SJ.MessageInSerializer={_fromJsonObject(u){return{application:u.application!=null?HJ.ApplicationInSerializer._fromJsonObject(u.application):void 0,channels:u.channels,deliverAt:u.deliverAt?new Date(u.deliverAt):null,eventId:u.eventId,eventType:u.eventType,payload:u.payload,payloadRetentionHours:u.payloadRetentionHours,payloadRetentionPeriod:u.payloadRetentionPeriod,tags:u.tags,transformationsParams:u.transformationsParams}},_toJsonObject(u){return{application:u.application!=null?HJ.ApplicationInSerializer._toJsonObject(u.application):void 0,channels:u.channels,deliverAt:u.deliverAt,eventId:u.eventId,eventType:u.eventType,payload:u.payload,payloadRetentionHours:u.payloadRetentionHours,payloadRetentionPeriod:u.payloadRetentionPeriod,tags:u.tags,transformationsParams:u.transformationsParams}}}});var M8=z((EJ)=>{Object.defineProperty(EJ,"__esModule",{value:!0});EJ.messageInRaw=EJ.Message=void 0;var XS=iZ(),WS=aZ(),MJ=Cu(),vS=oZ(),KS=DJ(),hS=xJ(),C2=m(),xS=UJ();class LJ{constructor(u){this.requestCtx=u}get poller(){return new hS.MessagePoller(this.requestCtx)}list(u,D){let B=new C2.SvixRequest(C2.HttpMethod.GET,"/api/v1/app/{app_id}/msg");return B.setPathParam("app_id",u),B.setQueryParams({limit:D===null||D===void 0?void 0:D.limit,iterator:D===null||D===void 0?void 0:D.iterator,channel:D===null||D===void 0?void 0:D.channel,before:D===null||D===void 0?void 0:D.before,after:D===null||D===void 0?void 0:D.after,with_content:D===null||D===void 0?void 0:D.withContent,tag:D===null||D===void 0?void 0:D.tag,event_types:D===null||D===void 0?void 0:D.eventTypes}),B.send(this.requestCtx,WS.ListResponseMessageOutSerializer._fromJsonObject)}create(u,D,B){let A=new C2.SvixRequest(C2.HttpMethod.POST,"/api/v1/app/{app_id}/msg");return A.setPathParam("app_id",u),A.setQueryParams({with_content:B===null||B===void 0?void 0:B.withContent}),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(xS.MessageInSerializer._toJsonObject(D)),A.send(this.requestCtx,MJ.MessageOutSerializer._fromJsonObject)}expungeAllContents(u,D){let B=new C2.SvixRequest(C2.HttpMethod.POST,"/api/v1/app/{app_id}/msg/expunge-all-contents");return B.setPathParam("app_id",u),B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.send(this.requestCtx,XS.ExpungeAllContentsOutSerializer._fromJsonObject)}precheck(u,D,B){let A=new C2.SvixRequest(C2.HttpMethod.POST,"/api/v1/app/{app_id}/msg/precheck/active");return A.setPathParam("app_id",u),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(vS.MessagePrecheckInSerializer._toJsonObject(D)),A.send(this.requestCtx,KS.MessagePrecheckOutSerializer._fromJsonObject)}get(u,D,B){let A=new C2.SvixRequest(C2.HttpMethod.GET,"/api/v1/app/{app_id}/msg/{msg_id}");return A.setPathParam("app_id",u),A.setPathParam("msg_id",D),A.setQueryParams({with_content:B===null||B===void 0?void 0:B.withContent}),A.send(this.requestCtx,MJ.MessageOutSerializer._fromJsonObject)}expungeContent(u,D){let B=new C2.SvixRequest(C2.HttpMethod.DELETE,"/api/v1/app/{app_id}/msg/{msg_id}/content");return B.setPathParam("app_id",u),B.setPathParam("msg_id",D),B.sendNoResponseBody(this.requestCtx)}}EJ.Message=LJ;function HS(u,D,B){return{eventType:u,payload:{},transformationsParams:{rawPayload:D,headers:B?{"content-type":B}:void 0}}}EJ.messageInRaw=HS});var L8=z((CJ)=>{Object.defineProperty(CJ,"__esModule",{value:!0});CJ.EmptyResponseSerializer=void 0;CJ.EmptyResponseSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var Pu=z((VJ)=>{Object.defineProperty(VJ,"__esModule",{value:!0});VJ.MessageStatusTextSerializer=VJ.MessageStatusText=void 0;var RS;(function(u){u.Success="success",u.Pending="pending",u.Fail="fail",u.Sending="sending"})(RS=VJ.MessageStatusText||(VJ.MessageStatusText={}));VJ.MessageStatusTextSerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var _J=z((IJ)=>{Object.defineProperty(IJ,"__esModule",{value:!0});IJ.EndpointMessageOutSerializer=void 0;var yJ=_0(),TJ=Pu();IJ.EndpointMessageOutSerializer={_fromJsonObject(u){return{channels:u.channels,deliverAt:u.deliverAt?new Date(u.deliverAt):null,eventId:u.eventId,eventType:u.eventType,id:u.id,nextAttempt:u.nextAttempt?new Date(u.nextAttempt):null,payload:u.payload,status:yJ.MessageStatusSerializer._fromJsonObject(u.status),statusText:TJ.MessageStatusTextSerializer._fromJsonObject(u.statusText),tags:u.tags,timestamp:new Date(u.timestamp)}},_toJsonObject(u){return{channels:u.channels,deliverAt:u.deliverAt,eventId:u.eventId,eventType:u.eventType,id:u.id,nextAttempt:u.nextAttempt,payload:u.payload,status:yJ.MessageStatusSerializer._toJsonObject(u.status),statusText:TJ.MessageStatusTextSerializer._toJsonObject(u.statusText),tags:u.tags,timestamp:u.timestamp}}}});var bJ=z((gJ)=>{Object.defineProperty(gJ,"__esModule",{value:!0});gJ.ListResponseEndpointMessageOutSerializer=void 0;var mJ=_J();gJ.ListResponseEndpointMessageOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>mJ.EndpointMessageOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>mJ.EndpointMessageOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var E8=z((lJ)=>{Object.defineProperty(lJ,"__esModule",{value:!0});lJ.MessageAttemptTriggerTypeSerializer=lJ.MessageAttemptTriggerType=void 0;var US;(function(u){u[u.Scheduled=0]="Scheduled",u[u.Manual=1]="Manual"})(US=lJ.MessageAttemptTriggerType||(lJ.MessageAttemptTriggerType={}));lJ.MessageAttemptTriggerTypeSerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var O8=z((aJ)=>{Object.defineProperty(aJ,"__esModule",{value:!0});aJ.MessageAttemptOutSerializer=void 0;var iJ=E8(),rJ=Cu(),nJ=_0(),pJ=Pu();aJ.MessageAttemptOutSerializer={_fromJsonObject(u){return{endpointId:u.endpointId,id:u.id,msg:u.msg!=null?rJ.MessageOutSerializer._fromJsonObject(u.msg):void 0,msgId:u.msgId,response:u.response,responseDurationMs:u.responseDurationMs,responseStatusCode:u.responseStatusCode,status:nJ.MessageStatusSerializer._fromJsonObject(u.status),statusText:pJ.MessageStatusTextSerializer._fromJsonObject(u.statusText),timestamp:new Date(u.timestamp),triggerType:iJ.MessageAttemptTriggerTypeSerializer._fromJsonObject(u.triggerType),url:u.url}},_toJsonObject(u){return{endpointId:u.endpointId,id:u.id,msg:u.msg!=null?rJ.MessageOutSerializer._toJsonObject(u.msg):void 0,msgId:u.msgId,response:u.response,responseDurationMs:u.responseDurationMs,responseStatusCode:u.responseStatusCode,status:nJ.MessageStatusSerializer._toJsonObject(u.status),statusText:pJ.MessageStatusTextSerializer._toJsonObject(u.statusText),timestamp:u.timestamp,triggerType:iJ.MessageAttemptTriggerTypeSerializer._toJsonObject(u.triggerType),url:u.url}}}});var uQ=z((oJ)=>{Object.defineProperty(oJ,"__esModule",{value:!0});oJ.ListResponseMessageAttemptOutSerializer=void 0;var tJ=O8();oJ.ListResponseMessageAttemptOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>tJ.MessageAttemptOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>tJ.MessageAttemptOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var wQ=z((AQ)=>{Object.defineProperty(AQ,"__esModule",{value:!0});AQ.MessageEndpointOutSerializer=void 0;var DQ=_0(),BQ=Pu();AQ.MessageEndpointOutSerializer={_fromJsonObject(u){return{channels:u.channels,createdAt:new Date(u.createdAt),description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,id:u.id,nextAttempt:u.nextAttempt?new Date(u.nextAttempt):null,rateLimit:u.rateLimit,status:DQ.MessageStatusSerializer._fromJsonObject(u.status),statusText:BQ.MessageStatusTextSerializer._fromJsonObject(u.statusText),throttleRate:u.throttleRate,uid:u.uid,updatedAt:new Date(u.updatedAt),url:u.url,version:u.version}},_toJsonObject(u){return{channels:u.channels,createdAt:u.createdAt,description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,id:u.id,nextAttempt:u.nextAttempt,rateLimit:u.rateLimit,status:DQ.MessageStatusSerializer._toJsonObject(u.status),statusText:BQ.MessageStatusTextSerializer._toJsonObject(u.statusText),throttleRate:u.throttleRate,uid:u.uid,updatedAt:u.updatedAt,url:u.url,version:u.version}}}});var zQ=z((NQ)=>{Object.defineProperty(NQ,"__esModule",{value:!0});NQ.ListResponseMessageEndpointOutSerializer=void 0;var GQ=wQ();NQ.ListResponseMessageEndpointOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>GQ.MessageEndpointOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>GQ.MessageEndpointOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var XQ=z((QQ)=>{Object.defineProperty(QQ,"__esModule",{value:!0});QQ.MessageAttempt=void 0;var MS=L8(),LS=bJ(),ZQ=uQ(),ES=zQ(),OS=O8(),W2=m();class JQ{constructor(u){this.requestCtx=u}listByEndpoint(u,D,B){let A=new W2.SvixRequest(W2.HttpMethod.GET,"/api/v1/app/{app_id}/attempt/endpoint/{endpoint_id}");return A.setPathParam("app_id",u),A.setPathParam("endpoint_id",D),A.setQueryParams({limit:B===null||B===void 0?void 0:B.limit,iterator:B===null||B===void 0?void 0:B.iterator,status:B===null||B===void 0?void 0:B.status,status_code_class:B===null||B===void 0?void 0:B.statusCodeClass,channel:B===null||B===void 0?void 0:B.channel,tag:B===null||B===void 0?void 0:B.tag,before:B===null||B===void 0?void 0:B.before,after:B===null||B===void 0?void 0:B.after,with_content:B===null||B===void 0?void 0:B.withContent,with_msg:B===null||B===void 0?void 0:B.withMsg,event_types:B===null||B===void 0?void 0:B.eventTypes}),A.send(this.requestCtx,ZQ.ListResponseMessageAttemptOutSerializer._fromJsonObject)}listByMsg(u,D,B){let A=new W2.SvixRequest(W2.HttpMethod.GET,"/api/v1/app/{app_id}/attempt/msg/{msg_id}");return A.setPathParam("app_id",u),A.setPathParam("msg_id",D),A.setQueryParams({limit:B===null||B===void 0?void 0:B.limit,iterator:B===null||B===void 0?void 0:B.iterator,status:B===null||B===void 0?void 0:B.status,status_code_class:B===null||B===void 0?void 0:B.statusCodeClass,channel:B===null||B===void 0?void 0:B.channel,tag:B===null||B===void 0?void 0:B.tag,endpoint_id:B===null||B===void 0?void 0:B.endpointId,before:B===null||B===void 0?void 0:B.before,after:B===null||B===void 0?void 0:B.after,with_content:B===null||B===void 0?void 0:B.withContent,event_types:B===null||B===void 0?void 0:B.eventTypes}),A.send(this.requestCtx,ZQ.ListResponseMessageAttemptOutSerializer._fromJsonObject)}listAttemptedMessages(u,D,B){let A=new W2.SvixRequest(W2.HttpMethod.GET,"/api/v1/app/{app_id}/endpoint/{endpoint_id}/msg");return A.setPathParam("app_id",u),A.setPathParam("endpoint_id",D),A.setQueryParams({limit:B===null||B===void 0?void 0:B.limit,iterator:B===null||B===void 0?void 0:B.iterator,channel:B===null||B===void 0?void 0:B.channel,tag:B===null||B===void 0?void 0:B.tag,status:B===null||B===void 0?void 0:B.status,before:B===null||B===void 0?void 0:B.before,after:B===null||B===void 0?void 0:B.after,with_content:B===null||B===void 0?void 0:B.withContent,event_types:B===null||B===void 0?void 0:B.eventTypes}),A.send(this.requestCtx,LS.ListResponseEndpointMessageOutSerializer._fromJsonObject)}get(u,D,B){let A=new W2.SvixRequest(W2.HttpMethod.GET,"/api/v1/app/{app_id}/msg/{msg_id}/attempt/{attempt_id}");return A.setPathParam("app_id",u),A.setPathParam("msg_id",D),A.setPathParam("attempt_id",B),A.send(this.requestCtx,OS.MessageAttemptOutSerializer._fromJsonObject)}expungeContent(u,D,B){let A=new W2.SvixRequest(W2.HttpMethod.DELETE,"/api/v1/app/{app_id}/msg/{msg_id}/attempt/{attempt_id}/content");return A.setPathParam("app_id",u),A.setPathParam("msg_id",D),A.setPathParam("attempt_id",B),A.sendNoResponseBody(this.requestCtx)}listAttemptedDestinations(u,D,B){let A=new W2.SvixRequest(W2.HttpMethod.GET,"/api/v1/app/{app_id}/msg/{msg_id}/endpoint");return A.setPathParam("app_id",u),A.setPathParam("msg_id",D),A.setQueryParams({limit:B===null||B===void 0?void 0:B.limit,iterator:B===null||B===void 0?void 0:B.iterator}),A.send(this.requestCtx,ES.ListResponseMessageEndpointOutSerializer._fromJsonObject)}resend(u,D,B,A){let F=new W2.SvixRequest(W2.HttpMethod.POST,"/api/v1/app/{app_id}/msg/{msg_id}/endpoint/{endpoint_id}/resend");return F.setPathParam("app_id",u),F.setPathParam("msg_id",D),F.setPathParam("endpoint_id",B),F.setHeaderParam("idempotency-key",A===null||A===void 0?void 0:A.idempotencyKey),F.send(this.requestCtx,MS.EmptyResponseSerializer._fromJsonObject)}}QQ.MessageAttempt=JQ});var C8=z((WQ)=>{Object.defineProperty(WQ,"__esModule",{value:!0});WQ.OperationalWebhookEndpointOutSerializer=void 0;WQ.OperationalWebhookEndpointOutSerializer={_fromJsonObject(u){return{createdAt:new Date(u.createdAt),description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,id:u.id,metadata:u.metadata,rateLimit:u.rateLimit,uid:u.uid,updatedAt:new Date(u.updatedAt),url:u.url}},_toJsonObject(u){return{createdAt:u.createdAt,description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,id:u.id,metadata:u.metadata,rateLimit:u.rateLimit,uid:u.uid,updatedAt:u.updatedAt,url:u.url}}}});var HQ=z((hQ)=>{Object.defineProperty(hQ,"__esModule",{value:!0});hQ.ListResponseOperationalWebhookEndpointOutSerializer=void 0;var KQ=C8();hQ.ListResponseOperationalWebhookEndpointOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>KQ.OperationalWebhookEndpointOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>KQ.OperationalWebhookEndpointOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var UQ=z((SQ)=>{Object.defineProperty(SQ,"__esModule",{value:!0});SQ.OperationalWebhookEndpointHeadersInSerializer=void 0;SQ.OperationalWebhookEndpointHeadersInSerializer={_fromJsonObject(u){return{headers:u.headers}},_toJsonObject(u){return{headers:u.headers}}}});var EQ=z((MQ)=>{Object.defineProperty(MQ,"__esModule",{value:!0});MQ.OperationalWebhookEndpointHeadersOutSerializer=void 0;MQ.OperationalWebhookEndpointHeadersOutSerializer={_fromJsonObject(u){return{headers:u.headers,sensitive:u.sensitive}},_toJsonObject(u){return{headers:u.headers,sensitive:u.sensitive}}}});var PQ=z((OQ)=>{Object.defineProperty(OQ,"__esModule",{value:!0});OQ.OperationalWebhookEndpointInSerializer=void 0;OQ.OperationalWebhookEndpointInSerializer={_fromJsonObject(u){return{description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,metadata:u.metadata,rateLimit:u.rateLimit,secret:u.secret,uid:u.uid,url:u.url}},_toJsonObject(u){return{description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,metadata:u.metadata,rateLimit:u.rateLimit,secret:u.secret,uid:u.uid,url:u.url}}}});var kQ=z((cQ)=>{Object.defineProperty(cQ,"__esModule",{value:!0});cQ.OperationalWebhookEndpointSecretInSerializer=void 0;cQ.OperationalWebhookEndpointSecretInSerializer={_fromJsonObject(u){return{key:u.key}},_toJsonObject(u){return{key:u.key}}}});var IQ=z((yQ)=>{Object.defineProperty(yQ,"__esModule",{value:!0});yQ.OperationalWebhookEndpointSecretOutSerializer=void 0;yQ.OperationalWebhookEndpointSecretOutSerializer={_fromJsonObject(u){return{key:u.key}},_toJsonObject(u){return{key:u.key}}}});var mQ=z((qQ)=>{Object.defineProperty(qQ,"__esModule",{value:!0});qQ.OperationalWebhookEndpointUpdateSerializer=void 0;qQ.OperationalWebhookEndpointUpdateSerializer={_fromJsonObject(u){return{description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,metadata:u.metadata,rateLimit:u.rateLimit,uid:u.uid,url:u.url}},_toJsonObject(u){return{description:u.description,disabled:u.disabled,filterTypes:u.filterTypes,metadata:u.metadata,rateLimit:u.rateLimit,uid:u.uid,url:u.url}}}});var c8=z((fQ)=>{Object.defineProperty(fQ,"__esModule",{value:!0});fQ.OperationalWebhookEndpoint=void 0;var CS=HQ(),PS=UQ(),cS=EQ(),VS=PQ(),P8=C8(),kS=kQ(),yS=IQ(),TS=mQ(),D2=m();class gQ{constructor(u){this.requestCtx=u}list(u){let D=new D2.SvixRequest(D2.HttpMethod.GET,"/api/v1/operational-webhook/endpoint");return D.setQueryParams({limit:u===null||u===void 0?void 0:u.limit,iterator:u===null||u===void 0?void 0:u.iterator,order:u===null||u===void 0?void 0:u.order}),D.send(this.requestCtx,CS.ListResponseOperationalWebhookEndpointOutSerializer._fromJsonObject)}create(u,D){let B=new D2.SvixRequest(D2.HttpMethod.POST,"/api/v1/operational-webhook/endpoint");return B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.setBody(VS.OperationalWebhookEndpointInSerializer._toJsonObject(u)),B.send(this.requestCtx,P8.OperationalWebhookEndpointOutSerializer._fromJsonObject)}get(u){let D=new D2.SvixRequest(D2.HttpMethod.GET,"/api/v1/operational-webhook/endpoint/{endpoint_id}");return D.setPathParam("endpoint_id",u),D.send(this.requestCtx,P8.OperationalWebhookEndpointOutSerializer._fromJsonObject)}update(u,D){let B=new D2.SvixRequest(D2.HttpMethod.PUT,"/api/v1/operational-webhook/endpoint/{endpoint_id}");return B.setPathParam("endpoint_id",u),B.setBody(TS.OperationalWebhookEndpointUpdateSerializer._toJsonObject(D)),B.send(this.requestCtx,P8.OperationalWebhookEndpointOutSerializer._fromJsonObject)}delete(u){let D=new D2.SvixRequest(D2.HttpMethod.DELETE,"/api/v1/operational-webhook/endpoint/{endpoint_id}");return D.setPathParam("endpoint_id",u),D.sendNoResponseBody(this.requestCtx)}getHeaders(u){let D=new D2.SvixRequest(D2.HttpMethod.GET,"/api/v1/operational-webhook/endpoint/{endpoint_id}/headers");return D.setPathParam("endpoint_id",u),D.send(this.requestCtx,cS.OperationalWebhookEndpointHeadersOutSerializer._fromJsonObject)}updateHeaders(u,D){let B=new D2.SvixRequest(D2.HttpMethod.PUT,"/api/v1/operational-webhook/endpoint/{endpoint_id}/headers");return B.setPathParam("endpoint_id",u),B.setBody(PS.OperationalWebhookEndpointHeadersInSerializer._toJsonObject(D)),B.sendNoResponseBody(this.requestCtx)}getSecret(u){let D=new D2.SvixRequest(D2.HttpMethod.GET,"/api/v1/operational-webhook/endpoint/{endpoint_id}/secret");return D.setPathParam("endpoint_id",u),D.send(this.requestCtx,yS.OperationalWebhookEndpointSecretOutSerializer._fromJsonObject)}rotateSecret(u,D,B){let A=new D2.SvixRequest(D2.HttpMethod.POST,"/api/v1/operational-webhook/endpoint/{endpoint_id}/secret/rotate");return A.setPathParam("endpoint_id",u),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(kS.OperationalWebhookEndpointSecretInSerializer._toJsonObject(D)),A.sendNoResponseBody(this.requestCtx)}}fQ.OperationalWebhookEndpoint=gQ});var iQ=z((lQ)=>{Object.defineProperty(lQ,"__esModule",{value:!0});lQ.OperationalWebhook=void 0;var IS=c8();class jQ{constructor(u){this.requestCtx=u}get endpoint(){return new IS.OperationalWebhookEndpoint(this.requestCtx)}}lQ.OperationalWebhook=jQ});var sQ=z((pQ)=>{Object.defineProperty(pQ,"__esModule",{value:!0});pQ.AggregateEventTypesOutSerializer=void 0;var rQ=e2(),nQ=u0();pQ.AggregateEventTypesOutSerializer={_fromJsonObject(u){return{id:u.id,status:rQ.BackgroundTaskStatusSerializer._fromJsonObject(u.status),task:nQ.BackgroundTaskTypeSerializer._fromJsonObject(u.task),updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){return{id:u.id,status:rQ.BackgroundTaskStatusSerializer._toJsonObject(u.status),task:nQ.BackgroundTaskTypeSerializer._toJsonObject(u.task),updatedAt:u.updatedAt}}}});var eQ=z((tQ)=>{Object.defineProperty(tQ,"__esModule",{value:!0});tQ.AppUsageStatsInSerializer=void 0;tQ.AppUsageStatsInSerializer={_fromJsonObject(u){return{appIds:u.appIds,since:new Date(u.since),until:new Date(u.until)}},_toJsonObject(u){return{appIds:u.appIds,since:u.since,until:u.until}}}});var FY=z((BY)=>{Object.defineProperty(BY,"__esModule",{value:!0});BY.AppUsageStatsOutSerializer=void 0;var uY=e2(),DY=u0();BY.AppUsageStatsOutSerializer={_fromJsonObject(u){return{id:u.id,status:uY.BackgroundTaskStatusSerializer._fromJsonObject(u.status),task:DY.BackgroundTaskTypeSerializer._fromJsonObject(u.task),unresolvedAppIds:u.unresolvedAppIds,updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){return{id:u.id,status:uY.BackgroundTaskStatusSerializer._toJsonObject(u.status),task:DY.BackgroundTaskTypeSerializer._toJsonObject(u.task),unresolvedAppIds:u.unresolvedAppIds,updatedAt:u.updatedAt}}}});var $Y=z((GY)=>{Object.defineProperty(GY,"__esModule",{value:!0});GY.Statistics=void 0;var qS=sQ(),_S=eQ(),mS=FY(),z3=m();class wY{constructor(u){this.requestCtx=u}aggregateAppStats(u,D){let B=new z3.SvixRequest(z3.HttpMethod.POST,"/api/v1/stats/usage/app");return B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.setBody(_S.AppUsageStatsInSerializer._toJsonObject(u)),B.send(this.requestCtx,mS.AppUsageStatsOutSerializer._fromJsonObject)}aggregateEventTypes(){return new z3.SvixRequest(z3.HttpMethod.PUT,"/api/v1/stats/usage/event-types").send(this.requestCtx,qS.AggregateEventTypesOutSerializer._fromJsonObject)}}GY.Statistics=wY});var JY=z((zY)=>{Object.defineProperty(zY,"__esModule",{value:!0});zY.HttpSinkHeadersPatchInSerializer=void 0;zY.HttpSinkHeadersPatchInSerializer={_fromJsonObject(u){return{headers:u.headers}},_toJsonObject(u){return{headers:u.headers}}}});var XY=z((QY)=>{Object.defineProperty(QY,"__esModule",{value:!0});QY.SinkTransformationOutSerializer=void 0;QY.SinkTransformationOutSerializer={_fromJsonObject(u){return{code:u.code,enabled:u.enabled}},_toJsonObject(u){return{code:u.code,enabled:u.enabled}}}});var V8=z((WY)=>{Object.defineProperty(WY,"__esModule",{value:!0});WY.StreamEventTypeOutSerializer=void 0;WY.StreamEventTypeOutSerializer={_fromJsonObject(u){return{archived:u.archived,createdAt:new Date(u.createdAt),deprecated:u.deprecated,description:u.description,featureFlags:u.featureFlags,name:u.name,updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){return{archived:u.archived,createdAt:u.createdAt,deprecated:u.deprecated,description:u.description,featureFlags:u.featureFlags,name:u.name,updatedAt:u.updatedAt}}}});var HY=z((hY)=>{Object.defineProperty(hY,"__esModule",{value:!0});hY.ListResponseStreamEventTypeOutSerializer=void 0;var KY=V8();hY.ListResponseStreamEventTypeOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>KY.StreamEventTypeOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>KY.StreamEventTypeOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var UY=z((SY)=>{Object.defineProperty(SY,"__esModule",{value:!0});SY.StreamEventTypeInSerializer=void 0;SY.StreamEventTypeInSerializer={_fromJsonObject(u){return{archived:u.archived,deprecated:u.deprecated,description:u.description,featureFlags:u.featureFlags,name:u.name}},_toJsonObject(u){return{archived:u.archived,deprecated:u.deprecated,description:u.description,featureFlags:u.featureFlags,name:u.name}}}});var EY=z((MY)=>{Object.defineProperty(MY,"__esModule",{value:!0});MY.StreamEventTypePatchSerializer=void 0;MY.StreamEventTypePatchSerializer={_fromJsonObject(u){return{archived:u.archived,deprecated:u.deprecated,description:u.description,featureFlags:u.featureFlags,name:u.name}},_toJsonObject(u){return{archived:u.archived,deprecated:u.deprecated,description:u.description,featureFlags:u.featureFlags,name:u.name}}}});var VY=z((PY)=>{Object.defineProperty(PY,"__esModule",{value:!0});PY.StreamingEventType=void 0;var gS=HY(),OY=UY(),Z3=V8(),fS=EY(),P2=m();class CY{constructor(u){this.requestCtx=u}list(u){let D=new P2.SvixRequest(P2.HttpMethod.GET,"/api/v1/stream/event-type");return D.setQueryParams({limit:u===null||u===void 0?void 0:u.limit,iterator:u===null||u===void 0?void 0:u.iterator,order:u===null||u===void 0?void 0:u.order,include_archived:u===null||u===void 0?void 0:u.includeArchived}),D.send(this.requestCtx,gS.ListResponseStreamEventTypeOutSerializer._fromJsonObject)}create(u,D){let B=new P2.SvixRequest(P2.HttpMethod.POST,"/api/v1/stream/event-type");return B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.setBody(OY.StreamEventTypeInSerializer._toJsonObject(u)),B.send(this.requestCtx,Z3.StreamEventTypeOutSerializer._fromJsonObject)}get(u){let D=new P2.SvixRequest(P2.HttpMethod.GET,"/api/v1/stream/event-type/{name}");return D.setPathParam("name",u),D.send(this.requestCtx,Z3.StreamEventTypeOutSerializer._fromJsonObject)}update(u,D){let B=new P2.SvixRequest(P2.HttpMethod.PUT,"/api/v1/stream/event-type/{name}");return B.setPathParam("name",u),B.setBody(OY.StreamEventTypeInSerializer._toJsonObject(D)),B.send(this.requestCtx,Z3.StreamEventTypeOutSerializer._fromJsonObject)}delete(u,D){let B=new P2.SvixRequest(P2.HttpMethod.DELETE,"/api/v1/stream/event-type/{name}");return B.setPathParam("name",u),B.setQueryParams({expunge:D===null||D===void 0?void 0:D.expunge}),B.sendNoResponseBody(this.requestCtx)}patch(u,D){let B=new P2.SvixRequest(P2.HttpMethod.PATCH,"/api/v1/stream/event-type/{name}");return B.setPathParam("name",u),B.setBody(fS.StreamEventTypePatchSerializer._toJsonObject(D)),B.send(this.requestCtx,Z3.StreamEventTypeOutSerializer._fromJsonObject)}}PY.StreamingEventType=CY});var TY=z((kY)=>{Object.defineProperty(kY,"__esModule",{value:!0});kY.EventInSerializer=void 0;kY.EventInSerializer={_fromJsonObject(u){return{eventType:u.eventType,payload:u.payload}},_toJsonObject(u){return{eventType:u.eventType,payload:u.payload}}}});var k8=z((IY)=>{Object.defineProperty(IY,"__esModule",{value:!0});IY.StreamInSerializer=void 0;IY.StreamInSerializer={_fromJsonObject(u){return{metadata:u.metadata,name:u.name,uid:u.uid}},_toJsonObject(u){return{metadata:u.metadata,name:u.name,uid:u.uid}}}});var bY=z((gY)=>{Object.defineProperty(gY,"__esModule",{value:!0});gY.CreateStreamEventsInSerializer=void 0;var _Y=TY(),mY=k8();gY.CreateStreamEventsInSerializer={_fromJsonObject(u){return{events:u.events.map((D)=>_Y.EventInSerializer._fromJsonObject(D)),stream:u.stream!=null?mY.StreamInSerializer._fromJsonObject(u.stream):void 0}},_toJsonObject(u){return{events:u.events.map((D)=>_Y.EventInSerializer._toJsonObject(D)),stream:u.stream!=null?mY.StreamInSerializer._toJsonObject(u.stream):void 0}}}});var dY=z((jY)=>{Object.defineProperty(jY,"__esModule",{value:!0});jY.CreateStreamEventsOutSerializer=void 0;jY.CreateStreamEventsOutSerializer={_fromJsonObject(u){return{}},_toJsonObject(u){return{}}}});var nY=z((iY)=>{Object.defineProperty(iY,"__esModule",{value:!0});iY.EventOutSerializer=void 0;iY.EventOutSerializer={_fromJsonObject(u){return{eventType:u.eventType,payload:u.payload,timestamp:new Date(u.timestamp)}},_toJsonObject(u){return{eventType:u.eventType,payload:u.payload,timestamp:u.timestamp}}}});var tY=z((aY)=>{Object.defineProperty(aY,"__esModule",{value:!0});aY.EventStreamOutSerializer=void 0;var pY=nY();aY.EventStreamOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>pY.EventOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator}},_toJsonObject(u){return{data:u.data.map((D)=>pY.EventOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator}}}});var DX=z((eY)=>{Object.defineProperty(eY,"__esModule",{value:!0});eY.StreamingEvents=void 0;var bS=bY(),jS=dY(),lS=tY(),J3=m();class oY{constructor(u){this.requestCtx=u}create(u,D,B){let A=new J3.SvixRequest(J3.HttpMethod.POST,"/api/v1/stream/{stream_id}/events");return A.setPathParam("stream_id",u),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(bS.CreateStreamEventsInSerializer._toJsonObject(D)),A.send(this.requestCtx,jS.CreateStreamEventsOutSerializer._fromJsonObject)}get(u,D,B){let A=new J3.SvixRequest(J3.HttpMethod.GET,"/api/v1/stream/{stream_id}/sink/{sink_id}/events");return A.setPathParam("stream_id",u),A.setPathParam("sink_id",D),A.setQueryParams({limit:B===null||B===void 0?void 0:B.limit,iterator:B===null||B===void 0?void 0:B.iterator,after:B===null||B===void 0?void 0:B.after}),A.send(this.requestCtx,lS.EventStreamOutSerializer._fromJsonObject)}}eY.StreamingEvents=oY});var y8=z((BX)=>{Object.defineProperty(BX,"__esModule",{value:!0});BX.AzureBlobStorageConfigSerializer=void 0;BX.AzureBlobStorageConfigSerializer={_fromJsonObject(u){return{accessKey:u.accessKey,account:u.account,container:u.container}},_toJsonObject(u){return{accessKey:u.accessKey,account:u.account,container:u.container}}}});var T8=z((FX)=>{Object.defineProperty(FX,"__esModule",{value:!0});FX.GoogleCloudStorageConfigSerializer=void 0;FX.GoogleCloudStorageConfigSerializer={_fromJsonObject(u){return{bucket:u.bucket,credentials:u.credentials}},_toJsonObject(u){return{bucket:u.bucket,credentials:u.credentials}}}});var I8=z((GX)=>{Object.defineProperty(GX,"__esModule",{value:!0});GX.S3ConfigSerializer=void 0;GX.S3ConfigSerializer={_fromJsonObject(u){return{accessKeyId:u.accessKeyId,bucket:u.bucket,endpointUrl:u.endpointUrl,region:u.region,secretAccessKey:u.secretAccessKey}},_toJsonObject(u){return{accessKeyId:u.accessKeyId,bucket:u.bucket,endpointUrl:u.endpointUrl,region:u.region,secretAccessKey:u.secretAccessKey}}}});var q8=z(($X)=>{Object.defineProperty($X,"__esModule",{value:!0});$X.SinkHttpConfigSerializer=void 0;$X.SinkHttpConfigSerializer={_fromJsonObject(u){return{headers:u.headers,key:u.key,url:u.url}},_toJsonObject(u){return{headers:u.headers,key:u.key,url:u.url}}}});var _8=z((ZX)=>{Object.defineProperty(ZX,"__esModule",{value:!0});ZX.SinkOtelV1ConfigSerializer=void 0;ZX.SinkOtelV1ConfigSerializer={_fromJsonObject(u){return{headers:u.headers,url:u.url}},_toJsonObject(u){return{headers:u.headers,url:u.url}}}});var m8=z((YX)=>{Object.defineProperty(YX,"__esModule",{value:!0});YX.SinkStatusSerializer=YX.SinkStatus=void 0;var dS;(function(u){u.Enabled="enabled",u.Paused="paused",u.Disabled="disabled",u.Retrying="retrying"})(dS=YX.SinkStatus||(YX.SinkStatus={}));YX.SinkStatusSerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var g8=z((SX)=>{Object.defineProperty(SX,"__esModule",{value:!0});SX.StreamSinkOutSerializer=void 0;var WX=y8(),vX=T8(),KX=I8(),hX=q8(),xX=_8(),HX=m8();SX.StreamSinkOutSerializer={_fromJsonObject(u){let D=u.type;function B(A){switch(A){case"poller":return{};case"azureBlobStorage":return WX.AzureBlobStorageConfigSerializer._fromJsonObject(u.config);case"otelTracing":return xX.SinkOtelV1ConfigSerializer._fromJsonObject(u.config);case"http":return hX.SinkHttpConfigSerializer._fromJsonObject(u.config);case"amazonS3":return KX.S3ConfigSerializer._fromJsonObject(u.config);case"googleCloudStorage":return vX.GoogleCloudStorageConfigSerializer._fromJsonObject(u.config);default:throw Error(`Unexpected type: ${A}`)}}return{type:D,config:B(D),batchSize:u.batchSize,createdAt:new Date(u.createdAt),currentIterator:u.currentIterator,eventTypes:u.eventTypes,failureReason:u.failureReason,id:u.id,maxWaitSecs:u.maxWaitSecs,metadata:u.metadata,nextRetryAt:u.nextRetryAt?new Date(u.nextRetryAt):null,status:HX.SinkStatusSerializer._fromJsonObject(u.status),uid:u.uid,updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){let D;switch(u.type){case"poller":D={};break;case"azureBlobStorage":D=WX.AzureBlobStorageConfigSerializer._toJsonObject(u.config);break;case"otelTracing":D=xX.SinkOtelV1ConfigSerializer._toJsonObject(u.config);break;case"http":D=hX.SinkHttpConfigSerializer._toJsonObject(u.config);break;case"amazonS3":D=KX.S3ConfigSerializer._toJsonObject(u.config);break;case"googleCloudStorage":D=vX.GoogleCloudStorageConfigSerializer._toJsonObject(u.config);break}return{type:u.type,config:D,batchSize:u.batchSize,createdAt:u.createdAt,currentIterator:u.currentIterator,eventTypes:u.eventTypes,failureReason:u.failureReason,id:u.id,maxWaitSecs:u.maxWaitSecs,metadata:u.metadata,nextRetryAt:u.nextRetryAt,status:HX.SinkStatusSerializer._toJsonObject(u.status),uid:u.uid,updatedAt:u.updatedAt}}}});var EX=z((MX)=>{Object.defineProperty(MX,"__esModule",{value:!0});MX.ListResponseStreamSinkOutSerializer=void 0;var UX=g8();MX.ListResponseStreamSinkOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>UX.StreamSinkOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>UX.StreamSinkOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var PX=z((OX)=>{Object.defineProperty(OX,"__esModule",{value:!0});OX.SinkSecretOutSerializer=void 0;OX.SinkSecretOutSerializer={_fromJsonObject(u){return{key:u.key}},_toJsonObject(u){return{key:u.key}}}});var kX=z((cX)=>{Object.defineProperty(cX,"__esModule",{value:!0});cX.SinkTransformInSerializer=void 0;cX.SinkTransformInSerializer={_fromJsonObject(u){return{code:u.code}},_toJsonObject(u){return{code:u.code}}}});var Q3=z((TX)=>{Object.defineProperty(TX,"__esModule",{value:!0});TX.SinkStatusInSerializer=TX.SinkStatusIn=void 0;var iS;(function(u){u.Enabled="enabled",u.Disabled="disabled"})(iS=TX.SinkStatusIn||(TX.SinkStatusIn={}));TX.SinkStatusInSerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var dX=z((jX)=>{Object.defineProperty(jX,"__esModule",{value:!0});jX.StreamSinkInSerializer=void 0;var qX=y8(),_X=T8(),mX=I8(),gX=q8(),fX=_8(),bX=Q3();jX.StreamSinkInSerializer={_fromJsonObject(u){let D=u.type;function B(A){switch(A){case"poller":return{};case"azureBlobStorage":return qX.AzureBlobStorageConfigSerializer._fromJsonObject(u.config);case"otelTracing":return fX.SinkOtelV1ConfigSerializer._fromJsonObject(u.config);case"http":return gX.SinkHttpConfigSerializer._fromJsonObject(u.config);case"amazonS3":return mX.S3ConfigSerializer._fromJsonObject(u.config);case"googleCloudStorage":return _X.GoogleCloudStorageConfigSerializer._fromJsonObject(u.config);default:throw Error(`Unexpected type: ${A}`)}}return{type:D,config:B(D),batchSize:u.batchSize,eventTypes:u.eventTypes,maxWaitSecs:u.maxWaitSecs,metadata:u.metadata,status:u.status!=null?bX.SinkStatusInSerializer._fromJsonObject(u.status):void 0,uid:u.uid}},_toJsonObject(u){let D;switch(u.type){case"poller":D={};break;case"azureBlobStorage":D=qX.AzureBlobStorageConfigSerializer._toJsonObject(u.config);break;case"otelTracing":D=fX.SinkOtelV1ConfigSerializer._toJsonObject(u.config);break;case"http":D=gX.SinkHttpConfigSerializer._toJsonObject(u.config);break;case"amazonS3":D=mX.S3ConfigSerializer._toJsonObject(u.config);break;case"googleCloudStorage":D=_X.GoogleCloudStorageConfigSerializer._toJsonObject(u.config);break}return{type:u.type,config:D,batchSize:u.batchSize,eventTypes:u.eventTypes,maxWaitSecs:u.maxWaitSecs,metadata:u.metadata,status:u.status!=null?bX.SinkStatusInSerializer._toJsonObject(u.status):void 0,uid:u.uid}}}});var nX=z((iX)=>{Object.defineProperty(iX,"__esModule",{value:!0});iX.AmazonS3PatchConfigSerializer=void 0;iX.AmazonS3PatchConfigSerializer={_fromJsonObject(u){return{accessKeyId:u.accessKeyId,bucket:u.bucket,endpointUrl:u.endpointUrl,region:u.region,secretAccessKey:u.secretAccessKey}},_toJsonObject(u){return{accessKeyId:u.accessKeyId,bucket:u.bucket,endpointUrl:u.endpointUrl,region:u.region,secretAccessKey:u.secretAccessKey}}}});var sX=z((pX)=>{Object.defineProperty(pX,"__esModule",{value:!0});pX.AzureBlobStoragePatchConfigSerializer=void 0;pX.AzureBlobStoragePatchConfigSerializer={_fromJsonObject(u){return{accessKey:u.accessKey,account:u.account,container:u.container}},_toJsonObject(u){return{accessKey:u.accessKey,account:u.account,container:u.container}}}});var eX=z((tX)=>{Object.defineProperty(tX,"__esModule",{value:!0});tX.GoogleCloudStoragePatchConfigSerializer=void 0;tX.GoogleCloudStoragePatchConfigSerializer={_fromJsonObject(u){return{bucket:u.bucket,credentials:u.credentials}},_toJsonObject(u){return{bucket:u.bucket,credentials:u.credentials}}}});var BW=z((uW)=>{Object.defineProperty(uW,"__esModule",{value:!0});uW.HttpPatchConfigSerializer=void 0;uW.HttpPatchConfigSerializer={_fromJsonObject(u){return{url:u.url}},_toJsonObject(u){return{url:u.url}}}});var wW=z((AW)=>{Object.defineProperty(AW,"__esModule",{value:!0});AW.OtelTracingPatchConfigSerializer=void 0;AW.OtelTracingPatchConfigSerializer={_fromJsonObject(u){return{url:u.url}},_toJsonObject(u){return{url:u.url}}}});var XW=z((QW)=>{Object.defineProperty(QW,"__esModule",{value:!0});QW.StreamSinkPatchSerializer=void 0;var GW=nX(),NW=sX(),$W=eX(),zW=BW(),ZW=wW(),JW=Q3();QW.StreamSinkPatchSerializer={_fromJsonObject(u){let D=u.type;function B(A){switch(A){case"poller":return{};case"azureBlobStorage":return NW.AzureBlobStoragePatchConfigSerializer._fromJsonObject(u.config);case"otelTracing":return ZW.OtelTracingPatchConfigSerializer._fromJsonObject(u.config);case"http":return zW.HttpPatchConfigSerializer._fromJsonObject(u.config);case"amazonS3":return GW.AmazonS3PatchConfigSerializer._fromJsonObject(u.config);case"googleCloudStorage":return $W.GoogleCloudStoragePatchConfigSerializer._fromJsonObject(u.config);default:throw Error(`Unexpected type: ${A}`)}}return{type:D,config:B(D),batchSize:u.batchSize,eventTypes:u.eventTypes,maxWaitSecs:u.maxWaitSecs,metadata:u.metadata,status:u.status!=null?JW.SinkStatusInSerializer._fromJsonObject(u.status):void 0,uid:u.uid}},_toJsonObject(u){let D;switch(u.type){case"poller":D={};break;case"azureBlobStorage":D=NW.AzureBlobStoragePatchConfigSerializer._toJsonObject(u.config);break;case"otelTracing":D=ZW.OtelTracingPatchConfigSerializer._toJsonObject(u.config);break;case"http":D=zW.HttpPatchConfigSerializer._toJsonObject(u.config);break;case"amazonS3":D=GW.AmazonS3PatchConfigSerializer._toJsonObject(u.config);break;case"googleCloudStorage":D=$W.GoogleCloudStoragePatchConfigSerializer._toJsonObject(u.config);break}return{type:u.type,config:D,batchSize:u.batchSize,eventTypes:u.eventTypes,maxWaitSecs:u.maxWaitSecs,metadata:u.metadata,status:u.status!=null?JW.SinkStatusInSerializer._toJsonObject(u.status):void 0,uid:u.uid}}}});var HW=z((hW)=>{Object.defineProperty(hW,"__esModule",{value:!0});hW.StreamingSink=void 0;var WW=L8(),rS=W8(),nS=EX(),pS=PX(),aS=kX(),vW=dX(),Y3=g8(),sS=XW(),B2=m();class KW{constructor(u){this.requestCtx=u}list(u,D){let B=new B2.SvixRequest(B2.HttpMethod.GET,"/api/v1/stream/{stream_id}/sink");return B.setPathParam("stream_id",u),B.setQueryParams({limit:D===null||D===void 0?void 0:D.limit,iterator:D===null||D===void 0?void 0:D.iterator,order:D===null||D===void 0?void 0:D.order}),B.send(this.requestCtx,nS.ListResponseStreamSinkOutSerializer._fromJsonObject)}create(u,D,B){let A=new B2.SvixRequest(B2.HttpMethod.POST,"/api/v1/stream/{stream_id}/sink");return A.setPathParam("stream_id",u),A.setHeaderParam("idempotency-key",B===null||B===void 0?void 0:B.idempotencyKey),A.setBody(vW.StreamSinkInSerializer._toJsonObject(D)),A.send(this.requestCtx,Y3.StreamSinkOutSerializer._fromJsonObject)}get(u,D){let B=new B2.SvixRequest(B2.HttpMethod.GET,"/api/v1/stream/{stream_id}/sink/{sink_id}");return B.setPathParam("stream_id",u),B.setPathParam("sink_id",D),B.send(this.requestCtx,Y3.StreamSinkOutSerializer._fromJsonObject)}update(u,D,B){let A=new B2.SvixRequest(B2.HttpMethod.PUT,"/api/v1/stream/{stream_id}/sink/{sink_id}");return A.setPathParam("stream_id",u),A.setPathParam("sink_id",D),A.setBody(vW.StreamSinkInSerializer._toJsonObject(B)),A.send(this.requestCtx,Y3.StreamSinkOutSerializer._fromJsonObject)}delete(u,D){let B=new B2.SvixRequest(B2.HttpMethod.DELETE,"/api/v1/stream/{stream_id}/sink/{sink_id}");return B.setPathParam("stream_id",u),B.setPathParam("sink_id",D),B.sendNoResponseBody(this.requestCtx)}patch(u,D,B){let A=new B2.SvixRequest(B2.HttpMethod.PATCH,"/api/v1/stream/{stream_id}/sink/{sink_id}");return A.setPathParam("stream_id",u),A.setPathParam("sink_id",D),A.setBody(sS.StreamSinkPatchSerializer._toJsonObject(B)),A.send(this.requestCtx,Y3.StreamSinkOutSerializer._fromJsonObject)}getSecret(u,D){let B=new B2.SvixRequest(B2.HttpMethod.GET,"/api/v1/stream/{stream_id}/sink/{sink_id}/secret");return B.setPathParam("stream_id",u),B.setPathParam("sink_id",D),B.send(this.requestCtx,pS.SinkSecretOutSerializer._fromJsonObject)}rotateSecret(u,D,B,A){let F=new B2.SvixRequest(B2.HttpMethod.POST,"/api/v1/stream/{stream_id}/sink/{sink_id}/secret/rotate");return F.setPathParam("stream_id",u),F.setPathParam("sink_id",D),F.setHeaderParam("idempotency-key",A===null||A===void 0?void 0:A.idempotencyKey),F.setBody(rS.EndpointSecretRotateInSerializer._toJsonObject(B)),F.send(this.requestCtx,WW.EmptyResponseSerializer._fromJsonObject)}transformationPartialUpdate(u,D,B){let A=new B2.SvixRequest(B2.HttpMethod.PATCH,"/api/v1/stream/{stream_id}/sink/{sink_id}/transformation");return A.setPathParam("stream_id",u),A.setPathParam("sink_id",D),A.setBody(aS.SinkTransformInSerializer._toJsonObject(B)),A.send(this.requestCtx,WW.EmptyResponseSerializer._fromJsonObject)}}hW.StreamingSink=KW});var f8=z((SW)=>{Object.defineProperty(SW,"__esModule",{value:!0});SW.StreamOutSerializer=void 0;SW.StreamOutSerializer={_fromJsonObject(u){return{createdAt:new Date(u.createdAt),id:u.id,metadata:u.metadata,name:u.name,uid:u.uid,updatedAt:new Date(u.updatedAt)}},_toJsonObject(u){return{createdAt:u.createdAt,id:u.id,metadata:u.metadata,name:u.name,uid:u.uid,updatedAt:u.updatedAt}}}});var EW=z((MW)=>{Object.defineProperty(MW,"__esModule",{value:!0});MW.ListResponseStreamOutSerializer=void 0;var UW=f8();MW.ListResponseStreamOutSerializer={_fromJsonObject(u){return{data:u.data.map((D)=>UW.StreamOutSerializer._fromJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}},_toJsonObject(u){return{data:u.data.map((D)=>UW.StreamOutSerializer._toJsonObject(D)),done:u.done,iterator:u.iterator,prevIterator:u.prevIterator}}}});var PW=z((OW)=>{Object.defineProperty(OW,"__esModule",{value:!0});OW.StreamPatchSerializer=void 0;OW.StreamPatchSerializer={_fromJsonObject(u){return{description:u.description,metadata:u.metadata,uid:u.uid}},_toJsonObject(u){return{description:u.description,metadata:u.metadata,uid:u.uid}}}});var TW=z((kW)=>{Object.defineProperty(kW,"__esModule",{value:!0});kW.StreamingStream=void 0;var tS=EW(),cW=k8(),X3=f8(),oS=PW(),c2=m();class VW{constructor(u){this.requestCtx=u}list(u){let D=new c2.SvixRequest(c2.HttpMethod.GET,"/api/v1/stream");return D.setQueryParams({limit:u===null||u===void 0?void 0:u.limit,iterator:u===null||u===void 0?void 0:u.iterator,order:u===null||u===void 0?void 0:u.order}),D.send(this.requestCtx,tS.ListResponseStreamOutSerializer._fromJsonObject)}create(u,D){let B=new c2.SvixRequest(c2.HttpMethod.POST,"/api/v1/stream");return B.setHeaderParam("idempotency-key",D===null||D===void 0?void 0:D.idempotencyKey),B.setBody(cW.StreamInSerializer._toJsonObject(u)),B.send(this.requestCtx,X3.StreamOutSerializer._fromJsonObject)}get(u){let D=new c2.SvixRequest(c2.HttpMethod.GET,"/api/v1/stream/{stream_id}");return D.setPathParam("stream_id",u),D.send(this.requestCtx,X3.StreamOutSerializer._fromJsonObject)}update(u,D){let B=new c2.SvixRequest(c2.HttpMethod.PUT,"/api/v1/stream/{stream_id}");return B.setPathParam("stream_id",u),B.setBody(cW.StreamInSerializer._toJsonObject(D)),B.send(this.requestCtx,X3.StreamOutSerializer._fromJsonObject)}delete(u){let D=new c2.SvixRequest(c2.HttpMethod.DELETE,"/api/v1/stream/{stream_id}");return D.setPathParam("stream_id",u),D.sendNoResponseBody(this.requestCtx)}patch(u,D){let B=new c2.SvixRequest(c2.HttpMethod.PATCH,"/api/v1/stream/{stream_id}");return B.setPathParam("stream_id",u),B.setBody(oS.StreamPatchSerializer._toJsonObject(D)),B.send(this.requestCtx,X3.StreamOutSerializer._fromJsonObject)}}kW.StreamingStream=VW});var gW=z((_W)=>{Object.defineProperty(_W,"__esModule",{value:!0});_W.Streaming=void 0;var IW=Y8(),eS=JY(),uR=XY(),DR=VY(),BR=DX(),AR=HW(),FR=TW(),g0=m();class qW{constructor(u){this.requestCtx=u}get event_type(){return new DR.StreamingEventType(this.requestCtx)}get events(){return new BR.StreamingEvents(this.requestCtx)}get sink(){return new AR.StreamingSink(this.requestCtx)}get stream(){return new FR.StreamingStream(this.requestCtx)}sinkHeadersGet(u,D){let B=new g0.SvixRequest(g0.HttpMethod.GET,"/api/v1/stream/{stream_id}/sink/{sink_id}/headers");return B.setPathParam("stream_id",u),B.setPathParam("sink_id",D),B.send(this.requestCtx,IW.EndpointHeadersOutSerializer._fromJsonObject)}sinkHeadersPatch(u,D,B){let A=new g0.SvixRequest(g0.HttpMethod.PATCH,"/api/v1/stream/{stream_id}/sink/{sink_id}/headers");return A.setPathParam("stream_id",u),A.setPathParam("sink_id",D),A.setBody(eS.HttpSinkHeadersPatchInSerializer._toJsonObject(B)),A.send(this.requestCtx,IW.EndpointHeadersOutSerializer._fromJsonObject)}sinkTransformationGet(u,D){let B=new g0.SvixRequest(g0.HttpMethod.GET,"/api/v1/stream/{stream_id}/sink/{sink_id}/transformation");return B.setPathParam("stream_id",u),B.setPathParam("sink_id",D),B.send(this.requestCtx,uR.SinkTransformationOutSerializer._fromJsonObject)}}_W.Streaming=qW});var jW=z((fW)=>{Object.defineProperty(fW,"__esModule",{value:!0});fW.HTTPValidationError=fW.ValidationError=fW.HttpErrorOut=void 0;class f0{static getAttributeTypeMap(){return f0.attributeTypeMap}}fW.HttpErrorOut=f0;f0.discriminator=void 0;f0.mapping=void 0;f0.attributeTypeMap=[{name:"code",baseName:"code",type:"string",format:""},{name:"detail",baseName:"detail",type:"string",format:""}];class b0{static getAttributeTypeMap(){return b0.attributeTypeMap}}fW.ValidationError=b0;b0.discriminator=void 0;b0.mapping=void 0;b0.attributeTypeMap=[{name:"loc",baseName:"loc",type:"Array<string>",format:""},{name:"msg",baseName:"msg",type:"string",format:""},{name:"type",baseName:"type",type:"string",format:""}];class j0{static getAttributeTypeMap(){return j0.attributeTypeMap}}fW.HTTPValidationError=j0;j0.discriminator=void 0;j0.mapping=void 0;j0.attributeTypeMap=[{name:"detail",baseName:"detail",type:"Array<ValidationError>",format:""}]});var rW=z((dW)=>{Object.defineProperty(dW,"__esModule",{value:!0});dW.timingSafeEqual=void 0;function lW(u,D=""){if(!u)throw Error(D)}function NR(u,D){if(u.byteLength!==D.byteLength)return!1;if(!(u instanceof DataView))u=new DataView(ArrayBuffer.isView(u)?u.buffer:u);if(!(D instanceof DataView))D=new DataView(ArrayBuffer.isView(D)?D.buffer:D);lW(u instanceof DataView),lW(D instanceof DataView);let B=u.byteLength,A=0,F=-1;while(++F<B)A|=u.getUint8(F)^D.getUint8(F);return A===0}dW.timingSafeEqual=NR});var aW=z((h2)=>{var $R=h2&&h2.__extends||function(){var u=function(D,B){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,F){A.__proto__=F}||function(A,F){for(var w in F)if(F.hasOwnProperty(w))A[w]=F[w]},u(D,B)};return function(D,B){u(D,B);function A(){this.constructor=D}D.prototype=B===null?Object.create(B):(A.prototype=B.prototype,new A)}}();Object.defineProperty(h2,"__esModule",{value:!0});var r=256,b8=function(){function u(D){if(D===void 0)D="=";this._paddingCharacter=D}return u.prototype.encodedLength=function(D){if(!this._paddingCharacter)return(D*8+5)/6|0;return(D+2)/3*4|0},u.prototype.encode=function(D){var B="",A=0;for(;A<D.length-2;A+=3){var F=D[A]<<16|D[A+1]<<8|D[A+2];B+=this._encodeByte(F>>>18&63),B+=this._encodeByte(F>>>12&63),B+=this._encodeByte(F>>>6&63),B+=this._encodeByte(F>>>0&63)}var w=D.length-A;if(w>0){var F=D[A]<<16|(w===2?D[A+1]<<8:0);if(B+=this._encodeByte(F>>>18&63),B+=this._encodeByte(F>>>12&63),w===2)B+=this._encodeByte(F>>>6&63);else B+=this._paddingCharacter||"";B+=this._paddingCharacter||""}return B},u.prototype.maxDecodedLength=function(D){if(!this._paddingCharacter)return(D*6+7)/8|0;return D/4*3|0},u.prototype.decodedLength=function(D){return this.maxDecodedLength(D.length-this._getPaddingLength(D))},u.prototype.decode=function(D){if(D.length===0)return new Uint8Array(0);var B=this._getPaddingLength(D),A=D.length-B,F=new Uint8Array(this.maxDecodedLength(A)),w=0,G=0,N=0,$=0,Z=0,Y=0,J=0;for(;G<A-4;G+=4)$=this._decodeChar(D.charCodeAt(G+0)),Z=this._decodeChar(D.charCodeAt(G+1)),Y=this._decodeChar(D.charCodeAt(G+2)),J=this._decodeChar(D.charCodeAt(G+3)),F[w++]=$<<2|Z>>>4,F[w++]=Z<<4|Y>>>2,F[w++]=Y<<6|J,N|=$&r,N|=Z&r,N|=Y&r,N|=J&r;if(G<A-1)$=this._decodeChar(D.charCodeAt(G)),Z=this._decodeChar(D.charCodeAt(G+1)),F[w++]=$<<2|Z>>>4,N|=$&r,N|=Z&r;if(G<A-2)Y=this._decodeChar(D.charCodeAt(G+2)),F[w++]=Z<<4|Y>>>2,N|=Y&r;if(G<A-3)J=this._decodeChar(D.charCodeAt(G+3)),F[w++]=Y<<6|J,N|=J&r;if(N!==0)throw Error("Base64Coder: incorrect characters for decoding");return F},u.prototype._encodeByte=function(D){var B=D;return B+=65,B+=25-D>>>8&6,B+=51-D>>>8&-75,B+=61-D>>>8&-15,B+=62-D>>>8&3,String.fromCharCode(B)},u.prototype._decodeChar=function(D){var B=r;return B+=(42-D&D-44)>>>8&-r+D-43+62,B+=(46-D&D-48)>>>8&-r+D-47+63,B+=(47-D&D-58)>>>8&-r+D-48+52,B+=(64-D&D-91)>>>8&-r+D-65+0,B+=(96-D&D-123)>>>8&-r+D-97+26,B},u.prototype._getPaddingLength=function(D){var B=0;if(this._paddingCharacter){for(var A=D.length-1;A>=0;A--){if(D[A]!==this._paddingCharacter)break;B++}if(D.length<4||B>2)throw Error("Base64Coder: incorrect padding")}return B},u}();h2.Coder=b8;var cu=new b8;function zR(u){return cu.encode(u)}h2.encode=zR;function ZR(u){return cu.decode(u)}h2.decode=ZR;var nW=function(u){$R(D,u);function D(){return u!==null&&u.apply(this,arguments)||this}return D.prototype._encodeByte=function(B){var A=B;return A+=65,A+=25-B>>>8&6,A+=51-B>>>8&-75,A+=61-B>>>8&-13,A+=62-B>>>8&49,String.fromCharCode(A)},D.prototype._decodeChar=function(B){var A=r;return A+=(44-B&B-46)>>>8&-r+B-45+62,A+=(94-B&B-96)>>>8&-r+B-95+63,A+=(47-B&B-58)>>>8&-r+B-48+52,A+=(64-B&B-91)>>>8&-r+B-65+0,A+=(96-B&B-123)>>>8&-r+B-97+26,A},D}(b8);h2.URLSafeCoder=nW;var pW=new nW;function JR(u){return pW.encode(u)}h2.encodeURLSafe=JR;function QR(u){return pW.decode(u)}h2.decodeURLSafe=QR;h2.encodedLength=function(u){return cu.encodedLength(u)};h2.maxDecodedLength=function(u){return cu.maxDecodedLength(u)};h2.decodedLength=function(u){return cu.decodedLength(u)}});var tW=z((sW,W3)=>{(function(u,D){var B={};D(B);var A=B.default;for(var F in B)A[F]=B[F];if(typeof W3==="object"&&typeof W3.exports==="object")W3.exports=A;else if(typeof define==="function"&&define.amd)define(function(){return A});else u.sha256=A})(sW,function(u){u.__esModule=!0,u.digestLength=32,u.blockSize=64;var D=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function B(J,Q,X,v,L){var x,E,H,k,g,y,H2,a,w2,s,Au,Fu,ju;while(L>=64){x=Q[0],E=Q[1],H=Q[2],k=Q[3],g=Q[4],y=Q[5],H2=Q[6],a=Q[7];for(s=0;s<16;s++)Au=v+s*4,J[s]=(X[Au]&255)<<24|(X[Au+1]&255)<<16|(X[Au+2]&255)<<8|X[Au+3]&255;for(s=16;s<64;s++)w2=J[s-2],Fu=(w2>>>17|w2<<15)^(w2>>>19|w2<<13)^w2>>>10,w2=J[s-15],ju=(w2>>>7|w2<<25)^(w2>>>18|w2<<14)^w2>>>3,J[s]=(Fu+J[s-7]|0)+(ju+J[s-16]|0);for(s=0;s<64;s++)Fu=(((g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7))+(g&y^~g&H2)|0)+(a+(D[s]+J[s]|0)|0)|0,ju=((x>>>2|x<<30)^(x>>>13|x<<19)^(x>>>22|x<<10))+(x&E^x&H^E&H)|0,a=H2,H2=y,y=g,g=k+Fu|0,k=H,H=E,E=x,x=Fu+ju|0;Q[0]+=x,Q[1]+=E,Q[2]+=H,Q[3]+=k,Q[4]+=g,Q[5]+=y,Q[6]+=H2,Q[7]+=a,v+=64,L-=64}return v}var A=function(){function J(){this.digestLength=u.digestLength,this.blockSize=u.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return J.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},J.prototype.clean=function(){for(var Q=0;Q<this.buffer.length;Q++)this.buffer[Q]=0;for(var Q=0;Q<this.temp.length;Q++)this.temp[Q]=0;this.reset()},J.prototype.update=function(Q,X){if(X===void 0)X=Q.length;if(this.finished)throw Error("SHA256: can't update because hash was finished.");var v=0;if(this.bytesHashed+=X,this.bufferLength>0){while(this.bufferLength<64&&X>0)this.buffer[this.bufferLength++]=Q[v++],X--;if(this.bufferLength===64)B(this.temp,this.state,this.buffer,0,64),this.bufferLength=0}if(X>=64)v=B(this.temp,this.state,Q,v,X),X%=64;while(X>0)this.buffer[this.bufferLength++]=Q[v++],X--;return this},J.prototype.finish=function(Q){if(!this.finished){var X=this.bytesHashed,v=this.bufferLength,L=X/536870912|0,x=X<<3,E=X%64<56?64:128;this.buffer[v]=128;for(var H=v+1;H<E-8;H++)this.buffer[H]=0;this.buffer[E-8]=L>>>24&255,this.buffer[E-7]=L>>>16&255,this.buffer[E-6]=L>>>8&255,this.buffer[E-5]=L>>>0&255,this.buffer[E-4]=x>>>24&255,this.buffer[E-3]=x>>>16&255,this.buffer[E-2]=x>>>8&255,this.buffer[E-1]=x>>>0&255,B(this.temp,this.state,this.buffer,0,E),this.finished=!0}for(var H=0;H<8;H++)Q[H*4+0]=this.state[H]>>>24&255,Q[H*4+1]=this.state[H]>>>16&255,Q[H*4+2]=this.state[H]>>>8&255,Q[H*4+3]=this.state[H]>>>0&255;return this},J.prototype.digest=function(){var Q=new Uint8Array(this.digestLength);return this.finish(Q),Q},J.prototype._saveState=function(Q){for(var X=0;X<this.state.length;X++)Q[X]=this.state[X]},J.prototype._restoreState=function(Q,X){for(var v=0;v<this.state.length;v++)this.state[v]=Q[v];this.bytesHashed=X,this.finished=!1,this.bufferLength=0},J}();u.Hash=A;var F=function(){function J(Q){this.inner=new A,this.outer=new A,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var X=new Uint8Array(this.blockSize);if(Q.length>this.blockSize)new A().update(Q).finish(X).clean();else for(var v=0;v<Q.length;v++)X[v]=Q[v];for(var v=0;v<X.length;v++)X[v]^=54;this.inner.update(X);for(var v=0;v<X.length;v++)X[v]^=106;this.outer.update(X),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var v=0;v<X.length;v++)X[v]=0}return J.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},J.prototype.clean=function(){for(var Q=0;Q<this.istate.length;Q++)this.ostate[Q]=this.istate[Q]=0;this.inner.clean(),this.outer.clean()},J.prototype.update=function(Q){return this.inner.update(Q),this},J.prototype.finish=function(Q){if(this.outer.finished)this.outer.finish(Q);else this.inner.finish(Q),this.outer.update(Q,this.digestLength).finish(Q);return this},J.prototype.digest=function(){var Q=new Uint8Array(this.digestLength);return this.finish(Q),Q},J}();u.HMAC=F;function w(J){var Q=new A().update(J),X=Q.digest();return Q.clean(),X}u.hash=w,u.default=w;function G(J,Q){var X=new F(J).update(Q),v=X.digest();return X.clean(),v}u.hmac=G;function N(J,Q,X,v){var L=v[0];if(L===0)throw Error("hkdf: cannot expand more");if(Q.reset(),L>1)Q.update(J);if(X)Q.update(X);Q.update(v),Q.finish(J),v[0]++}var $=new Uint8Array(u.digestLength);function Z(J,Q,X,v){if(Q===void 0)Q=$;if(v===void 0)v=32;var L=new Uint8Array([1]),x=G(Q,J),E=new F(x),H=new Uint8Array(E.digestLength),k=H.length,g=new Uint8Array(v);for(var y=0;y<v;y++){if(k===H.length)N(H,E,X,L),k=0;g[y]=H[k++]}return E.clean(),H.fill(0),L.fill(0),g}u.hkdf=Z;function Y(J,Q,X,v){var L=new F(J),x=L.digestLength,E=new Uint8Array(4),H=new Uint8Array(x),k=new Uint8Array(x),g=new Uint8Array(v);for(var y=0;y*x<v;y++){var H2=y+1;E[0]=H2>>>24&255,E[1]=H2>>>16&255,E[2]=H2>>>8&255,E[3]=H2>>>0&255,L.reset(),L.update(Q),L.update(E),L.finish(k);for(var a=0;a<x;a++)H[a]=k[a];for(var a=2;a<=X;a++){L.reset(),L.update(k).finish(k);for(var w2=0;w2<x;w2++)H[w2]^=k[w2]}for(var a=0;a<x&&y*x+a<v;a++)g[y*x+a]=H[a]}for(var y=0;y<x;y++)H[y]=k[y]=0;for(var y=0;y<4;y++)E[y]=0;return L.clean(),g}u.pbkdf2=Y})});var l8=z((uv)=>{Object.defineProperty(uv,"__esModule",{value:!0});uv.Webhook=uv.WebhookVerificationError=void 0;var YR=rW(),oW=aW(),XR=tW(),eW=300;class j8 extends Error{constructor(u){super(u);Object.setPrototypeOf(this,j8.prototype),this.name="ExtendableError",this.stack=Error(u).stack}}class D0 extends j8{constructor(u){super(u);Object.setPrototypeOf(this,D0.prototype),this.name="WebhookVerificationError"}}uv.WebhookVerificationError=D0;class Vu{constructor(u,D){if(!u)throw Error("Secret can't be empty.");if((D===null||D===void 0?void 0:D.format)==="raw")if(u instanceof Uint8Array)this.key=u;else this.key=Uint8Array.from(u,(B)=>B.charCodeAt(0));else{if(typeof u!=="string")throw Error("Expected secret to be of type string");if(u.startsWith(Vu.prefix))u=u.substring(Vu.prefix.length);this.key=oW.decode(u)}}verify(u,D){let B={};for(let J of Object.keys(D))B[J.toLowerCase()]=D[J];let A=B["webhook-id"],F=B["webhook-signature"],w=B["webhook-timestamp"];if(!F||!A||!w)throw new D0("Missing required headers");let G=this.verifyTimestamp(w),$=this.sign(A,G,u).split(",")[1],Z=F.split(" "),Y=new globalThis.TextEncoder;for(let J of Z){let[Q,X]=J.split(",");if(Q!=="v1")continue;if((0,YR.timingSafeEqual)(Y.encode(X),Y.encode($)))return JSON.parse(u.toString())}throw new D0("No matching signature found")}sign(u,D,B){if(typeof B==="string");else if(B.constructor.name==="Buffer")B=B.toString();else throw Error("Expected payload to be of type string or Buffer.");let A=new TextEncoder,F=Math.floor(D.getTime()/1000),w=A.encode(`${u}.${F}.${B}`);return`v1,${oW.encode(XR.hmac(this.key,w))}`}verifyTimestamp(u){let D=Math.floor(Date.now()/1000),B=parseInt(u,10);if(isNaN(B))throw new D0("Invalid Signature Headers");if(D-B>eW)throw new D0("Message timestamp too old");if(B>D+eW)throw new D0("Message timestamp too new");return new Date(B*1000)}}uv.Webhook=Vu;Vu.prefix="whsec_"});var Fv=z((d8)=>{Object.defineProperty(d8,"__esModule",{value:!0});d8.Webhook=d8.WebhookVerificationError=void 0;var vR=l8(),KR=l8();Object.defineProperty(d8,"WebhookVerificationError",{enumerable:!0,get:function(){return KR.WebhookVerificationError}});class Bv{constructor(u,D){this.inner=new vR.Webhook(u,D)}verify(u,D){var B,A,F,w,G,N;let $={};for(let Z of Object.keys(D))$[Z.toLowerCase()]=D[Z];return $["webhook-id"]=(A=(B=$["svix-id"])!==null&&B!==void 0?B:$["webhook-id"])!==null&&A!==void 0?A:"",$["webhook-signature"]=(w=(F=$["svix-signature"])!==null&&F!==void 0?F:$["webhook-signature"])!==null&&w!==void 0?w:"",$["webhook-timestamp"]=(N=(G=$["svix-timestamp"])!==null&&G!==void 0?G:$["webhook-timestamp"])!==null&&N!==void 0?N:"",this.inner.verify(u,$)}sign(u,D,B){return this.inner.sign(u,D,B)}}d8.Webhook=Bv});var $v=z((Gv)=>{Object.defineProperty(Gv,"__esModule",{value:!0});Gv.EndpointDisabledTriggerSerializer=Gv.EndpointDisabledTrigger=void 0;var hR;(function(u){u.Manual="manual",u.Automatic="automatic"})(hR=Gv.EndpointDisabledTrigger||(Gv.EndpointDisabledTrigger={}));Gv.EndpointDisabledTriggerSerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var Qv=z((Zv)=>{Object.defineProperty(Zv,"__esModule",{value:!0});Zv.OrderingSerializer=Zv.Ordering=void 0;var xR;(function(u){u.Ascending="ascending",u.Descending="descending"})(xR=Zv.Ordering||(Zv.Ordering={}));Zv.OrderingSerializer={_fromJsonObject(u){return u},_toJsonObject(u){return u}}});var Yv=z((z2)=>{Object.defineProperty(z2,"__esModule",{value:!0});z2.StatusCodeClass=z2.SinkStatusIn=z2.SinkStatus=z2.Ordering=z2.MessageStatusText=z2.MessageStatus=z2.MessageAttemptTriggerType=z2.EndpointDisabledTrigger=z2.ConnectorProduct=z2.ConnectorKind=z2.BackgroundTaskType=z2.BackgroundTaskStatus=z2.AppPortalCapability=void 0;var HR=$8();Object.defineProperty(z2,"AppPortalCapability",{enumerable:!0,get:function(){return HR.AppPortalCapability}});var SR=e2();Object.defineProperty(z2,"BackgroundTaskStatus",{enumerable:!0,get:function(){return SR.BackgroundTaskStatus}});var RR=u0();Object.defineProperty(z2,"BackgroundTaskType",{enumerable:!0,get:function(){return RR.BackgroundTaskType}});var UR=q0();Object.defineProperty(z2,"ConnectorKind",{enumerable:!0,get:function(){return UR.ConnectorKind}});var MR=B3();Object.defineProperty(z2,"ConnectorProduct",{enumerable:!0,get:function(){return MR.ConnectorProduct}});var LR=$v();Object.defineProperty(z2,"EndpointDisabledTrigger",{enumerable:!0,get:function(){return LR.EndpointDisabledTrigger}});var ER=E8();Object.defineProperty(z2,"MessageAttemptTriggerType",{enumerable:!0,get:function(){return ER.MessageAttemptTriggerType}});var OR=_0();Object.defineProperty(z2,"MessageStatus",{enumerable:!0,get:function(){return OR.MessageStatus}});var CR=Pu();Object.defineProperty(z2,"MessageStatusText",{enumerable:!0,get:function(){return CR.MessageStatusText}});var PR=Qv();Object.defineProperty(z2,"Ordering",{enumerable:!0,get:function(){return PR.Ordering}});var cR=m8();Object.defineProperty(z2,"SinkStatus",{enumerable:!0,get:function(){return cR.SinkStatus}});var VR=Q3();Object.defineProperty(z2,"SinkStatusIn",{enumerable:!0,get:function(){return VR.SinkStatusIn}});var kR=Q8();Object.defineProperty(z2,"StatusCodeClass",{enumerable:!0,get:function(){return kR.StatusCodeClass}})});var vv=z((n)=>{var TR=n&&n.__createBinding||(Object.create?function(u,D,B,A){if(A===void 0)A=B;var F=Object.getOwnPropertyDescriptor(D,B);if(!F||("get"in F?!D.__esModule:F.writable||F.configurable))F={enumerable:!0,get:function(){return D[B]}};Object.defineProperty(u,A,F)}:function(u,D,B,A){if(A===void 0)A=B;u[A]=D[B]}),Xv=n&&n.__exportStar||function(u,D){for(var B in u)if(B!=="default"&&!Object.prototype.hasOwnProperty.call(D,B))TR(D,u,B)};Object.defineProperty(n,"__esModule",{value:!0});n.Svix=n.messageInRaw=n.ValidationError=n.HttpErrorOut=n.HTTPValidationError=n.ApiException=void 0;var IR=YA(),qR=nA(),_R=J7(),mR=b7(),gR=Zw(),fR=Cw(),bR=BG(),jR=NG(),lR=HZ(),dR=fZ(),iR=M8(),rR=XQ(),nR=iQ(),pR=$Y(),aR=gW(),sR=c8(),tR=w8();Object.defineProperty(n,"ApiException",{enumerable:!0,get:function(){return tR.ApiException}});var i8=jW();Object.defineProperty(n,"HTTPValidationError",{enumerable:!0,get:function(){return i8.HTTPValidationError}});Object.defineProperty(n,"HttpErrorOut",{enumerable:!0,get:function(){return i8.HttpErrorOut}});Object.defineProperty(n,"ValidationError",{enumerable:!0,get:function(){return i8.ValidationError}});Xv(Fv(),n);Xv(Yv(),n);var oR=M8();Object.defineProperty(n,"messageInRaw",{enumerable:!0,get:function(){return oR.messageInRaw}});var eR=[{region:"us",url:"https://api.us.svix.com"},{region:"eu",url:"https://api.eu.svix.com"},{region:"in",url:"https://api.in.svix.com"},{region:"ca",url:"https://api.ca.svix.com"},{region:"au",url:"https://api.au.svix.com"}];class Wv{constructor(u,D={}){var B,A,F;let w=(B=eR.find((N)=>N.region===u.split(".")[1]))===null||B===void 0?void 0:B.url,G=(F=(A=D.serverUrl)!==null&&A!==void 0?A:w)!==null&&F!==void 0?F:"https://api.svix.com";if(D.retryScheduleInMs){this.requestCtx={baseUrl:G,token:u,timeout:D.requestTimeout,retryScheduleInMs:D.retryScheduleInMs,fetch:D.fetch};return}if(D.numRetries){this.requestCtx={baseUrl:G,token:u,timeout:D.requestTimeout,numRetries:D.numRetries,fetch:D.fetch};return}this.requestCtx={baseUrl:G,token:u,timeout:D.requestTimeout,fetch:D.fetch}}get application(){return new IR.Application(this.requestCtx)}get authentication(){return new qR.Authentication(this.requestCtx)}get backgroundTask(){return new _R.BackgroundTask(this.requestCtx)}get connector(){return new mR.Connector(this.requestCtx)}get endpoint(){return new gR.Endpoint(this.requestCtx)}get environment(){return new fR.Environment(this.requestCtx)}get eventType(){return new bR.EventType(this.requestCtx)}get health(){return new jR.Health(this.requestCtx)}get ingest(){return new lR.Ingest(this.requestCtx)}get integration(){return new dR.Integration(this.requestCtx)}get message(){return new iR.Message(this.requestCtx)}get messageAttempt(){return new rR.MessageAttempt(this.requestCtx)}get operationalWebhook(){return new nR.OperationalWebhook(this.requestCtx)}get statistics(){return new pR.Statistics(this.requestCtx)}get streaming(){return new aR.Streaming(this.requestCtx)}get operationalWebhookEndpoint(){return new sR.OperationalWebhookEndpoint(this.requestCtx)}}n.Svix=Wv});class l2{async read(u){let D=typeof u==="string"?{name:u}:u,B=await this.fetch({name:D.name,bucket:D.bucket});if(!B.ok)throw new Z2(D.name);let A=B.headers.get("Content-Type")??"application/octet-stream",F=B.headers.get("ETag")??void 0,w=B.headers.get("Last-Modified"),G=w?new Date(w):void 0;if(D.range){let Z=await B.blob();return{body:Z,start:0,end:Z.size-1,total:Z.size,partial:!1,type:A,etag:F,lastModified:G,name:D.name}}let N=Number(B.headers.get("Content-Length")),$=Number.isFinite(N)?N:0;return{body:B.body,start:0,end:$-1,total:$,partial:!1,type:A,etag:F,lastModified:G,name:D.name}}async size(u){let D=typeof u==="string"?u:u.name,B=typeof u==="string"?void 0:u.bucket,A=await this.fetch({name:D,bucket:B});if(!A.ok)throw new Z2(D);let F=Number(A.headers.get("Content-Length"));if(Number.isFinite(F))return await A.body?.cancel(),F;return(await A.blob()).size}}import{readdir as hK}from"fs/promises";class lu extends l2{folderPath;constructor(u=`${process.env.ROOT_DIR}/storage`){super();this.folderPath=u}async put(u){let D,B;if(u instanceof Blob)D=u,B=`${Bun.randomUUIDv7()}.${u.type.split("/")[1].split(";")[0]}`;else D=u.body,B=u.name;let A=D instanceof Buffer?D:D instanceof Blob||D instanceof File?Buffer.from(await D.arrayBuffer()):"",F=`${this.folderPath}/${B}`;return await Bun.write(F,A),B}async fetch(u){let D=process.env.BUCKET_NAME,B;if(typeof u==="string")B=u;else D=u.bucket??D,B=u.name;if(!B)throw Error("Object name has to be specified");let A=`${this.folderPath}/${B}`,F=Bun.file(A),w=Bun.file(A).stream(),G=new Date(F.lastModified).toUTCString();return new Response(w,{headers:{"Content-Type":F.type,"Content-Length":String(F.size),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":G}})}async read(u){let D=typeof u==="string"?{name:u}:u,{name:B,range:A=null}=D;if(!B)throw Error("Object name has to be specified");let F=Bun.file(`${this.folderPath}/${B}`);if(!await F.exists())throw new Z2(B);let w=F.size,G=A?wu(A,w):null;if(A&&!G)throw new d2(w);let N=G?.start??0,$=G?G.end:w-1;return{body:G?F.slice(N,$+1):F,start:N,end:$,total:w,partial:Boolean(G),type:F.type||"application/octet-stream",lastModified:new Date(F.lastModified),name:B}}async size(u){let D=typeof u==="string"?u:u.name,B=Bun.file(`${this.folderPath}/${D}`);if(!await B.exists())throw new Z2(D);return B.size}async list(){return await hK(this.folderPath)}}class a5 extends f{driver=new lu;boot(){}}var s5=W(g2(),1);function xK(u){return(D)=>async(B)=>{let{request:A}=B;if(u.expectContinueHeader!==!1&&s5.HttpRequest.isInstance(A)&&A.body&&u.runtime==="node"&&u.requestHandler?.constructor?.name!=="FetchHttpHandler"){let F=!0;if(typeof u.expectContinueHeader==="number")try{F=(Number(A.headers?.["content-length"])??u.bodyLengthChecker?.(A.body)??1/0)>=u.expectContinueHeader}catch(w){}else F=!!u.expectContinueHeader;if(F)A.headers.Expect="100-continue"}return D({...B,request:A})}}var HK={step:"build",tags:["SET_EXPECT_HEADER","EXPECT_HEADER"],name:"addExpectContinueMiddleware",override:!0},t5=(u)=>({applyToStack:(D)=>{D.add(xK(u),HK)}});var S2={WHEN_SUPPORTED:"WHEN_SUPPORTED",WHEN_REQUIRED:"WHEN_REQUIRED"},du=S2.WHEN_SUPPORTED,N0={WHEN_SUPPORTED:"WHEN_SUPPORTED",WHEN_REQUIRED:"WHEN_REQUIRED"},iu=S2.WHEN_SUPPORTED,V;(function(u){u.MD5="MD5",u.CRC32="CRC32",u.CRC32C="CRC32C",u.CRC64NVME="CRC64NVME",u.SHA1="SHA1",u.SHA256="SHA256"})(V||(V={}));var o5;(function(u){u.HEADER="header",u.TRAILER="trailer"})(o5||(o5={}));var Gu=V.CRC32;var i2;(function(u){u.ENV="env",u.CONFIG="shared config entry"})(i2||(i2={}));var h0=(u,D,B,A)=>{if(!(D in u))return;let F=u[D].toUpperCase();if(!Object.values(B).includes(F))throw TypeError(`Cannot load ${A} '${D}'. Expected one of ${Object.values(B)}, got '${u[D]}'.`);return F};var SK="AWS_REQUEST_CHECKSUM_CALCULATION",RK="request_checksum_calculation",e5={environmentVariableSelector:(u)=>h0(u,SK,S2,i2.ENV),configFileSelector:(u)=>h0(u,RK,S2,i2.CONFIG),default:du};var UK="AWS_RESPONSE_CHECKSUM_VALIDATION",MK="response_checksum_validation",u4={environmentVariableSelector:(u)=>h0(u,UK,N0,i2.ENV),configFileSelector:(u)=>h0(u,MK,N0,i2.CONFIG),default:iu};var x0=W(H0(),1),Q4=W(g2(),1),Y4=W(ou(),1);var D4=(u,{requestChecksumRequired:D,requestAlgorithmMember:B,requestChecksumCalculation:A})=>{if(!B)return A===S2.WHEN_SUPPORTED||D?Gu:void 0;if(!u[B])return;return u[B]};var $0=(u)=>u===V.MD5?"content-md5":`x-amz-checksum-${u.toLowerCase()}`;var B4=(u,D)=>{let B=u.toLowerCase();for(let A of Object.keys(D))if(B===A.toLowerCase())return!0;return!1};var A4=(u,D)=>{let B=u.toLowerCase();for(let A of Object.keys(D))if(A.toLowerCase().startsWith(B))return!0;return!1};var F4=W(LK(),1),ru=(u)=>u!==void 0&&typeof u!=="string"&&!ArrayBuffer.isView(u)&&!F4.isArrayBuffer(u);var w4=W(EK(),1),{__extends:WM,__assign:vM,__rest:KM,__decorate:hM,__param:xM,__esDecorate:HM,__runInitializers:SM,__propKey:RM,__setFunctionName:UM,__metadata:MM,__awaiter:nu,__generator:pu,__exportStar:LM,__createBinding:EM,__values:au,__read:OM,__spread:CM,__spreadArrays:PM,__spreadArray:cM,__await:VM,__asyncGenerator:kM,__asyncDelegator:yM,__asyncValues:TM,__makeTemplateObject:IM,__importStar:qM,__importDefault:_M,__classPrivateFieldGet:mM,__classPrivateFieldSet:gM,__classPrivateFieldIn:fM,__addDisposableResource:bM,__disposeResources:jM,__rewriteRelativeImportExtension:lM}=w4.default;import{Buffer as G4}from"buffer";var N4=(u,D)=>{if(typeof u!=="string")throw TypeError(`The "input" argument must be of type string. Received type ${typeof u} (${u})`);return D?G4.from(u,D):G4.from(u)};var m3=(u)=>{let D=N4(u,"utf8");return new Uint8Array(D.buffer,D.byteOffset,D.byteLength/Uint8Array.BYTES_PER_ELEMENT)};var OK=typeof Buffer<"u"&&Buffer.from?function(u){return Buffer.from(u,"utf8")}:m3;function Nu(u){if(u instanceof Uint8Array)return u;if(typeof u==="string")return OK(u);if(ArrayBuffer.isView(u))return new Uint8Array(u.buffer,u.byteOffset,u.byteLength/Uint8Array.BYTES_PER_ELEMENT);return new Uint8Array(u)}function $u(u){if(typeof u==="string")return u.length===0;return u.byteLength===0}function z0(u){return new Uint8Array([(u&4278190080)>>24,(u&16711680)>>16,(u&65280)>>8,u&255])}function zu(u){if(!Uint32Array.from){var D=new Uint32Array(u.length),B=0;while(B<u.length)D[B]=u[B],B+=1;return D}return Uint32Array.from(u)}var f3=function(){function u(){this.crc32c=new g3}return u.prototype.update=function(D){if($u(D))return;this.crc32c.update(Nu(D))},u.prototype.digest=function(){return nu(this,void 0,void 0,function(){return pu(this,function(D){return[2,z0(this.crc32c.digest())]})})},u.prototype.reset=function(){this.crc32c=new g3},u}();var g3=function(){function u(){this.checksum=4294967295}return u.prototype.update=function(D){var B,A;try{for(var F=au(D),w=F.next();!w.done;w=F.next()){var G=w.value;this.checksum=this.checksum>>>8^PK[(this.checksum^G)&255]}}catch(N){B={error:N}}finally{try{if(w&&!w.done&&(A=F.return))A.call(F)}finally{if(B)throw B.error}}return this},u.prototype.digest=function(){return(this.checksum^4294967295)>>>0},u}();var CK=[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],PK=zu(CK);var cK=()=>{let D=[,,,,,,,,];for(let B=0;B<8;B++){let A=Array(512);for(let F=0;F<256;F++){let w=BigInt(F);for(let G=0;G<8*(B+1);G++)if(w&1n)w=w>>1n^0x9a6c9329ac4bc9b5n;else w=w>>1n;A[F*2]=Number(w>>32n&0xffffffffn),A[F*2+1]=Number(w&0xffffffffn)}D[B]=new Uint32Array(A)}return D},b3,Zu,j3,l3,d3,i3,r3,n3,p3,VK=()=>{if(!b3)b3=cK(),[Zu,j3,l3,d3,i3,r3,n3,p3]=b3};class a3{c1=0;c2=0;constructor(){VK(),this.reset()}update(u){let D=u.length,B=0,A=this.c1,F=this.c2;while(B+8<=D){let w=((F^u[B++])&255)<<1,G=((F>>>8^u[B++])&255)<<1,N=((F>>>16^u[B++])&255)<<1,$=((F>>>24^u[B++])&255)<<1,Z=((A^u[B++])&255)<<1,Y=((A>>>8^u[B++])&255)<<1,J=((A>>>16^u[B++])&255)<<1,Q=((A>>>24^u[B++])&255)<<1;A=p3[w]^n3[G]^r3[N]^i3[$]^d3[Z]^l3[Y]^j3[J]^Zu[Q],F=p3[w+1]^n3[G+1]^r3[N+1]^i3[$+1]^d3[Z+1]^l3[Y+1]^j3[J+1]^Zu[Q+1]}while(B<D){let w=((F^u[B])&255)<<1;F=(F>>>8|(A&255)<<24)>>>0,A=A>>>8^Zu[w],F^=Zu[w+1],B++}this.c1=A,this.c2=F}async digest(){let u=this.c1^4294967295,D=this.c2^4294967295;return new Uint8Array([u>>>24,u>>>16&255,u>>>8&255,u&255,D>>>24,D>>>16&255,D>>>8&255,D&255])}reset(){this.c1=4294967295,this.c2=4294967295}}var s3={CrtCrc64Nvme:null};var t3=function(){function u(){this.crc32=new Z0}return u.prototype.update=function(D){if($u(D))return;this.crc32.update(Nu(D))},u.prototype.digest=function(){return nu(this,void 0,void 0,function(){return pu(this,function(D){return[2,z0(this.crc32.digest())]})})},u.prototype.reset=function(){this.crc32=new Z0},u}();var Z0=function(){function u(){this.checksum=4294967295}return u.prototype.update=function(D){var B,A;try{for(var F=au(D),w=F.next();!w.done;w=F.next()){var G=w.value;this.checksum=this.checksum>>>8^yK[(this.checksum^G)&255]}}catch(N){B={error:N}}finally{try{if(w&&!w.done&&(A=F.return))A.call(F)}finally{if(B)throw B.error}}return this},u.prototype.digest=function(){return(this.checksum^4294967295)>>>0},u}();var kK=[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],yK=zu(kK);import*as o3 from"zlib";class $4{checksum=0;update(u){this.checksum=o3.crc32(u,this.checksum)}async digest(){return z0(this.checksum)}reset(){this.checksum=0}}var z4=()=>{if(typeof o3.crc32>"u")return t3;return $4};var Z4=[V.CRC32,V.CRC32C,V.CRC64NVME,V.SHA1,V.SHA256],e3=[V.SHA256,V.SHA1,V.CRC32,V.CRC32C,V.CRC64NVME];var su=(u,D)=>{let{checksumAlgorithms:B={}}=D;switch(u){case V.MD5:return B?.MD5??D.md5;case V.CRC32:return B?.CRC32??z4();case V.CRC32C:return B?.CRC32C??f3;case V.CRC64NVME:if(typeof s3.CrtCrc64Nvme!=="function")return B?.CRC64NVME??a3;return B?.CRC64NVME??s3.CrtCrc64Nvme;case V.SHA1:return B?.SHA1??D.sha1;case V.SHA256:return B?.SHA256??D.sha256;default:if(B?.[u])return B[u];throw Error(`The checksum algorithm "${u}" is not supported by the client. Select one of ${Z4}, or provide an implementation to the client constructor checksums field.`)}};var J4=W(uD(),1),tu=(u,D)=>{let B=new u;return B.update(J4.toUint8Array(D||"")),B.digest()};var X4={name:"flexibleChecksumsMiddleware",step:"build",tags:["BODY_CHECKSUM"],override:!0},W4=(u,D)=>(B,A)=>async(F)=>{if(!Q4.HttpRequest.isInstance(F.request))return B(F);if(A4("x-amz-checksum-",F.request.headers))return B(F);let{request:w,input:G}=F,{body:N,headers:$}=w,{base64Encoder:Z,streamHasher:Y}=u,{requestChecksumRequired:J,requestAlgorithmMember:Q}=D,X=await u.requestChecksumCalculation(),v=Q?.name,L=Q?.httpHeader;if(v&&!G[v]){if(X===S2.WHEN_SUPPORTED||J){if(G[v]=Gu,L)$[L]=Gu}}let x=D4(G,{requestChecksumRequired:J,requestAlgorithmMember:Q?.name,requestChecksumCalculation:X}),E=N,H=$;if(x){switch(x){case V.CRC32:x0.setFeature(A,"FLEXIBLE_CHECKSUMS_REQ_CRC32","U");break;case V.CRC32C:x0.setFeature(A,"FLEXIBLE_CHECKSUMS_REQ_CRC32C","V");break;case V.CRC64NVME:x0.setFeature(A,"FLEXIBLE_CHECKSUMS_REQ_CRC64","W");break;case V.SHA1:x0.setFeature(A,"FLEXIBLE_CHECKSUMS_REQ_SHA1","X");break;case V.SHA256:x0.setFeature(A,"FLEXIBLE_CHECKSUMS_REQ_SHA256","Y");break}let k=$0(x),g=su(x,u);if(ru(N)){let{getAwsChunkedEncodingStream:y,bodyLengthChecker:H2}=u;E=y(typeof u.requestStreamBufferSize==="number"&&u.requestStreamBufferSize>=8192?Y4.createBufferedReadable(N,u.requestStreamBufferSize,A.logger):N,{base64Encoder:Z,bodyLengthChecker:H2,checksumLocationName:k,checksumAlgorithmFn:g,streamHasher:Y}),H={...$,"content-encoding":$["content-encoding"]?`${$["content-encoding"]},aws-chunked`:"aws-chunked","transfer-encoding":"chunked","x-amz-decoded-content-length":$["content-length"],"x-amz-content-sha256":"STREAMING-UNSIGNED-PAYLOAD-TRAILER","x-amz-trailer":k},delete H["content-length"]}else if(!B4(k,$)){let y=await tu(g,N);H={...$,[k]:Z(y)}}}try{return await B({...F,request:{...w,headers:H,body:E}})}catch(k){if(k instanceof Error&&k.name==="InvalidChunkSizeError")try{if(!k.message.endsWith("."))k.message+=".";k.message+=" Set [requestStreamBufferSize=number e.g. 65_536] in client constructor to instruct AWS SDK to buffer your input stream."}catch(g){}throw k}};var Ju=W(H0(),1);var v4={name:"flexibleChecksumsInputMiddleware",toMiddleware:"serializerMiddleware",relation:"before",tags:["BODY_CHECKSUM"],override:!0},K4=(u,D)=>(B,A)=>async(F)=>{let w=F.input,{requestValidationModeMember:G}=D,N=await u.requestChecksumCalculation(),$=await u.responseChecksumValidation();switch(N){case S2.WHEN_REQUIRED:Ju.setFeature(A,"FLEXIBLE_CHECKSUMS_REQ_WHEN_REQUIRED","a");break;case S2.WHEN_SUPPORTED:Ju.setFeature(A,"FLEXIBLE_CHECKSUMS_REQ_WHEN_SUPPORTED","Z");break}switch($){case N0.WHEN_REQUIRED:Ju.setFeature(A,"FLEXIBLE_CHECKSUMS_RES_WHEN_REQUIRED","c");break;case N0.WHEN_SUPPORTED:Ju.setFeature(A,"FLEXIBLE_CHECKSUMS_RES_WHEN_SUPPORTED","b");break}if(G&&!w[G]){if($===N0.WHEN_SUPPORTED)w[G]="ENABLED"}return B(F)};var R4=W(g2(),1);var eu=(u=[])=>{let D=[],B=e3.length;for(let A of u){let F=e3.indexOf(A);if(F!==-1)D[F]=A;else D[B++]=A}return D.filter(Boolean)};var h4=(u)=>{let D=u.lastIndexOf("-");if(D!==-1){let B=u.slice(D+1);if(!B.startsWith("0")){let A=parseInt(B,10);if(!isNaN(A)&&A>=1&&A<=1e4)return!0}}return!1};var H4=W(ou(),1);var x4=async(u,{checksumAlgorithmFn:D,base64Encoder:B})=>B(await tu(D,u));var S4=async(u,{config:D,responseAlgorithms:B,logger:A})=>{let F=eu(B),{body:w,headers:G}=u;for(let N of F){let $=$0(N),Z=G[$];if(Z){let Y;try{Y=su(N,D)}catch(X){if(N===V.CRC64NVME){A?.warn(`Skipping ${V.CRC64NVME} checksum validation: ${X.message}`);continue}throw X}let{base64Encoder:J}=D;if(ru(w)){u.body=H4.createChecksumStream({expectedChecksum:Z,checksumSourceLocation:$,checksum:new Y,source:w,base64Encoder:J});return}let Q=await x4(w,{checksumAlgorithmFn:Y,base64Encoder:J});if(Q===Z)break;throw Error(`Checksum mismatch: expected "${Q}" but received "${Z}" in response header "${$}".`)}}};var U4={name:"flexibleChecksumsResponseMiddleware",toMiddleware:"deserializerMiddleware",relation:"after",tags:["BODY_CHECKSUM"],override:!0},M4=(u,D)=>(B,A)=>async(F)=>{if(!R4.HttpRequest.isInstance(F.request))return B(F);let w=F.input,G=await B(F),N=G.response,{requestValidationModeMember:$,responseAlgorithms:Z}=D;if($&&w[$]==="ENABLED"){let{clientName:Y,commandName:J}=A,Q=Object.keys(u.checksumAlgorithms??{}).filter((L)=>{let x=$0(L);return N.headers[x]!==void 0}),X=eu([...Z??[],...Q]);if(Y==="S3Client"&&J==="GetObjectCommand"&&X.every((L)=>{let x=$0(L),E=N.headers[x];return!E||h4(E)}))return G;await S4(N,{config:u,responseAlgorithms:X,logger:A.logger})}return G};var u1=(u,D)=>({applyToStack:(B)=>{B.add(W4(u,D),X4),B.addRelativeTo(K4(u,D),v4),B.addRelativeTo(M4(u,D),U4)}});var DD=W(BD(),1);var L4=(u)=>{let{requestChecksumCalculation:D,responseChecksumValidation:B,requestStreamBufferSize:A}=u;return Object.assign(u,{requestChecksumCalculation:DD.normalizeProvider(D??du),responseChecksumValidation:DD.normalizeProvider(B??iu),requestStreamBufferSize:Number(A??0),checksumAlgorithms:u.checksumAlgorithms??{}})};var j1=W(Ux(),1),KB=W(Mx(),1),hB=W(Lx(),1);var E4=W(g2(),1),O4=W(R2(),1),TK="content-length",IK="x-amz-decoded-content-length";function qK(){return(u,D)=>async(B)=>{let{request:A}=B;if(E4.HttpRequest.isInstance(A)){if(!(TK in A.headers)&&!(IK in A.headers))if(typeof D?.logger?.warn==="function"&&!(D.logger instanceof O4.NoOpLogger))D.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 u({...B})}}var _K={step:"finalizeRequest",tags:["CHECK_CONTENT_LENGTH_HEADER"],name:"getCheckContentLengthHeaderPlugin",override:!0},C4=(u)=>({applyToStack:(D)=>{D.add(qK(),_K)}});var P4=(u)=>{return(D,B)=>async(A)=>{let F=await u.region(),w=u.region,G=()=>{};if(B.__s3RegionRedirect)Object.defineProperty(u,"region",{writable:!1,value:async()=>{return B.__s3RegionRedirect}}),G=()=>Object.defineProperty(u,"region",{writable:!0,value:w});try{let N=await D(A);if(B.__s3RegionRedirect){G();let $=await u.region();if(F!==$)throw Error("Region was not restored following S3 region redirect.")}return N}catch(N){throw G(),N}}},c4={tags:["REGION_REDIRECT","S3"],name:"regionRedirectEndpointMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"};function mK(u){return(D,B)=>async(A)=>{try{return await D(A)}catch(F){if(u.followRegionRedirects){let w=F?.$metadata?.httpStatusCode,G=B.commandName==="HeadBucketCommand",N=F?.$response?.headers?.["x-amz-bucket-region"];if(N){if(w===301||w===400&&(F?.name==="IllegalLocationConstraintException"||G)){try{let $=N;B.logger?.debug(`Redirecting from ${await u.region()} to ${$}`),B.__s3RegionRedirect=$}catch($){throw Error("Region redirect failed: "+$)}return D(A)}}}throw F}}}var gK={step:"initialize",tags:["REGION_REDIRECT","S3"],name:"regionRedirectMiddleware",override:!0},V4=(u)=>({applyToStack:(D)=>{D.add(mK(u),gK),D.addRelativeTo(P4(u),c4)}});var k4=W(g2(),1),y4=W(R2(),1),fK=(u)=>{return(D,B)=>async(A)=>{let F=await D(A),{response:w}=F;if(k4.HttpResponse.isInstance(w)){if(w.headers.expires){w.headers.expiresstring=w.headers.expires;try{y4.parseRfc7231DateTime(w.headers.expires)}catch(G){B.logger?.warn(`AWS SDK Warning for ${B.clientName}::${B.commandName} response parsing (${w.headers.expires}): ${G}`),delete w.headers.expires}}}return F}},bK={tags:["S3"],name:"s3ExpiresMiddleware",override:!0,relation:"after",toMiddleware:"deserializerMiddleware"},D1=(u)=>({applyToStack:(D)=>{D.addRelativeTo(fK(u),bK)}});class B1{data;lastPurgeTime=Date.now();static EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS=30000;constructor(u={}){this.data=u}get(u){let D=this.data[u];if(!D)return;return D}set(u,D){return this.data[u]=D,D}delete(u){delete this.data[u]}async purgeExpired(){let u=Date.now();if(this.lastPurgeTime+B1.EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS>u)return;for(let D in this.data){let B=this.data[D];if(!B.isRefreshing){let A=await B.identity;if(A.expiration){if(A.expiration.getTime()<u)delete this.data[D]}}}}}class Qu{_identity;isRefreshing;accessed;constructor(u,D=!1,B=Date.now()){this._identity=u,this.isRefreshing=D,this.accessed=B}get identity(){return this.accessed=Date.now(),this._identity}}class Yu{createSessionFn;cache;static REFRESH_WINDOW_MS=60000;constructor(u,D=new B1){this.createSessionFn=u,this.cache=D}async getS3ExpressIdentity(u,D){let B=D.Bucket,{cache:A}=this,F=A.get(B);if(F)return F.identity.then((w)=>{if((w.expiration?.getTime()??0)<Date.now())return A.set(B,new Qu(this.getIdentity(B))).identity;if((w.expiration?.getTime()??0)<Date.now()+Yu.REFRESH_WINDOW_MS&&!F.isRefreshing)F.isRefreshing=!0,this.getIdentity(B).then(($)=>{A.set(B,new Qu(Promise.resolve($)))});return w});return A.set(B,new Qu(this.getIdentity(B))).identity}async getIdentity(u){await this.cache.purgeExpired().catch((A)=>{console.warn(`Error while clearing expired entries in S3ExpressIdentityCache:
4
+ `+A)});let D=await this.createSessionFn(u);if(!D.Credentials?.AccessKeyId||!D.Credentials?.SecretAccessKey)throw Error("s3#createSession response credential missing AccessKeyId or SecretAccessKey.");return{accessKeyId:D.Credentials.AccessKeyId,secretAccessKey:D.Credentials.SecretAccessKey,sessionToken:D.Credentials.SessionToken,expiration:D.Credentials.Expiration?new Date(D.Credentials.Expiration):void 0}}}var b4=W(f4(),1);var S0=W(T4(),1),I4="Directory",q4="S3Express",_4="sigv4-s3express",A1="X-Amz-S3session-Token",Xu=A1.toLowerCase(),jK="AWS_S3_DISABLE_EXPRESS_SESSION_AUTH",lK="s3_disable_express_session_auth",AD={environmentVariableSelector:(u)=>S0.booleanSelector(u,jK,S0.SelectorType.ENV),configFileSelector:(u)=>S0.booleanSelector(u,lK,S0.SelectorType.CONFIG),default:!1};class F1 extends b4.SignatureV4{async signWithCredentials(u,D,B){let A=m4(D);u.headers[Xu]=D.sessionToken;let F=this;return g4(F,A),F.signRequest(u,B??{})}async presignWithCredentials(u,D,B){let A=m4(D);return delete u.headers[Xu],u.headers[A1]=D.sessionToken,u.query=u.query??{},u.query[A1]=D.sessionToken,g4(this,A),this.presign(u,B)}}function m4(u){return{accessKeyId:u.accessKeyId,secretAccessKey:u.secretAccessKey,expiration:u.expiration}}function g4(u,D){let B=setTimeout(()=>{throw Error("SignatureV4S3Express credential override was created but not called.")},10),A=u.credentialProvider,F=()=>{return clearTimeout(B),u.credentialProvider=A,Promise.resolve(D)};u.credentialProvider=F}var j4=W(H0(),1),l4=W(g2(),1);var d4=(u)=>{return(D,B)=>async(A)=>{if(B.endpointV2){let F=B.endpointV2,w=F.properties?.authSchemes?.[0]?.name===_4;if(F.properties?.backend===q4||F.properties?.bucketType===I4)j4.setFeature(B,"S3_EXPRESS_BUCKET","J"),B.isS3ExpressBucket=!0;if(w){let N=A.input.Bucket;if(N){let $=await u.s3ExpressIdentityProvider.getS3ExpressIdentity(await u.credentials(),{Bucket:N});if(B.s3ExpressIdentity=$,l4.HttpRequest.isInstance(A.request)&&$.sessionToken)A.request.headers[Xu]=$.sessionToken}}}return D(A)}},i4={name:"s3ExpressMiddleware",step:"build",tags:["S3","S3_EXPRESS"],override:!0},FD=(u)=>({applyToStack:(D)=>{D.add(d4(u),i4)}});var p4=W(n4(),1),a4=W(g2(),1),s4=W(BD(),1);var r4=async(u,D,B,A)=>{let F=await A.signWithCredentials(B,u,{});if(F.headers["X-Amz-Security-Token"]||F.headers["x-amz-security-token"])throw Error("X-Amz-Security-Token must not be set for s3-express requests.");return F};var dK=(u)=>(D)=>{throw D},iK=(u,D)=>{};var t4=(u)=>(D,B)=>async(A)=>{if(!a4.HttpRequest.isInstance(A.request))return D(A);let w=s4.getSmithyContext(B).selectedHttpAuthScheme;if(!w)throw Error("No HttpAuthScheme was selected: unable to sign request");let{httpAuthOption:{signingProperties:G={}},identity:N,signer:$}=w,Z;if(B.s3ExpressIdentity)Z=await r4(B.s3ExpressIdentity,G,A.request,await u.signer());else Z=await $.sign(A.request,N,G);let Y=await D({...A,request:Z}).catch(($.errorHandler||dK)(G));return($.successHandler||iK)(Y.response,G),Y},wD=(u)=>({applyToStack:(D)=>{D.addRelativeTo(t4(u),p4.httpSigningMiddlewareOptions)}});var o4=(u,{session:D})=>{let[B,A]=D,{forcePathStyle:F,useAccelerateEndpoint:w,disableMultiregionAccessPoints:G,followRegionRedirects:N,s3ExpressIdentityProvider:$,bucketEndpoint:Z,expectContinueHeader:Y}=u;return Object.assign(u,{forcePathStyle:F??!1,useAccelerateEndpoint:w??!1,disableMultiregionAccessPoints:G??!1,followRegionRedirects:N??!1,s3ExpressIdentityProvider:$??new Yu(async(J)=>B().send(new A({Bucket:J}))),bucketEndpoint:Z??!1,expectContinueHeader:Y??2097152})};var e4=W(g2(),1),w1=W(ou(),1),rK={CopyObjectCommand:!0,UploadPartCopyCommand:!0,CompleteMultipartUploadCommand:!0},nK=3000,pK=(u)=>(D,B)=>async(A)=>{let F=await D(A),{response:w}=F;if(!e4.HttpResponse.isInstance(w))return F;let{statusCode:G,body:N}=w;if(G<200||G>=300)return F;if(!(typeof N?.stream==="function"||typeof N?.pipe==="function"||typeof N?.tee==="function"))return F;let Z=N,Y=N;if(N&&typeof N==="object"&&!(N instanceof Uint8Array))[Z,Y]=await w1.splitStream(N);w.body=Y;let J=await aK(Z,{streamCollector:async(X)=>{return w1.headStream(X,nK)}});if(typeof Z?.destroy==="function")Z.destroy();let Q=u.utf8Encoder(J.subarray(J.length-16));if(J.length===0&&rK[B.commandName]){let X=Error("S3 aborted request");throw X.name="InternalError",X}if(Q&&Q.endsWith("</Error>"))w.statusCode=400;return F},aK=(u=new Uint8Array,D)=>{if(u instanceof Uint8Array)return Promise.resolve(u);return D.streamCollector(u)||Promise.resolve(new Uint8Array)},sK={relation:"after",toMiddleware:"deserializerMiddleware",tags:["THROW_200_EXCEPTIONS","S3"],name:"throw200ExceptionsMiddleware",override:!0},r2=(u)=>({applyToStack:(D)=>{D.addRelativeTo(pK(u),sK)}});var u9=(u)=>typeof u==="string"&&u.indexOf("arn:")===0&&u.split(":").length>=6;function D9(u){return(D,B)=>async(A)=>{if(u.bucketEndpoint){let F=B.endpointV2;if(F){let w=A.input.Bucket;if(typeof w==="string")try{let G=new URL(w);B.endpointV2={...F,url:G}}catch(G){let N=`@aws-sdk/middleware-sdk-s3: bucketEndpoint=true was set but Bucket=${w} could not be parsed as URL.`;if(B.logger?.constructor?.name==="NoOpLogger")console.warn(N);else B.logger?.warn?.(N);throw G}}}return D(A)}}var B9={name:"bucketEndpointMiddleware",override:!0,relation:"after",toMiddleware:"endpointV2Middleware"};function tK({bucketEndpoint:u}){return(D)=>async(B)=>{let{input:{Bucket:A}}=B;if(!u&&typeof A==="string"&&!u9(A)&&A.indexOf("/")>=0){let F=Error(`Bucket name shouldn't contain '/', received '${A}'`);throw F.name="InvalidBucketName",F}return D({...B})}}var oK={step:"initialize",tags:["VALIDATE_BUCKET_NAME"],name:"validateBucketNameMiddleware",override:!0},A9=(u)=>({applyToStack:(D)=>{D.add(tK(u),oK),D.addRelativeTo(D9(u),B9)}});var l1=W(Ex(),1),xB=W($B(),1),V0=W(n4(),1),HB=W(R6(),1);var F9=(u)=>Object.assign(u,{eventStreamMarshaller:u.eventStreamSerdeProvider(u)});var SB=W(Ox(),1),RB=W(J0(),1),d1=W(zB(),1),UB=W(R2(),1);var J1=W(H0(),1);var GD=W(f4(),1);var Wu={CrtSignerV4:null};class vu{sigv4aSigner;sigv4Signer;signerOptions;static sigv4aDependency(){if(typeof Wu.CrtSignerV4==="function")return"crt";else if(typeof GD.signatureV4aContainer.SignatureV4a==="function")return"js";return"none"}constructor(u){this.sigv4Signer=new F1(u),this.signerOptions=u}async sign(u,D={}){if(D.signingRegion==="*")return this.getSigv4aSigner().sign(u,D);return this.sigv4Signer.sign(u,D)}async signWithCredentials(u,D,B={}){if(B.signingRegion==="*"){let A=this.getSigv4aSigner(),F=Wu.CrtSignerV4;if(F&&A instanceof F)return A.signWithCredentials(u,D,B);else throw Error(`signWithCredentials with signingRegion '*' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. You 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";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt`)}return this.sigv4Signer.signWithCredentials(u,D,B)}async presign(u,D={}){if(D.signingRegion==="*"){let B=this.getSigv4aSigner(),A=Wu.CrtSignerV4;if(A&&B instanceof A)return B.presign(u,D);else throw Error(`presign with signingRegion '*' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. You 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";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt`)}return this.sigv4Signer.presign(u,D)}async presignWithCredentials(u,D,B={}){if(B.signingRegion==="*")throw Error("Method presignWithCredentials is not supported for [signingRegion=*].");return this.sigv4Signer.presignWithCredentials(u,D,B)}getSigv4aSigner(){if(!this.sigv4aSigner){let u=Wu.CrtSignerV4,D=GD.signatureV4aContainer.SignatureV4a;if(this.signerOptions.runtime==="node"){if(!u&&!D)throw Error("Neither CRT nor JS SigV4a implementation is available. Please load either @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt");if(u&&typeof u==="function")this.sigv4aSigner=new u({...this.signerOptions,signingAlgorithm:1});else if(D&&typeof D==="function")this.sigv4aSigner=new D({...this.signerOptions});else throw Error("Available SigV4a implementation is not a valid constructor. Please ensure you've properly imported @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a.For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt")}else{if(!D||typeof D!=="function")throw Error("JS SigV4a implementation is not available or not a valid constructor. Please check whether you have installed the @aws-sdk/signature-v4a package explicitly. The CRT implementation is not available for browsers. You must also register the package by calling [require('@aws-sdk/signature-v4a');] or an ESM equivalent such as [import '@aws-sdk/signature-v4a';]. For more information please go to https://github.com/aws/aws-sdk-js-v3#using-javascript-non-crt-implementation-of-sigv4a");this.sigv4aSigner=new D({...this.signerOptions})}}return this.sigv4aSigner}}var Y6=W(J0(),1),E0=W(BD(),1);var Q6=W(zh(),1),L0=W($h(),1);var R0={["required"]:!1,["type"]:"string"},U0={["required"]:!0,default:!1,["type"]:"boolean"},Ku={["required"]:!1,["type"]:"boolean"},M2={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"Accelerate"},!0]},I={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseFIPS"},!0]},T={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseDualStack"},!0]},j={["fn"]:"isSet",["argv"]:[{["ref"]:"Endpoint"}]},F6={["fn"]:"aws.partition",["argv"]:[{["ref"]:"Region"}],["assign"]:"partitionResult"},w9={["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[{["ref"]:"partitionResult"},"name"]},"aws-cn"]},xu={["fn"]:"isSet",["argv"]:[{["ref"]:"Bucket"}]},C={["ref"]:"Bucket"},G9={["conditions"]:[M2],["error"]:"S3Express does not support S3 Accelerate.",["type"]:"error"},N9={["conditions"]:[j,{["fn"]:"parseURL",["argv"]:[{["ref"]:"Endpoint"}],["assign"]:"url"}],["rules"]:[{["conditions"]:[{["fn"]:"isSet",["argv"]:[{["ref"]:"DisableS3ExpressSessionAuth"}]},{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"DisableS3ExpressSessionAuth"},!0]}],["rules"]:[{["conditions"]:[{["fn"]:"booleanEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[{["ref"]:"url"},"isIp"]},!0]}],["rules"]:[{["conditions"]:[{["fn"]:"uriEncode",["argv"]:[C],["assign"]:"uri_encoded_bucket"}],["rules"]:[{["endpoint"]:{["url"]:"{url#scheme}://{url#authority}/{uri_encoded_bucket}{url#path}",["properties"]:{["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},["headers"]:{}},["type"]:"endpoint"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"aws.isVirtualHostableS3Bucket",["argv"]:[C,!1]}],["rules"]:[{["endpoint"]:{["url"]:"{url#scheme}://{Bucket}.{url#authority}{url#path}",["properties"]:{["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},["headers"]:{}},["type"]:"endpoint"}],["type"]:"tree"},{["error"]:"S3Express bucket name is not a valid virtual hostable name.",["type"]:"error"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"booleanEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[{["ref"]:"url"},"isIp"]},!0]}],["rules"]:[{["conditions"]:[{["fn"]:"uriEncode",["argv"]:[C],["assign"]:"uri_encoded_bucket"}],["rules"]:[{["endpoint"]:{["url"]:"{url#scheme}://{url#authority}/{uri_encoded_bucket}{url#path}",["properties"]:{["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4-s3express",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},["headers"]:{}},["type"]:"endpoint"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"aws.isVirtualHostableS3Bucket",["argv"]:[C,!1]}],["rules"]:[{["endpoint"]:{["url"]:"{url#scheme}://{Bucket}.{url#authority}{url#path}",["properties"]:{["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4-s3express",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},["headers"]:{}},["type"]:"endpoint"}],["type"]:"tree"},{["error"]:"S3Express bucket name is not a valid virtual hostable name.",["type"]:"error"}],["type"]:"tree"},$2={["fn"]:"parseURL",["argv"]:[{["ref"]:"Endpoint"}],["assign"]:"url"},ND={["fn"]:"booleanEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[{["ref"]:"url"},"isIp"]},!0]},w6={["ref"]:"url"},G6={["fn"]:"uriEncode",["argv"]:[C],["assign"]:"uri_encoded_bucket"},v2={["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},K={},N6={["fn"]:"aws.isVirtualHostableS3Bucket",["argv"]:[C,!1]},$9={["error"]:"S3Express bucket name is not a valid virtual hostable name.",["type"]:"error"},z9={["fn"]:"isSet",["argv"]:[{["ref"]:"UseS3ExpressControlEndpoint"}]},Z9={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseS3ExpressControlEndpoint"},!0]},h={["fn"]:"not",["argv"]:[j]},U={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseDualStack"},!1]},S={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseFIPS"},!1]},G1={["error"]:"Unrecognized S3Express bucket name format.",["type"]:"error"},J9={["fn"]:"not",["argv"]:[xu]},Q9={["ref"]:"hardwareType"},Y9={["conditions"]:[h],["error"]:"Expected a endpoint to be specified but no endpoint was found",["type"]:"error"},N1={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4a",["signingName"]:"s3-outposts",["signingRegionSet"]:["*"]},{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3-outposts",["signingRegion"]:"{Region}"}]},$D={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"ForcePathStyle"},!1]},eK={["ref"]:"ForcePathStyle"},l={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"Accelerate"},!1]},p={["fn"]:"stringEquals",["argv"]:[{["ref"]:"Region"},"aws-global"]},t={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3",["signingRegion"]:"us-east-1"}]},O={["fn"]:"not",["argv"]:[p]},o={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseGlobalEndpoint"},!0]},X9={["url"]:"https://{Bucket}.s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:{["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3",["signingRegion"]:"{Region}"}]},["headers"]:{}},d={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3",["signingRegion"]:"{Region}"}]},e={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseGlobalEndpoint"},!1]},W9={["url"]:"https://{Bucket}.s3-fips.{Region}.{partitionResult#dnsSuffix}",["properties"]:d,["headers"]:{}},v9={["url"]:"https://{Bucket}.s3-accelerate.dualstack.{partitionResult#dnsSuffix}",["properties"]:d,["headers"]:{}},K9={["url"]:"https://{Bucket}.s3.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:d,["headers"]:{}},zD={["fn"]:"booleanEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[w6,"isIp"]},!1]},ZD={["url"]:"{url#scheme}://{url#authority}{url#normalizedPath}{Bucket}",["properties"]:d,["headers"]:{}},cD={["url"]:"{url#scheme}://{Bucket}.{url#authority}{url#path}",["properties"]:d,["headers"]:{}},h9={["endpoint"]:cD,["type"]:"endpoint"},JD={["url"]:"https://{Bucket}.s3-accelerate.{partitionResult#dnsSuffix}",["properties"]:d,["headers"]:{}},x9={["url"]:"https://{Bucket}.s3.{Region}.{partitionResult#dnsSuffix}",["properties"]:d,["headers"]:{}},$1={["error"]:"Invalid region: region was not a valid DNS name.",["type"]:"error"},J2={["ref"]:"bucketArn"},$6={["ref"]:"arnType"},QD={["fn"]:"getAttr",["argv"]:[J2,"service"]},VD={["ref"]:"accessPointName"},H9={["conditions"]:[T],["error"]:"S3 Object Lambda does not support Dual-stack",["type"]:"error"},S9={["conditions"]:[M2],["error"]:"S3 Object Lambda does not support S3 Accelerate",["type"]:"error"},R9={["conditions"]:[{["fn"]:"isSet",["argv"]:[{["ref"]:"DisableAccessPoints"}]},{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"DisableAccessPoints"},!0]}],["error"]:"Access points are not supported for this operation",["type"]:"error"},YD={["conditions"]:[{["fn"]:"isSet",["argv"]:[{["ref"]:"UseArnRegion"}]},{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseArnRegion"},!1]},{["fn"]:"not",["argv"]:[{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[J2,"region"]},"{Region}"]}]}],["error"]:"Invalid configuration: region from ARN `{bucketArn#region}` does not match client region `{Region}` and UseArnRegion is `false`",["type"]:"error"},z6={["fn"]:"getAttr",["argv"]:[{["ref"]:"bucketPartition"},"name"]},Z6={["fn"]:"getAttr",["argv"]:[J2,"accountId"]},XD={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3-object-lambda",["signingRegion"]:"{bucketArn#region}"}]},U9={["error"]:"Invalid ARN: The access point name may only contain a-z, A-Z, 0-9 and `-`. Found: `{accessPointName}`",["type"]:"error"},WD={["error"]:"Invalid ARN: The account id may only contain a-z, A-Z, 0-9 and `-`. Found: `{bucketArn#accountId}`",["type"]:"error"},vD={["error"]:"Invalid region in ARN: `{bucketArn#region}` (invalid DNS name)",["type"]:"error"},KD={["error"]:"Client was configured for partition `{partitionResult#name}` but ARN (`{Bucket}`) has `{bucketPartition#name}`",["type"]:"error"},M9={["error"]:"Invalid ARN: The ARN may only contain a single resource component after `accesspoint`.",["type"]:"error"},L9={["error"]:"Invalid ARN: Expected a resource of the format `accesspoint:<accesspoint name>` but no name was provided",["type"]:"error"},hu={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3",["signingRegion"]:"{bucketArn#region}"}]},E9={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4a",["signingName"]:"s3-outposts",["signingRegionSet"]:["*"]},{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3-outposts",["signingRegion"]:"{bucketArn#region}"}]},O9={["fn"]:"aws.parseArn",["argv"]:[C]},C9={["url"]:"https://s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:d,["headers"]:{}},P9={["url"]:"https://s3-fips.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:d,["headers"]:{}},c9={["url"]:"https://s3.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:d,["headers"]:{}},hD={["url"]:"{url#scheme}://{url#authority}{url#normalizedPath}{uri_encoded_bucket}",["properties"]:d,["headers"]:{}},V9={["url"]:"https://s3.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:d,["headers"]:{}},k9={["ref"]:"UseObjectLambdaEndpoint"},xD={["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4",["signingName"]:"s3-object-lambda",["signingRegion"]:"{Region}"}]},y9={["url"]:"https://s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:d,["headers"]:{}},T9={["url"]:"https://s3-fips.{Region}.{partitionResult#dnsSuffix}",["properties"]:d,["headers"]:{}},I9={["url"]:"https://s3.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:d,["headers"]:{}},HD={["url"]:"{url#scheme}://{url#authority}{url#path}",["properties"]:d,["headers"]:{}},q9={["url"]:"https://s3.{Region}.{partitionResult#dnsSuffix}",["properties"]:d,["headers"]:{}},SD=[{["ref"]:"Region"}],uh=[{["ref"]:"Endpoint"}],Dh=[C],RD=[M2],M0=[j,$2],_9=[{["fn"]:"isSet",["argv"]:[{["ref"]:"DisableS3ExpressSessionAuth"}]},{["fn"]:"booleanEquals",["argv"]:[{["ref"]:"DisableS3ExpressSessionAuth"},!0]}],Bh=[G6],UD=[N6],U2=[F6],MD=[I,T],Hu=[I,U],Su=[S,T],Ru=[S,U],m9=[{["fn"]:"substring",["argv"]:[C,6,14,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[C,14,16,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],I2=[{["conditions"]:[I,T],["endpoint"]:{["url"]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:v2,["headers"]:{}},["type"]:"endpoint"},{["conditions"]:Hu,["endpoint"]:{["url"]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.{Region}.{partitionResult#dnsSuffix}",["properties"]:v2,["headers"]:{}},["type"]:"endpoint"},{["conditions"]:Su,["endpoint"]:{["url"]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:v2,["headers"]:{}},["type"]:"endpoint"},{["conditions"]:Ru,["endpoint"]:{["url"]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.{Region}.{partitionResult#dnsSuffix}",["properties"]:v2,["headers"]:{}},["type"]:"endpoint"}],g9=[{["fn"]:"substring",["argv"]:[C,6,15,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[C,15,17,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],f9=[{["fn"]:"substring",["argv"]:[C,6,19,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[C,19,21,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],b9=[{["fn"]:"substring",["argv"]:[C,6,20,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[C,20,22,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],j9=[{["fn"]:"substring",["argv"]:[C,6,26,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[C,26,28,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],q2=[{["conditions"]:[I,T],["endpoint"]:{["url"]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:{["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4-s3express",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},["headers"]:{}},["type"]:"endpoint"},{["conditions"]:Hu,["endpoint"]:{["url"]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.{Region}.{partitionResult#dnsSuffix}",["properties"]:{["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4-s3express",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},["headers"]:{}},["type"]:"endpoint"},{["conditions"]:Su,["endpoint"]:{["url"]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:{["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4-s3express",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},["headers"]:{}},["type"]:"endpoint"},{["conditions"]:Ru,["endpoint"]:{["url"]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.{Region}.{partitionResult#dnsSuffix}",["properties"]:{["backend"]:"S3Express",["authSchemes"]:[{["disableDoubleEncoding"]:!0,["name"]:"sigv4-s3express",["signingName"]:"s3express",["signingRegion"]:"{Region}"}]},["headers"]:{}},["type"]:"endpoint"}],l9=[C,0,7,!0],d9=[{["fn"]:"substring",["argv"]:[C,7,15,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[C,15,17,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],i9=[{["fn"]:"substring",["argv"]:[C,7,16,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[C,16,18,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],r9=[{["fn"]:"substring",["argv"]:[C,7,20,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[C,20,22,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],n9=[{["fn"]:"substring",["argv"]:[C,7,21,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[C,21,23,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],p9=[{["fn"]:"substring",["argv"]:[C,7,27,!0],["assign"]:"s3expressAvailabilityZoneId"},{["fn"]:"substring",["argv"]:[C,27,29,!0],["assign"]:"s3expressAvailabilityZoneDelim"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"s3expressAvailabilityZoneDelim"},"--"]}],Ah=[xu],a9=[{["fn"]:"isValidHostLabel",["argv"]:[{["ref"]:"outpostId"},!1]}],s9=[{["fn"]:"stringEquals",["argv"]:[{["ref"]:"regionPrefix"},"beta"]}],Fh=["*"],t9=[{["fn"]:"isValidHostLabel",["argv"]:[{["ref"]:"Region"},!1]}],n2=[{["fn"]:"stringEquals",["argv"]:[{["ref"]:"Region"},"us-east-1"]}],LD=[{["fn"]:"stringEquals",["argv"]:[$6,"accesspoint"]}],o9=[{["fn"]:"getAttr",["argv"]:[J2,"resourceId[1]"],["assign"]:"accessPointName"},{["fn"]:"not",["argv"]:[{["fn"]:"stringEquals",["argv"]:[VD,""]}]}],wh=[J2,"resourceId[1]"],e9=[T],ED=[{["fn"]:"not",["argv"]:[{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[J2,"region"]},""]}]}],u6=[{["fn"]:"not",["argv"]:[{["fn"]:"isSet",["argv"]:[{["fn"]:"getAttr",["argv"]:[J2,"resourceId[2]"]}]}]}],Gh=[J2,"resourceId[2]"],OD=[{["fn"]:"aws.partition",["argv"]:[{["fn"]:"getAttr",["argv"]:[J2,"region"]}],["assign"]:"bucketPartition"}],D6=[{["fn"]:"stringEquals",["argv"]:[z6,{["fn"]:"getAttr",["argv"]:[{["ref"]:"partitionResult"},"name"]}]}],CD=[{["fn"]:"isValidHostLabel",["argv"]:[{["fn"]:"getAttr",["argv"]:[J2,"region"]},!0]}],PD=[{["fn"]:"isValidHostLabel",["argv"]:[Z6,!1]}],B6=[{["fn"]:"isValidHostLabel",["argv"]:[VD,!1]}],z1=[I],A6=[{["fn"]:"isValidHostLabel",["argv"]:[{["ref"]:"Region"},!0]}],Nh={version:"1.0",parameters:{Bucket:R0,Region:R0,UseFIPS:U0,UseDualStack:U0,Endpoint:R0,ForcePathStyle:U0,Accelerate:U0,UseGlobalEndpoint:U0,UseObjectLambdaEndpoint:Ku,Key:R0,Prefix:R0,CopySource:R0,DisableAccessPoints:Ku,DisableMultiRegionAccessPoints:U0,UseArnRegion:Ku,UseS3ExpressControlEndpoint:Ku,DisableS3ExpressSessionAuth:Ku},["rules"]:[{["conditions"]:[{["fn"]:"isSet",["argv"]:SD}],["rules"]:[{["conditions"]:[M2,I],error:"Accelerate cannot be used with FIPS",["type"]:"error"},{["conditions"]:[T,j],error:"Cannot set dual-stack in combination with a custom endpoint.",["type"]:"error"},{["conditions"]:[j,I],error:"A custom endpoint cannot be combined with FIPS",["type"]:"error"},{["conditions"]:[j,M2],error:"A custom endpoint cannot be combined with S3 Accelerate",["type"]:"error"},{["conditions"]:[I,F6,w9],error:"Partition does not support FIPS",["type"]:"error"},{["conditions"]:[xu,{["fn"]:"substring",["argv"]:[C,0,6,!0],["assign"]:"bucketSuffix"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"bucketSuffix"},"--x-s3"]}],["rules"]:[G9,N9,{["conditions"]:[z9,Z9],["rules"]:[{["conditions"]:U2,["rules"]:[{["conditions"]:[G6,h],["rules"]:[{["conditions"]:MD,endpoint:{["url"]:"https://s3express-control-fips.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:v2,["headers"]:K},["type"]:"endpoint"},{["conditions"]:Hu,endpoint:{["url"]:"https://s3express-control-fips.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:v2,["headers"]:K},["type"]:"endpoint"},{["conditions"]:Su,endpoint:{["url"]:"https://s3express-control.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:v2,["headers"]:K},["type"]:"endpoint"},{["conditions"]:Ru,endpoint:{["url"]:"https://s3express-control.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:v2,["headers"]:K},["type"]:"endpoint"}],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:UD,["rules"]:[{["conditions"]:U2,["rules"]:[{["conditions"]:_9,["rules"]:[{["conditions"]:m9,["rules"]:I2,["type"]:"tree"},{["conditions"]:g9,["rules"]:I2,["type"]:"tree"},{["conditions"]:f9,["rules"]:I2,["type"]:"tree"},{["conditions"]:b9,["rules"]:I2,["type"]:"tree"},{["conditions"]:j9,["rules"]:I2,["type"]:"tree"},G1],["type"]:"tree"},{["conditions"]:m9,["rules"]:q2,["type"]:"tree"},{["conditions"]:g9,["rules"]:q2,["type"]:"tree"},{["conditions"]:f9,["rules"]:q2,["type"]:"tree"},{["conditions"]:b9,["rules"]:q2,["type"]:"tree"},{["conditions"]:j9,["rules"]:q2,["type"]:"tree"},G1],["type"]:"tree"}],["type"]:"tree"},$9],["type"]:"tree"},{["conditions"]:[xu,{["fn"]:"substring",["argv"]:l9,["assign"]:"accessPointSuffix"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"accessPointSuffix"},"--xa-s3"]}],["rules"]:[G9,N9,{["conditions"]:UD,["rules"]:[{["conditions"]:U2,["rules"]:[{["conditions"]:_9,["rules"]:[{["conditions"]:d9,["rules"]:I2,["type"]:"tree"},{["conditions"]:i9,["rules"]:I2,["type"]:"tree"},{["conditions"]:r9,["rules"]:I2,["type"]:"tree"},{["conditions"]:n9,["rules"]:I2,["type"]:"tree"},{["conditions"]:p9,["rules"]:I2,["type"]:"tree"},G1],["type"]:"tree"},{["conditions"]:d9,["rules"]:q2,["type"]:"tree"},{["conditions"]:i9,["rules"]:q2,["type"]:"tree"},{["conditions"]:r9,["rules"]:q2,["type"]:"tree"},{["conditions"]:n9,["rules"]:q2,["type"]:"tree"},{["conditions"]:p9,["rules"]:q2,["type"]:"tree"},G1],["type"]:"tree"}],["type"]:"tree"},$9],["type"]:"tree"},{["conditions"]:[J9,z9,Z9],["rules"]:[{["conditions"]:U2,["rules"]:[{["conditions"]:M0,endpoint:{["url"]:"{url#scheme}://{url#authority}{url#path}",["properties"]:v2,["headers"]:K},["type"]:"endpoint"},{["conditions"]:MD,endpoint:{["url"]:"https://s3express-control-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:v2,["headers"]:K},["type"]:"endpoint"},{["conditions"]:Hu,endpoint:{["url"]:"https://s3express-control-fips.{Region}.{partitionResult#dnsSuffix}",["properties"]:v2,["headers"]:K},["type"]:"endpoint"},{["conditions"]:Su,endpoint:{["url"]:"https://s3express-control.dualstack.{Region}.{partitionResult#dnsSuffix}",["properties"]:v2,["headers"]:K},["type"]:"endpoint"},{["conditions"]:Ru,endpoint:{["url"]:"https://s3express-control.{Region}.{partitionResult#dnsSuffix}",["properties"]:v2,["headers"]:K},["type"]:"endpoint"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[xu,{["fn"]:"substring",["argv"]:[C,49,50,!0],["assign"]:"hardwareType"},{["fn"]:"substring",["argv"]:[C,8,12,!0],["assign"]:"regionPrefix"},{["fn"]:"substring",["argv"]:l9,["assign"]:"bucketAliasSuffix"},{["fn"]:"substring",["argv"]:[C,32,49,!0],["assign"]:"outpostId"},{["fn"]:"aws.partition",["argv"]:SD,["assign"]:"regionPartition"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"bucketAliasSuffix"},"--op-s3"]}],["rules"]:[{["conditions"]:a9,["rules"]:[{["conditions"]:UD,["rules"]:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Q9,"e"]}],["rules"]:[{["conditions"]:s9,["rules"]:[Y9,{["conditions"]:M0,endpoint:{["url"]:"https://{Bucket}.ec2.{url#authority}",["properties"]:N1,["headers"]:K},["type"]:"endpoint"}],["type"]:"tree"},{endpoint:{["url"]:"https://{Bucket}.ec2.s3-outposts.{Region}.{regionPartition#dnsSuffix}",["properties"]:N1,["headers"]:K},["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Q9,"o"]}],["rules"]:[{["conditions"]:s9,["rules"]:[Y9,{["conditions"]:M0,endpoint:{["url"]:"https://{Bucket}.op-{outpostId}.{url#authority}",["properties"]:N1,["headers"]:K},["type"]:"endpoint"}],["type"]:"tree"},{endpoint:{["url"]:"https://{Bucket}.op-{outpostId}.s3-outposts.{Region}.{regionPartition#dnsSuffix}",["properties"]:N1,["headers"]:K},["type"]:"endpoint"}],["type"]:"tree"},{error:'Unrecognized hardware type: "Expected hardware type o or e but got {hardwareType}"',["type"]:"error"}],["type"]:"tree"},{error:"Invalid Outposts Bucket alias - it must be a valid bucket name.",["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"]:Ah,["rules"]:[{["conditions"]:[j,{["fn"]:"not",["argv"]:[{["fn"]:"isSet",["argv"]:[{["fn"]:"parseURL",["argv"]:uh}]}]}],error:"Custom endpoint `{Endpoint}` was not a valid URI",["type"]:"error"},{["conditions"]:[$D,N6],["rules"]:[{["conditions"]:U2,["rules"]:[{["conditions"]:t9,["rules"]:[{["conditions"]:[M2,w9],error:"S3 Accelerate cannot be used in this region",["type"]:"error"},{["conditions"]:[T,I,l,h,p],endpoint:{["url"]:"https://{Bucket}.s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[T,I,l,h,O,o],["rules"]:[{endpoint:X9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[T,I,l,h,O,e],endpoint:X9,["type"]:"endpoint"},{["conditions"]:[U,I,l,h,p],endpoint:{["url"]:"https://{Bucket}.s3-fips.us-east-1.{partitionResult#dnsSuffix}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[U,I,l,h,O,o],["rules"]:[{endpoint:W9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[U,I,l,h,O,e],endpoint:W9,["type"]:"endpoint"},{["conditions"]:[T,S,M2,h,p],endpoint:{["url"]:"https://{Bucket}.s3-accelerate.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[T,S,M2,h,O,o],["rules"]:[{endpoint:v9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[T,S,M2,h,O,e],endpoint:v9,["type"]:"endpoint"},{["conditions"]:[T,S,l,h,p],endpoint:{["url"]:"https://{Bucket}.s3.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[T,S,l,h,O,o],["rules"]:[{endpoint:K9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[T,S,l,h,O,e],endpoint:K9,["type"]:"endpoint"},{["conditions"]:[U,S,l,j,$2,ND,p],endpoint:{["url"]:"{url#scheme}://{url#authority}{url#normalizedPath}{Bucket}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[U,S,l,j,$2,zD,p],endpoint:{["url"]:"{url#scheme}://{Bucket}.{url#authority}{url#path}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[U,S,l,j,$2,ND,O,o],["rules"]:[{["conditions"]:n2,endpoint:ZD,["type"]:"endpoint"},{endpoint:ZD,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[U,S,l,j,$2,zD,O,o],["rules"]:[{["conditions"]:n2,endpoint:cD,["type"]:"endpoint"},h9],["type"]:"tree"},{["conditions"]:[U,S,l,j,$2,ND,O,e],endpoint:ZD,["type"]:"endpoint"},{["conditions"]:[U,S,l,j,$2,zD,O,e],endpoint:cD,["type"]:"endpoint"},{["conditions"]:[U,S,M2,h,p],endpoint:{["url"]:"https://{Bucket}.s3-accelerate.{partitionResult#dnsSuffix}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[U,S,M2,h,O,o],["rules"]:[{["conditions"]:n2,endpoint:JD,["type"]:"endpoint"},{endpoint:JD,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[U,S,M2,h,O,e],endpoint:JD,["type"]:"endpoint"},{["conditions"]:[U,S,l,h,p],endpoint:{["url"]:"https://{Bucket}.s3.{partitionResult#dnsSuffix}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[U,S,l,h,O,o],["rules"]:[{["conditions"]:n2,endpoint:{["url"]:"https://{Bucket}.s3.{partitionResult#dnsSuffix}",["properties"]:d,["headers"]:K},["type"]:"endpoint"},{endpoint:x9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[U,S,l,h,O,e],endpoint:x9,["type"]:"endpoint"}],["type"]:"tree"},$1],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[j,$2,{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[w6,"scheme"]},"http"]},{["fn"]:"aws.isVirtualHostableS3Bucket",["argv"]:[C,!0]},$D,S,U,l],["rules"]:[{["conditions"]:U2,["rules"]:[{["conditions"]:t9,["rules"]:[h9],["type"]:"tree"},$1],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[$D,{["fn"]:"aws.parseArn",["argv"]:Dh,["assign"]:"bucketArn"}],["rules"]:[{["conditions"]:[{["fn"]:"getAttr",["argv"]:[J2,"resourceId[0]"],["assign"]:"arnType"},{["fn"]:"not",["argv"]:[{["fn"]:"stringEquals",["argv"]:[$6,""]}]}],["rules"]:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[QD,"s3-object-lambda"]}],["rules"]:[{["conditions"]:LD,["rules"]:[{["conditions"]:o9,["rules"]:[H9,S9,{["conditions"]:ED,["rules"]:[R9,{["conditions"]:u6,["rules"]:[YD,{["conditions"]:OD,["rules"]:[{["conditions"]:U2,["rules"]:[{["conditions"]:D6,["rules"]:[{["conditions"]:CD,["rules"]:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[Z6,""]}],error:"Invalid ARN: Missing account id",["type"]:"error"},{["conditions"]:PD,["rules"]:[{["conditions"]:B6,["rules"]:[{["conditions"]:M0,endpoint:{["url"]:"{url#scheme}://{accessPointName}-{bucketArn#accountId}.{url#authority}{url#path}",["properties"]:XD,["headers"]:K},["type"]:"endpoint"},{["conditions"]:z1,endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-object-lambda-fips.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:XD,["headers"]:K},["type"]:"endpoint"},{endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-object-lambda.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:XD,["headers"]:K},["type"]:"endpoint"}],["type"]:"tree"},U9],["type"]:"tree"},WD],["type"]:"tree"},vD],["type"]:"tree"},KD],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},M9],["type"]:"tree"},{error:"Invalid ARN: bucket ARN is missing a region",["type"]:"error"}],["type"]:"tree"},L9],["type"]:"tree"},{error:"Invalid ARN: Object Lambda ARNs only support `accesspoint` arn types, but found: `{arnType}`",["type"]:"error"}],["type"]:"tree"},{["conditions"]:LD,["rules"]:[{["conditions"]:o9,["rules"]:[{["conditions"]:ED,["rules"]:[{["conditions"]:LD,["rules"]:[{["conditions"]:ED,["rules"]:[R9,{["conditions"]:u6,["rules"]:[YD,{["conditions"]:OD,["rules"]:[{["conditions"]:U2,["rules"]:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[z6,"{partitionResult#name}"]}],["rules"]:[{["conditions"]:CD,["rules"]:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[QD,"s3"]}],["rules"]:[{["conditions"]:PD,["rules"]:[{["conditions"]:B6,["rules"]:[{["conditions"]:RD,error:"Access Points do not support S3 Accelerate",["type"]:"error"},{["conditions"]:MD,endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint-fips.dualstack.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:hu,["headers"]:K},["type"]:"endpoint"},{["conditions"]:Hu,endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint-fips.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:hu,["headers"]:K},["type"]:"endpoint"},{["conditions"]:Su,endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint.dualstack.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:hu,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[S,U,j,$2],endpoint:{["url"]:"{url#scheme}://{accessPointName}-{bucketArn#accountId}.{url#authority}{url#path}",["properties"]:hu,["headers"]:K},["type"]:"endpoint"},{["conditions"]:Ru,endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:hu,["headers"]:K},["type"]:"endpoint"}],["type"]:"tree"},U9],["type"]:"tree"},WD],["type"]:"tree"},{error:"Invalid ARN: The ARN was not for the S3 service, found: {bucketArn#service}",["type"]:"error"}],["type"]:"tree"},vD],["type"]:"tree"},KD],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},M9],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[{["fn"]:"isValidHostLabel",["argv"]:[VD,!0]}],["rules"]:[{["conditions"]:e9,error:"S3 MRAP does not support dual-stack",["type"]:"error"},{["conditions"]:z1,error:"S3 MRAP does not support FIPS",["type"]:"error"},{["conditions"]:RD,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"]:SD,["assign"]:"mrapPartition"}],["rules"]:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[{["fn"]:"getAttr",["argv"]:[{["ref"]:"mrapPartition"},"name"]},{["fn"]:"getAttr",["argv"]:[J2,"partition"]}]}],["rules"]:[{endpoint:{["url"]:"https://{accessPointName}.accesspoint.s3-global.{mrapPartition#dnsSuffix}",["properties"]:{["authSchemes"]:[{["disableDoubleEncoding"]:!0,name:"sigv4a",["signingName"]:"s3",["signingRegionSet"]:Fh}]},["headers"]:K},["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"},L9],["type"]:"tree"},{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[QD,"s3-outposts"]}],["rules"]:[{["conditions"]:e9,error:"S3 Outposts does not support Dual-stack",["type"]:"error"},{["conditions"]:z1,error:"S3 Outposts does not support FIPS",["type"]:"error"},{["conditions"]:RD,error:"S3 Outposts does not support S3 Accelerate",["type"]:"error"},{["conditions"]:[{["fn"]:"isSet",["argv"]:[{["fn"]:"getAttr",["argv"]:[J2,"resourceId[4]"]}]}],error:"Invalid Arn: Outpost Access Point ARN contains sub resources",["type"]:"error"},{["conditions"]:[{["fn"]:"getAttr",["argv"]:wh,["assign"]:"outpostId"}],["rules"]:[{["conditions"]:a9,["rules"]:[YD,{["conditions"]:OD,["rules"]:[{["conditions"]:U2,["rules"]:[{["conditions"]:D6,["rules"]:[{["conditions"]:CD,["rules"]:[{["conditions"]:PD,["rules"]:[{["conditions"]:[{["fn"]:"getAttr",["argv"]:Gh,["assign"]:"outpostType"}],["rules"]:[{["conditions"]:[{["fn"]:"getAttr",["argv"]:[J2,"resourceId[3]"],["assign"]:"accessPointName"}],["rules"]:[{["conditions"]:[{["fn"]:"stringEquals",["argv"]:[{["ref"]:"outpostType"},"accesspoint"]}],["rules"]:[{["conditions"]:M0,endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.{outpostId}.{url#authority}",["properties"]:E9,["headers"]:K},["type"]:"endpoint"},{endpoint:{["url"]:"https://{accessPointName}-{bucketArn#accountId}.{outpostId}.s3-outposts.{bucketArn#region}.{bucketPartition#dnsSuffix}",["properties"]:E9,["headers"]:K},["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"},WD],["type"]:"tree"},vD],["type"]:"tree"},KD],["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"]:[C,0,4,!1],["assign"]:"arnPrefix"},{["fn"]:"stringEquals",["argv"]:[{["ref"]:"arnPrefix"},"arn:"]},{["fn"]:"not",["argv"]:[{["fn"]:"isSet",["argv"]:[O9]}]}],error:"Invalid ARN: `{Bucket}` was not a valid ARN",["type"]:"error"},{["conditions"]:[{["fn"]:"booleanEquals",["argv"]:[eK,!0]},O9],error:"Path-style addressing cannot be used with ARN buckets",["type"]:"error"},{["conditions"]:Bh,["rules"]:[{["conditions"]:U2,["rules"]:[{["conditions"]:[l],["rules"]:[{["conditions"]:[T,h,I,p],endpoint:{["url"]:"https://s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[T,h,I,O,o],["rules"]:[{endpoint:C9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[T,h,I,O,e],endpoint:C9,["type"]:"endpoint"},{["conditions"]:[U,h,I,p],endpoint:{["url"]:"https://s3-fips.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[U,h,I,O,o],["rules"]:[{endpoint:P9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[U,h,I,O,e],endpoint:P9,["type"]:"endpoint"},{["conditions"]:[T,h,S,p],endpoint:{["url"]:"https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[T,h,S,O,o],["rules"]:[{endpoint:c9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[T,h,S,O,e],endpoint:c9,["type"]:"endpoint"},{["conditions"]:[U,j,$2,S,p],endpoint:{["url"]:"{url#scheme}://{url#authority}{url#normalizedPath}{uri_encoded_bucket}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[U,j,$2,S,O,o],["rules"]:[{["conditions"]:n2,endpoint:hD,["type"]:"endpoint"},{endpoint:hD,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[U,j,$2,S,O,e],endpoint:hD,["type"]:"endpoint"},{["conditions"]:[U,h,S,p],endpoint:{["url"]:"https://s3.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[U,h,S,O,o],["rules"]:[{["conditions"]:n2,endpoint:{["url"]:"https://s3.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",["properties"]:d,["headers"]:K},["type"]:"endpoint"},{endpoint:V9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[U,h,S,O,e],endpoint:V9,["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"]:[k9]},{["fn"]:"booleanEquals",["argv"]:[k9,!0]}],["rules"]:[{["conditions"]:U2,["rules"]:[{["conditions"]:A6,["rules"]:[H9,S9,{["conditions"]:M0,endpoint:{["url"]:"{url#scheme}://{url#authority}{url#path}",["properties"]:xD,["headers"]:K},["type"]:"endpoint"},{["conditions"]:z1,endpoint:{["url"]:"https://s3-object-lambda-fips.{Region}.{partitionResult#dnsSuffix}",["properties"]:xD,["headers"]:K},["type"]:"endpoint"},{endpoint:{["url"]:"https://s3-object-lambda.{Region}.{partitionResult#dnsSuffix}",["properties"]:xD,["headers"]:K},["type"]:"endpoint"}],["type"]:"tree"},$1],["type"]:"tree"}],["type"]:"tree"},{["conditions"]:[J9],["rules"]:[{["conditions"]:U2,["rules"]:[{["conditions"]:A6,["rules"]:[{["conditions"]:[I,T,h,p],endpoint:{["url"]:"https://s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[I,T,h,O,o],["rules"]:[{endpoint:y9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,T,h,O,e],endpoint:y9,["type"]:"endpoint"},{["conditions"]:[I,U,h,p],endpoint:{["url"]:"https://s3-fips.us-east-1.{partitionResult#dnsSuffix}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[I,U,h,O,o],["rules"]:[{endpoint:T9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[I,U,h,O,e],endpoint:T9,["type"]:"endpoint"},{["conditions"]:[S,T,h,p],endpoint:{["url"]:"https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[S,T,h,O,o],["rules"]:[{endpoint:I9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[S,T,h,O,e],endpoint:I9,["type"]:"endpoint"},{["conditions"]:[S,U,j,$2,p],endpoint:{["url"]:"{url#scheme}://{url#authority}{url#path}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[S,U,j,$2,O,o],["rules"]:[{["conditions"]:n2,endpoint:HD,["type"]:"endpoint"},{endpoint:HD,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[S,U,j,$2,O,e],endpoint:HD,["type"]:"endpoint"},{["conditions"]:[S,U,h,p],endpoint:{["url"]:"https://s3.{partitionResult#dnsSuffix}",["properties"]:t,["headers"]:K},["type"]:"endpoint"},{["conditions"]:[S,U,h,O,o],["rules"]:[{["conditions"]:n2,endpoint:{["url"]:"https://s3.{partitionResult#dnsSuffix}",["properties"]:d,["headers"]:K},["type"]:"endpoint"},{endpoint:q9,["type"]:"endpoint"}],["type"]:"tree"},{["conditions"]:[S,U,h,O,e],endpoint:q9,["type"]:"endpoint"}],["type"]:"tree"},$1],["type"]:"tree"}],["type"]:"tree"}],["type"]:"tree"},{error:"A region must be set when sending requests to S3.",["type"]:"error"}]},J6=Nh;var Zh=new L0.EndpointCache({size:50,params:["Accelerate","Bucket","DisableAccessPoints","DisableMultiRegionAccessPoints","DisableS3ExpressSessionAuth","Endpoint","ForcePathStyle","Region","UseArnRegion","UseDualStack","UseFIPS","UseGlobalEndpoint","UseObjectLambdaEndpoint","UseS3ExpressControlEndpoint"]}),Z1=(u,D={})=>{return Zh.get(u,()=>L0.resolveEndpoint(J6,{endpointParams:u,logger:D.logger}))};L0.customEndpointFunctions.aws=Q6.awsEndpointFunctions;var Jh=(u)=>async(D,B,A)=>{if(!A)throw Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`");let F=await u(D,B,A),w=E0.getSmithyContext(B)?.commandInstance?.constructor?.getEndpointParameterInstructions;if(!w)throw Error(`getEndpointParameterInstructions() is not defined on '${B.commandName}'`);let G=await Y6.resolveParams(A,{getEndpointParameterInstructions:w},D);return Object.assign(F,G)},Qh=async(u,D,B)=>{return{operation:E0.getSmithyContext(D).operation,region:await E0.normalizeProvider(u.region)()||(()=>{throw Error("expected `region` to be configured for `aws.auth#sigv4`")})()}},X6=Jh(Qh);function W6(u){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"s3",region:u.region},propertiesExtractor:(D,B)=>({signingProperties:{config:D,context:B}})}}function v6(u){return{schemeId:"aws.auth#sigv4a",signingProperties:{name:"s3",region:u.region},propertiesExtractor:(D,B)=>({signingProperties:{config:D,context:B}})}}var Yh=(u,D,B)=>{return(F)=>{let G=u(F).properties?.authSchemes;if(!G)return D(F);let N=[];for(let $ of G){let{name:Z,properties:Y={},...J}=$,Q=Z.toLowerCase();if(Z!==Q)console.warn(`HttpAuthScheme has been normalized with lowercasing: '${Z}' to '${Q}'`);let X;if(Q==="sigv4a"){X="aws.auth#sigv4a";let x=G.find((E)=>{let H=E.name.toLowerCase();return H!=="sigv4a"&&H.startsWith("sigv4")});if(vu.sigv4aDependency()==="none"&&x)continue}else if(Q.startsWith("sigv4"))X="aws.auth#sigv4";else throw Error(`Unknown HttpAuthScheme found in '@smithy.rules#endpointRuleSet': '${Q}'`);let v=B[X];if(!v)throw Error(`Could not find HttpAuthOption create function for '${X}'`);let L=v(F);L.schemeId=X,L.signingProperties={...L.signingProperties||{},...J,...Y},N.push(L)}return N}},Xh=(u)=>{let D=[];switch(u.operation){default:D.push(W6(u)),D.push(v6(u))}return D},K6=Yh(Z1,Xh,{"aws.auth#sigv4":W6,"aws.auth#sigv4a":v6}),h6=(u)=>{let D=J1.resolveAwsSdkSigV4Config(u),B=J1.resolveAwsSdkSigV4AConfig(D);return Object.assign(B,{authSchemePreference:E0.normalizeProvider(u.authSchemePreference??[])})};var V6=W(J0(),1),k6=W(R2(),1);var x6=(u)=>{return Object.assign(u,{useFipsEndpoint:u.useFipsEndpoint??!1,useDualstackEndpoint:u.useDualstackEndpoint??!1,forcePathStyle:u.forcePathStyle??!1,useAccelerateEndpoint:u.useAccelerateEndpoint??!1,useGlobalEndpoint:u.useGlobalEndpoint??!1,disableMultiregionAccessPoints:u.disableMultiregionAccessPoints??!1,defaultSigningName:"s3",clientContextParams:u.clientContextParams??{}})},_2={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"}};var kD=W(R6(),1);var H6=W(R2(),1);class i extends H6.ServiceException{constructor(u){super(u);Object.setPrototypeOf(this,i.prototype)}}class Q1 extends i{name="NoSuchUpload";$fault="client";constructor(u){super({name:"NoSuchUpload",$fault:"client",...u});Object.setPrototypeOf(this,Q1.prototype)}}class Y1 extends i{name="AccessDenied";$fault="client";constructor(u){super({name:"AccessDenied",$fault:"client",...u});Object.setPrototypeOf(this,Y1.prototype)}}class X1 extends i{name="ObjectNotInActiveTierError";$fault="client";constructor(u){super({name:"ObjectNotInActiveTierError",$fault:"client",...u});Object.setPrototypeOf(this,X1.prototype)}}class W1 extends i{name="BucketAlreadyExists";$fault="client";constructor(u){super({name:"BucketAlreadyExists",$fault:"client",...u});Object.setPrototypeOf(this,W1.prototype)}}class v1 extends i{name="BucketAlreadyOwnedByYou";$fault="client";constructor(u){super({name:"BucketAlreadyOwnedByYou",$fault:"client",...u});Object.setPrototypeOf(this,v1.prototype)}}class K1 extends i{name="NoSuchBucket";$fault="client";constructor(u){super({name:"NoSuchBucket",$fault:"client",...u});Object.setPrototypeOf(this,K1.prototype)}}class h1 extends i{name="InvalidObjectState";$fault="client";StorageClass;AccessTier;constructor(u){super({name:"InvalidObjectState",$fault:"client",...u});Object.setPrototypeOf(this,h1.prototype),this.StorageClass=u.StorageClass,this.AccessTier=u.AccessTier}}class x1 extends i{name="NoSuchKey";$fault="client";constructor(u){super({name:"NoSuchKey",$fault:"client",...u});Object.setPrototypeOf(this,x1.prototype)}}class H1 extends i{name="NotFound";$fault="client";constructor(u){super({name:"NotFound",$fault:"client",...u});Object.setPrototypeOf(this,H1.prototype)}}class S1 extends i{name="EncryptionTypeMismatch";$fault="client";constructor(u){super({name:"EncryptionTypeMismatch",$fault:"client",...u});Object.setPrototypeOf(this,S1.prototype)}}class R1 extends i{name="InvalidRequest";$fault="client";constructor(u){super({name:"InvalidRequest",$fault:"client",...u});Object.setPrototypeOf(this,R1.prototype)}}class U1 extends i{name="InvalidWriteOffset";$fault="client";constructor(u){super({name:"InvalidWriteOffset",$fault:"client",...u});Object.setPrototypeOf(this,U1.prototype)}}class M1 extends i{name="TooManyParts";$fault="client";constructor(u){super({name:"TooManyParts",$fault:"client",...u});Object.setPrototypeOf(this,M1.prototype)}}class L1 extends i{name="IdempotencyParameterMismatch";$fault="client";constructor(u){super({name:"IdempotencyParameterMismatch",$fault:"client",...u});Object.setPrototypeOf(this,L1.prototype)}}class E1 extends i{name="ObjectAlreadyInActiveTierError";$fault="client";constructor(u){super({name:"ObjectAlreadyInActiveTierError",$fault:"client",...u});Object.setPrototypeOf(this,E1.prototype)}}var U6=kD.TypeRegistry.for("smithy.ts.sdk.synthetic.com.amazonaws.s3"),Wh=[-3,"smithy.ts.sdk.synthetic.com.amazonaws.s3","S3ServiceException",0,[],[]];U6.registerError(Wh,i);var N2=kD.TypeRegistry.for("com.amazonaws.s3"),vh=[-3,"com.amazonaws.s3","AccessDenied",{["error"]:"client",["httpError"]:403},[],[]];N2.registerError(vh,Y1);var Kh=[-3,"com.amazonaws.s3","BucketAlreadyExists",{["error"]:"client",["httpError"]:409},[],[]];N2.registerError(Kh,W1);var hh=[-3,"com.amazonaws.s3","BucketAlreadyOwnedByYou",{["error"]:"client",["httpError"]:409},[],[]];N2.registerError(hh,v1);var xh=[-3,"com.amazonaws.s3","EncryptionTypeMismatch",{["error"]:"client",["httpError"]:400},[],[]];N2.registerError(xh,S1);var Hh=[-3,"com.amazonaws.s3","IdempotencyParameterMismatch",{["error"]:"client",["httpError"]:400},[],[]];N2.registerError(Hh,L1);var Sh=[-3,"com.amazonaws.s3","InvalidObjectState",{["error"]:"client",["httpError"]:403},["StorageClass","AccessTier"],[0,0]];N2.registerError(Sh,h1);var Rh=[-3,"com.amazonaws.s3","InvalidRequest",{["error"]:"client",["httpError"]:400},[],[]];N2.registerError(Rh,R1);var Uh=[-3,"com.amazonaws.s3","InvalidWriteOffset",{["error"]:"client",["httpError"]:400},[],[]];N2.registerError(Uh,U1);var Mh=[-3,"com.amazonaws.s3","NoSuchBucket",{["error"]:"client",["httpError"]:404},[],[]];N2.registerError(Mh,K1);var Lh=[-3,"com.amazonaws.s3","NoSuchKey",{["error"]:"client",["httpError"]:404},[],[]];N2.registerError(Lh,x1);var Eh=[-3,"com.amazonaws.s3","NoSuchUpload",{["error"]:"client",["httpError"]:404},[],[]];N2.registerError(Eh,Q1);var Oh=[-3,"com.amazonaws.s3","NotFound",{["error"]:"client"},[],[]];N2.registerError(Oh,H1);var Ch=[-3,"com.amazonaws.s3","ObjectAlreadyInActiveTierError",{["error"]:"client",["httpError"]:403},[],[]];N2.registerError(Ch,E1);var Ph=[-3,"com.amazonaws.s3","ObjectNotInActiveTierError",{["error"]:"client",["httpError"]:403},[],[]];N2.registerError(Ph,X1);var ch=[-3,"com.amazonaws.s3","TooManyParts",{["error"]:"client",["httpError"]:400},[],[]];N2.registerError(ch,M1);var M6=[U6,N2];var S6=[0,"com.amazonaws.s3","SessionCredentialValue",8,0],yD=[0,"com.amazonaws.s3","SSECustomerKey",8,0],O1=[0,"com.amazonaws.s3","SSEKMSEncryptionContext",8,0],O0=[0,"com.amazonaws.s3","SSEKMSKeyId",8,0],L6=[0,"com.amazonaws.s3","StreamingBlob",{["streaming"]:1},42];var Vh=[3,"com.amazonaws.s3","CommonPrefix",0,["Prefix"],[0]];var kh=[3,"com.amazonaws.s3","CreateSessionOutput",{["xmlName"]:"CreateSessionResult"},["Credentials","ServerSideEncryption","SSEKMSKeyId","SSEKMSEncryptionContext","BucketKeyEnabled"],[[()=>ih,{["xmlName"]:"Credentials"}],[0,{["httpHeader"]:"x-amz-server-side-encryption"}],[()=>O0,{["httpHeader"]:"x-amz-server-side-encryption-aws-kms-key-id"}],[()=>O1,{["httpHeader"]:"x-amz-server-side-encryption-context"}],[2,{["httpHeader"]:"x-amz-server-side-encryption-bucket-key-enabled"}]],1],yh=[3,"com.amazonaws.s3","CreateSessionRequest",0,["Bucket","SessionMode","ServerSideEncryption","SSEKMSKeyId","SSEKMSEncryptionContext","BucketKeyEnabled"],[[0,1],[0,{["httpHeader"]:"x-amz-create-session-mode"}],[0,{["httpHeader"]:"x-amz-server-side-encryption"}],[()=>O0,{["httpHeader"]:"x-amz-server-side-encryption-aws-kms-key-id"}],[()=>O1,{["httpHeader"]:"x-amz-server-side-encryption-context"}],[2,{["httpHeader"]:"x-amz-server-side-encryption-bucket-key-enabled"}]],1];var Th=[3,"com.amazonaws.s3","GetObjectOutput",0,["Body","DeleteMarker","AcceptRanges","Expiration","Restore","LastModified","ContentLength","ETag","ChecksumCRC32","ChecksumCRC32C","ChecksumCRC64NVME","ChecksumSHA1","ChecksumSHA256","ChecksumType","MissingMeta","VersionId","CacheControl","ContentDisposition","ContentEncoding","ContentLanguage","ContentRange","ContentType","Expires","ExpiresString","WebsiteRedirectLocation","ServerSideEncryption","Metadata","SSECustomerAlgorithm","SSECustomerKeyMD5","SSEKMSKeyId","BucketKeyEnabled","StorageClass","RequestCharged","ReplicationStatus","PartsCount","TagCount","ObjectLockMode","ObjectLockRetainUntilDate","ObjectLockLegalHoldStatus"],[[()=>L6,16],[2,{["httpHeader"]:"x-amz-delete-marker"}],[0,{["httpHeader"]:"accept-ranges"}],[0,{["httpHeader"]:"x-amz-expiration"}],[0,{["httpHeader"]:"x-amz-restore"}],[4,{["httpHeader"]:"Last-Modified"}],[1,{["httpHeader"]:"Content-Length"}],[0,{["httpHeader"]:"ETag"}],[0,{["httpHeader"]:"x-amz-checksum-crc32"}],[0,{["httpHeader"]:"x-amz-checksum-crc32c"}],[0,{["httpHeader"]:"x-amz-checksum-crc64nvme"}],[0,{["httpHeader"]:"x-amz-checksum-sha1"}],[0,{["httpHeader"]:"x-amz-checksum-sha256"}],[0,{["httpHeader"]:"x-amz-checksum-type"}],[1,{["httpHeader"]:"x-amz-missing-meta"}],[0,{["httpHeader"]:"x-amz-version-id"}],[0,{["httpHeader"]:"Cache-Control"}],[0,{["httpHeader"]:"Content-Disposition"}],[0,{["httpHeader"]:"Content-Encoding"}],[0,{["httpHeader"]:"Content-Language"}],[0,{["httpHeader"]:"Content-Range"}],[0,{["httpHeader"]:"Content-Type"}],[4,{["httpHeader"]:"Expires"}],[0,{["httpHeader"]:"ExpiresString"}],[0,{["httpHeader"]:"x-amz-website-redirect-location"}],[0,{["httpHeader"]:"x-amz-server-side-encryption"}],[128,{["httpPrefixHeaders"]:"x-amz-meta-"}],[0,{["httpHeader"]:"x-amz-server-side-encryption-customer-algorithm"}],[0,{["httpHeader"]:"x-amz-server-side-encryption-customer-key-MD5"}],[()=>O0,{["httpHeader"]:"x-amz-server-side-encryption-aws-kms-key-id"}],[2,{["httpHeader"]:"x-amz-server-side-encryption-bucket-key-enabled"}],[0,{["httpHeader"]:"x-amz-storage-class"}],[0,{["httpHeader"]:"x-amz-request-charged"}],[0,{["httpHeader"]:"x-amz-replication-status"}],[1,{["httpHeader"]:"x-amz-mp-parts-count"}],[1,{["httpHeader"]:"x-amz-tagging-count"}],[0,{["httpHeader"]:"x-amz-object-lock-mode"}],[5,{["httpHeader"]:"x-amz-object-lock-retain-until-date"}],[0,{["httpHeader"]:"x-amz-object-lock-legal-hold"}]]],Ih=[3,"com.amazonaws.s3","GetObjectRequest",0,["Bucket","Key","IfMatch","IfModifiedSince","IfNoneMatch","IfUnmodifiedSince","Range","ResponseCacheControl","ResponseContentDisposition","ResponseContentEncoding","ResponseContentLanguage","ResponseContentType","ResponseExpires","VersionId","SSECustomerAlgorithm","SSECustomerKey","SSECustomerKeyMD5","RequestPayer","PartNumber","ExpectedBucketOwner","ChecksumMode"],[[0,1],[0,1],[0,{["httpHeader"]:"If-Match"}],[4,{["httpHeader"]:"If-Modified-Since"}],[0,{["httpHeader"]:"If-None-Match"}],[4,{["httpHeader"]:"If-Unmodified-Since"}],[0,{["httpHeader"]:"Range"}],[0,{["httpQuery"]:"response-cache-control"}],[0,{["httpQuery"]:"response-content-disposition"}],[0,{["httpQuery"]:"response-content-encoding"}],[0,{["httpQuery"]:"response-content-language"}],[0,{["httpQuery"]:"response-content-type"}],[6,{["httpQuery"]:"response-expires"}],[0,{["httpQuery"]:"versionId"}],[0,{["httpHeader"]:"x-amz-server-side-encryption-customer-algorithm"}],[()=>yD,{["httpHeader"]:"x-amz-server-side-encryption-customer-key"}],[0,{["httpHeader"]:"x-amz-server-side-encryption-customer-key-MD5"}],[0,{["httpHeader"]:"x-amz-request-payer"}],[1,{["httpQuery"]:"partNumber"}],[0,{["httpHeader"]:"x-amz-expected-bucket-owner"}],[0,{["httpHeader"]:"x-amz-checksum-mode"}]],2];var qh=[3,"com.amazonaws.s3","HeadObjectOutput",0,["DeleteMarker","AcceptRanges","Expiration","Restore","ArchiveStatus","LastModified","ContentLength","ChecksumCRC32","ChecksumCRC32C","ChecksumCRC64NVME","ChecksumSHA1","ChecksumSHA256","ChecksumType","ETag","MissingMeta","VersionId","CacheControl","ContentDisposition","ContentEncoding","ContentLanguage","ContentType","ContentRange","Expires","ExpiresString","WebsiteRedirectLocation","ServerSideEncryption","Metadata","SSECustomerAlgorithm","SSECustomerKeyMD5","SSEKMSKeyId","BucketKeyEnabled","StorageClass","RequestCharged","ReplicationStatus","PartsCount","TagCount","ObjectLockMode","ObjectLockRetainUntilDate","ObjectLockLegalHoldStatus"],[[2,{["httpHeader"]:"x-amz-delete-marker"}],[0,{["httpHeader"]:"accept-ranges"}],[0,{["httpHeader"]:"x-amz-expiration"}],[0,{["httpHeader"]:"x-amz-restore"}],[0,{["httpHeader"]:"x-amz-archive-status"}],[4,{["httpHeader"]:"Last-Modified"}],[1,{["httpHeader"]:"Content-Length"}],[0,{["httpHeader"]:"x-amz-checksum-crc32"}],[0,{["httpHeader"]:"x-amz-checksum-crc32c"}],[0,{["httpHeader"]:"x-amz-checksum-crc64nvme"}],[0,{["httpHeader"]:"x-amz-checksum-sha1"}],[0,{["httpHeader"]:"x-amz-checksum-sha256"}],[0,{["httpHeader"]:"x-amz-checksum-type"}],[0,{["httpHeader"]:"ETag"}],[1,{["httpHeader"]:"x-amz-missing-meta"}],[0,{["httpHeader"]:"x-amz-version-id"}],[0,{["httpHeader"]:"Cache-Control"}],[0,{["httpHeader"]:"Content-Disposition"}],[0,{["httpHeader"]:"Content-Encoding"}],[0,{["httpHeader"]:"Content-Language"}],[0,{["httpHeader"]:"Content-Type"}],[0,{["httpHeader"]:"Content-Range"}],[4,{["httpHeader"]:"Expires"}],[0,{["httpHeader"]:"ExpiresString"}],[0,{["httpHeader"]:"x-amz-website-redirect-location"}],[0,{["httpHeader"]:"x-amz-server-side-encryption"}],[128,{["httpPrefixHeaders"]:"x-amz-meta-"}],[0,{["httpHeader"]:"x-amz-server-side-encryption-customer-algorithm"}],[0,{["httpHeader"]:"x-amz-server-side-encryption-customer-key-MD5"}],[()=>O0,{["httpHeader"]:"x-amz-server-side-encryption-aws-kms-key-id"}],[2,{["httpHeader"]:"x-amz-server-side-encryption-bucket-key-enabled"}],[0,{["httpHeader"]:"x-amz-storage-class"}],[0,{["httpHeader"]:"x-amz-request-charged"}],[0,{["httpHeader"]:"x-amz-replication-status"}],[1,{["httpHeader"]:"x-amz-mp-parts-count"}],[1,{["httpHeader"]:"x-amz-tagging-count"}],[0,{["httpHeader"]:"x-amz-object-lock-mode"}],[5,{["httpHeader"]:"x-amz-object-lock-retain-until-date"}],[0,{["httpHeader"]:"x-amz-object-lock-legal-hold"}]]],_h=[3,"com.amazonaws.s3","HeadObjectRequest",0,["Bucket","Key","IfMatch","IfModifiedSince","IfNoneMatch","IfUnmodifiedSince","Range","ResponseCacheControl","ResponseContentDisposition","ResponseContentEncoding","ResponseContentLanguage","ResponseContentType","ResponseExpires","VersionId","SSECustomerAlgorithm","SSECustomerKey","SSECustomerKeyMD5","RequestPayer","PartNumber","ExpectedBucketOwner","ChecksumMode"],[[0,1],[0,1],[0,{["httpHeader"]:"If-Match"}],[4,{["httpHeader"]:"If-Modified-Since"}],[0,{["httpHeader"]:"If-None-Match"}],[4,{["httpHeader"]:"If-Unmodified-Since"}],[0,{["httpHeader"]:"Range"}],[0,{["httpQuery"]:"response-cache-control"}],[0,{["httpQuery"]:"response-content-disposition"}],[0,{["httpQuery"]:"response-content-encoding"}],[0,{["httpQuery"]:"response-content-language"}],[0,{["httpQuery"]:"response-content-type"}],[6,{["httpQuery"]:"response-expires"}],[0,{["httpQuery"]:"versionId"}],[0,{["httpHeader"]:"x-amz-server-side-encryption-customer-algorithm"}],[()=>yD,{["httpHeader"]:"x-amz-server-side-encryption-customer-key"}],[0,{["httpHeader"]:"x-amz-server-side-encryption-customer-key-MD5"}],[0,{["httpHeader"]:"x-amz-request-payer"}],[1,{["httpQuery"]:"partNumber"}],[0,{["httpHeader"]:"x-amz-expected-bucket-owner"}],[0,{["httpHeader"]:"x-amz-checksum-mode"}]],2];var mh=[3,"com.amazonaws.s3","ListObjectsV2Output",{["xmlName"]:"ListBucketResult"},["IsTruncated","Contents","Name","Prefix","Delimiter","MaxKeys","CommonPrefixes","EncodingType","KeyCount","ContinuationToken","NextContinuationToken","StartAfter","RequestCharged"],[2,[()=>nh,{["xmlFlattened"]:1}],0,0,0,1,[()=>rh,{["xmlFlattened"]:1}],0,1,0,0,0,[0,{["httpHeader"]:"x-amz-request-charged"}]]],gh=[3,"com.amazonaws.s3","ListObjectsV2Request",0,["Bucket","Delimiter","EncodingType","MaxKeys","Prefix","ContinuationToken","FetchOwner","StartAfter","RequestPayer","ExpectedBucketOwner","OptionalObjectAttributes"],[[0,1],[0,{["httpQuery"]:"delimiter"}],[0,{["httpQuery"]:"encoding-type"}],[1,{["httpQuery"]:"max-keys"}],[0,{["httpQuery"]:"prefix"}],[0,{["httpQuery"]:"continuation-token"}],[2,{["httpQuery"]:"fetch-owner"}],[0,{["httpQuery"]:"start-after"}],[0,{["httpHeader"]:"x-amz-request-payer"}],[0,{["httpHeader"]:"x-amz-expected-bucket-owner"}],[64,{["httpHeader"]:"x-amz-optional-object-attributes"}]],1];var fh=[3,"com.amazonaws.s3","Object",0,["Key","LastModified","ETag","ChecksumAlgorithm","ChecksumType","Size","StorageClass","Owner","RestoreStatus"],[0,4,0,[64,{["xmlFlattened"]:1}],0,1,0,()=>bh,()=>dh]];var bh=[3,"com.amazonaws.s3","Owner",0,["DisplayName","ID"],[0,0]];var jh=[3,"com.amazonaws.s3","PutObjectOutput",0,["Expiration","ETag","ChecksumCRC32","ChecksumCRC32C","ChecksumCRC64NVME","ChecksumSHA1","ChecksumSHA256","ChecksumType","ServerSideEncryption","VersionId","SSECustomerAlgorithm","SSECustomerKeyMD5","SSEKMSKeyId","SSEKMSEncryptionContext","BucketKeyEnabled","Size","RequestCharged"],[[0,{["httpHeader"]:"x-amz-expiration"}],[0,{["httpHeader"]:"ETag"}],[0,{["httpHeader"]:"x-amz-checksum-crc32"}],[0,{["httpHeader"]:"x-amz-checksum-crc32c"}],[0,{["httpHeader"]:"x-amz-checksum-crc64nvme"}],[0,{["httpHeader"]:"x-amz-checksum-sha1"}],[0,{["httpHeader"]:"x-amz-checksum-sha256"}],[0,{["httpHeader"]:"x-amz-checksum-type"}],[0,{["httpHeader"]:"x-amz-server-side-encryption"}],[0,{["httpHeader"]:"x-amz-version-id"}],[0,{["httpHeader"]:"x-amz-server-side-encryption-customer-algorithm"}],[0,{["httpHeader"]:"x-amz-server-side-encryption-customer-key-MD5"}],[()=>O0,{["httpHeader"]:"x-amz-server-side-encryption-aws-kms-key-id"}],[()=>O1,{["httpHeader"]:"x-amz-server-side-encryption-context"}],[2,{["httpHeader"]:"x-amz-server-side-encryption-bucket-key-enabled"}],[1,{["httpHeader"]:"x-amz-object-size"}],[0,{["httpHeader"]:"x-amz-request-charged"}]]],lh=[3,"com.amazonaws.s3","PutObjectRequest",0,["Bucket","Key","ACL","Body","CacheControl","ContentDisposition","ContentEncoding","ContentLanguage","ContentLength","ContentMD5","ContentType","ChecksumAlgorithm","ChecksumCRC32","ChecksumCRC32C","ChecksumCRC64NVME","ChecksumSHA1","ChecksumSHA256","Expires","IfMatch","IfNoneMatch","GrantFullControl","GrantRead","GrantReadACP","GrantWriteACP","WriteOffsetBytes","Metadata","ServerSideEncryption","StorageClass","WebsiteRedirectLocation","SSECustomerAlgorithm","SSECustomerKey","SSECustomerKeyMD5","SSEKMSKeyId","SSEKMSEncryptionContext","BucketKeyEnabled","RequestPayer","Tagging","ObjectLockMode","ObjectLockRetainUntilDate","ObjectLockLegalHoldStatus","ExpectedBucketOwner"],[[0,1],[0,1],[0,{["httpHeader"]:"x-amz-acl"}],[()=>L6,16],[0,{["httpHeader"]:"Cache-Control"}],[0,{["httpHeader"]:"Content-Disposition"}],[0,{["httpHeader"]:"Content-Encoding"}],[0,{["httpHeader"]:"Content-Language"}],[1,{["httpHeader"]:"Content-Length"}],[0,{["httpHeader"]:"Content-MD5"}],[0,{["httpHeader"]:"Content-Type"}],[0,{["httpHeader"]:"x-amz-sdk-checksum-algorithm"}],[0,{["httpHeader"]:"x-amz-checksum-crc32"}],[0,{["httpHeader"]:"x-amz-checksum-crc32c"}],[0,{["httpHeader"]:"x-amz-checksum-crc64nvme"}],[0,{["httpHeader"]:"x-amz-checksum-sha1"}],[0,{["httpHeader"]:"x-amz-checksum-sha256"}],[4,{["httpHeader"]:"Expires"}],[0,{["httpHeader"]:"If-Match"}],[0,{["httpHeader"]:"If-None-Match"}],[0,{["httpHeader"]:"x-amz-grant-full-control"}],[0,{["httpHeader"]:"x-amz-grant-read"}],[0,{["httpHeader"]:"x-amz-grant-read-acp"}],[0,{["httpHeader"]:"x-amz-grant-write-acp"}],[1,{["httpHeader"]:"x-amz-write-offset-bytes"}],[128,{["httpPrefixHeaders"]:"x-amz-meta-"}],[0,{["httpHeader"]:"x-amz-server-side-encryption"}],[0,{["httpHeader"]:"x-amz-storage-class"}],[0,{["httpHeader"]:"x-amz-website-redirect-location"}],[0,{["httpHeader"]:"x-amz-server-side-encryption-customer-algorithm"}],[()=>yD,{["httpHeader"]:"x-amz-server-side-encryption-customer-key"}],[0,{["httpHeader"]:"x-amz-server-side-encryption-customer-key-MD5"}],[()=>O0,{["httpHeader"]:"x-amz-server-side-encryption-aws-kms-key-id"}],[()=>O1,{["httpHeader"]:"x-amz-server-side-encryption-context"}],[2,{["httpHeader"]:"x-amz-server-side-encryption-bucket-key-enabled"}],[0,{["httpHeader"]:"x-amz-request-payer"}],[0,{["httpHeader"]:"x-amz-tagging"}],[0,{["httpHeader"]:"x-amz-object-lock-mode"}],[5,{["httpHeader"]:"x-amz-object-lock-retain-until-date"}],[0,{["httpHeader"]:"x-amz-object-lock-legal-hold"}],[0,{["httpHeader"]:"x-amz-expected-bucket-owner"}]],2];var dh=[3,"com.amazonaws.s3","RestoreStatus",0,["IsRestoreInProgress","RestoreExpiryDate"],[2,4]];var ih=[3,"com.amazonaws.s3","SessionCredentials",0,["AccessKeyId","SecretAccessKey","SessionToken","Expiration"],[[0,{["xmlName"]:"AccessKeyId"}],[()=>S6,{["xmlName"]:"SecretAccessKey"}],[()=>S6,{["xmlName"]:"SessionToken"}],[4,{["xmlName"]:"Expiration"}]],4];var rh=[1,"com.amazonaws.s3","CommonPrefixList",0,()=>Vh];var nh=[1,"com.amazonaws.s3","ObjectList",0,[()=>fh,0]];var E6=[9,"com.amazonaws.s3","CreateSession",{["http"]:["GET","/?session",200]},()=>yh,()=>kh];var O6=[9,"com.amazonaws.s3","GetObject",{["httpChecksum"]:"-",["http"]:["GET","/{Key+}?x-id=GetObject",200]},()=>Ih,()=>Th];var C6=[9,"com.amazonaws.s3","HeadObject",{["http"]:["HEAD","/{Key+}",200]},()=>_h,()=>qh];var P6=[9,"com.amazonaws.s3","ListObjectsV2",{["http"]:["GET","/?list-type=2",200]},()=>gh,()=>mh];var c6=[9,"com.amazonaws.s3","PutObject",{["httpChecksum"]:"-",["http"]:["PUT","/{Key+}?x-id=PutObject",200]},()=>lh,()=>jh];class TD extends k6.Command.classBuilder().ep({..._2,DisableS3ExpressSessionAuth:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function(u,D,B,A){return[V6.getEndpointPlugin(B,u.getEndpointParameterInstructions()),r2(B)]}).s("AmazonS3","CreateSession",{}).n("S3Client","CreateSessionCommand").sc(E6).build(){}var y6={name:"@aws-sdk/client-s3",description:"AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native",version:"3.1015.0",scripts:{build:"concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs","build:cjs":"node ../../scripts/compilation/inline client-s3","build:es":"tsc -p tsconfig.es.json","build:include:deps":'yarn g:turbo run build -F="$npm_package_name"',"build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo s3",test:"yarn g:vitest run","test:browser":"node ./test/browser-build/esbuild && yarn g:vitest run -c vitest.config.browser.mts","test:browser:watch":"node ./test/browser-build/esbuild && yarn g:vitest watch -c vitest.config.browser.mts","test:e2e":"yarn g:vitest run -c vitest.config.e2e.mts && yarn test:browser","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.mts","test:index":"tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs","test:integration":"yarn g:vitest run -c vitest.config.integ.mts","test:integration:watch":"yarn g:vitest watch -c vitest.config.integ.mts","test:watch":"yarn g:vitest watch"},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/core":"^3.973.24","@aws-sdk/credential-provider-node":"^3.972.25","@aws-sdk/middleware-bucket-endpoint":"^3.972.8","@aws-sdk/middleware-expect-continue":"^3.972.8","@aws-sdk/middleware-flexible-checksums":"^3.974.4","@aws-sdk/middleware-host-header":"^3.972.8","@aws-sdk/middleware-location-constraint":"^3.972.8","@aws-sdk/middleware-logger":"^3.972.8","@aws-sdk/middleware-recursion-detection":"^3.972.8","@aws-sdk/middleware-sdk-s3":"^3.972.24","@aws-sdk/middleware-ssec":"^3.972.8","@aws-sdk/middleware-user-agent":"^3.972.25","@aws-sdk/region-config-resolver":"^3.972.9","@aws-sdk/signature-v4-multi-region":"^3.996.12","@aws-sdk/types":"^3.973.6","@aws-sdk/util-endpoints":"^3.996.5","@aws-sdk/util-user-agent-browser":"^3.972.8","@aws-sdk/util-user-agent-node":"^3.973.11","@smithy/config-resolver":"^4.4.13","@smithy/core":"^3.23.12","@smithy/eventstream-serde-browser":"^4.2.12","@smithy/eventstream-serde-config-resolver":"^4.3.12","@smithy/eventstream-serde-node":"^4.2.12","@smithy/fetch-http-handler":"^5.3.15","@smithy/hash-blob-browser":"^4.2.13","@smithy/hash-node":"^4.2.12","@smithy/hash-stream-node":"^4.2.12","@smithy/invalid-dependency":"^4.2.12","@smithy/md5-js":"^4.2.12","@smithy/middleware-content-length":"^4.2.12","@smithy/middleware-endpoint":"^4.4.27","@smithy/middleware-retry":"^4.4.44","@smithy/middleware-serde":"^4.2.15","@smithy/middleware-stack":"^4.2.12","@smithy/node-config-provider":"^4.3.12","@smithy/node-http-handler":"^4.5.0","@smithy/protocol-http":"^5.3.12","@smithy/smithy-client":"^4.12.7","@smithy/types":"^4.13.1","@smithy/url-parser":"^4.2.12","@smithy/util-base64":"^4.3.2","@smithy/util-body-length-browser":"^4.2.2","@smithy/util-body-length-node":"^4.2.3","@smithy/util-defaults-mode-browser":"^4.3.43","@smithy/util-defaults-mode-node":"^4.2.47","@smithy/util-endpoints":"^3.3.3","@smithy/util-middleware":"^4.2.12","@smithy/util-retry":"^4.2.12","@smithy/util-stream":"^4.5.20","@smithy/util-utf8":"^4.2.2","@smithy/util-waiter":"^4.2.13",tslib:"^2.6.2"},devDependencies:{"@aws-sdk/signature-v4-crt":"3.1015.0","@smithy/snapshot-testing":"^2.0.3","@tsconfig/node20":"20.1.8","@types/node":"^20.14.8",concurrently:"7.0.0","downlevel-dts":"0.10.1",premove:"4.0.0",typescript:"~5.8.3",vitest:"^4.0.17"},engines:{node:">=20.0.0"},typesVersions:{"<4.5":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["dist-*/**"],author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license:"Apache-2.0",browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-s3",repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-s3"}};var c0=W(H0(),1);var P1=W(I6(),1),j6=W(sh(),1);var C1=W(I6(),1),T6="AWS_EC2_METADATA_DISABLED",q6=async(u)=>{let{ENV_CMDS_FULL_URI:D,ENV_CMDS_RELATIVE_URI:B,fromContainerMetadata:A,fromInstanceMetadata:F}=await import("./chunk-b0ca3dzf.js");if(process.env[B]||process.env[D]){u.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromHttp/fromContainerMetadata");let{fromHttp:w}=await import("./chunk-6av6dnxx.js");return C1.chain(w(u),A(u))}if(process.env[T6]&&process.env[T6]!=="false")return async()=>{throw new C1.CredentialsProviderError("EC2 Instance Metadata Service access disabled",{logger:u.logger})};return u.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromInstanceMetadata"),F(u)};function _6(u,D){let B=ah(u),A,F,w,G=async(N)=>{if(N?.forceRefresh)return await B(N);if(w?.expiration){if(w?.expiration?.getTime()<Date.now())w=void 0}if(A)await A;else if(!w||D?.(w))if(w){if(!F)F=B(N).then(($)=>{w=$}).finally(()=>{F=void 0})}else return A=B(N).then(($)=>{w=$}).finally(()=>{A=void 0}),G(N);return w};return G}var ah=(u)=>async(D)=>{let B;for(let A of u)try{return await A(D)}catch(F){if(B=F,F?.tryNextLink)continue;throw F}throw B};var m6=!1,l6=(u={})=>_6([async()=>{if(u.profile??process.env[j6.ENV_PROFILE]){if(process.env[g6]&&process.env[f6]){if(!m6)(u.logger?.warn&&u.logger?.constructor?.name!=="NoOpLogger"?u.logger.warn.bind(u.logger):console.warn)(`@aws-sdk/credential-provider-node - defaultProvider::fromEnv WARNING:
5
5
  Multiple credential sources detected:
6
6
  Both AWS_PROFILE and the pair AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY static credentials are set.
7
7
  This SDK will proceed with the AWS_PROFILE value.
@@ -9,7 +9,7 @@ Headers: ${JSON.stringify(B)}`);this.code=u,this.body=D,this.headers={},B.forEac
9
9
  However, a future version may change this behavior to prefer the ENV static credentials.
10
10
  Please ensure that your environment only sets either the AWS_PROFILE or the
11
11
  AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY pair.
12
- `),_6=!0}throw new P1.CredentialsProviderError("AWS_PROFILE is set, skipping fromEnv provider.",{logger:u.logger,tryNextLink:!0})}return u.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromEnv"),b6(u)()},async(D)=>{u.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromSSO");let{ssoStartUrl:B,ssoAccountId:A,ssoRegion:F,ssoRoleName:w,ssoSession:G}=u;if(!B&&!A&&!F&&!w&&!G)throw new P1.CredentialsProviderError("Skipping SSO provider in default chain (inputs do not include SSO fields).",{logger:u.logger});let{fromSSO:N}=await import("./chunk-tjzbw6eg.js");return N(u)(D)},async(D)=>{u.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromIni");let{fromIni:B}=await import("./chunk-wed042aw.js");return B(u)(D)},async(D)=>{u.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromProcess");let{fromProcess:B}=await import("./chunk-tyjhatbq.js");return B(u)(D)},async(D)=>{u.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromTokenFile");let{fromTokenFile:B}=await import("./chunk-8jns0zmx.js");return B(u)(D)},async()=>{return u.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::remoteProvider"),(await q6(u))()},async()=>{throw new P1.CredentialsProviderError("Could not load credentials from any providers",{tryNextLink:!1,logger:u.logger})}],th);var th=(u)=>u?.expiration!==void 0&&u.expiration.getTime()-Date.now()<300000;var C0=Y(T4(),1),oh="AWS_S3_USE_ARN_REGION",eh="s3_use_arn_region",d6={environmentVariableSelector:(u)=>C0.booleanSelector(u,oh,C0.SelectorType.ENV),configFileSelector:(u)=>C0.booleanSelector(u,eh,C0.SelectorType.CONFIG),default:void 0};var I1=Y(hx(),1),s2=Y($B(),1);var p2=Y(r6(),1);var n6=Y(r6(),1);class P0{bytes;constructor(u){if(this.bytes=u,u.byteLength!==8)throw Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(u){if(u>9223372036854776000||u<-9223372036854776000)throw Error(`${u} is too large (or, if negative, too small) to represent as an Int64`);let D=new Uint8Array(8);for(let B=7,A=Math.abs(Math.round(u));B>-1&&A>0;B--,A/=256)D[B]=A;if(u<0)i6(D);return new P0(D)}valueOf(){let u=this.bytes.slice(0),D=u[0]&128;if(D)i6(u);return parseInt(n6.toHex(u),16)*(D?-1:1)}toString(){return String(this.valueOf())}}function i6(u){for(let D=0;D<8;D++)u[D]^=255;for(let D=7;D>-1;D--)if(u[D]++,u[D]!==0)break}class ID{toUtf8;fromUtf8;constructor(u,D){this.toUtf8=u,this.fromUtf8=D}format(u){let D=[];for(let F of Object.keys(u)){let w=this.fromUtf8(F);D.push(Uint8Array.from([w.byteLength]),w,this.formatHeaderValue(u[F]))}let B=new Uint8Array(D.reduce((F,w)=>F+w.byteLength,0)),A=0;for(let F of D)B.set(F,A),A+=F.byteLength;return B}formatHeaderValue(u){switch(u.type){case"boolean":return Uint8Array.from([u.value?0:1]);case"byte":return Uint8Array.from([2,u.value]);case"short":let D=new DataView(new ArrayBuffer(3));return D.setUint8(0,3),D.setInt16(1,u.value,!1),new Uint8Array(D.buffer);case"integer":let B=new DataView(new ArrayBuffer(5));return B.setUint8(0,4),B.setInt32(1,u.value,!1),new Uint8Array(B.buffer);case"long":let A=new Uint8Array(9);return A[0]=5,A.set(u.value.bytes,1),A;case"binary":let F=new DataView(new ArrayBuffer(3+u.value.byteLength));F.setUint8(0,6),F.setUint16(1,u.value.byteLength,!1);let w=new Uint8Array(F.buffer);return w.set(u.value,3),w;case"string":let G=this.fromUtf8(u.value),N=new DataView(new ArrayBuffer(3+G.byteLength));N.setUint8(0,7),N.setUint16(1,G.byteLength,!1);let $=new Uint8Array(N.buffer);return $.set(G,3),$;case"timestamp":let Z=new Uint8Array(9);return Z[0]=8,Z.set(P0.fromNumber(u.value.valueOf()).bytes,1),Z;case"uuid":if(!$x.test(u.value))throw Error(`Invalid UUID received: ${u.value}`);let v=new Uint8Array(17);return v[0]=9,v.set(p2.fromHex(u.value.replace(/\-/g,"")),1),v}}parse(u){let D={},B=0;while(B<u.byteLength){let A=u.getUint8(B++),F=this.toUtf8(new Uint8Array(u.buffer,u.byteOffset+B,A));switch(B+=A,u.getUint8(B++)){case 0:D[F]={type:a6,value:!0};break;case 1:D[F]={type:a6,value:!1};break;case 2:D[F]={type:ux,value:u.getInt8(B++)};break;case 3:D[F]={type:Dx,value:u.getInt16(B,!1)},B+=2;break;case 4:D[F]={type:Bx,value:u.getInt32(B,!1)},B+=4;break;case 5:D[F]={type:Ax,value:new P0(new Uint8Array(u.buffer,u.byteOffset+B,8))},B+=8;break;case 6:let w=u.getUint16(B,!1);B+=2,D[F]={type:Fx,value:new Uint8Array(u.buffer,u.byteOffset+B,w)},B+=w;break;case 7:let G=u.getUint16(B,!1);B+=2,D[F]={type:wx,value:this.toUtf8(new Uint8Array(u.buffer,u.byteOffset+B,G))},B+=G;break;case 8:D[F]={type:Gx,value:new Date(new P0(new Uint8Array(u.buffer,u.byteOffset+B,8)).valueOf())},B+=8;break;case 9:let N=new Uint8Array(u.buffer,u.byteOffset+B,16);B+=16,D[F]={type:Nx,value:`${p2.toHex(N.subarray(0,4))}-${p2.toHex(N.subarray(4,6))}-${p2.toHex(N.subarray(6,8))}-${p2.toHex(N.subarray(8,10))}-${p2.toHex(N.subarray(10))}`};break;default:throw Error("Unrecognized header type tag")}}return D}}var p6;(function(u){u[u.boolTrue=0]="boolTrue",u[u.boolFalse=1]="boolFalse",u[u.byte=2]="byte",u[u.short=3]="short",u[u.integer=4]="integer",u[u.long=5]="long",u[u.byteArray=6]="byteArray",u[u.string=7]="string",u[u.timestamp=8]="timestamp",u[u.uuid=9]="uuid"})(p6||(p6={}));var a6="boolean",ux="byte",Dx="short",Bx="integer",Ax="long",Fx="binary",wx="string",Gx="timestamp",Nx="uuid",$x=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;var s6=4,a2=s6*2,Q0=4,zx=a2+Q0*2;function t6({byteLength:u,byteOffset:D,buffer:B}){if(u<zx)throw Error("Provided message too short to accommodate event stream message overhead");let A=new DataView(B,D,u),F=A.getUint32(0,!1);if(u!==F)throw Error("Reported message length does not match received message length");let w=A.getUint32(s6,!1),G=A.getUint32(a2,!1),N=A.getUint32(u-Q0,!1),$=new Z0().update(new Uint8Array(B,D,a2));if(G!==$.digest())throw Error(`The prelude checksum specified in the message (${G}) does not match the calculated CRC32 checksum (${$.digest()})`);if($.update(new Uint8Array(B,D+a2,u-(a2+Q0))),N!==$.digest())throw Error(`The message checksum (${$.digest()}) did not match the expected value of ${N}`);return{headers:new DataView(B,D+a2+Q0,w),body:new Uint8Array(B,D+a2+Q0+w,F-w-(a2+Q0+Q0))}}class qD{headerMarshaller;messageBuffer;isEndOfStream;constructor(u,D){this.headerMarshaller=new ID(u,D),this.messageBuffer=[],this.isEndOfStream=!1}feed(u){this.messageBuffer.push(this.decode(u))}endOfStream(){this.isEndOfStream=!0}getMessage(){let u=this.messageBuffer.pop(),D=this.isEndOfStream;return{getMessage(){return u},isEndOfStream(){return D}}}getAvailableMessages(){let u=this.messageBuffer;this.messageBuffer=[];let D=this.isEndOfStream;return{getMessages(){return u},isEndOfStream(){return D}}}encode({headers:u,body:D}){let B=this.headerMarshaller.format(u),A=B.byteLength+D.byteLength+16,F=new Uint8Array(A),w=new DataView(F.buffer,F.byteOffset,F.byteLength),G=new Z0;return w.setUint32(0,A,!1),w.setUint32(4,B.byteLength,!1),w.setUint32(8,G.update(F.subarray(0,8)).digest(),!1),F.set(B,12),F.set(D,B.byteLength+12),w.setUint32(A-4,G.update(F.subarray(8,A-4)).digest(),!1),F}decode(u){let{headers:D,body:B}=t6(u);return{headers:this.headerMarshaller.parse(D),body:B}}formatHeaders(u){return this.headerMarshaller.format(u)}}class mD{options;constructor(u){this.options=u}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let u of this.options.inputStream)yield this.options.decoder.decode(u)}}class _D{options;constructor(u){this.options=u}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let u of this.options.messageStream)yield this.options.encoder.encode(u);if(this.options.includeEndFrame)yield new Uint8Array(0)}}class gD{options;constructor(u){this.options=u}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let u of this.options.messageStream){let D=await this.options.deserializer(u);if(D===void 0)continue;yield D}}}class fD{options;constructor(u){this.options=u}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let u of this.options.inputStream)yield this.options.serializer(u)}}function o6(u){let D=0,B=0,A=null,F=null,w=(N)=>{if(typeof N!=="number")throw Error("Attempted to allocate an event message where size was not a number: "+N);D=N,B=4,A=new Uint8Array(N),new DataView(A.buffer).setUint32(0,N,!1)},G=async function*(){let N=u[Symbol.asyncIterator]();while(!0){let{value:$,done:Z}=await N.next();if(Z){if(!D)return;else if(D===B)yield A;else throw Error("Truncated event message received.");return}let v=$.length,J=0;while(J<v){if(!A){let X=v-J;if(!F)F=new Uint8Array(4);let W=Math.min(4-B,X);if(F.set($.slice(J,J+W),B),B+=W,J+=W,B<4)break;w(new DataView(F.buffer).getUint32(0,!1)),F=null}let Q=Math.min(D-B,v-J);if(A.set($.slice(J,J+Q),B),B+=Q,J+=Q,D&&D===B)yield A,A=null,D=0,B=0}}};return{[Symbol.asyncIterator]:G}}function e6(u,D){return async function(B){let{value:A}=B.headers[":message-type"];if(A==="error"){let F=Error(B.headers[":error-message"].value||"UnknownError");throw F.name=B.headers[":error-code"].value,F}else if(A==="exception"){let F=B.headers[":exception-type"].value,w={[F]:B},G=await u(w);if(G.$unknown){let N=Error(D(B.body));throw N.name=F,N}throw G[F]}else if(A==="event"){let F={[B.headers[":event-type"].value]:B},w=await u(F);if(w.$unknown)return;return w}else throw Error(`Unrecognizable event type: ${B.headers[":event-type"].value}`)}}class bD{eventStreamCodec;utfEncoder;constructor({utf8Encoder:u,utf8Decoder:D}){this.eventStreamCodec=new qD(u,D),this.utfEncoder=u}deserialize(u,D){let B=o6(u);return new gD({messageStream:new mD({inputStream:B,decoder:this.eventStreamCodec}),deserializer:e6(D,this.utfEncoder)})}serialize(u,D){return new _D({messageStream:new fD({inputStream:u,serializer:D}),encoder:this.eventStreamCodec,includeEndFrame:!0})}}import{Readable as Zx}from"stream";async function*uB(u){let D=!1,B=!1,A=[];u.on("error",(F)=>{if(!D)D=!0;if(F)throw F}),u.on("data",(F)=>{A.push(F)}),u.on("end",()=>{D=!0});while(!B){let F=await new Promise((w)=>setTimeout(()=>w(A.shift()),0));if(F)yield F;B=D&&A.length===0}}class jD{universalMarshaller;constructor({utf8Encoder:u,utf8Decoder:D}){this.universalMarshaller=new bD({utf8Decoder:D,utf8Encoder:u})}deserialize(u,D){let B=typeof u[Symbol.asyncIterator]==="function"?u:uB(u);return this.universalMarshaller.deserialize(B,D)}serialize(u,D){return Zx.from(this.universalMarshaller.serialize(u,D))}}var DB=(u)=>new jD(u);var T1=Y(xx(),1);var BB=Y(uD(),1);import{Writable as Jx}from"stream";class lD extends Jx{hash;constructor(u,D){super(D);this.hash=u}_write(u,D,B){try{this.hash.update(BB.toUint8Array(u))}catch(A){return B(A)}B()}}var AB=(u,D)=>{if(D.readableFlowing!==null)throw Error("Unable to calculate hash for flowing readable stream");let B=new u,A=new lD(B);return D.pipe(A),new Promise((F,w)=>{D.on("error",(G)=>{A.end(),w(G)}),A.on("error",w),A.on("finish",()=>{B.digest().then(F).catch(w)})})};var q1=Y(zB(),1),K2=Y(Kx(),1),m1=Y(Yx(),1),_1=Y(R2(),1),ZB=Y(Hx(),1),JB=Y(Sx(),1),QB=Y(Wx(),1);var c1=Y(H0(),1),FB=Y(Xx(),1);var wB=Y(R2(),1),GB=Y(vx(),1),V1=Y(Qx(),1),k1=Y(ou(),1),y1=Y(uD(),1);var NB=(u)=>{return{apiVersion:"2006-03-01",base64Decoder:u?.base64Decoder??V1.fromBase64,base64Encoder:u?.base64Encoder??V1.toBase64,disableHostPrefix:u?.disableHostPrefix??!1,endpointProvider:u?.endpointProvider??Z1,extensions:u?.extensions??[],getAwsChunkedEncodingStream:u?.getAwsChunkedEncodingStream??k1.getAwsChunkedEncodingStream,httpAuthSchemeProvider:u?.httpAuthSchemeProvider??K6,httpAuthSchemes:u?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(D)=>D.getIdentityProvider("aws.auth#sigv4"),signer:new c1.AwsSdkSigV4Signer},{schemeId:"aws.auth#sigv4a",identityProvider:(D)=>D.getIdentityProvider("aws.auth#sigv4a"),signer:new c1.AwsSdkSigV4ASigner}],logger:u?.logger??new wB.NoOpLogger,protocol:u?.protocol??FB.AwsRestXmlProtocol,protocolSettings:u?.protocolSettings??{defaultNamespace:"com.amazonaws.s3",errorTypeRegistries:M6,xmlNamespace:"http://s3.amazonaws.com/doc/2006-03-01/",version:"2006-03-01",serviceTarget:"AmazonS3"},sdkStreamMixin:u?.sdkStreamMixin??k1.sdkStreamMixin,serviceId:u?.serviceId??"S3",signerConstructor:u?.signerConstructor??Wu,signingEscapePath:u?.signingEscapePath??!1,urlParser:u?.urlParser??GB.parseUrl,useArnRegion:u?.useArnRegion??void 0,utf8Decoder:u?.utf8Decoder??y1.fromUtf8,utf8Encoder:u?.utf8Encoder??y1.toUtf8}};var vB=(u)=>{_1.emitWarningIfUnsupportedVersion(process.version);let D=JB.resolveDefaultsModeConfig(u),B=()=>D().then(_1.loadConfigsForDefaultMode),A=NB(u);c0.emitWarningIfUnsupportedVersion(process.version);let F={profile:u?.profile,logger:A.logger};return{...A,...u,runtime:"node",defaultsMode:D,authSchemePreference:u?.authSchemePreference??K2.loadConfig(c0.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS,F),bodyLengthChecker:u?.bodyLengthChecker??ZB.calculateBodyLength,credentialDefaultProvider:u?.credentialDefaultProvider??l6,defaultUserAgentProvider:u?.defaultUserAgentProvider??I1.createDefaultUserAgentProvider({serviceId:A.serviceId,clientVersion:y6.version}),disableS3ExpressSessionAuth:u?.disableS3ExpressSessionAuth??K2.loadConfig(AD,F),eventStreamSerdeProvider:u?.eventStreamSerdeProvider??DB,maxAttempts:u?.maxAttempts??K2.loadConfig(q1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS,u),md5:u?.md5??T1.Hash.bind(null,"md5"),region:u?.region??K2.loadConfig(s2.NODE_REGION_CONFIG_OPTIONS,{...s2.NODE_REGION_CONFIG_FILE_OPTIONS,...F}),requestChecksumCalculation:u?.requestChecksumCalculation??K2.loadConfig(e5,F),requestHandler:m1.NodeHttpHandler.create(u?.requestHandler??B),responseChecksumValidation:u?.responseChecksumValidation??K2.loadConfig(u4,F),retryMode:u?.retryMode??K2.loadConfig({...q1.NODE_RETRY_MODE_CONFIG_OPTIONS,default:async()=>(await B()).retryMode||QB.DEFAULT_RETRY_MODE},u),sha1:u?.sha1??T1.Hash.bind(null,"sha1"),sha256:u?.sha256??T1.Hash.bind(null,"sha256"),sigv4aSigningRegionSet:u?.sigv4aSigningRegionSet??K2.loadConfig(c0.NODE_SIGV4A_CONFIG_OPTIONS,F),streamCollector:u?.streamCollector??m1.streamCollector,streamHasher:u?.streamHasher??AB,useArnRegion:u?.useArnRegion??K2.loadConfig(d6,F),useDualstackEndpoint:u?.useDualstackEndpoint??K2.loadConfig(s2.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,F),useFipsEndpoint:u?.useFipsEndpoint??K2.loadConfig(s2.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,F),userAgentAppId:u?.userAgentAppId??K2.loadConfig(I1.NODE_APP_ID_CONFIG_OPTIONS,F)}};var g1=Y(Rx(),1),f1=Y(g2(),1),b1=Y(R2(),1);var XB=(u)=>{let{httpAuthSchemes:D,httpAuthSchemeProvider:B,credentials:A}=u;return{setHttpAuthScheme(F){let w=D.findIndex((G)=>G.schemeId===F.schemeId);if(w===-1)D.push(F);else D.splice(w,1,F)},httpAuthSchemes(){return D},setHttpAuthSchemeProvider(F){B=F},httpAuthSchemeProvider(){return B},setCredentials(F){A=F},credentials(){return A}}},YB=(u)=>{return{httpAuthSchemes:u.httpAuthSchemes(),httpAuthSchemeProvider:u.httpAuthSchemeProvider(),credentials:u.credentials()}};var WB=(u,D)=>{let B=Object.assign(g1.getAwsRegionExtensionConfiguration(u),b1.getDefaultExtensionConfiguration(u),f1.getHttpHandlerExtensionConfiguration(u),XB(u));return D.forEach((A)=>A.configure(B)),Object.assign(u,g1.resolveAwsRegionExtensionConfiguration(B),b1.resolveDefaultRuntimeConfig(B),f1.resolveHttpHandlerRuntimeConfig(B),YB(B))};class dD extends UB.Client{config;constructor(...[u]){let D=vB(u||{});super(D);this.initConfig=D;let B=x6(D),A=l1.resolveUserAgentConfig(B),F=L4(A),w=d1.resolveRetryConfig(F),G=xB.resolveRegionConfig(w),N=j1.resolveHostHeaderConfig(G),$=RB.resolveEndpointConfig(N),Z=F9($),v=h6(Z),J=o4(v,{session:[()=>this,TD]}),Q=WB(J,u?.extensions||[]);this.config=Q,this.middlewareStack.use(HB.getSchemaSerdePlugin(this.config)),this.middlewareStack.use(l1.getUserAgentPlugin(this.config)),this.middlewareStack.use(d1.getRetryPlugin(this.config)),this.middlewareStack.use(SB.getContentLengthPlugin(this.config)),this.middlewareStack.use(j1.getHostHeaderPlugin(this.config)),this.middlewareStack.use(KB.getLoggerPlugin(this.config)),this.middlewareStack.use(hB.getRecursionDetectionPlugin(this.config)),this.middlewareStack.use(V0.getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:X6,identityProviderConfigProvider:async(X)=>new V0.DefaultIdentityProviderConfig({"aws.auth#sigv4":X.credentials,"aws.auth#sigv4a":X.credentials})})),this.middlewareStack.use(V0.getHttpSigningPlugin(this.config)),this.middlewareStack.use(A9(this.config)),this.middlewareStack.use(t5(this.config)),this.middlewareStack.use(V4(this.config)),this.middlewareStack.use(FD(this.config)),this.middlewareStack.use(wD(this.config))}destroy(){super.destroy()}}function Cx(u){return(D)=>async(B)=>{let A={...B.input},F=[{target:"SSECustomerKey",hash:"SSECustomerKeyMD5"},{target:"CopySourceSSECustomerKey",hash:"CopySourceSSECustomerKeyMD5"}];for(let w of F){let G=A[w.target];if(G){let N;if(typeof G==="string")if(cx(G,u))N=u.base64Decoder(G);else N=u.utf8Decoder(G),A[w.target]=u.base64Encoder(N);else N=ArrayBuffer.isView(G)?new Uint8Array(G.buffer,G.byteOffset,G.byteLength):new Uint8Array(G),A[w.target]=u.base64Encoder(N);let $=new u.md5;$.update(N),A[w.hash]=u.base64Encoder(await $.digest())}}return D({...B,input:A})}}var Px={name:"ssecMiddleware",step:"initialize",tags:["SSE"],override:!0},k0=(u)=>({applyToStack:(D)=>{D.add(Cx(u),Px)}});function cx(u,D){if(!/^(?:[A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(u))return!1;try{return D.base64Decoder(u).length===32}catch{return!1}}var MB=Y(J0(),1),LB=Y(R2(),1);class i1 extends LB.Command.classBuilder().ep({...m2,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(u,D,B,A){return[MB.getEndpointPlugin(B,u.getEndpointParameterInstructions()),u1(B,{requestChecksumRequired:!1,requestValidationModeMember:"ChecksumMode",responseAlgorithms:["CRC64NVME","CRC32","CRC32C","SHA256","SHA1"]}),k0(B),D1(B)]}).s("AmazonS3","GetObject",{}).n("S3Client","GetObjectCommand").sc(O6).build(){}var EB=Y(J0(),1),OB=Y(R2(),1);class iD extends OB.Command.classBuilder().ep({...m2,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(u,D,B,A){return[EB.getEndpointPlugin(B,u.getEndpointParameterInstructions()),r2(B),k0(B),D1(B)]}).s("AmazonS3","HeadObject",{}).n("S3Client","HeadObjectCommand").sc(C6).build(){}var CB=Y(J0(),1),PB=Y(R2(),1);class rD extends PB.Command.classBuilder().ep({...m2,Bucket:{type:"contextParams",name:"Bucket"},Prefix:{type:"contextParams",name:"Prefix"}}).m(function(u,D,B,A){return[CB.getEndpointPlugin(B,u.getEndpointParameterInstructions()),r2(B)]}).s("AmazonS3","ListObjectsV2",{}).n("S3Client","ListObjectsV2Command").sc(P6).build(){}var cB=Y(J0(),1),VB=Y(R2(),1);class nD extends VB.Command.classBuilder().ep({...m2,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(u,D,B,A){return[cB.getEndpointPlugin(B,u.getEndpointParameterInstructions()),u1(B,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!1}),C4(B),r2(B),k0(B)]}).s("AmazonS3","PutObject",{}).n("S3Client","PutObjectCommand").sc(c6).build(){}import{Buffer as kB}from"buffer";class yB extends l2{client;constructor(...u){super();this.client=new dD(...u)}async put(u){let D,B,A,F=process.env.BUCKET_NAME;if(u instanceof Blob)D=u,A=`${Bun.randomUUIDv7()}.${u.type.split("/")[1].split(";")[0]}`,B=u.type;else D=u.body,A=u.name,F=u.bucket??F,B=u.contentType||(D instanceof Blob||D instanceof File?D.type:void 0);B=B||void 0;let w=D instanceof kB?D:D instanceof Blob||D instanceof File?kB.from(await D.arrayBuffer()):"";return await this.client.send(new nD({Bucket:F,Key:A,Body:w,ContentType:B})),A}async list(u){return await this.client.send(new rD({Bucket:process.env.BUCKET_NAME,Prefix:u}))}async fetch(u){let D=process.env.BUCKET_NAME,B;if(typeof u==="string")B=u;else D=u.bucket??D,B=u.name;if(!B)throw Error("Object name has to be specified");let A=await this.client.send(new i1({Bucket:D,Key:B}));return new Response(A.Body.transformToWebStream(),{headers:{"Content-Type":A.ContentType,"Content-Length":A.ContentLength.toString(),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":A.LastModified?.toUTCString()||"",ETag:A.ETag||""}})}async read(u){let D=typeof u==="string"?{name:u}:u,B=D.bucket??process.env.BUCKET_NAME,{name:A,range:F=null}=D;if(!A)throw Error("Object name has to be specified");let w;try{w=await this.client.send(new i1({Bucket:B,Key:A,Range:F?pD(F):void 0}))}catch(Z){if(Z?.name==="InvalidRange"||Z?.$metadata?.httpStatusCode===416)throw new d2(await this.size({name:A,bucket:B}));if(Z?.name==="NoSuchKey"||Z?.$metadata?.httpStatusCode===404)throw new Z2(A);throw Z}let G=Uu(w.ContentRange),N=Boolean(G)&&w.$metadata?.httpStatusCode===206,$=G?.total??w.ContentLength??0;return{body:w.Body.transformToWebStream(),start:G?.start??0,end:G?.end??$-1,total:$,partial:N,type:w.ContentType??"application/octet-stream",etag:w.ETag||void 0,lastModified:w.LastModified,name:A}}async size(u){let D=typeof u==="string"?u:u.name,B=(typeof u==="string"?void 0:u.bucket)??process.env.BUCKET_NAME;try{return(await this.client.send(new iD({Bucket:B,Key:D}))).ContentLength??0}catch(A){if(A?.name==="NotFound"||A?.$metadata?.httpStatusCode===404)throw new Z2(D);throw A}}}import{Buffer as TB}from"buffer";import{Readable as Vx}from"stream";function aD(u){return u?.statusCode===404||u?.details?.errorCode==="BlobNotFound"||u?.code==="BlobNotFound"}function kx(u){return u?.statusCode===416||u?.details?.errorCode==="InvalidRange"||u?.code==="InvalidRange"}class IB extends l2{config;serviceClientPromise=null;constructor(u={}){super();this.config=u}async serviceClient(){if(this.config.serviceClient)return this.config.serviceClient;return this.serviceClientPromise??=(async()=>{let u;try{u=await import("@azure/storage-blob")}catch{throw Error("AzureBlobDriver requires the '@azure/storage-blob' package. Install it with `bun add @azure/storage-blob`, or pass a pre-built `serviceClient`.")}let D=this.config.connectionString??process.env.AZURE_STORAGE_CONNECTION_STRING;if(this.config.url)return new u.BlobServiceClient(this.config.url,this.config.credential);if(D)return u.BlobServiceClient.fromConnectionString(D);throw Error("AzureBlobDriver needs a connection string (AZURE_STORAGE_CONNECTION_STRING), a `url`, or a `serviceClient`.")})(),this.serviceClientPromise}async blob(u,D){if(!u)throw Error("Object name has to be specified");let B=D??this.config.container??process.env.BUCKET_NAME;if(!B)throw Error("AzureBlobDriver needs a container name, from `bucket`, the `container` config, or BUCKET_NAME.");return(await this.serviceClient()).getContainerClient(B).getBlockBlobClient(u)}async put(u){let D,B,A,F;if(u instanceof Blob)D=u,A=`${Bun.randomUUIDv7()}.${u.type.split("/")[1].split(";")[0]}`,B=u.type;else D=u.body,A=u.name,F=u.bucket,B=u.contentType??(D instanceof Blob||D instanceof File?D.type:void 0);let w=D instanceof TB?D:TB.from(await D.arrayBuffer());return await(await this.blob(A,F)).uploadData(w,{blobHTTPHeaders:B?{blobContentType:B}:void 0}),A}async list(u){let D=this.config.container??process.env.BUCKET_NAME,A=(await this.serviceClient()).getContainerClient(D),F=[];for await(let w of A.listBlobsFlat({prefix:u}))F.push(w.name);return F}async fetch(u){let D=await this.read(typeof u==="string"?{name:u}:{name:u.name,bucket:u.bucket});return new Response(D.body,{headers:{"Content-Type":D.type,"Content-Length":String(D.total),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":D.lastModified?.toUTCString()??"",ETag:D.etag??""}})}async read(u){let D=typeof u==="string"?{name:u}:u,{name:B,bucket:A,range:F=null}=D,w=await this.blob(B,A),G,N,$=F?.kind==="suffix"||F?.kind==="offset"&&F.end===null&&F.start===0;if(F&&$){let X=await this.size({name:B,bucket:A}),W=wu(F,X);if(!W)throw new d2(X);G=W.start,N=W.length}else if(F?.kind==="offset")G=F.start,N=F.end===null?void 0:F.end-F.start+1;let Z;try{Z=await w.download(G,N)}catch(X){if(kx(X))throw new d2(await this.size({name:B,bucket:A}));if(aD(X))throw new Z2(B);throw X}let v=Uu(Z.contentRange),J=Boolean(v),Q=v?.total??Z.contentLength??0;return{body:await yx(Z),start:v?.start??0,end:v?.end??Q-1,total:Q,partial:J,type:Z.contentType??"application/octet-stream",etag:Z.etag||void 0,lastModified:Z.lastModified,name:B}}async size(u){let D=typeof u==="string"?u:u.name,B=typeof u==="string"?void 0:u.bucket,A=await this.blob(D,B);try{return(await A.getProperties()).contentLength??0}catch(F){if(aD(F))throw new Z2(D);throw F}}async delete(u){let D=typeof u==="string"?u:u.name,B=typeof u==="string"?void 0:u.bucket,A=await this.blob(D,B);try{await A.delete()}catch(F){if(aD(F))throw new Z2(D);throw F}}}async function yx(u){if(u.blobBody)return await u.blobBody;if(u.readableStreamBody)return Vx.toWeb(u.readableStreamBody);return null}function r1(u,D){return Math.floor(u/D)*D}function Tx(u,D){if(D<=0)return 0;return Math.min(1,Math.max(0,(D-u)/D))}function sD(u,D,B,A){return D*Tx(B,A)+u}function Ix(u){let{current:D,previous:B,elapsed:A,window:F,limit:w,cost:G}=u,N=w-G;if(N<0)return F;let $=Math.max(0,F-A);if(B>0){let v=F*(1-(N-D)/B);if(v<=F)return Math.max(0,Math.ceil(v-A))}if(D<=N)return $;if(D<=0)return $;let Z=F*(1-N/D);return $+Math.max(0,Math.ceil(Z))}function n1(u){let{allowed:D,current:B,previous:A,now:F,elapsed:w,window:G,limit:N,cost:$}=u;if(D){let v=sD(B,A,w,G);return{allowed:!0,limit:N,remaining:Math.max(0,Math.floor(N-v)),resetAt:F-w+G,retryAfter:0}}let Z=Ix({current:B,previous:A,elapsed:w,window:G,limit:N,cost:$});return{allowed:!1,limit:N,remaining:0,resetAt:F+Z,retryAfter:Z}}class y0{}class p1 extends y0{buckets=new Map;maxKeys;constructor(u={}){super();this.maxKeys=Math.max(1,u.maxKeys??1e5)}consume(u){let{key:D,limit:B,window:A}=u,F=u.cost??1,w=Date.now(),G=r1(w,A),N=w-G,$=this.roll(D,A,G),v=sD($.current,$.previous,N,A)+F<=B;if(v)$.current+=F;if(this.buckets.delete(D),this.buckets.set(D,$),this.buckets.size>this.maxKeys)this.evict(w);return n1({allowed:v,current:$.current,previous:$.previous,now:w,elapsed:N,window:A,limit:B,cost:F})}clear(){this.buckets.clear()}get size(){return this.buckets.size}roll(u,D,B){let A=this.buckets.get(u);if(!A||A.window!==D)return{window:D,windowStart:B,current:0,previous:0};if(A.windowStart===B)return A;if(A.windowStart+D===B)return A.previous=A.current,A.current=0,A.windowStart=B,A;return A.previous=0,A.current=0,A.windowStart=B,A}evict(u){for(let[D,B]of this.buckets)if(u-B.windowStart>=B.window*2)this.buckets.delete(D);for(let D of this.buckets.keys()){if(this.buckets.size<=this.maxKeys)break;this.buckets.delete(D)}}}class qB extends f{driver=new p1;limit=1000;window=60;boot(){}}var qx=`
12
+ `),m6=!0}throw new P1.CredentialsProviderError("AWS_PROFILE is set, skipping fromEnv provider.",{logger:u.logger,tryNextLink:!0})}return u.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromEnv"),b6(u)()},async(D)=>{u.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromSSO");let{ssoStartUrl:B,ssoAccountId:A,ssoRegion:F,ssoRoleName:w,ssoSession:G}=u;if(!B&&!A&&!F&&!w&&!G)throw new P1.CredentialsProviderError("Skipping SSO provider in default chain (inputs do not include SSO fields).",{logger:u.logger});let{fromSSO:N}=await import("./chunk-tjzbw6eg.js");return N(u)(D)},async(D)=>{u.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromIni");let{fromIni:B}=await import("./chunk-wed042aw.js");return B(u)(D)},async(D)=>{u.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromProcess");let{fromProcess:B}=await import("./chunk-tyjhatbq.js");return B(u)(D)},async(D)=>{u.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromTokenFile");let{fromTokenFile:B}=await import("./chunk-8jns0zmx.js");return B(u)(D)},async()=>{return u.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::remoteProvider"),(await q6(u))()},async()=>{throw new P1.CredentialsProviderError("Could not load credentials from any providers",{tryNextLink:!1,logger:u.logger})}],th);var th=(u)=>u?.expiration!==void 0&&u.expiration.getTime()-Date.now()<300000;var C0=W(T4(),1),oh="AWS_S3_USE_ARN_REGION",eh="s3_use_arn_region",d6={environmentVariableSelector:(u)=>C0.booleanSelector(u,oh,C0.SelectorType.ENV),configFileSelector:(u)=>C0.booleanSelector(u,eh,C0.SelectorType.CONFIG),default:void 0};var I1=W(hx(),1),s2=W($B(),1);var p2=W(r6(),1);var n6=W(r6(),1);class P0{bytes;constructor(u){if(this.bytes=u,u.byteLength!==8)throw Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(u){if(u>9223372036854776000||u<-9223372036854776000)throw Error(`${u} is too large (or, if negative, too small) to represent as an Int64`);let D=new Uint8Array(8);for(let B=7,A=Math.abs(Math.round(u));B>-1&&A>0;B--,A/=256)D[B]=A;if(u<0)i6(D);return new P0(D)}valueOf(){let u=this.bytes.slice(0),D=u[0]&128;if(D)i6(u);return parseInt(n6.toHex(u),16)*(D?-1:1)}toString(){return String(this.valueOf())}}function i6(u){for(let D=0;D<8;D++)u[D]^=255;for(let D=7;D>-1;D--)if(u[D]++,u[D]!==0)break}class ID{toUtf8;fromUtf8;constructor(u,D){this.toUtf8=u,this.fromUtf8=D}format(u){let D=[];for(let F of Object.keys(u)){let w=this.fromUtf8(F);D.push(Uint8Array.from([w.byteLength]),w,this.formatHeaderValue(u[F]))}let B=new Uint8Array(D.reduce((F,w)=>F+w.byteLength,0)),A=0;for(let F of D)B.set(F,A),A+=F.byteLength;return B}formatHeaderValue(u){switch(u.type){case"boolean":return Uint8Array.from([u.value?0:1]);case"byte":return Uint8Array.from([2,u.value]);case"short":let D=new DataView(new ArrayBuffer(3));return D.setUint8(0,3),D.setInt16(1,u.value,!1),new Uint8Array(D.buffer);case"integer":let B=new DataView(new ArrayBuffer(5));return B.setUint8(0,4),B.setInt32(1,u.value,!1),new Uint8Array(B.buffer);case"long":let A=new Uint8Array(9);return A[0]=5,A.set(u.value.bytes,1),A;case"binary":let F=new DataView(new ArrayBuffer(3+u.value.byteLength));F.setUint8(0,6),F.setUint16(1,u.value.byteLength,!1);let w=new Uint8Array(F.buffer);return w.set(u.value,3),w;case"string":let G=this.fromUtf8(u.value),N=new DataView(new ArrayBuffer(3+G.byteLength));N.setUint8(0,7),N.setUint16(1,G.byteLength,!1);let $=new Uint8Array(N.buffer);return $.set(G,3),$;case"timestamp":let Z=new Uint8Array(9);return Z[0]=8,Z.set(P0.fromNumber(u.value.valueOf()).bytes,1),Z;case"uuid":if(!$x.test(u.value))throw Error(`Invalid UUID received: ${u.value}`);let Y=new Uint8Array(17);return Y[0]=9,Y.set(p2.fromHex(u.value.replace(/\-/g,"")),1),Y}}parse(u){let D={},B=0;while(B<u.byteLength){let A=u.getUint8(B++),F=this.toUtf8(new Uint8Array(u.buffer,u.byteOffset+B,A));switch(B+=A,u.getUint8(B++)){case 0:D[F]={type:a6,value:!0};break;case 1:D[F]={type:a6,value:!1};break;case 2:D[F]={type:ux,value:u.getInt8(B++)};break;case 3:D[F]={type:Dx,value:u.getInt16(B,!1)},B+=2;break;case 4:D[F]={type:Bx,value:u.getInt32(B,!1)},B+=4;break;case 5:D[F]={type:Ax,value:new P0(new Uint8Array(u.buffer,u.byteOffset+B,8))},B+=8;break;case 6:let w=u.getUint16(B,!1);B+=2,D[F]={type:Fx,value:new Uint8Array(u.buffer,u.byteOffset+B,w)},B+=w;break;case 7:let G=u.getUint16(B,!1);B+=2,D[F]={type:wx,value:this.toUtf8(new Uint8Array(u.buffer,u.byteOffset+B,G))},B+=G;break;case 8:D[F]={type:Gx,value:new Date(new P0(new Uint8Array(u.buffer,u.byteOffset+B,8)).valueOf())},B+=8;break;case 9:let N=new Uint8Array(u.buffer,u.byteOffset+B,16);B+=16,D[F]={type:Nx,value:`${p2.toHex(N.subarray(0,4))}-${p2.toHex(N.subarray(4,6))}-${p2.toHex(N.subarray(6,8))}-${p2.toHex(N.subarray(8,10))}-${p2.toHex(N.subarray(10))}`};break;default:throw Error("Unrecognized header type tag")}}return D}}var p6;(function(u){u[u.boolTrue=0]="boolTrue",u[u.boolFalse=1]="boolFalse",u[u.byte=2]="byte",u[u.short=3]="short",u[u.integer=4]="integer",u[u.long=5]="long",u[u.byteArray=6]="byteArray",u[u.string=7]="string",u[u.timestamp=8]="timestamp",u[u.uuid=9]="uuid"})(p6||(p6={}));var a6="boolean",ux="byte",Dx="short",Bx="integer",Ax="long",Fx="binary",wx="string",Gx="timestamp",Nx="uuid",$x=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;var s6=4,a2=s6*2,Q0=4,zx=a2+Q0*2;function t6({byteLength:u,byteOffset:D,buffer:B}){if(u<zx)throw Error("Provided message too short to accommodate event stream message overhead");let A=new DataView(B,D,u),F=A.getUint32(0,!1);if(u!==F)throw Error("Reported message length does not match received message length");let w=A.getUint32(s6,!1),G=A.getUint32(a2,!1),N=A.getUint32(u-Q0,!1),$=new Z0().update(new Uint8Array(B,D,a2));if(G!==$.digest())throw Error(`The prelude checksum specified in the message (${G}) does not match the calculated CRC32 checksum (${$.digest()})`);if($.update(new Uint8Array(B,D+a2,u-(a2+Q0))),N!==$.digest())throw Error(`The message checksum (${$.digest()}) did not match the expected value of ${N}`);return{headers:new DataView(B,D+a2+Q0,w),body:new Uint8Array(B,D+a2+Q0+w,F-w-(a2+Q0+Q0))}}class qD{headerMarshaller;messageBuffer;isEndOfStream;constructor(u,D){this.headerMarshaller=new ID(u,D),this.messageBuffer=[],this.isEndOfStream=!1}feed(u){this.messageBuffer.push(this.decode(u))}endOfStream(){this.isEndOfStream=!0}getMessage(){let u=this.messageBuffer.pop(),D=this.isEndOfStream;return{getMessage(){return u},isEndOfStream(){return D}}}getAvailableMessages(){let u=this.messageBuffer;this.messageBuffer=[];let D=this.isEndOfStream;return{getMessages(){return u},isEndOfStream(){return D}}}encode({headers:u,body:D}){let B=this.headerMarshaller.format(u),A=B.byteLength+D.byteLength+16,F=new Uint8Array(A),w=new DataView(F.buffer,F.byteOffset,F.byteLength),G=new Z0;return w.setUint32(0,A,!1),w.setUint32(4,B.byteLength,!1),w.setUint32(8,G.update(F.subarray(0,8)).digest(),!1),F.set(B,12),F.set(D,B.byteLength+12),w.setUint32(A-4,G.update(F.subarray(8,A-4)).digest(),!1),F}decode(u){let{headers:D,body:B}=t6(u);return{headers:this.headerMarshaller.parse(D),body:B}}formatHeaders(u){return this.headerMarshaller.format(u)}}class _D{options;constructor(u){this.options=u}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let u of this.options.inputStream)yield this.options.decoder.decode(u)}}class mD{options;constructor(u){this.options=u}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let u of this.options.messageStream)yield this.options.encoder.encode(u);if(this.options.includeEndFrame)yield new Uint8Array(0)}}class gD{options;constructor(u){this.options=u}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let u of this.options.messageStream){let D=await this.options.deserializer(u);if(D===void 0)continue;yield D}}}class fD{options;constructor(u){this.options=u}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let u of this.options.inputStream)yield this.options.serializer(u)}}function o6(u){let D=0,B=0,A=null,F=null,w=(N)=>{if(typeof N!=="number")throw Error("Attempted to allocate an event message where size was not a number: "+N);D=N,B=4,A=new Uint8Array(N),new DataView(A.buffer).setUint32(0,N,!1)},G=async function*(){let N=u[Symbol.asyncIterator]();while(!0){let{value:$,done:Z}=await N.next();if(Z){if(!D)return;else if(D===B)yield A;else throw Error("Truncated event message received.");return}let Y=$.length,J=0;while(J<Y){if(!A){let X=Y-J;if(!F)F=new Uint8Array(4);let v=Math.min(4-B,X);if(F.set($.slice(J,J+v),B),B+=v,J+=v,B<4)break;w(new DataView(F.buffer).getUint32(0,!1)),F=null}let Q=Math.min(D-B,Y-J);if(A.set($.slice(J,J+Q),B),B+=Q,J+=Q,D&&D===B)yield A,A=null,D=0,B=0}}};return{[Symbol.asyncIterator]:G}}function e6(u,D){return async function(B){let{value:A}=B.headers[":message-type"];if(A==="error"){let F=Error(B.headers[":error-message"].value||"UnknownError");throw F.name=B.headers[":error-code"].value,F}else if(A==="exception"){let F=B.headers[":exception-type"].value,w={[F]:B},G=await u(w);if(G.$unknown){let N=Error(D(B.body));throw N.name=F,N}throw G[F]}else if(A==="event"){let F={[B.headers[":event-type"].value]:B},w=await u(F);if(w.$unknown)return;return w}else throw Error(`Unrecognizable event type: ${B.headers[":event-type"].value}`)}}class bD{eventStreamCodec;utfEncoder;constructor({utf8Encoder:u,utf8Decoder:D}){this.eventStreamCodec=new qD(u,D),this.utfEncoder=u}deserialize(u,D){let B=o6(u);return new gD({messageStream:new _D({inputStream:B,decoder:this.eventStreamCodec}),deserializer:e6(D,this.utfEncoder)})}serialize(u,D){return new mD({messageStream:new fD({inputStream:u,serializer:D}),encoder:this.eventStreamCodec,includeEndFrame:!0})}}import{Readable as Zx}from"stream";async function*uB(u){let D=!1,B=!1,A=[];u.on("error",(F)=>{if(!D)D=!0;if(F)throw F}),u.on("data",(F)=>{A.push(F)}),u.on("end",()=>{D=!0});while(!B){let F=await new Promise((w)=>setTimeout(()=>w(A.shift()),0));if(F)yield F;B=D&&A.length===0}}class jD{universalMarshaller;constructor({utf8Encoder:u,utf8Decoder:D}){this.universalMarshaller=new bD({utf8Decoder:D,utf8Encoder:u})}deserialize(u,D){let B=typeof u[Symbol.asyncIterator]==="function"?u:uB(u);return this.universalMarshaller.deserialize(B,D)}serialize(u,D){return Zx.from(this.universalMarshaller.serialize(u,D))}}var DB=(u)=>new jD(u);var T1=W(xx(),1);var BB=W(uD(),1);import{Writable as Jx}from"stream";class lD extends Jx{hash;constructor(u,D){super(D);this.hash=u}_write(u,D,B){try{this.hash.update(BB.toUint8Array(u))}catch(A){return B(A)}B()}}var AB=(u,D)=>{if(D.readableFlowing!==null)throw Error("Unable to calculate hash for flowing readable stream");let B=new u,A=new lD(B);return D.pipe(A),new Promise((F,w)=>{D.on("error",(G)=>{A.end(),w(G)}),A.on("error",w),A.on("finish",()=>{B.digest().then(F).catch(w)})})};var q1=W(zB(),1),K2=W(Kx(),1),_1=W(Wx(),1),m1=W(R2(),1),ZB=W(Hx(),1),JB=W(Sx(),1),QB=W(vx(),1);var c1=W(H0(),1),FB=W(Xx(),1);var wB=W(R2(),1),GB=W(Yx(),1),V1=W(Qx(),1),k1=W(ou(),1),y1=W(uD(),1);var NB=(u)=>{return{apiVersion:"2006-03-01",base64Decoder:u?.base64Decoder??V1.fromBase64,base64Encoder:u?.base64Encoder??V1.toBase64,disableHostPrefix:u?.disableHostPrefix??!1,endpointProvider:u?.endpointProvider??Z1,extensions:u?.extensions??[],getAwsChunkedEncodingStream:u?.getAwsChunkedEncodingStream??k1.getAwsChunkedEncodingStream,httpAuthSchemeProvider:u?.httpAuthSchemeProvider??K6,httpAuthSchemes:u?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(D)=>D.getIdentityProvider("aws.auth#sigv4"),signer:new c1.AwsSdkSigV4Signer},{schemeId:"aws.auth#sigv4a",identityProvider:(D)=>D.getIdentityProvider("aws.auth#sigv4a"),signer:new c1.AwsSdkSigV4ASigner}],logger:u?.logger??new wB.NoOpLogger,protocol:u?.protocol??FB.AwsRestXmlProtocol,protocolSettings:u?.protocolSettings??{defaultNamespace:"com.amazonaws.s3",errorTypeRegistries:M6,xmlNamespace:"http://s3.amazonaws.com/doc/2006-03-01/",version:"2006-03-01",serviceTarget:"AmazonS3"},sdkStreamMixin:u?.sdkStreamMixin??k1.sdkStreamMixin,serviceId:u?.serviceId??"S3",signerConstructor:u?.signerConstructor??vu,signingEscapePath:u?.signingEscapePath??!1,urlParser:u?.urlParser??GB.parseUrl,useArnRegion:u?.useArnRegion??void 0,utf8Decoder:u?.utf8Decoder??y1.fromUtf8,utf8Encoder:u?.utf8Encoder??y1.toUtf8}};var YB=(u)=>{m1.emitWarningIfUnsupportedVersion(process.version);let D=JB.resolveDefaultsModeConfig(u),B=()=>D().then(m1.loadConfigsForDefaultMode),A=NB(u);c0.emitWarningIfUnsupportedVersion(process.version);let F={profile:u?.profile,logger:A.logger};return{...A,...u,runtime:"node",defaultsMode:D,authSchemePreference:u?.authSchemePreference??K2.loadConfig(c0.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS,F),bodyLengthChecker:u?.bodyLengthChecker??ZB.calculateBodyLength,credentialDefaultProvider:u?.credentialDefaultProvider??l6,defaultUserAgentProvider:u?.defaultUserAgentProvider??I1.createDefaultUserAgentProvider({serviceId:A.serviceId,clientVersion:y6.version}),disableS3ExpressSessionAuth:u?.disableS3ExpressSessionAuth??K2.loadConfig(AD,F),eventStreamSerdeProvider:u?.eventStreamSerdeProvider??DB,maxAttempts:u?.maxAttempts??K2.loadConfig(q1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS,u),md5:u?.md5??T1.Hash.bind(null,"md5"),region:u?.region??K2.loadConfig(s2.NODE_REGION_CONFIG_OPTIONS,{...s2.NODE_REGION_CONFIG_FILE_OPTIONS,...F}),requestChecksumCalculation:u?.requestChecksumCalculation??K2.loadConfig(e5,F),requestHandler:_1.NodeHttpHandler.create(u?.requestHandler??B),responseChecksumValidation:u?.responseChecksumValidation??K2.loadConfig(u4,F),retryMode:u?.retryMode??K2.loadConfig({...q1.NODE_RETRY_MODE_CONFIG_OPTIONS,default:async()=>(await B()).retryMode||QB.DEFAULT_RETRY_MODE},u),sha1:u?.sha1??T1.Hash.bind(null,"sha1"),sha256:u?.sha256??T1.Hash.bind(null,"sha256"),sigv4aSigningRegionSet:u?.sigv4aSigningRegionSet??K2.loadConfig(c0.NODE_SIGV4A_CONFIG_OPTIONS,F),streamCollector:u?.streamCollector??_1.streamCollector,streamHasher:u?.streamHasher??AB,useArnRegion:u?.useArnRegion??K2.loadConfig(d6,F),useDualstackEndpoint:u?.useDualstackEndpoint??K2.loadConfig(s2.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,F),useFipsEndpoint:u?.useFipsEndpoint??K2.loadConfig(s2.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,F),userAgentAppId:u?.userAgentAppId??K2.loadConfig(I1.NODE_APP_ID_CONFIG_OPTIONS,F)}};var g1=W(Rx(),1),f1=W(g2(),1),b1=W(R2(),1);var XB=(u)=>{let{httpAuthSchemes:D,httpAuthSchemeProvider:B,credentials:A}=u;return{setHttpAuthScheme(F){let w=D.findIndex((G)=>G.schemeId===F.schemeId);if(w===-1)D.push(F);else D.splice(w,1,F)},httpAuthSchemes(){return D},setHttpAuthSchemeProvider(F){B=F},httpAuthSchemeProvider(){return B},setCredentials(F){A=F},credentials(){return A}}},WB=(u)=>{return{httpAuthSchemes:u.httpAuthSchemes(),httpAuthSchemeProvider:u.httpAuthSchemeProvider(),credentials:u.credentials()}};var vB=(u,D)=>{let B=Object.assign(g1.getAwsRegionExtensionConfiguration(u),b1.getDefaultExtensionConfiguration(u),f1.getHttpHandlerExtensionConfiguration(u),XB(u));return D.forEach((A)=>A.configure(B)),Object.assign(u,g1.resolveAwsRegionExtensionConfiguration(B),b1.resolveDefaultRuntimeConfig(B),f1.resolveHttpHandlerRuntimeConfig(B),WB(B))};class dD extends UB.Client{config;constructor(...[u]){let D=YB(u||{});super(D);this.initConfig=D;let B=x6(D),A=l1.resolveUserAgentConfig(B),F=L4(A),w=d1.resolveRetryConfig(F),G=xB.resolveRegionConfig(w),N=j1.resolveHostHeaderConfig(G),$=RB.resolveEndpointConfig(N),Z=F9($),Y=h6(Z),J=o4(Y,{session:[()=>this,TD]}),Q=vB(J,u?.extensions||[]);this.config=Q,this.middlewareStack.use(HB.getSchemaSerdePlugin(this.config)),this.middlewareStack.use(l1.getUserAgentPlugin(this.config)),this.middlewareStack.use(d1.getRetryPlugin(this.config)),this.middlewareStack.use(SB.getContentLengthPlugin(this.config)),this.middlewareStack.use(j1.getHostHeaderPlugin(this.config)),this.middlewareStack.use(KB.getLoggerPlugin(this.config)),this.middlewareStack.use(hB.getRecursionDetectionPlugin(this.config)),this.middlewareStack.use(V0.getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:X6,identityProviderConfigProvider:async(X)=>new V0.DefaultIdentityProviderConfig({"aws.auth#sigv4":X.credentials,"aws.auth#sigv4a":X.credentials})})),this.middlewareStack.use(V0.getHttpSigningPlugin(this.config)),this.middlewareStack.use(A9(this.config)),this.middlewareStack.use(t5(this.config)),this.middlewareStack.use(V4(this.config)),this.middlewareStack.use(FD(this.config)),this.middlewareStack.use(wD(this.config))}destroy(){super.destroy()}}function Cx(u){return(D)=>async(B)=>{let A={...B.input},F=[{target:"SSECustomerKey",hash:"SSECustomerKeyMD5"},{target:"CopySourceSSECustomerKey",hash:"CopySourceSSECustomerKeyMD5"}];for(let w of F){let G=A[w.target];if(G){let N;if(typeof G==="string")if(cx(G,u))N=u.base64Decoder(G);else N=u.utf8Decoder(G),A[w.target]=u.base64Encoder(N);else N=ArrayBuffer.isView(G)?new Uint8Array(G.buffer,G.byteOffset,G.byteLength):new Uint8Array(G),A[w.target]=u.base64Encoder(N);let $=new u.md5;$.update(N),A[w.hash]=u.base64Encoder(await $.digest())}}return D({...B,input:A})}}var Px={name:"ssecMiddleware",step:"initialize",tags:["SSE"],override:!0},k0=(u)=>({applyToStack:(D)=>{D.add(Cx(u),Px)}});function cx(u,D){if(!/^(?:[A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(u))return!1;try{return D.base64Decoder(u).length===32}catch{return!1}}var MB=W(J0(),1),LB=W(R2(),1);class i1 extends LB.Command.classBuilder().ep({..._2,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(u,D,B,A){return[MB.getEndpointPlugin(B,u.getEndpointParameterInstructions()),u1(B,{requestChecksumRequired:!1,requestValidationModeMember:"ChecksumMode",responseAlgorithms:["CRC64NVME","CRC32","CRC32C","SHA256","SHA1"]}),k0(B),D1(B)]}).s("AmazonS3","GetObject",{}).n("S3Client","GetObjectCommand").sc(O6).build(){}var EB=W(J0(),1),OB=W(R2(),1);class iD extends OB.Command.classBuilder().ep({..._2,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(u,D,B,A){return[EB.getEndpointPlugin(B,u.getEndpointParameterInstructions()),r2(B),k0(B),D1(B)]}).s("AmazonS3","HeadObject",{}).n("S3Client","HeadObjectCommand").sc(C6).build(){}var CB=W(J0(),1),PB=W(R2(),1);class rD extends PB.Command.classBuilder().ep({..._2,Bucket:{type:"contextParams",name:"Bucket"},Prefix:{type:"contextParams",name:"Prefix"}}).m(function(u,D,B,A){return[CB.getEndpointPlugin(B,u.getEndpointParameterInstructions()),r2(B)]}).s("AmazonS3","ListObjectsV2",{}).n("S3Client","ListObjectsV2Command").sc(P6).build(){}var cB=W(J0(),1),VB=W(R2(),1);class nD extends VB.Command.classBuilder().ep({..._2,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function(u,D,B,A){return[cB.getEndpointPlugin(B,u.getEndpointParameterInstructions()),u1(B,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!1}),C4(B),r2(B),k0(B)]}).s("AmazonS3","PutObject",{}).n("S3Client","PutObjectCommand").sc(c6).build(){}import{Buffer as kB}from"buffer";class yB extends l2{client;constructor(...u){super();this.client=new dD(...u)}async put(u){let D,B,A,F=process.env.BUCKET_NAME;if(u instanceof Blob)D=u,A=`${Bun.randomUUIDv7()}.${u.type.split("/")[1].split(";")[0]}`,B=u.type;else D=u.body,A=u.name,F=u.bucket??F,B=u.contentType||(D instanceof Blob||D instanceof File?D.type:void 0);B=B||void 0;let w=D instanceof kB?D:D instanceof Blob||D instanceof File?kB.from(await D.arrayBuffer()):"";return await this.client.send(new nD({Bucket:F,Key:A,Body:w,ContentType:B})),A}async list(u){return await this.client.send(new rD({Bucket:process.env.BUCKET_NAME,Prefix:u}))}async fetch(u){let D=process.env.BUCKET_NAME,B;if(typeof u==="string")B=u;else D=u.bucket??D,B=u.name;if(!B)throw Error("Object name has to be specified");let A=await this.client.send(new i1({Bucket:D,Key:B}));return new Response(A.Body.transformToWebStream(),{headers:{"Content-Type":A.ContentType,"Content-Length":A.ContentLength.toString(),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":A.LastModified?.toUTCString()||"",ETag:A.ETag||""}})}async read(u){let D=typeof u==="string"?{name:u}:u,B=D.bucket??process.env.BUCKET_NAME,{name:A,range:F=null}=D;if(!A)throw Error("Object name has to be specified");let w;try{w=await this.client.send(new i1({Bucket:B,Key:A,Range:F?pD(F):void 0}))}catch(Z){if(Z?.name==="InvalidRange"||Z?.$metadata?.httpStatusCode===416)throw new d2(await this.size({name:A,bucket:B}));if(Z?.name==="NoSuchKey"||Z?.$metadata?.httpStatusCode===404)throw new Z2(A);throw Z}let G=Uu(w.ContentRange),N=Boolean(G)&&w.$metadata?.httpStatusCode===206,$=G?.total??w.ContentLength??0;return{body:w.Body.transformToWebStream(),start:G?.start??0,end:G?.end??$-1,total:$,partial:N,type:w.ContentType??"application/octet-stream",etag:w.ETag||void 0,lastModified:w.LastModified,name:A}}async size(u){let D=typeof u==="string"?u:u.name,B=(typeof u==="string"?void 0:u.bucket)??process.env.BUCKET_NAME;try{return(await this.client.send(new iD({Bucket:B,Key:D}))).ContentLength??0}catch(A){if(A?.name==="NotFound"||A?.$metadata?.httpStatusCode===404)throw new Z2(D);throw A}}}import{Buffer as TB}from"buffer";import{Readable as Vx}from"stream";function aD(u){return u?.statusCode===404||u?.details?.errorCode==="BlobNotFound"||u?.code==="BlobNotFound"}function kx(u){return u?.statusCode===416||u?.details?.errorCode==="InvalidRange"||u?.code==="InvalidRange"}class IB extends l2{config;serviceClientPromise=null;constructor(u={}){super();this.config=u}async serviceClient(){if(this.config.serviceClient)return this.config.serviceClient;return this.serviceClientPromise??=(async()=>{let u;try{u=await import("@azure/storage-blob")}catch{throw Error("AzureBlobDriver requires the '@azure/storage-blob' package. Install it with `bun add @azure/storage-blob`, or pass a pre-built `serviceClient`.")}let D=this.config.connectionString??process.env.AZURE_STORAGE_CONNECTION_STRING;if(this.config.url)return new u.BlobServiceClient(this.config.url,this.config.credential);if(D)return u.BlobServiceClient.fromConnectionString(D);throw Error("AzureBlobDriver needs a connection string (AZURE_STORAGE_CONNECTION_STRING), a `url`, or a `serviceClient`.")})(),this.serviceClientPromise}async blob(u,D){if(!u)throw Error("Object name has to be specified");let B=D??this.config.container??process.env.BUCKET_NAME;if(!B)throw Error("AzureBlobDriver needs a container name, from `bucket`, the `container` config, or BUCKET_NAME.");return(await this.serviceClient()).getContainerClient(B).getBlockBlobClient(u)}async put(u){let D,B,A,F;if(u instanceof Blob)D=u,A=`${Bun.randomUUIDv7()}.${u.type.split("/")[1].split(";")[0]}`,B=u.type;else D=u.body,A=u.name,F=u.bucket,B=u.contentType??(D instanceof Blob||D instanceof File?D.type:void 0);let w=D instanceof TB?D:TB.from(await D.arrayBuffer());return await(await this.blob(A,F)).uploadData(w,{blobHTTPHeaders:B?{blobContentType:B}:void 0}),A}async list(u){let D=this.config.container??process.env.BUCKET_NAME,A=(await this.serviceClient()).getContainerClient(D),F=[];for await(let w of A.listBlobsFlat({prefix:u}))F.push(w.name);return F}async fetch(u){let D=await this.read(typeof u==="string"?{name:u}:{name:u.name,bucket:u.bucket});return new Response(D.body,{headers:{"Content-Type":D.type,"Content-Length":String(D.total),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":D.lastModified?.toUTCString()??"",ETag:D.etag??""}})}async read(u){let D=typeof u==="string"?{name:u}:u,{name:B,bucket:A,range:F=null}=D,w=await this.blob(B,A),G,N,$=F?.kind==="suffix"||F?.kind==="offset"&&F.end===null&&F.start===0;if(F&&$){let X=await this.size({name:B,bucket:A}),v=wu(F,X);if(!v)throw new d2(X);G=v.start,N=v.length}else if(F?.kind==="offset")G=F.start,N=F.end===null?void 0:F.end-F.start+1;let Z;try{Z=await w.download(G,N)}catch(X){if(kx(X))throw new d2(await this.size({name:B,bucket:A}));if(aD(X))throw new Z2(B);throw X}let Y=Uu(Z.contentRange),J=Boolean(Y),Q=Y?.total??Z.contentLength??0;return{body:await yx(Z),start:Y?.start??0,end:Y?.end??Q-1,total:Q,partial:J,type:Z.contentType??"application/octet-stream",etag:Z.etag||void 0,lastModified:Z.lastModified,name:B}}async size(u){let D=typeof u==="string"?u:u.name,B=typeof u==="string"?void 0:u.bucket,A=await this.blob(D,B);try{return(await A.getProperties()).contentLength??0}catch(F){if(aD(F))throw new Z2(D);throw F}}async delete(u){let D=typeof u==="string"?u:u.name,B=typeof u==="string"?void 0:u.bucket,A=await this.blob(D,B);try{await A.delete()}catch(F){if(aD(F))throw new Z2(D);throw F}}}async function yx(u){if(u.blobBody)return await u.blobBody;if(u.readableStreamBody)return Vx.toWeb(u.readableStreamBody);return null}function r1(u,D){return Math.floor(u/D)*D}function Tx(u,D){if(D<=0)return 0;return Math.min(1,Math.max(0,(D-u)/D))}function sD(u,D,B,A){return D*Tx(B,A)+u}function Ix(u){let{current:D,previous:B,elapsed:A,window:F,limit:w,cost:G}=u,N=w-G;if(N<0)return F;let $=Math.max(0,F-A);if(B>0){let Y=F*(1-(N-D)/B);if(Y<=F)return Math.max(0,Math.ceil(Y-A))}if(D<=N)return $;if(D<=0)return $;let Z=F*(1-N/D);return $+Math.max(0,Math.ceil(Z))}function n1(u){let{allowed:D,current:B,previous:A,now:F,elapsed:w,window:G,limit:N,cost:$}=u;if(D){let Y=sD(B,A,w,G);return{allowed:!0,limit:N,remaining:Math.max(0,Math.floor(N-Y)),resetAt:F-w+G,retryAfter:0}}let Z=Ix({current:B,previous:A,elapsed:w,window:G,limit:N,cost:$});return{allowed:!1,limit:N,remaining:0,resetAt:F+Z,retryAfter:Z}}class y0{}class p1 extends y0{buckets=new Map;maxKeys;constructor(u={}){super();this.maxKeys=Math.max(1,u.maxKeys??1e5)}consume(u){let{key:D,limit:B,window:A}=u,F=u.cost??1,w=Date.now(),G=r1(w,A),N=w-G,$=this.roll(D,A,G),Y=sD($.current,$.previous,N,A)+F<=B;if(Y)$.current+=F;if(this.buckets.delete(D),this.buckets.set(D,$),this.buckets.size>this.maxKeys)this.evict(w);return n1({allowed:Y,current:$.current,previous:$.previous,now:w,elapsed:N,window:A,limit:B,cost:F})}clear(){this.buckets.clear()}get size(){return this.buckets.size}roll(u,D,B){let A=this.buckets.get(u);if(!A||A.window!==D)return{window:D,windowStart:B,current:0,previous:0};if(A.windowStart===B)return A;if(A.windowStart+D===B)return A.previous=A.current,A.current=0,A.windowStart=B,A;return A.previous=0,A.current=0,A.windowStart=B,A}evict(u){for(let[D,B]of this.buckets)if(u-B.windowStart>=B.window*2)this.buckets.delete(D);for(let D of this.buckets.keys()){if(this.buckets.size<=this.maxKeys)break;this.buckets.delete(D)}}}class qB extends f{driver=new p1;limit=1000;window=60;boot(){}}var qx=`
13
13
  local currentKey = KEYS[1]
14
14
  local previousKey = KEYS[2]
15
15
  local limit = tonumber(ARGV[1])
@@ -36,7 +36,7 @@ current = redis.call("INCRBY", currentKey, cost)
36
36
  redis.call("PEXPIRE", currentKey, window * 2)
37
37
 
38
38
  return {1, current, previous}
39
- `;class _B extends y0{injectedClient;prefix;failOpen;onError;scriptSha=null;constructor(u={}){super();this.injectedClient=u.client,this.prefix=u.prefix??"gemi:rl",this.failOpen=u.failOpen??!0,this.onError=u.onError??((D)=>console.error(D))}async consume(u){let{key:D,limit:B,window:A}=u,F=u.cost??1,w=Date.now(),G=r1(w,A),N=w-G,$=G/A;try{let Z=await this.run([`${this.prefix}:${D}:${$}`,`${this.prefix}:${D}:${$-1}`],[String(B),String(A),String(N),String(F)]),[v,J,Q]=(Array.isArray(Z)?Z:[]).map(Number);return n1({allowed:v===1,current:Number.isFinite(J)?J:0,previous:Number.isFinite(Q)?Q:0,now:w,elapsed:N,window:A,limit:B,cost:F})}catch(Z){if(this.onError(Z),!this.failOpen)return{allowed:!1,limit:B,remaining:0,resetAt:w+A,retryAfter:A};return{allowed:!0,limit:B,remaining:Math.max(0,Math.floor(B-F)),resetAt:G+A,retryAfter:0}}}get client(){if(this.injectedClient)return this.injectedClient;let D=mB.getStore()?.RedisServiceContainer?.client;if(!D)throw Error("RedisRateLimiter could not reach the Redis client. Register RedisServiceProvider on your kernel, or pass a client: new RedisRateLimiter({ client }).");return D}async run(u,D){let B=this.client,A=[String(u.length),...u,...D];try{return await B.send("EVALSHA",[await this.load(B),...A])}catch(F){if(!mx(F))throw F;return this.scriptSha=null,await B.send("EVALSHA",[await this.load(B),...A])}}load(u){if(!this.scriptSha)this.scriptSha=Promise.resolve(u.send("SCRIPT",["LOAD",qx])).then(String).catch((D)=>{throw this.scriptSha=null,D});return this.scriptSha}}function mx(u){return String(u?.message??u).includes("NOSCRIPT")}var t2=new TextEncoder;var Mu=new Uint8Array(256);for(let u=0;u<64;u++)Mu["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(u)]=u;function a1(u){let D=Math.ceil(u.length/4)*3,B=u.length,A=0;if(u.length%4===3)D--;else if(u.length%4===2)D-=2;else if(u[u.length-1]==="="){if(D--,u[u.length-2]==="=")D--}let F=new ArrayBuffer(D),w=new Uint8Array(F);for(let G=0;G<B;G+=4){let N=Mu[u.charCodeAt(G)],$=Mu[u.charCodeAt(G+1)],Z=Mu[u.charCodeAt(G+2)],v=Mu[u.charCodeAt(G+3)];w[A++]=N<<2|$>>4,w[A++]=($&15)<<4|Z>>2,w[A++]=(Z&3)<<6|v&63}return F}function T0(u){u=u||"utf8";let D;try{D=new TextDecoder(u)}catch(B){D=new TextDecoder("windows-1252")}return D}async function o2(u){if("arrayBuffer"in u)return await u.arrayBuffer();let D=new FileReader;return new Promise((B,A)=>{D.onload=function(F){B(F.target.result)},D.onerror=function(F){A(D.error)},D.readAsArrayBuffer(u)})}function gB(u){if(u>=48&&u<=57||u>=97&&u<=102||u>=65&&u<=70)return String.fromCharCode(u);return!1}function _x(u,D,B){let A=u.indexOf("*");if(A>=0)u=u.substr(0,A);D=D.toUpperCase();let F;if(D==="Q"){B=B.replace(/=\s+([0-9a-fA-F])/g,"=$1").replace(/[_\s]/g," ");let w=t2.encode(B),G=[];for(let $=0,Z=w.length;$<Z;$++){let v=w[$];if($<=Z-2&&v===61){let J=gB(w[$+1]),Q=gB(w[$+2]);if(J&&Q){let X=parseInt(J+Q,16);G.push(X),$+=2;continue}}G.push(v)}F=new ArrayBuffer(G.length);let N=new DataView(F);for(let $=0,Z=G.length;$<Z;$++)N.setUint8($,G[$])}else if(D==="B")F=a1(B.replace(/[^a-zA-Z0-9\+\/=]+/g,""));else F=t2.encode(B);return T0(u).decode(F)}function v0(u){let D=!0,B=!1;while(!B){let A=(u||"").toString().replace(/(=\?([^?]+)\?[Bb]\?([^?]*)\?=)\s*(?==\?([^?]+)\?[Bb]\?[^?]*\?=)/g,(F,w,G,N,$)=>{if(!D)return F;if(G===$&&N.length%4===0&&!/=$/.test(N))return w+"__\x00JOIN\x00__";return F}).replace(/(=\?([^?]+)\?[Qq]\?[^?]*\?=)\s*(?==\?([^?]+)\?[Qq]\?[^?]*\?=)/g,(F,w,G,N)=>{if(!D)return F;if(G===N)return w+"__\x00JOIN\x00__";return F}).replace(/(\?=)?__\x00JOIN\x00__(=\?([^?]+)\?[QqBb]\?)?/g,"").replace(/(=\?[^?]+\?[QqBb]\?[^?]*\?=)\s+(?==\?[^?]+\?[QqBb]\?[^?]*\?=)/g,"$1").replace(/=\?([\w_\-*]+)\?([QqBb])\?([^?]*)\?=/g,(F,w,G,N)=>_x(w,G,N));if(D&&A.indexOf("\uFFFD")>=0)D=!1;else return A}}function gx(u,D){D=D||"utf-8";let B=[];for(let w=0;w<u.length;w++){let G=u.charAt(w);if(G==="%"&&/^[a-f0-9]{2}/i.test(u.substr(w+1,2))){let N=u.substr(w+1,2);w+=2,B.push(parseInt(N,16))}else if(G.charCodeAt(0)>126){G=t2.encode(G);for(let N=0;N<G.length;N++)B.push(G[N])}else B.push(G.charCodeAt(0))}let A=new ArrayBuffer(B.length),F=new DataView(A);for(let w=0,G=B.length;w<G;w++)F.setUint8(w,B[w]);return T0(D).decode(A)}function fB(u){let D=new Map;Object.keys(u.params).forEach((B)=>{let A=B.match(/\*((\d+)\*?)?$/);if(!A)return;let F=B.substr(0,A.index).toLowerCase(),w=Number(A[2])||0,G;if(!D.has(F))G={charset:!1,values:[]},D.set(F,G);else G=D.get(F);let N=u.params[B];if(w===0&&A[0].charAt(A[0].length-1)==="*"&&(A=N.match(/^([^']*)'[^']*'(.*)$/)))G.charset=A[1]||"utf-8",N=A[2];G.values.push({nr:w,value:N}),delete u.params[B]}),D.forEach((B,A)=>{u.params[A]=gx(B.values.sort((F,w)=>F.nr-w.nr).map((F)=>F.value).join(""),B.charset)})}class s1{constructor(){this.chunks=[]}update(u){this.chunks.push(u),this.chunks.push(`
39
+ `;class mB extends y0{injectedClient;prefix;failOpen;onError;scriptSha=null;constructor(u={}){super();this.injectedClient=u.client,this.prefix=u.prefix??"gemi:rl",this.failOpen=u.failOpen??!0,this.onError=u.onError??((D)=>console.error(D))}async consume(u){let{key:D,limit:B,window:A}=u,F=u.cost??1,w=Date.now(),G=r1(w,A),N=w-G,$=G/A;try{let Z=await this.run([`${this.prefix}:${D}:${$}`,`${this.prefix}:${D}:${$-1}`],[String(B),String(A),String(N),String(F)]),[Y,J,Q]=(Array.isArray(Z)?Z:[]).map(Number);return n1({allowed:Y===1,current:Number.isFinite(J)?J:0,previous:Number.isFinite(Q)?Q:0,now:w,elapsed:N,window:A,limit:B,cost:F})}catch(Z){if(this.onError(Z),!this.failOpen)return{allowed:!1,limit:B,remaining:0,resetAt:w+A,retryAfter:A};return{allowed:!0,limit:B,remaining:Math.max(0,Math.floor(B-F)),resetAt:G+A,retryAfter:0}}}get client(){if(this.injectedClient)return this.injectedClient;let D=_B.getStore()?.RedisServiceContainer?.client;if(!D)throw Error("RedisRateLimiter could not reach the Redis client. Register RedisServiceProvider on your kernel, or pass a client: new RedisRateLimiter({ client }).");return D}async run(u,D){let B=this.client,A=[String(u.length),...u,...D];try{return await B.send("EVALSHA",[await this.load(B),...A])}catch(F){if(!_x(F))throw F;return this.scriptSha=null,await B.send("EVALSHA",[await this.load(B),...A])}}load(u){if(!this.scriptSha)this.scriptSha=Promise.resolve(u.send("SCRIPT",["LOAD",qx])).then(String).catch((D)=>{throw this.scriptSha=null,D});return this.scriptSha}}function _x(u){return String(u?.message??u).includes("NOSCRIPT")}var t2=new TextEncoder;var Mu=new Uint8Array(256);for(let u=0;u<64;u++)Mu["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(u)]=u;function a1(u){let D=Math.ceil(u.length/4)*3,B=u.length,A=0;if(u.length%4===3)D--;else if(u.length%4===2)D-=2;else if(u[u.length-1]==="="){if(D--,u[u.length-2]==="=")D--}let F=new ArrayBuffer(D),w=new Uint8Array(F);for(let G=0;G<B;G+=4){let N=Mu[u.charCodeAt(G)],$=Mu[u.charCodeAt(G+1)],Z=Mu[u.charCodeAt(G+2)],Y=Mu[u.charCodeAt(G+3)];w[A++]=N<<2|$>>4,w[A++]=($&15)<<4|Z>>2,w[A++]=(Z&3)<<6|Y&63}return F}function T0(u){u=u||"utf8";let D;try{D=new TextDecoder(u)}catch(B){D=new TextDecoder("windows-1252")}return D}async function o2(u){if("arrayBuffer"in u)return await u.arrayBuffer();let D=new FileReader;return new Promise((B,A)=>{D.onload=function(F){B(F.target.result)},D.onerror=function(F){A(D.error)},D.readAsArrayBuffer(u)})}function gB(u){if(u>=48&&u<=57||u>=97&&u<=102||u>=65&&u<=70)return String.fromCharCode(u);return!1}function mx(u,D,B){let A=u.indexOf("*");if(A>=0)u=u.substr(0,A);D=D.toUpperCase();let F;if(D==="Q"){B=B.replace(/=\s+([0-9a-fA-F])/g,"=$1").replace(/[_\s]/g," ");let w=t2.encode(B),G=[];for(let $=0,Z=w.length;$<Z;$++){let Y=w[$];if($<=Z-2&&Y===61){let J=gB(w[$+1]),Q=gB(w[$+2]);if(J&&Q){let X=parseInt(J+Q,16);G.push(X),$+=2;continue}}G.push(Y)}F=new ArrayBuffer(G.length);let N=new DataView(F);for(let $=0,Z=G.length;$<Z;$++)N.setUint8($,G[$])}else if(D==="B")F=a1(B.replace(/[^a-zA-Z0-9\+\/=]+/g,""));else F=t2.encode(B);return T0(u).decode(F)}function Y0(u){let D=!0,B=!1;while(!B){let A=(u||"").toString().replace(/(=\?([^?]+)\?[Bb]\?([^?]*)\?=)\s*(?==\?([^?]+)\?[Bb]\?[^?]*\?=)/g,(F,w,G,N,$)=>{if(!D)return F;if(G===$&&N.length%4===0&&!/=$/.test(N))return w+"__\x00JOIN\x00__";return F}).replace(/(=\?([^?]+)\?[Qq]\?[^?]*\?=)\s*(?==\?([^?]+)\?[Qq]\?[^?]*\?=)/g,(F,w,G,N)=>{if(!D)return F;if(G===N)return w+"__\x00JOIN\x00__";return F}).replace(/(\?=)?__\x00JOIN\x00__(=\?([^?]+)\?[QqBb]\?)?/g,"").replace(/(=\?[^?]+\?[QqBb]\?[^?]*\?=)\s+(?==\?[^?]+\?[QqBb]\?[^?]*\?=)/g,"$1").replace(/=\?([\w_\-*]+)\?([QqBb])\?([^?]*)\?=/g,(F,w,G,N)=>mx(w,G,N));if(D&&A.indexOf("\uFFFD")>=0)D=!1;else return A}}function gx(u,D){D=D||"utf-8";let B=[];for(let w=0;w<u.length;w++){let G=u.charAt(w);if(G==="%"&&/^[a-f0-9]{2}/i.test(u.substr(w+1,2))){let N=u.substr(w+1,2);w+=2,B.push(parseInt(N,16))}else if(G.charCodeAt(0)>126){G=t2.encode(G);for(let N=0;N<G.length;N++)B.push(G[N])}else B.push(G.charCodeAt(0))}let A=new ArrayBuffer(B.length),F=new DataView(A);for(let w=0,G=B.length;w<G;w++)F.setUint8(w,B[w]);return T0(D).decode(A)}function fB(u){let D=new Map;Object.keys(u.params).forEach((B)=>{let A=B.match(/\*((\d+)\*?)?$/);if(!A)return;let F=B.substr(0,A.index).toLowerCase(),w=Number(A[2])||0,G;if(!D.has(F))G={charset:!1,values:[]},D.set(F,G);else G=D.get(F);let N=u.params[B];if(w===0&&A[0].charAt(A[0].length-1)==="*"&&(A=N.match(/^([^']*)'[^']*'(.*)$/)))G.charset=A[1]||"utf-8",N=A[2];G.values.push({nr:w,value:N}),delete u.params[B]}),D.forEach((B,A)=>{u.params[A]=gx(B.values.sort((F,w)=>F.nr-w.nr).map((F)=>F.value).join(""),B.charset)})}class s1{constructor(){this.chunks=[]}update(u){this.chunks.push(u),this.chunks.push(`
40
40
  `)}finalize(){return o2(new Blob(this.chunks,{type:"application/octet-stream"}))}}class t1{constructor(u){u=u||{},this.decoder=u.decoder||new TextDecoder,this.maxChunkSize=102400,this.chunks=[],this.remainder=""}update(u){let D=this.decoder.decode(u);if(D=D.replace(/[^a-zA-Z0-9+\/]+/g,""),this.remainder+=D,this.remainder.length>=this.maxChunkSize){let B=Math.floor(this.remainder.length/4)*4,A;if(B===this.remainder.length)A=this.remainder,this.remainder="";else A=this.remainder.substr(0,B),this.remainder=this.remainder.substr(B);if(A.length)this.chunks.push(a1(A))}}finalize(){if(this.remainder&&!/^=+$/.test(this.remainder))this.chunks.push(a1(this.remainder));return o2(new Blob(this.chunks,{type:"application/octet-stream"}))}}var bB=/^=[a-f0-9]{2}$/i,fx=/(?==[a-f0-9]{2})/i,bx=/=\r?\n/g,jx=/=[a-fA-F0-9]?$/;class o1{constructor(u){u=u||{},this.decoder=u.decoder||new TextDecoder,this.maxChunkSize=102400,this.remainder="",this.chunks=[]}decodeQPBytes(u){let D=new ArrayBuffer(u.length),B=new DataView(D);for(let A=0,F=u.length;A<F;A++)B.setUint8(A,parseInt(u[A],16));return D}decodeChunks(u){u=u.replace(bx,"");let D=u.split(fx),B=[];for(let A of D){if(A.charAt(0)!=="="){if(B.length)this.chunks.push(this.decodeQPBytes(B)),B=[];this.chunks.push(A);continue}if(A.length===3){if(bB.test(A))B.push(A.substr(1));else{if(B.length)this.chunks.push(this.decodeQPBytes(B)),B=[];this.chunks.push(A)}continue}if(A.length>3){let F=A.substr(0,3);if(bB.test(F))B.push(A.substr(1,2)),this.chunks.push(this.decodeQPBytes(B)),B=[],A=A.substr(3),this.chunks.push(A);else{if(B.length)this.chunks.push(this.decodeQPBytes(B)),B=[];this.chunks.push(A)}}}if(B.length)this.chunks.push(this.decodeQPBytes(B))}update(u){let D=this.decoder.decode(u)+`
41
41
  `;if(D=this.remainder+D,D.length<this.maxChunkSize){this.remainder=D;return}this.remainder="";let B=D.match(jx);if(B){if(B.index===0){this.remainder=D;return}this.remainder=D.substr(B.index),D=D.substr(0,B.index)}this.decodeChunks(D)}finalize(){if(this.remainder.length)this.decodeChunks(this.remainder),this.remainder="";return o2(new Blob(this.chunks,{type:"application/octet-stream"}))}}var lx=T0();class Lu{constructor(u){if(this.options=u||{},this.postalMime=this.options.postalMime,this.root=!!this.options.parentNode,this.childNodes=[],this.options.parentNode){if(this.parentNode=this.options.parentNode,this.depth=this.parentNode.depth+1,this.depth>this.options.maxNestingDepth)throw Error(`Maximum MIME nesting depth of ${this.options.maxNestingDepth} levels exceeded`);this.options.parentNode.childNodes.push(this)}else this.depth=0;this.state="header",this.headerLines=[],this.headerSize=0;let B=(this.options.parentMultipartType||null)==="digest"?"message/rfc822":"text/plain";this.contentType={value:B,default:!0},this.contentTransferEncoding={value:"8bit"},this.contentDisposition={value:""},this.headers=[],this.contentDecoder=!1}setupContentDecoder(u){if(/base64/i.test(u))this.contentDecoder=new t1;else if(/quoted-printable/i.test(u))this.contentDecoder=new o1({decoder:T0(this.contentType.parsed.params.charset)});else this.contentDecoder=new s1}async finalize(){if(this.state==="finished")return;if(this.state==="header")this.processHeaders();let u=this.postalMime.boundaries;for(let D=u.length-1;D>=0;D--)if(u[D].node===this){u.splice(D,1);break}await this.finalizeChildNodes(),this.content=this.contentDecoder?await this.contentDecoder.finalize():null,this.state="finished"}async finalizeChildNodes(){for(let u of this.childNodes)await u.finalize()}stripComments(u){let D="",B=0,A=!1,F=!1;for(let w=0;w<u.length;w++){let G=u.charAt(w);if(A){if(B===0)D+=G;A=!1;continue}if(G==="\\"){if(A=!0,B===0)D+=G;continue}if(G==='"'&&B===0){F=!F,D+=G;continue}if(!F){if(G==="("){B++;continue}if(G===")"&&B>0){B--;continue}}if(B===0)D+=G}return D}parseStructuredHeader(u){u=this.stripComments(u);let D={value:!1,params:{}},B=!1,A="",F="value",w=!1,G=!1,N;for(let $=0,Z=u.length;$<Z;$++)switch(N=u.charAt($),F){case"key":if(N==="="){B=A.trim().toLowerCase(),F="value",A="";break}A+=N;break;case"value":if(G)A+=N;else if(N==="\\"){G=!0;continue}else if(w&&N===w)w=!1;else if(!w&&N==='"')w=N;else if(!w&&N===";"){if(B===!1)D.value=A.trim();else D.params[B]=A.trim();F="key",A=""}else A+=N;G=!1;break}if(A=A.trim(),F==="value")if(B===!1)D.value=A;else D.params[B]=A;else if(A)D.params[A.toLowerCase()]="";if(D.value)D.value=D.value.toLowerCase();return fB(D),D}decodeFlowedText(u,D){return u.split(/\r?\n/).reduce((B,A)=>{if(B.endsWith(" ")&&B!=="-- "&&!B.endsWith(`
42
42
  -- `))if(D)return B.slice(0,-1)+A;else return B+A;else return B+`
@@ -59,17 +59,17 @@ ${D.join(`
59
59
  `)}
60
60
  ${F}
61
61
  `}function D8(u){let D=[];if(u.from)D.push(`<div class="postal-email-header-key">From</div><div class="postal-email-header-value">${iB(u.from)}</div>`);if(u.subject)D.push(`<div class="postal-email-header-key">Subject</div><div class="postal-email-header-value postal-email-header-subject">${X0(u.subject)}</div>`);if(u.date){let A={year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1},F=typeof Intl>"u"?u.date:new Intl.DateTimeFormat("default",A).format(new Date(u.date));D.push(`<div class="postal-email-header-key">Date</div><div class="postal-email-header-value postal-email-header-date" data-date="${X0(u.date)}">${X0(F)}</div>`)}if(u.to&&u.to.length)D.push(`<div class="postal-email-header-key">To</div><div class="postal-email-header-value">${eD(u.to)}</div>`);if(u.cc&&u.cc.length)D.push(`<div class="postal-email-header-key">Cc</div><div class="postal-email-header-value">${eD(u.cc)}</div>`);if(u.bcc&&u.bcc.length)D.push(`<div class="postal-email-header-key">Bcc</div><div class="postal-email-header-value">${eD(u.bcc)}</div>`);return`<div class="postal-email-header">${D.length?'<div class="postal-email-header-row">':""}${D.join(`</div>
62
- <div class="postal-email-header-row">`)}${D.length?"</div>":""}</div>`}function nx(u,D){let B=!1,A="text",F,w=[],G={address:[],comment:[],group:[],text:[],textWasQuoted:[]},N,$,Z=!1;for(N=0,$=u.length;N<$;N++){let v=u[N],J=N?u[N-1]:null;if(v.type==="operator")switch(v.value){case"<":A="address",Z=!1;break;case"(":A="comment",Z=!1;break;case":":A="group",B=!0,Z=!1;break;case'"':Z=!Z,A="text";break;default:A="text",Z=!1;break}else if(v.value){if(A==="address")v.value=v.value.replace(/^[^<]*<\s*/,"");if(J&&J.noBreak&&G[A].length){if(G[A][G[A].length-1]+=v.value,A==="text"&&Z)G.textWasQuoted[G.textWasQuoted.length-1]=!0}else if(G[A].push(v.value),A==="text")G.textWasQuoted.push(Z)}}if(!G.text.length&&G.comment.length)G.text=G.comment,G.comment=[];if(B){G.text=G.text.join(" ");let v=[];if(G.group.length)B8(G.group.join(","),{_depth:D+1}).forEach((Q)=>{if(Q.group)v=v.concat(Q.group);else v.push(Q)});w.push({name:v0(G.text||F&&F.name),group:v})}else{if(!G.address.length&&G.text.length){for(N=G.text.length-1;N>=0;N--)if(!G.textWasQuoted[N]&&G.text[N].match(/^[^@\s]+@[^@\s]+$/)){G.address=G.text.splice(N,1),G.textWasQuoted.splice(N,1);break}let v=function(J){if(!G.address.length)return G.address=[J.trim()]," ";else return J};if(!G.address.length){for(N=G.text.length-1;N>=0;N--)if(!G.textWasQuoted[N]){if(G.text[N]=G.text[N].replace(/\s*\b[^@\s]+@[^\s]+\b\s*/,v).trim(),G.address.length)break}}}if(!G.text.length&&G.comment.length)G.text=G.comment,G.comment=[];if(G.address.length>1)G.text=G.text.concat(G.address.splice(1));if(G.text=G.text.join(" "),G.address=G.address.join(" "),!G.address&&/^=\?[^=]+?=$/.test(G.text.trim())){let v=v0(G.text);if(/<[^<>]+@[^<>]+>/.test(v)){let J=B8(v);if(J&&J.length)return J}return[{address:"",name:v}]}if(F={address:G.address||G.text||"",name:v0(G.text||G.address||"")},F.address===F.name)if((F.address||"").match(/@/))F.name="";else F.address="";w.push(F)}return w}class rB{constructor(u){this.str=(u||"").toString(),this.operatorCurrent="",this.operatorExpecting="",this.node=null,this.escaped=!1,this.list=[],this.operators={'"':'"',"(":")","<":">",",":"",":":";",";":""}}tokenize(){let u=[];for(let D=0,B=this.str.length;D<B;D++){let A=this.str.charAt(D),F=D<B-1?this.str.charAt(D+1):null;this.checkChar(A,F)}return this.list.forEach((D)=>{if(D.value=(D.value||"").toString().trim(),D.value)u.push(D)}),u}checkChar(u,D){if(this.escaped);else if(u===this.operatorExpecting){if(this.node={type:"operator",value:u},D&&![" ","\t","\r",`
62
+ <div class="postal-email-header-row">`)}${D.length?"</div>":""}</div>`}function nx(u,D){let B=!1,A="text",F,w=[],G={address:[],comment:[],group:[],text:[],textWasQuoted:[]},N,$,Z=!1;for(N=0,$=u.length;N<$;N++){let Y=u[N],J=N?u[N-1]:null;if(Y.type==="operator")switch(Y.value){case"<":A="address",Z=!1;break;case"(":A="comment",Z=!1;break;case":":A="group",B=!0,Z=!1;break;case'"':Z=!Z,A="text";break;default:A="text",Z=!1;break}else if(Y.value){if(A==="address")Y.value=Y.value.replace(/^[^<]*<\s*/,"");if(J&&J.noBreak&&G[A].length){if(G[A][G[A].length-1]+=Y.value,A==="text"&&Z)G.textWasQuoted[G.textWasQuoted.length-1]=!0}else if(G[A].push(Y.value),A==="text")G.textWasQuoted.push(Z)}}if(!G.text.length&&G.comment.length)G.text=G.comment,G.comment=[];if(B){G.text=G.text.join(" ");let Y=[];if(G.group.length)B8(G.group.join(","),{_depth:D+1}).forEach((Q)=>{if(Q.group)Y=Y.concat(Q.group);else Y.push(Q)});w.push({name:Y0(G.text||F&&F.name),group:Y})}else{if(!G.address.length&&G.text.length){for(N=G.text.length-1;N>=0;N--)if(!G.textWasQuoted[N]&&G.text[N].match(/^[^@\s]+@[^@\s]+$/)){G.address=G.text.splice(N,1),G.textWasQuoted.splice(N,1);break}let Y=function(J){if(!G.address.length)return G.address=[J.trim()]," ";else return J};if(!G.address.length){for(N=G.text.length-1;N>=0;N--)if(!G.textWasQuoted[N]){if(G.text[N]=G.text[N].replace(/\s*\b[^@\s]+@[^\s]+\b\s*/,Y).trim(),G.address.length)break}}}if(!G.text.length&&G.comment.length)G.text=G.comment,G.comment=[];if(G.address.length>1)G.text=G.text.concat(G.address.splice(1));if(G.text=G.text.join(" "),G.address=G.address.join(" "),!G.address&&/^=\?[^=]+?=$/.test(G.text.trim())){let Y=Y0(G.text);if(/<[^<>]+@[^<>]+>/.test(Y)){let J=B8(Y);if(J&&J.length)return J}return[{address:"",name:Y}]}if(F={address:G.address||G.text||"",name:Y0(G.text||G.address||"")},F.address===F.name)if((F.address||"").match(/@/))F.name="";else F.address="";w.push(F)}return w}class rB{constructor(u){this.str=(u||"").toString(),this.operatorCurrent="",this.operatorExpecting="",this.node=null,this.escaped=!1,this.list=[],this.operators={'"':'"',"(":")","<":">",",":"",":":";",";":""}}tokenize(){let u=[];for(let D=0,B=this.str.length;D<B;D++){let A=this.str.charAt(D),F=D<B-1?this.str.charAt(D+1):null;this.checkChar(A,F)}return this.list.forEach((D)=>{if(D.value=(D.value||"").toString().trim(),D.value)u.push(D)}),u}checkChar(u,D){if(this.escaped);else if(u===this.operatorExpecting){if(this.node={type:"operator",value:u},D&&![" ","\t","\r",`
63
63
  `,",",";"].includes(D))this.node.noBreak=!0;this.list.push(this.node),this.node=null,this.operatorExpecting="",this.escaped=!1;return}else if(!this.operatorExpecting&&u in this.operators){this.node={type:"operator",value:u},this.list.push(this.node),this.node=null,this.operatorExpecting=this.operators[u],this.escaped=!1;return}else if(this.operatorExpecting==='"'&&u==="\\"){this.escaped=!0;return}if(!this.node)this.node={type:"text",value:""},this.list.push(this.node);if(u===`
64
- `)u=" ";if(u.charCodeAt(0)>=33||[" ","\t"].includes(u))this.node.value+=u;this.escaped=!1}}var px=50;function B8(u,D){D=D||{};let B=D._depth||0;if(B>px)return[];let F=new rB(u).tokenize(),w=[],G=[],N=[];if(F.forEach(($)=>{if($.type==="operator"&&($.value===","||$.value===";")){if(G.length)w.push(G);G=[]}else G.push($)}),G.length)w.push(G);if(w.forEach(($)=>{if($=nx($,B),$.length)N=N.concat($)}),D.flatten){let $=[],Z=(v)=>{v.forEach((J)=>{if(J.group)return Z(J.group);else $.push(J)})};return Z(N),$}return N}var e1=B8;function nB(u){var D="",B="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A=new Uint8Array(u),F=A.byteLength,w=F%3,G=F-w,N,$,Z,v,J;for(var Q=0;Q<G;Q=Q+3)J=A[Q]<<16|A[Q+1]<<8|A[Q+2],N=(J&16515072)>>18,$=(J&258048)>>12,Z=(J&4032)>>6,v=J&63,D+=B[N]+B[$]+B[Z]+B[v];if(w==1)J=A[G],N=(J&252)>>2,$=(J&3)<<4,D+=B[N]+B[$]+"==";else if(w==2)J=A[G]<<8|A[G+1],N=(J&64512)>>10,$=(J&1008)>>4,Z=(J&15)<<2,D+=B[N]+B[$]+B[Z]+"=";return D}var ax=256,sx=2097152;function A8(u){return u.replace(/-(.)/g,(D,B)=>B.toUpperCase())}class I0{static parse(u,D){return new I0(D).parse(u)}constructor(u){this.options=u||{},this.mimeOptions={maxNestingDepth:this.options.maxNestingDepth||ax,maxHeadersSize:this.options.maxHeadersSize||sx},this.root=this.currentNode=new Lu({postalMime:this,...this.mimeOptions}),this.boundaries=[],this.textContent={},this.attachments=[],this.attachmentEncoding=(this.options.attachmentEncoding||"").toString().replace(/[-_\s]/g,"").trim().toLowerCase()||"arraybuffer",this.started=!1}async finalize(){await this.root.finalize()}async processLine(u,D){let B=this.boundaries;if(B.length&&u.length>2&&u[0]===45&&u[1]===45)for(let A=B.length-1;A>=0;A--){let F=B[A];if(u.length<F.value.length+2)continue;let w=!0;for(let Z=0;Z<F.value.length;Z++)if(u[Z+2]!==F.value[Z]){w=!1;break}if(!w)continue;let G=F.value.length+2,N=!1;if(u.length>=F.value.length+4&&u[F.value.length+2]===45&&u[F.value.length+3]===45)N=!0,G=F.value.length+4;let $=!0;for(let Z=G;Z<u.length;Z++)if(u[Z]!==32&&u[Z]!==9){$=!1;break}if(!$)continue;if(N)await F.node.finalize(),this.currentNode=F.node.parentNode||this.root;else await F.node.finalizeChildNodes(),this.currentNode=new Lu({postalMime:this,parentNode:F.node,parentMultipartType:F.node.contentType.multipart,...this.mimeOptions});if(D)return this.finalize();return}if(this.currentNode.feed(u),D)return this.finalize()}readLine(){let u=this.readPos,D=this.readPos;while(this.readPos<this.av.length){let B=this.av[this.readPos++];if(B!==13&&B!==10)D=this.readPos;if(B===10)return{bytes:new Uint8Array(this.buf,u,D-u),done:this.readPos>=this.av.length}}return{bytes:new Uint8Array(this.buf,u,D-u),done:this.readPos>=this.av.length}}async processNodeTree(){let u={},D=new Set,B=this.textMap=new Map,A=this.forceRfc822Attachments(),F=async(w,G,N)=>{if(G=G||!1,N=N||!1,!w.contentType.multipart){if(this.isInlineMessageRfc822(w)&&!A){let $=new I0;if(w.subMessage=await $.parse(w.content),!B.has(w))B.set(w,{});let Z=B.get(w);if(w.subMessage.text||!w.subMessage.html)Z.plain=Z.plain||[],Z.plain.push({type:"subMessage",value:w.subMessage}),D.add("plain");if(w.subMessage.html)Z.html=Z.html||[],Z.html.push({type:"subMessage",value:w.subMessage}),D.add("html");if($.textMap)$.textMap.forEach((v,J)=>{B.set(J,v)});for(let v of w.subMessage.attachments||[])this.attachments.push(v)}else if(this.isInlineTextNode(w)){let $=w.contentType.parsed.value.substr(w.contentType.parsed.value.indexOf("/")+1),Z=G||w;if(!B.has(Z))B.set(Z,{});let v=B.get(Z);v[$]=v[$]||[],v[$].push({type:"text",value:w.getTextContent()}),D.add($)}else if(w.content){let $=w.contentDisposition?.parsed?.params?.filename||w.contentType.parsed.params.name||null,Z={filename:$?v0($):null,mimeType:w.contentType.parsed.value,disposition:w.contentDisposition?.parsed?.value||null};if(N&&w.contentId)Z.related=!0;if(w.contentDescription)Z.description=w.contentDescription;if(w.contentId)Z.contentId=w.contentId;switch(w.contentType.parsed.value){case"text/calendar":case"application/ics":{if(w.contentType.parsed.params.method)Z.method=w.contentType.parsed.params.method.toString().toUpperCase().trim();let v=w.getTextContent().replace(/\r?\n/g,`
64
+ `)u=" ";if(u.charCodeAt(0)>=33||[" ","\t"].includes(u))this.node.value+=u;this.escaped=!1}}var px=50;function B8(u,D){D=D||{};let B=D._depth||0;if(B>px)return[];let F=new rB(u).tokenize(),w=[],G=[],N=[];if(F.forEach(($)=>{if($.type==="operator"&&($.value===","||$.value===";")){if(G.length)w.push(G);G=[]}else G.push($)}),G.length)w.push(G);if(w.forEach(($)=>{if($=nx($,B),$.length)N=N.concat($)}),D.flatten){let $=[],Z=(Y)=>{Y.forEach((J)=>{if(J.group)return Z(J.group);else $.push(J)})};return Z(N),$}return N}var e1=B8;function nB(u){var D="",B="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A=new Uint8Array(u),F=A.byteLength,w=F%3,G=F-w,N,$,Z,Y,J;for(var Q=0;Q<G;Q=Q+3)J=A[Q]<<16|A[Q+1]<<8|A[Q+2],N=(J&16515072)>>18,$=(J&258048)>>12,Z=(J&4032)>>6,Y=J&63,D+=B[N]+B[$]+B[Z]+B[Y];if(w==1)J=A[G],N=(J&252)>>2,$=(J&3)<<4,D+=B[N]+B[$]+"==";else if(w==2)J=A[G]<<8|A[G+1],N=(J&64512)>>10,$=(J&1008)>>4,Z=(J&15)<<2,D+=B[N]+B[$]+B[Z]+"=";return D}var ax=256,sx=2097152;function A8(u){return u.replace(/-(.)/g,(D,B)=>B.toUpperCase())}class I0{static parse(u,D){return new I0(D).parse(u)}constructor(u){this.options=u||{},this.mimeOptions={maxNestingDepth:this.options.maxNestingDepth||ax,maxHeadersSize:this.options.maxHeadersSize||sx},this.root=this.currentNode=new Lu({postalMime:this,...this.mimeOptions}),this.boundaries=[],this.textContent={},this.attachments=[],this.attachmentEncoding=(this.options.attachmentEncoding||"").toString().replace(/[-_\s]/g,"").trim().toLowerCase()||"arraybuffer",this.started=!1}async finalize(){await this.root.finalize()}async processLine(u,D){let B=this.boundaries;if(B.length&&u.length>2&&u[0]===45&&u[1]===45)for(let A=B.length-1;A>=0;A--){let F=B[A];if(u.length<F.value.length+2)continue;let w=!0;for(let Z=0;Z<F.value.length;Z++)if(u[Z+2]!==F.value[Z]){w=!1;break}if(!w)continue;let G=F.value.length+2,N=!1;if(u.length>=F.value.length+4&&u[F.value.length+2]===45&&u[F.value.length+3]===45)N=!0,G=F.value.length+4;let $=!0;for(let Z=G;Z<u.length;Z++)if(u[Z]!==32&&u[Z]!==9){$=!1;break}if(!$)continue;if(N)await F.node.finalize(),this.currentNode=F.node.parentNode||this.root;else await F.node.finalizeChildNodes(),this.currentNode=new Lu({postalMime:this,parentNode:F.node,parentMultipartType:F.node.contentType.multipart,...this.mimeOptions});if(D)return this.finalize();return}if(this.currentNode.feed(u),D)return this.finalize()}readLine(){let u=this.readPos,D=this.readPos;while(this.readPos<this.av.length){let B=this.av[this.readPos++];if(B!==13&&B!==10)D=this.readPos;if(B===10)return{bytes:new Uint8Array(this.buf,u,D-u),done:this.readPos>=this.av.length}}return{bytes:new Uint8Array(this.buf,u,D-u),done:this.readPos>=this.av.length}}async processNodeTree(){let u={},D=new Set,B=this.textMap=new Map,A=this.forceRfc822Attachments(),F=async(w,G,N)=>{if(G=G||!1,N=N||!1,!w.contentType.multipart){if(this.isInlineMessageRfc822(w)&&!A){let $=new I0;if(w.subMessage=await $.parse(w.content),!B.has(w))B.set(w,{});let Z=B.get(w);if(w.subMessage.text||!w.subMessage.html)Z.plain=Z.plain||[],Z.plain.push({type:"subMessage",value:w.subMessage}),D.add("plain");if(w.subMessage.html)Z.html=Z.html||[],Z.html.push({type:"subMessage",value:w.subMessage}),D.add("html");if($.textMap)$.textMap.forEach((Y,J)=>{B.set(J,Y)});for(let Y of w.subMessage.attachments||[])this.attachments.push(Y)}else if(this.isInlineTextNode(w)){let $=w.contentType.parsed.value.substr(w.contentType.parsed.value.indexOf("/")+1),Z=G||w;if(!B.has(Z))B.set(Z,{});let Y=B.get(Z);Y[$]=Y[$]||[],Y[$].push({type:"text",value:w.getTextContent()}),D.add($)}else if(w.content){let $=w.contentDisposition?.parsed?.params?.filename||w.contentType.parsed.params.name||null,Z={filename:$?Y0($):null,mimeType:w.contentType.parsed.value,disposition:w.contentDisposition?.parsed?.value||null};if(N&&w.contentId)Z.related=!0;if(w.contentDescription)Z.description=w.contentDescription;if(w.contentId)Z.contentId=w.contentId;switch(w.contentType.parsed.value){case"text/calendar":case"application/ics":{if(w.contentType.parsed.params.method)Z.method=w.contentType.parsed.params.method.toString().toUpperCase().trim();let Y=w.getTextContent().replace(/\r?\n/g,`
65
65
  `).replace(/\n*$/,`
66
- `);Z.content=t2.encode(v);break}default:Z.content=w.content}this.attachments.push(Z)}}else if(w.contentType.multipart==="alternative")G=w;else if(w.contentType.multipart==="related")N=w;for(let $ of w.childNodes)await F($,G,N)};await F(this.root,!1,!1),B.forEach((w)=>{D.forEach((G)=>{if(!u[G])u[G]=[];if(w[G])w[G].forEach((N)=>{switch(N.type){case"text":u[G].push(N.value);break;case"subMessage":switch(G){case"html":u[G].push(D8(N.value));break;case"plain":u[G].push(u8(N.value));break}break}});else{let N;switch(G){case"html":N="plain";break;case"plain":N="html";break}(w[N]||[]).forEach(($)=>{switch($.type){case"text":switch(G){case"html":u[G].push(jB($.value));break;case"plain":u[G].push(lB($.value));break}break;case"subMessage":switch(G){case"html":u[G].push(D8($.value));break;case"plain":u[G].push(u8($.value));break}break}})}})}),Object.keys(u).forEach((w)=>{u[w]=u[w].join(`
67
- `)}),this.textContent=u}isInlineTextNode(u){if(u.contentDisposition?.parsed?.value==="attachment")return!1;switch(u.contentType.parsed?.value){case"text/html":case"text/plain":return!0;case"text/calendar":case"text/csv":default:return!1}}isInlineMessageRfc822(u){if(u.contentType.parsed?.value!=="message/rfc822")return!1;return(u.contentDisposition?.parsed?.value||(this.options.rfc822Attachments?"attachment":"inline"))==="inline"}forceRfc822Attachments(){if(this.options.forceRfc822Attachments)return!0;let u=!1,D=(B)=>{if(!B.contentType.multipart){if(B.contentType.parsed&&["message/delivery-status","message/feedback-report"].includes(B.contentType.parsed.value))u=!0}for(let A of B.childNodes)D(A)};return D(this.root),u}async resolveStream(u){let D=0,B=[],A=u.getReader();while(!0){let{done:G,value:N}=await A.read();if(G)break;B.push(N),D+=N.length}let F=new Uint8Array(D),w=0;for(let G of B)F.set(G,w),w+=G.length;return F}async parse(u){if(this.started)throw Error("Can not reuse parser, create a new PostalMime object");if(this.started=!0,u&&typeof u.getReader==="function")u=await this.resolveStream(u);if(u=u||new ArrayBuffer(0),typeof u==="string")u=t2.encode(u);if(u instanceof Blob||Object.prototype.toString.call(u)==="[object Blob]")u=await o2(u);if(u.buffer instanceof ArrayBuffer)u=new Uint8Array(u).buffer;this.buf=u,this.av=new Uint8Array(u),this.readPos=0;while(this.readPos<this.av.length){let A=this.readLine();await this.processLine(A.bytes,A.done)}await this.processNodeTree();let D={headers:this.root.headers.map((A)=>({key:A.key,originalKey:A.originalKey,value:A.value})).reverse()};for(let A of["from","sender"]){let F=this.root.headers.find((w)=>w.key===A);if(F&&F.value){let w=e1(F.value);if(w&&w.length)D[A]=w[0]}}for(let A of["delivered-to","return-path"]){let F=this.root.headers.find((w)=>w.key===A);if(F&&F.value){let w=e1(F.value);if(w&&w.length&&w[0].address){let G=A8(A);D[G]=w[0].address}}}for(let A of["to","cc","bcc","reply-to"]){let F=this.root.headers.filter((G)=>G.key===A),w=[];if(F.filter((G)=>G&&G.value).map((G)=>e1(G.value)).forEach((G)=>w=w.concat(G||[])),w&&w.length){let G=A8(A);D[G]=w}}for(let A of["subject","message-id","in-reply-to","references"]){let F=this.root.headers.find((w)=>w.key===A);if(F&&F.value){let w=A8(A);D[w]=v0(F.value)}}let B=this.root.headers.find((A)=>A.key==="date");if(B){let A=new Date(B.value);if(A.toString()==="Invalid Date")A=B.value;else A=A.toISOString();D.date=A}if(this.textContent?.html)D.html=this.textContent.html;if(this.textContent?.plain)D.text=this.textContent.plain;switch(D.attachments=this.attachments,D.headerLines=(this.root.rawHeaderLines||[]).slice().reverse(),this.attachmentEncoding){case"arraybuffer":break;case"base64":for(let F of D.attachments||[])if(F?.content)F.content=nB(F.content),F.encoding="base64";break;case"utf8":let A=new TextDecoder("utf8");for(let F of D.attachments||[])if(F?.content)F.content=A.decode(F.content),F.encoding="utf8";break;default:throw Error("Unknown attachment encoding")}return D}}var UW=Y(WW(),1),uU="6.12.3";function A2(u){let D=new URLSearchParams;if(u.limit!==void 0)D.set("limit",u.limit.toString());if("after"in u&&u.after!==void 0)D.set("after",u.after);if("before"in u&&u.before!==void 0)D.set("before",u.before);return D.toString()}var DU=class{constructor(u){this.resend=u}async create(u,D={}){return await this.resend.post("/api-keys",u,D)}async list(u={}){let D=A2(u),B=D?`/api-keys?${D}`:"/api-keys";return await this.resend.get(B)}async remove(u){return await this.resend.delete(`/api-keys/${u}`)}},BU=class{constructor(u){this.resend=u}async get(u){return await this.resend.get(`/automations/${u.automationId}/runs/${u.runId}`)}async list(u){let D=A2(u),B=new URLSearchParams(D);if(u.status){let w=Array.isArray(u.status)?u.status.join(","):u.status;B.set("status",w)}let A=B.toString(),F=A?`/automations/${u.automationId}/runs?${A}`:`/automations/${u.automationId}/runs`;return await this.resend.get(F)}};function MW(u){switch(u.type){case"trigger":return{key:u.key,type:u.type,config:{event_name:u.config.eventName}};case"delay":return{key:u.key,type:u.type,config:u.config};case"send_email":return{key:u.key,type:u.type,config:{template:u.config.template,subject:u.config.subject,from:u.config.from,reply_to:u.config.replyTo}};case"wait_for_event":return{key:u.key,type:u.type,config:{event_name:u.config.eventName,timeout:u.config.timeout,filter_rule:u.config.filterRule}};case"condition":return{key:u.key,type:u.type,config:u.config};case"contact_update":return{key:u.key,type:u.type,config:{first_name:u.config.firstName,last_name:u.config.lastName,unsubscribed:u.config.unsubscribed,properties:u.config.properties}};case"contact_delete":return{key:u.key,type:u.type,config:u.config};case"add_to_segment":return{key:u.key,type:u.type,config:{segment_id:u.config.segmentId}}}}function LW(u){return{from:u.from,to:u.to,type:u.type}}function AU(u){return{name:u.name,status:u.status,steps:u.steps.map(MW),connections:u.connections.map(LW)}}function FU(u){return{event:u.event,contact_id:u.contactId,email:u.email,payload:u.payload}}var wU=class{constructor(u){this.resend=u,this.runs=new BU(this.resend)}async create(u){return await this.resend.post("/automations",AU(u))}async list(u={}){let D=[A2(u)];if(u.status)D.push(`status=${encodeURIComponent(u.status)}`);let B=D.filter(Boolean).join("&"),A=B?`/automations?${B}`:"/automations";return await this.resend.get(A)}async get(u){return await this.resend.get(`/automations/${u}`)}async remove(u){return await this.resend.delete(`/automations/${u}`)}async update(u,D){let B={};if(D.name!==void 0)B.name=D.name;if(D.status!==void 0)B.status=D.status;if(D.steps!==void 0)B.steps=D.steps.map(MW);if(D.connections!==void 0)B.connections=D.connections.map(LW);return await this.resend.patch(`/automations/${u}`,B)}async stop(u){return await this.resend.post(`/automations/${u}/stop`)}};function GU(u){return u?.map((D)=>({content:D.content,filename:D.filename,path:D.path,content_type:D.contentType,content_id:D.contentId}))}function EW(u){return{attachments:GU(u.attachments),bcc:u.bcc,cc:u.cc,from:u.from,headers:u.headers,html:u.html,reply_to:u.replyTo,scheduled_at:u.scheduledAt,subject:u.subject,tags:u.tags,text:u.text,to:u.to,template:u.template?{id:u.template.id,variables:u.template.variables}:void 0,topic_id:u.topicId}}async function W3(u){let D;try{({render:D}=await import("@react-email/render"))}catch{throw Error("Failed to render React component. Make sure to install `@react-email/render` or `@react-email/components`.")}return D(u)}var NU=class{constructor(u){this.resend=u}async send(u,D){return this.create(u,D)}async create(u,D){let B=[];for(let A of u){if(A.react)A.html=await W3(A.react),A.react=void 0;B.push(EW(A))}return await this.resend.post("/emails/batch",B,{...D,headers:{"x-batch-validation":D?.batchValidation??"strict",...D?.headers}})}},$U=class{constructor(u){this.resend=u}async create(u,D={}){if(u.react)u.html=await W3(u.react);return await this.resend.post("/broadcasts",{name:u.name,segment_id:u.segmentId,audience_id:u.audienceId,preview_text:u.previewText,from:u.from,html:u.html,reply_to:u.replyTo,subject:u.subject,text:u.text,topic_id:u.topicId,send:u.send,scheduled_at:u.scheduledAt},D)}async send(u,D){return await this.resend.post(`/broadcasts/${u}/send`,{scheduled_at:D?.scheduledAt})}async list(u={}){let D=A2(u),B=D?`/broadcasts?${D}`:"/broadcasts";return await this.resend.get(B)}async get(u){return await this.resend.get(`/broadcasts/${u}`)}async remove(u){return await this.resend.delete(`/broadcasts/${u}`)}async update(u,D){if(D.react)D.html=await W3(D.react);return await this.resend.patch(`/broadcasts/${u}`,{name:D.name,segment_id:D.segmentId,audience_id:D.audienceId,from:D.from,html:D.html,text:D.text,subject:D.subject,reply_to:D.replyTo,preview_text:D.previewText,topic_id:D.topicId})}};function KW(u){return{id:u.id,key:u.key,createdAt:u.created_at,type:u.type,fallbackValue:u.fallback_value}}function hW(u){if("key"in u)return{key:u.key,type:u.type,fallback_value:u.fallbackValue};return{fallback_value:u.fallbackValue}}var zU=class{constructor(u){this.resend=u}async create(u){let D=hW(u);return await this.resend.post("/contact-properties",D)}async list(u={}){let D=A2(u),B=D?`/contact-properties?${D}`:"/contact-properties",A=await this.resend.get(B);if(A.data)return{data:{...A.data,data:A.data.data.map((F)=>KW(F))},headers:A.headers,error:null};return A}async get(u){if(!u)return{data:null,headers:null,error:{message:"Missing `id` field.",statusCode:null,name:"missing_required_field"}};let D=await this.resend.get(`/contact-properties/${u}`);if(D.data)return{data:{object:"contact_property",...KW(D.data)},headers:D.headers,error:null};return D}async update(u){if(!u.id)return{data:null,headers:null,error:{message:"Missing `id` field.",statusCode:null,name:"missing_required_field"}};let D=hW(u);return await this.resend.patch(`/contact-properties/${u.id}`,D)}async remove(u){if(!u)return{data:null,headers:null,error:{message:"Missing `id` field.",statusCode:null,name:"missing_required_field"}};return await this.resend.delete(`/contact-properties/${u}`)}},ZU=class{constructor(u){this.resend=u}async list(u){if(!u.contactId&&!u.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};let D=u.email?u.email:u.contactId,B=A2(u),A=B?`/contacts/${D}/segments?${B}`:`/contacts/${D}/segments`;return await this.resend.get(A)}async add(u){if(!u.contactId&&!u.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};let D=u.email?u.email:u.contactId;return this.resend.post(`/contacts/${D}/segments/${u.segmentId}`)}async remove(u){if(!u.contactId&&!u.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};let D=u.email?u.email:u.contactId;return this.resend.delete(`/contacts/${D}/segments/${u.segmentId}`)}},JU=class{constructor(u){this.resend=u}async update(u){if(!u.id&&!u.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};let D=u.email?u.email:u.id;return this.resend.patch(`/contacts/${D}/topics`,u.topics)}async list(u){if(!u.id&&!u.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};let D=u.email?u.email:u.id,B=A2(u),A=B?`/contacts/${D}/topics?${B}`:`/contacts/${D}/topics`;return this.resend.get(A)}},QU=class{constructor(u){this.resend=u,this.topics=new JU(this.resend),this.segments=new ZU(this.resend)}async create(u,D={}){if("audienceId"in u){if("segments"in u||"topics"in u)return{data:null,headers:null,error:{message:"`audienceId` is deprecated, and cannot be used together with `segments` or `topics`. Use `segments` instead to add one or more segments to the new contact.",statusCode:null,name:"invalid_parameter"}};return await this.resend.post(`/audiences/${u.audienceId}/contacts`,{unsubscribed:u.unsubscribed,email:u.email,first_name:u.firstName,last_name:u.lastName,properties:u.properties},D)}return await this.resend.post("/contacts",{unsubscribed:u.unsubscribed,email:u.email,first_name:u.firstName,last_name:u.lastName,properties:u.properties,segments:u.segments,topics:u.topics},D)}async list(u={}){let D=u.segmentId??u.audienceId;if(!D){let F=A2(u),w=F?`/contacts?${F}`:"/contacts";return await this.resend.get(w)}let B=A2(u),A=B?`/segments/${D}/contacts?${B}`:`/segments/${D}/contacts`;return await this.resend.get(A)}async get(u){if(typeof u==="string")return this.resend.get(`/contacts/${u}`);if(!u.id&&!u.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};if(!u.audienceId)return this.resend.get(`/contacts/${u?.email?u?.email:u?.id}`);return this.resend.get(`/audiences/${u.audienceId}/contacts/${u?.email?u?.email:u?.id}`)}async update(u){if(!u.id&&!u.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};if(!u.audienceId)return await this.resend.patch(`/contacts/${u?.email?u?.email:u?.id}`,{unsubscribed:u.unsubscribed,first_name:u.firstName,last_name:u.lastName,properties:u.properties});return await this.resend.patch(`/audiences/${u.audienceId}/contacts/${u?.email?u?.email:u?.id}`,{unsubscribed:u.unsubscribed,first_name:u.firstName,last_name:u.lastName,properties:u.properties})}async remove(u){if(typeof u==="string")return this.resend.delete(`/contacts/${u}`);if(!u.id&&!u.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};if(!u.audienceId)return this.resend.delete(`/contacts/${u?.email?u?.email:u?.id}`);return this.resend.delete(`/audiences/${u.audienceId}/contacts/${u?.email?u?.email:u?.id}`)}};function vU(u){return{name:u.name,region:u.region,custom_return_path:u.customReturnPath,capabilities:u.capabilities,open_tracking:u.openTracking,click_tracking:u.clickTracking,tls:u.tls,tracking_subdomain:u.trackingSubdomain}}var XU=class{constructor(u){this.resend=u}async create(u,D={}){return await this.resend.post("/domains",vU(u),D)}async list(u={}){let D=A2(u),B=D?`/domains?${D}`:"/domains";return await this.resend.get(B)}async get(u){return await this.resend.get(`/domains/${u}`)}async update(u){return await this.resend.patch(`/domains/${u.id}`,{click_tracking:u.clickTracking,open_tracking:u.openTracking,tls:u.tls,capabilities:u.capabilities,tracking_subdomain:u.trackingSubdomain})}async remove(u){return await this.resend.delete(`/domains/${u}`)}async verify(u){return await this.resend.post(`/domains/${u}/verify`)}},YU=class{constructor(u){this.resend=u}async get(u){let{emailId:D,id:B}=u;return await this.resend.get(`/emails/${D}/attachments/${B}`)}async list(u){let{emailId:D}=u,B=A2(u),A=B?`/emails/${D}/attachments?${B}`:`/emails/${D}/attachments`;return await this.resend.get(A)}},WU=class{constructor(u){this.resend=u}async get(u){let{emailId:D,id:B}=u;return await this.resend.get(`/emails/receiving/${D}/attachments/${B}`)}async list(u){let{emailId:D}=u,B=A2(u),A=B?`/emails/receiving/${D}/attachments?${B}`:`/emails/receiving/${D}/attachments`;return await this.resend.get(A)}},KU=class{constructor(u){this.resend=u,this.attachments=new WU(u)}async get(u){return await this.resend.get(`/emails/receiving/${u}`)}async list(u={}){let D=A2(u),B=D?`/emails/receiving?${D}`:"/emails/receiving";return await this.resend.get(B)}async forward(u){let{emailId:D,to:B,from:A}=u,F=u.passthrough!==!1,w=await this.get(D);if(w.error)return{data:null,error:w.error,headers:w.headers};let G=w.data,N=G.subject||"(no subject)";if(F)return this.forwardPassthrough(G,{to:B,from:A,subject:N});let $=N.startsWith("Fwd:")?N:`Fwd: ${N}`;return this.forwardWrapped(G,{to:B,from:A,subject:$,text:"text"in u?u.text:void 0,html:"html"in u?u.html:void 0})}async forwardPassthrough(u,D){let{to:B,from:A,subject:F}=D;if(!u.raw?.download_url)return{data:null,error:{name:"validation_error",message:"Raw email content is not available for this email",statusCode:400},headers:null};let w=await fetch(u.raw.download_url);if(!w.ok)return{data:null,error:{name:"application_error",message:"Failed to download raw email content",statusCode:w.status},headers:null};let G=await w.text(),N=await I0.parse(G,{attachmentEncoding:"base64"}),$=N.attachments.map((Z)=>{let v=Z.contentId?Z.contentId.replace(/^<|>$/g,""):void 0;return{filename:Z.filename,content:Z.content.toString(),content_type:Z.mimeType,content_id:v||void 0}});return await this.resend.post("/emails",{from:A,to:B,subject:F,text:N.text||void 0,html:N.html||void 0,attachments:$.length>0?$:void 0})}async forwardWrapped(u,D){let{to:B,from:A,subject:F,text:w,html:G}=D;if(!u.raw?.download_url)return{data:null,error:{name:"validation_error",message:"Raw email content is not available for this email",statusCode:400},headers:null};let N=await fetch(u.raw.download_url);if(!N.ok)return{data:null,error:{name:"application_error",message:"Failed to download raw email content",statusCode:N.status},headers:null};let $=await N.text();return await this.resend.post("/emails",{from:A,to:B,subject:F,text:w,html:G,attachments:[{filename:"forwarded_message.eml",content:Buffer.from($).toString("base64"),content_type:"message/rfc822"}]})}},hU=class{constructor(u){this.resend=u,this.attachments=new YU(u),this.receiving=new KU(u)}async send(u,D={}){return this.create(u,D)}async create(u,D={}){if(u.react)u.html=await W3(u.react);return await this.resend.post("/emails",EW(u),D)}async get(u){return await this.resend.get(`/emails/${u}`)}async list(u={}){let D=A2(u),B=D?`/emails?${D}`:"/emails";return await this.resend.get(B)}async update(u){return await this.resend.patch(`/emails/${u.id}`,{scheduled_at:u.scheduledAt})}async cancel(u){return await this.resend.post(`/emails/${u}/cancel`)}},xU=class{constructor(u){this.resend=u}async send(u){return await this.resend.post("/events/send",FU(u))}async create(u){return await this.resend.post("/events",u)}async get(u){return await this.resend.get(`/events/${encodeURIComponent(u)}`)}async list(u={}){let D=A2(u),B=D?`/events?${D}`:"/events";return await this.resend.get(B)}async update(u,D){return await this.resend.patch(`/events/${encodeURIComponent(u)}`,D)}async remove(u){return await this.resend.delete(`/events/${encodeURIComponent(u)}`)}},HU=class{constructor(u){this.resend=u}async list(u={}){let D=A2(u),B=D?`/logs?${D}`:"/logs";return await this.resend.get(B)}async get(u){return await this.resend.get(`/logs/${u}`)}},SU=class{constructor(u){this.resend=u}async create(u,D={}){return await this.resend.post("/segments",u,D)}async list(u={}){let D=A2(u),B=D?`/segments?${D}`:"/segments";return await this.resend.get(B)}async get(u){return await this.resend.get(`/segments/${u}`)}async remove(u){return await this.resend.delete(`/segments/${u}`)}};function RU(u={}){let D=new URLSearchParams;if(u.before)D.set("before",u.before);if(u.after)D.set("after",u.after);if(u.limit)D.set("limit",u.limit.toString());return D.size>0?`?${D.toString()}`:""}function UU(u){return u?.map((D)=>({key:D.key,type:D.type,fallback_value:D.fallbackValue}))}function xW(u){return{name:"name"in u?u.name:void 0,subject:u.subject,html:u.html,text:u.text,alias:u.alias,from:u.from,reply_to:u.replyTo,variables:UU(u.variables)}}var HW=class{constructor(u,D){this.promise=u,this.publishFn=D}then(u,D){return this.promise.then(u,D)}async publish(){let{data:u,error:D}=await this.promise;if(D)return{data:null,headers:null,error:D};return this.publishFn(u.id)}},MU=class{constructor(u){this.resend=u}create(u){return new HW(this.performCreate(u),this.publish.bind(this))}async performCreate(u){if(u.react){if(!this.renderAsync)try{let{renderAsync:D}=await import("@react-email/render");this.renderAsync=D}catch{throw Error("Failed to render React component. Make sure to install `@react-email/render`")}u.html=await this.renderAsync(u.react)}return this.resend.post("/templates",xW(u))}async remove(u){return await this.resend.delete(`/templates/${u}`)}async get(u){return await this.resend.get(`/templates/${u}`)}async list(u={}){return this.resend.get(`/templates${RU(u)}`)}duplicate(u){return new HW(this.resend.post(`/templates/${u}/duplicate`),this.publish.bind(this))}async publish(u){return await this.resend.post(`/templates/${u}/publish`)}async update(u,D){return await this.resend.patch(`/templates/${u}`,xW(D))}},LU=class{constructor(u){this.resend=u}async create(u){let{defaultSubscription:D,...B}=u;return await this.resend.post("/topics",{...B,default_subscription:D})}async list(){return await this.resend.get("/topics")}async get(u){if(!u)return{data:null,headers:null,error:{message:"Missing `id` field.",statusCode:null,name:"missing_required_field"}};return await this.resend.get(`/topics/${u}`)}async update(u){if(!u.id)return{data:null,headers:null,error:{message:"Missing `id` field.",statusCode:null,name:"missing_required_field"}};return await this.resend.patch(`/topics/${u.id}`,u)}async remove(u){if(!u)return{data:null,headers:null,error:{message:"Missing `id` field.",statusCode:null,name:"missing_required_field"}};return await this.resend.delete(`/topics/${u}`)}},EU=class{constructor(u){this.resend=u}async create(u,D={}){return await this.resend.post("/webhooks",u,D)}async get(u){return await this.resend.get(`/webhooks/${u}`)}async list(u={}){let D=A2(u),B=D?`/webhooks?${D}`:"/webhooks";return await this.resend.get(B)}async update(u,D){return await this.resend.patch(`/webhooks/${u}`,D)}async remove(u){return await this.resend.delete(`/webhooks/${u}`)}verify(u){return new UW.Webhook(u.webhookSecret).verify(u.payload,{"svix-id":u.headers.id,"svix-timestamp":u.headers.timestamp,"svix-signature":u.headers.signature})}},SW="https://api.resend.com",RW=`resend-node:${uU}`,OU=typeof process<"u"&&process.env?process.env.RESEND_BASE_URL||SW:SW,CU=typeof process<"u"&&process.env?process.env.RESEND_USER_AGENT||RW:RW,OW=class{constructor(u){if(this.key=u,this.segments=new SU(this),this.apiKeys=new DU(this),this.audiences=this.segments,this.automations=new wU(this),this.batch=new NU(this),this.broadcasts=new $U(this),this.contactProperties=new zU(this),this.contacts=new QU(this),this.domains=new XU(this),this.emails=new hU(this),this.events=new xU(this),this.logs=new HU(this),this.templates=new MU(this),this.topics=new LU(this),this.webhooks=new EU(this),!u){if(typeof process<"u"&&process.env)this.key=process.env.RESEND_API_KEY;if(!this.key)throw Error('Missing API key. Pass it to the constructor `new Resend("re_123")`')}this.headers=new Headers({Authorization:`Bearer ${this.key}`,"User-Agent":CU,"Content-Type":"application/json"})}async fetchRequest(u,D={}){try{let B=await fetch(`${OU}${u}`,D);if(!B.ok)try{let A=await B.text();return{data:null,error:JSON.parse(A),headers:Object.fromEntries(B.headers.entries())}}catch(A){if(A instanceof SyntaxError)return{data:null,error:{name:"application_error",statusCode:B.status,message:"Internal server error. We are unable to process your request right now, please try again later."},headers:Object.fromEntries(B.headers.entries())};let F={message:B.statusText,statusCode:B.status,name:"application_error"};if(A instanceof Error)return{data:null,error:{...F,message:A.message},headers:Object.fromEntries(B.headers.entries())};return{data:null,error:F,headers:Object.fromEntries(B.headers.entries())}}return{data:await B.json(),error:null,headers:Object.fromEntries(B.headers.entries())}}catch{return{data:null,error:{name:"application_error",statusCode:null,message:"Unable to fetch data. The request could not be resolved."},headers:null}}}async post(u,D,B={}){let A=new Headers(this.headers);if(B.headers)for(let[w,G]of new Headers(B.headers).entries())A.set(w,G);if(B.idempotencyKey)A.set("Idempotency-Key",B.idempotencyKey);let F={method:"POST",body:JSON.stringify(D),...B,headers:A};return this.fetchRequest(u,F)}async get(u,D={}){let B=new Headers(this.headers);if(D.headers)for(let[F,w]of new Headers(D.headers).entries())B.set(F,w);let A={method:"GET",...D,headers:B};return this.fetchRequest(u,A)}async put(u,D,B={}){let A=new Headers(this.headers);if(B.headers)for(let[w,G]of new Headers(B.headers).entries())A.set(w,G);let F={method:"PUT",body:JSON.stringify(D),...B,headers:A};return this.fetchRequest(u,F)}async patch(u,D,B={}){let A=new Headers(this.headers);if(B.headers)for(let[w,G]of new Headers(B.headers).entries())A.set(w,G);let F={method:"PATCH",body:JSON.stringify(D),...B,headers:A};return this.fetchRequest(u,F)}async delete(u,D){let B={method:"DELETE",body:JSON.stringify(D),headers:this.headers};return this.fetchRequest(u,B)}};class K3{}class h3 extends K3{apiKey;constructor(u=process.env.RESEND_API_KEY){super();this.apiKey=u}async send(u){let D=new OW(this.apiKey),{data:B,error:A}=await D.emails.send({...u});if(A)return console.error(A),!1;if(B)return!0;return!1}}class CW extends f{driver=new h3;headers={};boot(){}filterRecipients(u){return u}}class PW extends f{channels={};boot(){}}class cW extends f{root;rootRouter;boot(){}onRequestStart(u){}onRequestEnd(u){}onRequestFail(u,D){}}class VW extends f{rootRouter;boot(){}onRequestStart(u){}onRequestEnd(u){}onRequestFail(u,D){}}class kW extends f{maxFileSize=10485760;boot(){}onLogFileClosed(u){}onLogCreated(u){}}class yW extends f{jobs=[];concurrency=1;boot(){}}class IW{static name="unset";worker=!1;maxAttempts=3;run(...u){}onFail(u,...D){}onSuccess(u,...D){}onDeadletter(u,...D){}static dispatch(...u){if(this.name==="unset")throw Error("Cannot dispatch a job with no name");TW.use().push(this,JSON.stringify(u))}}import PU from"sharp";class x3{}class H3 extends x3{async resize(u,D){let{height:B,width:A,quality:F,fit:w}=D;return await PU(u).resize(A>0?A:void 0,B>0?B:void 0,{fit:w}).webp({quality:F>0?F:80,force:!0}).toBuffer()}}class qW extends f{driver=new H3;boot(){}}class l0{}var cU={clientId:process.env.GOOGLE_CLIENT_ID,clientSecret:process.env.GOOGLE_CLIENT_SECRET,redirectPath:"/auth/oauth/google/callback",scope:"https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email"};class mW extends l0{config;constructor(u={}){super();this.config={...cU,...u}}getRedirectUrl(){let u=this.config.scope,D=this.config.clientId,B=new URL("https://accounts.google.com/o/oauth2/v2/auth"),A={scope:u,include_granted_scopes:"true",response_type:"code",state:"state_parameter_passthrough_value",redirect_uri:`${process.env.HOST_NAME}/auth/oauth/google/callback`,client_id:D};for(let[w,G]of Object.entries(A))B.searchParams.append(w,G);return B.toString()}async onCallback(u){let D=new URL("https://oauth2.googleapis.com/token");D.searchParams.append("code",u.search.get("code")),D.searchParams.append("client_id",this.config.clientId),D.searchParams.append("client_secret",this.config.clientSecret),D.searchParams.append("grant_type","authorization_code"),D.searchParams.append("redirect_uri",`${process.env.HOST_NAME}${this.config.redirectPath}`);let B=await fetch(D.toString(),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"}}),{access_token:A}=await B.json(),w=await(await fetch(`https://www.googleapis.com/oauth2/v3/userinfo?access_token=${A}`)).json();if(!w.email)console.error("Google OAuth error: email not found in user info response",w);return{name:w.name,email:w.email}}}var B0="https://api.x.com/2/",d0="https://api.x.com/labs/2/",A0="https://api.x.com/1.1/",b2="https://upload.x.com/1.1/",_W="https://stream.x.com/1.1/",i0="https://ads-api.x.com/12/",r0="https://ads-api-sandbox.twitter.com/12/";class r8{constructor({realData:u,rateLimit:D,instance:B,queryParams:A,sharedParams:F}){this._maxResultsWhenFetchLast=100,this._realData=u,this._rateLimit=D,this._instance=B,this._queryParams=A,this._sharedParams=F}get _isRateLimitOk(){if(!this._rateLimit)return!0;if(this._rateLimit.reset*1000<Date.now())return!0;return this._rateLimit.remaining>0}makeRequest(u){return this._instance.get(this.getEndpoint(),u,{fullResponse:!0,params:this._sharedParams})}makeNewInstanceFromResult(u,D){return new this.constructor({realData:u.data,rateLimit:u.rateLimit,instance:this._instance,queryParams:D,sharedParams:this._sharedParams})}getEndpoint(){return this._endpoint}injectQueryParams(u){return{...u?{max_results:u}:{},...this._queryParams}}async next(u){let D=this.getNextQueryParams(u),B=await this.makeRequest(D);return this.makeNewInstanceFromResult(B,D)}async fetchNext(u){let D=this.getNextQueryParams(u),B=await this.makeRequest(D);return await this.refreshInstanceFromResult(B,!0),this}async fetchLast(u=1/0){let D=this.getNextQueryParams(this._maxResultsWhenFetchLast),B=0;while(B<u&&this._isRateLimitOk){let A=await this.makeRequest(D);if(await this.refreshInstanceFromResult(A,!0),B+=this.getPageLengthFromRequest(A),this.isFetchLastOver(A))break;D=this.getNextQueryParams(this._maxResultsWhenFetchLast)}return this}get rateLimit(){var u;return{...(u=this._rateLimit)!==null&&u!==void 0?u:{}}}get data(){return this._realData}get done(){return!this.canFetchNextPage(this._realData)}*[Symbol.iterator](){yield*this.getItemArray()}async*[Symbol.asyncIterator](){yield*this.getItemArray();let u=this,D=this.canFetchNextPage(this._realData);while(D&&this._isRateLimitOk&&u.getItemArray().length>0){let B=await u.next(this._maxResultsWhenFetchLast);this.refreshInstanceFromResult({data:B._realData,headers:{},rateLimit:B._rateLimit},!0),D=this.canFetchNextPage(B._realData),yield*B.getItemArray(),u=B}}async*fetchAndIterate(){for(let B of this.getItemArray())yield[B,this];let u=this,D=this.canFetchNextPage(this._realData);while(D&&this._isRateLimitOk&&u.getItemArray().length>0){let B=await u.next(this._maxResultsWhenFetchLast);this.refreshInstanceFromResult({data:B._realData,headers:{},rateLimit:B._rateLimit},!0),D=this.canFetchNextPage(B._realData);for(let A of B.getItemArray())yield[A,B];this._rateLimit=B._rateLimit,u=B}}}class n8 extends r8{async previous(u){let D=this.getPreviousQueryParams(u),B=await this.makeRequest(D);return this.makeNewInstanceFromResult(B,D)}async fetchPrevious(u){let D=this.getPreviousQueryParams(u),B=await this.makeRequest(D);return await this.refreshInstanceFromResult(B,!1),this}}var n0=r8;class F2 extends n0{getNextQueryParams(u){var D;return{...this._queryParams,cursor:(D=this._realData.next_cursor_str)!==null&&D!==void 0?D:this._realData.next_cursor,...u?{count:u}:{}}}isFetchLastOver(u){return!this.canFetchNextPage(u.data)}canFetchNextPage(u){return!this.isNextCursorInvalid(u.next_cursor)||!this.isNextCursorInvalid(u.next_cursor_str)}isNextCursorInvalid(u){return u===void 0||u===0||u===-1||u==="0"||u==="-1"}}class p8 extends F2{constructor(){super(...arguments);this._endpoint="direct_messages/events/list.json"}refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.events.push(...B.events),this._realData.next_cursor=B.next_cursor}getPageLengthFromRequest(u){return u.data.events.length}getItemArray(){return this.events}get events(){return this._realData.events}}class a8 extends F2{constructor(){super(...arguments);this._endpoint="direct_messages/welcome_messages/list.json"}refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.welcome_messages.push(...B.welcome_messages),this._realData.next_cursor=B.next_cursor}getPageLengthFromRequest(u){return u.data.welcome_messages.length}getItemArray(){return this.welcomeMessages}get welcomeMessages(){return this._realData.welcome_messages}}var m;(function(u){u.Jpeg="image/jpeg",u.Mp4="video/mp4",u.Mov="video/quicktime",u.Gif="image/gif",u.Png="image/png",u.Srt="text/plain",u.Webp="image/webp"})(m||(m={}));var F0;(function(u){u.Create="message_create",u.WelcomeCreate="welcome_message"})(F0||(F0={}));var ku;(function(u){u.Request="request",u.PartialResponse="partial-response",u.Response="response"})(ku||(ku={}));class S3 extends Error{constructor(){super(...arguments);this.error=!0}}class yu extends S3{constructor(u,D){super(u);this.type=ku.Request,Error.captureStackTrace(this,this.constructor),Object.defineProperty(this,"_options",{value:D})}get request(){return this._options.request}get requestError(){return this._options.requestError}toJSON(){return{type:this.type,error:this.requestError}}}class Tu extends S3{constructor(u,D){super(u);this.type=ku.PartialResponse,Error.captureStackTrace(this,this.constructor),Object.defineProperty(this,"_options",{value:D})}get request(){return this._options.request}get response(){return this._options.response}get responseError(){return this._options.responseError}get rawContent(){return this._options.rawContent}toJSON(){return{type:this.type,error:this.responseError}}}class Iu extends S3{constructor(u,D){super(u);if(this.type=ku.Response,Error.captureStackTrace(this,this.constructor),Object.defineProperty(this,"_options",{value:D}),this.code=D.code,this.headers=D.headers,this.rateLimit=D.rateLimit,D.data&&typeof D.data==="object"&&"error"in D.data&&!D.data.errors){let B={...D.data};B.errors=[{code:Y0.InternalError,message:B.error}],this.data=B}else this.data=D.data}get request(){return this._options.request}get response(){return this._options.response}hasErrorCode(...u){let D=this.errors;if(!(D===null||D===void 0?void 0:D.length))return!1;if("code"in D[0])return D.some((F)=>u.includes(F.code));let B=this.data;return u.includes(B.type)}get errors(){var u;return(u=this.data)===null||u===void 0?void 0:u.errors}get rateLimitError(){return this.code===420||this.code===429}get isAuthError(){if(this.code===401)return!0;return this.hasErrorCode(Y0.AuthTimestampInvalid,Y0.AuthenticationFail,Y0.BadAuthenticationData,Y0.InvalidOrExpiredToken)}toJSON(){return{type:this.type,code:this.code,error:this.data,rateLimit:this.rateLimit,headers:this.headers}}}var Y0;(function(u){u[u.InvalidCoordinates=3]="InvalidCoordinates",u[u.NoLocationFound=13]="NoLocationFound",u[u.AuthenticationFail=32]="AuthenticationFail",u[u.InvalidOrExpiredToken=89]="InvalidOrExpiredToken",u[u.UnableToVerifyCredentials=99]="UnableToVerifyCredentials",u[u.AuthTimestampInvalid=135]="AuthTimestampInvalid",u[u.BadAuthenticationData=215]="BadAuthenticationData",u[u.NoUserMatch=17]="NoUserMatch",u[u.UserNotFound=50]="UserNotFound",u[u.ResourceNotFound=34]="ResourceNotFound",u[u.TweetNotFound=144]="TweetNotFound",u[u.TweetNotVisible=179]="TweetNotVisible",u[u.NotAllowedResource=220]="NotAllowedResource",u[u.MediaIdNotFound=325]="MediaIdNotFound",u[u.TweetNoLongerAvailable=421]="TweetNoLongerAvailable",u[u.TweetViolatedRules=422]="TweetViolatedRules",u[u.TargetUserSuspended=63]="TargetUserSuspended",u[u.YouAreSuspended=64]="YouAreSuspended",u[u.AccountUpdateFailed=120]="AccountUpdateFailed",u[u.NoSelfSpamReport=36]="NoSelfSpamReport",u[u.NoSelfMute=271]="NoSelfMute",u[u.AccountLocked=326]="AccountLocked",u[u.RateLimitExceeded=88]="RateLimitExceeded",u[u.NoDMRightForApp=93]="NoDMRightForApp",u[u.OverCapacity=130]="OverCapacity",u[u.InternalError=131]="InternalError",u[u.TooManyFollowings=161]="TooManyFollowings",u[u.TweetLimitExceeded=185]="TweetLimitExceeded",u[u.DuplicatedTweet=187]="DuplicatedTweet",u[u.TooManySpamReports=205]="TooManySpamReports",u[u.RequestLooksLikeSpam=226]="RequestLooksLikeSpam",u[u.NoWriteRightForApp=261]="NoWriteRightForApp",u[u.TweetActionsDisabled=425]="TweetActionsDisabled",u[u.TweetRepliesRestricted=433]="TweetRepliesRestricted",u[u.NamedParameterMissing=38]="NamedParameterMissing",u[u.InvalidAttachmentUrl=44]="InvalidAttachmentUrl",u[u.TweetTextTooLong=186]="TweetTextTooLong",u[u.MissingUrlParameter=195]="MissingUrlParameter",u[u.NoMultipleGifs=323]="NoMultipleGifs",u[u.InvalidMediaIds=324]="InvalidMediaIds",u[u.InvalidUrl=407]="InvalidUrl",u[u.TooManyTweetAttachments=386]="TooManyTweetAttachments",u[u.StatusAlreadyFavorited=139]="StatusAlreadyFavorited",u[u.FollowRequestAlreadySent=160]="FollowRequestAlreadySent",u[u.CannotUnmuteANonMutedAccount=272]="CannotUnmuteANonMutedAccount",u[u.TweetAlreadyRetweeted=327]="TweetAlreadyRetweeted",u[u.ReplyToDeletedTweet=385]="ReplyToDeletedTweet",u[u.DMReceiverNotFollowingYou=150]="DMReceiverNotFollowingYou",u[u.UnableToSendDM=151]="UnableToSendDM",u[u.MustAllowDMFromAnyone=214]="MustAllowDMFromAnyone",u[u.CannotSendDMToThisUser=349]="CannotSendDMToThisUser",u[u.DMTextTooLong=354]="DMTextTooLong",u[u.SubscriptionAlreadyExists=355]="SubscriptionAlreadyExists",u[u.CallbackUrlNotApproved=415]="CallbackUrlNotApproved",u[u.SuspendedApplication=416]="SuspendedApplication",u[u.OobOauthIsNotAllowed=417]="OobOauthIsNotAllowed"})(Y0||(Y0={}));var gW;(function(u){u.InvalidRequest="https://developer.x.com/en/support/x-api/error-troubleshooting#invalid-request",u.ClientForbidden="https://developer.x.com/en/support/x-api/error-troubleshooting#client-forbidden",u.UnsupportedAuthentication="https://developer.x.com/en/support/x-api/error-troubleshooting#unsupported-authentication",u.InvalidRules="https://developer.x.com/en/support/x-api/error-troubleshooting#invalid-rules",u.TooManyRules="https://developer.x.com/en/support/x-api/error-troubleshooting#rule-cap",u.DuplicatedRules="https://developer.x.com/en/support/x-api/error-troubleshooting#duplicate-rules",u.RateLimitExceeded="https://developer.x.com/en/support/x-api/error-troubleshooting#usage-capped",u.ConnectionError="https://developer.x.com/en/support/x-api/error-troubleshooting#streaming-connection",u.ClientDisconnected="https://developer.x.com/en/support/x-api/error-troubleshooting#client-disconnected",u.TwitterDisconnectedYou="https://developer.x.com/en/support/x-api/error-troubleshooting#operational-disconnect",u.ResourceNotFound="https://developer.x.com/en/support/x-api/error-troubleshooting#resource-not-found",u.ResourceUnauthorized="https://developer.x.com/en/support/x-api/error-troubleshooting#not-authorized-for-resource",u.DisallowedResource="https://developer.x.com/en/support/x-api/error-troubleshooting#disallowed-resource"})(gW||(gW={}));var M;(function(u){u.Connected="connected",u.ConnectError="connect error",u.ConnectionError="connection error",u.ConnectionClosed="connection closed",u.ConnectionLost="connection lost",u.ReconnectAttempt="reconnect attempt",u.Reconnected="reconnected",u.ReconnectError="reconnect error",u.ReconnectLimitExceeded="reconnect limit exceeded",u.DataKeepAlive="data keep-alive",u.Data="data event content",u.DataError="data twitter error",u.TweetParseError="data tweet parse error",u.Error="stream error"})(M||(M={}));class qu{constructor(u){this.value=u}}import*as S5 from"fs";var G2={debug:!1,deprecationWarnings:!0,logger:{log:console.log.bind(console)}};function s8(u){let D={value:void 0,promise:u().then((B)=>{return D.value=B,B})};return D}function R3(u){if(Array.isArray(u))return u;return[u]}function bW(u){for(let D of Object.keys(u))if(u[D]===void 0)delete u[D]}function U3(u){return typeof u==="object"&&"errors"in u&&!("data"in u)}function mu(u){if(Array.isArray(u)&&u.length>1)return!0;return u.toString().includes(",")}var fW=new Set;function t8(u){if(typeof console>"u"||!console.warn||!G2.deprecationWarnings)return;let D=`${u.instance}-${u.method}-${u.problem}`;if(fW.has(D))return;let B=`[twitter-api-v2] Deprecation warning: In ${u.instance}.${u.method}() call, ${u.problem}.
68
- ${u.resolution}.`;console.warn(B),console.warn("To disable this message, import variable TwitterApiV2Settings from twitter-api-v2 and set TwitterApiV2Settings.deprecationWarnings to false."),fW.add(D)}import{EventEmitter as IU}from"events";import{request as VU}from"https";import*as x2 from"zlib";import{EventEmitter as kU}from"events";class jW{constructor(u){this.requestData=u,this.requestErrorHandled=!1,this.responseData=[]}get hrefPathname(){let u=this.requestData.url;return u.hostname+u.pathname}isCompressionDisabled(){return!this.requestData.compression||this.requestData.compression==="identity"}isFormEncodedEndpoint(){return this.requestData.url.href.startsWith("https://api.x.com/oauth/")}createRequestError(u){if(G2.debug)G2.logger.log("Request error:",u);return new yu("Request failed.",{request:this.req,error:u})}createPartialResponseError(u,D){let A=`Request failed with partial response with HTTP code ${this.res.statusCode}`;if(D)A+=" (connection abruptly closed)";else A+=" (parse error)";return new Tu(A,{request:this.req,response:this.res,responseError:u,rawContent:Buffer.concat(this.responseData).toString()})}formatV1Errors(u){return u.map(({code:D,message:B})=>`${B} (Twitter code ${D})`).join(", ")}formatV2Error(u){return`${u.title}: ${u.detail} (see ${u.type})`}createResponseError({res:u,data:D,rateLimit:B,code:A}){var F;if(G2.debug)G2.logger.log(`Request failed with code ${A}, data:`,D),G2.logger.log("Response headers:",u.headers);let w=`Request failed with code ${A}`;if((F=D===null||D===void 0?void 0:D.errors)===null||F===void 0?void 0:F.length){let G=D.errors;if(typeof G[0]==="object"&&"code"in G[0])w+=" - "+this.formatV1Errors(G);else w+=" - "+this.formatV2Error(D)}return new Iu(w,{code:A,data:D,headers:u.headers,request:this.req,response:u,rateLimit:B})}getResponseDataStream(u){if(this.isCompressionDisabled())return u;let D=(u.headers["content-encoding"]||"identity").trim().toLowerCase();if(D==="br"){let B=x2.createBrotliDecompress({flush:x2.constants.BROTLI_OPERATION_FLUSH,finishFlush:x2.constants.BROTLI_OPERATION_FLUSH});return u.pipe(B),B}if(D==="gzip"){let B=x2.createGunzip({flush:x2.constants.Z_SYNC_FLUSH,finishFlush:x2.constants.Z_SYNC_FLUSH});return u.pipe(B),B}if(D==="deflate"){let B=x2.createInflate({flush:x2.constants.Z_SYNC_FLUSH,finishFlush:x2.constants.Z_SYNC_FLUSH});return u.pipe(B),B}return u}detectResponseType(u){var D,B;if(((D=u.headers["content-type"])===null||D===void 0?void 0:D.includes("application/json"))||((B=u.headers["content-type"])===null||B===void 0?void 0:B.includes("application/problem+json")))return"json";else if(this.isFormEncodedEndpoint())return"url";return"text"}getParsedResponse(u){let D=this.responseData,B=this.requestData.forceParseMode||this.detectResponseType(u);if(B==="buffer")return Buffer.concat(D);else if(B==="text")return Buffer.concat(D).toString();else if(B==="json"){let A=Buffer.concat(D).toString();return A.length?JSON.parse(A):void 0}else if(B==="url"){let A=Buffer.concat(D).toString(),F={};for(let[w,G]of new URLSearchParams(A))F[w]=G;return F}else return}getRateLimitFromResponse(u){let D=void 0;if(u.headers["x-rate-limit-limit"]){if(D={limit:Number(u.headers["x-rate-limit-limit"]),remaining:Number(u.headers["x-rate-limit-remaining"]),reset:Number(u.headers["x-rate-limit-reset"])},u.headers["x-app-limit-24hour-limit"])D.day={limit:Number(u.headers["x-app-limit-24hour-limit"]),remaining:Number(u.headers["x-app-limit-24hour-remaining"]),reset:Number(u.headers["x-app-limit-24hour-reset"])};if(u.headers["x-user-limit-24hour-limit"])D.userDay={limit:Number(u.headers["x-user-limit-24hour-limit"]),remaining:Number(u.headers["x-user-limit-24hour-remaining"]),reset:Number(u.headers["x-user-limit-24hour-reset"])};if(this.requestData.rateLimitSaver)this.requestData.rateLimitSaver(D)}return D}onSocketEventHandler(u,D,B){let A=this.onSocketCloseHandler.bind(this,u);B.on("close",A),D.on("complete",()=>B.off("close",A))}onSocketCloseHandler(u){if(this.req.removeAllListeners("timeout"),this.res)return;if(!this.requestErrorHandled)return u(this.createRequestError(Error("Socket closed without any information.")))}requestErrorHandler(u,D){var B,A;(A=(B=this.requestData).requestEventDebugHandler)===null||A===void 0||A.call(B,"request-error",{requestError:D}),this.requestErrorHandled=!0,u(this.createRequestError(D))}timeoutErrorHandler(){this.requestErrorHandled=!0,this.req.destroy(Error("Request timeout."))}classicResponseHandler(u,D,B){this.res=B;let A=this.getResponseDataStream(B);if(A.on("data",(F)=>this.responseData.push(F)),A.on("end",this.onResponseEndHandler.bind(this,u,D)),A.on("close",this.onResponseCloseHandler.bind(this,u,D)),this.requestData.requestEventDebugHandler)this.requestData.requestEventDebugHandler("response",{res:B}),B.on("aborted",(F)=>this.requestData.requestEventDebugHandler("response-aborted",{error:F})),B.on("error",(F)=>this.requestData.requestEventDebugHandler("response-error",{error:F})),B.on("close",()=>this.requestData.requestEventDebugHandler("response-close",{data:this.responseData})),B.on("end",()=>this.requestData.requestEventDebugHandler("response-end"))}onResponseEndHandler(u,D){let B=this.getRateLimitFromResponse(this.res),A;try{A=this.getParsedResponse(this.res)}catch(w){D(this.createPartialResponseError(w,!1));return}let F=this.res.statusCode;if(F>=400){D(this.createResponseError({data:A,res:this.res,rateLimit:B,code:F}));return}if(G2.debug)G2.logger.log(`[${this.requestData.options.method} ${this.hrefPathname}]: Request succeeds with code ${this.res.statusCode}`),G2.logger.log("Response body:",A);u({data:A,headers:this.res.headers,rateLimit:B})}onResponseCloseHandler(u,D){let B=this.res;if(B.aborted)try{return this.getParsedResponse(this.res),this.onResponseEndHandler(u,D)}catch(A){return D(this.createPartialResponseError(A,!0))}if(!B.complete)return D(this.createPartialResponseError(Error("Response has been interrupted before response could be parsed."),!0))}streamResponseHandler(u,D,B){if(B.statusCode<400){if(G2.debug)G2.logger.log(`[${this.requestData.options.method} ${this.hrefPathname}]: Request succeeds with code ${B.statusCode} (starting stream)`);let F=this.getResponseDataStream(B);u({req:this.req,res:F,originalResponse:B,requestData:this.requestData})}else this.classicResponseHandler(()=>{return},D,B)}debugRequest(){let u=this.requestData.url;if(G2.logger.log(`[${this.requestData.options.method} ${this.hrefPathname}]`,this.requestData.options),u.search)G2.logger.log("Request parameters:",[...u.searchParams.entries()].map(([D,B])=>`${D}: ${B}`));if(this.requestData.body)G2.logger.log("Request body:",this.requestData.body)}buildRequest(){var u;let D=this.requestData.url,B=D.username?`${D.username}:${D.password}`:void 0,A=(u=this.requestData.options.headers)!==null&&u!==void 0?u:{};if(this.requestData.compression===!0||this.requestData.compression==="brotli")A["accept-encoding"]="br;q=1.0, gzip;q=0.8, deflate;q=0.5, *;q=0.1";else if(this.requestData.compression==="gzip")A["accept-encoding"]="gzip;q=1, deflate;q=0.5, *;q=0.1";else if(this.requestData.compression==="deflate")A["accept-encoding"]="deflate;q=1, *;q=0.1";if(G2.debug)this.debugRequest();this.req=VU({...this.requestData.options,host:D.hostname,port:D.port||void 0,path:D.pathname+D.search,protocol:D.protocol,auth:B,headers:A})}registerRequestEventDebugHandlers(u){u.on("close",()=>this.requestData.requestEventDebugHandler("close")),u.on("abort",()=>this.requestData.requestEventDebugHandler("abort")),u.on("socket",(D)=>{this.requestData.requestEventDebugHandler("socket",{socket:D}),D.on("error",(B)=>this.requestData.requestEventDebugHandler("socket-error",{socket:D,error:B})),D.on("connect",()=>this.requestData.requestEventDebugHandler("socket-connect",{socket:D})),D.on("close",(B)=>this.requestData.requestEventDebugHandler("socket-close",{socket:D,withError:B})),D.on("end",()=>this.requestData.requestEventDebugHandler("socket-end",{socket:D})),D.on("lookup",(...B)=>this.requestData.requestEventDebugHandler("socket-lookup",{socket:D,data:B})),D.on("timeout",()=>this.requestData.requestEventDebugHandler("socket-timeout",{socket:D}))})}makeRequest(){return this.buildRequest(),new Promise((u,D)=>{let B=(G)=>{F.emit("complete"),u(G)},A=(G)=>{F.emit("complete"),D(G)},F=new kU,w=this.req;if(w.on("error",this.requestErrorHandler.bind(this,A)),w.on("socket",this.onSocketEventHandler.bind(this,A,F)),w.on("response",this.classicResponseHandler.bind(this,B,A)),this.requestData.options.timeout)w.on("timeout",this.timeoutErrorHandler.bind(this));if(this.requestData.requestEventDebugHandler)this.registerRequestEventDebugHandlers(w);if(this.requestData.body)w.write(this.requestData.body);w.end()})}async makeRequestAsStream(){let{req:u,res:D,requestData:B,originalResponse:A}=await this.makeRequestAndResolveWhenReady();return new M3(B,{req:u,res:D,originalResponse:A})}makeRequestAndResolveWhenReady(){return this.buildRequest(),new Promise((u,D)=>{let B=this.req;if(B.on("error",this.requestErrorHandler.bind(this,D)),B.on("response",this.streamResponseHandler.bind(this,u,D)),this.requestData.body)B.write(this.requestData.body);B.end()})}}var _u=jW;import{EventEmitter as yU}from"events";class lW extends yU{constructor(u){super();this.stream=u,this.stack=[],this.onStreamData=this.onStreamData.bind(this),this.onStreamError=this.onStreamError.bind(this),this.onceNewEvent=this.once.bind(this,"event"),u.on(M.Data,this.onStreamData),u.on(M.ConnectionError,this.onStreamError),u.on(M.TweetParseError,this.onStreamError),u.on(M.ConnectionClosed,this.onStreamError)}nextEvent(){return new Promise(this.onceNewEvent)}hasStack(){return this.stack.length>0}popStack(){let u=this.stack;return this.stack=[],u}destroy(){this.removeAllListeners(),this.stream.off(M.Data,this.onStreamData),this.stream.off(M.ConnectionError,this.onStreamError),this.stream.off(M.TweetParseError,this.onStreamError),this.stream.off(M.ConnectionClosed,this.onStreamError)}emitEvent(u,D){this.emit("event",{type:u,payload:D})}onStreamError(u){this.emitEvent("error",u)}onStreamData(u){this.stack.push(u),this.emitEvent("data",u)}}var dW=lW;import{EventEmitter as TU}from"events";class L3 extends TU{constructor(){super(...arguments);this.currentMessage=""}push(u){this.currentMessage+=u,u=this.currentMessage;let D=u.length,B=0,A=0;while(A<D){if(u.slice(A,A+2)===`\r
69
- `){let F=u.slice(B,A);if(B=A+=2,!F.length)continue;try{let w=JSON.parse(F);if(w){this.emit(W0.ParsedData,w);continue}}catch(w){this.emit(W0.ParseError,w)}}A++}this.currentMessage=u.slice(B,D)}reset(){this.currentMessage=""}}var W0;(function(u){u.ParsedData="parsed data",u.ParseError="parse error"})(W0||(W0={}));var iW=[5,15,30,60,90,120,180,300,600,900],qU=(u)=>u>iW.length?901000:iW[u-1]*1000;class rW extends IU{constructor(u,D){super();if(this.requestData=u,this.autoReconnect=!1,this.autoReconnectRetries=5,this.keepAliveTimeoutMs=120000,this.nextRetryTimeout=qU,this.parser=new L3,this.connectionProcessRunning=!1,this.onKeepAliveTimeout=this.onKeepAliveTimeout.bind(this),this.initEventsFromParser(),D)this.req=D.req,this.res=D.res,this.originalResponse=D.originalResponse,this.initEventsFromRequest()}on(u,D){return super.on(u,D)}initEventsFromRequest(){if(!this.req||!this.res)throw Error("TweetStream error: You cannot init TweetStream without a request and response object.");let u=(D)=>{this.emit(M.ConnectionError,D),this.emit(M.Error,{type:M.ConnectionError,error:D,message:"Connection lost or closed by Twitter."}),this.onConnectionError()};this.req.on("error",u),this.res.on("error",u),this.res.on("close",()=>u(Error("Connection closed by Twitter."))),this.res.on("data",(D)=>{if(this.resetKeepAliveTimeout(),D.toString()===`\r
70
- `)return this.emit(M.DataKeepAlive);this.parser.push(D.toString())}),this.resetKeepAliveTimeout()}initEventsFromParser(){let u=this.requestData.payloadIsError;this.parser.on(W0.ParsedData,(D)=>{if(u&&u(D))this.emit(M.DataError,D),this.emit(M.Error,{type:M.DataError,error:D,message:"Twitter sent a payload that is detected as an error payload."});else this.emit(M.Data,D)}),this.parser.on(W0.ParseError,(D)=>{this.emit(M.TweetParseError,D),this.emit(M.Error,{type:M.TweetParseError,error:D,message:"Failed to parse stream data."})})}resetKeepAliveTimeout(){if(this.unbindKeepAliveTimeout(),this.keepAliveTimeoutMs!==1/0)this.keepAliveTimeout=setTimeout(this.onKeepAliveTimeout,this.keepAliveTimeoutMs)}onKeepAliveTimeout(){this.emit(M.ConnectionLost),this.onConnectionError()}unbindTimeouts(){this.unbindRetryTimeout(),this.unbindKeepAliveTimeout()}unbindKeepAliveTimeout(){if(this.keepAliveTimeout)clearTimeout(this.keepAliveTimeout),this.keepAliveTimeout=void 0}unbindRetryTimeout(){if(this.retryTimeout)clearTimeout(this.retryTimeout),this.retryTimeout=void 0}closeWithoutEmit(){if(this.unbindTimeouts(),this.res)this.res.removeAllListeners(),this.res.destroy();if(this.req)this.req.removeAllListeners(),this.req.destroy()}close(){this.emit(M.ConnectionClosed),this.closeWithoutEmit()}destroy(){this.removeAllListeners(),this.close()}async clone(){let D=await new _u(this.requestData).makeRequestAsStream(),B=this.eventNames();for(let A of B){let F=this.listeners(A);for(let w of F)D.on(A,w)}return D}async connect(u={}){if(typeof u.autoReconnect<"u")this.autoReconnect=u.autoReconnect;if(typeof u.autoReconnectRetries<"u")this.autoReconnectRetries=u.autoReconnectRetries==="unlimited"?1/0:u.autoReconnectRetries;if(typeof u.keepAliveTimeout<"u")this.keepAliveTimeoutMs=u.keepAliveTimeout==="disable"?1/0:u.keepAliveTimeout;if(typeof u.nextRetryTimeout<"u")this.nextRetryTimeout=u.nextRetryTimeout;this.unbindTimeouts();try{await this.reconnect()}catch(D){if(this.emit(M.ConnectError,0),this.emit(M.Error,{type:M.ConnectError,error:D,message:"Connect error - Initial connection just failed."}),this.autoReconnect)this.makeAutoReconnectRetry(0,D);else throw D}return this}async reconnect(){if(this.connectionProcessRunning)throw Error("Connection process is already running.");this.connectionProcessRunning=!0;try{let u=!0;if(this.req)u=!1,this.closeWithoutEmit();let{req:D,res:B,originalResponse:A}=await new _u(this.requestData).makeRequestAndResolveWhenReady();this.req=D,this.res=B,this.originalResponse=A,this.emit(u?M.Connected:M.Reconnected),this.parser.reset(),this.initEventsFromRequest()}finally{this.connectionProcessRunning=!1}}async onConnectionError(u=0){if(this.unbindTimeouts(),this.closeWithoutEmit(),!this.autoReconnect){this.emit(M.ConnectionClosed);return}if(u>=this.autoReconnectRetries){this.emit(M.ReconnectLimitExceeded),this.emit(M.ConnectionClosed);return}try{this.emit(M.ReconnectAttempt,u),await this.reconnect()}catch(D){this.emit(M.ReconnectError,u),this.emit(M.Error,{type:M.ReconnectError,error:D,message:`Reconnect error - ${u+1} attempts made yet.`}),this.makeAutoReconnectRetry(u,D)}}makeAutoReconnectRetry(u,D){let B=this.nextRetryTimeout(u+1,D);this.retryTimeout=setTimeout(()=>{this.onConnectionError(u+1)},B)}async*[Symbol.asyncIterator](){let u=new dW(this);try{while(!0){if(!this.req||this.req.aborted)throw Error("Connection closed");if(u.hasStack())yield*u.popStack();let{type:D,payload:B}=await u.nextEvent();if(D==="error")throw B}}finally{u.destroy()}}}var M3=rW;function nW(u){var D;if(!((D=u.clientSettings.plugins)===null||D===void 0?void 0:D.length))return!1;for(let B of u.clientSettings.plugins)if(B.onRequestError||B.onResponseError)return!0;return!1}async function pW(u,D,B,A){let F;if(A instanceof yu||A instanceof Tu)F=await this.applyPluginMethod("onRequestError",{client:this,url:this.getUrlObjectFromUrlString(u.url),params:u,computedParams:D,requestOptions:B,error:A});else if(A instanceof Iu)F=await this.applyPluginMethod("onResponseError",{client:this,url:this.getUrlObjectFromUrlString(u.url),params:u,computedParams:D,requestOptions:B,error:A});if(F&&F instanceof qu)return F.value;return Promise.reject(A)}import*as tW from"crypto";class y2{constructor(u){this.nonceLength=32,this.consumerKeys=u.consumerKeys}static percentEncode(u){return encodeURIComponent(u).replace(/!/g,"%21").replace(/\*/g,"%2A").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29")}hash(u,D){return tW.createHmac("sha1",D).update(u).digest("base64")}authorize(u,D={}){let B={oauth_consumer_key:this.consumerKeys.key,oauth_nonce:this.getNonce(),oauth_signature_method:"HMAC-SHA1",oauth_timestamp:this.getTimestamp(),oauth_version:"1.0"};if(D.key!==void 0)B.oauth_token=D.key;if(!u.data)u.data={};return B.oauth_signature=this.getSignature(u,D.secret,B),B}toHeader(u){let D=sW(u),B="OAuth ";for(let A of D){if(A.key.indexOf("oauth_")!==0)continue;B+=y2.percentEncode(A.key)+'="'+y2.percentEncode(A.value)+'",'}return{Authorization:B.slice(0,B.length-1)}}getNonce(){let D="";for(let B=0;B<this.nonceLength;B++)D+="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"[Math.trunc(Math.random()*62)];return D}getTimestamp(){return Math.trunc(new Date().getTime()/1000)}getSignature(u,D,B){return this.hash(this.getBaseString(u,B),this.getSigningKey(D))}getSigningKey(u){return y2.percentEncode(this.consumerKeys.secret)+"&"+y2.percentEncode(u||"")}getBaseString(u,D){return u.method.toUpperCase()+"&"+y2.percentEncode(this.getBaseUrl(u.url))+"&"+y2.percentEncode(this.getParameterString(u,D))}getParameterString(u,D){let B=sW(gU(aW(D,aW(u.data,_U(u.url))))),A="";for(let{key:F,value:w}of B)if(w&&Array.isArray(w)){w.sort();let G="";w.forEach((N,$)=>{if(G+=F+"="+N,$<w.length)G+="&"}),A+=G}else A+=F+"="+w+"&";return A.slice(0,A.length-1)}getBaseUrl(u){return u.split("?")[0]}}var gu=y2;function aW(u,D){return{...u||{},...D||{}}}function sW(u){return Object.keys(u).sort().map((D)=>({key:D,value:u[D]}))}function mU(u){let D=u.split("&"),B={};for(let A of D){let[F,w=""]=A.split("=");if(B[F]){if(!Array.isArray(B[F]))B[F]=[B[F]];B[F].push(decodeURIComponent(w))}else B[F]=decodeURIComponent(w)}return B}function _U(u){let D=u.split("?");if(D.length===1)return{};return mU(D[1])}function gU(u){let D={};for(let B in u){let A=u[B];if(A&&Array.isArray(A))A=A.map((F)=>y2.percentEncode(F));else A=y2.percentEncode(A);D[y2.percentEncode(B)]=A}return D}class T2{constructor(){this._boundary="",this._chunks=[]}bodyAppend(...u){let D=u.map((B)=>B instanceof Buffer?B:Buffer.from(B));this._chunks.push(...D)}append(u,D,B){let A=D instanceof Buffer?D:D.toString(),F=this.getMultipartHeader(u,A,B);this.bodyAppend(F,A,T2.LINE_BREAK)}getHeaders(){return{"content-type":"multipart/form-data; boundary="+this.getBoundary()}}getLength(){return this._chunks.reduce((u,D)=>u+D.length,this.getMultipartFooter().length)}getBuffer(){let u=[...this._chunks,this.getMultipartFooter()],D=Buffer.alloc(this.getLength()),B=0;for(let A of u)for(let F=0;F<A.length;B++,F++)D[B]=A[F];return D}getBoundary(){if(!this._boundary)this.generateBoundary();return this._boundary}generateBoundary(){let u="--------------------------";for(let D=0;D<24;D++)u+=Math.floor(Math.random()*10).toString(16);this._boundary=u}getMultipartHeader(u,D,B){if(!B)B=D instanceof Buffer?T2.DEFAULT_CONTENT_TYPE:"";let A={"Content-Disposition":["form-data",`name="${u}"`],"Content-Type":B},F="";for(let[w,G]of Object.entries(A)){if(!G.length)continue;F+=w+": "+R3(G).join("; ")+T2.LINE_BREAK}return"--"+this.getBoundary()+T2.LINE_BREAK+F+T2.LINE_BREAK}getMultipartFooter(){if(this._footerChunk)return this._footerChunk;return this._footerChunk=Buffer.from("--"+this.getBoundary()+"--"+T2.LINE_BREAK)}}T2.LINE_BREAK=`\r
71
- `;T2.DEFAULT_CONTENT_TYPE="application/octet-stream";class o8{static formatQueryToString(u){let D={};for(let B in u)if(typeof u[B]==="string")D[B]=u[B];else if(typeof u[B]<"u")D[B]=String(u[B]);return D}static autoDetectBodyType(u){if(u.pathname.startsWith("/2/")||u.pathname.startsWith("/labs/2/")){if(u.password.startsWith("/2/oauth2"))return"url";return"json"}if(u.hostname==="upload.x.com"){if(u.pathname==="/1.1/media/upload.json")return"form-data";return"json"}let D=u.pathname.split("/1.1/",2)[1];if(this.JSON_1_1_ENDPOINTS.has(D))return"json";return"url"}static addQueryParamsToUrl(u,D){let B=Object.entries(D);if(B.length){let A="";for(let[F,w]of B)A+=(A.length?"&":"?")+`${gu.percentEncode(F)}=${gu.percentEncode(w)}`;u.search=A}}static constructBodyParams(u,D,B){if(u instanceof Buffer)return u;if(B==="json"){if(!D["content-type"])D["content-type"]="application/json;charset=UTF-8";return JSON.stringify(u)}else if(B==="url"){if(!D["content-type"])D["content-type"]="application/x-www-form-urlencoded;charset=UTF-8";if(Object.keys(u).length)return new URLSearchParams(u).toString().replace(/\*/g,"%2A");return""}else if(B==="raw")throw Error("You can only use raw body mode with Buffers. To give a string, use Buffer.from(str).");else{let A=new T2;for(let F in u)A.append(F,u[F]);if(!D["content-type"]){let F=A.getHeaders();D["content-type"]=F["content-type"]}return A.getBuffer()}}static setBodyLengthHeader(u,D){var B;if(u.headers=(B=u.headers)!==null&&B!==void 0?B:{},typeof D==="string")u.headers["content-length"]=Buffer.byteLength(D);else u.headers["content-length"]=D.length}static isOAuthSerializable(u){return!(u instanceof Buffer)}static mergeQueryAndBodyForOAuth(u,D){let B={};for(let A in u)B[A]=u[A];if(this.isOAuthSerializable(D))for(let A in D){let F=D[A];if(this.isOAuthSerializable(F))B[A]=typeof F==="object"&&F!==null&&"toString"in F?F.toString():F}return B}static moveUrlQueryParamsIntoObject(u,D){for(let[B,A]of u.searchParams)D[B]=A;return u.search="",u}static applyRequestParametersToUrl(u,D){return u.pathname=u.pathname.replace(/:([A-Z_-]+)/ig,(B,A)=>{if(D[A]!==void 0)return String(D[A]);return B}),u}}o8.JSON_1_1_ENDPOINTS=new Set(["direct_messages/events/new.json","direct_messages/welcome_messages/new.json","direct_messages/welcome_messages/rules/new.json","media/metadata/create.json","collections/entries/curate.json"]);var V2=o8;import*as oW from"crypto";class K0{static getCodeVerifier(){return this.generateRandomString(128)}static getCodeChallengeFromVerifier(u){return this.escapeBase64Url(oW.createHash("sha256").update(u).digest("base64"))}static getAuthHeader(u,D){let B=encodeURIComponent(u)+":"+encodeURIComponent(D);return Buffer.from(B).toString("base64")}static generateRandomString(u){let D="",B="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";for(let A=0;A<u;A++)D+=B[Math.floor(Math.random()*B.length)];return D}static escapeBase64Url(u){return u.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}}class p0{constructor(u){if(this.rateLimits={},this.clientSettings={},u)this.clientSettings=u}getRateLimits(){return this.rateLimits}saveRateLimit(u,D){this.rateLimits[u]=D}async send(u){var D,B,A,F,w;if((D=this.clientSettings.plugins)===null||D===void 0?void 0:D.length){let J=await this.applyPreRequestConfigHooks(u);if(J)return J}let G=this.getHttpRequestArgs(u),N={method:G.method,headers:G.headers,timeout:u.timeout,agent:this.clientSettings.httpAgent},$=u.enableRateLimitSave!==!1;if(G.body)V2.setBodyLengthHeader(N,G.body);if((B=this.clientSettings.plugins)===null||B===void 0?void 0:B.length)await this.applyPreRequestHooks(u,G,N);let Z=new _u({url:G.url,options:N,body:G.body,rateLimitSaver:$?this.saveRateLimit.bind(this,G.rawUrl):void 0,requestEventDebugHandler:u.requestEventDebugHandler,compression:(F=(A=u.compression)!==null&&A!==void 0?A:this.clientSettings.compression)!==null&&F!==void 0?F:!0,forceParseMode:u.forceParseMode}).makeRequest();if(nW(this))Z=this.applyResponseErrorHooks(u,G,N,Z);let v=await Z;if((w=this.clientSettings.plugins)===null||w===void 0?void 0:w.length){let J=await this.applyPostRequestHooks(u,G,N,v);if(J)return J.value}return v}sendStream(u){var D,B;if(this.clientSettings.plugins)this.applyPreStreamRequestConfigHooks(u);let A=this.getHttpRequestArgs(u),F={method:A.method,headers:A.headers,agent:this.clientSettings.httpAgent},w=u.enableRateLimitSave!==!1,G=u.autoConnect!==!1;if(A.body)V2.setBodyLengthHeader(F,A.body);let N={url:A.url,options:F,body:A.body,rateLimitSaver:w?this.saveRateLimit.bind(this,A.rawUrl):void 0,payloadIsError:u.payloadIsError,compression:(B=(D=u.compression)!==null&&D!==void 0?D:this.clientSettings.compression)!==null&&B!==void 0?B:!0},$=new M3(N);if(!G)return $;return $.connect()}initializeToken(u){if(typeof u==="string")this.bearerToken=u;else if(typeof u==="object"&&"appKey"in u){if(this.consumerToken=u.appKey,this.consumerSecret=u.appSecret,u.accessToken&&u.accessSecret)this.accessToken=u.accessToken,this.accessSecret=u.accessSecret;this._oauth=this.buildOAuth()}else if(typeof u==="object"&&"username"in u){let D=encodeURIComponent(u.username)+":"+encodeURIComponent(u.password);this.basicToken=Buffer.from(D).toString("base64")}else if(typeof u==="object"&&"clientId"in u)this.clientId=u.clientId,this.clientSecret=u.clientSecret}getActiveTokens(){if(this.bearerToken)return{type:"oauth2",bearerToken:this.bearerToken};else if(this.basicToken)return{type:"basic",token:this.basicToken};else if(this.consumerSecret&&this._oauth)return{type:"oauth-1.0a",appKey:this.consumerToken,appSecret:this.consumerSecret,accessToken:this.accessToken,accessSecret:this.accessSecret};else if(this.clientId)return{type:"oauth2-user",clientId:this.clientId};return{type:"none"}}buildOAuth(){if(!this.consumerSecret||!this.consumerToken)throw Error("Invalid consumer tokens");return new gu({consumerKeys:{key:this.consumerToken,secret:this.consumerSecret}})}getOAuthAccessTokens(){if(!this.accessSecret||!this.accessToken)return;return{key:this.accessToken,secret:this.accessSecret}}getPlugins(){var u;return(u=this.clientSettings.plugins)!==null&&u!==void 0?u:[]}hasPlugins(){var u;return!!((u=this.clientSettings.plugins)===null||u===void 0?void 0:u.length)}async applyPluginMethod(u,D){var B;let A;for(let F of this.getPlugins()){let w=await((B=F[u])===null||B===void 0?void 0:B.call(F,D));if(w&&w instanceof qu)A=w}return A}writeAuthHeaders({headers:u,bodyInSignature:D,url:B,method:A,query:F,body:w}){if(u={...u},this.bearerToken)u.Authorization="Bearer "+this.bearerToken;else if(this.basicToken)u.Authorization="Basic "+this.basicToken;else if(this.clientId&&this.clientSecret)u.Authorization="Basic "+K0.getAuthHeader(this.clientId,this.clientSecret);else if(this.consumerSecret&&this._oauth){let G=D?V2.mergeQueryAndBodyForOAuth(F,w):F,N=this._oauth.authorize({url:B.toString(),method:A,data:G},this.getOAuthAccessTokens());u={...u,...this._oauth.toHeader(N)}}return u}getUrlObjectFromUrlString(u){if(!u.startsWith("http"))u="https://"+u;return new URL(u)}getHttpRequestArgs({url:u,method:D,query:B={},body:A={},headers:F,forceBodyMode:w,enableAuth:G,params:N}){let $=void 0;if(D=D.toUpperCase(),F=F!==null&&F!==void 0?F:{},!F["x-user-agent"])F["x-user-agent"]="Node.twitter-api-v2";let Z=this.getUrlObjectFromUrlString(u),v=Z.origin+Z.pathname;if(N)V2.applyRequestParametersToUrl(Z,N);let J=V2.formatQueryToString(B);if(V2.moveUrlQueryParamsIntoObject(Z,J),!(A instanceof Buffer))bW(A);let Q=w!==null&&w!==void 0?w:V2.autoDetectBodyType(Z);if(G!==!1){let X=p0.BODY_METHODS.has(D)&&Q==="url";F=this.writeAuthHeaders({headers:F,bodyInSignature:X,method:D,query:J,url:Z,body:A})}if(p0.BODY_METHODS.has(D))$=V2.constructBodyParams(A,F,Q)||void 0;return V2.addQueryParamsToUrl(Z,J),{rawUrl:v,url:Z,method:D,headers:F,body:$}}async applyPreRequestConfigHooks(u){var D;let B=this.getUrlObjectFromUrlString(u.url);for(let A of this.getPlugins()){let F=await((D=A.onBeforeRequestConfig)===null||D===void 0?void 0:D.call(A,{client:this,url:B,params:u}));if(F)return F}}applyPreStreamRequestConfigHooks(u){var D;let B=this.getUrlObjectFromUrlString(u.url);for(let A of this.getPlugins())(D=A.onBeforeStreamRequestConfig)===null||D===void 0||D.call(A,{client:this,url:B,params:u})}async applyPreRequestHooks(u,D,B){await this.applyPluginMethod("onBeforeRequest",{client:this,url:this.getUrlObjectFromUrlString(u.url),params:u,computedParams:D,requestOptions:B})}async applyPostRequestHooks(u,D,B,A){return await this.applyPluginMethod("onAfterRequest",{client:this,url:this.getUrlObjectFromUrlString(u.url),params:u,computedParams:D,requestOptions:B,response:A})}applyResponseErrorHooks(u,D,B,A){return A.catch(pW.bind(this,u,D,B))}}p0.BODY_METHODS=new Set(["POST","PUT","PATCH"]);class w0{constructor(u,D={}){if(this._currentUser=null,this._currentUserV2=null,u instanceof w0)this._requestMaker=u._requestMaker;else this._requestMaker=new p0(D),this._requestMaker.initializeToken(u)}setPrefix(u){this._prefix=u}cloneWithPrefix(u){let D=this.constructor(this);return D.setPrefix(u),D}getActiveTokens(){return this._requestMaker.getActiveTokens()}getPlugins(){return this._requestMaker.getPlugins()}getPluginOfType(u){return this.getPlugins().find((D)=>D instanceof u)}hasHitRateLimit(u){var D;if(this.isRateLimitStatusObsolete(u))return!1;return((D=this.getLastRateLimitStatus(u))===null||D===void 0?void 0:D.remaining)===0}isRateLimitStatusObsolete(u){let D=this.getLastRateLimitStatus(u);if(D===void 0)return!0;return D.reset*1000<Date.now()}getLastRateLimitStatus(u){let D=u.match(/^https?:\/\//)?u:this._prefix+u;return this._requestMaker.getRateLimits()[D]}getCurrentUserObject(u=!1){if(!u&&this._currentUser){if(this._currentUser.value)return Promise.resolve(this._currentUser.value);return this._currentUser.promise}return this._currentUser=s8(()=>this.get("account/verify_credentials.json",{tweet_mode:"extended"},{prefix:A0})),this._currentUser.promise}getCurrentUserV2Object(u=!1){if(!u&&this._currentUserV2){if(this._currentUserV2.value)return Promise.resolve(this._currentUserV2.value);return this._currentUserV2.promise}return this._currentUserV2=s8(()=>this.get("users/me",void 0,{prefix:B0})),this._currentUserV2.promise}async get(u,D={},{fullResponse:B,prefix:A=this._prefix,...F}={}){if(A)u=A+u;let w=await this._requestMaker.send({url:u,method:"GET",query:D,...F});return B?w:w.data}async delete(u,D={},{fullResponse:B,prefix:A=this._prefix,...F}={}){if(A)u=A+u;let w=await this._requestMaker.send({url:u,method:"DELETE",query:D,...F});return B?w:w.data}async post(u,D,{fullResponse:B,prefix:A=this._prefix,...F}={}){if(A)u=A+u;let w=await this._requestMaker.send({url:u,method:"POST",body:D,...F});return B?w:w.data}async put(u,D,{fullResponse:B,prefix:A=this._prefix,...F}={}){if(A)u=A+u;let w=await this._requestMaker.send({url:u,method:"PUT",body:D,...F});return B?w:w.data}async patch(u,D,{fullResponse:B,prefix:A=this._prefix,...F}={}){if(A)u=A+u;let w=await this._requestMaker.send({url:u,method:"PATCH",body:D,...F});return B?w:w.data}getStream(u,D,{prefix:B=this._prefix,...A}={}){return this._requestMaker.sendStream({url:B?B+u:u,method:"GET",query:D,...A})}postStream(u,D,{prefix:B=this._prefix,...A}={}){return this._requestMaker.sendStream({url:B?B+u:u,method:"POST",body:D,...A})}}class k2 extends w0{constructor(u){if(!(u instanceof w0))throw Error("You must instance SubTwitterApi instance from existing TwitterApi instance.");super(u)}}class a0 extends n0{constructor(){super(...arguments);this.hasFinishedFetch=!1}refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.push(...B),this.hasFinishedFetch=B.length===0}getNextQueryParams(u){let D=BigInt(this._realData[this._realData.length-1].id_str);return{...this.injectQueryParams(u),max_id:(D-BigInt(1)).toString()}}getPageLengthFromRequest(u){return u.data.length}isFetchLastOver(u){return!u.data.length}canFetchNextPage(u){return u.length>0}getItemArray(){return this.tweets}get tweets(){return this._realData}get done(){return super.done||this.hasFinishedFetch}}class e8 extends a0{constructor(){super(...arguments);this._endpoint="statuses/home_timeline.json"}}class u5 extends a0{constructor(){super(...arguments);this._endpoint="statuses/mentions_timeline.json"}}class E3 extends a0{constructor(){super(...arguments);this._endpoint="statuses/user_timeline.json"}}class D5 extends a0{constructor(){super(...arguments);this._endpoint="lists/statuses.json"}}class O3 extends a0{constructor(){super(...arguments);this._endpoint="favorites/list.json"}}class B5 extends F2{constructor(){super(...arguments);this._endpoint="mutes/users/list.json"}refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.users.push(...B.users),this._realData.next_cursor=B.next_cursor}getPageLengthFromRequest(u){return u.data.users.length}getItemArray(){return this.users}get users(){return this._realData.users}}class A5 extends F2{constructor(){super(...arguments);this._endpoint="mutes/users/ids.json",this._maxResultsWhenFetchLast=5000}refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.ids.push(...B.ids),this._realData.next_cursor=B.next_cursor}getPageLengthFromRequest(u){return u.data.ids.length}getItemArray(){return this.ids}get ids(){return this._realData.ids}}class F5 extends F2{constructor(){super(...arguments);this._endpoint="followers/list.json"}refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.users.push(...B.users),this._realData.next_cursor=B.next_cursor}getPageLengthFromRequest(u){return u.data.users.length}getItemArray(){return this.users}get users(){return this._realData.users}}class w5 extends F2{constructor(){super(...arguments);this._endpoint="followers/ids.json",this._maxResultsWhenFetchLast=5000}refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.ids.push(...B.ids),this._realData.next_cursor=B.next_cursor}getPageLengthFromRequest(u){return u.data.ids.length}getItemArray(){return this.ids}get ids(){return this._realData.ids}}class G5 extends F2{constructor(){super(...arguments);this._endpoint="friends/list.json"}refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.users.push(...B.users),this._realData.next_cursor=B.next_cursor}getPageLengthFromRequest(u){return u.data.users.length}getItemArray(){return this.users}get users(){return this._realData.users}}class N5 extends F2{constructor(){super(...arguments);this._endpoint="friends/ids.json",this._maxResultsWhenFetchLast=5000}refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.ids.push(...B.ids),this._realData.next_cursor=B.next_cursor}getPageLengthFromRequest(u){return u.data.ids.length}getItemArray(){return this.ids}get ids(){return this._realData.ids}}class $5 extends n0{constructor(){super(...arguments);this._endpoint="users/search.json"}refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.push(...B)}getNextQueryParams(u){var D;let B=Number((D=this._queryParams.page)!==null&&D!==void 0?D:"1");return{...this._queryParams,page:B+1,...u?{count:u}:{}}}getPageLengthFromRequest(u){return u.data.length}isFetchLastOver(u){return!u.data.length}canFetchNextPage(u){return u.length>0}getItemArray(){return this.users}get users(){return this._realData}}class C3 extends F2{constructor(){super(...arguments);this._endpoint="friendships/incoming.json",this._maxResultsWhenFetchLast=5000}refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.ids.push(...B.ids),this._realData.next_cursor=B.next_cursor}getPageLengthFromRequest(u){return u.data.ids.length}getItemArray(){return this.ids}get ids(){return this._realData.ids}}class z5 extends C3{constructor(){super(...arguments);this._endpoint="friendships/outgoing.json"}}class P3 extends F2{refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.lists.push(...B.lists),this._realData.next_cursor=B.next_cursor}getPageLengthFromRequest(u){return u.data.lists.length}getItemArray(){return this.lists}get lists(){return this._realData.lists}}class Z5 extends P3{constructor(){super(...arguments);this._endpoint="lists/memberships.json"}}class J5 extends P3{constructor(){super(...arguments);this._endpoint="lists/ownerships.json"}}class Q5 extends P3{constructor(){super(...arguments);this._endpoint="lists/subscriptions.json"}}class v5 extends F2{refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.users.push(...B.users),this._realData.next_cursor=B.next_cursor}getPageLengthFromRequest(u){return u.data.users.length}getItemArray(){return this.users}get users(){return this._realData.users}}class X5 extends v5{constructor(){super(...arguments);this._endpoint="lists/members.json"}}class Y5 extends v5{constructor(){super(...arguments);this._endpoint="lists/subscribers.json"}}class s0 extends k2{constructor(){super(...arguments);this._prefix=A0}singleTweet(u,D={}){return this.get("statuses/show.json",{tweet_mode:"extended",id:u,...D})}tweets(u,D={}){return this.post("statuses/lookup.json",{tweet_mode:"extended",id:u,...D})}oembedTweet(u,D={}){return this.get("oembed",{url:`https://x.com/i/statuses/${u}`,...D},{prefix:"https://publish.x.com/"})}async homeTimeline(u={}){let D={tweet_mode:"extended",...u},B=await this.get("statuses/home_timeline.json",D,{fullResponse:!0});return new e8({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}async mentionTimeline(u={}){let D={tweet_mode:"extended",...u},B=await this.get("statuses/mentions_timeline.json",D,{fullResponse:!0});return new u5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}async userTimeline(u,D={}){let B={tweet_mode:"extended",user_id:u,...D},A=await this.get("statuses/user_timeline.json",B,{fullResponse:!0});return new E3({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:B})}async userTimelineByUsername(u,D={}){let B={tweet_mode:"extended",screen_name:u,...D},A=await this.get("statuses/user_timeline.json",B,{fullResponse:!0});return new E3({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:B})}async favoriteTimeline(u,D={}){let B={tweet_mode:"extended",user_id:u,...D},A=await this.get("favorites/list.json",B,{fullResponse:!0});return new O3({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:B})}async favoriteTimelineByUsername(u,D={}){let B={tweet_mode:"extended",screen_name:u,...D},A=await this.get("favorites/list.json",B,{fullResponse:!0});return new O3({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:B})}user(u){return this.get("users/show.json",{tweet_mode:"extended",...u})}users(u){return this.get("users/lookup.json",{tweet_mode:"extended",...u})}verifyCredentials(u={}){return this.get("account/verify_credentials.json",u)}async listMutedUsers(u={}){let D={tweet_mode:"extended",...u},B=await this.get("mutes/users/list.json",D,{fullResponse:!0});return new B5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}async listMutedUserIds(u={}){let D={stringify_ids:!0,...u},B=await this.get("mutes/users/ids.json",D,{fullResponse:!0});return new A5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}async userFriendList(u={}){let D={...u},B=await this.get("friends/list.json",D,{fullResponse:!0});return new G5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}async userFollowerList(u={}){let D={...u},B=await this.get("followers/list.json",D,{fullResponse:!0});return new F5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}async userFollowerIds(u={}){let D={stringify_ids:!0,...u},B=await this.get("followers/ids.json",D,{fullResponse:!0});return new w5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}async userFollowingIds(u={}){let D={stringify_ids:!0,...u},B=await this.get("friends/ids.json",D,{fullResponse:!0});return new N5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}async searchUsers(u,D={}){let B={q:u,tweet_mode:"extended",page:1,...D},A=await this.get("users/search.json",B,{fullResponse:!0});return new $5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:B})}friendship(u){return this.get("friendships/show.json",u)}friendships(u){return this.get("friendships/lookup.json",u)}friendshipsNoRetweets(){return this.get("friendships/no_retweets/ids.json",{stringify_ids:!0})}async friendshipsIncoming(u={}){let D={stringify_ids:!0,...u},B=await this.get("friendships/incoming.json",D,{fullResponse:!0});return new C3({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}async friendshipsOutgoing(u={}){let D={stringify_ids:!0,...u},B=await this.get("friendships/outgoing.json",D,{fullResponse:!0});return new z5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}accountSettings(){return this.get("account/settings.json")}userProfileBannerSizes(u){return this.get("users/profile_banner.json",u)}list(u){return this.get("lists/show.json",{tweet_mode:"extended",...u})}lists(u={}){return this.get("lists/list.json",{tweet_mode:"extended",...u})}async listMembers(u={}){let D={tweet_mode:"extended",...u},B=await this.get("lists/members.json",D,{fullResponse:!0});return new X5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}listGetMember(u){return this.get("lists/members/show.json",{tweet_mode:"extended",...u})}async listMemberships(u={}){let D={tweet_mode:"extended",...u},B=await this.get("lists/memberships.json",D,{fullResponse:!0});return new Z5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}async listOwnerships(u={}){let D={tweet_mode:"extended",...u},B=await this.get("lists/ownerships.json",D,{fullResponse:!0});return new J5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}async listStatuses(u){let D={tweet_mode:"extended",...u},B=await this.get("lists/statuses.json",D,{fullResponse:!0});return new D5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}async listSubscribers(u={}){let D={tweet_mode:"extended",...u},B=await this.get("lists/subscribers.json",D,{fullResponse:!0});return new Y5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}listGetSubscriber(u){return this.get("lists/subscribers/show.json",{tweet_mode:"extended",...u})}async listSubscriptions(u={}){let D={tweet_mode:"extended",...u},B=await this.get("lists/subscriptions.json",D,{fullResponse:!0});return new Q5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}mediaInfo(u){return this.get("media/upload.json",{command:"STATUS",media_id:u},{prefix:b2})}filterStream({autoConnect:u,...D}={}){let B={};for(let[F,w]of Object.entries(D))if(F==="follow"||F==="track")B[F]=w.toString();else if(F==="locations"){let G=w;B.locations=R3(G).map((N)=>`${N.lng},${N.lat}`).join(",")}else B[F]=w;return this.stream.postStream("statuses/filter.json",B,{autoConnect:u})}sampleStream({autoConnect:u,...D}={}){return this.stream.getStream("statuses/sample.json",D,{autoConnect:u})}get stream(){let u=new c3(this);return u.setPrefix(_W),u}trendsByPlace(u,D={}){return this.get("trends/place.json",{id:u,...D})}trendsAvailable(){return this.get("trends/available.json")}trendsClosest(u,D){return this.get("trends/closest.json",{lat:u,long:D})}geoPlace(u){return this.get("geo/id/:place_id.json",void 0,{params:{place_id:u}})}geoSearch(u){return this.get("geo/search.json",u)}geoReverseGeoCode(u){return this.get("geo/reverse_geocode.json",u)}rateLimitStatuses(...u){return this.get("application/rate_limit_status.json",{resources:u})}supportedLanguages(){return this.get("help/languages.json")}}import*as G0 from"fs";async function W5(u){let D=await K5(u);if(typeof D==="number")return new Promise((B,A)=>{G0.readFile(D,(F,w)=>{if(F)return A(F);B(w)})});else if(D instanceof Buffer)return D;else return D.readFile()}function K5(u){if(typeof u==="string")return G0.promises.open(u,"r");else if(typeof u==="number")return u;else if(typeof u==="object"&&!(u instanceof Buffer))return u;else if(!(u instanceof Buffer))throw Error("Given file is not valid, please check its type.");else return u}async function eW(u){if(typeof u==="number")return(await new Promise((B,A)=>{G0.fstat(u,(F,w)=>{if(F)A(F);B(w)})})).size;else if(u instanceof Buffer)return u.length;else return(await u.stat()).size}function uK(u,D,B){if(typeof B==="string")return B;else if(typeof u==="string"&&!D)return fU(u);else if(typeof D==="string")return bU(D);throw Error("You must specify type if file is a file handle or Buffer.")}function fU(u){if(u.endsWith(".jpeg")||u.endsWith(".jpg"))return m.Jpeg;if(u.endsWith(".png"))return m.Png;if(u.endsWith(".webp"))return m.Webp;if(u.endsWith(".gif"))return m.Gif;if(u.endsWith(".mpeg4")||u.endsWith(".mp4"))return m.Mp4;if(u.endsWith(".mov")||u.endsWith(".mov"))return m.Mov;if(u.endsWith(".srt"))return m.Srt;return t8({instance:"TwitterApiv1ReadWrite",method:"uploadMedia",problem:"options.mimeType is missing and filename couldn't help to resolve MIME type, so it will fallback to image/jpeg",resolution:"If you except to give filenames without extensions, please specify explicitlty the MIME type using options.mimeType"}),m.Jpeg}function bU(u){if(t8({instance:"TwitterApiv1ReadWrite",method:"uploadMedia",problem:"you're using options.type",resolution:"Remove options.type argument and migrate to options.mimeType which takes the real MIME type. If you're using type=longmp4, add options.longVideo alongside of mimeType=EUploadMimeType.Mp4"}),u==="gif")return m.Gif;if(u==="jpg")return m.Jpeg;if(u==="png")return m.Png;if(u==="webp")return m.Webp;if(u==="srt")return m.Srt;if(u==="mp4"||u==="longmp4")return m.Mp4;if(u==="mov")return m.Mov;return u}function DK(u,D){if(u===m.Mp4||u===m.Mov)return D==="tweet"?"TweetVideo":"DmVideo";if(u===m.Gif)return D==="tweet"?"TweetGif":"DmGif";if(u===m.Srt)return"Subtitles";else return D==="tweet"?"TweetImage":"DmImage"}function h5(u){return new Promise((D)=>setTimeout(D,u*1000))}async function x5(u,D,B=0,A){if(u instanceof Buffer){let w=u.slice(B,B+D);return[w,w.length]}if(!A)throw Error("Well, we will need a buffer to store file content.");let F;if(typeof u==="number")F=await new Promise((w,G)=>{G0.read(u,A,0,D,B,(N,$)=>{if(N)G(N);w($)})});else F=(await u.read(A,0,D,B)).bytesRead;return[A,F]}var H5="media/upload.json";class t0 extends s0{constructor(){super(...arguments);this._prefix=A0}get readOnly(){return this}tweet(u,D={}){let B={status:u,tweet_mode:"extended",...D};return this.post("statuses/update.json",B)}async quote(u,D,B={}){let A="https://x.com/i/statuses/"+D;return this.tweet(u,{...B,attachment_url:A})}async tweetThread(u){let D=[];for(let B of u){let A=D.length?D[D.length-1]:null,F={...typeof B==="string"?{status:B}:B},w=A?A.id_str:F.in_reply_to_status_id,G=F.status;if(w)D.push(await this.reply(G,w,F));else D.push(await this.tweet(G,F))}return D}reply(u,D,B={}){return this.tweet(u,{auto_populate_reply_metadata:!0,in_reply_to_status_id:D,...B})}deleteTweet(u){return this.post("statuses/destroy/:id.json",{tweet_mode:"extended"},{params:{id:u}})}reportUserAsSpam(u){return this.post("users/report_spam.json",{tweet_mode:"extended",...u})}updateFriendship(u){return this.post("friendships/update.json",u)}createFriendship(u){return this.post("friendships/create.json",u)}destroyFriendship(u){return this.post("friendships/destroy.json",u)}updateAccountSettings(u){return this.post("account/settings.json",u)}updateAccountProfile(u){return this.post("account/update_profile.json",u)}async updateAccountProfileBanner(u,D={}){let B={banner:await W5(u),...D};return this.post("account/update_profile_banner.json",B,{forceBodyMode:"form-data"})}async updateAccountProfileImage(u,D={}){let B={tweet_mode:"extended",image:await W5(u),...D};return this.post("account/update_profile_image.json",B,{forceBodyMode:"form-data"})}removeAccountProfileBanner(){return this.post("account/remove_profile_banner.json")}createList(u){return this.post("lists/create.json",{tweet_mode:"extended",...u})}updateList(u){return this.post("lists/update.json",{tweet_mode:"extended",...u})}removeList(u){return this.post("lists/destroy.json",{tweet_mode:"extended",...u})}addListMembers(u){let B=u.user_id&&mu(u.user_id)||u.screen_name&&mu(u.screen_name)?"lists/members/create_all.json":"lists/members/create.json";return this.post(B,u)}removeListMembers(u){let B=u.user_id&&mu(u.user_id)||u.screen_name&&mu(u.screen_name)?"lists/members/destroy_all.json":"lists/members/destroy.json";return this.post(B,u)}subscribeToList(u){return this.post("lists/subscribers/create.json",{tweet_mode:"extended",...u})}unsubscribeOfList(u){return this.post("lists/subscribers/destroy.json",{tweet_mode:"extended",...u})}createMediaMetadata(u,D){return this.post("media/metadata/create.json",{media_id:u,...D},{prefix:b2,forceBodyMode:"json"})}createMediaSubtitles(u,D){return this.post("media/subtitles/create.json",{media_id:u,media_category:"TweetVideo",subtitle_info:{subtitles:D}},{prefix:b2,forceBodyMode:"json"})}deleteMediaSubtitles(u,...D){return this.post("media/subtitles/delete.json",{media_id:u,media_category:"TweetVideo",subtitle_info:{subtitles:D.map((B)=>({language_code:B}))}},{prefix:b2,forceBodyMode:"json"})}async uploadMedia(u,D={},B=!1){var A;let F=(A=D.chunkLength)!==null&&A!==void 0?A:1048576,{fileHandle:w,mediaCategory:G,fileSize:N,mimeType:$}=await this.getUploadMediaRequirements(u,D);try{let Z=await this.post(H5,{command:"INIT",total_bytes:N,media_type:$,media_category:G,additional_owners:D.additionalOwners,shared:D.shared?!0:void 0},{prefix:b2});await this.mediaChunkedUpload(w,F,Z.media_id_string,D.maxConcurrentUploads);let v=await this.post(H5,{command:"FINALIZE",media_id:Z.media_id_string},{prefix:b2});if(v.processing_info&&v.processing_info.state!=="succeeded")await this.awaitForMediaProcessingCompletion(v);if(B)return v;else return v.media_id_string}finally{if(typeof u==="number")S5.close(u,()=>{});else if(typeof w==="object"&&!(w instanceof Buffer))w.close()}}async awaitForMediaProcessingCompletion(u){var D;while(!0){u=await this.mediaInfo(u.media_id_string);let{processing_info:B}=u;if(!B||B.state==="succeeded")return;if((D=B.error)===null||D===void 0?void 0:D.code){let{name:A,message:F}=B.error;throw Error(`Failed to process media: ${A} - ${F}.`)}if(B.state==="failed")throw Error("Failed to process the media.");if(B.check_after_secs)await h5(B.check_after_secs);else await h5(5)}}async getUploadMediaRequirements(u,{mimeType:D,type:B,target:A,longVideo:F}={}){let w;try{w=await K5(u);let G=uK(u,B,D),N;if(G===m.Mp4&&(!D&&!B&&A!=="dm"||F))N="amplify_video";else N=DK(G,A!==null&&A!==void 0?A:"tweet");return{fileHandle:w,mediaCategory:N,fileSize:await eW(w),mimeType:G}}catch(G){if(typeof u==="number")S5.close(u,()=>{});else if(typeof w==="object"&&!(w instanceof Buffer))w.close();throw G}}async mediaChunkedUpload(u,D,B,A=3){let F=0;if(A<1)throw RangeError("Bad maxConcurrentUploads parameter.");let w=u instanceof Buffer?void 0:Buffer.alloc(D),G,N,$=0;[G,N]=await x5(u,D,$,w),$+=N;let Z=new Set;while(N){let v=G.slice(0,N);if(v.length){let J=this.post(H5,{command:"APPEND",media_id:B,segment_index:F,media:v},{prefix:b2});Z.add(J),J.then(()=>{Z.delete(J)}),F++}if(Z.size>=A)await Promise.race(Z);[G,N]=await x5(u,D,$,w),$+=N}await Promise.all([...Z])}}class BK extends t0{constructor(){super(...arguments);this._prefix=A0}get readWrite(){return this}sendDm({recipient_id:u,custom_profile_id:D,...B}){let A={event:{type:F0.Create,[F0.Create]:{target:{recipient_id:u},message_data:B}}};if(D)A.event[F0.Create].custom_profile_id=D;return this.post("direct_messages/events/new.json",A,{forceBodyMode:"json"})}getDmEvent(u){return this.get("direct_messages/events/show.json",{id:u})}deleteDm(u){return this.delete("direct_messages/events/destroy.json",{id:u})}async listDmEvents(u={}){let D={...u},B=await this.get("direct_messages/events/list.json",D,{fullResponse:!0});return new p8({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}newWelcomeDm(u,D){let B={[F0.WelcomeCreate]:{name:u,message_data:D}};return this.post("direct_messages/welcome_messages/new.json",B,{forceBodyMode:"json"})}getWelcomeDm(u){return this.get("direct_messages/welcome_messages/show.json",{id:u})}deleteWelcomeDm(u){return this.delete("direct_messages/welcome_messages/destroy.json",{id:u})}updateWelcomeDm(u,D){let B={message_data:D};return this.put("direct_messages/welcome_messages/update.json",B,{forceBodyMode:"json",query:{id:u}})}async listWelcomeDms(u={}){let D={...u},B=await this.get("direct_messages/welcome_messages/list.json",D,{fullResponse:!0});return new a8({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}newWelcomeDmRule(u){return this.post("direct_messages/welcome_messages/rules/new.json",{welcome_message_rule:{welcome_message_id:u}},{forceBodyMode:"json"})}getWelcomeDmRule(u){return this.get("direct_messages/welcome_messages/rules/show.json",{id:u})}deleteWelcomeDmRule(u){return this.delete("direct_messages/welcome_messages/rules/destroy.json",{id:u})}async listWelcomeDmRules(u={}){let D={...u};return this.get("direct_messages/welcome_messages/rules/list.json",D)}async setWelcomeDm(u,D=!0){var B;let A=await this.listWelcomeDmRules();if((B=A.welcome_message_rules)===null||B===void 0?void 0:B.length){for(let F of A.welcome_message_rules)if(await this.deleteWelcomeDmRule(F.id),D)await this.deleteWelcomeDm(F.welcome_message_id)}return this.newWelcomeDmRule(u)}markDmAsRead(u,D){return this.post("direct_messages/mark_read.json",{last_read_event_id:u,recipient_id:D},{forceBodyMode:"url"})}indicateDmTyping(u){return this.post("direct_messages/indicate_typing.json",{recipient_id:u},{forceBodyMode:"url"})}async downloadDmImage(u){if(typeof u!=="string"){let B=u[F0.Create].message_data.attachment;if(!B)throw Error("The given direct message doesn't contain any attachment");u=B.media.media_url_https}let D=await this.get(u,void 0,{forceParseMode:"buffer",prefix:""});if(!D.length)throw Error("Image not found. Make sure you are logged with credentials able to access direct messages, and check the URL.");return D}}var c3=BK;class q{constructor(u){this.result=u}get tweets(){return q.tweets(this.result)}static tweets(u){var D,B;return(B=(D=u.includes)===null||D===void 0?void 0:D.tweets)!==null&&B!==void 0?B:[]}tweetById(u){return q.tweetById(this.result,u)}static tweetById(u,D){return this.tweets(u).find((B)=>B.id===D)}retweet(u){return q.retweet(this.result,u)}static retweet(u,D){var B;let A=((B=D.referenced_tweets)!==null&&B!==void 0?B:[]).filter((F)=>F.type==="retweeted").map((F)=>F.id);return this.tweets(u).find((F)=>A.includes(F.id))}quote(u){return q.quote(this.result,u)}static quote(u,D){var B;let A=((B=D.referenced_tweets)!==null&&B!==void 0?B:[]).filter((F)=>F.type==="quoted").map((F)=>F.id);return this.tweets(u).find((F)=>A.includes(F.id))}repliedTo(u){return q.repliedTo(this.result,u)}static repliedTo(u,D){var B;let A=((B=D.referenced_tweets)!==null&&B!==void 0?B:[]).filter((F)=>F.type==="replied_to").map((F)=>F.id);return this.tweets(u).find((F)=>A.includes(F.id))}author(u){return q.author(this.result,u)}static author(u,D){let B=D.author_id;return B?this.users(u).find((A)=>A.id===B):void 0}repliedToAuthor(u){return q.repliedToAuthor(this.result,u)}static repliedToAuthor(u,D){let B=D.in_reply_to_user_id;return B?this.users(u).find((A)=>A.id===B):void 0}get users(){return q.users(this.result)}static users(u){var D,B;return(B=(D=u.includes)===null||D===void 0?void 0:D.users)!==null&&B!==void 0?B:[]}userById(u){return q.userById(this.result,u)}static userById(u,D){return this.users(u).find((B)=>B.id===D)}pinnedTweet(u){return q.pinnedTweet(this.result,u)}static pinnedTweet(u,D){return D.pinned_tweet_id?this.tweets(u).find((B)=>B.id===D.pinned_tweet_id):void 0}get media(){return q.media(this.result)}static media(u){var D,B;return(B=(D=u.includes)===null||D===void 0?void 0:D.media)!==null&&B!==void 0?B:[]}medias(u){return q.medias(this.result,u)}static medias(u,D){var B,A;let F=(A=(B=D.attachments)===null||B===void 0?void 0:B.media_keys)!==null&&A!==void 0?A:[];return this.media(u).filter((w)=>F.includes(w.media_key))}get polls(){return q.polls(this.result)}static polls(u){var D,B;return(B=(D=u.includes)===null||D===void 0?void 0:D.polls)!==null&&B!==void 0?B:[]}poll(u){return q.poll(this.result,u)}static poll(u,D){var B,A;let F=(A=(B=D.attachments)===null||B===void 0?void 0:B.poll_ids)!==null&&A!==void 0?A:[];if(F.length){let w=F[0];return this.polls(u).find((G)=>G.id===w)}return}get places(){return q.places(this.result)}static places(u){var D,B;return(B=(D=u.includes)===null||D===void 0?void 0:D.places)!==null&&B!==void 0?B:[]}place(u){return q.place(this.result,u)}static place(u,D){var B;let A=(B=D.geo)===null||B===void 0?void 0:B.place_id;return A?this.places(u).find((F)=>F.id===A):void 0}listOwner(u){return q.listOwner(this.result,u)}static listOwner(u,D){let B=D.owner_id;return B?this.users(u).find((A)=>A.id===B):void 0}spaceCreator(u){return q.spaceCreator(this.result,u)}static spaceCreator(u,D){let B=D.creator_id;return B?this.users(u).find((A)=>A.id===B):void 0}spaceHosts(u){return q.spaceHosts(this.result,u)}static spaceHosts(u,D){var B;let A=(B=D.host_ids)!==null&&B!==void 0?B:[];return this.users(u).filter((F)=>A.includes(F.id))}spaceSpeakers(u){return q.spaceSpeakers(this.result,u)}static spaceSpeakers(u,D){var B;let A=(B=D.speaker_ids)!==null&&B!==void 0?B:[];return this.users(u).filter((F)=>A.includes(F.id))}spaceInvitedUsers(u){return q.spaceInvitedUsers(this.result,u)}static spaceInvitedUsers(u,D){var B;let A=(B=D.invited_user_ids)!==null&&B!==void 0?B:[];return this.users(u).filter((F)=>A.includes(F.id))}}class V3 extends n8{updateIncludes(u){if(u.errors){if(!this._realData.errors)this._realData.errors=[];this._realData.errors=[...this._realData.errors,...u.errors]}if(!u.includes)return;if(!this._realData.includes)this._realData.includes={};let D=this._realData.includes;for(let[B,A]of Object.entries(u.includes)){if(!D[B])D[B]=[];D[B]=[...D[B],...A]}}assertUsable(){if(this.unusable)throw Error("Unable to use this paginator to fetch more data, as it does not contain any metadata. Check .errors property for more details.")}get meta(){return this._realData.meta}get includes(){var u;if(!((u=this._realData)===null||u===void 0?void 0:u.includes))return new q(this._realData);if(this._includesInstance)return this._includesInstance;return this._includesInstance=new q(this._realData)}get errors(){var u;return(u=this._realData.errors)!==null&&u!==void 0?u:[]}get unusable(){return this.errors.length>0&&!this._realData.meta&&!this._realData.data}}class _2 extends V3{refreshInstanceFromResult(u,D){var B;let A=u.data,F=(B=A.data)!==null&&B!==void 0?B:[];if(this._rateLimit=u.rateLimit,!this._realData.data)this._realData.data=[];if(D)this._realData.meta.result_count+=A.meta.result_count,this._realData.meta.next_token=A.meta.next_token,this._realData.data.push(...F);else this._realData.meta.result_count+=A.meta.result_count,this._realData.meta.previous_token=A.meta.previous_token,this._realData.data.unshift(...F);this.updateIncludes(A)}getNextQueryParams(u){return this.assertUsable(),{...this.injectQueryParams(u),pagination_token:this._realData.meta.next_token}}getPreviousQueryParams(u){return this.assertUsable(),{...this.injectQueryParams(u),pagination_token:this._realData.meta.previous_token}}getPageLengthFromRequest(u){var D,B;return(B=(D=u.data.data)===null||D===void 0?void 0:D.length)!==null&&B!==void 0?B:0}isFetchLastOver(u){var D;return!((D=u.data.data)===null||D===void 0?void 0:D.length)||!this.canFetchNextPage(u.data)}canFetchNextPage(u){var D;return!!((D=u.meta)===null||D===void 0?void 0:D.next_token)}}class R5 extends V3{refreshInstanceFromResult(u,D){var B;let A=u.data,F=(B=A.data)!==null&&B!==void 0?B:[];if(this._rateLimit=u.rateLimit,!this._realData.data)this._realData.data=[];if(D)this._realData.meta.oldest_id=A.meta.oldest_id,this._realData.meta.result_count+=A.meta.result_count,this._realData.meta.next_token=A.meta.next_token,this._realData.data.push(...F);else this._realData.meta.newest_id=A.meta.newest_id,this._realData.meta.result_count+=A.meta.result_count,this._realData.data.unshift(...F);this.updateIncludes(A)}getNextQueryParams(u){this.assertUsable();let D={...this.injectQueryParams(u)};if(this._realData.meta.next_token)D.next_token=this._realData.meta.next_token;else{if(D.start_time)D.since_id=this.dateStringToSnowflakeId(D.start_time),delete D.start_time;if(D.end_time)delete D.end_time;D.until_id=this._realData.meta.oldest_id}return D}getPreviousQueryParams(u){return this.assertUsable(),{...this.injectQueryParams(u),since_id:this._realData.meta.newest_id}}getPageLengthFromRequest(u){var D,B;return(B=(D=u.data.data)===null||D===void 0?void 0:D.length)!==null&&B!==void 0?B:0}isFetchLastOver(u){var D;return!((D=u.data.data)===null||D===void 0?void 0:D.length)||!this.canFetchNextPage(u.data)}canFetchNextPage(u){return!!u.meta.next_token}getItemArray(){return this.tweets}dateStringToSnowflakeId(u){let D=BigInt("1288834974657"),B=new Date(u);if(isNaN(B.valueOf()))throw Error("Unable to convert start_time/end_time to a valid date. A ISO 8601 DateTime is excepted, please check your input.");return(BigInt(B.valueOf())-D<<BigInt("22")).toString()}get tweets(){var u;return(u=this._realData.data)!==null&&u!==void 0?u:[]}get meta(){return super.meta}}class o0 extends _2{refreshInstanceFromResult(u,D){super.refreshInstanceFromResult(u,D);let B=u.data;if(D)this._realData.meta.oldest_id=B.meta.oldest_id;else this._realData.meta.newest_id=B.meta.newest_id}getItemArray(){return this.tweets}get tweets(){var u;return(u=this._realData.data)!==null&&u!==void 0?u:[]}get meta(){return super.meta}}class U5 extends R5{constructor(){super(...arguments);this._endpoint="tweets/search/recent"}}class M5 extends R5{constructor(){super(...arguments);this._endpoint="tweets/search/all"}}class L5 extends o0{constructor(){super(...arguments);this._endpoint="tweets/:id/quote_tweets"}}class E5 extends o0{constructor(){super(...arguments);this._endpoint="users/:id/timelines/reverse_chronological"}}class O5 extends o0{constructor(){super(...arguments);this._endpoint="users/:id/tweets"}}class C5 extends o0{constructor(){super(...arguments);this._endpoint="users/:id/mentions"}}class P5 extends o0{constructor(){super(...arguments);this._endpoint="users/:id/bookmarks"}}class c5 extends _2{get tweets(){var u;return(u=this._realData.data)!==null&&u!==void 0?u:[]}get meta(){return super.meta}getItemArray(){return this.tweets}}class V5 extends c5{constructor(){super(...arguments);this._endpoint="users/:id/liked_tweets"}}class k5 extends c5{constructor(){super(...arguments);this._endpoint="lists/:id/tweets"}}class j2 extends _2{getItemArray(){return this.users}get users(){var u;return(u=this._realData.data)!==null&&u!==void 0?u:[]}get meta(){return super.meta}}class y5 extends j2{constructor(){super(...arguments);this._endpoint="users/:id/blocking"}}class T5 extends j2{constructor(){super(...arguments);this._endpoint="users/:id/muting"}}class I5 extends j2{constructor(){super(...arguments);this._endpoint="users/:id/followers"}}class q5 extends j2{constructor(){super(...arguments);this._endpoint="users/:id/following"}}class m5 extends j2{constructor(){super(...arguments);this._endpoint="lists/:id/members"}}class _5 extends j2{constructor(){super(...arguments);this._endpoint="lists/:id/followers"}}class g5 extends j2{constructor(){super(...arguments);this._endpoint="tweets/:id/liking_users"}}class f5 extends j2{constructor(){super(...arguments);this._endpoint="tweets/:id/retweeted_by"}}class k3 extends _2{getItemArray(){return this.lists}get lists(){var u;return(u=this._realData.data)!==null&&u!==void 0?u:[]}get meta(){return super.meta}}class b5 extends k3{constructor(){super(...arguments);this._endpoint="users/:id/owned_lists"}}class j5 extends k3{constructor(){super(...arguments);this._endpoint="users/:id/list_memberships"}}class l5 extends k3{constructor(){super(...arguments);this._endpoint="users/:id/followed_lists"}}class e0 extends k2{constructor(){super(...arguments);this._prefix=d0}}class y3 extends _2{getItemArray(){return this.events}get events(){var u;return(u=this._realData.data)!==null&&u!==void 0?u:[]}get meta(){return super.meta}}class d5 extends y3{constructor(){super(...arguments);this._endpoint="dm_events"}}class i5 extends y3{constructor(){super(...arguments);this._endpoint="dm_conversations/with/:participant_id/dm_events"}}class r5 extends y3{constructor(){super(...arguments);this._endpoint="dm_conversations/:dm_conversation_id/dm_events"}}class uu extends k2{constructor(){super(...arguments);this._prefix=B0}get labs(){if(this._labs)return this._labs;return this._labs=new e0(this)}async search(u,D={}){let B=typeof u==="string"?{...D,query:u}:{...u},A=await this.get("tweets/search/recent",B,{fullResponse:!0});return new U5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:B})}async searchAll(u,D={}){let B={...D,query:u},A=await this.get("tweets/search/all",B,{fullResponse:!0});return new M5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:B})}singleTweet(u,D={}){return this.get("tweets/:id",D,{params:{id:u}})}tweets(u,D={}){return this.get("tweets",{ids:u,...D})}tweetCountRecent(u,D={}){return this.get("tweets/counts/recent",{query:u,...D})}tweetCountAll(u,D={}){return this.get("tweets/counts/all",{query:u,...D})}async tweetRetweetedBy(u,D={}){let{asPaginator:B,...A}=D,F=await this.get("tweets/:id/retweeted_by",A,{fullResponse:!0,params:{id:u}});if(!B)return F.data;return new f5({realData:F.data,rateLimit:F.rateLimit,instance:this,queryParams:A,sharedParams:{id:u}})}async tweetLikedBy(u,D={}){let{asPaginator:B,...A}=D,F=await this.get("tweets/:id/liking_users",A,{fullResponse:!0,params:{id:u}});if(!B)return F.data;return new g5({realData:F.data,rateLimit:F.rateLimit,instance:this,queryParams:A,sharedParams:{id:u}})}async homeTimeline(u={}){let D=await this.getCurrentUserV2Object(),B=await this.get("users/:id/timelines/reverse_chronological",u,{fullResponse:!0,params:{id:D.data.id}});return new E5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:u,sharedParams:{id:D.data.id}})}async userTimeline(u,D={}){let B=await this.get("users/:id/tweets",D,{fullResponse:!0,params:{id:u}});return new O5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D,sharedParams:{id:u}})}async userMentionTimeline(u,D={}){let B=await this.get("users/:id/mentions",D,{fullResponse:!0,params:{id:u}});return new C5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D,sharedParams:{id:u}})}async quotes(u,D={}){let B=await this.get("tweets/:id/quote_tweets",D,{fullResponse:!0,params:{id:u}});return new L5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D,sharedParams:{id:u}})}async bookmarks(u={}){let D=await this.getCurrentUserV2Object(),B=await this.get("users/:id/bookmarks",u,{fullResponse:!0,params:{id:D.data.id}});return new P5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:u,sharedParams:{id:D.data.id}})}me(u={}){return this.get("users/me",u)}user(u,D={}){return this.get("users/:id",D,{params:{id:u}})}users(u,D={}){let B=Array.isArray(u)?u.join(","):u;return this.get("users",{...D,ids:B})}userByUsername(u,D={}){return this.get("users/by/username/:username",D,{params:{username:u}})}usersByUsernames(u,D={}){return u=Array.isArray(u)?u.join(","):u,this.get("users/by",{...D,usernames:u})}async followers(u,D={}){let{asPaginator:B,...A}=D,F={id:u};if(!B)return this.get("users/:id/followers",A,{params:F});let w=await this.get("users/:id/followers",A,{fullResponse:!0,params:F});return new I5({realData:w.data,rateLimit:w.rateLimit,instance:this,queryParams:A,sharedParams:F})}async following(u,D={}){let{asPaginator:B,...A}=D,F={id:u};if(!B)return this.get("users/:id/following",A,{params:F});let w=await this.get("users/:id/following",A,{fullResponse:!0,params:F});return new q5({realData:w.data,rateLimit:w.rateLimit,instance:this,queryParams:A,sharedParams:F})}async userLikedTweets(u,D={}){let B={id:u},A=await this.get("users/:id/liked_tweets",D,{fullResponse:!0,params:B});return new V5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:{...D},sharedParams:B})}async userBlockingUsers(u,D={}){let B={id:u},A=await this.get("users/:id/blocking",D,{fullResponse:!0,params:B});return new y5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:{...D},sharedParams:B})}async userMutingUsers(u,D={}){let B={id:u},A=await this.get("users/:id/muting",D,{fullResponse:!0,params:B});return new T5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:{...D},sharedParams:B})}list(u,D={}){return this.get("lists/:id",D,{params:{id:u}})}async listsOwned(u,D={}){let B={id:u},A=await this.get("users/:id/owned_lists",D,{fullResponse:!0,params:B});return new b5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:{...D},sharedParams:B})}async listMemberships(u,D={}){let B={id:u},A=await this.get("users/:id/list_memberships",D,{fullResponse:!0,params:B});return new j5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:{...D},sharedParams:B})}async listFollowed(u,D={}){let B={id:u},A=await this.get("users/:id/followed_lists",D,{fullResponse:!0,params:B});return new l5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:{...D},sharedParams:B})}async listTweets(u,D={}){let B={id:u},A=await this.get("lists/:id/tweets",D,{fullResponse:!0,params:B});return new k5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:{...D},sharedParams:B})}async listMembers(u,D={}){let B={id:u},A=await this.get("lists/:id/members",D,{fullResponse:!0,params:B});return new m5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:{...D},sharedParams:B})}async listFollowers(u,D={}){let B={id:u},A=await this.get("lists/:id/followers",D,{fullResponse:!0,params:B});return new _5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:{...D},sharedParams:B})}async listDmEvents(u={}){let D=await this.get("dm_events",u,{fullResponse:!0});return new d5({realData:D.data,rateLimit:D.rateLimit,instance:this,queryParams:{...u}})}async listDmEventsWithParticipant(u,D={}){let B={participant_id:u},A=await this.get("dm_conversations/with/:participant_id/dm_events",D,{fullResponse:!0,params:B});return new i5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:{...D},sharedParams:B})}async listDmEventsOfConversation(u,D={}){let B={dm_conversation_id:u},A=await this.get("dm_conversations/:dm_conversation_id/dm_events",D,{fullResponse:!0,params:B});return new r5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:{...D},sharedParams:B})}space(u,D={}){return this.get("spaces/:id",D,{params:{id:u}})}spaces(u,D={}){return this.get("spaces",{ids:u,...D})}spacesByCreators(u,D={}){return this.get("spaces/by/creator_ids",{user_ids:u,...D})}searchSpaces(u){return this.get("spaces/search",u)}spaceBuyers(u,D={}){return this.get("spaces/:id/buyers",D,{params:{id:u}})}spaceTweets(u,D={}){return this.get("spaces/:id/tweets",D,{params:{id:u}})}searchStream({autoConnect:u,...D}={}){return this.getStream("tweets/search/stream",D,{payloadIsError:U3,autoConnect:u})}streamRules(u={}){return this.get("tweets/search/stream/rules",u)}updateStreamRules(u,D={}){return this.post("tweets/search/stream/rules",u,{query:D})}sampleStream({autoConnect:u,...D}={}){return this.getStream("tweets/sample/stream",D,{payloadIsError:U3,autoConnect:u})}sample10Stream({autoConnect:u,...D}={}){return this.getStream("tweets/sample10/stream",D,{payloadIsError:U3,autoConnect:u})}complianceJobs(u){return this.get("compliance/jobs",u)}complianceJob(u){return this.get("compliance/jobs/:id",void 0,{params:{id:u}})}async sendComplianceJob(u){let D=await this.post("compliance/jobs",{type:u.type,name:u.name}),B=u.ids instanceof Buffer?u.ids:Buffer.from(u.ids.join(`
66
+ `);Z.content=t2.encode(Y);break}default:Z.content=w.content}this.attachments.push(Z)}}else if(w.contentType.multipart==="alternative")G=w;else if(w.contentType.multipart==="related")N=w;for(let $ of w.childNodes)await F($,G,N)};await F(this.root,!1,!1),B.forEach((w)=>{D.forEach((G)=>{if(!u[G])u[G]=[];if(w[G])w[G].forEach((N)=>{switch(N.type){case"text":u[G].push(N.value);break;case"subMessage":switch(G){case"html":u[G].push(D8(N.value));break;case"plain":u[G].push(u8(N.value));break}break}});else{let N;switch(G){case"html":N="plain";break;case"plain":N="html";break}(w[N]||[]).forEach(($)=>{switch($.type){case"text":switch(G){case"html":u[G].push(jB($.value));break;case"plain":u[G].push(lB($.value));break}break;case"subMessage":switch(G){case"html":u[G].push(D8($.value));break;case"plain":u[G].push(u8($.value));break}break}})}})}),Object.keys(u).forEach((w)=>{u[w]=u[w].join(`
67
+ `)}),this.textContent=u}isInlineTextNode(u){if(u.contentDisposition?.parsed?.value==="attachment")return!1;switch(u.contentType.parsed?.value){case"text/html":case"text/plain":return!0;case"text/calendar":case"text/csv":default:return!1}}isInlineMessageRfc822(u){if(u.contentType.parsed?.value!=="message/rfc822")return!1;return(u.contentDisposition?.parsed?.value||(this.options.rfc822Attachments?"attachment":"inline"))==="inline"}forceRfc822Attachments(){if(this.options.forceRfc822Attachments)return!0;let u=!1,D=(B)=>{if(!B.contentType.multipart){if(B.contentType.parsed&&["message/delivery-status","message/feedback-report"].includes(B.contentType.parsed.value))u=!0}for(let A of B.childNodes)D(A)};return D(this.root),u}async resolveStream(u){let D=0,B=[],A=u.getReader();while(!0){let{done:G,value:N}=await A.read();if(G)break;B.push(N),D+=N.length}let F=new Uint8Array(D),w=0;for(let G of B)F.set(G,w),w+=G.length;return F}async parse(u){if(this.started)throw Error("Can not reuse parser, create a new PostalMime object");if(this.started=!0,u&&typeof u.getReader==="function")u=await this.resolveStream(u);if(u=u||new ArrayBuffer(0),typeof u==="string")u=t2.encode(u);if(u instanceof Blob||Object.prototype.toString.call(u)==="[object Blob]")u=await o2(u);if(u.buffer instanceof ArrayBuffer)u=new Uint8Array(u).buffer;this.buf=u,this.av=new Uint8Array(u),this.readPos=0;while(this.readPos<this.av.length){let A=this.readLine();await this.processLine(A.bytes,A.done)}await this.processNodeTree();let D={headers:this.root.headers.map((A)=>({key:A.key,originalKey:A.originalKey,value:A.value})).reverse()};for(let A of["from","sender"]){let F=this.root.headers.find((w)=>w.key===A);if(F&&F.value){let w=e1(F.value);if(w&&w.length)D[A]=w[0]}}for(let A of["delivered-to","return-path"]){let F=this.root.headers.find((w)=>w.key===A);if(F&&F.value){let w=e1(F.value);if(w&&w.length&&w[0].address){let G=A8(A);D[G]=w[0].address}}}for(let A of["to","cc","bcc","reply-to"]){let F=this.root.headers.filter((G)=>G.key===A),w=[];if(F.filter((G)=>G&&G.value).map((G)=>e1(G.value)).forEach((G)=>w=w.concat(G||[])),w&&w.length){let G=A8(A);D[G]=w}}for(let A of["subject","message-id","in-reply-to","references"]){let F=this.root.headers.find((w)=>w.key===A);if(F&&F.value){let w=A8(A);D[w]=Y0(F.value)}}let B=this.root.headers.find((A)=>A.key==="date");if(B){let A=new Date(B.value);if(A.toString()==="Invalid Date")A=B.value;else A=A.toISOString();D.date=A}if(this.textContent?.html)D.html=this.textContent.html;if(this.textContent?.plain)D.text=this.textContent.plain;switch(D.attachments=this.attachments,D.headerLines=(this.root.rawHeaderLines||[]).slice().reverse(),this.attachmentEncoding){case"arraybuffer":break;case"base64":for(let F of D.attachments||[])if(F?.content)F.content=nB(F.content),F.encoding="base64";break;case"utf8":let A=new TextDecoder("utf8");for(let F of D.attachments||[])if(F?.content)F.content=A.decode(F.content),F.encoding="utf8";break;default:throw Error("Unknown attachment encoding")}return D}}var Uv=W(vv(),1),uU="6.12.3";function A2(u){let D=new URLSearchParams;if(u.limit!==void 0)D.set("limit",u.limit.toString());if("after"in u&&u.after!==void 0)D.set("after",u.after);if("before"in u&&u.before!==void 0)D.set("before",u.before);return D.toString()}var DU=class{constructor(u){this.resend=u}async create(u,D={}){return await this.resend.post("/api-keys",u,D)}async list(u={}){let D=A2(u),B=D?`/api-keys?${D}`:"/api-keys";return await this.resend.get(B)}async remove(u){return await this.resend.delete(`/api-keys/${u}`)}},BU=class{constructor(u){this.resend=u}async get(u){return await this.resend.get(`/automations/${u.automationId}/runs/${u.runId}`)}async list(u){let D=A2(u),B=new URLSearchParams(D);if(u.status){let w=Array.isArray(u.status)?u.status.join(","):u.status;B.set("status",w)}let A=B.toString(),F=A?`/automations/${u.automationId}/runs?${A}`:`/automations/${u.automationId}/runs`;return await this.resend.get(F)}};function Mv(u){switch(u.type){case"trigger":return{key:u.key,type:u.type,config:{event_name:u.config.eventName}};case"delay":return{key:u.key,type:u.type,config:u.config};case"send_email":return{key:u.key,type:u.type,config:{template:u.config.template,subject:u.config.subject,from:u.config.from,reply_to:u.config.replyTo}};case"wait_for_event":return{key:u.key,type:u.type,config:{event_name:u.config.eventName,timeout:u.config.timeout,filter_rule:u.config.filterRule}};case"condition":return{key:u.key,type:u.type,config:u.config};case"contact_update":return{key:u.key,type:u.type,config:{first_name:u.config.firstName,last_name:u.config.lastName,unsubscribed:u.config.unsubscribed,properties:u.config.properties}};case"contact_delete":return{key:u.key,type:u.type,config:u.config};case"add_to_segment":return{key:u.key,type:u.type,config:{segment_id:u.config.segmentId}}}}function Lv(u){return{from:u.from,to:u.to,type:u.type}}function AU(u){return{name:u.name,status:u.status,steps:u.steps.map(Mv),connections:u.connections.map(Lv)}}function FU(u){return{event:u.event,contact_id:u.contactId,email:u.email,payload:u.payload}}var wU=class{constructor(u){this.resend=u,this.runs=new BU(this.resend)}async create(u){return await this.resend.post("/automations",AU(u))}async list(u={}){let D=[A2(u)];if(u.status)D.push(`status=${encodeURIComponent(u.status)}`);let B=D.filter(Boolean).join("&"),A=B?`/automations?${B}`:"/automations";return await this.resend.get(A)}async get(u){return await this.resend.get(`/automations/${u}`)}async remove(u){return await this.resend.delete(`/automations/${u}`)}async update(u,D){let B={};if(D.name!==void 0)B.name=D.name;if(D.status!==void 0)B.status=D.status;if(D.steps!==void 0)B.steps=D.steps.map(Mv);if(D.connections!==void 0)B.connections=D.connections.map(Lv);return await this.resend.patch(`/automations/${u}`,B)}async stop(u){return await this.resend.post(`/automations/${u}/stop`)}};function GU(u){return u?.map((D)=>({content:D.content,filename:D.filename,path:D.path,content_type:D.contentType,content_id:D.contentId}))}function Ev(u){return{attachments:GU(u.attachments),bcc:u.bcc,cc:u.cc,from:u.from,headers:u.headers,html:u.html,reply_to:u.replyTo,scheduled_at:u.scheduledAt,subject:u.subject,tags:u.tags,text:u.text,to:u.to,template:u.template?{id:u.template.id,variables:u.template.variables}:void 0,topic_id:u.topicId}}async function v3(u){let D;try{({render:D}=await import("@react-email/render"))}catch{throw Error("Failed to render React component. Make sure to install `@react-email/render` or `@react-email/components`.")}return D(u)}var NU=class{constructor(u){this.resend=u}async send(u,D){return this.create(u,D)}async create(u,D){let B=[];for(let A of u){if(A.react)A.html=await v3(A.react),A.react=void 0;B.push(Ev(A))}return await this.resend.post("/emails/batch",B,{...D,headers:{"x-batch-validation":D?.batchValidation??"strict",...D?.headers}})}},$U=class{constructor(u){this.resend=u}async create(u,D={}){if(u.react)u.html=await v3(u.react);return await this.resend.post("/broadcasts",{name:u.name,segment_id:u.segmentId,audience_id:u.audienceId,preview_text:u.previewText,from:u.from,html:u.html,reply_to:u.replyTo,subject:u.subject,text:u.text,topic_id:u.topicId,send:u.send,scheduled_at:u.scheduledAt},D)}async send(u,D){return await this.resend.post(`/broadcasts/${u}/send`,{scheduled_at:D?.scheduledAt})}async list(u={}){let D=A2(u),B=D?`/broadcasts?${D}`:"/broadcasts";return await this.resend.get(B)}async get(u){return await this.resend.get(`/broadcasts/${u}`)}async remove(u){return await this.resend.delete(`/broadcasts/${u}`)}async update(u,D){if(D.react)D.html=await v3(D.react);return await this.resend.patch(`/broadcasts/${u}`,{name:D.name,segment_id:D.segmentId,audience_id:D.audienceId,from:D.from,html:D.html,text:D.text,subject:D.subject,reply_to:D.replyTo,preview_text:D.previewText,topic_id:D.topicId})}};function Kv(u){return{id:u.id,key:u.key,createdAt:u.created_at,type:u.type,fallbackValue:u.fallback_value}}function hv(u){if("key"in u)return{key:u.key,type:u.type,fallback_value:u.fallbackValue};return{fallback_value:u.fallbackValue}}var zU=class{constructor(u){this.resend=u}async create(u){let D=hv(u);return await this.resend.post("/contact-properties",D)}async list(u={}){let D=A2(u),B=D?`/contact-properties?${D}`:"/contact-properties",A=await this.resend.get(B);if(A.data)return{data:{...A.data,data:A.data.data.map((F)=>Kv(F))},headers:A.headers,error:null};return A}async get(u){if(!u)return{data:null,headers:null,error:{message:"Missing `id` field.",statusCode:null,name:"missing_required_field"}};let D=await this.resend.get(`/contact-properties/${u}`);if(D.data)return{data:{object:"contact_property",...Kv(D.data)},headers:D.headers,error:null};return D}async update(u){if(!u.id)return{data:null,headers:null,error:{message:"Missing `id` field.",statusCode:null,name:"missing_required_field"}};let D=hv(u);return await this.resend.patch(`/contact-properties/${u.id}`,D)}async remove(u){if(!u)return{data:null,headers:null,error:{message:"Missing `id` field.",statusCode:null,name:"missing_required_field"}};return await this.resend.delete(`/contact-properties/${u}`)}},ZU=class{constructor(u){this.resend=u}async list(u){if(!u.contactId&&!u.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};let D=u.email?u.email:u.contactId,B=A2(u),A=B?`/contacts/${D}/segments?${B}`:`/contacts/${D}/segments`;return await this.resend.get(A)}async add(u){if(!u.contactId&&!u.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};let D=u.email?u.email:u.contactId;return this.resend.post(`/contacts/${D}/segments/${u.segmentId}`)}async remove(u){if(!u.contactId&&!u.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};let D=u.email?u.email:u.contactId;return this.resend.delete(`/contacts/${D}/segments/${u.segmentId}`)}},JU=class{constructor(u){this.resend=u}async update(u){if(!u.id&&!u.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};let D=u.email?u.email:u.id;return this.resend.patch(`/contacts/${D}/topics`,u.topics)}async list(u){if(!u.id&&!u.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};let D=u.email?u.email:u.id,B=A2(u),A=B?`/contacts/${D}/topics?${B}`:`/contacts/${D}/topics`;return this.resend.get(A)}},QU=class{constructor(u){this.resend=u,this.topics=new JU(this.resend),this.segments=new ZU(this.resend)}async create(u,D={}){if("audienceId"in u){if("segments"in u||"topics"in u)return{data:null,headers:null,error:{message:"`audienceId` is deprecated, and cannot be used together with `segments` or `topics`. Use `segments` instead to add one or more segments to the new contact.",statusCode:null,name:"invalid_parameter"}};return await this.resend.post(`/audiences/${u.audienceId}/contacts`,{unsubscribed:u.unsubscribed,email:u.email,first_name:u.firstName,last_name:u.lastName,properties:u.properties},D)}return await this.resend.post("/contacts",{unsubscribed:u.unsubscribed,email:u.email,first_name:u.firstName,last_name:u.lastName,properties:u.properties,segments:u.segments,topics:u.topics},D)}async list(u={}){let D=u.segmentId??u.audienceId;if(!D){let F=A2(u),w=F?`/contacts?${F}`:"/contacts";return await this.resend.get(w)}let B=A2(u),A=B?`/segments/${D}/contacts?${B}`:`/segments/${D}/contacts`;return await this.resend.get(A)}async get(u){if(typeof u==="string")return this.resend.get(`/contacts/${u}`);if(!u.id&&!u.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};if(!u.audienceId)return this.resend.get(`/contacts/${u?.email?u?.email:u?.id}`);return this.resend.get(`/audiences/${u.audienceId}/contacts/${u?.email?u?.email:u?.id}`)}async update(u){if(!u.id&&!u.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};if(!u.audienceId)return await this.resend.patch(`/contacts/${u?.email?u?.email:u?.id}`,{unsubscribed:u.unsubscribed,first_name:u.firstName,last_name:u.lastName,properties:u.properties});return await this.resend.patch(`/audiences/${u.audienceId}/contacts/${u?.email?u?.email:u?.id}`,{unsubscribed:u.unsubscribed,first_name:u.firstName,last_name:u.lastName,properties:u.properties})}async remove(u){if(typeof u==="string")return this.resend.delete(`/contacts/${u}`);if(!u.id&&!u.email)return{data:null,headers:null,error:{message:"Missing `id` or `email` field.",statusCode:null,name:"missing_required_field"}};if(!u.audienceId)return this.resend.delete(`/contacts/${u?.email?u?.email:u?.id}`);return this.resend.delete(`/audiences/${u.audienceId}/contacts/${u?.email?u?.email:u?.id}`)}};function YU(u){return{name:u.name,region:u.region,custom_return_path:u.customReturnPath,capabilities:u.capabilities,open_tracking:u.openTracking,click_tracking:u.clickTracking,tls:u.tls,tracking_subdomain:u.trackingSubdomain}}var XU=class{constructor(u){this.resend=u}async create(u,D={}){return await this.resend.post("/domains",YU(u),D)}async list(u={}){let D=A2(u),B=D?`/domains?${D}`:"/domains";return await this.resend.get(B)}async get(u){return await this.resend.get(`/domains/${u}`)}async update(u){return await this.resend.patch(`/domains/${u.id}`,{click_tracking:u.clickTracking,open_tracking:u.openTracking,tls:u.tls,capabilities:u.capabilities,tracking_subdomain:u.trackingSubdomain})}async remove(u){return await this.resend.delete(`/domains/${u}`)}async verify(u){return await this.resend.post(`/domains/${u}/verify`)}},WU=class{constructor(u){this.resend=u}async get(u){let{emailId:D,id:B}=u;return await this.resend.get(`/emails/${D}/attachments/${B}`)}async list(u){let{emailId:D}=u,B=A2(u),A=B?`/emails/${D}/attachments?${B}`:`/emails/${D}/attachments`;return await this.resend.get(A)}},vU=class{constructor(u){this.resend=u}async get(u){let{emailId:D,id:B}=u;return await this.resend.get(`/emails/receiving/${D}/attachments/${B}`)}async list(u){let{emailId:D}=u,B=A2(u),A=B?`/emails/receiving/${D}/attachments?${B}`:`/emails/receiving/${D}/attachments`;return await this.resend.get(A)}},KU=class{constructor(u){this.resend=u,this.attachments=new vU(u)}async get(u){return await this.resend.get(`/emails/receiving/${u}`)}async list(u={}){let D=A2(u),B=D?`/emails/receiving?${D}`:"/emails/receiving";return await this.resend.get(B)}async forward(u){let{emailId:D,to:B,from:A}=u,F=u.passthrough!==!1,w=await this.get(D);if(w.error)return{data:null,error:w.error,headers:w.headers};let G=w.data,N=G.subject||"(no subject)";if(F)return this.forwardPassthrough(G,{to:B,from:A,subject:N});let $=N.startsWith("Fwd:")?N:`Fwd: ${N}`;return this.forwardWrapped(G,{to:B,from:A,subject:$,text:"text"in u?u.text:void 0,html:"html"in u?u.html:void 0})}async forwardPassthrough(u,D){let{to:B,from:A,subject:F}=D;if(!u.raw?.download_url)return{data:null,error:{name:"validation_error",message:"Raw email content is not available for this email",statusCode:400},headers:null};let w=await fetch(u.raw.download_url);if(!w.ok)return{data:null,error:{name:"application_error",message:"Failed to download raw email content",statusCode:w.status},headers:null};let G=await w.text(),N=await I0.parse(G,{attachmentEncoding:"base64"}),$=N.attachments.map((Z)=>{let Y=Z.contentId?Z.contentId.replace(/^<|>$/g,""):void 0;return{filename:Z.filename,content:Z.content.toString(),content_type:Z.mimeType,content_id:Y||void 0}});return await this.resend.post("/emails",{from:A,to:B,subject:F,text:N.text||void 0,html:N.html||void 0,attachments:$.length>0?$:void 0})}async forwardWrapped(u,D){let{to:B,from:A,subject:F,text:w,html:G}=D;if(!u.raw?.download_url)return{data:null,error:{name:"validation_error",message:"Raw email content is not available for this email",statusCode:400},headers:null};let N=await fetch(u.raw.download_url);if(!N.ok)return{data:null,error:{name:"application_error",message:"Failed to download raw email content",statusCode:N.status},headers:null};let $=await N.text();return await this.resend.post("/emails",{from:A,to:B,subject:F,text:w,html:G,attachments:[{filename:"forwarded_message.eml",content:Buffer.from($).toString("base64"),content_type:"message/rfc822"}]})}},hU=class{constructor(u){this.resend=u,this.attachments=new WU(u),this.receiving=new KU(u)}async send(u,D={}){return this.create(u,D)}async create(u,D={}){if(u.react)u.html=await v3(u.react);return await this.resend.post("/emails",Ev(u),D)}async get(u){return await this.resend.get(`/emails/${u}`)}async list(u={}){let D=A2(u),B=D?`/emails?${D}`:"/emails";return await this.resend.get(B)}async update(u){return await this.resend.patch(`/emails/${u.id}`,{scheduled_at:u.scheduledAt})}async cancel(u){return await this.resend.post(`/emails/${u}/cancel`)}},xU=class{constructor(u){this.resend=u}async send(u){return await this.resend.post("/events/send",FU(u))}async create(u){return await this.resend.post("/events",u)}async get(u){return await this.resend.get(`/events/${encodeURIComponent(u)}`)}async list(u={}){let D=A2(u),B=D?`/events?${D}`:"/events";return await this.resend.get(B)}async update(u,D){return await this.resend.patch(`/events/${encodeURIComponent(u)}`,D)}async remove(u){return await this.resend.delete(`/events/${encodeURIComponent(u)}`)}},HU=class{constructor(u){this.resend=u}async list(u={}){let D=A2(u),B=D?`/logs?${D}`:"/logs";return await this.resend.get(B)}async get(u){return await this.resend.get(`/logs/${u}`)}},SU=class{constructor(u){this.resend=u}async create(u,D={}){return await this.resend.post("/segments",u,D)}async list(u={}){let D=A2(u),B=D?`/segments?${D}`:"/segments";return await this.resend.get(B)}async get(u){return await this.resend.get(`/segments/${u}`)}async remove(u){return await this.resend.delete(`/segments/${u}`)}};function RU(u={}){let D=new URLSearchParams;if(u.before)D.set("before",u.before);if(u.after)D.set("after",u.after);if(u.limit)D.set("limit",u.limit.toString());return D.size>0?`?${D.toString()}`:""}function UU(u){return u?.map((D)=>({key:D.key,type:D.type,fallback_value:D.fallbackValue}))}function xv(u){return{name:"name"in u?u.name:void 0,subject:u.subject,html:u.html,text:u.text,alias:u.alias,from:u.from,reply_to:u.replyTo,variables:UU(u.variables)}}var Hv=class{constructor(u,D){this.promise=u,this.publishFn=D}then(u,D){return this.promise.then(u,D)}async publish(){let{data:u,error:D}=await this.promise;if(D)return{data:null,headers:null,error:D};return this.publishFn(u.id)}},MU=class{constructor(u){this.resend=u}create(u){return new Hv(this.performCreate(u),this.publish.bind(this))}async performCreate(u){if(u.react){if(!this.renderAsync)try{let{renderAsync:D}=await import("@react-email/render");this.renderAsync=D}catch{throw Error("Failed to render React component. Make sure to install `@react-email/render`")}u.html=await this.renderAsync(u.react)}return this.resend.post("/templates",xv(u))}async remove(u){return await this.resend.delete(`/templates/${u}`)}async get(u){return await this.resend.get(`/templates/${u}`)}async list(u={}){return this.resend.get(`/templates${RU(u)}`)}duplicate(u){return new Hv(this.resend.post(`/templates/${u}/duplicate`),this.publish.bind(this))}async publish(u){return await this.resend.post(`/templates/${u}/publish`)}async update(u,D){return await this.resend.patch(`/templates/${u}`,xv(D))}},LU=class{constructor(u){this.resend=u}async create(u){let{defaultSubscription:D,...B}=u;return await this.resend.post("/topics",{...B,default_subscription:D})}async list(){return await this.resend.get("/topics")}async get(u){if(!u)return{data:null,headers:null,error:{message:"Missing `id` field.",statusCode:null,name:"missing_required_field"}};return await this.resend.get(`/topics/${u}`)}async update(u){if(!u.id)return{data:null,headers:null,error:{message:"Missing `id` field.",statusCode:null,name:"missing_required_field"}};return await this.resend.patch(`/topics/${u.id}`,u)}async remove(u){if(!u)return{data:null,headers:null,error:{message:"Missing `id` field.",statusCode:null,name:"missing_required_field"}};return await this.resend.delete(`/topics/${u}`)}},EU=class{constructor(u){this.resend=u}async create(u,D={}){return await this.resend.post("/webhooks",u,D)}async get(u){return await this.resend.get(`/webhooks/${u}`)}async list(u={}){let D=A2(u),B=D?`/webhooks?${D}`:"/webhooks";return await this.resend.get(B)}async update(u,D){return await this.resend.patch(`/webhooks/${u}`,D)}async remove(u){return await this.resend.delete(`/webhooks/${u}`)}verify(u){return new Uv.Webhook(u.webhookSecret).verify(u.payload,{"svix-id":u.headers.id,"svix-timestamp":u.headers.timestamp,"svix-signature":u.headers.signature})}},Sv="https://api.resend.com",Rv=`resend-node:${uU}`,OU=typeof process<"u"&&process.env?process.env.RESEND_BASE_URL||Sv:Sv,CU=typeof process<"u"&&process.env?process.env.RESEND_USER_AGENT||Rv:Rv,Ov=class{constructor(u){if(this.key=u,this.segments=new SU(this),this.apiKeys=new DU(this),this.audiences=this.segments,this.automations=new wU(this),this.batch=new NU(this),this.broadcasts=new $U(this),this.contactProperties=new zU(this),this.contacts=new QU(this),this.domains=new XU(this),this.emails=new hU(this),this.events=new xU(this),this.logs=new HU(this),this.templates=new MU(this),this.topics=new LU(this),this.webhooks=new EU(this),!u){if(typeof process<"u"&&process.env)this.key=process.env.RESEND_API_KEY;if(!this.key)throw Error('Missing API key. Pass it to the constructor `new Resend("re_123")`')}this.headers=new Headers({Authorization:`Bearer ${this.key}`,"User-Agent":CU,"Content-Type":"application/json"})}async fetchRequest(u,D={}){try{let B=await fetch(`${OU}${u}`,D);if(!B.ok)try{let A=await B.text();return{data:null,error:JSON.parse(A),headers:Object.fromEntries(B.headers.entries())}}catch(A){if(A instanceof SyntaxError)return{data:null,error:{name:"application_error",statusCode:B.status,message:"Internal server error. We are unable to process your request right now, please try again later."},headers:Object.fromEntries(B.headers.entries())};let F={message:B.statusText,statusCode:B.status,name:"application_error"};if(A instanceof Error)return{data:null,error:{...F,message:A.message},headers:Object.fromEntries(B.headers.entries())};return{data:null,error:F,headers:Object.fromEntries(B.headers.entries())}}return{data:await B.json(),error:null,headers:Object.fromEntries(B.headers.entries())}}catch{return{data:null,error:{name:"application_error",statusCode:null,message:"Unable to fetch data. The request could not be resolved."},headers:null}}}async post(u,D,B={}){let A=new Headers(this.headers);if(B.headers)for(let[w,G]of new Headers(B.headers).entries())A.set(w,G);if(B.idempotencyKey)A.set("Idempotency-Key",B.idempotencyKey);let F={method:"POST",body:JSON.stringify(D),...B,headers:A};return this.fetchRequest(u,F)}async get(u,D={}){let B=new Headers(this.headers);if(D.headers)for(let[F,w]of new Headers(D.headers).entries())B.set(F,w);let A={method:"GET",...D,headers:B};return this.fetchRequest(u,A)}async put(u,D,B={}){let A=new Headers(this.headers);if(B.headers)for(let[w,G]of new Headers(B.headers).entries())A.set(w,G);let F={method:"PUT",body:JSON.stringify(D),...B,headers:A};return this.fetchRequest(u,F)}async patch(u,D,B={}){let A=new Headers(this.headers);if(B.headers)for(let[w,G]of new Headers(B.headers).entries())A.set(w,G);let F={method:"PATCH",body:JSON.stringify(D),...B,headers:A};return this.fetchRequest(u,F)}async delete(u,D){let B={method:"DELETE",body:JSON.stringify(D),headers:this.headers};return this.fetchRequest(u,B)}};class K3{}class h3 extends K3{apiKey;constructor(u=process.env.RESEND_API_KEY){super();this.apiKey=u}async send(u){let D=new Ov(this.apiKey),{data:B,error:A}=await D.emails.send({...u});if(A)return console.error(A),!1;if(B)return!0;return!1}}class Cv extends f{driver=new h3;headers={};boot(){}filterRecipients(u){return u}}class Pv extends f{channels={};boot(){}}class cv extends f{root;rootRouter;partialRendering=!0;boot(){}onRequestStart(u){}onRequestEnd(u){}onRequestFail(u,D){}}class Vv extends f{rootRouter;boot(){}onRequestStart(u){}onRequestEnd(u){}onRequestFail(u,D){}}class kv extends f{maxFileSize=10485760;boot(){}onLogFileClosed(u){}onLogCreated(u){}}class yv extends f{jobs=[];concurrency=1;boot(){}}class Iv{static name="unset";worker=!1;maxAttempts=3;run(...u){}onFail(u,...D){}onSuccess(u,...D){}onDeadletter(u,...D){}static dispatch(...u){if(this.name==="unset")throw Error("Cannot dispatch a job with no name");Tv.use().push(this,JSON.stringify(u))}}import PU from"sharp";class x3{}class H3 extends x3{async resize(u,D){let{height:B,width:A,quality:F,fit:w}=D;return await PU(u).resize(A>0?A:void 0,B>0?B:void 0,{fit:w}).webp({quality:F>0?F:80,force:!0}).toBuffer()}}class qv extends f{driver=new H3;boot(){}}class l0{}var cU={clientId:process.env.GOOGLE_CLIENT_ID,clientSecret:process.env.GOOGLE_CLIENT_SECRET,redirectPath:"/auth/oauth/google/callback",scope:"https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email"};class _v extends l0{config;constructor(u={}){super();this.config={...cU,...u}}getRedirectUrl(){let u=this.config.scope,D=this.config.clientId,B=new URL("https://accounts.google.com/o/oauth2/v2/auth"),A={scope:u,include_granted_scopes:"true",response_type:"code",state:"state_parameter_passthrough_value",redirect_uri:`${process.env.HOST_NAME}/auth/oauth/google/callback`,client_id:D};for(let[w,G]of Object.entries(A))B.searchParams.append(w,G);return B.toString()}async onCallback(u){let D=new URL("https://oauth2.googleapis.com/token");D.searchParams.append("code",u.search.get("code")),D.searchParams.append("client_id",this.config.clientId),D.searchParams.append("client_secret",this.config.clientSecret),D.searchParams.append("grant_type","authorization_code"),D.searchParams.append("redirect_uri",`${process.env.HOST_NAME}${this.config.redirectPath}`);let B=await fetch(D.toString(),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"}}),{access_token:A}=await B.json(),w=await(await fetch(`https://www.googleapis.com/oauth2/v3/userinfo?access_token=${A}`)).json();if(!w.email)console.error("Google OAuth error: email not found in user info response",w);return{name:w.name,email:w.email}}}var B0="https://api.x.com/2/",d0="https://api.x.com/labs/2/",A0="https://api.x.com/1.1/",b2="https://upload.x.com/1.1/",mv="https://stream.x.com/1.1/",i0="https://ads-api.x.com/12/",r0="https://ads-api-sandbox.twitter.com/12/";class r8{constructor({realData:u,rateLimit:D,instance:B,queryParams:A,sharedParams:F}){this._maxResultsWhenFetchLast=100,this._realData=u,this._rateLimit=D,this._instance=B,this._queryParams=A,this._sharedParams=F}get _isRateLimitOk(){if(!this._rateLimit)return!0;if(this._rateLimit.reset*1000<Date.now())return!0;return this._rateLimit.remaining>0}makeRequest(u){return this._instance.get(this.getEndpoint(),u,{fullResponse:!0,params:this._sharedParams})}makeNewInstanceFromResult(u,D){return new this.constructor({realData:u.data,rateLimit:u.rateLimit,instance:this._instance,queryParams:D,sharedParams:this._sharedParams})}getEndpoint(){return this._endpoint}injectQueryParams(u){return{...u?{max_results:u}:{},...this._queryParams}}async next(u){let D=this.getNextQueryParams(u),B=await this.makeRequest(D);return this.makeNewInstanceFromResult(B,D)}async fetchNext(u){let D=this.getNextQueryParams(u),B=await this.makeRequest(D);return await this.refreshInstanceFromResult(B,!0),this}async fetchLast(u=1/0){let D=this.getNextQueryParams(this._maxResultsWhenFetchLast),B=0;while(B<u&&this._isRateLimitOk){let A=await this.makeRequest(D);if(await this.refreshInstanceFromResult(A,!0),B+=this.getPageLengthFromRequest(A),this.isFetchLastOver(A))break;D=this.getNextQueryParams(this._maxResultsWhenFetchLast)}return this}get rateLimit(){var u;return{...(u=this._rateLimit)!==null&&u!==void 0?u:{}}}get data(){return this._realData}get done(){return!this.canFetchNextPage(this._realData)}*[Symbol.iterator](){yield*this.getItemArray()}async*[Symbol.asyncIterator](){yield*this.getItemArray();let u=this,D=this.canFetchNextPage(this._realData);while(D&&this._isRateLimitOk&&u.getItemArray().length>0){let B=await u.next(this._maxResultsWhenFetchLast);this.refreshInstanceFromResult({data:B._realData,headers:{},rateLimit:B._rateLimit},!0),D=this.canFetchNextPage(B._realData),yield*B.getItemArray(),u=B}}async*fetchAndIterate(){for(let B of this.getItemArray())yield[B,this];let u=this,D=this.canFetchNextPage(this._realData);while(D&&this._isRateLimitOk&&u.getItemArray().length>0){let B=await u.next(this._maxResultsWhenFetchLast);this.refreshInstanceFromResult({data:B._realData,headers:{},rateLimit:B._rateLimit},!0),D=this.canFetchNextPage(B._realData);for(let A of B.getItemArray())yield[A,B];this._rateLimit=B._rateLimit,u=B}}}class n8 extends r8{async previous(u){let D=this.getPreviousQueryParams(u),B=await this.makeRequest(D);return this.makeNewInstanceFromResult(B,D)}async fetchPrevious(u){let D=this.getPreviousQueryParams(u),B=await this.makeRequest(D);return await this.refreshInstanceFromResult(B,!1),this}}var n0=r8;class F2 extends n0{getNextQueryParams(u){var D;return{...this._queryParams,cursor:(D=this._realData.next_cursor_str)!==null&&D!==void 0?D:this._realData.next_cursor,...u?{count:u}:{}}}isFetchLastOver(u){return!this.canFetchNextPage(u.data)}canFetchNextPage(u){return!this.isNextCursorInvalid(u.next_cursor)||!this.isNextCursorInvalid(u.next_cursor_str)}isNextCursorInvalid(u){return u===void 0||u===0||u===-1||u==="0"||u==="-1"}}class p8 extends F2{constructor(){super(...arguments);this._endpoint="direct_messages/events/list.json"}refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.events.push(...B.events),this._realData.next_cursor=B.next_cursor}getPageLengthFromRequest(u){return u.data.events.length}getItemArray(){return this.events}get events(){return this._realData.events}}class a8 extends F2{constructor(){super(...arguments);this._endpoint="direct_messages/welcome_messages/list.json"}refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.welcome_messages.push(...B.welcome_messages),this._realData.next_cursor=B.next_cursor}getPageLengthFromRequest(u){return u.data.welcome_messages.length}getItemArray(){return this.welcomeMessages}get welcomeMessages(){return this._realData.welcome_messages}}var _;(function(u){u.Jpeg="image/jpeg",u.Mp4="video/mp4",u.Mov="video/quicktime",u.Gif="image/gif",u.Png="image/png",u.Srt="text/plain",u.Webp="image/webp"})(_||(_={}));var F0;(function(u){u.Create="message_create",u.WelcomeCreate="welcome_message"})(F0||(F0={}));var ku;(function(u){u.Request="request",u.PartialResponse="partial-response",u.Response="response"})(ku||(ku={}));class S3 extends Error{constructor(){super(...arguments);this.error=!0}}class yu extends S3{constructor(u,D){super(u);this.type=ku.Request,Error.captureStackTrace(this,this.constructor),Object.defineProperty(this,"_options",{value:D})}get request(){return this._options.request}get requestError(){return this._options.requestError}toJSON(){return{type:this.type,error:this.requestError}}}class Tu extends S3{constructor(u,D){super(u);this.type=ku.PartialResponse,Error.captureStackTrace(this,this.constructor),Object.defineProperty(this,"_options",{value:D})}get request(){return this._options.request}get response(){return this._options.response}get responseError(){return this._options.responseError}get rawContent(){return this._options.rawContent}toJSON(){return{type:this.type,error:this.responseError}}}class Iu extends S3{constructor(u,D){super(u);if(this.type=ku.Response,Error.captureStackTrace(this,this.constructor),Object.defineProperty(this,"_options",{value:D}),this.code=D.code,this.headers=D.headers,this.rateLimit=D.rateLimit,D.data&&typeof D.data==="object"&&"error"in D.data&&!D.data.errors){let B={...D.data};B.errors=[{code:W0.InternalError,message:B.error}],this.data=B}else this.data=D.data}get request(){return this._options.request}get response(){return this._options.response}hasErrorCode(...u){let D=this.errors;if(!(D===null||D===void 0?void 0:D.length))return!1;if("code"in D[0])return D.some((F)=>u.includes(F.code));let B=this.data;return u.includes(B.type)}get errors(){var u;return(u=this.data)===null||u===void 0?void 0:u.errors}get rateLimitError(){return this.code===420||this.code===429}get isAuthError(){if(this.code===401)return!0;return this.hasErrorCode(W0.AuthTimestampInvalid,W0.AuthenticationFail,W0.BadAuthenticationData,W0.InvalidOrExpiredToken)}toJSON(){return{type:this.type,code:this.code,error:this.data,rateLimit:this.rateLimit,headers:this.headers}}}var W0;(function(u){u[u.InvalidCoordinates=3]="InvalidCoordinates",u[u.NoLocationFound=13]="NoLocationFound",u[u.AuthenticationFail=32]="AuthenticationFail",u[u.InvalidOrExpiredToken=89]="InvalidOrExpiredToken",u[u.UnableToVerifyCredentials=99]="UnableToVerifyCredentials",u[u.AuthTimestampInvalid=135]="AuthTimestampInvalid",u[u.BadAuthenticationData=215]="BadAuthenticationData",u[u.NoUserMatch=17]="NoUserMatch",u[u.UserNotFound=50]="UserNotFound",u[u.ResourceNotFound=34]="ResourceNotFound",u[u.TweetNotFound=144]="TweetNotFound",u[u.TweetNotVisible=179]="TweetNotVisible",u[u.NotAllowedResource=220]="NotAllowedResource",u[u.MediaIdNotFound=325]="MediaIdNotFound",u[u.TweetNoLongerAvailable=421]="TweetNoLongerAvailable",u[u.TweetViolatedRules=422]="TweetViolatedRules",u[u.TargetUserSuspended=63]="TargetUserSuspended",u[u.YouAreSuspended=64]="YouAreSuspended",u[u.AccountUpdateFailed=120]="AccountUpdateFailed",u[u.NoSelfSpamReport=36]="NoSelfSpamReport",u[u.NoSelfMute=271]="NoSelfMute",u[u.AccountLocked=326]="AccountLocked",u[u.RateLimitExceeded=88]="RateLimitExceeded",u[u.NoDMRightForApp=93]="NoDMRightForApp",u[u.OverCapacity=130]="OverCapacity",u[u.InternalError=131]="InternalError",u[u.TooManyFollowings=161]="TooManyFollowings",u[u.TweetLimitExceeded=185]="TweetLimitExceeded",u[u.DuplicatedTweet=187]="DuplicatedTweet",u[u.TooManySpamReports=205]="TooManySpamReports",u[u.RequestLooksLikeSpam=226]="RequestLooksLikeSpam",u[u.NoWriteRightForApp=261]="NoWriteRightForApp",u[u.TweetActionsDisabled=425]="TweetActionsDisabled",u[u.TweetRepliesRestricted=433]="TweetRepliesRestricted",u[u.NamedParameterMissing=38]="NamedParameterMissing",u[u.InvalidAttachmentUrl=44]="InvalidAttachmentUrl",u[u.TweetTextTooLong=186]="TweetTextTooLong",u[u.MissingUrlParameter=195]="MissingUrlParameter",u[u.NoMultipleGifs=323]="NoMultipleGifs",u[u.InvalidMediaIds=324]="InvalidMediaIds",u[u.InvalidUrl=407]="InvalidUrl",u[u.TooManyTweetAttachments=386]="TooManyTweetAttachments",u[u.StatusAlreadyFavorited=139]="StatusAlreadyFavorited",u[u.FollowRequestAlreadySent=160]="FollowRequestAlreadySent",u[u.CannotUnmuteANonMutedAccount=272]="CannotUnmuteANonMutedAccount",u[u.TweetAlreadyRetweeted=327]="TweetAlreadyRetweeted",u[u.ReplyToDeletedTweet=385]="ReplyToDeletedTweet",u[u.DMReceiverNotFollowingYou=150]="DMReceiverNotFollowingYou",u[u.UnableToSendDM=151]="UnableToSendDM",u[u.MustAllowDMFromAnyone=214]="MustAllowDMFromAnyone",u[u.CannotSendDMToThisUser=349]="CannotSendDMToThisUser",u[u.DMTextTooLong=354]="DMTextTooLong",u[u.SubscriptionAlreadyExists=355]="SubscriptionAlreadyExists",u[u.CallbackUrlNotApproved=415]="CallbackUrlNotApproved",u[u.SuspendedApplication=416]="SuspendedApplication",u[u.OobOauthIsNotAllowed=417]="OobOauthIsNotAllowed"})(W0||(W0={}));var gv;(function(u){u.InvalidRequest="https://developer.x.com/en/support/x-api/error-troubleshooting#invalid-request",u.ClientForbidden="https://developer.x.com/en/support/x-api/error-troubleshooting#client-forbidden",u.UnsupportedAuthentication="https://developer.x.com/en/support/x-api/error-troubleshooting#unsupported-authentication",u.InvalidRules="https://developer.x.com/en/support/x-api/error-troubleshooting#invalid-rules",u.TooManyRules="https://developer.x.com/en/support/x-api/error-troubleshooting#rule-cap",u.DuplicatedRules="https://developer.x.com/en/support/x-api/error-troubleshooting#duplicate-rules",u.RateLimitExceeded="https://developer.x.com/en/support/x-api/error-troubleshooting#usage-capped",u.ConnectionError="https://developer.x.com/en/support/x-api/error-troubleshooting#streaming-connection",u.ClientDisconnected="https://developer.x.com/en/support/x-api/error-troubleshooting#client-disconnected",u.TwitterDisconnectedYou="https://developer.x.com/en/support/x-api/error-troubleshooting#operational-disconnect",u.ResourceNotFound="https://developer.x.com/en/support/x-api/error-troubleshooting#resource-not-found",u.ResourceUnauthorized="https://developer.x.com/en/support/x-api/error-troubleshooting#not-authorized-for-resource",u.DisallowedResource="https://developer.x.com/en/support/x-api/error-troubleshooting#disallowed-resource"})(gv||(gv={}));var M;(function(u){u.Connected="connected",u.ConnectError="connect error",u.ConnectionError="connection error",u.ConnectionClosed="connection closed",u.ConnectionLost="connection lost",u.ReconnectAttempt="reconnect attempt",u.Reconnected="reconnected",u.ReconnectError="reconnect error",u.ReconnectLimitExceeded="reconnect limit exceeded",u.DataKeepAlive="data keep-alive",u.Data="data event content",u.DataError="data twitter error",u.TweetParseError="data tweet parse error",u.Error="stream error"})(M||(M={}));class qu{constructor(u){this.value=u}}import*as S5 from"fs";var G2={debug:!1,deprecationWarnings:!0,logger:{log:console.log.bind(console)}};function s8(u){let D={value:void 0,promise:u().then((B)=>{return D.value=B,B})};return D}function R3(u){if(Array.isArray(u))return u;return[u]}function bv(u){for(let D of Object.keys(u))if(u[D]===void 0)delete u[D]}function U3(u){return typeof u==="object"&&"errors"in u&&!("data"in u)}function _u(u){if(Array.isArray(u)&&u.length>1)return!0;return u.toString().includes(",")}var fv=new Set;function t8(u){if(typeof console>"u"||!console.warn||!G2.deprecationWarnings)return;let D=`${u.instance}-${u.method}-${u.problem}`;if(fv.has(D))return;let B=`[twitter-api-v2] Deprecation warning: In ${u.instance}.${u.method}() call, ${u.problem}.
68
+ ${u.resolution}.`;console.warn(B),console.warn("To disable this message, import variable TwitterApiV2Settings from twitter-api-v2 and set TwitterApiV2Settings.deprecationWarnings to false."),fv.add(D)}import{EventEmitter as IU}from"events";import{request as VU}from"https";import*as x2 from"zlib";import{EventEmitter as kU}from"events";class jv{constructor(u){this.requestData=u,this.requestErrorHandled=!1,this.responseData=[]}get hrefPathname(){let u=this.requestData.url;return u.hostname+u.pathname}isCompressionDisabled(){return!this.requestData.compression||this.requestData.compression==="identity"}isFormEncodedEndpoint(){return this.requestData.url.href.startsWith("https://api.x.com/oauth/")}createRequestError(u){if(G2.debug)G2.logger.log("Request error:",u);return new yu("Request failed.",{request:this.req,error:u})}createPartialResponseError(u,D){let A=`Request failed with partial response with HTTP code ${this.res.statusCode}`;if(D)A+=" (connection abruptly closed)";else A+=" (parse error)";return new Tu(A,{request:this.req,response:this.res,responseError:u,rawContent:Buffer.concat(this.responseData).toString()})}formatV1Errors(u){return u.map(({code:D,message:B})=>`${B} (Twitter code ${D})`).join(", ")}formatV2Error(u){return`${u.title}: ${u.detail} (see ${u.type})`}createResponseError({res:u,data:D,rateLimit:B,code:A}){var F;if(G2.debug)G2.logger.log(`Request failed with code ${A}, data:`,D),G2.logger.log("Response headers:",u.headers);let w=`Request failed with code ${A}`;if((F=D===null||D===void 0?void 0:D.errors)===null||F===void 0?void 0:F.length){let G=D.errors;if(typeof G[0]==="object"&&"code"in G[0])w+=" - "+this.formatV1Errors(G);else w+=" - "+this.formatV2Error(D)}return new Iu(w,{code:A,data:D,headers:u.headers,request:this.req,response:u,rateLimit:B})}getResponseDataStream(u){if(this.isCompressionDisabled())return u;let D=(u.headers["content-encoding"]||"identity").trim().toLowerCase();if(D==="br"){let B=x2.createBrotliDecompress({flush:x2.constants.BROTLI_OPERATION_FLUSH,finishFlush:x2.constants.BROTLI_OPERATION_FLUSH});return u.pipe(B),B}if(D==="gzip"){let B=x2.createGunzip({flush:x2.constants.Z_SYNC_FLUSH,finishFlush:x2.constants.Z_SYNC_FLUSH});return u.pipe(B),B}if(D==="deflate"){let B=x2.createInflate({flush:x2.constants.Z_SYNC_FLUSH,finishFlush:x2.constants.Z_SYNC_FLUSH});return u.pipe(B),B}return u}detectResponseType(u){var D,B;if(((D=u.headers["content-type"])===null||D===void 0?void 0:D.includes("application/json"))||((B=u.headers["content-type"])===null||B===void 0?void 0:B.includes("application/problem+json")))return"json";else if(this.isFormEncodedEndpoint())return"url";return"text"}getParsedResponse(u){let D=this.responseData,B=this.requestData.forceParseMode||this.detectResponseType(u);if(B==="buffer")return Buffer.concat(D);else if(B==="text")return Buffer.concat(D).toString();else if(B==="json"){let A=Buffer.concat(D).toString();return A.length?JSON.parse(A):void 0}else if(B==="url"){let A=Buffer.concat(D).toString(),F={};for(let[w,G]of new URLSearchParams(A))F[w]=G;return F}else return}getRateLimitFromResponse(u){let D=void 0;if(u.headers["x-rate-limit-limit"]){if(D={limit:Number(u.headers["x-rate-limit-limit"]),remaining:Number(u.headers["x-rate-limit-remaining"]),reset:Number(u.headers["x-rate-limit-reset"])},u.headers["x-app-limit-24hour-limit"])D.day={limit:Number(u.headers["x-app-limit-24hour-limit"]),remaining:Number(u.headers["x-app-limit-24hour-remaining"]),reset:Number(u.headers["x-app-limit-24hour-reset"])};if(u.headers["x-user-limit-24hour-limit"])D.userDay={limit:Number(u.headers["x-user-limit-24hour-limit"]),remaining:Number(u.headers["x-user-limit-24hour-remaining"]),reset:Number(u.headers["x-user-limit-24hour-reset"])};if(this.requestData.rateLimitSaver)this.requestData.rateLimitSaver(D)}return D}onSocketEventHandler(u,D,B){let A=this.onSocketCloseHandler.bind(this,u);B.on("close",A),D.on("complete",()=>B.off("close",A))}onSocketCloseHandler(u){if(this.req.removeAllListeners("timeout"),this.res)return;if(!this.requestErrorHandled)return u(this.createRequestError(Error("Socket closed without any information.")))}requestErrorHandler(u,D){var B,A;(A=(B=this.requestData).requestEventDebugHandler)===null||A===void 0||A.call(B,"request-error",{requestError:D}),this.requestErrorHandled=!0,u(this.createRequestError(D))}timeoutErrorHandler(){this.requestErrorHandled=!0,this.req.destroy(Error("Request timeout."))}classicResponseHandler(u,D,B){this.res=B;let A=this.getResponseDataStream(B);if(A.on("data",(F)=>this.responseData.push(F)),A.on("end",this.onResponseEndHandler.bind(this,u,D)),A.on("close",this.onResponseCloseHandler.bind(this,u,D)),this.requestData.requestEventDebugHandler)this.requestData.requestEventDebugHandler("response",{res:B}),B.on("aborted",(F)=>this.requestData.requestEventDebugHandler("response-aborted",{error:F})),B.on("error",(F)=>this.requestData.requestEventDebugHandler("response-error",{error:F})),B.on("close",()=>this.requestData.requestEventDebugHandler("response-close",{data:this.responseData})),B.on("end",()=>this.requestData.requestEventDebugHandler("response-end"))}onResponseEndHandler(u,D){let B=this.getRateLimitFromResponse(this.res),A;try{A=this.getParsedResponse(this.res)}catch(w){D(this.createPartialResponseError(w,!1));return}let F=this.res.statusCode;if(F>=400){D(this.createResponseError({data:A,res:this.res,rateLimit:B,code:F}));return}if(G2.debug)G2.logger.log(`[${this.requestData.options.method} ${this.hrefPathname}]: Request succeeds with code ${this.res.statusCode}`),G2.logger.log("Response body:",A);u({data:A,headers:this.res.headers,rateLimit:B})}onResponseCloseHandler(u,D){let B=this.res;if(B.aborted)try{return this.getParsedResponse(this.res),this.onResponseEndHandler(u,D)}catch(A){return D(this.createPartialResponseError(A,!0))}if(!B.complete)return D(this.createPartialResponseError(Error("Response has been interrupted before response could be parsed."),!0))}streamResponseHandler(u,D,B){if(B.statusCode<400){if(G2.debug)G2.logger.log(`[${this.requestData.options.method} ${this.hrefPathname}]: Request succeeds with code ${B.statusCode} (starting stream)`);let F=this.getResponseDataStream(B);u({req:this.req,res:F,originalResponse:B,requestData:this.requestData})}else this.classicResponseHandler(()=>{return},D,B)}debugRequest(){let u=this.requestData.url;if(G2.logger.log(`[${this.requestData.options.method} ${this.hrefPathname}]`,this.requestData.options),u.search)G2.logger.log("Request parameters:",[...u.searchParams.entries()].map(([D,B])=>`${D}: ${B}`));if(this.requestData.body)G2.logger.log("Request body:",this.requestData.body)}buildRequest(){var u;let D=this.requestData.url,B=D.username?`${D.username}:${D.password}`:void 0,A=(u=this.requestData.options.headers)!==null&&u!==void 0?u:{};if(this.requestData.compression===!0||this.requestData.compression==="brotli")A["accept-encoding"]="br;q=1.0, gzip;q=0.8, deflate;q=0.5, *;q=0.1";else if(this.requestData.compression==="gzip")A["accept-encoding"]="gzip;q=1, deflate;q=0.5, *;q=0.1";else if(this.requestData.compression==="deflate")A["accept-encoding"]="deflate;q=1, *;q=0.1";if(G2.debug)this.debugRequest();this.req=VU({...this.requestData.options,host:D.hostname,port:D.port||void 0,path:D.pathname+D.search,protocol:D.protocol,auth:B,headers:A})}registerRequestEventDebugHandlers(u){u.on("close",()=>this.requestData.requestEventDebugHandler("close")),u.on("abort",()=>this.requestData.requestEventDebugHandler("abort")),u.on("socket",(D)=>{this.requestData.requestEventDebugHandler("socket",{socket:D}),D.on("error",(B)=>this.requestData.requestEventDebugHandler("socket-error",{socket:D,error:B})),D.on("connect",()=>this.requestData.requestEventDebugHandler("socket-connect",{socket:D})),D.on("close",(B)=>this.requestData.requestEventDebugHandler("socket-close",{socket:D,withError:B})),D.on("end",()=>this.requestData.requestEventDebugHandler("socket-end",{socket:D})),D.on("lookup",(...B)=>this.requestData.requestEventDebugHandler("socket-lookup",{socket:D,data:B})),D.on("timeout",()=>this.requestData.requestEventDebugHandler("socket-timeout",{socket:D}))})}makeRequest(){return this.buildRequest(),new Promise((u,D)=>{let B=(G)=>{F.emit("complete"),u(G)},A=(G)=>{F.emit("complete"),D(G)},F=new kU,w=this.req;if(w.on("error",this.requestErrorHandler.bind(this,A)),w.on("socket",this.onSocketEventHandler.bind(this,A,F)),w.on("response",this.classicResponseHandler.bind(this,B,A)),this.requestData.options.timeout)w.on("timeout",this.timeoutErrorHandler.bind(this));if(this.requestData.requestEventDebugHandler)this.registerRequestEventDebugHandlers(w);if(this.requestData.body)w.write(this.requestData.body);w.end()})}async makeRequestAsStream(){let{req:u,res:D,requestData:B,originalResponse:A}=await this.makeRequestAndResolveWhenReady();return new M3(B,{req:u,res:D,originalResponse:A})}makeRequestAndResolveWhenReady(){return this.buildRequest(),new Promise((u,D)=>{let B=this.req;if(B.on("error",this.requestErrorHandler.bind(this,D)),B.on("response",this.streamResponseHandler.bind(this,u,D)),this.requestData.body)B.write(this.requestData.body);B.end()})}}var mu=jv;import{EventEmitter as yU}from"events";class lv extends yU{constructor(u){super();this.stream=u,this.stack=[],this.onStreamData=this.onStreamData.bind(this),this.onStreamError=this.onStreamError.bind(this),this.onceNewEvent=this.once.bind(this,"event"),u.on(M.Data,this.onStreamData),u.on(M.ConnectionError,this.onStreamError),u.on(M.TweetParseError,this.onStreamError),u.on(M.ConnectionClosed,this.onStreamError)}nextEvent(){return new Promise(this.onceNewEvent)}hasStack(){return this.stack.length>0}popStack(){let u=this.stack;return this.stack=[],u}destroy(){this.removeAllListeners(),this.stream.off(M.Data,this.onStreamData),this.stream.off(M.ConnectionError,this.onStreamError),this.stream.off(M.TweetParseError,this.onStreamError),this.stream.off(M.ConnectionClosed,this.onStreamError)}emitEvent(u,D){this.emit("event",{type:u,payload:D})}onStreamError(u){this.emitEvent("error",u)}onStreamData(u){this.stack.push(u),this.emitEvent("data",u)}}var dv=lv;import{EventEmitter as TU}from"events";class L3 extends TU{constructor(){super(...arguments);this.currentMessage=""}push(u){this.currentMessage+=u,u=this.currentMessage;let D=u.length,B=0,A=0;while(A<D){if(u.slice(A,A+2)===`\r
69
+ `){let F=u.slice(B,A);if(B=A+=2,!F.length)continue;try{let w=JSON.parse(F);if(w){this.emit(v0.ParsedData,w);continue}}catch(w){this.emit(v0.ParseError,w)}}A++}this.currentMessage=u.slice(B,D)}reset(){this.currentMessage=""}}var v0;(function(u){u.ParsedData="parsed data",u.ParseError="parse error"})(v0||(v0={}));var iv=[5,15,30,60,90,120,180,300,600,900],qU=(u)=>u>iv.length?901000:iv[u-1]*1000;class rv extends IU{constructor(u,D){super();if(this.requestData=u,this.autoReconnect=!1,this.autoReconnectRetries=5,this.keepAliveTimeoutMs=120000,this.nextRetryTimeout=qU,this.parser=new L3,this.connectionProcessRunning=!1,this.onKeepAliveTimeout=this.onKeepAliveTimeout.bind(this),this.initEventsFromParser(),D)this.req=D.req,this.res=D.res,this.originalResponse=D.originalResponse,this.initEventsFromRequest()}on(u,D){return super.on(u,D)}initEventsFromRequest(){if(!this.req||!this.res)throw Error("TweetStream error: You cannot init TweetStream without a request and response object.");let u=(D)=>{this.emit(M.ConnectionError,D),this.emit(M.Error,{type:M.ConnectionError,error:D,message:"Connection lost or closed by Twitter."}),this.onConnectionError()};this.req.on("error",u),this.res.on("error",u),this.res.on("close",()=>u(Error("Connection closed by Twitter."))),this.res.on("data",(D)=>{if(this.resetKeepAliveTimeout(),D.toString()===`\r
70
+ `)return this.emit(M.DataKeepAlive);this.parser.push(D.toString())}),this.resetKeepAliveTimeout()}initEventsFromParser(){let u=this.requestData.payloadIsError;this.parser.on(v0.ParsedData,(D)=>{if(u&&u(D))this.emit(M.DataError,D),this.emit(M.Error,{type:M.DataError,error:D,message:"Twitter sent a payload that is detected as an error payload."});else this.emit(M.Data,D)}),this.parser.on(v0.ParseError,(D)=>{this.emit(M.TweetParseError,D),this.emit(M.Error,{type:M.TweetParseError,error:D,message:"Failed to parse stream data."})})}resetKeepAliveTimeout(){if(this.unbindKeepAliveTimeout(),this.keepAliveTimeoutMs!==1/0)this.keepAliveTimeout=setTimeout(this.onKeepAliveTimeout,this.keepAliveTimeoutMs)}onKeepAliveTimeout(){this.emit(M.ConnectionLost),this.onConnectionError()}unbindTimeouts(){this.unbindRetryTimeout(),this.unbindKeepAliveTimeout()}unbindKeepAliveTimeout(){if(this.keepAliveTimeout)clearTimeout(this.keepAliveTimeout),this.keepAliveTimeout=void 0}unbindRetryTimeout(){if(this.retryTimeout)clearTimeout(this.retryTimeout),this.retryTimeout=void 0}closeWithoutEmit(){if(this.unbindTimeouts(),this.res)this.res.removeAllListeners(),this.res.destroy();if(this.req)this.req.removeAllListeners(),this.req.destroy()}close(){this.emit(M.ConnectionClosed),this.closeWithoutEmit()}destroy(){this.removeAllListeners(),this.close()}async clone(){let D=await new mu(this.requestData).makeRequestAsStream(),B=this.eventNames();for(let A of B){let F=this.listeners(A);for(let w of F)D.on(A,w)}return D}async connect(u={}){if(typeof u.autoReconnect<"u")this.autoReconnect=u.autoReconnect;if(typeof u.autoReconnectRetries<"u")this.autoReconnectRetries=u.autoReconnectRetries==="unlimited"?1/0:u.autoReconnectRetries;if(typeof u.keepAliveTimeout<"u")this.keepAliveTimeoutMs=u.keepAliveTimeout==="disable"?1/0:u.keepAliveTimeout;if(typeof u.nextRetryTimeout<"u")this.nextRetryTimeout=u.nextRetryTimeout;this.unbindTimeouts();try{await this.reconnect()}catch(D){if(this.emit(M.ConnectError,0),this.emit(M.Error,{type:M.ConnectError,error:D,message:"Connect error - Initial connection just failed."}),this.autoReconnect)this.makeAutoReconnectRetry(0,D);else throw D}return this}async reconnect(){if(this.connectionProcessRunning)throw Error("Connection process is already running.");this.connectionProcessRunning=!0;try{let u=!0;if(this.req)u=!1,this.closeWithoutEmit();let{req:D,res:B,originalResponse:A}=await new mu(this.requestData).makeRequestAndResolveWhenReady();this.req=D,this.res=B,this.originalResponse=A,this.emit(u?M.Connected:M.Reconnected),this.parser.reset(),this.initEventsFromRequest()}finally{this.connectionProcessRunning=!1}}async onConnectionError(u=0){if(this.unbindTimeouts(),this.closeWithoutEmit(),!this.autoReconnect){this.emit(M.ConnectionClosed);return}if(u>=this.autoReconnectRetries){this.emit(M.ReconnectLimitExceeded),this.emit(M.ConnectionClosed);return}try{this.emit(M.ReconnectAttempt,u),await this.reconnect()}catch(D){this.emit(M.ReconnectError,u),this.emit(M.Error,{type:M.ReconnectError,error:D,message:`Reconnect error - ${u+1} attempts made yet.`}),this.makeAutoReconnectRetry(u,D)}}makeAutoReconnectRetry(u,D){let B=this.nextRetryTimeout(u+1,D);this.retryTimeout=setTimeout(()=>{this.onConnectionError(u+1)},B)}async*[Symbol.asyncIterator](){let u=new dv(this);try{while(!0){if(!this.req||this.req.aborted)throw Error("Connection closed");if(u.hasStack())yield*u.popStack();let{type:D,payload:B}=await u.nextEvent();if(D==="error")throw B}}finally{u.destroy()}}}var M3=rv;function nv(u){var D;if(!((D=u.clientSettings.plugins)===null||D===void 0?void 0:D.length))return!1;for(let B of u.clientSettings.plugins)if(B.onRequestError||B.onResponseError)return!0;return!1}async function pv(u,D,B,A){let F;if(A instanceof yu||A instanceof Tu)F=await this.applyPluginMethod("onRequestError",{client:this,url:this.getUrlObjectFromUrlString(u.url),params:u,computedParams:D,requestOptions:B,error:A});else if(A instanceof Iu)F=await this.applyPluginMethod("onResponseError",{client:this,url:this.getUrlObjectFromUrlString(u.url),params:u,computedParams:D,requestOptions:B,error:A});if(F&&F instanceof qu)return F.value;return Promise.reject(A)}import*as tv from"crypto";class y2{constructor(u){this.nonceLength=32,this.consumerKeys=u.consumerKeys}static percentEncode(u){return encodeURIComponent(u).replace(/!/g,"%21").replace(/\*/g,"%2A").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29")}hash(u,D){return tv.createHmac("sha1",D).update(u).digest("base64")}authorize(u,D={}){let B={oauth_consumer_key:this.consumerKeys.key,oauth_nonce:this.getNonce(),oauth_signature_method:"HMAC-SHA1",oauth_timestamp:this.getTimestamp(),oauth_version:"1.0"};if(D.key!==void 0)B.oauth_token=D.key;if(!u.data)u.data={};return B.oauth_signature=this.getSignature(u,D.secret,B),B}toHeader(u){let D=sv(u),B="OAuth ";for(let A of D){if(A.key.indexOf("oauth_")!==0)continue;B+=y2.percentEncode(A.key)+'="'+y2.percentEncode(A.value)+'",'}return{Authorization:B.slice(0,B.length-1)}}getNonce(){let D="";for(let B=0;B<this.nonceLength;B++)D+="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"[Math.trunc(Math.random()*62)];return D}getTimestamp(){return Math.trunc(new Date().getTime()/1000)}getSignature(u,D,B){return this.hash(this.getBaseString(u,B),this.getSigningKey(D))}getSigningKey(u){return y2.percentEncode(this.consumerKeys.secret)+"&"+y2.percentEncode(u||"")}getBaseString(u,D){return u.method.toUpperCase()+"&"+y2.percentEncode(this.getBaseUrl(u.url))+"&"+y2.percentEncode(this.getParameterString(u,D))}getParameterString(u,D){let B=sv(gU(av(D,av(u.data,mU(u.url))))),A="";for(let{key:F,value:w}of B)if(w&&Array.isArray(w)){w.sort();let G="";w.forEach((N,$)=>{if(G+=F+"="+N,$<w.length)G+="&"}),A+=G}else A+=F+"="+w+"&";return A.slice(0,A.length-1)}getBaseUrl(u){return u.split("?")[0]}}var gu=y2;function av(u,D){return{...u||{},...D||{}}}function sv(u){return Object.keys(u).sort().map((D)=>({key:D,value:u[D]}))}function _U(u){let D=u.split("&"),B={};for(let A of D){let[F,w=""]=A.split("=");if(B[F]){if(!Array.isArray(B[F]))B[F]=[B[F]];B[F].push(decodeURIComponent(w))}else B[F]=decodeURIComponent(w)}return B}function mU(u){let D=u.split("?");if(D.length===1)return{};return _U(D[1])}function gU(u){let D={};for(let B in u){let A=u[B];if(A&&Array.isArray(A))A=A.map((F)=>y2.percentEncode(F));else A=y2.percentEncode(A);D[y2.percentEncode(B)]=A}return D}class T2{constructor(){this._boundary="",this._chunks=[]}bodyAppend(...u){let D=u.map((B)=>B instanceof Buffer?B:Buffer.from(B));this._chunks.push(...D)}append(u,D,B){let A=D instanceof Buffer?D:D.toString(),F=this.getMultipartHeader(u,A,B);this.bodyAppend(F,A,T2.LINE_BREAK)}getHeaders(){return{"content-type":"multipart/form-data; boundary="+this.getBoundary()}}getLength(){return this._chunks.reduce((u,D)=>u+D.length,this.getMultipartFooter().length)}getBuffer(){let u=[...this._chunks,this.getMultipartFooter()],D=Buffer.alloc(this.getLength()),B=0;for(let A of u)for(let F=0;F<A.length;B++,F++)D[B]=A[F];return D}getBoundary(){if(!this._boundary)this.generateBoundary();return this._boundary}generateBoundary(){let u="--------------------------";for(let D=0;D<24;D++)u+=Math.floor(Math.random()*10).toString(16);this._boundary=u}getMultipartHeader(u,D,B){if(!B)B=D instanceof Buffer?T2.DEFAULT_CONTENT_TYPE:"";let A={"Content-Disposition":["form-data",`name="${u}"`],"Content-Type":B},F="";for(let[w,G]of Object.entries(A)){if(!G.length)continue;F+=w+": "+R3(G).join("; ")+T2.LINE_BREAK}return"--"+this.getBoundary()+T2.LINE_BREAK+F+T2.LINE_BREAK}getMultipartFooter(){if(this._footerChunk)return this._footerChunk;return this._footerChunk=Buffer.from("--"+this.getBoundary()+"--"+T2.LINE_BREAK)}}T2.LINE_BREAK=`\r
71
+ `;T2.DEFAULT_CONTENT_TYPE="application/octet-stream";class o8{static formatQueryToString(u){let D={};for(let B in u)if(typeof u[B]==="string")D[B]=u[B];else if(typeof u[B]<"u")D[B]=String(u[B]);return D}static autoDetectBodyType(u){if(u.pathname.startsWith("/2/")||u.pathname.startsWith("/labs/2/")){if(u.password.startsWith("/2/oauth2"))return"url";return"json"}if(u.hostname==="upload.x.com"){if(u.pathname==="/1.1/media/upload.json")return"form-data";return"json"}let D=u.pathname.split("/1.1/",2)[1];if(this.JSON_1_1_ENDPOINTS.has(D))return"json";return"url"}static addQueryParamsToUrl(u,D){let B=Object.entries(D);if(B.length){let A="";for(let[F,w]of B)A+=(A.length?"&":"?")+`${gu.percentEncode(F)}=${gu.percentEncode(w)}`;u.search=A}}static constructBodyParams(u,D,B){if(u instanceof Buffer)return u;if(B==="json"){if(!D["content-type"])D["content-type"]="application/json;charset=UTF-8";return JSON.stringify(u)}else if(B==="url"){if(!D["content-type"])D["content-type"]="application/x-www-form-urlencoded;charset=UTF-8";if(Object.keys(u).length)return new URLSearchParams(u).toString().replace(/\*/g,"%2A");return""}else if(B==="raw")throw Error("You can only use raw body mode with Buffers. To give a string, use Buffer.from(str).");else{let A=new T2;for(let F in u)A.append(F,u[F]);if(!D["content-type"]){let F=A.getHeaders();D["content-type"]=F["content-type"]}return A.getBuffer()}}static setBodyLengthHeader(u,D){var B;if(u.headers=(B=u.headers)!==null&&B!==void 0?B:{},typeof D==="string")u.headers["content-length"]=Buffer.byteLength(D);else u.headers["content-length"]=D.length}static isOAuthSerializable(u){return!(u instanceof Buffer)}static mergeQueryAndBodyForOAuth(u,D){let B={};for(let A in u)B[A]=u[A];if(this.isOAuthSerializable(D))for(let A in D){let F=D[A];if(this.isOAuthSerializable(F))B[A]=typeof F==="object"&&F!==null&&"toString"in F?F.toString():F}return B}static moveUrlQueryParamsIntoObject(u,D){for(let[B,A]of u.searchParams)D[B]=A;return u.search="",u}static applyRequestParametersToUrl(u,D){return u.pathname=u.pathname.replace(/:([A-Z_-]+)/ig,(B,A)=>{if(D[A]!==void 0)return String(D[A]);return B}),u}}o8.JSON_1_1_ENDPOINTS=new Set(["direct_messages/events/new.json","direct_messages/welcome_messages/new.json","direct_messages/welcome_messages/rules/new.json","media/metadata/create.json","collections/entries/curate.json"]);var V2=o8;import*as ov from"crypto";class K0{static getCodeVerifier(){return this.generateRandomString(128)}static getCodeChallengeFromVerifier(u){return this.escapeBase64Url(ov.createHash("sha256").update(u).digest("base64"))}static getAuthHeader(u,D){let B=encodeURIComponent(u)+":"+encodeURIComponent(D);return Buffer.from(B).toString("base64")}static generateRandomString(u){let D="",B="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~";for(let A=0;A<u;A++)D+=B[Math.floor(Math.random()*B.length)];return D}static escapeBase64Url(u){return u.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}}class p0{constructor(u){if(this.rateLimits={},this.clientSettings={},u)this.clientSettings=u}getRateLimits(){return this.rateLimits}saveRateLimit(u,D){this.rateLimits[u]=D}async send(u){var D,B,A,F,w;if((D=this.clientSettings.plugins)===null||D===void 0?void 0:D.length){let J=await this.applyPreRequestConfigHooks(u);if(J)return J}let G=this.getHttpRequestArgs(u),N={method:G.method,headers:G.headers,timeout:u.timeout,agent:this.clientSettings.httpAgent},$=u.enableRateLimitSave!==!1;if(G.body)V2.setBodyLengthHeader(N,G.body);if((B=this.clientSettings.plugins)===null||B===void 0?void 0:B.length)await this.applyPreRequestHooks(u,G,N);let Z=new mu({url:G.url,options:N,body:G.body,rateLimitSaver:$?this.saveRateLimit.bind(this,G.rawUrl):void 0,requestEventDebugHandler:u.requestEventDebugHandler,compression:(F=(A=u.compression)!==null&&A!==void 0?A:this.clientSettings.compression)!==null&&F!==void 0?F:!0,forceParseMode:u.forceParseMode}).makeRequest();if(nv(this))Z=this.applyResponseErrorHooks(u,G,N,Z);let Y=await Z;if((w=this.clientSettings.plugins)===null||w===void 0?void 0:w.length){let J=await this.applyPostRequestHooks(u,G,N,Y);if(J)return J.value}return Y}sendStream(u){var D,B;if(this.clientSettings.plugins)this.applyPreStreamRequestConfigHooks(u);let A=this.getHttpRequestArgs(u),F={method:A.method,headers:A.headers,agent:this.clientSettings.httpAgent},w=u.enableRateLimitSave!==!1,G=u.autoConnect!==!1;if(A.body)V2.setBodyLengthHeader(F,A.body);let N={url:A.url,options:F,body:A.body,rateLimitSaver:w?this.saveRateLimit.bind(this,A.rawUrl):void 0,payloadIsError:u.payloadIsError,compression:(B=(D=u.compression)!==null&&D!==void 0?D:this.clientSettings.compression)!==null&&B!==void 0?B:!0},$=new M3(N);if(!G)return $;return $.connect()}initializeToken(u){if(typeof u==="string")this.bearerToken=u;else if(typeof u==="object"&&"appKey"in u){if(this.consumerToken=u.appKey,this.consumerSecret=u.appSecret,u.accessToken&&u.accessSecret)this.accessToken=u.accessToken,this.accessSecret=u.accessSecret;this._oauth=this.buildOAuth()}else if(typeof u==="object"&&"username"in u){let D=encodeURIComponent(u.username)+":"+encodeURIComponent(u.password);this.basicToken=Buffer.from(D).toString("base64")}else if(typeof u==="object"&&"clientId"in u)this.clientId=u.clientId,this.clientSecret=u.clientSecret}getActiveTokens(){if(this.bearerToken)return{type:"oauth2",bearerToken:this.bearerToken};else if(this.basicToken)return{type:"basic",token:this.basicToken};else if(this.consumerSecret&&this._oauth)return{type:"oauth-1.0a",appKey:this.consumerToken,appSecret:this.consumerSecret,accessToken:this.accessToken,accessSecret:this.accessSecret};else if(this.clientId)return{type:"oauth2-user",clientId:this.clientId};return{type:"none"}}buildOAuth(){if(!this.consumerSecret||!this.consumerToken)throw Error("Invalid consumer tokens");return new gu({consumerKeys:{key:this.consumerToken,secret:this.consumerSecret}})}getOAuthAccessTokens(){if(!this.accessSecret||!this.accessToken)return;return{key:this.accessToken,secret:this.accessSecret}}getPlugins(){var u;return(u=this.clientSettings.plugins)!==null&&u!==void 0?u:[]}hasPlugins(){var u;return!!((u=this.clientSettings.plugins)===null||u===void 0?void 0:u.length)}async applyPluginMethod(u,D){var B;let A;for(let F of this.getPlugins()){let w=await((B=F[u])===null||B===void 0?void 0:B.call(F,D));if(w&&w instanceof qu)A=w}return A}writeAuthHeaders({headers:u,bodyInSignature:D,url:B,method:A,query:F,body:w}){if(u={...u},this.bearerToken)u.Authorization="Bearer "+this.bearerToken;else if(this.basicToken)u.Authorization="Basic "+this.basicToken;else if(this.clientId&&this.clientSecret)u.Authorization="Basic "+K0.getAuthHeader(this.clientId,this.clientSecret);else if(this.consumerSecret&&this._oauth){let G=D?V2.mergeQueryAndBodyForOAuth(F,w):F,N=this._oauth.authorize({url:B.toString(),method:A,data:G},this.getOAuthAccessTokens());u={...u,...this._oauth.toHeader(N)}}return u}getUrlObjectFromUrlString(u){if(!u.startsWith("http"))u="https://"+u;return new URL(u)}getHttpRequestArgs({url:u,method:D,query:B={},body:A={},headers:F,forceBodyMode:w,enableAuth:G,params:N}){let $=void 0;if(D=D.toUpperCase(),F=F!==null&&F!==void 0?F:{},!F["x-user-agent"])F["x-user-agent"]="Node.twitter-api-v2";let Z=this.getUrlObjectFromUrlString(u),Y=Z.origin+Z.pathname;if(N)V2.applyRequestParametersToUrl(Z,N);let J=V2.formatQueryToString(B);if(V2.moveUrlQueryParamsIntoObject(Z,J),!(A instanceof Buffer))bv(A);let Q=w!==null&&w!==void 0?w:V2.autoDetectBodyType(Z);if(G!==!1){let X=p0.BODY_METHODS.has(D)&&Q==="url";F=this.writeAuthHeaders({headers:F,bodyInSignature:X,method:D,query:J,url:Z,body:A})}if(p0.BODY_METHODS.has(D))$=V2.constructBodyParams(A,F,Q)||void 0;return V2.addQueryParamsToUrl(Z,J),{rawUrl:Y,url:Z,method:D,headers:F,body:$}}async applyPreRequestConfigHooks(u){var D;let B=this.getUrlObjectFromUrlString(u.url);for(let A of this.getPlugins()){let F=await((D=A.onBeforeRequestConfig)===null||D===void 0?void 0:D.call(A,{client:this,url:B,params:u}));if(F)return F}}applyPreStreamRequestConfigHooks(u){var D;let B=this.getUrlObjectFromUrlString(u.url);for(let A of this.getPlugins())(D=A.onBeforeStreamRequestConfig)===null||D===void 0||D.call(A,{client:this,url:B,params:u})}async applyPreRequestHooks(u,D,B){await this.applyPluginMethod("onBeforeRequest",{client:this,url:this.getUrlObjectFromUrlString(u.url),params:u,computedParams:D,requestOptions:B})}async applyPostRequestHooks(u,D,B,A){return await this.applyPluginMethod("onAfterRequest",{client:this,url:this.getUrlObjectFromUrlString(u.url),params:u,computedParams:D,requestOptions:B,response:A})}applyResponseErrorHooks(u,D,B,A){return A.catch(pv.bind(this,u,D,B))}}p0.BODY_METHODS=new Set(["POST","PUT","PATCH"]);class w0{constructor(u,D={}){if(this._currentUser=null,this._currentUserV2=null,u instanceof w0)this._requestMaker=u._requestMaker;else this._requestMaker=new p0(D),this._requestMaker.initializeToken(u)}setPrefix(u){this._prefix=u}cloneWithPrefix(u){let D=this.constructor(this);return D.setPrefix(u),D}getActiveTokens(){return this._requestMaker.getActiveTokens()}getPlugins(){return this._requestMaker.getPlugins()}getPluginOfType(u){return this.getPlugins().find((D)=>D instanceof u)}hasHitRateLimit(u){var D;if(this.isRateLimitStatusObsolete(u))return!1;return((D=this.getLastRateLimitStatus(u))===null||D===void 0?void 0:D.remaining)===0}isRateLimitStatusObsolete(u){let D=this.getLastRateLimitStatus(u);if(D===void 0)return!0;return D.reset*1000<Date.now()}getLastRateLimitStatus(u){let D=u.match(/^https?:\/\//)?u:this._prefix+u;return this._requestMaker.getRateLimits()[D]}getCurrentUserObject(u=!1){if(!u&&this._currentUser){if(this._currentUser.value)return Promise.resolve(this._currentUser.value);return this._currentUser.promise}return this._currentUser=s8(()=>this.get("account/verify_credentials.json",{tweet_mode:"extended"},{prefix:A0})),this._currentUser.promise}getCurrentUserV2Object(u=!1){if(!u&&this._currentUserV2){if(this._currentUserV2.value)return Promise.resolve(this._currentUserV2.value);return this._currentUserV2.promise}return this._currentUserV2=s8(()=>this.get("users/me",void 0,{prefix:B0})),this._currentUserV2.promise}async get(u,D={},{fullResponse:B,prefix:A=this._prefix,...F}={}){if(A)u=A+u;let w=await this._requestMaker.send({url:u,method:"GET",query:D,...F});return B?w:w.data}async delete(u,D={},{fullResponse:B,prefix:A=this._prefix,...F}={}){if(A)u=A+u;let w=await this._requestMaker.send({url:u,method:"DELETE",query:D,...F});return B?w:w.data}async post(u,D,{fullResponse:B,prefix:A=this._prefix,...F}={}){if(A)u=A+u;let w=await this._requestMaker.send({url:u,method:"POST",body:D,...F});return B?w:w.data}async put(u,D,{fullResponse:B,prefix:A=this._prefix,...F}={}){if(A)u=A+u;let w=await this._requestMaker.send({url:u,method:"PUT",body:D,...F});return B?w:w.data}async patch(u,D,{fullResponse:B,prefix:A=this._prefix,...F}={}){if(A)u=A+u;let w=await this._requestMaker.send({url:u,method:"PATCH",body:D,...F});return B?w:w.data}getStream(u,D,{prefix:B=this._prefix,...A}={}){return this._requestMaker.sendStream({url:B?B+u:u,method:"GET",query:D,...A})}postStream(u,D,{prefix:B=this._prefix,...A}={}){return this._requestMaker.sendStream({url:B?B+u:u,method:"POST",body:D,...A})}}class k2 extends w0{constructor(u){if(!(u instanceof w0))throw Error("You must instance SubTwitterApi instance from existing TwitterApi instance.");super(u)}}class a0 extends n0{constructor(){super(...arguments);this.hasFinishedFetch=!1}refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.push(...B),this.hasFinishedFetch=B.length===0}getNextQueryParams(u){let D=BigInt(this._realData[this._realData.length-1].id_str);return{...this.injectQueryParams(u),max_id:(D-BigInt(1)).toString()}}getPageLengthFromRequest(u){return u.data.length}isFetchLastOver(u){return!u.data.length}canFetchNextPage(u){return u.length>0}getItemArray(){return this.tweets}get tweets(){return this._realData}get done(){return super.done||this.hasFinishedFetch}}class e8 extends a0{constructor(){super(...arguments);this._endpoint="statuses/home_timeline.json"}}class u5 extends a0{constructor(){super(...arguments);this._endpoint="statuses/mentions_timeline.json"}}class E3 extends a0{constructor(){super(...arguments);this._endpoint="statuses/user_timeline.json"}}class D5 extends a0{constructor(){super(...arguments);this._endpoint="lists/statuses.json"}}class O3 extends a0{constructor(){super(...arguments);this._endpoint="favorites/list.json"}}class B5 extends F2{constructor(){super(...arguments);this._endpoint="mutes/users/list.json"}refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.users.push(...B.users),this._realData.next_cursor=B.next_cursor}getPageLengthFromRequest(u){return u.data.users.length}getItemArray(){return this.users}get users(){return this._realData.users}}class A5 extends F2{constructor(){super(...arguments);this._endpoint="mutes/users/ids.json",this._maxResultsWhenFetchLast=5000}refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.ids.push(...B.ids),this._realData.next_cursor=B.next_cursor}getPageLengthFromRequest(u){return u.data.ids.length}getItemArray(){return this.ids}get ids(){return this._realData.ids}}class F5 extends F2{constructor(){super(...arguments);this._endpoint="followers/list.json"}refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.users.push(...B.users),this._realData.next_cursor=B.next_cursor}getPageLengthFromRequest(u){return u.data.users.length}getItemArray(){return this.users}get users(){return this._realData.users}}class w5 extends F2{constructor(){super(...arguments);this._endpoint="followers/ids.json",this._maxResultsWhenFetchLast=5000}refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.ids.push(...B.ids),this._realData.next_cursor=B.next_cursor}getPageLengthFromRequest(u){return u.data.ids.length}getItemArray(){return this.ids}get ids(){return this._realData.ids}}class G5 extends F2{constructor(){super(...arguments);this._endpoint="friends/list.json"}refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.users.push(...B.users),this._realData.next_cursor=B.next_cursor}getPageLengthFromRequest(u){return u.data.users.length}getItemArray(){return this.users}get users(){return this._realData.users}}class N5 extends F2{constructor(){super(...arguments);this._endpoint="friends/ids.json",this._maxResultsWhenFetchLast=5000}refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.ids.push(...B.ids),this._realData.next_cursor=B.next_cursor}getPageLengthFromRequest(u){return u.data.ids.length}getItemArray(){return this.ids}get ids(){return this._realData.ids}}class $5 extends n0{constructor(){super(...arguments);this._endpoint="users/search.json"}refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.push(...B)}getNextQueryParams(u){var D;let B=Number((D=this._queryParams.page)!==null&&D!==void 0?D:"1");return{...this._queryParams,page:B+1,...u?{count:u}:{}}}getPageLengthFromRequest(u){return u.data.length}isFetchLastOver(u){return!u.data.length}canFetchNextPage(u){return u.length>0}getItemArray(){return this.users}get users(){return this._realData}}class C3 extends F2{constructor(){super(...arguments);this._endpoint="friendships/incoming.json",this._maxResultsWhenFetchLast=5000}refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.ids.push(...B.ids),this._realData.next_cursor=B.next_cursor}getPageLengthFromRequest(u){return u.data.ids.length}getItemArray(){return this.ids}get ids(){return this._realData.ids}}class z5 extends C3{constructor(){super(...arguments);this._endpoint="friendships/outgoing.json"}}class P3 extends F2{refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.lists.push(...B.lists),this._realData.next_cursor=B.next_cursor}getPageLengthFromRequest(u){return u.data.lists.length}getItemArray(){return this.lists}get lists(){return this._realData.lists}}class Z5 extends P3{constructor(){super(...arguments);this._endpoint="lists/memberships.json"}}class J5 extends P3{constructor(){super(...arguments);this._endpoint="lists/ownerships.json"}}class Q5 extends P3{constructor(){super(...arguments);this._endpoint="lists/subscriptions.json"}}class Y5 extends F2{refreshInstanceFromResult(u,D){let B=u.data;if(this._rateLimit=u.rateLimit,D)this._realData.users.push(...B.users),this._realData.next_cursor=B.next_cursor}getPageLengthFromRequest(u){return u.data.users.length}getItemArray(){return this.users}get users(){return this._realData.users}}class X5 extends Y5{constructor(){super(...arguments);this._endpoint="lists/members.json"}}class W5 extends Y5{constructor(){super(...arguments);this._endpoint="lists/subscribers.json"}}class s0 extends k2{constructor(){super(...arguments);this._prefix=A0}singleTweet(u,D={}){return this.get("statuses/show.json",{tweet_mode:"extended",id:u,...D})}tweets(u,D={}){return this.post("statuses/lookup.json",{tweet_mode:"extended",id:u,...D})}oembedTweet(u,D={}){return this.get("oembed",{url:`https://x.com/i/statuses/${u}`,...D},{prefix:"https://publish.x.com/"})}async homeTimeline(u={}){let D={tweet_mode:"extended",...u},B=await this.get("statuses/home_timeline.json",D,{fullResponse:!0});return new e8({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}async mentionTimeline(u={}){let D={tweet_mode:"extended",...u},B=await this.get("statuses/mentions_timeline.json",D,{fullResponse:!0});return new u5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}async userTimeline(u,D={}){let B={tweet_mode:"extended",user_id:u,...D},A=await this.get("statuses/user_timeline.json",B,{fullResponse:!0});return new E3({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:B})}async userTimelineByUsername(u,D={}){let B={tweet_mode:"extended",screen_name:u,...D},A=await this.get("statuses/user_timeline.json",B,{fullResponse:!0});return new E3({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:B})}async favoriteTimeline(u,D={}){let B={tweet_mode:"extended",user_id:u,...D},A=await this.get("favorites/list.json",B,{fullResponse:!0});return new O3({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:B})}async favoriteTimelineByUsername(u,D={}){let B={tweet_mode:"extended",screen_name:u,...D},A=await this.get("favorites/list.json",B,{fullResponse:!0});return new O3({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:B})}user(u){return this.get("users/show.json",{tweet_mode:"extended",...u})}users(u){return this.get("users/lookup.json",{tweet_mode:"extended",...u})}verifyCredentials(u={}){return this.get("account/verify_credentials.json",u)}async listMutedUsers(u={}){let D={tweet_mode:"extended",...u},B=await this.get("mutes/users/list.json",D,{fullResponse:!0});return new B5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}async listMutedUserIds(u={}){let D={stringify_ids:!0,...u},B=await this.get("mutes/users/ids.json",D,{fullResponse:!0});return new A5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}async userFriendList(u={}){let D={...u},B=await this.get("friends/list.json",D,{fullResponse:!0});return new G5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}async userFollowerList(u={}){let D={...u},B=await this.get("followers/list.json",D,{fullResponse:!0});return new F5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}async userFollowerIds(u={}){let D={stringify_ids:!0,...u},B=await this.get("followers/ids.json",D,{fullResponse:!0});return new w5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}async userFollowingIds(u={}){let D={stringify_ids:!0,...u},B=await this.get("friends/ids.json",D,{fullResponse:!0});return new N5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}async searchUsers(u,D={}){let B={q:u,tweet_mode:"extended",page:1,...D},A=await this.get("users/search.json",B,{fullResponse:!0});return new $5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:B})}friendship(u){return this.get("friendships/show.json",u)}friendships(u){return this.get("friendships/lookup.json",u)}friendshipsNoRetweets(){return this.get("friendships/no_retweets/ids.json",{stringify_ids:!0})}async friendshipsIncoming(u={}){let D={stringify_ids:!0,...u},B=await this.get("friendships/incoming.json",D,{fullResponse:!0});return new C3({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}async friendshipsOutgoing(u={}){let D={stringify_ids:!0,...u},B=await this.get("friendships/outgoing.json",D,{fullResponse:!0});return new z5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}accountSettings(){return this.get("account/settings.json")}userProfileBannerSizes(u){return this.get("users/profile_banner.json",u)}list(u){return this.get("lists/show.json",{tweet_mode:"extended",...u})}lists(u={}){return this.get("lists/list.json",{tweet_mode:"extended",...u})}async listMembers(u={}){let D={tweet_mode:"extended",...u},B=await this.get("lists/members.json",D,{fullResponse:!0});return new X5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}listGetMember(u){return this.get("lists/members/show.json",{tweet_mode:"extended",...u})}async listMemberships(u={}){let D={tweet_mode:"extended",...u},B=await this.get("lists/memberships.json",D,{fullResponse:!0});return new Z5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}async listOwnerships(u={}){let D={tweet_mode:"extended",...u},B=await this.get("lists/ownerships.json",D,{fullResponse:!0});return new J5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}async listStatuses(u){let D={tweet_mode:"extended",...u},B=await this.get("lists/statuses.json",D,{fullResponse:!0});return new D5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}async listSubscribers(u={}){let D={tweet_mode:"extended",...u},B=await this.get("lists/subscribers.json",D,{fullResponse:!0});return new W5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}listGetSubscriber(u){return this.get("lists/subscribers/show.json",{tweet_mode:"extended",...u})}async listSubscriptions(u={}){let D={tweet_mode:"extended",...u},B=await this.get("lists/subscriptions.json",D,{fullResponse:!0});return new Q5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}mediaInfo(u){return this.get("media/upload.json",{command:"STATUS",media_id:u},{prefix:b2})}filterStream({autoConnect:u,...D}={}){let B={};for(let[F,w]of Object.entries(D))if(F==="follow"||F==="track")B[F]=w.toString();else if(F==="locations"){let G=w;B.locations=R3(G).map((N)=>`${N.lng},${N.lat}`).join(",")}else B[F]=w;return this.stream.postStream("statuses/filter.json",B,{autoConnect:u})}sampleStream({autoConnect:u,...D}={}){return this.stream.getStream("statuses/sample.json",D,{autoConnect:u})}get stream(){let u=new c3(this);return u.setPrefix(mv),u}trendsByPlace(u,D={}){return this.get("trends/place.json",{id:u,...D})}trendsAvailable(){return this.get("trends/available.json")}trendsClosest(u,D){return this.get("trends/closest.json",{lat:u,long:D})}geoPlace(u){return this.get("geo/id/:place_id.json",void 0,{params:{place_id:u}})}geoSearch(u){return this.get("geo/search.json",u)}geoReverseGeoCode(u){return this.get("geo/reverse_geocode.json",u)}rateLimitStatuses(...u){return this.get("application/rate_limit_status.json",{resources:u})}supportedLanguages(){return this.get("help/languages.json")}}import*as G0 from"fs";async function v5(u){let D=await K5(u);if(typeof D==="number")return new Promise((B,A)=>{G0.readFile(D,(F,w)=>{if(F)return A(F);B(w)})});else if(D instanceof Buffer)return D;else return D.readFile()}function K5(u){if(typeof u==="string")return G0.promises.open(u,"r");else if(typeof u==="number")return u;else if(typeof u==="object"&&!(u instanceof Buffer))return u;else if(!(u instanceof Buffer))throw Error("Given file is not valid, please check its type.");else return u}async function ev(u){if(typeof u==="number")return(await new Promise((B,A)=>{G0.fstat(u,(F,w)=>{if(F)A(F);B(w)})})).size;else if(u instanceof Buffer)return u.length;else return(await u.stat()).size}function uK(u,D,B){if(typeof B==="string")return B;else if(typeof u==="string"&&!D)return fU(u);else if(typeof D==="string")return bU(D);throw Error("You must specify type if file is a file handle or Buffer.")}function fU(u){if(u.endsWith(".jpeg")||u.endsWith(".jpg"))return _.Jpeg;if(u.endsWith(".png"))return _.Png;if(u.endsWith(".webp"))return _.Webp;if(u.endsWith(".gif"))return _.Gif;if(u.endsWith(".mpeg4")||u.endsWith(".mp4"))return _.Mp4;if(u.endsWith(".mov")||u.endsWith(".mov"))return _.Mov;if(u.endsWith(".srt"))return _.Srt;return t8({instance:"TwitterApiv1ReadWrite",method:"uploadMedia",problem:"options.mimeType is missing and filename couldn't help to resolve MIME type, so it will fallback to image/jpeg",resolution:"If you except to give filenames without extensions, please specify explicitlty the MIME type using options.mimeType"}),_.Jpeg}function bU(u){if(t8({instance:"TwitterApiv1ReadWrite",method:"uploadMedia",problem:"you're using options.type",resolution:"Remove options.type argument and migrate to options.mimeType which takes the real MIME type. If you're using type=longmp4, add options.longVideo alongside of mimeType=EUploadMimeType.Mp4"}),u==="gif")return _.Gif;if(u==="jpg")return _.Jpeg;if(u==="png")return _.Png;if(u==="webp")return _.Webp;if(u==="srt")return _.Srt;if(u==="mp4"||u==="longmp4")return _.Mp4;if(u==="mov")return _.Mov;return u}function DK(u,D){if(u===_.Mp4||u===_.Mov)return D==="tweet"?"TweetVideo":"DmVideo";if(u===_.Gif)return D==="tweet"?"TweetGif":"DmGif";if(u===_.Srt)return"Subtitles";else return D==="tweet"?"TweetImage":"DmImage"}function h5(u){return new Promise((D)=>setTimeout(D,u*1000))}async function x5(u,D,B=0,A){if(u instanceof Buffer){let w=u.slice(B,B+D);return[w,w.length]}if(!A)throw Error("Well, we will need a buffer to store file content.");let F;if(typeof u==="number")F=await new Promise((w,G)=>{G0.read(u,A,0,D,B,(N,$)=>{if(N)G(N);w($)})});else F=(await u.read(A,0,D,B)).bytesRead;return[A,F]}var H5="media/upload.json";class t0 extends s0{constructor(){super(...arguments);this._prefix=A0}get readOnly(){return this}tweet(u,D={}){let B={status:u,tweet_mode:"extended",...D};return this.post("statuses/update.json",B)}async quote(u,D,B={}){let A="https://x.com/i/statuses/"+D;return this.tweet(u,{...B,attachment_url:A})}async tweetThread(u){let D=[];for(let B of u){let A=D.length?D[D.length-1]:null,F={...typeof B==="string"?{status:B}:B},w=A?A.id_str:F.in_reply_to_status_id,G=F.status;if(w)D.push(await this.reply(G,w,F));else D.push(await this.tweet(G,F))}return D}reply(u,D,B={}){return this.tweet(u,{auto_populate_reply_metadata:!0,in_reply_to_status_id:D,...B})}deleteTweet(u){return this.post("statuses/destroy/:id.json",{tweet_mode:"extended"},{params:{id:u}})}reportUserAsSpam(u){return this.post("users/report_spam.json",{tweet_mode:"extended",...u})}updateFriendship(u){return this.post("friendships/update.json",u)}createFriendship(u){return this.post("friendships/create.json",u)}destroyFriendship(u){return this.post("friendships/destroy.json",u)}updateAccountSettings(u){return this.post("account/settings.json",u)}updateAccountProfile(u){return this.post("account/update_profile.json",u)}async updateAccountProfileBanner(u,D={}){let B={banner:await v5(u),...D};return this.post("account/update_profile_banner.json",B,{forceBodyMode:"form-data"})}async updateAccountProfileImage(u,D={}){let B={tweet_mode:"extended",image:await v5(u),...D};return this.post("account/update_profile_image.json",B,{forceBodyMode:"form-data"})}removeAccountProfileBanner(){return this.post("account/remove_profile_banner.json")}createList(u){return this.post("lists/create.json",{tweet_mode:"extended",...u})}updateList(u){return this.post("lists/update.json",{tweet_mode:"extended",...u})}removeList(u){return this.post("lists/destroy.json",{tweet_mode:"extended",...u})}addListMembers(u){let B=u.user_id&&_u(u.user_id)||u.screen_name&&_u(u.screen_name)?"lists/members/create_all.json":"lists/members/create.json";return this.post(B,u)}removeListMembers(u){let B=u.user_id&&_u(u.user_id)||u.screen_name&&_u(u.screen_name)?"lists/members/destroy_all.json":"lists/members/destroy.json";return this.post(B,u)}subscribeToList(u){return this.post("lists/subscribers/create.json",{tweet_mode:"extended",...u})}unsubscribeOfList(u){return this.post("lists/subscribers/destroy.json",{tweet_mode:"extended",...u})}createMediaMetadata(u,D){return this.post("media/metadata/create.json",{media_id:u,...D},{prefix:b2,forceBodyMode:"json"})}createMediaSubtitles(u,D){return this.post("media/subtitles/create.json",{media_id:u,media_category:"TweetVideo",subtitle_info:{subtitles:D}},{prefix:b2,forceBodyMode:"json"})}deleteMediaSubtitles(u,...D){return this.post("media/subtitles/delete.json",{media_id:u,media_category:"TweetVideo",subtitle_info:{subtitles:D.map((B)=>({language_code:B}))}},{prefix:b2,forceBodyMode:"json"})}async uploadMedia(u,D={},B=!1){var A;let F=(A=D.chunkLength)!==null&&A!==void 0?A:1048576,{fileHandle:w,mediaCategory:G,fileSize:N,mimeType:$}=await this.getUploadMediaRequirements(u,D);try{let Z=await this.post(H5,{command:"INIT",total_bytes:N,media_type:$,media_category:G,additional_owners:D.additionalOwners,shared:D.shared?!0:void 0},{prefix:b2});await this.mediaChunkedUpload(w,F,Z.media_id_string,D.maxConcurrentUploads);let Y=await this.post(H5,{command:"FINALIZE",media_id:Z.media_id_string},{prefix:b2});if(Y.processing_info&&Y.processing_info.state!=="succeeded")await this.awaitForMediaProcessingCompletion(Y);if(B)return Y;else return Y.media_id_string}finally{if(typeof u==="number")S5.close(u,()=>{});else if(typeof w==="object"&&!(w instanceof Buffer))w.close()}}async awaitForMediaProcessingCompletion(u){var D;while(!0){u=await this.mediaInfo(u.media_id_string);let{processing_info:B}=u;if(!B||B.state==="succeeded")return;if((D=B.error)===null||D===void 0?void 0:D.code){let{name:A,message:F}=B.error;throw Error(`Failed to process media: ${A} - ${F}.`)}if(B.state==="failed")throw Error("Failed to process the media.");if(B.check_after_secs)await h5(B.check_after_secs);else await h5(5)}}async getUploadMediaRequirements(u,{mimeType:D,type:B,target:A,longVideo:F}={}){let w;try{w=await K5(u);let G=uK(u,B,D),N;if(G===_.Mp4&&(!D&&!B&&A!=="dm"||F))N="amplify_video";else N=DK(G,A!==null&&A!==void 0?A:"tweet");return{fileHandle:w,mediaCategory:N,fileSize:await ev(w),mimeType:G}}catch(G){if(typeof u==="number")S5.close(u,()=>{});else if(typeof w==="object"&&!(w instanceof Buffer))w.close();throw G}}async mediaChunkedUpload(u,D,B,A=3){let F=0;if(A<1)throw RangeError("Bad maxConcurrentUploads parameter.");let w=u instanceof Buffer?void 0:Buffer.alloc(D),G,N,$=0;[G,N]=await x5(u,D,$,w),$+=N;let Z=new Set;while(N){let Y=G.slice(0,N);if(Y.length){let J=this.post(H5,{command:"APPEND",media_id:B,segment_index:F,media:Y},{prefix:b2});Z.add(J),J.then(()=>{Z.delete(J)}),F++}if(Z.size>=A)await Promise.race(Z);[G,N]=await x5(u,D,$,w),$+=N}await Promise.all([...Z])}}class BK extends t0{constructor(){super(...arguments);this._prefix=A0}get readWrite(){return this}sendDm({recipient_id:u,custom_profile_id:D,...B}){let A={event:{type:F0.Create,[F0.Create]:{target:{recipient_id:u},message_data:B}}};if(D)A.event[F0.Create].custom_profile_id=D;return this.post("direct_messages/events/new.json",A,{forceBodyMode:"json"})}getDmEvent(u){return this.get("direct_messages/events/show.json",{id:u})}deleteDm(u){return this.delete("direct_messages/events/destroy.json",{id:u})}async listDmEvents(u={}){let D={...u},B=await this.get("direct_messages/events/list.json",D,{fullResponse:!0});return new p8({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}newWelcomeDm(u,D){let B={[F0.WelcomeCreate]:{name:u,message_data:D}};return this.post("direct_messages/welcome_messages/new.json",B,{forceBodyMode:"json"})}getWelcomeDm(u){return this.get("direct_messages/welcome_messages/show.json",{id:u})}deleteWelcomeDm(u){return this.delete("direct_messages/welcome_messages/destroy.json",{id:u})}updateWelcomeDm(u,D){let B={message_data:D};return this.put("direct_messages/welcome_messages/update.json",B,{forceBodyMode:"json",query:{id:u}})}async listWelcomeDms(u={}){let D={...u},B=await this.get("direct_messages/welcome_messages/list.json",D,{fullResponse:!0});return new a8({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D})}newWelcomeDmRule(u){return this.post("direct_messages/welcome_messages/rules/new.json",{welcome_message_rule:{welcome_message_id:u}},{forceBodyMode:"json"})}getWelcomeDmRule(u){return this.get("direct_messages/welcome_messages/rules/show.json",{id:u})}deleteWelcomeDmRule(u){return this.delete("direct_messages/welcome_messages/rules/destroy.json",{id:u})}async listWelcomeDmRules(u={}){let D={...u};return this.get("direct_messages/welcome_messages/rules/list.json",D)}async setWelcomeDm(u,D=!0){var B;let A=await this.listWelcomeDmRules();if((B=A.welcome_message_rules)===null||B===void 0?void 0:B.length){for(let F of A.welcome_message_rules)if(await this.deleteWelcomeDmRule(F.id),D)await this.deleteWelcomeDm(F.welcome_message_id)}return this.newWelcomeDmRule(u)}markDmAsRead(u,D){return this.post("direct_messages/mark_read.json",{last_read_event_id:u,recipient_id:D},{forceBodyMode:"url"})}indicateDmTyping(u){return this.post("direct_messages/indicate_typing.json",{recipient_id:u},{forceBodyMode:"url"})}async downloadDmImage(u){if(typeof u!=="string"){let B=u[F0.Create].message_data.attachment;if(!B)throw Error("The given direct message doesn't contain any attachment");u=B.media.media_url_https}let D=await this.get(u,void 0,{forceParseMode:"buffer",prefix:""});if(!D.length)throw Error("Image not found. Make sure you are logged with credentials able to access direct messages, and check the URL.");return D}}var c3=BK;class q{constructor(u){this.result=u}get tweets(){return q.tweets(this.result)}static tweets(u){var D,B;return(B=(D=u.includes)===null||D===void 0?void 0:D.tweets)!==null&&B!==void 0?B:[]}tweetById(u){return q.tweetById(this.result,u)}static tweetById(u,D){return this.tweets(u).find((B)=>B.id===D)}retweet(u){return q.retweet(this.result,u)}static retweet(u,D){var B;let A=((B=D.referenced_tweets)!==null&&B!==void 0?B:[]).filter((F)=>F.type==="retweeted").map((F)=>F.id);return this.tweets(u).find((F)=>A.includes(F.id))}quote(u){return q.quote(this.result,u)}static quote(u,D){var B;let A=((B=D.referenced_tweets)!==null&&B!==void 0?B:[]).filter((F)=>F.type==="quoted").map((F)=>F.id);return this.tweets(u).find((F)=>A.includes(F.id))}repliedTo(u){return q.repliedTo(this.result,u)}static repliedTo(u,D){var B;let A=((B=D.referenced_tweets)!==null&&B!==void 0?B:[]).filter((F)=>F.type==="replied_to").map((F)=>F.id);return this.tweets(u).find((F)=>A.includes(F.id))}author(u){return q.author(this.result,u)}static author(u,D){let B=D.author_id;return B?this.users(u).find((A)=>A.id===B):void 0}repliedToAuthor(u){return q.repliedToAuthor(this.result,u)}static repliedToAuthor(u,D){let B=D.in_reply_to_user_id;return B?this.users(u).find((A)=>A.id===B):void 0}get users(){return q.users(this.result)}static users(u){var D,B;return(B=(D=u.includes)===null||D===void 0?void 0:D.users)!==null&&B!==void 0?B:[]}userById(u){return q.userById(this.result,u)}static userById(u,D){return this.users(u).find((B)=>B.id===D)}pinnedTweet(u){return q.pinnedTweet(this.result,u)}static pinnedTweet(u,D){return D.pinned_tweet_id?this.tweets(u).find((B)=>B.id===D.pinned_tweet_id):void 0}get media(){return q.media(this.result)}static media(u){var D,B;return(B=(D=u.includes)===null||D===void 0?void 0:D.media)!==null&&B!==void 0?B:[]}medias(u){return q.medias(this.result,u)}static medias(u,D){var B,A;let F=(A=(B=D.attachments)===null||B===void 0?void 0:B.media_keys)!==null&&A!==void 0?A:[];return this.media(u).filter((w)=>F.includes(w.media_key))}get polls(){return q.polls(this.result)}static polls(u){var D,B;return(B=(D=u.includes)===null||D===void 0?void 0:D.polls)!==null&&B!==void 0?B:[]}poll(u){return q.poll(this.result,u)}static poll(u,D){var B,A;let F=(A=(B=D.attachments)===null||B===void 0?void 0:B.poll_ids)!==null&&A!==void 0?A:[];if(F.length){let w=F[0];return this.polls(u).find((G)=>G.id===w)}return}get places(){return q.places(this.result)}static places(u){var D,B;return(B=(D=u.includes)===null||D===void 0?void 0:D.places)!==null&&B!==void 0?B:[]}place(u){return q.place(this.result,u)}static place(u,D){var B;let A=(B=D.geo)===null||B===void 0?void 0:B.place_id;return A?this.places(u).find((F)=>F.id===A):void 0}listOwner(u){return q.listOwner(this.result,u)}static listOwner(u,D){let B=D.owner_id;return B?this.users(u).find((A)=>A.id===B):void 0}spaceCreator(u){return q.spaceCreator(this.result,u)}static spaceCreator(u,D){let B=D.creator_id;return B?this.users(u).find((A)=>A.id===B):void 0}spaceHosts(u){return q.spaceHosts(this.result,u)}static spaceHosts(u,D){var B;let A=(B=D.host_ids)!==null&&B!==void 0?B:[];return this.users(u).filter((F)=>A.includes(F.id))}spaceSpeakers(u){return q.spaceSpeakers(this.result,u)}static spaceSpeakers(u,D){var B;let A=(B=D.speaker_ids)!==null&&B!==void 0?B:[];return this.users(u).filter((F)=>A.includes(F.id))}spaceInvitedUsers(u){return q.spaceInvitedUsers(this.result,u)}static spaceInvitedUsers(u,D){var B;let A=(B=D.invited_user_ids)!==null&&B!==void 0?B:[];return this.users(u).filter((F)=>A.includes(F.id))}}class V3 extends n8{updateIncludes(u){if(u.errors){if(!this._realData.errors)this._realData.errors=[];this._realData.errors=[...this._realData.errors,...u.errors]}if(!u.includes)return;if(!this._realData.includes)this._realData.includes={};let D=this._realData.includes;for(let[B,A]of Object.entries(u.includes)){if(!D[B])D[B]=[];D[B]=[...D[B],...A]}}assertUsable(){if(this.unusable)throw Error("Unable to use this paginator to fetch more data, as it does not contain any metadata. Check .errors property for more details.")}get meta(){return this._realData.meta}get includes(){var u;if(!((u=this._realData)===null||u===void 0?void 0:u.includes))return new q(this._realData);if(this._includesInstance)return this._includesInstance;return this._includesInstance=new q(this._realData)}get errors(){var u;return(u=this._realData.errors)!==null&&u!==void 0?u:[]}get unusable(){return this.errors.length>0&&!this._realData.meta&&!this._realData.data}}class m2 extends V3{refreshInstanceFromResult(u,D){var B;let A=u.data,F=(B=A.data)!==null&&B!==void 0?B:[];if(this._rateLimit=u.rateLimit,!this._realData.data)this._realData.data=[];if(D)this._realData.meta.result_count+=A.meta.result_count,this._realData.meta.next_token=A.meta.next_token,this._realData.data.push(...F);else this._realData.meta.result_count+=A.meta.result_count,this._realData.meta.previous_token=A.meta.previous_token,this._realData.data.unshift(...F);this.updateIncludes(A)}getNextQueryParams(u){return this.assertUsable(),{...this.injectQueryParams(u),pagination_token:this._realData.meta.next_token}}getPreviousQueryParams(u){return this.assertUsable(),{...this.injectQueryParams(u),pagination_token:this._realData.meta.previous_token}}getPageLengthFromRequest(u){var D,B;return(B=(D=u.data.data)===null||D===void 0?void 0:D.length)!==null&&B!==void 0?B:0}isFetchLastOver(u){var D;return!((D=u.data.data)===null||D===void 0?void 0:D.length)||!this.canFetchNextPage(u.data)}canFetchNextPage(u){var D;return!!((D=u.meta)===null||D===void 0?void 0:D.next_token)}}class R5 extends V3{refreshInstanceFromResult(u,D){var B;let A=u.data,F=(B=A.data)!==null&&B!==void 0?B:[];if(this._rateLimit=u.rateLimit,!this._realData.data)this._realData.data=[];if(D)this._realData.meta.oldest_id=A.meta.oldest_id,this._realData.meta.result_count+=A.meta.result_count,this._realData.meta.next_token=A.meta.next_token,this._realData.data.push(...F);else this._realData.meta.newest_id=A.meta.newest_id,this._realData.meta.result_count+=A.meta.result_count,this._realData.data.unshift(...F);this.updateIncludes(A)}getNextQueryParams(u){this.assertUsable();let D={...this.injectQueryParams(u)};if(this._realData.meta.next_token)D.next_token=this._realData.meta.next_token;else{if(D.start_time)D.since_id=this.dateStringToSnowflakeId(D.start_time),delete D.start_time;if(D.end_time)delete D.end_time;D.until_id=this._realData.meta.oldest_id}return D}getPreviousQueryParams(u){return this.assertUsable(),{...this.injectQueryParams(u),since_id:this._realData.meta.newest_id}}getPageLengthFromRequest(u){var D,B;return(B=(D=u.data.data)===null||D===void 0?void 0:D.length)!==null&&B!==void 0?B:0}isFetchLastOver(u){var D;return!((D=u.data.data)===null||D===void 0?void 0:D.length)||!this.canFetchNextPage(u.data)}canFetchNextPage(u){return!!u.meta.next_token}getItemArray(){return this.tweets}dateStringToSnowflakeId(u){let D=BigInt("1288834974657"),B=new Date(u);if(isNaN(B.valueOf()))throw Error("Unable to convert start_time/end_time to a valid date. A ISO 8601 DateTime is excepted, please check your input.");return(BigInt(B.valueOf())-D<<BigInt("22")).toString()}get tweets(){var u;return(u=this._realData.data)!==null&&u!==void 0?u:[]}get meta(){return super.meta}}class o0 extends m2{refreshInstanceFromResult(u,D){super.refreshInstanceFromResult(u,D);let B=u.data;if(D)this._realData.meta.oldest_id=B.meta.oldest_id;else this._realData.meta.newest_id=B.meta.newest_id}getItemArray(){return this.tweets}get tweets(){var u;return(u=this._realData.data)!==null&&u!==void 0?u:[]}get meta(){return super.meta}}class U5 extends R5{constructor(){super(...arguments);this._endpoint="tweets/search/recent"}}class M5 extends R5{constructor(){super(...arguments);this._endpoint="tweets/search/all"}}class L5 extends o0{constructor(){super(...arguments);this._endpoint="tweets/:id/quote_tweets"}}class E5 extends o0{constructor(){super(...arguments);this._endpoint="users/:id/timelines/reverse_chronological"}}class O5 extends o0{constructor(){super(...arguments);this._endpoint="users/:id/tweets"}}class C5 extends o0{constructor(){super(...arguments);this._endpoint="users/:id/mentions"}}class P5 extends o0{constructor(){super(...arguments);this._endpoint="users/:id/bookmarks"}}class c5 extends m2{get tweets(){var u;return(u=this._realData.data)!==null&&u!==void 0?u:[]}get meta(){return super.meta}getItemArray(){return this.tweets}}class V5 extends c5{constructor(){super(...arguments);this._endpoint="users/:id/liked_tweets"}}class k5 extends c5{constructor(){super(...arguments);this._endpoint="lists/:id/tweets"}}class j2 extends m2{getItemArray(){return this.users}get users(){var u;return(u=this._realData.data)!==null&&u!==void 0?u:[]}get meta(){return super.meta}}class y5 extends j2{constructor(){super(...arguments);this._endpoint="users/:id/blocking"}}class T5 extends j2{constructor(){super(...arguments);this._endpoint="users/:id/muting"}}class I5 extends j2{constructor(){super(...arguments);this._endpoint="users/:id/followers"}}class q5 extends j2{constructor(){super(...arguments);this._endpoint="users/:id/following"}}class _5 extends j2{constructor(){super(...arguments);this._endpoint="lists/:id/members"}}class m5 extends j2{constructor(){super(...arguments);this._endpoint="lists/:id/followers"}}class g5 extends j2{constructor(){super(...arguments);this._endpoint="tweets/:id/liking_users"}}class f5 extends j2{constructor(){super(...arguments);this._endpoint="tweets/:id/retweeted_by"}}class k3 extends m2{getItemArray(){return this.lists}get lists(){var u;return(u=this._realData.data)!==null&&u!==void 0?u:[]}get meta(){return super.meta}}class b5 extends k3{constructor(){super(...arguments);this._endpoint="users/:id/owned_lists"}}class j5 extends k3{constructor(){super(...arguments);this._endpoint="users/:id/list_memberships"}}class l5 extends k3{constructor(){super(...arguments);this._endpoint="users/:id/followed_lists"}}class e0 extends k2{constructor(){super(...arguments);this._prefix=d0}}class y3 extends m2{getItemArray(){return this.events}get events(){var u;return(u=this._realData.data)!==null&&u!==void 0?u:[]}get meta(){return super.meta}}class d5 extends y3{constructor(){super(...arguments);this._endpoint="dm_events"}}class i5 extends y3{constructor(){super(...arguments);this._endpoint="dm_conversations/with/:participant_id/dm_events"}}class r5 extends y3{constructor(){super(...arguments);this._endpoint="dm_conversations/:dm_conversation_id/dm_events"}}class uu extends k2{constructor(){super(...arguments);this._prefix=B0}get labs(){if(this._labs)return this._labs;return this._labs=new e0(this)}async search(u,D={}){let B=typeof u==="string"?{...D,query:u}:{...u},A=await this.get("tweets/search/recent",B,{fullResponse:!0});return new U5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:B})}async searchAll(u,D={}){let B={...D,query:u},A=await this.get("tweets/search/all",B,{fullResponse:!0});return new M5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:B})}singleTweet(u,D={}){return this.get("tweets/:id",D,{params:{id:u}})}tweets(u,D={}){return this.get("tweets",{ids:u,...D})}tweetCountRecent(u,D={}){return this.get("tweets/counts/recent",{query:u,...D})}tweetCountAll(u,D={}){return this.get("tweets/counts/all",{query:u,...D})}async tweetRetweetedBy(u,D={}){let{asPaginator:B,...A}=D,F=await this.get("tweets/:id/retweeted_by",A,{fullResponse:!0,params:{id:u}});if(!B)return F.data;return new f5({realData:F.data,rateLimit:F.rateLimit,instance:this,queryParams:A,sharedParams:{id:u}})}async tweetLikedBy(u,D={}){let{asPaginator:B,...A}=D,F=await this.get("tweets/:id/liking_users",A,{fullResponse:!0,params:{id:u}});if(!B)return F.data;return new g5({realData:F.data,rateLimit:F.rateLimit,instance:this,queryParams:A,sharedParams:{id:u}})}async homeTimeline(u={}){let D=await this.getCurrentUserV2Object(),B=await this.get("users/:id/timelines/reverse_chronological",u,{fullResponse:!0,params:{id:D.data.id}});return new E5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:u,sharedParams:{id:D.data.id}})}async userTimeline(u,D={}){let B=await this.get("users/:id/tweets",D,{fullResponse:!0,params:{id:u}});return new O5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D,sharedParams:{id:u}})}async userMentionTimeline(u,D={}){let B=await this.get("users/:id/mentions",D,{fullResponse:!0,params:{id:u}});return new C5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D,sharedParams:{id:u}})}async quotes(u,D={}){let B=await this.get("tweets/:id/quote_tweets",D,{fullResponse:!0,params:{id:u}});return new L5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:D,sharedParams:{id:u}})}async bookmarks(u={}){let D=await this.getCurrentUserV2Object(),B=await this.get("users/:id/bookmarks",u,{fullResponse:!0,params:{id:D.data.id}});return new P5({realData:B.data,rateLimit:B.rateLimit,instance:this,queryParams:u,sharedParams:{id:D.data.id}})}me(u={}){return this.get("users/me",u)}user(u,D={}){return this.get("users/:id",D,{params:{id:u}})}users(u,D={}){let B=Array.isArray(u)?u.join(","):u;return this.get("users",{...D,ids:B})}userByUsername(u,D={}){return this.get("users/by/username/:username",D,{params:{username:u}})}usersByUsernames(u,D={}){return u=Array.isArray(u)?u.join(","):u,this.get("users/by",{...D,usernames:u})}async followers(u,D={}){let{asPaginator:B,...A}=D,F={id:u};if(!B)return this.get("users/:id/followers",A,{params:F});let w=await this.get("users/:id/followers",A,{fullResponse:!0,params:F});return new I5({realData:w.data,rateLimit:w.rateLimit,instance:this,queryParams:A,sharedParams:F})}async following(u,D={}){let{asPaginator:B,...A}=D,F={id:u};if(!B)return this.get("users/:id/following",A,{params:F});let w=await this.get("users/:id/following",A,{fullResponse:!0,params:F});return new q5({realData:w.data,rateLimit:w.rateLimit,instance:this,queryParams:A,sharedParams:F})}async userLikedTweets(u,D={}){let B={id:u},A=await this.get("users/:id/liked_tweets",D,{fullResponse:!0,params:B});return new V5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:{...D},sharedParams:B})}async userBlockingUsers(u,D={}){let B={id:u},A=await this.get("users/:id/blocking",D,{fullResponse:!0,params:B});return new y5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:{...D},sharedParams:B})}async userMutingUsers(u,D={}){let B={id:u},A=await this.get("users/:id/muting",D,{fullResponse:!0,params:B});return new T5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:{...D},sharedParams:B})}list(u,D={}){return this.get("lists/:id",D,{params:{id:u}})}async listsOwned(u,D={}){let B={id:u},A=await this.get("users/:id/owned_lists",D,{fullResponse:!0,params:B});return new b5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:{...D},sharedParams:B})}async listMemberships(u,D={}){let B={id:u},A=await this.get("users/:id/list_memberships",D,{fullResponse:!0,params:B});return new j5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:{...D},sharedParams:B})}async listFollowed(u,D={}){let B={id:u},A=await this.get("users/:id/followed_lists",D,{fullResponse:!0,params:B});return new l5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:{...D},sharedParams:B})}async listTweets(u,D={}){let B={id:u},A=await this.get("lists/:id/tweets",D,{fullResponse:!0,params:B});return new k5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:{...D},sharedParams:B})}async listMembers(u,D={}){let B={id:u},A=await this.get("lists/:id/members",D,{fullResponse:!0,params:B});return new _5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:{...D},sharedParams:B})}async listFollowers(u,D={}){let B={id:u},A=await this.get("lists/:id/followers",D,{fullResponse:!0,params:B});return new m5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:{...D},sharedParams:B})}async listDmEvents(u={}){let D=await this.get("dm_events",u,{fullResponse:!0});return new d5({realData:D.data,rateLimit:D.rateLimit,instance:this,queryParams:{...u}})}async listDmEventsWithParticipant(u,D={}){let B={participant_id:u},A=await this.get("dm_conversations/with/:participant_id/dm_events",D,{fullResponse:!0,params:B});return new i5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:{...D},sharedParams:B})}async listDmEventsOfConversation(u,D={}){let B={dm_conversation_id:u},A=await this.get("dm_conversations/:dm_conversation_id/dm_events",D,{fullResponse:!0,params:B});return new r5({realData:A.data,rateLimit:A.rateLimit,instance:this,queryParams:{...D},sharedParams:B})}space(u,D={}){return this.get("spaces/:id",D,{params:{id:u}})}spaces(u,D={}){return this.get("spaces",{ids:u,...D})}spacesByCreators(u,D={}){return this.get("spaces/by/creator_ids",{user_ids:u,...D})}searchSpaces(u){return this.get("spaces/search",u)}spaceBuyers(u,D={}){return this.get("spaces/:id/buyers",D,{params:{id:u}})}spaceTweets(u,D={}){return this.get("spaces/:id/tweets",D,{params:{id:u}})}searchStream({autoConnect:u,...D}={}){return this.getStream("tweets/search/stream",D,{payloadIsError:U3,autoConnect:u})}streamRules(u={}){return this.get("tweets/search/stream/rules",u)}updateStreamRules(u,D={}){return this.post("tweets/search/stream/rules",u,{query:D})}sampleStream({autoConnect:u,...D}={}){return this.getStream("tweets/sample/stream",D,{payloadIsError:U3,autoConnect:u})}sample10Stream({autoConnect:u,...D}={}){return this.getStream("tweets/sample10/stream",D,{payloadIsError:U3,autoConnect:u})}complianceJobs(u){return this.get("compliance/jobs",u)}complianceJob(u){return this.get("compliance/jobs/:id",void 0,{params:{id:u}})}async sendComplianceJob(u){let D=await this.post("compliance/jobs",{type:u.type,name:u.name}),B=u.ids instanceof Buffer?u.ids:Buffer.from(u.ids.join(`
72
72
  `));return await this.put(D.data.upload_url,B,{forceBodyMode:"raw",enableAuth:!1,headers:{"Content-Type":"text/plain"},prefix:""}),D}async complianceJobResult(u){let D=u;while(D.status!=="complete"){if(D.status==="expired"||D.status==="failed")throw Error("Job failed to be completed.");await new Promise((A)=>setTimeout(A,3500)),D=(await this.complianceJob(u.id)).data}return(await this.get(u.download_url,void 0,{enableAuth:!1,prefix:""})).trim().split(`
73
- `).filter((A)=>A).map((A)=>JSON.parse(A))}async usage(u={}){return this.get("usage/tweets",u)}community(u,D={}){return this.get("communities/:id",D,{params:{id:u}})}searchCommunities(u,D={}){return this.get("communities/search",{query:u,...D})}}class Du extends e0{constructor(){super(...arguments);this._prefix=d0}get readOnly(){return this}}class Bu extends uu{constructor(){super(...arguments);this._prefix=B0}get readOnly(){return this}get labs(){if(this._labs)return this._labs;return this._labs=new Du(this)}hideReply(u,D){return this.put("tweets/:id/hidden",{hidden:D},{params:{id:u}})}like(u,D){return this.post("users/:id/likes",{tweet_id:D},{params:{id:u}})}unlike(u,D){return this.delete("users/:id/likes/:tweet_id",void 0,{params:{id:u,tweet_id:D}})}retweet(u,D){return this.post("users/:id/retweets",{tweet_id:D},{params:{id:u}})}unretweet(u,D){return this.delete("users/:id/retweets/:tweet_id",void 0,{params:{id:u,tweet_id:D}})}tweet(u,D={}){if(typeof u==="object")D=u;else D={text:u,...D};return this.post("tweets",D)}async uploadMedia(u,D,B=1048576){let A=D.media_category;if(!D.media_category){if(D.media_type.includes("gif"))A="tweet_gif";else if(D.media_type.includes("image"))A="tweet_image";else if(D.media_type.includes("video"))A="tweet_video"}let F={additional_owners:D.additional_owners,media_type:D.media_type,total_bytes:u.length,media_category:A},G=(await this.post("media/upload/initialize",F)).data.id,N=Math.ceil(u.length/B),$=new Uint8Array(u);for(let v=0;v<N;v++){let J=v*B,Q=Math.min(J+B,u.length),X=$.slice(J,Q),W=Buffer.from(X),L={segment_index:v,media:W};await this.post(`media/upload/${G}/append`,L,{forceBodyMode:"form-data"})}if((await this.post(`media/upload/${G}/finalize`)).data.processing_info)await this.waitForMediaProcessing(G);return G}async waitForMediaProcessing(u){var D;let A=(await this.get("media/upload",{command:"STATUS",media_id:u})).data.processing_info;if(!A)return;switch(A.state){case"succeeded":return;case"failed":throw Error(`Media processing failed: ${(D=A.error)===null||D===void 0?void 0:D.message}`);case"pending":case"in_progress":{let F=A===null||A===void 0?void 0:A.check_after_secs;if(F&&F>0)await new Promise((w)=>setTimeout(w,F*1000)),await this.waitForMediaProcessing(u)}}}createMediaMetadata(u,D){return this.post("media/metadata",{id:u,metadata:D})}reply(u,D,B={}){var A;let F={in_reply_to_tweet_id:D,...(A=B.reply)!==null&&A!==void 0?A:{}};return this.post("tweets",{text:u,...B,reply:F})}quote(u,D,B={}){return this.tweet(u,{...B,quote_tweet_id:D})}async tweetThread(u){var D,B;let A=[];for(let F of u){let w=A.length?A[A.length-1]:null,G={...typeof F==="string"?{text:F}:F},N=w?w.data.id:(D=G.reply)===null||D===void 0?void 0:D.in_reply_to_tweet_id,$=(B=G.text)!==null&&B!==void 0?B:"";if(N)A.push(await this.reply($,N,G));else A.push(await this.tweet($,G))}return A}deleteTweet(u){return this.delete("tweets/:id",void 0,{params:{id:u}})}async bookmark(u){let D=await this.getCurrentUserV2Object();return this.post("users/:id/bookmarks",{tweet_id:u},{params:{id:D.data.id}})}async deleteBookmark(u){let D=await this.getCurrentUserV2Object();return this.delete("users/:id/bookmarks/:tweet_id",void 0,{params:{id:D.data.id,tweet_id:u}})}follow(u,D){return this.post("users/:id/following",{target_user_id:D},{params:{id:u}})}unfollow(u,D){return this.delete("users/:source_user_id/following/:target_user_id",void 0,{params:{source_user_id:u,target_user_id:D}})}block(u,D){return this.post("users/:id/blocking",{target_user_id:D},{params:{id:u}})}unblock(u,D){return this.delete("users/:source_user_id/blocking/:target_user_id",void 0,{params:{source_user_id:u,target_user_id:D}})}mute(u,D){return this.post("users/:id/muting",{target_user_id:D},{params:{id:u}})}unmute(u,D){return this.delete("users/:source_user_id/muting/:target_user_id",void 0,{params:{source_user_id:u,target_user_id:D}})}createList(u){return this.post("lists",u)}updateList(u,D={}){return this.put("lists/:id",D,{params:{id:u}})}removeList(u){return this.delete("lists/:id",void 0,{params:{id:u}})}addListMember(u,D){return this.post("lists/:id/members",{user_id:D},{params:{id:u}})}removeListMember(u,D){return this.delete("lists/:id/members/:user_id",void 0,{params:{id:u,user_id:D}})}subscribeToList(u,D){return this.post("users/:id/followed_lists",{list_id:D},{params:{id:u}})}unsubscribeOfList(u,D){return this.delete("users/:id/followed_lists/:list_id",void 0,{params:{id:u,list_id:D}})}pinList(u,D){return this.post("users/:id/pinned_lists",{list_id:D},{params:{id:u}})}unpinList(u,D){return this.delete("users/:id/pinned_lists/:list_id",void 0,{params:{id:u,list_id:D}})}sendDmInConversation(u,D){return this.post("dm_conversations/:dm_conversation_id/messages",D,{params:{dm_conversation_id:u}})}sendDmToParticipant(u,D){return this.post("dm_conversations/with/:participant_id/messages",D,{params:{participant_id:u}})}createDmConversation(u){return this.post("dm_conversations",u)}}class AK extends Du{constructor(){super(...arguments);this._prefix=d0}get readWrite(){return this}}var FK=AK;class wK extends Bu{constructor(){super(...arguments);this._prefix=B0}get readWrite(){return this}get labs(){if(this._labs)return this._labs;return this._labs=new FK(this)}}var GK=wK;class fu extends w0{get v1(){if(this._v1)return this._v1;return this._v1=new s0(this)}get v2(){if(this._v2)return this._v2;return this._v2=new uu(this)}async currentUser(u=!1){return await this.getCurrentUserObject(u)}async currentUserV2(u=!1){return await this.getCurrentUserV2Object(u)}search(u,D){return this.v2.search(u,D)}async generateAuthLink(u="oob",{authAccessType:D,linkMode:B="authenticate",forceLogin:A,screenName:F}={}){let w=await this.post("https://api.x.com/oauth/request_token",{oauth_callback:u,x_auth_access_type:D}),G=`https://api.x.com/oauth/${B}?oauth_token=${encodeURIComponent(w.oauth_token)}`;if(A!==void 0)G+=`&force_login=${encodeURIComponent(A)}`;if(F!==void 0)G+=`&screen_name=${encodeURIComponent(F)}`;if(this._requestMaker.hasPlugins())this._requestMaker.applyPluginMethod("onOAuth1RequestToken",{client:this._requestMaker,url:G,oauthResult:w});return{url:G,...w}}async login(u){let D=this.getActiveTokens();if(D.type!=="oauth-1.0a")throw Error("You must setup TwitterApi instance with consumer keys to accept OAuth 1.0 login");let B=await this.post("https://api.x.com/oauth/access_token",{oauth_token:D.accessToken,oauth_verifier:u}),A=new this.constructor({appKey:D.appKey,appSecret:D.appSecret,accessToken:B.oauth_token,accessSecret:B.oauth_token_secret},this._requestMaker.clientSettings);return{accessToken:B.oauth_token,accessSecret:B.oauth_token_secret,userId:B.user_id,screenName:B.screen_name,client:A}}async appLogin(){let u=this.getActiveTokens();if(u.type!=="oauth-1.0a")throw Error("You must setup TwitterApi instance with consumer keys to accept app-only login");let B=await new this.constructor({username:u.appKey,password:u.appSecret},this._requestMaker.clientSettings).post("https://api.x.com/oauth2/token",{grant_type:"client_credentials"});return new this.constructor(B.access_token,this._requestMaker.clientSettings)}generateOAuth2AuthLink(u,D={}){var B,A;if(!this._requestMaker.clientId)throw Error("Twitter API instance is not initialized with client ID. You can find your client ID in Twitter Developer Portal. Please build an instance with: new TwitterApi({ clientId: '<yourClientId>' })");let F=(B=D.state)!==null&&B!==void 0?B:K0.generateRandomString(32),w=K0.getCodeVerifier(),G=K0.getCodeChallengeFromVerifier(w),N=(A=D.scope)!==null&&A!==void 0?A:"",$=Array.isArray(N)?N.join(" "):N,Z=new URL("https://x.com/i/oauth2/authorize"),v={response_type:"code",client_id:this._requestMaker.clientId,redirect_uri:u,state:F,code_challenge:G,code_challenge_method:"s256",scope:$};V2.addQueryParamsToUrl(Z,v);let J={url:Z.toString(),state:F,codeVerifier:w,codeChallenge:G};if(this._requestMaker.hasPlugins())this._requestMaker.applyPluginMethod("onOAuth2RequestToken",{client:this._requestMaker,result:J,redirectUri:u});return J}async loginWithOAuth2({code:u,codeVerifier:D,redirectUri:B}){if(!this._requestMaker.clientId)throw Error("Twitter API instance is not initialized with client ID. Please build an instance with: new TwitterApi({ clientId: '<yourClientId>' })");let A=await this.post("https://api.x.com/2/oauth2/token",{code:u,code_verifier:D,redirect_uri:B,grant_type:"authorization_code",client_id:this._requestMaker.clientId,client_secret:this._requestMaker.clientSecret});return this.parseOAuth2AccessTokenResult(A)}async refreshOAuth2Token(u){if(!this._requestMaker.clientId)throw Error("Twitter API instance is not initialized with client ID. Please build an instance with: new TwitterApi({ clientId: '<yourClientId>' })");let D=await this.post("https://api.x.com/2/oauth2/token",{refresh_token:u,grant_type:"refresh_token",client_id:this._requestMaker.clientId,client_secret:this._requestMaker.clientSecret});return this.parseOAuth2AccessTokenResult(D)}async revokeOAuth2Token(u,D="access_token"){if(!this._requestMaker.clientId)throw Error("Twitter API instance is not initialized with client ID. Please build an instance with: new TwitterApi({ clientId: '<yourClientId>' })");return await this.post("https://api.x.com/2/oauth2/revoke",{client_id:this._requestMaker.clientId,client_secret:this._requestMaker.clientSecret,token:u,token_type_hint:D})}parseOAuth2AccessTokenResult(u){let D=new this.constructor(u.access_token,this._requestMaker.clientSettings),B=u.scope.split(" ").filter((A)=>A);return{client:D,expiresIn:u.expires_in,accessToken:u.access_token,scope:B,refreshToken:u.refresh_token}}}class bu extends fu{get v1(){if(this._v1)return this._v1;return this._v1=new t0(this)}get v2(){if(this._v2)return this._v2;return this._v2=new Bu(this)}get readOnly(){return this}}class T3 extends k2{constructor(){super(...arguments);this._prefix=i0}}class I3 extends T3{constructor(){super(...arguments);this._prefix=i0}get readOnly(){return this}}class q3 extends k2{constructor(){super(...arguments);this._prefix=r0}}class m3 extends q3{constructor(){super(...arguments);this._prefix=r0}get readOnly(){return this}}class NK extends m3{constructor(){super(...arguments);this._prefix=r0}get readWrite(){return this}}var $K=NK;class zK extends I3{constructor(){super(...arguments);this._prefix=i0}get readWrite(){return this}get sandbox(){if(this._sandbox)return this._sandbox;return this._sandbox=new $K(this)}}var ZK=zK;class n5 extends bu{get v1(){if(this._v1)return this._v1;return this._v1=new c3(this)}get v2(){if(this._v2)return this._v2;return this._v2=new GK(this)}get readWrite(){return this}get ads(){if(this._ads)return this._ads;return this._ads=new ZK(this)}static getErrors(u){var D;if(typeof u!=="object")return[];if(!("data"in u))return[];return(D=u.data.errors)!==null&&D!==void 0?D:[]}static getProfileImageInSize(u,D){let B=u.split("/").pop(),A=["normal","bigger","mini"],F=u;for(let G of A)if(B.includes(`_${G}`)){F=u.replace(`_${G}`,"");break}if(D==="original")return F;let w=F.lastIndexOf(".");if(w!==-1){let G=F.slice(w+1);return F.slice(0,w)+"_"+D+"."+G}else return F+"_"+D}}var jU={clientId:process.env.X_CLIENT_ID,clientSecret:process.env.X_SECRET,redirectPath:"/auth/oauth/x/callback",scope:["tweet.read","users.read","offline.access"]};class QK extends l0{config;client;oauthStates=new Map;constructor(u={}){super();this.config={...jU,...u},this.client=new n5({clientId:this.config.clientId,clientSecret:this.config.clientSecret})}getRedirectUrl(){let{url:u,codeVerifier:D,state:B}=this.client.generateOAuth2AuthLink(`${process.env.HOST_NAME}${this.config.redirectPath}`,{scope:this.config.scope});return this.oauthStates.set(B,{state:B,codeVerifier:D}),JK.to(u),u}async onCallback(u){let D=u.search.get("code"),B=u.search.get("state"),A=this.oauthStates.get(B);if(!A)throw Error("Invalid or expired OAuth state");let F=await this.client.loginWithOAuth2({code:D,codeVerifier:A.codeVerifier,redirectUri:`${process.env.HOST_NAME}${this.config.redirectPath}`});this.oauthStates.delete(B);let{data:w}=await F.client.v2.me({"user.fields":["name","username","entities"]}),{name:G,email:N,id:$="",username:Z}=w??{};return{name:G,email:N,username:Z,providerId:$}}}class vK extends f{kernel;jobs=[];constructor(u){super();this.kernel=u}boot(){}}class XK{name;cron;callback(){}onTick(){}onComplete(){}static exp(u){return u}}class YK extends f{url=process.env.REDIS_URL;options;boot(){}}class p5 extends WK{service;static _name="SingletonServiceContainer";constructor(u){super();this.service=u}}class KK{static use(){let u=p5.use().service;if(u.services.has(this.name))return u.services.get(this.name);let D=new this;return u.services.set(this.name,D),D}}export{l2 as oa,lu as pa,a5 as qa,VW as ra,yB as sa,IB as ta,y0 as ua,p1 as va,qB as wa,_B as xa,K3 as ya,h3 as za,CW as Aa,PW as Ba,cW as Ca,kW as Da,yW as Ea,IW as Fa,x3 as Ga,H3 as Ha,qW as Ia,l0 as Ja,mW as Ka,QK as La,vK as Ma,XK as Na,YK as Oa,p5 as Pa,KK as Qa};
73
+ `).filter((A)=>A).map((A)=>JSON.parse(A))}async usage(u={}){return this.get("usage/tweets",u)}community(u,D={}){return this.get("communities/:id",D,{params:{id:u}})}searchCommunities(u,D={}){return this.get("communities/search",{query:u,...D})}}class Du extends e0{constructor(){super(...arguments);this._prefix=d0}get readOnly(){return this}}class Bu extends uu{constructor(){super(...arguments);this._prefix=B0}get readOnly(){return this}get labs(){if(this._labs)return this._labs;return this._labs=new Du(this)}hideReply(u,D){return this.put("tweets/:id/hidden",{hidden:D},{params:{id:u}})}like(u,D){return this.post("users/:id/likes",{tweet_id:D},{params:{id:u}})}unlike(u,D){return this.delete("users/:id/likes/:tweet_id",void 0,{params:{id:u,tweet_id:D}})}retweet(u,D){return this.post("users/:id/retweets",{tweet_id:D},{params:{id:u}})}unretweet(u,D){return this.delete("users/:id/retweets/:tweet_id",void 0,{params:{id:u,tweet_id:D}})}tweet(u,D={}){if(typeof u==="object")D=u;else D={text:u,...D};return this.post("tweets",D)}async uploadMedia(u,D,B=1048576){let A=D.media_category;if(!D.media_category){if(D.media_type.includes("gif"))A="tweet_gif";else if(D.media_type.includes("image"))A="tweet_image";else if(D.media_type.includes("video"))A="tweet_video"}let F={additional_owners:D.additional_owners,media_type:D.media_type,total_bytes:u.length,media_category:A},G=(await this.post("media/upload/initialize",F)).data.id,N=Math.ceil(u.length/B),$=new Uint8Array(u);for(let Y=0;Y<N;Y++){let J=Y*B,Q=Math.min(J+B,u.length),X=$.slice(J,Q),v=Buffer.from(X),L={segment_index:Y,media:v};await this.post(`media/upload/${G}/append`,L,{forceBodyMode:"form-data"})}if((await this.post(`media/upload/${G}/finalize`)).data.processing_info)await this.waitForMediaProcessing(G);return G}async waitForMediaProcessing(u){var D;let A=(await this.get("media/upload",{command:"STATUS",media_id:u})).data.processing_info;if(!A)return;switch(A.state){case"succeeded":return;case"failed":throw Error(`Media processing failed: ${(D=A.error)===null||D===void 0?void 0:D.message}`);case"pending":case"in_progress":{let F=A===null||A===void 0?void 0:A.check_after_secs;if(F&&F>0)await new Promise((w)=>setTimeout(w,F*1000)),await this.waitForMediaProcessing(u)}}}createMediaMetadata(u,D){return this.post("media/metadata",{id:u,metadata:D})}reply(u,D,B={}){var A;let F={in_reply_to_tweet_id:D,...(A=B.reply)!==null&&A!==void 0?A:{}};return this.post("tweets",{text:u,...B,reply:F})}quote(u,D,B={}){return this.tweet(u,{...B,quote_tweet_id:D})}async tweetThread(u){var D,B;let A=[];for(let F of u){let w=A.length?A[A.length-1]:null,G={...typeof F==="string"?{text:F}:F},N=w?w.data.id:(D=G.reply)===null||D===void 0?void 0:D.in_reply_to_tweet_id,$=(B=G.text)!==null&&B!==void 0?B:"";if(N)A.push(await this.reply($,N,G));else A.push(await this.tweet($,G))}return A}deleteTweet(u){return this.delete("tweets/:id",void 0,{params:{id:u}})}async bookmark(u){let D=await this.getCurrentUserV2Object();return this.post("users/:id/bookmarks",{tweet_id:u},{params:{id:D.data.id}})}async deleteBookmark(u){let D=await this.getCurrentUserV2Object();return this.delete("users/:id/bookmarks/:tweet_id",void 0,{params:{id:D.data.id,tweet_id:u}})}follow(u,D){return this.post("users/:id/following",{target_user_id:D},{params:{id:u}})}unfollow(u,D){return this.delete("users/:source_user_id/following/:target_user_id",void 0,{params:{source_user_id:u,target_user_id:D}})}block(u,D){return this.post("users/:id/blocking",{target_user_id:D},{params:{id:u}})}unblock(u,D){return this.delete("users/:source_user_id/blocking/:target_user_id",void 0,{params:{source_user_id:u,target_user_id:D}})}mute(u,D){return this.post("users/:id/muting",{target_user_id:D},{params:{id:u}})}unmute(u,D){return this.delete("users/:source_user_id/muting/:target_user_id",void 0,{params:{source_user_id:u,target_user_id:D}})}createList(u){return this.post("lists",u)}updateList(u,D={}){return this.put("lists/:id",D,{params:{id:u}})}removeList(u){return this.delete("lists/:id",void 0,{params:{id:u}})}addListMember(u,D){return this.post("lists/:id/members",{user_id:D},{params:{id:u}})}removeListMember(u,D){return this.delete("lists/:id/members/:user_id",void 0,{params:{id:u,user_id:D}})}subscribeToList(u,D){return this.post("users/:id/followed_lists",{list_id:D},{params:{id:u}})}unsubscribeOfList(u,D){return this.delete("users/:id/followed_lists/:list_id",void 0,{params:{id:u,list_id:D}})}pinList(u,D){return this.post("users/:id/pinned_lists",{list_id:D},{params:{id:u}})}unpinList(u,D){return this.delete("users/:id/pinned_lists/:list_id",void 0,{params:{id:u,list_id:D}})}sendDmInConversation(u,D){return this.post("dm_conversations/:dm_conversation_id/messages",D,{params:{dm_conversation_id:u}})}sendDmToParticipant(u,D){return this.post("dm_conversations/with/:participant_id/messages",D,{params:{participant_id:u}})}createDmConversation(u){return this.post("dm_conversations",u)}}class AK extends Du{constructor(){super(...arguments);this._prefix=d0}get readWrite(){return this}}var FK=AK;class wK extends Bu{constructor(){super(...arguments);this._prefix=B0}get readWrite(){return this}get labs(){if(this._labs)return this._labs;return this._labs=new FK(this)}}var GK=wK;class fu extends w0{get v1(){if(this._v1)return this._v1;return this._v1=new s0(this)}get v2(){if(this._v2)return this._v2;return this._v2=new uu(this)}async currentUser(u=!1){return await this.getCurrentUserObject(u)}async currentUserV2(u=!1){return await this.getCurrentUserV2Object(u)}search(u,D){return this.v2.search(u,D)}async generateAuthLink(u="oob",{authAccessType:D,linkMode:B="authenticate",forceLogin:A,screenName:F}={}){let w=await this.post("https://api.x.com/oauth/request_token",{oauth_callback:u,x_auth_access_type:D}),G=`https://api.x.com/oauth/${B}?oauth_token=${encodeURIComponent(w.oauth_token)}`;if(A!==void 0)G+=`&force_login=${encodeURIComponent(A)}`;if(F!==void 0)G+=`&screen_name=${encodeURIComponent(F)}`;if(this._requestMaker.hasPlugins())this._requestMaker.applyPluginMethod("onOAuth1RequestToken",{client:this._requestMaker,url:G,oauthResult:w});return{url:G,...w}}async login(u){let D=this.getActiveTokens();if(D.type!=="oauth-1.0a")throw Error("You must setup TwitterApi instance with consumer keys to accept OAuth 1.0 login");let B=await this.post("https://api.x.com/oauth/access_token",{oauth_token:D.accessToken,oauth_verifier:u}),A=new this.constructor({appKey:D.appKey,appSecret:D.appSecret,accessToken:B.oauth_token,accessSecret:B.oauth_token_secret},this._requestMaker.clientSettings);return{accessToken:B.oauth_token,accessSecret:B.oauth_token_secret,userId:B.user_id,screenName:B.screen_name,client:A}}async appLogin(){let u=this.getActiveTokens();if(u.type!=="oauth-1.0a")throw Error("You must setup TwitterApi instance with consumer keys to accept app-only login");let B=await new this.constructor({username:u.appKey,password:u.appSecret},this._requestMaker.clientSettings).post("https://api.x.com/oauth2/token",{grant_type:"client_credentials"});return new this.constructor(B.access_token,this._requestMaker.clientSettings)}generateOAuth2AuthLink(u,D={}){var B,A;if(!this._requestMaker.clientId)throw Error("Twitter API instance is not initialized with client ID. You can find your client ID in Twitter Developer Portal. Please build an instance with: new TwitterApi({ clientId: '<yourClientId>' })");let F=(B=D.state)!==null&&B!==void 0?B:K0.generateRandomString(32),w=K0.getCodeVerifier(),G=K0.getCodeChallengeFromVerifier(w),N=(A=D.scope)!==null&&A!==void 0?A:"",$=Array.isArray(N)?N.join(" "):N,Z=new URL("https://x.com/i/oauth2/authorize"),Y={response_type:"code",client_id:this._requestMaker.clientId,redirect_uri:u,state:F,code_challenge:G,code_challenge_method:"s256",scope:$};V2.addQueryParamsToUrl(Z,Y);let J={url:Z.toString(),state:F,codeVerifier:w,codeChallenge:G};if(this._requestMaker.hasPlugins())this._requestMaker.applyPluginMethod("onOAuth2RequestToken",{client:this._requestMaker,result:J,redirectUri:u});return J}async loginWithOAuth2({code:u,codeVerifier:D,redirectUri:B}){if(!this._requestMaker.clientId)throw Error("Twitter API instance is not initialized with client ID. Please build an instance with: new TwitterApi({ clientId: '<yourClientId>' })");let A=await this.post("https://api.x.com/2/oauth2/token",{code:u,code_verifier:D,redirect_uri:B,grant_type:"authorization_code",client_id:this._requestMaker.clientId,client_secret:this._requestMaker.clientSecret});return this.parseOAuth2AccessTokenResult(A)}async refreshOAuth2Token(u){if(!this._requestMaker.clientId)throw Error("Twitter API instance is not initialized with client ID. Please build an instance with: new TwitterApi({ clientId: '<yourClientId>' })");let D=await this.post("https://api.x.com/2/oauth2/token",{refresh_token:u,grant_type:"refresh_token",client_id:this._requestMaker.clientId,client_secret:this._requestMaker.clientSecret});return this.parseOAuth2AccessTokenResult(D)}async revokeOAuth2Token(u,D="access_token"){if(!this._requestMaker.clientId)throw Error("Twitter API instance is not initialized with client ID. Please build an instance with: new TwitterApi({ clientId: '<yourClientId>' })");return await this.post("https://api.x.com/2/oauth2/revoke",{client_id:this._requestMaker.clientId,client_secret:this._requestMaker.clientSecret,token:u,token_type_hint:D})}parseOAuth2AccessTokenResult(u){let D=new this.constructor(u.access_token,this._requestMaker.clientSettings),B=u.scope.split(" ").filter((A)=>A);return{client:D,expiresIn:u.expires_in,accessToken:u.access_token,scope:B,refreshToken:u.refresh_token}}}class bu extends fu{get v1(){if(this._v1)return this._v1;return this._v1=new t0(this)}get v2(){if(this._v2)return this._v2;return this._v2=new Bu(this)}get readOnly(){return this}}class T3 extends k2{constructor(){super(...arguments);this._prefix=i0}}class I3 extends T3{constructor(){super(...arguments);this._prefix=i0}get readOnly(){return this}}class q3 extends k2{constructor(){super(...arguments);this._prefix=r0}}class _3 extends q3{constructor(){super(...arguments);this._prefix=r0}get readOnly(){return this}}class NK extends _3{constructor(){super(...arguments);this._prefix=r0}get readWrite(){return this}}var $K=NK;class zK extends I3{constructor(){super(...arguments);this._prefix=i0}get readWrite(){return this}get sandbox(){if(this._sandbox)return this._sandbox;return this._sandbox=new $K(this)}}var ZK=zK;class n5 extends bu{get v1(){if(this._v1)return this._v1;return this._v1=new c3(this)}get v2(){if(this._v2)return this._v2;return this._v2=new GK(this)}get readWrite(){return this}get ads(){if(this._ads)return this._ads;return this._ads=new ZK(this)}static getErrors(u){var D;if(typeof u!=="object")return[];if(!("data"in u))return[];return(D=u.data.errors)!==null&&D!==void 0?D:[]}static getProfileImageInSize(u,D){let B=u.split("/").pop(),A=["normal","bigger","mini"],F=u;for(let G of A)if(B.includes(`_${G}`)){F=u.replace(`_${G}`,"");break}if(D==="original")return F;let w=F.lastIndexOf(".");if(w!==-1){let G=F.slice(w+1);return F.slice(0,w)+"_"+D+"."+G}else return F+"_"+D}}var jU={clientId:process.env.X_CLIENT_ID,clientSecret:process.env.X_SECRET,redirectPath:"/auth/oauth/x/callback",scope:["tweet.read","users.read","offline.access"]};class QK extends l0{config;client;oauthStates=new Map;constructor(u={}){super();this.config={...jU,...u},this.client=new n5({clientId:this.config.clientId,clientSecret:this.config.clientSecret})}getRedirectUrl(){let{url:u,codeVerifier:D,state:B}=this.client.generateOAuth2AuthLink(`${process.env.HOST_NAME}${this.config.redirectPath}`,{scope:this.config.scope});return this.oauthStates.set(B,{state:B,codeVerifier:D}),JK.to(u),u}async onCallback(u){let D=u.search.get("code"),B=u.search.get("state"),A=this.oauthStates.get(B);if(!A)throw Error("Invalid or expired OAuth state");let F=await this.client.loginWithOAuth2({code:D,codeVerifier:A.codeVerifier,redirectUri:`${process.env.HOST_NAME}${this.config.redirectPath}`});this.oauthStates.delete(B);let{data:w}=await F.client.v2.me({"user.fields":["name","username","entities"]}),{name:G,email:N,id:$="",username:Z}=w??{};return{name:G,email:N,username:Z,providerId:$}}}class YK extends f{kernel;jobs=[];constructor(u){super();this.kernel=u}boot(){}}class XK{name;cron;callback(){}onTick(){}onComplete(){}static exp(u){return u}}class WK extends f{url=process.env.REDIS_URL;options;boot(){}}class p5 extends vK{service;static _name="SingletonServiceContainer";constructor(u){super();this.service=u}}class KK{static use(){let u=p5.use().service;if(u.services.has(this.name))return u.services.get(this.name);let D=new this;return u.services.set(this.name,D),D}}export{l2 as oa,lu as pa,a5 as qa,Vv as ra,yB as sa,IB as ta,y0 as ua,p1 as va,qB as wa,mB as xa,K3 as ya,h3 as za,Cv as Aa,Pv as Ba,cv as Ca,kv as Da,yv as Ea,Iv as Fa,x3 as Ga,H3 as Ha,qv as Ia,l0 as Ja,_v as Ka,QK as La,YK as Ma,XK as Na,WK as Oa,p5 as Pa,KK as Qa};
74
74
 
75
- //# debugId=206E2A9D422CC72D64756E2164756E21
75
+ //# debugId=35BF56706E51C2E564756E2164756E21