alchemylab-opencode 2.0.1 → 2.0.4

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 (232) hide show
  1. package/NODE_COMPAT.md +8 -1
  2. package/dist/20260127222353_familiar_lady_ursula-YYOFSQD5.js +18 -0
  3. package/dist/20260211171708_add_project_commands-3GKQTPBZ.js +18 -0
  4. package/dist/20260213144116_wakeful_the_professor-ROO7OAVL.js +18 -0
  5. package/dist/20260225215848_workspace-V2OZTNFF.js +18 -0
  6. package/dist/20260227213759_add_session_workspace_id-GVDWAXKM.js +18 -0
  7. package/dist/20260228203230_blue_harpoon-Z5QP2II5.js +18 -0
  8. package/dist/20260303231226_add_workspace_fields-QOVAFN7W.js +18 -0
  9. package/dist/20260309230000_move_org_to_state-RQURSDZD.js +18 -0
  10. package/dist/20260312043431_session_message_cursor-VBISKDXL.js +18 -0
  11. package/dist/20260323234822_events-PILJHLNA.js +18 -0
  12. package/dist/20260410174513_workspace-name-63YCZ5NS.js +18 -0
  13. package/dist/20260413175956_chief_energizer-NMAZYGDO.js +18 -0
  14. package/dist/20260423070820_add_icon_url_override-RAJCVNEP.js +18 -0
  15. package/dist/20260427172553_slow_nightmare-ULYYZLR4.js +18 -0
  16. package/dist/20260428004200_add_session_path-U4WO2TGE.js +18 -0
  17. package/dist/20260501142318_next_venus-6BCYATSC.js +18 -0
  18. package/dist/20260504145000_add_sync_owner-RGVHV6LN.js +18 -0
  19. package/dist/20260507164347_add_workspace_time-GE6UHNPM.js +18 -0
  20. package/dist/{20260510033149_session_usage-UGBVOXZB.js → 20260510033149_session_usage-7XHCFVKY.js} +5 -1
  21. package/dist/20260511000411_data_migration_state-2EGZKFLB.js +18 -0
  22. package/dist/20260511173437_session-metadata-K322YY33.js +18 -0
  23. package/dist/20260601010001_normalize_storage_paths-VZDTY366.js +18 -0
  24. package/dist/{20260225215848_workspace-ZMSOZSPA.js → 20260601202201_amazing_prowler-YT6PLK3L.js} +5 -1
  25. package/dist/{20260228203230_blue_harpoon-IW3Z4TQZ.js → 20260602002951_lowly_union_jack-6VLQTBVB.js} +5 -1
  26. package/dist/20260602182828_add_project_directories-TVSRD25A.js +18 -0
  27. package/dist/20260603001617_session_message_projection_indexes-PHKTF6HK.js +18 -0
  28. package/dist/{20260622170816_reset_v2_session_state-5JPHJTZG.js → 20260603040000_session_message_projection_order-7RTV2POG.js} +5 -1
  29. package/dist/20260603141458_session_input_inbox-RSBWABG7.js +18 -0
  30. package/dist/20260603160727_jittery_ezekiel_stane-DXBLLRVV.js +18 -0
  31. package/dist/20260604172448_event_sourced_session_input-H6Z3JEBD.js +18 -0
  32. package/dist/20260605003541_add_session_context_snapshot-6FDPM2TK.js +18 -0
  33. package/dist/20260605042240_add_context_epoch_agent-C2OF2UKR.js +18 -0
  34. package/dist/20260611035744_credential-YNZ47FSH.js +18 -0
  35. package/dist/20260611192811_lush_chimera-E357VI6P.js +18 -0
  36. package/dist/20260612174303_project_dir_strategy-VUGGK42O.js +18 -0
  37. package/dist/20260622142730_simplify_session_context_epoch-UYGXZ5BX.js +18 -0
  38. package/dist/20260622170816_reset_v2_session_state-EILLPCJQ.js +18 -0
  39. package/dist/20260622202450_simplify_session_input-Y65GDGBO.js +18 -0
  40. package/dist/NodeSdk-AGMQWBHH.js +18 -0
  41. package/dist/anthropic-45OFTLAW.js +18 -0
  42. package/dist/anthropic-FVULF7C3.js +18 -0
  43. package/dist/app-runtime-LDQWNGWP.js +18 -0
  44. package/dist/chunk-2JE3QYG6.js +18 -0
  45. package/dist/chunk-2MRHL4B2.js +18 -0
  46. package/dist/chunk-4GJE6OMN.js +190 -0
  47. package/dist/chunk-4MBUHJHY.js +22 -0
  48. package/dist/chunk-5BLZCAU6.js +55 -0
  49. package/dist/chunk-7XX6TY62.js +259 -0
  50. package/dist/chunk-ANF3QA3Z.js +48 -0
  51. package/dist/chunk-AZUMH3TO.js +18 -0
  52. package/dist/chunk-B74WSFN4.js +878 -0
  53. package/dist/chunk-BQ4IEPN3.js +19 -0
  54. package/dist/chunk-CYRZU5QM.js +33 -0
  55. package/dist/chunk-DADVNQTM.js +1490 -0
  56. package/dist/chunk-DO2UZ6NY.js +18 -0
  57. package/dist/chunk-DWEYXIQI.js +780 -0
  58. package/dist/chunk-EK6FQQHY.js +20 -0
  59. package/dist/chunk-ELPXQ32J.js +90 -0
  60. package/dist/chunk-FGLPSSRK.js +19 -0
  61. package/dist/chunk-FOHYZ7MJ.js +55 -0
  62. package/dist/chunk-FV7U6PVP.js +18 -0
  63. package/dist/chunk-FYYAOZPU.js +18 -0
  64. package/dist/chunk-G7PFO5HG.js +920 -0
  65. package/dist/chunk-GDWO6EXN.js +22 -0
  66. package/dist/chunk-GW3ZRKAI.js +20 -0
  67. package/dist/chunk-IYUSBBGY.js +35 -0
  68. package/dist/chunk-JPOFLMNH.js +18 -0
  69. package/dist/{chunk-VURLSDCB.js → chunk-K5LKDIVU.js} +4 -0
  70. package/dist/chunk-KS4WLVK5.js +19 -0
  71. package/dist/chunk-LIXP4TPL.js +18 -0
  72. package/dist/chunk-LSC4RT5V.js +36 -0
  73. package/dist/chunk-M5A6NFHQ.js +28 -0
  74. package/dist/chunk-M6E6KNLV.js +30 -0
  75. package/dist/chunk-MLFZXUGQ.js +18 -0
  76. package/dist/chunk-NDI67DRG.js +31 -0
  77. package/dist/chunk-NGT6LCW6.js +18 -0
  78. package/dist/chunk-OCWGUTZJ.js +36 -0
  79. package/dist/chunk-OGDRUXMJ.js +18 -0
  80. package/dist/chunk-OGJKLJC7.js +29 -0
  81. package/dist/chunk-OT2YNR56.js +19 -0
  82. package/dist/chunk-OUVSKG2H.js +19 -0
  83. package/dist/chunk-P5RLCJUV.js +18 -0
  84. package/dist/chunk-Q3WIUQXB.js +18 -0
  85. package/dist/{20260227213759_add_session_workspace_id-ROENWPKA.js → chunk-QCRIXKIC.js} +5 -1
  86. package/dist/chunk-QD24DLUD.js +18 -0
  87. package/dist/chunk-R2GWBJEP.js +18 -0
  88. package/dist/chunk-RPAXSOGH.js +18 -0
  89. package/dist/chunk-TK5R7QUN.js +18 -0
  90. package/dist/chunk-TNQWZFIZ.js +28 -0
  91. package/dist/chunk-UCLPBO4I.js +18 -0
  92. package/dist/chunk-UPEPL4I2.js +18 -0
  93. package/dist/chunk-V6FDDNGV.js +117 -0
  94. package/dist/chunk-V6HERYFV.js +18 -0
  95. package/dist/chunk-V7XKKJ7X.js +24 -0
  96. package/dist/chunk-VHDYUBBS.js +23 -0
  97. package/dist/chunk-VWLJXTZ5.js +18 -0
  98. package/dist/chunk-VXAPFOIL.js +22 -0
  99. package/dist/chunk-WKZYINC7.js +29 -0
  100. package/dist/chunk-WPMP2ZFE.js +40 -0
  101. package/dist/chunk-WRTNIOI3.js +18 -0
  102. package/dist/chunk-X5F46HR5.js +18 -0
  103. package/dist/chunk-XPS7TQZG.js +22 -0
  104. package/dist/chunk-YJPP6IQ3.js +23 -0
  105. package/dist/chunk-ZYQWFC55.js +22 -0
  106. package/dist/code-mode-YYOGD36U.js +502 -0
  107. package/dist/copilot-provider-QVMLQZZC.js +18 -0
  108. package/dist/dist-5NQOHNPL.js +18 -0
  109. package/dist/dist-7CT3XCNN.js +32 -0
  110. package/dist/dist-CL46WFZG.js +18 -0
  111. package/dist/{20260605042240_add_context_epoch_agent-W6IQYZXE.js → dist-CYBRID2F.js} +5 -1
  112. package/dist/dist-HXJTF22W.js +32 -0
  113. package/dist/dist-JFXI53ZF.js +22 -0
  114. package/dist/dist-KBYKWVT5.js +22 -0
  115. package/dist/dist-KM5HCPZX.js +35 -0
  116. package/dist/dist-KTNLTEHB.js +18 -0
  117. package/dist/dist-KZ5R5QM5.js +24 -0
  118. package/dist/dist-NLXUYBW7.js +32 -0
  119. package/dist/dist-O4DF72J2.js +22 -0
  120. package/dist/dist-PH4MEGVR.js +22 -0
  121. package/dist/{20260511000411_data_migration_state-FB4LBFSE.js → dist-QJPOJCLB.js} +5 -1
  122. package/dist/dist-QYH62TCJ.js +22 -0
  123. package/dist/{20260303231226_add_workspace_fields-OUVZMNAG.js → dist-RIC4WKHC.js} +5 -1
  124. package/dist/dist-T776XKTM.js +22 -0
  125. package/dist/dist-TCE5MKZQ.js +23 -0
  126. package/dist/dist-TH2Q44RX.js +50 -0
  127. package/dist/dist-VV5FV5RT.js +101 -0
  128. package/dist/dist-XAFENVUS.js +22 -0
  129. package/dist/dist-XPFB35TX.js +32 -0
  130. package/dist/dist-YUH4RKR5.js +28 -0
  131. package/dist/dist-es-43ZM44MP.js +18 -0
  132. package/dist/dist-es-6PLFRCS4.js +18 -0
  133. package/dist/dist-es-G5UIJOU7.js +26 -0
  134. package/dist/{20260428004200_add_session_path-LGW75WYA.js → dist-es-HYIIGUNX.js} +5 -1
  135. package/dist/dist-es-L2GU465G.js +18 -0
  136. package/dist/dist-es-LSR2QCFZ.js +18 -0
  137. package/dist/dist-es-RGEIM2BP.js +18 -0
  138. package/dist/dist-es-SITTNOGV.js +18 -0
  139. package/dist/dist-es-W5GYOX6F.js +18 -0
  140. package/dist/esm-NN5W7YCL.js +18 -0
  141. package/dist/esm-XWJSHYHG.js +18 -0
  142. package/dist/getMachineId-bsd-L5I5TZ5I.js +18 -0
  143. package/dist/getMachineId-darwin-YB7KG37W.js +19 -0
  144. package/dist/getMachineId-linux-EL47KXX7.js +18 -0
  145. package/dist/getMachineId-unsupported-QOWPEBPN.js +18 -0
  146. package/dist/getMachineId-win-HCRYRDFJ.js +18 -0
  147. package/dist/lib-ZP7Q6A3E.js +199 -0
  148. package/dist/loadCognitoIdentity-EWT55EI7.js +18 -0
  149. package/dist/loadSso-AGOUE6RL.js +18 -0
  150. package/dist/{20260213144116_wakeful_the_professor-ZVDD54AK.js → loadSts-RH5L3PIX.js} +5 -1
  151. package/dist/mantle-IJXDXT4M.js +25 -0
  152. package/dist/mime-types-46EO4HOZ.js +18 -0
  153. package/dist/multipart-parser-KZWMKXA4.js +19 -0
  154. package/dist/{20260211171708_add_project_commands-GDOHPDPF.js → open-7KXTRM37.js} +5 -1
  155. package/dist/openai-ZOJI6I5R.js +18 -0
  156. package/dist/p-map-CYL6ILJW.js +18 -0
  157. package/dist/photon-W56QZY4L.js +18 -0
  158. package/dist/{20260423070820_add_icon_url_override-X5SHFGTI.js → pkce-VT4ITJTB.js} +5 -1
  159. package/dist/{pty.node-Y3N2XKYG.js → pty.node-IWULXXG6.js} +5 -1
  160. package/dist/run.js +5 -1
  161. package/dist/serve.js +143 -1
  162. package/dist/server-LVIHYOCY.js +21 -0
  163. package/dist/session-6OPJNJMK.js +18 -0
  164. package/dist/signin-OCIW23YM.js +18 -0
  165. package/dist/src-3NCXEROI.js +18 -0
  166. package/dist/src-LXWGIUZH.js +18 -0
  167. package/dist/src-WDYKISPD.js +20 -0
  168. package/dist/src-YAAFIGTW.js +18 -0
  169. package/dist/sso-oidc-OMMKINFE.js +18 -0
  170. package/dist/sts-MWK22JIX.js +18 -0
  171. package/dist/token-QPO3OAGS.js +18 -0
  172. package/dist/token-util-YGPCEEPO.js +18 -0
  173. package/dist/unified-W3ZKZ4HG.js +18 -0
  174. package/dist/worktree-32M5MTFE.js +18 -0
  175. package/package.json +40 -40
  176. package/postinstall.cjs +4 -2
  177. package/dist/20260127222353_familiar_lady_ursula-KV747FJX.js +0 -14
  178. package/dist/20260309230000_move_org_to_state-NOXAPU5V.js +0 -14
  179. package/dist/20260312043431_session_message_cursor-DJ4T3T4R.js +0 -14
  180. package/dist/20260323234822_events-72GIKJ2A.js +0 -14
  181. package/dist/20260410174513_workspace-name-JXSWFBJN.js +0 -14
  182. package/dist/20260413175956_chief_energizer-4HEWZ6U3.js +0 -14
  183. package/dist/20260427172553_slow_nightmare-PS5T2AH2.js +0 -14
  184. package/dist/20260501142318_next_venus-J3TLVXZ6.js +0 -14
  185. package/dist/20260504145000_add_sync_owner-3R52GB4C.js +0 -14
  186. package/dist/20260507164347_add_workspace_time-JHDRCZAR.js +0 -14
  187. package/dist/20260511173437_session-metadata-T2XHGWHS.js +0 -14
  188. package/dist/20260601010001_normalize_storage_paths-5MAY5GT3.js +0 -14
  189. package/dist/20260601202201_amazing_prowler-PET224YG.js +0 -14
  190. package/dist/20260602002951_lowly_union_jack-PG6XDMGL.js +0 -14
  191. package/dist/20260602182828_add_project_directories-ZCH2ACGG.js +0 -14
  192. package/dist/20260603001617_session_message_projection_indexes-XVLJTUF2.js +0 -14
  193. package/dist/20260603040000_session_message_projection_order-XG6RACZQ.js +0 -14
  194. package/dist/20260603141458_session_input_inbox-K2VQ7V6E.js +0 -14
  195. package/dist/20260603160727_jittery_ezekiel_stane-WKJLRDO7.js +0 -14
  196. package/dist/20260604172448_event_sourced_session_input-NTXOECR7.js +0 -14
  197. package/dist/20260605003541_add_session_context_snapshot-DXMQEXMT.js +0 -14
  198. package/dist/20260611035744_credential-XTMSYTJD.js +0 -14
  199. package/dist/20260611192811_lush_chimera-XPLIQMJD.js +0 -14
  200. package/dist/20260612174303_project_dir_strategy-FR2NGQKK.js +0 -14
  201. package/dist/20260622142730_simplify_session_context_epoch-NTQZR3RE.js +0 -14
  202. package/dist/20260622202450_simplify_session_input-2EXF2HMV.js +0 -14
  203. package/dist/app-runtime-HQBOCDV5.js +0 -14
  204. package/dist/chunk-4FEBIOI5.js +0 -865
  205. package/dist/chunk-4K2RXRZL.js +0 -14
  206. package/dist/chunk-4RFMKEKM.js +0 -1455
  207. package/dist/chunk-BM2C7NHL.js +0 -41
  208. package/dist/chunk-MKEMZFJI.js +0 -393
  209. package/dist/chunk-OMDJ6ZZ2.js +0 -684
  210. package/dist/chunk-OWMG4NNF.js +0 -186
  211. package/dist/chunk-QRABYJKL.js +0 -14
  212. package/dist/chunk-RHIWAYN5.js +0 -14
  213. package/dist/chunk-Z5TLIUAI.js +0 -28
  214. package/dist/code-mode-7BQJUARW.js +0 -40
  215. package/dist/copilot-provider-TX4YFKJZ.js +0 -14
  216. package/dist/photon-VQS5F5BI.js +0 -14
  217. package/dist/server-BFUQR7MX.js +0 -17
  218. package/dist/session-6RNXZNG6.js +0 -14
  219. package/dist/worktree-QHQHX3SG.js +0 -14
  220. package/patches/@ai-sdk%2Famazon-bedrock@4.0.166.patch +0 -164
  221. package/patches/@ai-sdk%2Fanthropic@3.0.111.patch +0 -528
  222. package/patches/@ai-sdk%2Fgoogle@3.0.73.patch +0 -69
  223. package/patches/@ai-sdk%2Fgroq@3.0.31.patch +0 -79
  224. package/patches/@ai-sdk%2Fmistral@3.0.51.patch +0 -714
  225. package/patches/@ai-sdk%2Fopenai-compatible@2.0.41.patch +0 -39
  226. package/patches/@ai-sdk%2Fopenai@3.0.88.patch +0 -280
  227. package/patches/@ai-sdk%2Fxai@3.0.139.patch +0 -296
  228. package/patches/@modelcontextprotocol%2Fsdk@1.29.0.patch +0 -647
  229. package/patches/@npmcli%2Fagent@4.0.2.patch +0 -13
  230. package/patches/effect@4.0.0-beta.83.patch +0 -57
  231. package/patches/gcp-metadata@8.1.2.patch +0 -14
  232. package/patches/pacote@21.5.0.patch +0 -18
