@mindbowser_inc/ui-feedback-plugin 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4032 +0,0 @@
1
- var cs = Object.defineProperty;
2
- var us = (t, e, s) => e in t ? cs(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
3
- var m = (t, e, s) => us(t, typeof e != "symbol" ? e + "" : e, s);
4
- import { _ as ds, b as fs } from "./tslib.es6-BNkLP3y-.mjs";
5
- function ls(t, e, s) {
6
- return t.$source || (t.$source = {}), t.$source[e] = s, t;
7
- }
8
- const hs = (t) => (t == null ? void 0 : t.body) instanceof ReadableStream, U = (t, e) => {
9
- const s = [];
10
- if (t && s.push(t), e)
11
- for (const r of e)
12
- s.push(r);
13
- return s;
14
- }, O = (t, e) => `${t || "anonymous"}${e && e.length > 0 ? ` (a.k.a. ${e.join(",")})` : ""}`, me = () => {
15
- let t = [], e = [], s = !1;
16
- const r = /* @__PURE__ */ new Set(), n = (l) => l.sort((f, h) => Ye[h.step] - Ye[f.step] || Ze[h.priority || "normal"] - Ze[f.priority || "normal"]), i = (l) => {
17
- let f = !1;
18
- const h = (p) => {
19
- const y = U(p.name, p.aliases);
20
- if (y.includes(l)) {
21
- f = !0;
22
- for (const g of y)
23
- r.delete(g);
24
- return !1;
25
- }
26
- return !0;
27
- };
28
- return t = t.filter(h), e = e.filter(h), f;
29
- }, o = (l) => {
30
- let f = !1;
31
- const h = (p) => {
32
- if (p.middleware === l) {
33
- f = !0;
34
- for (const y of U(p.name, p.aliases))
35
- r.delete(y);
36
- return !1;
37
- }
38
- return !0;
39
- };
40
- return t = t.filter(h), e = e.filter(h), f;
41
- }, a = (l) => {
42
- var f;
43
- return t.forEach((h) => {
44
- l.add(h.middleware, { ...h });
45
- }), e.forEach((h) => {
46
- l.addRelativeTo(h.middleware, { ...h });
47
- }), (f = l.identifyOnResolve) == null || f.call(l, d.identifyOnResolve()), l;
48
- }, c = (l) => {
49
- const f = [];
50
- return l.before.forEach((h) => {
51
- h.before.length === 0 && h.after.length === 0 ? f.push(h) : f.push(...c(h));
52
- }), f.push(l), l.after.reverse().forEach((h) => {
53
- h.before.length === 0 && h.after.length === 0 ? f.push(h) : f.push(...c(h));
54
- }), f;
55
- }, u = (l = !1) => {
56
- const f = [], h = [], p = {};
57
- return t.forEach((g) => {
58
- const w = {
59
- ...g,
60
- before: [],
61
- after: []
62
- };
63
- for (const S of U(w.name, w.aliases))
64
- p[S] = w;
65
- f.push(w);
66
- }), e.forEach((g) => {
67
- const w = {
68
- ...g,
69
- before: [],
70
- after: []
71
- };
72
- for (const S of U(w.name, w.aliases))
73
- p[S] = w;
74
- h.push(w);
75
- }), h.forEach((g) => {
76
- if (g.toMiddleware) {
77
- const w = p[g.toMiddleware];
78
- if (w === void 0) {
79
- if (l)
80
- return;
81
- throw new Error(`${g.toMiddleware} is not found when adding ${O(g.name, g.aliases)} middleware ${g.relation} ${g.toMiddleware}`);
82
- }
83
- g.relation === "after" && w.after.push(g), g.relation === "before" && w.before.push(g);
84
- }
85
- }), n(f).map(c).reduce((g, w) => (g.push(...w), g), []);
86
- }, d = {
87
- add: (l, f = {}) => {
88
- const { name: h, override: p, aliases: y } = f, g = {
89
- step: "initialize",
90
- priority: "normal",
91
- middleware: l,
92
- ...f
93
- }, w = U(h, y);
94
- if (w.length > 0) {
95
- if (w.some((S) => r.has(S))) {
96
- if (!p)
97
- throw new Error(`Duplicate middleware name '${O(h, y)}'`);
98
- for (const S of w) {
99
- const b = t.findIndex((A) => {
100
- var x;
101
- return A.name === S || ((x = A.aliases) == null ? void 0 : x.some((k) => k === S));
102
- });
103
- if (b === -1)
104
- continue;
105
- const E = t[b];
106
- if (E.step !== g.step || g.priority !== E.priority)
107
- throw new Error(`"${O(E.name, E.aliases)}" middleware with ${E.priority} priority in ${E.step} step cannot be overridden by "${O(h, y)}" middleware with ${g.priority} priority in ${g.step} step.`);
108
- t.splice(b, 1);
109
- }
110
- }
111
- for (const S of w)
112
- r.add(S);
113
- }
114
- t.push(g);
115
- },
116
- addRelativeTo: (l, f) => {
117
- const { name: h, override: p, aliases: y } = f, g = {
118
- middleware: l,
119
- ...f
120
- }, w = U(h, y);
121
- if (w.length > 0) {
122
- if (w.some((S) => r.has(S))) {
123
- if (!p)
124
- throw new Error(`Duplicate middleware name '${O(h, y)}'`);
125
- for (const S of w) {
126
- const b = e.findIndex((A) => {
127
- var x;
128
- return A.name === S || ((x = A.aliases) == null ? void 0 : x.some((k) => k === S));
129
- });
130
- if (b === -1)
131
- continue;
132
- const E = e[b];
133
- if (E.toMiddleware !== g.toMiddleware || E.relation !== g.relation)
134
- throw new Error(`"${O(E.name, E.aliases)}" middleware ${E.relation} "${E.toMiddleware}" middleware cannot be overridden by "${O(h, y)}" middleware ${g.relation} "${g.toMiddleware}" middleware.`);
135
- e.splice(b, 1);
136
- }
137
- }
138
- for (const S of w)
139
- r.add(S);
140
- }
141
- e.push(g);
142
- },
143
- clone: () => a(me()),
144
- use: (l) => {
145
- l.applyToStack(d);
146
- },
147
- remove: (l) => typeof l == "string" ? i(l) : o(l),
148
- removeByTag: (l) => {
149
- let f = !1;
150
- const h = (p) => {
151
- const { tags: y, name: g, aliases: w } = p;
152
- if (y && y.includes(l)) {
153
- const S = U(g, w);
154
- for (const b of S)
155
- r.delete(b);
156
- return f = !0, !1;
157
- }
158
- return !0;
159
- };
160
- return t = t.filter(h), e = e.filter(h), f;
161
- },
162
- concat: (l) => {
163
- var h;
164
- const f = a(me());
165
- return f.use(l), f.identifyOnResolve(s || f.identifyOnResolve() || (((h = l.identifyOnResolve) == null ? void 0 : h.call(l)) ?? !1)), f;
166
- },
167
- applyToStack: a,
168
- identify: () => u(!0).map((l) => {
169
- const f = l.step ?? l.relation + " " + l.toMiddleware;
170
- return O(l.name, l.aliases) + " - " + f;
171
- }),
172
- identifyOnResolve(l) {
173
- return typeof l == "boolean" && (s = l), s;
174
- },
175
- resolve: (l, f) => {
176
- for (const h of u().map((p) => p.middleware).reverse())
177
- l = h(l, f);
178
- return s && console.log(d.identify()), l;
179
- }
180
- };
181
- return d;
182
- }, Ye = {
183
- initialize: 5,
184
- serialize: 4,
185
- build: 3,
186
- finalizeRequest: 2,
187
- deserialize: 1
188
- }, Ze = {
189
- high: 3,
190
- normal: 2,
191
- low: 1
192
- };
193
- var Y;
194
- (function(t) {
195
- t.HTTP = "http", t.HTTPS = "https";
196
- })(Y || (Y = {}));
197
- var Z;
198
- (function(t) {
199
- t.MD5 = "md5", t.CRC32 = "crc32", t.CRC32C = "crc32c", t.SHA1 = "sha1", t.SHA256 = "sha256";
200
- })(Z || (Z = {}));
201
- const He = "__smithy_context", ie = (t) => t[He] || (t[He] = {});
202
- class C {
203
- constructor(e) {
204
- m(this, "method");
205
- m(this, "protocol");
206
- m(this, "hostname");
207
- m(this, "port");
208
- m(this, "path");
209
- m(this, "query");
210
- m(this, "headers");
211
- m(this, "username");
212
- m(this, "password");
213
- m(this, "fragment");
214
- m(this, "body");
215
- this.method = e.method || "GET", this.hostname = e.hostname || "localhost", this.port = e.port, this.query = e.query || {}, this.headers = e.headers || {}, this.body = e.body, this.protocol = e.protocol ? e.protocol.slice(-1) !== ":" ? `${e.protocol}:` : e.protocol : "https:", this.path = e.path ? e.path.charAt(0) !== "/" ? `/${e.path}` : e.path : "/", this.username = e.username, this.password = e.password, this.fragment = e.fragment;
216
- }
217
- static clone(e) {
218
- const s = new C({
219
- ...e,
220
- headers: { ...e.headers }
221
- });
222
- return s.query && (s.query = ms(s.query)), s;
223
- }
224
- static isInstance(e) {
225
- if (!e)
226
- return !1;
227
- const s = e;
228
- return "method" in s && "protocol" in s && "hostname" in s && "path" in s && typeof s.query == "object" && typeof s.headers == "object";
229
- }
230
- clone() {
231
- return C.clone(this);
232
- }
233
- }
234
- function ms(t) {
235
- return Object.keys(t).reduce((e, s) => {
236
- const r = t[s];
237
- return {
238
- ...e,
239
- [s]: Array.isArray(r) ? [...r] : r
240
- };
241
- }, {});
242
- }
243
- class q {
244
- constructor(e) {
245
- m(this, "statusCode");
246
- m(this, "reason");
247
- m(this, "headers");
248
- m(this, "body");
249
- this.statusCode = e.statusCode, this.reason = e.reason, this.headers = e.headers || {}, this.body = e.body;
250
- }
251
- static isInstance(e) {
252
- if (!e)
253
- return !1;
254
- const s = e;
255
- return typeof s.statusCode == "number" && typeof s.headers == "object";
256
- }
257
- }
258
- const ps = new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"), we = (t, e = !1) => {
259
- if (!e)
260
- return ps.test(t);
261
- const s = t.split(".");
262
- for (const r of s)
263
- if (!we(r))
264
- return !1;
265
- return !0;
266
- }, L = (t) => {
267
- if (typeof t == "function")
268
- return t;
269
- const e = Promise.resolve(t);
270
- return () => e;
271
- };
272
- function gs(t) {
273
- const e = {};
274
- if (t = t.replace(/^\?/, ""), t)
275
- for (const s of t.split("&")) {
276
- let [r, n = null] = s.split("=");
277
- r = decodeURIComponent(r), n && (n = decodeURIComponent(n)), r in e ? Array.isArray(e[r]) ? e[r].push(n) : e[r] = [e[r], n] : e[r] = n;
278
- }
279
- return e;
280
- }
281
- const Fe = (t) => {
282
- if (typeof t == "string")
283
- return Fe(new URL(t));
284
- const { hostname: e, pathname: s, port: r, protocol: n, search: i } = t;
285
- let o;
286
- return i && (o = gs(i)), {
287
- hostname: e,
288
- port: r ? parseInt(r) : void 0,
289
- protocol: n,
290
- path: s,
291
- query: o
292
- };
293
- }, Xe = (t) => {
294
- if (typeof t == "object") {
295
- if ("url" in t) {
296
- const e = Fe(t.url);
297
- if (t.headers) {
298
- e.headers = {};
299
- for (const s in t.headers)
300
- e.headers[s.toLowerCase()] = t.headers[s].join(", ");
301
- }
302
- return e;
303
- }
304
- return t;
305
- }
306
- return Fe(t);
307
- }, Xi = (t) => () => Promise.reject(t);
308
- class Ji {
309
- constructor(e) {
310
- m(this, "config");
311
- m(this, "middlewareStack", me());
312
- m(this, "initConfig");
313
- m(this, "handlers");
314
- this.config = e;
315
- const { protocol: s, protocolSettings: r } = e;
316
- r && typeof s == "function" && (e.protocol = new s(r));
317
- }
318
- send(e, s, r) {
319
- const n = typeof s != "function" ? s : void 0, i = typeof s == "function" ? s : r, o = n === void 0 && this.config.cacheMiddleware === !0;
320
- let a;
321
- if (o) {
322
- this.handlers || (this.handlers = /* @__PURE__ */ new WeakMap());
323
- const c = this.handlers;
324
- c.has(e.constructor) ? a = c.get(e.constructor) : (a = e.resolveMiddleware(this.middlewareStack, this.config, n), c.set(e.constructor, a));
325
- } else
326
- delete this.handlers, a = e.resolveMiddleware(this.middlewareStack, this.config, n);
327
- if (i)
328
- a(e).then((c) => i(null, c.output), (c) => i(c)).catch(() => {
329
- });
330
- else
331
- return a(e).then((c) => c.output);
332
- }
333
- destroy() {
334
- var e, s, r;
335
- (r = (s = (e = this.config) == null ? void 0 : e.requestHandler) == null ? void 0 : s.destroy) == null || r.call(s), delete this.handlers;
336
- }
337
- }
338
- const Ee = (t) => typeof t == "function" ? t() : t, Mt = (t, e, s, r, n) => ({
339
- name: e,
340
- namespace: t,
341
- traits: s,
342
- input: r,
343
- output: n
344
- }), ys = (t) => (e, s) => async (r) => {
345
- var l, f, h, p;
346
- const { response: n } = await e(r), { operationSchema: i } = ie(s), [, o, a, c, u, d] = i ?? [];
347
- try {
348
- const y = await t.protocol.deserializeResponse(Mt(o, a, c, u, d), {
349
- ...t,
350
- ...s
351
- }, n);
352
- return {
353
- response: n,
354
- output: y
355
- };
356
- } catch (y) {
357
- if (Object.defineProperty(y, "$response", {
358
- value: n,
359
- enumerable: !1,
360
- writable: !1,
361
- configurable: !1
362
- }), !("$metadata" in y)) {
363
- const g = "Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";
364
- try {
365
- y.message += `
366
- ` + g;
367
- } catch {
368
- !s.logger || ((f = (l = s.logger) == null ? void 0 : l.constructor) == null ? void 0 : f.name) === "NoOpLogger" ? console.warn(g) : (p = (h = s.logger) == null ? void 0 : h.warn) == null || p.call(h, g);
369
- }
370
- typeof y.$responseBodyText < "u" && y.$response && (y.$response.body = y.$responseBodyText);
371
- try {
372
- if (q.isInstance(n)) {
373
- const { headers: w = {}, statusCode: S } = n, b = Object.entries(w);
374
- y.$metadata = {
375
- httpStatusCode: S,
376
- requestId: Te(/^x-[\w-]+-request-?id$/, b),
377
- extendedRequestId: Te(/^x-[\w-]+-id-2$/, b),
378
- cfId: Te(/^x-[\w-]+-cf-id$/, b)
379
- };
380
- }
381
- } catch {
382
- }
383
- }
384
- throw y;
385
- }
386
- }, Te = (t, e) => (e.find(([s]) => s.match(t)) || [void 0, void 0])[1], ws = (t) => (e, s) => async (r) => {
387
- const { operationSchema: n } = ie(s), [, i, o, a, c, u] = n ?? [], d = s.endpointV2 ? async () => Xe(s.endpointV2) : t.endpoint, l = await t.protocol.serializeRequest(Mt(i, o, a, c, u), r.input, {
388
- ...t,
389
- ...s,
390
- endpoint: d
391
- });
392
- return e({
393
- ...r,
394
- request: l
395
- });
396
- }, Ss = {
397
- name: "deserializerMiddleware",
398
- step: "deserialize",
399
- tags: ["DESERIALIZER"],
400
- override: !0
401
- }, bs = {
402
- name: "serializerMiddleware",
403
- step: "serialize",
404
- tags: ["SERIALIZER"],
405
- override: !0
406
- };
407
- function Ki(t) {
408
- return {
409
- applyToStack: (e) => {
410
- e.add(ws(t), bs), e.add(ys(t), Ss), t.protocol.setSerdeContext(t);
411
- }
412
- };
413
- }
414
- const Re = [];
415
- function V(t) {
416
- if (typeof t == "object")
417
- return t;
418
- if (t = t | 0, Re[t])
419
- return Re[t];
420
- const e = {};
421
- let s = 0;
422
- for (const r of [
423
- "httpLabel",
424
- "idempotent",
425
- "idempotencyToken",
426
- "sensitive",
427
- "httpPayload",
428
- "httpResponseCode",
429
- "httpQueryParams"
430
- ])
431
- (t >> s++ & 1) === 1 && (e[r] = 1);
432
- return Re[t] = e;
433
- }
434
- const G = {
435
- it: Symbol.for("@smithy/nor-struct-it"),
436
- ns: Symbol.for("@smithy/ns")
437
- }, Ae = [], ve = {}, N = class N {
438
- constructor(e, s) {
439
- m(this, "ref");
440
- m(this, "memberName");
441
- m(this, "symbol", N.symbol);
442
- m(this, "name");
443
- m(this, "schema");
444
- m(this, "_isMemberSchema");
445
- m(this, "traits");
446
- m(this, "memberTraits");
447
- m(this, "normalizedTraits");
448
- this.ref = e, this.memberName = s;
449
- const r = [];
450
- let n = e, i = e;
451
- for (this._isMemberSchema = !1; Ce(n); )
452
- r.push(n[1]), n = n[0], i = Ee(n), this._isMemberSchema = !0;
453
- if (r.length > 0) {
454
- this.memberTraits = {};
455
- for (let o = r.length - 1; o >= 0; --o) {
456
- const a = r[o];
457
- Object.assign(this.memberTraits, V(a));
458
- }
459
- } else
460
- this.memberTraits = 0;
461
- if (i instanceof N) {
462
- const o = this.memberTraits;
463
- Object.assign(this, i), this.memberTraits = Object.assign({}, o, i.getMemberTraits(), this.getMemberTraits()), this.normalizedTraits = void 0, this.memberName = s ?? i.memberName;
464
- return;
465
- }
466
- if (this.schema = Ee(i), Es(this.schema) ? (this.name = `${this.schema[1]}#${this.schema[2]}`, this.traits = this.schema[3]) : (this.name = this.memberName ?? String(i), this.traits = 0), this._isMemberSchema && !s)
467
- throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(!0)} missing member name.`);
468
- }
469
- static [Symbol.hasInstance](e) {
470
- const s = this.prototype.isPrototypeOf(e);
471
- return !s && typeof e == "object" && e !== null ? e.symbol === this.symbol : s;
472
- }
473
- static of(e) {
474
- const s = typeof e == "function" || typeof e == "object" && e !== null;
475
- if (typeof e == "number") {
476
- if (Ae[e])
477
- return Ae[e];
478
- } else if (typeof e == "string") {
479
- if (ve[e])
480
- return ve[e];
481
- } else if (s && e[G.ns])
482
- return e[G.ns];
483
- const r = Ee(e);
484
- if (r instanceof N)
485
- return r;
486
- if (Ce(r)) {
487
- const [i, o] = r;
488
- if (i instanceof N)
489
- return Object.assign(i.getMergedTraits(), V(o)), i;
490
- throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(e, null, 2)}.`);
491
- }
492
- const n = new N(r);
493
- return s ? e[G.ns] = n : typeof r == "string" ? ve[r] = n : typeof r == "number" ? Ae[r] = n : n;
494
- }
495
- getSchema() {
496
- const e = this.schema;
497
- return Array.isArray(e) && e[0] === 0 ? e[4] : e;
498
- }
499
- getName(e = !1) {
500
- const { name: s } = this;
501
- return !e && s && s.includes("#") ? s.split("#")[1] : s || void 0;
502
- }
503
- getMemberName() {
504
- return this.memberName;
505
- }
506
- isMemberSchema() {
507
- return this._isMemberSchema;
508
- }
509
- isListSchema() {
510
- const e = this.getSchema();
511
- return typeof e == "number" ? e >= 64 && e < 128 : e[0] === 1;
512
- }
513
- isMapSchema() {
514
- const e = this.getSchema();
515
- return typeof e == "number" ? e >= 128 && e <= 255 : e[0] === 2;
516
- }
517
- isStructSchema() {
518
- const e = this.getSchema();
519
- if (typeof e != "object")
520
- return !1;
521
- const s = e[0];
522
- return s === 3 || s === -3 || s === 4;
523
- }
524
- isUnionSchema() {
525
- const e = this.getSchema();
526
- return typeof e != "object" ? !1 : e[0] === 4;
527
- }
528
- isBlobSchema() {
529
- const e = this.getSchema();
530
- return e === 21 || e === 42;
531
- }
532
- isTimestampSchema() {
533
- const e = this.getSchema();
534
- return typeof e == "number" && e >= 4 && e <= 7;
535
- }
536
- isUnitSchema() {
537
- return this.getSchema() === "unit";
538
- }
539
- isDocumentSchema() {
540
- return this.getSchema() === 15;
541
- }
542
- isStringSchema() {
543
- return this.getSchema() === 0;
544
- }
545
- isBooleanSchema() {
546
- return this.getSchema() === 2;
547
- }
548
- isNumericSchema() {
549
- return this.getSchema() === 1;
550
- }
551
- isBigIntegerSchema() {
552
- return this.getSchema() === 17;
553
- }
554
- isBigDecimalSchema() {
555
- return this.getSchema() === 19;
556
- }
557
- isStreaming() {
558
- const { streaming: e } = this.getMergedTraits();
559
- return !!e || this.getSchema() === 42;
560
- }
561
- isIdempotencyToken() {
562
- return !!this.getMergedTraits().idempotencyToken;
563
- }
564
- getMergedTraits() {
565
- return this.normalizedTraits ?? (this.normalizedTraits = {
566
- ...this.getOwnTraits(),
567
- ...this.getMemberTraits()
568
- });
569
- }
570
- getMemberTraits() {
571
- return V(this.memberTraits);
572
- }
573
- getOwnTraits() {
574
- return V(this.traits);
575
- }
576
- getKeySchema() {
577
- const [e, s] = [this.isDocumentSchema(), this.isMapSchema()];
578
- if (!e && !s)
579
- throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(!0)}`);
580
- const r = this.getSchema(), n = e ? 15 : r[4] ?? 0;
581
- return W([n, 0], "key");
582
- }
583
- getValueSchema() {
584
- const e = this.getSchema(), [s, r, n] = [this.isDocumentSchema(), this.isMapSchema(), this.isListSchema()], i = typeof e == "number" ? 63 & e : e && typeof e == "object" && (r || n) ? e[3 + e[0]] : s ? 15 : void 0;
585
- if (i != null)
586
- return W([i, 0], r ? "value" : "member");
587
- throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no value member.`);
588
- }
589
- getMemberSchema(e) {
590
- const s = this.getSchema();
591
- if (this.isStructSchema() && s[4].includes(e)) {
592
- const r = s[4].indexOf(e), n = s[5][r];
593
- return W(Ce(n) ? n : [n, 0], e);
594
- }
595
- if (this.isDocumentSchema())
596
- return W([15, 0], e);
597
- throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no member=${e}.`);
598
- }
599
- getMemberSchemas() {
600
- const e = {};
601
- try {
602
- for (const [s, r] of this.structIterator())
603
- e[s] = r;
604
- } catch {
605
- }
606
- return e;
607
- }
608
- getEventStreamMember() {
609
- if (this.isStructSchema()) {
610
- for (const [e, s] of this.structIterator())
611
- if (s.isStreaming() && s.isStructSchema())
612
- return e;
613
- }
614
- return "";
615
- }
616
- *structIterator() {
617
- if (this.isUnitSchema())
618
- return;
619
- if (!this.isStructSchema())
620
- throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");
621
- const e = this.getSchema(), s = e[4].length;
622
- let r = e[G.it];
623
- if (r && s === r.length) {
624
- yield* r;
625
- return;
626
- }
627
- r = Array(s);
628
- for (let n = 0; n < s; ++n) {
629
- const i = e[4][n], o = W([e[5][n], 0], i);
630
- yield r[n] = [i, o];
631
- }
632
- e[G.it] = r;
633
- }
634
- };
635
- m(N, "symbol", Symbol.for("@smithy/nor"));
636
- let B = N;
637
- function W(t, e) {
638
- if (t instanceof B)
639
- return Object.assign(t, {
640
- memberName: e,
641
- _isMemberSchema: !0
642
- });
643
- const s = B;
644
- return new s(t, e);
645
- }
646
- const Ce = (t) => Array.isArray(t) && t.length === 2, Es = (t) => Array.isArray(t) && t.length >= 5, M = class M {
647
- constructor(e, s = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map()) {
648
- m(this, "namespace");
649
- m(this, "schemas");
650
- m(this, "exceptions");
651
- this.namespace = e, this.schemas = s, this.exceptions = r;
652
- }
653
- static for(e) {
654
- return M.registries.has(e) || M.registries.set(e, new M(e)), M.registries.get(e);
655
- }
656
- copyFrom(e) {
657
- const { schemas: s, exceptions: r } = this;
658
- for (const [n, i] of e.schemas)
659
- s.has(n) || s.set(n, i);
660
- for (const [n, i] of e.exceptions)
661
- r.has(n) || r.set(n, i);
662
- }
663
- register(e, s) {
664
- const r = this.normalizeShapeId(e);
665
- for (const n of [this, M.for(r.split("#")[0])])
666
- n.schemas.set(r, s);
667
- }
668
- getSchema(e) {
669
- const s = this.normalizeShapeId(e);
670
- if (!this.schemas.has(s)) {
671
- if (!e.includes("#")) {
672
- const r = "#" + e, n = [];
673
- for (const [i, o] of this.schemas.entries())
674
- i.endsWith(r) && n.push(o);
675
- if (n.length === 1)
676
- return n[0];
677
- }
678
- throw new Error(`@smithy/core/schema - schema not found for ${s}`);
679
- }
680
- return this.schemas.get(s);
681
- }
682
- registerError(e, s) {
683
- const r = e, n = r[1];
684
- for (const i of [this, M.for(n)])
685
- i.schemas.set(n + "#" + r[2], r), i.exceptions.set(r, s);
686
- }
687
- getErrorCtor(e) {
688
- const s = e;
689
- return this.exceptions.has(s) ? this.exceptions.get(s) : M.for(s[1]).exceptions.get(s);
690
- }
691
- getBaseException() {
692
- for (const e of this.exceptions.keys())
693
- if (Array.isArray(e)) {
694
- const [, s, r] = e, n = s + "#" + r;
695
- if (n.startsWith("smithy.ts.sdk.synthetic.") && n.endsWith("ServiceException"))
696
- return e;
697
- }
698
- }
699
- find(e) {
700
- for (const s of this.schemas.values())
701
- if (e(s))
702
- return s;
703
- }
704
- clear() {
705
- this.schemas.clear(), this.exceptions.clear();
706
- }
707
- normalizeShapeId(e) {
708
- return e.includes("#") ? e : this.namespace + "#" + e;
709
- }
710
- };
711
- m(M, "registries", /* @__PURE__ */ new Map());
712
- let ee = M;
713
- const xe = "***SensitiveInformation***";
714
- function Be(t, e) {
715
- if (e == null)
716
- return e;
717
- const s = B.of(t);
718
- if (s.getMergedTraits().sensitive)
719
- return xe;
720
- if (s.isListSchema()) {
721
- if (!!s.getValueSchema().getMergedTraits().sensitive)
722
- return xe;
723
- } else if (s.isMapSchema()) {
724
- if (!!s.getKeySchema().getMergedTraits().sensitive || !!s.getValueSchema().getMergedTraits().sensitive)
725
- return xe;
726
- } else if (s.isStructSchema() && typeof e == "object") {
727
- const r = e, n = {};
728
- for (const [i, o] of s.structIterator())
729
- r[i] != null && (n[i] = Be(o, r[i]));
730
- return n;
731
- }
732
- return e;
733
- }
734
- class Ts {
735
- constructor() {
736
- m(this, "middlewareStack", me());
737
- m(this, "schema");
738
- }
739
- static classBuilder() {
740
- return new Rs();
741
- }
742
- resolveMiddlewareWithContext(e, s, r, { middlewareFn: n, clientName: i, commandName: o, inputFilterSensitiveLog: a, outputFilterSensitiveLog: c, smithyContext: u, additionalContext: d, CommandCtor: l }) {
743
- for (const w of n.bind(this)(l, e, s, r))
744
- this.middlewareStack.use(w);
745
- const f = e.concat(this.middlewareStack), { logger: h } = s, p = {
746
- logger: h,
747
- clientName: i,
748
- commandName: o,
749
- inputFilterSensitiveLog: a,
750
- outputFilterSensitiveLog: c,
751
- [He]: {
752
- commandInstance: this,
753
- ...u
754
- },
755
- ...d
756
- }, { requestHandler: y } = s;
757
- let g = r ?? {};
758
- return u.eventStream && (g = {
759
- isEventStream: !0,
760
- ...g
761
- }), f.resolve((w) => y.handle(w.request, g), p);
762
- }
763
- }
764
- class Rs {
765
- constructor() {
766
- m(this, "_init", () => {
767
- });
768
- m(this, "_ep", {});
769
- m(this, "_middlewareFn", () => []);
770
- m(this, "_commandName", "");
771
- m(this, "_clientName", "");
772
- m(this, "_additionalContext", {});
773
- m(this, "_smithyContext", {});
774
- m(this, "_inputFilterSensitiveLog");
775
- m(this, "_outputFilterSensitiveLog");
776
- m(this, "_serializer", null);
777
- m(this, "_deserializer", null);
778
- m(this, "_operationSchema");
779
- }
780
- init(e) {
781
- this._init = e;
782
- }
783
- ep(e) {
784
- return this._ep = e, this;
785
- }
786
- m(e) {
787
- return this._middlewareFn = e, this;
788
- }
789
- s(e, s, r = {}) {
790
- return this._smithyContext = {
791
- service: e,
792
- operation: s,
793
- ...r
794
- }, this;
795
- }
796
- c(e = {}) {
797
- return this._additionalContext = e, this;
798
- }
799
- n(e, s) {
800
- return this._clientName = e, this._commandName = s, this;
801
- }
802
- f(e = (r) => r, s = (r) => r) {
803
- return this._inputFilterSensitiveLog = e, this._outputFilterSensitiveLog = s, this;
804
- }
805
- ser(e) {
806
- return this._serializer = e, this;
807
- }
808
- de(e) {
809
- return this._deserializer = e, this;
810
- }
811
- sc(e) {
812
- return this._operationSchema = e, this._smithyContext.operationSchema = e, this;
813
- }
814
- build() {
815
- const e = this;
816
- let s;
817
- return s = class extends Ts {
818
- constructor(...[n]) {
819
- super();
820
- m(this, "input");
821
- m(this, "serialize", e._serializer);
822
- m(this, "deserialize", e._deserializer);
823
- this.input = n ?? {}, e._init(this), this.schema = e._operationSchema;
824
- }
825
- static getEndpointParameterInstructions() {
826
- return e._ep;
827
- }
828
- resolveMiddleware(n, i, o) {
829
- const a = e._operationSchema, c = (a == null ? void 0 : a[4]) ?? (a == null ? void 0 : a.input), u = (a == null ? void 0 : a[5]) ?? (a == null ? void 0 : a.output);
830
- return this.resolveMiddlewareWithContext(n, i, o, {
831
- CommandCtor: s,
832
- middlewareFn: e._middlewareFn,
833
- clientName: e._clientName,
834
- commandName: e._commandName,
835
- inputFilterSensitiveLog: e._inputFilterSensitiveLog ?? (a ? Be.bind(null, c) : (d) => d),
836
- outputFilterSensitiveLog: e._outputFilterSensitiveLog ?? (a ? Be.bind(null, u) : (d) => d),
837
- smithyContext: e._smithyContext,
838
- additionalContext: e._additionalContext
839
- });
840
- }
841
- };
842
- }
843
- }
844
- class X extends Error {
845
- constructor(s) {
846
- super(s.message);
847
- m(this, "$fault");
848
- m(this, "$response");
849
- m(this, "$retryable");
850
- m(this, "$metadata");
851
- Object.setPrototypeOf(this, Object.getPrototypeOf(this).constructor.prototype), this.name = s.name, this.$fault = s.$fault, this.$metadata = s.$metadata;
852
- }
853
- static isInstance(s) {
854
- if (!s)
855
- return !1;
856
- const r = s;
857
- return X.prototype.isPrototypeOf(r) || !!r.$fault && !!r.$metadata && (r.$fault === "client" || r.$fault === "server");
858
- }
859
- static [Symbol.hasInstance](s) {
860
- if (!s)
861
- return !1;
862
- const r = s;
863
- return this === X ? X.isInstance(s) : X.isInstance(s) ? r.name && this.name ? this.prototype.isPrototypeOf(s) || r.name === this.name : this.prototype.isPrototypeOf(s) : !1;
864
- }
865
- }
866
- const et = (t, e = {}) => {
867
- Object.entries(e).filter(([, r]) => r !== void 0).forEach(([r, n]) => {
868
- (t[r] == null || t[r] === "") && (t[r] = n);
869
- });
870
- const s = t.message || t.Message || "UnknownError";
871
- return t.message = s, delete t.Message, t;
872
- }, Qi = (t) => {
873
- switch (t) {
874
- case "standard":
875
- return {
876
- retryMode: "standard",
877
- connectionTimeout: 3100
878
- };
879
- case "in-region":
880
- return {
881
- retryMode: "standard",
882
- connectionTimeout: 1100
883
- };
884
- case "cross-region":
885
- return {
886
- retryMode: "standard",
887
- connectionTimeout: 3100
888
- };
889
- case "mobile":
890
- return {
891
- retryMode: "standard",
892
- connectionTimeout: 3e4
893
- };
894
- default:
895
- return {};
896
- }
897
- }, $t = Object.values(Z), As = (t) => {
898
- const e = [];
899
- for (const s in Z) {
900
- const r = Z[s];
901
- t[r] !== void 0 && e.push({
902
- algorithmId: () => r,
903
- checksumConstructor: () => t[r]
904
- });
905
- }
906
- for (const [s, r] of Object.entries(t.checksumAlgorithms ?? {}))
907
- e.push({
908
- algorithmId: () => s,
909
- checksumConstructor: () => r
910
- });
911
- return {
912
- addChecksumAlgorithm(s) {
913
- t.checksumAlgorithms = t.checksumAlgorithms ?? {};
914
- const r = s.algorithmId(), n = s.checksumConstructor();
915
- $t.includes(r) ? t.checksumAlgorithms[r.toUpperCase()] = n : t.checksumAlgorithms[r] = n, e.push(s);
916
- },
917
- checksumAlgorithms() {
918
- return e;
919
- }
920
- };
921
- }, vs = (t) => {
922
- const e = {};
923
- return t.checksumAlgorithms().forEach((s) => {
924
- const r = s.algorithmId();
925
- $t.includes(r) && (e[r] = s.checksumConstructor());
926
- }), e;
927
- }, Cs = (t) => ({
928
- setRetryStrategy(e) {
929
- t.retryStrategy = e;
930
- },
931
- retryStrategy() {
932
- return t.retryStrategy;
933
- }
934
- }), xs = (t) => {
935
- const e = {};
936
- return e.retryStrategy = t.retryStrategy(), e;
937
- }, Yi = (t) => Object.assign(As(t), Cs(t)), Zi = (t) => Object.assign(vs(t), xs(t));
938
- class Is {
939
- trace() {
940
- }
941
- debug() {
942
- }
943
- info() {
944
- }
945
- warn() {
946
- }
947
- error() {
948
- }
949
- }
950
- const kt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", tt = Object.entries(kt).reduce((t, [e, s]) => (t[s] = Number(e), t), {}), Ms = kt.split(""), j = 6, J = 8, $s = 63, Ot = (t) => {
951
- let e = t.length / 4 * 3;
952
- t.slice(-2) === "==" ? e -= 2 : t.slice(-1) === "=" && e--;
953
- const s = new ArrayBuffer(e), r = new DataView(s);
954
- for (let n = 0; n < t.length; n += 4) {
955
- let i = 0, o = 0;
956
- for (let u = n, d = n + 3; u <= d; u++)
957
- if (t[u] !== "=") {
958
- if (!(t[u] in tt))
959
- throw new TypeError(`Invalid character ${t[u]} in base64 string.`);
960
- i |= tt[t[u]] << (d - u) * j, o += j;
961
- } else
962
- i >>= j;
963
- const a = n / 4 * 3;
964
- i >>= o % J;
965
- const c = Math.floor(o / J);
966
- for (let u = 0; u < c; u++) {
967
- const d = (c - u - 1) * J;
968
- r.setUint8(a + u, (i & 255 << d) >> d);
969
- }
970
- }
971
- return new Uint8Array(s);
972
- }, te = (t) => new TextEncoder().encode(t);
973
- function ks(t) {
974
- let e;
975
- typeof t == "string" ? e = te(t) : e = t;
976
- const s = typeof e == "object" && typeof e.length == "number", r = typeof e == "object" && typeof e.byteOffset == "number" && typeof e.byteLength == "number";
977
- if (!s && !r)
978
- throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");
979
- let n = "";
980
- for (let i = 0; i < e.length; i += 3) {
981
- let o = 0, a = 0;
982
- for (let u = i, d = Math.min(i + 3, e.length); u < d; u++)
983
- o |= e[u] << (d - u - 1) * J, a += J;
984
- const c = Math.ceil(a / j);
985
- o <<= c * j - a;
986
- for (let u = 1; u <= c; u++) {
987
- const d = (c - u) * j;
988
- n += Ms[(o & $s << d) >> d];
989
- }
990
- n += "==".slice(0, 4 - c);
991
- }
992
- return n;
993
- }
994
- function Os(t, e, s, r) {
995
- return class ue extends Uint8Array {
996
- static fromString(i, o = "utf-8") {
997
- if (typeof i == "string")
998
- return o === "base64" ? ue.mutate(r(i)) : ue.mutate(e(i));
999
- throw new Error(`Unsupported conversion from ${typeof i} to Uint8ArrayBlobAdapter.`);
1000
- }
1001
- static mutate(i) {
1002
- return Object.setPrototypeOf(i, ue.prototype), i;
1003
- }
1004
- transformToString(i = "utf-8") {
1005
- return i === "base64" ? s(this) : t(this);
1006
- }
1007
- };
1008
- }
1009
- const Ns = (t) => {
1010
- if (typeof t == "string")
1011
- return t;
1012
- if (typeof t != "object" || typeof t.byteOffset != "number" || typeof t.byteLength != "number")
1013
- throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");
1014
- return new TextDecoder("utf-8").decode(t);
1015
- }, T = Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
1016
- function _s(t) {
1017
- return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? () => crypto.randomUUID() : () => {
1018
- const e = new Uint8Array(16);
1019
- return t(e), e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128, T[e[0]] + T[e[1]] + T[e[2]] + T[e[3]] + "-" + T[e[4]] + T[e[5]] + "-" + T[e[6]] + T[e[7]] + "-" + T[e[8]] + T[e[9]] + "-" + T[e[10]] + T[e[11]] + T[e[12]] + T[e[13]] + T[e[14]] + T[e[15]];
1020
- };
1021
- }
1022
- const ze = (t) => {
1023
- if (t != null) {
1024
- if (typeof t == "string") {
1025
- const e = parseFloat(t);
1026
- if (!Number.isNaN(e))
1027
- return String(e) !== String(t) && js.warn(zs(`Expected number but observed string: ${t}`)), e;
1028
- }
1029
- if (typeof t == "number")
1030
- return t;
1031
- throw new TypeError(`Expected number, got ${typeof t}: ${t}`);
1032
- }
1033
- }, Ps = Math.ceil(2 ** 127 * (2 - 2 ** -23)), st = (t) => {
1034
- const e = ze(t);
1035
- if (e !== void 0 && !Number.isNaN(e) && e !== 1 / 0 && e !== -1 / 0 && Math.abs(e) > Ps)
1036
- throw new TypeError(`Expected 32-bit float, got ${t}`);
1037
- return e;
1038
- }, Ds = (t) => {
1039
- if (t != null) {
1040
- if (Number.isInteger(t) && !Number.isNaN(t))
1041
- return t;
1042
- throw new TypeError(`Expected integer, got ${typeof t}: ${t}`);
1043
- }
1044
- }, rt = (t) => Nt(t, 16), nt = (t) => Nt(t, 8), Nt = (t, e) => {
1045
- const s = Ds(t);
1046
- if (s !== void 0 && Us(s, e) !== s)
1047
- throw new TypeError(`Expected ${e}-bit integer, got ${t}`);
1048
- return s;
1049
- }, Us = (t, e) => {
1050
- switch (e) {
1051
- case 32:
1052
- return Int32Array.of(t)[0];
1053
- case 16:
1054
- return Int16Array.of(t)[0];
1055
- case 8:
1056
- return Int8Array.of(t)[0];
1057
- }
1058
- }, Ls = (t) => ze(typeof t == "string" ? Se(t) : t), Hs = (t) => st(typeof t == "string" ? Se(t) : t), Fs = /(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g, Se = (t) => {
1059
- const e = t.match(Fs);
1060
- if (e === null || e[0].length !== t.length)
1061
- throw new TypeError("Expected real number, got implicit NaN");
1062
- return parseFloat(t);
1063
- }, pe = (t) => rt(typeof t == "string" ? Se(t) : t), Bs = (t) => nt(typeof t == "string" ? Se(t) : t), zs = (t) => String(new TypeError(t).stack || t).split(`
1064
- `).slice(0, 5).filter((e) => !e.includes("stackTraceWarning")).join(`
1065
- `), js = {
1066
- warn: console.warn
1067
- }, qs = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], Je = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
1068
- function eo(t) {
1069
- const e = t.getUTCFullYear(), s = t.getUTCMonth(), r = t.getUTCDay(), n = t.getUTCDate(), i = t.getUTCHours(), o = t.getUTCMinutes(), a = t.getUTCSeconds(), c = n < 10 ? `0${n}` : `${n}`, u = i < 10 ? `0${i}` : `${i}`, d = o < 10 ? `0${o}` : `${o}`, l = a < 10 ? `0${a}` : `${a}`;
1070
- return `${qs[r]}, ${c} ${Je[s]} ${e} ${u}:${d}:${l} GMT`;
1071
- }
1072
- const Gs = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/), to = (t) => {
1073
- if (t == null)
1074
- return;
1075
- if (typeof t != "string")
1076
- throw new TypeError("RFC-3339 date-times must be expressed as strings");
1077
- const e = Gs.exec(t);
1078
- if (!e)
1079
- throw new TypeError("Invalid RFC-3339 date-time value");
1080
- const [s, r, n, i, o, a, c, u, d] = e, l = pe(se(r)), f = P(n, "month", 1, 12), h = P(i, "day", 1, 31), p = de(l, f, h, { hours: o, minutes: a, seconds: c, fractionalMilliseconds: u });
1081
- return d.toUpperCase() != "Z" && p.setTime(p.getTime() - rr(d)), p;
1082
- }, Ws = new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/), Vs = new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/), Xs = new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/), Js = (t) => {
1083
- if (t == null)
1084
- return;
1085
- if (typeof t != "string")
1086
- throw new TypeError("RFC-7231 date-times must be expressed as strings");
1087
- let e = Ws.exec(t);
1088
- if (e) {
1089
- const [s, r, n, i, o, a, c, u] = e;
1090
- return de(pe(se(i)), Ie(n), P(r, "day", 1, 31), { hours: o, minutes: a, seconds: c, fractionalMilliseconds: u });
1091
- }
1092
- if (e = Vs.exec(t), e) {
1093
- const [s, r, n, i, o, a, c, u] = e;
1094
- return Ys(de(Ks(i), Ie(n), P(r, "day", 1, 31), {
1095
- hours: o,
1096
- minutes: a,
1097
- seconds: c,
1098
- fractionalMilliseconds: u
1099
- }));
1100
- }
1101
- if (e = Xs.exec(t), e) {
1102
- const [s, r, n, i, o, a, c, u] = e;
1103
- return de(pe(se(u)), Ie(r), P(n.trimLeft(), "day", 1, 31), { hours: i, minutes: o, seconds: a, fractionalMilliseconds: c });
1104
- }
1105
- throw new TypeError("Invalid RFC-7231 date-time value");
1106
- }, so = (t) => {
1107
- if (t == null)
1108
- return;
1109
- let e;
1110
- if (typeof t == "number")
1111
- e = t;
1112
- else if (typeof t == "string")
1113
- e = Ls(t);
1114
- else if (typeof t == "object" && t.tag === 1)
1115
- e = t.value;
1116
- else
1117
- throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");
1118
- if (Number.isNaN(e) || e === 1 / 0 || e === -1 / 0)
1119
- throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");
1120
- return new Date(Math.round(e * 1e3));
1121
- }, de = (t, e, s, r) => {
1122
- const n = e - 1;
1123
- return er(t, n, s), new Date(Date.UTC(t, n, s, P(r.hours, "hour", 0, 23), P(r.minutes, "minute", 0, 59), P(r.seconds, "seconds", 0, 60), sr(r.fractionalMilliseconds)));
1124
- }, Ks = (t) => {
1125
- const e = (/* @__PURE__ */ new Date()).getUTCFullYear(), s = Math.floor(e / 100) * 100 + pe(se(t));
1126
- return s < e ? s + 100 : s;
1127
- }, Qs = 50 * 365 * 24 * 60 * 60 * 1e3, Ys = (t) => t.getTime() - (/* @__PURE__ */ new Date()).getTime() > Qs ? new Date(Date.UTC(t.getUTCFullYear() - 100, t.getUTCMonth(), t.getUTCDate(), t.getUTCHours(), t.getUTCMinutes(), t.getUTCSeconds(), t.getUTCMilliseconds())) : t, Ie = (t) => {
1128
- const e = Je.indexOf(t);
1129
- if (e < 0)
1130
- throw new TypeError(`Invalid month: ${t}`);
1131
- return e + 1;
1132
- }, Zs = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], er = (t, e, s) => {
1133
- let r = Zs[e];
1134
- if (e === 1 && tr(t) && (r = 29), s > r)
1135
- throw new TypeError(`Invalid day for ${Je[e]} in ${t}: ${s}`);
1136
- }, tr = (t) => t % 4 === 0 && (t % 100 !== 0 || t % 400 === 0), P = (t, e, s, r) => {
1137
- const n = Bs(se(t));
1138
- if (n < s || n > r)
1139
- throw new TypeError(`${e} must be between ${s} and ${r}, inclusive`);
1140
- return n;
1141
- }, sr = (t) => t == null ? 0 : Hs("0." + t) * 1e3, rr = (t) => {
1142
- const e = t[0];
1143
- let s = 1;
1144
- if (e == "+")
1145
- s = 1;
1146
- else if (e == "-")
1147
- s = -1;
1148
- else
1149
- throw new TypeError(`Offset direction, ${e}, must be "+" or "-"`);
1150
- const r = Number(t.substring(1, 3)), n = Number(t.substring(4, 6));
1151
- return s * (r * 60 + n) * 60 * 1e3;
1152
- }, se = (t) => {
1153
- let e = 0;
1154
- for (; e < t.length - 1 && t.charAt(e) === "0"; )
1155
- e++;
1156
- return e === 0 ? t : t.slice(e);
1157
- }, z = function(e) {
1158
- return Object.assign(new String(e), {
1159
- deserializeJSON() {
1160
- return JSON.parse(String(e));
1161
- },
1162
- toString() {
1163
- return String(e);
1164
- },
1165
- toJSON() {
1166
- return String(e);
1167
- }
1168
- });
1169
- };
1170
- z.from = (t) => t && typeof t == "object" && (t instanceof z || "deserializeJSON" in t) ? t : typeof t == "string" || Object.getPrototypeOf(t) === String.prototype ? z(String(t)) : z(JSON.stringify(t));
1171
- z.fromObject = z.from;
1172
- const it = /^-?\d*(\.\d+)?$/;
1173
- class _t {
1174
- constructor(e, s) {
1175
- m(this, "string");
1176
- m(this, "type");
1177
- if (this.string = e, this.type = s, !it.test(e))
1178
- throw new Error('@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".');
1179
- }
1180
- toString() {
1181
- return this.string;
1182
- }
1183
- static [Symbol.hasInstance](e) {
1184
- if (!e || typeof e != "object")
1185
- return !1;
1186
- const s = e;
1187
- return _t.prototype.isPrototypeOf(e) || s.type === "bigDecimal" && it.test(s.string);
1188
- }
1189
- }
1190
- const Pt = {}, je = {};
1191
- for (let t = 0; t < 256; t++) {
1192
- let e = t.toString(16).toLowerCase();
1193
- e.length === 1 && (e = `0${e}`), Pt[t] = e, je[e] = t;
1194
- }
1195
- function nr(t) {
1196
- if (t.length % 2 !== 0)
1197
- throw new Error("Hex encoded strings must have an even number length");
1198
- const e = new Uint8Array(t.length / 2);
1199
- for (let s = 0; s < t.length; s += 2) {
1200
- const r = t.slice(s, s + 2).toLowerCase();
1201
- if (r in je)
1202
- e[s / 2] = je[r];
1203
- else
1204
- throw new Error(`Cannot decode unrecognized sequence ${r} as hexadecimal`);
1205
- }
1206
- return e;
1207
- }
1208
- function H(t) {
1209
- let e = "";
1210
- for (let s = 0; s < t.byteLength; s++)
1211
- e += Pt[t[s]];
1212
- return e;
1213
- }
1214
- const ot = typeof TextEncoder == "function" ? new TextEncoder() : null, ro = (t) => {
1215
- if (typeof t == "string") {
1216
- if (ot)
1217
- return ot.encode(t).byteLength;
1218
- let e = t.length;
1219
- for (let s = e - 1; s >= 0; s--) {
1220
- const r = t.charCodeAt(s);
1221
- r > 127 && r <= 2047 ? e++ : r > 2047 && r <= 65535 && (e += 2), r >= 56320 && r <= 57343 && s--;
1222
- }
1223
- return e;
1224
- } else {
1225
- if (typeof t.byteLength == "number")
1226
- return t.byteLength;
1227
- if (typeof t.size == "number")
1228
- return t.size;
1229
- }
1230
- throw new Error(`Body Length computation failed for ${t}`);
1231
- }, re = (t) => typeof t == "string" ? te(t) : ArrayBuffer.isView(t) ? new Uint8Array(t.buffer, t.byteOffset, t.byteLength / Uint8Array.BYTES_PER_ELEMENT) : new Uint8Array(t), ir = (t) => typeof ArrayBuffer == "function" && t instanceof ArrayBuffer || Object.prototype.toString.call(t) === "[object ArrayBuffer]", Dt = async (t) => {
1232
- }, or = async (t) => {
1233
- const e = (t == null ? void 0 : t.Bucket) || "";
1234
- if (typeof t.Bucket == "string" && (t.Bucket = e.replace(/#/g, encodeURIComponent("#")).replace(/\?/g, encodeURIComponent("?"))), fr(e)) {
1235
- if (t.ForcePathStyle === !0)
1236
- throw new Error("Path-style addressing cannot be used with ARN buckets");
1237
- } else (!dr(e) || e.indexOf(".") !== -1 && !String(t.Endpoint).startsWith("http:") || e.toLowerCase() !== e || e.length < 3) && (t.ForcePathStyle = !0);
1238
- return t.DisableMultiRegionAccessPoints && (t.disableMultiRegionAccessPoints = !0, t.DisableMRAP = !0), t;
1239
- }, ar = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/, cr = /(\d+\.){3}\d+/, ur = /\.\./, dr = (t) => ar.test(t) && !cr.test(t) && !ur.test(t), fr = (t) => {
1240
- const [e, s, r, , , n] = t.split(":"), i = e === "arn" && t.split(":").length >= 6, o = !!(i && s && r && n);
1241
- if (i && !o)
1242
- throw new Error(`Invalid ARN: ${t} was an invalid ARN.`);
1243
- return o;
1244
- }, lr = (t, e, s, r = !1) => {
1245
- const n = async () => {
1246
- let i;
1247
- if (r) {
1248
- const o = s.clientContextParams;
1249
- i = (o == null ? void 0 : o[t]) ?? s[t] ?? s[e];
1250
- } else
1251
- i = s[t] ?? s[e];
1252
- return typeof i == "function" ? i() : i;
1253
- };
1254
- return t === "credentialScope" || e === "CredentialScope" ? async () => {
1255
- const i = typeof s.credentials == "function" ? await s.credentials() : s.credentials;
1256
- return (i == null ? void 0 : i.credentialScope) ?? (i == null ? void 0 : i.CredentialScope);
1257
- } : t === "accountId" || e === "AccountId" ? async () => {
1258
- const i = typeof s.credentials == "function" ? await s.credentials() : s.credentials;
1259
- return (i == null ? void 0 : i.accountId) ?? (i == null ? void 0 : i.AccountId);
1260
- } : t === "endpoint" || e === "endpoint" ? async () => {
1261
- if (s.isCustomEndpoint === !1)
1262
- return;
1263
- const i = await n();
1264
- if (i && typeof i == "object") {
1265
- if ("url" in i)
1266
- return i.url.href;
1267
- if ("hostname" in i) {
1268
- const { protocol: o, hostname: a, port: c, path: u } = i;
1269
- return `${o}//${a}${c ? ":" + c : ""}${u}`;
1270
- }
1271
- }
1272
- return i;
1273
- } : n;
1274
- };
1275
- function hr(t) {
1276
- return async (e, s, r, n) => {
1277
- if (!r.isCustomEndpoint) {
1278
- let a;
1279
- r.serviceConfiguredEndpoint ? a = await r.serviceConfiguredEndpoint() : a = await t(r.serviceId), a && (r.endpoint = () => Promise.resolve(Xe(a)), r.isCustomEndpoint = !0);
1280
- }
1281
- const i = await mr(e, s, r);
1282
- if (typeof r.endpointProvider != "function")
1283
- throw new Error("config.endpointProvider is not set.");
1284
- const o = r.endpointProvider(i, n);
1285
- if (r.isCustomEndpoint && r.endpoint) {
1286
- const a = await r.endpoint();
1287
- if (a != null && a.headers) {
1288
- o.headers ?? (o.headers = {});
1289
- for (const [c, u] of Object.entries(a.headers))
1290
- o.headers[c] = Array.isArray(u) ? u : [u];
1291
- }
1292
- }
1293
- return o;
1294
- };
1295
- }
1296
- const mr = async (t, e, s) => {
1297
- var i;
1298
- const r = {}, n = ((i = e == null ? void 0 : e.getEndpointParameterInstructions) == null ? void 0 : i.call(e)) || {};
1299
- for (const [o, a] of Object.entries(n))
1300
- switch (a.type) {
1301
- case "staticContextParams":
1302
- r[o] = a.value;
1303
- break;
1304
- case "contextParams":
1305
- r[o] = t[a.name];
1306
- break;
1307
- case "clientContextParams":
1308
- case "builtInParams":
1309
- r[o] = await lr(a.name, o, s, a.type !== "builtInParams")();
1310
- break;
1311
- case "operationContextParams":
1312
- r[o] = a.get(t);
1313
- break;
1314
- default:
1315
- throw new Error("Unrecognized endpoint parameter instruction: " + JSON.stringify(a));
1316
- }
1317
- return Object.keys(n).length === 0 && Object.assign(r, s), String(s.serviceId).toLowerCase() === "s3" && await or(r), r;
1318
- };
1319
- function pr(t, e, s) {
1320
- t.__smithy_context ? t.__smithy_context.features || (t.__smithy_context.features = {}) : t.__smithy_context = { features: {} }, t.__smithy_context.features[e] = s;
1321
- }
1322
- function gr(t) {
1323
- const e = hr(t);
1324
- return ({ config: s, instructions: r }) => (n, i) => async (o) => {
1325
- var u, d, l;
1326
- s.isCustomEndpoint && pr(i, "ENDPOINT_OVERRIDE", "N");
1327
- const a = await e(o.input, {
1328
- getEndpointParameterInstructions() {
1329
- return r;
1330
- }
1331
- }, { ...s }, i);
1332
- i.endpointV2 = a, i.authSchemes = (u = a.properties) == null ? void 0 : u.authSchemes;
1333
- const c = (d = i.authSchemes) == null ? void 0 : d[0];
1334
- if (c) {
1335
- i.signing_region = c.signingRegion, i.signing_service = c.signingName;
1336
- const f = ie(i), h = (l = f == null ? void 0 : f.selectedHttpAuthScheme) == null ? void 0 : l.httpAuthOption;
1337
- h && (h.signingProperties = Object.assign(h.signingProperties || {}, {
1338
- signing_region: c.signingRegion,
1339
- signingRegion: c.signingRegion,
1340
- signing_service: c.signingName,
1341
- signingName: c.signingName,
1342
- signingRegionSet: c.signingRegionSet
1343
- }, c.properties));
1344
- }
1345
- return n({
1346
- ...o
1347
- });
1348
- };
1349
- }
1350
- const yr = {
1351
- name: "serializerMiddleware"
1352
- }, wr = {
1353
- step: "serialize",
1354
- tags: ["ENDPOINT_PARAMETERS", "ENDPOINT_V2", "ENDPOINT"],
1355
- name: "endpointV2Middleware",
1356
- override: !0,
1357
- relation: "before",
1358
- toMiddleware: yr.name
1359
- };
1360
- function Sr(t) {
1361
- const e = gr(t);
1362
- return (s, r) => ({
1363
- applyToStack: (n) => {
1364
- n.addRelativeTo(e({
1365
- config: s,
1366
- instructions: r
1367
- }), wr);
1368
- }
1369
- });
1370
- }
1371
- function br(t) {
1372
- return (e) => {
1373
- const s = e.tls ?? !0, { endpoint: r, useDualstackEndpoint: n, useFipsEndpoint: i } = e, o = r != null ? async () => Xe(await L(r)()) : void 0, c = Object.assign(e, {
1374
- endpoint: o,
1375
- tls: s,
1376
- isCustomEndpoint: !!r,
1377
- useDualstackEndpoint: L(n ?? !1),
1378
- useFipsEndpoint: L(i ?? !1)
1379
- });
1380
- let u;
1381
- return c.serviceConfiguredEndpoint = async () => (e.serviceId && !u && (u = t(e.serviceId)), u), c;
1382
- };
1383
- }
1384
- class Ut {
1385
- constructor(e, s, r, n) {
1386
- m(this, "nodes");
1387
- m(this, "root");
1388
- m(this, "conditions");
1389
- m(this, "results");
1390
- this.nodes = e, this.root = s, this.conditions = r, this.results = n;
1391
- }
1392
- static from(e, s, r, n) {
1393
- return new Ut(e, s, r, n);
1394
- }
1395
- }
1396
- class no {
1397
- constructor({ size: e, params: s }) {
1398
- m(this, "capacity");
1399
- m(this, "data", /* @__PURE__ */ new Map());
1400
- m(this, "parameters", []);
1401
- this.capacity = e ?? 50, s && (this.parameters = s);
1402
- }
1403
- get(e, s) {
1404
- const r = this.hash(e);
1405
- if (r === !1)
1406
- return s();
1407
- if (!this.data.has(r)) {
1408
- if (this.data.size > this.capacity + 10) {
1409
- const n = this.data.keys();
1410
- let i = 0;
1411
- for (; ; ) {
1412
- const { value: o, done: a } = n.next();
1413
- if (this.data.delete(o), a || ++i > 10)
1414
- break;
1415
- }
1416
- }
1417
- this.data.set(r, s());
1418
- }
1419
- return this.data.get(r);
1420
- }
1421
- size() {
1422
- return this.data.size;
1423
- }
1424
- hash(e) {
1425
- let s = "";
1426
- const { parameters: r } = this;
1427
- if (r.length === 0)
1428
- return !1;
1429
- for (const n of r) {
1430
- const i = String(e[n] ?? "");
1431
- if (i.includes("|;"))
1432
- return !1;
1433
- s += i + "|;";
1434
- }
1435
- return s;
1436
- }
1437
- }
1438
- class I extends Error {
1439
- constructor(e) {
1440
- super(e), this.name = "EndpointError";
1441
- }
1442
- }
1443
- const Er = "endpoints";
1444
- function ge(t) {
1445
- return typeof t != "object" || t == null ? t : "ref" in t ? `$${ge(t.ref)}` : "fn" in t ? `${t.fn}(${(t.argv || []).map(ge).join(", ")})` : JSON.stringify(t, null, 2);
1446
- }
1447
- const Lt = {}, Tr = (t, e) => t === e;
1448
- function Rr(...t) {
1449
- for (const e of t)
1450
- if (e != null)
1451
- return e;
1452
- }
1453
- const Ar = (t) => {
1454
- const e = t.split("."), s = [];
1455
- for (const r of e) {
1456
- const n = r.indexOf("[");
1457
- if (n !== -1) {
1458
- if (r.indexOf("]") !== r.length - 1)
1459
- throw new I(`Path: '${t}' does not end with ']'`);
1460
- const i = r.slice(n + 1, -1);
1461
- if (Number.isNaN(parseInt(i)))
1462
- throw new I(`Invalid array index: '${i}' in path: '${t}'`);
1463
- n !== 0 && s.push(r.slice(0, n)), s.push(i);
1464
- } else
1465
- s.push(r);
1466
- }
1467
- return s;
1468
- }, Ht = (t, e) => Ar(e).reduce((s, r) => {
1469
- if (typeof s != "object")
1470
- throw new I(`Index '${r}' in '${e}' not found in '${JSON.stringify(t)}'`);
1471
- if (Array.isArray(s)) {
1472
- const n = parseInt(r);
1473
- return s[n < 0 ? s.length + n : n];
1474
- }
1475
- return s[r];
1476
- }, t), vr = (t) => t != null;
1477
- function Cr(t, e, s) {
1478
- return t ? e : s;
1479
- }
1480
- const xr = (t) => !t, Ir = 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}$"), Ft = (t) => Ir.test(t) || t.startsWith("[") && t.endsWith("]"), Me = {
1481
- [Y.HTTP]: 80,
1482
- [Y.HTTPS]: 443
1483
- }, Mr = (t) => {
1484
- const e = (() => {
1485
- try {
1486
- if (t instanceof URL)
1487
- return t;
1488
- if (typeof t == "object" && "hostname" in t) {
1489
- const { hostname: f, port: h, protocol: p = "", path: y = "", query: g = {} } = t, w = new URL(`${p}//${f}${h ? `:${h}` : ""}${y}`);
1490
- return w.search = Object.entries(g).map(([S, b]) => `${S}=${b}`).join("&"), w;
1491
- }
1492
- return new URL(t);
1493
- } catch {
1494
- return null;
1495
- }
1496
- })();
1497
- if (!e)
1498
- return console.error(`Unable to parse ${JSON.stringify(t)} as a whatwg URL.`), null;
1499
- const s = e.href, { host: r, hostname: n, pathname: i, protocol: o, search: a } = e;
1500
- if (a)
1501
- return null;
1502
- const c = o.slice(0, -1);
1503
- if (!Object.values(Y).includes(c))
1504
- return null;
1505
- const u = Ft(n), d = s.includes(`${r}:${Me[c]}`) || typeof t == "string" && t.includes(`${r}:${Me[c]}`), l = `${r}${d ? `:${Me[c]}` : ""}`;
1506
- return {
1507
- scheme: c,
1508
- authority: l,
1509
- path: i,
1510
- normalizedPath: i.endsWith("/") ? i : `${i}/`,
1511
- isIp: u
1512
- };
1513
- };
1514
- function $r(t, e, s) {
1515
- if (s === 1)
1516
- return [t];
1517
- if (t === "")
1518
- return [""];
1519
- const r = t.split(e);
1520
- return s === 0 ? r : r.slice(0, s - 1).concat(r.slice(1).join(e));
1521
- }
1522
- const kr = (t, e) => t === e, Or = (t, e, s, r) => t == null || e >= s || t.length < s || /[^\u0000-\u007f]/.test(t) ? null : r ? t.substring(t.length - s, t.length - e) : t.substring(e, s), Nr = (t) => encodeURIComponent(t).replace(/[!*'()]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`), _r = {
1523
- booleanEquals: Tr,
1524
- coalesce: Rr,
1525
- getAttr: Ht,
1526
- isSet: vr,
1527
- isValidHostLabel: we,
1528
- ite: Cr,
1529
- not: xr,
1530
- parseURL: Mr,
1531
- split: $r,
1532
- stringEquals: kr,
1533
- substring: Or,
1534
- uriEncode: Nr
1535
- }, Bt = (t, e) => {
1536
- const s = [], { referenceRecord: r, endpointParams: n } = e;
1537
- let i = 0;
1538
- for (; i < t.length; ) {
1539
- const o = t.indexOf("{", i);
1540
- if (o === -1) {
1541
- s.push(t.slice(i));
1542
- break;
1543
- }
1544
- s.push(t.slice(i, o));
1545
- const a = t.indexOf("}", o);
1546
- if (a === -1) {
1547
- s.push(t.slice(o));
1548
- break;
1549
- }
1550
- t[o + 1] === "{" && t[a + 1] === "}" && (s.push(t.slice(o + 1, a)), i = a + 2);
1551
- const c = t.substring(o + 1, a);
1552
- if (c.includes("#")) {
1553
- const [u, d] = c.split("#");
1554
- s.push(Ht(r[u] ?? n[u], d));
1555
- } else
1556
- s.push(r[c] ?? n[c]);
1557
- i = a + 1;
1558
- }
1559
- return s.join("");
1560
- }, Pr = ({ ref: t }, e) => e.referenceRecord[t] ?? e.endpointParams[t], be = (t, e, s) => {
1561
- if (typeof t == "string")
1562
- return Bt(t, s);
1563
- if (t.fn)
1564
- return jt.callFunction(t, s);
1565
- if (t.ref)
1566
- return Pr(t, s);
1567
- throw new I(`'${e}': ${String(t)} is not a string, function or reference.`);
1568
- }, zt = ({ fn: t, argv: e }, s) => {
1569
- const r = Array(e.length);
1570
- for (let o = 0; o < r.length; ++o) {
1571
- const a = e[o];
1572
- typeof a == "boolean" || typeof a == "number" ? r[o] = a : r[o] = jt.evaluateExpression(a, "arg", s);
1573
- }
1574
- const n = t.indexOf(".");
1575
- if (n !== -1) {
1576
- const o = Lt[t.slice(0, n)], a = o == null ? void 0 : o[t.slice(n + 1)];
1577
- if (typeof a == "function")
1578
- return a(...r);
1579
- }
1580
- const i = _r[t];
1581
- if (typeof i == "function")
1582
- return i(...r);
1583
- throw new Error(`function ${t} not loaded in endpointFunctions.`);
1584
- }, jt = {
1585
- evaluateExpression: be,
1586
- callFunction: zt
1587
- }, Dr = (t, e) => {
1588
- var i, o;
1589
- const { assign: s } = t;
1590
- if (s && s in e.referenceRecord)
1591
- throw new I(`'${s}' is already defined in Reference Record.`);
1592
- const r = zt(t, e);
1593
- (o = (i = e.logger) == null ? void 0 : i.debug) == null || o.call(i, `${Er} evaluateCondition: ${ge(t)} = ${ge(r)}`);
1594
- const n = r === "" ? !0 : !!r;
1595
- return s != null ? { result: n, toAssign: { name: s, value: r } } : { result: n };
1596
- }, Ur = (t, e) => Object.entries(t ?? {}).reduce((s, [r, n]) => (s[r] = n.map((i) => {
1597
- const o = be(i, "Header value entry", e);
1598
- if (typeof o != "string")
1599
- throw new I(`Header '${r}' value '${o}' is not a string`);
1600
- return o;
1601
- }), s), {}), qt = (t, e) => Object.entries(t).reduce((s, [r, n]) => (s[r] = Wt.getEndpointProperty(n, e), s), {}), Gt = (t, e) => {
1602
- if (Array.isArray(t))
1603
- return t.map((s) => Gt(s, e));
1604
- switch (typeof t) {
1605
- case "string":
1606
- return Bt(t, e);
1607
- case "object":
1608
- if (t === null)
1609
- throw new I(`Unexpected endpoint property: ${t}`);
1610
- return Wt.getEndpointProperties(t, e);
1611
- case "boolean":
1612
- return t;
1613
- default:
1614
- throw new I(`Unexpected endpoint property type: ${typeof t}`);
1615
- }
1616
- }, Wt = {
1617
- getEndpointProperty: Gt,
1618
- getEndpointProperties: qt
1619
- }, Lr = (t, e) => {
1620
- const s = be(t, "Endpoint URL", e);
1621
- if (typeof s == "string")
1622
- try {
1623
- return new URL(s);
1624
- } catch (r) {
1625
- throw console.error(`Failed to construct URL with ${s}`, r), r;
1626
- }
1627
- throw new I(`Endpoint URL must be a string, got ${typeof s}`);
1628
- }, $e = 1e8, io = (t, e) => {
1629
- const { nodes: s, root: r, results: n, conditions: i } = t;
1630
- let o = r;
1631
- const a = {}, c = {
1632
- referenceRecord: a,
1633
- endpointParams: e.endpointParams,
1634
- logger: e.logger
1635
- };
1636
- for (; o !== 1 && o !== -1 && o < $e; ) {
1637
- const u = 3 * (Math.abs(o) - 1), [d, l, f] = [s[u], s[u + 1], s[u + 2]], [h, p, y] = i[d], g = Dr({ fn: h, assign: y, argv: p }, c);
1638
- if (g.toAssign) {
1639
- const { name: w, value: S } = g.toAssign;
1640
- a[w] = S;
1641
- }
1642
- o = o >= 0 === g.result ? l : f;
1643
- }
1644
- if (o >= $e) {
1645
- const u = n[o - $e];
1646
- if (u[0] === -1) {
1647
- const [, h] = u;
1648
- throw new I(be(h, "Error", c));
1649
- }
1650
- const [d, l, f] = u;
1651
- return {
1652
- url: Lr(d, c),
1653
- properties: qt(l, c),
1654
- headers: Ur(f ?? {}, c)
1655
- };
1656
- }
1657
- throw new I("No matching endpoint.");
1658
- }, oo = br(Dt), ao = Sr(Dt);
1659
- class ke extends Os(Ns, te, ks, Ot) {
1660
- }
1661
- const Hr = (t) => crypto.getRandomValues(t), Vt = _s(Hr), co = Vt, uo = async (t = new Uint8Array(), e) => {
1662
- if (t instanceof Uint8Array)
1663
- return ke.mutate(t);
1664
- if (!t)
1665
- return ke.mutate(new Uint8Array());
1666
- const s = e.streamCollector(t);
1667
- return ke.mutate(await s);
1668
- };
1669
- class Fr {
1670
- constructor() {
1671
- m(this, "serdeContext");
1672
- }
1673
- setSerdeContext(e) {
1674
- this.serdeContext = e;
1675
- }
1676
- }
1677
- class fo extends Fr {
1678
- constructor(s) {
1679
- super();
1680
- m(this, "options");
1681
- m(this, "compositeErrorRegistry");
1682
- this.options = s, this.compositeErrorRegistry = ee.for(s.defaultNamespace);
1683
- for (const r of s.errorTypeRegistries ?? [])
1684
- this.compositeErrorRegistry.copyFrom(r);
1685
- }
1686
- getRequestType() {
1687
- return C;
1688
- }
1689
- getResponseType() {
1690
- return q;
1691
- }
1692
- setSerdeContext(s) {
1693
- this.serdeContext = s, this.serializer.setSerdeContext(s), this.deserializer.setSerdeContext(s), this.getPayloadCodec() && this.getPayloadCodec().setSerdeContext(s);
1694
- }
1695
- updateServiceEndpoint(s, r) {
1696
- if ("url" in r) {
1697
- s.protocol = r.url.protocol, s.hostname = r.url.hostname, s.port = r.url.port ? Number(r.url.port) : void 0, s.path = r.url.pathname, s.fragment = r.url.hash || void 0, s.username = r.url.username || void 0, s.password = r.url.password || void 0, s.query || (s.query = {});
1698
- for (const [n, i] of r.url.searchParams.entries())
1699
- s.query[n] = i;
1700
- if (r.headers)
1701
- for (const n in r.headers)
1702
- s.headers[n] = r.headers[n].join(", ");
1703
- return s;
1704
- } else {
1705
- if (s.protocol = r.protocol, s.hostname = r.hostname, s.port = r.port ? Number(r.port) : void 0, s.path = r.path, s.query = {
1706
- ...r.query
1707
- }, r.headers)
1708
- for (const n in r.headers)
1709
- s.headers[n] = r.headers[n];
1710
- return s;
1711
- }
1712
- }
1713
- setHostPrefix(s, r, n) {
1714
- var a, c;
1715
- if ((a = this.serdeContext) != null && a.disableHostPrefix)
1716
- return;
1717
- const i = B.of(r.input), o = V(r.traits ?? {});
1718
- if (o.endpoint) {
1719
- let u = (c = o.endpoint) == null ? void 0 : c[0];
1720
- if (typeof u == "string") {
1721
- for (const [d, l] of i.structIterator()) {
1722
- if (!l.getMergedTraits().hostLabel)
1723
- continue;
1724
- const f = n[d];
1725
- if (typeof f != "string")
1726
- throw new Error(`@smithy/core/schema - ${d} in input must be a string as hostLabel.`);
1727
- u = u.replace(`{${d}}`, f);
1728
- }
1729
- s.hostname = u + s.hostname;
1730
- }
1731
- }
1732
- }
1733
- deserializeMetadata(s) {
1734
- return {
1735
- httpStatusCode: s.statusCode,
1736
- requestId: s.headers["x-amzn-requestid"] ?? s.headers["x-amzn-request-id"] ?? s.headers["x-amz-request-id"],
1737
- extendedRequestId: s.headers["x-amz-id-2"],
1738
- cfId: s.headers["x-amz-cf-id"]
1739
- };
1740
- }
1741
- async serializeEventStream({ eventStream: s, requestSchema: r, initialRequest: n }) {
1742
- return (await this.loadEventStreamCapability()).serializeEventStream({
1743
- eventStream: s,
1744
- requestSchema: r,
1745
- initialRequest: n
1746
- });
1747
- }
1748
- async deserializeEventStream({ response: s, responseSchema: r, initialResponseContainer: n }) {
1749
- return (await this.loadEventStreamCapability()).deserializeEventStream({
1750
- response: s,
1751
- responseSchema: r,
1752
- initialResponseContainer: n
1753
- });
1754
- }
1755
- async loadEventStreamCapability() {
1756
- const { EventStreamSerde: s, eventStreamSerdeProvider: r } = await import("./index.browser-CKeO7JYa.mjs"), n = this.resolveEventStreamMarshaller(r);
1757
- return new s({
1758
- marshaller: n,
1759
- serializer: this.serializer,
1760
- deserializer: this.deserializer,
1761
- serdeContext: this.serdeContext,
1762
- defaultContentType: this.getDefaultContentType()
1763
- });
1764
- }
1765
- resolveEventStreamMarshaller(s) {
1766
- const r = this.serdeContext;
1767
- return r.eventStreamMarshaller ? r.eventStreamMarshaller : s(this.serdeContext);
1768
- }
1769
- getDefaultContentType() {
1770
- throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`);
1771
- }
1772
- async deserializeHttpMessage(s, r, n, i, o) {
1773
- return [];
1774
- }
1775
- getEventStreamMarshaller() {
1776
- const s = this.serdeContext;
1777
- if (!s.eventStreamMarshaller)
1778
- throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");
1779
- return s.eventStreamMarshaller;
1780
- }
1781
- }
1782
- function lo(t, e) {
1783
- if (e.timestampFormat.useTrait && t.isTimestampSchema() && (t.getSchema() === 5 || t.getSchema() === 6 || t.getSchema() === 7))
1784
- return t.getSchema();
1785
- const { httpLabel: s, httpPrefixHeaders: r, httpHeader: n, httpQuery: i } = t.getMergedTraits();
1786
- return (e.httpBindings ? typeof r == "string" || n ? 6 : i || s ? 5 : void 0 : void 0) ?? e.timestampFormat.default;
1787
- }
1788
- const ho = (t) => ({
1789
- setHttpHandler(e) {
1790
- t.httpHandler = e;
1791
- },
1792
- httpHandler() {
1793
- return t.httpHandler;
1794
- },
1795
- updateHttpClientConfig(e, s) {
1796
- var r;
1797
- (r = t.httpHandler) == null || r.updateHttpClientConfig(e, s);
1798
- },
1799
- httpHandlerConfigs() {
1800
- return t.httpHandler.httpHandlerConfigs();
1801
- }
1802
- }), mo = (t) => ({
1803
- httpHandler: t.httpHandler()
1804
- }), at = "content-length";
1805
- function Br(t) {
1806
- return (e) => async (s) => {
1807
- const r = s.request;
1808
- if (C.isInstance(r)) {
1809
- const { body: n, headers: i } = r;
1810
- if (n && Object.keys(i).map((o) => o.toLowerCase()).indexOf(at) === -1)
1811
- try {
1812
- const o = t(n);
1813
- r.headers = {
1814
- ...r.headers,
1815
- [at]: String(o)
1816
- };
1817
- } catch {
1818
- }
1819
- }
1820
- return e({
1821
- ...s,
1822
- request: r
1823
- });
1824
- };
1825
- }
1826
- const zr = {
1827
- step: "build",
1828
- tags: ["SET_CONTENT_LENGTH", "CONTENT_LENGTH"],
1829
- name: "contentLengthMiddleware",
1830
- override: !0
1831
- }, po = (t) => ({
1832
- applyToStack: (e) => {
1833
- e.add(Br(t.bodyLengthChecker), zr);
1834
- }
1835
- }), F = (t) => encodeURIComponent(t).replace(/[!'()*]/g, jr), jr = (t) => `%${t.charCodeAt(0).toString(16).toUpperCase()}`;
1836
- function qr(t) {
1837
- const e = [];
1838
- for (let s of Object.keys(t).sort()) {
1839
- const r = t[s];
1840
- if (s = F(s), Array.isArray(r))
1841
- for (let n = 0, i = r.length; n < i; n++)
1842
- e.push(`${s}=${F(r[n])}`);
1843
- else {
1844
- let n = s;
1845
- (r || typeof r == "string") && (n += `=${F(r)}`), e.push(n);
1846
- }
1847
- }
1848
- return e.join("&");
1849
- }
1850
- const Gr = [
1851
- "BandwidthLimitExceeded",
1852
- "EC2ThrottledException",
1853
- "LimitExceededException",
1854
- "PriorRequestNotComplete",
1855
- "ProvisionedThroughputExceededException",
1856
- "RequestLimitExceeded",
1857
- "RequestThrottled",
1858
- "RequestThrottledException",
1859
- "SlowDown",
1860
- "ThrottledException",
1861
- "Throttling",
1862
- "ThrottlingException",
1863
- "TooManyRequestsException",
1864
- "TransactionInProgressException"
1865
- ], Wr = ["TimeoutError", "RequestTimeout", "RequestTimeoutException"], Vr = [500, 502, 503, 504], Xr = ["ECONNRESET", "ECONNREFUSED", "EPIPE", "ETIMEDOUT"], Jr = ["EHOSTUNREACH", "ENETUNREACH", "ENOTFOUND", "EAI_AGAIN"], Kr = (t) => (t == null ? void 0 : t.$retryable) !== void 0, Qr = (t) => {
1866
- var e;
1867
- return (e = t.$metadata) == null ? void 0 : e.clockSkewCorrected;
1868
- }, Yr = (t) => {
1869
- const e = /* @__PURE__ */ new Set([
1870
- "Failed to fetch",
1871
- "NetworkError when attempting to fetch resource",
1872
- "The Internet connection appears to be offline",
1873
- "Load failed",
1874
- "Network request failed"
1875
- ]);
1876
- return t && t instanceof TypeError ? e.has(t.message) : !1;
1877
- }, Xt = (t) => {
1878
- var e, s;
1879
- return ((e = t.$metadata) == null ? void 0 : e.httpStatusCode) === 429 || Gr.includes(t.name) || ((s = t.$retryable) == null ? void 0 : s.throttling) == !0;
1880
- }, Ke = (t, e = 0) => {
1881
- var s, r;
1882
- return Kr(t) || Qr(t) || t.name === "InvalidSignatureException" && ((s = t.message) == null ? void 0 : s.includes("Signature expired")) || Wr.includes(t.name) || Xr.includes((t == null ? void 0 : t.code) || "") || Jr.includes((t == null ? void 0 : t.code) || "") || Vr.includes(((r = t.$metadata) == null ? void 0 : r.httpStatusCode) || 0) || Yr(t) || en(t) || t.cause !== void 0 && e <= 10 && Ke(t.cause, e + 1);
1883
- }, Zr = (t) => {
1884
- var e;
1885
- if (((e = t.$metadata) == null ? void 0 : e.httpStatusCode) !== void 0) {
1886
- const s = t.$metadata.httpStatusCode;
1887
- return 500 <= s && s <= 599 && !Ke(t);
1888
- }
1889
- return !1;
1890
- };
1891
- function en(t) {
1892
- return t.code === "ERR_HTTP2_STREAM_ERROR" && t.message.includes("NGHTTP2_REFUSED_STREAM");
1893
- }
1894
- const Jt = 20 * 1e3, ct = 500, tn = 1, sn = "amz-sdk-invocation-id", rn = "amz-sdk-request";
1895
- function nn(t, e) {
1896
- var s, r, n, i;
1897
- if (q.isInstance(t))
1898
- for (const o of Object.keys(t.headers)) {
1899
- const a = o.toLowerCase();
1900
- if (a === "retry-after") {
1901
- const c = t.headers[o];
1902
- let u = NaN;
1903
- if (c.endsWith("GMT"))
1904
- try {
1905
- u = (Js(c).getTime() - Date.now()) / 1e3;
1906
- } catch (d) {
1907
- (s = e == null ? void 0 : e.trace) == null || s.call(e, "Failed to parse retry-after header"), (r = e == null ? void 0 : e.trace) == null || r.call(e, d);
1908
- }
1909
- else c.match(/ GMT, ((\d+)|(\d+\.\d+))$/) ? u = Number((n = c.match(/ GMT, ([\d.]+)$/)) == null ? void 0 : n[1]) : c.match(/^((\d+)|(\d+\.\d+))$/) ? u = Number(c) : Date.parse(c) >= Date.now() && (u = (Date.parse(c) - Date.now()) / 1e3);
1910
- return isNaN(u) ? void 0 : new Date(Date.now() + u * 1e3);
1911
- } else if (a === "x-amz-retry-after") {
1912
- const c = t.headers[o], u = Number(c);
1913
- if (isNaN(u)) {
1914
- (i = e == null ? void 0 : e.trace) == null || i.call(e, `Failed to parse x-amz-retry-after=${c}`);
1915
- return;
1916
- }
1917
- return new Date(Date.now() + u);
1918
- }
1919
- }
1920
- }
1921
- const on = (t) => t instanceof Error ? t : t instanceof Object ? Object.assign(new Error(), t) : typeof t == "string" ? new Error(t) : new Error(`AWS SDK error wrapper for ${t}`);
1922
- function an(t) {
1923
- return (e) => (s, r) => async (n) => {
1924
- var a, c;
1925
- let i = await e.retryStrategy();
1926
- const o = await e.maxAttempts();
1927
- if (un(i)) {
1928
- i = i;
1929
- let u = await i.acquireInitialRetryToken((r.partition_id ?? "") + (r.__retryLongPoll ? ":longpoll" : "")), d = new Error(), l = 0, f = 0;
1930
- const { request: h } = n, p = C.isInstance(h);
1931
- for (p && (h.headers[sn] = Vt()); ; )
1932
- try {
1933
- p && (h.headers[rn] = `attempt=${l + 1}; max=${o}`);
1934
- const { response: y, output: g } = await s(n);
1935
- return i.recordSuccess(u), g.$metadata.attempts = l + 1, g.$metadata.totalRetryDelay = f, { response: y, output: g };
1936
- } catch (y) {
1937
- const g = dn(y, e.logger);
1938
- if (d = on(y), p && t(h))
1939
- throw (a = r.logger instanceof Is ? console : r.logger) == null || a.warn("An error was encountered in a non-retryable streaming request."), d;
1940
- try {
1941
- u = await i.refreshRetryTokenForRetry(u, g);
1942
- } catch {
1943
- throw d.$metadata || (d.$metadata = {}), d.$metadata.attempts = l + 1, d.$metadata.totalRetryDelay = f, d;
1944
- }
1945
- l = u.getRetryCount();
1946
- const w = u.getRetryDelay();
1947
- f += (((c = u == null ? void 0 : u.$retryLog) == null ? void 0 : c.acquisitionDelay) ?? 0) + w, w > 0 && await cn(w);
1948
- }
1949
- } else
1950
- return i = i, i != null && i.mode && (r.userAgent = [...r.userAgent || [], ["cfg/retry-mode", i.mode]]), i.retry(s, n);
1951
- };
1952
- }
1953
- const cn = (t) => new Promise((e) => setTimeout(e, t)), un = (t) => typeof t.acquireInitialRetryToken < "u" && typeof t.refreshRetryTokenForRetry < "u" && typeof t.recordSuccess < "u", dn = (t, e) => {
1954
- const s = {
1955
- error: t,
1956
- errorType: fn(t)
1957
- }, r = nn(t.$response, e);
1958
- return r && (s.retryAfterHint = r), s;
1959
- }, fn = (t) => Xt(t) ? "THROTTLING" : Ke(t) ? "TRANSIENT" : Zr(t) ? "SERVER_ERROR" : "CLIENT_ERROR", ln = {
1960
- name: "retryMiddleware",
1961
- tags: ["RETRY"],
1962
- step: "finalizeRequest",
1963
- priority: "high",
1964
- override: !0
1965
- };
1966
- function hn(t) {
1967
- const e = an(t);
1968
- return (s) => ({
1969
- applyToStack: (r) => {
1970
- r.add(e(s), ln);
1971
- }
1972
- });
1973
- }
1974
- const ye = class ye {
1975
- constructor(e) {
1976
- m(this, "beta");
1977
- m(this, "minCapacity");
1978
- m(this, "minFillRate");
1979
- m(this, "scaleConstant");
1980
- m(this, "smooth");
1981
- m(this, "enabled", !1);
1982
- m(this, "availableTokens", 0);
1983
- m(this, "lastMaxRate", 0);
1984
- m(this, "measuredTxRate", 0);
1985
- m(this, "requestCount", 0);
1986
- m(this, "fillRate");
1987
- m(this, "lastThrottleTime");
1988
- m(this, "lastTimestamp", 0);
1989
- m(this, "lastTxRateBucket");
1990
- m(this, "maxCapacity");
1991
- m(this, "timeWindow", 0);
1992
- this.beta = (e == null ? void 0 : e.beta) ?? 0.7, this.minCapacity = (e == null ? void 0 : e.minCapacity) ?? 1, this.minFillRate = (e == null ? void 0 : e.minFillRate) ?? 0.5, this.scaleConstant = (e == null ? void 0 : e.scaleConstant) ?? 0.4, this.smooth = (e == null ? void 0 : e.smooth) ?? 0.8, this.lastThrottleTime = this.getCurrentTimeInSeconds(), this.lastTxRateBucket = Math.floor(this.getCurrentTimeInSeconds()), this.fillRate = this.minFillRate, this.maxCapacity = this.minCapacity;
1993
- }
1994
- async getSendToken() {
1995
- return this.acquireTokenBucket(1);
1996
- }
1997
- updateClientSendingRate(e) {
1998
- let s;
1999
- this.updateMeasuredRate();
2000
- const r = e;
2001
- if ((r == null ? void 0 : r.errorType) === "THROTTLING" || Xt((r == null ? void 0 : r.error) ?? e)) {
2002
- const o = this.enabled ? Math.min(this.measuredTxRate, this.fillRate) : this.measuredTxRate;
2003
- this.lastMaxRate = o, this.calculateTimeWindow(), this.lastThrottleTime = this.getCurrentTimeInSeconds(), s = this.cubicThrottle(o), this.enableTokenBucket();
2004
- } else
2005
- this.calculateTimeWindow(), s = this.cubicSuccess(this.getCurrentTimeInSeconds());
2006
- const i = Math.min(s, 2 * this.measuredTxRate);
2007
- this.updateTokenBucketRate(i);
2008
- }
2009
- getCurrentTimeInSeconds() {
2010
- return Date.now() / 1e3;
2011
- }
2012
- async acquireTokenBucket(e) {
2013
- if (this.enabled) {
2014
- for (this.refillTokenBucket(); e > this.availableTokens; ) {
2015
- const s = (e - this.availableTokens) / this.fillRate * 1e3;
2016
- await new Promise((r) => ye.setTimeoutFn(r, s)), this.refillTokenBucket();
2017
- }
2018
- this.availableTokens = this.availableTokens - e;
2019
- }
2020
- }
2021
- refillTokenBucket() {
2022
- const e = this.getCurrentTimeInSeconds();
2023
- if (!this.lastTimestamp) {
2024
- this.lastTimestamp = e;
2025
- return;
2026
- }
2027
- const s = (e - this.lastTimestamp) * this.fillRate;
2028
- this.availableTokens = Math.min(this.maxCapacity, this.availableTokens + s), this.lastTimestamp = e;
2029
- }
2030
- calculateTimeWindow() {
2031
- this.timeWindow = this.getPrecise(Math.pow(this.lastMaxRate * (1 - this.beta) / this.scaleConstant, 1 / 3));
2032
- }
2033
- cubicThrottle(e) {
2034
- return this.getPrecise(e * this.beta);
2035
- }
2036
- cubicSuccess(e) {
2037
- return this.getPrecise(this.scaleConstant * Math.pow(e - this.lastThrottleTime - this.timeWindow, 3) + this.lastMaxRate);
2038
- }
2039
- enableTokenBucket() {
2040
- this.enabled = !0;
2041
- }
2042
- updateTokenBucketRate(e) {
2043
- this.refillTokenBucket(), this.fillRate = Math.max(e, this.minFillRate), this.maxCapacity = Math.max(e, this.minCapacity), this.availableTokens = Math.min(this.availableTokens, this.maxCapacity);
2044
- }
2045
- updateMeasuredRate() {
2046
- const e = this.getCurrentTimeInSeconds(), s = Math.floor(e * 2) / 2;
2047
- if (this.requestCount++, s > this.lastTxRateBucket) {
2048
- const r = this.requestCount / (s - this.lastTxRateBucket);
2049
- this.measuredTxRate = this.getPrecise(r * this.smooth + this.measuredTxRate * (1 - this.smooth)), this.requestCount = 0, this.lastTxRateBucket = s;
2050
- }
2051
- }
2052
- getPrecise(e) {
2053
- return parseFloat(e.toFixed(8));
2054
- }
2055
- };
2056
- m(ye, "setTimeoutFn", (e, s) => setTimeout(e, s));
2057
- let qe = ye;
2058
- var xt;
2059
- const _ = class _ {
2060
- static delay() {
2061
- return _.v2026 ? 50 : 100;
2062
- }
2063
- static throttlingDelay() {
2064
- return _.v2026 ? 1e3 : 500;
2065
- }
2066
- static cost() {
2067
- return _.v2026 ? 14 : 5;
2068
- }
2069
- static throttlingCost() {
2070
- return _.v2026 ? 5 : 10;
2071
- }
2072
- static modifiedCostType() {
2073
- return _.v2026 ? "THROTTLING" : "TRANSIENT";
2074
- }
2075
- };
2076
- m(_, "v2026", typeof process < "u" && ((xt = process.env) == null ? void 0 : xt.SMITHY_NEW_RETRIES_2026) === "true");
2077
- let R = _;
2078
- class mn {
2079
- constructor() {
2080
- m(this, "x", R.delay());
2081
- }
2082
- computeNextBackoffDelay(e) {
2083
- const n = Math.random() * Math.min(this.x * 2 ** e, Jt);
2084
- return Math.floor(n);
2085
- }
2086
- setDelayBase(e) {
2087
- this.x = e;
2088
- }
2089
- }
2090
- class ut {
2091
- constructor(e, s, r, n) {
2092
- m(this, "delay");
2093
- m(this, "count");
2094
- m(this, "cost");
2095
- m(this, "longPoll");
2096
- m(this, "$retryLog", {
2097
- acquisitionDelay: 0
2098
- });
2099
- this.delay = e, this.count = s, this.cost = r, this.longPoll = n;
2100
- }
2101
- getRetryCount() {
2102
- return this.count;
2103
- }
2104
- getRetryDelay() {
2105
- return Math.min(Jt, this.delay);
2106
- }
2107
- getRetryCost() {
2108
- return this.cost;
2109
- }
2110
- isLongPoll() {
2111
- return this.longPoll;
2112
- }
2113
- }
2114
- var D;
2115
- (function(t) {
2116
- t.STANDARD = "standard", t.ADAPTIVE = "adaptive";
2117
- })(D || (D = {}));
2118
- const fe = 3, go = D.STANDARD, oe = {
2119
- incompatible: 1,
2120
- attempts: 2,
2121
- capacity: 3
2122
- };
2123
- class Ge {
2124
- constructor(e) {
2125
- m(this, "mode", D.STANDARD);
2126
- m(this, "retryBackoffStrategy");
2127
- m(this, "capacity", ct);
2128
- m(this, "maxAttemptsProvider");
2129
- m(this, "baseDelay");
2130
- typeof e == "number" ? this.maxAttemptsProvider = async () => e : typeof e == "function" ? this.maxAttemptsProvider = e : e && typeof e == "object" && (this.maxAttemptsProvider = async () => e.maxAttempts, this.baseDelay = e.baseDelay, this.retryBackoffStrategy = e.backoff), this.maxAttemptsProvider ?? (this.maxAttemptsProvider = async () => fe), this.baseDelay ?? (this.baseDelay = R.delay()), this.retryBackoffStrategy ?? (this.retryBackoffStrategy = new mn());
2131
- }
2132
- async acquireInitialRetryToken(e) {
2133
- return new ut(R.delay(), 0, void 0, R.v2026 && e.includes(":longpoll"));
2134
- }
2135
- async refreshRetryTokenForRetry(e, s) {
2136
- var a, c;
2137
- const r = await this.getMaxAttempts(), n = this.retryCode(e, s, r), i = n === 0, o = (a = e.isLongPoll) == null ? void 0 : a.call(e);
2138
- if (i || o) {
2139
- const u = s.errorType;
2140
- this.retryBackoffStrategy.setDelayBase(u === "THROTTLING" ? R.throttlingDelay() : this.baseDelay);
2141
- const d = this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount());
2142
- let l = d;
2143
- if (s.retryAfterHint instanceof Date && (l = Math.max(d, Math.min(s.retryAfterHint.getTime() - Date.now(), d + 5e3))), i) {
2144
- const f = this.getCapacityCost(u);
2145
- this.capacity -= f;
2146
- const h = new ut(0, e.getRetryCount() + 1, f, ((c = e.isLongPoll) == null ? void 0 : c.call(e)) ?? !1);
2147
- return await new Promise((p) => setTimeout(p, l)), h.$retryLog.acquisitionDelay = l, h;
2148
- } else {
2149
- const f = R.v2026 && n === oe.capacity && o ? l : 0;
2150
- f > 0 && await new Promise((h) => setTimeout(h, f));
2151
- }
2152
- }
2153
- throw new Error("No retry token available");
2154
- }
2155
- recordSuccess(e) {
2156
- this.capacity = Math.min(ct, this.capacity + (e.getRetryCost() ?? tn));
2157
- }
2158
- getCapacity() {
2159
- return this.capacity;
2160
- }
2161
- async maxAttempts() {
2162
- return this.maxAttemptsProvider();
2163
- }
2164
- async getMaxAttempts() {
2165
- try {
2166
- return await this.maxAttemptsProvider();
2167
- } catch {
2168
- return console.warn(`Max attempts provider could not resolve. Using default of ${fe}`), fe;
2169
- }
2170
- }
2171
- retryCode(e, s, r) {
2172
- const n = e.getRetryCount() + 1, i = this.isRetryableError(s.errorType) ? 0 : oe.incompatible, o = n < r ? 0 : oe.attempts, a = this.capacity >= this.getCapacityCost(s.errorType) ? 0 : oe.capacity;
2173
- return i || o || a;
2174
- }
2175
- getCapacityCost(e) {
2176
- return e === R.modifiedCostType() ? R.throttlingCost() : R.cost();
2177
- }
2178
- isRetryableError(e) {
2179
- return e === "THROTTLING" || e === "TRANSIENT";
2180
- }
2181
- }
2182
- class pn {
2183
- constructor(e, s) {
2184
- m(this, "mode", D.ADAPTIVE);
2185
- m(this, "rateLimiter");
2186
- m(this, "standardRetryStrategy");
2187
- const { rateLimiter: r } = s ?? {};
2188
- this.rateLimiter = r ?? new qe(), this.standardRetryStrategy = s ? new Ge({
2189
- maxAttempts: typeof e == "number" ? e : 3,
2190
- ...s
2191
- }) : new Ge(e);
2192
- }
2193
- async acquireInitialRetryToken(e) {
2194
- const s = await this.standardRetryStrategy.acquireInitialRetryToken(e);
2195
- return await this.rateLimiter.getSendToken(), s;
2196
- }
2197
- async refreshRetryTokenForRetry(e, s) {
2198
- this.rateLimiter.updateClientSendingRate(s);
2199
- const r = await this.standardRetryStrategy.refreshRetryTokenForRetry(e, s);
2200
- return await this.rateLimiter.getSendToken(), r;
2201
- }
2202
- recordSuccess(e) {
2203
- this.rateLimiter.updateClientSendingRate({}), this.standardRetryStrategy.recordSuccess(e);
2204
- }
2205
- async maxAttemptsProvider() {
2206
- return this.standardRetryStrategy.maxAttempts();
2207
- }
2208
- }
2209
- const yo = (t, e) => {
2210
- const { retryStrategy: s, retryMode: r } = t, { defaultMaxAttempts: n = fe, defaultBaseDelay: i = R.delay() } = {}, o = L(t.maxAttempts ?? n);
2211
- let a = s ? Promise.resolve(s) : void 0;
2212
- const c = async () => {
2213
- const u = await o();
2214
- return await L(r)() === D.ADAPTIVE ? new pn(o, {
2215
- maxAttempts: u,
2216
- baseDelay: i
2217
- }) : new Ge({
2218
- maxAttempts: u,
2219
- baseDelay: i
2220
- });
2221
- };
2222
- return Object.assign(t, {
2223
- maxAttempts: o,
2224
- retryStrategy: () => a ?? (a = c())
2225
- });
2226
- }, wo = hn(hs);
2227
- var It;
2228
- R.v2026 || (R.v2026 = typeof process == "object" && ((It = process.env) == null ? void 0 : It.AWS_NEW_RETRIES_2026) === "true");
2229
- function $(t, e, s) {
2230
- t.__aws_sdk_context ? t.__aws_sdk_context.features || (t.__aws_sdk_context.features = {}) : t.__aws_sdk_context = {
2231
- features: {}
2232
- }, t.__aws_sdk_context.features[e] = s;
2233
- }
2234
- function So(t) {
2235
- return t;
2236
- }
2237
- const gn = (t) => (e) => async (s) => {
2238
- if (!C.isInstance(s.request))
2239
- return e(s);
2240
- const { request: r } = s, { handlerProtocol: n = "" } = t.requestHandler.metadata || {};
2241
- if (n.indexOf("h2") >= 0 && !r.headers[":authority"])
2242
- delete r.headers.host, r.headers[":authority"] = r.hostname + (r.port ? ":" + r.port : "");
2243
- else if (!r.headers.host) {
2244
- let i = r.hostname;
2245
- r.port != null && (i += `:${r.port}`), r.headers.host = i;
2246
- }
2247
- return e(s);
2248
- }, yn = {
2249
- name: "hostHeaderMiddleware",
2250
- step: "build",
2251
- priority: "low",
2252
- tags: ["HOST"],
2253
- override: !0
2254
- }, bo = (t) => ({
2255
- applyToStack: (e) => {
2256
- e.add(gn(t), yn);
2257
- }
2258
- }), wn = () => (t, e) => async (s) => {
2259
- var r, n;
2260
- try {
2261
- const i = await t(s), { clientName: o, commandName: a, logger: c, dynamoDbDocumentClientOptions: u = {} } = e, { overrideInputFilterSensitiveLog: d, overrideOutputFilterSensitiveLog: l } = u, f = d ?? e.inputFilterSensitiveLog, h = l ?? e.outputFilterSensitiveLog, { $metadata: p, ...y } = i.output;
2262
- return (r = c == null ? void 0 : c.info) == null || r.call(c, {
2263
- clientName: o,
2264
- commandName: a,
2265
- input: f(s.input),
2266
- output: h(y),
2267
- metadata: p
2268
- }), i;
2269
- } catch (i) {
2270
- const { clientName: o, commandName: a, logger: c, dynamoDbDocumentClientOptions: u = {} } = e, { overrideInputFilterSensitiveLog: d } = u, l = d ?? e.inputFilterSensitiveLog;
2271
- throw (n = c == null ? void 0 : c.error) == null || n.call(c, {
2272
- clientName: o,
2273
- commandName: a,
2274
- input: l(s.input),
2275
- error: i,
2276
- metadata: i.$metadata
2277
- }), i;
2278
- }
2279
- }, Sn = {
2280
- name: "loggerMiddleware",
2281
- tags: ["LOGGER"],
2282
- step: "initialize",
2283
- override: !0
2284
- }, Eo = (t) => ({
2285
- applyToStack: (e) => {
2286
- e.add(wn(), Sn);
2287
- }
2288
- }), To = (t) => ({
2289
- applyToStack: (e) => {
2290
- }
2291
- }), bn = (t, e) => {
2292
- if (!e || e.length === 0)
2293
- return t;
2294
- const s = [];
2295
- for (const r of e)
2296
- for (const n of t)
2297
- n.schemeId.split("#")[1] === r && s.push(n);
2298
- for (const r of t)
2299
- s.find(({ schemeId: n }) => n === r.schemeId) || s.push(r);
2300
- return s;
2301
- };
2302
- function En(t) {
2303
- const e = /* @__PURE__ */ new Map();
2304
- for (const s of t)
2305
- e.set(s.schemeId, s);
2306
- return e;
2307
- }
2308
- const Tn = (t, e) => (s, r) => async (n) => {
2309
- var l;
2310
- const i = t.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(t, r, n.input)), o = t.authSchemePreference ? await t.authSchemePreference() : [], a = bn(i, o), c = En(t.httpAuthSchemes), u = ie(r), d = [];
2311
- for (const f of a) {
2312
- const h = c.get(f.schemeId);
2313
- if (!h) {
2314
- d.push(`HttpAuthScheme \`${f.schemeId}\` was not enabled for this service.`);
2315
- continue;
2316
- }
2317
- const p = h.identityProvider(await e.identityProviderConfigProvider(t));
2318
- if (!p) {
2319
- d.push(`HttpAuthScheme \`${f.schemeId}\` did not have an IdentityProvider configured.`);
2320
- continue;
2321
- }
2322
- const { identityProperties: y = {}, signingProperties: g = {} } = ((l = f.propertiesExtractor) == null ? void 0 : l.call(f, t, r)) || {};
2323
- f.identityProperties = Object.assign(f.identityProperties || {}, y), f.signingProperties = Object.assign(f.signingProperties || {}, g), u.selectedHttpAuthScheme = {
2324
- httpAuthOption: f,
2325
- identity: await p(f.identityProperties),
2326
- signer: h.signer
2327
- };
2328
- break;
2329
- }
2330
- if (!u.selectedHttpAuthScheme)
2331
- throw new Error(d.join(`
2332
- `));
2333
- return s(n);
2334
- }, Rn = {
2335
- step: "serialize",
2336
- tags: ["HTTP_AUTH_SCHEME"],
2337
- name: "httpAuthSchemeMiddleware",
2338
- override: !0,
2339
- relation: "before",
2340
- toMiddleware: "endpointV2Middleware"
2341
- }, Ro = (t, { httpAuthSchemeParametersProvider: e, identityProviderConfigProvider: s }) => ({
2342
- applyToStack: (r) => {
2343
- r.addRelativeTo(Tn(t, {
2344
- httpAuthSchemeParametersProvider: e,
2345
- identityProviderConfigProvider: s
2346
- }), Rn);
2347
- }
2348
- }), An = (t) => (e) => {
2349
- throw e;
2350
- }, vn = (t, e) => {
2351
- }, Cn = (t) => (e, s) => async (r) => {
2352
- if (!C.isInstance(r.request))
2353
- return e(r);
2354
- const i = ie(s).selectedHttpAuthScheme;
2355
- if (!i)
2356
- throw new Error("No HttpAuthScheme was selected: unable to sign request");
2357
- const { httpAuthOption: { signingProperties: o = {} }, identity: a, signer: c } = i, u = await e({
2358
- ...r,
2359
- request: await c.sign(r.request, a, o)
2360
- }).catch((c.errorHandler || An)(o));
2361
- return (c.successHandler || vn)(u.response, o), u;
2362
- }, xn = {
2363
- step: "finalizeRequest",
2364
- tags: ["HTTP_SIGNING"],
2365
- name: "httpSigningMiddleware",
2366
- aliases: ["apiKeyMiddleware", "tokenMiddleware", "awsAuthMiddleware"],
2367
- override: !0,
2368
- relation: "after",
2369
- toMiddleware: "retryMiddleware"
2370
- }, Ao = (t) => ({
2371
- applyToStack: (e) => {
2372
- e.addRelativeTo(Cn(), xn);
2373
- }
2374
- }), K = (t) => {
2375
- if (typeof t == "function")
2376
- return t;
2377
- const e = Promise.resolve(t);
2378
- return () => e;
2379
- };
2380
- class vo {
2381
- constructor(e) {
2382
- m(this, "authSchemes", /* @__PURE__ */ new Map());
2383
- for (const s in e) {
2384
- const r = e[s];
2385
- r !== void 0 && this.authSchemes.set(s, r);
2386
- }
2387
- }
2388
- getIdentityProvider(e) {
2389
- return this.authSchemes.get(e);
2390
- }
2391
- }
2392
- const In = (t) => function(s) {
2393
- return Kt(s) && s.expiration.getTime() - Date.now() < t;
2394
- }, Mn = 3e5, $n = In(Mn), Kt = (t) => t.expiration !== void 0, kn = (t, e, s) => {
2395
- if (t === void 0)
2396
- return;
2397
- const r = typeof t != "function" ? async () => Promise.resolve(t) : t;
2398
- let n, i, o, a = !1;
2399
- const c = async (u) => {
2400
- i || (i = r(u));
2401
- try {
2402
- n = await i, o = !0, a = !1;
2403
- } finally {
2404
- i = void 0;
2405
- }
2406
- return n;
2407
- };
2408
- return e === void 0 ? async (u) => ((!o || u != null && u.forceRefresh) && (n = await c(u)), n) : async (u) => ((!o || u != null && u.forceRefresh) && (n = await c(u)), a ? n : s(n) ? (e(n) && await c(u), n) : (a = !0, n));
2409
- }, On = void 0;
2410
- function Nn(t) {
2411
- return t === void 0 ? !0 : typeof t == "string" && t.length <= 50;
2412
- }
2413
- function Co(t) {
2414
- const e = K(t.userAgentAppId ?? On), { customUserAgent: s } = t;
2415
- return Object.assign(t, {
2416
- customUserAgent: typeof s == "string" ? [[s]] : s,
2417
- userAgentAppId: async () => {
2418
- var n, i;
2419
- const r = await e();
2420
- if (!Nn(r)) {
2421
- const o = ((i = (n = t.logger) == null ? void 0 : n.constructor) == null ? void 0 : i.name) === "NoOpLogger" || !t.logger ? console : t.logger;
2422
- typeof r != "string" ? o == null || o.warn("userAgentAppId must be a string or undefined.") : r.length > 50 && (o == null || o.warn("The provided userAgentAppId exceeds the maximum length of 50 characters."));
2423
- }
2424
- return r;
2425
- }
2426
- });
2427
- }
2428
- const _n = {
2429
- partitions: [
2430
- {
2431
- id: "aws",
2432
- outputs: {
2433
- dnsSuffix: "amazonaws.com",
2434
- dualStackDnsSuffix: "api.aws",
2435
- implicitGlobalRegion: "us-east-1",
2436
- name: "aws",
2437
- supportsDualStack: !0,
2438
- supportsFIPS: !0
2439
- },
2440
- regionRegex: "^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",
2441
- regions: {
2442
- "af-south-1": {
2443
- description: "Africa (Cape Town)"
2444
- },
2445
- "ap-east-1": {
2446
- description: "Asia Pacific (Hong Kong)"
2447
- },
2448
- "ap-east-2": {
2449
- description: "Asia Pacific (Taipei)"
2450
- },
2451
- "ap-northeast-1": {
2452
- description: "Asia Pacific (Tokyo)"
2453
- },
2454
- "ap-northeast-2": {
2455
- description: "Asia Pacific (Seoul)"
2456
- },
2457
- "ap-northeast-3": {
2458
- description: "Asia Pacific (Osaka)"
2459
- },
2460
- "ap-south-1": {
2461
- description: "Asia Pacific (Mumbai)"
2462
- },
2463
- "ap-south-2": {
2464
- description: "Asia Pacific (Hyderabad)"
2465
- },
2466
- "ap-southeast-1": {
2467
- description: "Asia Pacific (Singapore)"
2468
- },
2469
- "ap-southeast-2": {
2470
- description: "Asia Pacific (Sydney)"
2471
- },
2472
- "ap-southeast-3": {
2473
- description: "Asia Pacific (Jakarta)"
2474
- },
2475
- "ap-southeast-4": {
2476
- description: "Asia Pacific (Melbourne)"
2477
- },
2478
- "ap-southeast-5": {
2479
- description: "Asia Pacific (Malaysia)"
2480
- },
2481
- "ap-southeast-6": {
2482
- description: "Asia Pacific (New Zealand)"
2483
- },
2484
- "ap-southeast-7": {
2485
- description: "Asia Pacific (Thailand)"
2486
- },
2487
- "aws-global": {
2488
- description: "aws global region"
2489
- },
2490
- "ca-central-1": {
2491
- description: "Canada (Central)"
2492
- },
2493
- "ca-west-1": {
2494
- description: "Canada West (Calgary)"
2495
- },
2496
- "eu-central-1": {
2497
- description: "Europe (Frankfurt)"
2498
- },
2499
- "eu-central-2": {
2500
- description: "Europe (Zurich)"
2501
- },
2502
- "eu-north-1": {
2503
- description: "Europe (Stockholm)"
2504
- },
2505
- "eu-south-1": {
2506
- description: "Europe (Milan)"
2507
- },
2508
- "eu-south-2": {
2509
- description: "Europe (Spain)"
2510
- },
2511
- "eu-west-1": {
2512
- description: "Europe (Ireland)"
2513
- },
2514
- "eu-west-2": {
2515
- description: "Europe (London)"
2516
- },
2517
- "eu-west-3": {
2518
- description: "Europe (Paris)"
2519
- },
2520
- "il-central-1": {
2521
- description: "Israel (Tel Aviv)"
2522
- },
2523
- "me-central-1": {
2524
- description: "Middle East (UAE)"
2525
- },
2526
- "me-south-1": {
2527
- description: "Middle East (Bahrain)"
2528
- },
2529
- "mx-central-1": {
2530
- description: "Mexico (Central)"
2531
- },
2532
- "sa-east-1": {
2533
- description: "South America (Sao Paulo)"
2534
- },
2535
- "us-east-1": {
2536
- description: "US East (N. Virginia)"
2537
- },
2538
- "us-east-2": {
2539
- description: "US East (Ohio)"
2540
- },
2541
- "us-west-1": {
2542
- description: "US West (N. California)"
2543
- },
2544
- "us-west-2": {
2545
- description: "US West (Oregon)"
2546
- }
2547
- }
2548
- },
2549
- {
2550
- id: "aws-cn",
2551
- outputs: {
2552
- dnsSuffix: "amazonaws.com.cn",
2553
- dualStackDnsSuffix: "api.amazonwebservices.com.cn",
2554
- implicitGlobalRegion: "cn-northwest-1",
2555
- name: "aws-cn",
2556
- supportsDualStack: !0,
2557
- supportsFIPS: !0
2558
- },
2559
- regionRegex: "^cn\\-\\w+\\-\\d+$",
2560
- regions: {
2561
- "aws-cn-global": {
2562
- description: "aws-cn global region"
2563
- },
2564
- "cn-north-1": {
2565
- description: "China (Beijing)"
2566
- },
2567
- "cn-northwest-1": {
2568
- description: "China (Ningxia)"
2569
- }
2570
- }
2571
- },
2572
- {
2573
- id: "aws-eusc",
2574
- outputs: {
2575
- dnsSuffix: "amazonaws.eu",
2576
- dualStackDnsSuffix: "api.amazonwebservices.eu",
2577
- implicitGlobalRegion: "eusc-de-east-1",
2578
- name: "aws-eusc",
2579
- supportsDualStack: !0,
2580
- supportsFIPS: !0
2581
- },
2582
- regionRegex: "^eusc\\-(de)\\-\\w+\\-\\d+$",
2583
- regions: {
2584
- "eusc-de-east-1": {
2585
- description: "AWS European Sovereign Cloud (Germany)"
2586
- }
2587
- }
2588
- },
2589
- {
2590
- id: "aws-iso",
2591
- outputs: {
2592
- dnsSuffix: "c2s.ic.gov",
2593
- dualStackDnsSuffix: "api.aws.ic.gov",
2594
- implicitGlobalRegion: "us-iso-east-1",
2595
- name: "aws-iso",
2596
- supportsDualStack: !0,
2597
- supportsFIPS: !0
2598
- },
2599
- regionRegex: "^us\\-iso\\-\\w+\\-\\d+$",
2600
- regions: {
2601
- "aws-iso-global": {
2602
- description: "aws-iso global region"
2603
- },
2604
- "us-iso-east-1": {
2605
- description: "US ISO East"
2606
- },
2607
- "us-iso-west-1": {
2608
- description: "US ISO WEST"
2609
- }
2610
- }
2611
- },
2612
- {
2613
- id: "aws-iso-b",
2614
- outputs: {
2615
- dnsSuffix: "sc2s.sgov.gov",
2616
- dualStackDnsSuffix: "api.aws.scloud",
2617
- implicitGlobalRegion: "us-isob-east-1",
2618
- name: "aws-iso-b",
2619
- supportsDualStack: !0,
2620
- supportsFIPS: !0
2621
- },
2622
- regionRegex: "^us\\-isob\\-\\w+\\-\\d+$",
2623
- regions: {
2624
- "aws-iso-b-global": {
2625
- description: "aws-iso-b global region"
2626
- },
2627
- "us-isob-east-1": {
2628
- description: "US ISOB East (Ohio)"
2629
- },
2630
- "us-isob-west-1": {
2631
- description: "US ISOB West"
2632
- }
2633
- }
2634
- },
2635
- {
2636
- id: "aws-iso-e",
2637
- outputs: {
2638
- dnsSuffix: "cloud.adc-e.uk",
2639
- dualStackDnsSuffix: "api.cloud-aws.adc-e.uk",
2640
- implicitGlobalRegion: "eu-isoe-west-1",
2641
- name: "aws-iso-e",
2642
- supportsDualStack: !0,
2643
- supportsFIPS: !0
2644
- },
2645
- regionRegex: "^eu\\-isoe\\-\\w+\\-\\d+$",
2646
- regions: {
2647
- "aws-iso-e-global": {
2648
- description: "aws-iso-e global region"
2649
- },
2650
- "eu-isoe-west-1": {
2651
- description: "EU ISOE West"
2652
- }
2653
- }
2654
- },
2655
- {
2656
- id: "aws-iso-f",
2657
- outputs: {
2658
- dnsSuffix: "csp.hci.ic.gov",
2659
- dualStackDnsSuffix: "api.aws.hci.ic.gov",
2660
- implicitGlobalRegion: "us-isof-south-1",
2661
- name: "aws-iso-f",
2662
- supportsDualStack: !0,
2663
- supportsFIPS: !0
2664
- },
2665
- regionRegex: "^us\\-isof\\-\\w+\\-\\d+$",
2666
- regions: {
2667
- "aws-iso-f-global": {
2668
- description: "aws-iso-f global region"
2669
- },
2670
- "us-isof-east-1": {
2671
- description: "US ISOF EAST"
2672
- },
2673
- "us-isof-south-1": {
2674
- description: "US ISOF SOUTH"
2675
- }
2676
- }
2677
- },
2678
- {
2679
- id: "aws-us-gov",
2680
- outputs: {
2681
- dnsSuffix: "amazonaws.com",
2682
- dualStackDnsSuffix: "api.aws",
2683
- implicitGlobalRegion: "us-gov-west-1",
2684
- name: "aws-us-gov",
2685
- supportsDualStack: !0,
2686
- supportsFIPS: !0
2687
- },
2688
- regionRegex: "^us\\-gov\\-\\w+\\-\\d+$",
2689
- regions: {
2690
- "aws-us-gov-global": {
2691
- description: "aws-us-gov global region"
2692
- },
2693
- "us-gov-east-1": {
2694
- description: "AWS GovCloud (US-East)"
2695
- },
2696
- "us-gov-west-1": {
2697
- description: "AWS GovCloud (US-West)"
2698
- }
2699
- }
2700
- }
2701
- ]
2702
- };
2703
- let Pn = _n;
2704
- const Dn = (t) => {
2705
- const { partitions: e } = Pn;
2706
- for (const r of e) {
2707
- const { regions: n, outputs: i } = r;
2708
- for (const [o, a] of Object.entries(n))
2709
- if (o === t)
2710
- return {
2711
- ...i,
2712
- ...a
2713
- };
2714
- }
2715
- for (const r of e) {
2716
- const { regionRegex: n, outputs: i } = r;
2717
- if (new RegExp(n).test(t))
2718
- return {
2719
- ...i
2720
- };
2721
- }
2722
- const s = e.find((r) => r.id === "aws");
2723
- if (!s)
2724
- throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");
2725
- return {
2726
- ...s.outputs
2727
- };
2728
- }, Un = /\d{12}\.ddb/;
2729
- async function Ln(t, e, s) {
2730
- var i, o, a, c, u;
2731
- const r = s.request;
2732
- if (((i = r == null ? void 0 : r.headers) == null ? void 0 : i["smithy-protocol"]) === "rpc-v2-cbor" && $(t, "PROTOCOL_RPC_V2_CBOR", "M"), typeof e.retryStrategy == "function") {
2733
- const d = await e.retryStrategy();
2734
- if (typeof d.mode == "string")
2735
- switch (d.mode) {
2736
- case D.ADAPTIVE:
2737
- $(t, "RETRY_MODE_ADAPTIVE", "F");
2738
- break;
2739
- case D.STANDARD:
2740
- $(t, "RETRY_MODE_STANDARD", "E");
2741
- break;
2742
- }
2743
- }
2744
- if (typeof e.accountIdEndpointMode == "function") {
2745
- const d = t.endpointV2;
2746
- switch (String((o = d == null ? void 0 : d.url) == null ? void 0 : o.hostname).match(Un) && $(t, "ACCOUNT_ID_ENDPOINT", "O"), await ((a = e.accountIdEndpointMode) == null ? void 0 : a.call(e))) {
2747
- case "disabled":
2748
- $(t, "ACCOUNT_ID_MODE_DISABLED", "Q");
2749
- break;
2750
- case "preferred":
2751
- $(t, "ACCOUNT_ID_MODE_PREFERRED", "P");
2752
- break;
2753
- case "required":
2754
- $(t, "ACCOUNT_ID_MODE_REQUIRED", "R");
2755
- break;
2756
- }
2757
- }
2758
- const n = (u = (c = t.__smithy_context) == null ? void 0 : c.selectedHttpAuthScheme) == null ? void 0 : u.identity;
2759
- if (n != null && n.$source) {
2760
- const d = n;
2761
- d.accountId && $(t, "RESOLVED_ACCOUNT_ID", "T");
2762
- for (const [l, f] of Object.entries(d.$source ?? {}))
2763
- $(t, l, f);
2764
- }
2765
- }
2766
- const dt = "user-agent", Oe = "x-amz-user-agent", ft = " ", Ne = "/", Hn = /[^!$%&'*+\-.^_`|~\w]/g, Fn = /[^!$%&'*+\-.^_`|~\w#]/g, lt = "-", Bn = 1024;
2767
- function zn(t) {
2768
- let e = "";
2769
- for (const s in t) {
2770
- const r = t[s];
2771
- if (e.length + r.length + 1 <= Bn) {
2772
- e.length ? e += "," + r : e += r;
2773
- continue;
2774
- }
2775
- break;
2776
- }
2777
- return e;
2778
- }
2779
- const jn = (t) => (e, s) => async (r) => {
2780
- var h, p, y, g;
2781
- const { request: n } = r;
2782
- if (!C.isInstance(n))
2783
- return e(r);
2784
- const { headers: i } = n, o = ((h = s == null ? void 0 : s.userAgent) == null ? void 0 : h.map(ae)) || [], a = (await t.defaultUserAgentProvider()).map(ae);
2785
- await Ln(s, t, r);
2786
- const c = s;
2787
- a.push(`m/${zn(Object.assign({}, (p = s.__smithy_context) == null ? void 0 : p.features, (y = c.__aws_sdk_context) == null ? void 0 : y.features))}`);
2788
- const u = ((g = t == null ? void 0 : t.customUserAgent) == null ? void 0 : g.map(ae)) || [], d = await t.userAgentAppId();
2789
- d && a.push(ae(["app", `${d}`]));
2790
- const l = [].concat([...a, ...o, ...u]).join(ft), f = [
2791
- ...a.filter((w) => w.startsWith("aws-sdk-")),
2792
- ...u
2793
- ].join(ft);
2794
- return t.runtime !== "browser" ? (f && (i[Oe] = i[Oe] ? `${i[dt]} ${f}` : f), i[dt] = l) : i[Oe] = l, e({
2795
- ...r,
2796
- request: n
2797
- });
2798
- }, ae = (t) => {
2799
- var o;
2800
- const e = t[0].split(Ne).map((a) => a.replace(Hn, lt)).join(Ne), s = (o = t[1]) == null ? void 0 : o.replace(Fn, lt), r = e.indexOf(Ne), n = e.substring(0, r);
2801
- let i = e.substring(r + 1);
2802
- return n === "api" && (i = i.toLowerCase()), [n, i, s].filter((a) => a && a.length > 0).reduce((a, c, u) => {
2803
- switch (u) {
2804
- case 0:
2805
- return c;
2806
- case 1:
2807
- return `${a}/${c}`;
2808
- default:
2809
- return `${a}#${c}`;
2810
- }
2811
- }, "");
2812
- }, qn = {
2813
- name: "getUserAgentMiddleware",
2814
- step: "build",
2815
- priority: "low",
2816
- tags: ["SET_USER_AGENT", "USER_AGENT"],
2817
- override: !0
2818
- }, xo = (t) => ({
2819
- applyToStack: (e) => {
2820
- e.add(jn(t), qn);
2821
- }
2822
- }), Io = ({ serviceId: t, clientVersion: e }) => async (s) => {
2823
- var h, p, y;
2824
- const r = typeof window < "u" ? window.navigator : void 0, n = (r == null ? void 0 : r.userAgent) ?? "", i = ((h = r == null ? void 0 : r.userAgentData) == null ? void 0 : h.platform) ?? ht.os(n) ?? "other", o = void 0, a = ((p = r == null ? void 0 : r.userAgentData) == null ? void 0 : p.brands) ?? [], c = a[a.length - 1], u = (c == null ? void 0 : c.brand) ?? ht.browser(n) ?? "unknown", d = (c == null ? void 0 : c.version) ?? "unknown", l = [
2825
- ["aws-sdk-js", e],
2826
- ["ua", "2.1"],
2827
- [`os/${i}`, o],
2828
- ["lang/js"],
2829
- ["md/browser", `${u}_${d}`]
2830
- ];
2831
- t && l.push([`api/${t}`, e]);
2832
- const f = await ((y = s == null ? void 0 : s.userAgentAppId) == null ? void 0 : y.call(s));
2833
- return f && l.push([`app/${f}`]), l;
2834
- }, ht = {
2835
- os(t) {
2836
- if (/iPhone|iPad|iPod/.test(t))
2837
- return "iOS";
2838
- if (/Macintosh|Mac OS X/.test(t))
2839
- return "macOS";
2840
- if (/Windows NT/.test(t))
2841
- return "Windows";
2842
- if (/Android/.test(t))
2843
- return "Android";
2844
- if (/Linux/.test(t))
2845
- return "Linux";
2846
- },
2847
- browser(t) {
2848
- if (/EdgiOS|EdgA|Edg\//.test(t))
2849
- return "Microsoft Edge";
2850
- if (/Firefox\//.test(t))
2851
- return "Firefox";
2852
- if (/Chrome\//.test(t))
2853
- return "Chrome";
2854
- if (/Safari\//.test(t))
2855
- return "Safari";
2856
- }
2857
- }, Qt = (t, e = !1) => {
2858
- if (e) {
2859
- for (const s of t.split("."))
2860
- if (!Qt(s))
2861
- return !1;
2862
- return !0;
2863
- }
2864
- return !(!we(t) || t.length < 3 || t.length > 63 || t !== t.toLowerCase() || Ft(t));
2865
- }, mt = ":", Gn = "/", Wn = (t) => {
2866
- const e = t.split(mt);
2867
- if (e.length < 6)
2868
- return null;
2869
- const [s, r, n, i, o, ...a] = e;
2870
- if (s !== "arn" || r === "" || n === "" || a.join(mt) === "")
2871
- return null;
2872
- const c = a.map((u) => u.split(Gn)).flat();
2873
- return {
2874
- partition: r,
2875
- service: n,
2876
- region: i,
2877
- accountId: o,
2878
- resourceId: c
2879
- };
2880
- }, Vn = {
2881
- isVirtualHostableS3Bucket: Qt,
2882
- parseArn: Wn,
2883
- partition: Dn
2884
- };
2885
- Lt.aws = Vn;
2886
- const Xn = (t, e, s) => {
2887
- let r, n, i, o = !1;
2888
- const a = async () => {
2889
- n || (n = t());
2890
- try {
2891
- r = await n, i = !0, o = !1;
2892
- } finally {
2893
- n = void 0;
2894
- }
2895
- return r;
2896
- };
2897
- return async (c) => ((!i || c != null && c.forceRefresh) && (r = await a()), r);
2898
- }, pt = /* @__PURE__ */ new Set(), Jn = (t, e = we) => {
2899
- if (!pt.has(t) && !e(t))
2900
- if (t === "*")
2901
- console.warn('@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.');
2902
- else
2903
- throw new Error(`Region not accepted: region="${t}" is not a valid hostname component.`);
2904
- else
2905
- pt.add(t);
2906
- }, Yt = (t) => typeof t == "string" && (t.startsWith("fips-") || t.endsWith("-fips")), Kn = (t) => Yt(t) ? ["fips-aws-global", "aws-fips"].includes(t) ? "us-east-1" : t.replace(/fips-(dkr-|prod-)?|-fips/, "") : t, Mo = (t) => {
2907
- const { region: e, useFipsEndpoint: s } = t;
2908
- if (!e)
2909
- throw new Error("Region is missing");
2910
- return Object.assign(t, {
2911
- region: async () => {
2912
- const r = typeof e == "function" ? await e() : e, n = Kn(r);
2913
- return Jn(n), n;
2914
- },
2915
- useFipsEndpoint: async () => {
2916
- const r = typeof e == "string" ? e : await e();
2917
- return Yt(r) ? !0 : typeof s != "function" ? Promise.resolve(!!s) : s();
2918
- }
2919
- });
2920
- }, Qn = ["in-region", "cross-region", "mobile", "standard", "legacy"], $o = ({ defaultsMode: t } = {}) => Xn(async () => {
2921
- const e = typeof t == "function" ? await t() : t;
2922
- switch (e == null ? void 0 : e.toLowerCase()) {
2923
- case "auto":
2924
- return Promise.resolve(Yn() ? "mobile" : "standard");
2925
- case "mobile":
2926
- case "in-region":
2927
- case "cross-region":
2928
- case "standard":
2929
- case "legacy":
2930
- return Promise.resolve(e == null ? void 0 : e.toLocaleLowerCase());
2931
- case void 0:
2932
- return Promise.resolve("legacy");
2933
- default:
2934
- throw new Error(`Invalid parameter for "defaultsMode", expect ${Qn.join(", ")}, got ${e}`);
2935
- }
2936
- }), Yn = () => {
2937
- var e;
2938
- const t = window == null ? void 0 : window.navigator;
2939
- if (t != null && t.connection) {
2940
- const { effectiveType: s, rtt: r, downlink: n } = t == null ? void 0 : t.connection;
2941
- if (typeof s == "string" && s !== "4g" || Number(r) > 100 || Number(n) < 10)
2942
- return !0;
2943
- }
2944
- return ((e = t == null ? void 0 : t.userAgentData) == null ? void 0 : e.mobile) || typeof (t == null ? void 0 : t.maxTouchPoints) == "number" && (t == null ? void 0 : t.maxTouchPoints) > 1;
2945
- }, ko = !1, Oo = !1, No = (t) => ({
2946
- setRegion(e) {
2947
- t.region = e;
2948
- },
2949
- region() {
2950
- return t.region;
2951
- }
2952
- }), _o = (t) => ({
2953
- region: t.region()
2954
- }), Zn = (t) => new TextEncoder().encode(t);
2955
- var ei = typeof Buffer < "u" && Buffer.from ? function(t) {
2956
- return Buffer.from(t, "utf8");
2957
- } : Zn;
2958
- function ne(t) {
2959
- return t instanceof Uint8Array ? t : typeof t == "string" ? ei(t) : ArrayBuffer.isView(t) ? new Uint8Array(t.buffer, t.byteOffset, t.byteLength / Uint8Array.BYTES_PER_ELEMENT) : new Uint8Array(t);
2960
- }
2961
- function We(t) {
2962
- return typeof t == "string" ? t.length === 0 : t.byteLength === 0;
2963
- }
2964
- class ti {
2965
- format(e) {
2966
- const s = [];
2967
- for (const i of Object.keys(e)) {
2968
- const o = te(i);
2969
- s.push(Uint8Array.from([o.byteLength]), o, this.formatHeaderValue(e[i]));
2970
- }
2971
- const r = new Uint8Array(s.reduce((i, o) => i + o.byteLength, 0));
2972
- let n = 0;
2973
- for (const i of s)
2974
- r.set(i, n), n += i.byteLength;
2975
- return r;
2976
- }
2977
- formatHeaderValue(e) {
2978
- switch (e.type) {
2979
- case "boolean":
2980
- return Uint8Array.from([e.value ? 0 : 1]);
2981
- case "byte":
2982
- return Uint8Array.from([2, e.value]);
2983
- case "short":
2984
- const s = new DataView(new ArrayBuffer(3));
2985
- return s.setUint8(0, 3), s.setInt16(1, e.value, !1), new Uint8Array(s.buffer);
2986
- case "integer":
2987
- const r = new DataView(new ArrayBuffer(5));
2988
- return r.setUint8(0, 4), r.setInt32(1, e.value, !1), new Uint8Array(r.buffer);
2989
- case "long":
2990
- const n = new Uint8Array(9);
2991
- return n[0] = 5, n.set(e.value.bytes, 1), n;
2992
- case "binary":
2993
- const i = new DataView(new ArrayBuffer(3 + e.value.byteLength));
2994
- i.setUint8(0, 6), i.setUint16(1, e.value.byteLength, !1);
2995
- const o = new Uint8Array(i.buffer);
2996
- return o.set(e.value, 3), o;
2997
- case "string":
2998
- const a = te(e.value), c = new DataView(new ArrayBuffer(3 + a.byteLength));
2999
- c.setUint8(0, 7), c.setUint16(1, a.byteLength, !1);
3000
- const u = new Uint8Array(c.buffer);
3001
- return u.set(a, 3), u;
3002
- case "timestamp":
3003
- const d = new Uint8Array(9);
3004
- return d[0] = 8, d.set(Qe.fromNumber(e.value.valueOf()).bytes, 1), d;
3005
- case "uuid":
3006
- if (!si.test(e.value))
3007
- throw new Error(`Invalid UUID received: ${e.value}`);
3008
- const l = new Uint8Array(17);
3009
- return l[0] = 9, l.set(nr(e.value.replace(/\-/g, "")), 1), l;
3010
- }
3011
- }
3012
- }
3013
- var gt;
3014
- (function(t) {
3015
- t[t.boolTrue = 0] = "boolTrue", t[t.boolFalse = 1] = "boolFalse", t[t.byte = 2] = "byte", t[t.short = 3] = "short", t[t.integer = 4] = "integer", t[t.long = 5] = "long", t[t.byteArray = 6] = "byteArray", t[t.string = 7] = "string", t[t.timestamp = 8] = "timestamp", t[t.uuid = 9] = "uuid";
3016
- })(gt || (gt = {}));
3017
- const si = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
3018
- class Qe {
3019
- constructor(e) {
3020
- m(this, "bytes");
3021
- if (this.bytes = e, e.byteLength !== 8)
3022
- throw new Error("Int64 buffers must be exactly 8 bytes");
3023
- }
3024
- static fromNumber(e) {
3025
- if (e > 9223372036854776e3 || e < -9223372036854776e3)
3026
- throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);
3027
- const s = new Uint8Array(8);
3028
- for (let r = 7, n = Math.abs(Math.round(e)); r > -1 && n > 0; r--, n /= 256)
3029
- s[r] = n;
3030
- return e < 0 && yt(s), new Qe(s);
3031
- }
3032
- valueOf() {
3033
- const e = this.bytes.slice(0), s = e[0] & 128;
3034
- return s && yt(e), parseInt(H(e), 16) * (s ? -1 : 1);
3035
- }
3036
- toString() {
3037
- return String(this.valueOf());
3038
- }
3039
- }
3040
- function yt(t) {
3041
- for (let e = 0; e < 8; e++)
3042
- t[e] ^= 255;
3043
- for (let e = 7; e > -1 && (t[e]++, t[e] === 0); e--)
3044
- ;
3045
- }
3046
- const ri = "X-Amz-Algorithm", ni = "X-Amz-Credential", Zt = "X-Amz-Date", ii = "X-Amz-SignedHeaders", oi = "X-Amz-Expires", es = "X-Amz-Signature", ts = "X-Amz-Security-Token", ss = "authorization", rs = Zt.toLowerCase(), ai = "date", ci = [ss, rs, ai], ui = es.toLowerCase(), Ve = "x-amz-content-sha256", di = ts.toLowerCase(), fi = {
3047
- authorization: !0,
3048
- "cache-control": !0,
3049
- connection: !0,
3050
- expect: !0,
3051
- from: !0,
3052
- "keep-alive": !0,
3053
- "max-forwards": !0,
3054
- pragma: !0,
3055
- referer: !0,
3056
- te: !0,
3057
- trailer: !0,
3058
- "transfer-encoding": !0,
3059
- upgrade: !0,
3060
- "user-agent": !0,
3061
- "x-amzn-trace-id": !0
3062
- }, li = /^proxy-/, hi = /^sec-/, _e = "AWS4-HMAC-SHA256", mi = "AWS4-HMAC-SHA256-PAYLOAD", pi = "UNSIGNED-PAYLOAD", gi = 50, ns = "aws4_request", yi = 60 * 60 * 24 * 7, wi = ({ query: t = {} }) => {
3063
- const e = [], s = {};
3064
- for (const r of Object.keys(t)) {
3065
- if (r.toLowerCase() === ui)
3066
- continue;
3067
- const n = F(r);
3068
- e.push(n);
3069
- const i = t[r];
3070
- typeof i == "string" ? s[n] = `${n}=${F(i)}` : Array.isArray(i) && (s[n] = i.slice(0).reduce((o, a) => o.concat([`${n}=${F(a)}`]), []).sort().join("&"));
3071
- }
3072
- return e.sort().map((r) => s[r]).filter((r) => r).join("&");
3073
- }, Si = (t) => bi(t).toISOString().replace(/\.\d{3}Z$/, "Z"), bi = (t) => typeof t == "number" ? new Date(t * 1e3) : typeof t == "string" ? Number(t) ? new Date(Number(t) * 1e3) : new Date(t) : t;
3074
- class Ei {
3075
- constructor({ applyChecksum: e, credentials: s, region: r, service: n, sha256: i, uriEscapePath: o = !0 }) {
3076
- m(this, "service");
3077
- m(this, "regionProvider");
3078
- m(this, "credentialProvider");
3079
- m(this, "sha256");
3080
- m(this, "uriEscapePath");
3081
- m(this, "applyChecksum");
3082
- this.service = n, this.sha256 = i, this.uriEscapePath = o, this.applyChecksum = typeof e == "boolean" ? e : !0, this.regionProvider = L(r), this.credentialProvider = L(s);
3083
- }
3084
- createCanonicalRequest(e, s, r) {
3085
- const n = Object.keys(s).sort();
3086
- return `${e.method}
3087
- ${this.getCanonicalPath(e)}
3088
- ${wi(e)}
3089
- ${n.map((i) => `${i}:${s[i]}`).join(`
3090
- `)}
3091
-
3092
- ${n.join(";")}
3093
- ${r}`;
3094
- }
3095
- async createStringToSign(e, s, r, n) {
3096
- const i = new this.sha256();
3097
- i.update(re(r));
3098
- const o = await i.digest();
3099
- return `${n}
3100
- ${e}
3101
- ${s}
3102
- ${H(o)}`;
3103
- }
3104
- getCanonicalPath({ path: e }) {
3105
- if (this.uriEscapePath) {
3106
- const s = [];
3107
- for (const i of e.split("/"))
3108
- (i == null ? void 0 : i.length) !== 0 && i !== "." && (i === ".." ? s.pop() : s.push(i));
3109
- const r = `${e != null && e.startsWith("/") ? "/" : ""}${s.join("/")}${s.length > 0 && (e != null && e.endsWith("/")) ? "/" : ""}`;
3110
- return F(r).replace(/%2F/g, "/");
3111
- }
3112
- return e;
3113
- }
3114
- validateResolvedCredentials(e) {
3115
- if (typeof e != "object" || typeof e.accessKeyId != "string" || typeof e.secretAccessKey != "string")
3116
- throw new Error("Resolved credential object is not valid");
3117
- }
3118
- formatDate(e) {
3119
- const s = Si(e).replace(/[\-:]/g, "");
3120
- return {
3121
- longDate: s,
3122
- shortDate: s.slice(0, 8)
3123
- };
3124
- }
3125
- getCanonicalHeaderList(e) {
3126
- return Object.keys(e).sort().join(";");
3127
- }
3128
- }
3129
- const ce = {}, Pe = [], De = (t, e, s) => `${t}/${e}/${s}/${ns}`, Ti = async (t, e, s, r, n) => {
3130
- const i = await wt(t, e.secretAccessKey, e.accessKeyId), o = `${s}:${r}:${n}:${H(i)}:${e.sessionToken}`;
3131
- if (o in ce)
3132
- return ce[o];
3133
- for (Pe.push(o); Pe.length > gi; )
3134
- delete ce[Pe.shift()];
3135
- let a = `AWS4${e.secretAccessKey}`;
3136
- for (const c of [s, r, n, ns])
3137
- a = await wt(t, a, c);
3138
- return ce[o] = a;
3139
- }, wt = (t, e, s) => {
3140
- const r = new t(e);
3141
- return r.update(re(s)), r.digest();
3142
- }, St = ({ headers: t }, e, s) => {
3143
- const r = {};
3144
- for (const n of Object.keys(t).sort()) {
3145
- if (t[n] == null)
3146
- continue;
3147
- const i = n.toLowerCase();
3148
- (i in fi || e != null && e.has(i) || li.test(i) || hi.test(i)) && (!s || s && !s.has(i)) || (r[i] = t[n].trim().replace(/\s+/g, " "));
3149
- }
3150
- return r;
3151
- }, Ue = async ({ headers: t, body: e }, s) => {
3152
- for (const r of Object.keys(t))
3153
- if (r.toLowerCase() === Ve)
3154
- return t[r];
3155
- if (e == null)
3156
- return "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
3157
- if (typeof e == "string" || ArrayBuffer.isView(e) || ir(e)) {
3158
- const r = new s();
3159
- return r.update(re(e)), H(await r.digest());
3160
- }
3161
- return pi;
3162
- }, Ri = (t, e) => {
3163
- t = t.toLowerCase();
3164
- for (const s of Object.keys(e))
3165
- if (t === s.toLowerCase())
3166
- return !0;
3167
- return !1;
3168
- }, Ai = (t, e = {}) => {
3169
- var n, i;
3170
- const { headers: s, query: r = {} } = C.clone(t);
3171
- for (const o of Object.keys(s)) {
3172
- const a = o.toLowerCase();
3173
- (a.slice(0, 6) === "x-amz-" && !((n = e.unhoistableHeaders) != null && n.has(a)) || (i = e.hoistableHeaders) != null && i.has(a)) && (r[o] = s[o], delete s[o]);
3174
- }
3175
- return {
3176
- ...t,
3177
- headers: s,
3178
- query: r
3179
- };
3180
- }, bt = (t) => {
3181
- t = C.clone(t);
3182
- for (const e of Object.keys(t.headers))
3183
- ci.indexOf(e.toLowerCase()) > -1 && delete t.headers[e];
3184
- return t;
3185
- };
3186
- class Et extends Ei {
3187
- constructor({ applyChecksum: s, credentials: r, region: n, service: i, sha256: o, uriEscapePath: a = !0 }) {
3188
- super({
3189
- applyChecksum: s,
3190
- credentials: r,
3191
- region: n,
3192
- service: i,
3193
- sha256: o,
3194
- uriEscapePath: a
3195
- });
3196
- m(this, "headerFormatter", new ti());
3197
- }
3198
- async presign(s, r = {}) {
3199
- const { signingDate: n = /* @__PURE__ */ new Date(), expiresIn: i = 3600, unsignableHeaders: o, unhoistableHeaders: a, signableHeaders: c, hoistableHeaders: u, signingRegion: d, signingService: l } = r, f = await this.credentialProvider();
3200
- this.validateResolvedCredentials(f);
3201
- const h = d ?? await this.regionProvider(), { longDate: p, shortDate: y } = this.formatDate(n);
3202
- if (i > yi)
3203
- return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");
3204
- const g = De(y, h, l ?? this.service), w = Ai(bt(s), { unhoistableHeaders: a, hoistableHeaders: u });
3205
- f.sessionToken && (w.query[ts] = f.sessionToken), w.query[ri] = _e, w.query[ni] = `${f.accessKeyId}/${g}`, w.query[Zt] = p, w.query[oi] = i.toString(10);
3206
- const S = St(w, o, c);
3207
- return w.query[ii] = this.getCanonicalHeaderList(S), w.query[es] = await this.getSignature(p, g, this.getSigningKey(f, h, y, l), this.createCanonicalRequest(w, S, await Ue(s, this.sha256))), w;
3208
- }
3209
- async sign(s, r) {
3210
- return typeof s == "string" ? this.signString(s, r) : s.headers && s.payload ? this.signEvent(s, r) : s.message ? this.signMessage(s, r) : this.signRequest(s, r);
3211
- }
3212
- async signEvent({ headers: s, payload: r }, { signingDate: n = /* @__PURE__ */ new Date(), priorSignature: i, signingRegion: o, signingService: a, eventStreamCredentials: c }) {
3213
- const u = o ?? await this.regionProvider(), { shortDate: d, longDate: l } = this.formatDate(n), f = De(d, u, a ?? this.service), h = await Ue({ headers: {}, body: r }, this.sha256), p = new this.sha256();
3214
- p.update(s);
3215
- const y = H(await p.digest()), g = [
3216
- mi,
3217
- l,
3218
- f,
3219
- i,
3220
- y,
3221
- h
3222
- ].join(`
3223
- `);
3224
- return this.signString(g, {
3225
- signingDate: n,
3226
- signingRegion: u,
3227
- signingService: a,
3228
- eventStreamCredentials: c
3229
- });
3230
- }
3231
- async signMessage(s, { signingDate: r = /* @__PURE__ */ new Date(), signingRegion: n, signingService: i, eventStreamCredentials: o }) {
3232
- return this.signEvent({
3233
- headers: this.headerFormatter.format(s.message.headers),
3234
- payload: s.message.body
3235
- }, {
3236
- signingDate: r,
3237
- signingRegion: n,
3238
- signingService: i,
3239
- priorSignature: s.priorSignature,
3240
- eventStreamCredentials: o
3241
- }).then((c) => ({ message: s.message, signature: c }));
3242
- }
3243
- async signString(s, { signingDate: r = /* @__PURE__ */ new Date(), signingRegion: n, signingService: i, eventStreamCredentials: o } = {}) {
3244
- const a = o ?? await this.credentialProvider();
3245
- this.validateResolvedCredentials(a);
3246
- const c = n ?? await this.regionProvider(), { shortDate: u } = this.formatDate(r), d = new this.sha256(await this.getSigningKey(a, c, u, i));
3247
- return d.update(re(s)), H(await d.digest());
3248
- }
3249
- async signRequest(s, { signingDate: r = /* @__PURE__ */ new Date(), signableHeaders: n, unsignableHeaders: i, signingRegion: o, signingService: a } = {}) {
3250
- const c = await this.credentialProvider();
3251
- this.validateResolvedCredentials(c);
3252
- const u = o ?? await this.regionProvider(), d = bt(s), { longDate: l, shortDate: f } = this.formatDate(r), h = De(f, u, a ?? this.service);
3253
- d.headers[rs] = l, c.sessionToken && (d.headers[di] = c.sessionToken);
3254
- const p = await Ue(d, this.sha256);
3255
- !Ri(Ve, d.headers) && this.applyChecksum && (d.headers[Ve] = p);
3256
- const y = St(d, i, n), g = await this.getSignature(l, h, this.getSigningKey(c, u, f, a), this.createCanonicalRequest(d, y, p));
3257
- return d.headers[ss] = `${_e} Credential=${c.accessKeyId}/${h}, SignedHeaders=${this.getCanonicalHeaderList(y)}, Signature=${g}`, d;
3258
- }
3259
- async getSignature(s, r, n, i) {
3260
- const o = await this.createStringToSign(s, r, i, _e), a = new this.sha256(await n);
3261
- return a.update(re(o)), H(await a.digest());
3262
- }
3263
- getSigningKey(s, r, n, i) {
3264
- return Ti(this.sha256, s, n, r, i || this.service);
3265
- }
3266
- }
3267
- class Po {
3268
- constructor(e = !1) {
3269
- m(this, "queryCompat");
3270
- m(this, "errorRegistry");
3271
- this.queryCompat = e;
3272
- }
3273
- resolveRestContentType(e, s) {
3274
- const r = s.getMemberSchemas(), n = Object.values(r).find((i) => !!i.getMergedTraits().httpPayload);
3275
- if (n) {
3276
- const i = n.getMergedTraits().mediaType;
3277
- return i || (n.isStringSchema() ? "text/plain" : n.isBlobSchema() ? "application/octet-stream" : e);
3278
- } else if (!s.isUnitSchema() && Object.values(r).find((o) => {
3279
- const { httpQuery: a, httpQueryParams: c, httpHeader: u, httpLabel: d, httpPrefixHeaders: l } = o.getMergedTraits();
3280
- return !a && !c && !u && !d && l === void 0;
3281
- }))
3282
- return e;
3283
- }
3284
- async getErrorSchemaOrThrowBaseException(e, s, r, n, i, o) {
3285
- var u, d;
3286
- let a = e;
3287
- e.includes("#") && ([, a] = e.split("#"));
3288
- const c = {
3289
- $metadata: i,
3290
- $fault: r.statusCode < 500 ? "client" : "server"
3291
- };
3292
- if (!this.errorRegistry)
3293
- throw new Error("@aws-sdk/core/protocols - error handler not initialized.");
3294
- try {
3295
- return { errorSchema: (o == null ? void 0 : o(this.errorRegistry, a)) ?? this.errorRegistry.getSchema(e), errorMetadata: c };
3296
- } catch {
3297
- n.message = n.message ?? n.Message ?? "UnknownError";
3298
- const f = this.errorRegistry, h = f.getBaseException();
3299
- if (h) {
3300
- const g = f.getErrorCtor(h) ?? Error;
3301
- throw this.decorateServiceException(Object.assign(new g({ name: a }), c), n);
3302
- }
3303
- const p = n, y = (p == null ? void 0 : p.message) ?? (p == null ? void 0 : p.Message) ?? ((u = p == null ? void 0 : p.Error) == null ? void 0 : u.Message) ?? ((d = p == null ? void 0 : p.Error) == null ? void 0 : d.message);
3304
- throw this.decorateServiceException(Object.assign(new Error(y), {
3305
- name: a
3306
- }, c), n);
3307
- }
3308
- }
3309
- compose(e, s, r) {
3310
- let n = r;
3311
- s.includes("#") && ([n] = s.split("#"));
3312
- const i = ee.for(n), o = ee.for("smithy.ts.sdk.synthetic." + r);
3313
- e.copyFrom(i), e.copyFrom(o), this.errorRegistry = e;
3314
- }
3315
- decorateServiceException(e, s = {}) {
3316
- var r, n, i, o;
3317
- if (this.queryCompat) {
3318
- const a = e.Message ?? s.Message, c = et(e, s);
3319
- a && (c.message = a);
3320
- const u = c.Error ?? {};
3321
- u.Type = (r = c.Error) == null ? void 0 : r.Type, u.Code = (n = c.Error) == null ? void 0 : n.Code, u.Message = ((i = c.Error) == null ? void 0 : i.message) ?? ((o = c.Error) == null ? void 0 : o.Message) ?? a, c.Error = u;
3322
- const d = c.$metadata.requestId;
3323
- return d && (c.RequestId = d), c;
3324
- }
3325
- return et(e, s);
3326
- }
3327
- setQueryCompatError(e, s) {
3328
- var n;
3329
- const r = (n = s.headers) == null ? void 0 : n["x-amzn-query-error"];
3330
- if (e !== void 0 && r != null) {
3331
- const [i, o] = r.split(";"), a = Object.keys(e), c = {
3332
- Code: i,
3333
- Type: o
3334
- };
3335
- e.Code = i, e.Type = o;
3336
- for (let u = 0; u < a.length; u++) {
3337
- const d = a[u];
3338
- c[d === "message" ? "Message" : d] = e[d];
3339
- }
3340
- delete c.__type, e.Error = c;
3341
- }
3342
- }
3343
- queryCompatOutput(e, s) {
3344
- e.Error && (s.Error = e.Error), e.Type && (s.Type = e.Type), e.Code && (s.Code = e.Code);
3345
- }
3346
- findQueryCompatibleError(e, s) {
3347
- try {
3348
- return e.getSchema(s);
3349
- } catch {
3350
- return e.find((n) => {
3351
- var i;
3352
- return ((i = B.of(n).getMergedTraits().awsQueryError) == null ? void 0 : i[0]) === s;
3353
- });
3354
- }
3355
- }
3356
- }
3357
- class Do {
3358
- constructor() {
3359
- m(this, "serdeContext");
3360
- }
3361
- setSerdeContext(e) {
3362
- this.serdeContext = e;
3363
- }
3364
- }
3365
- class Uo {
3366
- constructor(e, s) {
3367
- m(this, "from");
3368
- m(this, "to");
3369
- m(this, "keys");
3370
- this.from = e, this.to = s;
3371
- const r = Object.keys(this.from), n = new Set(r);
3372
- n.delete("__type"), this.keys = n;
3373
- }
3374
- mark(e) {
3375
- this.keys.delete(e);
3376
- }
3377
- hasUnknown() {
3378
- return this.keys.size === 1 && Object.keys(this.to).length === 0;
3379
- }
3380
- writeUnknown() {
3381
- if (this.hasUnknown()) {
3382
- const e = this.keys.values().next().value, s = this.from[e];
3383
- this.to.$unknown = [e, s];
3384
- }
3385
- }
3386
- }
3387
- const Tt = (t) => {
3388
- var e, s;
3389
- return q.isInstance(t) ? ((e = t.headers) == null ? void 0 : e.date) ?? ((s = t.headers) == null ? void 0 : s.Date) : void 0;
3390
- }, is = (t) => new Date(Date.now() + t), vi = (t, e) => Math.abs(is(e).getTime() - t) >= 3e5, Rt = (t, e) => {
3391
- const s = Date.parse(t);
3392
- return vi(s, e) ? s - Date.now() : e;
3393
- }, Q = (t, e) => {
3394
- if (!e)
3395
- throw new Error(`Property \`${t}\` is not resolved for AWS SDK SigV4Auth`);
3396
- return e;
3397
- }, Ci = async (t) => {
3398
- var u, d, l;
3399
- const e = Q("context", t.context), s = Q("config", t.config), r = (l = (d = (u = e.endpointV2) == null ? void 0 : u.properties) == null ? void 0 : d.authSchemes) == null ? void 0 : l[0], i = await Q("signer", s.signer)(r), o = t == null ? void 0 : t.signingRegion, a = t == null ? void 0 : t.signingRegionSet, c = t == null ? void 0 : t.signingName;
3400
- return {
3401
- config: s,
3402
- signer: i,
3403
- signingRegion: o,
3404
- signingRegionSet: a,
3405
- signingName: c
3406
- };
3407
- };
3408
- class Lo {
3409
- async sign(e, s, r) {
3410
- var l;
3411
- if (!C.isInstance(e))
3412
- throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");
3413
- const n = await Ci(r), { config: i, signer: o } = n;
3414
- let { signingRegion: a, signingName: c } = n;
3415
- const u = r.context;
3416
- if (((l = u == null ? void 0 : u.authSchemes) == null ? void 0 : l.length) ?? !1) {
3417
- const [f, h] = u.authSchemes;
3418
- (f == null ? void 0 : f.name) === "sigv4a" && (h == null ? void 0 : h.name) === "sigv4" && (a = (h == null ? void 0 : h.signingRegion) ?? a, c = (h == null ? void 0 : h.signingName) ?? c);
3419
- }
3420
- return r._preRequestSystemClockOffset = i.systemClockOffset, await o.sign(e, {
3421
- signingDate: is(i.systemClockOffset),
3422
- signingRegion: a,
3423
- signingService: c
3424
- });
3425
- }
3426
- errorHandler(e) {
3427
- return (s) => {
3428
- const r = s, n = r.ServerTime ?? Tt(r.$response);
3429
- if (n) {
3430
- const i = Q("config", e.config), o = e._preRequestSystemClockOffset, a = Rt(n, i.systemClockOffset);
3431
- (a !== i.systemClockOffset || o !== void 0 && o !== a) && r.$metadata && (i.systemClockOffset = a, r.$metadata.clockSkewCorrected = !0);
3432
- }
3433
- throw s;
3434
- };
3435
- }
3436
- successHandler(e, s) {
3437
- const r = Tt(e);
3438
- if (r) {
3439
- const n = Q("config", s.config);
3440
- n.systemClockOffset = Rt(r, n.systemClockOffset);
3441
- }
3442
- }
3443
- }
3444
- const Ho = (t) => {
3445
- let e = t.credentials, s = !!t.credentials, r;
3446
- Object.defineProperty(t, "credentials", {
3447
- set(u) {
3448
- u && u !== e && u !== r && (s = !0), e = u;
3449
- const d = xi(t, {
3450
- credentials: e,
3451
- credentialDefaultProvider: t.credentialDefaultProvider
3452
- }), l = Ii(t, d);
3453
- if (s && !l.attributed) {
3454
- const f = typeof e == "object" && e !== null;
3455
- r = async (h) => {
3456
- const y = await l(h);
3457
- return f && (!y.$source || Object.keys(y.$source).length === 0) ? ls(y, "CREDENTIALS_CODE", "e") : y;
3458
- }, r.memoized = l.memoized, r.configBound = l.configBound, r.attributed = !0;
3459
- } else
3460
- r = l;
3461
- },
3462
- get() {
3463
- return r;
3464
- },
3465
- enumerable: !0,
3466
- configurable: !0
3467
- }), t.credentials = e;
3468
- const { signingEscapePath: n = !0, systemClockOffset: i = t.systemClockOffset || 0, sha256: o } = t;
3469
- let a;
3470
- return t.signer ? a = K(t.signer) : t.regionInfoProvider ? a = () => K(t.region)().then(async (u) => [
3471
- await t.regionInfoProvider(u, {
3472
- useFipsEndpoint: await t.useFipsEndpoint(),
3473
- useDualstackEndpoint: await t.useDualstackEndpoint()
3474
- }) || {},
3475
- u
3476
- ]).then(([u, d]) => {
3477
- const { signingRegion: l, signingService: f } = u;
3478
- t.signingRegion = t.signingRegion || l || d, t.signingName = t.signingName || f || t.serviceId;
3479
- const h = {
3480
- ...t,
3481
- credentials: t.credentials,
3482
- region: t.signingRegion,
3483
- service: t.signingName,
3484
- sha256: o,
3485
- uriEscapePath: n
3486
- }, p = t.signerConstructor || Et;
3487
- return new p(h);
3488
- }) : a = async (u) => {
3489
- u = Object.assign({}, {
3490
- name: "sigv4",
3491
- signingName: t.signingName || t.defaultSigningName,
3492
- signingRegion: await K(t.region)(),
3493
- properties: {}
3494
- }, u);
3495
- const d = u.signingRegion, l = u.signingName;
3496
- t.signingRegion = t.signingRegion || d, t.signingName = t.signingName || l || t.serviceId;
3497
- const f = {
3498
- ...t,
3499
- credentials: t.credentials,
3500
- region: t.signingRegion,
3501
- service: t.signingName,
3502
- sha256: o,
3503
- uriEscapePath: n
3504
- }, h = t.signerConstructor || Et;
3505
- return new h(f);
3506
- }, Object.assign(t, {
3507
- systemClockOffset: i,
3508
- signingEscapePath: n,
3509
- signer: a
3510
- });
3511
- };
3512
- function xi(t, { credentials: e, credentialDefaultProvider: s }) {
3513
- let r;
3514
- return e ? e != null && e.memoized ? r = e : r = kn(e, $n, Kt) : s ? r = K(s(Object.assign({}, t, {
3515
- parentClientConfig: t
3516
- }))) : r = async () => {
3517
- throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.");
3518
- }, r.memoized = !0, r;
3519
- }
3520
- function Ii(t, e) {
3521
- if (e.configBound)
3522
- return e;
3523
- const s = async (r) => e({ ...r, callerClientConfig: t });
3524
- return s.memoized = e.memoized, s.configBound = !0, s;
3525
- }
3526
- const Mi = {};
3527
- function le() {
3528
- return typeof window < "u" ? window : typeof self < "u" ? self : Mi;
3529
- }
3530
- var $i = [
3531
- "decrypt",
3532
- "digest",
3533
- "encrypt",
3534
- "exportKey",
3535
- "generateKey",
3536
- "importKey",
3537
- "sign",
3538
- "verify"
3539
- ];
3540
- function ki(t) {
3541
- if (Oi(t) && typeof t.crypto.subtle == "object") {
3542
- var e = t.crypto.subtle;
3543
- return Ni(e);
3544
- }
3545
- return !1;
3546
- }
3547
- function Oi(t) {
3548
- if (typeof t == "object" && typeof t.crypto == "object") {
3549
- var e = t.crypto.getRandomValues;
3550
- return typeof e == "function";
3551
- }
3552
- return !1;
3553
- }
3554
- function Ni(t) {
3555
- return t && $i.every(function(e) {
3556
- return typeof t[e] == "function";
3557
- });
3558
- }
3559
- var os = { name: "SHA-256" }, At = {
3560
- name: "HMAC",
3561
- hash: os
3562
- }, _i = new Uint8Array([
3563
- 227,
3564
- 176,
3565
- 196,
3566
- 66,
3567
- 152,
3568
- 252,
3569
- 28,
3570
- 20,
3571
- 154,
3572
- 251,
3573
- 244,
3574
- 200,
3575
- 153,
3576
- 111,
3577
- 185,
3578
- 36,
3579
- 39,
3580
- 174,
3581
- 65,
3582
- 228,
3583
- 100,
3584
- 155,
3585
- 147,
3586
- 76,
3587
- 164,
3588
- 149,
3589
- 153,
3590
- 27,
3591
- 120,
3592
- 82,
3593
- 184,
3594
- 85
3595
- ]), Pi = (
3596
- /** @class */
3597
- function() {
3598
- function t(e) {
3599
- this.toHash = new Uint8Array(0), this.secret = e, this.reset();
3600
- }
3601
- return t.prototype.update = function(e) {
3602
- if (!We(e)) {
3603
- var s = ne(e), r = new Uint8Array(this.toHash.byteLength + s.byteLength);
3604
- r.set(this.toHash, 0), r.set(s, this.toHash.byteLength), this.toHash = r;
3605
- }
3606
- }, t.prototype.digest = function() {
3607
- var e = this;
3608
- return this.key ? this.key.then(function(s) {
3609
- return le().crypto.subtle.sign(At, s, e.toHash).then(function(r) {
3610
- return new Uint8Array(r);
3611
- });
3612
- }) : We(this.toHash) ? Promise.resolve(_i) : Promise.resolve().then(function() {
3613
- return le().crypto.subtle.digest(os, e.toHash);
3614
- }).then(function(s) {
3615
- return Promise.resolve(new Uint8Array(s));
3616
- });
3617
- }, t.prototype.reset = function() {
3618
- var e = this;
3619
- this.toHash = new Uint8Array(0), this.secret && this.secret !== void 0 && (this.key = new Promise(function(s, r) {
3620
- le().crypto.subtle.importKey("raw", ne(e.secret), At, !1, ["sign"]).then(s, r);
3621
- }), this.key.catch(function() {
3622
- }));
3623
- }, t;
3624
- }()
3625
- ), v = 64, Di = 32, Ui = new Uint32Array([
3626
- 1116352408,
3627
- 1899447441,
3628
- 3049323471,
3629
- 3921009573,
3630
- 961987163,
3631
- 1508970993,
3632
- 2453635748,
3633
- 2870763221,
3634
- 3624381080,
3635
- 310598401,
3636
- 607225278,
3637
- 1426881987,
3638
- 1925078388,
3639
- 2162078206,
3640
- 2614888103,
3641
- 3248222580,
3642
- 3835390401,
3643
- 4022224774,
3644
- 264347078,
3645
- 604807628,
3646
- 770255983,
3647
- 1249150122,
3648
- 1555081692,
3649
- 1996064986,
3650
- 2554220882,
3651
- 2821834349,
3652
- 2952996808,
3653
- 3210313671,
3654
- 3336571891,
3655
- 3584528711,
3656
- 113926993,
3657
- 338241895,
3658
- 666307205,
3659
- 773529912,
3660
- 1294757372,
3661
- 1396182291,
3662
- 1695183700,
3663
- 1986661051,
3664
- 2177026350,
3665
- 2456956037,
3666
- 2730485921,
3667
- 2820302411,
3668
- 3259730800,
3669
- 3345764771,
3670
- 3516065817,
3671
- 3600352804,
3672
- 4094571909,
3673
- 275423344,
3674
- 430227734,
3675
- 506948616,
3676
- 659060556,
3677
- 883997877,
3678
- 958139571,
3679
- 1322822218,
3680
- 1537002063,
3681
- 1747873779,
3682
- 1955562222,
3683
- 2024104815,
3684
- 2227730452,
3685
- 2361852424,
3686
- 2428436474,
3687
- 2756734187,
3688
- 3204031479,
3689
- 3329325298
3690
- ]), Li = [
3691
- 1779033703,
3692
- 3144134277,
3693
- 1013904242,
3694
- 2773480762,
3695
- 1359893119,
3696
- 2600822924,
3697
- 528734635,
3698
- 1541459225
3699
- ], Hi = Math.pow(2, 53) - 1, he = (
3700
- /** @class */
3701
- function() {
3702
- function t() {
3703
- this.state = Int32Array.from(Li), this.temp = new Int32Array(64), this.buffer = new Uint8Array(64), this.bufferLength = 0, this.bytesHashed = 0, this.finished = !1;
3704
- }
3705
- return t.prototype.update = function(e) {
3706
- if (this.finished)
3707
- throw new Error("Attempted to update an already finished hash.");
3708
- var s = 0, r = e.byteLength;
3709
- if (this.bytesHashed += r, this.bytesHashed * 8 > Hi)
3710
- throw new Error("Cannot hash more than 2^53 - 1 bits");
3711
- for (; r > 0; )
3712
- this.buffer[this.bufferLength++] = e[s++], r--, this.bufferLength === v && (this.hashBuffer(), this.bufferLength = 0);
3713
- }, t.prototype.digest = function() {
3714
- if (!this.finished) {
3715
- var e = this.bytesHashed * 8, s = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength), r = this.bufferLength;
3716
- if (s.setUint8(this.bufferLength++, 128), r % v >= v - 8) {
3717
- for (var n = this.bufferLength; n < v; n++)
3718
- s.setUint8(n, 0);
3719
- this.hashBuffer(), this.bufferLength = 0;
3720
- }
3721
- for (var n = this.bufferLength; n < v - 8; n++)
3722
- s.setUint8(n, 0);
3723
- s.setUint32(v - 8, Math.floor(e / 4294967296), !0), s.setUint32(v - 4, e), this.hashBuffer(), this.finished = !0;
3724
- }
3725
- for (var i = new Uint8Array(Di), n = 0; n < 8; n++)
3726
- i[n * 4] = this.state[n] >>> 24 & 255, i[n * 4 + 1] = this.state[n] >>> 16 & 255, i[n * 4 + 2] = this.state[n] >>> 8 & 255, i[n * 4 + 3] = this.state[n] >>> 0 & 255;
3727
- return i;
3728
- }, t.prototype.hashBuffer = function() {
3729
- for (var e = this, s = e.buffer, r = e.state, n = r[0], i = r[1], o = r[2], a = r[3], c = r[4], u = r[5], d = r[6], l = r[7], f = 0; f < v; f++) {
3730
- if (f < 16)
3731
- this.temp[f] = (s[f * 4] & 255) << 24 | (s[f * 4 + 1] & 255) << 16 | (s[f * 4 + 2] & 255) << 8 | s[f * 4 + 3] & 255;
3732
- else {
3733
- var h = this.temp[f - 2], p = (h >>> 17 | h << 15) ^ (h >>> 19 | h << 13) ^ h >>> 10;
3734
- h = this.temp[f - 15];
3735
- var y = (h >>> 7 | h << 25) ^ (h >>> 18 | h << 14) ^ h >>> 3;
3736
- this.temp[f] = (p + this.temp[f - 7] | 0) + (y + this.temp[f - 16] | 0);
3737
- }
3738
- var g = (((c >>> 6 | c << 26) ^ (c >>> 11 | c << 21) ^ (c >>> 25 | c << 7)) + (c & u ^ ~c & d) | 0) + (l + (Ui[f] + this.temp[f] | 0) | 0) | 0, w = ((n >>> 2 | n << 30) ^ (n >>> 13 | n << 19) ^ (n >>> 22 | n << 10)) + (n & i ^ n & o ^ i & o) | 0;
3739
- l = d, d = u, u = c, c = a + g | 0, a = o, o = i, i = n, n = g + w | 0;
3740
- }
3741
- r[0] += n, r[1] += i, r[2] += o, r[3] += a, r[4] += c, r[5] += u, r[6] += d, r[7] += l;
3742
- }, t;
3743
- }()
3744
- ), Fi = (
3745
- /** @class */
3746
- function() {
3747
- function t(e) {
3748
- this.secret = e, this.hash = new he(), this.reset();
3749
- }
3750
- return t.prototype.update = function(e) {
3751
- if (!(We(e) || this.error))
3752
- try {
3753
- this.hash.update(ne(e));
3754
- } catch (s) {
3755
- this.error = s;
3756
- }
3757
- }, t.prototype.digestSync = function() {
3758
- if (this.error)
3759
- throw this.error;
3760
- return this.outer ? (this.outer.finished || this.outer.update(this.hash.digest()), this.outer.digest()) : this.hash.digest();
3761
- }, t.prototype.digest = function() {
3762
- return ds(this, void 0, void 0, function() {
3763
- return fs(this, function(e) {
3764
- return [2, this.digestSync()];
3765
- });
3766
- });
3767
- }, t.prototype.reset = function() {
3768
- if (this.hash = new he(), this.secret) {
3769
- this.outer = new he();
3770
- var e = Bi(this.secret), s = new Uint8Array(v);
3771
- s.set(e);
3772
- for (var r = 0; r < v; r++)
3773
- e[r] ^= 54, s[r] ^= 92;
3774
- this.hash.update(e), this.outer.update(s);
3775
- for (var r = 0; r < e.byteLength; r++)
3776
- e[r] = 0;
3777
- }
3778
- }, t;
3779
- }()
3780
- );
3781
- function Bi(t) {
3782
- var e = ne(t);
3783
- if (e.byteLength > v) {
3784
- var s = new he();
3785
- s.update(e), e = s.digest();
3786
- }
3787
- var r = new Uint8Array(v);
3788
- return r.set(e), r;
3789
- }
3790
- var Fo = (
3791
- /** @class */
3792
- function() {
3793
- function t(e) {
3794
- ki(le()) ? this.hash = new Pi(e) : this.hash = new Fi(e);
3795
- }
3796
- return t.prototype.update = function(e, s) {
3797
- this.hash.update(ne(e));
3798
- }, t.prototype.digest = function() {
3799
- return this.hash.digest();
3800
- }, t.prototype.reset = function() {
3801
- this.hash.reset();
3802
- }, t;
3803
- }()
3804
- );
3805
- function vt(t, e) {
3806
- return new Request(t, e);
3807
- }
3808
- function zi(t = 0) {
3809
- return new Promise((e, s) => {
3810
- t && setTimeout(() => {
3811
- const r = new Error(`Request did not complete within ${t} ms`);
3812
- r.name = "TimeoutError", s(r);
3813
- }, t);
3814
- });
3815
- }
3816
- const Le = {
3817
- supported: void 0
3818
- };
3819
- class as {
3820
- constructor(e) {
3821
- m(this, "config");
3822
- m(this, "configProvider");
3823
- typeof e == "function" ? this.configProvider = e().then((s) => s || {}) : (this.config = e ?? {}, this.configProvider = Promise.resolve(this.config)), Le.supported === void 0 && (Le.supported = typeof Request < "u" && "keepalive" in vt("https://[::1]"));
3824
- }
3825
- static create(e) {
3826
- return typeof (e == null ? void 0 : e.handle) == "function" ? e : new as(e);
3827
- }
3828
- destroy() {
3829
- }
3830
- async handle(e, { abortSignal: s, requestTimeout: r } = {}) {
3831
- var S;
3832
- this.config || (this.config = await this.configProvider);
3833
- const n = r ?? this.config.requestTimeout, i = this.config.keepAlive === !0, o = this.config.credentials;
3834
- if (s != null && s.aborted) {
3835
- const b = Ct(s);
3836
- return Promise.reject(b);
3837
- }
3838
- let a = e.path;
3839
- const c = qr(e.query || {});
3840
- c && (a += `?${c}`), e.fragment && (a += `#${e.fragment}`);
3841
- let u = "";
3842
- if (e.username != null || e.password != null) {
3843
- const b = e.username ?? "", E = e.password ?? "";
3844
- u = `${b}:${E}@`;
3845
- }
3846
- const { port: d, method: l } = e, f = `${e.protocol}//${u}${e.hostname}${d ? `:${d}` : ""}${a}`, h = l === "GET" || l === "HEAD" ? void 0 : e.body, p = {
3847
- body: h,
3848
- headers: new Headers(e.headers),
3849
- method: l,
3850
- credentials: o
3851
- };
3852
- (S = this.config) != null && S.cache && (p.cache = this.config.cache), h && (p.duplex = "half"), typeof AbortController < "u" && (p.signal = s), Le.supported && (p.keepalive = i), typeof this.config.requestInit == "function" && Object.assign(p, this.config.requestInit(e));
3853
- let y = () => {
3854
- };
3855
- const g = vt(f, p), w = [
3856
- fetch(g).then((b) => {
3857
- const E = b.headers, A = {};
3858
- for (const k of E.entries())
3859
- A[k[0]] = k[1];
3860
- return b.body != null ? {
3861
- response: new q({
3862
- headers: A,
3863
- reason: b.statusText,
3864
- statusCode: b.status,
3865
- body: b.body
3866
- })
3867
- } : b.blob().then((k) => ({
3868
- response: new q({
3869
- headers: A,
3870
- reason: b.statusText,
3871
- statusCode: b.status,
3872
- body: k
3873
- })
3874
- }));
3875
- }),
3876
- zi(n)
3877
- ];
3878
- return s && w.push(new Promise((b, E) => {
3879
- const A = () => {
3880
- const x = Ct(s);
3881
- E(x);
3882
- };
3883
- if (typeof s.addEventListener == "function") {
3884
- const x = s;
3885
- x.addEventListener("abort", A, { once: !0 }), y = () => x.removeEventListener("abort", A);
3886
- } else
3887
- s.onabort = A;
3888
- })), Promise.race(w).finally(y);
3889
- }
3890
- updateHttpClientConfig(e, s) {
3891
- this.config = void 0, this.configProvider = this.configProvider.then((r) => (r[e] = s, r));
3892
- }
3893
- httpHandlerConfigs() {
3894
- return this.config ?? {};
3895
- }
3896
- }
3897
- function Ct(t) {
3898
- const e = t && typeof t == "object" && "reason" in t ? t.reason : void 0;
3899
- if (e) {
3900
- if (e instanceof Error) {
3901
- const n = new Error("Request aborted");
3902
- return n.name = "AbortError", n.cause = e, n;
3903
- }
3904
- const r = new Error(String(e));
3905
- return r.name = "AbortError", r;
3906
- }
3907
- const s = new Error("Request aborted");
3908
- return s.name = "AbortError", s;
3909
- }
3910
- const Bo = async (t) => {
3911
- var e;
3912
- return typeof Blob == "function" && t instanceof Blob || ((e = t.constructor) == null ? void 0 : e.name) === "Blob" ? Blob.prototype.arrayBuffer !== void 0 ? new Uint8Array(await t.arrayBuffer()) : ji(t) : qi(t);
3913
- };
3914
- async function ji(t) {
3915
- const e = await Gi(t), s = Ot(e);
3916
- return new Uint8Array(s);
3917
- }
3918
- async function qi(t) {
3919
- const e = [], s = t.getReader();
3920
- let r = !1, n = 0;
3921
- for (; !r; ) {
3922
- const { done: a, value: c } = await s.read();
3923
- c && (e.push(c), n += c.length), r = a;
3924
- }
3925
- const i = new Uint8Array(n);
3926
- let o = 0;
3927
- for (const a of e)
3928
- i.set(a, o), o += a.length;
3929
- return i;
3930
- }
3931
- function Gi(t) {
3932
- return new Promise((e, s) => {
3933
- const r = new FileReader();
3934
- r.onloadend = () => {
3935
- if (r.readyState !== 2)
3936
- return s(new Error("Reader aborted too early"));
3937
- const n = r.result ?? "", i = n.indexOf(","), o = i > -1 ? i + 1 : n.length;
3938
- e(n.substring(o));
3939
- }, r.onabort = () => s(new Error("Read aborted")), r.onerror = () => s(r.error), r.readAsDataURL(t);
3940
- });
3941
- }
3942
- export {
3943
- Fo as $,
3944
- Lo as A,
3945
- Ci as B,
3946
- is as C,
3947
- K as D,
3948
- Ut as E,
3949
- no as F,
3950
- io as G,
3951
- fo as H,
3952
- Vn as I,
3953
- Lt as J,
3954
- Ho as K,
3955
- z as L,
3956
- mr as M,
3957
- B as N,
3958
- X as O,
3959
- Po as P,
3960
- Ts as Q,
3961
- ao as R,
3962
- Fr as S,
3963
- ee as T,
3964
- Uo as U,
3965
- le as V,
3966
- Zn as W,
3967
- ki as X,
3968
- Fe as Y,
3969
- $o as Z,
3970
- Bo as _,
3971
- H as a,
3972
- go as a0,
3973
- fe as a1,
3974
- ro as a2,
3975
- Oo as a3,
3976
- ko as a4,
3977
- as as a5,
3978
- Xi as a6,
3979
- Io as a7,
3980
- Qi as a8,
3981
- No as a9,
3982
- Yi as aa,
3983
- ho as ab,
3984
- _o as ac,
3985
- Zi as ad,
3986
- mo as ae,
3987
- Ji as af,
3988
- Co as ag,
3989
- yo as ah,
3990
- Mo as ai,
3991
- oo as aj,
3992
- Ki as ak,
3993
- xo as al,
3994
- wo as am,
3995
- po as an,
3996
- bo as ao,
3997
- Eo as ap,
3998
- To as aq,
3999
- Ro as ar,
4000
- Ao as as,
4001
- So as at,
4002
- vo as au,
4003
- so as av,
4004
- to as aw,
4005
- Ee as ax,
4006
- Ns as b,
4007
- C as c,
4008
- V as d,
4009
- uo as e,
4010
- Ot as f,
4011
- lo as g,
4012
- _t as h,
4013
- te as i,
4014
- co as j,
4015
- eo as k,
4016
- ir as l,
4017
- We as m,
4018
- ne as n,
4019
- re as o,
4020
- L as p,
4021
- Is as q,
4022
- q as r,
4023
- $ as s,
4024
- ks as t,
4025
- Js as u,
4026
- Et as v,
4027
- xn as w,
4028
- ie as x,
4029
- Do as y,
4030
- nr as z
4031
- };
4032
- //# sourceMappingURL=stream-collector-mh16BUWl.mjs.map