@etainabl/nodejs-sdk 1.3.110 → 1.3.112

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 (49) hide show
  1. package/dist/esm/chunk-3YGWW265.js +64 -0
  2. package/dist/esm/chunk-3YGWW265.js.map +1 -0
  3. package/dist/esm/chunk-BIVFO5LG.js +2476 -0
  4. package/dist/esm/chunk-BIVFO5LG.js.map +1 -0
  5. package/dist/esm/chunk-CIKXN3GS.js +64 -0
  6. package/dist/esm/chunk-CIKXN3GS.js.map +1 -0
  7. package/dist/esm/chunk-E6O4HVLA.js +121 -0
  8. package/dist/esm/chunk-E6O4HVLA.js.map +1 -0
  9. package/dist/esm/chunk-HAEAETXR.js +210 -0
  10. package/dist/esm/chunk-HAEAETXR.js.map +1 -0
  11. package/dist/esm/chunk-ITSE4X2J.js +1733 -0
  12. package/dist/esm/chunk-ITSE4X2J.js.map +1 -0
  13. package/dist/esm/chunk-OWL7NKW5.js +47 -0
  14. package/dist/esm/chunk-OWL7NKW5.js.map +1 -0
  15. package/dist/esm/chunk-R63LRFTI.js +153 -0
  16. package/dist/esm/chunk-R63LRFTI.js.map +1 -0
  17. package/dist/esm/chunk-UFTVLHTW.js +114 -0
  18. package/dist/esm/chunk-UFTVLHTW.js.map +1 -0
  19. package/dist/esm/chunk-UZGMBQZB.js +13 -0
  20. package/dist/esm/chunk-UZGMBQZB.js.map +1 -0
  21. package/dist/esm/chunk-XXAWQ5GA.js +3359 -0
  22. package/dist/esm/chunk-XXAWQ5GA.js.map +1 -0
  23. package/dist/esm/dist-es-4ZHJVMJ4.js +21 -0
  24. package/dist/esm/dist-es-4ZHJVMJ4.js.map +1 -0
  25. package/dist/esm/dist-es-FD7XXZCE.js +305 -0
  26. package/dist/esm/dist-es-FD7XXZCE.js.map +1 -0
  27. package/dist/esm/dist-es-MXGFLXV2.js +379 -0
  28. package/dist/esm/dist-es-MXGFLXV2.js.map +1 -0
  29. package/dist/esm/dist-es-QPNGCVTW.js +67 -0
  30. package/dist/esm/dist-es-QPNGCVTW.js.map +1 -0
  31. package/dist/esm/dist-es-RHLCSE2G.js +200 -0
  32. package/dist/esm/dist-es-RHLCSE2G.js.map +1 -0
  33. package/dist/esm/dist-es-X5IH3XCT.js +88 -0
  34. package/dist/esm/dist-es-X5IH3XCT.js.map +1 -0
  35. package/dist/esm/dist-es-XEM2CDDP.js +163 -0
  36. package/dist/esm/dist-es-XEM2CDDP.js.map +1 -0
  37. package/dist/esm/index.js +4299 -81
  38. package/dist/esm/index.js.map +1 -1
  39. package/dist/esm/loadSso-3QBKTJF3.js +655 -0
  40. package/dist/esm/loadSso-3QBKTJF3.js.map +1 -0
  41. package/dist/esm/sso-oidc-GZ3LZ3MF.js +827 -0
  42. package/dist/esm/sso-oidc-GZ3LZ3MF.js.map +1 -0
  43. package/dist/esm/sts-CIQKG7FB.js +1162 -0
  44. package/dist/esm/sts-CIQKG7FB.js.map +1 -0
  45. package/dist/index.d.cts +176 -82
  46. package/dist/index.d.ts +176 -82
  47. package/dist/index.js +21923 -1147
  48. package/dist/index.js.map +1 -1
  49. package/package.json +4 -2