@@ -0,0 +1,19 @@
1
+ // Built by esbuild from opencode-server source
2
+ if (typeof globalThis.Bun === 'undefined') {
3
+ globalThis.Bun = {
4
+ version: '0.0.0-node-compat',
5
+ stdin: { async text() { const chunks = []; for await (const c of process.stdin) chunks.push(c); return Buffer.concat(chunks).toString(); } },
6
+ which(cmd) { try { return require('child_process').execFileSync('which', [cmd], { encoding: 'utf8' }).trim(); } catch { return null; } },
7
+ };
8
+ }
9
+ if (typeof globalThis.__name === 'undefined') { globalThis.__name = (t, n) => { Object.defineProperty(t, 'name', { value: n, configurable: true }); return t; }; }
10
+ if (typeof globalThis.__export === 'undefined') { globalThis.__export = (t, a) => { for (const k in a) Object.defineProperty(t, k, { get: a[k], enumerable: true }); }; }
11
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
13
+ import { fileURLToPath as __alchemyFileURLToPath } from 'node:url';
14
+ import { dirname as __alchemyDirname } from 'node:path';
15
+ const __alchemy_filename = __alchemyFileURLToPath(import.meta.url);
16
+ const __alchemy_dirname = __alchemyDirname(__alchemy_filename);
17
+
18
+ import{f as S,j as q}from"./chunk-CYRZU5QM.js";import{a as o,g as I}from"./chunk-2MRHL4B2.js";var T=I(S());var g=o(e=>!!e&&typeof e=="object"&&typeof e.AccessKeyId=="string"&&typeof e.SecretAccessKey=="string"&&typeof e.Token=="string"&&typeof e.Expiration=="string","isImdsCredentials"),O=o(e=>({accessKeyId:e.AccessKeyId,secretAccessKey:e.SecretAccessKey,sessionToken:e.Token,expiration:new Date(e.Expiration),...e.AccountId&&{accountId:e.AccountId}}),"fromImdsCredentials");var j=1e3,Y=0,h=o(({maxRetries:e=0,timeout:t=1e3})=>({maxRetries:e,timeout:t}),"providerConfigFromInit");var D=I(S());import F from"node:http";function m(e){return new Promise((t,a)=>{let r=F.request({method:"GET",...e,hostname:e.hostname?.replace(/^\[(.+)\]$/,"$1")});r.on("error",n=>{a(Object.assign(new D.ProviderError("Unable to connect to instance metadata service"),n)),r.destroy()}),r.on("timeout",()=>{a(new D.ProviderError("TimeoutError from instance metadata service")),r.destroy()}),r.on("response",n=>{let{statusCode:s=400}=n;(s<200||300<=s)&&(a(Object.assign(new D.ProviderError("Error response received from instance metadata service"),{statusCode:s})),r.destroy());let f=[];n.on("data",i=>{f.push(i)}),n.on("end",()=>{t(Buffer.concat(f)),r.destroy()})}),r.end()})}o(m,"httpRequest");var N=o((e,t)=>{let a=e();for(let r=0;r<t;r++)a=a.catch(e);return a},"retry");var v="AWS_CONTAINER_CREDENTIALS_FULL_URI",w="AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",x="AWS_CONTAINER_AUTHORIZATION_TOKEN",J=o((e={})=>{let{timeout:t,maxRetries:a}=h(e);return()=>N(async()=>{let r=await ee({logger:e.logger}),n=JSON.parse(await X(t,r));if(!g(n))throw new T.CredentialsProviderError("Invalid response received from instance metadata service.",{logger:e.logger});return O(n)},a)},"fromContainerMetadata"),X=o(async(e,t)=>(process.env[x]&&(t.headers={...t.headers,Authorization:process.env[x]}),(await m({...t,timeout:e})).toString()),"requestFromEcsImds"),z="169.254.170.2",Z=new Set(["localhost","127.0.0.1"]),Q=new Set(["http:","https:"]),ee=o(async({logger:e})=>{if(process.env[w])return{hostname:z,path:process.env[w]};if(process.env[v]){let t;try{t=new URL(process.env[v])}catch{throw new T.CredentialsProviderError(`${process.env[v]} is not a valid container metadata service URL`,{tryNextLink:!1,logger:e})}if(!t.hostname||!Z.has(t.hostname))throw new T.CredentialsProviderError(`${t.hostname} is not a valid container metadata service hostname`,{tryNextLink:!1,logger:e});if(!t.protocol||!Q.has(t.protocol))throw new T.CredentialsProviderError(`${t.protocol} is not a valid container metadata service protocol`,{tryNextLink:!1,logger:e});return{protocol:t.protocol,hostname:t.hostname,path:t.pathname+t.search,port:t.port?parseInt(t.port,10):void 0}}throw new T.CredentialsProviderError(`The container metadata credential provider cannot be used unless the ${w} or ${v} environment variable is set`,{tryNextLink:!1,logger:e})},"getCmdsUri");var C=I(S());var b=I(S());var M=class e extends b.CredentialsProviderError{static{o(this,"InstanceMetadataV1FallbackError")}tryNextLink;name="InstanceMetadataV1FallbackError";constructor(t,a=!0){super(t,a),this.tryNextLink=a,Object.setPrototypeOf(this,e.prototype)}};var R=I(S()),U=I(q());var u;(function(e){e.IPv4="http://169.254.169.254",e.IPv6="http://[fd00:ec2::254]"})(u||(u={}));var te="AWS_EC2_METADATA_SERVICE_ENDPOINT",oe="ec2_metadata_service_endpoint",V={environmentVariableSelector:o(e=>e[te],"environmentVariableSelector"),configFileSelector:o(e=>e[oe],"configFileSelector"),default:void 0};var p;(function(e){e.IPv4="IPv4",e.IPv6="IPv6"})(p||(p={}));var re="AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE",ne="ec2_metadata_service_endpoint_mode",k={environmentVariableSelector:o(e=>e[re],"environmentVariableSelector"),configFileSelector:o(e=>e[ne],"configFileSelector"),default:p.IPv4};var y=o(async()=>(0,U.parseUrl)(await ae()||await se()),"getInstanceMetadataEndpoint"),ae=o(async()=>(0,R.loadConfig)(V)(),"getFromEndpointConfig"),se=o(async()=>{let e=await(0,R.loadConfig)(k)();switch(e){case p.IPv4:return u.IPv4;case p.IPv6:return u.IPv6;default:throw new Error(`Unsupported endpoint mode: ${e}. Select from ${Object.values(p)}`)}},"getFromEndpointModeConfig");var ie="https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html",P=o((e,t)=>{let a=300+Math.floor(Math.random()*300),r=new Date(Date.now()+a*1e3);t.warn(`Attempting credential expiration extension due to a credential service availability issue. A refresh of these credentials will be attempted after ${new Date(r)}.
19
+ For more information, please visit: `+ie);let n=e.originalExpiration??e.expiration;return{...e,...n?{originalExpiration:n}:{},expiration:r}},"getExtendedInstanceMetadataCredentials");var W=o((e,t={})=>{let a=t?.logger||console,r;return async()=>{let n;try{n=await e(),n.expiration&&n.expiration.getTime()<Date.now()&&(n=P(n,a))}catch(s){if(r)a.warn("Credential renew failed: ",s),n=P(r,a);else throw s}return r=n,n}},"staticStabilityProvider");var B="/latest/meta-data/iam/security-credentials/",ce="/latest/api/token",L="AWS_EC2_METADATA_V1_DISABLED",K="ec2_metadata_v1_disabled",$="x-aws-ec2-metadata-token",de=o((e={})=>W(le(e),{logger:e.logger}),"fromInstanceMetadata"),le=o((e={})=>{let t=!1,{logger:a,profile:r}=e,{timeout:n,maxRetries:s}=h(e),f=o(async(i,E)=>{if(t||E.headers?.[$]==null){let c=!1,d=!1,H=await(0,C.loadConfig)({environmentVariableSelector:o(l=>{let _=l[L];if(d=!!_&&_!=="false",_===void 0)throw new C.CredentialsProviderError(`${L} not set in env, checking config file next.`,{logger:e.logger});return d},"environmentVariableSelector"),configFileSelector:o(l=>{let _=l[K];return c=!!_&&_!=="false",c},"configFileSelector"),default:!1},{profile:r})();if(e.ec2MetadataV1Disabled||H){let l=[];throw e.ec2MetadataV1Disabled&&l.push("credential provider initialization (runtime option ec2MetadataV1Disabled)"),c&&l.push(`config file profile (${K})`),d&&l.push(`process environment variable (${L})`),new M(`AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${l.join(", ")}].`)}}let G=(await N(async()=>{let c;try{c=await me(E)}catch(d){throw d.statusCode===401&&(t=!1),d}return c},i)).trim();return N(async()=>{let c;try{c=await fe(G,E,e)}catch(d){throw d.statusCode===401&&(t=!1),d}return c},i)},"getCredentials");return async()=>{let i=await y();if(t)return a?.debug("AWS SDK Instance Metadata","using v1 fallback (no token fetch)"),f(s,{...i,timeout:n});{let E;try{E=(await pe({...i,timeout:n})).toString()}catch(A){if(A?.statusCode===400)throw Object.assign(A,{message:"EC2 Metadata token request returned error"});return(A.message==="TimeoutError"||[403,404,405].includes(A.statusCode))&&(t=!0),a?.debug("AWS SDK Instance Metadata","using v1 fallback (initial)"),f(s,{...i,timeout:n})}return f(s,{...i,headers:{[$]:E},timeout:n})}}},"getInstanceMetadataProvider"),pe=o(async e=>m({...e,path:ce,method:"PUT",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"21600"}}),"getMetadataToken"),me=o(async e=>(await m({...e,path:B})).toString(),"getProfile"),fe=o(async(e,t,a)=>{let r=JSON.parse((await m({...t,path:B+e})).toString());if(!g(r))throw new C.CredentialsProviderError("Invalid response received from instance metadata service.",{logger:a.logger});return O(r)},"getCredentialsFromProfile");export{j as a,Y as b,h as c,m as d,v as e,w as f,x as g,J as h,u as i,y as j,de as k};
@@ -0,0 +1,33 @@
1
+ // Built by esbuild from opencode-server source
2
+ if (typeof globalThis.Bun === 'undefined') {
3
+ globalThis.Bun = {
4
+ version: '0.0.0-node-compat',
5
+ stdin: { async text() { const chunks = []; for await (const c of process.stdin) chunks.push(c); return Buffer.concat(chunks).toString(); } },
6
+ which(cmd) { try { return require('child_process').execFileSync('which', [cmd], { encoding: 'utf8' }).trim(); } catch { return null; } },
7
+ };
8
+ }
9
+ if (typeof globalThis.__name === 'undefined') { globalThis.__name = (t, n) => { Object.defineProperty(t, 'name', { value: n, configurable: true }); return t; }; }
10
+ if (typeof globalThis.__export === 'undefined') { globalThis.__export = (t, a) => { for (const k in a) Object.defineProperty(t, k, { get: a[k], enumerable: true }); }; }
11
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
13
+ import { fileURLToPath as __alchemyFileURLToPath } from 'node:url';
14
+ import { dirname as __alchemyDirname } from 'node:path';
15
+ const __alchemy_filename = __alchemyFileURLToPath(import.meta.url);
16
+ const __alchemy_dirname = __alchemyDirname(__alchemy_filename);
17
+
18
+ import{a,b as v,c as B,d as G,e as vo,h as Re}from"./chunk-2MRHL4B2.js";var Me,kn=B(()=>{(function(t){t.HEADER="header",t.QUERY="query"})(Me||(Me={}))});var $e,Pn=B(()=>{(function(t){t.HEADER="header",t.QUERY="query"})($e||($e={}))});var vn=B(()=>{kn();Pn()});var st,Bn=B(()=>{(function(t){t.HTTP="http",t.HTTPS="https"})(st||(st={}))});var se,Fn,zn,hr=B(()=>{(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(se||(se={}));Fn=a(t=>{let e=[];return t.sha256!==void 0&&e.push({algorithmId:a(()=>se.SHA256,"algorithmId"),checksumConstructor:a(()=>t.sha256,"checksumConstructor")}),t.md5!=null&&e.push({algorithmId:a(()=>se.MD5,"algorithmId"),checksumConstructor:a(()=>t.md5,"checksumConstructor")}),{addChecksumAlgorithm(r){e.push(r)},checksumAlgorithms(){return e}}},"getChecksumConfiguration"),zn=a(t=>{let e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e},"resolveChecksumRuntimeConfig")});var lr,dr,jn=B(()=>{hr();lr=a(t=>Fn(t),"getDefaultClientConfiguration"),dr=a(t=>zn(t),"resolveDefaultRuntimeConfig")});var Hn=B(()=>{jn();hr()});var it,Vn=B(()=>{(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(it||(it={}))});var qn,Wn=B(()=>{qn="__smithy_context"});var ot,Gn=B(()=>{(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(ot||(ot={}))});var at,Jn=B(()=>{(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(at||(at={}))});var de={};vo(de,{AlgorithmId:()=>se,EndpointURLScheme:()=>st,FieldPosition:()=>it,HttpApiKeyAuthLocation:()=>$e,HttpAuthLocation:()=>Me,IniSectionType:()=>ot,RequestHandlerProtocol:()=>at,SMITHY_CONTEXT_KEY:()=>qn,getDefaultClientConfiguration:()=>lr,resolveDefaultRuntimeConfig:()=>dr});var me=B(()=>{vn();Bn();Hn();Vn();Wn();Gn();Jn()});var j=G(F=>{var{SMITHY_CONTEXT_KEY:Kn}=(me(),Re(de)),Bo=a(t=>t[Kn]||(t[Kn]={}),"getSmithyContext");function Qn(t,e){return Object.prototype.hasOwnProperty.call(t,e)}a(Qn,"hasOwn");var mr=class t{static{a(this,"HttpRequest")}method;protocol;hostname;port;path;query;headers;username;password;fragment;body;constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=Fo(r.query)),r}static isInstance(e){if(!e)return!1;let r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query=="object"&&typeof r.headers=="object"}clone(){return t.clone(this)}};function Fo(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}a(Fo,"cloneQuery");var pr=class{static{a(this,"HttpResponse")}statusCode;reason;headers;body;constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;let r=e;return typeof r.statusCode=="number"&&typeof r.headers=="object"}},zo=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),Zn=a((t,e=!1)=>{if(!e)return zo.test(t);let r=t.split(".");for(let n of r)if(!Zn(n))return!1;return!0},"isValidHostLabel");function jo(t){return/^[a-z0-9][a-z0-9.-]*[a-z0-9]$/.test(t)}a(jo,"isValidHostname");var Ho=a(t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e},"normalizeProvider");function Xn(t){let e={};if(t=t.replace(/^\?/,""),t)for(let r of t.split("&")){let[n,s=null]=r.split("=");n=decodeURIComponent(n),s&&(s=decodeURIComponent(s)),n in e?Array.isArray(e[n])?e[n].push(s):e[n]=[e[n],s]:e[n]=s}return e}a(Xn,"parseQueryString");var ct=a(t=>{if(typeof t=="string")return ct(new URL(t));let{hostname:e,pathname:r,port:n,protocol:s,search:i}=t,o;return i&&(o=Xn(i)),{hostname:e,port:n?parseInt(n):void 0,protocol:s,path:r,query:o}},"parseUrl"),Vo=a(t=>{if(typeof t=="object"){if("url"in t){let e=ct(t.url);if(t.headers){e.headers={};for(let r in t.headers)Qn(t.headers,r)&&(e.headers[r.toLowerCase()]=t.headers[r].join(", "))}return e}return t}return ct(t)},"toEndpointV1");F.HttpRequest=mr;F.HttpResponse=pr;F.getSmithyContext=Bo;F.hasOwn=Qn;F.isValidHostLabel=Zn;F.isValidHostname=jo;F.normalizeProvider=Ho;F.parseQueryString=Xn;F.parseUrl=ct;F.toEndpointV1=Vo});var yt=G(N=>{var{getSmithyContext:Yn,HttpResponse:qo,toEndpointV1:Wo}=j(),ft=a(t=>typeof t=="function"?t():t,"deref"),wr=a((t,e,r,n,s)=>({name:e,namespace:t,traits:r,input:n,output:s}),"operation"),Go=a(t=>(e,r)=>async n=>{let{response:s}=await e(n),{operationSchema:i}=Yn(r),[,o,c,f,u,d]=i??[];try{let h=await t.protocol.deserializeResponse(wr(o,c,f,u,d),{...t,...r},s);return{response:s,output:h}}catch(h){if(Object.defineProperty(h,"$response",{value:s,enumerable:!1,writable:!1,configurable:!1}),!("$metadata"in h)){let l="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";try{h.message+=`
19
+ `+l}catch{!r.logger||r.logger?.constructor?.name==="NoOpLogger"?console.warn(l):r.logger?.warn?.(l)}typeof h.$responseBodyText<"u"&&h.$response&&(h.$response.body=h.$responseBodyText);try{if(qo.isInstance(s)){let{headers:m={},statusCode:p}=s,y=Object.entries(m);h.$metadata={httpStatusCode:p,requestId:gr(/^x-[\w-]+-request-?id$/,y),extendedRequestId:gr(/^x-[\w-]+-id-2$/,y),cfId:gr(/^x-[\w-]+-cf-id$/,y)}}}catch{}}throw h}},"schemaDeserializationMiddleware"),gr=a((t,e)=>(e.find(([r])=>r.match(t))||[void 0,void 0])[1],"findHeader"),Jo=a(t=>(e,r)=>async n=>{let{operationSchema:s}=Yn(r),[,i,o,c,f,u]=s??[],d=r.endpointV2?async()=>Wo(r.endpointV2):t.endpoint,h=await t.protocol.serializeRequest(wr(i,o,c,f,u),n.input,{...t,...r,endpoint:d});return e({...n,request:h})},"schemaSerializationMiddleware"),es={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},ts={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function Ko(t){return{applyToStack:a(e=>{e.add(Jo(t),ts),e.add(Go(t),es),t.protocol.setSerdeContext(t)},"applyToStack")}}a(Ko,"getSchemaSerdePlugin");var L=class{static{a(this,"Schema")}name;namespace;traits;static assign(e,r){return Object.assign(e,r)}static[Symbol.hasInstance](e){let r=this.prototype.isPrototypeOf(e);return!r&&typeof e=="object"&&e!==null?e.symbol===this.symbol:r}getName(){return this.namespace+"#"+this.name}},dt=class t extends L{static{a(this,"ListSchema")}static symbol=Symbol.for("@smithy/lis");valueSchema;symbol=t.symbol},Qo=a((t,e,r,n)=>L.assign(new dt,{name:e,namespace:t,traits:r,valueSchema:n}),"list"),mt=class t extends L{static{a(this,"MapSchema")}static symbol=Symbol.for("@smithy/map");keySchema;valueSchema;symbol=t.symbol},Zo=a((t,e,r,n,s)=>L.assign(new mt,{name:e,namespace:t,traits:r,keySchema:n,valueSchema:s}),"map"),pt=class t extends L{static{a(this,"OperationSchema")}static symbol=Symbol.for("@smithy/ope");input;output;symbol=t.symbol},Xo=a((t,e,r,n,s)=>L.assign(new pt,{name:e,namespace:t,traits:r,input:n,output:s}),"op"),ke=class t extends L{static{a(this,"StructureSchema")}static symbol=Symbol.for("@smithy/str");memberNames;memberList;symbol=t.symbol},Yo=a((t,e,r,n,s)=>L.assign(new ke,{name:e,namespace:t,traits:r,memberNames:n,memberList:s}),"struct"),gt=class t extends ke{static{a(this,"ErrorSchema")}static symbol=Symbol.for("@smithy/err");ctor;symbol=t.symbol},ea=a((t,e,r,n,s,i)=>L.assign(new gt,{name:e,namespace:t,traits:r,memberNames:n,memberList:s,ctor:null}),"error"),ut=[];function Le(t){if(typeof t=="object")return t;if(t=t|0,ut[t])return ut[t];let e={},r=0;for(let n of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"])(t>>r++&1)===1&&(e[n]=1);return ut[t]=e}a(Le,"translateTraits");var Ue={it:Symbol.for("@smithy/nor-struct-it"),ns:Symbol.for("@smithy/ns")},ht=[],lt={},Pe=class t{static{a(this,"NormalizedSchema")}ref;memberName;static symbol=Symbol.for("@smithy/nor");symbol=t.symbol;name;schema;_isMemberSchema;traits;memberTraits;normalizedTraits;constructor(e,r){this.ref=e,this.memberName=r;let n=[],s=e,i=e;for(this._isMemberSchema=!1;yr(s);)n.push(s[1]),s=s[0],i=ft(s),this._isMemberSchema=!0;if(n.length>0){this.memberTraits={};for(let o=n.length-1;o>=0;--o){let c=n[o];Object.assign(this.memberTraits,Le(c))}}else this.memberTraits=0;if(i instanceof t){let o=this.memberTraits;Object.assign(this,i),this.memberTraits=Object.assign({},o,i.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,this.memberName=r??i.memberName;return}if(this.schema=ft(i),rs(this.schema)?(this.name=`${this.schema[1]}#${this.schema[2]}`,this.traits=this.schema[3]):(this.name=this.memberName??String(i),this.traits=0),this._isMemberSchema&&!r)throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(!0)} missing member name.`)}static[Symbol.hasInstance](e){let r=this.prototype.isPrototypeOf(e);return!r&&typeof e=="object"&&e!==null?e.symbol===this.symbol:r}static of(e){let r=typeof e=="function"||typeof e=="object"&&e!==null;if(typeof e=="number"){if(ht[e])return ht[e]}else if(typeof e=="string"){if(lt[e])return lt[e]}else if(r&&e[Ue.ns])return e[Ue.ns];let n=ft(e);if(n instanceof t)return n;if(yr(n)){let[i,o]=n;if(i instanceof t)return Object.assign(i.getMergedTraits(),Le(o)),i;throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(e,null,2)}.`)}let s=new t(n);return r?e[Ue.ns]=s:typeof n=="string"?lt[n]=s:typeof n=="number"?ht[n]=s:s}getSchema(){let e=this.schema;return Array.isArray(e)&&e[0]===0?e[4]:e}getName(e=!1){let{name:r}=this;return!e&&r&&r.includes("#")?r.split("#")[1]:r||void 0}getMemberName(){return this.memberName}isMemberSchema(){return this._isMemberSchema}isListSchema(){let e=this.getSchema();return typeof e=="number"?e>=64&&e<128:e[0]===1}isMapSchema(){let e=this.getSchema();return typeof e=="number"?e>=128&&e<=255:e[0]===2}isStructSchema(){let e=this.getSchema();if(typeof e!="object")return!1;let r=e[0];return r===3||r===-3||r===4}isUnionSchema(){let e=this.getSchema();return typeof e!="object"?!1:e[0]===4}isBlobSchema(){let e=this.getSchema();return e===21||e===42}isTimestampSchema(){let e=this.getSchema();return typeof e=="number"&&e>=4&&e<=7}isUnitSchema(){return this.getSchema()==="unit"}isDocumentSchema(){return this.getSchema()===15}isStringSchema(){return this.getSchema()===0}isBooleanSchema(){return this.getSchema()===2}isNumericSchema(){return this.getSchema()===1}isBigIntegerSchema(){return this.getSchema()===17}isBigDecimalSchema(){return this.getSchema()===19}isStreaming(){let{streaming:e}=this.getMergedTraits();return!!e||this.getSchema()===42}isIdempotencyToken(){return!!this.getMergedTraits().idempotencyToken}getMergedTraits(){return this.normalizedTraits??(this.normalizedTraits={...this.getOwnTraits(),...this.getMemberTraits()})}getMemberTraits(){return Le(this.memberTraits)}getOwnTraits(){return Le(this.traits)}getKeySchema(){let[e,r]=[this.isDocumentSchema(),this.isMapSchema()];if(!e&&!r)throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(!0)}`);let n=this.getSchema(),s=e?15:n[4]??0;return De([s,0],"key")}getValueSchema(){let e=this.getSchema(),[r,n,s]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()],i=typeof e=="number"?63&e:e&&typeof e=="object"&&(n||s)?e[3+e[0]]:r?15:void 0;if(i!=null)return De([i,0],n?"value":"member");throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no value member.`)}getMemberSchema(e){let r=this.getSchema();if(this.isStructSchema()&&r[4].includes(e)){let n=r[4].indexOf(e),s=r[5][n];return De(yr(s)?s:[s,0],e)}if(this.isDocumentSchema())return De([15,0],e);throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no member=${e}.`)}getMemberSchemas(){let e={};try{for(let[r,n]of this.structIterator())e[r]=n}catch{}return e}getEventStreamMember(){if(this.isStructSchema()){for(let[e,r]of this.structIterator())if(r.isStreaming()&&r.isStructSchema())return e}return""}*structIterator(){if(this.isUnitSchema())return;if(!this.isStructSchema())throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");let e=this.getSchema(),r=e[4].length,n=e[Ue.it];if(n&&r===n.length){yield*n;return}n=Array(r);for(let s=0;s<r;++s){let i=e[4][s],o=De([e[5][s],0],i);yield n[s]=[i,o]}e[Ue.it]=n}};function De(t,e){if(t instanceof Pe)return Object.assign(t,{memberName:e,_isMemberSchema:!0});let r=Pe;return new r(t,e)}a(De,"member");var yr=a(t=>Array.isArray(t)&&t.length===2,"isMemberSchema"),rs=a(t=>Array.isArray(t)&&t.length>=5,"isStaticSchema"),ve=class t extends L{static{a(this,"SimpleSchema")}static symbol=Symbol.for("@smithy/sim");schemaRef;symbol=t.symbol},ta=a((t,e,r,n)=>L.assign(new ve,{name:e,namespace:t,traits:n,schemaRef:r}),"sim"),ra=a((t,e,r,n)=>L.assign(new ve,{name:e,namespace:t,traits:r,schemaRef:n}),"simAdapter"),na={BLOB:21,STREAMING_BLOB:42,BOOLEAN:2,STRING:0,NUMERIC:1,BIG_INTEGER:17,BIG_DECIMAL:19,DOCUMENT:15,TIMESTAMP_DEFAULT:4,TIMESTAMP_DATE_TIME:5,TIMESTAMP_HTTP_DATE:6,TIMESTAMP_EPOCH_SECONDS:7,LIST_MODIFIER:64,MAP_MODIFIER:128},Sr=class t{static{a(this,"TypeRegistry")}namespace;schemas;exceptions;static registries=new Map;constructor(e,r=new Map,n=new Map){this.namespace=e,this.schemas=r,this.exceptions=n,t.registries.has(e)||t.registries.set(e,this)}static for(e){return t.registries.get(e)??new t(e)}copyFrom(e){let{schemas:r,exceptions:n}=this;for(let[s,i]of e.schemas)r.has(s)||r.set(s,i);for(let[s,i]of e.exceptions)n.has(s)||n.set(s,i)}register(e,r){let n=this.normalizeShapeId(e);for(let s of[this,t.for(n.split("#")[0])])s.schemas.has(n)||s.schemas.set(n,r)}getSchema(e){let r=this.normalizeShapeId(e);if(!this.schemas.has(r)){if(!e.includes("#")){let n="#"+e,s=[];for(let[i,o]of this.schemas.entries())i.endsWith(n)&&s.push(o);if(s.length===1)return s[0]}throw new Error(`@smithy/core/schema - schema not found for ${r}`)}return this.schemas.get(r)}registerError(e,r){let n=e,s=n[1],i=s+"#"+n[2];r.hasOwnProperty?.("shapeId")||(r.shapeId=i);for(let o of[this,t.for(s)])!o.schemas.has(i)&&!o.exceptions.has(n)&&(o.schemas.set(i,n),o.exceptions.set(n,r))}getErrorCtor(e){let r=e;return this.exceptions.has(r)?this.exceptions.get(r):t.for(r[1]).exceptions.get(r)}getBaseException(){for(let e of this.exceptions.keys())if(Array.isArray(e)){let[,r,n]=e,s=r+"#"+n;if(s.startsWith("smithy.ts.sdk.synthetic.")&&s.endsWith("ServiceException"))return e}}find(e){for(let r of this.schemas.values())if(e(r))return r}clear(){this.schemas.clear(),this.exceptions.clear()}normalizeShapeId(e){return e.includes("#")?e:this.namespace+"#"+e}};N.ErrorSchema=gt;N.ListSchema=dt;N.MapSchema=mt;N.NormalizedSchema=Pe;N.OperationSchema=pt;N.SCHEMA=na;N.Schema=L;N.SimpleSchema=ve;N.StructureSchema=ke;N.TypeRegistry=Sr;N.deref=ft;N.deserializerMiddlewareOption=es;N.error=ea;N.getSchemaSerdePlugin=Ko;N.isStaticSchema=rs;N.list=Qo;N.map=Zo;N.op=Xo;N.operation=wr;N.serializerMiddlewareOption=ts;N.sim=ta;N.simAdapter=ra;N.simpleSchemaCacheN=ht;N.simpleSchemaCacheS=lt;N.struct=Yo;N.traitsCache=ut;N.translateTraits=Le});var bs=G(x=>{var{hasOwn:je}=j(),{getSmithyContext:sa,normalizeProvider:ia}=j();x.getSmithyContext=sa;x.normalizeProvider=ia;var{SMITHY_CONTEXT_KEY:ns,AlgorithmId:Be}=(me(),Re(de));x.AlgorithmId=Be;var{NormalizedSchema:oa}=yt(),ie=a((t,e)=>{let r=[];if(t&&r.push(t),e)for(let n of e)r.push(n);return r},"getAllAliases"),Z=a((t,e)=>`${t||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,"getMiddlewareNameWithAliases"),Fe=a(()=>{let t=[],e=[],r=!1,n=new Set,s=a(h=>h.sort((l,m)=>ss[m.step]-ss[l.step]||is[m.priority||"normal"]-is[l.priority||"normal"]),"sort"),i=a(h=>{let l=!1,m=a(p=>{let y=ie(p.name,p.aliases);if(y.includes(h)){l=!0;for(let g of y)n.delete(g);return!1}return!0},"filterCb");return t=t.filter(m),e=e.filter(m),l},"removeByName"),o=a(h=>{let l=!1,m=a(p=>{if(p.middleware===h){l=!0;for(let y of ie(p.name,p.aliases))n.delete(y);return!1}return!0},"filterCb");return t=t.filter(m),e=e.filter(m),l},"removeByReference"),c=a(h=>(t.forEach(l=>{h.add(l.middleware,{...l})}),e.forEach(l=>{h.addRelativeTo(l.middleware,{...l})}),h.identifyOnResolve?.(d.identifyOnResolve()),h),"cloneTo"),f=a(h=>{let l=[];return h.before.forEach(m=>{m.before.length===0&&m.after.length===0?l.push(m):l.push(...f(m))}),l.push(h),h.after.reverse().forEach(m=>{m.before.length===0&&m.after.length===0?l.push(m):l.push(...f(m))}),l},"expandRelativeMiddlewareList"),u=a((h=!1)=>{let l=[],m=[],p={};return t.forEach(g=>{let S={...g,before:[],after:[]};for(let b of ie(S.name,S.aliases))p[b]=S;l.push(S)}),e.forEach(g=>{let S={...g,before:[],after:[]};for(let b of ie(S.name,S.aliases))p[b]=S;m.push(S)}),m.forEach(g=>{if(g.toMiddleware){let S=p[g.toMiddleware];if(S===void 0){if(h)return;throw new Error(`${g.toMiddleware} is not found when adding ${Z(g.name,g.aliases)} middleware ${g.relation} ${g.toMiddleware}`)}g.relation==="after"&&S.after.push(g),g.relation==="before"&&S.before.push(g)}}),s(l).map(f).reduce((g,S)=>(g.push(...S),g),[])},"getMiddlewareList"),d={add:a((h,l={})=>{let{name:m,override:p,aliases:y}=l,g={step:"initialize",priority:"normal",middleware:h,...l},S=ie(m,y);if(S.length>0){if(S.some(b=>n.has(b))){if(!p)throw new Error(`Duplicate middleware name '${Z(m,y)}'`);for(let b of S){let C=t.findIndex(P=>P.name===b||P.aliases?.some(le=>le===b));if(C===-1)continue;let I=t[C];if(I.step!==g.step||g.priority!==I.priority)throw new Error(`"${Z(I.name,I.aliases)}" middleware with ${I.priority} priority in ${I.step} step cannot be overridden by "${Z(m,y)}" middleware with ${g.priority} priority in ${g.step} step.`);t.splice(C,1)}}for(let b of S)n.add(b)}t.push(g)},"add"),addRelativeTo:a((h,l)=>{let{name:m,override:p,aliases:y}=l,g={middleware:h,...l},S=ie(m,y);if(S.length>0){if(S.some(b=>n.has(b))){if(!p)throw new Error(`Duplicate middleware name '${Z(m,y)}'`);for(let b of S){let C=e.findIndex(P=>P.name===b||P.aliases?.some(le=>le===b));if(C===-1)continue;let I=e[C];if(I.toMiddleware!==g.toMiddleware||I.relation!==g.relation)throw new Error(`"${Z(I.name,I.aliases)}" middleware ${I.relation} "${I.toMiddleware}" middleware cannot be overridden by "${Z(m,y)}" middleware ${g.relation} "${g.toMiddleware}" middleware.`);e.splice(C,1)}}for(let b of S)n.add(b)}e.push(g)},"addRelativeTo"),clone:a(()=>c(Fe()),"clone"),use:a(h=>{h.applyToStack(d)},"use"),remove:a(h=>typeof h=="string"?i(h):o(h),"remove"),removeByTag:a(h=>{let l=!1,m=a(p=>{let{tags:y,name:g,aliases:S}=p;if(y&&y.includes(h)){let b=ie(g,S);for(let C of b)n.delete(C);return l=!0,!1}return!0},"filterCb");return t=t.filter(m),e=e.filter(m),l},"removeByTag"),concat:a(h=>{let l=c(Fe());return l.use(h),l.identifyOnResolve(r||l.identifyOnResolve()||(h.identifyOnResolve?.()??!1)),l},"concat"),applyToStack:c,identify:a(()=>u(!0).map(h=>{let l=h.step??h.relation+" "+h.toMiddleware;return Z(h.name,h.aliases)+" - "+l}),"identify"),identifyOnResolve(h){return typeof h=="boolean"&&(r=h),r},resolve:a((h,l)=>{for(let m of u().map(p=>p.middleware).reverse())h=m(h,l);return r&&console.log(d.identify()),h},"resolve")};return d},"constructStack"),ss={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},is={high:3,normal:2,low:1},aa=a(t=>()=>{throw new Error(t)},"invalidFunction"),ca=a(t=>()=>Promise.reject(t),"invalidProvider"),St=a(()=>{let t=new WeakSet;return(e,r)=>{if(typeof r=="object"&&r!==null){if(t.has(r))return"[Circular]";t.add(r)}return r}},"getCircularReplacer"),fa=a(t=>new Promise(e=>setTimeout(e,t*1e3)),"sleep"),cs={minDelay:2,maxDelay:120},H;(function(t){t.ABORTED="ABORTED",t.FAILURE="FAILURE",t.SUCCESS="SUCCESS",t.RETRY="RETRY",t.TIMEOUT="TIMEOUT"})(H||(H={}));var ua=a(t=>{if(t.state===H.ABORTED){let e=new Error(`${JSON.stringify({...t,reason:"Request was aborted"},St())}`);throw e.name="AbortError",e}else if(t.state===H.TIMEOUT){let e=new Error(`${JSON.stringify({...t,reason:"Waiter has timed out"},St())}`);throw e.name="TimeoutError",e}else if(t.state!==H.SUCCESS)throw new Error(`${JSON.stringify(t,St())}`);return t},"checkExceptions"),ha=a(async({minDelay:t,maxDelay:e,maxWaitTime:r,abortController:n,client:s,abortSignal:i},o,c)=>{let f={},[u,d]=[t*1e3,e*1e3],h=0,l=Date.now()+r*1e3,m=Date.now()+6e4,p=!1;for(;;){if(h>0){let S=ma(u,d,h,l);if(n?.signal?.aborted||i?.aborted){let b="AbortController signal aborted.";return f[b]|=0,f[b]+=1,{state:H.ABORTED,observedResponses:f}}if(Date.now()+S>l)return{state:H.TIMEOUT,observedResponses:f};await fa(S/1e3)}let{state:y,reason:g}=await c(s,o);if(g){let S=da(g);f[S]|=0,f[S]+=1}if(y!==H.RETRY)return{state:y,reason:g,final:g,observedResponses:f};h+=1,!p&&Date.now()>=m&&(la(f,s),p=!0)}},"runPolling"),la=a((t={},e)=>{let r=Object.keys(t),n=0;for(let o of r){let c=t[o]|0;o.startsWith("403:")&&(n+=c)}let s=e?.config?.logger,i=typeof s?.warn=="function"&&!s.constructor?.name?.includes?.("NoOpLogger")?s:console;(n>=3||r[r.length-1]?.startsWith("403:"))&&i.warn("@smithy/util-waiter WARN - 403 status code encountered during waiter polling.")},"checkWarn403"),da=a(t=>{let e=t?.$response?.statusCode??t?.$metadata?.httpStatusCode;return t?.$responseBodyText?`${e?e+": ":""}Deserialization error for body: ${t.$responseBodyText}`:e?t?.$response||t?.message?`${e??"Unknown"}: ${t?.message}`:`${e}: OK`:String(t?.message??JSON.stringify(t,St())??"Unknown")},"createMessageFromResponse"),ma=a((t,e,r,n)=>{let s=Math.log(e/t)/Math.log(2)+1;if(r>s)return e;let i=t*2**(r-1),o=Math.min(i,e),c=pa(t,o);if(Date.now()+c>n){let f=n-Date.now();return Math.max(0,f-500)}return c},"exponentialBackoffWithJitter"),pa=a((t,e)=>t+Math.random()*(e-t),"randomInRange"),ga=a(t=>{if(t.maxWaitTime<=0)throw new Error("WaiterConfiguration.maxWaitTime must be greater than 0");if(t.minDelay<=0)throw new Error("WaiterConfiguration.minDelay must be greater than 0");if(t.maxDelay<=0)throw new Error("WaiterConfiguration.maxDelay must be greater than 0");if(t.maxWaitTime<=t.minDelay)throw new Error(`WaiterConfiguration.maxWaitTime [${t.maxWaitTime}] must be greater than WaiterConfiguration.minDelay [${t.minDelay}] for this waiter`);if(t.maxDelay<t.minDelay)throw new Error(`WaiterConfiguration.maxDelay [${t.maxDelay}] must be greater than WaiterConfiguration.minDelay [${t.minDelay}] for this waiter`)},"validateWaiterOptions"),os=a(t=>{let e,r=new Promise(n=>{e=a(()=>n({state:H.ABORTED}),"onAbort"),typeof t.addEventListener=="function"?t.addEventListener("abort",e):t.onabort=e});return{clearListener(){typeof t.removeEventListener=="function"&&t.removeEventListener("abort",e)},aborted:r}},"abortTimeout"),ya=a(async(t,e,r)=>{let n={...cs,...t};ga(n);let s=[ha(n,e,r)],i=[];if(t.abortSignal){let{aborted:o,clearListener:c}=os(t.abortSignal);i.push(c),s.push(o)}if(t.abortController?.signal){let{aborted:o,clearListener:c}=os(t.abortController.signal);i.push(c),s.push(o)}return Promise.race(s).then(o=>{for(let c of i)c();return o})},"createWaiter"),Er=class{static{a(this,"Client")}config;middlewareStack=Fe();initConfig;handlers;constructor(e){this.config=e;let{protocol:r,protocolSettings:n}=e;n&&typeof r=="function"&&(e.protocol=new r(n))}send(e,r,n){let s=typeof r!="function"?r:void 0,i=typeof r=="function"?r:n,o=s===void 0&&this.config.cacheMiddleware===!0,c;if(o){this.handlers||(this.handlers=new WeakMap);let f=this.handlers;f.has(e.constructor)?c=f.get(e.constructor):(c=e.resolveMiddleware(this.middlewareStack,this.config,s),f.set(e.constructor,c))}else delete this.handlers,c=e.resolveMiddleware(this.middlewareStack,this.config,s);if(i)c(e).then(f=>i(null,f.output),f=>i(f)).catch(()=>{});else return c(e).then(f=>f.output)}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}},br="***SensitiveInformation***";function wt(t,e){if(e==null)return e;let r=oa.of(t);if(r.getMergedTraits().sensitive)return br;if(r.isListSchema()){if(!!r.getValueSchema().getMergedTraits().sensitive)return br}else if(r.isMapSchema()){if(!!r.getKeySchema().getMergedTraits().sensitive||!!r.getValueSchema().getMergedTraits().sensitive)return br}else if(r.isStructSchema()&&typeof e=="object"){let n=e,s={};for(let[i,o]of r.structIterator())n[i]!=null&&(s[i]=wt(o,n[i]));return s}return e}a(wt,"schemaLogFilter");var ze=class{static{a(this,"Command")}middlewareStack=Fe();schema;static classBuilder(){return new Tr}resolveMiddlewareWithContext(e,r,n,{middlewareFn:s,clientName:i,commandName:o,inputFilterSensitiveLog:c,outputFilterSensitiveLog:f,smithyContext:u,additionalContext:d,CommandCtor:h}){for(let b of s.bind(this)(h,e,r,n))this.middlewareStack.use(b);let l=e.concat(this.middlewareStack),{logger:m}=r,p=d[ns],y={logger:m,clientName:i,commandName:o,inputFilterSensitiveLog:c,outputFilterSensitiveLog:f,...d,[ns]:{...p,commandInstance:this,...u,...n?.metricsRecorder===void 0?{}:{metricsRecorder:n.metricsRecorder}}},{requestHandler:g}=r,S=n??{};return S.metricsRecorder&&(S={...S},delete S.metricsRecorder),u.eventStream&&(S={isEventStream:!0,...S}),l.resolve(b=>g.handle(b.request,S),y)}},Tr=class{static{a(this,"ClassBuilder")}_init=a(()=>{},"_init");_ep={};_middlewareFn=a(()=>[],"_middlewareFn");_commandName="";_clientName="";_additionalContext={};_smithyContext={};_inputFilterSensitiveLog=void 0;_outputFilterSensitiveLog=void 0;_serializer=null;_deserializer=null;_operationSchema;init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,r,n={}){return this._smithyContext={service:e,operation:r,...n},this}c(e={}){return this._additionalContext=e,this}n(e,r){return this._clientName=e,this._commandName=r,this}f(e=n=>n,r=n=>n){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=r,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}sc(e){return this._operationSchema=e,this._smithyContext.operationSchema=e,this}build(){let e=this,r;return r=class extends ze{static{a(this,"CommandRef")}input;static getEndpointParameterInstructions(){return e._ep}constructor(...[n]){super(),this.input=n??{},e._init(this),this.schema=e._operationSchema}resolveMiddleware(n,s,i){let o=e._operationSchema,c=o?.[4]??o?.input,f=o?.[5]??o?.output;return this.resolveMiddlewareWithContext(n,s,i,{CommandCtor:r,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog??(o?wt.bind(null,c):u=>u),outputFilterSensitiveLog:e._outputFilterSensitiveLog??(o?wt.bind(null,f):u=>u),smithyContext:e._smithyContext,additionalContext:e._additionalContext})}serialize=e._serializer;deserialize=e._deserializer}}},Sa="***SensitiveInformation***",wa=a((t,e,r)=>{for(let[i,o]of Object.entries(t)){let c=a(async function(u,d,h){let l=new o(u);if(typeof d=="function")this.send(l,d);else if(typeof h=="function"){if(typeof d!="object")throw new Error(`Expected http options but got ${typeof d}`);this.send(l,d||{},h)}else return this.send(l,d)},"methodImpl"),f=(i[0].toLowerCase()+i.slice(1)).replace(/Command$/,"");e.prototype[f]=c}let{paginators:n={},waiters:s={}}=r??{};for(let[i,o]of Object.entries(n))e.prototype[i]===void 0&&(e.prototype[i]=function(c={},f,...u){return o({...f,client:this},c,...u)});for(let[i,o]of Object.entries(s))e.prototype[i]===void 0&&(e.prototype[i]=async function(c={},f,...u){let d=f;return typeof f=="number"&&(d={maxWaitTime:f}),o({...d,client:this},c,...u)})},"createAggregatedClient"),xr=class t extends Error{static{a(this,"ServiceException")}static shapeId="smithy.ts.sdk.synthetic.nonamespace.client#ServiceException";$fault;$response;$retryable;$metadata;constructor(e){super(e.message),Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}static isInstance(e){if(!e)return!1;let r=e;return t.prototype.isPrototypeOf(r)||!!r.$fault&&!!r.$metadata&&(r.$fault==="client"||r.$fault==="server")}static[Symbol.hasInstance](e){if(!e)return!1;let r=e;if(this===t)return t.isInstance(e);if(t.isInstance(e)){if(this.prototype.isPrototypeOf(e))return!0;let n=Object.prototype.hasOwnProperty.call(this,"shapeId")?this.shapeId:void 0,s=!1;if(n){let o=Object.getPrototypeOf(r);for(;o&&o!==Object.prototype;){let c=o.constructor,f=c!==t&&Object.prototype.hasOwnProperty.call(c,"shapeId")?c?.shapeId:void 0;if(f&&(s=!0,f===n))return!0;o=Object.getPrototypeOf(o)}}if(n&&s)return!1;let i=this.name;if(i&&i.length>=6){if(r.name===i)return!0;let o=Object.getPrototypeOf(r);for(;o&&o!==Object.prototype;){let c=o.constructor?.name;if(c&&c!=="Error"&&c===i)return!0;o=Object.getPrototypeOf(o)}}}return!1}},fs=a((t,e={})=>{Object.entries(e).filter(([,n])=>n!==void 0).forEach(([n,s])=>{(t[n]==null||t[n]==="")&&(t[n]=s)});let r=t.message||t.Message||"UnknownError";return t.message=r,delete t.Message,t},"decorateServiceException"),us=a(({output:t,parsedBody:e,exceptionCtor:r,errorCode:n})=>{let s=Ea(t),i=s.httpStatusCode?s.httpStatusCode+"":void 0,o=new r({name:e?.code||e?.Code||n||i||"UnknownError",$fault:"client",$metadata:s});throw fs(o,e)},"throwDefaultError"),ba=a(t=>({output:e,parsedBody:r,errorCode:n})=>{us({output:e,parsedBody:r,exceptionCtor:t,errorCode:n})},"withBaseException"),Ea=a(t=>({httpStatusCode:t.statusCode,requestId:t.headers["x-amzn-requestid"]??t.headers["x-amzn-request-id"]??t.headers["x-amz-request-id"],extendedRequestId:t.headers["x-amz-id-2"],cfId:t.headers["x-amz-cf-id"]}),"deserializeMetadata"),Ta=a(t=>{switch(t){case"standard":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}},"loadConfigsForDefaultMode"),as=!1,xa=a(t=>{t&&!as&&parseInt(t.substring(1,t.indexOf(".")))<16&&(as=!0)},"emitWarningIfUnsupportedVersion"),hs=Object.values(Be),ls=a(t=>{let e=[];for(let r in Be){if(!je(Be,r))continue;let n=Be[r];t[n]!==void 0&&e.push({algorithmId:a(()=>n,"algorithmId"),checksumConstructor:a(()=>t[n],"checksumConstructor")})}for(let[r,n]of Object.entries(t.checksumAlgorithms??{}))e.push({algorithmId:a(()=>r,"algorithmId"),checksumConstructor:a(()=>n,"checksumConstructor")});return{addChecksumAlgorithm(r){t.checksumAlgorithms=t.checksumAlgorithms??{};let n=r.algorithmId(),s=r.checksumConstructor();hs.includes(n)?t.checksumAlgorithms[n.toUpperCase()]=s:t.checksumAlgorithms[n]=s,e.push(r)},checksumAlgorithms(){return e}}},"getChecksumConfiguration"),ds=a(t=>{let e={};return t.checksumAlgorithms().forEach(r=>{let n=r.algorithmId();hs.includes(n)&&(e[n]=r.checksumConstructor())}),e},"resolveChecksumRuntimeConfig"),ms=a(t=>({setRetryStrategy(e){t.retryStrategy=e},retryStrategy(){return t.retryStrategy}}),"getRetryConfiguration"),ps=a(t=>{let e={};return e.retryStrategy=t.retryStrategy(),e},"resolveRetryRuntimeConfig"),gs=a(t=>Object.assign(ls(t),ms(t)),"getDefaultExtensionConfiguration"),Ca=gs,Ia=a(t=>Object.assign(ds(t),ps(t)),"resolveDefaultRuntimeConfig"),Na=a(t=>Array.isArray(t)?t:[t],"getArrayIfSingleItem"),ys=a(t=>{let e="#text";for(let r in t)je(t,r)&&(t[r][e]!==void 0?t[r]=t[r][e]:typeof t[r]=="object"&&t[r]!==null&&(t[r]=ys(t[r])));return t},"getValueFromTextNode"),Aa=a(t=>t!=null,"isSerializableHeaderValue"),Cr=class{static{a(this,"NoOpLogger")}trace(){}debug(){}info(){}warn(){}error(){}};function Ss(t,e,r){let n,s,i;if(typeof e>"u"&&typeof r>"u")n={},i=t;else{if(n=t,typeof e=="function")return s=e,i=r,Ra(n,s,i);i=e}for(let o in i)if(je(i,o)){if(!Array.isArray(i[o])){n[o]=i[o];continue}ws(n,null,i,o)}return n}a(Ss,"map");var Oa=a(t=>{let e={};for(let[r,n]of Object.entries(t||{}))e[r]=[,n];return e},"convertMap"),_a=a((t,e)=>{let r={};for(let n in e)je(e,n)&&ws(r,t,e,n);return r},"take"),Ra=a((t,e,r)=>Ss(t,Object.entries(r).reduce((n,[s,i])=>(Array.isArray(i)?n[s]=i:typeof i=="function"?n[s]=[e,i()]:n[s]=[e,i],n),{})),"mapWithFilter"),ws=a((t,e,r,n)=>{if(e!==null){let o=r[n];typeof o=="function"&&(o=[,o]);let[c=Ma,f=$a,u=n]=o;(typeof c=="function"&&c(e[u])||typeof c!="function"&&c)&&(t[n]=f(e[u]));return}let[s,i]=r[n];if(typeof i=="function"){let o,c=s===void 0&&(o=i())!=null,f=typeof s=="function"&&!!s(void 0)||typeof s!="function"&&!!s;c?t[n]=o:f&&(t[n]=i())}else{let o=s===void 0&&i!=null,c=typeof s=="function"&&!!s(i)||typeof s!="function"&&!!s;(o||c)&&(t[n]=i)}},"applyInstruction"),Ma=a(t=>t!=null,"nonNullish"),$a=a(t=>t,"pass"),Ua=a(t=>{if(t!==t)return"NaN";switch(t){case 1/0:return"Infinity";case-1/0:return"-Infinity";default:return t}},"serializeFloat"),Da=a(t=>t.toISOString().replace(".000Z","Z"),"serializeDateTime"),Ir=a(t=>{if(t==null)return{};if(Array.isArray(t))return t.filter(e=>e!=null).map(Ir);if(typeof t=="object"){let e={};for(let r in t)je(t,r)&&t[r]!=null&&(e[r]=Ir(t[r]));return e}return t},"_json");function La(t,e,r,n){return a(function(i,o,c,f,u={}){let d=Object.assign({},t,i);return ze.classBuilder().ep(d).m(function(h,l,m,p){let y=o.call(this,h,l,m,p);return y.unshift(n(m,h.getEndpointParameterInstructions())),y}).s(e,c,u).n(r,c.charAt(0).toUpperCase()+c.slice(1)+"Command").sc(f).build()},"makeCommand")}a(La,"makeBuilder");x.Client=Er;x.Command=ze;x.NoOpLogger=Cr;x.SENSITIVE_STRING=Sa;x.ServiceException=xr;x.WaiterState=H;x._json=Ir;x.checkExceptions=ua;x.constructStack=Fe;x.convertMap=Oa;x.createAggregatedClient=wa;x.createWaiter=ya;x.decorateServiceException=fs;x.emitWarningIfUnsupportedVersion=xa;x.getArrayIfSingleItem=Na;x.getChecksumConfiguration=ls;x.getDefaultClientConfiguration=Ca;x.getDefaultExtensionConfiguration=gs;x.getRetryConfiguration=ms;x.getValueFromTextNode=ys;x.invalidFunction=aa;x.invalidProvider=ca;x.isSerializableHeaderValue=Aa;x.loadConfigsForDefaultMode=Ta;x.makeBuilder=La;x.map=Ss;x.resolveChecksumRuntimeConfig=ds;x.resolveDefaultRuntimeConfig=Ia;x.resolveRetryRuntimeConfig=ps;x.schemaLogFilter=wt;x.serializeDateTime=Da;x.serializeFloat=Ua;x.take=_a;x.throwDefaultError=us;x.waiterServiceDefaults=cs;x.withBaseException=ba});var qs=G(E=>{var{homedir:ka}=v("node:os"),{sep:Pa,join:He}=v("node:path"),{createHash:va}=v("node:crypto"),{readFile:_s}=v("node:fs/promises"),{IniSectionType:bt}=(me(),Re(de)),{normalizeProvider:Et}=bs(),{isValidHostLabel:Ba}=j(),pe=class t extends Error{static{a(this,"ProviderError")}name="ProviderError";tryNextLink;constructor(e,r=!0){let n,s=!0;typeof r=="boolean"?(n=void 0,s=r):r!=null&&typeof r=="object"&&(n=r.logger,s=r.tryNextLink??!0),super(e),this.tryNextLink=s,Object.setPrototypeOf(this,t.prototype),n?.debug?.(`@smithy/property-provider ${s?"->":"(!)"} ${e}`)}static from(e,r=!0){return Object.assign(new this(e.message,r),e)}},Ve=class t extends pe{static{a(this,"CredentialsProviderError")}name="CredentialsProviderError";constructor(e,r=!0){super(e,r),Object.setPrototypeOf(this,t.prototype)}},Or=class t extends pe{static{a(this,"TokenProviderError")}name="TokenProviderError";constructor(e,r=!0){super(e,r),Object.setPrototypeOf(this,t.prototype)}},Rs=a((...t)=>async()=>{if(t.length===0)throw new pe("No providers in chain");let e;for(let r of t)try{return await r()}catch(n){if(e=n,n?.tryNextLink)continue;throw n}throw e},"chain"),Ms=a(t=>()=>Promise.resolve(t),"fromValue"),Mr=a((t,e,r)=>{let n,s,i,o=!1,c=a(async()=>{s||(s=t());try{n=await s,i=!0,o=!1}finally{s=void 0}return n},"coalesceProvider");return e===void 0?async f=>((!i||f?.forceRefresh)&&(n=await c()),n):async f=>((!i||f?.forceRefresh)&&(n=await c()),o?n:r&&!r(n)?(o=!0,n):(e(n)&&await c(),n))},"memoize"),J=a((t,e,r)=>{if(e in t){if(t[e]==="true")return!0;if(t[e]==="false")return!1;throw new Error(`Cannot load ${r} "${e}". Expected "true" or "false", got ${t[e]}.`)}},"booleanSelector"),Fa=a((t,e,r)=>{if(!(e in t))return;let n=parseInt(t[e],10);if(Number.isNaN(n))throw new TypeError(`Cannot load ${r} '${e}'. Expected number, got '${t[e]}'.`);return n},"numberSelector"),z;(function(t){t.ENV="env",t.CONFIG="shared config entry"})(z||(z={}));var Nr={},za=a(()=>process&&process.geteuid?`${process.geteuid()}`:"DEFAULT","getHomeDirCacheKey"),qe=a(()=>{let{HOME:t,USERPROFILE:e,HOMEPATH:r,HOMEDRIVE:n=`C:${Pa}`}=process.env;if(t)return t;if(e)return e;if(r)return`${n}${r}`;let s=za();return Nr[s]||(Nr[s]=ka()),Nr[s]},"getHomeDir"),$s="AWS_PROFILE",Us="default",Ds=a(t=>t.profile||process.env[$s]||Us,"getProfileName"),Ls=a(t=>{let r=va("sha1").update(t).digest("hex");return He(qe(),".aws","sso","cache",`${r}.json`)},"getSSOTokenFilepath"),Tt={},ja=a(async t=>{if(Tt[t])return Tt[t];let e=Ls(t),r=await _s(e,"utf8");return JSON.parse(r)},"getSSOTokenFromFile"),oe=".",Ha=a(t=>Object.entries(t).filter(([e])=>{let r=e.indexOf(oe);return r===-1?!1:Object.values(bt).includes(e.substring(0,r))}).reduce((e,[r,n])=>{let s=r.indexOf(oe),i=r.substring(0,s)===bt.PROFILE?r.substring(s+1):r;return e[i]=n,e},{...t.default&&{default:t.default}}),"getConfigData"),Va="AWS_CONFIG_FILE",ks=a(()=>process.env[Va]||He(qe(),".aws","config"),"getConfigFilepath"),qa="AWS_SHARED_CREDENTIALS_FILE",Wa=a(()=>process.env[qa]||He(qe(),".aws","credentials"),"getCredentialsFilepath"),Ga=/^([\w-]+)\s(["'])?([\w-@+.%:/]+)\2$/,Ja=["__proto__","profile __proto__"],_r=a(t=>{let e={},r,n;for(let s of t.split(/\r?\n/)){let i=s.split(/(^|\s)[;#]/)[0].trim();if(i[0]==="["&&i[i.length-1]==="]"){r=void 0,n=void 0;let c=i.substring(1,i.length-1),f=Ga.exec(c);if(f){let[,u,,d]=f;Object.values(bt).includes(u)&&(r=[u,d].join(oe))}else r=c;if(Ja.includes(c))throw new Error(`Found invalid profile name "${c}"`)}else if(r){let c=i.indexOf("=");if(![0,-1].includes(c)){let[f,u]=[i.substring(0,c).trim(),i.substring(c+1).trim()];if(u==="")n=f;else{n&&s.trimStart()===s&&(n=void 0),e[r]=e[r]||{};let d=n?[n,f].join(oe):f;e[r][d]=u}}}}return e},"parseIni"),Ar={},xt={},Ct=a((t,e)=>xt[t]!==void 0?xt[t]:((!Ar[t]||e?.ignoreCache)&&(Ar[t]=_s(t,"utf8")),Ar[t]),"readFile"),Es=a(()=>({}),"swallowError$1"),$r=a(async(t={})=>{let{filepath:e=Wa(),configFilepath:r=ks()}=t,n=qe(),s="~/",i=e;e.startsWith(s)&&(i=He(n,e.slice(2)));let o=r;r.startsWith(s)&&(o=He(n,r.slice(2)));let c=await Promise.all([Ct(o,{ignoreCache:t.ignoreCache}).then(_r).then(Ha).catch(Es),Ct(i,{ignoreCache:t.ignoreCache}).then(_r).catch(Es)]);return{configFile:c[0],credentialsFile:c[1]}},"loadSharedConfigFiles"),Ka=a(t=>Object.entries(t).filter(([e])=>e.startsWith(bt.SSO_SESSION+oe)).reduce((e,[r,n])=>({...e,[r.substring(r.indexOf(oe)+1)]:n}),{}),"getSsoSessionData"),Qa=a(()=>({}),"swallowError"),Za=a(async(t={})=>Ct(t.configFilepath??ks()).then(_r).then(Ka).catch(Qa),"loadSsoSessionData"),Xa=a((...t)=>{let e={};for(let r of t)for(let[n,s]of Object.entries(r))e[n]!==void 0?Object.assign(e[n],s):e[n]=s;return e},"mergeConfigFiles"),Ya=a(async t=>{let e=await $r(t);return Xa(e.configFile,e.credentialsFile)},"parseKnownFiles"),ec={getFileRecord(){return xt},interceptFile(t,e){xt[t]=Promise.resolve(e)},getTokenRecord(){return Tt},interceptToken(t,e){Tt[t]=e}};function Ps(t){try{let e=new Set(Array.from(t.match(/([A-Z_]){3,}/g)??[]));return e.delete("CONFIG"),e.delete("CONFIG_PREFIX_SEPARATOR"),e.delete("ENV"),[...e].join(", ")}catch{return t}}a(Ps,"getSelectorName");var tc=a((t,e)=>async()=>{try{let r=t(process.env,e);if(r===void 0)throw new Error;return r}catch(r){throw new Ve(r.message||`Not found in ENV: ${Ps(t.toString())}`,{logger:e?.logger})}},"fromEnv"),rc=a((t,{preferredFile:e="config",...r}={})=>async()=>{let n=Ds(r),{configFile:s,credentialsFile:i}=await $r(r),o=i[n]||{},c=s[n]||{},f=e==="config"?{...o,...c}:{...c,...o};try{let d=t(f,e==="config"?s:i);if(d===void 0)throw new Error;return d}catch(u){throw new Ve(u.message||`Not found in config files w/ profile [${n}]: ${Ps(t.toString())}`,{logger:r.logger})}},"fromSharedConfigFiles"),nc=a(t=>typeof t=="function","isFunction"),vs=a(t=>nc(t)?async()=>await t():Ms(t),"fromStatic"),Rr=a(({environmentVariableSelector:t,configFileSelector:e,default:r},n={})=>{let{signingName:s,logger:i}=n;return Mr(Rs(tc(t,{signingName:s,logger:i}),rc(e,n),vs(r)))},"loadConfig"),Ur="AWS_USE_DUALSTACK_ENDPOINT",Dr="use_dualstack_endpoint",sc=!1,ic={environmentVariableSelector:a(t=>J(t,Ur,z.ENV),"environmentVariableSelector"),configFileSelector:a(t=>J(t,Dr,z.CONFIG),"configFileSelector"),default:!1},oc={environmentVariableSelector:a(t=>J(t,Ur,z.ENV),"environmentVariableSelector"),configFileSelector:a(t=>J(t,Dr,z.CONFIG),"configFileSelector"),default:void 0},Lr="AWS_USE_FIPS_ENDPOINT",kr="use_fips_endpoint",ac=!1,cc={environmentVariableSelector:a(t=>J(t,Lr,z.ENV),"environmentVariableSelector"),configFileSelector:a(t=>J(t,kr,z.CONFIG),"configFileSelector"),default:!1},fc={environmentVariableSelector:a(t=>J(t,Lr,z.ENV),"environmentVariableSelector"),configFileSelector:a(t=>J(t,kr,z.CONFIG),"configFileSelector"),default:void 0},uc=a(t=>{let{tls:e,endpoint:r,urlParser:n,useDualstackEndpoint:s}=t;return Object.assign(t,{tls:e??!0,endpoint:Et(typeof r=="string"?n(r):r),isCustomEndpoint:!0,useDualstackEndpoint:Et(s??!1)})},"resolveCustomEndpointsConfig"),hc=a(async t=>{let{tls:e=!0}=t,r=await t.region();if(!new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/).test(r))throw new Error("Invalid region in client config");let s=await t.useDualstackEndpoint(),i=await t.useFipsEndpoint(),{hostname:o}=await t.regionInfoProvider(r,{useDualstackEndpoint:s,useFipsEndpoint:i})??{};if(!o)throw new Error("Cannot resolve hostname from client config");return t.urlParser(`${e?"https:":"http:"}//${o}`)},"getEndpointFromRegion"),lc=a(t=>{let e=Et(t.useDualstackEndpoint??!1),{endpoint:r,useFipsEndpoint:n,urlParser:s,tls:i}=t;return Object.assign(t,{tls:i??!0,endpoint:r?Et(typeof r=="string"?s(r):r):()=>hc({...t,useDualstackEndpoint:e,useFipsEndpoint:n}),isCustomEndpoint:!!r,useDualstackEndpoint:e})},"resolveEndpointsConfig"),dc="AWS_EXECUTION_ENV",Ts="AWS_REGION",xs="AWS_DEFAULT_REGION",mc="AWS_EC2_METADATA_DISABLED",pc=["in-region","cross-region","mobile","standard","legacy"],gc="/latest/meta-data/placement/region",yc="/latest/api/token",Sc="x-aws-ec2-metadata-token",wc="x-aws-ec2-metadata-token-ttl-seconds",Cs=1e3,bc=6e4,Bs=0,Fs=a(async()=>{if(!process.env[mc]&&!(Date.now()<Bs))try{let t=Ec(),e=(await Ns({...t,path:yc,method:"PUT",headers:{[wc]:"21600"}})).toString();return(await Ns({...t,path:gc,method:"GET",headers:{[Sc]:e}})).toString().trim()||Is()}catch{return Is()}},"getInstanceMetadataRegion"),Is=a(()=>{Bs=Date.now()+bc},"cacheNegativeAndReturnUndefined"),Ec=a(()=>{let t=process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT;if(t){let e=new URL(t);return{hostname:e.hostname.replace(/^\[(.+)]$/,"$1"),port:e.port?Number(e.port):void 0}}return process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE==="IPv6"?{hostname:"fd00:ec2::254"}:{hostname:"169.254.169.254"}},"resolveImdsEndpoint"),Ns=a(async t=>{let{request:e}=v("node:http");return new Promise((r,n)=>{let s=e({hostname:t.hostname,port:t.port,path:t.path,method:t.method,headers:t.headers,timeout:Cs,signal:AbortSignal.timeout(Cs)});s.on("error",i=>{n(i),s.destroy()}),s.on("timeout",()=>{n(new Error("TimeoutError from instance metadata service")),s.destroy()}),s.on("response",i=>{let{statusCode:o=400}=i;if(o<200||o>=300){n(Object.assign(new Error("Error response received from instance metadata service"),{statusCode:o})),s.destroy();return}let c=[];i.on("data",f=>c.push(f)),i.on("end",()=>{r(Buffer.concat(c)),s.destroy()})}),s.end()})},"imdsRequest"),zs="AWS_REGION",js="region",Hs={environmentVariableSelector:a(t=>t[zs],"environmentVariableSelector"),configFileSelector:a(t=>t[js],"configFileSelector"),default:a(async()=>{let t=await Fs();if(t)return t;throw new Error("Region is missing")},"default")},Tc={preferredFile:"credentials"},As=new Set,xc=a((t,e=Ba)=>{if(!As.has(t)&&!e(t))if(t==="*")console.warn('@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.');else throw new Error(`Region not accepted: region="${t}" is not a valid hostname component.`);else As.add(t)},"checkRegion"),Vs=a(t=>typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips")),"isFipsRegion"),Cc=a(t=>Vs(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t,"getRealRegion"),Ic=a(t=>{let{region:e,useFipsEndpoint:r}=t;if(!e)throw new Error("Region is missing");return Object.assign(t,{region:a(async()=>{let n=typeof e=="function"?await e():e,s=Cc(n);return xc(s),s},"region"),useFipsEndpoint:a(async()=>{let n=typeof e=="string"?e:await e();return Vs(n)?!0:typeof r!="function"?Promise.resolve(!!r):r()},"useFipsEndpoint")})},"resolveRegionConfig"),Os=a((t=[],{useFipsEndpoint:e,useDualstackEndpoint:r})=>t.find(({tags:n})=>e===n.includes("fips")&&r===n.includes("dualstack"))?.hostname,"getHostnameFromVariants"),Nc=a((t,{regionHostname:e,partitionHostname:r})=>e||(r?r.replace("{region}",t):void 0),"getResolvedHostname"),Ac=a((t,{partitionHash:e})=>Object.keys(e||{}).find(r=>e[r].regions.includes(t))??"aws","getResolvedPartition"),Oc=a((t,{signingRegion:e,regionRegex:r,useFipsEndpoint:n})=>{if(e)return e;if(n){let s=r.replace("\\\\","\\").replace(/^\^/g,"\\.").replace(/\$$/g,"\\."),i=t.match(s);if(i)return i[0].slice(1,-1)}},"getResolvedSigningRegion"),_c=a((t,{useFipsEndpoint:e=!1,useDualstackEndpoint:r=!1,signingService:n,regionHash:s,partitionHash:i})=>{let o=Ac(t,{partitionHash:i}),c=t in s?t:i[o]?.endpoint??t,f={useFipsEndpoint:e,useDualstackEndpoint:r},u=Os(s[c]?.variants,f),d=Os(i[o]?.variants,f),h=Nc(c,{regionHostname:u,partitionHostname:d});if(h===void 0)throw new Error(`Endpoint resolution failed for: ${{resolvedRegion:c,useFipsEndpoint:e,useDualstackEndpoint:r}}`);let l=Oc(h,{signingRegion:s[c]?.signingRegion,regionRegex:i[o].regionRegex,useFipsEndpoint:e});return{partition:o,signingService:n,hostname:h,...l&&{signingRegion:l},...s[c]?.signingService&&{signingService:s[c].signingService}}},"getRegionInfo"),Rc="AWS_DEFAULTS_MODE",Mc="defaults_mode",$c={environmentVariableSelector:a(t=>t[Rc],"environmentVariableSelector"),configFileSelector:a(t=>t[Mc],"configFileSelector"),default:"legacy"},Uc=a(({region:t=Rr(Hs),defaultsMode:e=Rr($c)}={})=>Mr(async()=>{let r=typeof e=="function"?await e():e;switch(r?.toLowerCase()){case"auto":return Dc(t);case"in-region":case"cross-region":case"mobile":case"standard":case"legacy":return Promise.resolve(r?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${pc.join(", ")}, got ${r}`)}}),"resolveDefaultsModeConfig"),Dc=a(async t=>{if(t){let e=typeof t=="function"?await t():t,r=await Lc();return r?e===r?"in-region":"cross-region":"standard"}return"standard"},"resolveNodeDefaultsModeAuto"),Lc=a(async()=>process.env[dc]&&(process.env[Ts]||process.env[xs])?process.env[Ts]??process.env[xs]:Fs(),"inferPhysicalRegion");E.CONFIG_PREFIX_SEPARATOR=oe;E.CONFIG_USE_DUALSTACK_ENDPOINT=Dr;E.CONFIG_USE_FIPS_ENDPOINT=kr;E.CredentialsProviderError=Ve;E.DEFAULT_PROFILE=Us;E.DEFAULT_USE_DUALSTACK_ENDPOINT=sc;E.DEFAULT_USE_FIPS_ENDPOINT=ac;E.ENV_PROFILE=$s;E.ENV_USE_DUALSTACK_ENDPOINT=Ur;E.ENV_USE_FIPS_ENDPOINT=Lr;E.NODE_REGION_CONFIG_FILE_OPTIONS=Tc;E.NODE_REGION_CONFIG_OPTIONS=Hs;E.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS=ic;E.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS=cc;E.ProviderError=pe;E.REGION_ENV_NAME=zs;E.REGION_INI_NAME=js;E.SelectorType=z;E.TokenProviderError=Or;E.booleanSelector=J;E.chain=Rs;E.externalDataInterceptor=ec;E.fromStatic=vs;E.fromValue=Ms;E.getHomeDir=qe;E.getProfileName=Ds;E.getRegionInfo=_c;E.getSSOTokenFilepath=Ls;E.getSSOTokenFromFile=ja;E.loadConfig=Rr;E.loadSharedConfigFiles=$r;E.loadSsoSessionData=Za;E.memoize=Mr;E.nodeDualstackConfigSelectors=oc;E.nodeFipsConfigSelectors=fc;E.numberSelector=Fa;E.parseKnownFiles=Ya;E.readFile=Ct;E.resolveCustomEndpointsConfig=uc;E.resolveDefaultsModeConfig=Uc;E.resolveEndpointsConfig=lc;E.resolveRegionConfig=Ic});var gi=G(R=>{var{CONFIG_PREFIX_SEPARATOR:Ws,booleanSelector:Gs,SelectorType:Js,loadConfig:Ks}=qs(),{toEndpointV1:It,getSmithyContext:kc,normalizeProvider:Pr,isValidHostLabel:Xs,hasOwn:Pc}=j();R.isValidHostLabel=Xs;R.middlewareEndpointToEndpointV1=It;R.toEndpointV1=It;var{EndpointURLScheme:Fr}=(me(),Re(de)),Qs="AWS_ENDPOINT_URL",Zs="endpoint_url",vc=a(t=>({environmentVariableSelector:a(e=>{let r=t.split(" ").map(i=>i.toUpperCase()),n=e[[Qs,...r].join("_")];if(n)return n;let s=e[Qs];if(s)return s},"environmentVariableSelector"),configFileSelector:a((e,r)=>{if(e.services){let s=["services",e.services].join(Ws);if(!r||!r[s])throw new Error(`The services section "${e.services}" specified in the profile is not present in the shared configuration file.`);let i=r[s],o=t.split(" ").map(f=>f.toLowerCase()),c=i[[o.join("_"),Zs].join(Ws)];if(c)return c}let n=e[Zs];if(n)return n},"configFileSelector"),default:void 0}),"getEndpointUrlConfig"),Bc="AWS_IGNORE_CONFIGURED_ENDPOINT_URLS",Fc="ignore_configured_endpoint_urls",zc={environmentVariableSelector:a(t=>Gs(t,Bc,Js.ENV),"environmentVariableSelector"),configFileSelector:a(t=>Gs(t,Fc,Js.CONFIG),"configFileSelector"),default:!1},Nt=a(async t=>{if(!await Ks(zc)())return Ks(vc(t??""))()},"getEndpointFromConfig"),jc=a(async t=>{let e=t?.Bucket||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),Gc(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!Wc(e)||e.indexOf(".")!==-1&&!String(t.Endpoint).startsWith("http:")||e.toLowerCase()!==e||e.length<3)&&(t.ForcePathStyle=!0);return t.DisableMultiRegionAccessPoints&&(t.disableMultiRegionAccessPoints=!0,t.DisableMRAP=!0),t},"resolveParamsForS3"),Hc=/^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$/,Vc=/(\d+\.){3}\d+/,qc=/\.\./,Wc=a(t=>Hc.test(t)&&!Vc.test(t)&&!qc.test(t),"isDnsCompatibleBucketName"),Gc=a(t=>{let[e,r,n,,,s]=t.split(":"),i=e==="arn"&&t.split(":").length>=6,o=!!(i&&r&&n&&s);if(i&&!o)throw new Error(`Invalid ARN: ${t} was an invalid ARN.`);return o},"isArnBucketName"),Jc=a((t,e,r,n=!1)=>{let s=a(async()=>{let i;return n?i=r.clientContextParams?.[t]??r[t]??r[e]:i=r[t]??r[e],typeof i=="function"?i():i},"configProvider");return t==="credentialScope"||e==="CredentialScope"?async()=>{let i=typeof r.credentials=="function"?await r.credentials():r.credentials;return i?.credentialScope??i?.CredentialScope}:t==="accountId"||e==="AccountId"?async()=>{let i=typeof r.credentials=="function"?await r.credentials():r.credentials;return i?.accountId??i?.AccountId}:t==="endpoint"||e==="endpoint"?async()=>{if(r.isCustomEndpoint===!1)return;let i=await s();if(i&&typeof i=="object"){if("url"in i)return i.url.href;if("hostname"in i){let{protocol:o,hostname:c,port:f,path:u}=i;return`${o}//${c}${f?":"+f:""}${u}`}}return i}:s},"createConfigValueProvider");function Ys(t){return async(e,r,n,s)=>{if(!n.isCustomEndpoint&&!n.ignoreConfiguredEndpointUrls){let c;n.serviceConfiguredEndpoint?c=await n.serviceConfiguredEndpoint():c=await t(n.serviceId),c&&(n.endpoint=()=>Promise.resolve(It(c)),n.isCustomEndpoint=!0,s?.logger?.debug?.(`@smithy/core/endpoints - resolved endpoint from config: ${c}`))}let i=await ei(e,r,n);if(typeof n.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");let o=n.endpointProvider(i,s);if(n.isCustomEndpoint&&n.endpoint){let c=await n.endpoint();if(c?.headers){o.headers??={};for(let[f,u]of Object.entries(c.headers))o.headers[f]=Array.isArray(u)?u:[u]}}return o}}a(Ys,"bindGetEndpointFromInstructions");var ei=a(async(t,e,r)=>{let n={},s=e?.getEndpointParameterInstructions?.()||{};for(let[i,o]of Object.entries(s))switch(o.type){case"staticContextParams":n[i]=o.value;break;case"contextParams":n[i]=t[o.name];break;case"clientContextParams":case"builtInParams":n[i]=await Jc(o.name,i,r,o.type!=="builtInParams")();break;case"operationContextParams":n[i]=o.get(t);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(o))}return Object.keys(s).length===0&&Object.assign(n,r),String(r.serviceId).toLowerCase()==="s3"&&await jc(n),n},"resolveParams");function Kc(t,e,r){t.__smithy_context?t.__smithy_context.features||(t.__smithy_context.features={}):t.__smithy_context={features:{}},t.__smithy_context.features[e]=r}a(Kc,"setFeature");function ti(t){let e=Ys(t);return({config:r,instructions:n})=>(s,i)=>async o=>{r.isCustomEndpoint&&Kc(i,"ENDPOINT_OVERRIDE","N");let c=await e(o.input,{getEndpointParameterInstructions(){return n}},{...r},i);i.endpointV2=c,i.authSchemes=c.properties?.authSchemes;let f=i.authSchemes?.[0];if(f){i.signing_region=f.signingRegion,i.signing_service=f.signingName;let d=kc(i)?.selectedHttpAuthScheme?.httpAuthOption;d&&(d.signingProperties=Object.assign(d.signingProperties||{},{signing_region:f.signingRegion,signingRegion:f.signingRegion,signing_service:f.signingName,signingName:f.signingName,signingRegionSet:f.signingRegionSet},f.properties))}return s({...o})}}a(ti,"bindEndpointMiddleware");var Qc={name:"serializerMiddleware"},ri={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:Qc.name};function Zc(t){let e=ti(t);return(r,n)=>({applyToStack:a(s=>{s.addRelativeTo(e({config:r,instructions:n}),ri)},"applyToStack")})}a(Zc,"bindGetEndpointPlugin");function Xc(t){return e=>{let r=e.tls??!0,{endpoint:n,useDualstackEndpoint:s,useFipsEndpoint:i}=e,o=n!=null?async()=>It(await Pr(n)()):void 0,f=Object.assign(e,{endpoint:o,tls:r,isCustomEndpoint:!!n,useDualstackEndpoint:Pr(s??!1),useFipsEndpoint:Pr(i??!1),ignoreConfiguredEndpointUrls:!!e.ignoreConfiguredEndpointUrls}),u;return f.serviceConfiguredEndpoint=async()=>(e.serviceId&&!u&&(u=t(e.serviceId)),u),f}}a(Xc,"bindResolveEndpointConfig");var zr=class t{static{a(this,"BinaryDecisionDiagram")}nodes;root;conditions;results;constructor(e,r,n,s){this.nodes=e,this.root=r,this.conditions=n,this.results=s}static from(e,r,n,s){return new t(e,r,n,s)}},jr=class{static{a(this,"EndpointCache")}capacity;data=new Map;parameters=[];constructor({size:e,params:r}){this.capacity=e??50,r&&(this.parameters=r)}get(e,r){let n=this.hash(e);if(n===!1)return r();if(!this.data.has(n)){if(this.data.size>this.capacity+10){let s=this.data.keys(),i=0;for(;;){let{value:o,done:c}=s.next();if(this.data.delete(o),c||++i>10)break}}this.data.set(n,r())}return this.data.get(n)}size(){return this.data.size}hash(e){let r="",{parameters:n}=this;if(n.length===0)return!1;for(let s of n){let i=e[s],o=i==null?"\0":String(i);if(o.includes("|;"))return!1;r+=o+"|;"}return r}},_=class extends Error{static{a(this,"EndpointError")}constructor(e){super(e),this.name="EndpointError"}},We="endpoints";function X(t){return typeof t!="object"||t==null?t:"ref"in t?`$${X(t.ref)}`:"fn"in t?`${t.fn}(${(t.argv||[]).map(X).join(", ")})`:JSON.stringify(t,null,2)}a(X,"toDebugString");var ni={},Yc=a((t,e)=>t===e,"booleanEquals");function ef(...t){for(let e of t)if(e!=null)return e}a(ef,"coalesce");var tf=a(t=>{let e=t.split("."),r=[];for(let n of e){let s=n.indexOf("[");if(s!==-1){if(n.indexOf("]")!==n.length-1)throw new _(`Path: '${t}' does not end with ']'`);let i=n.slice(s+1,-1);if(Number.isNaN(parseInt(i)))throw new _(`Invalid array index: '${i}' in path: '${t}'`);s!==0&&r.push(n.slice(0,s)),r.push(i)}else r.push(n)}return r},"getAttrPathList"),si=a((t,e)=>tf(e).reduce((r,n)=>{if(typeof r!="object")throw new _(`Index '${n}' in '${e}' not found in '${JSON.stringify(t)}'`);if(Array.isArray(r)){let s=parseInt(n);return r[s<0?r.length+s:s]}return r[n]},t),"getAttr"),rf=a(t=>t!=null,"isSet");function nf(t,e,r){return t?e:r}a(nf,"ite");var sf=a(t=>!t,"not"),of=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),ii=a(t=>of.test(t)||t.startsWith("[")&&t.endsWith("]"),"isIpAddress"),vr={[Fr.HTTP]:80,[Fr.HTTPS]:443},af=a(t=>{let e=(()=>{try{if(t instanceof URL)return t;if(typeof t=="object"&&"hostname"in t){let{hostname:l,port:m,protocol:p="",path:y="",query:g={}}=t,S=new URL(`${p}//${l}${m?`:${m}`:""}${y}`);return S.search=Object.entries(g).map(([b,C])=>`${b}=${C}`).join("&"),S}return new URL(t)}catch{return null}})();if(!e)return console.error(`Unable to parse ${JSON.stringify(t)} as a whatwg URL.`),null;let r=e.href,{host:n,hostname:s,pathname:i,protocol:o,search:c}=e;if(c)return null;let f=o.slice(0,-1);if(!Object.values(Fr).includes(f))return null;let u=ii(s),d=r.includes(`${n}:${vr[f]}`)||typeof t=="string"&&t.includes(`${n}:${vr[f]}`),h=`${n}${d?`:${vr[f]}`:""}`;return{scheme:f,authority:h,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:u}},"parseURL");function cf(t,e,r){if(r===1)return[t];if(t==="")return[""];let n=t.split(e);return r===0?n:n.slice(0,r-1).concat(n.slice(1).join(e))}a(cf,"split");var ff=a((t,e)=>t===e,"stringEquals"),uf=a((t,e,r,n)=>t==null||e>=r||t.length<r||/[^\u0000-\u007f]/.test(t)?null:n?t.substring(t.length-r,t.length-e):t.substring(e,r),"substring"),hf=a(t=>encodeURIComponent(t).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),"uriEncode"),lf={booleanEquals:Yc,coalesce:ef,getAttr:si,isSet:rf,isValidHostLabel:Xs,ite:nf,not:sf,parseURL:af,split:cf,stringEquals:ff,substring:uf,uriEncode:hf},oi=a((t,e)=>{let r=[],{referenceRecord:n,endpointParams:s}=e,i=0;for(;i<t.length;){let o=t.indexOf("{",i);if(o===-1){r.push(t.slice(i));break}r.push(t.slice(i,o));let c=t.indexOf("}",o);if(c===-1){r.push(t.slice(o));break}t[o+1]==="{"&&t[c+1]==="}"&&(r.push(t.slice(o+1,c)),i=c+2);let f=t.substring(o+1,c);if(f.includes("#")){let[u,d]=f.split("#");r.push(si(n[u]??s[u],d))}else r.push(n[f]??s[f]);i=c+1}return r.join("")},"evaluateTemplate"),df=a(({ref:t},e)=>e.referenceRecord[t]??e.endpointParams[t],"getReferenceValue"),Ge=a((t,e,r)=>{if(typeof t=="string")return oi(t,r);if(t.fn)return ci.callFunction(t,r);if(t.ref)return df(t,r);throw new _(`'${e}': ${String(t)} is not a string, function or reference.`)},"evaluateExpression"),ai=a(({fn:t,argv:e},r)=>{let n=Array(e.length);for(let o=0;o<n.length;++o){let c=e[o];typeof c=="boolean"||typeof c=="number"?n[o]=c:n[o]=ci.evaluateExpression(c,"arg",r)}let s=t.indexOf(".");if(s!==-1){let c=ni[t.slice(0,s)]?.[t.slice(s+1)];if(typeof c=="function")return c(...n)}let i=lf[t];if(typeof i=="function")return i(...n);throw new Error(`function ${t} not loaded in endpointFunctions.`)},"callFunction"),ci={evaluateExpression:Ge,callFunction:ai},fi=a((t,e)=>{let{assign:r}=t;if(r&&r in e.referenceRecord)throw new _(`'${r}' is already defined in Reference Record.`);let n=ai(t,e);e.logger?.debug?.(`${We} evaluateCondition: ${X(t)} = ${X(n)}`);let s=n===""?!0:!!n;return r!=null?{result:s,toAssign:{name:r,value:n}}:{result:s}},"evaluateCondition"),ui=a((t,e)=>Object.entries(t??{}).reduce((r,[n,s])=>(r[n]=s.map(i=>{let o=Ge(i,"Header value entry",e);if(typeof o!="string")throw new _(`Header '${n}' value '${o}' is not a string`);return o}),r),{}),"getEndpointHeaders"),Hr=a((t,e)=>Object.entries(t).reduce((r,[n,s])=>(r[n]=li.getEndpointProperty(s,e),r),{}),"getEndpointProperties"),hi=a((t,e)=>{if(Array.isArray(t))return t.map(r=>hi(r,e));switch(typeof t){case"string":return oi(t,e);case"object":if(t===null)throw new _(`Unexpected endpoint property: ${t}`);return li.getEndpointProperties(t,e);case"boolean":return t;default:throw new _(`Unexpected endpoint property type: ${typeof t}`)}},"getEndpointProperty"),li={getEndpointProperty:hi,getEndpointProperties:Hr},di=a((t,e)=>{let r=Ge(t,"Endpoint URL",e);if(typeof r=="string")try{return new URL(r)}catch(n){throw console.error(`Failed to construct URL with ${r}`,n),n}throw new _(`Endpoint URL must be a string, got ${typeof r}`)},"getEndpointUrl"),Br=1e8,mf=a((t,e)=>{let{nodes:r,root:n,results:s,conditions:i}=t,o=n,c={},f={referenceRecord:c,endpointParams:e.endpointParams,logger:e.logger};for(;o!==1&&o!==-1&&o<Br;){let u=3*(Math.abs(o)-1),[d,h,l]=[r[u],r[u+1],r[u+2]],[m,p,y]=i[d],g=fi({fn:m,assign:y,argv:p},f);if(g.toAssign){let{name:S,value:b}=g.toAssign;c[S]=b}o=o>=0===g.result?h:l}if(o>=Br){let u=s[o-Br];if(u[0]===-1){let[,m]=u;throw new _(Ge(m,"Error",f))}let[d,h,l]=u;return{url:di(d,f),properties:Hr(h,f),headers:ui(l??{},f)}}throw new _("No matching endpoint.")},"decideEndpoint"),Vr=a((t=[],e)=>{let r={},n={...e,referenceRecord:{...e.referenceRecord}},s=!1;for(let i of t){let{result:o,toAssign:c}=fi(i,n);if(!o)return{result:o};c&&(s=!0,r[c.name]=c.value,n.referenceRecord[c.name]=c.value,e.logger?.debug?.(`${We} assign: ${c.name} := ${X(c.value)}`))}return s?{result:!0,referenceRecord:r}:{result:!0}},"evaluateConditions"),pf=a((t,e)=>{let{conditions:r,endpoint:n}=t,{result:s,referenceRecord:i}=Vr(r,e);if(!s)return;let o=i?{...e,referenceRecord:{...e.referenceRecord,...i}}:e,{url:c,properties:f,headers:u}=n;e.logger?.debug?.(`${We} Resolving endpoint from template: ${X(n)}`);let d={url:di(c,o)};return u!=null&&(d.headers=ui(u,o)),f!=null&&(d.properties=Hr(f,o)),d},"evaluateEndpointRule"),gf=a((t,e)=>{let{conditions:r,error:n}=t,{result:s,referenceRecord:i}=Vr(r,e);if(!s)return;let o=i?{...e,referenceRecord:{...e.referenceRecord,...i}}:e;throw new _(Ge(n,"Error",o))},"evaluateErrorRule"),mi=a((t,e)=>{for(let r of t)if(r.type==="endpoint"){let n=pf(r,e);if(n)return n}else if(r.type==="error")gf(r,e);else if(r.type==="tree"){let n=pi.evaluateTreeRule(r,e);if(n)return n}else throw new _(`Unknown endpoint rule: ${r}`);throw new _("Rules evaluation failed")},"evaluateRules"),yf=a((t,e)=>{let{conditions:r,rules:n}=t,{result:s,referenceRecord:i}=Vr(r,e);if(!s)return;let o=i?{...e,referenceRecord:{...e.referenceRecord,...i}}:e;return pi.evaluateRules(n,o)},"evaluateTreeRule"),pi={evaluateRules:mi,evaluateTreeRule:yf},Sf=a((t,e)=>{let{endpointParams:r,logger:n}=e,{parameters:s,rules:i}=t;e.logger?.debug?.(`${We} Initial EndpointParams: ${X(r)}`);for(let c in s){if(!Pc(s,c))continue;let f=s[c],u=r[c];if(u==null&&f.default!=null){r[c]=f.default;continue}if(f.required&&u==null)throw new _(`Missing required parameter: '${c}'`)}let o=mi(i,{endpointParams:r,logger:n,referenceRecord:{}});return e.logger?.debug?.(`${We} Resolved endpoint: ${X(o)}`),o},"resolveEndpoint"),wf=a(t=>{let{endpoint:e}=t;return e===void 0&&(t.endpoint=async()=>{throw new Error("@smithy/middleware-endpoint: (default endpointRuleSet) endpoint is not set - you must configure an endpoint.")}),t},"resolveEndpointRequiredConfig"),bf=Ys(Nt),Ef=Xc(Nt),Tf=ti(Nt),xf=Zc(Nt);R.BinaryDecisionDiagram=zr;R.EndpointCache=jr;R.EndpointError=_;R.customEndpointFunctions=ni;R.decideEndpoint=mf;R.endpointMiddleware=Tf;R.endpointMiddlewareOptions=ri;R.getEndpointFromInstructions=bf;R.getEndpointPlugin=xf;R.isIpAddress=ii;R.resolveEndpoint=Sf;R.resolveEndpointConfig=Ef;R.resolveEndpointRequiredConfig=wf;R.resolveParams=ei});var Lt=G(w=>{var{createHmac:Cf,createHash:If,getRandomValues:Nf}=v("node:crypto"),{hasOwn:Ci,HttpResponse:Af}=j();w.hasOwn=Ci;var{ReadStream:Of,lstatSync:_f,fstatSync:Rf}=v("node:fs"),{toEndpointV1:Mf}=gi(),{Readable:ge,Writable:Ii,PassThrough:yi}=v("node:stream"),Ni=a(t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]","isArrayBuffer"),Se=a((t,e=0,r=t.byteLength-e)=>{if(!Ni(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return Buffer.from(t,e,r)},"fromArrayBuffer"),Mt=a((t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?Buffer.from(t,e):Buffer.from(t)},"fromString"),$f=/^[A-Za-z0-9+/]*={0,2}$/,Ai=a(t=>{if(t.length*3%4!==0)throw new TypeError("Incorrect padding on base64 string.");if(!$f.exec(t))throw new TypeError("Invalid base64 string.");let e=Mt(t,"base64");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)},"fromBase64"),$t=a(t=>{let e=Mt(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},"fromUtf8$1"),rn=a(t=>{let e;if(typeof t=="string"?e=$t(t):e=t,typeof e!="object"||typeof e.byteOffset!="number"||typeof e.byteLength!="number")throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");return Se(e.buffer,e.byteOffset,e.byteLength).toString("base64")},"toBase64$1");function Uf(t,e,r,n){return class At extends Uint8Array{static{a(this,"Uint8ArrayBlobAdapter")}static fromString(i,o="utf-8"){if(typeof i=="string")return o==="base64"?At.mutate(n(i)):At.mutate(e(i));throw new Error(`Unsupported conversion from ${typeof i} to Uint8ArrayBlobAdapter.`)}static mutate(i){return Object.setPrototypeOf(i,At.prototype),i}transformToString(i="utf-8"){return i==="base64"?r(this):t(this)}}}a(Uf,"bindUint8ArrayBlobAdapter");var Oi=a(t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return Se(t.buffer,t.byteOffset,t.byteLength).toString("utf8")},"toUtf8$1"),D=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Df(t){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?()=>crypto.randomUUID():()=>{let e=new Uint8Array(16);return t(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128,D[e[0]]+D[e[1]]+D[e[2]]+D[e[3]]+"-"+D[e[4]]+D[e[5]]+"-"+D[e[6]]+D[e[7]]+"-"+D[e[8]]+D[e[9]]+"-"+D[e[10]]+D[e[11]]+D[e[12]]+D[e[13]]+D[e[14]]+D[e[15]]}}a(Df,"bindV4");var Lf=a((t,e,r=n=>n)=>t,"copyDocumentWithTransform"),kf=a(t=>{switch(t){case"true":return!0;case"false":return!1;default:throw new Error(`Unable to parse boolean value "${t}"`)}},"parseBoolean"),Pf=a(t=>{if(t!=null){if(typeof t=="number"){if((t===0||t===1)&&Ze.warn(_t(`Expected boolean, got ${typeof t}: ${t}`)),t===0)return!1;if(t===1)return!0}if(typeof t=="string"){let e=t.toLowerCase();if((e==="false"||e==="true")&&Ze.warn(_t(`Expected boolean, got ${typeof t}: ${t}`)),e==="false")return!1;if(e==="true")return!0}if(typeof t=="boolean")return t;throw new TypeError(`Expected boolean, got ${typeof t}: ${t}`)}},"expectBoolean"),Ke=a(t=>{if(t!=null){if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return String(e)!==String(t)&&Ze.warn(_t(`Expected number but observed string: ${t}`)),e}if(typeof t=="number")return t;throw new TypeError(`Expected number, got ${typeof t}: ${t}`)}},"expectNumber"),vf=Math.ceil(2**127*(2-2**-23)),Ot=a(t=>{let e=Ke(t);if(e!==void 0&&!Number.isNaN(e)&&e!==1/0&&e!==-1/0&&Math.abs(e)>vf)throw new TypeError(`Expected 32-bit float, got ${t}`);return e},"expectFloat32"),Qe=a(t=>{if(t!=null){if(Number.isInteger(t)&&!Number.isNaN(t))return t;throw new TypeError(`Expected integer, got ${typeof t}: ${t}`)}},"expectLong"),Bf=Qe,Jr=a(t=>nn(t,32),"expectInt32"),Kr=a(t=>nn(t,16),"expectShort"),Qr=a(t=>nn(t,8),"expectByte"),nn=a((t,e)=>{let r=Qe(t);if(r!==void 0&&Ff(r,e)!==r)throw new TypeError(`Expected ${e}-bit integer, got ${t}`);return r},"expectSizedInt"),Ff=a((t,e)=>{switch(e){case 32:return Int32Array.of(t)[0];case 16:return Int16Array.of(t)[0];case 8:return Int8Array.of(t)[0]}},"castInt"),zf=a((t,e)=>{if(t==null)throw e?new TypeError(`Expected a non-null value for ${e}`):new TypeError("Expected a non-null value");return t},"expectNonNull"),_i=a(t=>{if(t==null)return;if(typeof t=="object"&&!Array.isArray(t))return t;let e=Array.isArray(t)?"array":typeof t;throw new TypeError(`Expected object, got ${e}: ${t}`)},"expectObject"),jf=a(t=>{if(t!=null){if(typeof t=="string")return t;if(["boolean","number","bigint"].includes(typeof t))return Ze.warn(_t(`Expected string, got ${typeof t}: ${t}`)),String(t);throw new TypeError(`Expected string, got ${typeof t}: ${t}`)}},"expectString"),Hf=a(t=>{if(t==null)return;let e=_i(t),r=[];for(let n in e)Ci(e,n)&&e[n]!=null&&r.push(n);if(r.length===0)throw new TypeError("Unions must have exactly one non-null member. None were found.");if(r.length>1)throw new TypeError(`Unions must have exactly one non-null member. Keys ${r} were not null.`);return e},"expectUnion"),sn=a(t=>Ke(typeof t=="string"?Ee(t):t),"strictParseDouble"),Vf=sn,Ri=a(t=>Ot(typeof t=="string"?Ee(t):t),"strictParseFloat32"),qf=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,Ee=a(t=>{let e=t.match(qf);if(e===null||e[0].length!==t.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(t)},"parseNumber"),on=a(t=>typeof t=="string"?Mi(t):Ke(t),"limitedParseDouble"),Wf=on,Gf=on,Jf=a(t=>typeof t=="string"?Mi(t):Ot(t),"limitedParseFloat32"),Mi=a(t=>{switch(t){case"NaN":return NaN;case"Infinity":return 1/0;case"-Infinity":return-1/0;default:throw new Error(`Unable to parse float value: ${t}`)}},"parseFloatString"),$i=a(t=>Qe(typeof t=="string"?Ee(t):t),"strictParseLong"),Kf=$i,Qf=a(t=>Jr(typeof t=="string"?Ee(t):t),"strictParseInt32"),we=a(t=>Kr(typeof t=="string"?Ee(t):t),"strictParseShort"),Ui=a(t=>Qr(typeof t=="string"?Ee(t):t),"strictParseByte"),_t=a(t=>String(new TypeError(t).stack||t).split(`
20
+ `).slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join(`
21
+ `),"stackTraceWarning"),Ze={warn:console.warn},Zf=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],an=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Xf(t){let e=t.getUTCFullYear(),r=t.getUTCMonth(),n=t.getUTCDay(),s=t.getUTCDate(),i=t.getUTCHours(),o=t.getUTCMinutes(),c=t.getUTCSeconds(),f=s<10?`0${s}`:`${s}`,u=i<10?`0${i}`:`${i}`,d=o<10?`0${o}`:`${o}`,h=c<10?`0${c}`:`${c}`;return`${Zf[n]}, ${f} ${an[r]} ${e} ${u}:${d}:${h} GMT`}a(Xf,"dateToUtcString");var Yf=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),eu=a(t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=Yf.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,s,i,o,c,f,u]=e,d=we(be(n)),h=V(s,"month",1,12),l=V(i,"day",1,31);return Je(d,h,l,{hours:o,minutes:c,seconds:f,fractionalMilliseconds:u})},"parseRfc3339DateTime"),tu=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}:\d{2})|[zZ])$/),ru=a(t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=tu.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,s,i,o,c,f,u,d]=e,h=we(be(n)),l=V(s,"month",1,12),m=V(i,"day",1,31),p=Je(h,l,m,{hours:o,minutes:c,seconds:f,fractionalMilliseconds:u});return d.toUpperCase()!="Z"&&p.setTime(p.getTime()-pu(d)),p},"parseRfc3339DateTimeWithOffset"),nu=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),su=new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),iu=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/),ou=a(t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-7231 date-times must be expressed as strings");let e=nu.exec(t);if(e){let[r,n,s,i,o,c,f,u]=e;return Je(we(be(i)),qr(s),V(n,"day",1,31),{hours:o,minutes:c,seconds:f,fractionalMilliseconds:u})}if(e=su.exec(t),e){let[r,n,s,i,o,c,f,u]=e;return uu(Je(cu(i),qr(s),V(n,"day",1,31),{hours:o,minutes:c,seconds:f,fractionalMilliseconds:u}))}if(e=iu.exec(t),e){let[r,n,s,i,o,c,f,u]=e;return Je(we(be(u)),qr(n),V(s.trimLeft(),"day",1,31),{hours:i,minutes:o,seconds:c,fractionalMilliseconds:f})}throw new TypeError("Invalid RFC-7231 date-time value")},"parseRfc7231DateTime"),au=a(t=>{if(t==null)return;let e;if(typeof t=="number")e=t;else if(typeof t=="string")e=sn(t);else if(typeof t=="object"&&t.tag===1)e=t.value;else throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");if(Number.isNaN(e)||e===1/0||e===-1/0)throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(e*1e3))},"parseEpochTimestamp"),Je=a((t,e,r,n)=>{let s=e-1;return lu(t,s,r),new Date(Date.UTC(t,s,r,V(n.hours,"hour",0,23),V(n.minutes,"minute",0,59),V(n.seconds,"seconds",0,60),mu(n.fractionalMilliseconds)))},"buildDate"),cu=a(t=>{let e=new Date().getUTCFullYear(),r=Math.floor(e/100)*100+we(be(t));return r<e?r+100:r},"parseTwoDigitYear"),fu=50*365*24*60*60*1e3,uu=a(t=>t.getTime()-new Date().getTime()>fu?new Date(Date.UTC(t.getUTCFullYear()-100,t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds())):t,"adjustRfc850Year"),qr=a(t=>{let e=an.indexOf(t);if(e<0)throw new TypeError(`Invalid month: ${t}`);return e+1},"parseMonthByShortName"),hu=[31,28,31,30,31,30,31,31,30,31,30,31],lu=a((t,e,r)=>{let n=hu[e];if(e===1&&du(t)&&(n=29),r>n)throw new TypeError(`Invalid day for ${an[e]} in ${t}: ${r}`)},"validateDayOfMonth"),du=a(t=>t%4===0&&(t%100!==0||t%400===0),"isLeapYear"),V=a((t,e,r,n)=>{let s=Ui(be(t));if(s<r||s>n)throw new TypeError(`${e} must be between ${r} and ${n}, inclusive`);return s},"parseDateValue"),mu=a(t=>t==null?0:Ri("0."+t)*1e3,"parseMilliseconds"),pu=a(t=>{let e=t[0],r=1;if(e=="+")r=1;else if(e=="-")r=-1;else throw new TypeError(`Offset direction, ${e}, must be "+" or "-"`);let n=Number(t.substring(1,3)),s=Number(t.substring(4,6));return r*(n*60+s)*60*1e3},"parseOffsetToMilliseconds"),be=a(t=>{let e=0;for(;e<t.length-1&&t.charAt(e)==="0";)e++;return e===0?t:t.slice(e)},"stripLeadingZeroes"),ae=a(function(e){return Object.assign(new String(e),{deserializeJSON(){return JSON.parse(String(e))},toString(){return String(e)},toJSON(){return String(e)}})},"LazyJsonString");ae.from=t=>t&&typeof t=="object"&&(t instanceof ae||"deserializeJSON"in t)?t:typeof t=="string"||Object.getPrototypeOf(t)===String.prototype?ae(String(t)):ae(JSON.stringify(t));ae.fromObject=ae.from;function gu(t){return(t.includes(",")||t.includes('"'))&&(t=`"${t.replace(/"/g,'\\"')}"`),t}a(gu,"quoteHeader");var cn="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?",fn="(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)",un="(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?",Di="(\\d?\\d)",Li="(\\d{4})",yu=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/),Su=new RegExp(`^${cn}, ${Di} ${fn} ${Li} ${un} GMT$`),wu=new RegExp(`^${cn}, ${Di}-${fn}-(\\d\\d) ${un} GMT$`),bu=new RegExp(`^${cn} ${fn} ( [1-9]|\\d\\d) ${un} ${Li}$`),Eu=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Tu=a(t=>{if(t==null)return;let e=NaN;if(typeof t=="number")e=t;else if(typeof t=="string"){if(!/^-?\d*\.?\d+$/.test(t))throw new TypeError("parseEpochTimestamp - numeric string invalid.");e=Number.parseFloat(t)}else typeof t=="object"&&t.tag===1&&(e=t.value);if(isNaN(e)||Math.abs(e)===1/0)throw new TypeError("Epoch timestamps must be valid finite numbers.");return new Date(Math.round(e*1e3))},"_parseEpochTimestamp"),xu=a(t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC3339 timestamps must be strings");let e=yu.exec(t);if(!e)throw new TypeError(`Invalid RFC3339 timestamp format ${t}`);let[,r,n,s,i,o,c,,f,u]=e;K(n,1,12),K(s,1,31),K(i,0,23),K(o,0,59),K(c,0,60);let d=new Date(Date.UTC(Number(r),Number(n)-1,Number(s),Number(i),Number(o),Number(c),Number(f)?Math.round(parseFloat(`0.${f}`)*1e3):0));if(d.setUTCFullYear(Number(r)),u.toUpperCase()!="Z"){let[,h,l,m]=/([+-])(\d\d):(\d\d)/.exec(u)||[void 0,"+",0,0],p=h==="-"?1:-1;d.setTime(d.getTime()+p*(Number(l)*60*60*1e3+Number(m)*60*1e3))}return d},"_parseRfc3339DateTimeWithOffset"),Cu=a(t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC7231 timestamps must be strings.");let e,r,n,s,i,o,c,f;if((f=Su.exec(t))?[,e,r,n,s,i,o,c]=f:(f=wu.exec(t))?([,e,r,n,s,i,o,c]=f,n=(Number(n)+1900).toString()):(f=bu.exec(t))&&([,r,e,s,i,o,c,n]=f),n&&o){let u=Date.UTC(Number(n),Eu.indexOf(r),Number(e),Number(s),Number(i),Number(o),c?Math.round(parseFloat(`0.${c}`)*1e3):0);K(e,1,31),K(s,0,23),K(i,0,59),K(o,0,60);let d=new Date(u);return d.setUTCFullYear(Number(n)),d}throw new TypeError(`Invalid RFC7231 date-time value ${t}.`)},"_parseRfc7231DateTime");function K(t,e,r){let n=Number(t);if(n<e||n>r)throw new Error(`Value ${n} out of range [${e}, ${r}]`)}a(K,"range");function Iu(t,e,r){if(r<=0||!Number.isInteger(r))throw new Error("Invalid number of delimiters ("+r+") for splitEvery.");let n=t.split(e);if(r===1)return n;let s=[],i="";for(let o=0;o<n.length;o++)i===""?i=n[o]:i+=e+n[o],(o+1)%r===0&&(s.push(i),i="");return i!==""&&s.push(i),s}a(Iu,"splitEvery");var Nu=a(t=>{let e=t.length,r=[],n=!1,s,i=0;for(let o=0;o<e;++o){let c=t[o];switch(c){case'"':s!=="\\"&&(n=!n);break;case",":n||(r.push(t.slice(i,o)),i=o+1);break}s=c}return r.push(t.slice(i)),r.map(o=>{o=o.trim();let c=o.length;return c<2?o:(o[0]==='"'&&o[c-1]==='"'&&(o=o.slice(1,c-1)),o.replace(/\\"/g,'"'))})},"splitHeader"),Si=/^-?((0|[1-9]\d*)(\.\d+)?|\.\d+)([eE][+-]?\d+)?$/,Rt=class t{static{a(this,"NumericValue")}string;type;constructor(e,r){if(this.string=e,this.type=r,!Si.test(e))throw new Error(`@smithy/core/serde - NumericValue string must conform to the Smithy bigDecimal format. Received: "${e}"`)}toString(){return this.string}static[Symbol.hasInstance](e){if(!e||typeof e!="object")return!1;let r=e;return t.prototype.isPrototypeOf(e)||r.type==="bigDecimal"&&Si.test(r.string)}};function Au(t){return new Rt(String(t),"bigDecimal")}a(Au,"nv");var ki={},Zr={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),ki[t]=e,Zr[e]=t}function Ou(t){if(t.length%2!==0)throw new Error("Hex encoded strings must have an even number length");let e=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2){let n=t.slice(r,r+2).toLowerCase();if(n in Zr)e[r/2]=Zr[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}a(Ou,"fromHex");function Pi(t){let e="";for(let r=0;r<t.byteLength;r++)e+=ki[t[r]];return e}a(Pi,"toHex");var _u=a(t=>{if(!t)return 0;if(typeof t=="string")return Buffer.byteLength(t);if(typeof t.byteLength=="number")return t.byteLength;if(typeof t.size=="number")return t.size;if(typeof t.start=="number"&&typeof t.end=="number")return t.end+1-t.start;if(t instanceof Of){if(t.path!=null)return _f(t.path).size;if(typeof t.fd=="number")return Rf(t.fd).size}throw new Error(`Body Length computation failed for ${t}`)},"calculateBodyLength"),vi=a(t=>t instanceof Uint8Array?t:typeof t=="string"?$t(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t),"toUint8Array");function Ut(t,e){if(e===void 0){e=0;for(let s of t)e+=s.byteLength}let r=new Uint8Array(e),n=0;for(let s of t)r.set(s,n),n+=s.byteLength;return r}a(Ut,"concatBytes");var Bi=a((t,e)=>(r,n)=>async s=>{let{response:i}=await r(s);try{let o=await e(i,t);return{response:i,output:o}}catch(o){if(Object.defineProperty(o,"$response",{value:i,enumerable:!1,writable:!1,configurable:!1}),!("$metadata"in o)){let c="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";try{o.message+=`
22
+ `+c}catch{!n.logger||n.logger?.constructor?.name==="NoOpLogger"?console.warn(c):n.logger?.warn?.(c)}typeof o.$responseBodyText<"u"&&o.$response&&(o.$response.body=o.$responseBodyText);try{if(Af.isInstance(i)){let{headers:f={}}=i,u=Object.entries(f);o.$metadata={httpStatusCode:i.statusCode,requestId:Wr(/^x-[\w-]+-request-?id$/,u),extendedRequestId:Wr(/^x-[\w-]+-id-2$/,u),cfId:Wr(/^x-[\w-]+-cf-id$/,u)}}}catch{}}throw o}},"deserializerMiddleware"),Wr=a((t,e)=>(e.find(([r])=>r.match(t))||[void 0,void 0])[1],"findHeader"),Fi=a((t,e)=>(r,n)=>async s=>{let i=t,o=n.endpointV2?async()=>Mf(n.endpointV2):i.endpoint;if(!o)throw new Error("No valid endpoint provider available.");let c=await e(s.input,{...t,endpoint:o});return r({...s,request:c})},"serializerMiddleware"),zi={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},ji={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function Ru(t,e,r){return{applyToStack:a(n=>{n.add(Bi(t,r),zi),n.add(Fi(t,e),ji)},"applyToStack")}}a(Ru,"getSerdePlugin");var Xr=class{static{a(this,"Hash")}algorithmIdentifier;secret;hash;constructor(e,r){this.algorithmIdentifier=e,this.secret=r,this.reset()}update(e,r){this.hash.update(vi(wi(e,r)))}digest(){return Promise.resolve(this.hash.digest())}reset(){this.hash=this.secret?Cf(this.algorithmIdentifier,wi(this.secret)):If(this.algorithmIdentifier)}};function wi(t,e){return Buffer.isBuffer(t)?t:typeof t=="string"?Mt(t,e):ArrayBuffer.isView(t)?Se(t.buffer,t.byteOffset,t.byteLength):Se(t)}a(wi,"castSourceData");var Hi=class extends ge{static{a(this,"ChecksumStream")}expectedChecksum;checksumSourceLocation;checksum;source;base64Encoder;constructor({expectedChecksum:e,checksum:r,source:n,checksumSourceLocation:s,base64Encoder:i}){if(super(),typeof n.pipe!="function")throw new Error(`@smithy/util-stream: unsupported source type ${n?.constructor?.name??n} in ChecksumStream.`);this.source=n,this.base64Encoder=i??rn,this.expectedChecksum=e,this.checksum=r,this.checksumSourceLocation=s,this.source.on("data",this.onSourceData),this.source.on("end",this.onSourceEnd),this.source.on("error",this.onSourceError),this.source.on("close",this.onSourceClose),this.source.pause()}onSourceData=a(e=>{if(!this.destroyed){try{this.checksum.update(e)}catch(r){this.destroy(r);return}this.push(e)||this.source.pause()}},"onSourceData");onSourceEnd=a(async()=>{if(!this.destroyed){try{let e=await this.checksum.digest(),r=this.base64Encoder(e);if(this.expectedChecksum!==r){this.destroy(new Error(`Checksum mismatch: expected "${this.expectedChecksum}" but received "${r}" in response header "${this.checksumSourceLocation}".`));return}}catch(e){this.destroy(e);return}this.push(null)}},"onSourceEnd");onSourceError=a(e=>{this.destroy(e)},"onSourceError");onSourceClose=a(()=>{!this.destroyed&&!this.source.readableEnded&&this.destroy(new Error("Connection lost or stream closed before all data was received."))},"onSourceClose");_read(e){this.source.resume()}_destroy(e,r){this.source?.removeListener("data",this.onSourceData),this.source?.removeListener("end",this.onSourceEnd),this.source?.removeListener("error",this.onSourceError),this.source?.removeListener("close",this.onSourceClose),this.source?.destroy(),r(e)}},q=a(t=>typeof ReadableStream=="function"&&(t?.constructor?.name===ReadableStream.name||t instanceof ReadableStream),"isReadableStream"),Dt=a(t=>typeof Blob=="function"&&(t?.constructor?.name===Blob.name||t instanceof Blob),"isBlob"),Mu=a(t=>new TextEncoder().encode(t),"fromUtf8"),Vi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";Object.entries(Vi).reduce((t,[e,r])=>(t[r]=Number(e),t),{});var $u=Vi.split(""),Gr=6,bi=8,Uu=63;function qi(t){let e;typeof t=="string"?e=Mu(t):e=t;let r=typeof e=="object"&&typeof e.length=="number",n=typeof e=="object"&&typeof e.byteOffset=="number"&&typeof e.byteLength=="number";if(!r&&!n)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let s="";for(let i=0;i<e.length;i+=3){let o=0,c=0;for(let u=i,d=Math.min(i+3,e.length);u<d;u++)o|=e[u]<<(d-u-1)*bi,c+=bi;let f=Math.ceil(c/Gr);o<<=f*Gr-c;for(let u=1;u<=f;u++){let d=(f-u)*Gr;s+=$u[(o&Uu<<d)>>d]}s+="==".slice(0,4-f)}return s}a(qi,"toBase64");var Du=typeof ReadableStream=="function"?ReadableStream:function(){},Yr=class extends Du{static{a(this,"ChecksumStream")}},Lu=a(({expectedChecksum:t,checksum:e,source:r,checksumSourceLocation:n,base64Encoder:s})=>{if(!q(r))throw new Error(`@smithy/util-stream: unsupported source type ${r?.constructor?.name??r} in ChecksumStream.`);let i=s??qi;if(typeof TransformStream!="function")throw new Error("@smithy/util-stream: unable to instantiate ChecksumStream because API unavailable: ReadableStream/TransformStream.");let o=new TransformStream({start(){},async transform(f,u){e.update(f),u.enqueue(f)},async flush(f){let u=await e.digest(),d=i(u);if(t!==d){let h=new Error(`Checksum mismatch: expected "${t}" but received "${d}" in response header "${n}".`);f.error(h)}else f.terminate()}});r.pipeThrough(o);let c=o.readable;return Object.setPrototypeOf(c,Yr.prototype),c},"createChecksumStream$1");function ku(t){return typeof ReadableStream=="function"&&q(t.source)?Lu(t):new Hi(t)}a(ku,"createChecksumStream");var Xe=class{static{a(this,"ByteArrayCollector")}allocByteArray;byteLength=0;byteArrays=[];constructor(e){this.allocByteArray=e}push(e){this.byteArrays.push(e),this.byteLength+=e.byteLength}flush(){if(this.byteArrays.length===1){let n=this.byteArrays[0];return this.reset(),n}let e=this.allocByteArray(this.byteLength),r=0;for(let n=0;n<this.byteArrays.length;++n){let s=this.byteArrays[n];e.set(s,r),r+=s.byteLength}return this.reset(),e}reset(){this.byteArrays=[],this.byteLength=0}};function Pu(t,e,r){let n=t.getReader(),s=!1,i=0,o=["",new Xe(u=>new Uint8Array(u))],c=-1,f=a(async u=>{let{value:d,done:h}=await n.read(),l=d;if(h){if(c!==-1){let m=ye(o,c);Y(m)>0&&u.enqueue(m)}u.close()}else{let m=Gi(l,!1);if(c!==m&&(c>=0&&u.enqueue(ye(o,c)),c=m),c===-1){u.enqueue(l);return}let p=Y(l);i+=p;let y=Y(o[c]);if(p>=e&&y===0)u.enqueue(l);else{let g=Wi(o,c,l);!s&&i>e*2&&(s=!0,r?.warn(`@smithy/util-stream - stream chunk size ${p} is below threshold of ${e}, automatically buffering.`)),g>=e?u.enqueue(ye(o,c)):await f(u)}}},"pull");return new ReadableStream({pull:f})}a(Pu,"createBufferedReadableStream");function Wi(t,e,r){switch(e){case 0:return t[0]+=r,Y(t[0]);case 1:case 2:return t[e].push(r),Y(t[e])}}a(Wi,"merge");function ye(t,e){switch(e){case 0:let r=t[0];return t[0]="",r;case 1:case 2:return t[e].flush()}throw new Error(`@smithy/util-stream - invalid index ${e} given to flush()`)}a(ye,"flush");function Y(t){return t?.byteLength??t?.length??0}a(Y,"sizeOf");function Gi(t,e=!0){return e&&typeof Buffer<"u"&&t instanceof Buffer?2:t instanceof Uint8Array?1:typeof t=="string"?0:-1}a(Gi,"modeOf");function vu(t,e,r){if(q(t))return Pu(t,e,r);let n=new ge({read(){}}),s=!1,i=0,o=["",new Xe(f=>new Uint8Array(f)),new Xe(f=>Buffer.from(new Uint8Array(f)))],c=-1;return t.on("data",f=>{let u=Gi(f,!0);if(c!==u&&(c>=0&&n.push(ye(o,c)),c=u),c===-1){n.push(f);return}let d=Y(f);i+=d;let h=Y(o[c]);if(d>=e&&h===0)n.push(f);else{let l=Wi(o,c,f);!s&&i>e*2&&(s=!0,r?.warn(`@smithy/util-stream - stream chunk size ${d} is below threshold of ${e}, automatically buffering.`)),l>=e&&n.push(ye(o,c))}}),t.on("end",()=>{if(c!==-1){let f=ye(o,c);Y(f)>0&&n.push(f)}n.push(null)}),n}a(vu,"createBufferedReadable");var Bu=a((t,e)=>{let{base64Encoder:r,bodyLengthChecker:n,checksumAlgorithmFn:s,checksumLocationName:i,streamHasher:o}=e,c=r!==void 0&&n!==void 0&&s!==void 0&&i!==void 0&&o!==void 0,f=c?o(s,t):void 0;Promise.resolve(f).catch(()=>{});let u=t.getReader();return new ReadableStream({async pull(d){let{value:h,done:l}=await u.read();if(l){if(d.enqueue(`0\r
23
+ `),c){let m=r(await f);d.enqueue(`${i}:${m}\r
24
+ `),d.enqueue(`\r
25
+ `)}d.close()}else d.enqueue(`${(n(h)||0).toString(16)}\r
26
+ ${h}\r
27
+ `)}})},"getAwsChunkedEncodingStream$1");function Fu(t,e){let r=t,n=t;if(q(n))return Bu(n,e);let{base64Encoder:s,bodyLengthChecker:i,checksumAlgorithmFn:o,checksumLocationName:c,streamHasher:f}=e,u=s!==void 0&&o!==void 0&&c!==void 0&&f!==void 0,d=u?f(o,r):void 0;Promise.resolve(d).catch(()=>{});let h=new ge({read(){r.resume()}});return r.on("data",l=>{let m=i(l)||0;m!==0&&(h.push(`${m.toString(16)}\r
28
+ `),h.push(l),h.push(`\r
29
+ `)||r.pause())}),r.on("error",l=>{h.destroy(l)}),r.pause(),r.on("end",async()=>{try{if(h.push(`0\r
30
+ `),u){let l=s(await d);h.push(`${c}:${l}\r
31
+ `),h.push(`\r
32
+ `)}h.push(null)}catch(l){h.destroy(l)}}),h}a(Fu,"getAwsChunkedEncodingStream");async function zu(t,e){let r=0,n=[],s=t.getReader(),i=!1;for(;!i;){let{done:f,value:u}=await s.read();if(u&&(n.push(u),r+=u?.byteLength??0),r>=e)break;i=f}s.releaseLock();let o=new Uint8Array(Math.min(e,r)),c=0;for(let f of n){if(f.byteLength>o.byteLength-c){o.set(f.subarray(0,o.byteLength-c),c);break}else o.set(f,c);c+=f.length}return o}a(zu,"headStream$1");var ju=a((t,e)=>q(t)?zu(t,e):new Promise((r,n)=>{let s=new Hu;s.limit=e,t.pipe(s),t.on("error",i=>{s.end(),n(i)}),s.on("error",n),s.on("finish",function(){let i=Ut(this.buffers);r(i)})}),"headStream"),Hu=class extends Ii{static{a(this,"Collector")}buffers=[];limit=1/0;bytesBuffered=0;_write(e,r,n){if(this.buffers.push(e),this.bytesBuffered+=e.byteLength??0,this.bytesBuffered>=this.limit){let s=this.bytesBuffered-this.limit,i=this.buffers[this.buffers.length-1];this.buffers[this.buffers.length-1]=i.subarray(0,i.byteLength-s),this.emit("finish")}n()}},Vu=a(t=>{if(typeof t=="string")return t;if(typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(t)},"toUtf8"),qu=a(async t=>Dt(t)?Ji(t):Ki(t),"streamCollector$1");async function Ji(t){return t.arrayBuffer().then(e=>new Uint8Array(e))}a(Ji,"collectBlob");async function Ki(t){let e=[],r=t.getReader(),n=0;for(;;){let{done:s,value:i}=await r.read();if(i&&(e.push(i),n+=i.length),s)break}return Ut(e,n)}a(Ki,"collectReadableStream");var Ei="The stream has already been transformed.",Wu=a(t=>{if(!Ti(t)&&!q(t)){let s=t?.__proto__?.constructor?.name||t;throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${s}`)}let e=!1,r=a(async()=>{if(e)throw new Error(Ei);return e=!0,await qu(t)},"transformToByteArray"),n=a(s=>{if(typeof s.stream!="function")throw new Error(`Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.
33
+ If you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body`);return s.stream()},"blobToWebStream");return Object.assign(t,{transformToByteArray:r,transformToString:a(async s=>{let i=await r();if(s==="base64")return qi(i);if(s==="hex")return Pi(i);if(s===void 0||s==="utf8"||s==="utf-8")return Vu(i);if(typeof TextDecoder=="function")return new TextDecoder(s).decode(i);throw new Error("TextDecoder is not available, please make sure polyfill is provided.")},"transformToString"),transformToWebStream:a(()=>{if(e)throw new Error(Ei);if(e=!0,Ti(t))return n(t);if(q(t))return t;throw new Error(`Cannot transform payload to web stream, got ${t}`)},"transformToWebStream")})},"sdkStreamMixin$1"),Ti=a(t=>typeof Blob=="function"&&t instanceof Blob,"isBlobInstance"),Qi=a(t=>Dt(t)?Ji(t):q(t)?Ki(t):new Promise((e,r)=>{let n=new en,s=t;s.pipe(n),s.on("error",i=>{n.end(),r(i)}),n.on("error",r),n.on("finish",function(){let i=Ut(this.bufferedBytes);e(i)})}),"streamCollector"),en=class extends Ii{static{a(this,"Collector")}bufferedBytes=[];_write(e,r,n){this.bufferedBytes.push(e),n()}},xi="The stream has already been transformed.",Gu=a(t=>{if(!(t instanceof ge))try{return Wu(t)}catch{let s=t?.__proto__?.constructor?.name||t;throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${s}`)}let e=!1,r=a(async()=>{if(e)throw new Error(xi);return e=!0,await Qi(t)},"transformToByteArray");return Object.assign(t,{transformToByteArray:r,transformToString:a(async n=>{let s=await r();return n===void 0||Buffer.isEncoding(n)?Se(s.buffer,s.byteOffset,s.byteLength).toString(n):new TextDecoder(n).decode(s)},"transformToString"),transformToWebStream:a(()=>{if(e)throw new Error(xi);if(t.readableFlowing!==null)throw new Error("The stream has been consumed by other callbacks.");if(typeof ge.toWeb!="function")throw new Error("Readable.toWeb() is not supported. Please ensure a polyfill is available.");return e=!0,ge.toWeb(t)},"transformToWebStream")})},"sdkStreamMixin");async function Ju(t){return typeof t.stream=="function"&&(t=t.stream()),t.tee()}a(Ju,"splitStream$1");async function Ku(t){if(q(t)||Dt(t))return Ju(t);let e=new yi,r=new yi;return t.pipe(e),t.pipe(r),[e,r]}a(Ku,"splitStream");var tn=class extends Uf(Oi,$t,rn,Ai){static{a(this,"Uint8ArrayBlobAdapter")}},Qu=Nf,Zi=Df(Qu),Zu=Zi;w.ChecksumStream=Hi;w.Hash=Xr;w.LazyJsonString=ae;w.NumericValue=Rt;w.Uint8ArrayBlobAdapter=tn;w._parseEpochTimestamp=Tu;w._parseRfc3339DateTimeWithOffset=xu;w._parseRfc7231DateTime=Cu;w.calculateBodyLength=_u;w.concatBytes=Ut;w.copyDocumentWithTransform=Lf;w.createBufferedReadable=vu;w.createChecksumStream=ku;w.dateToUtcString=Xf;w.deserializerMiddleware=Bi;w.deserializerMiddlewareOption=zi;w.expectBoolean=Pf;w.expectByte=Qr;w.expectFloat32=Ot;w.expectInt=Bf;w.expectInt32=Jr;w.expectLong=Qe;w.expectNonNull=zf;w.expectNumber=Ke;w.expectObject=_i;w.expectShort=Kr;w.expectString=jf;w.expectUnion=Hf;w.fromArrayBuffer=Se;w.fromBase64=Ai;w.fromHex=Ou;w.fromString=Mt;w.fromUtf8=$t;w.generateIdempotencyToken=Zu;w.getAwsChunkedEncodingStream=Fu;w.getSerdePlugin=Ru;w.handleFloat=Wf;w.headStream=ju;w.isArrayBuffer=Ni;w.isBlob=Dt;w.isReadableStream=q;w.limitedParseDouble=on;w.limitedParseFloat=Gf;w.limitedParseFloat32=Jf;w.logger=Ze;w.nv=Au;w.parseBoolean=kf;w.parseEpochTimestamp=au;w.parseRfc3339DateTime=eu;w.parseRfc3339DateTimeWithOffset=ru;w.parseRfc7231DateTime=ou;w.quoteHeader=gu;w.sdkStreamMixin=Gu;w.serializerMiddleware=Fi;w.serializerMiddlewareOption=ji;w.splitEvery=Iu;w.splitHeader=Nu;w.splitStream=Ku;w.streamCollector=Qi;w.strictParseByte=Ui;w.strictParseDouble=sn;w.strictParseFloat=Vf;w.strictParseFloat32=Ri;w.strictParseInt=Kf;w.strictParseInt32=Qf;w.strictParseLong=$i;w.strictParseShort=we;w.toBase64=rn;w.toHex=Pi;w.toUint8Array=vi;w.toUtf8=Oi;w.v4=Zi});var co=G(k=>{var{createReadStream:Xu}=v("node:fs"),{Writable:Yu}=v("node:stream"),{toUint8Array:Te,concatBytes:eh}=Lt(),{createHash:Ye,createHmac:th}=v("node:crypto"),Xi=v("node:zlib");async function no(t,e,r=1024*1024){let n=t.size,s=0;for(;s<n;){let i=t.slice(s,Math.min(n,s+r));e(new Uint8Array(await i.arrayBuffer())),s+=i.size}}a(no,"blobReader");var rh=a(async function(e,r){let n=new e;return await no(r,s=>{n.update(s)}),n.digest()},"blobHasher"),Pt=class extends Yu{static{a(this,"HashCalculator")}hash;constructor(e,r){super(r),this.hash=e}_write(e,r,n){try{this.hash.update(Te(e))}catch(s){return n(s)}n()}},nh=a((t,e)=>new Promise((r,n)=>{if(!sh(e)){n(new Error("Unable to calculate hash for non-file streams."));return}let s=Xu(e.path,{start:e.start,end:e.end}),i=new t,o=new Pt(i);s.pipe(o),s.on("error",c=>{o.end(),n(c)}),o.on("error",n),o.on("finish",function(){i.digest().then(r).catch(n)})}),"fileStreamHasher"),sh=a(t=>typeof t.path=="string","isReadStream"),ih=a((t,e)=>{if(e.readableFlowing!==null)throw new Error("Unable to calculate hash for flowing readable stream");let r=new t,n=new Pt(r);return e.pipe(n),new Promise((s,i)=>{e.on("error",o=>{n.end(),i(o)}),n.on("error",i),n.on("finish",()=>{r.digest().then(s).catch(i)})})},"readableStreamHasher"),vt=class{static{a(this,"Md5Js")}digestLength=16;state=Uint32Array.from(Yi);writeBuffer=new DataView(new ArrayBuffer(64));bufferLength=0;bytesHashed=0;update(e){let r=Te(e),n=0,s=r.byteLength;for(this.bytesHashed+=s;s>0;)this.writeBuffer.setUint8(this.bufferLength++,r[n++]),--s,this.bufferLength===64&&(hn(this.state,this.writeBuffer),this.bufferLength=0)}async digest(){let e=Uint32Array.from(this.state),r=new DataView(this.writeBuffer.buffer.slice(0)),n=this.bufferLength,s=this.bytesHashed*8;if(r.setUint8(n++,128),this.bufferLength%64>=56){for(let c=n;c<64;++c)r.setUint8(c,0);hn(e,r),n=0}for(let c=n;c<56;++c)r.setUint8(c,0);r.setUint32(56,s>>>0,!0),r.setUint32(60,Math.floor(s/2**32),!0),hn(e,r);let i=new Uint8Array(16),o=new DataView(i.buffer);for(let c=0;c<4;++c)o.setUint32(c*4,e[c],!0);return i}reset(){this.state.set(Yi),this.writeBuffer=new DataView(new ArrayBuffer(64)),this.bufferLength=0,this.bytesHashed=0}},Yi=[1732584193,4023233417,2562383102,271733878],ee=4294967295,oh=Uint8Array.of(7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21),ah=Array.from({length:64},(t,e)=>Math.abs(Math.sin(e+1))*2**32>>>0);function hn(t,e){let r=t[0],n=t[1],s=t[2],i=t[3];for(let o=0;o<64;++o){let c,f;o<16?(c=n&s|~n&i,f=o):o<32?(c=i&n|s&~i,f=(5*o+1)%16):o<48?(c=n^s^i,f=(3*o+5)%16):(c=s^(n|~i),f=7*o%16);let u=e.getUint32(f*4,!0),d=i;i=s,s=n;let h=oh[(o>>4)*4+(o&3)],l=(r+c&ee)+(u+ah[o]&ee)&ee;n=n+((l<<h|l>>>32-h)>>>0)&ee,r=d}t[0]=t[0]+r&ee,t[1]=t[1]+n&ee,t[2]=t[2]+s&ee,t[3]=t[3]+i&ee}a(hn,"compress");var ch=(()=>{try{return Ye("md5"),!0}catch{return!1}})(),so=ch?fh():vt;function fh(){return class{static{a(this,"Md5Node")}digestLength=16;hash=Ye("md5");update(e){this.hash.update(Te(e))}async digest(){let e=this.hash.copy().digest();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}reset(){this.hash=Ye("md5")}}}a(fh,"buildNativeClass$2");var io=new Uint32Array(256);for(let t=0;t<256;++t){let e=t;for(let r=0;r<8;++r)e=e&1?3988292384^e>>>1:e>>>1;io[t]=e>>>0}var ln=4294967295,Bt=class{static{a(this,"Crc32Js")}digestLength=4;checksum=ln;update(e){for(let r=0;r<e.length;++r)this.checksum=this.checksum>>>8^io[(this.checksum^e[r])&255]}digestSync(){return(this.checksum^ln)>>>0}async digest(){let e=this.digestSync(),r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,e,!1),r}reset(){this.checksum=ln}},eo=typeof Xi.crc32=="function"?Xi.crc32:void 0,oo=eo?uh(eo):Bt;function uh(t){return class{static{a(this,"Crc32Node")}digestLength=4;value=0;update(r){this.value=t(r,this.value)}digestSync(){return this.value>>>0}async digest(){let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,this.digestSync(),!1),r}reset(){this.value=0}}}a(uh,"buildNativeClass$1");var $=64,to=32,hh=2**53-1,xe=class t{static{a(this,"Sha256Js")}digestLength=to;state=Int32Array.from(ro);w;buffer=new Uint8Array(64);bufferLength=0;bytesHashed=0;finished=!1;inner;outer;constructor(e){if(e){let r=t.normalizeKey(e);this.inner=new t,this.outer=new t;let{inner:n,outer:s}=this,i=new Uint8Array($*2);for(let o=0;o<$;++o)i[o]=54^r[o],i[o+$]=92^r[o];n.update(i.subarray(0,$)),s.update(i.subarray($))}}update(e){if(this.finished)throw new Error("Attempted to update an already finished HMAC.");if(this.inner){this.inner.update(e);return}let r=Te(e),n=0,{byteLength:s}=r;if(this.bytesHashed+=s,this.bytesHashed*8>hh)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;s>0;)this.buffer[this.bufferLength++]=r[n++],s--,this.bufferLength===$&&(this.hashBuffer(),this.bufferLength=0)}async digest(){let{inner:e,outer:r}=this;if(e&&r){if(this.finished)throw new Error("Attempted to digest an already finished HMAC.");this.finished=!0;let n=e.digestSync();return r.update(n),r.digestSync()}return this.digestSync()}reset(){this.state=Int32Array.from(ro),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0}digestSync(){let e=this.state.slice(),r=this.buffer.slice(),n=this.bufferLength,s=this.bytesHashed*8,i=new DataView(r.buffer,r.byteOffset,r.byteLength);if(i.setUint8(n++,128),(n-1)%$>=$-8){for(let c=n;c<$;++c)i.setUint8(c,0);this.hashBufferWith(e,r),n=0}for(let c=n;c<$-8;++c)i.setUint8(c,0);i.setUint32($-8,Math.floor(s/4294967296),!1),i.setUint32($-4,s,!1),this.hashBufferWith(e,r);let o=new Uint8Array(to);for(let c=0;c<8;++c)o[c*4]=e[c]>>>24&255,o[c*4+1]=e[c]>>>16&255,o[c*4+2]=e[c]>>>8&255,o[c*4+3]=e[c]>>>0&255;return o}static normalizeKey(e){let r=Te(e);if(r.byteLength>$){let n=new t;n.update(r);let s=n.digestSync(),i=new Uint8Array($);return i.set(s),i}if(r.byteLength<$){let n=new Uint8Array($);return n.set(r),n}return r}hashBuffer(){this.hashBufferWith(this.state,this.buffer)}hashBufferWith(e,r){let n=this.w??=new Int32Array(64),s=e[0],i=e[1],o=e[2],c=e[3],f=e[4],u=e[5],d=e[6],h=e[7];for(let l=0;l<$;++l){if(l<16)n[l]=(r[l*4]&255)<<24|(r[l*4+1]&255)<<16|(r[l*4+2]&255)<<8|r[l*4+3]&255;else{let y=n[l-2],g=(y>>>17|y<<15)^(y>>>19|y<<13)^y>>>10;y=n[l-15];let S=(y>>>7|y<<25)^(y>>>18|y<<14)^y>>>3;n[l]=(g+n[l-7]|0)+(S+n[l-16]|0)}let m=(((f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(f&u^~f&d)|0)+(h+(lh[l]+n[l]|0)|0)|0,p=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&i^s&o^i&o)|0;h=d,d=u,u=f,f=c+m|0,c=o,o=i,i=s,s=m+p|0}e[0]+=s,e[1]+=i,e[2]+=o,e[3]+=c,e[4]+=f,e[5]+=u,e[6]+=d,e[7]+=h}},ro=new Int32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),lh=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),dh=(()=>{try{return Ye("sha256"),!0}catch{return!1}})(),ao=dh?mh():xe;function mh(){return class{static{a(this,"Sha256Node")}digestLength=32;secret;hash;isHmac;finished=!1;constructor(e){this.secret=e,this.isHmac=!!e,this.hash=this.createHash()}update(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");this.hash.update(e)}async digest(){let e;return this.isHmac?(this.finished=!0,e=this.hash.digest()):e=this.hash.copy().digest(),new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}reset(){this.hash=this.createHash(),this.finished=!1}createHash(){return this.secret?th("sha256",ph(this.secret)):Ye("sha256")}}}a(mh,"buildNativeClass");function ph(t){return typeof t=="string"?t:ArrayBuffer.isView(t)?Buffer.from(t.buffer,t.byteOffset,t.byteLength):Buffer.from(t)}a(ph,"toBuffer");var{digest:gh,sign:yh,importKey:Sh}=globalThis?.crypto?.subtle??{},kt=typeof gh=="function"&&typeof yh=="function"&&typeof Sh=="function"?globalThis.crypto.subtle:void 0,wh=8*1024*1024,dn=class{static{a(this,"Sha256WebCrypto")}digestLength=32;secret;pending=[];pendingBytes=0;fallback;finished=!1;constructor(e){e&&(this.secret=Te(e))}update(e){if(this.finished)throw new Error("Attempted to update an already finished HMAC.");if(this.fallback){this.fallback.update(e);return}this.pending.push(e.slice()),this.pendingBytes+=e.byteLength,this.pendingBytes>=wh&&this.switchToFallback()}async digest(){if(this.fallback)return this.fallback.digest();if(this.secret&&this.finished)throw new Error("Attempted to digest an already finished HMAC.");let e=eh(this.pending);if(kt){if(this.secret){this.finished=!0;let s=await kt.importKey("raw",this.secret,{name:"HMAC",hash:"SHA-256"},!1,["sign"]),i=await kt.sign("HMAC",s,e);return new Uint8Array(i)}let n=await kt.digest("SHA-256",e);return new Uint8Array(n)}let r=new xe(this.secret);return r.update(e),r.digest()}reset(){this.pending=[],this.pendingBytes=0,this.fallback=void 0,this.finished=!1}switchToFallback(){let e=new xe(this.secret);for(let r of this.pending)e.update(r);this.fallback=e,this.pending=[],this.pendingBytes=0}};k.Crc32=oo;k.Crc32Js=Bt;k.Crc32Node=oo;k.Md5=so;k.Md5Js=vt;k.Md5Node=so;k.Sha256=ao;k.Sha256Js=xe;k.Sha256Node=ao;k.Sha256WebCrypto=dn;k.blobHasher=rh;k.blobReader=no;k.fileStreamHasher=nh;k.readableStreamHasher=ih});var go=G(O=>{var{Crc32:lo}=co(),{hasOwn:Ft}=j(),{toHex:Ce,fromHex:bh,toUtf8:Eh,fromUtf8:Th}=Lt(),{Readable:xh}=v("node:stream"),{TypeRegistry:Ch}=yt(),Ie=class t{static{a(this,"Int64")}bytes;constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let r=new Uint8Array(8);for(let n=7,s=Math.abs(Math.round(e));n>-1&&s>0;n--,s/=256)r[n]=s;return e<0&&fo(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&fo(e),parseInt(Ce(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}};function fo(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}a(fo,"negate");var zt=class{static{a(this,"HeaderMarshaller")}toUtf8;fromUtf8;constructor(e,r){this.toUtf8=e,this.fromUtf8=r}format(e){let r=[];for(let i in e){if(!Ft(e,i))continue;let o=this.fromUtf8(i);r.push(Uint8Array.from([o.byteLength]),o,this.formatHeaderValue(e[i]))}let n=new Uint8Array(r.reduce((i,o)=>i+o.byteLength,0)),s=0;for(let i of r)n.set(i,s),s+=i.byteLength;return n}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":let r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,e.value,!1),new Uint8Array(r.buffer);case"integer":let n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case"long":let s=new Uint8Array(9);return s[0]=5,s.set(e.value.bytes,1),s;case"binary":let i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);let o=new Uint8Array(i.buffer);return o.set(e.value,3),o;case"string":let c=this.fromUtf8(e.value),f=new DataView(new ArrayBuffer(3+c.byteLength));f.setUint8(0,7),f.setUint16(1,c.byteLength,!1);let u=new Uint8Array(f.buffer);return u.set(c,3),u;case"timestamp":let d=new Uint8Array(9);return d[0]=8,d.set(Ie.fromNumber(e.value.valueOf()).bytes,1),d;case"uuid":if(!Uh.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let h=new Uint8Array(17);return h[0]=9,h.set(bh(e.value.replace(/-/g,"")),1),h}}parse(e){let r={},n=0;for(;n<e.byteLength;){let s=e.getUint8(n++),i=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,s));switch(n+=s,e.getUint8(n++)){case 0:r[i]={type:ho,value:!0};break;case 1:r[i]={type:ho,value:!1};break;case 2:r[i]={type:Ih,value:e.getInt8(n++)};break;case 3:r[i]={type:Nh,value:e.getInt16(n,!1)},n+=2;break;case 4:r[i]={type:Ah,value:e.getInt32(n,!1)},n+=4;break;case 5:r[i]={type:Oh,value:new Ie(new Uint8Array(e.buffer,e.byteOffset+n,8))},n+=8;break;case 6:let o=e.getUint16(n,!1);n+=2,r[i]={type:_h,value:new Uint8Array(e.buffer,e.byteOffset+n,o)},n+=o;break;case 7:let c=e.getUint16(n,!1);n+=2,r[i]={type:Rh,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,c))},n+=c;break;case 8:r[i]={type:Mh,value:new Date(new Ie(new Uint8Array(e.buffer,e.byteOffset+n,8)).valueOf())},n+=8;break;case 9:let f=new Uint8Array(e.buffer,e.byteOffset+n,16);n+=16,r[i]={type:$h,value:`${Ce(f.subarray(0,4))}-${Ce(f.subarray(4,6))}-${Ce(f.subarray(6,8))}-${Ce(f.subarray(8,10))}-${Ce(f.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return r}},uo;(function(t){t[t.boolTrue=0]="boolTrue",t[t.boolFalse=1]="boolFalse",t[t.byte=2]="byte",t[t.short=3]="short",t[t.integer=4]="integer",t[t.long=5]="long",t[t.byteArray=6]="byteArray",t[t.string=7]="string",t[t.timestamp=8]="timestamp",t[t.uuid=9]="uuid"})(uo||(uo={}));var ho="boolean",Ih="byte",Nh="short",Ah="integer",Oh="long",_h="binary",Rh="string",Mh="timestamp",$h="uuid",Uh=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,mo=4,te=mo*2,ce=4,Dh=te+ce*2;function Lh({byteLength:t,byteOffset:e,buffer:r}){if(t<Dh)throw new Error("Provided message too short to accommodate event stream message overhead");let n=new DataView(r,e,t),s=n.getUint32(0,!1);if(t!==s)throw new Error("Reported message length does not match received message length");let i=n.getUint32(mo,!1),o=n.getUint32(te,!1),c=n.getUint32(t-ce,!1),f=new lo;if(f.update(new Uint8Array(r,e,te)),o!==f.digestSync())throw new Error(`The prelude checksum specified in the message (${o}) does not match the calculated CRC32 checksum (${f.digestSync()})`);if(f.update(new Uint8Array(r,e+te,t-(te+ce))),c!==f.digestSync())throw new Error(`The message checksum (${f.digestSync()}) did not match the expected value of ${c}`);return{headers:new DataView(r,e+te+ce,i),body:new Uint8Array(r,e+te+ce+i,s-i-(te+ce+ce))}}a(Lh,"splitMessage");var jt=class{static{a(this,"EventStreamCodec")}headerMarshaller;messageBuffer;isEndOfStream;constructor(e,r){this.headerMarshaller=new zt(e,r),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){let e=this.messageBuffer.pop(),r=this.isEndOfStream;return{getMessage(){return e},isEndOfStream(){return r}}}getAvailableMessages(){let e=this.messageBuffer;this.messageBuffer=[];let r=this.isEndOfStream;return{getMessages(){return e},isEndOfStream(){return r}}}encode({headers:e,body:r}){let n=this.headerMarshaller.format(e),s=n.byteLength+r.byteLength+16,i=new Uint8Array(s),o=new DataView(i.buffer,i.byteOffset,i.byteLength),c=new lo;return o.setUint32(0,s,!1),o.setUint32(4,n.byteLength,!1),c.update(i.subarray(0,8)),o.setUint32(8,c.digestSync(),!1),i.set(n,12),i.set(r,n.byteLength+12),c.update(i.subarray(8,s-4)),o.setUint32(s-4,c.digestSync(),!1),i}decode(e){let{headers:r,body:n}=Lh(e);return{headers:this.headerMarshaller.parse(r),body:n}}formatHeaders(e){return this.headerMarshaller.format(e)}},Ht=class{static{a(this,"MessageDecoderStream")}options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.decoder.decode(e)}},Vt=class{static{a(this,"MessageEncoderStream")}options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream)yield this.options.encoder.encode(e);this.options.includeEndFrame&&(yield new Uint8Array(0))}},qt=class{static{a(this,"SmithyMessageDecoderStream")}options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream){let r=await this.options.deserializer(e);r!==void 0&&(yield r)}}},Wt=class{static{a(this,"SmithyMessageEncoderStream")}options;constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.serializer(e)}};function po(t){let e=0,r=0,n=null,s=null,i=a(c=>{if(typeof c!="number")throw new Error("Attempted to allocate an event message where size was not a number: "+c);e=c,r=4,n=new Uint8Array(c),new DataView(n.buffer).setUint32(0,c,!1)},"allocateMessage"),o=a(async function*(){let c=t[Symbol.asyncIterator]();for(;;){let{value:f,done:u}=await c.next();if(u){if(e)if(e===r)yield n;else throw new Error("Truncated event message received.");else return;return}let d=f.length,h=0;for(;h<d;){if(!n){let m=d-h;s||(s=new Uint8Array(4));let p=Math.min(4-r,m);if(s.set(f.slice(h,h+p),r),r+=p,h+=p,r<4)break;i(new DataView(s.buffer).getUint32(0,!1)),s=null}let l=Math.min(e-r,d-h);n.set(f.slice(h,h+l),r),r+=l,h+=l,e&&e===r&&(yield n,n=null,e=0,r=0)}}},"iterator");return{[Symbol.asyncIterator]:o}}a(po,"getChunkedStream");function kh(t,e){let r=pn(e.deserializer,e.toUtf8);return{[Symbol.asyncIterator]:async function*(){for await(let n of t){let s=e.eventStreamCodec.decode(n),i=await r(s);i!==void 0&&(yield i)}}}}a(kh,"getUnmarshalledStream");function pn(t,e){return async function(r){let{value:n}=r.headers[":message-type"];if(n==="error"){let s=new Error(r.headers[":error-message"].value||"UnknownError");throw s.name=r.headers[":error-code"].value,s}else if(n==="exception"){let s=r.headers[":exception-type"].value,i={[s]:r},o=await t(i);if(o.$unknown){let c=new Error(e(r.body));throw c.name=s,c}throw o[s]}else if(n==="event"){let s={[r.headers[":event-type"].value]:r},i=await t(s);return i.$unknown?void 0:i}else throw Error(`Unrecognizable event type: ${r.headers[":event-type"].value}`)}}a(pn,"getMessageUnmarshaller");var gn=class{static{a(this,"EventStreamMarshaller")}eventStreamCodec;utfEncoder;constructor({utf8Encoder:e,utf8Decoder:r}){this.eventStreamCodec=new jt(e,r),this.utfEncoder=e}deserialize(e,r){let n=po(e);return new qt({messageStream:new Ht({inputStream:n,decoder:this.eventStreamCodec}),deserializer:pn(r,this.utfEncoder)})}serialize(e,r){return new Vt({messageStream:new Wt({inputStream:e,serializer:r}),encoder:this.eventStreamCodec,includeEndFrame:!0})}},Ph=a(t=>new gn(t),"eventStreamSerdeProvider$1"),Gt=class{static{a(this,"EventStreamMarshaller")}universalMarshaller;constructor({utf8Encoder:e,utf8Decoder:r}){this.universalMarshaller=new gn({utf8Decoder:r,utf8Encoder:e})}deserialize(e,r){let n=typeof e[Symbol.asyncIterator]=="function"?e:Bh(e);return this.universalMarshaller.deserialize(n,r)}serialize(e,r){return xh.from(this.universalMarshaller.serialize(e,r))}},vh=a(t=>new Gt(t),"eventStreamSerdeProvider");async function*Bh(t){let e=!1,r=!1,n=new Array;for(t.on("error",s=>{if(e||(e=!0),s)throw s}),t.on("data",s=>{n.push(s)}),t.on("end",()=>{e=!0});!r;){let s=await new Promise(i=>setTimeout(()=>i(n.shift()),0));s&&(yield s),r=e&&n.length===0}}a(Bh,"readableToIterable");var Fh=a(t=>({[Symbol.asyncIterator]:async function*(){let e=t.getReader();try{for(;;){let{done:r,value:n}=await e.read();if(r)return;yield n}}finally{e.releaseLock()}}}),"readableStreamToIterable"),zh=a(t=>{let e=t[Symbol.asyncIterator]();return new ReadableStream({async pull(r){let{done:n,value:s}=await e.next();if(n)return r.close();r.enqueue(s)}})},"iterableToReadableStream"),jh=a(t=>Object.assign(t,{eventStreamMarshaller:t.eventStreamSerdeProvider(t)}),"resolveEventStreamSerdeConfig"),mn=class{static{a(this,"EventStreamSerde")}marshaller;serializer;deserializer;serdeContext;defaultContentType;compositeErrorRegistry;constructor({marshaller:e,serializer:r,deserializer:n,serdeContext:s,defaultContentType:i,compositeErrorRegistry:o}){this.marshaller=e,this.serializer=r,this.deserializer=n,this.serdeContext=s,this.defaultContentType=i,this.compositeErrorRegistry=o}async serializeEventStream({eventStream:e,requestSchema:r,initialRequest:n,initialMessageType:s}){let i=this.marshaller,o=r.getEventStreamMember(),c=r.getMemberSchema(o),f=this.serializer,u=this.defaultContentType,d=Symbol("initialRequestMarker"),h={async*[Symbol.asyncIterator](){if(n){let l={":event-type":{type:"string",value:s??"initial-request"},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:u}};f.write(r,n);let m=f.flush();yield{[d]:!0,headers:l,body:m}}for await(let l of e)yield l}};return i.serialize(h,l=>{if(l[d])return{headers:l.headers,body:l.body};let m="";for(let C in l)if(Ft(l,C)&&C!=="__type"){m=C;break}let{additionalHeaders:p,body:y,eventType:g,explicitPayloadContentType:S}=this.writeEventBody(m,c,l);return{headers:{":event-type":{type:"string",value:g},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:S??u},...p},body:y}})}async deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:n,initialMessageType:s}){let i=this.marshaller,o=r.getEventStreamMember(),f=r.getMemberSchema(o).getMemberSchemas(),u=Symbol("initialResponseMarker"),d=i.deserialize(e.body,async m=>{let p="";for(let g in m)if(Ft(m,g)&&g!=="__type"){p=g;break}let y=m[p].body;if(p===(s??"initial-response")){let g=await this.deserializer.read(r,y);return delete g[o],{[u]:!0,...g}}else if(p in f){let g=f[p];if(g.isStructSchema()){let S={},b=!1;for(let[C,I]of g.structIterator()){let{eventHeader:P,eventPayload:le}=I.getMergedTraits();if(b=b||!!(P||le),le)I.isBlobSchema()?S[C]=y:I.isStringSchema()?S[C]=(this.serdeContext?.utf8Encoder??Eh)(y):I.isStructSchema()&&(S[C]=await this.deserializer.read(I,y));else if(P){let ne=m[p].headers[C]?.value;ne!=null&&(I.isNumericSchema()?ne&&typeof ne=="object"&&"bytes"in ne?S[C]=BigInt(ne.toString()):S[C]=Number(ne):S[C]=ne)}}return{[p]:await this.readEventMember(g,y,b,S)}}return{[p]:await this.deserializer.read(g,y)}}else return{$unknown:m}}),h=d[Symbol.asyncIterator](),l=await h.next();if(l.done)return d;if(l.value?.[u]){if(!r)throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");for(let m in l.value)Ft(l.value,m)&&(n[m]=l.value[m])}return{async*[Symbol.asyncIterator](){for(l?.value?.[u]||(yield l.value);;){let{done:m,value:p}=await h.next();if(m)break;yield p}}}}async readEventMember(e,r,n,s){let i,o=e.getSchema();if(Array.isArray(o)&&o[0]===-3){let f=o[1],u=Ch.for(f);this.compositeErrorRegistry?.copyFrom(u),i=(this.compositeErrorRegistry??u)?.getErrorCtor(o)}let c=n?s:r.byteLength===0?{}:await this.deserializer.read(e,r);if(i){let f=c.message??c.Message??"Unknown",u={},d=e.getMergedTraits().error;return d&&(u.$fault=d),Object.assign(new i({}),u,{message:f},c)}return c}writeEventBody(e,r,n){let s=this.serializer,i=e,o=null,c,f=r.getSchema()[4].includes(e),u={};if(f){let l=r.getMemberSchema(e);if(l.isStructSchema()){for(let[m,p]of l.structIterator()){let{eventHeader:y,eventPayload:g}=p.getMergedTraits();if(g)o=m;else if(y){let S=n[e][m],b="binary";p.isNumericSchema()?(-2)**31<=S&&S<=2**31-1?b="integer":b="long":p.isTimestampSchema()?b="timestamp":p.isStringSchema()?b="string":p.isBooleanSchema()&&(b="boolean"),S!=null&&(u[m]={type:b,value:S},delete n[e][m])}}if(o!==null){let m=l.getMemberSchema(o);m.isBlobSchema()?c="application/octet-stream":m.isStringSchema()&&(c="text/plain"),s.write(m,n[e][o])}else s.write(l,n[e])}else if(l.isUnitSchema())s.write(l,{});else throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.")}else{let[l,m]=n[e];i=l,s.write(15,m)}let d=s.flush()??new Uint8Array;return{body:typeof d=="string"?(this.serdeContext?.utf8Decoder??Th)(d):d,eventType:i,explicitPayloadContentType:c,additionalHeaders:u}}};O.EventStreamCodec=jt;O.EventStreamMarshaller=Gt;O.EventStreamSerde=mn;O.HeaderMarshaller=zt;O.Int64=Ie;O.MessageDecoderStream=Ht;O.MessageEncoderStream=Vt;O.SmithyMessageDecoderStream=qt;O.SmithyMessageEncoderStream=Wt;O.UniversalEventStreamMarshaller=gn;O.eventStreamSerdeProvider=vh;O.getChunkedStream=po;O.getMessageUnmarshaller=pn;O.getUnmarshalledStream=kh;O.iterableToReadableStream=zh;O.readableStreamToIterable=Fh;O.resolveEventStreamSerdeConfig=jh;O.universalEventStreamSerdeProvider=Ph});var bl=G(T=>{var{Uint8ArrayBlobAdapter:yn,sdkStreamMixin:Hh,splitEvery:Vh,splitHeader:Io,fromBase64:Zt,_parseEpochTimestamp:qh,_parseRfc7231DateTime:Wh,_parseRfc3339DateTimeWithOffset:Gh,LazyJsonString:Oe,NumericValue:U,toUtf8:fr,fromUtf8:Jh,generateIdempotencyToken:$n,toBase64:Ae,dateToUtcString:Un,quoteHeader:Kh,parseEpochTimestamp:No,parseRfc7231DateTime:Ao,parseRfc3339DateTimeWithOffset:Oo}=Lt(),{HttpRequest:_e,HttpResponse:_o,hasOwn:M,isValidHostname:Ro,getSmithyContext:Qh}=j(),{parseQueryString:Zh,parseUrl:Xh}=j();T.HttpRequest=_e;T.HttpResponse=_o;T.isValidHostname=Ro;T.parseQueryString=Zh;T.parseUrl=Xh;var{TypeRegistry:Tn,NormalizedSchema:A,translateTraits:Mo,deref:Yh}=yt(),{FieldPosition:el}=(me(),Re(de)),Q=a(async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return yn.mutate(t);if(!t)return yn.mutate(new Uint8Array);let r=e.streamCollector(t);return yn.mutate(await r)},"collectBody");function rt(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}a(rt,"extendedEncodeURIComponent");var ue=class{static{a(this,"SerdeContext")}serdeContext;setSerdeContext(e){this.serdeContext=e}},nt=class extends ue{static{a(this,"HttpProtocol")}options;compositeErrorRegistry;constructor(e){super(),this.options=e,this.compositeErrorRegistry=new Tn(e.defaultNamespace);for(let r of e.errorTypeRegistries??[])this.compositeErrorRegistry.copyFrom(r)}getRequestType(){return _e}getResponseType(){return _o}setSerdeContext(e){this.serdeContext=e,this.serializer.setSerdeContext(e),this.deserializer.setSerdeContext(e),this.getPayloadCodec()&&this.getPayloadCodec().setSerdeContext(e)}updateServiceEndpoint(e,r){if("url"in r){e.protocol=r.url.protocol,e.hostname=r.url.hostname,e.port=r.url.port?Number(r.url.port):void 0,e.path=r.url.pathname,e.fragment=r.url.hash||void 0,e.username=r.url.username||void 0,e.password=r.url.password||void 0,e.query||(e.query={});for(let[n,s]of r.url.searchParams.entries())e.query[n]=s;if(r.headers)for(let n in r.headers)M(r.headers,n)&&(e.headers[n]=r.headers[n].join(", "));return e}else{if(e.protocol=r.protocol,e.hostname=r.hostname,e.port=r.port?Number(r.port):void 0,e.path=r.path,e.query={...r.query},r.headers)for(let n in r.headers)M(r.headers,n)&&(e.headers[n]=r.headers[n]);return e}}setHostPrefix(e,r,n){if(this.serdeContext?.disableHostPrefix)return;let s=A.of(r.input),i=Mo(r.traits??{});if(i.endpoint){let o=i.endpoint?.[0];if(typeof o=="string"){for(let[c,f]of s.structIterator()){if(!f.getMergedTraits().hostLabel)continue;let u=n[c];if(typeof u!="string")throw new Error(`@smithy/core/schema - ${c} in input must be a string as hostLabel.`);o=o.replace(`{${c}}`,u)}if(e.hostname=o+e.hostname,!Ro(e.hostname))throw new Error(`[${e.hostname}] is not a valid hostname.`)}}}deserializeMetadata(e){return{httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}}resolveError(e,r,n){let s=[-3,"","Error",0,[],[],0],i;for(let o of n)for(let c of r)try{c==="*"?i=o.getSchema(e):i=o.getSchema(c+"#"+e);let f=o.getErrorCtor(i);if(f)return[i,f,"modeled"];{let u=o.getBaseException();if(u){let d=o.getErrorCtor(u);if(d)return[i,d,"synthetic"]}}}catch{}for(let o of n){let c=o.getBaseException();if(c){let f=o.getErrorCtor(c);if(f)return[c,f,"synthetic"]}}return[s,Error,"native"]}async serializeEventStream({eventStream:e,requestSchema:r,initialRequest:n}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:e,requestSchema:r,initialRequest:n})}async deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:n}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:e,responseSchema:r,initialResponseContainer:n})}async loadEventStreamCapability(){let{EventStreamSerde:e,eventStreamSerdeProvider:r}=go(),n=this.resolveEventStreamMarshaller(r);return new e({marshaller:n,serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType(),compositeErrorRegistry:this.compositeErrorRegistry})}getDefaultContentType(){throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(e,r,n,s,i){return[]}getEventStreamMarshaller(){let e=this.serdeContext;if(!e.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return e.eventStreamMarshaller}resolveEventStreamMarshaller(e){let r=this.serdeContext;return r.eventStreamMarshaller?r.eventStreamMarshaller:e(this.serdeContext)}},xn=class extends nt{static{a(this,"HttpBindingProtocol")}async serializeRequest(e,r,n){let s=r&&typeof r=="object"?r:{},i=this.serializer,o={},c={},f=await n.endpoint(),u=A.of(e?.input),d=[],h=[],l=!1,m,p=new _e({protocol:"",hostname:"",port:void 0,path:"",fragment:void 0,query:o,headers:c,body:void 0});if(f){this.updateServiceEndpoint(p,f),this.setHostPrefix(p,e,s);let y=Mo(e.traits);if(y.http){p.method=y.http[0];let[g,S]=y.http[1].split("?");p.path=="/"?p.path=g:p.path+=g;let b=new URLSearchParams(S??"");for(let[C,I]of b)o[C]=I}}for(let[y,g]of u.structIterator()){let S=g.getMergedTraits()??{},b=s[y];if(b==null&&!g.isIdempotencyToken()){if(S.httpLabel&&(p.path.includes(`{${y}+}`)||p.path.includes(`{${y}}`)))throw new Error(`No value provided for input HTTP label: ${y}.`);continue}if(S.httpPayload)g.isStreaming()?g.isStructSchema()?s[y]&&(m=await this.serializeEventStream({eventStream:s[y],requestSchema:u})):m=b:(i.write(g,b),m=i.flush());else if(S.httpLabel){i.write(g,b);let C=i.flush();p.path.includes(`{${y}+}`)?p.path=p.path.replace(`{${y}+}`,C.split("/").map(rt).join("/")):p.path.includes(`{${y}}`)&&(p.path=p.path.replace(`{${y}}`,rt(C)))}else if(S.httpHeader)i.write(g,b),c[S.httpHeader.toLowerCase()]=String(i.flush());else if(typeof S.httpPrefixHeaders=="string")for(let C in b){if(!M(b,C))continue;let I=b[C],P=S.httpPrefixHeaders+C;i.write([g.getValueSchema(),{httpHeader:P}],I),c[P.toLowerCase()]=i.flush()}else S.httpQuery||S.httpQueryParams?this.serializeQuery(g,b,o):(l=!0,d.push(y),h.push(g))}if(l&&s){let[y,g]=(u.getName(!0)??"#Unknown").split("#"),S=u.getSchema()[6],b=[3,y,g,u.getMergedTraits(),d,h,void 0];S?b[6]=S:b.pop(),i.write(b,s),m=i.flush()}return p.headers=c,p.query=o,p.body=m,p}serializeQuery(e,r,n){let s=this.serializer,i=e.getMergedTraits();if(i.httpQueryParams){for(let o in r)if(M(r,o)&&!(o in n)){let c=r[o],f=e.getValueSchema();Object.assign(f.getMergedTraits(),{...i,httpQuery:o,httpQueryParams:void 0}),this.serializeQuery(f,c,n)}return}if(e.isListSchema()){let o=!!e.getMergedTraits().sparse,c=[];for(let f of r){s.write([e.getValueSchema(),i],f);let u=s.flush();(o||u!==void 0)&&c.push(u)}n[i.httpQuery]=c}else s.write([e,i],r),n[i.httpQuery]=s.flush()}async deserializeResponse(e,r,n){let s=this.deserializer,i=A.of(e.output),o={};if(n.statusCode>=300){let f=await Q(n.body,r);throw f.byteLength>0&&Object.assign(o,await s.read(15,f)),await this.handleError(e,r,n,o,this.deserializeMetadata(n)),new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(let f in n.headers){if(!M(n.headers,f))continue;let u=n.headers[f];delete n.headers[f],n.headers[f.toLowerCase()]=u}let c=await this.deserializeHttpMessage(i,r,n,o);if(c.length){let f=await Q(n.body,r);if(f.byteLength>0){let u=await s.read(i,f);for(let d of c)u[d]!=null&&(o[d]=u[d])}}else c.discardResponseBody&&await Q(n.body,r);return o.$metadata=this.deserializeMetadata(n),o}async deserializeHttpMessage(e,r,n,s,i){let o;s instanceof Set?o=i:o=s;let c=!0,f=this.deserializer,u=A.of(e),d=[];for(let[h,l]of u.structIterator()){let m=l.getMemberTraits();if(m.httpPayload){if(c=!1,l.isStreaming())l.isStructSchema()?o[h]=await this.deserializeEventStream({response:n,responseSchema:u}):o[h]=Hh(n.body);else if(n.body){let y=await Q(n.body,r);y.byteLength>0&&(o[h]=await f.read(l,y))}}else if(m.httpHeader){let p=String(m.httpHeader).toLowerCase(),y=n.headers[p];if(y!=null)if(l.isListSchema()){let g=l.getValueSchema();g.getMergedTraits().httpHeader=p;let S;g.isTimestampSchema()&&g.getSchema()===4?S=Vh(y,",",2):S=Io(y);let b=[];for(let C of S)b.push(await f.read(g,C.trim()));o[h]=b}else o[h]=await f.read(l,y)}else if(m.httpPrefixHeaders!==void 0){o[h]={};for(let p in n.headers)if(M(n.headers,p)&&p.startsWith(m.httpPrefixHeaders)){let y=n.headers[p],g=l.getValueSchema();g.getMergedTraits().httpHeader=p,o[h][p.slice(m.httpPrefixHeaders.length)]=await f.read(g,y)}}else m.httpResponseCode?o[h]=n.statusCode:d.push(h)}return d.discardResponseBody=c,d}},Xt=class extends nt{static{a(this,"RpcProtocol")}async serializeRequest(e,r,n){let s=this.serializer,i={},o={},c=await n.endpoint(),f=A.of(e?.input),u=f.getSchema(),d,h=r&&typeof r=="object"?r:{},l=new _e({protocol:"",hostname:"",port:void 0,path:"/",fragment:void 0,query:i,headers:o,body:void 0});if(c&&(this.updateServiceEndpoint(l,c),this.setHostPrefix(l,e,h)),h){let m=f.getEventStreamMember();if(m){if(h[m]){let p={};for(let[y]of f.structIterator())y!==m&&h[y]!=null&&(p[y]=h[y]);d=await this.serializeEventStream({eventStream:h[m],requestSchema:f,initialRequest:p})}}else s.write(u,h),d=s.flush()}return l.headers=Object.assign(l.headers,o),l.query=i,l.body=d,l.method="POST",l}async deserializeResponse(e,r,n){let s=this.deserializer,i=A.of(e.output),o={};if(n.statusCode>=300){let f=await Q(n.body,r);throw f.byteLength>0&&Object.assign(o,await s.read(15,f)),await this.handleError(e,r,n,o,this.deserializeMetadata(n)),new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.")}for(let f in n.headers){if(!M(n.headers,f))continue;let u=n.headers[f];delete n.headers[f],n.headers[f.toLowerCase()]=u}let c=i.getEventStreamMember();if(c)o[c]=await this.deserializeEventStream({response:n,responseSchema:i,initialResponseContainer:o});else{let f=await Q(n.body,r);f.byteLength>0&&Object.assign(o,await s.read(i,f))}return o.$metadata=this.deserializeMetadata(n),o}},$o=a((t,e,r,n,s,i)=>{if(e!=null&&e[r]!==void 0){let o=n();if(o==null||o.length<=0)throw new Error("Empty value provided for input HTTP label: "+r+".");t=t.replace(s,i?o.split("/").map(c=>rt(c)).join("/"):rt(o))}else throw new Error("No value provided for input HTTP label: "+r+".");return t},"resolvedPath");function tl(t,e){return new Yt(t,e)}a(tl,"requestBuilder");var Yt=class{static{a(this,"RequestBuilder")}input;context;query={};method="";headers={};path="";body=null;hostname="";resolvePathStack=[];constructor(e,r){this.input=e,this.context=r}async build(){let{hostname:e,protocol:r="https",port:n,path:s}=await this.context.endpoint();this.path=s;for(let i of this.resolvePathStack)i(this.path);return new _e({protocol:r,hostname:this.hostname||e,port:n,method:this.method,path:this.path,query:this.query,body:this.body,headers:this.headers})}hn(e){return this.hostname=e,this}bp(e){return this.resolvePathStack.push(r=>{this.path=`${r?.endsWith("/")?r.slice(0,-1):r||""}`+e}),this}p(e,r,n,s){return this.resolvePathStack.push(i=>{this.path=$o(i,this.input,e,r,n,s)}),this}h(e){return this.headers=e,this}q(e){return this.query=e,this}b(e){return this.body=e,this}m(e){return this.method=e,this}};function he(t,e){if(e.timestampFormat.useTrait&&t.isTimestampSchema()&&(t.getSchema()===5||t.getSchema()===6||t.getSchema()===7))return t.getSchema();let{httpLabel:r,httpPrefixHeaders:n,httpHeader:s,httpQuery:i}=t.getMergedTraits();return(e.httpBindings?typeof n=="string"||s?6:i||r?5:void 0:void 0)??e.timestampFormat.default}a(he,"determineTimestampFormat");var er=class extends ue{static{a(this,"FromStringShapeDeserializer")}settings;constructor(e){super(),this.settings=e}read(e,r){let n=A.of(e);if(n.isListSchema())return Io(r).map(s=>this.read(n.getValueSchema(),s));if(n.isBlobSchema())return(this.serdeContext?.base64Decoder??Zt)(r);if(n.isTimestampSchema())switch(he(n,this.settings)){case 5:return Gh(r);case 6:return Wh(r);case 7:return qh(r);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",r),new Date(r)}if(n.isStringSchema()){let s=n.getMergedTraits().mediaType,i=r;if(s)return n.getMergedTraits().httpHeader&&(i=this.base64ToUtf8(i)),(s==="application/json"||s.endsWith("+json"))&&(i=Oe.from(i)),i}return n.isNumericSchema()?Number(r):n.isBigIntegerSchema()?BigInt(r):n.isBigDecimalSchema()?new U(r,"bigDecimal"):n.isBooleanSchema()?String(r).toLowerCase()==="true":r}base64ToUtf8(e){return(this.serdeContext?.utf8Encoder??fr)((this.serdeContext?.base64Decoder??Zt)(e))}},Cn=class extends ue{static{a(this,"HttpInterceptingShapeDeserializer")}codecDeserializer;stringDeserializer;constructor(e,r){super(),this.codecDeserializer=e,this.stringDeserializer=new er(r)}setSerdeContext(e){this.stringDeserializer.setSerdeContext(e),this.codecDeserializer.setSerdeContext(e),this.serdeContext=e}read(e,r){let n=A.of(e),s=n.getMergedTraits(),i=this.serdeContext?.utf8Encoder??fr;if(s.httpHeader||s.httpResponseCode)return this.stringDeserializer.read(n,i(r));if(s.httpPayload){if(n.isBlobSchema()){let o=this.serdeContext?.utf8Decoder??Jh;return typeof r=="string"?o(r):r}else if(n.isStringSchema())return"byteLength"in r?i(r):r}return this.codecDeserializer.read(n,r)}},tr=class extends ue{static{a(this,"ToStringShapeSerializer")}settings;stringBuffer="";constructor(e){super(),this.settings=e}write(e,r){let n=A.of(e);switch(typeof r){case"object":if(r===null){this.stringBuffer="null";return}if(n.isTimestampSchema()){if(!(r instanceof Date))throw new Error(`@smithy/core/protocols - received non-Date value ${r} when schema expected Date in ${n.getName(!0)}`);switch(he(n,this.settings)){case 5:this.stringBuffer=r.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=Un(r);break;case 7:this.stringBuffer=String(r.getTime()/1e3);break;default:console.warn("Missing timestamp format, using epoch seconds",r),this.stringBuffer=String(r.getTime()/1e3)}return}if(n.isBlobSchema()&&"byteLength"in r){this.stringBuffer=(this.serdeContext?.base64Encoder??Ae)(r);return}if(n.isListSchema()&&Array.isArray(r)){let o="";for(let c of r){this.write([n.getValueSchema(),n.getMergedTraits()],c);let f=this.flush(),u=n.getValueSchema().isTimestampSchema()?f:Kh(f);o!==""&&(o+=", "),o+=u}this.stringBuffer=o;return}this.stringBuffer=JSON.stringify(r,null,2);break;case"string":let s=n.getMergedTraits().mediaType,i=r;if(s&&((s==="application/json"||s.endsWith("+json"))&&(i=Oe.from(i)),n.getMergedTraits().httpHeader)){this.stringBuffer=(this.serdeContext?.base64Encoder??Ae)(i.toString());return}this.stringBuffer=r;break;default:n.isIdempotencyToken()?this.stringBuffer=$n():this.stringBuffer=String(r)}}flush(){let e=this.stringBuffer;return this.stringBuffer="",e}},In=class{static{a(this,"HttpInterceptingShapeSerializer")}codecSerializer;stringSerializer;buffer;constructor(e,r,n=new tr(r)){this.codecSerializer=e,this.stringSerializer=n}setSerdeContext(e){this.codecSerializer.setSerdeContext(e),this.stringSerializer.setSerdeContext(e)}write(e,r){let n=A.of(e),s=n.getMergedTraits();if(s.httpHeader||s.httpLabel||s.httpQuery){this.stringSerializer.write(n,r),this.buffer=this.stringSerializer.flush();return}return this.codecSerializer.write(n,r)}flush(){if(this.buffer!==void 0){let e=this.buffer;return this.buffer=void 0,e}return this.codecSerializer.flush()}},Nn=class{static{a(this,"Field")}name;kind;values;constructor({name:e,kind:r=el.HEADER,values:n=[]}){this.name=e,this.kind=r,this.values=n}add(e){this.values.push(e)}set(e){this.values=e}remove(e){this.values=this.values.filter(r=>r!==e)}toString(){return this.values.map(e=>e.includes(",")||e.includes(" ")?`"${e}"`:e).join(", ")}get(){return this.values}},An=class{static{a(this,"Fields")}entries={};encoding;constructor({fields:e=[],encoding:r="utf-8"}){e.forEach(this.setField.bind(this)),this.encoding=r}setField(e){this.entries[e.name.toLowerCase()]=e}getField(e){return this.entries[e.toLowerCase()]}removeField(e){delete this.entries[e.toLowerCase()]}getByType(e){return Object.values(this.entries).filter(r=>r.kind===e)}},rl=a(t=>(t.logger&&t.logger.constructor?.name!=="NoOpLogger"&&t.requestHandler?.updateHttpClientConfig?.(Symbol.for("logger"),t.logger),{setHttpHandler(e){t.requestHandler=e},httpHandler(){return t.requestHandler},updateHttpClientConfig(e,r){t.requestHandler?.updateHttpClientConfig(e,r)},httpHandlerConfigs(){return t.requestHandler.httpHandlerConfigs()}}),"getHttpHandlerExtensionConfiguration"),nl=a(t=>({requestHandler:t.httpHandler()}),"resolveHttpHandlerRuntimeConfig"),yo="content-length";function Uo(t){return e=>async r=>{let n=r.request;if(_e.isInstance(n)){let{body:s,headers:i}=n;if(s&&Object.keys(i).map(o=>o.toLowerCase()).indexOf(yo)===-1)try{let o=t(s);o!=null&&(n.headers={...n.headers,[yo]:String(o)})}catch{}}return e({...r,request:n})}}a(Uo,"contentLengthMiddleware");var Do={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},sl=a(t=>({applyToStack:a(e=>{e.add(Uo(t.bodyLengthChecker),Do)},"applyToStack")}),"getContentLengthPlugin"),tt=a(t=>encodeURIComponent(t).replace(/[!'()*]/g,il),"escapeUri"),il=a(t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`,"hexEncode"),ol=a(t=>t.split("/").map(tt).join("/"),"escapeUriPath");function al(t){let e=[];for(let r of Object.keys(t).sort()){let n=t[r];if(r=tt(r),Array.isArray(n))for(let s=0,i=n.length;s<i;s++)e.push(`${r}=${tt(n[s])}`);else{let s=r;(n||typeof n=="string")&&(s+=`=${tt(n)}`),e.push(s)}}return e.join("&")}a(al,"buildQueryString");var re=class{static{a(this,"SerdeContextConfig")}serdeContext;setSerdeContext(e){this.serdeContext=e}},rr=class{static{a(this,"UnionSerde")}from;to;keys;constructor(e,r){this.from=e,this.to=r;let n=Object.keys(this.from),s=new Set(n);s.delete("__type"),this.keys=s}mark(e){this.keys.delete(e)}hasUnknown(){return this.keys.size===1&&Object.keys(this.to).length===0}writeUnknown(){if(this.hasUnknown()){let e=this.keys.values().next().value,r=this.from[e];this.to.$unknown=[e,r]}}},et;function Lo(){if(et===void 0)try{if(typeof Buffer!="function")et=!1;else{let t=JSON.parse(Buffer.from([123,125]));et=t!==null&&typeof t=="object"}}catch{et=!1}return et}a(Lo,"detectBufferParsing");function Dn(t,e,r){if(r?.source){let n=r.source;if(typeof e=="number")return e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER?fl(n,e)?e:new U(n,"bigDecimal"):cl(n)?new U(n,"bigDecimal"):/[eE]/.test(n)?ul(n):BigInt(n)}return e}a(Dn,"jsonReviver");function cl(t){let e=t.indexOf(".");if(e===-1)return!1;let r=t.search(/[eE]/);if(r===-1)return!0;let n=r-e-1;return parseInt(t.slice(r+1),10)<n}a(cl,"isFractionalBigNumeric");function fl(t,e){if(t===String(e)||Object.is(e,-0))return!0;if(/[eE]/.test(t))return Sn(t)===Sn(String(e));let r=t.replace(/(\.\d*?)0+$/,"$1").replace(/\.$/,""),n=String(e);return r===n?!0:/[eE]/.test(n)?r===Sn(n):!1}a(fl,"isRepresentable");function Sn(t){let e=t.startsWith("-"),r=e?t.slice(1):t,n=r.search(/[eE]/),s;if(n===-1)s=r;else{let i=parseInt(r.slice(n+1),10),o=r.slice(0,n),c=o.indexOf("."),f,u;c===-1?(f=o,u=o.length):(f=o.slice(0,c)+o.slice(c+1),u=c),f=f.replace(/0+$/,"")||"0";let d=u+i;f==="0"?s="0":d<=0?s="0."+"0".repeat(-d)+f:d>=f.length?s=f+"0".repeat(d-f.length):s=f.slice(0,d)+"."+f.slice(d)}return s.includes(".")&&(s=s.replace(/(\.\d*?)0+$/,"$1").replace(/\.$/,"")),(e?"-":"")+s}a(Sn,"expandToDecimal");function ul(t){let e=t.search(/[eE]/),r=parseInt(t.slice(e+1),10),n=t.startsWith("-"),s=t.slice(n?1:0,e),i=s.indexOf("."),o,c;if(i===-1)o=s,c=r;else{o=s.slice(0,i)+s.slice(i+1);let u=s.length-i-1;c=r-u}o=o.replace(/0+$/,"")||"0";let f=BigInt(o)*10n**BigInt(c+(s.replace(".","").length-o.length));return n?-f:f}a(ul,"expandExponentToBigInt");var wn=Symbol.for("@aws-sdk/reviver");function Ln(t){let e=A.of(t),r=e.getSchema();if(Array.isArray(r)&&e.isStructSchema()){if(wn in r)return r[wn];let n=nr(e,new Set);return r[wn]=n,n}return nr(e,new Set)}a(Ln,"needsReviver");function nr(t,e){let r=t.getSchema();if(e.has(r))return!1;if(e.add(r),t.isBigIntegerSchema()||t.isBigDecimalSchema())return!0;if(t.isStructSchema()){for(let[,n]of t.structIterator())if(nr(n,e))return!0}else if(t.isListSchema()||t.isMapSchema()){if(nr(t.getValueSchema(),e))return!0}else if(t.isDocumentSchema())return!0;return!1}a(nr,"_check");var hl=a((t,e)=>Q(t,e).then(r=>(e?.utf8Encoder??fr)(r)),"collectBodyString");async function ur(t,e,r){let n;if(Lo()&&typeof t?.[Symbol.asyncIterator]=="function"){let i=await Q(t,e);typeof Buffer=="function"&&(Buffer.isBuffer(i)?n=i:n=Buffer.from(i.buffer,i.byteOffset,i.byteLength))}if(n||(n=await hl(t,e)),n.length===0)return{};let s=r&&Ln(r)?Dn:void 0;try{return JSON.parse(n,s)}catch(i){throw i?.name==="SyntaxError"&&Object.defineProperty(i,"$responseBodyText",{value:typeof n=="string"?n:n.toString("utf8")}),i}}a(ur,"parseJsonBody");var ll=a(async(t,e)=>{let r=await ur(t,e);return r.message=r.message??r.Message,r},"parseJsonErrorBody"),So=a((t,e)=>Object.keys(t).find(r=>r.toLowerCase()===e.toLowerCase()),"findKey"),bn=a(t=>{let e=t;return typeof e=="number"&&(e=e.toString()),e.indexOf(",")>=0&&(e=e.split(",")[0]),e.indexOf(":")>=0&&(e=e.split(":")[0]),e.indexOf("#")>=0&&(e=e.split("#")[1]),e},"sanitizeErrorCode"),dl=a((t,e)=>Po(t,e,["header","code","type"]),"loadRestJsonErrorCode"),ml=a((t,e,r=!1)=>Po(t,e,r?["code","header","type"]:["type","code","header"]),"loadJsonRpcErrorCode"),ko=a((t,e)=>{if(e?.__type!==void 0){let r=e.__type;return typeof r=="number"&&(r=r.toString()),r.indexOf(",")>=0&&(r=r.split(",")[0]),r.indexOf(":")>=0&&(r=r.split(":")[0]),r}},"loadSmithyRpcV2JsonErrorCode"),Po=a(({headers:t},e,r)=>{for(;r.length>0;)switch(r.shift()){case"header":let s=So(t??{},"x-amzn-errortype");if(s!==void 0)return bn(t[s]);break;case"code":let i=So(e??{},"code");if(i&&e[i]!==void 0)return bn(e[i]);break;case"type":if(e?.__type!==void 0)return bn(e.__type);break}},"loadErrorCode");function fe(t){Object.defineProperty(t,"__proto__",{value:void 0,writable:!0,enumerable:!0,configurable:!0})}a(fe,"writeKey");var sr=class extends re{static{a(this,"JsonShapeDeserializer2")}settings;constructor(e){super(),this.settings=e}async read(e,r){let n=Ln(e)?Dn:void 0,s;if(typeof r=="string"){if(r.length===0)return{};s=JSON.parse(r,n)}else if(r instanceof Uint8Array&&Lo()){if(r.byteLength===0)return{};let i=Buffer.isBuffer(r)?r:Buffer.from(r.buffer,r.byteOffset,r.byteLength);s=JSON.parse(i,n)}else s=await ur(r,this.serdeContext,e);return this._read(e,s)}readObject(e,r){return this._read(e,r)}_read(e,r){let n=r!==null&&typeof r=="object",s=A.of(e);if(n){if(s.isStructSchema())return this._readStruct(s,r);if(Array.isArray(r)&&s.isListSchema()){let o=s.getValueSchema();if(this.needsTransform(o))for(let c=0;c<r.length;++c)r[c]=this._read(o,r[c]);return r}if(s.isMapSchema()){let o=s.getValueSchema(),c=r;if(this.needsTransform(o))for(let f in c)M(c,f)&&(f==="__proto__"&&fe(c),c[f]=this._read(o,c[f]));return c}}if(s.isBlobSchema()&&typeof r=="string")return Zt(r);let i=s.getMergedTraits().mediaType;if(s.isStringSchema()&&typeof r=="string"&&i)return i==="application/json"||i.endsWith("+json")?Oe.from(r):r;if(s.isTimestampSchema()&&r!=null)switch(he(s,this.settings)){case 5:return Oo(r);case 6:return Ao(r);case 7:return No(r);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",r),new Date(r)}if(s.isBigIntegerSchema()&&(typeof r=="number"||typeof r=="string"))return BigInt(r);if(s.isBigDecimalSchema()&&r!=null){if(r instanceof U)return r;let o=r;return o.type==="bigDecimal"&&"string"in o?new U(o.string,o.type):new U(String(r),"bigDecimal")}if(s.isNumericSchema()&&typeof r=="string"){switch(r){case"Infinity":return 1/0;case"-Infinity":return-1/0;case"NaN":return NaN}return r}if(s.isDocumentSchema()&&n)if(Array.isArray(r))for(let o=0;o<r.length;++o){let c=r[o];c instanceof U||(r[o]=this._read(s,c))}else{let o=r;for(let c in o){if(!M(o,c))continue;c==="__proto__"&&fe(o);let f=o[c];f instanceof U||(o[c]=this._read(s,f))}}return r}_readStruct(e,r){let n=e.isUnionSchema(),s={},i,o=typeof r.__type=="string",{jsonName:c}=this.settings;c&&o&&(i={});let f;n&&(f=new rr(r,s));for(let[u,d]of e.structIterator()){let h=u;c&&(h=d.getMergedTraits().jsonName??h,o&&(i[h]=u)),n&&f.mark(h),r[h]!=null&&(s[u]=this._read(d,r[h]))}if(n)f.writeUnknown();else if(o)for(let u in r){if(!M(r,u))continue;let d=r[u],h=c?i[u]??u:u;h in s||(s[h]=d)}return s}needsTransform(e){return!!(e.isBlobSchema()||e.isTimestampSchema()||e.isBigIntegerSchema()||e.isBigDecimalSchema()||e.isNumericSchema()||e.isDocumentSchema()||e.isStructSchema()||e.isListSchema()||e.isMapSchema()||e.isStringSchema()&&e.getMergedTraits().mediaType)}},On=class t extends Uint8Array{static{a(this,"JsonBytesStringAdapter")}string=null;static allocUnsafe(e){if(typeof Buffer=="function"){let r=Buffer.allocUnsafe(e);return new t(r.buffer,r.byteOffset,r.byteLength)}return new t(e)}toString(){return this.s()}valueOf(){return this.s()}includes(e,r){return typeof e=="string"?this.s().includes(e,r):Uint8Array.prototype.includes.call(this,e,r)}indexOf(e,r){return typeof e=="string"?this.s().indexOf(e,r):Uint8Array.prototype.indexOf.call(this,e,r)}lastIndexOf(e,r){if(typeof e=="string")return this.s().lastIndexOf(e,r);let n=Uint8Array.prototype.lastIndexOf;return r!==void 0?n.call(this,e,r):n.call(this,e)}startsWith(e,r){return this.s().startsWith(e,r)}endsWith(e,r){return this.s().endsWith(e,r)}match(e){return this.s().match(e)}replace(e,r){return this.s().replace(e,r)}search(e){return this.s().search(e)}split(e,r){return this.s().split(e,r)}substring(e,r){return this.s().substring(e,r)}trim(){return this.s().trim()}trimStart(){return this.s().trimStart()}trimEnd(){return this.s().trimEnd()}charAt(e){return this.s().charAt(e)}charCodeAt(e){return this.s().charCodeAt(e)}padStart(e,r){return this.s().padStart(e,r)}padEnd(e,r){return this.s().padEnd(e,r)}repeat(e){return this.s().repeat(e)}toUpperCase(){return this.s().toUpperCase()}toLowerCase(){return this.s().toLowerCase()}s(){if(this.string==null){let e=Date.now();e>wo+6e4&&(console.warn("@aws-sdk/core/protocols - WARN - JsonCodec2: you have called a string method on a Uint8Array request body. It has been automatically converted to string. In a future version this will throw an error."),wo=e),this.string=fr(this)}return this.string}},wo=0,Jt=new TextEncoder,bo=123,Eo=125,pl=91,gl=93,Ne=34,Kt=58,Qt=44,To=92,yl=new Uint8Array([116,114,117,101]),Sl=new Uint8Array([102,97,108,115,101]),wl=new Uint8Array([110,117,108,108]),W=new Array(128).fill(null);W[8]="b";W[9]="t";W[10]="n";W[12]="f";W[13]="r";W[34]='"';W[92]="\\";for(let t=0;t<32;t++)W[t]===null&&(W[t]="u00"+t.toString(16).padStart(2,"0"));var xo=2048;function En(t){return On.allocUnsafe(t)}a(En,"alloc");var ir=class t extends re{static{a(this,"JsonShapeSerializer2")}settings;json;i=0;rootSchema;rawValue;passthrough=!1;constructor(e){super(),this.settings=e,this.json=En(xo)}write(e,r){this.i=0,this.rawValue=r,this.rootSchema=A.of(e),this.passthrough=this.rootSchema.isBlobSchema()||this.rootSchema.isStringSchema(),this.passthrough||this.writeValue(this.rootSchema,r,void 0)}writeDiscriminatedDocument(e,r){this.i=0,this.rootSchema=A.of(e);let n=this.rootSchema;if(n.isStructSchema()&&r!=null&&typeof r=="object"){this.writeValue(n,r,void 0);let s=`"__type":"${n.getName(!0)??"Unknown"}",`,i=s.length;this.ensure(i),this.json.copyWithin(1+i,1,this.i),Jt.encodeInto(s,this.json.subarray(1)),this.i+=i}else this.writeValue(n,r,void 0)}flush(){this.rootSchema=void 0;let e=this.i;this.i=0;let r=this.rawValue;if(this.rawValue=void 0,e===0)return r;let n=this.json.subarray(0,e);return this.json=En(xo),n}ensure(e){let{i:r,json:n}=this;if(r+e>n.length){let s=n.length*2;for(;s<r+e;)s*=2;let i=En(s);i.set(this.json),this.json=i}}writeAscii(e){let r=e.length;this.ensure(r);let{i:n,json:s}=this;for(let i=0;i<r;++i)s[n]=e.charCodeAt(i),n+=1;this.i=n}writeAsciiQuoted(e){let r=e.length;this.ensure(r+4);let{json:n,i:s}=this;n[s++]=Ne;for(let i=0;i<r;++i)n[s++]=e.charCodeAt(i);n[s++]=Ne,this.i=s}writeJsonString(e){this.ensure(e.length*3+2),this.json[this.i++]=Ne;let r=e.length;for(let n=0;n<r;++n){let s=e.charCodeAt(n);if(s>34&&s<92)this.json[this.i++]=s;else if(s<128){let i=W[s];if(i!==null){this.ensure(i.length+1),this.json[this.i++]=To;for(let o=0;o<i.length;o++)this.json[this.i++]=i.charCodeAt(o)}else this.json[this.i++]=s}else if(s>=55296&&s<=56319){let i=n+1<r?e.charCodeAt(n+1):0;if(i>=56320&&i<=57343){this.ensure(4);let{written:o}=Jt.encodeInto(e.substring(n,n+2),this.json.subarray(this.i));this.i+=o,++n}else this.ensure(6),this.writeUnicodeEscape(s)}else if(s>=56320&&s<=57343)this.ensure(6),this.writeUnicodeEscape(s);else{let{i,json:o}=this;s<2048?(o[i++]=192|s>>6,o[i++]=128|s&63):(o[i++]=224|s>>12,o[i++]=128|s>>6&63,o[i++]=128|s&63),this.i=i}}this.json[this.i++]=Ne}writeUnicodeEscape(e){let{json:r,i:n}=this;r[n++]=To,r[n++]=117;let s=e.toString(16).padStart(4,"0");for(let i=0;i<4;++i)r[n++]=s.charCodeAt(i);this.i=n}static B64=(()=>{let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=new Uint8Array(64);for(let n=0;n<64;++n)r[n]=e.charCodeAt(n);return r})();writeBase64(e){let r=Math.ceil(e.length/3)*4;this.ensure(r+2);let n=this.json,s=t.B64,i=this.i;n[i++]=Ne;let o=e.length,c=o%3,f=o-c;for(let u=0;u<f;u+=3){let d=e[u],h=e[u+1],l=e[u+2];n[i++]=s[d>>2],n[i++]=s[(d&3)<<4|h>>4],n[i++]=s[(h&15)<<2|l>>6],n[i++]=s[l&63]}if(c===2){let u=e[f],d=e[f+1];n[i++]=s[u>>2],n[i++]=s[(u&3)<<4|d>>4],n[i++]=s[(d&15)<<2],n[i++]=61}else if(c===1){let u=e[f];n[i++]=s[u>>2],n[i++]=s[(u&3)<<4],n[i++]=61,n[i++]=61}n[i++]=Ne,this.i=i}writeValue(e,r,n){if(r==null){if(n?.isStructSchema()){if(r===void 0&&A.of(e).isIdempotencyToken()){this.writeAsciiQuoted($n());return}return}this.ensure(4),this.json.set(wl,this.i),this.i+=4;return}let s=A.of(e),i=typeof r=="object";if(s.isStringSchema()){let o=s.getMergedTraits().mediaType;if(o&&(o==="application/json"||o.endsWith("+json"))){this.writeJsonString(Oe.from(r).toString());return}}if(this.settings.bigNumberAsString&&r!=null&&(s.isBigIntegerSchema()||s.isBigDecimalSchema())){let o=r instanceof U?r.string:String(r);this.writeAsciiQuoted(o);return}if(i){if(s.isStructSchema()){this.writeStruct(s,r);return}if(Array.isArray(r)&&(s.isListSchema()||s.isDocumentSchema())){this.writeList(s,r,s.isDocumentSchema());return}if(s.isMapSchema()){this.writeMap(s,r,!1);return}if(r instanceof Uint8Array&&(s.isBlobSchema()||s.isDocumentSchema())){this.writeBase64(r);return}if(r instanceof Date&&(s.isTimestampSchema()||s.isDocumentSchema())){this.writeTimestamp(s,r);return}if(r instanceof U){this.writeAscii(r.string);return}if(s.isDocumentSchema()){Array.isArray(r)?this.writeList(s,r,!0):this.writeMap(s,r,!0);return}let o=JSON.stringify(r);this.writeAscii(o);return}if(typeof r=="string"){if(s.isBlobSchema()){let o=(this.serdeContext?.base64Encoder??Ae)(r);this.writeAsciiQuoted(o);return}this.writeJsonString(r);return}if(typeof r=="number"){if(Math.abs(r)===1/0||Number.isNaN(r)){this.writeAsciiQuoted(String(r));return}let o=String(r);this.writeAscii(o);return}if(typeof r=="boolean"){this.ensure(5);let{i:o,json:c}=this;r?(c.set(yl,o),o+=4):(c.set(Sl,o),o+=5),this.i=o;return}if(typeof r=="bigint"){this.writeAscii(r.toString());return}this.writeAscii(String(r))}writeStruct(e,r){this.ensure(2),this.json[this.i++]=bo;let n=!1,s=typeof r.__type=="string",i;s&&(i=new Set);for(let[o,c]of e.structIterator()){let f=r[o];if(f==null&&!c.isIdempotencyToken())continue;n&&(this.ensure(1),this.json[this.i++]=Qt),n=!0;let u=this.settings.jsonName?c.getMergedTraits().jsonName??o:o;i&&(i.add(o),i.add(u)),this.writeAsciiQuoted(u),this.json[this.i++]=Kt,this.writeValue(c,f,e)}if(!n&&e.isUnionSchema()){let{$unknown:o}=r;if(Array.isArray(o)){let[c,f]=o;this.writeAsciiQuoted(c),this.ensure(1),this.json[this.i++]=Kt,this.writeValue(15,f,e)}}else if(s)for(let o in r){if(i.has(o))continue;i.add(o);let c=r[o];n&&(this.ensure(1),this.json[this.i++]=Qt),n=!0,this.writeAsciiQuoted(o),this.ensure(1),this.json[this.i++]=Kt,this.writeValue(15,c,void 0)}this.ensure(1),this.json[this.i++]=Eo}writeList(e,r,n){let s=!!e.getMergedTraits().sparse,i=e.getValueSchema();if(!n&&(i.isStringSchema()||i.isNumericSchema()||i.isBooleanSchema())){let c=!1;for(let u=0;u<r.length;++u){let d=r[u];if(Number.isNaN(d)||d===1/0||d===-1/0||d==null&&!s){c=!0;break}}let f;if(!c)f=JSON.stringify(r);else{let u=[];for(let d=0;d<r.length;++d){let h=r[d];h==null&&!s||(Number.isNaN(h)||h===1/0||h===-1/0?u.push(String(h)):u.push(h))}f=JSON.stringify(u)}this.ensure(f.length*3),this.i+=Jt.encodeInto(f,this.json.subarray(this.i)).written;return}this.ensure(2),this.json[this.i++]=pl;let o=!1;for(let c=0;c<r.length;++c){let f=r[c];(n?f===void 0:f==null&&!s)||(o&&(this.ensure(1),this.json[this.i++]=Qt),this.writeValue(i,f,void 0),o=!0)}this.ensure(1),this.json[this.i++]=gl}writeMap(e,r,n){let s=!!e.getMergedTraits().sparse,i=e.getValueSchema();if(!n&&(i.isStringSchema()||i.isNumericSchema()||i.isBooleanSchema())){let c;for(let u in r){if(!M(r,u))continue;let d=r[u];Number.isNaN(d)||d===1/0||d===-1/0?((c??={})[u]=d,r[u]=String(d)):d===null&&!s&&((c??={})[u]=null,r[u]=void 0)}let f=JSON.stringify(r);c&&Object.assign(r,c),this.ensure(f.length*3),this.i+=Jt.encodeInto(f,this.json.subarray(this.i)).written;return}this.ensure(2),this.json[this.i++]=bo;let o=!0;for(let c in r){if(!M(r,c))continue;let f=r[c];(n?f===void 0:f==null&&!s)||(o||(this.ensure(1),this.json[this.i++]=Qt),o=!1,this.writeJsonString(c),this.ensure(1),this.json[this.i++]=Kt,this.writeValue(i,f,void 0))}this.ensure(1),this.json[this.i++]=Eo}writeTimestamp(e,r){switch(he(e,this.settings)){case 5:{let s=r.toISOString().replace(".000Z","Z");this.writeAsciiQuoted(s);return}case 6:{this.writeAsciiQuoted(Un(r));return}case 7:{let s=String(r.getTime()/1e3);this.writeAscii(s);return}default:{let s=String(r.getTime()/1e3);this.writeAscii(s);return}}}},or=class extends re{static{a(this,"JsonCodec2")}settings;constructor(e){super(),this.settings=e}createSerializer(){let e=new ir(this.settings);return e.setSerdeContext(this.serdeContext),e}createDeserializer(){let e=new sr(this.settings);return e.setSerdeContext(this.serdeContext),e}},_n=class extends Xt{static{a(this,"SmithyRpcV2JsonProtocol")}codec=new or({timestampFormat:{useTrait:!1,default:7},jsonName:!1,bigNumberAsString:!0});serializer=this.codec.createSerializer();deserializer=this.codec.createDeserializer();constructor({defaultNamespace:e,errorTypeRegistries:r}){super({defaultNamespace:e,errorTypeRegistries:r})}getShapeId(){return"smithy.protocols#rpcv2Json"}getPayloadCodec(){return this.codec}async serializeRequest(e,r,n){let s=await super.serializeRequest(e,r,n);Object.assign(s.headers,{"content-type":this.getDefaultContentType(),"smithy-protocol":"rpc-v2-json",accept:this.getDefaultContentType()}),Yh(e.input)==="unit"?(delete s.body,delete s.headers["content-type"]):s.body||(s.body="{}");let{service:i,operation:o}=Qh(n),c=`/service/${i}/operation/${o}`;return s.path.endsWith("/")?s.path+=c.slice(1):s.path+=c,s}async deserializeResponse(e,r,n){return super.deserializeResponse(e,r,n)}async handleError(e,r,n,s,i){let o=ko(n,s)??"Unknown",c={$metadata:i,$fault:n.statusCode<=500?"client":"server"},f=this.options.defaultNamespace;o.includes("#")&&([f]=o.split("#"));let u=this.compositeErrorRegistry,d=Tn.for(f);u.copyFrom(d);let h;try{h=u.getSchema(o)}catch{s.Message&&(s.message=s.Message);let C=Tn.for("smithy.ts.sdk.synthetic."+f);u.copyFrom(C);let I=u.getBaseException();if(I){let P=u.getErrorCtor(I);throw Object.assign(new P({name:o}),c,s)}throw Object.assign(new Error(o),c,s)}let l=A.of(h),m=u.getErrorCtor(h),p=s.message??s.Message??"Unknown",y=new m({}),g={},S=this.codec.createDeserializer();for(let[b,C]of l.structIterator())s[b]!=null&&(g[b]=S.readObject(C,s[b]));throw Object.assign(y,c,{$fault:l.getMergedTraits().error,message:p},g)}getDefaultContentType(){return"application/json"}},ar=class extends re{static{a(this,"JsonShapeDeserializer")}settings;constructor(e){super(),this.settings=e}async read(e,r){let n=Ln(e)?Dn:void 0;return this._read(e,typeof r=="string"?JSON.parse(r,n):await ur(r,this.serdeContext,e))}readObject(e,r){return this._read(e,r)}_read(e,r){let n=r!==null&&typeof r=="object",s=A.of(e);if(n){if(s.isStructSchema()){let o=r,c=s.isUnionSchema(),f={},u,{jsonName:d}=this.settings;d&&(u={});let h;c&&(h=new rr(o,f));for(let[l,m]of s.structIterator()){let p=l;d&&(p=m.getMergedTraits().jsonName??p,u[p]=l),c&&h.mark(p),o[p]!=null&&(f[l]=this._read(m,o[p]))}if(c)h.writeUnknown();else if(typeof o.__type=="string")for(let l in o){if(!M(o,l))continue;let m=o[l],p=d?u[l]??l:l;p in f||(f[p]=m)}return f}if(Array.isArray(r)&&s.isListSchema()){let o=s.getValueSchema(),c=[];for(let f of r)c.push(this._read(o,f));return c}if(s.isMapSchema()){let o=s.getValueSchema(),c={};for(let f in r)M(r,f)&&(f==="__proto__"&&fe(c),c[f]=this._read(o,r[f]));return c}}if(s.isBlobSchema()&&typeof r=="string")return Zt(r);let i=s.getMergedTraits().mediaType;if(s.isStringSchema()&&typeof r=="string"&&i)return i==="application/json"||i.endsWith("+json")?Oe.from(r):r;if(s.isTimestampSchema()&&r!=null)switch(he(s,this.settings)){case 5:return Oo(r);case 6:return Ao(r);case 7:return No(r);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",r),new Date(r)}if(s.isBigIntegerSchema()&&(typeof r=="number"||typeof r=="string"))return BigInt(r);if(s.isBigDecimalSchema()&&r!=null){if(r instanceof U)return r;let o=r;return o.type==="bigDecimal"&&"string"in o?new U(o.string,o.type):new U(String(r),"bigDecimal")}if(s.isNumericSchema()&&typeof r=="string"){switch(r){case"Infinity":return 1/0;case"-Infinity":return-1/0;case"NaN":return NaN}return r}if(s.isDocumentSchema())if(n){let o=Array.isArray(r)?[]:{};for(let c in r){if(!M(r,c))continue;c==="__proto__"&&fe(o);let f=r[c];f instanceof U?o[c]=f:o[c]=this._read(s,f)}return o}else return structuredClone(r);return r}},Co="\u039D",Rn=class{static{a(this,"JsonReplacer")}values=new Map;counter=0;stage=0;createReplacer(){if(this.stage===1)throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");return this.stage=1,(e,r)=>{if(r instanceof U){let n=`${Co+"nv"+this.counter++}_`+r.string;return this.values.set(`"${n}"`,r.string),n}if(typeof r=="bigint"){let n=r.toString(),s=`${Co+"b"+this.counter++}_`+n;return this.values.set(`"${s}"`,n),s}return r}}replaceInJson(e){if(this.stage===0)throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");if(this.stage=2,this.counter===0)return e;for(let[r,n]of this.values)e=e.replace(r,n);return e}},cr=class extends re{static{a(this,"JsonShapeSerializer")}settings;buffer;useReplacer=!1;rootSchema;constructor(e){super(),this.settings=e}write(e,r){this.rootSchema=A.of(e),this.buffer=this._write(this.rootSchema,r)}flush(){let{rootSchema:e,useReplacer:r}=this;if(this.rootSchema=void 0,this.useReplacer=!1,e?.isStructSchema()||e?.isDocumentSchema()){if(!r)return JSON.stringify(this.buffer);let n=new Rn;return n.replaceInJson(JSON.stringify(this.buffer,n.createReplacer(),0))}return this.buffer}writeDiscriminatedDocument(e,r){this.write(e,r),typeof this.buffer=="object"&&(this.buffer.__type=A.of(e).getName(!0))}_write(e,r,n){let s=r!==null&&typeof r=="object",i=A.of(e);if(s){if(i.isStructSchema()){let o=r,c={},{jsonName:f}=this.settings,u;f&&(u={});let d=0;for(let[h,l]of i.structIterator()){let m=this._write(l,o[h],i);if(m!==void 0){let p=h;f&&(p=l.getMergedTraits().jsonName??h,u[h]=p),c[p]=m,d++}}if(i.isUnionSchema()&&d===0){let{$unknown:h}=o;if(Array.isArray(h)){let[l,m]=h;l==="__proto__"&&fe(c),c[l]=this._write(15,m)}}else if(typeof o.__type=="string")for(let h in o){if(!M(o,h))continue;let l=o[h],m=f?u[h]??h:h;m in c||(c[m]=this._write(15,l))}return c}if(Array.isArray(r)&&i.isListSchema()){let o=i.getValueSchema(),c=[],f=!!i.getMergedTraits().sparse;for(let u of r)(f||u!=null)&&c.push(this._write(o,u));return c}if(i.isMapSchema()){let o=i.getValueSchema(),c={},f=!!i.getMergedTraits().sparse;for(let u in r){if(!M(r,u))continue;let d=r[u];(f||d!=null)&&(u==="__proto__"&&fe(c),c[u]=this._write(o,d))}return c}if(r instanceof Uint8Array&&i.isBlobSchema())return i===this.rootSchema?r:(this.serdeContext?.base64Encoder??Ae)(r);if(r instanceof Date&&(i.isTimestampSchema()||i.isDocumentSchema()))switch(he(i,this.settings)){case 5:return r.toISOString().replace(".000Z","Z");case 6:return Un(r);case 7:return r.getTime()/1e3;default:return console.warn("Missing timestamp format, using epoch seconds",r),r.getTime()/1e3}r instanceof U&&(this.useReplacer=!0)}if(!(r===null&&n?.isStructSchema())){if(i.isStringSchema()){if(typeof r>"u"&&i.isIdempotencyToken())return $n();let o=i.getMergedTraits().mediaType;return r!=null&&o&&(o==="application/json"||o.endsWith("+json"))?Oe.from(r):r}if(typeof r=="number")return Math.abs(r)===1/0||isNaN(r)?String(r):r;if(typeof r=="string"&&i.isBlobSchema())return i===this.rootSchema?r:(this.serdeContext?.base64Encoder??Ae)(r);if(typeof r=="bigint"&&(this.useReplacer=!0),i.isDocumentSchema())if(s){if(r instanceof Uint8Array)return(this.serdeContext?.base64Encoder??Ae)(r);let o=Array.isArray(r)?[]:{};for(let c in r){if(!M(r,c))continue;let f=r[c];c==="__proto__"&&fe(o),f instanceof U?(this.useReplacer=!0,o[c]=f):o[c]=this._write(i,f)}return o}else return structuredClone(r);return r}}},Mn=class extends re{static{a(this,"JsonCodec")}settings;constructor(e){super(),this.settings=e}createSerializer(){let e=new cr(this.settings);return e.setSerdeContext(this.serdeContext),e}createDeserializer(){let e=new ar(this.settings);return e.setSerdeContext(this.serdeContext),e}};T.Field=Nn;T.Fields=An;T.FromStringShapeDeserializer=er;T.HttpBindingProtocol=xn;T.HttpInterceptingShapeDeserializer=Cn;T.HttpInterceptingShapeSerializer=In;T.HttpProtocol=nt;T.JsonCodec=Mn;T.JsonCodec2=or;T.JsonShapeDeserializer=ar;T.JsonShapeDeserializer2=sr;T.JsonShapeSerializer=cr;T.JsonShapeSerializer2=ir;T.RequestBuilder=Yt;T.RpcProtocol=Xt;T.SerdeContext=ue;T.SmithyRpcV2JsonProtocol=_n;T.ToStringShapeSerializer=tr;T.buildQueryString=al;T.collectBody=Q;T.contentLengthMiddleware=Uo;T.contentLengthMiddlewareOptions=Do;T.determineTimestampFormat=he;T.escapeUri=tt;T.escapeUriPath=ol;T.extendedEncodeURIComponent=rt;T.getContentLengthPlugin=sl;T.getHttpHandlerExtensionConfiguration=rl;T.loadJsonRpcErrorCode=ml;T.loadRestJsonErrorCode=dl;T.loadSmithyRpcV2JsonErrorCode=ko;T.parseJsonBody=ur;T.parseJsonErrorBody=ll;T.requestBuilder=tl;T.resolveHttpHandlerRuntimeConfig=nl;T.resolvedPath=$o});export{de as a,me as b,j as c,yt as d,bs as e,qs as f,gi as g,Lt as h,co as i,bl as j};