@stacksjs/ts-cloud 0.16.79 → 0.16.81

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 (181) hide show
  1. package/dist/aws/index.js +1 -1
  2. package/dist/bin/{chunk-nbffypj8.js → chunk-08sws53b.js} +3 -3
  3. package/dist/bin/{chunk-vgcscxh1.js → chunk-0z3n1v9g.js} +3 -3
  4. package/dist/bin/{chunk-6xx24qev.js → chunk-19mhwmfp.js} +1 -1
  5. package/dist/bin/chunk-1qez75tb.js +1 -0
  6. package/dist/bin/chunk-1rrmswhq.js +1 -0
  7. package/dist/bin/{chunk-gqstb8zn.js → chunk-1wgyq50e.js} +1 -1
  8. package/dist/bin/{chunk-0r8k7qth.js → chunk-20rfyk4x.js} +4 -4
  9. package/dist/bin/{chunk-rdqcr78z.js → chunk-35325988.js} +2 -2
  10. package/dist/bin/chunk-3rjer1mp.js +1 -0
  11. package/dist/bin/{chunk-06hwds44.js → chunk-3wvpgb8m.js} +3 -3
  12. package/dist/bin/{chunk-jcehsvnm.js → chunk-462swbg5.js} +13 -13
  13. package/dist/bin/chunk-4c4q96vm.js +1 -0
  14. package/dist/bin/chunk-5hmrqjmq.js +1 -0
  15. package/dist/bin/chunk-5tzygzdy.js +1 -0
  16. package/dist/bin/{chunk-e12679p1.js → chunk-69mejej3.js} +1 -1
  17. package/dist/bin/{chunk-hyrvmjq0.js → chunk-6b6yr784.js} +2 -2
  18. package/dist/bin/chunk-6ybjfjbc.js +1 -0
  19. package/dist/bin/chunk-7848wre2.js +1 -0
  20. package/dist/bin/chunk-7haewmr7.js +1 -0
  21. package/dist/bin/chunk-7yhy2a7h.js +1 -0
  22. package/dist/bin/{chunk-k3cyh23p.js → chunk-83tt2t15.js} +5 -5
  23. package/dist/bin/{chunk-y5gx3dq2.js → chunk-89v3ec9n.js} +1 -1
  24. package/dist/bin/{chunk-33shhgye.js → chunk-8rkfwgb4.js} +7 -7
  25. package/dist/bin/{chunk-p35e4j11.js → chunk-9gp8p8hv.js} +2 -2
  26. package/dist/bin/chunk-9zwvysdn.js +1 -0
  27. package/dist/bin/{chunk-hhbmtgkq.js → chunk-b1cb27m8.js} +6 -6
  28. package/dist/bin/chunk-b9ersj22.js +1 -0
  29. package/dist/bin/{chunk-gbbcp2bw.js → chunk-bkx2kapc.js} +2 -2
  30. package/dist/bin/{chunk-540wkkhs.js → chunk-btrxye8p.js} +5 -5
  31. package/dist/bin/chunk-byqyjckv.js +11 -0
  32. package/dist/bin/chunk-ce4mbne7.js +1 -0
  33. package/dist/bin/{chunk-9ktyfegk.js → chunk-cgyk48s5.js} +1 -1
  34. package/dist/bin/{chunk-th05q1gs.js → chunk-cxf9pmmw.js} +2 -2
  35. package/dist/bin/{chunk-0zydd9s4.js → chunk-d0m01m6d.js} +5 -5
  36. package/dist/bin/{chunk-eyzdhtp4.js → chunk-f7jzs1h1.js} +4 -4
  37. package/dist/bin/{chunk-ma0d990n.js → chunk-gn7rdyz7.js} +2 -2
  38. package/dist/bin/chunk-haezjam0.js +1 -0
  39. package/dist/bin/{chunk-2wkw8qy0.js → chunk-hgs5fr4v.js} +91 -90
  40. package/dist/bin/chunk-hp1cqk45.js +1 -0
  41. package/dist/bin/{chunk-tf5tf414.js → chunk-jqs2ywj2.js} +2 -2
  42. package/dist/bin/{chunk-c1znyyca.js → chunk-jx062xpq.js} +1 -1
  43. package/dist/bin/chunk-k9s81q0g.js +1 -0
  44. package/dist/bin/chunk-nba35r6z.js +1 -0
  45. package/dist/bin/{chunk-0v5q5sh0.js → chunk-nzg624aj.js} +3 -3
  46. package/dist/bin/chunk-q3mtvtem.js +1 -0
  47. package/dist/bin/{chunk-s076q9sj.js → chunk-qmwqntnx.js} +2 -2
  48. package/dist/bin/{chunk-4m2k5mvd.js → chunk-qpasspad.js} +4 -4
  49. package/dist/bin/chunk-qpd51n1j.js +1 -0
  50. package/dist/bin/chunk-rtpc6djg.js +1 -0
  51. package/dist/bin/chunk-s9k81gq6.js +1 -0
  52. package/dist/bin/{chunk-wayhpmn7.js → chunk-sacx9p6f.js} +86 -86
  53. package/dist/bin/{chunk-fhqjr3ba.js → chunk-ssnvdxh4.js} +3 -3
  54. package/dist/bin/{chunk-kq526rgc.js → chunk-t0r1rdj2.js} +1 -1
  55. package/dist/bin/chunk-tpy9t3cv.js +1 -0
  56. package/dist/bin/{chunk-by7dtwtj.js → chunk-w40r35vn.js} +1 -1
  57. package/dist/bin/chunk-wm0rq725.js +1 -0
  58. package/dist/bin/chunk-y9qdpwa6.js +1 -0
  59. package/dist/bin/chunk-ybekawxv.js +1 -0
  60. package/dist/bin/{chunk-4vtyjj7c.js → chunk-yf2drw7r.js} +1 -1
  61. package/dist/bin/{chunk-fgnvksyx.js → chunk-z03ytarv.js} +46 -46
  62. package/dist/bin/{chunk-gq4htm3f.js → chunk-z9g7fa1w.js} +1 -1
  63. package/dist/bin/{chunk-0e7y7q0t.js → chunk-zfn3a9sx.js} +1 -1
  64. package/dist/bin/chunk-zg8nnq7k.js +1 -0
  65. package/dist/bin/{chunk-kyqe19mh.js → chunk-zn9wmqd1.js} +2 -2
  66. package/dist/bin/cli.js +215 -215
  67. package/dist/bin/dashboard-server.js +1 -1
  68. package/dist/bin/stacks-queue-worker.js +1 -1
  69. package/dist/bin/stacks-scheduler.js +1 -1
  70. package/dist/chunk-18dqxyz5.js +1 -0
  71. package/dist/{chunk-etv0rcjd.js → chunk-1h95atas.js} +1 -1
  72. package/dist/{chunk-nxj8pwa7.js → chunk-3wh3hsvp.js} +1 -1
  73. package/dist/{chunk-t7qgvz8z.js → chunk-5rds38z9.js} +55 -55
  74. package/dist/chunk-5v2wpf1k.js +1 -0
  75. package/dist/{chunk-tp37gyhc.js → chunk-7ea0q5tg.js} +1 -1
  76. package/dist/{chunk-wy0bqg1v.js → chunk-7v2f53s0.js} +4 -4
  77. package/dist/{chunk-dvma06m5.js → chunk-9w8qtr4p.js} +1 -1
  78. package/dist/{chunk-hg93a2g9.js → chunk-c71hhcsb.js} +2 -2
  79. package/dist/{chunk-w8sctn7m.js → chunk-cf274f07.js} +1 -1
  80. package/dist/{chunk-v6s9k1mp.js → chunk-cz4dw2hk.js} +1 -1
  81. package/dist/{chunk-0cgrk9g3.js → chunk-dh5m9b05.js} +1 -1
  82. package/dist/{chunk-z5c5amm1.js → chunk-dvw5dy32.js} +4 -4
  83. package/dist/{chunk-b6wsc7jp.js → chunk-eyc2tvze.js} +1 -1
  84. package/dist/{chunk-8k44kaz0.js → chunk-pk8ppz98.js} +1 -1
  85. package/dist/{chunk-p9cm5ynz.js → chunk-svvfj380.js} +91 -88
  86. package/dist/{chunk-f4fggc5f.js → chunk-tb5hy7rm.js} +1 -1
  87. package/dist/deploy/index.js +1 -1
  88. package/dist/dns/index.js +1 -1
  89. package/dist/drivers/hetzner/driver.d.ts +1 -0
  90. package/dist/drivers/index.js +1 -1
  91. package/dist/drivers/shared/backups.test.d.ts +1 -0
  92. package/dist/drivers/shared/compute-provision.d.ts +2 -0
  93. package/dist/index.js +2 -2
  94. package/dist/mail/index.js +2 -2
  95. package/dist/operations/index.js +1 -1
  96. package/dist/protection/index.js +1 -1
  97. package/dist/spend/index.js +1 -1
  98. package/dist/ui/404.html +1 -1
  99. package/dist/ui/accept-invitation.html +1 -1
  100. package/dist/ui/access-denied.html +1 -1
  101. package/dist/ui/account/automation.html +5 -5
  102. package/dist/ui/account/security.html +2 -2
  103. package/dist/ui/applications/compose.html +6 -6
  104. package/dist/ui/applications/new.html +2 -2
  105. package/dist/ui/data/backups.html +6 -6
  106. package/dist/ui/data/services.html +6 -6
  107. package/dist/ui/data/volumes.html +6 -6
  108. package/dist/ui/index.html +6 -6
  109. package/dist/ui/infrastructure/topology.html +5 -5
  110. package/dist/ui/integrations.html +2 -2
  111. package/dist/ui/operations/alerts.html +5 -5
  112. package/dist/ui/operations/configuration.html +6 -6
  113. package/dist/ui/operations/jobs.html +5 -5
  114. package/dist/ui/operations/maintenance.html +6 -6
  115. package/dist/ui/operations/observability.html +6 -6
  116. package/dist/ui/operations/previews.html +6 -6
  117. package/dist/ui/operations/queue.html +6 -6
  118. package/dist/ui/operations/regions.html +6 -6
  119. package/dist/ui/operations/releases.html +6 -6
  120. package/dist/ui/operations/spend.html +6 -6
  121. package/dist/ui/operations/workloads.html +6 -6
  122. package/dist/ui/security.html +2 -2
  123. package/dist/ui/server/actions.html +6 -6
  124. package/dist/ui/server/activity.html +1 -1
  125. package/dist/ui/server/capacity.html +6 -6
  126. package/dist/ui/server/database.html +6 -6
  127. package/dist/ui/server/deployments.html +5 -5
  128. package/dist/ui/server/diagnostics.html +1 -1
  129. package/dist/ui/server/firewall.html +6 -6
  130. package/dist/ui/server/fleet.html +5 -5
  131. package/dist/ui/server/logs.html +5 -5
  132. package/dist/ui/server/metrics.html +5 -5
  133. package/dist/ui/server/security.html +2 -2
  134. package/dist/ui/server/services.html +1 -1
  135. package/dist/ui/server/sites.html +6 -6
  136. package/dist/ui/server/ssh-keys.html +6 -6
  137. package/dist/ui/server/team.html +6 -6
  138. package/dist/ui/server/terminal.html +2 -2
  139. package/dist/ui/serverless/alarms.html +6 -6
  140. package/dist/ui/serverless/assets.html +2 -2
  141. package/dist/ui/serverless/cost.html +2 -2
  142. package/dist/ui/serverless/data.html +6 -6
  143. package/dist/ui/serverless/deployments.html +2 -2
  144. package/dist/ui/serverless/firewall.html +1 -1
  145. package/dist/ui/serverless/functions.html +5 -5
  146. package/dist/ui/serverless/logs.html +6 -6
  147. package/dist/ui/serverless/metrics.html +2 -2
  148. package/dist/ui/serverless/queues.html +5 -5
  149. package/dist/ui/serverless/secrets.html +5 -5
  150. package/dist/ui/serverless/traces.html +5 -5
  151. package/dist/ui/serverless.html +6 -6
  152. package/package.json +3 -3
  153. package/dist/bin/chunk-00j7xxxg.js +0 -1
  154. package/dist/bin/chunk-1xfn93bc.js +0 -1
  155. package/dist/bin/chunk-413nb697.js +0 -1
  156. package/dist/bin/chunk-8esaawk6.js +0 -1
  157. package/dist/bin/chunk-8zc4kx6k.js +0 -1
  158. package/dist/bin/chunk-9t6wztvn.js +0 -1
  159. package/dist/bin/chunk-b77qsk6r.js +0 -1
  160. package/dist/bin/chunk-d73xkm0k.js +0 -1
  161. package/dist/bin/chunk-dmj5xv74.js +0 -1
  162. package/dist/bin/chunk-dnswjyen.js +0 -1
  163. package/dist/bin/chunk-grx14tmn.js +0 -1
  164. package/dist/bin/chunk-h28tfah9.js +0 -1
  165. package/dist/bin/chunk-k1bdndgj.js +0 -1
  166. package/dist/bin/chunk-kkrp8100.js +0 -1
  167. package/dist/bin/chunk-nwcpck34.js +0 -1
  168. package/dist/bin/chunk-nzky7rgv.js +0 -1
  169. package/dist/bin/chunk-p96975b7.js +0 -1
  170. package/dist/bin/chunk-ps0pzqm0.js +0 -9
  171. package/dist/bin/chunk-rgwwr6x2.js +0 -1
  172. package/dist/bin/chunk-sky689gw.js +0 -1
  173. package/dist/bin/chunk-tx56y5qk.js +0 -1
  174. package/dist/bin/chunk-v0fkhtgq.js +0 -1
  175. package/dist/bin/chunk-v7dk21w9.js +0 -1
  176. package/dist/bin/chunk-ww4r3r7x.js +0 -1
  177. package/dist/bin/chunk-x9dep4ew.js +0 -1
  178. package/dist/bin/chunk-y5hsmt17.js +0 -1
  179. package/dist/bin/chunk-zfy6f6ph.js +0 -1
  180. package/dist/chunk-fmhqz3eg.js +0 -1
  181. package/dist/chunk-pev4cpbd.js +0 -1