@@ -0,0 +1,3359 @@
1
+ import {
2
+ loadConfig,
3
+ parseUrl
4
+ } from "./chunk-UFTVLHTW.js";
5
+ import {
6
+ HttpRequest,
7
+ HttpResponse,
8
+ NoOpLogger,
9
+ collectBody,
10
+ escapeUri,
11
+ fromArrayBuffer,
12
+ fromHex,
13
+ fromString,
14
+ fromUtf8,
15
+ getSmithyContext,
16
+ isArrayBuffer,
17
+ normalizeProvider,
18
+ toHex,
19
+ toUint8Array
20
+ } from "./chunk-BIVFO5LG.js";
21
+ import {
22
+ CONFIG_PREFIX_SEPARATOR
23
+ } from "./chunk-HAEAETXR.js";
24
+ import {
25
+ setCredentialFeature
26
+ } from "./chunk-UZGMBQZB.js";
27
+ import {
28
+ EndpointURLScheme
29
+ } from "./chunk-3YGWW265.js";
30
+ import {
31
+ ProviderError,
32
+ memoize
33
+ } from "./chunk-R63LRFTI.js";
34
+
35
+ // node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/resolveAuthOptions.js
36
+ var resolveAuthOptions = (candidateAuthOptions, authSchemePreference) => {
37
+ if (!authSchemePreference || authSchemePreference.length === 0) {
38
+ return candidateAuthOptions;
39
+ }
40
+ const preferredAuthOptions = [];
41
+ for (const preferredSchemeName of authSchemePreference) {
42
+ for (const candidateAuthOption of candidateAuthOptions) {
43
+ const candidateAuthSchemeName = candidateAuthOption.schemeId.split("#")[1];
44
+ if (candidateAuthSchemeName === preferredSchemeName) {
45
+ preferredAuthOptions.push(candidateAuthOption);
46
+ }
47
+ }
48
+ }
49
+ for (const candidateAuthOption of candidateAuthOptions) {
50
+ if (!preferredAuthOptions.find(({ schemeId }) => schemeId === candidateAuthOption.schemeId)) {
51
+ preferredAuthOptions.push(candidateAuthOption);
52
+ }
53
+ }
54
+ return preferredAuthOptions;
55
+ };
56
+
57
+ // node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/httpAuthSchemeMiddleware.js
58
+ function convertHttpAuthSchemesToMap(httpAuthSchemes) {
59
+ const map = /* @__PURE__ */ new Map();
60
+ for (const scheme of httpAuthSchemes) {
61
+ map.set(scheme.schemeId, scheme);
62
+ }
63
+ return map;
64
+ }
65
+ var httpAuthSchemeMiddleware = (config, mwOptions) => (next, context) => async (args) => {
66
+ const options = config.httpAuthSchemeProvider(await mwOptions.httpAuthSchemeParametersProvider(config, context, args.input));
67
+ const authSchemePreference = config.authSchemePreference ? await config.authSchemePreference() : [];
68
+ const resolvedOptions = resolveAuthOptions(options, authSchemePreference);
69
+ const authSchemes = convertHttpAuthSchemesToMap(config.httpAuthSchemes);
70
+ const smithyContext = getSmithyContext(context);
71
+ const failureReasons = [];
72
+ for (const option of resolvedOptions) {
73
+ const scheme = authSchemes.get(option.schemeId);
74
+ if (!scheme) {
75
+ failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` was not enabled for this service.`);
76
+ continue;
77
+ }
78
+ const identityProvider = scheme.identityProvider(await mwOptions.identityProviderConfigProvider(config));
79
+ if (!identityProvider) {
80
+ failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` did not have an IdentityProvider configured.`);
81
+ continue;
82
+ }
83
+ const { identityProperties = {}, signingProperties = {} } = option.propertiesExtractor?.(config, context) || {};
84
+ option.identityProperties = Object.assign(option.identityProperties || {}, identityProperties);
85
+ option.signingProperties = Object.assign(option.signingProperties || {}, signingProperties);
86
+ smithyContext.selectedHttpAuthScheme = {
87
+ httpAuthOption: option,
88
+ identity: await identityProvider(option.identityProperties),
89
+ signer: scheme.signer
90
+ };
91
+ break;
92
+ }
93
+ if (!smithyContext.selectedHttpAuthScheme) {
94
+ throw new Error(failureReasons.join("\n"));
95
+ }
96
+ return next(args);
97
+ };
98
+
99
+ // node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/getHttpAuthSchemeEndpointRuleSetPlugin.js
100
+ var httpAuthSchemeEndpointRuleSetMiddlewareOptions = {
101
+ step: "serialize",
102
+ tags: ["HTTP_AUTH_SCHEME"],
103
+ name: "httpAuthSchemeMiddleware",
104
+ override: true,
105
+ relation: "before",
106
+ toMiddleware: "endpointV2Middleware"
107
+ };
108
+ var getHttpAuthSchemeEndpointRuleSetPlugin = (config, { httpAuthSchemeParametersProvider, identityProviderConfigProvider }) => ({
109
+ applyToStack: (clientStack) => {
110
+ clientStack.addRelativeTo(httpAuthSchemeMiddleware(config, {
111
+ httpAuthSchemeParametersProvider,
112
+ identityProviderConfigProvider
113
+ }), httpAuthSchemeEndpointRuleSetMiddlewareOptions);
114
+ }
115
+ });
116
+
117
+ // node_modules/@smithy/middleware-serde/dist-es/deserializerMiddleware.js
118
+ var deserializerMiddleware = (options, deserializer) => (next, context) => async (args) => {
119
+ const { response } = await next(args);
120
+ try {
121
+ const parsed = await deserializer(response, options);
122
+ return {
123
+ response,
124
+ output: parsed
125
+ };
126
+ } catch (error) {
127
+ Object.defineProperty(error, "$response", {
128
+ value: response
129
+ });
130
+ if (!("$metadata" in error)) {
131
+ const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;
132
+ try {
133
+ error.message += "\n " + hint;
134
+ } catch (e) {
135
+ if (!context.logger || context.logger?.constructor?.name === "NoOpLogger") {
136
+ console.warn(hint);
137
+ } else {
138
+ context.logger?.warn?.(hint);
139
+ }
140
+ }
141
+ if (typeof error.$responseBodyText !== "undefined") {
142
+ if (error.$response) {
143
+ error.$response.body = error.$responseBodyText;
144
+ }
145
+ }
146
+ try {
147
+ if (HttpResponse.isInstance(response)) {
148
+ const { headers = {} } = response;
149
+ const headerEntries = Object.entries(headers);
150
+ error.$metadata = {
151
+ httpStatusCode: response.statusCode,
152
+ requestId: findHeader(/^x-[\w-]+-request-?id$/, headerEntries),
153
+ extendedRequestId: findHeader(/^x-[\w-]+-id-2$/, headerEntries),
154
+ cfId: findHeader(/^x-[\w-]+-cf-id$/, headerEntries)
155
+ };
156
+ }
157
+ } catch (e) {
158
+ }
159
+ }
160
+ throw error;
161
+ }
162
+ };
163
+ var findHeader = (pattern, headers) => {
164
+ return (headers.find(([k]) => {
165
+ return k.match(pattern);
166
+ }) || [void 0, void 0])[1];
167
+ };
168
+
169
+ // node_modules/@smithy/middleware-serde/dist-es/serializerMiddleware.js
170
+ var serializerMiddleware = (options, serializer) => (next, context) => async (args) => {
171
+ const endpointConfig = options;
172
+ const endpoint = context.endpointV2?.url && endpointConfig.urlParser ? async () => endpointConfig.urlParser(context.endpointV2.url) : endpointConfig.endpoint;
173
+ if (!endpoint) {
174
+ throw new Error("No valid endpoint provider available.");
175
+ }
176
+ const request = await serializer(args.input, { ...options, endpoint });
177
+ return next({
178
+ ...args,
179
+ request
180
+ });
181
+ };
182
+
183
+ // node_modules/@smithy/middleware-serde/dist-es/serdePlugin.js
184
+ var deserializerMiddlewareOption = {
185
+ name: "deserializerMiddleware",
186
+ step: "deserialize",
187
+ tags: ["DESERIALIZER"],
188
+ override: true
189
+ };
190
+ var serializerMiddlewareOption = {
191
+ name: "serializerMiddleware",
192
+ step: "serialize",
193
+ tags: ["SERIALIZER"],
194
+ override: true
195
+ };
196
+ function getSerdePlugin(config, serializer, deserializer) {
197
+ return {
198
+ applyToStack: (commandStack) => {
199
+ commandStack.add(deserializerMiddleware(config, deserializer), deserializerMiddlewareOption);
200
+ commandStack.add(serializerMiddleware(config, serializer), serializerMiddlewareOption);
201
+ }
202
+ };
203
+ }
204
+
205
+ // node_modules/@smithy/core/dist-es/middleware-http-signing/httpSigningMiddleware.js
206
+ var defaultErrorHandler = (signingProperties) => (error) => {
207
+ throw error;
208
+ };
209
+ var defaultSuccessHandler = (httpResponse, signingProperties) => {
210
+ };
211
+ var httpSigningMiddleware = (config) => (next, context) => async (args) => {
212
+ if (!HttpRequest.isInstance(args.request)) {
213
+ return next(args);
214
+ }
215
+ const smithyContext = getSmithyContext(context);
216
+ const scheme = smithyContext.selectedHttpAuthScheme;
217
+ if (!scheme) {
218
+ throw new Error(`No HttpAuthScheme was selected: unable to sign request`);
219
+ }
220
+ const { httpAuthOption: { signingProperties = {} }, identity, signer } = scheme;
221
+ const output = await next({
222
+ ...args,
223
+ request: await signer.sign(args.request, identity, signingProperties)
224
+ }).catch((signer.errorHandler || defaultErrorHandler)(signingProperties));
225
+ (signer.successHandler || defaultSuccessHandler)(output.response, signingProperties);
226
+ return output;
227
+ };
228
+
229
+ // node_modules/@smithy/core/dist-es/middleware-http-signing/getHttpSigningMiddleware.js
230
+ var httpSigningMiddlewareOptions = {
231
+ step: "finalizeRequest",
232
+ tags: ["HTTP_SIGNING"],
233
+ name: "httpSigningMiddleware",
234
+ aliases: ["apiKeyMiddleware", "tokenMiddleware", "awsAuthMiddleware"],
235
+ override: true,
236
+ relation: "after",
237
+ toMiddleware: "retryMiddleware"
238
+ };
239
+ var getHttpSigningPlugin = (config) => ({
240
+ applyToStack: (clientStack) => {
241
+ clientStack.addRelativeTo(httpSigningMiddleware(config), httpSigningMiddlewareOptions);
242
+ }
243
+ });
244
+
245
+ // node_modules/@smithy/core/dist-es/util-identity-and-auth/DefaultIdentityProviderConfig.js
246
+ var DefaultIdentityProviderConfig = class {
247
+ constructor(config) {
248
+ this.authSchemes = /* @__PURE__ */ new Map();
249
+ for (const [key, value] of Object.entries(config)) {
250
+ if (value !== void 0) {
251
+ this.authSchemes.set(key, value);
252
+ }
253
+ }
254
+ }
255
+ getIdentityProvider(schemeId) {
256
+ return this.authSchemes.get(schemeId);
257
+ }
258
+ };
259
+
260
+ // node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/getHttpAuthSchemePlugin.js
261
+ var httpAuthSchemeMiddlewareOptions = {
262
+ step: "serialize",
263
+ tags: ["HTTP_AUTH_SCHEME"],
264
+ name: "httpAuthSchemeMiddleware",
265
+ override: true,
266
+ relation: "before",
267
+ toMiddleware: serializerMiddlewareOption.name
268
+ };
269
+
270
+ // node_modules/@smithy/core/dist-es/normalizeProvider.js
271
+ var normalizeProvider2 = (input) => {
272
+ if (typeof input === "function")
273
+ return input;
274
+ const promisified = Promise.resolve(input);
275
+ return () => promisified;
276
+ };
277
+
278
+ // node_modules/@smithy/core/dist-es/setFeature.js
279
+ function setFeature(context, feature, value) {
280
+ if (!context.__smithy_context) {
281
+ context.__smithy_context = {
282
+ features: {}
283
+ };
284
+ } else if (!context.__smithy_context.features) {
285
+ context.__smithy_context.features = {};
286
+ }
287
+ context.__smithy_context.features[feature] = value;
288
+ }
289
+
290
+ // node_modules/@smithy/core/dist-es/util-identity-and-auth/httpAuthSchemes/noAuth.js
291
+ var NoAuthSigner = class {
292
+ async sign(httpRequest, identity, signingProperties) {
293
+ return httpRequest;
294
+ }
295
+ };
296
+
297
+ // node_modules/@smithy/core/dist-es/util-identity-and-auth/memoizeIdentityProvider.js
298
+ var createIsIdentityExpiredFunction = (expirationMs) => (identity) => doesIdentityRequireRefresh(identity) && identity.expiration.getTime() - Date.now() < expirationMs;
299
+ var EXPIRATION_MS = 3e5;
300
+ var isIdentityExpired = createIsIdentityExpiredFunction(EXPIRATION_MS);
301
+ var doesIdentityRequireRefresh = (identity) => identity.expiration !== void 0;
302
+ var memoizeIdentityProvider = (provider, isExpired, requiresRefresh) => {
303
+ if (provider === void 0) {
304
+ return void 0;
305
+ }
306
+ const normalizedProvider = typeof provider !== "function" ? async () => Promise.resolve(provider) : provider;
307
+ let resolved;
308
+ let pending;
309
+ let hasResult;
310
+ let isConstant = false;
311
+ const coalesceProvider = async (options) => {
312
+ if (!pending) {
313
+ pending = normalizedProvider(options);
314
+ }
315
+ try {
316
+ resolved = await pending;
317
+ hasResult = true;
318
+ isConstant = false;
319
+ } finally {
320
+ pending = void 0;
321
+ }
322
+ return resolved;
323
+ };
324
+ if (isExpired === void 0) {
325
+ return async (options) => {
326
+ if (!hasResult || options?.forceRefresh) {
327
+ resolved = await coalesceProvider(options);
328
+ }
329
+ return resolved;
330
+ };
331
+ }
332
+ return async (options) => {
333
+ if (!hasResult || options?.forceRefresh) {
334
+ resolved = await coalesceProvider(options);
335
+ }
336
+ if (isConstant) {
337
+ return resolved;
338
+ }
339
+ if (!requiresRefresh(resolved)) {
340
+ isConstant = true;
341
+ return resolved;
342
+ }
343
+ if (isExpired(resolved)) {
344
+ await coalesceProvider(options);
345
+ return resolved;
346
+ }
347
+ return resolved;
348
+ };
349
+ };
350
+
351
+ // node_modules/@aws-sdk/middleware-host-header/dist-es/index.js
352
+ function resolveHostHeaderConfig(input) {
353
+ return input;
354
+ }
355
+ var hostHeaderMiddleware = (options) => (next) => async (args) => {
356
+ if (!HttpRequest.isInstance(args.request))
357
+ return next(args);
358
+ const { request } = args;
359
+ const { handlerProtocol = "" } = options.requestHandler.metadata || {};
360
+ if (handlerProtocol.indexOf("h2") >= 0 && !request.headers[":authority"]) {
361
+ delete request.headers["host"];
362
+ request.headers[":authority"] = request.hostname + (request.port ? ":" + request.port : "");
363
+ } else if (!request.headers["host"]) {
364
+ let host = request.hostname;
365
+ if (request.port != null)
366
+ host += `:${request.port}`;
367
+ request.headers["host"] = host;
368
+ }
369
+ return next(args);
370
+ };
371
+ var hostHeaderMiddlewareOptions = {
372
+ name: "hostHeaderMiddleware",
373
+ step: "build",
374
+ priority: "low",
375
+ tags: ["HOST"],
376
+ override: true
377
+ };
378
+ var getHostHeaderPlugin = (options) => ({
379
+ applyToStack: (clientStack) => {
380
+ clientStack.add(hostHeaderMiddleware(options), hostHeaderMiddlewareOptions);
381
+ }
382
+ });
383
+
384
+ // node_modules/@aws-sdk/middleware-logger/dist-es/loggerMiddleware.js
385
+ var loggerMiddleware = () => (next, context) => async (args) => {
386
+ try {
387
+ const response = await next(args);
388
+ const { clientName, commandName, logger, dynamoDbDocumentClientOptions = {} } = context;
389
+ const { overrideInputFilterSensitiveLog, overrideOutputFilterSensitiveLog } = dynamoDbDocumentClientOptions;
390
+ const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog;
391
+ const outputFilterSensitiveLog = overrideOutputFilterSensitiveLog ?? context.outputFilterSensitiveLog;
392
+ const { $metadata, ...outputWithoutMetadata } = response.output;
393
+ logger?.info?.({
394
+ clientName,
395
+ commandName,
396
+ input: inputFilterSensitiveLog(args.input),
397
+ output: outputFilterSensitiveLog(outputWithoutMetadata),
398
+ metadata: $metadata
399
+ });
400
+ return response;
401
+ } catch (error) {
402
+ const { clientName, commandName, logger, dynamoDbDocumentClientOptions = {} } = context;
403
+ const { overrideInputFilterSensitiveLog } = dynamoDbDocumentClientOptions;
404
+ const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog;
405
+ logger?.error?.({
406
+ clientName,
407
+ commandName,
408
+ input: inputFilterSensitiveLog(args.input),
409
+ error,
410
+ metadata: error.$metadata
411
+ });
412
+ throw error;
413
+ }
414
+ };
415
+ var loggerMiddlewareOptions = {
416
+ name: "loggerMiddleware",
417
+ tags: ["LOGGER"],
418
+ step: "initialize",
419
+ override: true
420
+ };
421
+ var getLoggerPlugin = (options) => ({
422
+ applyToStack: (clientStack) => {
423
+ clientStack.add(loggerMiddleware(), loggerMiddlewareOptions);
424
+ }
425
+ });
426
+
427
+ // node_modules/@aws-sdk/middleware-recursion-detection/dist-es/index.js
428
+ var TRACE_ID_HEADER_NAME = "X-Amzn-Trace-Id";
429
+ var ENV_LAMBDA_FUNCTION_NAME = "AWS_LAMBDA_FUNCTION_NAME";
430
+ var ENV_TRACE_ID = "_X_AMZN_TRACE_ID";
431
+ var recursionDetectionMiddleware = (options) => (next) => async (args) => {
432
+ const { request } = args;
433
+ if (!HttpRequest.isInstance(request) || options.runtime !== "node") {
434
+ return next(args);
435
+ }
436
+ const traceIdHeader = Object.keys(request.headers ?? {}).find((h) => h.toLowerCase() === TRACE_ID_HEADER_NAME.toLowerCase()) ?? TRACE_ID_HEADER_NAME;
437
+ if (request.headers.hasOwnProperty(traceIdHeader)) {
438
+ return next(args);
439
+ }
440
+ const functionName = process.env[ENV_LAMBDA_FUNCTION_NAME];
441
+ const traceId = process.env[ENV_TRACE_ID];
442
+ const nonEmptyString = (str) => typeof str === "string" && str.length > 0;
443
+ if (nonEmptyString(functionName) && nonEmptyString(traceId)) {
444
+ request.headers[TRACE_ID_HEADER_NAME] = traceId;
445
+ }
446
+ return next({
447
+ ...args,
448
+ request
449
+ });
450
+ };
451
+ var addRecursionDetectionMiddlewareOptions = {
452
+ step: "build",
453
+ tags: ["RECURSION_DETECTION"],
454
+ name: "recursionDetectionMiddleware",
455
+ override: true,
456
+ priority: "low"
457
+ };
458
+ var getRecursionDetectionPlugin = (options) => ({
459
+ applyToStack: (clientStack) => {
460
+ clientStack.add(recursionDetectionMiddleware(options), addRecursionDetectionMiddlewareOptions);
461
+ }
462
+ });
463
+
464
+ // node_modules/@aws-sdk/middleware-user-agent/dist-es/configurations.js
465
+ var DEFAULT_UA_APP_ID = void 0;
466
+ function isValidUserAgentAppId(appId) {
467
+ if (appId === void 0) {
468
+ return true;
469
+ }
470
+ return typeof appId === "string" && appId.length <= 50;
471
+ }
472
+ function resolveUserAgentConfig(input) {
473
+ const normalizedAppIdProvider = normalizeProvider2(input.userAgentAppId ?? DEFAULT_UA_APP_ID);
474
+ const { customUserAgent } = input;
475
+ return Object.assign(input, {
476
+ customUserAgent: typeof customUserAgent === "string" ? [[customUserAgent]] : customUserAgent,
477
+ userAgentAppId: async () => {
478
+ const appId = await normalizedAppIdProvider();
479
+ if (!isValidUserAgentAppId(appId)) {
480
+ const logger = input.logger?.constructor?.name === "NoOpLogger" || !input.logger ? console : input.logger;
481
+ if (typeof appId !== "string") {
482
+ logger?.warn("userAgentAppId must be a string or undefined.");
483
+ } else if (appId.length > 50) {
484
+ logger?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.");
485
+ }
486
+ }
487
+ return appId;
488
+ }
489
+ });
490
+ }
491
+
492
+ // node_modules/@smithy/util-endpoints/dist-es/cache/EndpointCache.js
493
+ var EndpointCache = class {
494
+ constructor({ size, params }) {
495
+ this.data = /* @__PURE__ */ new Map();
496
+ this.parameters = [];
497
+ this.capacity = size ?? 50;
498
+ if (params) {
499
+ this.parameters = params;
500
+ }
501
+ }
502
+ get(endpointParams, resolver) {
503
+ const key = this.hash(endpointParams);
504
+ if (key === false) {
505
+ return resolver();
506
+ }
507
+ if (!this.data.has(key)) {
508
+ if (this.data.size > this.capacity + 10) {
509
+ const keys = this.data.keys();
510
+ let i = 0;
511
+ while (true) {
512
+ const { value, done } = keys.next();
513
+ this.data.delete(value);
514
+ if (done || ++i > 10) {
515
+ break;
516
+ }
517
+ }
518
+ }
519
+ this.data.set(key, resolver());
520
+ }
521
+ return this.data.get(key);
522
+ }
523
+ size() {
524
+ return this.data.size;
525
+ }
526
+ hash(endpointParams) {
527
+ let buffer = "";
528
+ const { parameters } = this;
529
+ if (parameters.length === 0) {
530
+ return false;
531
+ }
532
+ for (const param of parameters) {
533
+ const val = String(endpointParams[param] ?? "");
534
+ if (val.includes("|;")) {
535
+ return false;
536
+ }
537
+ buffer += val + "|;";
538
+ }
539
+ return buffer;
540
+ }
541
+ };
542
+
543
+ // node_modules/@smithy/util-endpoints/dist-es/lib/isIpAddress.js
544
+ var IP_V4_REGEX = 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}$`);
545
+ var isIpAddress = (value) => IP_V4_REGEX.test(value) || value.startsWith("[") && value.endsWith("]");
546
+
547
+ // node_modules/@smithy/util-endpoints/dist-es/lib/isValidHostLabel.js
548
+ var VALID_HOST_LABEL_REGEX = new RegExp(`^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$`);
549
+ var isValidHostLabel = (value, allowSubDomains = false) => {
550
+ if (!allowSubDomains) {
551
+ return VALID_HOST_LABEL_REGEX.test(value);
552
+ }
553
+ const labels = value.split(".");
554
+ for (const label of labels) {
555
+ if (!isValidHostLabel(label)) {
556
+ return false;
557
+ }
558
+ }
559
+ return true;
560
+ };
561
+
562
+ // node_modules/@smithy/util-endpoints/dist-es/utils/customEndpointFunctions.js
563
+ var customEndpointFunctions = {};
564
+
565
+ // node_modules/@smithy/util-endpoints/dist-es/debug/debugId.js
566
+ var debugId = "endpoints";
567
+
568
+ // node_modules/@smithy/util-endpoints/dist-es/debug/toDebugString.js
569
+ function toDebugString(input) {
570
+ if (typeof input !== "object" || input == null) {
571
+ return input;
572
+ }
573
+ if ("ref" in input) {
574
+ return `$${toDebugString(input.ref)}`;
575
+ }
576
+ if ("fn" in input) {
577
+ return `${input.fn}(${(input.argv || []).map(toDebugString).join(", ")})`;
578
+ }
579
+ return JSON.stringify(input, null, 2);
580
+ }
581
+
582
+ // node_modules/@smithy/util-endpoints/dist-es/types/EndpointError.js
583
+ var EndpointError = class extends Error {
584
+ constructor(message) {
585
+ super(message);
586
+ this.name = "EndpointError";
587
+ }
588
+ };
589
+
590
+ // node_modules/@smithy/util-endpoints/dist-es/lib/booleanEquals.js
591
+ var booleanEquals = (value1, value2) => value1 === value2;
592
+
593
+ // node_modules/@smithy/util-endpoints/dist-es/lib/getAttrPathList.js
594
+ var getAttrPathList = (path) => {
595
+ const parts = path.split(".");
596
+ const pathList = [];
597
+ for (const part of parts) {
598
+ const squareBracketIndex = part.indexOf("[");
599
+ if (squareBracketIndex !== -1) {
600
+ if (part.indexOf("]") !== part.length - 1) {
601
+ throw new EndpointError(`Path: '${path}' does not end with ']'`);
602
+ }
603
+ const arrayIndex = part.slice(squareBracketIndex + 1, -1);
604
+ if (Number.isNaN(parseInt(arrayIndex))) {
605
+ throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path}'`);
606
+ }
607
+ if (squareBracketIndex !== 0) {
608
+ pathList.push(part.slice(0, squareBracketIndex));
609
+ }
610
+ pathList.push(arrayIndex);
611
+ } else {
612
+ pathList.push(part);
613
+ }
614
+ }
615
+ return pathList;
616
+ };
617
+
618
+ // node_modules/@smithy/util-endpoints/dist-es/lib/getAttr.js
619
+ var getAttr = (value, path) => getAttrPathList(path).reduce((acc, index) => {
620
+ if (typeof acc !== "object") {
621
+ throw new EndpointError(`Index '${index}' in '${path}' not found in '${JSON.stringify(value)}'`);
622
+ } else if (Array.isArray(acc)) {
623
+ return acc[parseInt(index)];
624
+ }
625
+ return acc[index];
626
+ }, value);
627
+
628
+ // node_modules/@smithy/util-endpoints/dist-es/lib/isSet.js
629
+ var isSet = (value) => value != null;
630
+
631
+ // node_modules/@smithy/util-endpoints/dist-es/lib/not.js
632
+ var not = (value) => !value;
633
+
634
+ // node_modules/@smithy/util-endpoints/dist-es/lib/parseURL.js
635
+ var DEFAULT_PORTS = {
636
+ [EndpointURLScheme.HTTP]: 80,
637
+ [EndpointURLScheme.HTTPS]: 443
638
+ };
639
+ var parseURL = (value) => {
640
+ const whatwgURL = (() => {
641
+ try {
642
+ if (value instanceof URL) {
643
+ return value;
644
+ }
645
+ if (typeof value === "object" && "hostname" in value) {
646
+ const { hostname: hostname2, port, protocol: protocol2 = "", path = "", query = {} } = value;
647
+ const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path}`);
648
+ url.search = Object.entries(query).map(([k, v]) => `${k}=${v}`).join("&");
649
+ return url;
650
+ }
651
+ return new URL(value);
652
+ } catch (error) {
653
+ return null;
654
+ }
655
+ })();
656
+ if (!whatwgURL) {
657
+ console.error(`Unable to parse ${JSON.stringify(value)} as a whatwg URL.`);
658
+ return null;
659
+ }
660
+ const urlString = whatwgURL.href;
661
+ const { host, hostname, pathname, protocol, search } = whatwgURL;
662
+ if (search) {
663
+ return null;
664
+ }
665
+ const scheme = protocol.slice(0, -1);
666
+ if (!Object.values(EndpointURLScheme).includes(scheme)) {
667
+ return null;
668
+ }
669
+ const isIp = isIpAddress(hostname);
670
+ const inputContainsDefaultPort = urlString.includes(`${host}:${DEFAULT_PORTS[scheme]}`) || typeof value === "string" && value.includes(`${host}:${DEFAULT_PORTS[scheme]}`);
671
+ const authority = `${host}${inputContainsDefaultPort ? `:${DEFAULT_PORTS[scheme]}` : ``}`;
672
+ return {
673
+ scheme,
674
+ authority,
675
+ path: pathname,
676
+ normalizedPath: pathname.endsWith("/") ? pathname : `${pathname}/`,
677
+ isIp
678
+ };
679
+ };
680
+
681
+ // node_modules/@smithy/util-endpoints/dist-es/lib/stringEquals.js
682
+ var stringEquals = (value1, value2) => value1 === value2;
683
+
684
+ // node_modules/@smithy/util-endpoints/dist-es/lib/substring.js
685
+ var substring = (input, start, stop, reverse) => {
686
+ if (start >= stop || input.length < stop) {
687
+ return null;
688
+ }
689
+ if (!reverse) {
690
+ return input.substring(start, stop);
691
+ }
692
+ return input.substring(input.length - stop, input.length - start);
693
+ };
694
+
695
+ // node_modules/@smithy/util-endpoints/dist-es/lib/uriEncode.js
696
+ var uriEncode = (value) => encodeURIComponent(value).replace(/[!*'()]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`);
697
+
698
+ // node_modules/@smithy/util-endpoints/dist-es/utils/endpointFunctions.js
699
+ var endpointFunctions = {
700
+ booleanEquals,
701
+ getAttr,
702
+ isSet,
703
+ isValidHostLabel,
704
+ not,
705
+ parseURL,
706
+ stringEquals,
707
+ substring,
708
+ uriEncode
709
+ };
710
+
711
+ // node_modules/@smithy/util-endpoints/dist-es/utils/evaluateTemplate.js
712
+ var evaluateTemplate = (template, options) => {
713
+ const evaluatedTemplateArr = [];
714
+ const templateContext = {
715
+ ...options.endpointParams,
716
+ ...options.referenceRecord
717
+ };
718
+ let currentIndex = 0;
719
+ while (currentIndex < template.length) {
720
+ const openingBraceIndex = template.indexOf("{", currentIndex);
721
+ if (openingBraceIndex === -1) {
722
+ evaluatedTemplateArr.push(template.slice(currentIndex));
723
+ break;
724
+ }
725
+ evaluatedTemplateArr.push(template.slice(currentIndex, openingBraceIndex));
726
+ const closingBraceIndex = template.indexOf("}", openingBraceIndex);
727
+ if (closingBraceIndex === -1) {
728
+ evaluatedTemplateArr.push(template.slice(openingBraceIndex));
729
+ break;
730
+ }
731
+ if (template[openingBraceIndex + 1] === "{" && template[closingBraceIndex + 1] === "}") {
732
+ evaluatedTemplateArr.push(template.slice(openingBraceIndex + 1, closingBraceIndex));
733
+ currentIndex = closingBraceIndex + 2;
734
+ }
735
+ const parameterName = template.substring(openingBraceIndex + 1, closingBraceIndex);
736
+ if (parameterName.includes("#")) {
737
+ const [refName, attrName] = parameterName.split("#");
738
+ evaluatedTemplateArr.push(getAttr(templateContext[refName], attrName));
739
+ } else {
740
+ evaluatedTemplateArr.push(templateContext[parameterName]);
741
+ }
742
+ currentIndex = closingBraceIndex + 1;
743
+ }
744
+ return evaluatedTemplateArr.join("");
745
+ };
746
+
747
+ // node_modules/@smithy/util-endpoints/dist-es/utils/getReferenceValue.js
748
+ var getReferenceValue = ({ ref }, options) => {
749
+ const referenceRecord = {
750
+ ...options.endpointParams,
751
+ ...options.referenceRecord
752
+ };
753
+ return referenceRecord[ref];
754
+ };
755
+
756
+ // node_modules/@smithy/util-endpoints/dist-es/utils/evaluateExpression.js
757
+ var evaluateExpression = (obj, keyName, options) => {
758
+ if (typeof obj === "string") {
759
+ return evaluateTemplate(obj, options);
760
+ } else if (obj["fn"]) {
761
+ return callFunction(obj, options);
762
+ } else if (obj["ref"]) {
763
+ return getReferenceValue(obj, options);
764
+ }
765
+ throw new EndpointError(`'${keyName}': ${String(obj)} is not a string, function or reference.`);
766
+ };
767
+
768
+ // node_modules/@smithy/util-endpoints/dist-es/utils/callFunction.js
769
+ var callFunction = ({ fn, argv }, options) => {
770
+ const evaluatedArgs = argv.map((arg) => ["boolean", "number"].includes(typeof arg) ? arg : evaluateExpression(arg, "arg", options));
771
+ const fnSegments = fn.split(".");
772
+ if (fnSegments[0] in customEndpointFunctions && fnSegments[1] != null) {
773
+ return customEndpointFunctions[fnSegments[0]][fnSegments[1]](...evaluatedArgs);
774
+ }
775
+ return endpointFunctions[fn](...evaluatedArgs);
776
+ };
777
+
778
+ // node_modules/@smithy/util-endpoints/dist-es/utils/evaluateCondition.js
779
+ var evaluateCondition = ({ assign, ...fnArgs }, options) => {
780
+ if (assign && assign in options.referenceRecord) {
781
+ throw new EndpointError(`'${assign}' is already defined in Reference Record.`);
782
+ }
783
+ const value = callFunction(fnArgs, options);
784
+ options.logger?.debug?.(`${debugId} evaluateCondition: ${toDebugString(fnArgs)} = ${toDebugString(value)}`);
785
+ return {
786
+ result: value === "" ? true : !!value,
787
+ ...assign != null && { toAssign: { name: assign, value } }
788
+ };
789
+ };
790
+
791
+ // node_modules/@smithy/util-endpoints/dist-es/utils/evaluateConditions.js
792
+ var evaluateConditions = (conditions = [], options) => {
793
+ const conditionsReferenceRecord = {};
794
+ for (const condition of conditions) {
795
+ const { result, toAssign } = evaluateCondition(condition, {
796
+ ...options,
797
+ referenceRecord: {
798
+ ...options.referenceRecord,
799
+ ...conditionsReferenceRecord
800
+ }
801
+ });
802
+ if (!result) {
803
+ return { result };
804
+ }
805
+ if (toAssign) {
806
+ conditionsReferenceRecord[toAssign.name] = toAssign.value;
807
+ options.logger?.debug?.(`${debugId} assign: ${toAssign.name} := ${toDebugString(toAssign.value)}`);
808
+ }
809
+ }
810
+ return { result: true, referenceRecord: conditionsReferenceRecord };
811
+ };
812
+
813
+ // node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointHeaders.js
814
+ var getEndpointHeaders = (headers, options) => Object.entries(headers).reduce((acc, [headerKey, headerVal]) => ({
815
+ ...acc,
816
+ [headerKey]: headerVal.map((headerValEntry) => {
817
+ const processedExpr = evaluateExpression(headerValEntry, "Header value entry", options);
818
+ if (typeof processedExpr !== "string") {
819
+ throw new EndpointError(`Header '${headerKey}' value '${processedExpr}' is not a string`);
820
+ }
821
+ return processedExpr;
822
+ })
823
+ }), {});
824
+
825
+ // node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointProperty.js
826
+ var getEndpointProperty = (property, options) => {
827
+ if (Array.isArray(property)) {
828
+ return property.map((propertyEntry) => getEndpointProperty(propertyEntry, options));
829
+ }
830
+ switch (typeof property) {
831
+ case "string":
832
+ return evaluateTemplate(property, options);
833
+ case "object":
834
+ if (property === null) {
835
+ throw new EndpointError(`Unexpected endpoint property: ${property}`);
836
+ }
837
+ return getEndpointProperties(property, options);
838
+ case "boolean":
839
+ return property;
840
+ default:
841
+ throw new EndpointError(`Unexpected endpoint property type: ${typeof property}`);
842
+ }
843
+ };
844
+
845
+ // node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointProperties.js
846
+ var getEndpointProperties = (properties, options) => Object.entries(properties).reduce((acc, [propertyKey, propertyVal]) => ({
847
+ ...acc,
848
+ [propertyKey]: getEndpointProperty(propertyVal, options)
849
+ }), {});
850
+
851
+ // node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointUrl.js
852
+ var getEndpointUrl = (endpointUrl, options) => {
853
+ const expression = evaluateExpression(endpointUrl, "Endpoint URL", options);
854
+ if (typeof expression === "string") {
855
+ try {
856
+ return new URL(expression);
857
+ } catch (error) {
858
+ console.error(`Failed to construct URL with ${expression}`, error);
859
+ throw error;
860
+ }
861
+ }
862
+ throw new EndpointError(`Endpoint URL must be a string, got ${typeof expression}`);
863
+ };
864
+
865
+ // node_modules/@smithy/util-endpoints/dist-es/utils/evaluateEndpointRule.js
866
+ var evaluateEndpointRule = (endpointRule, options) => {
867
+ const { conditions, endpoint } = endpointRule;
868
+ const { result, referenceRecord } = evaluateConditions(conditions, options);
869
+ if (!result) {
870
+ return;
871
+ }
872
+ const endpointRuleOptions = {
873
+ ...options,
874
+ referenceRecord: { ...options.referenceRecord, ...referenceRecord }
875
+ };
876
+ const { url, properties, headers } = endpoint;
877
+ options.logger?.debug?.(`${debugId} Resolving endpoint from template: ${toDebugString(endpoint)}`);
878
+ return {
879
+ ...headers != void 0 && {
880
+ headers: getEndpointHeaders(headers, endpointRuleOptions)
881
+ },
882
+ ...properties != void 0 && {
883
+ properties: getEndpointProperties(properties, endpointRuleOptions)
884
+ },
885
+ url: getEndpointUrl(url, endpointRuleOptions)
886
+ };
887
+ };
888
+
889
+ // node_modules/@smithy/util-endpoints/dist-es/utils/evaluateErrorRule.js
890
+ var evaluateErrorRule = (errorRule, options) => {
891
+ const { conditions, error } = errorRule;
892
+ const { result, referenceRecord } = evaluateConditions(conditions, options);
893
+ if (!result) {
894
+ return;
895
+ }
896
+ throw new EndpointError(evaluateExpression(error, "Error", {
897
+ ...options,
898
+ referenceRecord: { ...options.referenceRecord, ...referenceRecord }
899
+ }));
900
+ };
901
+
902
+ // node_modules/@smithy/util-endpoints/dist-es/utils/evaluateTreeRule.js
903
+ var evaluateTreeRule = (treeRule, options) => {
904
+ const { conditions, rules } = treeRule;
905
+ const { result, referenceRecord } = evaluateConditions(conditions, options);
906
+ if (!result) {
907
+ return;
908
+ }
909
+ return evaluateRules(rules, {
910
+ ...options,
911
+ referenceRecord: { ...options.referenceRecord, ...referenceRecord }
912
+ });
913
+ };
914
+
915
+ // node_modules/@smithy/util-endpoints/dist-es/utils/evaluateRules.js
916
+ var evaluateRules = (rules, options) => {
917
+ for (const rule of rules) {
918
+ if (rule.type === "endpoint") {
919
+ const endpointOrUndefined = evaluateEndpointRule(rule, options);
920
+ if (endpointOrUndefined) {
921
+ return endpointOrUndefined;
922
+ }
923
+ } else if (rule.type === "error") {
924
+ evaluateErrorRule(rule, options);
925
+ } else if (rule.type === "tree") {
926
+ const endpointOrUndefined = evaluateTreeRule(rule, options);
927
+ if (endpointOrUndefined) {
928
+ return endpointOrUndefined;
929
+ }
930
+ } else {
931
+ throw new EndpointError(`Unknown endpoint rule: ${rule}`);
932
+ }
933
+ }
934
+ throw new EndpointError(`Rules evaluation failed`);
935
+ };
936
+
937
+ // node_modules/@smithy/util-endpoints/dist-es/resolveEndpoint.js
938
+ var resolveEndpoint = (ruleSetObject, options) => {
939
+ const { endpointParams, logger } = options;
940
+ const { parameters, rules } = ruleSetObject;
941
+ options.logger?.debug?.(`${debugId} Initial EndpointParams: ${toDebugString(endpointParams)}`);
942
+ const paramsWithDefault = Object.entries(parameters).filter(([, v]) => v.default != null).map(([k, v]) => [k, v.default]);
943
+ if (paramsWithDefault.length > 0) {
944
+ for (const [paramKey, paramDefaultValue] of paramsWithDefault) {
945
+ endpointParams[paramKey] = endpointParams[paramKey] ?? paramDefaultValue;
946
+ }
947
+ }
948
+ const requiredParams = Object.entries(parameters).filter(([, v]) => v.required).map(([k]) => k);
949
+ for (const requiredParam of requiredParams) {
950
+ if (endpointParams[requiredParam] == null) {
951
+ throw new EndpointError(`Missing required parameter: '${requiredParam}'`);
952
+ }
953
+ }
954
+ const endpoint = evaluateRules(rules, { endpointParams, logger, referenceRecord: {} });
955
+ options.logger?.debug?.(`${debugId} Resolved endpoint: ${toDebugString(endpoint)}`);
956
+ return endpoint;
957
+ };
958
+
959
+ // node_modules/@aws-sdk/util-endpoints/dist-es/lib/aws/isVirtualHostableS3Bucket.js
960
+ var isVirtualHostableS3Bucket = (value, allowSubDomains = false) => {
961
+ if (allowSubDomains) {
962
+ for (const label of value.split(".")) {
963
+ if (!isVirtualHostableS3Bucket(label)) {
964
+ return false;
965
+ }
966
+ }
967
+ return true;
968
+ }
969
+ if (!isValidHostLabel(value)) {
970
+ return false;
971
+ }
972
+ if (value.length < 3 || value.length > 63) {
973
+ return false;
974
+ }
975
+ if (value !== value.toLowerCase()) {
976
+ return false;
977
+ }
978
+ if (isIpAddress(value)) {
979
+ return false;
980
+ }
981
+ return true;
982
+ };
983
+
984
+ // node_modules/@aws-sdk/util-endpoints/dist-es/lib/aws/parseArn.js
985
+ var ARN_DELIMITER = ":";
986
+ var RESOURCE_DELIMITER = "/";
987
+ var parseArn = (value) => {
988
+ const segments = value.split(ARN_DELIMITER);
989
+ if (segments.length < 6)
990
+ return null;
991
+ const [arn, partition2, service, region, accountId, ...resourcePath] = segments;
992
+ if (arn !== "arn" || partition2 === "" || service === "" || resourcePath.join(ARN_DELIMITER) === "")
993
+ return null;
994
+ const resourceId = resourcePath.map((resource) => resource.split(RESOURCE_DELIMITER)).flat();
995
+ return {
996
+ partition: partition2,
997
+ service,
998
+ region,
999
+ accountId,
1000
+ resourceId
1001
+ };
1002
+ };
1003
+
1004
+ // node_modules/@aws-sdk/util-endpoints/dist-es/lib/aws/partitions.json
1005
+ var partitions_default = {
1006
+ partitions: [{
1007
+ id: "aws",
1008
+ outputs: {
1009
+ dnsSuffix: "amazonaws.com",
1010
+ dualStackDnsSuffix: "api.aws",
1011
+ implicitGlobalRegion: "us-east-1",
1012
+ name: "aws",
1013
+ supportsDualStack: true,
1014
+ supportsFIPS: true
1015
+ },
1016
+ regionRegex: "^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",
1017
+ regions: {
1018
+ "af-south-1": {
1019
+ description: "Africa (Cape Town)"
1020
+ },
1021
+ "ap-east-1": {
1022
+ description: "Asia Pacific (Hong Kong)"
1023
+ },
1024
+ "ap-east-2": {
1025
+ description: "Asia Pacific (Taipei)"
1026
+ },
1027
+ "ap-northeast-1": {
1028
+ description: "Asia Pacific (Tokyo)"
1029
+ },
1030
+ "ap-northeast-2": {
1031
+ description: "Asia Pacific (Seoul)"
1032
+ },
1033
+ "ap-northeast-3": {
1034
+ description: "Asia Pacific (Osaka)"
1035
+ },
1036
+ "ap-south-1": {
1037
+ description: "Asia Pacific (Mumbai)"
1038
+ },
1039
+ "ap-south-2": {
1040
+ description: "Asia Pacific (Hyderabad)"
1041
+ },
1042
+ "ap-southeast-1": {
1043
+ description: "Asia Pacific (Singapore)"
1044
+ },
1045
+ "ap-southeast-2": {
1046
+ description: "Asia Pacific (Sydney)"
1047
+ },
1048
+ "ap-southeast-3": {
1049
+ description: "Asia Pacific (Jakarta)"
1050
+ },
1051
+ "ap-southeast-4": {
1052
+ description: "Asia Pacific (Melbourne)"
1053
+ },
1054
+ "ap-southeast-5": {
1055
+ description: "Asia Pacific (Malaysia)"
1056
+ },
1057
+ "ap-southeast-7": {
1058
+ description: "Asia Pacific (Thailand)"
1059
+ },
1060
+ "aws-global": {
1061
+ description: "AWS Standard global region"
1062
+ },
1063
+ "ca-central-1": {
1064
+ description: "Canada (Central)"
1065
+ },
1066
+ "ca-west-1": {
1067
+ description: "Canada West (Calgary)"
1068
+ },
1069
+ "eu-central-1": {
1070
+ description: "Europe (Frankfurt)"
1071
+ },
1072
+ "eu-central-2": {
1073
+ description: "Europe (Zurich)"
1074
+ },
1075
+ "eu-north-1": {
1076
+ description: "Europe (Stockholm)"
1077
+ },
1078
+ "eu-south-1": {
1079
+ description: "Europe (Milan)"
1080
+ },
1081
+ "eu-south-2": {
1082
+ description: "Europe (Spain)"
1083
+ },
1084
+ "eu-west-1": {
1085
+ description: "Europe (Ireland)"
1086
+ },
1087
+ "eu-west-2": {
1088
+ description: "Europe (London)"
1089
+ },
1090
+ "eu-west-3": {
1091
+ description: "Europe (Paris)"
1092
+ },
1093
+ "il-central-1": {
1094
+ description: "Israel (Tel Aviv)"
1095
+ },
1096
+ "me-central-1": {
1097
+ description: "Middle East (UAE)"
1098
+ },
1099
+ "me-south-1": {
1100
+ description: "Middle East (Bahrain)"
1101
+ },
1102
+ "mx-central-1": {
1103
+ description: "Mexico (Central)"
1104
+ },
1105
+ "sa-east-1": {
1106
+ description: "South America (Sao Paulo)"
1107
+ },
1108
+ "us-east-1": {
1109
+ description: "US East (N. Virginia)"
1110
+ },
1111
+ "us-east-2": {
1112
+ description: "US East (Ohio)"
1113
+ },
1114
+ "us-west-1": {
1115
+ description: "US West (N. California)"
1116
+ },
1117
+ "us-west-2": {
1118
+ description: "US West (Oregon)"
1119
+ }
1120
+ }
1121
+ }, {
1122
+ id: "aws-cn",
1123
+ outputs: {
1124
+ dnsSuffix: "amazonaws.com.cn",
1125
+ dualStackDnsSuffix: "api.amazonwebservices.com.cn",
1126
+ implicitGlobalRegion: "cn-northwest-1",
1127
+ name: "aws-cn",
1128
+ supportsDualStack: true,
1129
+ supportsFIPS: true
1130
+ },
1131
+ regionRegex: "^cn\\-\\w+\\-\\d+$",
1132
+ regions: {
1133
+ "aws-cn-global": {
1134
+ description: "AWS China global region"
1135
+ },
1136
+ "cn-north-1": {
1137
+ description: "China (Beijing)"
1138
+ },
1139
+ "cn-northwest-1": {
1140
+ description: "China (Ningxia)"
1141
+ }
1142
+ }
1143
+ }, {
1144
+ id: "aws-us-gov",
1145
+ outputs: {
1146
+ dnsSuffix: "amazonaws.com",
1147
+ dualStackDnsSuffix: "api.aws",
1148
+ implicitGlobalRegion: "us-gov-west-1",
1149
+ name: "aws-us-gov",
1150
+ supportsDualStack: true,
1151
+ supportsFIPS: true
1152
+ },
1153
+ regionRegex: "^us\\-gov\\-\\w+\\-\\d+$",
1154
+ regions: {
1155
+ "aws-us-gov-global": {
1156
+ description: "AWS GovCloud (US) global region"
1157
+ },
1158
+ "us-gov-east-1": {
1159
+ description: "AWS GovCloud (US-East)"
1160
+ },
1161
+ "us-gov-west-1": {
1162
+ description: "AWS GovCloud (US-West)"
1163
+ }
1164
+ }
1165
+ }, {
1166
+ id: "aws-iso",
1167
+ outputs: {
1168
+ dnsSuffix: "c2s.ic.gov",
1169
+ dualStackDnsSuffix: "c2s.ic.gov",
1170
+ implicitGlobalRegion: "us-iso-east-1",
1171
+ name: "aws-iso",
1172
+ supportsDualStack: false,
1173
+ supportsFIPS: true
1174
+ },
1175
+ regionRegex: "^us\\-iso\\-\\w+\\-\\d+$",
1176
+ regions: {
1177
+ "aws-iso-global": {
1178
+ description: "AWS ISO (US) global region"
1179
+ },
1180
+ "us-iso-east-1": {
1181
+ description: "US ISO East"
1182
+ },
1183
+ "us-iso-west-1": {
1184
+ description: "US ISO WEST"
1185
+ }
1186
+ }
1187
+ }, {
1188
+ id: "aws-iso-b",
1189
+ outputs: {
1190
+ dnsSuffix: "sc2s.sgov.gov",
1191
+ dualStackDnsSuffix: "sc2s.sgov.gov",
1192
+ implicitGlobalRegion: "us-isob-east-1",
1193
+ name: "aws-iso-b",
1194
+ supportsDualStack: false,
1195
+ supportsFIPS: true
1196
+ },
1197
+ regionRegex: "^us\\-isob\\-\\w+\\-\\d+$",
1198
+ regions: {
1199
+ "aws-iso-b-global": {
1200
+ description: "AWS ISOB (US) global region"
1201
+ },
1202
+ "us-isob-east-1": {
1203
+ description: "US ISOB East (Ohio)"
1204
+ }
1205
+ }
1206
+ }, {
1207
+ id: "aws-iso-e",
1208
+ outputs: {
1209
+ dnsSuffix: "cloud.adc-e.uk",
1210
+ dualStackDnsSuffix: "cloud.adc-e.uk",
1211
+ implicitGlobalRegion: "eu-isoe-west-1",
1212
+ name: "aws-iso-e",
1213
+ supportsDualStack: false,
1214
+ supportsFIPS: true
1215
+ },
1216
+ regionRegex: "^eu\\-isoe\\-\\w+\\-\\d+$",
1217
+ regions: {
1218
+ "aws-iso-e-global": {
1219
+ description: "AWS ISOE (Europe) global region"
1220
+ },
1221
+ "eu-isoe-west-1": {
1222
+ description: "EU ISOE West"
1223
+ }
1224
+ }
1225
+ }, {
1226
+ id: "aws-iso-f",
1227
+ outputs: {
1228
+ dnsSuffix: "csp.hci.ic.gov",
1229
+ dualStackDnsSuffix: "csp.hci.ic.gov",
1230
+ implicitGlobalRegion: "us-isof-south-1",
1231
+ name: "aws-iso-f",
1232
+ supportsDualStack: false,
1233
+ supportsFIPS: true
1234
+ },
1235
+ regionRegex: "^us\\-isof\\-\\w+\\-\\d+$",
1236
+ regions: {
1237
+ "aws-iso-f-global": {
1238
+ description: "AWS ISOF global region"
1239
+ },
1240
+ "us-isof-east-1": {
1241
+ description: "US ISOF EAST"
1242
+ },
1243
+ "us-isof-south-1": {
1244
+ description: "US ISOF SOUTH"
1245
+ }
1246
+ }
1247
+ }, {
1248
+ id: "aws-eusc",
1249
+ outputs: {
1250
+ dnsSuffix: "amazonaws.eu",
1251
+ dualStackDnsSuffix: "amazonaws.eu",
1252
+ implicitGlobalRegion: "eusc-de-east-1",
1253
+ name: "aws-eusc",
1254
+ supportsDualStack: false,
1255
+ supportsFIPS: true
1256
+ },
1257
+ regionRegex: "^eusc\\-(de)\\-\\w+\\-\\d+$",
1258
+ regions: {
1259
+ "eusc-de-east-1": {
1260
+ description: "EU (Germany)"
1261
+ }
1262
+ }
1263
+ }],
1264
+ version: "1.1"
1265
+ };
1266
+
1267
+ // node_modules/@aws-sdk/util-endpoints/dist-es/lib/aws/partition.js
1268
+ var selectedPartitionsInfo = partitions_default;
1269
+ var selectedUserAgentPrefix = "";
1270
+ var partition = (value) => {
1271
+ const { partitions } = selectedPartitionsInfo;
1272
+ for (const partition2 of partitions) {
1273
+ const { regions, outputs } = partition2;
1274
+ for (const [region, regionData] of Object.entries(regions)) {
1275
+ if (region === value) {
1276
+ return {
1277
+ ...outputs,
1278
+ ...regionData
1279
+ };
1280
+ }
1281
+ }
1282
+ }
1283
+ for (const partition2 of partitions) {
1284
+ const { regionRegex, outputs } = partition2;
1285
+ if (new RegExp(regionRegex).test(value)) {
1286
+ return {
1287
+ ...outputs
1288
+ };
1289
+ }
1290
+ }
1291
+ const DEFAULT_PARTITION = partitions.find((partition2) => partition2.id === "aws");
1292
+ if (!DEFAULT_PARTITION) {
1293
+ throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");
1294
+ }
1295
+ return {
1296
+ ...DEFAULT_PARTITION.outputs
1297
+ };
1298
+ };
1299
+ var getUserAgentPrefix = () => selectedUserAgentPrefix;
1300
+
1301
+ // node_modules/@aws-sdk/util-endpoints/dist-es/aws.js
1302
+ var awsEndpointFunctions = {
1303
+ isVirtualHostableS3Bucket,
1304
+ parseArn,
1305
+ partition
1306
+ };
1307
+ customEndpointFunctions.aws = awsEndpointFunctions;
1308
+
1309
+ // node_modules/@aws-sdk/core/dist-es/submodules/client/emitWarningIfUnsupportedVersion.js
1310
+ var state = {
1311
+ warningEmitted: false
1312
+ };
1313
+ var emitWarningIfUnsupportedVersion = (version) => {
1314
+ if (version && !state.warningEmitted && parseInt(version.substring(1, version.indexOf("."))) < 18) {
1315
+ state.warningEmitted = true;
1316
+ process.emitWarning(`NodeDeprecationWarning: The AWS SDK for JavaScript (v3) will
1317
+ no longer support Node.js 16.x on January 6, 2025.
1318
+
1319
+ To continue receiving updates to AWS services, bug fixes, and security
1320
+ updates please upgrade to a supported Node.js LTS version.
1321
+
1322
+ More information can be found at: https://a.co/74kJMmI`);
1323
+ }
1324
+ };
1325
+
1326
+ // node_modules/@aws-sdk/core/dist-es/submodules/client/setFeature.js
1327
+ function setFeature2(context, feature, value) {
1328
+ if (!context.__aws_sdk_context) {
1329
+ context.__aws_sdk_context = {
1330
+ features: {}
1331
+ };
1332
+ } else if (!context.__aws_sdk_context.features) {
1333
+ context.__aws_sdk_context.features = {};
1334
+ }
1335
+ context.__aws_sdk_context.features[feature] = value;
1336
+ }
1337
+
1338
+ // node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getDateHeader.js
1339
+ var getDateHeader = (response) => HttpResponse.isInstance(response) ? response.headers?.date ?? response.headers?.Date : void 0;
1340
+
1341
+ // node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getSkewCorrectedDate.js
1342
+ var getSkewCorrectedDate = (systemClockOffset) => new Date(Date.now() + systemClockOffset);
1343
+
1344
+ // node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/isClockSkewed.js
1345
+ var isClockSkewed = (clockTime, systemClockOffset) => Math.abs(getSkewCorrectedDate(systemClockOffset).getTime() - clockTime) >= 3e5;
1346
+
1347
+ // node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getUpdatedSystemClockOffset.js
1348
+ var getUpdatedSystemClockOffset = (clockTime, currentSystemClockOffset) => {
1349
+ const clockTimeInMs = Date.parse(clockTime);
1350
+ if (isClockSkewed(clockTimeInMs, currentSystemClockOffset)) {
1351
+ return clockTimeInMs - Date.now();
1352
+ }
1353
+ return currentSystemClockOffset;
1354
+ };
1355
+
1356
+ // node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.js
1357
+ var throwSigningPropertyError = (name, property) => {
1358
+ if (!property) {
1359
+ throw new Error(`Property \`${name}\` is not resolved for AWS SDK SigV4Auth`);
1360
+ }
1361
+ return property;
1362
+ };
1363
+ var validateSigningProperties = async (signingProperties) => {
1364
+ const context = throwSigningPropertyError("context", signingProperties.context);
1365
+ const config = throwSigningPropertyError("config", signingProperties.config);
1366
+ const authScheme = context.endpointV2?.properties?.authSchemes?.[0];
1367
+ const signerFunction = throwSigningPropertyError("signer", config.signer);
1368
+ const signer = await signerFunction(authScheme);
1369
+ const signingRegion = signingProperties?.signingRegion;
1370
+ const signingRegionSet = signingProperties?.signingRegionSet;
1371
+ const signingName = signingProperties?.signingName;
1372
+ return {
1373
+ config,
1374
+ signer,
1375
+ signingRegion,
1376
+ signingRegionSet,
1377
+ signingName
1378
+ };
1379
+ };
1380
+ var AwsSdkSigV4Signer = class {
1381
+ async sign(httpRequest, identity, signingProperties) {
1382
+ if (!HttpRequest.isInstance(httpRequest)) {
1383
+ throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");
1384
+ }
1385
+ const validatedProps = await validateSigningProperties(signingProperties);
1386
+ const { config, signer } = validatedProps;
1387
+ let { signingRegion, signingName } = validatedProps;
1388
+ const handlerExecutionContext = signingProperties.context;
1389
+ if (handlerExecutionContext?.authSchemes?.length ?? 0 > 1) {
1390
+ const [first, second] = handlerExecutionContext.authSchemes;
1391
+ if (first?.name === "sigv4a" && second?.name === "sigv4") {
1392
+ signingRegion = second?.signingRegion ?? signingRegion;
1393
+ signingName = second?.signingName ?? signingName;
1394
+ }
1395
+ }
1396
+ const signedRequest = await signer.sign(httpRequest, {
1397
+ signingDate: getSkewCorrectedDate(config.systemClockOffset),
1398
+ signingRegion,
1399
+ signingService: signingName
1400
+ });
1401
+ return signedRequest;
1402
+ }
1403
+ errorHandler(signingProperties) {
1404
+ return (error) => {
1405
+ const serverTime = error.ServerTime ?? getDateHeader(error.$response);
1406
+ if (serverTime) {
1407
+ const config = throwSigningPropertyError("config", signingProperties.config);
1408
+ const initialSystemClockOffset = config.systemClockOffset;
1409
+ config.systemClockOffset = getUpdatedSystemClockOffset(serverTime, config.systemClockOffset);
1410
+ const clockSkewCorrected = config.systemClockOffset !== initialSystemClockOffset;
1411
+ if (clockSkewCorrected && error.$metadata) {
1412
+ error.$metadata.clockSkewCorrected = true;
1413
+ }
1414
+ }
1415
+ throw error;
1416
+ };
1417
+ }
1418
+ successHandler(httpResponse, signingProperties) {
1419
+ const dateHeader = getDateHeader(httpResponse);
1420
+ if (dateHeader) {
1421
+ const config = throwSigningPropertyError("config", signingProperties.config);
1422
+ config.systemClockOffset = getUpdatedSystemClockOffset(dateHeader, config.systemClockOffset);
1423
+ }
1424
+ }
1425
+ };
1426
+
1427
+ // node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4ASigner.js
1428
+ var AwsSdkSigV4ASigner = class extends AwsSdkSigV4Signer {
1429
+ async sign(httpRequest, identity, signingProperties) {
1430
+ if (!HttpRequest.isInstance(httpRequest)) {
1431
+ throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");
1432
+ }
1433
+ const { config, signer, signingRegion, signingRegionSet, signingName } = await validateSigningProperties(signingProperties);
1434
+ const configResolvedSigningRegionSet = await config.sigv4aSigningRegionSet?.();
1435
+ const multiRegionOverride = (configResolvedSigningRegionSet ?? signingRegionSet ?? [signingRegion]).join(",");
1436
+ const signedRequest = await signer.sign(httpRequest, {
1437
+ signingDate: getSkewCorrectedDate(config.systemClockOffset),
1438
+ signingRegion: multiRegionOverride,
1439
+ signingService: signingName
1440
+ });
1441
+ return signedRequest;
1442
+ }
1443
+ };
1444
+
1445
+ // node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getArrayForCommaSeparatedString.js
1446
+ var getArrayForCommaSeparatedString = (str) => typeof str === "string" && str.length > 0 ? str.split(",").map((item) => item.trim()) : [];
1447
+
1448
+ // node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getBearerTokenEnvKey.js
1449
+ var getBearerTokenEnvKey = (signingName) => `AWS_BEARER_TOKEN_${signingName.replace(/[\s-]/g, "_").toUpperCase()}`;
1450
+
1451
+ // node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/NODE_AUTH_SCHEME_PREFERENCE_OPTIONS.js
1452
+ var NODE_AUTH_SCHEME_PREFERENCE_ENV_KEY = "AWS_AUTH_SCHEME_PREFERENCE";
1453
+ var NODE_AUTH_SCHEME_PREFERENCE_CONFIG_KEY = "auth_scheme_preference";
1454
+ var NODE_AUTH_SCHEME_PREFERENCE_OPTIONS = {
1455
+ environmentVariableSelector: (env2, options) => {
1456
+ if (options?.signingName) {
1457
+ const bearerTokenKey = getBearerTokenEnvKey(options.signingName);
1458
+ if (bearerTokenKey in env2)
1459
+ return ["httpBearerAuth"];
1460
+ }
1461
+ if (!(NODE_AUTH_SCHEME_PREFERENCE_ENV_KEY in env2))
1462
+ return void 0;
1463
+ return getArrayForCommaSeparatedString(env2[NODE_AUTH_SCHEME_PREFERENCE_ENV_KEY]);
1464
+ },
1465
+ configFileSelector: (profile) => {
1466
+ if (!(NODE_AUTH_SCHEME_PREFERENCE_CONFIG_KEY in profile))
1467
+ return void 0;
1468
+ return getArrayForCommaSeparatedString(profile[NODE_AUTH_SCHEME_PREFERENCE_CONFIG_KEY]);
1469
+ },
1470
+ default: []
1471
+ };
1472
+
1473
+ // node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.js
1474
+ var resolveAwsSdkSigV4AConfig = (config) => {
1475
+ config.sigv4aSigningRegionSet = normalizeProvider2(config.sigv4aSigningRegionSet);
1476
+ return config;
1477
+ };
1478
+ var NODE_SIGV4A_CONFIG_OPTIONS = {
1479
+ environmentVariableSelector(env2) {
1480
+ if (env2.AWS_SIGV4A_SIGNING_REGION_SET) {
1481
+ return env2.AWS_SIGV4A_SIGNING_REGION_SET.split(",").map((_) => _.trim());
1482
+ }
1483
+ throw new ProviderError("AWS_SIGV4A_SIGNING_REGION_SET not set in env.", {
1484
+ tryNextLink: true
1485
+ });
1486
+ },
1487
+ configFileSelector(profile) {
1488
+ if (profile.sigv4a_signing_region_set) {
1489
+ return (profile.sigv4a_signing_region_set ?? "").split(",").map((_) => _.trim());
1490
+ }
1491
+ throw new ProviderError("sigv4a_signing_region_set not set in profile.", {
1492
+ tryNextLink: true
1493
+ });
1494
+ },
1495
+ default: void 0
1496
+ };
1497
+
1498
+ // node_modules/@smithy/signature-v4/dist-es/constants.js
1499
+ var ALGORITHM_QUERY_PARAM = "X-Amz-Algorithm";
1500
+ var CREDENTIAL_QUERY_PARAM = "X-Amz-Credential";
1501
+ var AMZ_DATE_QUERY_PARAM = "X-Amz-Date";
1502
+ var SIGNED_HEADERS_QUERY_PARAM = "X-Amz-SignedHeaders";
1503
+ var EXPIRES_QUERY_PARAM = "X-Amz-Expires";
1504
+ var SIGNATURE_QUERY_PARAM = "X-Amz-Signature";
1505
+ var TOKEN_QUERY_PARAM = "X-Amz-Security-Token";
1506
+ var AUTH_HEADER = "authorization";
1507
+ var AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase();
1508
+ var DATE_HEADER = "date";
1509
+ var GENERATED_HEADERS = [AUTH_HEADER, AMZ_DATE_HEADER, DATE_HEADER];
1510
+ var SIGNATURE_HEADER = SIGNATURE_QUERY_PARAM.toLowerCase();
1511
+ var SHA256_HEADER = "x-amz-content-sha256";
1512
+ var TOKEN_HEADER = TOKEN_QUERY_PARAM.toLowerCase();
1513
+ var ALWAYS_UNSIGNABLE_HEADERS = {
1514
+ authorization: true,
1515
+ "cache-control": true,
1516
+ connection: true,
1517
+ expect: true,
1518
+ from: true,
1519
+ "keep-alive": true,
1520
+ "max-forwards": true,
1521
+ pragma: true,
1522
+ referer: true,
1523
+ te: true,
1524
+ trailer: true,
1525
+ "transfer-encoding": true,
1526
+ upgrade: true,
1527
+ "user-agent": true,
1528
+ "x-amzn-trace-id": true
1529
+ };
1530
+ var PROXY_HEADER_PATTERN = /^proxy-/;
1531
+ var SEC_HEADER_PATTERN = /^sec-/;
1532
+ var ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256";
1533
+ var EVENT_ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256-PAYLOAD";
1534
+ var UNSIGNED_PAYLOAD = "UNSIGNED-PAYLOAD";
1535
+ var MAX_CACHE_SIZE = 50;
1536
+ var KEY_TYPE_IDENTIFIER = "aws4_request";
1537
+ var MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7;
1538
+
1539
+ // node_modules/@smithy/signature-v4/dist-es/credentialDerivation.js
1540
+ var signingKeyCache = {};
1541
+ var cacheQueue = [];
1542
+ var createScope = (shortDate, region, service) => `${shortDate}/${region}/${service}/${KEY_TYPE_IDENTIFIER}`;
1543
+ var getSigningKey = async (sha256Constructor, credentials, shortDate, region, service) => {
1544
+ const credsHash = await hmac(sha256Constructor, credentials.secretAccessKey, credentials.accessKeyId);
1545
+ const cacheKey = `${shortDate}:${region}:${service}:${toHex(credsHash)}:${credentials.sessionToken}`;
1546
+ if (cacheKey in signingKeyCache) {
1547
+ return signingKeyCache[cacheKey];
1548
+ }
1549
+ cacheQueue.push(cacheKey);
1550
+ while (cacheQueue.length > MAX_CACHE_SIZE) {
1551
+ delete signingKeyCache[cacheQueue.shift()];
1552
+ }
1553
+ let key = `AWS4${credentials.secretAccessKey}`;
1554
+ for (const signable of [shortDate, region, service, KEY_TYPE_IDENTIFIER]) {
1555
+ key = await hmac(sha256Constructor, key, signable);
1556
+ }
1557
+ return signingKeyCache[cacheKey] = key;
1558
+ };
1559
+ var hmac = (ctor, secret, data) => {
1560
+ const hash = new ctor(secret);
1561
+ hash.update(toUint8Array(data));
1562
+ return hash.digest();
1563
+ };
1564
+
1565
+ // node_modules/@smithy/signature-v4/dist-es/getCanonicalHeaders.js
1566
+ var getCanonicalHeaders = ({ headers }, unsignableHeaders, signableHeaders) => {
1567
+ const canonical = {};
1568
+ for (const headerName of Object.keys(headers).sort()) {
1569
+ if (headers[headerName] == void 0) {
1570
+ continue;
1571
+ }
1572
+ const canonicalHeaderName = headerName.toLowerCase();
1573
+ if (canonicalHeaderName in ALWAYS_UNSIGNABLE_HEADERS || unsignableHeaders?.has(canonicalHeaderName) || PROXY_HEADER_PATTERN.test(canonicalHeaderName) || SEC_HEADER_PATTERN.test(canonicalHeaderName)) {
1574
+ if (!signableHeaders || signableHeaders && !signableHeaders.has(canonicalHeaderName)) {
1575
+ continue;
1576
+ }
1577
+ }
1578
+ canonical[canonicalHeaderName] = headers[headerName].trim().replace(/\s+/g, " ");
1579
+ }
1580
+ return canonical;
1581
+ };
1582
+
1583
+ // node_modules/@smithy/signature-v4/dist-es/getPayloadHash.js
1584
+ var getPayloadHash = async ({ headers, body }, hashConstructor) => {
1585
+ for (const headerName of Object.keys(headers)) {
1586
+ if (headerName.toLowerCase() === SHA256_HEADER) {
1587
+ return headers[headerName];
1588
+ }
1589
+ }
1590
+ if (body == void 0) {
1591
+ return "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
1592
+ } else if (typeof body === "string" || ArrayBuffer.isView(body) || isArrayBuffer(body)) {
1593
+ const hashCtor = new hashConstructor();
1594
+ hashCtor.update(toUint8Array(body));
1595
+ return toHex(await hashCtor.digest());
1596
+ }
1597
+ return UNSIGNED_PAYLOAD;
1598
+ };
1599
+
1600
+ // node_modules/@smithy/signature-v4/dist-es/HeaderFormatter.js
1601
+ var HeaderFormatter = class {
1602
+ format(headers) {
1603
+ const chunks = [];
1604
+ for (const headerName of Object.keys(headers)) {
1605
+ const bytes = fromUtf8(headerName);
1606
+ chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName]));
1607
+ }
1608
+ const out = new Uint8Array(chunks.reduce((carry, bytes) => carry + bytes.byteLength, 0));
1609
+ let position = 0;
1610
+ for (const chunk of chunks) {
1611
+ out.set(chunk, position);
1612
+ position += chunk.byteLength;
1613
+ }
1614
+ return out;
1615
+ }
1616
+ formatHeaderValue(header) {
1617
+ switch (header.type) {
1618
+ case "boolean":
1619
+ return Uint8Array.from([header.value ? 0 : 1]);
1620
+ case "byte":
1621
+ return Uint8Array.from([2, header.value]);
1622
+ case "short":
1623
+ const shortView = new DataView(new ArrayBuffer(3));
1624
+ shortView.setUint8(0, 3);
1625
+ shortView.setInt16(1, header.value, false);
1626
+ return new Uint8Array(shortView.buffer);
1627
+ case "integer":
1628
+ const intView = new DataView(new ArrayBuffer(5));
1629
+ intView.setUint8(0, 4);
1630
+ intView.setInt32(1, header.value, false);
1631
+ return new Uint8Array(intView.buffer);
1632
+ case "long":
1633
+ const longBytes = new Uint8Array(9);
1634
+ longBytes[0] = 5;
1635
+ longBytes.set(header.value.bytes, 1);
1636
+ return longBytes;
1637
+ case "binary":
1638
+ const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength));
1639
+ binView.setUint8(0, 6);
1640
+ binView.setUint16(1, header.value.byteLength, false);
1641
+ const binBytes = new Uint8Array(binView.buffer);
1642
+ binBytes.set(header.value, 3);
1643
+ return binBytes;
1644
+ case "string":
1645
+ const utf8Bytes = fromUtf8(header.value);
1646
+ const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength));
1647
+ strView.setUint8(0, 7);
1648
+ strView.setUint16(1, utf8Bytes.byteLength, false);
1649
+ const strBytes = new Uint8Array(strView.buffer);
1650
+ strBytes.set(utf8Bytes, 3);
1651
+ return strBytes;
1652
+ case "timestamp":
1653
+ const tsBytes = new Uint8Array(9);
1654
+ tsBytes[0] = 8;
1655
+ tsBytes.set(Int64.fromNumber(header.value.valueOf()).bytes, 1);
1656
+ return tsBytes;
1657
+ case "uuid":
1658
+ if (!UUID_PATTERN.test(header.value)) {
1659
+ throw new Error(`Invalid UUID received: ${header.value}`);
1660
+ }
1661
+ const uuidBytes = new Uint8Array(17);
1662
+ uuidBytes[0] = 9;
1663
+ uuidBytes.set(fromHex(header.value.replace(/\-/g, "")), 1);
1664
+ return uuidBytes;
1665
+ }
1666
+ }
1667
+ };
1668
+ var HEADER_VALUE_TYPE;
1669
+ (function(HEADER_VALUE_TYPE2) {
1670
+ HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["boolTrue"] = 0] = "boolTrue";
1671
+ HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["boolFalse"] = 1] = "boolFalse";
1672
+ HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["byte"] = 2] = "byte";
1673
+ HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["short"] = 3] = "short";
1674
+ HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["integer"] = 4] = "integer";
1675
+ HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["long"] = 5] = "long";
1676
+ HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["byteArray"] = 6] = "byteArray";
1677
+ HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["string"] = 7] = "string";
1678
+ HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["timestamp"] = 8] = "timestamp";
1679
+ HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["uuid"] = 9] = "uuid";
1680
+ })(HEADER_VALUE_TYPE || (HEADER_VALUE_TYPE = {}));
1681
+ var UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
1682
+ var Int64 = class _Int64 {
1683
+ constructor(bytes) {
1684
+ this.bytes = bytes;
1685
+ if (bytes.byteLength !== 8) {
1686
+ throw new Error("Int64 buffers must be exactly 8 bytes");
1687
+ }
1688
+ }
1689
+ static fromNumber(number) {
1690
+ if (number > 9223372036854776e3 || number < -9223372036854776e3) {
1691
+ throw new Error(`${number} is too large (or, if negative, too small) to represent as an Int64`);
1692
+ }
1693
+ const bytes = new Uint8Array(8);
1694
+ for (let i = 7, remaining = Math.abs(Math.round(number)); i > -1 && remaining > 0; i--, remaining /= 256) {
1695
+ bytes[i] = remaining;
1696
+ }
1697
+ if (number < 0) {
1698
+ negate(bytes);
1699
+ }
1700
+ return new _Int64(bytes);
1701
+ }
1702
+ valueOf() {
1703
+ const bytes = this.bytes.slice(0);
1704
+ const negative = bytes[0] & 128;
1705
+ if (negative) {
1706
+ negate(bytes);
1707
+ }
1708
+ return parseInt(toHex(bytes), 16) * (negative ? -1 : 1);
1709
+ }
1710
+ toString() {
1711
+ return String(this.valueOf());
1712
+ }
1713
+ };
1714
+ function negate(bytes) {
1715
+ for (let i = 0; i < 8; i++) {
1716
+ bytes[i] ^= 255;
1717
+ }
1718
+ for (let i = 7; i > -1; i--) {
1719
+ bytes[i]++;
1720
+ if (bytes[i] !== 0)
1721
+ break;
1722
+ }
1723
+ }
1724
+
1725
+ // node_modules/@smithy/signature-v4/dist-es/headerUtil.js
1726
+ var hasHeader = (soughtHeader, headers) => {
1727
+ soughtHeader = soughtHeader.toLowerCase();
1728
+ for (const headerName of Object.keys(headers)) {
1729
+ if (soughtHeader === headerName.toLowerCase()) {
1730
+ return true;
1731
+ }
1732
+ }
1733
+ return false;
1734
+ };
1735
+
1736
+ // node_modules/@smithy/signature-v4/dist-es/moveHeadersToQuery.js
1737
+ var moveHeadersToQuery = (request, options = {}) => {
1738
+ const { headers, query = {} } = HttpRequest.clone(request);
1739
+ for (const name of Object.keys(headers)) {
1740
+ const lname = name.toLowerCase();
1741
+ if (lname.slice(0, 6) === "x-amz-" && !options.unhoistableHeaders?.has(lname) || options.hoistableHeaders?.has(lname)) {
1742
+ query[name] = headers[name];
1743
+ delete headers[name];
1744
+ }
1745
+ }
1746
+ return {
1747
+ ...request,
1748
+ headers,
1749
+ query
1750
+ };
1751
+ };
1752
+
1753
+ // node_modules/@smithy/signature-v4/dist-es/prepareRequest.js
1754
+ var prepareRequest = (request) => {
1755
+ request = HttpRequest.clone(request);
1756
+ for (const headerName of Object.keys(request.headers)) {
1757
+ if (GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {
1758
+ delete request.headers[headerName];
1759
+ }
1760
+ }
1761
+ return request;
1762
+ };
1763
+
1764
+ // node_modules/@smithy/signature-v4/dist-es/getCanonicalQuery.js
1765
+ var getCanonicalQuery = ({ query = {} }) => {
1766
+ const keys = [];
1767
+ const serialized = {};
1768
+ for (const key of Object.keys(query)) {
1769
+ if (key.toLowerCase() === SIGNATURE_HEADER) {
1770
+ continue;
1771
+ }
1772
+ const encodedKey = escapeUri(key);
1773
+ keys.push(encodedKey);
1774
+ const value = query[key];
1775
+ if (typeof value === "string") {
1776
+ serialized[encodedKey] = `${encodedKey}=${escapeUri(value)}`;
1777
+ } else if (Array.isArray(value)) {
1778
+ serialized[encodedKey] = value.slice(0).reduce((encoded, value2) => encoded.concat([`${encodedKey}=${escapeUri(value2)}`]), []).sort().join("&");
1779
+ }
1780
+ }
1781
+ return keys.sort().map((key) => serialized[key]).filter((serialized2) => serialized2).join("&");
1782
+ };
1783
+
1784
+ // node_modules/@smithy/signature-v4/dist-es/utilDate.js
1785
+ var iso8601 = (time) => toDate(time).toISOString().replace(/\.\d{3}Z$/, "Z");
1786
+ var toDate = (time) => {
1787
+ if (typeof time === "number") {
1788
+ return new Date(time * 1e3);
1789
+ }
1790
+ if (typeof time === "string") {
1791
+ if (Number(time)) {
1792
+ return new Date(Number(time) * 1e3);
1793
+ }
1794
+ return new Date(time);
1795
+ }
1796
+ return time;
1797
+ };
1798
+
1799
+ // node_modules/@smithy/signature-v4/dist-es/SignatureV4Base.js
1800
+ var SignatureV4Base = class {
1801
+ constructor({ applyChecksum, credentials, region, service, sha256, uriEscapePath = true }) {
1802
+ this.service = service;
1803
+ this.sha256 = sha256;
1804
+ this.uriEscapePath = uriEscapePath;
1805
+ this.applyChecksum = typeof applyChecksum === "boolean" ? applyChecksum : true;
1806
+ this.regionProvider = normalizeProvider(region);
1807
+ this.credentialProvider = normalizeProvider(credentials);
1808
+ }
1809
+ createCanonicalRequest(request, canonicalHeaders, payloadHash) {
1810
+ const sortedHeaders = Object.keys(canonicalHeaders).sort();
1811
+ return `${request.method}
1812
+ ${this.getCanonicalPath(request)}
1813
+ ${getCanonicalQuery(request)}
1814
+ ${sortedHeaders.map((name) => `${name}:${canonicalHeaders[name]}`).join("\n")}
1815
+
1816
+ ${sortedHeaders.join(";")}
1817
+ ${payloadHash}`;
1818
+ }
1819
+ async createStringToSign(longDate, credentialScope, canonicalRequest, algorithmIdentifier) {
1820
+ const hash = new this.sha256();
1821
+ hash.update(toUint8Array(canonicalRequest));
1822
+ const hashedRequest = await hash.digest();
1823
+ return `${algorithmIdentifier}
1824
+ ${longDate}
1825
+ ${credentialScope}
1826
+ ${toHex(hashedRequest)}`;
1827
+ }
1828
+ getCanonicalPath({ path }) {
1829
+ if (this.uriEscapePath) {
1830
+ const normalizedPathSegments = [];
1831
+ for (const pathSegment of path.split("/")) {
1832
+ if (pathSegment?.length === 0)
1833
+ continue;
1834
+ if (pathSegment === ".")
1835
+ continue;
1836
+ if (pathSegment === "..") {
1837
+ normalizedPathSegments.pop();
1838
+ } else {
1839
+ normalizedPathSegments.push(pathSegment);
1840
+ }
1841
+ }
1842
+ const normalizedPath = `${path?.startsWith("/") ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && path?.endsWith("/") ? "/" : ""}`;
1843
+ const doubleEncoded = escapeUri(normalizedPath);
1844
+ return doubleEncoded.replace(/%2F/g, "/");
1845
+ }
1846
+ return path;
1847
+ }
1848
+ validateResolvedCredentials(credentials) {
1849
+ if (typeof credentials !== "object" || typeof credentials.accessKeyId !== "string" || typeof credentials.secretAccessKey !== "string") {
1850
+ throw new Error("Resolved credential object is not valid");
1851
+ }
1852
+ }
1853
+ formatDate(now) {
1854
+ const longDate = iso8601(now).replace(/[\-:]/g, "");
1855
+ return {
1856
+ longDate,
1857
+ shortDate: longDate.slice(0, 8)
1858
+ };
1859
+ }
1860
+ getCanonicalHeaderList(headers) {
1861
+ return Object.keys(headers).sort().join(";");
1862
+ }
1863
+ };
1864
+
1865
+ // node_modules/@smithy/signature-v4/dist-es/SignatureV4.js
1866
+ var SignatureV4 = class extends SignatureV4Base {
1867
+ constructor({ applyChecksum, credentials, region, service, sha256, uriEscapePath = true }) {
1868
+ super({
1869
+ applyChecksum,
1870
+ credentials,
1871
+ region,
1872
+ service,
1873
+ sha256,
1874
+ uriEscapePath
1875
+ });
1876
+ this.headerFormatter = new HeaderFormatter();
1877
+ }
1878
+ async presign(originalRequest, options = {}) {
1879
+ const { signingDate = /* @__PURE__ */ new Date(), expiresIn = 3600, unsignableHeaders, unhoistableHeaders, signableHeaders, hoistableHeaders, signingRegion, signingService } = options;
1880
+ const credentials = await this.credentialProvider();
1881
+ this.validateResolvedCredentials(credentials);
1882
+ const region = signingRegion ?? await this.regionProvider();
1883
+ const { longDate, shortDate } = this.formatDate(signingDate);
1884
+ if (expiresIn > MAX_PRESIGNED_TTL) {
1885
+ return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");
1886
+ }
1887
+ const scope = createScope(shortDate, region, signingService ?? this.service);
1888
+ const request = moveHeadersToQuery(prepareRequest(originalRequest), { unhoistableHeaders, hoistableHeaders });
1889
+ if (credentials.sessionToken) {
1890
+ request.query[TOKEN_QUERY_PARAM] = credentials.sessionToken;
1891
+ }
1892
+ request.query[ALGORITHM_QUERY_PARAM] = ALGORITHM_IDENTIFIER;
1893
+ request.query[CREDENTIAL_QUERY_PARAM] = `${credentials.accessKeyId}/${scope}`;
1894
+ request.query[AMZ_DATE_QUERY_PARAM] = longDate;
1895
+ request.query[EXPIRES_QUERY_PARAM] = expiresIn.toString(10);
1896
+ const canonicalHeaders = getCanonicalHeaders(request, unsignableHeaders, signableHeaders);
1897
+ request.query[SIGNED_HEADERS_QUERY_PARAM] = this.getCanonicalHeaderList(canonicalHeaders);
1898
+ request.query[SIGNATURE_QUERY_PARAM] = await this.getSignature(longDate, scope, this.getSigningKey(credentials, region, shortDate, signingService), this.createCanonicalRequest(request, canonicalHeaders, await getPayloadHash(originalRequest, this.sha256)));
1899
+ return request;
1900
+ }
1901
+ async sign(toSign, options) {
1902
+ if (typeof toSign === "string") {
1903
+ return this.signString(toSign, options);
1904
+ } else if (toSign.headers && toSign.payload) {
1905
+ return this.signEvent(toSign, options);
1906
+ } else if (toSign.message) {
1907
+ return this.signMessage(toSign, options);
1908
+ } else {
1909
+ return this.signRequest(toSign, options);
1910
+ }
1911
+ }
1912
+ async signEvent({ headers, payload }, { signingDate = /* @__PURE__ */ new Date(), priorSignature, signingRegion, signingService }) {
1913
+ const region = signingRegion ?? await this.regionProvider();
1914
+ const { shortDate, longDate } = this.formatDate(signingDate);
1915
+ const scope = createScope(shortDate, region, signingService ?? this.service);
1916
+ const hashedPayload = await getPayloadHash({ headers: {}, body: payload }, this.sha256);
1917
+ const hash = new this.sha256();
1918
+ hash.update(headers);
1919
+ const hashedHeaders = toHex(await hash.digest());
1920
+ const stringToSign = [
1921
+ EVENT_ALGORITHM_IDENTIFIER,
1922
+ longDate,
1923
+ scope,
1924
+ priorSignature,
1925
+ hashedHeaders,
1926
+ hashedPayload
1927
+ ].join("\n");
1928
+ return this.signString(stringToSign, { signingDate, signingRegion: region, signingService });
1929
+ }
1930
+ async signMessage(signableMessage, { signingDate = /* @__PURE__ */ new Date(), signingRegion, signingService }) {
1931
+ const promise = this.signEvent({
1932
+ headers: this.headerFormatter.format(signableMessage.message.headers),
1933
+ payload: signableMessage.message.body
1934
+ }, {
1935
+ signingDate,
1936
+ signingRegion,
1937
+ signingService,
1938
+ priorSignature: signableMessage.priorSignature
1939
+ });
1940
+ return promise.then((signature) => {
1941
+ return { message: signableMessage.message, signature };
1942
+ });
1943
+ }
1944
+ async signString(stringToSign, { signingDate = /* @__PURE__ */ new Date(), signingRegion, signingService } = {}) {
1945
+ const credentials = await this.credentialProvider();
1946
+ this.validateResolvedCredentials(credentials);
1947
+ const region = signingRegion ?? await this.regionProvider();
1948
+ const { shortDate } = this.formatDate(signingDate);
1949
+ const hash = new this.sha256(await this.getSigningKey(credentials, region, shortDate, signingService));
1950
+ hash.update(toUint8Array(stringToSign));
1951
+ return toHex(await hash.digest());
1952
+ }
1953
+ async signRequest(requestToSign, { signingDate = /* @__PURE__ */ new Date(), signableHeaders, unsignableHeaders, signingRegion, signingService } = {}) {
1954
+ const credentials = await this.credentialProvider();
1955
+ this.validateResolvedCredentials(credentials);
1956
+ const region = signingRegion ?? await this.regionProvider();
1957
+ const request = prepareRequest(requestToSign);
1958
+ const { longDate, shortDate } = this.formatDate(signingDate);
1959
+ const scope = createScope(shortDate, region, signingService ?? this.service);
1960
+ request.headers[AMZ_DATE_HEADER] = longDate;
1961
+ if (credentials.sessionToken) {
1962
+ request.headers[TOKEN_HEADER] = credentials.sessionToken;
1963
+ }
1964
+ const payloadHash = await getPayloadHash(request, this.sha256);
1965
+ if (!hasHeader(SHA256_HEADER, request.headers) && this.applyChecksum) {
1966
+ request.headers[SHA256_HEADER] = payloadHash;
1967
+ }
1968
+ const canonicalHeaders = getCanonicalHeaders(request, unsignableHeaders, signableHeaders);
1969
+ const signature = await this.getSignature(longDate, scope, this.getSigningKey(credentials, region, shortDate, signingService), this.createCanonicalRequest(request, canonicalHeaders, payloadHash));
1970
+ request.headers[AUTH_HEADER] = `${ALGORITHM_IDENTIFIER} Credential=${credentials.accessKeyId}/${scope}, SignedHeaders=${this.getCanonicalHeaderList(canonicalHeaders)}, Signature=${signature}`;
1971
+ return request;
1972
+ }
1973
+ async getSignature(longDate, credentialScope, keyPromise, canonicalRequest) {
1974
+ const stringToSign = await this.createStringToSign(longDate, credentialScope, canonicalRequest, ALGORITHM_IDENTIFIER);
1975
+ const hash = new this.sha256(await keyPromise);
1976
+ hash.update(toUint8Array(stringToSign));
1977
+ return toHex(await hash.digest());
1978
+ }
1979
+ getSigningKey(credentials, region, shortDate, service) {
1980
+ return getSigningKey(this.sha256, credentials, shortDate, region, service || this.service);
1981
+ }
1982
+ };
1983
+
1984
+ // node_modules/@smithy/signature-v4/dist-es/signature-v4a-container.js
1985
+ var signatureV4aContainer = {
1986
+ SignatureV4a: null
1987
+ };
1988
+
1989
+ // node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.js
1990
+ var resolveAwsSdkSigV4Config = (config) => {
1991
+ let inputCredentials = config.credentials;
1992
+ let isUserSupplied = !!config.credentials;
1993
+ let resolvedCredentials = void 0;
1994
+ Object.defineProperty(config, "credentials", {
1995
+ set(credentials) {
1996
+ if (credentials && credentials !== inputCredentials && credentials !== resolvedCredentials) {
1997
+ isUserSupplied = true;
1998
+ }
1999
+ inputCredentials = credentials;
2000
+ const memoizedProvider = normalizeCredentialProvider(config, {
2001
+ credentials: inputCredentials,
2002
+ credentialDefaultProvider: config.credentialDefaultProvider
2003
+ });
2004
+ const boundProvider = bindCallerConfig(config, memoizedProvider);
2005
+ if (isUserSupplied && !boundProvider.attributed) {
2006
+ resolvedCredentials = async (options) => boundProvider(options).then((creds) => setCredentialFeature(creds, "CREDENTIALS_CODE", "e"));
2007
+ resolvedCredentials.memoized = boundProvider.memoized;
2008
+ resolvedCredentials.configBound = boundProvider.configBound;
2009
+ resolvedCredentials.attributed = true;
2010
+ } else {
2011
+ resolvedCredentials = boundProvider;
2012
+ }
2013
+ },
2014
+ get() {
2015
+ return resolvedCredentials;
2016
+ },
2017
+ enumerable: true,
2018
+ configurable: true
2019
+ });
2020
+ config.credentials = inputCredentials;
2021
+ const { signingEscapePath = true, systemClockOffset = config.systemClockOffset || 0, sha256 } = config;
2022
+ let signer;
2023
+ if (config.signer) {
2024
+ signer = normalizeProvider2(config.signer);
2025
+ } else if (config.regionInfoProvider) {
2026
+ signer = () => normalizeProvider2(config.region)().then(async (region) => [
2027
+ await config.regionInfoProvider(region, {
2028
+ useFipsEndpoint: await config.useFipsEndpoint(),
2029
+ useDualstackEndpoint: await config.useDualstackEndpoint()
2030
+ }) || {},
2031
+ region
2032
+ ]).then(([regionInfo, region]) => {
2033
+ const { signingRegion, signingService } = regionInfo;
2034
+ config.signingRegion = config.signingRegion || signingRegion || region;
2035
+ config.signingName = config.signingName || signingService || config.serviceId;
2036
+ const params = {
2037
+ ...config,
2038
+ credentials: config.credentials,
2039
+ region: config.signingRegion,
2040
+ service: config.signingName,
2041
+ sha256,
2042
+ uriEscapePath: signingEscapePath
2043
+ };
2044
+ const SignerCtor = config.signerConstructor || SignatureV4;
2045
+ return new SignerCtor(params);
2046
+ });
2047
+ } else {
2048
+ signer = async (authScheme) => {
2049
+ authScheme = Object.assign({}, {
2050
+ name: "sigv4",
2051
+ signingName: config.signingName || config.defaultSigningName,
2052
+ signingRegion: await normalizeProvider2(config.region)(),
2053
+ properties: {}
2054
+ }, authScheme);
2055
+ const signingRegion = authScheme.signingRegion;
2056
+ const signingService = authScheme.signingName;
2057
+ config.signingRegion = config.signingRegion || signingRegion;
2058
+ config.signingName = config.signingName || signingService || config.serviceId;
2059
+ const params = {
2060
+ ...config,
2061
+ credentials: config.credentials,
2062
+ region: config.signingRegion,
2063
+ service: config.signingName,
2064
+ sha256,
2065
+ uriEscapePath: signingEscapePath
2066
+ };
2067
+ const SignerCtor = config.signerConstructor || SignatureV4;
2068
+ return new SignerCtor(params);
2069
+ };
2070
+ }
2071
+ const resolvedConfig = Object.assign(config, {
2072
+ systemClockOffset,
2073
+ signingEscapePath,
2074
+ signer
2075
+ });
2076
+ return resolvedConfig;
2077
+ };
2078
+ function normalizeCredentialProvider(config, { credentials, credentialDefaultProvider }) {
2079
+ let credentialsProvider;
2080
+ if (credentials) {
2081
+ if (!credentials?.memoized) {
2082
+ credentialsProvider = memoizeIdentityProvider(credentials, isIdentityExpired, doesIdentityRequireRefresh);
2083
+ } else {
2084
+ credentialsProvider = credentials;
2085
+ }
2086
+ } else {
2087
+ if (credentialDefaultProvider) {
2088
+ credentialsProvider = normalizeProvider2(credentialDefaultProvider(Object.assign({}, config, {
2089
+ parentClientConfig: config
2090
+ })));
2091
+ } else {
2092
+ credentialsProvider = async () => {
2093
+ throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.");
2094
+ };
2095
+ }
2096
+ }
2097
+ credentialsProvider.memoized = true;
2098
+ return credentialsProvider;
2099
+ }
2100
+ function bindCallerConfig(config, credentialsProvider) {
2101
+ if (credentialsProvider.configBound) {
2102
+ return credentialsProvider;
2103
+ }
2104
+ const fn = async (options) => credentialsProvider({ ...options, callerClientConfig: config });
2105
+ fn.memoized = credentialsProvider.memoized;
2106
+ fn.configBound = true;
2107
+ return fn;
2108
+ }
2109
+
2110
+ // node_modules/@aws-sdk/core/dist-es/submodules/protocols/common.js
2111
+ var collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
2112
+
2113
+ // node_modules/@aws-sdk/middleware-user-agent/dist-es/check-features.js
2114
+ var ACCOUNT_ID_ENDPOINT_REGEX = /\d{12}\.ddb/;
2115
+ async function checkFeatures(context, config, args) {
2116
+ const request = args.request;
2117
+ if (request?.headers?.["smithy-protocol"] === "rpc-v2-cbor") {
2118
+ setFeature2(context, "PROTOCOL_RPC_V2_CBOR", "M");
2119
+ }
2120
+ if (typeof config.retryStrategy === "function") {
2121
+ const retryStrategy = await config.retryStrategy();
2122
+ if (typeof retryStrategy.acquireInitialRetryToken === "function") {
2123
+ if (retryStrategy.constructor?.name?.includes("Adaptive")) {
2124
+ setFeature2(context, "RETRY_MODE_ADAPTIVE", "F");
2125
+ } else {
2126
+ setFeature2(context, "RETRY_MODE_STANDARD", "E");
2127
+ }
2128
+ } else {
2129
+ setFeature2(context, "RETRY_MODE_LEGACY", "D");
2130
+ }
2131
+ }
2132
+ if (typeof config.accountIdEndpointMode === "function") {
2133
+ const endpointV2 = context.endpointV2;
2134
+ if (String(endpointV2?.url?.hostname).match(ACCOUNT_ID_ENDPOINT_REGEX)) {
2135
+ setFeature2(context, "ACCOUNT_ID_ENDPOINT", "O");
2136
+ }
2137
+ switch (await config.accountIdEndpointMode?.()) {
2138
+ case "disabled":
2139
+ setFeature2(context, "ACCOUNT_ID_MODE_DISABLED", "Q");
2140
+ break;
2141
+ case "preferred":
2142
+ setFeature2(context, "ACCOUNT_ID_MODE_PREFERRED", "P");
2143
+ break;
2144
+ case "required":
2145
+ setFeature2(context, "ACCOUNT_ID_MODE_REQUIRED", "R");
2146
+ break;
2147
+ }
2148
+ }
2149
+ const identity = context.__smithy_context?.selectedHttpAuthScheme?.identity;
2150
+ if (identity?.$source) {
2151
+ const credentials = identity;
2152
+ if (credentials.accountId) {
2153
+ setFeature2(context, "RESOLVED_ACCOUNT_ID", "T");
2154
+ }
2155
+ for (const [key, value] of Object.entries(credentials.$source ?? {})) {
2156
+ setFeature2(context, key, value);
2157
+ }
2158
+ }
2159
+ }
2160
+
2161
+ // node_modules/@aws-sdk/middleware-user-agent/dist-es/constants.js
2162
+ var USER_AGENT = "user-agent";
2163
+ var X_AMZ_USER_AGENT = "x-amz-user-agent";
2164
+ var SPACE = " ";
2165
+ var UA_NAME_SEPARATOR = "/";
2166
+ var UA_NAME_ESCAPE_REGEX = /[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g;
2167
+ var UA_VALUE_ESCAPE_REGEX = /[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g;
2168
+ var UA_ESCAPE_CHAR = "-";
2169
+
2170
+ // node_modules/@aws-sdk/middleware-user-agent/dist-es/encode-features.js
2171
+ var BYTE_LIMIT = 1024;
2172
+ function encodeFeatures(features) {
2173
+ let buffer = "";
2174
+ for (const key in features) {
2175
+ const val = features[key];
2176
+ if (buffer.length + val.length + 1 <= BYTE_LIMIT) {
2177
+ if (buffer.length) {
2178
+ buffer += "," + val;
2179
+ } else {
2180
+ buffer += val;
2181
+ }
2182
+ continue;
2183
+ }
2184
+ break;
2185
+ }
2186
+ return buffer;
2187
+ }
2188
+
2189
+ // node_modules/@aws-sdk/middleware-user-agent/dist-es/user-agent-middleware.js
2190
+ var userAgentMiddleware = (options) => (next, context) => async (args) => {
2191
+ const { request } = args;
2192
+ if (!HttpRequest.isInstance(request)) {
2193
+ return next(args);
2194
+ }
2195
+ const { headers } = request;
2196
+ const userAgent = context?.userAgent?.map(escapeUserAgent) || [];
2197
+ const defaultUserAgent = (await options.defaultUserAgentProvider()).map(escapeUserAgent);
2198
+ await checkFeatures(context, options, args);
2199
+ const awsContext = context;
2200
+ defaultUserAgent.push(`m/${encodeFeatures(Object.assign({}, context.__smithy_context?.features, awsContext.__aws_sdk_context?.features))}`);
2201
+ const customUserAgent = options?.customUserAgent?.map(escapeUserAgent) || [];
2202
+ const appId = await options.userAgentAppId();
2203
+ if (appId) {
2204
+ defaultUserAgent.push(escapeUserAgent([`app/${appId}`]));
2205
+ }
2206
+ const prefix = getUserAgentPrefix();
2207
+ const sdkUserAgentValue = (prefix ? [prefix] : []).concat([...defaultUserAgent, ...userAgent, ...customUserAgent]).join(SPACE);
2208
+ const normalUAValue = [
2209
+ ...defaultUserAgent.filter((section) => section.startsWith("aws-sdk-")),
2210
+ ...customUserAgent
2211
+ ].join(SPACE);
2212
+ if (options.runtime !== "browser") {
2213
+ if (normalUAValue) {
2214
+ headers[X_AMZ_USER_AGENT] = headers[X_AMZ_USER_AGENT] ? `${headers[USER_AGENT]} ${normalUAValue}` : normalUAValue;
2215
+ }
2216
+ headers[USER_AGENT] = sdkUserAgentValue;
2217
+ } else {
2218
+ headers[X_AMZ_USER_AGENT] = sdkUserAgentValue;
2219
+ }
2220
+ return next({
2221
+ ...args,
2222
+ request
2223
+ });
2224
+ };
2225
+ var escapeUserAgent = (userAgentPair) => {
2226
+ const name = userAgentPair[0].split(UA_NAME_SEPARATOR).map((part) => part.replace(UA_NAME_ESCAPE_REGEX, UA_ESCAPE_CHAR)).join(UA_NAME_SEPARATOR);
2227
+ const version = userAgentPair[1]?.replace(UA_VALUE_ESCAPE_REGEX, UA_ESCAPE_CHAR);
2228
+ const prefixSeparatorIndex = name.indexOf(UA_NAME_SEPARATOR);
2229
+ const prefix = name.substring(0, prefixSeparatorIndex);
2230
+ let uaName = name.substring(prefixSeparatorIndex + 1);
2231
+ if (prefix === "api") {
2232
+ uaName = uaName.toLowerCase();
2233
+ }
2234
+ return [prefix, uaName, version].filter((item) => item && item.length > 0).reduce((acc, item, index) => {
2235
+ switch (index) {
2236
+ case 0:
2237
+ return item;
2238
+ case 1:
2239
+ return `${acc}/${item}`;
2240
+ default:
2241
+ return `${acc}#${item}`;
2242
+ }
2243
+ }, "");
2244
+ };
2245
+ var getUserAgentMiddlewareOptions = {
2246
+ name: "getUserAgentMiddleware",
2247
+ step: "build",
2248
+ priority: "low",
2249
+ tags: ["SET_USER_AGENT", "USER_AGENT"],
2250
+ override: true
2251
+ };
2252
+ var getUserAgentPlugin = (config) => ({
2253
+ applyToStack: (clientStack) => {
2254
+ clientStack.add(userAgentMiddleware(config), getUserAgentMiddlewareOptions);
2255
+ }
2256
+ });
2257
+
2258
+ // node_modules/@smithy/config-resolver/dist-es/regionConfig/isFipsRegion.js
2259
+ var isFipsRegion = (region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips"));
2260
+
2261
+ // node_modules/@smithy/config-resolver/dist-es/regionConfig/getRealRegion.js
2262
+ var getRealRegion = (region) => isFipsRegion(region) ? ["fips-aws-global", "aws-fips"].includes(region) ? "us-east-1" : region.replace(/fips-(dkr-|prod-)?|-fips/, "") : region;
2263
+
2264
+ // node_modules/@smithy/config-resolver/dist-es/regionConfig/resolveRegionConfig.js
2265
+ var resolveRegionConfig = (input) => {
2266
+ const { region, useFipsEndpoint } = input;
2267
+ if (!region) {
2268
+ throw new Error("Region is missing");
2269
+ }
2270
+ return Object.assign(input, {
2271
+ region: async () => {
2272
+ if (typeof region === "string") {
2273
+ return getRealRegion(region);
2274
+ }
2275
+ const providedRegion = await region();
2276
+ return getRealRegion(providedRegion);
2277
+ },
2278
+ useFipsEndpoint: async () => {
2279
+ const providedRegion = typeof region === "string" ? region : await region();
2280
+ if (isFipsRegion(providedRegion)) {
2281
+ return true;
2282
+ }
2283
+ return typeof useFipsEndpoint !== "function" ? Promise.resolve(!!useFipsEndpoint) : useFipsEndpoint();
2284
+ }
2285
+ });
2286
+ };
2287
+
2288
+ // node_modules/@smithy/util-config-provider/dist-es/booleanSelector.js
2289
+ var booleanSelector = (obj, key, type) => {
2290
+ if (!(key in obj))
2291
+ return void 0;
2292
+ if (obj[key] === "true")
2293
+ return true;
2294
+ if (obj[key] === "false")
2295
+ return false;
2296
+ throw new Error(`Cannot load ${type} "${key}". Expected "true" or "false", got ${obj[key]}.`);
2297
+ };
2298
+
2299
+ // node_modules/@smithy/util-config-provider/dist-es/types.js
2300
+ var SelectorType;
2301
+ (function(SelectorType2) {
2302
+ SelectorType2["ENV"] = "env";
2303
+ SelectorType2["CONFIG"] = "shared config entry";
2304
+ })(SelectorType || (SelectorType = {}));
2305
+
2306
+ // node_modules/@smithy/config-resolver/dist-es/endpointsConfig/NodeUseDualstackEndpointConfigOptions.js
2307
+ var ENV_USE_DUALSTACK_ENDPOINT = "AWS_USE_DUALSTACK_ENDPOINT";
2308
+ var CONFIG_USE_DUALSTACK_ENDPOINT = "use_dualstack_endpoint";
2309
+ var NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS = {
2310
+ environmentVariableSelector: (env2) => booleanSelector(env2, ENV_USE_DUALSTACK_ENDPOINT, SelectorType.ENV),
2311
+ configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_DUALSTACK_ENDPOINT, SelectorType.CONFIG),
2312
+ default: false
2313
+ };
2314
+
2315
+ // node_modules/@smithy/config-resolver/dist-es/endpointsConfig/NodeUseFipsEndpointConfigOptions.js
2316
+ var ENV_USE_FIPS_ENDPOINT = "AWS_USE_FIPS_ENDPOINT";
2317
+ var CONFIG_USE_FIPS_ENDPOINT = "use_fips_endpoint";
2318
+ var NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS = {
2319
+ environmentVariableSelector: (env2) => booleanSelector(env2, ENV_USE_FIPS_ENDPOINT, SelectorType.ENV),
2320
+ configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_FIPS_ENDPOINT, SelectorType.CONFIG),
2321
+ default: false
2322
+ };
2323
+
2324
+ // node_modules/@smithy/config-resolver/dist-es/regionConfig/config.js
2325
+ var REGION_ENV_NAME = "AWS_REGION";
2326
+ var REGION_INI_NAME = "region";
2327
+ var NODE_REGION_CONFIG_OPTIONS = {
2328
+ environmentVariableSelector: (env2) => env2[REGION_ENV_NAME],
2329
+ configFileSelector: (profile) => profile[REGION_INI_NAME],
2330
+ default: () => {
2331
+ throw new Error("Region is missing");
2332
+ }
2333
+ };
2334
+ var NODE_REGION_CONFIG_FILE_OPTIONS = {
2335
+ preferredFile: "credentials"
2336
+ };
2337
+
2338
+ // node_modules/@smithy/middleware-content-length/dist-es/index.js
2339
+ var CONTENT_LENGTH_HEADER = "content-length";
2340
+ function contentLengthMiddleware(bodyLengthChecker) {
2341
+ return (next) => async (args) => {
2342
+ const request = args.request;
2343
+ if (HttpRequest.isInstance(request)) {
2344
+ const { body, headers } = request;
2345
+ if (body && Object.keys(headers).map((str) => str.toLowerCase()).indexOf(CONTENT_LENGTH_HEADER) === -1) {
2346
+ try {
2347
+ const length = bodyLengthChecker(body);
2348
+ request.headers = {
2349
+ ...request.headers,
2350
+ [CONTENT_LENGTH_HEADER]: String(length)
2351
+ };
2352
+ } catch (error) {
2353
+ }
2354
+ }
2355
+ }
2356
+ return next({
2357
+ ...args,
2358
+ request
2359
+ });
2360
+ };
2361
+ }
2362
+ var contentLengthMiddlewareOptions = {
2363
+ step: "build",
2364
+ tags: ["SET_CONTENT_LENGTH", "CONTENT_LENGTH"],
2365
+ name: "contentLengthMiddleware",
2366
+ override: true
2367
+ };
2368
+ var getContentLengthPlugin = (options) => ({
2369
+ applyToStack: (clientStack) => {
2370
+ clientStack.add(contentLengthMiddleware(options.bodyLengthChecker), contentLengthMiddlewareOptions);
2371
+ }
2372
+ });
2373
+
2374
+ // node_modules/@smithy/middleware-endpoint/dist-es/service-customizations/s3.js
2375
+ var resolveParamsForS3 = async (endpointParams) => {
2376
+ const bucket = endpointParams?.Bucket || "";
2377
+ if (typeof endpointParams.Bucket === "string") {
2378
+ endpointParams.Bucket = bucket.replace(/#/g, encodeURIComponent("#")).replace(/\?/g, encodeURIComponent("?"));
2379
+ }
2380
+ if (isArnBucketName(bucket)) {
2381
+ if (endpointParams.ForcePathStyle === true) {
2382
+ throw new Error("Path-style addressing cannot be used with ARN buckets");
2383
+ }
2384
+ } else if (!isDnsCompatibleBucketName(bucket) || bucket.indexOf(".") !== -1 && !String(endpointParams.Endpoint).startsWith("http:") || bucket.toLowerCase() !== bucket || bucket.length < 3) {
2385
+ endpointParams.ForcePathStyle = true;
2386
+ }
2387
+ if (endpointParams.DisableMultiRegionAccessPoints) {
2388
+ endpointParams.disableMultiRegionAccessPoints = true;
2389
+ endpointParams.DisableMRAP = true;
2390
+ }
2391
+ return endpointParams;
2392
+ };
2393
+ var DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/;
2394
+ var IP_ADDRESS_PATTERN = /(\d+\.){3}\d+/;
2395
+ var DOTS_PATTERN = /\.\./;
2396
+ var isDnsCompatibleBucketName = (bucketName) => DOMAIN_PATTERN.test(bucketName) && !IP_ADDRESS_PATTERN.test(bucketName) && !DOTS_PATTERN.test(bucketName);
2397
+ var isArnBucketName = (bucketName) => {
2398
+ const [arn, partition2, service, , , bucket] = bucketName.split(":");
2399
+ const isArn = arn === "arn" && bucketName.split(":").length >= 6;
2400
+ const isValidArn = Boolean(isArn && partition2 && service && bucket);
2401
+ if (isArn && !isValidArn) {
2402
+ throw new Error(`Invalid ARN: ${bucketName} was an invalid ARN.`);
2403
+ }
2404
+ return isValidArn;
2405
+ };
2406
+
2407
+ // node_modules/@smithy/middleware-endpoint/dist-es/adaptors/createConfigValueProvider.js
2408
+ var createConfigValueProvider = (configKey, canonicalEndpointParamKey, config) => {
2409
+ const configProvider = async () => {
2410
+ const configValue = config[configKey] ?? config[canonicalEndpointParamKey];
2411
+ if (typeof configValue === "function") {
2412
+ return configValue();
2413
+ }
2414
+ return configValue;
2415
+ };
2416
+ if (configKey === "credentialScope" || canonicalEndpointParamKey === "CredentialScope") {
2417
+ return async () => {
2418
+ const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials;
2419
+ const configValue = credentials?.credentialScope ?? credentials?.CredentialScope;
2420
+ return configValue;
2421
+ };
2422
+ }
2423
+ if (configKey === "accountId" || canonicalEndpointParamKey === "AccountId") {
2424
+ return async () => {
2425
+ const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials;
2426
+ const configValue = credentials?.accountId ?? credentials?.AccountId;
2427
+ return configValue;
2428
+ };
2429
+ }
2430
+ if (configKey === "endpoint" || canonicalEndpointParamKey === "endpoint") {
2431
+ return async () => {
2432
+ const endpoint = await configProvider();
2433
+ if (endpoint && typeof endpoint === "object") {
2434
+ if ("url" in endpoint) {
2435
+ return endpoint.url.href;
2436
+ }
2437
+ if ("hostname" in endpoint) {
2438
+ const { protocol, hostname, port, path } = endpoint;
2439
+ return `${protocol}//${hostname}${port ? ":" + port : ""}${path}`;
2440
+ }
2441
+ }
2442
+ return endpoint;
2443
+ };
2444
+ }
2445
+ return configProvider;
2446
+ };
2447
+
2448
+ // node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointUrlConfig.js
2449
+ var ENV_ENDPOINT_URL = "AWS_ENDPOINT_URL";
2450
+ var CONFIG_ENDPOINT_URL = "endpoint_url";
2451
+ var getEndpointUrlConfig = (serviceId) => ({
2452
+ environmentVariableSelector: (env2) => {
2453
+ const serviceSuffixParts = serviceId.split(" ").map((w) => w.toUpperCase());
2454
+ const serviceEndpointUrl = env2[[ENV_ENDPOINT_URL, ...serviceSuffixParts].join("_")];
2455
+ if (serviceEndpointUrl)
2456
+ return serviceEndpointUrl;
2457
+ const endpointUrl = env2[ENV_ENDPOINT_URL];
2458
+ if (endpointUrl)
2459
+ return endpointUrl;
2460
+ return void 0;
2461
+ },
2462
+ configFileSelector: (profile, config) => {
2463
+ if (config && profile.services) {
2464
+ const servicesSection = config[["services", profile.services].join(CONFIG_PREFIX_SEPARATOR)];
2465
+ if (servicesSection) {
2466
+ const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase());
2467
+ const endpointUrl2 = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(CONFIG_PREFIX_SEPARATOR)];
2468
+ if (endpointUrl2)
2469
+ return endpointUrl2;
2470
+ }
2471
+ }
2472
+ const endpointUrl = profile[CONFIG_ENDPOINT_URL];
2473
+ if (endpointUrl)
2474
+ return endpointUrl;
2475
+ return void 0;
2476
+ },
2477
+ default: void 0
2478
+ });
2479
+
2480
+ // node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointFromConfig.js
2481
+ var getEndpointFromConfig = async (serviceId) => loadConfig(getEndpointUrlConfig(serviceId ?? ""))();
2482
+
2483
+ // node_modules/@smithy/middleware-endpoint/dist-es/adaptors/toEndpointV1.js
2484
+ var toEndpointV1 = (endpoint) => {
2485
+ if (typeof endpoint === "object") {
2486
+ if ("url" in endpoint) {
2487
+ return parseUrl(endpoint.url);
2488
+ }
2489
+ return endpoint;
2490
+ }
2491
+ return parseUrl(endpoint);
2492
+ };
2493
+
2494
+ // node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointFromInstructions.js
2495
+ var getEndpointFromInstructions = async (commandInput, instructionsSupplier, clientConfig, context) => {
2496
+ if (!clientConfig.endpoint) {
2497
+ let endpointFromConfig;
2498
+ if (clientConfig.serviceConfiguredEndpoint) {
2499
+ endpointFromConfig = await clientConfig.serviceConfiguredEndpoint();
2500
+ } else {
2501
+ endpointFromConfig = await getEndpointFromConfig(clientConfig.serviceId);
2502
+ }
2503
+ if (endpointFromConfig) {
2504
+ clientConfig.endpoint = () => Promise.resolve(toEndpointV1(endpointFromConfig));
2505
+ }
2506
+ }
2507
+ const endpointParams = await resolveParams(commandInput, instructionsSupplier, clientConfig);
2508
+ if (typeof clientConfig.endpointProvider !== "function") {
2509
+ throw new Error("config.endpointProvider is not set.");
2510
+ }
2511
+ const endpoint = clientConfig.endpointProvider(endpointParams, context);
2512
+ return endpoint;
2513
+ };
2514
+ var resolveParams = async (commandInput, instructionsSupplier, clientConfig) => {
2515
+ const endpointParams = {};
2516
+ const instructions = instructionsSupplier?.getEndpointParameterInstructions?.() || {};
2517
+ for (const [name, instruction] of Object.entries(instructions)) {
2518
+ switch (instruction.type) {
2519
+ case "staticContextParams":
2520
+ endpointParams[name] = instruction.value;
2521
+ break;
2522
+ case "contextParams":
2523
+ endpointParams[name] = commandInput[instruction.name];
2524
+ break;
2525
+ case "clientContextParams":
2526
+ case "builtInParams":
2527
+ endpointParams[name] = await createConfigValueProvider(instruction.name, name, clientConfig)();
2528
+ break;
2529
+ case "operationContextParams":
2530
+ endpointParams[name] = instruction.get(commandInput);
2531
+ break;
2532
+ default:
2533
+ throw new Error("Unrecognized endpoint parameter instruction: " + JSON.stringify(instruction));
2534
+ }
2535
+ }
2536
+ if (Object.keys(instructions).length === 0) {
2537
+ Object.assign(endpointParams, clientConfig);
2538
+ }
2539
+ if (String(clientConfig.serviceId).toLowerCase() === "s3") {
2540
+ await resolveParamsForS3(endpointParams);
2541
+ }
2542
+ return endpointParams;
2543
+ };
2544
+
2545
+ // node_modules/@smithy/middleware-endpoint/dist-es/endpointMiddleware.js
2546
+ var endpointMiddleware = ({ config, instructions }) => {
2547
+ return (next, context) => async (args) => {
2548
+ if (config.endpoint) {
2549
+ setFeature(context, "ENDPOINT_OVERRIDE", "N");
2550
+ }
2551
+ const endpoint = await getEndpointFromInstructions(args.input, {
2552
+ getEndpointParameterInstructions() {
2553
+ return instructions;
2554
+ }
2555
+ }, { ...config }, context);
2556
+ context.endpointV2 = endpoint;
2557
+ context.authSchemes = endpoint.properties?.authSchemes;
2558
+ const authScheme = context.authSchemes?.[0];
2559
+ if (authScheme) {
2560
+ context["signing_region"] = authScheme.signingRegion;
2561
+ context["signing_service"] = authScheme.signingName;
2562
+ const smithyContext = getSmithyContext(context);
2563
+ const httpAuthOption = smithyContext?.selectedHttpAuthScheme?.httpAuthOption;
2564
+ if (httpAuthOption) {
2565
+ httpAuthOption.signingProperties = Object.assign(httpAuthOption.signingProperties || {}, {
2566
+ signing_region: authScheme.signingRegion,
2567
+ signingRegion: authScheme.signingRegion,
2568
+ signing_service: authScheme.signingName,
2569
+ signingName: authScheme.signingName,
2570
+ signingRegionSet: authScheme.signingRegionSet
2571
+ }, authScheme.properties);
2572
+ }
2573
+ }
2574
+ return next({
2575
+ ...args
2576
+ });
2577
+ };
2578
+ };
2579
+
2580
+ // node_modules/@smithy/middleware-endpoint/dist-es/getEndpointPlugin.js
2581
+ var endpointMiddlewareOptions = {
2582
+ step: "serialize",
2583
+ tags: ["ENDPOINT_PARAMETERS", "ENDPOINT_V2", "ENDPOINT"],
2584
+ name: "endpointV2Middleware",
2585
+ override: true,
2586
+ relation: "before",
2587
+ toMiddleware: serializerMiddlewareOption.name
2588
+ };
2589
+ var getEndpointPlugin = (config, instructions) => ({
2590
+ applyToStack: (clientStack) => {
2591
+ clientStack.addRelativeTo(endpointMiddleware({
2592
+ config,
2593
+ instructions
2594
+ }), endpointMiddlewareOptions);
2595
+ }
2596
+ });
2597
+
2598
+ // node_modules/@smithy/middleware-endpoint/dist-es/resolveEndpointConfig.js
2599
+ var resolveEndpointConfig = (input) => {
2600
+ const tls = input.tls ?? true;
2601
+ const { endpoint, useDualstackEndpoint, useFipsEndpoint } = input;
2602
+ const customEndpointProvider = endpoint != null ? async () => toEndpointV1(await normalizeProvider(endpoint)()) : void 0;
2603
+ const isCustomEndpoint = !!endpoint;
2604
+ const resolvedConfig = Object.assign(input, {
2605
+ endpoint: customEndpointProvider,
2606
+ tls,
2607
+ isCustomEndpoint,
2608
+ useDualstackEndpoint: normalizeProvider(useDualstackEndpoint ?? false),
2609
+ useFipsEndpoint: normalizeProvider(useFipsEndpoint ?? false)
2610
+ });
2611
+ let configuredEndpointPromise = void 0;
2612
+ resolvedConfig.serviceConfiguredEndpoint = async () => {
2613
+ if (input.serviceId && !configuredEndpointPromise) {
2614
+ configuredEndpointPromise = getEndpointFromConfig(input.serviceId);
2615
+ }
2616
+ return configuredEndpointPromise;
2617
+ };
2618
+ return resolvedConfig;
2619
+ };
2620
+
2621
+ // node_modules/@smithy/util-retry/dist-es/config.js
2622
+ var RETRY_MODES;
2623
+ (function(RETRY_MODES2) {
2624
+ RETRY_MODES2["STANDARD"] = "standard";
2625
+ RETRY_MODES2["ADAPTIVE"] = "adaptive";
2626
+ })(RETRY_MODES || (RETRY_MODES = {}));
2627
+ var DEFAULT_MAX_ATTEMPTS = 3;
2628
+ var DEFAULT_RETRY_MODE = RETRY_MODES.STANDARD;
2629
+
2630
+ // node_modules/@smithy/service-error-classification/dist-es/constants.js
2631
+ var THROTTLING_ERROR_CODES = [
2632
+ "BandwidthLimitExceeded",
2633
+ "EC2ThrottledException",
2634
+ "LimitExceededException",
2635
+ "PriorRequestNotComplete",
2636
+ "ProvisionedThroughputExceededException",
2637
+ "RequestLimitExceeded",
2638
+ "RequestThrottled",
2639
+ "RequestThrottledException",
2640
+ "SlowDown",
2641
+ "ThrottledException",
2642
+ "Throttling",
2643
+ "ThrottlingException",
2644
+ "TooManyRequestsException",
2645
+ "TransactionInProgressException"
2646
+ ];
2647
+ var TRANSIENT_ERROR_CODES = ["TimeoutError", "RequestTimeout", "RequestTimeoutException"];
2648
+ var TRANSIENT_ERROR_STATUS_CODES = [500, 502, 503, 504];
2649
+ var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "ECONNREFUSED", "EPIPE", "ETIMEDOUT"];
2650
+ var NODEJS_NETWORK_ERROR_CODES = ["EHOSTUNREACH", "ENETUNREACH", "ENOTFOUND"];
2651
+
2652
+ // node_modules/@smithy/service-error-classification/dist-es/index.js
2653
+ var isClockSkewCorrectedError = (error) => error.$metadata?.clockSkewCorrected;
2654
+ var isBrowserNetworkError = (error) => {
2655
+ const errorMessages = /* @__PURE__ */ new Set([
2656
+ "Failed to fetch",
2657
+ "NetworkError when attempting to fetch resource",
2658
+ "The Internet connection appears to be offline",
2659
+ "Load failed",
2660
+ "Network request failed"
2661
+ ]);
2662
+ const isValid = error && error instanceof TypeError;
2663
+ if (!isValid) {
2664
+ return false;
2665
+ }
2666
+ return errorMessages.has(error.message);
2667
+ };
2668
+ var isThrottlingError = (error) => error.$metadata?.httpStatusCode === 429 || THROTTLING_ERROR_CODES.includes(error.name) || error.$retryable?.throttling == true;
2669
+ var isTransientError = (error, depth = 0) => isClockSkewCorrectedError(error) || TRANSIENT_ERROR_CODES.includes(error.name) || NODEJS_TIMEOUT_ERROR_CODES.includes(error?.code || "") || NODEJS_NETWORK_ERROR_CODES.includes(error?.code || "") || TRANSIENT_ERROR_STATUS_CODES.includes(error.$metadata?.httpStatusCode || 0) || isBrowserNetworkError(error) || error.cause !== void 0 && depth <= 10 && isTransientError(error.cause, depth + 1);
2670
+ var isServerError = (error) => {
2671
+ if (error.$metadata?.httpStatusCode !== void 0) {
2672
+ const statusCode = error.$metadata.httpStatusCode;
2673
+ if (500 <= statusCode && statusCode <= 599 && !isTransientError(error)) {
2674
+ return true;
2675
+ }
2676
+ return false;
2677
+ }
2678
+ return false;
2679
+ };
2680
+
2681
+ // node_modules/@smithy/util-retry/dist-es/DefaultRateLimiter.js
2682
+ var DefaultRateLimiter = class _DefaultRateLimiter {
2683
+ constructor(options) {
2684
+ this.currentCapacity = 0;
2685
+ this.enabled = false;
2686
+ this.lastMaxRate = 0;
2687
+ this.measuredTxRate = 0;
2688
+ this.requestCount = 0;
2689
+ this.lastTimestamp = 0;
2690
+ this.timeWindow = 0;
2691
+ this.beta = options?.beta ?? 0.7;
2692
+ this.minCapacity = options?.minCapacity ?? 1;
2693
+ this.minFillRate = options?.minFillRate ?? 0.5;
2694
+ this.scaleConstant = options?.scaleConstant ?? 0.4;
2695
+ this.smooth = options?.smooth ?? 0.8;
2696
+ const currentTimeInSeconds = this.getCurrentTimeInSeconds();
2697
+ this.lastThrottleTime = currentTimeInSeconds;
2698
+ this.lastTxRateBucket = Math.floor(this.getCurrentTimeInSeconds());
2699
+ this.fillRate = this.minFillRate;
2700
+ this.maxCapacity = this.minCapacity;
2701
+ }
2702
+ getCurrentTimeInSeconds() {
2703
+ return Date.now() / 1e3;
2704
+ }
2705
+ async getSendToken() {
2706
+ return this.acquireTokenBucket(1);
2707
+ }
2708
+ async acquireTokenBucket(amount) {
2709
+ if (!this.enabled) {
2710
+ return;
2711
+ }
2712
+ this.refillTokenBucket();
2713
+ if (amount > this.currentCapacity) {
2714
+ const delay = (amount - this.currentCapacity) / this.fillRate * 1e3;
2715
+ await new Promise((resolve) => _DefaultRateLimiter.setTimeoutFn(resolve, delay));
2716
+ }
2717
+ this.currentCapacity = this.currentCapacity - amount;
2718
+ }
2719
+ refillTokenBucket() {
2720
+ const timestamp = this.getCurrentTimeInSeconds();
2721
+ if (!this.lastTimestamp) {
2722
+ this.lastTimestamp = timestamp;
2723
+ return;
2724
+ }
2725
+ const fillAmount = (timestamp - this.lastTimestamp) * this.fillRate;
2726
+ this.currentCapacity = Math.min(this.maxCapacity, this.currentCapacity + fillAmount);
2727
+ this.lastTimestamp = timestamp;
2728
+ }
2729
+ updateClientSendingRate(response) {
2730
+ let calculatedRate;
2731
+ this.updateMeasuredRate();
2732
+ if (isThrottlingError(response)) {
2733
+ const rateToUse = !this.enabled ? this.measuredTxRate : Math.min(this.measuredTxRate, this.fillRate);
2734
+ this.lastMaxRate = rateToUse;
2735
+ this.calculateTimeWindow();
2736
+ this.lastThrottleTime = this.getCurrentTimeInSeconds();
2737
+ calculatedRate = this.cubicThrottle(rateToUse);
2738
+ this.enableTokenBucket();
2739
+ } else {
2740
+ this.calculateTimeWindow();
2741
+ calculatedRate = this.cubicSuccess(this.getCurrentTimeInSeconds());
2742
+ }
2743
+ const newRate = Math.min(calculatedRate, 2 * this.measuredTxRate);
2744
+ this.updateTokenBucketRate(newRate);
2745
+ }
2746
+ calculateTimeWindow() {
2747
+ this.timeWindow = this.getPrecise(Math.pow(this.lastMaxRate * (1 - this.beta) / this.scaleConstant, 1 / 3));
2748
+ }
2749
+ cubicThrottle(rateToUse) {
2750
+ return this.getPrecise(rateToUse * this.beta);
2751
+ }
2752
+ cubicSuccess(timestamp) {
2753
+ return this.getPrecise(this.scaleConstant * Math.pow(timestamp - this.lastThrottleTime - this.timeWindow, 3) + this.lastMaxRate);
2754
+ }
2755
+ enableTokenBucket() {
2756
+ this.enabled = true;
2757
+ }
2758
+ updateTokenBucketRate(newRate) {
2759
+ this.refillTokenBucket();
2760
+ this.fillRate = Math.max(newRate, this.minFillRate);
2761
+ this.maxCapacity = Math.max(newRate, this.minCapacity);
2762
+ this.currentCapacity = Math.min(this.currentCapacity, this.maxCapacity);
2763
+ }
2764
+ updateMeasuredRate() {
2765
+ const t = this.getCurrentTimeInSeconds();
2766
+ const timeBucket = Math.floor(t * 2) / 2;
2767
+ this.requestCount++;
2768
+ if (timeBucket > this.lastTxRateBucket) {
2769
+ const currentRate = this.requestCount / (timeBucket - this.lastTxRateBucket);
2770
+ this.measuredTxRate = this.getPrecise(currentRate * this.smooth + this.measuredTxRate * (1 - this.smooth));
2771
+ this.requestCount = 0;
2772
+ this.lastTxRateBucket = timeBucket;
2773
+ }
2774
+ }
2775
+ getPrecise(num) {
2776
+ return parseFloat(num.toFixed(8));
2777
+ }
2778
+ };
2779
+ DefaultRateLimiter.setTimeoutFn = setTimeout;
2780
+
2781
+ // node_modules/@smithy/util-retry/dist-es/constants.js
2782
+ var DEFAULT_RETRY_DELAY_BASE = 100;
2783
+ var MAXIMUM_RETRY_DELAY = 20 * 1e3;
2784
+ var THROTTLING_RETRY_DELAY_BASE = 500;
2785
+ var INITIAL_RETRY_TOKENS = 500;
2786
+ var RETRY_COST = 5;
2787
+ var TIMEOUT_RETRY_COST = 10;
2788
+ var NO_RETRY_INCREMENT = 1;
2789
+ var INVOCATION_ID_HEADER = "amz-sdk-invocation-id";
2790
+ var REQUEST_HEADER = "amz-sdk-request";
2791
+
2792
+ // node_modules/@smithy/util-retry/dist-es/defaultRetryBackoffStrategy.js
2793
+ var getDefaultRetryBackoffStrategy = () => {
2794
+ let delayBase = DEFAULT_RETRY_DELAY_BASE;
2795
+ const computeNextBackoffDelay = (attempts) => {
2796
+ return Math.floor(Math.min(MAXIMUM_RETRY_DELAY, Math.random() * 2 ** attempts * delayBase));
2797
+ };
2798
+ const setDelayBase = (delay) => {
2799
+ delayBase = delay;
2800
+ };
2801
+ return {
2802
+ computeNextBackoffDelay,
2803
+ setDelayBase
2804
+ };
2805
+ };
2806
+
2807
+ // node_modules/@smithy/util-retry/dist-es/defaultRetryToken.js
2808
+ var createDefaultRetryToken = ({ retryDelay, retryCount, retryCost }) => {
2809
+ const getRetryCount = () => retryCount;
2810
+ const getRetryDelay = () => Math.min(MAXIMUM_RETRY_DELAY, retryDelay);
2811
+ const getRetryCost = () => retryCost;
2812
+ return {
2813
+ getRetryCount,
2814
+ getRetryDelay,
2815
+ getRetryCost
2816
+ };
2817
+ };
2818
+
2819
+ // node_modules/@smithy/util-retry/dist-es/StandardRetryStrategy.js
2820
+ var StandardRetryStrategy = class {
2821
+ constructor(maxAttempts) {
2822
+ this.maxAttempts = maxAttempts;
2823
+ this.mode = RETRY_MODES.STANDARD;
2824
+ this.capacity = INITIAL_RETRY_TOKENS;
2825
+ this.retryBackoffStrategy = getDefaultRetryBackoffStrategy();
2826
+ this.maxAttemptsProvider = typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts;
2827
+ }
2828
+ async acquireInitialRetryToken(retryTokenScope) {
2829
+ return createDefaultRetryToken({
2830
+ retryDelay: DEFAULT_RETRY_DELAY_BASE,
2831
+ retryCount: 0
2832
+ });
2833
+ }
2834
+ async refreshRetryTokenForRetry(token, errorInfo) {
2835
+ const maxAttempts = await this.getMaxAttempts();
2836
+ if (this.shouldRetry(token, errorInfo, maxAttempts)) {
2837
+ const errorType = errorInfo.errorType;
2838
+ this.retryBackoffStrategy.setDelayBase(errorType === "THROTTLING" ? THROTTLING_RETRY_DELAY_BASE : DEFAULT_RETRY_DELAY_BASE);
2839
+ const delayFromErrorType = this.retryBackoffStrategy.computeNextBackoffDelay(token.getRetryCount());
2840
+ const retryDelay = errorInfo.retryAfterHint ? Math.max(errorInfo.retryAfterHint.getTime() - Date.now() || 0, delayFromErrorType) : delayFromErrorType;
2841
+ const capacityCost = this.getCapacityCost(errorType);
2842
+ this.capacity -= capacityCost;
2843
+ return createDefaultRetryToken({
2844
+ retryDelay,
2845
+ retryCount: token.getRetryCount() + 1,
2846
+ retryCost: capacityCost
2847
+ });
2848
+ }
2849
+ throw new Error("No retry token available");
2850
+ }
2851
+ recordSuccess(token) {
2852
+ this.capacity = Math.max(INITIAL_RETRY_TOKENS, this.capacity + (token.getRetryCost() ?? NO_RETRY_INCREMENT));
2853
+ }
2854
+ getCapacity() {
2855
+ return this.capacity;
2856
+ }
2857
+ async getMaxAttempts() {
2858
+ try {
2859
+ return await this.maxAttemptsProvider();
2860
+ } catch (error) {
2861
+ console.warn(`Max attempts provider could not resolve. Using default of ${DEFAULT_MAX_ATTEMPTS}`);
2862
+ return DEFAULT_MAX_ATTEMPTS;
2863
+ }
2864
+ }
2865
+ shouldRetry(tokenToRenew, errorInfo, maxAttempts) {
2866
+ const attempts = tokenToRenew.getRetryCount() + 1;
2867
+ return attempts < maxAttempts && this.capacity >= this.getCapacityCost(errorInfo.errorType) && this.isRetryableError(errorInfo.errorType);
2868
+ }
2869
+ getCapacityCost(errorType) {
2870
+ return errorType === "TRANSIENT" ? TIMEOUT_RETRY_COST : RETRY_COST;
2871
+ }
2872
+ isRetryableError(errorType) {
2873
+ return errorType === "THROTTLING" || errorType === "TRANSIENT";
2874
+ }
2875
+ };
2876
+
2877
+ // node_modules/@smithy/util-retry/dist-es/AdaptiveRetryStrategy.js
2878
+ var AdaptiveRetryStrategy = class {
2879
+ constructor(maxAttemptsProvider, options) {
2880
+ this.maxAttemptsProvider = maxAttemptsProvider;
2881
+ this.mode = RETRY_MODES.ADAPTIVE;
2882
+ const { rateLimiter } = options ?? {};
2883
+ this.rateLimiter = rateLimiter ?? new DefaultRateLimiter();
2884
+ this.standardRetryStrategy = new StandardRetryStrategy(maxAttemptsProvider);
2885
+ }
2886
+ async acquireInitialRetryToken(retryTokenScope) {
2887
+ await this.rateLimiter.getSendToken();
2888
+ return this.standardRetryStrategy.acquireInitialRetryToken(retryTokenScope);
2889
+ }
2890
+ async refreshRetryTokenForRetry(tokenToRenew, errorInfo) {
2891
+ this.rateLimiter.updateClientSendingRate(errorInfo);
2892
+ return this.standardRetryStrategy.refreshRetryTokenForRetry(tokenToRenew, errorInfo);
2893
+ }
2894
+ recordSuccess(token) {
2895
+ this.rateLimiter.updateClientSendingRate({});
2896
+ this.standardRetryStrategy.recordSuccess(token);
2897
+ }
2898
+ };
2899
+
2900
+ // node_modules/@smithy/middleware-retry/dist-es/configurations.js
2901
+ var ENV_MAX_ATTEMPTS = "AWS_MAX_ATTEMPTS";
2902
+ var CONFIG_MAX_ATTEMPTS = "max_attempts";
2903
+ var NODE_MAX_ATTEMPT_CONFIG_OPTIONS = {
2904
+ environmentVariableSelector: (env2) => {
2905
+ const value = env2[ENV_MAX_ATTEMPTS];
2906
+ if (!value)
2907
+ return void 0;
2908
+ const maxAttempt = parseInt(value);
2909
+ if (Number.isNaN(maxAttempt)) {
2910
+ throw new Error(`Environment variable ${ENV_MAX_ATTEMPTS} mast be a number, got "${value}"`);
2911
+ }
2912
+ return maxAttempt;
2913
+ },
2914
+ configFileSelector: (profile) => {
2915
+ const value = profile[CONFIG_MAX_ATTEMPTS];
2916
+ if (!value)
2917
+ return void 0;
2918
+ const maxAttempt = parseInt(value);
2919
+ if (Number.isNaN(maxAttempt)) {
2920
+ throw new Error(`Shared config file entry ${CONFIG_MAX_ATTEMPTS} mast be a number, got "${value}"`);
2921
+ }
2922
+ return maxAttempt;
2923
+ },
2924
+ default: DEFAULT_MAX_ATTEMPTS
2925
+ };
2926
+ var resolveRetryConfig = (input) => {
2927
+ const { retryStrategy, retryMode: _retryMode, maxAttempts: _maxAttempts } = input;
2928
+ const maxAttempts = normalizeProvider(_maxAttempts ?? DEFAULT_MAX_ATTEMPTS);
2929
+ return Object.assign(input, {
2930
+ maxAttempts,
2931
+ retryStrategy: async () => {
2932
+ if (retryStrategy) {
2933
+ return retryStrategy;
2934
+ }
2935
+ const retryMode = await normalizeProvider(_retryMode)();
2936
+ if (retryMode === RETRY_MODES.ADAPTIVE) {
2937
+ return new AdaptiveRetryStrategy(maxAttempts);
2938
+ }
2939
+ return new StandardRetryStrategy(maxAttempts);
2940
+ }
2941
+ });
2942
+ };
2943
+ var ENV_RETRY_MODE = "AWS_RETRY_MODE";
2944
+ var CONFIG_RETRY_MODE = "retry_mode";
2945
+ var NODE_RETRY_MODE_CONFIG_OPTIONS = {
2946
+ environmentVariableSelector: (env2) => env2[ENV_RETRY_MODE],
2947
+ configFileSelector: (profile) => profile[CONFIG_RETRY_MODE],
2948
+ default: DEFAULT_RETRY_MODE
2949
+ };
2950
+
2951
+ // node_modules/uuid/dist/esm-node/rng.js
2952
+ import crypto from "crypto";
2953
+ var rnds8Pool = new Uint8Array(256);
2954
+ var poolPtr = rnds8Pool.length;
2955
+ function rng() {
2956
+ if (poolPtr > rnds8Pool.length - 16) {
2957
+ crypto.randomFillSync(rnds8Pool);
2958
+ poolPtr = 0;
2959
+ }
2960
+ return rnds8Pool.slice(poolPtr, poolPtr += 16);
2961
+ }
2962
+
2963
+ // node_modules/uuid/dist/esm-node/stringify.js
2964
+ var byteToHex = [];
2965
+ for (let i = 0; i < 256; ++i) {
2966
+ byteToHex.push((i + 256).toString(16).slice(1));
2967
+ }
2968
+ function unsafeStringify(arr, offset = 0) {
2969
+ return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
2970
+ }
2971
+
2972
+ // node_modules/uuid/dist/esm-node/native.js
2973
+ import crypto2 from "crypto";
2974
+ var native_default = {
2975
+ randomUUID: crypto2.randomUUID
2976
+ };
2977
+
2978
+ // node_modules/uuid/dist/esm-node/v4.js
2979
+ function v4(options, buf, offset) {
2980
+ if (native_default.randomUUID && !buf && !options) {
2981
+ return native_default.randomUUID();
2982
+ }
2983
+ options = options || {};
2984
+ const rnds = options.random || (options.rng || rng)();
2985
+ rnds[6] = rnds[6] & 15 | 64;
2986
+ rnds[8] = rnds[8] & 63 | 128;
2987
+ if (buf) {
2988
+ offset = offset || 0;
2989
+ for (let i = 0; i < 16; ++i) {
2990
+ buf[offset + i] = rnds[i];
2991
+ }
2992
+ return buf;
2993
+ }
2994
+ return unsafeStringify(rnds);
2995
+ }
2996
+ var v4_default = v4;
2997
+
2998
+ // node_modules/@smithy/middleware-retry/dist-es/isStreamingPayload/isStreamingPayload.js
2999
+ import { Readable } from "stream";
3000
+ var isStreamingPayload = (request) => request?.body instanceof Readable || typeof ReadableStream !== "undefined" && request?.body instanceof ReadableStream;
3001
+
3002
+ // node_modules/@smithy/middleware-retry/dist-es/util.js
3003
+ var asSdkError = (error) => {
3004
+ if (error instanceof Error)
3005
+ return error;
3006
+ if (error instanceof Object)
3007
+ return Object.assign(new Error(), error);
3008
+ if (typeof error === "string")
3009
+ return new Error(error);
3010
+ return new Error(`AWS SDK error wrapper for ${error}`);
3011
+ };
3012
+
3013
+ // node_modules/@smithy/middleware-retry/dist-es/retryMiddleware.js
3014
+ var retryMiddleware = (options) => (next, context) => async (args) => {
3015
+ let retryStrategy = await options.retryStrategy();
3016
+ const maxAttempts = await options.maxAttempts();
3017
+ if (isRetryStrategyV2(retryStrategy)) {
3018
+ retryStrategy = retryStrategy;
3019
+ let retryToken = await retryStrategy.acquireInitialRetryToken(context["partition_id"]);
3020
+ let lastError = new Error();
3021
+ let attempts = 0;
3022
+ let totalRetryDelay = 0;
3023
+ const { request } = args;
3024
+ const isRequest = HttpRequest.isInstance(request);
3025
+ if (isRequest) {
3026
+ request.headers[INVOCATION_ID_HEADER] = v4_default();
3027
+ }
3028
+ while (true) {
3029
+ try {
3030
+ if (isRequest) {
3031
+ request.headers[REQUEST_HEADER] = `attempt=${attempts + 1}; max=${maxAttempts}`;
3032
+ }
3033
+ const { response, output } = await next(args);
3034
+ retryStrategy.recordSuccess(retryToken);
3035
+ output.$metadata.attempts = attempts + 1;
3036
+ output.$metadata.totalRetryDelay = totalRetryDelay;
3037
+ return { response, output };
3038
+ } catch (e) {
3039
+ const retryErrorInfo = getRetryErrorInfo(e);
3040
+ lastError = asSdkError(e);
3041
+ if (isRequest && isStreamingPayload(request)) {
3042
+ (context.logger instanceof NoOpLogger ? console : context.logger)?.warn("An error was encountered in a non-retryable streaming request.");
3043
+ throw lastError;
3044
+ }
3045
+ try {
3046
+ retryToken = await retryStrategy.refreshRetryTokenForRetry(retryToken, retryErrorInfo);
3047
+ } catch (refreshError) {
3048
+ if (!lastError.$metadata) {
3049
+ lastError.$metadata = {};
3050
+ }
3051
+ lastError.$metadata.attempts = attempts + 1;
3052
+ lastError.$metadata.totalRetryDelay = totalRetryDelay;
3053
+ throw lastError;
3054
+ }
3055
+ attempts = retryToken.getRetryCount();
3056
+ const delay = retryToken.getRetryDelay();
3057
+ totalRetryDelay += delay;
3058
+ await new Promise((resolve) => setTimeout(resolve, delay));
3059
+ }
3060
+ }
3061
+ } else {
3062
+ retryStrategy = retryStrategy;
3063
+ if (retryStrategy?.mode)
3064
+ context.userAgent = [...context.userAgent || [], ["cfg/retry-mode", retryStrategy.mode]];
3065
+ return retryStrategy.retry(next, args);
3066
+ }
3067
+ };
3068
+ var isRetryStrategyV2 = (retryStrategy) => typeof retryStrategy.acquireInitialRetryToken !== "undefined" && typeof retryStrategy.refreshRetryTokenForRetry !== "undefined" && typeof retryStrategy.recordSuccess !== "undefined";
3069
+ var getRetryErrorInfo = (error) => {
3070
+ const errorInfo = {
3071
+ error,
3072
+ errorType: getRetryErrorType(error)
3073
+ };
3074
+ const retryAfterHint = getRetryAfterHint(error.$response);
3075
+ if (retryAfterHint) {
3076
+ errorInfo.retryAfterHint = retryAfterHint;
3077
+ }
3078
+ return errorInfo;
3079
+ };
3080
+ var getRetryErrorType = (error) => {
3081
+ if (isThrottlingError(error))
3082
+ return "THROTTLING";
3083
+ if (isTransientError(error))
3084
+ return "TRANSIENT";
3085
+ if (isServerError(error))
3086
+ return "SERVER_ERROR";
3087
+ return "CLIENT_ERROR";
3088
+ };
3089
+ var retryMiddlewareOptions = {
3090
+ name: "retryMiddleware",
3091
+ tags: ["RETRY"],
3092
+ step: "finalizeRequest",
3093
+ priority: "high",
3094
+ override: true
3095
+ };
3096
+ var getRetryPlugin = (options) => ({
3097
+ applyToStack: (clientStack) => {
3098
+ clientStack.add(retryMiddleware(options), retryMiddlewareOptions);
3099
+ }
3100
+ });
3101
+ var getRetryAfterHint = (response) => {
3102
+ if (!HttpResponse.isInstance(response))
3103
+ return;
3104
+ const retryAfterHeaderName = Object.keys(response.headers).find((key) => key.toLowerCase() === "retry-after");
3105
+ if (!retryAfterHeaderName)
3106
+ return;
3107
+ const retryAfter = response.headers[retryAfterHeaderName];
3108
+ const retryAfterSeconds = Number(retryAfter);
3109
+ if (!Number.isNaN(retryAfterSeconds))
3110
+ return new Date(retryAfterSeconds * 1e3);
3111
+ const retryAfterDate = new Date(retryAfter);
3112
+ return retryAfterDate;
3113
+ };
3114
+
3115
+ // node_modules/@aws-sdk/util-user-agent-node/dist-es/defaultUserAgent.js
3116
+ import { platform, release } from "os";
3117
+ import { env, versions } from "process";
3118
+
3119
+ // node_modules/@aws-sdk/util-user-agent-node/dist-es/crt-availability.js
3120
+ var crtAvailability = {
3121
+ isCrtAvailable: false
3122
+ };
3123
+
3124
+ // node_modules/@aws-sdk/util-user-agent-node/dist-es/is-crt-available.js
3125
+ var isCrtAvailable = () => {
3126
+ if (crtAvailability.isCrtAvailable) {
3127
+ return ["md/crt-avail"];
3128
+ }
3129
+ return null;
3130
+ };
3131
+
3132
+ // node_modules/@aws-sdk/util-user-agent-node/dist-es/defaultUserAgent.js
3133
+ var createDefaultUserAgentProvider = ({ serviceId, clientVersion }) => {
3134
+ return async (config) => {
3135
+ const sections = [
3136
+ ["aws-sdk-js", clientVersion],
3137
+ ["ua", "2.1"],
3138
+ [`os/${platform()}`, release()],
3139
+ ["lang/js"],
3140
+ ["md/nodejs", `${versions.node}`]
3141
+ ];
3142
+ const crtAvailable = isCrtAvailable();
3143
+ if (crtAvailable) {
3144
+ sections.push(crtAvailable);
3145
+ }
3146
+ if (serviceId) {
3147
+ sections.push([`api/${serviceId}`, clientVersion]);
3148
+ }
3149
+ if (env.AWS_EXECUTION_ENV) {
3150
+ sections.push([`exec-env/${env.AWS_EXECUTION_ENV}`]);
3151
+ }
3152
+ const appId = await config?.userAgentAppId?.();
3153
+ const resolvedUserAgent = appId ? [...sections, [`app/${appId}`]] : [...sections];
3154
+ return resolvedUserAgent;
3155
+ };
3156
+ };
3157
+
3158
+ // node_modules/@aws-sdk/util-user-agent-node/dist-es/nodeAppIdConfigOptions.js
3159
+ var UA_APP_ID_ENV_NAME = "AWS_SDK_UA_APP_ID";
3160
+ var UA_APP_ID_INI_NAME = "sdk_ua_app_id";
3161
+ var UA_APP_ID_INI_NAME_DEPRECATED = "sdk-ua-app-id";
3162
+ var NODE_APP_ID_CONFIG_OPTIONS = {
3163
+ environmentVariableSelector: (env2) => env2[UA_APP_ID_ENV_NAME],
3164
+ configFileSelector: (profile) => profile[UA_APP_ID_INI_NAME] ?? profile[UA_APP_ID_INI_NAME_DEPRECATED],
3165
+ default: DEFAULT_UA_APP_ID
3166
+ };
3167
+
3168
+ // node_modules/@smithy/hash-node/dist-es/index.js
3169
+ import { Buffer as Buffer2 } from "buffer";
3170
+ import { createHash, createHmac } from "crypto";
3171
+ var Hash = class {
3172
+ constructor(algorithmIdentifier, secret) {
3173
+ this.algorithmIdentifier = algorithmIdentifier;
3174
+ this.secret = secret;
3175
+ this.reset();
3176
+ }
3177
+ update(toHash, encoding) {
3178
+ this.hash.update(toUint8Array(castSourceData(toHash, encoding)));
3179
+ }
3180
+ digest() {
3181
+ return Promise.resolve(this.hash.digest());
3182
+ }
3183
+ reset() {
3184
+ this.hash = this.secret ? createHmac(this.algorithmIdentifier, castSourceData(this.secret)) : createHash(this.algorithmIdentifier);
3185
+ }
3186
+ };
3187
+ function castSourceData(toCast, encoding) {
3188
+ if (Buffer2.isBuffer(toCast)) {
3189
+ return toCast;
3190
+ }
3191
+ if (typeof toCast === "string") {
3192
+ return fromString(toCast, encoding);
3193
+ }
3194
+ if (ArrayBuffer.isView(toCast)) {
3195
+ return fromArrayBuffer(toCast.buffer, toCast.byteOffset, toCast.byteLength);
3196
+ }
3197
+ return fromArrayBuffer(toCast);
3198
+ }
3199
+
3200
+ // node_modules/@smithy/util-body-length-node/dist-es/calculateBodyLength.js
3201
+ import { fstatSync, lstatSync } from "fs";
3202
+ var calculateBodyLength = (body) => {
3203
+ if (!body) {
3204
+ return 0;
3205
+ }
3206
+ if (typeof body === "string") {
3207
+ return Buffer.byteLength(body);
3208
+ } else if (typeof body.byteLength === "number") {
3209
+ return body.byteLength;
3210
+ } else if (typeof body.size === "number") {
3211
+ return body.size;
3212
+ } else if (typeof body.start === "number" && typeof body.end === "number") {
3213
+ return body.end + 1 - body.start;
3214
+ } else if (typeof body.path === "string" || Buffer.isBuffer(body.path)) {
3215
+ return lstatSync(body.path).size;
3216
+ } else if (typeof body.fd === "number") {
3217
+ return fstatSync(body.fd).size;
3218
+ }
3219
+ throw new Error(`Body Length computation failed for ${body}`);
3220
+ };
3221
+
3222
+ // node_modules/@smithy/util-defaults-mode-node/dist-es/constants.js
3223
+ var AWS_EXECUTION_ENV = "AWS_EXECUTION_ENV";
3224
+ var AWS_REGION_ENV = "AWS_REGION";
3225
+ var AWS_DEFAULT_REGION_ENV = "AWS_DEFAULT_REGION";
3226
+ var ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED";
3227
+ var DEFAULTS_MODE_OPTIONS = ["in-region", "cross-region", "mobile", "standard", "legacy"];
3228
+ var IMDS_REGION_PATH = "/latest/meta-data/placement/region";
3229
+
3230
+ // node_modules/@smithy/util-defaults-mode-node/dist-es/defaultsModeConfig.js
3231
+ var AWS_DEFAULTS_MODE_ENV = "AWS_DEFAULTS_MODE";
3232
+ var AWS_DEFAULTS_MODE_CONFIG = "defaults_mode";
3233
+ var NODE_DEFAULTS_MODE_CONFIG_OPTIONS = {
3234
+ environmentVariableSelector: (env2) => {
3235
+ return env2[AWS_DEFAULTS_MODE_ENV];
3236
+ },
3237
+ configFileSelector: (profile) => {
3238
+ return profile[AWS_DEFAULTS_MODE_CONFIG];
3239
+ },
3240
+ default: "legacy"
3241
+ };
3242
+
3243
+ // node_modules/@smithy/util-defaults-mode-node/dist-es/resolveDefaultsModeConfig.js
3244
+ var resolveDefaultsModeConfig = ({ region = loadConfig(NODE_REGION_CONFIG_OPTIONS), defaultsMode = loadConfig(NODE_DEFAULTS_MODE_CONFIG_OPTIONS) } = {}) => memoize(async () => {
3245
+ const mode = typeof defaultsMode === "function" ? await defaultsMode() : defaultsMode;
3246
+ switch (mode?.toLowerCase()) {
3247
+ case "auto":
3248
+ return resolveNodeDefaultsModeAuto(region);
3249
+ case "in-region":
3250
+ case "cross-region":
3251
+ case "mobile":
3252
+ case "standard":
3253
+ case "legacy":
3254
+ return Promise.resolve(mode?.toLocaleLowerCase());
3255
+ case void 0:
3256
+ return Promise.resolve("legacy");
3257
+ default:
3258
+ throw new Error(`Invalid parameter for "defaultsMode", expect ${DEFAULTS_MODE_OPTIONS.join(", ")}, got ${mode}`);
3259
+ }
3260
+ });
3261
+ var resolveNodeDefaultsModeAuto = async (clientRegion) => {
3262
+ if (clientRegion) {
3263
+ const resolvedRegion = typeof clientRegion === "function" ? await clientRegion() : clientRegion;
3264
+ const inferredRegion = await inferPhysicalRegion();
3265
+ if (!inferredRegion) {
3266
+ return "standard";
3267
+ }
3268
+ if (resolvedRegion === inferredRegion) {
3269
+ return "in-region";
3270
+ } else {
3271
+ return "cross-region";
3272
+ }
3273
+ }
3274
+ return "standard";
3275
+ };
3276
+ var inferPhysicalRegion = async () => {
3277
+ if (process.env[AWS_EXECUTION_ENV] && (process.env[AWS_REGION_ENV] || process.env[AWS_DEFAULT_REGION_ENV])) {
3278
+ return process.env[AWS_REGION_ENV] ?? process.env[AWS_DEFAULT_REGION_ENV];
3279
+ }
3280
+ if (!process.env[ENV_IMDS_DISABLED]) {
3281
+ try {
3282
+ const { getInstanceMetadataEndpoint, httpRequest } = await import("./dist-es-MXGFLXV2.js");
3283
+ const endpoint = await getInstanceMetadataEndpoint();
3284
+ return (await httpRequest({ ...endpoint, path: IMDS_REGION_PATH })).toString();
3285
+ } catch (e) {
3286
+ }
3287
+ }
3288
+ };
3289
+
3290
+ // node_modules/@aws-sdk/region-config-resolver/dist-es/extensions/index.js
3291
+ var getAwsRegionExtensionConfiguration = (runtimeConfig) => {
3292
+ return {
3293
+ setRegion(region) {
3294
+ runtimeConfig.region = region;
3295
+ },
3296
+ region() {
3297
+ return runtimeConfig.region;
3298
+ }
3299
+ };
3300
+ };
3301
+ var resolveAwsRegionExtensionConfiguration = (awsRegionExtensionConfiguration) => {
3302
+ return {
3303
+ region: awsRegionExtensionConfiguration.region()
3304
+ };
3305
+ };
3306
+
3307
+ export {
3308
+ emitWarningIfUnsupportedVersion,
3309
+ setFeature2 as setFeature,
3310
+ AwsSdkSigV4Signer,
3311
+ AwsSdkSigV4ASigner,
3312
+ NODE_AUTH_SCHEME_PREFERENCE_OPTIONS,
3313
+ getHttpAuthSchemeEndpointRuleSetPlugin,
3314
+ getSerdePlugin,
3315
+ httpSigningMiddlewareOptions,
3316
+ getHttpSigningPlugin,
3317
+ DefaultIdentityProviderConfig,
3318
+ NoAuthSigner,
3319
+ resolveAwsSdkSigV4AConfig,
3320
+ NODE_SIGV4A_CONFIG_OPTIONS,
3321
+ SignatureV4,
3322
+ signatureV4aContainer,
3323
+ resolveAwsSdkSigV4Config,
3324
+ collectBodyString,
3325
+ resolveHostHeaderConfig,
3326
+ getHostHeaderPlugin,
3327
+ getLoggerPlugin,
3328
+ getRecursionDetectionPlugin,
3329
+ booleanSelector,
3330
+ SelectorType,
3331
+ resolveUserAgentConfig,
3332
+ EndpointCache,
3333
+ customEndpointFunctions,
3334
+ resolveEndpoint,
3335
+ awsEndpointFunctions,
3336
+ getUserAgentPlugin,
3337
+ NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,
3338
+ NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,
3339
+ NODE_REGION_CONFIG_OPTIONS,
3340
+ NODE_REGION_CONFIG_FILE_OPTIONS,
3341
+ resolveRegionConfig,
3342
+ getContentLengthPlugin,
3343
+ resolveParams,
3344
+ getEndpointPlugin,
3345
+ resolveEndpointConfig,
3346
+ DEFAULT_RETRY_MODE,
3347
+ NODE_MAX_ATTEMPT_CONFIG_OPTIONS,
3348
+ resolveRetryConfig,
3349
+ NODE_RETRY_MODE_CONFIG_OPTIONS,
3350
+ getRetryPlugin,
3351
+ createDefaultUserAgentProvider,
3352
+ NODE_APP_ID_CONFIG_OPTIONS,
3353
+ Hash,
3354
+ calculateBodyLength,
3355
+ resolveDefaultsModeConfig,
3356
+ getAwsRegionExtensionConfiguration,
3357
+ resolveAwsRegionExtensionConfiguration
3358
+ };
3359
+ //# sourceMappingURL=chunk-XXAWQ5GA.js.map