@@ -0,0 +1 @@
1
+ import{qp}from"./chunk-9gp8p8hv.js";import"./chunk-z9g7fa1w.js";import"./chunk-qpasspad.js";import"./chunk-btrxye8p.js";import"./chunk-sacx9p6f.js";import"./chunk-8rkfwgb4.js";export{qp as buildAndPushServerlessImage};
@@ -0,0 +1 @@
1
+ import{Or,nl,il,Pt,$r,Lr,Mr,Ur,Cn}from"./chunk-d0m01m6d.js";import"./chunk-ssnvdxh4.js";import"./chunk-sacx9p6f.js";import"./chunk-8rkfwgb4.js";export{$r as AwsSecretsManagerConfigurationBackend,Lr as AwsSsmConfigurationBackend,Ur as ConfigurationService,Or as ConfigurationStore,Mr as ExternalConfigurationBackend,Pt as LocalEncryptedConfigurationBackend,nl as parseDotenv,il as serializeDotenv,Cn as synchronizeConfiguredConfiguration};
@@ -0,0 +1 @@
1
+ import{Xt,iu,ou,Jo,p,k,la}from"./chunk-btrxye8p.js";export{p as AWSClient,k as buildQueryParams,ou as canonicalUriFor,Jo as coerceXmlValues,la as detectCredentialSource,Xt as resolveS3Endpoint,iu as signingNameFor};
@@ -1,4 +1,4 @@
1
- import{p}from"./chunk-540wkkhs.js";class F{client;region;constructor(e="us-east-1"){this.region=e,this.client=new p}async createHostedZone(e){let t=e.CallerReference||`${Date.now()}-${Math.random().toString(36).slice(2)}`,o=`<?xml version="1.0" encoding="UTF-8"?>
1
+ import{p}from"./chunk-btrxye8p.js";class F{client;region;constructor(e="us-east-1"){this.region=e,this.client=new p}async createHostedZone(e){let t=e.CallerReference||`${Date.now()}-${Math.random().toString(36).slice(2)}`,o=`<?xml version="1.0" encoding="UTF-8"?>
2
2
  <CreateHostedZoneRequest xmlns="https://route53.amazonaws.com/doc/2013-04-01/">
3
3
  <Name>${e.Name}</Name>
4
4
  <CallerReference>${t}</CallerReference>`;if(e.HostedZoneConfig){if(o+=`
@@ -1,2 +1,2 @@
1
- import{accessSync as u,constants as l,realpathSync as r,statSync as d}from"node:fs";import{basename as h,delimiter as f,isAbsolute as b,relative as m,resolve as o,sep as B}from"node:path";import a from"node:process";function c(e){let n=e.split("/");if(!/^[a-zA-Z0-9_./-]+$/.test(e)||e.startsWith("/")||n.some((t)=>!t||t==="."||t==="..")||n.at(-1)!=="bun")throw Error("Stacks backgroundBun must select a safe release-relative Bun executable")}function el(e,n){if(c(n),!/^\/[a-zA-Z0-9_./-]+$/.test(e)||e.split("/").includes(".."))throw Error("Stacks backgroundBun requires a safe absolute release directory");return`${e}/${n}`}function Ui(){let e=a.env.TS_CLOUD_BACKGROUND_BUN;if(e===void 0)return;c(e);let n=r(a.cwd()),t=r(o(n,e)),s=m(n,t);if(!s||b(s)||s===".."||s.startsWith(`..${B}`)||h(t)!=="bun"||!d(t).isFile()||r(a.execPath)!==t)throw Error("The selected background Bun must be the running executable inside this release");u(t,l.X_OK);let i=a.env.PATH?.split(f)[0];if(!i||r(o(i,"bun"))!==t)throw Error("The selected background Bun must lead the service launch PATH")}
2
- export{el,Ui};
1
+ import{accessSync as u,constants as l,realpathSync as r,statSync as d}from"node:fs";import{basename as h,delimiter as f,isAbsolute as b,relative as m,resolve as o,sep as B}from"node:path";import a from"node:process";function c(e){let n=e.split("/");if(!/^[a-zA-Z0-9_./-]+$/.test(e)||e.startsWith("/")||n.some((t)=>!t||t==="."||t==="..")||n.at(-1)!=="bun")throw Error("Stacks backgroundBun must select a safe release-relative Bun executable")}function tl(e,n){if(c(n),!/^\/[a-zA-Z0-9_./-]+$/.test(e)||e.split("/").includes(".."))throw Error("Stacks backgroundBun requires a safe absolute release directory");return`${e}/${n}`}function Bi(){let e=a.env.TS_CLOUD_BACKGROUND_BUN;if(e===void 0)return;c(e);let n=r(a.cwd()),t=r(o(n,e)),s=m(n,t);if(!s||b(s)||s===".."||s.startsWith(`..${B}`)||h(t)!=="bun"||!d(t).isFile()||r(a.execPath)!==t)throw Error("The selected background Bun must be the running executable inside this release");u(t,l.X_OK);let i=a.env.PATH?.split(f)[0];if(!i||r(o(i,"bun"))!==t)throw Error("The selected background Bun must lead the service launch PATH")}
2
+ export{tl,Bi};
@@ -0,0 +1 @@
1
+ import{Rt,ru,ea,qo,ym,ta,ra,Wo,Wt,bm,nu,Sm,vm,z,na,Cm}from"./chunk-nzg624aj.js";import"./chunk-19mhwmfp.js";import"./chunk-qpasspad.js";import"./chunk-yf2drw7r.js";import"./chunk-1wgyq50e.js";import"./chunk-btrxye8p.js";import"./chunk-sacx9p6f.js";import"./chunk-8rkfwgb4.js";export{qo as assertEnvWithinLimit,ea as buildFunctionEnv,ym as deployServerlessApp,Sm as getCommandRecord,ru as infraEnvFromOutputs,nu as listCommandHistory,ta as redeployServerlessApp,Rt as resolveServerlessFunctions,Cm as restoreServerlessDatabase,ra as rollbackServerlessApp,bm as runAndRecordCommand,vm as runDbQuery,Wt as runRemoteCommand,na as scaleServerlessDatabase,z as serverlessInfo,Wo as setMaintenance};
@@ -0,0 +1 @@
1
+ import{Em,wm,ua,ol,pa,ma,wn,ze,I,ga,sl,H,Fr,w,su,Y,jr,fa,Xo,le,U,Qo,au,cu,lu,du,l,o,Am,Rm,T,ha,ya,ba,Im,Pm,$e,Sa,Fi,uu,Dm,km,He,Dt,va,al,cl,Nm,ll,dl,ul,Yo,Ca,st,Zo,An,ji,Rn,Ge,pu,es,ts,Ta,Ea,wa,Aa,Ra,Ia,Ae,j,mu,gu,pl,b,M,at,N,ml,kt,ye,Qt,xm,gl,Re,rs,qe,Yt,Vi,Ie,ns,Le,fu,zi,Pe,De,ie,Hi,X,Zt,Nt,ke,t,In,_m,fl,Pa,Om,$m,Lm,Mm,Da,Um,Bm,Fm,jm,Vm,zm,Hm,Gm,qm,Wm,Km,Jm,hu,yu,bu,Su,vu,Cu,Tu,er,hl,yl,Vr,Gi,Xm,bl,Qm,Ym,Pn,Zm,eg,tg,rg,ng,ig,Eu,wu,Au,Ru,Iu,qi,og,Dn,Pu,Sl,Du,ka,be,ku,Nu,xt,is,tr,xu,vl,_u,Ou,$u,Cl,Se,sg,ag,cg,lg,Lu,dg,Ne,ug,pg,mg,Na,xa,Mu,Tl,El,gg,fg,hg,yg,bg,Uu,_a,Sg,vg,Cg,Tg,Eg,Bu,Fu,wg,Ag,Rg,Ig,Pg,Dg,kg,ju,Ng,wl,Oa,xg,_g,Og,$g,Al,Rl,Il,Lg,$a,Vu,zu,Hu,Gu,La,qu,Mg,Ug,Bg,Fg,jg,Vg,zg,Wu,Ku,Ju,Xu,Pl,Hg,Gg,qg,Wg,Kg,Jg,Xg,Qg,Yg,Qu,Yu,Zu,ep,Zg,ef,Dl,tf,kl,Nl,xl,_l,rf,nf,of,sf,ct,Wi,af,cf,lf,df,uf,pf,mf,gf,tp,ff,hf,Ol,$l,yf,bf,rp,Sf,vf,Cf,Tf,Ef,wf,Af,Rf,If,Pf,Df,kf,Nf,xf,_f,Of,$f,Lf,Mf,Uf,Bf,Ma,np,Ua,ip,Ba,op,Fa,sp,ja,ap,zr,cp,Va,lp,Ki,dp,za,up,Ha,pp,Ll,Ff,Ml,jf,Ga,mp,Hr,gp,Ul,Vf,qa,fp,Bl,zf,Fl,Hf,jl,Gf,Wa,hp,Vl,qf,zl,Wf,Hl,Kf,Gl,Jf,Ka,yp,Ja,bp,ql,Xf,Wl,Qf,Kl,Yf,Jl,Zf,Xl,eh,Ql,th,Xa,Sp,Yl,rh,Zl,nh,ed,ih,td,oh,rd,sh,nd,ah,id,od,sd,ad,cd,ch,ld,lh,dd,dh,ud,uh,_t,pd,vp,os,Qa,kn,Cp,Ji,rr,Ya,Za,Tp,Ep,ec,md,tc,gd,ph,mh,rc,nc,ic,fd,Xi,hd,yd,ss,oc,sc,bd,wp,Ap,Rp,gh,Sd,vd,fh,Ip,Cd,Pp,Dp,kp,hh,Td,Nn,ac,Ed,yh,Np,as,cs,cc,wd,bh,lc,xp,Ad,Sh,Rd,vh,Id,Ch}from"./chunk-sacx9p6f.js";import{dc,Z,uc,ls,_p,Ot,Op,$p,xn,Lp,Mp,Up,Bp,Fp}from"./chunk-8rkfwgb4.js";export{za as ABTestManager,qe as AI,_u as AWSAPIError,Ba as AWSConfigManager,_m as AWS_PSEUDO_PARAMETERS,ct as AWS_REGIONS,ns as ApiGateway,In as Arn,ie as AssetHasher,Pe as Auth,Ma as BackupManager,dd as BatchProcessingManager,Va as BlueGreenManager,ed as BounceComplaintHandler,Gl as BuildOptimizationManager,Ge as CDN,nc as CHAIN_HEADER,va as CLOUDFRONT_FAILOVER_STATUS_CODES,vf as COMMON_CROSS_ACCOUNT_ROLES,Vi as Cache,Ki as CanaryManager,Vl as CertificateManager,xt as CloudError,fl as CloudFormationBuilder,Du as CloudFormationClient,Nu as CloudFrontClient,Fa as CloudTrailManager,ep as CommandHistory,ke as Communication,b as Compute,is as ConfigurationError,Ka as ContainerRegistryManager,tr as CredentialError,kl as CrossRegionReferenceManager,yu as DASHBOARD_ENTRY,bu as DASHBOARD_PORT_BASE,Su as DASHBOARD_PORT_SPAN,hu as DASHBOARD_STATE_DIR,al as DEFAULT_FAILOVER_STATUS_CODES,Xi as DEFAULT_RECURSION_LIMITS,Ne as DEFAULT_SERVICE_LIMITS,ua as DEFAULT_STATE_DIR,pu as DEFAULT_STORAGE_FAILOVER_STATUS_CODES,rc as DEPTH_HEADER,ld as DLQMonitoringManager,Ae as DNS,Yl as DNSSECManager,Yt as Database,Fl as DatabaseUserManager,Se as DebugLogger,uu as DependencyGraph,De as Deployment,xu as DeploymentError,Ua as DisasterRecoveryManager,N as Email,id as EmailAdvanced,td as EmailAnalyticsManager,od as EmailHandlers,nd as EmailTemplateManager,Ou as ErrorCodes,ts as FAILOVER_REPLICA_POLICY_SID,cd as FIFOQueueManager,Na as FileCache,at as FileSystem,t as Fn,Nl as GlobalResourceManager,ja as GuardDutyManager,Uu as HashCache,Ad as HealthCheckManager,Hl as ImageScanningManager,Qt as JobLoader,Ed as LARAVEL_SERVERLESS_BUILD_STEPS,Kl as LambdaConcurrencyManager,Ql as LambdaDLQManager,Jl as LambdaDestinationsManager,ql as LambdaLayersManager,Xl as LambdaVPCManager,Wl as LambdaVersionsManager,Ga as LogsManager,Cp as MANAGED_NODE_VERSIONS,hl as MANAGEMENT_DASHBOARD_SITE_PREFIX,Le as Messaging,Ml as MetricsManager,Ul as MigrationManager,Al as MockCloudFormation,Il as MockDynamoDB,Rl as MockS3,zi as Monitoring,Ol as MultiAccountManager,Dl as MultiRegionManager,Ku as MultiStepProgress,M as Network,Rd as NetworkSecurityManager,dl as ORIGIN_CONNECTION_ATTEMPTS,ul as ORIGIN_CONNECTION_TIMEOUT,cl as ORIGIN_GROUP_ALLOWED_METHODS,Nm as ORIGIN_GROUP_ID_SUFFIX,ll as ORIGIN_GROUP_SELECTION_CRITERIA,$l as OrganizationManager,Np as PHP_DEFAULT_EXCLUDES,Tp as PHP_LAYER_EXTENSIONS,X as ParameterStore,Bl as PerformanceManager,Ie as Permissions,kt as Phone,sd as PhoneAdvanced,ml as PhoneHandlers,$a as PreviewEnvironmentManager,La as PreviewNotificationService,Wu as ProgressBar,Ha as ProgressiveDeploymentManager,du as Pseudo,ye as Queue,ud as QueueManagementManager,Em as QueuePresets,rp as RECOMMENDED_ACCOUNT_STRUCTURES,Sf as RECOMMENDED_SCPS,Qu as REPL,Zu as REPLCommandBuilder,Yu as REPLContext,Bu as RateLimiter,wm as RealtimePresets,ss as RecursionGuard,Nt as Redirects,xl as RegionPairManager,Dt as Registry,qa as ReplicaManager,Id as ResourceManagementManager,Zl as Route53ResolverManager,Xa as Route53RoutingManager,ka as S3Client,be as S3Error,Re as SMS,ol as STATE_DIR_ENV_VAR,es as STORAGE_FAILOVER_METADATA_KEY,Zt as Search,Hi as Secrets,Wa as SecretsManager,jl as SecretsRotationManager,j as Security,zr as SecurityHubManager,zl as SecurityScanningManager,rd as SenderReputationManager,Ja as ServiceMeshManager,rs as Sftp,ad as SmsAdvanced,gl as SmsHandlers,Ju as Spinner,_l as StackDependencyManager,xm as StacksIntegration,wd as StaticSiteManager,He as Storage,lc as StorageAdvancedManager,Hr as SyntheticsManager,ic as TRACE_HEADER,Xu as TaskList,Qo as TemplateBuilder,xa as TemplateCache,vl as ValidationError,fu as Workflow,Ll as XRayManager,up as abTestManager,pl as amazonLinuxImageId,gu as amazonLinuxImageParameter,Dm as analyzeStackDiff,Qa as artifactKey,An as assertOriginGroupMethods,Kg as autocomplete,op as awsConfigManager,np as backupManager,Sg as batch,dh as batchProcessingManager,lp as blueGreenManager,ih as bounceComplaintHandler,mh as buildBunRuntimeLayerZip,Pa as buildCloudFormationTemplate,Ra as buildFailoverReplicaPolicyStatement,fa as buildMailEnv,ph as buildNodeRuntimeLayerZip,Jf as buildOptimizationManager,Ca as buildOriginGroup,Zo as buildOriginGroups,yh as buildPhpRuntimeLayerZip,Aa as buildReplicationConfiguration,wa as buildReplicationRole,dp as canaryManager,Pg as categorizeChanges,qf as certificateManager,lg as checkIAMPermissions,Sd as checkInvocation,ug as checkServiceQuotas,Fu as chunk,Mp as clearSigningKeyCache,ju as cloudConfigSchema,sp as cloudTrailManager,cs as collectPhpAppEntries,Qm as composePresets,Za as composeServerlessAppTemplate,yp as containerRegistryManager,Bm as createApiBackendPreset,kp as createCliHandler,og as createCredentialProvider,Jm as createDashboardSite,Hm as createDataPipelinePreset,Cl as createError,Da as createExistingStaticFullStackPreset,Um as createFullStackAppPreset,hh as createHandlers,Pp as createHttpHandler,jm as createJamstackPreset,Wm as createLaravelPreset,Gm as createMLApiPreset,Vm as createMicroservicesPreset,Lg as createMockAWS,$m as createNodeJsServerPreset,Lm as createNodeJsServerlessPreset,Ym as createPreset,ls as createPresignedUrl,_p as createPresignedUrlAsync,Dp as createQueueHandler,zm as createRealtimeAppPreset,ku as createS3Client,Km as createServerlessLaravelPreset,Mm as createServerlessNodePreset,Om as createStaticSitePreset,qm as createTraditionalWebAppPreset,Fm as createWordPressPreset,_t as createZip,rf as crossRegionReferenceManager,Hf as databaseUserManager,wl as defaultLocalConfig,Fr as deploymentCoexistenceError,vu as deriveManagementDashboardPort,sl as detectDeploymentTargets,ag as detectMisconfigurations,dc as detectServiceRegion,Ag as diffTemplates,lh as dlqMonitoringManager,rh as dnssecManager,ip as drManager,oh as emailAnalyticsManager,ah as emailTemplateManager,Ip as eventToRequest,bl as extendPreset,ch as fifoQueueManager,bg as findChangedFiles,wf as formatAccountStructure,Fg as formatBytes,km as formatDiff,jg as formatDuration,Xg as formatFlagSuggestions,Zg as formatHistory,ef as formatHistoryStats,zg as formatKeyValue,Vg as formatList,Bg as formatProgressBar,tp as formatRegion,ff as formatRegionList,Hg as formatSuggestion,Mg as formatTable,Ug as formatTree,Au as fromEC2Metadata,Ru as fromECSMetadata,Eu as fromEnvironment,wu as fromSharedCredentials,Iu as fromWebIdentity,fd as functionFingerprint,tc as generateAppImageDockerfile,Uf as generateApprovalConfig,pd as generateBootstrap,Hu as generateCleanupWorkflow,Gu as generateCostReportWorkflow,Tf as generateCrossAccountRoleCF,$f as generateDeploymentConfig,kf as generateDeploymentPipeline,Af as generateDeploymentWorkflow,o as generateLogicalId,Of as generateManualPipeline,Df as generateMatrixWorkflow,Lf as generateMultiEnvConfig,Nf as generateMultiEnvPipeline,Rf as generateMultiEnvWorkflow,If as generatePRPreviewWorkflow,Bf as generateParallelConfig,Td as generatePhpFpmConfig,md as generatePhpLayerDockerfile,xf as generatePreviewPipeline,zu as generatePreviewWorkflow,l as generateResourceName,Mf as generateScheduledConfig,_f as generateScheduledPipeline,Pf as generateScheduledWorkflow,Sl as getAccountId,af as getAllRegions,pf as getClosestRegion,Qg as getCommandUsage,qg as getContextualHelp,qi as getCredentials,Dg as getDeploymentStrategy,kg as getDiffStats,Rg as getDiffSummary,$u as getErrorDetails,Oa as getLocalConfig,Og as getLocalCredentials,_g as getLocalEndpoint,$g as getLocalEnvVars,pg as getQuotaUsageSummary,Cf as getRecommendedStructure,Wi as getRegion,hf as getRegionStats,lf as getRegionsByCompliance,cf as getRegionsByLocation,df as getRegionsByPricingTier,Lu as getRequiredPermissions,Up as getSigningKeyCacheSize,Am as getTimestamp,nf as globalResourceManager,ap as guardDutyManager,er as hasManagementDashboardSite,gg as hashBuffer,fg as hashDirectory,Tl as hashFile,hg as hashManifest,El as hashString,Sh as healthCheckManager,Kf as imageScanningManager,yd as inspectInvocation,Ap as installRecursionFetch,bd as invocationContext,mu as isArmInstanceType,Gg as isLikelyTypo,xg as isLocalDevelopment,Vr as isManagementDashboardSiteName,Bp as isNodeCryptoAvailable,ji as isS3RestEndpoint,ma as isStateDirConfigured,ga as isStatePath,uf as isValidRegion,Fp as isWebCryptoAvailable,Yf as lambdaConcurrencyManager,th as lambdaDLQManager,Zf as lambdaDestinationsManager,Xf as lambdaLayersManager,eh as lambdaVPCManager,Qf as lambdaVersionsManager,ac as laravelServerlessEnvDefaults,mp as logsManager,su as mailEnabled,jr as mailFirewallPorts,Xo as mailWebmailSites,Ot as makeAWSRequest,$p as makeAWSRequestAsync,Op as makeAWSRequestOnce,yl as managementDashboardSiteName,Pn as mergeInfrastructure,jf as metricsManager,Vf as migrationManager,yf as multiAccountManager,tf as multiRegionManager,vh as networkSecurityManager,bf as organizationManager,cc as packagePhpApp,kn as packageServerlessApp,_a as parallel,vg as parallelMap,Cg as parallelWithRetry,hd as parseChain,Lp as parseJSONResponse,xn as parseXMLResponse,zf as performanceManager,ec as phpLayerBuildStage,Ep as phpLayerPackages,Nn as phpRuntimeLayerAssets,Vu as previewManager,qu as previewNotifications,wg as processInChunks,pp as progressiveDeploymentManager,oc as propagationHeaders,uh as queueManagementManager,yg as quickHash,sc as recursionBlockedResponse,of as regionPairManager,fp as replicaManager,Ig as requiresReplacement,gh as resetRecursionRuntime,fh as resolveApp,w as resolveAppDatabase,U as resolveCloudProvider,Dn as resolveCredentials,Cu as resolveDashboardDomain,Tu as resolveDashboardDomains,Pm as resolveDeployBucketName,H as resolveDeploymentMode,Yo as resolveFailoverStatusCodes,le as resolveMailProxy,Y as resolveMailService,Xm as resolveManagementDashboardSite,Gi as resolveManagementDashboardSites,st as resolveOriginConnection,T as resolveProjectStackName,Ya as resolveQueueNames,rr as resolveQueues,wp as resolveRecursionConfig,Pu as resolveRegion,$e as resolveServerlessAppStackName,Sa as resolveServerlessArtifactBucketName,Fi as resolveServerlessAssetBucketName,Ji as resolveServerlessRuntime,ba as resolveSiteBucketName,ya as resolveSiteResourceName,ha as resolveSiteStackName,I as resolveStatePath,Im as resolveStorageBucketName,Ta as resolveStorageFailover,Ch as resourceManagementManager,Cd as responseToResult,nh as route53ResolverManager,Sp as route53RoutingManager,vp as runBuildHooks,as as runPhpBuildHooks,Ea as s3RegionalDomain,Rm as sanitizeName,Wg as searchCommands,hp as secretsManager,Gf as secretsRotationManager,cp as securityHubManager,Wf as securityScanningManager,sh as senderReputationManager,Tg as sequence,bp as serviceMeshManager,pa as setStateDir,os as sha256,Rp as sharedRecursionGuard,gd as sharedRuntimeLoop,Z as signRequest,uc as signRequestAsync,sf as stackDependencyManager,wn as stateDir,ze as statePath,bh as staticSiteManager,xp as storageAdvancedManager,Ia as storageFailoverReplicasFromTemplate,Pl as suggestCommand,Jg as suggestFlags,dg as suggestIAMPolicy,mg as suggestQuotaIncrease,gf as suggestRegionPairs,mf as suggestRegions,gp as syntheticsManager,Mu as templateCache,Ef as validateAccountStructure,Ng as validateAgainstSchema,Yg as validateCommand,sg as validateConfiguration,cg as validateCredentials,Rn as validateOriginGroups,lu as validateResourceLimits,au as validateTemplate,cu as validateTemplateSize,ng as withCDN,rg as withCache,tg as withDatabase,vd as withInvocation,Zm as withMonitoring,ig as withQueue,eg as withSecurity,Eg as withTimeout,Ff as xrayManager};
@@ -0,0 +1 @@
1
+ import{dc,Z,uc,ls,_p,Ot,Op,$p,xn,Lp,Mp,Up,Bp,Fp}from"./chunk-8rkfwgb4.js";export{Mp as clearSigningKeyCache,ls as createPresignedUrl,_p as createPresignedUrlAsync,dc as detectServiceRegion,Up as getSigningKeyCacheSize,Bp as isNodeCryptoAvailable,Fp as isWebCryptoAvailable,Ot as makeAWSRequest,$p as makeAWSRequestAsync,Op as makeAWSRequestOnce,Lp as parseJSONResponse,xn as parseXMLResponse,Z as signRequest,uc as signRequestAsync};
@@ -0,0 +1 @@
1
+ import{rl,Tm}from"./chunk-08sws53b.js";import"./chunk-69mejej3.js";import"./chunk-1wgyq50e.js";import"./chunk-btrxye8p.js";export{rl as EmailClient,Tm as email};
@@ -1,8 +1,8 @@
1
- var l={mode:"detection",paranoiaLevel:1,inboundThreshold:5,outboundThreshold:4,maxBodyBytes:13107200,rejectOversizedBody:!0,auditLogPath:"/var/log/ts-cloud/waf-audit.log",blockStatus:403},d={bypassBase:1e5,exclusionBase:101000,rateLimitBase:102000,customBase:109000};function nt(e){return e.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/[\r\n]+/g," ")}function Ls(e){if(e.length>1000)return!1;if(/\([^)]*[+*]\)[+*]/.test(e))return!1;if(/\[[^\]]*\][+*]\{/.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}function b(e,r){let t=[],o=[],s=r;for(let n of e){if(n.enabled===!1)continue;if(n.key&&(n.key.source==="cookie"||n.key.source==="header")&&!n.key.name){o.push({ruleId:n.id,reason:"The rule keys on a header or cookie but names none."});continue}let c=n.path?Gc(n.path):".*";if(!Ls(c)){o.push({ruleId:n.id,reason:"The path pattern compiles to an unsafe regular expression."});continue}let u=[`SecRule REQUEST_URI "@rx ${nt(c)}"`];if(n.methods?.length)u.push(` "chain,id:${s},phase:1,pass,nolog,setvar:'tx.ts_cloud_ratelimit=${nt(n.id)}'"`);else u.push(` "id:${s},phase:1,pass,nolog,setvar:'tx.ts_cloud_ratelimit=${nt(n.id)}'"`);if(t.push(`# Marks requests governed by the ts-cloud rate limit "${nt(n.id)}".`),t.push(u.join(" \\\n")),n.methods?.length)t.push(` SecRule REQUEST_METHOD "@within ${nt(n.methods.join(" ").toUpperCase())}" "t:none"`);t.push(""),s++}return{lines:t,unmapped:o}}function Gc(e){return`^${e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"\x01").replace(/\*/g,"[^/]*").replace(/\u0001/g,".*")}$`}function Di(e={},r=[]){let t=e.mode??l.mode,o=[],s=e.paranoiaLevel??l.paranoiaLevel,n=e.inboundThreshold??l.inboundThreshold,c=e.outboundThreshold??l.outboundThreshold,u=e.maxBodyBytes??l.maxBodyBytes,h=e.rejectOversizedBody!==!1;if(t==="blocking"&&s>=3)o.push(`Paranoia level ${s} blocks legitimate traffic on most applications until it is tuned. Run it in detection mode first.`);if(t==="blocking")o.push("zig-waf is pre-alpha. Blocking mode makes it a failure path for every request.");if(!h)o.push("Oversized bodies are passed through uninspected, so padding a request bypasses every rule.");if(e.bypassPaths?.length)o.push(`${e.bypassPaths.length} path(s) bypass inspection entirely.`);let i=["# Managed by ts-cloud. Edits are overwritten on the next deploy.",`# Mode: ${t}. Paranoia level: ${s}.`,""];if(t==="off")return i.push("SecRuleEngine Off",""),{config:`${i.join(`
1
+ var l={mode:"detection",paranoiaLevel:1,inboundThreshold:5,outboundThreshold:4,maxBodyBytes:13107200,rejectOversizedBody:!0,auditLogPath:"/var/log/ts-cloud/waf-audit.log",blockStatus:403},d={bypassBase:1e5,exclusionBase:101000,rateLimitBase:102000,customBase:109000};function nt(e){return e.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/[\r\n]+/g," ")}function Ms(e){if(e.length>1000)return!1;if(/\([^)]*[+*]\)[+*]/.test(e))return!1;if(/\[[^\]]*\][+*]\{/.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}function b(e,r){let t=[],o=[],s=r;for(let n of e){if(n.enabled===!1)continue;if(n.key&&(n.key.source==="cookie"||n.key.source==="header")&&!n.key.name){o.push({ruleId:n.id,reason:"The rule keys on a header or cookie but names none."});continue}let c=n.path?qc(n.path):".*";if(!Ms(c)){o.push({ruleId:n.id,reason:"The path pattern compiles to an unsafe regular expression."});continue}let u=[`SecRule REQUEST_URI "@rx ${nt(c)}"`];if(n.methods?.length)u.push(` "chain,id:${s},phase:1,pass,nolog,setvar:'tx.ts_cloud_ratelimit=${nt(n.id)}'"`);else u.push(` "id:${s},phase:1,pass,nolog,setvar:'tx.ts_cloud_ratelimit=${nt(n.id)}'"`);if(t.push(`# Marks requests governed by the ts-cloud rate limit "${nt(n.id)}".`),t.push(u.join(" \\\n")),n.methods?.length)t.push(` SecRule REQUEST_METHOD "@within ${nt(n.methods.join(" ").toUpperCase())}" "t:none"`);t.push(""),s++}return{lines:t,unmapped:o}}function qc(e){return`^${e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"\x01").replace(/\*/g,"[^/]*").replace(/\u0001/g,".*")}$`}function Di(e={},r=[]){let t=e.mode??l.mode,o=[],s=e.paranoiaLevel??l.paranoiaLevel,n=e.inboundThreshold??l.inboundThreshold,c=e.outboundThreshold??l.outboundThreshold,u=e.maxBodyBytes??l.maxBodyBytes,h=e.rejectOversizedBody!==!1;if(t==="blocking"&&s>=3)o.push(`Paranoia level ${s} blocks legitimate traffic on most applications until it is tuned. Run it in detection mode first.`);if(t==="blocking")o.push("zig-waf is pre-alpha. Blocking mode makes it a failure path for every request.");if(!h)o.push("Oversized bodies are passed through uninspected, so padding a request bypasses every rule.");if(e.bypassPaths?.length)o.push(`${e.bypassPaths.length} path(s) bypass inspection entirely.`);let i=["# Managed by ts-cloud. Edits are overwritten on the next deploy.",`# Mode: ${t}. Paranoia level: ${s}.`,""];if(t==="off")return i.push("SecRuleEngine Off",""),{config:`${i.join(`
2
2
  `)}
3
- `,unmappedRateLimits:[],warnings:o,mode:t};i.push(`SecRuleEngine ${t==="blocking"?"On":"DetectionOnly"}`,"SecRequestBodyAccess On","SecResponseBodyAccess Off",`SecRequestBodyLimit ${u}`,`SecRequestBodyNoFilesLimit ${Math.min(u,131072)}`,`SecRequestBodyLimitAction ${h?"Reject":"ProcessPartial"}`,"SecRequestBodyInMemoryLimit 131072",`SecAuditEngine ${t==="blocking"?"RelevantOnly":"On"}`,"SecAuditLogParts ABIJDEFHZ",`SecAuditLog ${nt(e.auditLogPath??l.auditLogPath)}`,"SecAuditLogType Serial",`SecDefaultAction "phase:1,log,auditlog,${t==="blocking"?`deny,status:${e.blockStatus??l.blockStatus}`:"pass"}"`,"","# CRS anomaly scoring setup.",`SecAction "id:900000,phase:1,pass,nolog,t:none,setvar:tx.paranoia_level=${s}"`,`SecAction "id:900001,phase:1,pass,nolog,t:none,setvar:tx.inbound_anomaly_score_threshold=${n}"`,`SecAction "id:900002,phase:1,pass,nolog,t:none,setvar:tx.outbound_anomaly_score_threshold=${c}"`,'SecAction "id:900003,phase:1,pass,nolog,t:none,setvar:tx.critical_anomaly_score=5,setvar:tx.error_anomaly_score=4,setvar:tx.warning_anomaly_score=3,setvar:tx.notice_anomaly_score=2"','SecAction "id:900004,phase:1,pass,nolog,t:none,setvar:tx.anomaly_score=0"',"");let g=d.bypassBase;for(let a of e.bypassPaths??[]){let y=Gc(a);if(!Ls(y)){o.push(`Bypass path "${a}" was dropped: it compiles to an unsafe regular expression.`);continue}i.push(`# Inspection bypass for ${nt(a)}. Every bypass is an unguarded route.`,`SecRule REQUEST_URI "@rx ${nt(y)}" "id:${g},phase:1,pass,nolog,ctl:ruleEngine=Off"`,""),g++}let m=d.exclusionBase;for(let a of e.exclusions??[]){if(!Number.isInteger(a.ruleId)||a.ruleId<=0){o.push(`Exclusion with rule id "${a.ruleId}" was dropped: the id is not a positive integer.`);continue}if(i.push(`# ${nt(a.reason)}`),a.pathPattern){if(!Ls(a.pathPattern)){o.push(`Exclusion for rule ${a.ruleId} was dropped: its path pattern is unsafe.`);continue}i.push(`SecRule REQUEST_URI "@rx ${nt(a.pathPattern)}" "id:${m},phase:1,pass,nolog,ctl:ruleRemoveById=${a.ruleId}"`),m++}else i.push(`SecRuleRemoveById ${a.ruleId}`);i.push("")}let p=b(r,d.rateLimitBase);if(p.lines.length>0)i.push("# Rate-limit route markers. SecLang has no counters, so the tag is set","# here and the counting stays in the ts-cloud limiter.",...p.lines);let f=d.customBase;for(let a of e.customRules??[])i.push(`# Operator-supplied rule ${f}.`,a.trim(),""),f++;if(t==="blocking")i.push("# Blocking decision: one rule, at the end, on the accumulated score.",`SecRule TX:ANOMALY_SCORE "@ge %{tx.inbound_anomaly_score_threshold}" "id:949110,phase:2,deny,status:${e.blockStatus??l.blockStatus},log,msg:'Inbound anomaly score exceeded (total: %{tx.anomaly_score})'"`,"");return{config:`${i.join(`
3
+ `,unmappedRateLimits:[],warnings:o,mode:t};i.push(`SecRuleEngine ${t==="blocking"?"On":"DetectionOnly"}`,"SecRequestBodyAccess On","SecResponseBodyAccess Off",`SecRequestBodyLimit ${u}`,`SecRequestBodyNoFilesLimit ${Math.min(u,131072)}`,`SecRequestBodyLimitAction ${h?"Reject":"ProcessPartial"}`,"SecRequestBodyInMemoryLimit 131072",`SecAuditEngine ${t==="blocking"?"RelevantOnly":"On"}`,"SecAuditLogParts ABIJDEFHZ",`SecAuditLog ${nt(e.auditLogPath??l.auditLogPath)}`,"SecAuditLogType Serial",`SecDefaultAction "phase:1,log,auditlog,${t==="blocking"?`deny,status:${e.blockStatus??l.blockStatus}`:"pass"}"`,"","# CRS anomaly scoring setup.",`SecAction "id:900000,phase:1,pass,nolog,t:none,setvar:tx.paranoia_level=${s}"`,`SecAction "id:900001,phase:1,pass,nolog,t:none,setvar:tx.inbound_anomaly_score_threshold=${n}"`,`SecAction "id:900002,phase:1,pass,nolog,t:none,setvar:tx.outbound_anomaly_score_threshold=${c}"`,'SecAction "id:900003,phase:1,pass,nolog,t:none,setvar:tx.critical_anomaly_score=5,setvar:tx.error_anomaly_score=4,setvar:tx.warning_anomaly_score=3,setvar:tx.notice_anomaly_score=2"','SecAction "id:900004,phase:1,pass,nolog,t:none,setvar:tx.anomaly_score=0"',"");let g=d.bypassBase;for(let a of e.bypassPaths??[]){let y=qc(a);if(!Ms(y)){o.push(`Bypass path "${a}" was dropped: it compiles to an unsafe regular expression.`);continue}i.push(`# Inspection bypass for ${nt(a)}. Every bypass is an unguarded route.`,`SecRule REQUEST_URI "@rx ${nt(y)}" "id:${g},phase:1,pass,nolog,ctl:ruleEngine=Off"`,""),g++}let m=d.exclusionBase;for(let a of e.exclusions??[]){if(!Number.isInteger(a.ruleId)||a.ruleId<=0){o.push(`Exclusion with rule id "${a.ruleId}" was dropped: the id is not a positive integer.`);continue}if(i.push(`# ${nt(a.reason)}`),a.pathPattern){if(!Ms(a.pathPattern)){o.push(`Exclusion for rule ${a.ruleId} was dropped: its path pattern is unsafe.`);continue}i.push(`SecRule REQUEST_URI "@rx ${nt(a.pathPattern)}" "id:${m},phase:1,pass,nolog,ctl:ruleRemoveById=${a.ruleId}"`),m++}else i.push(`SecRuleRemoveById ${a.ruleId}`);i.push("")}let p=b(r,d.rateLimitBase);if(p.lines.length>0)i.push("# Rate-limit route markers. SecLang has no counters, so the tag is set","# here and the counting stays in the ts-cloud limiter.",...p.lines);let f=d.customBase;for(let a of e.customRules??[])i.push(`# Operator-supplied rule ${f}.`,a.trim(),""),f++;if(t==="blocking")i.push("# Blocking decision: one rule, at the end, on the accumulated score.",`SecRule TX:ANOMALY_SCORE "@ge %{tx.inbound_anomaly_score_threshold}" "id:949110,phase:2,deny,status:${e.blockStatus??l.blockStatus},log,msg:'Inbound anomaly score exceeded (total: %{tx.anomaly_score})'"`,"");return{config:`${i.join(`
4
4
  `)}
5
- `,unmappedRateLimits:p.unmapped,warnings:o,mode:t}}function Ms(e={},r=[],t={}){let o=t.binary??"/usr/local/bin/zig-waf",s=t.configPath??"/etc/ts-cloud/waf.conf",n=Di(e,r);return`#!/usr/bin/env bash
5
+ `,unmappedRateLimits:p.unmapped,warnings:o,mode:t}}function Us(e={},r=[],t={}){let o=t.binary??"/usr/local/bin/zig-waf",s=t.configPath??"/etc/ts-cloud/waf.conf",n=Di(e,r);return`#!/usr/bin/env bash
6
6
  # Managed by ts-cloud. Installs the zig-waf ruleset.
7
7
  set -euo pipefail
8
8
 
@@ -33,5 +33,5 @@ fi
33
33
 
34
34
  mv "${s}.new" "${s}"
35
35
  echo "ts-cloud: WAF config installed (mode: ${n.mode})"
36
- `}function gm(e,r){return e.map((t)=>({projectId:r.projectId,environmentId:r.environmentId,resourceId:r.resourceId,kind:"event",source:"zig-waf",name:t.action==="blocked"?"waf.blocked":"waf.matched",timestamp:t.timestamp,value:1,host:t.host,pathTemplate:t.path,method:t.method,attributes:{ruleId:t.ruleId??null,anomalyScore:t.anomalyScore,action:t.action,messages:t.messages.slice(0,5)}}))}
37
- export{nt,Ls,Gc,Di,Ms,gm};
36
+ `}function fm(e,r){return e.map((t)=>({projectId:r.projectId,environmentId:r.environmentId,resourceId:r.resourceId,kind:"event",source:"zig-waf",name:t.action==="blocked"?"waf.blocked":"waf.matched",timestamp:t.timestamp,value:1,host:t.host,pathTemplate:t.path,method:t.method,attributes:{ruleId:t.ruleId??null,anomalyScore:t.anomalyScore,action:t.action,messages:t.messages.slice(0,5)}}))}
37
+ export{nt,Ms,qc,Di,Us,fm};
@@ -1,2 +1,2 @@
1
- import{p}from"./chunk-540wkkhs.js";import{L,x}from"./chunk-gbbcp2bw.js";class V{client;region;constructor(e="us-east-1",i){this.region=e,this.client=new p}async createQueue(e){let t={Action:"CreateQueue",QueueName:e.fifo&&!e.queueName.endsWith(".fifo")?`${e.queueName}.fifo`:e.queueName,Version:"2012-11-05"},s=1;if(e.visibilityTimeout!==void 0)t[`Attribute.${s}.Name`]="VisibilityTimeout",t[`Attribute.${s}.Value`]=e.visibilityTimeout.toString(),s++;if(e.messageRetentionPeriod!==void 0)t[`Attribute.${s}.Name`]="MessageRetentionPeriod",t[`Attribute.${s}.Value`]=e.messageRetentionPeriod.toString(),s++;if(e.delaySeconds!==void 0)t[`Attribute.${s}.Name`]="DelaySeconds",t[`Attribute.${s}.Value`]=e.delaySeconds.toString(),s++;if(e.maxMessageSize!==void 0)t[`Attribute.${s}.Name`]="MaximumMessageSize",t[`Attribute.${s}.Value`]=e.maxMessageSize.toString(),s++;if(e.receiveMessageWaitTime!==void 0)t[`Attribute.${s}.Name`]="ReceiveMessageWaitTimeSeconds",t[`Attribute.${s}.Value`]=e.receiveMessageWaitTime.toString(),s++;if(e.fifo){if(t[`Attribute.${s}.Name`]="FifoQueue",t[`Attribute.${s}.Value`]="true",s++,e.contentBasedDeduplication)t[`Attribute.${s}.Name`]="ContentBasedDeduplication",t[`Attribute.${s}.Value`]="true",s++}if(e.deadLetterTargetArn&&e.maxReceiveCount)t[`Attribute.${s}.Name`]="RedrivePolicy",t[`Attribute.${s}.Value`]=JSON.stringify({deadLetterTargetArn:e.deadLetterTargetArn,maxReceiveCount:e.maxReceiveCount}),s++;if(e.tags&&Object.keys(e.tags).length>0){let a=1;for(let[u,n]of Object.entries(e.tags))t[`Tag.${a}.Key`]=u,t[`Tag.${a}.Value`]=n,a++}let r=await this.client.request({service:"sqs",region:this.region,method:"POST",path:"/",body:new URLSearchParams(t).toString()});return{QueueUrl:r.QueueUrl||r.CreateQueueResult?.QueueUrl}}async listQueues(e){let i={Action:"ListQueues",Version:"2012-11-05"};if(e)i.QueueNamePrefix=e;let t=await this.client.request({service:"sqs",region:this.region,method:"POST",path:"/",body:new URLSearchParams(i).toString()}),s=[];if(t.QueueUrl)s.push(t.QueueUrl);else if(t.ListQueuesResult?.QueueUrl)if(Array.isArray(t.ListQueuesResult.QueueUrl))s.push(...t.ListQueuesResult.QueueUrl);else s.push(t.ListQueuesResult.QueueUrl);return{QueueUrls:s}}async getQueueAttributes(e){let i={Action:"GetQueueAttributes",QueueUrl:e,Version:"2012-11-05","AttributeName.1":"All"},t=await this.client.request({service:"sqs",region:this.region,method:"POST",path:"/",body:new URLSearchParams(i).toString()}),s={};for(let r of x(L(t,"GetQueueAttributes")?.Attribute))s[r.Name]=String(r.Value);return{Attributes:s}}async getQueueUrl(e){let i={Action:"GetQueueUrl",QueueName:e,Version:"2012-11-05"},t=await this.client.request({service:"sqs",region:this.region,method:"POST",path:"/",body:new URLSearchParams(i).toString()});return{QueueUrl:t.QueueUrl||t.GetQueueUrlResult?.QueueUrl}}async deleteQueue(e){let i={Action:"DeleteQueue",QueueUrl:e,Version:"2012-11-05"};await this.client.request({service:"sqs",region:this.region,method:"POST",path:"/",body:new URLSearchParams(i).toString()})}async purgeQueue(e){let i={Action:"PurgeQueue",QueueUrl:e,Version:"2012-11-05"};await this.client.request({service:"sqs",region:this.region,method:"POST",path:"/",body:new URLSearchParams(i).toString()})}async sendMessage(e){let i={Action:"SendMessage",QueueUrl:e.queueUrl,MessageBody:e.messageBody,Version:"2012-11-05"};if(e.delaySeconds!==void 0)i.DelaySeconds=e.delaySeconds;if(e.messageGroupId)i.MessageGroupId=e.messageGroupId;if(e.messageDeduplicationId)i.MessageDeduplicationId=e.messageDeduplicationId;let t=await this.client.request({service:"sqs",region:this.region,method:"POST",path:"/",body:new URLSearchParams(i).toString()});return{MessageId:t.MessageId||t.SendMessageResult?.MessageId}}async receiveMessages(e){let i={Action:"ReceiveMessage",QueueUrl:e.queueUrl,Version:"2012-11-05"};if(e.maxMessages!==void 0)i.MaxNumberOfMessages=e.maxMessages;if(e.visibilityTimeout!==void 0)i.VisibilityTimeout=e.visibilityTimeout;if(e.waitTimeSeconds!==void 0)i.WaitTimeSeconds=e.waitTimeSeconds;let t=await this.client.request({service:"sqs",region:this.region,method:"POST",path:"/",body:new URLSearchParams(i).toString()}),s=[],r=t.Message||t.ReceiveMessageResult?.Message;if(r)if(Array.isArray(r))s.push(...r.map((a)=>({MessageId:a.MessageId,ReceiptHandle:a.ReceiptHandle,Body:a.Body})));else s.push({MessageId:r.MessageId,ReceiptHandle:r.ReceiptHandle,Body:r.Body});return{Messages:s}}async deleteMessage(e,i){let t={Action:"DeleteMessage",QueueUrl:e,ReceiptHandle:i,Version:"2012-11-05"};await this.client.request({service:"sqs",region:this.region,method:"POST",path:"/",body:new URLSearchParams(t).toString()})}}
1
+ import{p}from"./chunk-btrxye8p.js";import{L,x}from"./chunk-bkx2kapc.js";class V{client;region;constructor(e="us-east-1",i){this.region=e,this.client=new p}async createQueue(e){let t={Action:"CreateQueue",QueueName:e.fifo&&!e.queueName.endsWith(".fifo")?`${e.queueName}.fifo`:e.queueName,Version:"2012-11-05"},s=1;if(e.visibilityTimeout!==void 0)t[`Attribute.${s}.Name`]="VisibilityTimeout",t[`Attribute.${s}.Value`]=e.visibilityTimeout.toString(),s++;if(e.messageRetentionPeriod!==void 0)t[`Attribute.${s}.Name`]="MessageRetentionPeriod",t[`Attribute.${s}.Value`]=e.messageRetentionPeriod.toString(),s++;if(e.delaySeconds!==void 0)t[`Attribute.${s}.Name`]="DelaySeconds",t[`Attribute.${s}.Value`]=e.delaySeconds.toString(),s++;if(e.maxMessageSize!==void 0)t[`Attribute.${s}.Name`]="MaximumMessageSize",t[`Attribute.${s}.Value`]=e.maxMessageSize.toString(),s++;if(e.receiveMessageWaitTime!==void 0)t[`Attribute.${s}.Name`]="ReceiveMessageWaitTimeSeconds",t[`Attribute.${s}.Value`]=e.receiveMessageWaitTime.toString(),s++;if(e.fifo){if(t[`Attribute.${s}.Name`]="FifoQueue",t[`Attribute.${s}.Value`]="true",s++,e.contentBasedDeduplication)t[`Attribute.${s}.Name`]="ContentBasedDeduplication",t[`Attribute.${s}.Value`]="true",s++}if(e.deadLetterTargetArn&&e.maxReceiveCount)t[`Attribute.${s}.Name`]="RedrivePolicy",t[`Attribute.${s}.Value`]=JSON.stringify({deadLetterTargetArn:e.deadLetterTargetArn,maxReceiveCount:e.maxReceiveCount}),s++;if(e.tags&&Object.keys(e.tags).length>0){let a=1;for(let[u,n]of Object.entries(e.tags))t[`Tag.${a}.Key`]=u,t[`Tag.${a}.Value`]=n,a++}let r=await this.client.request({service:"sqs",region:this.region,method:"POST",path:"/",body:new URLSearchParams(t).toString()});return{QueueUrl:r.QueueUrl||r.CreateQueueResult?.QueueUrl}}async listQueues(e){let i={Action:"ListQueues",Version:"2012-11-05"};if(e)i.QueueNamePrefix=e;let t=await this.client.request({service:"sqs",region:this.region,method:"POST",path:"/",body:new URLSearchParams(i).toString()}),s=[];if(t.QueueUrl)s.push(t.QueueUrl);else if(t.ListQueuesResult?.QueueUrl)if(Array.isArray(t.ListQueuesResult.QueueUrl))s.push(...t.ListQueuesResult.QueueUrl);else s.push(t.ListQueuesResult.QueueUrl);return{QueueUrls:s}}async getQueueAttributes(e){let i={Action:"GetQueueAttributes",QueueUrl:e,Version:"2012-11-05","AttributeName.1":"All"},t=await this.client.request({service:"sqs",region:this.region,method:"POST",path:"/",body:new URLSearchParams(i).toString()}),s={};for(let r of x(L(t,"GetQueueAttributes")?.Attribute))s[r.Name]=String(r.Value);return{Attributes:s}}async getQueueUrl(e){let i={Action:"GetQueueUrl",QueueName:e,Version:"2012-11-05"},t=await this.client.request({service:"sqs",region:this.region,method:"POST",path:"/",body:new URLSearchParams(i).toString()});return{QueueUrl:t.QueueUrl||t.GetQueueUrlResult?.QueueUrl}}async deleteQueue(e){let i={Action:"DeleteQueue",QueueUrl:e,Version:"2012-11-05"};await this.client.request({service:"sqs",region:this.region,method:"POST",path:"/",body:new URLSearchParams(i).toString()})}async purgeQueue(e){let i={Action:"PurgeQueue",QueueUrl:e,Version:"2012-11-05"};await this.client.request({service:"sqs",region:this.region,method:"POST",path:"/",body:new URLSearchParams(i).toString()})}async sendMessage(e){let i={Action:"SendMessage",QueueUrl:e.queueUrl,MessageBody:e.messageBody,Version:"2012-11-05"};if(e.delaySeconds!==void 0)i.DelaySeconds=e.delaySeconds;if(e.messageGroupId)i.MessageGroupId=e.messageGroupId;if(e.messageDeduplicationId)i.MessageDeduplicationId=e.messageDeduplicationId;let t=await this.client.request({service:"sqs",region:this.region,method:"POST",path:"/",body:new URLSearchParams(i).toString()});return{MessageId:t.MessageId||t.SendMessageResult?.MessageId}}async receiveMessages(e){let i={Action:"ReceiveMessage",QueueUrl:e.queueUrl,Version:"2012-11-05"};if(e.maxMessages!==void 0)i.MaxNumberOfMessages=e.maxMessages;if(e.visibilityTimeout!==void 0)i.VisibilityTimeout=e.visibilityTimeout;if(e.waitTimeSeconds!==void 0)i.WaitTimeSeconds=e.waitTimeSeconds;let t=await this.client.request({service:"sqs",region:this.region,method:"POST",path:"/",body:new URLSearchParams(i).toString()}),s=[],r=t.Message||t.ReceiveMessageResult?.Message;if(r)if(Array.isArray(r))s.push(...r.map((a)=>({MessageId:a.MessageId,ReceiptHandle:a.ReceiptHandle,Body:a.Body})));else s.push({MessageId:r.MessageId,ReceiptHandle:r.ReceiptHandle,Body:r.Body});return{Messages:s}}async deleteMessage(e,i){let t={Action:"DeleteMessage",QueueUrl:e,ReceiptHandle:i,Version:"2012-11-05"};await this.client.request({service:"sqs",region:this.region,method:"POST",path:"/",body:new URLSearchParams(t).toString()})}}
2
2
  export{V};
@@ -1,14 +1,14 @@
1
- var q;try{q=await import("node:crypto")}catch{}var v=new Map,Q=100,ee={appstream2:"appstream",cloudhsmv2:"cloudhsm",email:"ses",marketplace:"aws-marketplace",mobile:"AWSMobileHubService",pinpoint:"mobiletargeting",queue:"sqs","git-codecommit":"codecommit","mturk-requester-sandbox":"mturk-requester","personalize-runtime":"personalize"};function lc(e){let n=typeof e==="string"?new URL(e):e,{hostname:t,pathname:s}=n;if(t.endsWith(".on.aws")){let a=t.match(/^[^.]+\.lambda-url\.([^.]+)\.on\.aws$/);if(a)return{service:"lambda",region:a[1]};return{service:"",region:""}}if(t.endsWith(".r2.cloudflarestorage.com"))return{service:"s3",region:"auto"};if(t.endsWith(".backblazeb2.com")){let a=t.match(/^(?:[^.]+\.)?s3\.([^.]+)\.backblazeb2\.com$/);if(a)return{service:"s3",region:a[1]};return{service:"",region:""}}let c=t.replace("dualstack.","").match(/([^.]+)\.(?:([^.]+)\.)?amazonaws\.com(?:\.cn)?$/);if(!c)return{service:"",region:""};let r=c[1],i=c[2]||"";if(i==="us-gov")i="us-gov-west-1";else if(i==="s3"||i==="s3-accelerate")i="us-east-1",r="s3";else if(r==="iot")if(t.startsWith("iot."))r="execute-api";else if(t.startsWith("data.jobs.iot."))r="iot-jobs-data";else r=s==="/mqtt"?"iotdevicegateway":"iotdata";else if(r==="autoscaling");else if(!i&&r.startsWith("s3-"))i=r.slice(3).replace(/^fips-|^external-1/,""),r="s3";else if(r.endsWith("-fips"))r=r.slice(0,-5);else if(i&&/-\d$/.test(r)&&!/-\d$/.test(i))[r,i]=[i,r];return r=ee[r]||r,{service:r,region:i||"us-east-1"}}function Y(e){let{method:n,url:t,body:s="",accessKeyId:c,secretAccessKey:r,sessionToken:i,signQuery:a=!1,expiresIn:h=86400,datetime:m}=e,d=new URL(t),f=d.hostname,p=lc(d),u=e.service||p.service,g=e.region||p.region;if(!u)throw Error("Could not detect service from URL. Please provide service explicitly.");if(!g)throw Error("Could not detect region from URL. Please provide region explicitly.");let o=m||new Date().toISOString().replace(/[:-]|\.\d{3}/g,""),y=o.substring(0,8),S=[y,g,u,"aws4_request"].join("/"),b="AWS4-HMAC-SHA256";if(a)return te({urlObj:d,method:n,body:s,accessKeyId:c,secretAccessKey:r,sessionToken:i,service:u,region:g,timestamp:o,date:y,credentialScope:S,algorithm:b,expiresIn:h,cache:e.cache});let A=d.pathname||"/",x=I(d.searchParams),l={host:f,"x-amz-date":o,...e.headers};if(i)l["x-amz-security-token"]=i;let R=Object.keys(l).some((D)=>D.toLowerCase()==="content-type");if(s&&!R)l["content-type"]="application/x-amz-json-1.0";if(u==="s3"&&!l["x-amz-content-sha256"])l["x-amz-content-sha256"]=E(s);let P=_(l),w=N(l),U=l["x-amz-content-sha256"]||E(s),O=[n,j(A),x,P,w,U].join(`
1
+ var q;try{q=await import("node:crypto")}catch{}var v=new Map,Q=100,ee={appstream2:"appstream",cloudhsmv2:"cloudhsm",email:"ses",marketplace:"aws-marketplace",mobile:"AWSMobileHubService",pinpoint:"mobiletargeting",queue:"sqs","git-codecommit":"codecommit","mturk-requester-sandbox":"mturk-requester","personalize-runtime":"personalize"};function dc(e){let n=typeof e==="string"?new URL(e):e,{hostname:t,pathname:s}=n;if(t.endsWith(".on.aws")){let a=t.match(/^[^.]+\.lambda-url\.([^.]+)\.on\.aws$/);if(a)return{service:"lambda",region:a[1]};return{service:"",region:""}}if(t.endsWith(".r2.cloudflarestorage.com"))return{service:"s3",region:"auto"};if(t.endsWith(".backblazeb2.com")){let a=t.match(/^(?:[^.]+\.)?s3\.([^.]+)\.backblazeb2\.com$/);if(a)return{service:"s3",region:a[1]};return{service:"",region:""}}let c=t.replace("dualstack.","").match(/([^.]+)\.(?:([^.]+)\.)?amazonaws\.com(?:\.cn)?$/);if(!c)return{service:"",region:""};let r=c[1],i=c[2]||"";if(i==="us-gov")i="us-gov-west-1";else if(i==="s3"||i==="s3-accelerate")i="us-east-1",r="s3";else if(r==="iot")if(t.startsWith("iot."))r="execute-api";else if(t.startsWith("data.jobs.iot."))r="iot-jobs-data";else r=s==="/mqtt"?"iotdevicegateway":"iotdata";else if(r==="autoscaling");else if(!i&&r.startsWith("s3-"))i=r.slice(3).replace(/^fips-|^external-1/,""),r="s3";else if(r.endsWith("-fips"))r=r.slice(0,-5);else if(i&&/-\d$/.test(r)&&!/-\d$/.test(i))[r,i]=[i,r];return r=ee[r]||r,{service:r,region:i||"us-east-1"}}function Z(e){let{method:n,url:t,body:s="",accessKeyId:c,secretAccessKey:r,sessionToken:i,signQuery:a=!1,expiresIn:h=86400,datetime:m}=e,d=new URL(t),f=d.hostname,p=dc(d),u=e.service||p.service,g=e.region||p.region;if(!u)throw Error("Could not detect service from URL. Please provide service explicitly.");if(!g)throw Error("Could not detect region from URL. Please provide region explicitly.");let o=m||new Date().toISOString().replace(/[:-]|\.\d{3}/g,""),y=o.substring(0,8),S=[y,g,u,"aws4_request"].join("/"),b="AWS4-HMAC-SHA256";if(a)return te({urlObj:d,method:n,body:s,accessKeyId:c,secretAccessKey:r,sessionToken:i,service:u,region:g,timestamp:o,date:y,credentialScope:S,algorithm:b,expiresIn:h,cache:e.cache});let A=d.pathname||"/",x=I(d.searchParams),l={host:f,"x-amz-date":o,...e.headers};if(i)l["x-amz-security-token"]=i;let R=Object.keys(l).some((D)=>D.toLowerCase()==="content-type");if(s&&!R)l["content-type"]="application/x-amz-json-1.0";if(u==="s3"&&!l["x-amz-content-sha256"])l["x-amz-content-sha256"]=E(s);let P=_(l),w=N(l),U=l["x-amz-content-sha256"]||E(s),O=[n,j(A),x,P,w,U].join(`
2
2
  `),M=E(O),K=[b,o,S,M].join(`
3
- `),W=e.cache??v,L=J(r,y,g,u,K,W),X=[`${b} Credential=${c}/${S}`,`SignedHeaders=${w}`,`Signature=${L}`].join(", ");return l.authorization=X,{url:t,method:n,headers:l,body:s||void 0}}async function dc(e){let{method:n,url:t,body:s="",accessKeyId:c,secretAccessKey:r,sessionToken:i,signQuery:a=!1,expiresIn:h=86400,datetime:m}=e,d=new URL(t),f=d.hostname,p=lc(d),u=e.service||p.service,g=e.region||p.region;if(!u)throw Error("Could not detect service from URL. Please provide service explicitly.");if(!g)throw Error("Could not detect region from URL. Please provide region explicitly.");let o=m||new Date().toISOString().replace(/[:-]|\.\d{3}/g,""),y=o.substring(0,8),S=[y,g,u,"aws4_request"].join("/"),b="AWS4-HMAC-SHA256";if(a)return ne({urlObj:d,method:n,body:s,accessKeyId:c,secretAccessKey:r,sessionToken:i,service:u,region:g,timestamp:o,date:y,credentialScope:S,algorithm:b,expiresIn:h,cache:e.cache});let A=d.pathname||"/",x=I(d.searchParams),l={host:f,"x-amz-date":o,...e.headers};if(i)l["x-amz-security-token"]=i;let R=Object.keys(l).some((F)=>F.toLowerCase()==="content-type");if(s&&!R)l["content-type"]="application/x-amz-json-1.0";let P=await k(s);if(u==="s3"&&!l["x-amz-content-sha256"])l["x-amz-content-sha256"]=P;let w=_(l),U=N(l),O=l["x-amz-content-sha256"]||P,M=[n,j(A),x,w,U,O].join(`
3
+ `),W=e.cache??v,L=Y(r,y,g,u,K,W),X=[`${b} Credential=${c}/${S}`,`SignedHeaders=${w}`,`Signature=${L}`].join(", ");return l.authorization=X,{url:t,method:n,headers:l,body:s||void 0}}async function uc(e){let{method:n,url:t,body:s="",accessKeyId:c,secretAccessKey:r,sessionToken:i,signQuery:a=!1,expiresIn:h=86400,datetime:m}=e,d=new URL(t),f=d.hostname,p=dc(d),u=e.service||p.service,g=e.region||p.region;if(!u)throw Error("Could not detect service from URL. Please provide service explicitly.");if(!g)throw Error("Could not detect region from URL. Please provide region explicitly.");let o=m||new Date().toISOString().replace(/[:-]|\.\d{3}/g,""),y=o.substring(0,8),S=[y,g,u,"aws4_request"].join("/"),b="AWS4-HMAC-SHA256";if(a)return ne({urlObj:d,method:n,body:s,accessKeyId:c,secretAccessKey:r,sessionToken:i,service:u,region:g,timestamp:o,date:y,credentialScope:S,algorithm:b,expiresIn:h,cache:e.cache});let A=d.pathname||"/",x=I(d.searchParams),l={host:f,"x-amz-date":o,...e.headers};if(i)l["x-amz-security-token"]=i;let R=Object.keys(l).some((F)=>F.toLowerCase()==="content-type");if(s&&!R)l["content-type"]="application/x-amz-json-1.0";let P=await k(s);if(u==="s3"&&!l["x-amz-content-sha256"])l["x-amz-content-sha256"]=P;let w=_(l),U=N(l),O=l["x-amz-content-sha256"]||P,M=[n,j(A),x,w,U,O].join(`
4
4
  `),K=await k(M),W=[b,o,S,K].join(`
5
- `),L=e.cache??v,X=await V(r,y,g,u,W,L),D=[`${b} Credential=${c}/${S}`,`SignedHeaders=${U}`,`Signature=${X}`].join(", ");return l.authorization=D,{url:t,method:n,headers:l,body:s||void 0}}function te(e){let{urlObj:n,method:t,body:s,accessKeyId:c,secretAccessKey:r,sessionToken:i,service:a,region:h,timestamp:m,date:d,credentialScope:f,algorithm:p,expiresIn:u,cache:g}=e,o=new URL(n.toString());o.searchParams.set("X-Amz-Algorithm",p),o.searchParams.set("X-Amz-Credential",`${c}/${f}`),o.searchParams.set("X-Amz-Date",m),o.searchParams.set("X-Amz-Expires",String(u));let y=a==="s3"?"UNSIGNED-PAYLOAD":E(s);if(a==="s3")o.searchParams.set("X-Amz-Content-Sha256",y);let S="host";if(o.searchParams.set("X-Amz-SignedHeaders",S),i)o.searchParams.set("X-Amz-Security-Token",i);let b=j(o.pathname||"/"),A=`host:${o.hostname}
5
+ `),L=e.cache??v,X=await J(r,y,g,u,W,L),D=[`${b} Credential=${c}/${S}`,`SignedHeaders=${U}`,`Signature=${X}`].join(", ");return l.authorization=D,{url:t,method:n,headers:l,body:s||void 0}}function te(e){let{urlObj:n,method:t,body:s,accessKeyId:c,secretAccessKey:r,sessionToken:i,service:a,region:h,timestamp:m,date:d,credentialScope:f,algorithm:p,expiresIn:u,cache:g}=e,o=new URL(n.toString());o.searchParams.set("X-Amz-Algorithm",p),o.searchParams.set("X-Amz-Credential",`${c}/${f}`),o.searchParams.set("X-Amz-Date",m),o.searchParams.set("X-Amz-Expires",String(u));let y=a==="s3"?"UNSIGNED-PAYLOAD":E(s);if(a==="s3")o.searchParams.set("X-Amz-Content-Sha256",y);let S="host";if(o.searchParams.set("X-Amz-SignedHeaders",S),i)o.searchParams.set("X-Amz-Security-Token",i);let b=j(o.pathname||"/"),A=`host:${o.hostname}
6
6
  `,x=I(o.searchParams),l=[t,b,x,A,S,y].join(`
7
7
  `),R=[p,m,f,E(l)].join(`
8
- `),w=J(r,d,h,a,R,g??v);return o.searchParams.set("X-Amz-Signature",w),{url:o.toString(),method:t,headers:{},body:s||void 0}}async function ne(e){let{urlObj:n,method:t,body:s,accessKeyId:c,secretAccessKey:r,sessionToken:i,service:a,region:h,timestamp:m,date:d,credentialScope:f,algorithm:p,expiresIn:u,cache:g}=e,o=new URL(n.toString());o.searchParams.set("X-Amz-Algorithm",p),o.searchParams.set("X-Amz-Credential",`${c}/${f}`),o.searchParams.set("X-Amz-Date",m),o.searchParams.set("X-Amz-Expires",String(u));let y=a==="s3"?"UNSIGNED-PAYLOAD":await k(s);if(a==="s3")o.searchParams.set("X-Amz-Content-Sha256",y);let S="host";if(o.searchParams.set("X-Amz-SignedHeaders",S),i)o.searchParams.set("X-Amz-Security-Token",i);let b=j(o.pathname||"/"),A=`host:${o.hostname}
8
+ `),w=Y(r,d,h,a,R,g??v);return o.searchParams.set("X-Amz-Signature",w),{url:o.toString(),method:t,headers:{},body:s||void 0}}async function ne(e){let{urlObj:n,method:t,body:s,accessKeyId:c,secretAccessKey:r,sessionToken:i,service:a,region:h,timestamp:m,date:d,credentialScope:f,algorithm:p,expiresIn:u,cache:g}=e,o=new URL(n.toString());o.searchParams.set("X-Amz-Algorithm",p),o.searchParams.set("X-Amz-Credential",`${c}/${f}`),o.searchParams.set("X-Amz-Date",m),o.searchParams.set("X-Amz-Expires",String(u));let y=a==="s3"?"UNSIGNED-PAYLOAD":await k(s);if(a==="s3")o.searchParams.set("X-Amz-Content-Sha256",y);let S="host";if(o.searchParams.set("X-Amz-SignedHeaders",S),i)o.searchParams.set("X-Amz-Security-Token",i);let b=j(o.pathname||"/"),A=`host:${o.hostname}
9
9
  `,x=I(o.searchParams),l=[t,b,x,A,S,y].join(`
10
10
  `),R=[p,m,f,await k(l)].join(`
11
- `),w=await V(r,d,h,a,R,g??v);return o.searchParams.set("X-Amz-Signature",w),{url:o.toString(),method:t,headers:{},body:s||void 0}}function cs(e){let{url:n,method:t="GET",expiresIn:s=3600,...c}=e,r=Math.min(s,604800);return Y({...c,url:n,method:t,signQuery:!0,expiresIn:r}).url}async function xp(e){let{url:n,method:t="GET",expiresIn:s=3600,...c}=e,r=Math.min(s,604800);return(await dc({...c,url:n,method:t,signQuery:!0,expiresIn:r})).url}function _(e){return Object.keys(e).sort().map((n)=>`${n.toLowerCase()}:${e[n].trim().replace(/\s+/g," ")}`).join(`
11
+ `),w=await J(r,d,h,a,R,g??v);return o.searchParams.set("X-Amz-Signature",w),{url:o.toString(),method:t,headers:{},body:s||void 0}}function ls(e){let{url:n,method:t="GET",expiresIn:s=3600,...c}=e,r=Math.min(s,604800);return Z({...c,url:n,method:t,signQuery:!0,expiresIn:r}).url}async function _p(e){let{url:n,method:t="GET",expiresIn:s=3600,...c}=e,r=Math.min(s,604800);return(await uc({...c,url:n,method:t,signQuery:!0,expiresIn:r})).url}function _(e){return Object.keys(e).sort().map((n)=>`${n.toLowerCase()}:${e[n].trim().replace(/\s+/g," ")}`).join(`
12
12
  `)+`
13
- `}function N(e){return Object.keys(e).sort().map((n)=>n.toLowerCase()).join(";")}function I(e){let n=[];return e.forEach((t,s)=>{n.push([B(s),B(t)])}),n.sort((t,s)=>{if(t[0]<s[0])return-1;if(t[0]>s[0])return 1;if(t[1]<s[1])return-1;if(t[1]>s[1])return 1;return 0}),n.map(([t,s])=>`${t}=${s}`).join("&")}function j(e){return e.split("/").map((n)=>B(n)).join("/")}function B(e){return encodeURIComponent(e).replace(/[!'()*]/g,(n)=>`%${n.charCodeAt(0).toString(16).toUpperCase()}`)}function E(e){if(!q)throw Error("Synchronous hash not available in browser. Use signRequestAsync() instead.");return q.createHash("sha256").update(e,"utf8").digest("hex")}function C(e,n){if(!q)throw Error("Synchronous hmac not available in browser. Use signRequestAsync() instead.");return q.createHmac("sha256",e).update(n,"utf8").digest()}async function k(e){let t=new TextEncoder().encode(e),s=await crypto.subtle.digest("SHA-256",t);return G(new Uint8Array(s))}async function z(e,n){let t=new TextEncoder,s=typeof e==="string"?t.encode(e):e,c=t.encode(n),r=await crypto.subtle.importKey("raw",s.buffer,{name:"HMAC",hash:"SHA-256"},!1,["sign"]),i=await crypto.subtle.sign("HMAC",r,c.buffer);return new Uint8Array(i)}function G(e){return Array.from(e).map((n)=>n.toString(16).padStart(2,"0")).join("")}function J(e,n,t,s,c,r){let i=`${e}:${n}:${t}:${s}`,a=r.get(i);if(!a){let h=C(`AWS4${e}`,n),m=C(h,t),d=C(m,s);if(a=C(d,"aws4_request"),r.size>=Q){let f=r.keys().next().value;if(f)r.delete(f)}r.set(i,a)}return C(a,c).toString("hex")}async function V(e,n,t,s,c,r){let i=`${e}:${n}:${t}:${s}`,a=r.get(i);if(!a){let m=await z(`AWS4${e}`,n),d=await z(m,t),f=await z(d,s);if(a=await z(f,"aws4_request"),r.size>=Q){let p=r.keys().next().value;if(p)r.delete(p)}r.set(i,a)}let h=await z(a,c);return G(h)}function Z(e,n){return n.includes(e)}function T(e,n,t){let s=n*Math.pow(2,e),c=Math.random()*0.3*s;return Math.min(s+c,t)}function H(e){return new Promise((n)=>setTimeout(n,e))}async function Ot(e,n){let{maxRetries:t=3,initialDelayMs:s=100,maxDelayMs:c=5000,retryableStatusCodes:r=[429,500,502,503,504],timeoutMs:i=30000}=n??{},a,h;for(let m=0;m<=t;m++){let d=Y(e),f={method:d.method,headers:d.headers};if(d.body)f.body=d.body;let p=new AbortController,u=setTimeout(()=>p.abort(),i);f.signal=p.signal;try{let g=await fetch(d.url,f);if(clearTimeout(u),h=g,g.ok)return g;if(m<t&&Z(g.status,r)){let y=T(m,s,c);await H(y);continue}let o=await g.text();throw Error(`AWS API request failed (${g.status}): ${o}`)}catch(g){if(clearTimeout(u),a=g,g instanceof Error&&g.name==="AbortError")a=Error(`Request timed out after ${i}ms`);if(m<t&&!(g instanceof Error&&g.message.includes("AWS API request failed"))){let o=T(m,s,c);await H(o);continue}throw a}}throw a??Error("Request failed after retries")}async function _p(e){return Ot(e,{maxRetries:0})}async function Op(e,n){let{maxRetries:t=3,initialDelayMs:s=100,maxDelayMs:c=5000,retryableStatusCodes:r=[429,500,502,503,504],timeoutMs:i=30000}=n??{},a;for(let h=0;h<=t;h++){let m=await dc(e),d={method:m.method,headers:m.headers};if(m.body)d.body=m.body;let f=new AbortController,p=setTimeout(()=>f.abort(),i);d.signal=f.signal;try{let u=await fetch(m.url,d);if(clearTimeout(p),u.ok)return u;if(h<t&&Z(u.status,r)){let o=T(h,s,c);await H(o);continue}let g=await u.text();throw Error(`AWS API request failed (${u.status}): ${g}`)}catch(u){if(clearTimeout(p),a=u,u instanceof Error&&u.name==="AbortError")a=Error(`Request timed out after ${i}ms`);if(h<t&&!(u instanceof Error&&u.message.includes("AWS API request failed"))){let g=T(h,s,c);await H(g);continue}throw a}}throw a??Error("Request failed after retries")}async function xn(e){let n=await e.text(),t={},s=/<(\w+)>([^<]+)<\/\1>/g,c;while((c=s.exec(n))!==null){let[,r,i]=c;t[r]=i}return t}async function $p(e){return await e.json()}function Lp(){v.clear()}function Mp(){return v.size}function Up(){return q!==void 0}function Bp(){return typeof crypto<"u"&&typeof crypto.subtle<"u"}
14
- export{lc,Y,dc,cs,xp,Ot,_p,Op,xn,$p,Lp,Mp,Up,Bp};
13
+ `}function N(e){return Object.keys(e).sort().map((n)=>n.toLowerCase()).join(";")}function I(e){let n=[];return e.forEach((t,s)=>{n.push([B(s),B(t)])}),n.sort((t,s)=>{if(t[0]<s[0])return-1;if(t[0]>s[0])return 1;if(t[1]<s[1])return-1;if(t[1]>s[1])return 1;return 0}),n.map(([t,s])=>`${t}=${s}`).join("&")}function j(e){return e.split("/").map((n)=>B(n)).join("/")}function B(e){return encodeURIComponent(e).replace(/[!'()*]/g,(n)=>`%${n.charCodeAt(0).toString(16).toUpperCase()}`)}function E(e){if(!q)throw Error("Synchronous hash not available in browser. Use signRequestAsync() instead.");return q.createHash("sha256").update(e,"utf8").digest("hex")}function C(e,n){if(!q)throw Error("Synchronous hmac not available in browser. Use signRequestAsync() instead.");return q.createHmac("sha256",e).update(n,"utf8").digest()}async function k(e){let t=new TextEncoder().encode(e),s=await crypto.subtle.digest("SHA-256",t);return G(new Uint8Array(s))}async function z(e,n){let t=new TextEncoder,s=typeof e==="string"?t.encode(e):e,c=t.encode(n),r=await crypto.subtle.importKey("raw",s.buffer,{name:"HMAC",hash:"SHA-256"},!1,["sign"]),i=await crypto.subtle.sign("HMAC",r,c.buffer);return new Uint8Array(i)}function G(e){return Array.from(e).map((n)=>n.toString(16).padStart(2,"0")).join("")}function Y(e,n,t,s,c,r){let i=`${e}:${n}:${t}:${s}`,a=r.get(i);if(!a){let h=C(`AWS4${e}`,n),m=C(h,t),d=C(m,s);if(a=C(d,"aws4_request"),r.size>=Q){let f=r.keys().next().value;if(f)r.delete(f)}r.set(i,a)}return C(a,c).toString("hex")}async function J(e,n,t,s,c,r){let i=`${e}:${n}:${t}:${s}`,a=r.get(i);if(!a){let m=await z(`AWS4${e}`,n),d=await z(m,t),f=await z(d,s);if(a=await z(f,"aws4_request"),r.size>=Q){let p=r.keys().next().value;if(p)r.delete(p)}r.set(i,a)}let h=await z(a,c);return G(h)}function V(e,n){return n.includes(e)}function T(e,n,t){let s=n*Math.pow(2,e),c=Math.random()*0.3*s;return Math.min(s+c,t)}function H(e){return new Promise((n)=>setTimeout(n,e))}async function Ot(e,n){let{maxRetries:t=3,initialDelayMs:s=100,maxDelayMs:c=5000,retryableStatusCodes:r=[429,500,502,503,504],timeoutMs:i=30000}=n??{},a,h;for(let m=0;m<=t;m++){let d=Z(e),f={method:d.method,headers:d.headers};if(d.body)f.body=d.body;let p=new AbortController,u=setTimeout(()=>p.abort(),i);f.signal=p.signal;try{let g=await fetch(d.url,f);if(clearTimeout(u),h=g,g.ok)return g;if(m<t&&V(g.status,r)){let y=T(m,s,c);await H(y);continue}let o=await g.text();throw Error(`AWS API request failed (${g.status}): ${o}`)}catch(g){if(clearTimeout(u),a=g,g instanceof Error&&g.name==="AbortError")a=Error(`Request timed out after ${i}ms`);if(m<t&&!(g instanceof Error&&g.message.includes("AWS API request failed"))){let o=T(m,s,c);await H(o);continue}throw a}}throw a??Error("Request failed after retries")}async function Op(e){return Ot(e,{maxRetries:0})}async function $p(e,n){let{maxRetries:t=3,initialDelayMs:s=100,maxDelayMs:c=5000,retryableStatusCodes:r=[429,500,502,503,504],timeoutMs:i=30000}=n??{},a;for(let h=0;h<=t;h++){let m=await uc(e),d={method:m.method,headers:m.headers};if(m.body)d.body=m.body;let f=new AbortController,p=setTimeout(()=>f.abort(),i);d.signal=f.signal;try{let u=await fetch(m.url,d);if(clearTimeout(p),u.ok)return u;if(h<t&&V(u.status,r)){let o=T(h,s,c);await H(o);continue}let g=await u.text();throw Error(`AWS API request failed (${u.status}): ${g}`)}catch(u){if(clearTimeout(p),a=u,u instanceof Error&&u.name==="AbortError")a=Error(`Request timed out after ${i}ms`);if(h<t&&!(u instanceof Error&&u.message.includes("AWS API request failed"))){let g=T(h,s,c);await H(g);continue}throw a}}throw a??Error("Request failed after retries")}async function xn(e){let n=await e.text(),t={},s=/<(\w+)>([^<]+)<\/\1>/g,c;while((c=s.exec(n))!==null){let[,r,i]=c;t[r]=i}return t}async function Lp(e){return await e.json()}function Mp(){v.clear()}function Up(){return v.size}function Bp(){return q!==void 0}function Fp(){return typeof crypto<"u"&&typeof crypto.subtle<"u"}
14
+ export{dc,Z,uc,ls,_p,Ot,Op,$p,xn,Lp,Mp,Up,Bp,Fp};
@@ -1,2 +1,2 @@
1
- import{is,kn,ec,Nn,ss,as}from"./chunk-wayhpmn7.js";import{e}from"./chunk-4m2k5mvd.js";import{At}from"./chunk-gq4htm3f.js";import{execFileSync as C}from"node:child_process";import{mkdirSync as w,mkdtempSync as I,rmSync as U,writeFileSync as g}from"node:fs";import{tmpdir as j}from"node:os";import{dirname as O,join as o}from"node:path";function E(s,t){for(let r of t){let d=o(s,r.name);w(O(d),{recursive:!0}),g(d,r.data,r.mode?{mode:r.mode}:void 0)}}async function Gp(s){let{app:t,projectRoot:r,region:d,repository:u}=s,x=t.architecture??"x86_64",R=x==="arm64"?"linux/arm64":"linux/amd64",b=t.kind==="php",n=s.onStep??(()=>{}),a=I(o(j(),"tscloud-img-"));try{let h=o(a,"app");w(h,{recursive:!0});let f,y;if(b){ss({projectRoot:r,app:t,skipBuild:s.skipBuild,onStep:n}),n("staging application tree");let i=as(r);E(h,i),E(o(a,"runtime"),Nn().map((c)=>({name:c.path,data:c.contents,mode:c.mode})));let v=t.handlers?.http??"public/index.php";f={http:v,queue:t.handlers?.queue??v,cli:t.handlers?.cli??v},y=is(i.map((c)=>`${c.name}:${c.data.length}`).join("|"))}else{n("bundling application");let i=await kn({projectRoot:r,app:t,skipBuild:s.skipBuild,onStep:n});g(o(h,"index.mjs"),i.bundle),f=i.handlers,y=i.sha256}let B=y.slice(0,16);g(o(a,"Dockerfile"),ec({kind:t.kind??"node",phpVersion:t.phpVersion,architecture:x}));let k=new At(d),p;try{p=(await k.describeRepositories({repositoryNames:[u]})).repositories?.[0]?.repositoryUri??""}catch{p=""}if(!p)n(`creating ECR repository ${u}`),p=(await k.createRepository({repositoryName:u,imageScanningConfiguration:{scanOnPush:!0}})).repository?.repositoryUri??"";if(!p)throw Error(`could not resolve ECR repository URI for ${u}`);let l=`${p}:${B}`;n("docker build"),C("docker",["build","--platform",R,"--provenance=false","--sbom=false","-t",l,a],{stdio:"inherit"}),n("ecr auth + push");let m=(await k.getAuthorizationToken()).authorizationData?.[0];if(!m?.authorizationToken||!m.proxyEndpoint)throw Error("failed to get an ECR authorization token");let A=m.proxyEndpoint.replace(/^https?:\/\//,""),S=o(a,".docker");return w(S,{recursive:!0}),g(o(S,"config.json"),JSON.stringify({auths:{[A]:{auth:m.authorizationToken}}})),C("docker",["push",l],{stdio:"inherit",env:{...process.env,DOCKER_CONFIG:S}}),e(`Image: ${l}`),{imageUri:l,tag:B,handlers:f}}finally{U(a,{recursive:!0,force:!0})}}
2
- export{Gp};
1
+ import{os,kn,tc,Nn,as,cs}from"./chunk-sacx9p6f.js";import{e}from"./chunk-qpasspad.js";import{At}from"./chunk-z9g7fa1w.js";import{execFileSync as C}from"node:child_process";import{mkdirSync as w,mkdtempSync as I,rmSync as U,writeFileSync as g}from"node:fs";import{tmpdir as j}from"node:os";import{dirname as O,join as o}from"node:path";function E(s,t){for(let r of t){let d=o(s,r.name);w(O(d),{recursive:!0}),g(d,r.data,r.mode?{mode:r.mode}:void 0)}}async function qp(s){let{app:t,projectRoot:r,region:d,repository:u}=s,x=t.architecture??"x86_64",R=x==="arm64"?"linux/arm64":"linux/amd64",b=t.kind==="php",n=s.onStep??(()=>{}),a=I(o(j(),"tscloud-img-"));try{let h=o(a,"app");w(h,{recursive:!0});let f,y;if(b){as({projectRoot:r,app:t,skipBuild:s.skipBuild,onStep:n}),n("staging application tree");let i=cs(r);E(h,i),E(o(a,"runtime"),Nn().map((c)=>({name:c.path,data:c.contents,mode:c.mode})));let v=t.handlers?.http??"public/index.php";f={http:v,queue:t.handlers?.queue??v,cli:t.handlers?.cli??v},y=os(i.map((c)=>`${c.name}:${c.data.length}`).join("|"))}else{n("bundling application");let i=await kn({projectRoot:r,app:t,skipBuild:s.skipBuild,onStep:n});g(o(h,"index.mjs"),i.bundle),f=i.handlers,y=i.sha256}let B=y.slice(0,16);g(o(a,"Dockerfile"),tc({kind:t.kind??"node",phpVersion:t.phpVersion,architecture:x}));let k=new At(d),p;try{p=(await k.describeRepositories({repositoryNames:[u]})).repositories?.[0]?.repositoryUri??""}catch{p=""}if(!p)n(`creating ECR repository ${u}`),p=(await k.createRepository({repositoryName:u,imageScanningConfiguration:{scanOnPush:!0}})).repository?.repositoryUri??"";if(!p)throw Error(`could not resolve ECR repository URI for ${u}`);let l=`${p}:${B}`;n("docker build"),C("docker",["build","--platform",R,"--provenance=false","--sbom=false","-t",l,a],{stdio:"inherit"}),n("ecr auth + push");let m=(await k.getAuthorizationToken()).authorizationData?.[0];if(!m?.authorizationToken||!m.proxyEndpoint)throw Error("failed to get an ECR authorization token");let A=m.proxyEndpoint.replace(/^https?:\/\//,""),S=o(a,".docker");return w(S,{recursive:!0}),g(o(S,"config.json"),JSON.stringify({auths:{[A]:{auth:m.authorizationToken}}})),C("docker",["push",l],{stdio:"inherit",env:{...process.env,DOCKER_CONFIG:S}}),e(`Image: ${l}`),{imageUri:l,tag:B,handlers:f}}finally{U(a,{recursive:!0,force:!0})}}
2
+ export{qp};
@@ -0,0 +1 @@
1
+ import{D}from"./chunk-19mhwmfp.js";import"./chunk-btrxye8p.js";export{D as LambdaClient};
@@ -1,6 +1,6 @@
1
- var Kd={newConnectionsPerSecond:50,concurrentPerSource:100,synPerSecond:2000,burst:100,icmpPerSecond:5,banSeconds:600};function h(e){return{...Kd,...e.thresholds}}var _=/^(?:\d{1,3}\.){3}\d{1,3}(?:\/\d{1,2})?$|^[0-9a-f:]+(?:\/\d{1,3})?$/i;function wo(e){if(!_.test(e))return!1;let[t,n]=e.split("/");if(t.includes(":"))return n==null||Number(n)>=0&&Number(n)<=128;let s=t.split(".");if(s.length!==4||s.some((a)=>Number(a)>255||a===""))return!1;return n==null||Number(n)>=0&&Number(n)<=32}function f(e){return[...new Set((e??[]).map((t)=>t.trim()).filter(wo))]}function y(e){let t=(e??[80,443]).filter((n)=>Number.isInteger(n)&&n>=1&&n<=65535);return[...new Set(t)].sort((n,s)=>n-s)}function Jd(e={}){let t=h(e);return{"net.ipv4.tcp_syncookies":"1","net.ipv4.tcp_max_syn_backlog":String(Math.max(4096,t.synPerSecond*4)),"net.ipv4.tcp_synack_retries":"2","net.ipv4.tcp_abort_on_overflow":"1","net.ipv4.tcp_fin_timeout":"15","net.ipv4.tcp_keepalive_time":"300","net.ipv4.tcp_keepalive_intvl":"30","net.ipv4.tcp_keepalive_probes":"3","net.core.somaxconn":"4096","net.core.netdev_max_backlog":"16384","net.ipv4.conf.all.rp_filter":"1","net.ipv4.conf.default.rp_filter":"1","net.ipv4.conf.all.accept_source_route":"0","net.ipv4.conf.all.accept_redirects":"0","net.ipv4.conf.all.send_redirects":"0","net.ipv6.conf.all.accept_redirects":"0","net.ipv6.conf.all.accept_source_route":"0","net.ipv4.icmp_echo_ignore_broadcasts":"1","net.ipv4.icmp_ignore_bogus_error_responses":"1","net.netfilter.nf_conntrack_max":"262144","net.netfilter.nf_conntrack_tcp_timeout_established":"3600"}}function Xd(e={}){let t=["# Managed by ts-cloud. Edits are overwritten on the next deploy.","# Network hardening against L3/L4 floods.",""];for(let[n,s]of Object.entries(Jd(e)))t.push(`${n} = ${s}`);return`${t.join(`
1
+ var Jd={newConnectionsPerSecond:50,concurrentPerSource:100,synPerSecond:2000,burst:100,icmpPerSecond:5,banSeconds:600};function h(e){return{...Jd,...e.thresholds}}var _=/^(?:\d{1,3}\.){3}\d{1,3}(?:\/\d{1,2})?$|^[0-9a-f:]+(?:\/\d{1,3})?$/i;function Ao(e){if(!_.test(e))return!1;let[t,n]=e.split("/");if(t.includes(":"))return n==null||Number(n)>=0&&Number(n)<=128;let s=t.split(".");if(s.length!==4||s.some((a)=>Number(a)>255||a===""))return!1;return n==null||Number(n)>=0&&Number(n)<=32}function f(e){return[...new Set((e??[]).map((t)=>t.trim()).filter(Ao))]}function y(e){let t=(e??[80,443]).filter((n)=>Number.isInteger(n)&&n>=1&&n<=65535);return[...new Set(t)].sort((n,s)=>n-s)}function Xd(e={}){let t=h(e);return{"net.ipv4.tcp_syncookies":"1","net.ipv4.tcp_max_syn_backlog":String(Math.max(4096,t.synPerSecond*4)),"net.ipv4.tcp_synack_retries":"2","net.ipv4.tcp_abort_on_overflow":"1","net.ipv4.tcp_fin_timeout":"15","net.ipv4.tcp_keepalive_time":"300","net.ipv4.tcp_keepalive_intvl":"30","net.ipv4.tcp_keepalive_probes":"3","net.core.somaxconn":"4096","net.core.netdev_max_backlog":"16384","net.ipv4.conf.all.rp_filter":"1","net.ipv4.conf.default.rp_filter":"1","net.ipv4.conf.all.accept_source_route":"0","net.ipv4.conf.all.accept_redirects":"0","net.ipv4.conf.all.send_redirects":"0","net.ipv6.conf.all.accept_redirects":"0","net.ipv6.conf.all.accept_source_route":"0","net.ipv4.icmp_echo_ignore_broadcasts":"1","net.ipv4.icmp_ignore_bogus_error_responses":"1","net.netfilter.nf_conntrack_max":"262144","net.netfilter.nf_conntrack_tcp_timeout_established":"3600"}}function Qd(e={}){let t=["# Managed by ts-cloud. Edits are overwritten on the next deploy.","# Network hardening against L3/L4 floods.",""];for(let[n,s]of Object.entries(Xd(e)))t.push(`${n} = ${s}`);return`${t.join(`
2
2
  `)}
3
- `}function Qd(e={}){let t=h(e),n=y(e.ports),s=f(e.allowlist),a=f(e.blocklist),l=e.monitorOnly?"counter":"counter drop",i=e.originProtection?.enabled?f(e.originProtection.cdnRanges):[],c=s.filter((r)=>!r.includes(":")),p=s.filter((r)=>r.includes(":")),u=a.filter((r)=>!r.includes(":")),o=["#!/usr/sbin/nft -f","# Managed by ts-cloud. Edits are overwritten on the next deploy.","","table inet ts_cloud_ddos","delete table inet ts_cloud_ddos","","table inet ts_cloud_ddos {"," # Sources that tripped a limit, with a timeout so a ban self-expires.",` set banned4 { type ipv4_addr; flags timeout; timeout ${t.banSeconds}s; }`,` set banned6 { type ipv6_addr; flags timeout; timeout ${t.banSeconds}s; }`];if(c.length>0)o.push(` set allow4 { type ipv4_addr; flags interval; elements = { ${c.join(", ")} } }`);if(p.length>0)o.push(` set allow6 { type ipv6_addr; flags interval; elements = { ${p.join(", ")} } }`);if(u.length>0)o.push(` set block4 { type ipv4_addr; flags interval; elements = { ${u.join(", ")} } }`);if(i.length>0)o.push(` set cdn4 { type ipv4_addr; flags interval; elements = { ${i.filter((r)=>!r.includes(":")).join(", ")} } }`);if(o.push(""," chain input {"," type filter hook input priority -150; policy accept;",""," # Established traffic is already paid for; never re-inspect it."," ct state established,related accept"," iif lo accept",""," # Invalid packets are never legitimate and are cheap to drop early."," ct state invalid counter drop"),c.length>0)o.push(" ip saddr @allow4 accept");if(p.length>0)o.push(" ip6 saddr @allow6 accept");if(u.length>0)o.push(" ip saddr @block4 counter drop");if(o.push(" ip saddr @banned4 counter drop"," ip6 saddr @banned6 counter drop",""),o.push(" # Nonsense TCP flag combinations: scanners and stack fingerprinting."," tcp flags & (fin|syn) == (fin|syn) counter drop"," tcp flags & (syn|rst) == (syn|rst) counter drop"," tcp flags & (fin|rst) == (fin|rst) counter drop"," tcp flags & (fin|ack) == fin counter drop"," tcp flags & (syn|fin|ack|rst|psh|urg) == 0x0 counter drop",""," # Ping stays usable, ping floods do not.",` ip protocol icmp icmp type echo-request limit rate ${t.icmpPerSecond}/second burst ${t.burst} packets accept`," ip protocol icmp icmp type echo-request counter drop",""),n.length>0){let r=n.join(", ");if(o.push(" # Platform-wide SYN ceiling. Above it the kernel falls back to cookies.",` tcp dport { ${r} } ct state new limit rate ${t.synPerSecond}/second burst ${t.burst} packets accept`,""," # Per-source new-connection rate. This is what stops one host hammering.",` tcp dport { ${r} } ct state new meter conn_rate4 { ip saddr limit rate over ${t.newConnectionsPerSecond}/second burst ${t.burst} packets } add @banned4 { ip saddr } ${l}`,` tcp dport { ${r} } ct state new meter conn_rate6 { ip6 saddr limit rate over ${t.newConnectionsPerSecond}/second burst ${t.burst} packets } add @banned6 { ip6 saddr } ${l}`,""," # Concurrency ceiling per source: the slow-loris defence.",` tcp dport { ${r} } ct state new meter conn_count4 { ip saddr ct count over ${t.concurrentPerSource} } ${l}`,` tcp dport { ${r} } ct state new meter conn_count6 { ip6 saddr ct count over ${t.concurrentPerSource} } ${l}`,""),i.length>0)o.push(" # Origin protection: reject traffic that skipped the CDN and came"," # straight to the box, which is how an attacker bypasses the edge.",` tcp dport { ${r} } ip saddr != @cdn4 counter drop`,"")}return o.push(" }","}",""),o.join(`
3
+ `}function Yd(e={}){let t=h(e),n=y(e.ports),s=f(e.allowlist),a=f(e.blocklist),l=e.monitorOnly?"counter":"counter drop",i=e.originProtection?.enabled?f(e.originProtection.cdnRanges):[],c=s.filter((r)=>!r.includes(":")),p=s.filter((r)=>r.includes(":")),u=a.filter((r)=>!r.includes(":")),o=["#!/usr/sbin/nft -f","# Managed by ts-cloud. Edits are overwritten on the next deploy.","","table inet ts_cloud_ddos","delete table inet ts_cloud_ddos","","table inet ts_cloud_ddos {"," # Sources that tripped a limit, with a timeout so a ban self-expires.",` set banned4 { type ipv4_addr; flags timeout; timeout ${t.banSeconds}s; }`,` set banned6 { type ipv6_addr; flags timeout; timeout ${t.banSeconds}s; }`];if(c.length>0)o.push(` set allow4 { type ipv4_addr; flags interval; elements = { ${c.join(", ")} } }`);if(p.length>0)o.push(` set allow6 { type ipv6_addr; flags interval; elements = { ${p.join(", ")} } }`);if(u.length>0)o.push(` set block4 { type ipv4_addr; flags interval; elements = { ${u.join(", ")} } }`);if(i.length>0)o.push(` set cdn4 { type ipv4_addr; flags interval; elements = { ${i.filter((r)=>!r.includes(":")).join(", ")} } }`);if(o.push(""," chain input {"," type filter hook input priority -150; policy accept;",""," # Established traffic is already paid for; never re-inspect it."," ct state established,related accept"," iif lo accept",""," # Invalid packets are never legitimate and are cheap to drop early."," ct state invalid counter drop"),c.length>0)o.push(" ip saddr @allow4 accept");if(p.length>0)o.push(" ip6 saddr @allow6 accept");if(u.length>0)o.push(" ip saddr @block4 counter drop");if(o.push(" ip saddr @banned4 counter drop"," ip6 saddr @banned6 counter drop",""),o.push(" # Nonsense TCP flag combinations: scanners and stack fingerprinting."," tcp flags & (fin|syn) == (fin|syn) counter drop"," tcp flags & (syn|rst) == (syn|rst) counter drop"," tcp flags & (fin|rst) == (fin|rst) counter drop"," tcp flags & (fin|ack) == fin counter drop"," tcp flags & (syn|fin|ack|rst|psh|urg) == 0x0 counter drop",""," # Ping stays usable, ping floods do not.",` ip protocol icmp icmp type echo-request limit rate ${t.icmpPerSecond}/second burst ${t.burst} packets accept`," ip protocol icmp icmp type echo-request counter drop",""),n.length>0){let r=n.join(", ");if(o.push(" # Platform-wide SYN ceiling. Above it the kernel falls back to cookies.",` tcp dport { ${r} } ct state new limit rate ${t.synPerSecond}/second burst ${t.burst} packets accept`,""," # Per-source new-connection rate. This is what stops one host hammering.",` tcp dport { ${r} } ct state new meter conn_rate4 { ip saddr limit rate over ${t.newConnectionsPerSecond}/second burst ${t.burst} packets } add @banned4 { ip saddr } ${l}`,` tcp dport { ${r} } ct state new meter conn_rate6 { ip6 saddr limit rate over ${t.newConnectionsPerSecond}/second burst ${t.burst} packets } add @banned6 { ip6 saddr } ${l}`,""," # Concurrency ceiling per source: the slow-loris defence.",` tcp dport { ${r} } ct state new meter conn_count4 { ip saddr ct count over ${t.concurrentPerSource} } ${l}`,` tcp dport { ${r} } ct state new meter conn_count6 { ip6 saddr ct count over ${t.concurrentPerSource} } ${l}`,""),i.length>0)o.push(" # Origin protection: reject traffic that skipped the CDN and came"," # straight to the box, which is how an attacker bypasses the edge.",` tcp dport { ${r} } ip saddr != @cdn4 counter drop`,"")}return o.push(" }","}",""),o.join(`
4
4
  `)}function Pr(e={}){return`#!/usr/bin/env bash
5
5
  # Managed by ts-cloud. Installs L3/L4 flood mitigation.
6
6
  set -euo pipefail
@@ -13,11 +13,11 @@ fi
13
13
 
14
14
  install -d -m 0755 /etc/ts-cloud /etc/nftables.d
15
15
  cat > /etc/sysctl.d/90-ts-cloud-ddos.conf <<'SYSCTL_EOF'
16
- ${Xd(e)}SYSCTL_EOF
16
+ ${Qd(e)}SYSCTL_EOF
17
17
  sysctl --system >/dev/null
18
18
 
19
19
  cat > /etc/nftables.d/ts-cloud-ddos.nft.new <<'NFT_EOF'
20
- ${Qd(e)}NFT_EOF
20
+ ${Yd(e)}NFT_EOF
21
21
 
22
22
  # Syntax-check before applying: a bad ruleset would leave the box unprotected.
23
23
  if ! nft -c -f /etc/nftables.d/ts-cloud-ddos.nft.new; then
@@ -40,5 +40,5 @@ include "/etc/nftables.d/ts-cloud-ddos.nft"
40
40
  fi
41
41
  systemctl enable nftables >/dev/null 2>&1 || true
42
42
  echo "ts-cloud: L3/L4 mitigation active"
43
- `}var b=["off","monitor","rate_limit","challenge","lockdown"];function fm(e,t=[]){let n=[],s=Math.max(1,e.baselineRequestsPerSecond),a=e.requestsPerSecond/s,l=0,i=(g,v)=>{n.push(v),l=Math.max(l,b.indexOf(g))},c=a>=3;if(c)i("monitor",`Traffic is ${a.toFixed(1)}x the baseline.`);let p=e.topSourceShare>=0.25,u=e.errorRate>=0.25,o=(e.suspiciousAgentShare??0)>=0.5,r=e.uniqueSources>0&&e.requestsPerSecond/e.uniqueSources>=50;if(c&&p)i("rate_limit",`One source accounts for ${(e.topSourceShare*100).toFixed(0)}% of traffic.`);if(c&&r)i("rate_limit","Request rate per unique source is far above what a browser produces.");if(c&&u)i("challenge",`Error rate is ${(e.errorRate*100).toFixed(0)}% under load.`);if(c&&o)i("challenge","Most requests carry no recognisable browser agent.");if(a>=20&&(p||u||o||r))i("lockdown",`Traffic is ${a.toFixed(0)}x the baseline with attack-shaped characteristics.`);if(!c&&e.topSourceShare>=0.6&&e.requestsPerSecond>s)i("rate_limit","A single source dominates traffic without an overall surge.");let d=b[l],m={off:1,monitor:1,rate_limit:0.5,challenge:0.25,lockdown:0.1}[d];return{level:d,reasons:n,rateLimitFactor:m,challengeEnabled:d==="challenge"||d==="lockdown",staticOnly:d==="lockdown",banCandidates:d==="off"||d==="monitor"?[]:f(t)}}function Ao(e,t){return Math.max(1,Math.floor(e*t.rateLimitFactor))}
44
- export{Kd,wo,Jd,Xd,Qd,Pr,fm,Ao};
43
+ `}var b=["off","monitor","rate_limit","challenge","lockdown"];function hm(e,t=[]){let n=[],s=Math.max(1,e.baselineRequestsPerSecond),a=e.requestsPerSecond/s,l=0,i=(g,v)=>{n.push(v),l=Math.max(l,b.indexOf(g))},c=a>=3;if(c)i("monitor",`Traffic is ${a.toFixed(1)}x the baseline.`);let p=e.topSourceShare>=0.25,u=e.errorRate>=0.25,o=(e.suspiciousAgentShare??0)>=0.5,r=e.uniqueSources>0&&e.requestsPerSecond/e.uniqueSources>=50;if(c&&p)i("rate_limit",`One source accounts for ${(e.topSourceShare*100).toFixed(0)}% of traffic.`);if(c&&r)i("rate_limit","Request rate per unique source is far above what a browser produces.");if(c&&u)i("challenge",`Error rate is ${(e.errorRate*100).toFixed(0)}% under load.`);if(c&&o)i("challenge","Most requests carry no recognisable browser agent.");if(a>=20&&(p||u||o||r))i("lockdown",`Traffic is ${a.toFixed(0)}x the baseline with attack-shaped characteristics.`);if(!c&&e.topSourceShare>=0.6&&e.requestsPerSecond>s)i("rate_limit","A single source dominates traffic without an overall surge.");let d=b[l],m={off:1,monitor:1,rate_limit:0.5,challenge:0.25,lockdown:0.1}[d];return{level:d,reasons:n,rateLimitFactor:m,challengeEnabled:d==="challenge"||d==="lockdown",staticOnly:d==="lockdown",banCandidates:d==="off"||d==="monitor"?[]:f(t)}}function Ro(e,t){return Math.max(1,Math.floor(e*t.rateLimitFactor))}
44
+ export{Jd,Ao,Xd,Qd,Yd,Pr,hm,Ro};
@@ -0,0 +1 @@
1
+ import{fe}from"./chunk-zfn3a9sx.js";import"./chunk-btrxye8p.js";export{fe as RDSClient};
@@ -1,2 +1,2 @@
1
- function L(n,r){return(n?.[`${r}Response`]??n)?.[`${r}Result`]}function x(n){if(n===void 0||n===null||n==="")return[];return Array.isArray(n)?n:[n]}function aa(n){return n===!0||n==="true"}
2
- export{L,x,aa};
1
+ function L(n,r){return(n?.[`${r}Response`]??n)?.[`${r}Result`]}function x(n){if(n===void 0||n===null||n==="")return[];return Array.isArray(n)?n:[n]}function ca(n){return n===!0||n==="true"}
2
+ export{L,x,ca};
@@ -1,6 +1,6 @@
1
- import*as w from"node:crypto";import{existsSync as V,readFileSync as Y}from"node:fs";import{homedir as W}from"node:os";import{join as K}from"node:path";var j={amp:"&",lt:"<",gt:">",quot:'"',apos:"'"},z={nbsp:" ",copy:"©",reg:"®",trade:"™",euro:"€",pound:"£",yen:"¥",cent:"¢",deg:"°",micro:"µ",middot:"·",bull:"•",hellip:"…",prime:"′",Prime:"″",laquo:"«",raquo:"»",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",ndash:"–",mdash:"—",iexcl:"¡",iquest:"¿",sect:"§",para:"¶",dagger:"†",Dagger:"‡",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",times:"×",divide:"÷",plusmn:"±",ne:"≠",le:"≤",ge:"≥",infin:"∞",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",equiv:"≡",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜"};class D{customEntities={};useHtmlEntities;constructor(t=!1){this.useHtmlEntities=t}addEntity(t,e){this.customEntities[t]=e}decodeEntities(t){let e=t.indexOf("&");if(e===-1)return t;let r=t.length,i="",s=0;while(e!==-1&&e<r){if(e>s)i+=t.substring(s,e);let n=t.indexOf(";",e+1);if(n===-1||n-e>32){i+="&",s=e+1,e=t.indexOf("&",s);continue}let a=t.substring(e+1,n);if(a.charCodeAt(0)===35){let o=a.length,d=0,g=!1;if(o>2&&(a.charCodeAt(1)===120||a.charCodeAt(1)===88)){g=!0;for(let m=2;m<o;m++){let h=a.charCodeAt(m);if(h>=48&&h<=57)d=d<<4|h-48;else if(h>=65&&h<=70)d=d<<4|h-55;else if(h>=97&&h<=102)d=d<<4|h-87;else{g=!1;break}}}else if(o>1){g=!0;for(let m=1;m<o;m++){let h=a.charCodeAt(m);if(h>=48&&h<=57)d=d*10+(h-48);else{g=!1;break}}}if(g)i+=String.fromCodePoint(d);else i+=t.substring(e,n+1)}else{let o=this.customEntities[a];if(o===void 0){let d=a.length;if(d>=2&&d<=4){let g=a.charCodeAt(0);if(g===108&&d===2&&a.charCodeAt(1)===116)o="<";else if(g===103&&d===2&&a.charCodeAt(1)===116)o=">";else if(g===97&&d===3&&a.charCodeAt(1)===109&&a.charCodeAt(2)===112)o="&";else if(g===113&&d===4)o=a==="quot"?'"':void 0;else if(g===97&&d===4)o=a==="apos"?"'":void 0}if(o===void 0)o=j[a]??(this.useHtmlEntities?z[a]:void 0)}if(o!==void 0)i+=o;else i+=t.substring(e,n+1)}s=n+1,e=t.indexOf("&",s)}if(s<r)i+=t.substring(s);return i}}var T=[];T[38]="&amp;";T[60]="&lt;";T[62]="&gt;";T[34]="&quot;";T[39]="&apos;";var H={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,alwaysCreateTextNode:!1,trimValues:!0,parseTagValue:!0,parseAttributeValue:!1,processEntities:!0,htmlEntities:!1,commentPropName:!1,cdataPropName:!1,piPropName:!1,preserveOrder:!1,stopNodes:[],unpairedTags:[],isArray:void 0,tagValueProcessor:void 0,attributeValueProcessor:void 0,updateTag:void 0,numberParseOptions:{hex:!0,leadingZeros:!0,scientific:!0},ignorePiTags:!1,transformAttributeName:void 0,transformTagName:void 0,ignoreDeclaration:!1};function S(t){return t===32||t===9||t===10||t===13}function x(t){return t>=65&&t<=90||t>=97&&t<=122||t===95||t===58||t>=192&&t<=214||t>=216&&t<=246||t>=248&&t<=767||t>=880&&t<=893||t>=895&&t<=8191||t>=8204&&t<=8205||t>=8304&&t<=8591||t>=11264&&t<=12271||t>=12289&&t<=55295||t>=63744&&t<=64975||t>=65008&&t<=65533}function R(t){return x(t)||t===45||t===46||t>=48&&t<=57||t===183||t>=768&&t<=879||t>=8255&&t<=8256}var L=/^0x[\da-fA-F]+$/,X=/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/,M=/^[+-]?(\d+\.?\d*|\.\d+)$/;function v(t,e){return t.charCodeAt(e)===91&&t.charCodeAt(e+1)===67&&t.charCodeAt(e+2)===68&&t.charCodeAt(e+3)===65&&t.charCodeAt(e+4)===84&&t.charCodeAt(e+5)===65&&t.charCodeAt(e+6)===91}function I(t,e){let r=t.charCodeAt(e),i=t.charCodeAt(e+1),s=t.charCodeAt(e+2),n=t.charCodeAt(e+3),a=t.charCodeAt(e+4),o=t.charCodeAt(e+5),d=t.charCodeAt(e+6);return(r===68||r===100)&&(i===79||i===111)&&(s===67||s===99)&&(n===84||n===116)&&(a===89||a===121)&&(o===80||o===112)&&(d===69||d===101)}function G(t,e,r){if(e>=r||!x(t.charCodeAt(e)))return e;e++;while(e<r&&R(t.charCodeAt(e)))e++;return e}class Jt{options;entityDecoder;unpairedSet;exactStopNodes;wildcardStopSuffixes;needsJPath;_ignoreAttributes=!0;_textNodeName="#text";_commentPropName=!1;_cdataPropName=!1;_piPropName=!1;_alwaysCreateTextNode=!1;_trimValues=!0;_processEntities=!0;_parseTagValue=!0;_parseAttributeValue=!1;_removeNSPrefix=!1;_attrPrefix="@_";_attrsGroupName=!1;_ignorePiTags=!1;_ignoreDeclaration=!1;constructor(t){this.options={...H,...t},this.entityDecoder=new D(this.options.htmlEntities),this.unpairedSet=new Set(this.options.unpairedTags),this.exactStopNodes=new Set,this.wildcardStopSuffixes=[];for(let e of this.options.stopNodes)if(e.startsWith("*."))this.wildcardStopSuffixes.push(e.substring(2));else this.exactStopNodes.add(e);this._ignoreAttributes=this.options.ignoreAttributes,this._textNodeName=this.options.textNodeName,this._commentPropName=this.options.commentPropName,this._cdataPropName=this.options.cdataPropName,this._piPropName=this.options.piPropName,this._alwaysCreateTextNode=this.options.alwaysCreateTextNode,this._trimValues=this.options.trimValues,this._processEntities=this.options.processEntities,this._parseTagValue=this.options.parseTagValue,this._parseAttributeValue=this.options.parseAttributeValue,this._removeNSPrefix=this.options.removeNSPrefix,this._attrPrefix=this.options.attributeNamePrefix,this._attrsGroupName=this.options.attributesGroupName,this._ignorePiTags=this.options.ignorePiTags,this._ignoreDeclaration=this.options.ignoreDeclaration,this.needsJPath=this.options.stopNodes.length>0||this.options.isArray!==void 0||this.options.updateTag!==void 0||this.options.tagValueProcessor!==void 0||this.options.attributeValueProcessor!==void 0}addEntity(t,e){this.entityDecoder.addEntity(t,e)}parse(t){if(t instanceof Uint8Array)t=new TextDecoder().decode(t);let e=t;if(this.options.preserveOrder)return this.parseOrdered(e);return this.parseUnordered(e)}parseUnordered(t){let e={},r=t.length,i=0;if(r>0&&t.charCodeAt(0)===65279)i=1;return i=this.parseChildren(t,i,r,e,"",[]),e}parseOrdered(t){let e=t.length,r=0;if(e>0&&t.charCodeAt(0)===65279)r=1;let i=[];return this.parseChildrenOrdered(t,r,e,i,""),i}readTagName(t,e,r){return G(t,e,r)}extractTagName(t,e,r){let i=t.substring(e,r);if(this._removeNSPrefix){let s=i.indexOf(":");if(s!==-1)i=i.substring(s+1)}if(this.options.transformTagName)i=this.options.transformTagName(i);return i}parseAttributes(t,e,r,i,s){let n=0,a=this._removeNSPrefix,o=this.options.transformAttributeName,d=this._trimValues,g=this._processEntities,m=this.options.attributeValueProcessor;while(e<r){let h=t.charCodeAt(e);while(h===32||h===9||h===10||h===13){if(e++,e>=r)break;h=t.charCodeAt(e)}if(e>=r)break;if(h===62||h===47)break;let C=e;if(!x(h))break;e++;while(e<r&&R(t.charCodeAt(e)))e++;let f=t.substring(C,e);if(a){let A=f.indexOf(":");if(A!==-1)f=f.substring(A+1)}if(o)f=o(f);while(e<r&&S(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===61){e++;while(e<r&&S(t.charCodeAt(e)))e++;if(e>=r)break;let A=t.charCodeAt(e);if(A===34||A===39){e++;let y=e;while(e<r&&t.charCodeAt(e)!==A)e++;let u=t.substring(y,e);if(d&&u.length>0){let c=u.charCodeAt(0),l=u.charCodeAt(u.length-1);if(c<=32||l<=32)u=u.trim()}if(g)u=this.entityDecoder.decodeEntities(u);if(m)u=m(f,u,i)??u;if(s[f]=u,n++,e<r)e++}}else s[f]="true",n++}return n>0?-e-1:e}processTagValue(t,e,r,i,s){if(this._trimValues){let n=t.length;if(n>0){let a=t.charCodeAt(0),o=t.charCodeAt(n-1);if(a<=32||o<=32)t=t.trim()}}if(this._processEntities)t=this.entityDecoder.decodeEntities(t);if(this.options.tagValueProcessor){let n=this.options.tagValueProcessor(e,t,r,i,s);if(n!==void 0)t=n}if(!t)return t;if(this._parseTagValue)return this.parseValue(t);return t}parseValue(t){if(t==="true")return!0;if(t==="false")return!1;if(!t)return t;let e=t.charCodeAt(0);if(!(e>=48&&e<=57||e===43||e===45||e===46))return t;let i=this.options.numberParseOptions;if(i.skipLike?.test(t))return t;if(i.hex&&e===48&&L.test(t))return Number.parseInt(t,16);if(t.length>1&&e===48&&t.charCodeAt(1)!==46){if(i.leadingZeros)return t}if(i.scientific&&X.test(t)){let s=Number(t);if(!Number.isNaN(s))return s}if(M.test(t)){let s=Number(t);if(!Number.isNaN(s))return s}return t}parseAttributeValue(t){if(!this._parseAttributeValue)return t;return this.parseValue(t)}isStopNode(t){if(this.exactStopNodes.has(t))return!0;for(let e of this.wildcardStopSuffixes)if(t.endsWith(`.${e}`)||t===e)return!0;return!1}readStopNodeContent(t,e,r,i){let s=`</${i}`,n=t.indexOf(s,e);if(n===-1)return{content:t.substring(e),pos:r};let a=t.substring(e,n),o=n+s.length;while(o<r&&t.charCodeAt(o)!==62)o++;if(o<r)o++;return{content:a,pos:o}}addToObj(t,e,r,i,s,n){let a=t[e];if(a!==void 0)if(!Array.isArray(a))t[e]=[a,r];else a.push(r);else if(this.options.isArray?.(e,i,s,n))t[e]=[r];else t[e]=r}flushText(t,e,r,i){if(!t&&!e)return;let s=this._textNodeName;if(e){let n=t;if(n&&this._processEntities)n=this.entityDecoder.decodeEntities(n);let a=e+n;if(this._trimValues&&a.length>0){let o=a.charCodeAt(0),d=a.charCodeAt(a.length-1);if(o<=32||d<=32)a=a.trim()}if(this.options.tagValueProcessor){let o=this.options.tagValueProcessor(s,a,r,!1,!0);if(o!==void 0)a=o}if(a){let o=this._parseTagValue?this.parseValue(a):a;if(o!==void 0&&o!=="")this.addToObj(i,s,o,r,!0,!1)}}else{let n=this.processTagValue(t,s,r,!1,!0);if(n!==void 0&&n!=="")this.addToObj(i,s,n,r,!0,!1)}}parseChildren(t,e,r,i,s,n){let a="",o="",d=this.needsJPath;while(e<r){if(t.charCodeAt(e)!==60){let c=e;e++;while(e<r&&t.charCodeAt(e)!==60)e++;if(!a)a=t.substring(c,e);else a+=t.substring(c,e);continue}if(e+1>=r)break;let m=t.charCodeAt(e+1);if(m===33&&e+3<r&&t.charCodeAt(e+2)===45&&t.charCodeAt(e+3)===45){if(a||o)this.flushText(a,o,s,i),a="",o="";e+=4;let c=t.indexOf("-->",e);if(c===-1){e=r;break}if(this._commentPropName){let l=t.substring(e,c);this.addToObj(i,this._commentPropName,l,s,!0,!1)}e=c+3;continue}if(m===33&&e+8<r&&v(t,e+2)){e+=9;let c=t.indexOf("]]>",e);if(c===-1){e=r;break}let l=t.substring(e,c);if(this._cdataPropName)this.flushText(a,o,s,i),a="",o="",this.addToObj(i,this._cdataPropName,l,s,!0,!1);else{if(a){let b=a;if(this._processEntities)b=this.entityDecoder.decodeEntities(b);o+=b,a=""}o+=l}e=c+3;continue}if(m===33&&e+9<r&&I(t,e+2)){e+=9;let c=1;while(e<r&&c>0){let l=t.charCodeAt(e);if(l===60)c++;else if(l===62)c--;e++}continue}if(m===63){e+=2;let c=e;while(e<r&&!S(t.charCodeAt(e))&&t.charCodeAt(e)!==63)e++;let l=t.substring(c,e),b=t.indexOf("?>",e);if(b===-1){e=r;break}let E=t.substring(e,b).trim();if(l==="xml"){if(!this._ignoreDeclaration&&this._piPropName){let _=this.parsePiAttributes(E);this.addToObj(i,this._piPropName,{[l]:_},s,!0,!1)}}else if(!this._ignorePiTags&&this._piPropName)this.addToObj(i,this._piPropName,{[l]:E},s,!0,!1);e=b+2;continue}if(m===47){if(a||o)this.flushText(a,o,s,i),a="",o="";e+=2;let c=e,l=this.readTagName(t,e,r),b=this.extractTagName(t,c,l);e=l;while(e<r&&S(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===62)e++;if(n.length>0&&n[n.length-1]===b){n.pop();continue}return e}if(a||o)this.flushText(a,o,s,i),a="",o="";e++;let h=e,C=this.readTagName(t,e,r),f=this.extractTagName(t,h,C);if(!f){e=C+1;continue}e=C;let A=d?s?`${s}.${f}`:f:"",y={},u=!1;if(!this._ignoreAttributes){let c=this.parseAttributes(t,e,r,A,y);if(c<0)e=-c-1,u=!0;else e=c}else while(e<r){let c=t.charCodeAt(e);if(c===62||c===47)break;if(c===34||c===39){e++;while(e<r&&t.charCodeAt(e)!==c)e++}e++}if(this.options.updateTag){if(this.options.updateTag(f,A,y)===!1){while(e<r&&S(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===47)e+=2;else if(e<r&&t.charCodeAt(e)===62){e++;let l=`</${f}>`,b=t.indexOf(l,e);if(b!==-1)e=b+l.length}continue}}while(e<r&&S(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===47){if(e+=2,u||this._alwaysCreateTextNode){let c={};if(u)this.applyAttributes(c,y,A);if(this._alwaysCreateTextNode)c[this._textNodeName]="";this.addToObj(i,f,c,A,!0,!1)}else this.addToObj(i,f,"",A,!0,!1);continue}if(e<r&&t.charCodeAt(e)===62){if(e++,this.unpairedSet.has(f)){if(u){let E={};this.applyAttributes(E,y,A),this.addToObj(i,f,E,A,!0,!1)}else this.addToObj(i,f,"",A,!0,!1);n.push(f);continue}if(this.exactStopNodes.size>0||this.wildcardStopSuffixes.length>0){if(this.isStopNode(A)){let E=this.readStopNodeContent(t,e,r,f),_={};if(u)this.applyAttributes(_,y,A);if(E.content)_[this._textNodeName]=E.content;this.addToObj(i,f,_,A,!0,!1),e=E.pos;continue}}let c={};if(u)this.applyAttributes(c,y,A);e=this.parseChildren(t,e,r,c,A,n);let l=this._textNodeName,b=c[l];if(!u&&!this._alwaysCreateTextNode){let E=!0;for(let _ in c)if(_!==l){E=!1;break}if(E){this.addToObj(i,f,b!==void 0?b:"",A,!0,!1);continue}}this.addToObj(i,f,c,A,!1,!1)}}if(a||o)this.flushText(a,o,s,i);return e}parseChildrenOrdered(t,e,r,i,s){let n="",a=this.needsJPath;while(e<r){if(t.charCodeAt(e)!==60){let u=e;e++;while(e<r&&t.charCodeAt(e)!==60)e++;if(!n)n=t.substring(u,e);else n+=t.substring(u,e);continue}if(e+1>=r)break;let d=t.charCodeAt(e+1);if(d===33&&e+3<r&&t.charCodeAt(e+2)===45&&t.charCodeAt(e+3)===45){if(n){let c=this.processTagValue(n,this._textNodeName,s,!1,!0);if(c!==void 0&&c!=="")i.push({[this._textNodeName]:c});n=""}e+=4;let u=t.indexOf("-->",e);if(u===-1){e=r;break}if(this._commentPropName)i.push({[this._commentPropName]:[{[this._textNodeName]:t.substring(e,u)}]});e=u+3;continue}if(d===33&&e+8<r&&v(t,e+2)){e+=9;let u=t.indexOf("]]>",e);if(u===-1){e=r;break}let c=t.substring(e,u);if(this._cdataPropName){if(n){let l=this.processTagValue(n,this._textNodeName,s,!1,!0);if(l!==void 0&&l!=="")i.push({[this._textNodeName]:l});n=""}i.push({[this._cdataPropName]:[{[this._textNodeName]:c}]})}else n+=c;e=u+3;continue}if(d===33&&e+9<r&&I(t,e+2)){e+=9;let u=1;while(e<r&&u>0){let c=t.charCodeAt(e);if(c===60)u++;else if(c===62)u--;e++}continue}if(d===63){e+=2;let u=t.indexOf("?>",e);if(u===-1){e=r;break}e=u+2;continue}if(d===47){if(n){let c=this.processTagValue(n,this._textNodeName,s,!1,!0);if(c!==void 0&&c!=="")i.push({[this._textNodeName]:c});n=""}e+=2,e=this.readTagName(t,e,r);while(e<r&&S(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===62)e++;return e}if(n){let u=this.processTagValue(n,this._textNodeName,s,!1,!0);if(u!==void 0&&u!=="")i.push({[this._textNodeName]:u});n=""}e++;let g=e,m=this.readTagName(t,e,r),h=this.extractTagName(t,g,m);if(!h){e=m+1;continue}e=m;let C=a?s?`${s}.${h}`:h:"",f={},A=!1;if(!this._ignoreAttributes){let u=this.parseAttributes(t,e,r,C,f);if(u<0)e=-u-1,A=!0;else e=u}else while(e<r){let u=t.charCodeAt(e);if(u===62||u===47)break;if(u===34||u===39){e++;while(e<r&&t.charCodeAt(e)!==u)e++}e++}while(e<r&&S(t.charCodeAt(e)))e++;let y={[h]:[]};if(A){y[":@"]={};for(let c in f)y[":@"][this._attrPrefix+c]=this.parseAttributeValue(f[c])}if(e<r&&t.charCodeAt(e)===47){e+=2,i.push(y);continue}if(e<r&&t.charCodeAt(e)===62)e++,e=this.parseChildrenOrdered(t,e,r,y[h],C),i.push(y)}if(n){let o=this.processTagValue(n,this._textNodeName,s,!1,!0);if(o!==void 0&&o!=="")i.push({[this._textNodeName]:o})}return e}applyAttributes(t,e,r){let i=this._attrPrefix;if(this._attrsGroupName){let s={};for(let n in e)s[i+n]=this.parseAttributeValue(e[n]);t[this._attrsGroupName]=s}else for(let s in e)t[i+s]=this.parseAttributeValue(e[s])}parsePiAttributes(t){let e={},r=0,i=t.length;while(r<i){while(r<i&&S(t.charCodeAt(r)))r++;if(r>=i)break;let s=r;while(r<i&&!S(t.charCodeAt(r))&&t.charCodeAt(r)!==61)r++;let n=t.substring(s,r);if(!n)break;while(r<i&&S(t.charCodeAt(r)))r++;if(r<i&&t.charCodeAt(r)===61){r++;while(r<i&&S(t.charCodeAt(r)))r++;if(r<i){let a=t.charCodeAt(r);if(a===34||a===39){r++;let o=r;while(r<i&&t.charCodeAt(r)!==a)r++;if(e[n]=t.substring(o,r),r<i)r++}}}}return e}}function Xt(t){let e=t.endpoint||`s3.${t.region}.amazonaws.com`,r=new URL(/^https?:\/\//i.test(e)?e:`https://${e}`);if(r.protocol!=="http:"&&r.protocol!=="https:"||r.pathname!=="/"&&r.pathname!==""||r.search||r.hash||r.username||r.password)throw Error("S3 endpoint must be an HTTP(S) origin without a path");let i=r.protocol.slice(0,-1),s=r.host;if(!t.bucket)return{protocol:i,host:s,path:t.path};if(t.forcePathStyle){let n=t.path==="/"?`/${t.bucket}`:`/${t.bucket}${t.path}`;return{protocol:i,host:s,path:n}}return{protocol:i,host:`${t.bucket}.${s}`,path:t.path}}var J={email:"ses","bedrock-runtime":"bedrock","bedrock-agent":"bedrock","bedrock-agent-runtime":"bedrock","personalize-runtime":"personalize","personalize-events":"personalize"};function nu(t){return J[t]??t}function iu(t,e){if(t==="s3")return e;return e.split("/").map((r)=>encodeURIComponent(r).replace(/[!'()*]/g,(i)=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`)).join("/")}function Ko(t){if(typeof t==="string"){if(t==="true")return!0;if(t==="false")return!1;let e=Number(t);if(t!==""&&Number.isFinite(e)&&String(e)===t)return e;return t}if(Array.isArray(t))return t.map(Ko);if(t&&typeof t==="object"){let e={};for(let[r,i]of Object.entries(t))e[r]=Ko(i);return e}return t}var Z=new Set(["InvalidClientTokenId","UnrecognizedClientException","InvalidAccessKeyId","SignatureDoesNotMatch","IncompleteSignature","ExpiredToken","ExpiredTokenException","InvalidToken","AuthFailure"]);class p{credentials;credentialSource="no credentials";config;cache;xmlParser;constructor(t,e){if(this.config={maxRetries:3,retryDelay:1000,cacheEnabled:!0,defaultCacheTTL:60000,...e},t)this.credentialSource="credentials passed to AWSClient";this.credentials=t||this.loadCredentials(),this.cache=new Map,this.xmlParser=new Jt({ignoreAttributes:!1,attributeNamePrefix:"@_",textNodeName:"#text",parseTagValue:!1,parseAttributeValue:!1,trimValues:!0})}loadCredentials(){let t=process.env.AWS_ACCESS_KEY_ID,e=process.env.AWS_SECRET_ACCESS_KEY,r=process.env.AWS_SESSION_TOKEN;if(t&&e)return this.credentialSource="AWS_ACCESS_KEY_ID in the environment",{accessKeyId:t,secretAccessKey:e,sessionToken:r};let i=this.loadCredentialsFromFile();if(i)return i;return{accessKeyId:"",secretAccessKey:""}}loadCredentialsFromFile(){let t=this.config?.profile||process.env.AWS_PROFILE||"default",e=process.env.AWS_SHARED_CREDENTIALS_FILE||K(W(),".aws","credentials");if(!V(e))return null;try{let r=Y(e,"utf-8"),i=this.parseCredentialsFile(r,t);if(i.accessKeyId&&i.secretAccessKey)return this.credentialSource=`profile "${t}" in ${e}`,i}catch{}return null}parseCredentialsFile(t,e){let r=t.split(`
2
- `),i="",s="",n="",a;for(let o of r){let d=o.trim();if(!d||d.startsWith("#"))continue;let g=d.match(/^\[([^\]]+)\]$/);if(g){i=g[1];continue}if(i===e){let[m,...h]=d.split("="),C=h.join("=").trim();if(m.trim()==="aws_access_key_id")s=C;else if(m.trim()==="aws_secret_access_key")n=C;else if(m.trim()==="aws_session_token")a=C}}return{accessKeyId:s,secretAccessKey:n,sessionToken:a}}ec2CredentialsCache;async getCredentials(){let t=process.env.AWS_ACCESS_KEY_ID,e=process.env.AWS_SECRET_ACCESS_KEY;if(t&&e)return this.credentialSource="AWS_ACCESS_KEY_ID in the environment",{accessKeyId:t,secretAccessKey:e,sessionToken:process.env.AWS_SESSION_TOKEN};let r=this.loadCredentialsFromFile();if(r)return r;if(this.ec2CredentialsCache){let i=Date.now();if(this.ec2CredentialsCache.expiration>i+300000)return this.credentialSource="EC2 instance metadata",this.ec2CredentialsCache.credentials}try{let s=await(await fetch("http://169.254.169.254/latest/api/token",{method:"PUT",headers:{"X-aws-ec2-metadata-token-ttl-seconds":"21600"}})).text(),a=await(await fetch("http://169.254.169.254/latest/meta-data/iam/security-credentials/",{headers:{"X-aws-ec2-metadata-token":s}})).text(),d=await(await fetch(`http://169.254.169.254/latest/meta-data/iam/security-credentials/${a}`,{headers:{"X-aws-ec2-metadata-token":s}})).json(),g={accessKeyId:d.AccessKeyId,secretAccessKey:d.SecretAccessKey,sessionToken:d.Token};return this.credentialSource="EC2 instance metadata",this.ec2CredentialsCache={credentials:g,expiration:new Date(d.Expiration).getTime()},g}catch(i){throw Error("AWS credentials not found. Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables, or run on an EC2 instance with an IAM role.")}}async request(t){if(t.method==="GET"&&this.config.cacheEnabled&&t.cacheKey){let i=this.getFromCache(t.cacheKey);if(i!==null)return i}let e=t.retries??this.config.maxRetries??3,r=null;for(let i=0;i<=e;i++)try{let s=await this.makeRequest(t);if(t.method==="GET"&&this.config.cacheEnabled&&t.cacheKey)this.setInCache(t.cacheKey,s,t.cacheTTL??this.config.defaultCacheTTL??60000);return s}catch(s){if(r=s,!this.shouldRetry(s))throw s;if(i===e)throw s;let a=this.calculateRetryDelay(i);await this.sleep(a)}throw r||Error("Request failed after retries")}async makeRequest(t){let e=t.credentials||(this.credentials?.accessKeyId?this.credentials:await this.getCredentials());if(!e||!e.accessKeyId||!e.secretAccessKey)throw Error("AWS credentials not provided");let r=this.buildUrl(t),i=this.signRequest(t,e),s=await fetch(r,{method:t.method,headers:i,body:t.body});if(t.streamResponse&&s.ok)return s;let n=await s.text();if(!s.ok){let o=this.parseError(n,s.status,s.headers);if(o.code&&Z.has(String(o.code).split("#").pop())){let d=t.credentials?"credentials passed with the request":this.credentialSource;o.message+=` (credentials from ${d})`}throw o}if(!n||n.trim()===""){if(t.returnHeaders)return{body:null,headers:this.headersToObject(s.headers)};return null}if(t.rawResponse){if(t.returnHeaders)return{body:n,headers:this.headersToObject(s.headers)};return n}let a;if(n.startsWith("<"))a=this.parseXmlResponse(n);else try{a=JSON.parse(n)}catch{a=n}if(t.returnHeaders)return{body:a,headers:this.headersToObject(s.headers)};return a}headersToObject(t){let e={};return t.forEach((r,i)=>{e[i]=r}),e}buildUrl(t){let{service:e,region:r,queryParams:i}=t,{path:s}=t,n,a="https";if(e==="s3"){let d=Xt({region:r,path:s,bucket:t.bucket,endpoint:this.config.endpoint,forcePathStyle:this.config.forcePathStyle});a=d.protocol,n=d.host,s=d.path}else if(e==="cloudfront")n="cloudfront.amazonaws.com";else if(e==="iam")n="iam.amazonaws.com";else if(e==="route53")n="route53.amazonaws.com";else if(e==="route53domains")n="route53domains.us-east-1.amazonaws.com";else if(e==="ecr")n=`api.ecr.${r}.amazonaws.com`;else if(e==="ses")n=`email.${r}.amazonaws.com`;else n=`${e}.${r}.amazonaws.com`;let o=`${a}://${n}${s}`;if(i&&Object.keys(i).length>0){let d=Object.keys(i).map((g)=>`${this.uriEncode(g)}=${this.uriEncode(i[g])}`).join("&");o+=`?${d}`}return o}signRequest(t,e){let{service:r,region:i,method:s,queryParams:n,body:a}=t,{path:o}=t,d=new Date,g=this.getAmzDate(d),m=this.getDateStamp(d),h;if(r==="s3"){let N=Xt({region:i,path:o,bucket:t.bucket,endpoint:this.config.endpoint,forcePathStyle:this.config.forcePathStyle});h=N.host,o=N.path}else if(r==="cloudfront")h="cloudfront.amazonaws.com";else if(r==="iam")h="iam.amazonaws.com";else if(r==="route53")h="route53.amazonaws.com";else if(r==="route53domains")h="route53domains.us-east-1.amazonaws.com";else if(r==="ecr")h=`api.ecr.${i}.amazonaws.com`;else if(r==="ses")h=`email.${i}.amazonaws.com`;else h=`${r}.${i}.amazonaws.com`;let C={host:h,"x-amz-date":g,...t.headers||{}};if(e.sessionToken)C["x-amz-security-token"]=e.sessionToken;if(a){if(!Object.keys(C).some((P)=>P.toLowerCase()==="content-type"))C["content-type"]="application/x-www-form-urlencoded";C["content-length"]=Buffer.byteLength(a).toString()}let f=this.sha256(a||"");C["x-amz-content-sha256"]=f;let A=iu(r,o),y=n?Object.keys(n).sort().map((N)=>`${this.uriEncode(N)}=${this.uriEncode(n[N])}`).join("&"):"",u=Object.keys(C).sort((N,P)=>N.toLowerCase().localeCompare(P.toLowerCase())),c=u.map((N)=>`${N.toLowerCase()}:${C[N].trim()}
1
+ import*as w from"node:crypto";import{existsSync as V,readFileSync as Y}from"node:fs";import{homedir as W}from"node:os";import{join as K}from"node:path";var j={amp:"&",lt:"<",gt:">",quot:'"',apos:"'"},z={nbsp:" ",copy:"©",reg:"®",trade:"™",euro:"€",pound:"£",yen:"¥",cent:"¢",deg:"°",micro:"µ",middot:"·",bull:"•",hellip:"…",prime:"′",Prime:"″",laquo:"«",raquo:"»",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",ndash:"–",mdash:"—",iexcl:"¡",iquest:"¿",sect:"§",para:"¶",dagger:"†",Dagger:"‡",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",times:"×",divide:"÷",plusmn:"±",ne:"≠",le:"≤",ge:"≥",infin:"∞",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",equiv:"≡",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜"};class D{customEntities={};useHtmlEntities;constructor(t=!1){this.useHtmlEntities=t}addEntity(t,e){this.customEntities[t]=e}decodeEntities(t){let e=t.indexOf("&");if(e===-1)return t;let r=t.length,i="",s=0;while(e!==-1&&e<r){if(e>s)i+=t.substring(s,e);let n=t.indexOf(";",e+1);if(n===-1||n-e>32){i+="&",s=e+1,e=t.indexOf("&",s);continue}let a=t.substring(e+1,n);if(a.charCodeAt(0)===35){let o=a.length,d=0,g=!1;if(o>2&&(a.charCodeAt(1)===120||a.charCodeAt(1)===88)){g=!0;for(let m=2;m<o;m++){let h=a.charCodeAt(m);if(h>=48&&h<=57)d=d<<4|h-48;else if(h>=65&&h<=70)d=d<<4|h-55;else if(h>=97&&h<=102)d=d<<4|h-87;else{g=!1;break}}}else if(o>1){g=!0;for(let m=1;m<o;m++){let h=a.charCodeAt(m);if(h>=48&&h<=57)d=d*10+(h-48);else{g=!1;break}}}if(g)i+=String.fromCodePoint(d);else i+=t.substring(e,n+1)}else{let o=this.customEntities[a];if(o===void 0){let d=a.length;if(d>=2&&d<=4){let g=a.charCodeAt(0);if(g===108&&d===2&&a.charCodeAt(1)===116)o="<";else if(g===103&&d===2&&a.charCodeAt(1)===116)o=">";else if(g===97&&d===3&&a.charCodeAt(1)===109&&a.charCodeAt(2)===112)o="&";else if(g===113&&d===4)o=a==="quot"?'"':void 0;else if(g===97&&d===4)o=a==="apos"?"'":void 0}if(o===void 0)o=j[a]??(this.useHtmlEntities?z[a]:void 0)}if(o!==void 0)i+=o;else i+=t.substring(e,n+1)}s=n+1,e=t.indexOf("&",s)}if(s<r)i+=t.substring(s);return i}}var T=[];T[38]="&amp;";T[60]="&lt;";T[62]="&gt;";T[34]="&quot;";T[39]="&apos;";var H={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,alwaysCreateTextNode:!1,trimValues:!0,parseTagValue:!0,parseAttributeValue:!1,processEntities:!0,htmlEntities:!1,commentPropName:!1,cdataPropName:!1,piPropName:!1,preserveOrder:!1,stopNodes:[],unpairedTags:[],isArray:void 0,tagValueProcessor:void 0,attributeValueProcessor:void 0,updateTag:void 0,numberParseOptions:{hex:!0,leadingZeros:!0,scientific:!0},ignorePiTags:!1,transformAttributeName:void 0,transformTagName:void 0,ignoreDeclaration:!1};function S(t){return t===32||t===9||t===10||t===13}function x(t){return t>=65&&t<=90||t>=97&&t<=122||t===95||t===58||t>=192&&t<=214||t>=216&&t<=246||t>=248&&t<=767||t>=880&&t<=893||t>=895&&t<=8191||t>=8204&&t<=8205||t>=8304&&t<=8591||t>=11264&&t<=12271||t>=12289&&t<=55295||t>=63744&&t<=64975||t>=65008&&t<=65533}function R(t){return x(t)||t===45||t===46||t>=48&&t<=57||t===183||t>=768&&t<=879||t>=8255&&t<=8256}var L=/^0x[\da-fA-F]+$/,X=/^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/,M=/^[+-]?(\d+\.?\d*|\.\d+)$/;function v(t,e){return t.charCodeAt(e)===91&&t.charCodeAt(e+1)===67&&t.charCodeAt(e+2)===68&&t.charCodeAt(e+3)===65&&t.charCodeAt(e+4)===84&&t.charCodeAt(e+5)===65&&t.charCodeAt(e+6)===91}function I(t,e){let r=t.charCodeAt(e),i=t.charCodeAt(e+1),s=t.charCodeAt(e+2),n=t.charCodeAt(e+3),a=t.charCodeAt(e+4),o=t.charCodeAt(e+5),d=t.charCodeAt(e+6);return(r===68||r===100)&&(i===79||i===111)&&(s===67||s===99)&&(n===84||n===116)&&(a===89||a===121)&&(o===80||o===112)&&(d===69||d===101)}function G(t,e,r){if(e>=r||!x(t.charCodeAt(e)))return e;e++;while(e<r&&R(t.charCodeAt(e)))e++;return e}class Jt{options;entityDecoder;unpairedSet;exactStopNodes;wildcardStopSuffixes;needsJPath;_ignoreAttributes=!0;_textNodeName="#text";_commentPropName=!1;_cdataPropName=!1;_piPropName=!1;_alwaysCreateTextNode=!1;_trimValues=!0;_processEntities=!0;_parseTagValue=!0;_parseAttributeValue=!1;_removeNSPrefix=!1;_attrPrefix="@_";_attrsGroupName=!1;_ignorePiTags=!1;_ignoreDeclaration=!1;constructor(t){this.options={...H,...t},this.entityDecoder=new D(this.options.htmlEntities),this.unpairedSet=new Set(this.options.unpairedTags),this.exactStopNodes=new Set,this.wildcardStopSuffixes=[];for(let e of this.options.stopNodes)if(e.startsWith("*."))this.wildcardStopSuffixes.push(e.substring(2));else this.exactStopNodes.add(e);this._ignoreAttributes=this.options.ignoreAttributes,this._textNodeName=this.options.textNodeName,this._commentPropName=this.options.commentPropName,this._cdataPropName=this.options.cdataPropName,this._piPropName=this.options.piPropName,this._alwaysCreateTextNode=this.options.alwaysCreateTextNode,this._trimValues=this.options.trimValues,this._processEntities=this.options.processEntities,this._parseTagValue=this.options.parseTagValue,this._parseAttributeValue=this.options.parseAttributeValue,this._removeNSPrefix=this.options.removeNSPrefix,this._attrPrefix=this.options.attributeNamePrefix,this._attrsGroupName=this.options.attributesGroupName,this._ignorePiTags=this.options.ignorePiTags,this._ignoreDeclaration=this.options.ignoreDeclaration,this.needsJPath=this.options.stopNodes.length>0||this.options.isArray!==void 0||this.options.updateTag!==void 0||this.options.tagValueProcessor!==void 0||this.options.attributeValueProcessor!==void 0}addEntity(t,e){this.entityDecoder.addEntity(t,e)}parse(t){if(t instanceof Uint8Array)t=new TextDecoder().decode(t);let e=t;if(this.options.preserveOrder)return this.parseOrdered(e);return this.parseUnordered(e)}parseUnordered(t){let e={},r=t.length,i=0;if(r>0&&t.charCodeAt(0)===65279)i=1;return i=this.parseChildren(t,i,r,e,"",[]),e}parseOrdered(t){let e=t.length,r=0;if(e>0&&t.charCodeAt(0)===65279)r=1;let i=[];return this.parseChildrenOrdered(t,r,e,i,""),i}readTagName(t,e,r){return G(t,e,r)}extractTagName(t,e,r){let i=t.substring(e,r);if(this._removeNSPrefix){let s=i.indexOf(":");if(s!==-1)i=i.substring(s+1)}if(this.options.transformTagName)i=this.options.transformTagName(i);return i}parseAttributes(t,e,r,i,s){let n=0,a=this._removeNSPrefix,o=this.options.transformAttributeName,d=this._trimValues,g=this._processEntities,m=this.options.attributeValueProcessor;while(e<r){let h=t.charCodeAt(e);while(h===32||h===9||h===10||h===13){if(e++,e>=r)break;h=t.charCodeAt(e)}if(e>=r)break;if(h===62||h===47)break;let C=e;if(!x(h))break;e++;while(e<r&&R(t.charCodeAt(e)))e++;let f=t.substring(C,e);if(a){let A=f.indexOf(":");if(A!==-1)f=f.substring(A+1)}if(o)f=o(f);while(e<r&&S(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===61){e++;while(e<r&&S(t.charCodeAt(e)))e++;if(e>=r)break;let A=t.charCodeAt(e);if(A===34||A===39){e++;let y=e;while(e<r&&t.charCodeAt(e)!==A)e++;let u=t.substring(y,e);if(d&&u.length>0){let c=u.charCodeAt(0),l=u.charCodeAt(u.length-1);if(c<=32||l<=32)u=u.trim()}if(g)u=this.entityDecoder.decodeEntities(u);if(m)u=m(f,u,i)??u;if(s[f]=u,n++,e<r)e++}}else s[f]="true",n++}return n>0?-e-1:e}processTagValue(t,e,r,i,s){if(this._trimValues){let n=t.length;if(n>0){let a=t.charCodeAt(0),o=t.charCodeAt(n-1);if(a<=32||o<=32)t=t.trim()}}if(this._processEntities)t=this.entityDecoder.decodeEntities(t);if(this.options.tagValueProcessor){let n=this.options.tagValueProcessor(e,t,r,i,s);if(n!==void 0)t=n}if(!t)return t;if(this._parseTagValue)return this.parseValue(t);return t}parseValue(t){if(t==="true")return!0;if(t==="false")return!1;if(!t)return t;let e=t.charCodeAt(0);if(!(e>=48&&e<=57||e===43||e===45||e===46))return t;let i=this.options.numberParseOptions;if(i.skipLike?.test(t))return t;if(i.hex&&e===48&&L.test(t))return Number.parseInt(t,16);if(t.length>1&&e===48&&t.charCodeAt(1)!==46){if(i.leadingZeros)return t}if(i.scientific&&X.test(t)){let s=Number(t);if(!Number.isNaN(s))return s}if(M.test(t)){let s=Number(t);if(!Number.isNaN(s))return s}return t}parseAttributeValue(t){if(!this._parseAttributeValue)return t;return this.parseValue(t)}isStopNode(t){if(this.exactStopNodes.has(t))return!0;for(let e of this.wildcardStopSuffixes)if(t.endsWith(`.${e}`)||t===e)return!0;return!1}readStopNodeContent(t,e,r,i){let s=`</${i}`,n=t.indexOf(s,e);if(n===-1)return{content:t.substring(e),pos:r};let a=t.substring(e,n),o=n+s.length;while(o<r&&t.charCodeAt(o)!==62)o++;if(o<r)o++;return{content:a,pos:o}}addToObj(t,e,r,i,s,n){let a=t[e];if(a!==void 0)if(!Array.isArray(a))t[e]=[a,r];else a.push(r);else if(this.options.isArray?.(e,i,s,n))t[e]=[r];else t[e]=r}flushText(t,e,r,i){if(!t&&!e)return;let s=this._textNodeName;if(e){let n=t;if(n&&this._processEntities)n=this.entityDecoder.decodeEntities(n);let a=e+n;if(this._trimValues&&a.length>0){let o=a.charCodeAt(0),d=a.charCodeAt(a.length-1);if(o<=32||d<=32)a=a.trim()}if(this.options.tagValueProcessor){let o=this.options.tagValueProcessor(s,a,r,!1,!0);if(o!==void 0)a=o}if(a){let o=this._parseTagValue?this.parseValue(a):a;if(o!==void 0&&o!=="")this.addToObj(i,s,o,r,!0,!1)}}else{let n=this.processTagValue(t,s,r,!1,!0);if(n!==void 0&&n!=="")this.addToObj(i,s,n,r,!0,!1)}}parseChildren(t,e,r,i,s,n){let a="",o="",d=this.needsJPath;while(e<r){if(t.charCodeAt(e)!==60){let c=e;e++;while(e<r&&t.charCodeAt(e)!==60)e++;if(!a)a=t.substring(c,e);else a+=t.substring(c,e);continue}if(e+1>=r)break;let m=t.charCodeAt(e+1);if(m===33&&e+3<r&&t.charCodeAt(e+2)===45&&t.charCodeAt(e+3)===45){if(a||o)this.flushText(a,o,s,i),a="",o="";e+=4;let c=t.indexOf("-->",e);if(c===-1){e=r;break}if(this._commentPropName){let l=t.substring(e,c);this.addToObj(i,this._commentPropName,l,s,!0,!1)}e=c+3;continue}if(m===33&&e+8<r&&v(t,e+2)){e+=9;let c=t.indexOf("]]>",e);if(c===-1){e=r;break}let l=t.substring(e,c);if(this._cdataPropName)this.flushText(a,o,s,i),a="",o="",this.addToObj(i,this._cdataPropName,l,s,!0,!1);else{if(a){let b=a;if(this._processEntities)b=this.entityDecoder.decodeEntities(b);o+=b,a=""}o+=l}e=c+3;continue}if(m===33&&e+9<r&&I(t,e+2)){e+=9;let c=1;while(e<r&&c>0){let l=t.charCodeAt(e);if(l===60)c++;else if(l===62)c--;e++}continue}if(m===63){e+=2;let c=e;while(e<r&&!S(t.charCodeAt(e))&&t.charCodeAt(e)!==63)e++;let l=t.substring(c,e),b=t.indexOf("?>",e);if(b===-1){e=r;break}let E=t.substring(e,b).trim();if(l==="xml"){if(!this._ignoreDeclaration&&this._piPropName){let _=this.parsePiAttributes(E);this.addToObj(i,this._piPropName,{[l]:_},s,!0,!1)}}else if(!this._ignorePiTags&&this._piPropName)this.addToObj(i,this._piPropName,{[l]:E},s,!0,!1);e=b+2;continue}if(m===47){if(a||o)this.flushText(a,o,s,i),a="",o="";e+=2;let c=e,l=this.readTagName(t,e,r),b=this.extractTagName(t,c,l);e=l;while(e<r&&S(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===62)e++;if(n.length>0&&n[n.length-1]===b){n.pop();continue}return e}if(a||o)this.flushText(a,o,s,i),a="",o="";e++;let h=e,C=this.readTagName(t,e,r),f=this.extractTagName(t,h,C);if(!f){e=C+1;continue}e=C;let A=d?s?`${s}.${f}`:f:"",y={},u=!1;if(!this._ignoreAttributes){let c=this.parseAttributes(t,e,r,A,y);if(c<0)e=-c-1,u=!0;else e=c}else while(e<r){let c=t.charCodeAt(e);if(c===62||c===47)break;if(c===34||c===39){e++;while(e<r&&t.charCodeAt(e)!==c)e++}e++}if(this.options.updateTag){if(this.options.updateTag(f,A,y)===!1){while(e<r&&S(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===47)e+=2;else if(e<r&&t.charCodeAt(e)===62){e++;let l=`</${f}>`,b=t.indexOf(l,e);if(b!==-1)e=b+l.length}continue}}while(e<r&&S(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===47){if(e+=2,u||this._alwaysCreateTextNode){let c={};if(u)this.applyAttributes(c,y,A);if(this._alwaysCreateTextNode)c[this._textNodeName]="";this.addToObj(i,f,c,A,!0,!1)}else this.addToObj(i,f,"",A,!0,!1);continue}if(e<r&&t.charCodeAt(e)===62){if(e++,this.unpairedSet.has(f)){if(u){let E={};this.applyAttributes(E,y,A),this.addToObj(i,f,E,A,!0,!1)}else this.addToObj(i,f,"",A,!0,!1);n.push(f);continue}if(this.exactStopNodes.size>0||this.wildcardStopSuffixes.length>0){if(this.isStopNode(A)){let E=this.readStopNodeContent(t,e,r,f),_={};if(u)this.applyAttributes(_,y,A);if(E.content)_[this._textNodeName]=E.content;this.addToObj(i,f,_,A,!0,!1),e=E.pos;continue}}let c={};if(u)this.applyAttributes(c,y,A);e=this.parseChildren(t,e,r,c,A,n);let l=this._textNodeName,b=c[l];if(!u&&!this._alwaysCreateTextNode){let E=!0;for(let _ in c)if(_!==l){E=!1;break}if(E){this.addToObj(i,f,b!==void 0?b:"",A,!0,!1);continue}}this.addToObj(i,f,c,A,!1,!1)}}if(a||o)this.flushText(a,o,s,i);return e}parseChildrenOrdered(t,e,r,i,s){let n="",a=this.needsJPath;while(e<r){if(t.charCodeAt(e)!==60){let u=e;e++;while(e<r&&t.charCodeAt(e)!==60)e++;if(!n)n=t.substring(u,e);else n+=t.substring(u,e);continue}if(e+1>=r)break;let d=t.charCodeAt(e+1);if(d===33&&e+3<r&&t.charCodeAt(e+2)===45&&t.charCodeAt(e+3)===45){if(n){let c=this.processTagValue(n,this._textNodeName,s,!1,!0);if(c!==void 0&&c!=="")i.push({[this._textNodeName]:c});n=""}e+=4;let u=t.indexOf("-->",e);if(u===-1){e=r;break}if(this._commentPropName)i.push({[this._commentPropName]:[{[this._textNodeName]:t.substring(e,u)}]});e=u+3;continue}if(d===33&&e+8<r&&v(t,e+2)){e+=9;let u=t.indexOf("]]>",e);if(u===-1){e=r;break}let c=t.substring(e,u);if(this._cdataPropName){if(n){let l=this.processTagValue(n,this._textNodeName,s,!1,!0);if(l!==void 0&&l!=="")i.push({[this._textNodeName]:l});n=""}i.push({[this._cdataPropName]:[{[this._textNodeName]:c}]})}else n+=c;e=u+3;continue}if(d===33&&e+9<r&&I(t,e+2)){e+=9;let u=1;while(e<r&&u>0){let c=t.charCodeAt(e);if(c===60)u++;else if(c===62)u--;e++}continue}if(d===63){e+=2;let u=t.indexOf("?>",e);if(u===-1){e=r;break}e=u+2;continue}if(d===47){if(n){let c=this.processTagValue(n,this._textNodeName,s,!1,!0);if(c!==void 0&&c!=="")i.push({[this._textNodeName]:c});n=""}e+=2,e=this.readTagName(t,e,r);while(e<r&&S(t.charCodeAt(e)))e++;if(e<r&&t.charCodeAt(e)===62)e++;return e}if(n){let u=this.processTagValue(n,this._textNodeName,s,!1,!0);if(u!==void 0&&u!=="")i.push({[this._textNodeName]:u});n=""}e++;let g=e,m=this.readTagName(t,e,r),h=this.extractTagName(t,g,m);if(!h){e=m+1;continue}e=m;let C=a?s?`${s}.${h}`:h:"",f={},A=!1;if(!this._ignoreAttributes){let u=this.parseAttributes(t,e,r,C,f);if(u<0)e=-u-1,A=!0;else e=u}else while(e<r){let u=t.charCodeAt(e);if(u===62||u===47)break;if(u===34||u===39){e++;while(e<r&&t.charCodeAt(e)!==u)e++}e++}while(e<r&&S(t.charCodeAt(e)))e++;let y={[h]:[]};if(A){y[":@"]={};for(let c in f)y[":@"][this._attrPrefix+c]=this.parseAttributeValue(f[c])}if(e<r&&t.charCodeAt(e)===47){e+=2,i.push(y);continue}if(e<r&&t.charCodeAt(e)===62)e++,e=this.parseChildrenOrdered(t,e,r,y[h],C),i.push(y)}if(n){let o=this.processTagValue(n,this._textNodeName,s,!1,!0);if(o!==void 0&&o!=="")i.push({[this._textNodeName]:o})}return e}applyAttributes(t,e,r){let i=this._attrPrefix;if(this._attrsGroupName){let s={};for(let n in e)s[i+n]=this.parseAttributeValue(e[n]);t[this._attrsGroupName]=s}else for(let s in e)t[i+s]=this.parseAttributeValue(e[s])}parsePiAttributes(t){let e={},r=0,i=t.length;while(r<i){while(r<i&&S(t.charCodeAt(r)))r++;if(r>=i)break;let s=r;while(r<i&&!S(t.charCodeAt(r))&&t.charCodeAt(r)!==61)r++;let n=t.substring(s,r);if(!n)break;while(r<i&&S(t.charCodeAt(r)))r++;if(r<i&&t.charCodeAt(r)===61){r++;while(r<i&&S(t.charCodeAt(r)))r++;if(r<i){let a=t.charCodeAt(r);if(a===34||a===39){r++;let o=r;while(r<i&&t.charCodeAt(r)!==a)r++;if(e[n]=t.substring(o,r),r<i)r++}}}}return e}}function Xt(t){let e=t.endpoint||`s3.${t.region}.amazonaws.com`,r=new URL(/^https?:\/\//i.test(e)?e:`https://${e}`);if(r.protocol!=="http:"&&r.protocol!=="https:"||r.pathname!=="/"&&r.pathname!==""||r.search||r.hash||r.username||r.password)throw Error("S3 endpoint must be an HTTP(S) origin without a path");let i=r.protocol.slice(0,-1),s=r.host;if(!t.bucket)return{protocol:i,host:s,path:t.path};if(t.forcePathStyle){let n=t.path==="/"?`/${t.bucket}`:`/${t.bucket}${t.path}`;return{protocol:i,host:s,path:n}}return{protocol:i,host:`${t.bucket}.${s}`,path:t.path}}var J={email:"ses","bedrock-runtime":"bedrock","bedrock-agent":"bedrock","bedrock-agent-runtime":"bedrock","personalize-runtime":"personalize","personalize-events":"personalize"};function iu(t){return J[t]??t}function ou(t,e){if(t==="s3")return e;return e.split("/").map((r)=>encodeURIComponent(r).replace(/[!'()*]/g,(i)=>`%${i.charCodeAt(0).toString(16).toUpperCase()}`)).join("/")}function Jo(t){if(typeof t==="string"){if(t==="true")return!0;if(t==="false")return!1;let e=Number(t);if(t!==""&&Number.isFinite(e)&&String(e)===t)return e;return t}if(Array.isArray(t))return t.map(Jo);if(t&&typeof t==="object"){let e={};for(let[r,i]of Object.entries(t))e[r]=Jo(i);return e}return t}var Z=new Set(["InvalidClientTokenId","UnrecognizedClientException","InvalidAccessKeyId","SignatureDoesNotMatch","IncompleteSignature","ExpiredToken","ExpiredTokenException","InvalidToken","AuthFailure"]);class p{credentials;credentialSource="no credentials";config;cache;xmlParser;constructor(t,e){if(this.config={maxRetries:3,retryDelay:1000,cacheEnabled:!0,defaultCacheTTL:60000,...e},t)this.credentialSource="credentials passed to AWSClient";this.credentials=t||this.loadCredentials(),this.cache=new Map,this.xmlParser=new Jt({ignoreAttributes:!1,attributeNamePrefix:"@_",textNodeName:"#text",parseTagValue:!1,parseAttributeValue:!1,trimValues:!0})}loadCredentials(){let t=process.env.AWS_ACCESS_KEY_ID,e=process.env.AWS_SECRET_ACCESS_KEY,r=process.env.AWS_SESSION_TOKEN;if(t&&e)return this.credentialSource="AWS_ACCESS_KEY_ID in the environment",{accessKeyId:t,secretAccessKey:e,sessionToken:r};let i=this.loadCredentialsFromFile();if(i)return i;return{accessKeyId:"",secretAccessKey:""}}loadCredentialsFromFile(){let t=this.config?.profile||process.env.AWS_PROFILE||"default",e=process.env.AWS_SHARED_CREDENTIALS_FILE||K(W(),".aws","credentials");if(!V(e))return null;try{let r=Y(e,"utf-8"),i=this.parseCredentialsFile(r,t);if(i.accessKeyId&&i.secretAccessKey)return this.credentialSource=`profile "${t}" in ${e}`,i}catch{}return null}parseCredentialsFile(t,e){let r=t.split(`
2
+ `),i="",s="",n="",a;for(let o of r){let d=o.trim();if(!d||d.startsWith("#"))continue;let g=d.match(/^\[([^\]]+)\]$/);if(g){i=g[1];continue}if(i===e){let[m,...h]=d.split("="),C=h.join("=").trim();if(m.trim()==="aws_access_key_id")s=C;else if(m.trim()==="aws_secret_access_key")n=C;else if(m.trim()==="aws_session_token")a=C}}return{accessKeyId:s,secretAccessKey:n,sessionToken:a}}ec2CredentialsCache;async getCredentials(){let t=process.env.AWS_ACCESS_KEY_ID,e=process.env.AWS_SECRET_ACCESS_KEY;if(t&&e)return this.credentialSource="AWS_ACCESS_KEY_ID in the environment",{accessKeyId:t,secretAccessKey:e,sessionToken:process.env.AWS_SESSION_TOKEN};let r=this.loadCredentialsFromFile();if(r)return r;if(this.ec2CredentialsCache){let i=Date.now();if(this.ec2CredentialsCache.expiration>i+300000)return this.credentialSource="EC2 instance metadata",this.ec2CredentialsCache.credentials}try{let s=await(await fetch("http://169.254.169.254/latest/api/token",{method:"PUT",headers:{"X-aws-ec2-metadata-token-ttl-seconds":"21600"}})).text(),a=await(await fetch("http://169.254.169.254/latest/meta-data/iam/security-credentials/",{headers:{"X-aws-ec2-metadata-token":s}})).text(),d=await(await fetch(`http://169.254.169.254/latest/meta-data/iam/security-credentials/${a}`,{headers:{"X-aws-ec2-metadata-token":s}})).json(),g={accessKeyId:d.AccessKeyId,secretAccessKey:d.SecretAccessKey,sessionToken:d.Token};return this.credentialSource="EC2 instance metadata",this.ec2CredentialsCache={credentials:g,expiration:new Date(d.Expiration).getTime()},g}catch(i){throw Error("AWS credentials not found. Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables, or run on an EC2 instance with an IAM role.")}}async request(t){if(t.method==="GET"&&this.config.cacheEnabled&&t.cacheKey){let i=this.getFromCache(t.cacheKey);if(i!==null)return i}let e=t.retries??this.config.maxRetries??3,r=null;for(let i=0;i<=e;i++)try{let s=await this.makeRequest(t);if(t.method==="GET"&&this.config.cacheEnabled&&t.cacheKey)this.setInCache(t.cacheKey,s,t.cacheTTL??this.config.defaultCacheTTL??60000);return s}catch(s){if(r=s,!this.shouldRetry(s))throw s;if(i===e)throw s;let a=this.calculateRetryDelay(i);await this.sleep(a)}throw r||Error("Request failed after retries")}async makeRequest(t){let e=t.credentials||(this.credentials?.accessKeyId?this.credentials:await this.getCredentials());if(!e||!e.accessKeyId||!e.secretAccessKey)throw Error("AWS credentials not provided");let r=this.buildUrl(t),i=this.signRequest(t,e),s=await fetch(r,{method:t.method,headers:i,body:t.body});if(t.streamResponse&&s.ok)return s;let n=await s.text();if(!s.ok){let o=this.parseError(n,s.status,s.headers);if(o.code&&Z.has(String(o.code).split("#").pop())){let d=t.credentials?"credentials passed with the request":this.credentialSource;o.message+=` (credentials from ${d})`}throw o}if(!n||n.trim()===""){if(t.returnHeaders)return{body:null,headers:this.headersToObject(s.headers)};return null}if(t.rawResponse){if(t.returnHeaders)return{body:n,headers:this.headersToObject(s.headers)};return n}let a;if(n.startsWith("<"))a=this.parseXmlResponse(n);else try{a=JSON.parse(n)}catch{a=n}if(t.returnHeaders)return{body:a,headers:this.headersToObject(s.headers)};return a}headersToObject(t){let e={};return t.forEach((r,i)=>{e[i]=r}),e}buildUrl(t){let{service:e,region:r,queryParams:i}=t,{path:s}=t,n,a="https";if(e==="s3"){let d=Xt({region:r,path:s,bucket:t.bucket,endpoint:this.config.endpoint,forcePathStyle:this.config.forcePathStyle});a=d.protocol,n=d.host,s=d.path}else if(e==="cloudfront")n="cloudfront.amazonaws.com";else if(e==="iam")n="iam.amazonaws.com";else if(e==="route53")n="route53.amazonaws.com";else if(e==="route53domains")n="route53domains.us-east-1.amazonaws.com";else if(e==="ecr")n=`api.ecr.${r}.amazonaws.com`;else if(e==="ses")n=`email.${r}.amazonaws.com`;else n=`${e}.${r}.amazonaws.com`;let o=`${a}://${n}${s}`;if(i&&Object.keys(i).length>0){let d=Object.keys(i).map((g)=>`${this.uriEncode(g)}=${this.uriEncode(i[g])}`).join("&");o+=`?${d}`}return o}signRequest(t,e){let{service:r,region:i,method:s,queryParams:n,body:a}=t,{path:o}=t,d=new Date,g=this.getAmzDate(d),m=this.getDateStamp(d),h;if(r==="s3"){let N=Xt({region:i,path:o,bucket:t.bucket,endpoint:this.config.endpoint,forcePathStyle:this.config.forcePathStyle});h=N.host,o=N.path}else if(r==="cloudfront")h="cloudfront.amazonaws.com";else if(r==="iam")h="iam.amazonaws.com";else if(r==="route53")h="route53.amazonaws.com";else if(r==="route53domains")h="route53domains.us-east-1.amazonaws.com";else if(r==="ecr")h=`api.ecr.${i}.amazonaws.com`;else if(r==="ses")h=`email.${i}.amazonaws.com`;else h=`${r}.${i}.amazonaws.com`;let C={host:h,"x-amz-date":g,...t.headers||{}};if(e.sessionToken)C["x-amz-security-token"]=e.sessionToken;if(a){if(!Object.keys(C).some((P)=>P.toLowerCase()==="content-type"))C["content-type"]="application/x-www-form-urlencoded";C["content-length"]=Buffer.byteLength(a).toString()}let f=this.sha256(a||"");C["x-amz-content-sha256"]=f;let A=ou(r,o),y=n?Object.keys(n).sort().map((N)=>`${this.uriEncode(N)}=${this.uriEncode(n[N])}`).join("&"):"",u=Object.keys(C).sort((N,P)=>N.toLowerCase().localeCompare(P.toLowerCase())),c=u.map((N)=>`${N.toLowerCase()}:${C[N].trim()}
3
3
  `).join(""),l=u.map((N)=>N.toLowerCase()).join(";"),b=[s,A,y,c,l,f].join(`
4
- `),E="AWS4-HMAC-SHA256",_=nu(r),O=`${m}/${i}/${_}/aws4_request`,B=[E,g,O,this.sha256(b)].join(`
5
- `),F=this.getSignatureKey(e.secretAccessKey,m,i,_),q=this.hmac(F,B),U=`${E} Credential=${e.accessKeyId}/${O}, SignedHeaders=${l}, Signature=${q}`;return{...C,Authorization:U}}getAmzDate(t){return t.toISOString().replace(/[:-]|\.\d{3}/g,"")}getDateStamp(t){return t.toISOString().slice(0,10).replace(/-/g,"")}uriEncode(t){return encodeURIComponent(t).replace(/[!'()*]/g,(e)=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}sha256(t){return w.createHash("sha256").update(t,"utf8").digest("hex")}hmac(t,e){return w.createHmac("sha256",t).update(e,"utf8").digest("hex")}getSignatureKey(t,e,r,i){let s=w.createHmac("sha256",`AWS4${t}`).update(e).digest(),n=w.createHmac("sha256",s).update(r).digest(),a=w.createHmac("sha256",n).update(i).digest();return w.createHmac("sha256",a).update("aws4_request").digest()}parseXmlResponse(t){try{let e=Ko(this.xmlParser.parse(t));if(e.ErrorResponse)throw this.createErrorFromXml(e.ErrorResponse.Error);let r=Object.keys(e);if(r.length===1)return e[r[0]];return e}catch(e){if(e.code||e.statusCode)throw e;return{}}}parseError(t,e,r){let i=Error();if(i.statusCode=e,i.requestId=r.get("x-amzn-requestid")||r.get("x-amz-request-id")||void 0,t.startsWith("<"))try{let s=Ko(this.xmlParser.parse(t));if(s.ErrorResponse?.Error){let n=s.ErrorResponse.Error;return i.code=n.Code,i.message=`AWS Error [${n.Code}]: ${n.Message||"Unknown error"}`,i.type=n.Type,i}if(s.Error)return i.code=s.Error.Code,i.message=`AWS Error [${s.Error.Code}]: ${s.Error.Message||"Unknown error"}`,i}catch{}try{let s=JSON.parse(t);if(s.__type||s.code)return i.code=s.__type||s.code,i.message=`AWS Error [${i.code}]: ${s.message||s.Message||"Unknown error"}`,i}catch{}return i.message=`AWS API Error (${e}): ${t}`,i}createErrorFromXml(t){let e=Error();return e.code=t.Code,e.message=`AWS Error [${t.Code}]: ${t.Message||"Unknown error"}`,e.type=t.Type,e}isRetryableError(t){return["RequestTimeout","RequestTimeoutException","PriorRequestNotComplete","ConnectionError","ThrottlingException","Throttling","TooManyRequestsException","ProvisionedThroughputExceededException","RequestLimitExceeded","BandwidthLimitExceeded","SlowDown","ServiceUnavailable","ServiceUnavailableException","InternalError","InternalFailure","InternalServerError","InternalServiceException","TransientError","TransientFailure","IDPCommunicationErrorException","NetworkError","ConnectionRefusedException","EC2ThrottledException","503 Slow Down","500 InternalError"].includes(t)}isRetryableStatusCode(t){return t>=500||t===429}shouldRetry(t){if(t.name==="FetchError"||t.name==="TypeError"||t.code==="ECONNRESET")return!0;if(t.code&&this.isRetryableError(t.code))return!0;if(t.statusCode&&this.isRetryableStatusCode(t.statusCode))return!0;if(t.statusCode&&t.statusCode>=400&&t.statusCode<500&&t.statusCode!==429)return!1;if(t.statusCode)return!1;return!0}calculateRetryDelay(t){let e=this.config.retryDelay??1000,r=30000,i=Math.min(e*2**t,30000),s=Math.random()*0.3*i;return i+s}sleep(t){return new Promise((e)=>setTimeout(e,t))}getFromCache(t){let e=this.cache.get(t);if(!e)return null;if(Date.now()>e.expires)return this.cache.delete(t),null;return e.data}setInCache(t,e,r){this.cache.set(t,{data:e,expires:Date.now()+r})}clearCache(){this.cache.clear()}clearExpiredCache(){let t=Date.now();for(let[e,r]of this.cache.entries())if(t>r.expires)this.cache.delete(e)}}function k(t){let e={};for(let[r,i]of Object.entries(t)){if(i===void 0||i===null)continue;if(Array.isArray(i))i.forEach((s,n)=>{e[`${r}.${n+1}`]=String(s)});else if(typeof i==="object")for(let[s,n]of Object.entries(i))e[`${r}.${s}`]=String(n);else e[r]=String(i)}return e}function ca(){let t=process.env.AWS_ACCESS_KEY_ID,e=process.env.AWS_SECRET_ACCESS_KEY,r=t==="",i=e==="";if(t&&e)return{source:"env",emptyEnvKey:r,emptyEnvSecret:i,description:"environment variables (AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY)"};let s=process.env.AWS_PROFILE||"default",n=process.env.AWS_SHARED_CREDENTIALS_FILE||K(W(),".aws","credentials");if(V(n))return{source:"file",profile:s,emptyEnvKey:r,emptyEnvSecret:i,description:`~/.aws/credentials (profile: ${s})`};return{source:"ec2",emptyEnvKey:r,emptyEnvSecret:i,description:"EC2 instance metadata service (IMDSv2)"}}
6
- export{Jt,Xt,nu,iu,Ko,p,k,ca};
4
+ `),E="AWS4-HMAC-SHA256",_=iu(r),O=`${m}/${i}/${_}/aws4_request`,B=[E,g,O,this.sha256(b)].join(`
5
+ `),F=this.getSignatureKey(e.secretAccessKey,m,i,_),q=this.hmac(F,B),U=`${E} Credential=${e.accessKeyId}/${O}, SignedHeaders=${l}, Signature=${q}`;return{...C,Authorization:U}}getAmzDate(t){return t.toISOString().replace(/[:-]|\.\d{3}/g,"")}getDateStamp(t){return t.toISOString().slice(0,10).replace(/-/g,"")}uriEncode(t){return encodeURIComponent(t).replace(/[!'()*]/g,(e)=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}sha256(t){return w.createHash("sha256").update(t,"utf8").digest("hex")}hmac(t,e){return w.createHmac("sha256",t).update(e,"utf8").digest("hex")}getSignatureKey(t,e,r,i){let s=w.createHmac("sha256",`AWS4${t}`).update(e).digest(),n=w.createHmac("sha256",s).update(r).digest(),a=w.createHmac("sha256",n).update(i).digest();return w.createHmac("sha256",a).update("aws4_request").digest()}parseXmlResponse(t){try{let e=Jo(this.xmlParser.parse(t));if(e.ErrorResponse)throw this.createErrorFromXml(e.ErrorResponse.Error);let r=Object.keys(e);if(r.length===1)return e[r[0]];return e}catch(e){if(e.code||e.statusCode)throw e;return{}}}parseError(t,e,r){let i=Error();if(i.statusCode=e,i.requestId=r.get("x-amzn-requestid")||r.get("x-amz-request-id")||void 0,t.startsWith("<"))try{let s=Jo(this.xmlParser.parse(t));if(s.ErrorResponse?.Error){let n=s.ErrorResponse.Error;return i.code=n.Code,i.message=`AWS Error [${n.Code}]: ${n.Message||"Unknown error"}`,i.type=n.Type,i}if(s.Error)return i.code=s.Error.Code,i.message=`AWS Error [${s.Error.Code}]: ${s.Error.Message||"Unknown error"}`,i}catch{}try{let s=JSON.parse(t);if(s.__type||s.code)return i.code=s.__type||s.code,i.message=`AWS Error [${i.code}]: ${s.message||s.Message||"Unknown error"}`,i}catch{}return i.message=`AWS API Error (${e}): ${t}`,i}createErrorFromXml(t){let e=Error();return e.code=t.Code,e.message=`AWS Error [${t.Code}]: ${t.Message||"Unknown error"}`,e.type=t.Type,e}isRetryableError(t){return["RequestTimeout","RequestTimeoutException","PriorRequestNotComplete","ConnectionError","ThrottlingException","Throttling","TooManyRequestsException","ProvisionedThroughputExceededException","RequestLimitExceeded","BandwidthLimitExceeded","SlowDown","ServiceUnavailable","ServiceUnavailableException","InternalError","InternalFailure","InternalServerError","InternalServiceException","TransientError","TransientFailure","IDPCommunicationErrorException","NetworkError","ConnectionRefusedException","EC2ThrottledException","503 Slow Down","500 InternalError"].includes(t)}isRetryableStatusCode(t){return t>=500||t===429}shouldRetry(t){if(t.name==="FetchError"||t.name==="TypeError"||t.code==="ECONNRESET")return!0;if(t.code&&this.isRetryableError(t.code))return!0;if(t.statusCode&&this.isRetryableStatusCode(t.statusCode))return!0;if(t.statusCode&&t.statusCode>=400&&t.statusCode<500&&t.statusCode!==429)return!1;if(t.statusCode)return!1;return!0}calculateRetryDelay(t){let e=this.config.retryDelay??1000,r=30000,i=Math.min(e*2**t,30000),s=Math.random()*0.3*i;return i+s}sleep(t){return new Promise((e)=>setTimeout(e,t))}getFromCache(t){let e=this.cache.get(t);if(!e)return null;if(Date.now()>e.expires)return this.cache.delete(t),null;return e.data}setInCache(t,e,r){this.cache.set(t,{data:e,expires:Date.now()+r})}clearCache(){this.cache.clear()}clearExpiredCache(){let t=Date.now();for(let[e,r]of this.cache.entries())if(t>r.expires)this.cache.delete(e)}}function k(t){let e={};for(let[r,i]of Object.entries(t)){if(i===void 0||i===null)continue;if(Array.isArray(i))i.forEach((s,n)=>{e[`${r}.${n+1}`]=String(s)});else if(typeof i==="object")for(let[s,n]of Object.entries(i))e[`${r}.${s}`]=String(n);else e[r]=String(i)}return e}function la(){let t=process.env.AWS_ACCESS_KEY_ID,e=process.env.AWS_SECRET_ACCESS_KEY,r=t==="",i=e==="";if(t&&e)return{source:"env",emptyEnvKey:r,emptyEnvSecret:i,description:"environment variables (AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY)"};let s=process.env.AWS_PROFILE||"default",n=process.env.AWS_SHARED_CREDENTIALS_FILE||K(W(),".aws","credentials");if(V(n))return{source:"file",profile:s,emptyEnvKey:r,emptyEnvSecret:i,description:`~/.aws/credentials (profile: ${s})`};return{source:"ec2",emptyEnvKey:r,emptyEnvSecret:i,description:"EC2 instance metadata service (IMDSv2)"}}
6
+ export{Jt,Xt,iu,ou,Jo,p,k,la};