import { gt, yt } from "./chunk-O6L55DMN.js"; import "./chunk-FNDTTSSL.js"; import "./chunk-KE6WE6IM.js"; import "./chunk-KRMUJIEJ.js"; import "./chunk-YFT6OQ5R.js"; import "./chunk-USOO7D3G.js"; import "./chunk-F73GDDKZ.js"; import { cloneDeep_default, merge_default } from "./chunk-LK7GAOJV.js"; import "./chunk-GCDLWRBO.js"; import "./chunk-YI6SOFIT.js"; import { axios_default } from "./chunk-SCTZEQPU.js"; import "./chunk-PLDDJCW6.js"; // node_modules/@fast-crud/fast-extends/dist/uploader-s3-77927a69.mjs var dc = Object.defineProperty; var lc = (e, t, n) => t in e ? dc(e, t, { enumerable: true, configurable: true, writable: true, value: n }) : e[t] = n; var _ = (e, t, n) => (lc(e, typeof t != "symbol" ? t + "" : t, n), n); var yc = (e) => ({ setHttpHandler(t) { e.httpHandler = t; }, httpHandler() { return e.httpHandler; }, updateHttpClientConfig(t, n) { var r; (r = e.httpHandler) == null || r.updateHttpClientConfig(t, n); }, httpHandlerConfigs() { return e.httpHandler.httpHandlerConfigs(); } }); var wc = (e) => ({ httpHandler: e.httpHandler() }); var ss; (function(e) { e.HEADER = "header", e.QUERY = "query"; })(ss || (ss = {})); var is; (function(e) { e.HEADER = "header", e.QUERY = "query"; })(is || (is = {})); var Mt; (function(e) { e.HTTP = "http", e.HTTPS = "https"; })(Mt || (Mt = {})); var Zt; (function(e) { e.MD5 = "md5", e.CRC32 = "crc32", e.CRC32C = "crc32c", e.SHA1 = "sha1", e.SHA256 = "sha256"; })(Zt || (Zt = {})); var os; (function(e) { e[e.HEADER = 0] = "HEADER", e[e.TRAILER = 1] = "TRAILER"; })(os || (os = {})); var ir = "__smithy_context"; var as; (function(e) { e.PROFILE = "profile", e.SSO_SESSION = "sso-session", e.SERVICES = "services"; })(as || (as = {})); var cs; (function(e) { e.HTTP_0_9 = "http/0.9", e.HTTP_1_0 = "http/1.0", e.TDS_8_0 = "tds/8.0"; })(cs || (cs = {})); var se = class _se { constructor(t) { this.method = t.method || "GET", this.hostname = t.hostname || "localhost", this.port = t.port, this.query = t.query || {}, this.headers = t.headers || {}, this.body = t.body, this.protocol = t.protocol ? t.protocol.slice(-1) !== ":" ? `${t.protocol}:` : t.protocol : "https:", this.path = t.path ? t.path.charAt(0) !== "/" ? `/${t.path}` : t.path : "/", this.username = t.username, this.password = t.password, this.fragment = t.fragment; } static clone(t) { const n = new _se({ ...t, headers: { ...t.headers } }); return n.query && (n.query = bc(n.query)), n; } static isInstance(t) { if (!t) return false; const n = t; return "method" in n && "protocol" in n && "hostname" in n && "path" in n && typeof n.query == "object" && typeof n.headers == "object"; } clone() { return _se.clone(this); } }; function bc(e) { return Object.keys(e).reduce((t, n) => { const r = e[n]; return { ...t, [n]: Array.isArray(r) ? [...r] : r }; }, {}); } var gt2 = class { constructor(t) { this.statusCode = t.statusCode, this.reason = t.reason, this.headers = t.headers || {}, this.body = t.body; } static isInstance(t) { if (!t) return false; const n = t; return typeof n.statusCode == "number" && typeof n.headers == "object"; } }; function Ec(e) { return (t) => async (n) => { var s, i; const { request: r } = n; return se.isInstance(r) && r.body && e.runtime === "node" && ((i = (s = e.requestHandler) == null ? void 0 : s.constructor) == null ? void 0 : i.name) !== "FetchHttpHandler" && (r.headers = { ...r.headers, Expect: "100-continue" }), t({ ...n, request: r }); }; } var xc = { step: "build", tags: ["SET_EXPECT_HEADER", "EXPECT_HEADER"], name: "addExpectContinueMiddleware", override: true }; var Sc = (e) => ({ applyToStack: (t) => { t.add(Ec(e), xc); } }); var mt = { WHEN_SUPPORTED: "WHEN_SUPPORTED", WHEN_REQUIRED: "WHEN_REQUIRED" }; var Ac = mt.WHEN_SUPPORTED; var bn = { WHEN_SUPPORTED: "WHEN_SUPPORTED", WHEN_REQUIRED: "WHEN_REQUIRED" }; var Cc = mt.WHEN_SUPPORTED; var V; (function(e) { e.MD5 = "MD5", e.CRC32 = "CRC32", e.CRC32C = "CRC32C", e.CRC64NVME = "CRC64NVME", e.SHA1 = "SHA1", e.SHA256 = "SHA256"; })(V || (V = {})); var us; (function(e) { e.HEADER = "header", e.TRAILER = "trailer"; })(us || (us = {})); var or = V.CRC32; var ds; (function(e) { e.ENV = "env", e.CONFIG = "shared config entry"; })(ds || (ds = {})); function vc(e, t, n) { return e.$source || (e.$source = {}), e.$source[t] = n, e; } function ne(e, t, n) { e.__aws_sdk_context ? e.__aws_sdk_context.features || (e.__aws_sdk_context.features = {}) : e.__aws_sdk_context = { features: {} }, e.__aws_sdk_context.features[t] = n; } var ls = (e) => { var t, n; return gt2.isInstance(e) ? ((t = e.headers) == null ? void 0 : t.date) ?? ((n = e.headers) == null ? void 0 : n.Date) : void 0; }; var Sr = (e) => new Date(Date.now() + e); var Rc = (e, t) => Math.abs(Sr(t).getTime() - e) >= 3e5; var fs = (e, t) => { const n = Date.parse(e); return Rc(n, t) ? n - Date.now() : t; }; var kt = (e, t) => { if (!t) throw new Error(`Property \`${e}\` is not resolved for AWS SDK SigV4Auth`); return t; }; var bo = async (e) => { var u, l, f; const t = kt("context", e.context), n = kt("config", e.config), r = (f = (l = (u = t.endpointV2) == null ? void 0 : u.properties) == null ? void 0 : l.authSchemes) == null ? void 0 : f[0], i = await kt("signer", n.signer)(r), o = e == null ? void 0 : e.signingRegion, a = e == null ? void 0 : e.signingRegionSet, c = e == null ? void 0 : e.signingName; return { config: n, signer: i, signingRegion: o, signingRegionSet: a, signingName: c }; }; var Eo = class { async sign(t, n, r) { var f; if (!se.isInstance(t)) throw new Error("The request is not an instance of `HttpRequest` and cannot be signed"); const s = await bo(r), { config: i, signer: o } = s; let { signingRegion: a, signingName: c } = s; const u = r.context; if (((f = u == null ? void 0 : u.authSchemes) == null ? void 0 : f.length) ?? 0 > 1) { const [p, g] = u.authSchemes; (p == null ? void 0 : p.name) === "sigv4a" && (g == null ? void 0 : g.name) === "sigv4" && (a = (g == null ? void 0 : g.signingRegion) ?? a, c = (g == null ? void 0 : g.signingName) ?? c); } return await o.sign(t, { signingDate: Sr(i.systemClockOffset), signingRegion: a, signingService: c }); } errorHandler(t) { return (n) => { const r = n.ServerTime ?? ls(n.$response); if (r) { const s = kt("config", t.config), i = s.systemClockOffset; s.systemClockOffset = fs(r, s.systemClockOffset), s.systemClockOffset !== i && n.$metadata && (n.$metadata.clockSkewCorrected = true); } throw n; }; } successHandler(t, n) { const r = ls(t); if (r) { const s = kt("config", n.config); s.systemClockOffset = fs(r, s.systemClockOffset); } } }; var kc = class extends Eo { async sign(t, n, r) { var p; if (!se.isInstance(t)) throw new Error("The request is not an instance of `HttpRequest` and cannot be signed"); const { config: s, signer: i, signingRegion: o, signingRegionSet: a, signingName: c } = await bo(r), l = (await ((p = s.sigv4aSigningRegionSet) == null ? void 0 : p.call(s)) ?? a ?? [o]).join(","); return await i.sign(t, { signingDate: Sr(s.systemClockOffset), signingRegion: l, signingService: c }); } }; var St = (e) => e[ir] || (e[ir] = {}); var Ne = (e) => { if (typeof e == "function") return e; const t = Promise.resolve(e); return () => t; }; var Tc = (e, t) => { if (!t || t.length === 0) return e; const n = []; for (const r of t) for (const s of e) s.schemeId.split("#")[1] === r && n.push(s); for (const r of e) n.find(({ schemeId: s }) => s === r.schemeId) || n.push(r); return n; }; function Bc(e) { const t = /* @__PURE__ */ new Map(); for (const n of e) t.set(n.schemeId, n); return t; } var Ic = (e, t) => (n, r) => async (s) => { var f; const i = e.httpAuthSchemeProvider(await t.httpAuthSchemeParametersProvider(e, r, s.input)), o = e.authSchemePreference ? await e.authSchemePreference() : [], a = Tc(i, o), c = Bc(e.httpAuthSchemes), u = St(r), l = []; for (const p of a) { const g = c.get(p.schemeId); if (!g) { l.push(`HttpAuthScheme \`${p.schemeId}\` was not enabled for this service.`); continue; } const S = g.identityProvider(await t.identityProviderConfigProvider(e)); if (!S) { l.push(`HttpAuthScheme \`${p.schemeId}\` did not have an IdentityProvider configured.`); continue; } const { identityProperties: T = {}, signingProperties: A = {} } = ((f = p.propertiesExtractor) == null ? void 0 : f.call(p, e, r)) || {}; p.identityProperties = Object.assign(p.identityProperties || {}, T), p.signingProperties = Object.assign(p.signingProperties || {}, A), u.selectedHttpAuthScheme = { httpAuthOption: p, identity: await S(p.identityProperties), signer: g.signer }; break; } if (!u.selectedHttpAuthScheme) throw new Error(l.join(` `)); return n(s); }; var _c = { step: "serialize", tags: ["HTTP_AUTH_SCHEME"], name: "httpAuthSchemeMiddleware", override: true, relation: "before", toMiddleware: "endpointV2Middleware" }; var Pc = (e, { httpAuthSchemeParametersProvider: t, identityProviderConfigProvider: n }) => ({ applyToStack: (r) => { r.addRelativeTo(Ic(e, { httpAuthSchemeParametersProvider: t, identityProviderConfigProvider: n }), _c); } }); var Nc = (e, t) => (n, r) => async (s) => { var o, a, c, u; const { response: i } = await n(s); try { const l = await t(i, e); return { response: i, output: l }; } catch (l) { if (Object.defineProperty(l, "$response", { value: i }), !("$metadata" in l)) { const f = "Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object."; try { l.message += ` ` + f; } catch { !r.logger || ((a = (o = r.logger) == null ? void 0 : o.constructor) == null ? void 0 : a.name) === "NoOpLogger" || (u = (c = r.logger) == null ? void 0 : c.warn) == null || u.call(c, f); } typeof l.$responseBodyText < "u" && l.$response && (l.$response.body = l.$responseBodyText); try { if (gt2.isInstance(i)) { const { headers: p = {} } = i, g = Object.entries(p); l.$metadata = { httpStatusCode: i.statusCode, requestId: En(/^x-[\w-]+-request-?id$/, g), extendedRequestId: En(/^x-[\w-]+-id-2$/, g), cfId: En(/^x-[\w-]+-cf-id$/, g) }; } } catch { } } throw l; } }; var En = (e, t) => (t.find(([n]) => n.match(e)) || [void 0, void 0])[1]; var Mc = (e, t) => (n, r) => async (s) => { var c; const i = e, o = (c = r.endpointV2) != null && c.url && i.urlParser ? async () => i.urlParser(r.endpointV2.url) : i.endpoint; if (!o) throw new Error("No valid endpoint provider available."); const a = await t(s.input, { ...e, endpoint: o }); return n({ ...s, request: a }); }; var Fc = { name: "deserializerMiddleware", step: "deserialize", tags: ["DESERIALIZER"], override: true }; var xo = { name: "serializerMiddleware", step: "serialize", tags: ["SERIALIZER"], override: true }; function So(e, t, n) { return { applyToStack: (r) => { r.add(Nc(e, n), Fc), r.add(Mc(e, t), xo); } }; } var Oc = (e) => (t) => { throw t; }; var Dc = (e, t) => { }; var Uc = (e) => (t, n) => async (r) => { if (!se.isInstance(r.request)) return t(r); const i = St(n).selectedHttpAuthScheme; if (!i) throw new Error("No HttpAuthScheme was selected: unable to sign request"); const { httpAuthOption: { signingProperties: o = {} }, identity: a, signer: c } = i, u = await t({ ...r, request: await c.sign(r.request, a, o) }).catch((c.errorHandler || Oc)(o)); return (c.successHandler || Dc)(u.response, o), u; }; var Ao = { step: "finalizeRequest", tags: ["HTTP_SIGNING"], name: "httpSigningMiddleware", aliases: ["apiKeyMiddleware", "tokenMiddleware", "awsAuthMiddleware"], override: true, relation: "after", toMiddleware: "retryMiddleware" }; var $c = (e) => ({ applyToStack: (t) => { t.addRelativeTo(Uc(), Ao); } }); var ht = (e) => { if (typeof e == "function") return e; const t = Promise.resolve(e); return () => t; }; var Ge = {}; var At = new Array(64); for (let e = 0, t = "A".charCodeAt(0), n = "Z".charCodeAt(0); e + t <= n; e++) { const r = String.fromCharCode(e + t); Ge[r] = e, At[e] = r; } for (let e = 0, t = "a".charCodeAt(0), n = "z".charCodeAt(0); e + t <= n; e++) { const r = String.fromCharCode(e + t), s = e + 26; Ge[r] = s, At[s] = r; } for (let e = 0; e < 10; e++) { Ge[e.toString(10)] = e + 52; const t = e.toString(10), n = e + 52; Ge[t] = n, At[n] = t; } Ge["+"] = 62; At[62] = "+"; Ge["/"] = 63; At[63] = "/"; var pt = 6; var Tt = 8; var Lc = 63; var Ar = (e) => { let t = e.length / 4 * 3; e.slice(-2) === "==" ? t -= 2 : e.slice(-1) === "=" && t--; const n = new ArrayBuffer(t), r = new DataView(n); for (let s = 0; s < e.length; s += 4) { let i = 0, o = 0; for (let u = s, l = s + 3; u <= l; u++) if (e[u] !== "=") { if (!(e[u] in Ge)) throw new TypeError(`Invalid character ${e[u]} in base64 string.`); i |= Ge[e[u]] << (l - u) * pt, o += pt; } else i >>= pt; const a = s / 4 * 3; i >>= o % Tt; const c = Math.floor(o / Tt); for (let u = 0; u < c; u++) { const l = (c - u - 1) * Tt; r.setUint8(a + u, (i & 255 << l) >> l); } } return new Uint8Array(n); }; var ot = (e) => new TextEncoder().encode(e); var yt2 = (e) => typeof e == "string" ? ot(e) : ArrayBuffer.isView(e) ? new Uint8Array(e.buffer, e.byteOffset, e.byteLength / Uint8Array.BYTES_PER_ELEMENT) : new Uint8Array(e); var Cr = (e) => { if (typeof e == "string") return e; if (typeof e != "object" || typeof e.byteOffset != "number" || typeof e.byteLength != "number") throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array."); return new TextDecoder("utf-8").decode(e); }; function cn(e) { let t; typeof e == "string" ? t = ot(e) : t = e; const n = typeof t == "object" && typeof t.length == "number", r = typeof t == "object" && typeof t.byteOffset == "number" && typeof t.byteLength == "number"; if (!n && !r) throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array."); let s = ""; for (let i = 0; i < t.length; i += 3) { let o = 0, a = 0; for (let u = i, l = Math.min(i + 3, t.length); u < l; u++) o |= t[u] << (l - u - 1) * Tt, a += Tt; const c = Math.ceil(a / pt); o <<= c * pt - a; for (let u = 1; u <= c; u++) { const l = (c - u) * pt; s += At[(o & Lc << l) >> l]; } s += "==".slice(0, 4 - c); } return s; } function Hc(e, t = "utf-8") { return t === "base64" ? cn(e) : Cr(e); } function zc(e, t) { return t === "base64" ? st.mutate(Ar(e)) : st.mutate(ot(e)); } var st = class _st extends Uint8Array { static fromString(t, n = "utf-8") { switch (typeof t) { case "string": return zc(t, n); default: throw new Error(`Unsupported conversion from ${typeof t} to Uint8ArrayBlobAdapter.`); } } static mutate(t) { return Object.setPrototypeOf(t, _st.prototype), t; } transformToString(t = "utf-8") { return Hc(this, t); } }; var jc = typeof ReadableStream == "function" ? ReadableStream : function() { }; var qc = class extends jc { }; var ar = (e) => { var t; return typeof ReadableStream == "function" && (((t = e == null ? void 0 : e.constructor) == null ? void 0 : t.name) === ReadableStream.name || e instanceof ReadableStream); }; var Vc = ({ expectedChecksum: e, checksum: t, source: n, checksumSourceLocation: r, base64Encoder: s }) => { var c; if (!ar(n)) throw new Error(`@smithy/util-stream: unsupported source type ${((c = n == null ? void 0 : n.constructor) == null ? void 0 : c.name) ?? n} in ChecksumStream.`); const i = s ?? cn; if (typeof TransformStream != "function") throw new Error("@smithy/util-stream: unable to instantiate ChecksumStream because API unavailable: ReadableStream/TransformStream."); const o = new TransformStream({ start() { }, async transform(u, l) { t.update(u), l.enqueue(u); }, async flush(u) { const l = await t.digest(), f = i(l); if (e !== f) { const p = new Error(`Checksum mismatch: expected "${e}" but received "${f}" in response header "${r}".`); u.error(p); } else u.terminate(); } }); n.pipeThrough(o); const a = o.readable; return Object.setPrototypeOf(a, qc.prototype), a; }; var Wc = class { constructor(t) { this.allocByteArray = t, this.byteLength = 0, this.byteArrays = []; } push(t) { this.byteArrays.push(t), this.byteLength += t.byteLength; } flush() { if (this.byteArrays.length === 1) { const r = this.byteArrays[0]; return this.reset(), r; } const t = this.allocByteArray(this.byteLength); let n = 0; for (let r = 0; r < this.byteArrays.length; ++r) { const s = this.byteArrays[r]; t.set(s, n), n += s.byteLength; } return this.reset(), t; } reset() { this.byteArrays = [], this.byteLength = 0; } }; function Kc(e, t, n) { const r = e.getReader(); let s = false, i = 0; const o = ["", new Wc((u) => new Uint8Array(u))]; let a = -1; const c = async (u) => { const { value: l, done: f } = await r.read(), p = l; if (f) { if (a !== -1) { const g = xn(o, a); Bt(g) > 0 && u.enqueue(g); } u.close(); } else { const g = Xc(p, false); if (a !== g && (a >= 0 && u.enqueue(xn(o, a)), a = g), a === -1) { u.enqueue(p); return; } const S = Bt(p); i += S; const T = Bt(o[a]); if (S >= t && T === 0) u.enqueue(p); else { const A = Zc(o, a, p); !s && i > t * 2 && (s = true, n == null || n.warn(`@smithy/util-stream - stream chunk size ${S} is below threshold of ${t}, automatically buffering.`)), A >= t ? u.enqueue(xn(o, a)) : await c(u); } } }; return new ReadableStream({ pull: c }); } var Gc = Kc; function Zc(e, t, n) { switch (t) { case 0: return e[0] += n, Bt(e[0]); case 1: case 2: return e[t].push(n), Bt(e[t]); } } function xn(e, t) { switch (t) { case 0: const n = e[0]; return e[0] = "", n; case 1: case 2: return e[t].flush(); } throw new Error(`@smithy/util-stream - invalid index ${t} given to flush()`); } function Bt(e) { return (e == null ? void 0 : e.byteLength) ?? (e == null ? void 0 : e.length) ?? 0; } function Xc(e, t = true) { return t && typeof Buffer < "u" && e instanceof Buffer ? 2 : e instanceof Uint8Array ? 1 : typeof e == "string" ? 0 : -1; } var Qc = (e, t) => { const { base64Encoder: n, bodyLengthChecker: r, checksumAlgorithmFn: s, checksumLocationName: i, streamHasher: o } = t, a = n !== void 0 && r !== void 0 && s !== void 0 && i !== void 0 && o !== void 0, c = a ? o(s, e) : void 0, u = e.getReader(); return new ReadableStream({ async pull(l) { const { value: f, done: p } = await u.read(); if (p) { if (l.enqueue(`0\r `), a) { const g = n(await c); l.enqueue(`${i}:${g}\r `), l.enqueue(`\r `); } l.close(); } else l.enqueue(`${(r(f) || 0).toString(16)}\r ${f}\r `); } }); }; async function Yc(e, t) { let n = 0; const r = [], s = e.getReader(); let i = false; for (; !i; ) { const { done: c, value: u } = await s.read(); if (u && (r.push(u), n += (u == null ? void 0 : u.byteLength) ?? 0), n >= t) break; i = c; } s.releaseLock(); const o = new Uint8Array(Math.min(t, n)); let a = 0; for (const c of r) { if (c.byteLength > o.byteLength - a) { o.set(c.subarray(0, o.byteLength - a), a); break; } else o.set(c, a); a += c.length; } return o; } var it = (e) => encodeURIComponent(e).replace(/[!'()*]/g, Jc); var Jc = (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`; function eu(e) { const t = []; for (let n of Object.keys(e).sort()) { const r = e[n]; if (n = it(n), Array.isArray(r)) for (let s = 0, i = r.length; s < i; s++) t.push(`${n}=${it(r[s])}`); else { let s = n; (r || typeof r == "string") && (s += `=${it(r)}`), t.push(s); } } return t.join("&"); } function hs(e, t) { return new Request(e, t); } function tu(e = 0) { return new Promise((t, n) => { e && setTimeout(() => { const r = new Error(`Request did not complete within ${e} ms`); r.name = "TimeoutError", n(r); }, e); }); } var Sn = { supported: void 0 }; var vr = class _vr { static create(t) { return typeof (t == null ? void 0 : t.handle) == "function" ? t : new _vr(t); } constructor(t) { typeof t == "function" ? this.configProvider = t().then((n) => n || {}) : (this.config = t ?? {}, this.configProvider = Promise.resolve(this.config)), Sn.supported === void 0 && (Sn.supported = typeof Request < "u" && "keepalive" in hs("https://[::1]")); } destroy() { } async handle(t, { abortSignal: n, requestTimeout: r } = {}) { var L; this.config || (this.config = await this.configProvider); const s = r ?? this.config.requestTimeout, i = this.config.keepAlive === true, o = this.config.credentials; if (n != null && n.aborted) { const H = new Error("Request aborted"); return H.name = "AbortError", Promise.reject(H); } let a = t.path; const c = eu(t.query || {}); c && (a += `?${c}`), t.fragment && (a += `#${t.fragment}`); let u = ""; if (t.username != null || t.password != null) { const H = t.username ?? "", K = t.password ?? ""; u = `${H}:${K}@`; } const { port: l, method: f } = t, p = `${t.protocol}//${u}${t.hostname}${l ? `:${l}` : ""}${a}`, g = f === "GET" || f === "HEAD" ? void 0 : t.body, S = { body: g, headers: new Headers(t.headers), method: f, credentials: o }; (L = this.config) != null && L.cache && (S.cache = this.config.cache), g && (S.duplex = "half"), typeof AbortController < "u" && (S.signal = n), Sn.supported && (S.keepalive = i), typeof this.config.requestInit == "function" && Object.assign(S, this.config.requestInit(t)); let T = () => { }; const A = hs(p, S), I = [ fetch(A).then((H) => { const K = H.headers, he = {}; for (const Fe of K.entries()) he[Fe[0]] = Fe[1]; return H.body != null ? { response: new gt2({ headers: he, reason: H.statusText, statusCode: H.status, body: H.body }) } : H.blob().then((Fe) => ({ response: new gt2({ headers: he, reason: H.statusText, statusCode: H.status, body: Fe }) })); }), tu(s) ]; return n && I.push(new Promise((H, K) => { const he = () => { const pe = new Error("Request aborted"); pe.name = "AbortError", K(pe); }; if (typeof n.addEventListener == "function") { const pe = n; pe.addEventListener("abort", he, { once: true }), T = () => pe.removeEventListener("abort", he); } else n.onabort = he; })), Promise.race(I).finally(T); } updateHttpClientConfig(t, n) { this.config = void 0, this.configProvider = this.configProvider.then((r) => (r[t] = n, r)); } httpHandlerConfigs() { return this.config ?? {}; } }; var Co = async (e) => { var t; return typeof Blob == "function" && e instanceof Blob || ((t = e.constructor) == null ? void 0 : t.name) === "Blob" ? Blob.prototype.arrayBuffer !== void 0 ? new Uint8Array(await e.arrayBuffer()) : nu(e) : ru(e); }; async function nu(e) { const t = await su(e), n = Ar(t); return new Uint8Array(n); } async function ru(e) { const t = [], n = e.getReader(); let r = false, s = 0; for (; !r; ) { const { done: a, value: c } = await n.read(); c && (t.push(c), s += c.length), r = a; } const i = new Uint8Array(s); let o = 0; for (const a of t) i.set(a, o), o += a.length; return i; } function su(e) { return new Promise((t, n) => { const r = new FileReader(); r.onloadend = () => { if (r.readyState !== 2) return n(new Error("Reader aborted too early")); const s = r.result ?? "", i = s.indexOf(","), o = i > -1 ? i + 1 : s.length; t(s.substring(o)); }, r.onabort = () => n(new Error("Read aborted")), r.onerror = () => n(r.error), r.readAsDataURL(e); }); } var vo = {}; var cr = {}; for (let e = 0; e < 256; e++) { let t = e.toString(16).toLowerCase(); t.length === 1 && (t = `0${t}`), vo[e] = t, cr[t] = e; } function Ro(e) { if (e.length % 2 !== 0) throw new Error("Hex encoded strings must have an even number length"); const t = new Uint8Array(e.length / 2); for (let n = 0; n < e.length; n += 2) { const r = e.slice(n, n + 2).toLowerCase(); if (r in cr) t[n / 2] = cr[r]; else throw new Error(`Cannot decode unrecognized sequence ${r} as hexadecimal`); } return t; } function Re(e) { let t = ""; for (let n = 0; n < e.byteLength; n++) t += vo[e[n]]; return t; } var ps = "The stream has already been transformed."; var iu = (e) => { var s, i; if (!gs(e) && !ar(e)) { const o = ((i = (s = e == null ? void 0 : e.__proto__) == null ? void 0 : s.constructor) == null ? void 0 : i.name) || e; throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${o}`); } let t = false; const n = async () => { if (t) throw new Error(ps); return t = true, await Co(e); }, r = (o) => { if (typeof o.stream != "function") throw new Error(`Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled. If you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body`); return o.stream(); }; return Object.assign(e, { transformToByteArray: n, transformToString: async (o) => { const a = await n(); if (o === "base64") return cn(a); if (o === "hex") return Re(a); if (o === void 0 || o === "utf8" || o === "utf-8") return Cr(a); if (typeof TextDecoder == "function") return new TextDecoder(o).decode(a); throw new Error("TextDecoder is not available, please make sure polyfill is provided."); }, transformToWebStream: () => { if (t) throw new Error(ps); if (t = true, gs(e)) return r(e); if (ar(e)) return e; throw new Error(`Cannot transform payload to web stream, got ${e}`); } }); }; var gs = (e) => typeof Blob == "function" && e instanceof Blob; async function ou(e) { return typeof e.stream == "function" && (e = e.stream()), e.tee(); } var ko = async (e = new Uint8Array(), t) => { if (e instanceof Uint8Array) return st.mutate(e); if (!e) return st.mutate(new Uint8Array()); const n = t.streamCollector(e); return st.mutate(await n); }; function ms(e) { return encodeURIComponent(e).replace(/[!'()*]/g, function(t) { return "%" + t.charCodeAt(0).toString(16).toUpperCase(); }); } var To = (e) => { switch (e) { case "true": return true; case "false": return false; default: throw new Error(`Unable to parse boolean value "${e}"`); } }; var au = (e) => { if (e != null) { if (typeof e == "string") { const t = parseFloat(e); if (!Number.isNaN(t)) return String(t) !== String(e) && Po.warn(_o(`Expected number but observed string: ${e}`)), t; } if (typeof e == "number") return e; throw new TypeError(`Expected number, got ${typeof e}: ${e}`); } }; var cu = Math.ceil(2 ** 127 * (2 - 2 ** -23)); var ys = (e) => { const t = au(e); if (t !== void 0 && !Number.isNaN(t) && t !== 1 / 0 && t !== -1 / 0 && Math.abs(t) > cu) throw new TypeError(`Expected 32-bit float, got ${e}`); return t; }; var ur = (e) => { if (e != null) { if (Number.isInteger(e) && !Number.isNaN(e)) return e; throw new TypeError(`Expected integer, got ${typeof e}: ${e}`); } }; var ws = (e) => Bo(e, 16); var bs = (e) => Bo(e, 8); var Bo = (e, t) => { const n = ur(e); if (n !== void 0 && uu(n, t) !== n) throw new TypeError(`Expected ${t}-bit integer, got ${e}`); return n; }; var uu = (e, t) => { switch (t) { case 32: return Int32Array.of(e)[0]; case 16: return Int16Array.of(e)[0]; case 8: return Int8Array.of(e)[0]; } }; var Io = (e, t) => { if (e == null) throw t ? new TypeError(`Expected a non-null value for ${t}`) : new TypeError("Expected a non-null value"); return e; }; var du = (e) => { if (e == null) return; if (typeof e == "object" && !Array.isArray(e)) return e; const t = Array.isArray(e) ? "array" : typeof e; throw new TypeError(`Expected object, got ${t}: ${e}`); }; var It = (e) => { if (e != null) { if (typeof e == "string") return e; if (["boolean", "number", "bigint"].includes(typeof e)) return Po.warn(_o(`Expected string, got ${typeof e}: ${e}`)), String(e); throw new TypeError(`Expected string, got ${typeof e}: ${e}`); } }; var lu = (e) => ys(typeof e == "string" ? un(e) : e); var fu = /(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g; var un = (e) => { const t = e.match(fu); if (t === null || t[0].length !== e.length) throw new TypeError("Expected real number, got implicit NaN"); return parseFloat(e); }; var hu = (e) => ur(typeof e == "string" ? un(e) : e); var pu = (e) => ws(typeof e == "string" ? un(e) : e); var gu = (e) => bs(typeof e == "string" ? un(e) : e); var _o = (e) => String(new TypeError(e).stack || e).split(` `).slice(0, 5).filter((t) => !t.includes("stackTraceWarning")).join(` `); var Po = { warn: console.warn }; var mu = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; var No = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; function yu(e) { const t = e.getUTCFullYear(), n = e.getUTCMonth(), r = e.getUTCDay(), s = e.getUTCDate(), i = e.getUTCHours(), o = e.getUTCMinutes(), a = e.getUTCSeconds(), c = s < 10 ? `0${s}` : `${s}`, u = i < 10 ? `0${i}` : `${i}`, l = o < 10 ? `0${o}` : `${o}`, f = a < 10 ? `0${a}` : `${a}`; return `${mu[r]}, ${c} ${No[n]} ${t} ${u}:${l}:${f} GMT`; } var wu = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/); var bu = (e) => { if (e == null) return; if (typeof e != "string") throw new TypeError("RFC-3339 date-times must be expressed as strings"); const t = wu.exec(e); if (!t) throw new TypeError("Invalid RFC-3339 date-time value"); const [n, r, s, i, o, a, c, u, l] = t, f = pu(Mo(r)), p = _t(s, "month", 1, 12), g = _t(i, "day", 1, 31), S = Eu(f, p, g, { hours: o, minutes: a, seconds: c, fractionalMilliseconds: u }); return l.toUpperCase() != "Z" && S.setTime(S.getTime() - vu(l)), S; }; var Eu = (e, t, n, r) => { const s = t - 1; return Su(e, s, n), new Date(Date.UTC(e, s, n, _t(r.hours, "hour", 0, 23), _t(r.minutes, "minute", 0, 59), _t(r.seconds, "seconds", 0, 60), Cu(r.fractionalMilliseconds))); }; var xu = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; var Su = (e, t, n) => { let r = xu[t]; if (t === 1 && Au(e) && (r = 29), n > r) throw new TypeError(`Invalid day for ${No[t]} in ${e}: ${n}`); }; var Au = (e) => e % 4 === 0 && (e % 100 !== 0 || e % 400 === 0); var _t = (e, t, n, r) => { const s = gu(Mo(e)); if (s < n || s > r) throw new TypeError(`${t} must be between ${n} and ${r}, inclusive`); return s; }; var Cu = (e) => e == null ? 0 : lu("0." + e) * 1e3; var vu = (e) => { const t = e[0]; let n = 1; if (t == "+") n = 1; else if (t == "-") n = -1; else throw new TypeError(`Offset direction, ${t}, must be "+" or "-"`); const r = Number(e.substring(1, 3)), s = Number(e.substring(4, 6)); return n * (r * 60 + s) * 60 * 1e3; }; var Mo = (e) => { let t = 0; for (; t < e.length - 1 && e.charAt(t) === "0"; ) t++; return t === 0 ? e : e.slice(t); }; var Ru = (e, t, n, r, s, i) => { if (t != null && t[n] !== void 0) { const o = r(); if (o.length <= 0) throw new Error("Empty value provided for input HTTP label: " + n + "."); e = e.replace(s, i ? o.split("/").map((a) => ms(a)).join("/") : ms(o)); } else throw new Error("No value provided for input HTTP label: " + n + "."); return e; }; function Fo(e, t) { return new ku(e, t); } var ku = class { constructor(t, n) { this.input = t, this.context = n, this.query = {}, this.method = "", this.headers = {}, this.path = "", this.body = null, this.hostname = "", this.resolvePathStack = []; } async build() { const { hostname: t, protocol: n = "https", port: r, path: s } = await this.context.endpoint(); this.path = s; for (const i of this.resolvePathStack) i(this.path); return new se({ protocol: n, hostname: this.hostname || t, port: r, method: this.method, path: this.path, query: this.query, body: this.body, headers: this.headers }); } hn(t) { return this.hostname = t, this; } bp(t) { return this.resolvePathStack.push((n) => { this.path = `${n != null && n.endsWith("/") ? n.slice(0, -1) : n || ""}` + t; }), this; } p(t, n, r, s) { return this.resolvePathStack.push((i) => { this.path = Ru(i, this.input, t, n, r, s); }), this; } h(t) { return this.headers = t, this; } q(t) { return this.query = t, this; } b(t) { return this.body = t, this; } m(t) { return this.method = t, this; } }; function Tu(e, t, n) { e.__smithy_context ? e.__smithy_context.features || (e.__smithy_context.features = {}) : e.__smithy_context = { features: {} }, e.__smithy_context.features[t] = n; } var Bu = class { constructor(t) { this.authSchemes = /* @__PURE__ */ new Map(); for (const [n, r] of Object.entries(t)) r !== void 0 && this.authSchemes.set(n, r); } getIdentityProvider(t) { return this.authSchemes.get(t); } }; var Iu = (e) => (t) => Oo(t) && t.expiration.getTime() - Date.now() < e; var _u = 3e5; var Pu = Iu(_u); var Oo = (e) => e.expiration !== void 0; var Nu = (e, t, n) => { if (e === void 0) return; const r = typeof e != "function" ? async () => Promise.resolve(e) : e; let s, i, o, a = false; const c = async (u) => { i || (i = r(u)); try { s = await i, o = true, a = false; } finally { i = void 0; } return s; }; return t === void 0 ? async (u) => ((!o || u != null && u.forceRefresh) && (s = await c(u)), s) : async (u) => ((!o || u != null && u.forceRefresh) && (s = await c(u)), a ? s : n(s) ? (t(s) && await c(u), s) : (a = true, s)); }; var Mu = (e, t, n) => { let r, s, i, o = false; const a = async () => { s || (s = e()); try { r = await s, i = true, o = false; } finally { s = void 0; } return r; }; return t === void 0 ? async (c) => ((!i || c != null && c.forceRefresh) && (r = await a()), r) : async (c) => ((!i || c != null && c.forceRefresh) && (r = await a()), o ? r : n && !n(r) ? (o = true, r) : (t(r) && await a(), r)); }; var Fu = (e) => (e.sigv4aSigningRegionSet = ht(e.sigv4aSigningRegionSet), e); var Ou = "X-Amz-Algorithm"; var Du = "X-Amz-Credential"; var Do = "X-Amz-Date"; var Uu = "X-Amz-SignedHeaders"; var $u = "X-Amz-Expires"; var Uo = "X-Amz-Signature"; var $o = "X-Amz-Security-Token"; var Lo = "authorization"; var Ho = Do.toLowerCase(); var Lu = "date"; var Hu = [Lo, Ho, Lu]; var zu = Uo.toLowerCase(); var dr = "x-amz-content-sha256"; var ju = $o.toLowerCase(); var qu = { authorization: true, "cache-control": true, connection: true, expect: true, from: true, "keep-alive": true, "max-forwards": true, pragma: true, referer: true, te: true, trailer: true, "transfer-encoding": true, upgrade: true, "user-agent": true, "x-amzn-trace-id": true }; var Vu = /^proxy-/; var Wu = /^sec-/; var An = "AWS4-HMAC-SHA256"; var Ku = "AWS4-HMAC-SHA256-PAYLOAD"; var Gu = "UNSIGNED-PAYLOAD"; var Zu = 50; var zo = "aws4_request"; var Xu = 60 * 60 * 24 * 7; var Ut = {}; var Cn = []; var vn = (e, t, n) => `${e}/${t}/${n}/${zo}`; var Qu = async (e, t, n, r, s) => { const i = await Es(e, t.secretAccessKey, t.accessKeyId), o = `${n}:${r}:${s}:${Re(i)}:${t.sessionToken}`; if (o in Ut) return Ut[o]; for (Cn.push(o); Cn.length > Zu; ) delete Ut[Cn.shift()]; let a = `AWS4${t.secretAccessKey}`; for (const c of [n, r, s, zo]) a = await Es(e, a, c); return Ut[o] = a; }; var Es = (e, t, n) => { const r = new e(t); return r.update(yt2(n)), r.digest(); }; var xs = ({ headers: e }, t, n) => { const r = {}; for (const s of Object.keys(e).sort()) { if (e[s] == null) continue; const i = s.toLowerCase(); (i in qu || t != null && t.has(i) || Vu.test(i) || Wu.test(i)) && (!n || n && !n.has(i)) || (r[i] = e[s].trim().replace(/\s+/g, " ")); } return r; }; var jo = (e) => typeof ArrayBuffer == "function" && e instanceof ArrayBuffer || Object.prototype.toString.call(e) === "[object ArrayBuffer]"; var Rn = async ({ headers: e, body: t }, n) => { for (const r of Object.keys(e)) if (r.toLowerCase() === dr) return e[r]; if (t == null) return "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; if (typeof t == "string" || ArrayBuffer.isView(t) || jo(t)) { const r = new n(); return r.update(yt2(t)), Re(await r.digest()); } return Gu; }; var Yu = class { format(t) { const n = []; for (const i of Object.keys(t)) { const o = ot(i); n.push(Uint8Array.from([o.byteLength]), o, this.formatHeaderValue(t[i])); } const r = new Uint8Array(n.reduce((i, o) => i + o.byteLength, 0)); let s = 0; for (const i of n) r.set(i, s), s += i.byteLength; return r; } formatHeaderValue(t) { switch (t.type) { case "boolean": return Uint8Array.from([t.value ? 0 : 1]); case "byte": return Uint8Array.from([2, t.value]); case "short": const n = new DataView(new ArrayBuffer(3)); return n.setUint8(0, 3), n.setInt16(1, t.value, false), new Uint8Array(n.buffer); case "integer": const r = new DataView(new ArrayBuffer(5)); return r.setUint8(0, 4), r.setInt32(1, t.value, false), new Uint8Array(r.buffer); case "long": const s = new Uint8Array(9); return s[0] = 5, s.set(t.value.bytes, 1), s; case "binary": const i = new DataView(new ArrayBuffer(3 + t.value.byteLength)); i.setUint8(0, 6), i.setUint16(1, t.value.byteLength, false); const o = new Uint8Array(i.buffer); return o.set(t.value, 3), o; case "string": const a = ot(t.value), c = new DataView(new ArrayBuffer(3 + a.byteLength)); c.setUint8(0, 7), c.setUint16(1, a.byteLength, false); const u = new Uint8Array(c.buffer); return u.set(a, 3), u; case "timestamp": const l = new Uint8Array(9); return l[0] = 8, l.set(ed.fromNumber(t.value.valueOf()).bytes, 1), l; case "uuid": if (!Ju.test(t.value)) throw new Error(`Invalid UUID received: ${t.value}`); const f = new Uint8Array(17); return f[0] = 9, f.set(Ro(t.value.replace(/\-/g, "")), 1), f; } } }; var Ss; (function(e) { e[e.boolTrue = 0] = "boolTrue", e[e.boolFalse = 1] = "boolFalse", e[e.byte = 2] = "byte", e[e.short = 3] = "short", e[e.integer = 4] = "integer", e[e.long = 5] = "long", e[e.byteArray = 6] = "byteArray", e[e.string = 7] = "string", e[e.timestamp = 8] = "timestamp", e[e.uuid = 9] = "uuid"; })(Ss || (Ss = {})); var Ju = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/; var ed = class qo { constructor(t) { if (this.bytes = t, t.byteLength !== 8) throw new Error("Int64 buffers must be exactly 8 bytes"); } static fromNumber(t) { if (t > 9223372036854776e3 || t < -9223372036854776e3) throw new Error(`${t} is too large (or, if negative, too small) to represent as an Int64`); const n = new Uint8Array(8); for (let r = 7, s = Math.abs(Math.round(t)); r > -1 && s > 0; r--, s /= 256) n[r] = s; return t < 0 && As(n), new qo(n); } valueOf() { const t = this.bytes.slice(0), n = t[0] & 128; return n && As(t), parseInt(Re(t), 16) * (n ? -1 : 1); } toString() { return String(this.valueOf()); } }; function As(e) { for (let t = 0; t < 8; t++) e[t] ^= 255; for (let t = 7; t > -1 && (e[t]++, e[t] === 0); t--) ; } var td = (e, t) => { e = e.toLowerCase(); for (const n of Object.keys(t)) if (e === n.toLowerCase()) return true; return false; }; var nd = (e, t = {}) => { var s, i; const { headers: n, query: r = {} } = se.clone(e); for (const o of Object.keys(n)) { const a = o.toLowerCase(); (a.slice(0, 6) === "x-amz-" && !((s = t.unhoistableHeaders) != null && s.has(a)) || (i = t.hoistableHeaders) != null && i.has(a)) && (r[o] = n[o], delete n[o]); } return { ...e, headers: n, query: r }; }; var Cs = (e) => { e = se.clone(e); for (const t of Object.keys(e.headers)) Hu.indexOf(t.toLowerCase()) > -1 && delete e.headers[t]; return e; }; var rd = ({ query: e = {} }) => { const t = [], n = {}; for (const r of Object.keys(e)) { if (r.toLowerCase() === zu) continue; const s = it(r); t.push(s); const i = e[r]; typeof i == "string" ? n[s] = `${s}=${it(i)}` : Array.isArray(i) && (n[s] = i.slice(0).reduce((o, a) => o.concat([`${s}=${it(a)}`]), []).sort().join("&")); } return t.sort().map((r) => n[r]).filter((r) => r).join("&"); }; var sd = (e) => id(e).toISOString().replace(/\.\d{3}Z$/, "Z"); var id = (e) => typeof e == "number" ? new Date(e * 1e3) : typeof e == "string" ? Number(e) ? new Date(Number(e) * 1e3) : new Date(e) : e; var od = class { constructor({ applyChecksum: t, credentials: n, region: r, service: s, sha256: i, uriEscapePath: o = true }) { this.service = s, this.sha256 = i, this.uriEscapePath = o, this.applyChecksum = typeof t == "boolean" ? t : true, this.regionProvider = Ne(r), this.credentialProvider = Ne(n); } createCanonicalRequest(t, n, r) { const s = Object.keys(n).sort(); return `${t.method} ${this.getCanonicalPath(t)} ${rd(t)} ${s.map((i) => `${i}:${n[i]}`).join(` `)} ${s.join(";")} ${r}`; } async createStringToSign(t, n, r, s) { const i = new this.sha256(); i.update(yt2(r)); const o = await i.digest(); return `${s} ${t} ${n} ${Re(o)}`; } getCanonicalPath({ path: t }) { if (this.uriEscapePath) { const n = []; for (const i of t.split("/")) (i == null ? void 0 : i.length) !== 0 && i !== "." && (i === ".." ? n.pop() : n.push(i)); const r = `${t != null && t.startsWith("/") ? "/" : ""}${n.join("/")}${n.length > 0 && (t != null && t.endsWith("/")) ? "/" : ""}`; return it(r).replace(/%2F/g, "/"); } return t; } validateResolvedCredentials(t) { if (typeof t != "object" || typeof t.accessKeyId != "string" || typeof t.secretAccessKey != "string") throw new Error("Resolved credential object is not valid"); } formatDate(t) { const n = sd(t).replace(/[\-:]/g, ""); return { longDate: n, shortDate: n.slice(0, 8) }; } getCanonicalHeaderList(t) { return Object.keys(t).sort().join(";"); } }; var lr = class extends od { constructor({ applyChecksum: t, credentials: n, region: r, service: s, sha256: i, uriEscapePath: o = true }) { super({ applyChecksum: t, credentials: n, region: r, service: s, sha256: i, uriEscapePath: o }), this.headerFormatter = new Yu(); } async presign(t, n = {}) { const { signingDate: r = /* @__PURE__ */ new Date(), expiresIn: s = 3600, unsignableHeaders: i, unhoistableHeaders: o, signableHeaders: a, hoistableHeaders: c, signingRegion: u, signingService: l } = n, f = await this.credentialProvider(); this.validateResolvedCredentials(f); const p = u ?? await this.regionProvider(), { longDate: g, shortDate: S } = this.formatDate(r); if (s > Xu) return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future"); const T = vn(S, p, l ?? this.service), A = nd(Cs(t), { unhoistableHeaders: o, hoistableHeaders: c }); f.sessionToken && (A.query[$o] = f.sessionToken), A.query[Ou] = An, A.query[Du] = `${f.accessKeyId}/${T}`, A.query[Do] = g, A.query[$u] = s.toString(10); const I = xs(A, i, a); return A.query[Uu] = this.getCanonicalHeaderList(I), A.query[Uo] = await this.getSignature(g, T, this.getSigningKey(f, p, S, l), this.createCanonicalRequest(A, I, await Rn(t, this.sha256))), A; } async sign(t, n) { return typeof t == "string" ? this.signString(t, n) : t.headers && t.payload ? this.signEvent(t, n) : t.message ? this.signMessage(t, n) : this.signRequest(t, n); } async signEvent({ headers: t, payload: n }, { signingDate: r = /* @__PURE__ */ new Date(), priorSignature: s, signingRegion: i, signingService: o }) { const a = i ?? await this.regionProvider(), { shortDate: c, longDate: u } = this.formatDate(r), l = vn(c, a, o ?? this.service), f = await Rn({ headers: {}, body: n }, this.sha256), p = new this.sha256(); p.update(t); const g = Re(await p.digest()), S = [ Ku, u, l, s, g, f ].join(` `); return this.signString(S, { signingDate: r, signingRegion: a, signingService: o }); } async signMessage(t, { signingDate: n = /* @__PURE__ */ new Date(), signingRegion: r, signingService: s }) { return this.signEvent({ headers: this.headerFormatter.format(t.message.headers), payload: t.message.body }, { signingDate: n, signingRegion: r, signingService: s, priorSignature: t.priorSignature }).then((o) => ({ message: t.message, signature: o })); } async signString(t, { signingDate: n = /* @__PURE__ */ new Date(), signingRegion: r, signingService: s } = {}) { const i = await this.credentialProvider(); this.validateResolvedCredentials(i); const o = r ?? await this.regionProvider(), { shortDate: a } = this.formatDate(n), c = new this.sha256(await this.getSigningKey(i, o, a, s)); return c.update(yt2(t)), Re(await c.digest()); } async signRequest(t, { signingDate: n = /* @__PURE__ */ new Date(), signableHeaders: r, unsignableHeaders: s, signingRegion: i, signingService: o } = {}) { const a = await this.credentialProvider(); this.validateResolvedCredentials(a); const c = i ?? await this.regionProvider(), u = Cs(t), { longDate: l, shortDate: f } = this.formatDate(n), p = vn(f, c, o ?? this.service); u.headers[Ho] = l, a.sessionToken && (u.headers[ju] = a.sessionToken); const g = await Rn(u, this.sha256); !td(dr, u.headers) && this.applyChecksum && (u.headers[dr] = g); const S = xs(u, s, r), T = await this.getSignature(l, p, this.getSigningKey(a, c, f, o), this.createCanonicalRequest(u, S, g)); return u.headers[Lo] = `${An} Credential=${a.accessKeyId}/${p}, SignedHeaders=${this.getCanonicalHeaderList(S)}, Signature=${T}`, u; } async getSignature(t, n, r, s) { const i = await this.createStringToSign(t, n, s, An), o = new this.sha256(await r); return o.update(yt2(i)), Re(await o.digest()); } getSigningKey(t, n, r, s) { return Qu(this.sha256, t, r, n, s || this.service); } }; var ad = (e) => { let t = e.credentials, n = !!e.credentials, r; Object.defineProperty(e, "credentials", { set(u) { u && u !== t && u !== r && (n = true), t = u; const l = cd(e, { credentials: t, credentialDefaultProvider: e.credentialDefaultProvider }), f = ud(e, l); n && !f.attributed ? (r = async (p) => f(p).then((g) => vc(g, "CREDENTIALS_CODE", "e")), r.memoized = f.memoized, r.configBound = f.configBound, r.attributed = true) : r = f; }, get() { return r; }, enumerable: true, configurable: true }), e.credentials = t; const { signingEscapePath: s = true, systemClockOffset: i = e.systemClockOffset || 0, sha256: o } = e; let a; return e.signer ? a = ht(e.signer) : e.regionInfoProvider ? a = () => ht(e.region)().then(async (u) => [ await e.regionInfoProvider(u, { useFipsEndpoint: await e.useFipsEndpoint(), useDualstackEndpoint: await e.useDualstackEndpoint() }) || {}, u ]).then(([u, l]) => { const { signingRegion: f, signingService: p } = u; e.signingRegion = e.signingRegion || f || l, e.signingName = e.signingName || p || e.serviceId; const g = { ...e, credentials: e.credentials, region: e.signingRegion, service: e.signingName, sha256: o, uriEscapePath: s }, S = e.signerConstructor || lr; return new S(g); }) : a = async (u) => { u = Object.assign({}, { name: "sigv4", signingName: e.signingName || e.defaultSigningName, signingRegion: await ht(e.region)(), properties: {} }, u); const l = u.signingRegion, f = u.signingName; e.signingRegion = e.signingRegion || l, e.signingName = e.signingName || f || e.serviceId; const p = { ...e, credentials: e.credentials, region: e.signingRegion, service: e.signingName, sha256: o, uriEscapePath: s }, g = e.signerConstructor || lr; return new g(p); }, Object.assign(e, { systemClockOffset: i, signingEscapePath: s, signer: a }); }; function cd(e, { credentials: t, credentialDefaultProvider: n }) { let r; return t ? t != null && t.memoized ? r = t : r = Nu(t, Pu, Oo) : n ? r = ht(n(Object.assign({}, e, { parentClientConfig: e }))) : r = async () => { throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured."); }, r.memoized = true, r; } function ud(e, t) { if (t.configBound) return t; const n = async (r) => t({ ...r, callerClientConfig: e }); return n.memoized = t.memoized, n.configBound = true, n; } var vs = typeof TextEncoder == "function" ? new TextEncoder() : null; var dd = (e) => { if (typeof e == "string") { if (vs) return vs.encode(e).byteLength; let t = e.length; for (let n = t - 1; n >= 0; n--) { const r = e.charCodeAt(n); r > 127 && r <= 2047 ? t++ : r > 2047 && r <= 65535 && (t += 2), r >= 56320 && r <= 57343 && n--; } return t; } else { if (typeof e.byteLength == "number") return e.byteLength; if (typeof e.size == "number") return e.size; } throw new Error(`Body Length computation failed for ${e}`); }; var Qe = (e, t) => { const n = []; if (e && n.push(e), t) for (const r of t) n.push(r); return n; }; var Le = (e, t) => `${e || "anonymous"}${t && t.length > 0 ? ` (a.k.a. ${t.join(",")})` : ""}`; var Xt = () => { let e = [], t = [], n = false; const r = /* @__PURE__ */ new Set(), s = (f) => f.sort((p, g) => Rs[g.step] - Rs[p.step] || ks[g.priority || "normal"] - ks[p.priority || "normal"]), i = (f) => { let p = false; const g = (S) => { const T = Qe(S.name, S.aliases); if (T.includes(f)) { p = true; for (const A of T) r.delete(A); return false; } return true; }; return e = e.filter(g), t = t.filter(g), p; }, o = (f) => { let p = false; const g = (S) => { if (S.middleware === f) { p = true; for (const T of Qe(S.name, S.aliases)) r.delete(T); return false; } return true; }; return e = e.filter(g), t = t.filter(g), p; }, a = (f) => { var p; return e.forEach((g) => { f.add(g.middleware, { ...g }); }), t.forEach((g) => { f.addRelativeTo(g.middleware, { ...g }); }), (p = f.identifyOnResolve) == null || p.call(f, l.identifyOnResolve()), f; }, c = (f) => { const p = []; return f.before.forEach((g) => { g.before.length === 0 && g.after.length === 0 ? p.push(g) : p.push(...c(g)); }), p.push(f), f.after.reverse().forEach((g) => { g.before.length === 0 && g.after.length === 0 ? p.push(g) : p.push(...c(g)); }), p; }, u = (f = false) => { const p = [], g = [], S = {}; return e.forEach((A) => { const I = { ...A, before: [], after: [] }; for (const L of Qe(I.name, I.aliases)) S[L] = I; p.push(I); }), t.forEach((A) => { const I = { ...A, before: [], after: [] }; for (const L of Qe(I.name, I.aliases)) S[L] = I; g.push(I); }), g.forEach((A) => { if (A.toMiddleware) { const I = S[A.toMiddleware]; if (I === void 0) { if (f) return; throw new Error(`${A.toMiddleware} is not found when adding ${Le(A.name, A.aliases)} middleware ${A.relation} ${A.toMiddleware}`); } A.relation === "after" && I.after.push(A), A.relation === "before" && I.before.push(A); } }), s(p).map(c).reduce((A, I) => (A.push(...I), A), []); }, l = { add: (f, p = {}) => { const { name: g, override: S, aliases: T } = p, A = { step: "initialize", priority: "normal", middleware: f, ...p }, I = Qe(g, T); if (I.length > 0) { if (I.some((L) => r.has(L))) { if (!S) throw new Error(`Duplicate middleware name '${Le(g, T)}'`); for (const L of I) { const H = e.findIndex((he) => { var pe; return he.name === L || ((pe = he.aliases) == null ? void 0 : pe.some((Fe) => Fe === L)); }); if (H === -1) continue; const K = e[H]; if (K.step !== A.step || A.priority !== K.priority) throw new Error(`"${Le(K.name, K.aliases)}" middleware with ${K.priority} priority in ${K.step} step cannot be overridden by "${Le(g, T)}" middleware with ${A.priority} priority in ${A.step} step.`); e.splice(H, 1); } } for (const L of I) r.add(L); } e.push(A); }, addRelativeTo: (f, p) => { const { name: g, override: S, aliases: T } = p, A = { middleware: f, ...p }, I = Qe(g, T); if (I.length > 0) { if (I.some((L) => r.has(L))) { if (!S) throw new Error(`Duplicate middleware name '${Le(g, T)}'`); for (const L of I) { const H = t.findIndex((he) => { var pe; return he.name === L || ((pe = he.aliases) == null ? void 0 : pe.some((Fe) => Fe === L)); }); if (H === -1) continue; const K = t[H]; if (K.toMiddleware !== A.toMiddleware || K.relation !== A.relation) throw new Error(`"${Le(K.name, K.aliases)}" middleware ${K.relation} "${K.toMiddleware}" middleware cannot be overridden by "${Le(g, T)}" middleware ${A.relation} "${A.toMiddleware}" middleware.`); t.splice(H, 1); } } for (const L of I) r.add(L); } t.push(A); }, clone: () => a(Xt()), use: (f) => { f.applyToStack(l); }, remove: (f) => typeof f == "string" ? i(f) : o(f), removeByTag: (f) => { let p = false; const g = (S) => { const { tags: T, name: A, aliases: I } = S; if (T && T.includes(f)) { const L = Qe(A, I); for (const H of L) r.delete(H); return p = true, false; } return true; }; return e = e.filter(g), t = t.filter(g), p; }, concat: (f) => { var g; const p = a(Xt()); return p.use(f), p.identifyOnResolve(n || p.identifyOnResolve() || (((g = f.identifyOnResolve) == null ? void 0 : g.call(f)) ?? false)), p; }, applyToStack: a, identify: () => u(true).map((f) => { const p = f.step ?? f.relation + " " + f.toMiddleware; return Le(f.name, f.aliases) + " - " + p; }), identifyOnResolve(f) { return typeof f == "boolean" && (n = f), n; }, resolve: (f, p) => { for (const g of u().map((S) => S.middleware).reverse()) f = g(f, p); return f; } }; return l; }; var Rs = { initialize: 5, serialize: 4, build: 3, finalizeRequest: 2, deserialize: 1 }; var ks = { high: 3, normal: 2, low: 1 }; var ld = class { constructor(t) { this.config = t, this.middlewareStack = Xt(); } send(t, n, r) { const s = typeof n != "function" ? n : void 0, i = typeof n == "function" ? n : r, o = s === void 0 && this.config.cacheMiddleware === true; let a; if (o) { this.handlers || (this.handlers = /* @__PURE__ */ new WeakMap()); const c = this.handlers; c.has(t.constructor) ? a = c.get(t.constructor) : (a = t.resolveMiddleware(this.middlewareStack, this.config, s), c.set(t.constructor, a)); } else delete this.handlers, a = t.resolveMiddleware(this.middlewareStack, this.config, s); if (i) a(t).then((c) => i(null, c.output), (c) => i(c)).catch(() => { }); else return a(t).then((c) => c.output); } destroy() { var t, n, r; (r = (n = (t = this.config) == null ? void 0 : t.requestHandler) == null ? void 0 : n.destroy) == null || r.call(n), delete this.handlers; } }; var Rr = class { constructor() { this.middlewareStack = Xt(); } static classBuilder() { return new fd(); } resolveMiddlewareWithContext(t, n, r, { middlewareFn: s, clientName: i, commandName: o, inputFilterSensitiveLog: a, outputFilterSensitiveLog: c, smithyContext: u, additionalContext: l, CommandCtor: f }) { for (const A of s.bind(this)(f, t, n, r)) this.middlewareStack.use(A); const p = t.concat(this.middlewareStack), { logger: g } = n, S = { logger: g, clientName: i, commandName: o, inputFilterSensitiveLog: a, outputFilterSensitiveLog: c, [ir]: { commandInstance: this, ...u }, ...l }, { requestHandler: T } = n; return p.resolve((A) => T.handle(A.request, r || {}), S); } }; var fd = class { constructor() { this._init = () => { }, this._ep = {}, this._middlewareFn = () => [], this._commandName = "", this._clientName = "", this._additionalContext = {}, this._smithyContext = {}, this._inputFilterSensitiveLog = (t) => t, this._outputFilterSensitiveLog = (t) => t, this._serializer = null, this._deserializer = null; } init(t) { this._init = t; } ep(t) { return this._ep = t, this; } m(t) { return this._middlewareFn = t, this; } s(t, n, r = {}) { return this._smithyContext = { service: t, operation: n, ...r }, this; } c(t = {}) { return this._additionalContext = t, this; } n(t, n) { return this._clientName = t, this._commandName = n, this; } f(t = (r) => r, n = (r) => r) { return this._inputFilterSensitiveLog = t, this._outputFilterSensitiveLog = n, this; } ser(t) { return this._serializer = t, this; } de(t) { return this._deserializer = t, this; } sc(t) { return this._operationSchema = t, this._smithyContext.operationSchema = t, this; } build() { const t = this; let n; return n = class extends Rr { static getEndpointParameterInstructions() { return t._ep; } constructor(...[r]) { super(), this.serialize = t._serializer, this.deserialize = t._deserializer, this.input = r ?? {}, t._init(this), this.schema = t._operationSchema; } resolveMiddleware(r, s, i) { return this.resolveMiddlewareWithContext(r, s, i, { CommandCtor: n, middlewareFn: t._middlewareFn, clientName: t._clientName, commandName: t._commandName, inputFilterSensitiveLog: t._inputFilterSensitiveLog, outputFilterSensitiveLog: t._outputFilterSensitiveLog, smithyContext: t._smithyContext, additionalContext: t._additionalContext }); } }; } }; var Me = "***SensitiveInformation***"; var ft = class _ft extends Error { constructor(t) { super(t.message), Object.setPrototypeOf(this, Object.getPrototypeOf(this).constructor.prototype), this.name = t.name, this.$fault = t.$fault, this.$metadata = t.$metadata; } static isInstance(t) { if (!t) return false; const n = t; return _ft.prototype.isPrototypeOf(n) || !!n.$fault && !!n.$metadata && (n.$fault === "client" || n.$fault === "server"); } static [Symbol.hasInstance](t) { if (!t) return false; const n = t; return this === _ft ? _ft.isInstance(t) : _ft.isInstance(t) ? n.name && this.name ? this.prototype.isPrototypeOf(t) || n.name === this.name : this.prototype.isPrototypeOf(t) : false; } }; var ve = (e, t = {}) => { Object.entries(t).filter(([, r]) => r !== void 0).forEach(([r, s]) => { (e[r] == null || e[r] === "") && (e[r] = s); }); const n = e.message || e.Message || "UnknownError"; return e.message = n, delete e.Message, e; }; var hd = ({ output: e, parsedBody: t, exceptionCtor: n, errorCode: r }) => { const s = gd(e), i = s.httpStatusCode ? s.httpStatusCode + "" : void 0, o = new n({ name: (t == null ? void 0 : t.code) || (t == null ? void 0 : t.Code) || r || i || "UnknownError", $fault: "client", $metadata: s }); throw ve(o, t); }; var pd = (e) => ({ output: t, parsedBody: n, errorCode: r }) => { hd({ output: t, parsedBody: n, exceptionCtor: e, errorCode: r }); }; var gd = (e) => ({ httpStatusCode: e.statusCode, requestId: e.headers["x-amzn-requestid"] ?? e.headers["x-amzn-request-id"] ?? e.headers["x-amz-request-id"], extendedRequestId: e.headers["x-amz-id-2"], cfId: e.headers["x-amz-cf-id"] }); var md = (e) => { switch (e) { case "standard": return { retryMode: "standard", connectionTimeout: 3100 }; case "in-region": return { retryMode: "standard", connectionTimeout: 1100 }; case "cross-region": return { retryMode: "standard", connectionTimeout: 3100 }; case "mobile": return { retryMode: "standard", connectionTimeout: 3e4 }; default: return {}; } }; var yd = (e) => { const t = []; for (const n in Zt) { const r = Zt[n]; e[r] !== void 0 && t.push({ algorithmId: () => r, checksumConstructor: () => e[r] }); } return { addChecksumAlgorithm(n) { t.push(n); }, checksumAlgorithms() { return t; } }; }; var wd = (e) => { const t = {}; return e.checksumAlgorithms().forEach((n) => { t[n.algorithmId()] = n.checksumConstructor(); }), t; }; var bd = (e) => ({ setRetryStrategy(t) { e.retryStrategy = t; }, retryStrategy() { return e.retryStrategy; } }); var Ed = (e) => { const t = {}; return t.retryStrategy = e.retryStrategy(), t; }; var xd = (e) => Object.assign(yd(e), bd(e)); var Sd = (e) => Object.assign(wd(e), Ed(e)); var Vo = (e) => { const t = "#text"; for (const n in e) e.hasOwnProperty(n) && e[n][t] !== void 0 ? e[n] = e[n][t] : typeof e[n] == "object" && e[n] !== null && (e[n] = Vo(e[n])); return e; }; var Ve = (e) => e != null; var kr = class { trace() { } debug() { } info() { } warn() { } error() { } }; function ee(e, t, n) { let r, s, i; if (typeof t > "u" && typeof n > "u") r = {}, i = e; else { if (r = e, typeof t == "function") return s = t, i = n, Ad(r, s, i); i = t; } for (const o of Object.keys(i)) { if (!Array.isArray(i[o])) { r[o] = i[o]; continue; } Cd(r, null, i, o); } return r; } var Ad = (e, t, n) => ee(e, Object.entries(n).reduce((r, [s, i]) => (Array.isArray(i) ? r[s] = i : typeof i == "function" ? r[s] = [t, i()] : r[s] = [t, i], r), {})); var Cd = (e, t, n, r) => { if (t !== null) { let o = n[r]; typeof o == "function" && (o = [, o]); const [a = vd, c = Rd, u = r] = o; (typeof a == "function" && a(t[u]) || typeof a != "function" && a) && (e[r] = c(t[u])); return; } let [s, i] = n[r]; if (typeof i == "function") { let o; const a = s === void 0 && (o = i()) != null, c = typeof s == "function" && !!s(void 0) || typeof s != "function" && !!s; a ? e[r] = o : c && (e[r] = i()); } else { const o = s === void 0 && i != null, a = typeof s == "function" && !!s(i) || typeof s != "function" && !!s; (o || a) && (e[r] = i); } }; var vd = (e) => e != null; var Rd = (e) => e; var kd = (e) => e.toISOString().replace(".000Z", "Z"); var Td = (e, t) => ko(e, t).then((n) => t.utf8Encoder(n)); var Wo = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD"; var Bd = Wo + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040"; var Id = "[" + Wo + "][" + Bd + "]*"; var _d = new RegExp("^" + Id + "$"); function Ko(e, t) { const n = []; let r = t.exec(e); for (; r; ) { const s = []; s.startIndex = t.lastIndex - r[0].length; const i = r.length; for (let o = 0; o < i; o++) s.push(r[o]); n.push(s), r = t.exec(e); } return n; } var Tr = function(e) { const t = _d.exec(e); return !(t === null || typeof t > "u"); }; function Pd(e) { return typeof e < "u"; } var Nd = { allowBooleanAttributes: false, //A tag can have attributes without any value unpairedTags: [] }; function Md(e, t) { t = Object.assign({}, Nd, t); const n = []; let r = false, s = false; e[0] === "\uFEFF" && (e = e.substr(1)); for (let i = 0; i < e.length; i++) if (e[i] === "<" && e[i + 1] === "?") { if (i += 2, i = Bs(e, i), i.err) return i; } else if (e[i] === "<") { let o = i; if (i++, e[i] === "!") { i = Is(e, i); continue; } else { let a = false; e[i] === "/" && (a = true, i++); let c = ""; for (; i < e.length && e[i] !== ">" && e[i] !== " " && e[i] !== " " && e[i] !== ` ` && e[i] !== "\r"; i++) c += e[i]; if (c = c.trim(), c[c.length - 1] === "/" && (c = c.substring(0, c.length - 1), i--), !zd(c)) { let f; return c.trim().length === 0 ? f = "Invalid space after '<'." : f = "Tag '" + c + "' is an invalid name.", Q("InvalidTag", f, xe(e, i)); } const u = Dd(e, i); if (u === false) return Q("InvalidAttr", "Attributes for '" + c + "' have open quote.", xe(e, i)); let l = u.value; if (i = u.index, l[l.length - 1] === "/") { const f = i - l.length; l = l.substring(0, l.length - 1); const p = _s(l, t); if (p === true) r = true; else return Q(p.err.code, p.err.msg, xe(e, f + p.err.line)); } else if (a) if (u.tagClosed) { if (l.trim().length > 0) return Q("InvalidTag", "Closing tag '" + c + "' can't have attributes or invalid starting.", xe(e, o)); if (n.length === 0) return Q("InvalidTag", "Closing tag '" + c + "' has not been opened.", xe(e, o)); { const f = n.pop(); if (c !== f.tagName) { let p = xe(e, f.tagStartPos); return Q( "InvalidTag", "Expected closing tag '" + f.tagName + "' (opened in line " + p.line + ", col " + p.col + ") instead of closing tag '" + c + "'.", xe(e, o) ); } n.length == 0 && (s = true); } } else return Q("InvalidTag", "Closing tag '" + c + "' doesn't have proper closing.", xe(e, i)); else { const f = _s(l, t); if (f !== true) return Q(f.err.code, f.err.msg, xe(e, i - l.length + f.err.line)); if (s === true) return Q("InvalidXml", "Multiple possible root nodes found.", xe(e, i)); t.unpairedTags.indexOf(c) !== -1 || n.push({ tagName: c, tagStartPos: o }), r = true; } for (i++; i < e.length; i++) if (e[i] === "<") if (e[i + 1] === "!") { i++, i = Is(e, i); continue; } else if (e[i + 1] === "?") { if (i = Bs(e, ++i), i.err) return i; } else break; else if (e[i] === "&") { const f = Ld(e, i); if (f == -1) return Q("InvalidChar", "char '&' is not expected.", xe(e, i)); i = f; } else if (s === true && !Ts(e[i])) return Q("InvalidXml", "Extra text at the end", xe(e, i)); e[i] === "<" && i--; } } else { if (Ts(e[i])) continue; return Q("InvalidChar", "char '" + e[i] + "' is not expected.", xe(e, i)); } if (r) { if (n.length == 1) return Q("InvalidTag", "Unclosed tag '" + n[0].tagName + "'.", xe(e, n[0].tagStartPos)); if (n.length > 0) return Q("InvalidXml", "Invalid '" + JSON.stringify(n.map((i) => i.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }); } else return Q("InvalidXml", "Start tag expected.", 1); return true; } function Ts(e) { return e === " " || e === " " || e === ` ` || e === "\r"; } function Bs(e, t) { const n = t; for (; t < e.length; t++) if (e[t] == "?" || e[t] == " ") { const r = e.substr(n, t - n); if (t > 5 && r === "xml") return Q("InvalidXml", "XML declaration allowed only at the start of the document.", xe(e, t)); if (e[t] == "?" && e[t + 1] == ">") { t++; break; } else continue; } return t; } function Is(e, t) { if (e.length > t + 5 && e[t + 1] === "-" && e[t + 2] === "-") { for (t += 3; t < e.length; t++) if (e[t] === "-" && e[t + 1] === "-" && e[t + 2] === ">") { t += 2; break; } } else if (e.length > t + 8 && e[t + 1] === "D" && e[t + 2] === "O" && e[t + 3] === "C" && e[t + 4] === "T" && e[t + 5] === "Y" && e[t + 6] === "P" && e[t + 7] === "E") { let n = 1; for (t += 8; t < e.length; t++) if (e[t] === "<") n++; else if (e[t] === ">" && (n--, n === 0)) break; } else if (e.length > t + 9 && e[t + 1] === "[" && e[t + 2] === "C" && e[t + 3] === "D" && e[t + 4] === "A" && e[t + 5] === "T" && e[t + 6] === "A" && e[t + 7] === "[") { for (t += 8; t < e.length; t++) if (e[t] === "]" && e[t + 1] === "]" && e[t + 2] === ">") { t += 2; break; } } return t; } var Fd = '"'; var Od = "'"; function Dd(e, t) { let n = "", r = "", s = false; for (; t < e.length; t++) { if (e[t] === Fd || e[t] === Od) r === "" ? r = e[t] : r !== e[t] || (r = ""); else if (e[t] === ">" && r === "") { s = true; break; } n += e[t]; } return r !== "" ? false : { value: n, index: t, tagClosed: s }; } var Ud = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); function _s(e, t) { const n = Ko(e, Ud), r = {}; for (let s = 0; s < n.length; s++) { if (n[s][1].length === 0) return Q("InvalidAttr", "Attribute '" + n[s][2] + "' has no space in starting.", Ct(n[s])); if (n[s][3] !== void 0 && n[s][4] === void 0) return Q("InvalidAttr", "Attribute '" + n[s][2] + "' is without value.", Ct(n[s])); if (n[s][3] === void 0 && !t.allowBooleanAttributes) return Q("InvalidAttr", "boolean attribute '" + n[s][2] + "' is not allowed.", Ct(n[s])); const i = n[s][2]; if (!Hd(i)) return Q("InvalidAttr", "Attribute '" + i + "' is an invalid name.", Ct(n[s])); if (!r.hasOwnProperty(i)) r[i] = 1; else return Q("InvalidAttr", "Attribute '" + i + "' is repeated.", Ct(n[s])); } return true; } function $d(e, t) { let n = /\d/; for (e[t] === "x" && (t++, n = /[\da-fA-F]/); t < e.length; t++) { if (e[t] === ";") return t; if (!e[t].match(n)) break; } return -1; } function Ld(e, t) { if (t++, e[t] === ";") return -1; if (e[t] === "#") return t++, $d(e, t); let n = 0; for (; t < e.length; t++, n++) if (!(e[t].match(/\w/) && n < 20)) { if (e[t] === ";") break; return -1; } return t; } function Q(e, t, n) { return { err: { code: e, msg: t, line: n.line || n, col: n.col } }; } function Hd(e) { return Tr(e); } function zd(e) { return Tr(e); } function xe(e, t) { const n = e.substring(0, t).split(/\r?\n/); return { line: n.length, // column number is last line's length + 1, because column numbering starts at 1: col: n[n.length - 1].length + 1 }; } function Ct(e) { return e.startIndex + e[1].length; } var jd = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, // remove NS from tag name or attribute name if true allowBooleanAttributes: false, //a tag can have attributes without any value //ignoreRootElement : false, parseTagValue: true, parseAttributeValue: false, trimValues: true, //Trim string values of tag and attributes cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(e, t) { return t; }, attributeValueProcessor: function(e, t) { return t; }, stopNodes: [], //nested tags will not be parsed even for errors alwaysCreateTextNode: false, isArray: () => false, commentPropName: false, unpairedTags: [], processEntities: true, htmlEntities: false, ignoreDeclaration: false, ignorePiTags: false, transformTagName: false, transformAttributeName: false, updateTag: function(e, t, n) { return e; }, // skipEmptyListItem: false captureMetaData: false }; var qd = function(e) { return Object.assign({}, jd, e); }; var Qt; typeof Symbol != "function" ? Qt = "@@xmlMetadata" : Qt = Symbol("XML Node Metadata"); var Je = class { constructor(t) { this.tagname = t, this.child = [], this[":@"] = {}; } add(t, n) { t === "__proto__" && (t = "#__proto__"), this.child.push({ [t]: n }); } addChild(t, n) { t.tagname === "__proto__" && (t.tagname = "#__proto__"), t[":@"] && Object.keys(t[":@"]).length > 0 ? this.child.push({ [t.tagname]: t.child, ":@": t[":@"] }) : this.child.push({ [t.tagname]: t.child }), n !== void 0 && (this.child[this.child.length - 1][Qt] = { startIndex: n }); } /** symbol used for metadata */ static getMetaDataSymbol() { return Qt; } }; function Vd(e, t) { const n = {}; if (e[t + 3] === "O" && e[t + 4] === "C" && e[t + 5] === "T" && e[t + 6] === "Y" && e[t + 7] === "P" && e[t + 8] === "E") { t = t + 9; let r = 1, s = false, i = false, o = ""; for (; t < e.length; t++) if (e[t] === "<" && !i) { if (s && et(e, "!ENTITY", t)) { t += 7; let a, c; [a, c, t] = Wd(e, t + 1), c.indexOf("&") === -1 && (n[a] = { regx: RegExp(`&${a};`, "g"), val: c }); } else if (s && et(e, "!ELEMENT", t)) { t += 8; const { index: a } = Gd(e, t + 1); t = a; } else if (s && et(e, "!ATTLIST", t)) t += 8; else if (s && et(e, "!NOTATION", t)) { t += 9; const { index: a } = Kd(e, t + 1); t = a; } else if (et(e, "!--", t)) i = true; else throw new Error("Invalid DOCTYPE"); r++, o = ""; } else if (e[t] === ">") { if (i ? e[t - 1] === "-" && e[t - 2] === "-" && (i = false, r--) : r--, r === 0) break; } else e[t] === "[" ? s = true : o += e[t]; if (r !== 0) throw new Error("Unclosed DOCTYPE"); } else throw new Error("Invalid Tag instead of DOCTYPE"); return { entities: n, i: t }; } var We = (e, t) => { for (; t < e.length && /\s/.test(e[t]); ) t++; return t; }; function Wd(e, t) { t = We(e, t); let n = ""; for (; t < e.length && !/\s/.test(e[t]) && e[t] !== '"' && e[t] !== "'"; ) n += e[t], t++; if (Br(n), t = We(e, t), e.substring(t, t + 6).toUpperCase() === "SYSTEM") throw new Error("External entities are not supported"); if (e[t] === "%") throw new Error("Parameter entities are not supported"); let r = ""; return [t, r] = qt(e, t, "entity"), t--, [n, r, t]; } function Kd(e, t) { t = We(e, t); let n = ""; for (; t < e.length && !/\s/.test(e[t]); ) n += e[t], t++; Br(n), t = We(e, t); const r = e.substring(t, t + 6).toUpperCase(); if (r !== "SYSTEM" && r !== "PUBLIC") throw new Error(`Expected SYSTEM or PUBLIC, found "${r}"`); t += r.length, t = We(e, t); let s = null, i = null; if (r === "PUBLIC") [t, s] = qt(e, t, "publicIdentifier"), t = We(e, t), (e[t] === '"' || e[t] === "'") && ([t, i] = qt(e, t, "systemIdentifier")); else if (r === "SYSTEM" && ([t, i] = qt(e, t, "systemIdentifier"), !i)) throw new Error("Missing mandatory system identifier for SYSTEM notation"); return { notationName: n, publicIdentifier: s, systemIdentifier: i, index: --t }; } function qt(e, t, n) { let r = ""; const s = e[t]; if (s !== '"' && s !== "'") throw new Error(`Expected quoted string, found "${s}"`); for (t++; t < e.length && e[t] !== s; ) r += e[t], t++; if (e[t] !== s) throw new Error(`Unterminated ${n} value`); return t++, [t, r]; } function Gd(e, t) { t = We(e, t); let n = ""; for (; t < e.length && !/\s/.test(e[t]); ) n += e[t], t++; if (!Br(n)) throw new Error(`Invalid element name: "${n}"`); t = We(e, t); let r = ""; if (e[t] === "E" && et(e, "MPTY", t)) t += 4; else if (e[t] === "A" && et(e, "NY", t)) t += 2; else if (e[t] === "(") { for (t++; t < e.length && e[t] !== ")"; ) r += e[t], t++; if (e[t] !== ")") throw new Error("Unterminated content model"); } else throw new Error(`Invalid Element Expression, found "${e[t]}"`); return { elementName: n, contentModel: r.trim(), index: t }; } function et(e, t, n) { for (let r = 0; r < t.length; r++) if (t[r] !== e[n + r + 1]) return false; return true; } function Br(e) { if (Tr(e)) return e; throw new Error(`Invalid entity name ${e}`); } var Zd = /^[-+]?0x[a-fA-F0-9]+$/; var Xd = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/; var Qd = { hex: true, // oct: false, leadingZeros: true, decimalPoint: ".", eNotation: true //skipLike: /regex/ }; function Yd(e, t = {}) { if (t = Object.assign({}, Qd, t), !e || typeof e != "string") return e; let n = e.trim(); if (t.skipLike !== void 0 && t.skipLike.test(n)) return e; if (e === "0") return 0; if (t.hex && Zd.test(n)) return nl(n, 16); if (n.search(/.+[eE].+/) !== -1) return el(e, n, t); { const r = Xd.exec(n); if (r) { const s = r[1] || "", i = r[2]; let o = tl(r[3]); const a = s ? ( // 0., -00., 000. e[i.length + 1] === "." ) : e[i.length] === "."; if (!t.leadingZeros && (i.length > 1 || i.length === 1 && !a)) return e; { const c = Number(n), u = String(c); if (c === 0) return c; if (u.search(/[eE]/) !== -1) return t.eNotation ? c : e; if (n.indexOf(".") !== -1) return u === "0" || u === o || u === `${s}${o}` ? c : e; let l = i ? o : n; return i ? l === u || s + l === u ? c : e : l === u || l === s + u ? c : e; } } else return e; } } var Jd = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; function el(e, t, n) { if (!n.eNotation) return e; const r = t.match(Jd); if (r) { let s = r[1] || ""; const i = r[3].indexOf("e") === -1 ? "E" : "e", o = r[2], a = s ? ( // 0E. e[o.length + 1] === i ) : e[o.length] === i; return o.length > 1 && a ? e : o.length === 1 && (r[3].startsWith(`.${i}`) || r[3][0] === i) ? Number(t) : n.leadingZeros && !a ? (t = (r[1] || "") + r[3], Number(t)) : e; } else return e; } function tl(e) { return e && e.indexOf(".") !== -1 && (e = e.replace(/0+$/, ""), e === "." ? e = "0" : e[0] === "." ? e = "0" + e : e[e.length - 1] === "." && (e = e.substring(0, e.length - 1))), e; } function nl(e, t) { if (parseInt) return parseInt(e, t); if (Number.parseInt) return Number.parseInt(e, t); if (window && window.parseInt) return window.parseInt(e, t); throw new Error("parseInt, Number.parseInt, window.parseInt are not supported"); } function rl(e) { return typeof e == "function" ? e : Array.isArray(e) ? (t) => { for (const n of e) if (typeof n == "string" && t === n || n instanceof RegExp && n.test(t)) return true; } : () => false; } var sl = class { constructor(t) { this.options = t, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, // "lt" : { regex: /&(lt|#60);/g, val: "<" }, // "gt" : { regex: /&(gt|#62);/g, val: ">" }, // "amp" : { regex: /&(amp|#38);/g, val: "&" }, // "quot" : { regex: /&(quot|#34);/g, val: "\"" }, // "apos" : { regex: /&(apos|#39);/g, val: "'" }, cent: { regex: /&(cent|#162);/g, val: "¢" }, pound: { regex: /&(pound|#163);/g, val: "£" }, yen: { regex: /&(yen|#165);/g, val: "¥" }, euro: { regex: /&(euro|#8364);/g, val: "€" }, copyright: { regex: /&(copy|#169);/g, val: "©" }, reg: { regex: /&(reg|#174);/g, val: "®" }, inr: { regex: /&(inr|#8377);/g, val: "₹" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (n, r) => String.fromCodePoint(Number.parseInt(r, 10)) }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (n, r) => String.fromCodePoint(Number.parseInt(r, 16)) } }, this.addExternalEntities = il, this.parseXml = dl, this.parseTextData = ol, this.resolveNameSpace = al, this.buildAttributesMap = ul, this.isItStopNode = pl, this.replaceEntitiesValue = fl, this.readStopNodeData = ml, this.saveTextToParentTag = hl, this.addChild = ll, this.ignoreAttributesFn = rl(this.options.ignoreAttributes); } }; function il(e) { const t = Object.keys(e); for (let n = 0; n < t.length; n++) { const r = t[n]; this.lastEntities[r] = { regex: new RegExp("&" + r + ";", "g"), val: e[r] }; } } function ol(e, t, n, r, s, i, o) { if (e !== void 0 && (this.options.trimValues && !r && (e = e.trim()), e.length > 0)) { o || (e = this.replaceEntitiesValue(e)); const a = this.options.tagValueProcessor(t, e, n, s, i); return a == null ? e : typeof a != typeof e || a !== e ? a : this.options.trimValues ? hr(e, this.options.parseTagValue, this.options.numberParseOptions) : e.trim() === e ? hr(e, this.options.parseTagValue, this.options.numberParseOptions) : e; } } function al(e) { if (this.options.removeNSPrefix) { const t = e.split(":"), n = e.charAt(0) === "/" ? "/" : ""; if (t[0] === "xmlns") return ""; t.length === 2 && (e = n + t[1]); } return e; } var cl = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); function ul(e, t, n) { if (this.options.ignoreAttributes !== true && typeof e == "string") { const r = Ko(e, cl), s = r.length, i = {}; for (let o = 0; o < s; o++) { const a = this.resolveNameSpace(r[o][1]); if (this.ignoreAttributesFn(a, t)) continue; let c = r[o][4], u = this.options.attributeNamePrefix + a; if (a.length) if (this.options.transformAttributeName && (u = this.options.transformAttributeName(u)), u === "__proto__" && (u = "#__proto__"), c !== void 0) { this.options.trimValues && (c = c.trim()), c = this.replaceEntitiesValue(c); const l = this.options.attributeValueProcessor(a, c, t); l == null ? i[u] = c : typeof l != typeof c || l !== c ? i[u] = l : i[u] = hr( c, this.options.parseAttributeValue, this.options.numberParseOptions ); } else this.options.allowBooleanAttributes && (i[u] = true); } if (!Object.keys(i).length) return; if (this.options.attributesGroupName) { const o = {}; return o[this.options.attributesGroupName] = i, o; } return i; } } var dl = function(e) { e = e.replace(/\r\n?/g, ` `); const t = new Je("!xml"); let n = t, r = "", s = ""; for (let i = 0; i < e.length; i++) if (e[i] === "<") if (e[i + 1] === "/") { const a = nt(e, ">", i, "Closing Tag is not closed."); let c = e.substring(i + 2, a).trim(); if (this.options.removeNSPrefix) { const f = c.indexOf(":"); f !== -1 && (c = c.substr(f + 1)); } this.options.transformTagName && (c = this.options.transformTagName(c)), n && (r = this.saveTextToParentTag(r, n, s)); const u = s.substring(s.lastIndexOf(".") + 1); if (c && this.options.unpairedTags.indexOf(c) !== -1) throw new Error(`Unpaired tag can not be used as closing tag: `); let l = 0; u && this.options.unpairedTags.indexOf(u) !== -1 ? (l = s.lastIndexOf(".", s.lastIndexOf(".") - 1), this.tagsNodeStack.pop()) : l = s.lastIndexOf("."), s = s.substring(0, l), n = this.tagsNodeStack.pop(), r = "", i = a; } else if (e[i + 1] === "?") { let a = fr(e, i, false, "?>"); if (!a) throw new Error("Pi Tag is not closed."); if (r = this.saveTextToParentTag(r, n, s), !(this.options.ignoreDeclaration && a.tagName === "?xml" || this.options.ignorePiTags)) { const c = new Je(a.tagName); c.add(this.options.textNodeName, ""), a.tagName !== a.tagExp && a.attrExpPresent && (c[":@"] = this.buildAttributesMap(a.tagExp, s, a.tagName)), this.addChild(n, c, s, i); } i = a.closeIndex + 1; } else if (e.substr(i + 1, 3) === "!--") { const a = nt(e, "-->", i + 4, "Comment is not closed."); if (this.options.commentPropName) { const c = e.substring(i + 4, a - 2); r = this.saveTextToParentTag(r, n, s), n.add(this.options.commentPropName, [{ [this.options.textNodeName]: c }]); } i = a; } else if (e.substr(i + 1, 2) === "!D") { const a = Vd(e, i); this.docTypeEntities = a.entities, i = a.i; } else if (e.substr(i + 1, 2) === "![") { const a = nt(e, "]]>", i, "CDATA is not closed.") - 2, c = e.substring(i + 9, a); r = this.saveTextToParentTag(r, n, s); let u = this.parseTextData(c, n.tagname, s, true, false, true, true); u == null && (u = ""), this.options.cdataPropName ? n.add(this.options.cdataPropName, [{ [this.options.textNodeName]: c }]) : n.add(this.options.textNodeName, u), i = a + 2; } else { let a = fr(e, i, this.options.removeNSPrefix), c = a.tagName; const u = a.rawTagName; let l = a.tagExp, f = a.attrExpPresent, p = a.closeIndex; this.options.transformTagName && (c = this.options.transformTagName(c)), n && r && n.tagname !== "!xml" && (r = this.saveTextToParentTag(r, n, s, false)); const g = n; g && this.options.unpairedTags.indexOf(g.tagname) !== -1 && (n = this.tagsNodeStack.pop(), s = s.substring(0, s.lastIndexOf("."))), c !== t.tagname && (s += s ? "." + c : c); const S = i; if (this.isItStopNode(this.options.stopNodes, s, c)) { let T = ""; if (l.length > 0 && l.lastIndexOf("/") === l.length - 1) c[c.length - 1] === "/" ? (c = c.substr(0, c.length - 1), s = s.substr(0, s.length - 1), l = c) : l = l.substr(0, l.length - 1), i = a.closeIndex; else if (this.options.unpairedTags.indexOf(c) !== -1) i = a.closeIndex; else { const I = this.readStopNodeData(e, u, p + 1); if (!I) throw new Error(`Unexpected end of ${u}`); i = I.i, T = I.tagContent; } const A = new Je(c); c !== l && f && (A[":@"] = this.buildAttributesMap(l, s, c)), T && (T = this.parseTextData(T, c, s, true, f, true, true)), s = s.substr(0, s.lastIndexOf(".")), A.add(this.options.textNodeName, T), this.addChild(n, A, s, S); } else { if (l.length > 0 && l.lastIndexOf("/") === l.length - 1) { c[c.length - 1] === "/" ? (c = c.substr(0, c.length - 1), s = s.substr(0, s.length - 1), l = c) : l = l.substr(0, l.length - 1), this.options.transformTagName && (c = this.options.transformTagName(c)); const T = new Je(c); c !== l && f && (T[":@"] = this.buildAttributesMap(l, s, c)), this.addChild(n, T, s, S), s = s.substr(0, s.lastIndexOf(".")); } else { const T = new Je(c); this.tagsNodeStack.push(n), c !== l && f && (T[":@"] = this.buildAttributesMap(l, s, c)), this.addChild(n, T, s, S), n = T; } r = "", i = p; } } else r += e[i]; return t.child; }; function ll(e, t, n, r) { this.options.captureMetaData || (r = void 0); const s = this.options.updateTag(t.tagname, n, t[":@"]); s === false || (typeof s == "string" && (t.tagname = s), e.addChild(t, r)); } var fl = function(e) { if (this.options.processEntities) { for (let t in this.docTypeEntities) { const n = this.docTypeEntities[t]; e = e.replace(n.regx, n.val); } for (let t in this.lastEntities) { const n = this.lastEntities[t]; e = e.replace(n.regex, n.val); } if (this.options.htmlEntities) for (let t in this.htmlEntities) { const n = this.htmlEntities[t]; e = e.replace(n.regex, n.val); } e = e.replace(this.ampEntity.regex, this.ampEntity.val); } return e; }; function hl(e, t, n, r) { return e && (r === void 0 && (r = t.child.length === 0), e = this.parseTextData( e, t.tagname, n, false, t[":@"] ? Object.keys(t[":@"]).length !== 0 : false, r ), e !== void 0 && e !== "" && t.add(this.options.textNodeName, e), e = ""), e; } function pl(e, t, n) { const r = "*." + n; for (const s in e) { const i = e[s]; if (r === i || t === i) return true; } return false; } function gl(e, t, n = ">") { let r, s = ""; for (let i = t; i < e.length; i++) { let o = e[i]; if (r) o === r && (r = ""); else if (o === '"' || o === "'") r = o; else if (o === n[0]) if (n[1]) { if (e[i + 1] === n[1]) return { data: s, index: i }; } else return { data: s, index: i }; else o === " " && (o = " "); s += o; } } function nt(e, t, n, r) { const s = e.indexOf(t, n); if (s === -1) throw new Error(r); return s + t.length - 1; } function fr(e, t, n, r = ">") { const s = gl(e, t + 1, r); if (!s) return; let i = s.data; const o = s.index, a = i.search(/\s/); let c = i, u = true; a !== -1 && (c = i.substring(0, a), i = i.substring(a + 1).trimStart()); const l = c; if (n) { const f = c.indexOf(":"); f !== -1 && (c = c.substr(f + 1), u = c !== s.data.substr(f + 1)); } return { tagName: c, tagExp: i, closeIndex: o, attrExpPresent: u, rawTagName: l }; } function ml(e, t, n) { const r = n; let s = 1; for (; n < e.length; n++) if (e[n] === "<") if (e[n + 1] === "/") { const i = nt(e, ">", n, `${t} is not closed`); if (e.substring(n + 2, i).trim() === t && (s--, s === 0)) return { tagContent: e.substring(r, n), i }; n = i; } else if (e[n + 1] === "?") n = nt(e, "?>", n + 1, "StopNode is not closed."); else if (e.substr(n + 1, 3) === "!--") n = nt(e, "-->", n + 3, "StopNode is not closed."); else if (e.substr(n + 1, 2) === "![") n = nt(e, "]]>", n, "StopNode is not closed.") - 2; else { const i = fr(e, n, ">"); i && ((i && i.tagName) === t && i.tagExp[i.tagExp.length - 1] !== "/" && s++, n = i.closeIndex); } } function hr(e, t, n) { if (t && typeof e == "string") { const r = e.trim(); return r === "true" ? true : r === "false" ? false : Yd(e, n); } else return Pd(e) ? e : ""; } var kn = Je.getMetaDataSymbol(); function yl(e, t) { return Go(e, t); } function Go(e, t, n) { let r; const s = {}; for (let i = 0; i < e.length; i++) { const o = e[i], a = wl(o); let c = ""; if (n === void 0 ? c = a : c = n + "." + a, a === t.textNodeName) r === void 0 ? r = o[a] : r += "" + o[a]; else { if (a === void 0) continue; if (o[a]) { let u = Go(o[a], t, c); const l = El(u, t); o[kn] !== void 0 && (u[kn] = o[kn]), o[":@"] ? bl(u, o[":@"], c, t) : Object.keys(u).length === 1 && u[t.textNodeName] !== void 0 && !t.alwaysCreateTextNode ? u = u[t.textNodeName] : Object.keys(u).length === 0 && (t.alwaysCreateTextNode ? u[t.textNodeName] = "" : u = ""), s[a] !== void 0 && s.hasOwnProperty(a) ? (Array.isArray(s[a]) || (s[a] = [s[a]]), s[a].push(u)) : t.isArray(a, c, l) ? s[a] = [u] : s[a] = u; } } } return typeof r == "string" ? r.length > 0 && (s[t.textNodeName] = r) : r !== void 0 && (s[t.textNodeName] = r), s; } function wl(e) { const t = Object.keys(e); for (let n = 0; n < t.length; n++) { const r = t[n]; if (r !== ":@") return r; } } function bl(e, t, n, r) { if (t) { const s = Object.keys(t), i = s.length; for (let o = 0; o < i; o++) { const a = s[o]; r.isArray(a, n + "." + a, true, true) ? e[a] = [t[a]] : e[a] = t[a]; } } } function El(e, t) { const { textNodeName: n } = t, r = Object.keys(e).length; return !!(r === 0 || r === 1 && (e[n] || typeof e[n] == "boolean" || e[n] === 0)); } var xl = class { constructor(t) { this.externalEntities = {}, this.options = qd(t); } /** * Parse XML dats to JS object * @param {string|Buffer} xmlData * @param {boolean|Object} validationOption */ parse(t, n) { if (typeof t != "string") if (t.toString) t = t.toString(); else throw new Error("XML data is accepted in String or Bytes[] form."); if (n) { n === true && (n = {}); const i = Md(t, n); if (i !== true) throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`); } const r = new sl(this.options); r.addExternalEntities(this.externalEntities); const s = r.parseXml(t); return this.options.preserveOrder || s === void 0 ? s : yl(s, this.options); } /** * Add Entity which is not by default supported by this library * @param {string} key * @param {string} value */ addEntity(t, n) { if (n.indexOf("&") !== -1) throw new Error("Entity value can't have '&'"); if (t.indexOf("&") !== -1 || t.indexOf(";") !== -1) throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for ' '"); if (n === "&") throw new Error("An entity with value '&' is not permitted"); this.externalEntities[t] = n; } /** * Returns a Symbol that can be used to access the metadata * property on a node. * * If Symbol is not available in the environment, an ordinary property is used * and the name of the property is here returned. * * The XMLMetaData property is only present when `captureMetaData` * is true in the options. */ static getMetaDataSymbol() { return Je.getMetaDataSymbol(); } }; var Zo = (e, t) => Td(e, t).then((n) => { if (n.length) { const r = new xl({ attributeNamePrefix: "", htmlEntities: true, ignoreAttributes: false, ignoreDeclaration: true, parseTagValue: false, trimValues: false, tagValueProcessor: (c, u) => u.trim() === "" && u.includes(` `) ? "" : void 0 }); r.addEntity("#xD", "\r"), r.addEntity("#10", ` `); let s; try { s = r.parse(n, true); } catch (c) { throw c && typeof c == "object" && Object.defineProperty(c, "$responseBodyText", { value: n }), c; } const i = "#text", o = Object.keys(s)[0], a = s[o]; return a[i] && (a[o] = a[i], delete a[i]), Vo(a); } return {}; }); var Sl = async (e, t) => { const n = await Zo(e, t); return n.Error && (n.Error.message = n.Error.message ?? n.Error.Message), n; }; var Al = (e, t) => { var n; if (((n = t == null ? void 0 : t.Error) == null ? void 0 : n.Code) !== void 0) return t.Error.Code; if ((t == null ? void 0 : t.Code) !== void 0) return t.Code; if (e.statusCode == 404) return "NotFound"; }; var pr = [ V.CRC32, V.CRC32C, V.CRC64NVME, V.SHA1, V.SHA256 ]; var Cl = [ V.SHA256, V.SHA1, V.CRC32, V.CRC32C, V.CRC64NVME ]; var vl = (e, { requestChecksumRequired: t, requestAlgorithmMember: n, requestChecksumCalculation: r }) => { if (!n) return r === mt.WHEN_SUPPORTED || t ? or : void 0; if (!e[n]) return; const s = e[n]; if (!pr.includes(s)) throw new Error(`The checksum algorithm "${s}" is not supported by the client. Select one of ${pr}.`); return s; }; var Ir = (e) => e === V.MD5 ? "content-md5" : `x-amz-checksum-${e.toLowerCase()}`; var Rl = (e, t) => { const n = e.toLowerCase(); for (const r of Object.keys(t)) if (n === r.toLowerCase()) return true; return false; }; var kl = (e, t) => { const n = e.toLowerCase(); for (const r of Object.keys(t)) if (r.toLowerCase().startsWith(n)) return true; return false; }; var Xo = (e) => e !== void 0 && typeof e != "string" && !ArrayBuffer.isView(e) && !jo(e); function _r(e, t, n, r) { function s(i) { return i instanceof n ? i : new n(function(o) { o(i); }); } return new (n || (n = Promise))(function(i, o) { function a(l) { try { u(r.next(l)); } catch (f) { o(f); } } function c(l) { try { u(r.throw(l)); } catch (f) { o(f); } } function u(l) { l.done ? i(l.value) : s(l.value).then(a, c); } u((r = r.apply(e, t || [])).next()); }); } function Pr(e, t) { var n = { label: 0, sent: function() { if (i[0] & 1) throw i[1]; return i[1]; }, trys: [], ops: [] }, r, s, i, o = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype); return o.next = a(0), o.throw = a(1), o.return = a(2), typeof Symbol == "function" && (o[Symbol.iterator] = function() { return this; }), o; function a(u) { return function(l) { return c([u, l]); }; } function c(u) { if (r) throw new TypeError("Generator is already executing."); for (; o && (o = 0, u[0] && (n = 0)), n; ) try { if (r = 1, s && (i = u[0] & 2 ? s.return : u[0] ? s.throw || ((i = s.return) && i.call(s), 0) : s.next) && !(i = i.call(s, u[1])).done) return i; switch (s = 0, i && (u = [u[0] & 2, i.value]), u[0]) { case 0: case 1: i = u; break; case 4: return n.label++, { value: u[1], done: false }; case 5: n.label++, s = u[1], u = [0]; continue; case 7: u = n.ops.pop(), n.trys.pop(); continue; default: if (i = n.trys, !(i = i.length > 0 && i[i.length - 1]) && (u[0] === 6 || u[0] === 2)) { n = 0; continue; } if (u[0] === 3 && (!i || u[1] > i[0] && u[1] < i[3])) { n.label = u[1]; break; } if (u[0] === 6 && n.label < i[1]) { n.label = i[1], i = u; break; } if (i && n.label < i[2]) { n.label = i[2], n.ops.push(u); break; } i[2] && n.ops.pop(), n.trys.pop(); continue; } u = t.call(e, n); } catch (l) { u = [6, l], s = 0; } finally { r = i = 0; } if (u[0] & 5) throw u[1]; return { value: u[0] ? u[1] : void 0, done: true }; } } function Qo(e) { var t = typeof Symbol == "function" && Symbol.iterator, n = t && e[t], r = 0; if (n) return n.call(e); if (e && typeof e.length == "number") return { next: function() { return e && r >= e.length && (e = void 0), { value: e && e[r++], done: !e }; } }; throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined."); } var Yo = (e) => new TextEncoder().encode(e); var Tl = typeof Buffer < "u" && Buffer.from ? function(e) { return Buffer.from(e, "utf8"); } : Yo; function Ze(e) { return e instanceof Uint8Array ? e : typeof e == "string" ? Tl(e) : ArrayBuffer.isView(e) ? new Uint8Array(e.buffer, e.byteOffset, e.byteLength / Uint8Array.BYTES_PER_ELEMENT) : new Uint8Array(e); } function Ft(e) { return typeof e == "string" ? e.length === 0 : e.byteLength === 0; } function Jo(e) { return new Uint8Array([ (e & 4278190080) >> 24, (e & 16711680) >> 16, (e & 65280) >> 8, e & 255 ]); } function ea(e) { if (!Uint32Array.from) { for (var t = new Uint32Array(e.length), n = 0; n < e.length; ) t[n] = e[n], n += 1; return t; } return Uint32Array.from(e); } var Bl = ( /** @class */ function() { function e() { this.crc32c = new Ps(); } return e.prototype.update = function(t) { Ft(t) || this.crc32c.update(Ze(t)); }, e.prototype.digest = function() { return _r(this, void 0, void 0, function() { return Pr(this, function(t) { return [2, Jo(this.crc32c.digest())]; }); }); }, e.prototype.reset = function() { this.crc32c = new Ps(); }, e; }() ); var Ps = ( /** @class */ function() { function e() { this.checksum = 4294967295; } return e.prototype.update = function(t) { var n, r; try { for (var s = Qo(t), i = s.next(); !i.done; i = s.next()) { var o = i.value; this.checksum = this.checksum >>> 8 ^ _l[(this.checksum ^ o) & 255]; } } catch (a) { n = { error: a }; } finally { try { i && !i.done && (r = s.return) && r.call(s); } finally { if (n) throw n.error; } } return this; }, e.prototype.digest = function() { return (this.checksum ^ 4294967295) >>> 0; }, e; }() ); var Il = [ 0, 4067132163, 3778769143, 324072436, 3348797215, 904991772, 648144872, 3570033899, 2329499855, 2024987596, 1809983544, 2575936315, 1296289744, 3207089363, 2893594407, 1578318884, 274646895, 3795141740, 4049975192, 51262619, 3619967088, 632279923, 922689671, 3298075524, 2592579488, 1760304291, 2075979607, 2312596564, 1562183871, 2943781820, 3156637768, 1313733451, 549293790, 3537243613, 3246849577, 871202090, 3878099393, 357341890, 102525238, 4101499445, 2858735121, 1477399826, 1264559846, 3107202533, 1845379342, 2677391885, 2361733625, 2125378298, 820201905, 3263744690, 3520608582, 598981189, 4151959214, 85089709, 373468761, 3827903834, 3124367742, 1213305469, 1526817161, 2842354314, 2107672161, 2412447074, 2627466902, 1861252501, 1098587580, 3004210879, 2688576843, 1378610760, 2262928035, 1955203488, 1742404180, 2511436119, 3416409459, 969524848, 714683780, 3639785095, 205050476, 4266873199, 3976438427, 526918040, 1361435347, 2739821008, 2954799652, 1114974503, 2529119692, 1691668175, 2005155131, 2247081528, 3690758684, 697762079, 986182379, 3366744552, 476452099, 3993867776, 4250756596, 255256311, 1640403810, 2477592673, 2164122517, 1922457750, 2791048317, 1412925310, 1197962378, 3037525897, 3944729517, 427051182, 170179418, 4165941337, 746937522, 3740196785, 3451792453, 1070968646, 1905808397, 2213795598, 2426610938, 1657317369, 3053634322, 1147748369, 1463399397, 2773627110, 4215344322, 153784257, 444234805, 3893493558, 1021025245, 3467647198, 3722505002, 797665321, 2197175160, 1889384571, 1674398607, 2443626636, 1164749927, 3070701412, 2757221520, 1446797203, 137323447, 4198817972, 3910406976, 461344835, 3484808360, 1037989803, 781091935, 3705997148, 2460548119, 1623424788, 1939049696, 2180517859, 1429367560, 2807687179, 3020495871, 1180866812, 410100952, 3927582683, 4182430767, 186734380, 3756733383, 763408580, 1053836080, 3434856499, 2722870694, 1344288421, 1131464017, 2971354706, 1708204729, 2545590714, 2229949006, 1988219213, 680717673, 3673779818, 3383336350, 1002577565, 4010310262, 493091189, 238226049, 4233660802, 2987750089, 1082061258, 1395524158, 2705686845, 1972364758, 2279892693, 2494862625, 1725896226, 952904198, 3399985413, 3656866545, 731699698, 4283874585, 222117402, 510512622, 3959836397, 3280807620, 837199303, 582374963, 3504198960, 68661723, 4135334616, 3844915500, 390545967, 1230274059, 3141532936, 2825850620, 1510247935, 2395924756, 2091215383, 1878366691, 2644384480, 3553878443, 565732008, 854102364, 3229815391, 340358836, 3861050807, 4117890627, 119113024, 1493875044, 2875275879, 3090270611, 1247431312, 2660249211, 1828433272, 2141937292, 2378227087, 3811616794, 291187481, 34330861, 4032846830, 615137029, 3603020806, 3314634738, 939183345, 1776939221, 2609017814, 2295496738, 2058945313, 2926798794, 1545135305, 1330124605, 3173225534, 4084100981, 17165430, 307568514, 3762199681, 888469610, 3332340585, 3587147933, 665062302, 2042050490, 2346497209, 2559330125, 1793573966, 3190661285, 1279665062, 1595330642, 2910671697 ]; var _l = ea(Il); var Pl = ( /** @class */ function() { function e() { this.crc32 = new Yt(); } return e.prototype.update = function(t) { Ft(t) || this.crc32.update(Ze(t)); }, e.prototype.digest = function() { return _r(this, void 0, void 0, function() { return Pr(this, function(t) { return [2, Jo(this.crc32.digest())]; }); }); }, e.prototype.reset = function() { this.crc32 = new Yt(); }, e; }() ); var Yt = ( /** @class */ function() { function e() { this.checksum = 4294967295; } return e.prototype.update = function(t) { var n, r; try { for (var s = Qo(t), i = s.next(); !i.done; i = s.next()) { var o = i.value; this.checksum = this.checksum >>> 8 ^ Ml[(this.checksum ^ o) & 255]; } } catch (a) { n = { error: a }; } finally { try { i && !i.done && (r = s.return) && r.call(s); } finally { if (n) throw n.error; } } return this; }, e.prototype.digest = function() { return (this.checksum ^ 4294967295) >>> 0; }, e; }() ); var Nl = [ 0, 1996959894, 3993919788, 2567524794, 124634137, 1886057615, 3915621685, 2657392035, 249268274, 2044508324, 3772115230, 2547177864, 162941995, 2125561021, 3887607047, 2428444049, 498536548, 1789927666, 4089016648, 2227061214, 450548861, 1843258603, 4107580753, 2211677639, 325883990, 1684777152, 4251122042, 2321926636, 335633487, 1661365465, 4195302755, 2366115317, 997073096, 1281953886, 3579855332, 2724688242, 1006888145, 1258607687, 3524101629, 2768942443, 901097722, 1119000684, 3686517206, 2898065728, 853044451, 1172266101, 3705015759, 2882616665, 651767980, 1373503546, 3369554304, 3218104598, 565507253, 1454621731, 3485111705, 3099436303, 671266974, 1594198024, 3322730930, 2970347812, 795835527, 1483230225, 3244367275, 3060149565, 1994146192, 31158534, 2563907772, 4023717930, 1907459465, 112637215, 2680153253, 3904427059, 2013776290, 251722036, 2517215374, 3775830040, 2137656763, 141376813, 2439277719, 3865271297, 1802195444, 476864866, 2238001368, 4066508878, 1812370925, 453092731, 2181625025, 4111451223, 1706088902, 314042704, 2344532202, 4240017532, 1658658271, 366619977, 2362670323, 4224994405, 1303535960, 984961486, 2747007092, 3569037538, 1256170817, 1037604311, 2765210733, 3554079995, 1131014506, 879679996, 2909243462, 3663771856, 1141124467, 855842277, 2852801631, 3708648649, 1342533948, 654459306, 3188396048, 3373015174, 1466479909, 544179635, 3110523913, 3462522015, 1591671054, 702138776, 2966460450, 3352799412, 1504918807, 783551873, 3082640443, 3233442989, 3988292384, 2596254646, 62317068, 1957810842, 3939845945, 2647816111, 81470997, 1943803523, 3814918930, 2489596804, 225274430, 2053790376, 3826175755, 2466906013, 167816743, 2097651377, 4027552580, 2265490386, 503444072, 1762050814, 4150417245, 2154129355, 426522225, 1852507879, 4275313526, 2312317920, 282753626, 1742555852, 4189708143, 2394877945, 397917763, 1622183637, 3604390888, 2714866558, 953729732, 1340076626, 3518719985, 2797360999, 1068828381, 1219638859, 3624741850, 2936675148, 906185462, 1090812512, 3747672003, 2825379669, 829329135, 1181335161, 3412177804, 3160834842, 628085408, 1382605366, 3423369109, 3138078467, 570562233, 1426400815, 3317316542, 2998733608, 733239954, 1555261956, 3268935591, 3050360625, 752459403, 1541320221, 2607071920, 3965973030, 1969922972, 40735498, 2617837225, 3943577151, 1913087877, 83908371, 2512341634, 3803740692, 2075208622, 213261112, 2463272603, 3855990285, 2094854071, 198958881, 2262029012, 4057260610, 1759359992, 534414190, 2176718541, 4139329115, 1873836001, 414664567, 2282248934, 4279200368, 1711684554, 285281116, 2405801727, 4167216745, 1634467795, 376229701, 2685067896, 3608007406, 1308918612, 956543938, 2808555105, 3495958263, 1231636301, 1047427035, 2932959818, 3654703836, 1088359270, 936918e3, 2847714899, 3736837829, 1202900863, 817233897, 3183342108, 3401237130, 1404277552, 615818150, 3134207493, 3453421203, 1423857449, 601450431, 3009837614, 3294710456, 1567103746, 711928724, 3020668471, 3272380065, 1510334235, 755167117 ]; var Ml = ea(Nl); var Fl = () => Pl; var ta = (e, t) => { switch (e) { case V.MD5: return t.md5; case V.CRC32: return Fl(); case V.CRC32C: return Bl; case V.CRC64NVME: throw new Error(`Please check whether you have installed the "@aws-sdk/crc64-nvme-crt" package explicitly. You must also register the package by calling [require("@aws-sdk/crc64-nvme-crt");] or an ESM equivalent such as [import "@aws-sdk/crc64-nvme-crt";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt`); case V.SHA1: return t.sha1; case V.SHA256: return t.sha256; default: throw new Error(`Unsupported checksum algorithm: ${e}`); } }; var na = (e, t) => { const n = new e(); return n.update(yt2(t || "")), n.digest(); }; var Ol = { name: "flexibleChecksumsMiddleware", step: "build", tags: ["BODY_CHECKSUM"], override: true }; var Dl = (e, t) => (n, r) => async (s) => { if (!se.isInstance(s.request) || kl("x-amz-checksum-", s.request.headers)) return n(s); const { request: i, input: o } = s, { body: a, headers: c } = i, { base64Encoder: u, streamHasher: l } = e, { requestChecksumRequired: f, requestAlgorithmMember: p } = t, g = await e.requestChecksumCalculation(), S = p == null ? void 0 : p.name, T = p == null ? void 0 : p.httpHeader; S && !o[S] && (g === mt.WHEN_SUPPORTED || f) && (o[S] = or, T && (c[T] = or)); const A = vl(o, { requestChecksumRequired: f, requestAlgorithmMember: p == null ? void 0 : p.name, requestChecksumCalculation: g }); let I = a, L = c; if (A) { switch (A) { case V.CRC32: ne(r, "FLEXIBLE_CHECKSUMS_REQ_CRC32", "U"); break; case V.CRC32C: ne(r, "FLEXIBLE_CHECKSUMS_REQ_CRC32C", "V"); break; case V.CRC64NVME: ne(r, "FLEXIBLE_CHECKSUMS_REQ_CRC64", "W"); break; case V.SHA1: ne(r, "FLEXIBLE_CHECKSUMS_REQ_SHA1", "X"); break; case V.SHA256: ne(r, "FLEXIBLE_CHECKSUMS_REQ_SHA256", "Y"); break; } const K = Ir(A), he = ta(A, e); if (Xo(a)) { const { getAwsChunkedEncodingStream: pe, bodyLengthChecker: Fe } = e; I = pe(typeof e.requestStreamBufferSize == "number" && e.requestStreamBufferSize >= 8 * 1024 ? Gc(a, e.requestStreamBufferSize, r.logger) : a, { base64Encoder: u, bodyLengthChecker: Fe, checksumLocationName: K, checksumAlgorithmFn: he, streamHasher: l }), L = { ...c, "content-encoding": c["content-encoding"] ? `${c["content-encoding"]},aws-chunked` : "aws-chunked", "transfer-encoding": "chunked", "x-amz-decoded-content-length": c["content-length"], "x-amz-content-sha256": "STREAMING-UNSIGNED-PAYLOAD-TRAILER", "x-amz-trailer": K }, delete L["content-length"]; } else if (!Rl(K, c)) { const pe = await na(he, a); L = { ...c, [K]: u(pe) }; } } return await n({ ...s, request: { ...i, headers: L, body: I } }); }; var Ul = { name: "flexibleChecksumsInputMiddleware", toMiddleware: "serializerMiddleware", relation: "before", tags: ["BODY_CHECKSUM"], override: true }; var $l = (e, t) => (n, r) => async (s) => { const i = s.input, { requestValidationModeMember: o } = t, a = await e.requestChecksumCalculation(), c = await e.responseChecksumValidation(); switch (a) { case mt.WHEN_REQUIRED: ne(r, "FLEXIBLE_CHECKSUMS_REQ_WHEN_REQUIRED", "a"); break; case mt.WHEN_SUPPORTED: ne(r, "FLEXIBLE_CHECKSUMS_REQ_WHEN_SUPPORTED", "Z"); break; } switch (c) { case bn.WHEN_REQUIRED: ne(r, "FLEXIBLE_CHECKSUMS_RES_WHEN_REQUIRED", "c"); break; case bn.WHEN_SUPPORTED: ne(r, "FLEXIBLE_CHECKSUMS_RES_WHEN_SUPPORTED", "b"); break; } return o && !i[o] && c === bn.WHEN_SUPPORTED && (i[o] = "ENABLED"), n(s); }; var ra = (e = []) => { const t = []; for (const n of Cl) !e.includes(n) || !pr.includes(n) || t.push(n); return t; }; var Ll = (e) => { const t = e.lastIndexOf("-"); if (t !== -1) { const n = e.slice(t + 1); if (!n.startsWith("0")) { const r = parseInt(n, 10); if (!isNaN(r) && r >= 1 && r <= 1e4) return true; } } return false; }; var Hl = async (e, { checksumAlgorithmFn: t, base64Encoder: n }) => n(await na(t, e)); var zl = async (e, { config: t, responseAlgorithms: n, logger: r }) => { const s = ra(n), { body: i, headers: o } = e; for (const a of s) { const c = Ir(a), u = o[c]; if (u) { let l; try { l = ta(a, t); } catch (g) { if (a === V.CRC64NVME) { r == null || r.warn(`Skipping ${V.CRC64NVME} checksum validation: ${g.message}`); continue; } throw g; } const { base64Encoder: f } = t; if (Xo(i)) { e.body = Vc({ expectedChecksum: u, checksumSourceLocation: c, checksum: new l(), source: i, base64Encoder: f }); return; } const p = await Hl(i, { checksumAlgorithmFn: l, base64Encoder: f }); if (p === u) break; throw new Error(`Checksum mismatch: expected "${p}" but received "${u}" in response header "${c}".`); } } }; var jl = { name: "flexibleChecksumsResponseMiddleware", toMiddleware: "deserializerMiddleware", relation: "after", tags: ["BODY_CHECKSUM"], override: true }; var ql = (e, t) => (n, r) => async (s) => { if (!se.isInstance(s.request)) return n(s); const i = s.input, o = await n(s), a = o.response, { requestValidationModeMember: c, responseAlgorithms: u } = t; if (c && i[c] === "ENABLED") { const { clientName: l, commandName: f } = r; if (l === "S3Client" && f === "GetObjectCommand" && ra(u).every((g) => { const S = Ir(g), T = a.headers[S]; return !T || Ll(T); })) return o; await zl(a, { config: e, responseAlgorithms: u, logger: r.logger }); } return o; }; var Vl = (e, t) => ({ applyToStack: (n) => { n.add(Dl(e, t), Ol), n.addRelativeTo($l(e, t), Ul), n.addRelativeTo(ql(e, t), jl); } }); var Wl = (e) => { const { requestChecksumCalculation: t, responseChecksumValidation: n, requestStreamBufferSize: r } = e; return Object.assign(e, { requestChecksumCalculation: Ne(t ?? Ac), responseChecksumValidation: Ne(n ?? Cc), requestStreamBufferSize: Number(r ?? 0) }); }; var Kl = (e) => (t) => async (n) => { if (!se.isInstance(n.request)) return t(n); const { request: r } = n, { handlerProtocol: s = "" } = e.requestHandler.metadata || {}; if (s.indexOf("h2") >= 0 && !r.headers[":authority"]) delete r.headers.host, r.headers[":authority"] = r.hostname + (r.port ? ":" + r.port : ""); else if (!r.headers.host) { let i = r.hostname; r.port != null && (i += `:${r.port}`), r.headers.host = i; } return t(n); }; var Gl = { name: "hostHeaderMiddleware", step: "build", priority: "low", tags: ["HOST"], override: true }; var Zl = (e) => ({ applyToStack: (t) => { t.add(Kl(e), Gl); } }); var Xl = () => (e, t) => async (n) => { var r, s; try { const i = await e(n), { clientName: o, commandName: a, logger: c, dynamoDbDocumentClientOptions: u = {} } = t, { overrideInputFilterSensitiveLog: l, overrideOutputFilterSensitiveLog: f } = u, p = l ?? t.inputFilterSensitiveLog, g = f ?? t.outputFilterSensitiveLog, { $metadata: S, ...T } = i.output; return (r = c == null ? void 0 : c.info) == null || r.call(c, { clientName: o, commandName: a, input: p(n.input), output: g(T), metadata: S }), i; } catch (i) { const { clientName: o, commandName: a, logger: c, dynamoDbDocumentClientOptions: u = {} } = t, { overrideInputFilterSensitiveLog: l } = u, f = l ?? t.inputFilterSensitiveLog; throw (s = c == null ? void 0 : c.error) == null || s.call(c, { clientName: o, commandName: a, input: f(n.input), error: i, metadata: i.$metadata }), i; } }; var Ql = { name: "loggerMiddleware", tags: ["LOGGER"], step: "initialize", override: true }; var Yl = (e) => ({ applyToStack: (t) => { t.add(Xl(), Ql); } }); var Tn = "X-Amzn-Trace-Id"; var Jl = "AWS_LAMBDA_FUNCTION_NAME"; var ef = "_X_AMZN_TRACE_ID"; var tf = (e) => (t) => async (n) => { const { request: r } = n; if (!se.isInstance(r) || e.runtime !== "node") return t(n); const s = Object.keys(r.headers ?? {}).find((c) => c.toLowerCase() === Tn.toLowerCase()) ?? Tn; if (r.headers.hasOwnProperty(s)) return t(n); const i = process.env[Jl], o = process.env[ef], a = (c) => typeof c == "string" && c.length > 0; return a(i) && a(o) && (r.headers[Tn] = o), t({ ...n, request: r }); }; var nf = { step: "build", tags: ["RECURSION_DETECTION"], name: "recursionDetectionMiddleware", override: true, priority: "low" }; var rf = (e) => ({ applyToStack: (t) => { t.add(tf(e), nf); } }); var sf = "content-length"; var of = "x-amz-decoded-content-length"; function af() { return (e, t) => async (n) => { var s; const { request: r } = n; if (se.isInstance(r) && !(sf in r.headers) && !(of in r.headers)) { const i = "Are you using a Stream of unknown length as the Body of a PutObject request? Consider using Upload instead from @aws-sdk/lib-storage."; typeof ((s = t == null ? void 0 : t.logger) == null ? void 0 : s.warn) == "function" && !(t.logger instanceof kr) && t.logger.warn(i); } return e({ ...n }); }; } var cf = { step: "finalizeRequest", tags: ["CHECK_CONTENT_LENGTH_HEADER"], name: "getCheckContentLengthHeaderPlugin", override: true }; var uf = (e) => ({ applyToStack: (t) => { t.add(af(), cf); } }); var df = (e) => (t, n) => async (r) => { const s = await e.region(), i = e.region; let o = () => { }; n.__s3RegionRedirect && (Object.defineProperty(e, "region", { writable: false, value: async () => n.__s3RegionRedirect }), o = () => Object.defineProperty(e, "region", { writable: true, value: i })); try { const a = await t(r); if (n.__s3RegionRedirect) { o(); const c = await e.region(); if (s !== c) throw new Error("Region was not restored following S3 region redirect."); } return a; } catch (a) { throw o(), a; } }; var lf = { tags: ["REGION_REDIRECT", "S3"], name: "regionRedirectEndpointMiddleware", override: true, relation: "before", toMiddleware: "endpointV2Middleware" }; function ff(e) { return (t, n) => async (r) => { var s, i, o; try { return await t(r); } catch (a) { if (e.followRegionRedirects && (((s = a == null ? void 0 : a.$metadata) == null ? void 0 : s.httpStatusCode) === 301 || ((i = a == null ? void 0 : a.$metadata) == null ? void 0 : i.httpStatusCode) === 400 && (a == null ? void 0 : a.name) === "IllegalLocationConstraintException")) { try { const c = a.$response.headers["x-amz-bucket-region"]; (o = n.logger) == null || o.debug(`Redirecting from ${await e.region()} to ${c}`), n.__s3RegionRedirect = c; } catch (c) { throw new Error("Region redirect failed: " + c); } return t(r); } throw a; } }; } var hf = { step: "initialize", tags: ["REGION_REDIRECT", "S3"], name: "regionRedirectMiddleware", override: true }; var pf = (e) => ({ applyToStack: (t) => { t.add(ff(e), hf), t.addRelativeTo(df(e), lf); } }); var on = class on2 { constructor(t = {}) { _(this, "data"); _(this, "lastPurgeTime", Date.now()); this.data = t; } get(t) { const n = this.data[t]; if (n) return n; } set(t, n) { return this.data[t] = n, n; } delete(t) { delete this.data[t]; } async purgeExpired() { const t = Date.now(); if (!(this.lastPurgeTime + on2.EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS > t)) for (const n in this.data) { const r = this.data[n]; if (!r.isRefreshing) { const s = await r.identity; s.expiration && s.expiration.getTime() < t && delete this.data[n]; } } } }; _(on, "EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS", 3e4); var gr = on; var Bn = class { constructor(t, n = false, r = Date.now()) { _(this, "_identity"); _(this, "isRefreshing"); _(this, "accessed"); this._identity = t, this.isRefreshing = n, this.accessed = r; } get identity() { return this.accessed = Date.now(), this._identity; } }; var an = class an2 { constructor(t, n = new gr()) { _(this, "createSessionFn"); _(this, "cache"); this.createSessionFn = t, this.cache = n; } async getS3ExpressIdentity(t, n) { const r = n.Bucket, { cache: s } = this, i = s.get(r); return i ? i.identity.then((o) => { var u, l; return (((u = o.expiration) == null ? void 0 : u.getTime()) ?? 0) < Date.now() ? s.set(r, new Bn(this.getIdentity(r))).identity : ((((l = o.expiration) == null ? void 0 : l.getTime()) ?? 0) < Date.now() + an2.REFRESH_WINDOW_MS && !i.isRefreshing && (i.isRefreshing = true, this.getIdentity(r).then((f) => { s.set(r, new Bn(Promise.resolve(f))); })), o); }) : s.set(r, new Bn(this.getIdentity(r))).identity; } async getIdentity(t) { var s, i; await this.cache.purgeExpired().catch((o) => { }); const n = await this.createSessionFn(t); if (!((s = n.Credentials) != null && s.AccessKeyId) || !((i = n.Credentials) != null && i.SecretAccessKey)) throw new Error("s3#createSession response credential missing AccessKeyId or SecretAccessKey."); return { accessKeyId: n.Credentials.AccessKeyId, secretAccessKey: n.Credentials.SecretAccessKey, sessionToken: n.Credentials.SessionToken, expiration: n.Credentials.Expiration ? new Date(n.Credentials.Expiration) : void 0 }; } }; _(an, "REFRESH_WINDOW_MS", 6e4); var mr = an; var Ns; (function(e) { e.ENV = "env", e.CONFIG = "shared config entry"; })(Ns || (Ns = {})); var gf = "Directory"; var mf = "S3Express"; var yf = "sigv4-s3express"; var yr = "X-Amz-S3session-Token"; var wr = yr.toLowerCase(); var wf = class extends lr { async signWithCredentials(t, n, r) { const s = Ms(n); t.headers[wr] = n.sessionToken; const i = this; return Fs(i, s), i.signRequest(t, r ?? {}); } async presignWithCredentials(t, n, r) { const s = Ms(n); return delete t.headers[wr], t.headers[yr] = n.sessionToken, t.query = t.query ?? {}, t.query[yr] = n.sessionToken, Fs(this, s), this.presign(t, r); } }; function Ms(e) { return { accessKeyId: e.accessKeyId, secretAccessKey: e.secretAccessKey, expiration: e.expiration }; } function Fs(e, t) { const n = setTimeout(() => { throw new Error("SignatureV4S3Express credential override was created but not called."); }, 10), r = e.credentialProvider, s = () => (clearTimeout(n), e.credentialProvider = r, Promise.resolve(t)); e.credentialProvider = s; } var bf = (e) => (t, n) => async (r) => { var s, i, o, a, c; if (n.endpointV2) { const u = n.endpointV2, l = ((o = (i = (s = u.properties) == null ? void 0 : s.authSchemes) == null ? void 0 : i[0]) == null ? void 0 : o.name) === yf; if ((((a = u.properties) == null ? void 0 : a.backend) === mf || ((c = u.properties) == null ? void 0 : c.bucketType) === gf) && (ne(n, "S3_EXPRESS_BUCKET", "J"), n.isS3ExpressBucket = true), l) { const p = r.input.Bucket; if (p) { const g = await e.s3ExpressIdentityProvider.getS3ExpressIdentity(await e.credentials(), { Bucket: p }); n.s3ExpressIdentity = g, se.isInstance(r.request) && g.sessionToken && (r.request.headers[wr] = g.sessionToken); } } } return t(r); }; var Ef = { name: "s3ExpressMiddleware", step: "build", tags: ["S3", "S3_EXPRESS"], override: true }; var xf = (e) => ({ applyToStack: (t) => { t.add(bf(e), Ef); } }); var Sf = async (e, t, n, r) => { const s = await r.signWithCredentials(n, e, {}); if (s.headers["X-Amz-Security-Token"] || s.headers["x-amz-security-token"]) throw new Error("X-Amz-Security-Token must not be set for s3-express requests."); return s; }; var Af = (e) => (t) => { throw t; }; var Cf = (e, t) => { }; var vf = (e) => (t, n) => async (r) => { if (!se.isInstance(r.request)) return t(r); const i = St(n).selectedHttpAuthScheme; if (!i) throw new Error("No HttpAuthScheme was selected: unable to sign request"); const { httpAuthOption: { signingProperties: o = {} }, identity: a, signer: c } = i; let u; n.s3ExpressIdentity ? u = await Sf(n.s3ExpressIdentity, o, r.request, await e.signer()) : u = await c.sign(r.request, a, o); const l = await t({ ...r, request: u }).catch((c.errorHandler || Af)(o)); return (c.successHandler || Cf)(l.response, o), l; }; var Rf = (e) => ({ applyToStack: (t) => { t.addRelativeTo(vf(e), Ao); } }); var kf = (e, { session: t }) => { const [n, r] = t, { forcePathStyle: s, useAccelerateEndpoint: i, disableMultiregionAccessPoints: o, followRegionRedirects: a, s3ExpressIdentityProvider: c, bucketEndpoint: u } = e; return Object.assign(e, { forcePathStyle: s ?? false, useAccelerateEndpoint: i ?? false, disableMultiregionAccessPoints: o ?? false, followRegionRedirects: a ?? false, s3ExpressIdentityProvider: c ?? new mr(async (l) => n().send(new r({ Bucket: l }))), bucketEndpoint: u ?? false }); }; var Tf = { CopyObjectCommand: true, UploadPartCopyCommand: true, CompleteMultipartUploadCommand: true }; var Bf = 3e3; var If = (e) => (t, n) => async (r) => { const s = await t(r), { response: i } = s; if (!gt2.isInstance(i)) return s; const { statusCode: o, body: a } = i; if (o < 200 || o >= 300 || !(typeof (a == null ? void 0 : a.stream) == "function" || typeof (a == null ? void 0 : a.pipe) == "function" || typeof (a == null ? void 0 : a.tee) == "function")) return s; let u = a, l = a; a && typeof a == "object" && !(a instanceof Uint8Array) && ([u, l] = await ou(a)), i.body = l; const f = await _f(u, { streamCollector: async (g) => Yc(g, Bf) }); typeof (u == null ? void 0 : u.destroy) == "function" && u.destroy(); const p = e.utf8Encoder(f.subarray(f.length - 16)); if (f.length === 0 && Tf[n.commandName]) { const g = new Error("S3 aborted request"); throw g.name = "InternalError", g; } return p && p.endsWith("") && (i.statusCode = 400), s; }; var _f = (e = new Uint8Array(), t) => e instanceof Uint8Array ? Promise.resolve(e) : t.streamCollector(e) || Promise.resolve(new Uint8Array()); var Pf = { relation: "after", toMiddleware: "deserializerMiddleware", tags: ["THROW_200_EXCEPTIONS", "S3"], name: "throw200ExceptionsMiddleware", override: true }; var sa = (e) => ({ applyToStack: (t) => { t.addRelativeTo(If(e), Pf); } }); var Nf = (e) => typeof e == "string" && e.indexOf("arn:") === 0 && e.split(":").length >= 6; function Mf(e) { return (t, n) => async (r) => { var s, i, o, a; if (e.bucketEndpoint) { const c = n.endpointV2; if (c) { const u = r.input.Bucket; if (typeof u == "string") try { const l = new URL(u); n.endpointV2 = { ...c, url: l }; } catch (l) { const f = `@aws-sdk/middleware-sdk-s3: bucketEndpoint=true was set but Bucket=${u} could not be parsed as URL.`; throw ((i = (s = n.logger) == null ? void 0 : s.constructor) == null ? void 0 : i.name) === "NoOpLogger" || (a = (o = n.logger) == null ? void 0 : o.warn) == null || a.call(o, f), l; } } } return t(r); }; } var Ff = { name: "bucketEndpointMiddleware", override: true, relation: "after", toMiddleware: "endpointV2Middleware" }; function Of({ bucketEndpoint: e }) { return (t) => async (n) => { const { input: { Bucket: r } } = n; if (!e && typeof r == "string" && !Nf(r) && r.indexOf("/") >= 0) { const s = new Error(`Bucket name shouldn't contain '/', received '${r}'`); throw s.name = "InvalidBucketName", s; } return t({ ...n }); }; } var Df = { step: "initialize", tags: ["VALIDATE_BUCKET_NAME"], name: "validateBucketNameMiddleware", override: true }; var Uf = (e) => ({ applyToStack: (t) => { t.add(Of(e), Df), t.addRelativeTo(Mf(e), Ff); } }); var $f = void 0; function Lf(e) { return e === void 0 ? true : typeof e == "string" && e.length <= 50; } function Hf(e) { const t = ht(e.userAgentAppId ?? $f), { customUserAgent: n } = e; return Object.assign(e, { customUserAgent: typeof n == "string" ? [[n]] : n, userAgentAppId: async () => { var s, i; const r = await t(); if (!Lf(r)) { const o = ((i = (s = e.logger) == null ? void 0 : s.constructor) == null ? void 0 : i.name) === "NoOpLogger" || !e.logger ? console : e.logger; 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.")); } return r; } }); } var zf = class { constructor({ size: t, params: n }) { this.data = /* @__PURE__ */ new Map(), this.parameters = [], this.capacity = t ?? 50, n && (this.parameters = n); } get(t, n) { const r = this.hash(t); if (r === false) return n(); if (!this.data.has(r)) { if (this.data.size > this.capacity + 10) { const s = this.data.keys(); let i = 0; for (; ; ) { const { value: o, done: a } = s.next(); if (this.data.delete(o), a || ++i > 10) break; } } this.data.set(r, n()); } return this.data.get(r); } size() { return this.data.size; } hash(t) { let n = ""; const { parameters: r } = this; if (r.length === 0) return false; for (const s of r) { const i = String(t[s] ?? ""); if (i.includes("|;")) return false; n += i + "|;"; } return n; } }; var jf = 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}$"); var ia = (e) => jf.test(e) || e.startsWith("[") && e.endsWith("]"); var qf = new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"); var Nr = (e, t = false) => { if (!t) return qf.test(e); const n = e.split("."); for (const r of n) if (!Nr(r)) return false; return true; }; var Jt = {}; var Ot = "endpoints"; function Xe(e) { return typeof e != "object" || e == null ? e : "ref" in e ? `$${Xe(e.ref)}` : "fn" in e ? `${e.fn}(${(e.argv || []).map(Xe).join(", ")})` : JSON.stringify(e, null, 2); } var Be = class extends Error { constructor(t) { super(t), this.name = "EndpointError"; } }; var Vf = (e, t) => e === t; var Wf = (e) => { const t = e.split("."), n = []; for (const r of t) { const s = r.indexOf("["); if (s !== -1) { if (r.indexOf("]") !== r.length - 1) throw new Be(`Path: '${e}' does not end with ']'`); const i = r.slice(s + 1, -1); if (Number.isNaN(parseInt(i))) throw new Be(`Invalid array index: '${i}' in path: '${e}'`); s !== 0 && n.push(r.slice(0, s)), n.push(i); } else n.push(r); } return n; }; var oa = (e, t) => Wf(t).reduce((n, r) => { if (typeof n != "object") throw new Be(`Index '${r}' in '${t}' not found in '${JSON.stringify(e)}'`); return Array.isArray(n) ? n[parseInt(r)] : n[r]; }, e); var Kf = (e) => e != null; var Gf = (e) => !e; var In = { [Mt.HTTP]: 80, [Mt.HTTPS]: 443 }; var Zf = (e) => { const t = (() => { try { if (e instanceof URL) return e; if (typeof e == "object" && "hostname" in e) { const { hostname: p, port: g, protocol: S = "", path: T = "", query: A = {} } = e, I = new URL(`${S}//${p}${g ? `:${g}` : ""}${T}`); return I.search = Object.entries(A).map(([L, H]) => `${L}=${H}`).join("&"), I; } return new URL(e); } catch { return null; } })(); if (!t) return null; const n = t.href, { host: r, hostname: s, pathname: i, protocol: o, search: a } = t; if (a) return null; const c = o.slice(0, -1); if (!Object.values(Mt).includes(c)) return null; const u = ia(s), l = n.includes(`${r}:${In[c]}`) || typeof e == "string" && e.includes(`${r}:${In[c]}`), f = `${r}${l ? `:${In[c]}` : ""}`; return { scheme: c, authority: f, path: i, normalizedPath: i.endsWith("/") ? i : `${i}/`, isIp: u }; }; var Xf = (e, t) => e === t; var Qf = (e, t, n, r) => t >= n || e.length < n ? null : r ? e.substring(e.length - n, e.length - t) : e.substring(t, n); var Yf = (e) => encodeURIComponent(e).replace(/[!*'()]/g, (t) => `%${t.charCodeAt(0).toString(16).toUpperCase()}`); var Jf = { booleanEquals: Vf, getAttr: oa, isSet: Kf, isValidHostLabel: Nr, not: Gf, parseURL: Zf, stringEquals: Xf, substring: Qf, uriEncode: Yf }; var aa = (e, t) => { const n = [], r = { ...t.endpointParams, ...t.referenceRecord }; let s = 0; for (; s < e.length; ) { const i = e.indexOf("{", s); if (i === -1) { n.push(e.slice(s)); break; } n.push(e.slice(s, i)); const o = e.indexOf("}", i); if (o === -1) { n.push(e.slice(i)); break; } e[i + 1] === "{" && e[o + 1] === "}" && (n.push(e.slice(i + 1, o)), s = o + 2); const a = e.substring(i + 1, o); if (a.includes("#")) { const [c, u] = a.split("#"); n.push(oa(r[c], u)); } else n.push(r[a]); s = o + 1; } return n.join(""); }; var eh = ({ ref: e }, t) => ({ ...t.endpointParams, ...t.referenceRecord })[e]; var dn = (e, t, n) => { if (typeof e == "string") return aa(e, n); if (e.fn) return ca(e, n); if (e.ref) return eh(e, n); throw new Be(`'${t}': ${String(e)} is not a string, function or reference.`); }; var ca = ({ fn: e, argv: t }, n) => { const r = t.map((i) => ["boolean", "number"].includes(typeof i) ? i : dn(i, "arg", n)), s = e.split("."); return s[0] in Jt && s[1] != null ? Jt[s[0]][s[1]](...r) : Jf[e](...r); }; var th = ({ assign: e, ...t }, n) => { var s, i; if (e && e in n.referenceRecord) throw new Be(`'${e}' is already defined in Reference Record.`); const r = ca(t, n); return (i = (s = n.logger) == null ? void 0 : s.debug) == null || i.call(s, `${Ot} evaluateCondition: ${Xe(t)} = ${Xe(r)}`), { result: r === "" ? true : !!r, ...e != null && { toAssign: { name: e, value: r } } }; }; var Mr = (e = [], t) => { var r, s; const n = {}; for (const i of e) { const { result: o, toAssign: a } = th(i, { ...t, referenceRecord: { ...t.referenceRecord, ...n } }); if (!o) return { result: o }; a && (n[a.name] = a.value, (s = (r = t.logger) == null ? void 0 : r.debug) == null || s.call(r, `${Ot} assign: ${a.name} := ${Xe(a.value)}`)); } return { result: true, referenceRecord: n }; }; var nh = (e, t) => Object.entries(e).reduce((n, [r, s]) => ({ ...n, [r]: s.map((i) => { const o = dn(i, "Header value entry", t); if (typeof o != "string") throw new Be(`Header '${r}' value '${o}' is not a string`); return o; }) }), {}); var ua = (e, t) => { if (Array.isArray(e)) return e.map((n) => ua(n, t)); switch (typeof e) { case "string": return aa(e, t); case "object": if (e === null) throw new Be(`Unexpected endpoint property: ${e}`); return da(e, t); case "boolean": return e; default: throw new Be(`Unexpected endpoint property type: ${typeof e}`); } }; var da = (e, t) => Object.entries(e).reduce((n, [r, s]) => ({ ...n, [r]: ua(s, t) }), {}); var rh = (e, t) => { const n = dn(e, "Endpoint URL", t); if (typeof n == "string") try { return new URL(n); } catch (r) { throw r; } throw new Be(`Endpoint URL must be a string, got ${typeof n}`); }; var sh = (e, t) => { var l, f; const { conditions: n, endpoint: r } = e, { result: s, referenceRecord: i } = Mr(n, t); if (!s) return; const o = { ...t, referenceRecord: { ...t.referenceRecord, ...i } }, { url: a, properties: c, headers: u } = r; return (f = (l = t.logger) == null ? void 0 : l.debug) == null || f.call(l, `${Ot} Resolving endpoint from template: ${Xe(r)}`), { ...u != null && { headers: nh(u, o) }, ...c != null && { properties: da(c, o) }, url: rh(a, o) }; }; var ih = (e, t) => { const { conditions: n, error: r } = e, { result: s, referenceRecord: i } = Mr(n, t); if (s) throw new Be(dn(r, "Error", { ...t, referenceRecord: { ...t.referenceRecord, ...i } })); }; var oh = (e, t) => { const { conditions: n, rules: r } = e, { result: s, referenceRecord: i } = Mr(n, t); if (s) return la(r, { ...t, referenceRecord: { ...t.referenceRecord, ...i } }); }; var la = (e, t) => { for (const n of e) if (n.type === "endpoint") { const r = sh(n, t); if (r) return r; } else if (n.type === "error") ih(n, t); else if (n.type === "tree") { const r = oh(n, t); if (r) return r; } else throw new Be(`Unknown endpoint rule: ${n}`); throw new Be("Rules evaluation failed"); }; var ah = (e, t) => { var u, l, f, p; const { endpointParams: n, logger: r } = t, { parameters: s, rules: i } = e; (l = (u = t.logger) == null ? void 0 : u.debug) == null || l.call(u, `${Ot} Initial EndpointParams: ${Xe(n)}`); const o = Object.entries(s).filter(([, g]) => g.default != null).map(([g, S]) => [g, S.default]); if (o.length > 0) for (const [g, S] of o) n[g] = n[g] ?? S; const a = Object.entries(s).filter(([, g]) => g.required).map(([g]) => g); for (const g of a) if (n[g] == null) throw new Be(`Missing required parameter: '${g}'`); const c = la(i, { endpointParams: n, logger: r, referenceRecord: {} }); return (p = (f = t.logger) == null ? void 0 : f.debug) == null || p.call(f, `${Ot} Resolved endpoint: ${Xe(c)}`), c; }; var fa = (e, t = false) => { if (t) { for (const n of e.split(".")) if (!fa(n)) return false; return true; } return !(!Nr(e) || e.length < 3 || e.length > 63 || e !== e.toLowerCase() || ia(e)); }; var Os = ":"; var ch = "/"; var uh = (e) => { const t = e.split(Os); if (t.length < 6) return null; const [n, r, s, i, o, ...a] = t; if (n !== "arn" || r === "" || s === "" || a.join(Os) === "") return null; const c = a.map((u) => u.split(ch)).flat(); return { partition: r, service: s, region: i, accountId: o, resourceId: c }; }; var dh = [ { id: "aws", outputs: { dnsSuffix: "amazonaws.com", dualStackDnsSuffix: "api.aws", implicitGlobalRegion: "us-east-1", name: "aws", supportsDualStack: true, supportsFIPS: true }, regionRegex: "^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$", regions: { "af-south-1": { description: "Africa (Cape Town)" }, "ap-east-1": { description: "Asia Pacific (Hong Kong)" }, "ap-east-2": { description: "Asia Pacific (Taipei)" }, "ap-northeast-1": { description: "Asia Pacific (Tokyo)" }, "ap-northeast-2": { description: "Asia Pacific (Seoul)" }, "ap-northeast-3": { description: "Asia Pacific (Osaka)" }, "ap-south-1": { description: "Asia Pacific (Mumbai)" }, "ap-south-2": { description: "Asia Pacific (Hyderabad)" }, "ap-southeast-1": { description: "Asia Pacific (Singapore)" }, "ap-southeast-2": { description: "Asia Pacific (Sydney)" }, "ap-southeast-3": { description: "Asia Pacific (Jakarta)" }, "ap-southeast-4": { description: "Asia Pacific (Melbourne)" }, "ap-southeast-5": { description: "Asia Pacific (Malaysia)" }, "ap-southeast-7": { description: "Asia Pacific (Thailand)" }, "aws-global": { description: "AWS Standard global region" }, "ca-central-1": { description: "Canada (Central)" }, "ca-west-1": { description: "Canada West (Calgary)" }, "eu-central-1": { description: "Europe (Frankfurt)" }, "eu-central-2": { description: "Europe (Zurich)" }, "eu-north-1": { description: "Europe (Stockholm)" }, "eu-south-1": { description: "Europe (Milan)" }, "eu-south-2": { description: "Europe (Spain)" }, "eu-west-1": { description: "Europe (Ireland)" }, "eu-west-2": { description: "Europe (London)" }, "eu-west-3": { description: "Europe (Paris)" }, "il-central-1": { description: "Israel (Tel Aviv)" }, "me-central-1": { description: "Middle East (UAE)" }, "me-south-1": { description: "Middle East (Bahrain)" }, "mx-central-1": { description: "Mexico (Central)" }, "sa-east-1": { description: "South America (Sao Paulo)" }, "us-east-1": { description: "US East (N. Virginia)" }, "us-east-2": { description: "US East (Ohio)" }, "us-west-1": { description: "US West (N. California)" }, "us-west-2": { description: "US West (Oregon)" } } }, { id: "aws-cn", outputs: { dnsSuffix: "amazonaws.com.cn", dualStackDnsSuffix: "api.amazonwebservices.com.cn", implicitGlobalRegion: "cn-northwest-1", name: "aws-cn", supportsDualStack: true, supportsFIPS: true }, regionRegex: "^cn\\-\\w+\\-\\d+$", regions: { "aws-cn-global": { description: "AWS China global region" }, "cn-north-1": { description: "China (Beijing)" }, "cn-northwest-1": { description: "China (Ningxia)" } } }, { id: "aws-us-gov", outputs: { dnsSuffix: "amazonaws.com", dualStackDnsSuffix: "api.aws", implicitGlobalRegion: "us-gov-west-1", name: "aws-us-gov", supportsDualStack: true, supportsFIPS: true }, regionRegex: "^us\\-gov\\-\\w+\\-\\d+$", regions: { "aws-us-gov-global": { description: "AWS GovCloud (US) global region" }, "us-gov-east-1": { description: "AWS GovCloud (US-East)" }, "us-gov-west-1": { description: "AWS GovCloud (US-West)" } } }, { id: "aws-iso", outputs: { dnsSuffix: "c2s.ic.gov", dualStackDnsSuffix: "c2s.ic.gov", implicitGlobalRegion: "us-iso-east-1", name: "aws-iso", supportsDualStack: false, supportsFIPS: true }, regionRegex: "^us\\-iso\\-\\w+\\-\\d+$", regions: { "aws-iso-global": { description: "AWS ISO (US) global region" }, "us-iso-east-1": { description: "US ISO East" }, "us-iso-west-1": { description: "US ISO WEST" } } }, { id: "aws-iso-b", outputs: { dnsSuffix: "sc2s.sgov.gov", dualStackDnsSuffix: "sc2s.sgov.gov", implicitGlobalRegion: "us-isob-east-1", name: "aws-iso-b", supportsDualStack: false, supportsFIPS: true }, regionRegex: "^us\\-isob\\-\\w+\\-\\d+$", regions: { "aws-iso-b-global": { description: "AWS ISOB (US) global region" }, "us-isob-east-1": { description: "US ISOB East (Ohio)" } } }, { id: "aws-iso-e", outputs: { dnsSuffix: "cloud.adc-e.uk", dualStackDnsSuffix: "cloud.adc-e.uk", implicitGlobalRegion: "eu-isoe-west-1", name: "aws-iso-e", supportsDualStack: false, supportsFIPS: true }, regionRegex: "^eu\\-isoe\\-\\w+\\-\\d+$", regions: { "aws-iso-e-global": { description: "AWS ISOE (Europe) global region" }, "eu-isoe-west-1": { description: "EU ISOE West" } } }, { id: "aws-iso-f", outputs: { dnsSuffix: "csp.hci.ic.gov", dualStackDnsSuffix: "csp.hci.ic.gov", implicitGlobalRegion: "us-isof-south-1", name: "aws-iso-f", supportsDualStack: false, supportsFIPS: true }, regionRegex: "^us\\-isof\\-\\w+\\-\\d+$", regions: { "aws-iso-f-global": { description: "AWS ISOF global region" }, "us-isof-east-1": { description: "US ISOF EAST" }, "us-isof-south-1": { description: "US ISOF SOUTH" } } }, { id: "aws-eusc", outputs: { dnsSuffix: "amazonaws.eu", dualStackDnsSuffix: "amazonaws.eu", implicitGlobalRegion: "eusc-de-east-1", name: "aws-eusc", supportsDualStack: false, supportsFIPS: true }, regionRegex: "^eusc\\-(de)\\-\\w+\\-\\d+$", regions: { "eusc-de-east-1": { description: "EU (Germany)" } } } ]; var lh = "1.1"; var fh = { partitions: dh, version: lh }; var hh = fh; var ph = (e) => { const { partitions: t } = hh; for (const r of t) { const { regions: s, outputs: i } = r; for (const [o, a] of Object.entries(s)) if (o === e) return { ...i, ...a }; } for (const r of t) { const { regionRegex: s, outputs: i } = r; if (new RegExp(s).test(e)) return { ...i }; } const n = t.find((r) => r.id === "aws"); if (!n) throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist."); return { ...n.outputs }; }; var ha = { isVirtualHostableS3Bucket: fa, parseArn: uh, partition: ph }; Jt.aws = ha; function gh(e) { const t = {}; if (e = e.replace(/^\?/, ""), e) for (const n of e.split("&")) { let [r, s = null] = n.split("="); r = decodeURIComponent(r), s && (s = decodeURIComponent(s)), r in t ? Array.isArray(t[r]) ? t[r].push(s) : t[r] = [t[r], s] : t[r] = s; } return t; } var en = (e) => { if (typeof e == "string") return en(new URL(e)); const { hostname: t, pathname: n, port: r, protocol: s, search: i } = e; let o; return i && (o = gh(i)), { hostname: t, port: r ? parseInt(r) : void 0, protocol: s, path: n, query: o }; }; var mh = /\d{12}\.ddb/; async function yh(e, t, n) { var i, o, a, c, u, l, f; const r = n.request; if (((i = r == null ? void 0 : r.headers) == null ? void 0 : i["smithy-protocol"]) === "rpc-v2-cbor" && ne(e, "PROTOCOL_RPC_V2_CBOR", "M"), typeof t.retryStrategy == "function") { const p = await t.retryStrategy(); typeof p.acquireInitialRetryToken == "function" ? (a = (o = p.constructor) == null ? void 0 : o.name) != null && a.includes("Adaptive") ? ne(e, "RETRY_MODE_ADAPTIVE", "F") : ne(e, "RETRY_MODE_STANDARD", "E") : ne(e, "RETRY_MODE_LEGACY", "D"); } if (typeof t.accountIdEndpointMode == "function") { const p = e.endpointV2; switch (String((c = p == null ? void 0 : p.url) == null ? void 0 : c.hostname).match(mh) && ne(e, "ACCOUNT_ID_ENDPOINT", "O"), await ((u = t.accountIdEndpointMode) == null ? void 0 : u.call(t))) { case "disabled": ne(e, "ACCOUNT_ID_MODE_DISABLED", "Q"); break; case "preferred": ne(e, "ACCOUNT_ID_MODE_PREFERRED", "P"); break; case "required": ne(e, "ACCOUNT_ID_MODE_REQUIRED", "R"); break; } } const s = (f = (l = e.__smithy_context) == null ? void 0 : l.selectedHttpAuthScheme) == null ? void 0 : f.identity; if (s != null && s.$source) { const p = s; p.accountId && ne(e, "RESOLVED_ACCOUNT_ID", "T"); for (const [g, S] of Object.entries(p.$source ?? {})) ne(e, g, S); } } var Ds = "user-agent"; var _n = "x-amz-user-agent"; var Us = " "; var Pn = "/"; var wh = /[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g; var bh = /[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g; var $s = "-"; var Eh = 1024; function xh(e) { let t = ""; for (const n in e) { const r = e[n]; if (t.length + r.length + 1 <= Eh) { t.length ? t += "," + r : t += r; continue; } break; } return t; } var Sh = (e) => (t, n) => async (r) => { var g, S, T, A; const { request: s } = r; if (!se.isInstance(s)) return t(r); const { headers: i } = s, o = ((g = n == null ? void 0 : n.userAgent) == null ? void 0 : g.map($t)) || [], a = (await e.defaultUserAgentProvider()).map($t); await yh(n, e, r); const c = n; a.push(`m/${xh(Object.assign({}, (S = n.__smithy_context) == null ? void 0 : S.features, (T = c.__aws_sdk_context) == null ? void 0 : T.features))}`); const u = ((A = e == null ? void 0 : e.customUserAgent) == null ? void 0 : A.map($t)) || [], l = await e.userAgentAppId(); l && a.push($t([`app/${l}`])); const f = [].concat([...a, ...o, ...u]).join(Us), p = [ ...a.filter((I) => I.startsWith("aws-sdk-")), ...u ].join(Us); return e.runtime !== "browser" ? (p && (i[_n] = i[_n] ? `${i[Ds]} ${p}` : p), i[Ds] = f) : i[_n] = f, t({ ...r, request: s }); }; var $t = (e) => { var o; const t = e[0].split(Pn).map((a) => a.replace(wh, $s)).join(Pn), n = (o = e[1]) == null ? void 0 : o.replace(bh, $s), r = t.indexOf(Pn), s = t.substring(0, r); let i = t.substring(r + 1); return s === "api" && (i = i.toLowerCase()), [s, i, n].filter((a) => a && a.length > 0).reduce((a, c, u) => { switch (u) { case 0: return c; case 1: return `${a}/${c}`; default: return `${a}#${c}`; } }, ""); }; var Ah = { name: "getUserAgentMiddleware", step: "build", priority: "low", tags: ["SET_USER_AGENT", "USER_AGENT"], override: true }; var Ch = (e) => ({ applyToStack: (t) => { t.add(Sh(e), Ah); } }); var vh = false; var Rh = false; var pa = (e) => typeof e == "string" && (e.startsWith("fips-") || e.endsWith("-fips")); var Ls = (e) => pa(e) ? ["fips-aws-global", "aws-fips"].includes(e) ? "us-east-1" : e.replace(/fips-(dkr-|prod-)?|-fips/, "") : e; var kh = (e) => { const { region: t, useFipsEndpoint: n } = e; if (!t) throw new Error("Region is missing"); return Object.assign(e, { region: async () => { if (typeof t == "string") return Ls(t); const r = await t(); return Ls(r); }, useFipsEndpoint: async () => { const r = typeof t == "string" ? t : await t(); return pa(r) ? true : typeof n != "function" ? Promise.resolve(!!n) : n(); } }); }; var Th = (e) => Object.assign(e, { eventStreamMarshaller: e.eventStreamSerdeProvider(e) }); var Hs = "content-length"; function Bh(e) { return (t) => async (n) => { const r = n.request; if (se.isInstance(r)) { const { body: s, headers: i } = r; if (s && Object.keys(i).map((o) => o.toLowerCase()).indexOf(Hs) === -1) try { const o = e(s); r.headers = { ...r.headers, [Hs]: String(o) }; } catch { } } return t({ ...n, request: r }); }; } var Ih = { step: "build", tags: ["SET_CONTENT_LENGTH", "CONTENT_LENGTH"], name: "contentLengthMiddleware", override: true }; var _h = (e) => ({ applyToStack: (t) => { t.add(Bh(e.bodyLengthChecker), Ih); } }); var Ph = async (e) => { const t = (e == null ? void 0 : e.Bucket) || ""; if (typeof e.Bucket == "string" && (e.Bucket = t.replace(/#/g, encodeURIComponent("#")).replace(/\?/g, encodeURIComponent("?"))), Dh(t)) { if (e.ForcePathStyle === true) throw new Error("Path-style addressing cannot be used with ARN buckets"); } else (!Oh(t) || t.indexOf(".") !== -1 && !String(e.Endpoint).startsWith("http:") || t.toLowerCase() !== t || t.length < 3) && (e.ForcePathStyle = true); return e.DisableMultiRegionAccessPoints && (e.disableMultiRegionAccessPoints = true, e.DisableMRAP = true), e; }; var Nh = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/; var Mh = /(\d+\.){3}\d+/; var Fh = /\.\./; var Oh = (e) => Nh.test(e) && !Mh.test(e) && !Fh.test(e); var Dh = (e) => { const [t, n, r, , , s] = e.split(":"), i = t === "arn" && e.split(":").length >= 6, o = !!(i && n && r && s); if (i && !o) throw new Error(`Invalid ARN: ${e} was an invalid ARN.`); return o; }; var Uh = (e, t, n) => { const r = async () => { const s = n[e] ?? n[t]; return typeof s == "function" ? s() : s; }; return e === "credentialScope" || t === "CredentialScope" ? async () => { const s = typeof n.credentials == "function" ? await n.credentials() : n.credentials; return (s == null ? void 0 : s.credentialScope) ?? (s == null ? void 0 : s.CredentialScope); } : e === "accountId" || t === "AccountId" ? async () => { const s = typeof n.credentials == "function" ? await n.credentials() : n.credentials; return (s == null ? void 0 : s.accountId) ?? (s == null ? void 0 : s.AccountId); } : e === "endpoint" || t === "endpoint" ? async () => { if (n.isCustomEndpoint === false) return; const s = await r(); if (s && typeof s == "object") { if ("url" in s) return s.url.href; if ("hostname" in s) { const { protocol: i, hostname: o, port: a, path: c } = s; return `${i}//${o}${a ? ":" + a : ""}${c}`; } } return s; } : r; }; var ga = async (e) => { }; var ma = (e) => typeof e == "object" ? "url" in e ? en(e.url) : e : en(e); var $h = async (e, t, n, r) => { if (!n.isCustomEndpoint) { let o; n.serviceConfiguredEndpoint ? o = await n.serviceConfiguredEndpoint() : o = await ga(n.serviceId), o && (n.endpoint = () => Promise.resolve(ma(o)), n.isCustomEndpoint = true); } const s = await ya(e, t, n); if (typeof n.endpointProvider != "function") throw new Error("config.endpointProvider is not set."); return n.endpointProvider(s, r); }; var ya = async (e, t, n) => { var i; const r = {}, s = ((i = t == null ? void 0 : t.getEndpointParameterInstructions) == null ? void 0 : i.call(t)) || {}; for (const [o, a] of Object.entries(s)) switch (a.type) { case "staticContextParams": r[o] = a.value; break; case "contextParams": r[o] = e[a.name]; break; case "clientContextParams": case "builtInParams": r[o] = await Uh(a.name, o, n)(); break; case "operationContextParams": r[o] = a.get(e); break; default: throw new Error("Unrecognized endpoint parameter instruction: " + JSON.stringify(a)); } return Object.keys(s).length === 0 && Object.assign(r, n), String(n.serviceId).toLowerCase() === "s3" && await Ph(r), r; }; var Lh = ({ config: e, instructions: t }) => (n, r) => async (s) => { var a, c, u; e.isCustomEndpoint && Tu(r, "ENDPOINT_OVERRIDE", "N"); const i = await $h(s.input, { getEndpointParameterInstructions() { return t; } }, { ...e }, r); r.endpointV2 = i, r.authSchemes = (a = i.properties) == null ? void 0 : a.authSchemes; const o = (c = r.authSchemes) == null ? void 0 : c[0]; if (o) { r.signing_region = o.signingRegion, r.signing_service = o.signingName; const l = St(r), f = (u = l == null ? void 0 : l.selectedHttpAuthScheme) == null ? void 0 : u.httpAuthOption; f && (f.signingProperties = Object.assign(f.signingProperties || {}, { signing_region: o.signingRegion, signingRegion: o.signingRegion, signing_service: o.signingName, signingName: o.signingName, signingRegionSet: o.signingRegionSet }, o.properties)); } return n({ ...s }); }; var Hh = { step: "serialize", tags: ["ENDPOINT_PARAMETERS", "ENDPOINT_V2", "ENDPOINT"], name: "endpointV2Middleware", override: true, relation: "before", toMiddleware: xo.name }; var wa = (e, t) => ({ applyToStack: (n) => { n.addRelativeTo(Lh({ config: e, instructions: t }), Hh); } }); var zh = (e) => { const t = e.tls ?? true, { endpoint: n, useDualstackEndpoint: r, useFipsEndpoint: s } = e, i = n != null ? async () => ma(await Ne(n)()) : void 0, a = Object.assign(e, { endpoint: i, tls: t, isCustomEndpoint: !!n, useDualstackEndpoint: Ne(r ?? false), useFipsEndpoint: Ne(s ?? false) }); let c; return a.serviceConfiguredEndpoint = async () => (e.serviceId && !c && (c = ga(e.serviceId)), c), a; }; var wt; (function(e) { e.STANDARD = "standard", e.ADAPTIVE = "adaptive"; })(wt || (wt = {})); var Fr = 3; var jh = wt.STANDARD; var qh = [ "BandwidthLimitExceeded", "EC2ThrottledException", "LimitExceededException", "PriorRequestNotComplete", "ProvisionedThroughputExceededException", "RequestLimitExceeded", "RequestThrottled", "RequestThrottledException", "SlowDown", "ThrottledException", "Throttling", "ThrottlingException", "TooManyRequestsException", "TransactionInProgressException" ]; var Vh = ["TimeoutError", "RequestTimeout", "RequestTimeoutException"]; var Wh = [500, 502, 503, 504]; var Kh = ["ECONNRESET", "ECONNREFUSED", "EPIPE", "ETIMEDOUT"]; var Gh = ["EHOSTUNREACH", "ENETUNREACH", "ENOTFOUND"]; var Zh = (e) => { var t; return (t = e.$metadata) == null ? void 0 : t.clockSkewCorrected; }; var Xh = (e) => { const t = /* @__PURE__ */ new Set([ "Failed to fetch", "NetworkError when attempting to fetch resource", "The Internet connection appears to be offline", "Load failed", "Network request failed" ]); return e && e instanceof TypeError ? t.has(e.message) : false; }; var ba = (e) => { var t, n; return ((t = e.$metadata) == null ? void 0 : t.httpStatusCode) === 429 || qh.includes(e.name) || ((n = e.$retryable) == null ? void 0 : n.throttling) == true; }; var Or = (e, t = 0) => { var n; return Zh(e) || Vh.includes(e.name) || Kh.includes((e == null ? void 0 : e.code) || "") || Gh.includes((e == null ? void 0 : e.code) || "") || Wh.includes(((n = e.$metadata) == null ? void 0 : n.httpStatusCode) || 0) || Xh(e) || e.cause !== void 0 && t <= 10 && Or(e.cause, t + 1); }; var Qh = (e) => { var t; if (((t = e.$metadata) == null ? void 0 : t.httpStatusCode) !== void 0) { const n = e.$metadata.httpStatusCode; return 500 <= n && n <= 599 && !Or(e); } return false; }; var ln = class _ln { constructor(t) { this.currentCapacity = 0, this.enabled = false, this.lastMaxRate = 0, this.measuredTxRate = 0, this.requestCount = 0, this.lastTimestamp = 0, this.timeWindow = 0, this.beta = (t == null ? void 0 : t.beta) ?? 0.7, this.minCapacity = (t == null ? void 0 : t.minCapacity) ?? 1, this.minFillRate = (t == null ? void 0 : t.minFillRate) ?? 0.5, this.scaleConstant = (t == null ? void 0 : t.scaleConstant) ?? 0.4, this.smooth = (t == null ? void 0 : t.smooth) ?? 0.8; const n = this.getCurrentTimeInSeconds(); this.lastThrottleTime = n, this.lastTxRateBucket = Math.floor(this.getCurrentTimeInSeconds()), this.fillRate = this.minFillRate, this.maxCapacity = this.minCapacity; } getCurrentTimeInSeconds() { return Date.now() / 1e3; } async getSendToken() { return this.acquireTokenBucket(1); } async acquireTokenBucket(t) { if (this.enabled) { if (this.refillTokenBucket(), t > this.currentCapacity) { const n = (t - this.currentCapacity) / this.fillRate * 1e3; await new Promise((r) => _ln.setTimeoutFn(r, n)); } this.currentCapacity = this.currentCapacity - t; } } refillTokenBucket() { const t = this.getCurrentTimeInSeconds(); if (!this.lastTimestamp) { this.lastTimestamp = t; return; } const n = (t - this.lastTimestamp) * this.fillRate; this.currentCapacity = Math.min(this.maxCapacity, this.currentCapacity + n), this.lastTimestamp = t; } updateClientSendingRate(t) { let n; if (this.updateMeasuredRate(), ba(t)) { const s = this.enabled ? Math.min(this.measuredTxRate, this.fillRate) : this.measuredTxRate; this.lastMaxRate = s, this.calculateTimeWindow(), this.lastThrottleTime = this.getCurrentTimeInSeconds(), n = this.cubicThrottle(s), this.enableTokenBucket(); } else this.calculateTimeWindow(), n = this.cubicSuccess(this.getCurrentTimeInSeconds()); const r = Math.min(n, 2 * this.measuredTxRate); this.updateTokenBucketRate(r); } calculateTimeWindow() { this.timeWindow = this.getPrecise(Math.pow(this.lastMaxRate * (1 - this.beta) / this.scaleConstant, 1 / 3)); } cubicThrottle(t) { return this.getPrecise(t * this.beta); } cubicSuccess(t) { return this.getPrecise(this.scaleConstant * Math.pow(t - this.lastThrottleTime - this.timeWindow, 3) + this.lastMaxRate); } enableTokenBucket() { this.enabled = true; } updateTokenBucketRate(t) { this.refillTokenBucket(), this.fillRate = Math.max(t, this.minFillRate), this.maxCapacity = Math.max(t, this.minCapacity), this.currentCapacity = Math.min(this.currentCapacity, this.maxCapacity); } updateMeasuredRate() { const t = this.getCurrentTimeInSeconds(), n = Math.floor(t * 2) / 2; if (this.requestCount++, n > this.lastTxRateBucket) { const r = this.requestCount / (n - this.lastTxRateBucket); this.measuredTxRate = this.getPrecise(r * this.smooth + this.measuredTxRate * (1 - this.smooth)), this.requestCount = 0, this.lastTxRateBucket = n; } } getPrecise(t) { return parseFloat(t.toFixed(8)); } }; ln.setTimeoutFn = setTimeout; var br = 100; var Ea = 20 * 1e3; var Yh = 500; var zs = 500; var Jh = 5; var ep = 10; var tp = 1; var np = "amz-sdk-invocation-id"; var rp = "amz-sdk-request"; var sp = () => { let e = br; return { computeNextBackoffDelay: (r) => Math.floor(Math.min(Ea, Math.random() * 2 ** r * e)), setDelayBase: (r) => { e = r; } }; }; var js = ({ retryDelay: e, retryCount: t, retryCost: n }) => ({ getRetryCount: () => t, getRetryDelay: () => Math.min(Ea, e), getRetryCost: () => n }); var xa = class { constructor(t) { this.maxAttempts = t, this.mode = wt.STANDARD, this.capacity = zs, this.retryBackoffStrategy = sp(), this.maxAttemptsProvider = typeof t == "function" ? t : async () => t; } async acquireInitialRetryToken(t) { return js({ retryDelay: br, retryCount: 0 }); } async refreshRetryTokenForRetry(t, n) { const r = await this.getMaxAttempts(); if (this.shouldRetry(t, n, r)) { const s = n.errorType; this.retryBackoffStrategy.setDelayBase(s === "THROTTLING" ? Yh : br); const i = this.retryBackoffStrategy.computeNextBackoffDelay(t.getRetryCount()), o = n.retryAfterHint ? Math.max(n.retryAfterHint.getTime() - Date.now() || 0, i) : i, a = this.getCapacityCost(s); return this.capacity -= a, js({ retryDelay: o, retryCount: t.getRetryCount() + 1, retryCost: a }); } throw new Error("No retry token available"); } recordSuccess(t) { this.capacity = Math.max(zs, this.capacity + (t.getRetryCost() ?? tp)); } getCapacity() { return this.capacity; } async getMaxAttempts() { try { return await this.maxAttemptsProvider(); } catch { return Fr; } } shouldRetry(t, n, r) { return t.getRetryCount() + 1 < r && this.capacity >= this.getCapacityCost(n.errorType) && this.isRetryableError(n.errorType); } getCapacityCost(t) { return t === "TRANSIENT" ? ep : Jh; } isRetryableError(t) { return t === "THROTTLING" || t === "TRANSIENT"; } }; var ip = class { constructor(t, n) { this.maxAttemptsProvider = t, this.mode = wt.ADAPTIVE; const { rateLimiter: r } = n ?? {}; this.rateLimiter = r ?? new ln(), this.standardRetryStrategy = new xa(t); } async acquireInitialRetryToken(t) { return await this.rateLimiter.getSendToken(), this.standardRetryStrategy.acquireInitialRetryToken(t); } async refreshRetryTokenForRetry(t, n) { return this.rateLimiter.updateClientSendingRate(n), this.standardRetryStrategy.refreshRetryTokenForRetry(t, n); } recordSuccess(t) { this.rateLimiter.updateClientSendingRate({}), this.standardRetryStrategy.recordSuccess(t); } }; var Lt; var op = new Uint8Array(16); function ap() { if (!Lt && (Lt = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Lt)) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported"); return Lt(op); } var le = []; for (let e = 0; e < 256; ++e) le.push((e + 256).toString(16).slice(1)); function cp(e, t = 0) { return le[e[t + 0]] + le[e[t + 1]] + le[e[t + 2]] + le[e[t + 3]] + "-" + le[e[t + 4]] + le[e[t + 5]] + "-" + le[e[t + 6]] + le[e[t + 7]] + "-" + le[e[t + 8]] + le[e[t + 9]] + "-" + le[e[t + 10]] + le[e[t + 11]] + le[e[t + 12]] + le[e[t + 13]] + le[e[t + 14]] + le[e[t + 15]]; } var up = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto); var qs = { randomUUID: up }; function dp(e, t, n) { if (qs.randomUUID && !t && !e) return qs.randomUUID(); e = e || {}; const r = e.random || (e.rng || ap)(); if (r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, t) { n = n || 0; for (let s = 0; s < 16; ++s) t[n + s] = r[s]; return t; } return cp(r); } var lp = (e) => e instanceof Error ? e : e instanceof Object ? Object.assign(new Error(), e) : typeof e == "string" ? new Error(e) : new Error(`AWS SDK error wrapper for ${e}`); var fp = (e) => { const { retryStrategy: t, retryMode: n, maxAttempts: r } = e, s = Ne(r ?? Fr); return Object.assign(e, { maxAttempts: s, retryStrategy: async () => t || (await Ne(n)() === wt.ADAPTIVE ? new ip(s) : new xa(s)) }); }; var hp = (e) => (e == null ? void 0 : e.body) instanceof ReadableStream; var pp = (e) => (t, n) => async (r) => { var o; let s = await e.retryStrategy(); const i = await e.maxAttempts(); if (gp(s)) { s = s; let a = await s.acquireInitialRetryToken(n.partition_id), c = new Error(), u = 0, l = 0; const { request: f } = r, p = se.isInstance(f); for (p && (f.headers[np] = dp()); ; ) try { p && (f.headers[rp] = `attempt=${u + 1}; max=${i}`); const { response: g, output: S } = await t(r); return s.recordSuccess(a), S.$metadata.attempts = u + 1, S.$metadata.totalRetryDelay = l, { response: g, output: S }; } catch (g) { const S = mp(g); if (c = lp(g), p && hp(f)) throw (o = n.logger instanceof kr ? console : n.logger) == null || o.warn("An error was encountered in a non-retryable streaming request."), c; try { a = await s.refreshRetryTokenForRetry(a, S); } catch { throw c.$metadata || (c.$metadata = {}), c.$metadata.attempts = u + 1, c.$metadata.totalRetryDelay = l, c; } u = a.getRetryCount(); const T = a.getRetryDelay(); l += T, await new Promise((A) => setTimeout(A, T)); } } else return s = s, s != null && s.mode && (n.userAgent = [...n.userAgent || [], ["cfg/retry-mode", s.mode]]), s.retry(t, r); }; var gp = (e) => typeof e.acquireInitialRetryToken < "u" && typeof e.refreshRetryTokenForRetry < "u" && typeof e.recordSuccess < "u"; var mp = (e) => { const t = { error: e, errorType: yp(e) }, n = Ep(e.$response); return n && (t.retryAfterHint = n), t; }; var yp = (e) => ba(e) ? "THROTTLING" : Or(e) ? "TRANSIENT" : Qh(e) ? "SERVER_ERROR" : "CLIENT_ERROR"; var wp = { name: "retryMiddleware", tags: ["RETRY"], step: "finalizeRequest", priority: "high", override: true }; var bp = (e) => ({ applyToStack: (t) => { t.add(pp(e), wp); } }); var Ep = (e) => { if (!gt2.isInstance(e)) return; const t = Object.keys(e.headers).find((i) => i.toLowerCase() === "retry-after"); if (!t) return; const n = e.headers[t], r = Number(n); return Number.isNaN(r) ? new Date(n) : new Date(r * 1e3); }; var Sa = class { constructor(t) { _(this, "sigv4aSigner"); _(this, "sigv4Signer"); _(this, "signerOptions"); this.sigv4Signer = new wf(t), this.signerOptions = t; } static sigv4aDependency() { return "none"; } async sign(t, n = {}) { return n.signingRegion === "*" ? this.getSigv4aSigner().sign(t, n) : this.sigv4Signer.sign(t, n); } async signWithCredentials(t, n, r = {}) { if (r.signingRegion === "*") throw this.getSigv4aSigner(), new Error(`signWithCredentials with signingRegion '*' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt`); return this.sigv4Signer.signWithCredentials(t, n, r); } async presign(t, n = {}) { if (n.signingRegion === "*") throw this.getSigv4aSigner(), new Error(`presign with signingRegion '*' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt`); return this.sigv4Signer.presign(t, n); } async presignWithCredentials(t, n, r = {}) { if (r.signingRegion === "*") throw new Error("Method presignWithCredentials is not supported for [signingRegion=*]."); return this.sigv4Signer.presignWithCredentials(t, n, r); } getSigv4aSigner() { if (!this.sigv4aSigner) throw this.signerOptions.runtime === "node" ? new Error("Neither CRT nor JS SigV4a implementation is available. Please load either @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt") : new Error("JS SigV4a implementation is not available or not a valid constructor. Please check whether you have installed the @aws-sdk/signature-v4a package explicitly. The CRT implementation is not available for browsers. You must also register the package by calling [require('@aws-sdk/signature-v4a');] or an ESM equivalent such as [import '@aws-sdk/signature-v4a';]. For more information please go to https://github.com/aws/aws-sdk-js-v3#using-javascript-non-crt-implementation-of-sigv4a"); return this.sigv4aSigner; } }; var Dr = "required"; var d = "type"; var w = "rules"; var h = "conditions"; var m = "fn"; var y = "argv"; var B = "ref"; var M = "assign"; var v = "url"; var R = "properties"; var rt = "backend"; var be = "authSchemes"; var ue = "disableDoubleEncoding"; var de = "signingName"; var Ce = "signingRegion"; var k = "headers"; var Ur = "signingRegionSet"; var xp = 6; var Sp = false; var Oe = true; var Te = "isSet"; var J = "booleanEquals"; var C = "error"; var tn = "aws.partition"; var $ = "stringEquals"; var G = "getAttr"; var Y = "name"; var q = "substring"; var Vs = "bucketSuffix"; var $r = "parseURL"; var x = "endpoint"; var b = "tree"; var nn = "aws.isVirtualHostableS3Bucket"; var rn = "{url#scheme}://{Bucket}.{url#authority}{url#path}"; var $e = "not"; var Ws = "accessPointSuffix"; var Vt = "{url#scheme}://{url#authority}{url#path}"; var Aa = "hardwareType"; var Ca = "regionPrefix"; var Ks = "bucketAliasSuffix"; var Er = "outpostId"; var at = "isValidHostLabel"; var Lr = "sigv4a"; var Dt = "s3-outposts"; var bt = "s3"; var va = "{url#scheme}://{url#authority}{url#normalizedPath}{Bucket}"; var Ra = "https://{Bucket}.s3-accelerate.{partitionResult#dnsSuffix}"; var Gs = "https://{Bucket}.s3.{partitionResult#dnsSuffix}"; var ka = "aws.parseArn"; var Ta = "bucketArn"; var Ba = "arnType"; var sn = ""; var Hr = "s3-object-lambda"; var Ia = "accesspoint"; var zr = "accessPointName"; var Zs = "{url#scheme}://{accessPointName}-{bucketArn#accountId}.{url#authority}{url#path}"; var Xs = "mrapPartition"; var Qs = "outpostType"; var Ys = "arnPrefix"; var _a = "{url#scheme}://{url#authority}{url#normalizedPath}{uri_encoded_bucket}"; var Js = "https://s3.{partitionResult#dnsSuffix}/{uri_encoded_bucket}"; var ei = "https://s3.{partitionResult#dnsSuffix}"; var ct = { [Dr]: false, [d]: "String" }; var ut = { [Dr]: true, default: false, [d]: "Boolean" }; var vt = { [Dr]: false, [d]: "Boolean" }; var _e = { [m]: J, [y]: [{ [B]: "Accelerate" }, true] }; var W = { [m]: J, [y]: [{ [B]: "UseFIPS" }, true] }; var j = { [m]: J, [y]: [{ [B]: "UseDualStack" }, true] }; var X = { [m]: Te, [y]: [{ [B]: "Endpoint" }] }; var Pa = { [m]: tn, [y]: [{ [B]: "Region" }], [M]: "partitionResult" }; var ti = { [m]: $, [y]: [{ [m]: G, [y]: [{ [B]: "partitionResult" }, Y] }, "aws-cn"] }; var Pt = { [m]: Te, [y]: [{ [B]: "Bucket" }] }; var U = { [B]: "Bucket" }; var ni = { [h]: [j], [C]: "S3Express does not support Dual-stack.", [d]: C }; var ri = { [h]: [_e], [C]: "S3Express does not support S3 Accelerate.", [d]: C }; var si = { [h]: [X, { [m]: $r, [y]: [{ [B]: "Endpoint" }], [M]: "url" }], [w]: [{ [h]: [{ [m]: Te, [y]: [{ [B]: "DisableS3ExpressSessionAuth" }] }, { [m]: J, [y]: [{ [B]: "DisableS3ExpressSessionAuth" }, true] }], [w]: [{ [h]: [{ [m]: J, [y]: [{ [m]: G, [y]: [{ [B]: "url" }, "isIp"] }, true] }], [w]: [{ [h]: [{ [m]: "uriEncode", [y]: [U], [M]: "uri_encoded_bucket" }], [w]: [{ [x]: { [v]: "{url#scheme}://{url#authority}/{uri_encoded_bucket}{url#path}", [R]: { [rt]: "S3Express", [be]: [{ [ue]: true, [Y]: "sigv4", [de]: "s3express", [Ce]: "{Region}" }] }, [k]: {} }, [d]: x }], [d]: b }], [d]: b }, { [h]: [{ [m]: nn, [y]: [U, false] }], [w]: [{ [x]: { [v]: rn, [R]: { [rt]: "S3Express", [be]: [{ [ue]: true, [Y]: "sigv4", [de]: "s3express", [Ce]: "{Region}" }] }, [k]: {} }, [d]: x }], [d]: b }, { [C]: "S3Express bucket name is not a valid virtual hostable name.", [d]: C }], [d]: b }, { [h]: [{ [m]: J, [y]: [{ [m]: G, [y]: [{ [B]: "url" }, "isIp"] }, true] }], [w]: [{ [h]: [{ [m]: "uriEncode", [y]: [U], [M]: "uri_encoded_bucket" }], [w]: [{ [x]: { [v]: "{url#scheme}://{url#authority}/{uri_encoded_bucket}{url#path}", [R]: { [rt]: "S3Express", [be]: [{ [ue]: true, [Y]: "sigv4-s3express", [de]: "s3express", [Ce]: "{Region}" }] }, [k]: {} }, [d]: x }], [d]: b }], [d]: b }, { [h]: [{ [m]: nn, [y]: [U, false] }], [w]: [{ [x]: { [v]: rn, [R]: { [rt]: "S3Express", [be]: [{ [ue]: true, [Y]: "sigv4-s3express", [de]: "s3express", [Ce]: "{Region}" }] }, [k]: {} }, [d]: x }], [d]: b }, { [C]: "S3Express bucket name is not a valid virtual hostable name.", [d]: C }], [d]: b }; var Se = { [m]: $r, [y]: [{ [B]: "Endpoint" }], [M]: "url" }; var Nn = { [m]: J, [y]: [{ [m]: G, [y]: [{ [B]: "url" }, "isIp"] }, true] }; var Na = { [B]: "url" }; var Ma = { [m]: "uriEncode", [y]: [U], [M]: "uri_encoded_bucket" }; var tt = { [rt]: "S3Express", [be]: [{ [ue]: true, [Y]: "sigv4", [de]: "s3express", [Ce]: "{Region}" }] }; var P = {}; var Fa = { [m]: nn, [y]: [U, false] }; var ii = { [C]: "S3Express bucket name is not a valid virtual hostable name.", [d]: C }; var oi = { [m]: Te, [y]: [{ [B]: "UseS3ExpressControlEndpoint" }] }; var ai = { [m]: J, [y]: [{ [B]: "UseS3ExpressControlEndpoint" }, true] }; var N = { [m]: $e, [y]: [X] }; var Ht = { [C]: "Unrecognized S3Express bucket name format.", [d]: C }; var ci = { [m]: $e, [y]: [Pt] }; var ui = { [B]: Aa }; var di = { [h]: [N], [C]: "Expected a endpoint to be specified but no endpoint was found", [d]: C }; var zt = { [be]: [{ [ue]: true, [Y]: Lr, [de]: Dt, [Ur]: ["*"] }, { [ue]: true, [Y]: "sigv4", [de]: Dt, [Ce]: "{Region}" }] }; var Mn = { [m]: J, [y]: [{ [B]: "ForcePathStyle" }, false] }; var Ap = { [B]: "ForcePathStyle" }; var te = { [m]: J, [y]: [{ [B]: "Accelerate" }, false] }; var ie = { [m]: $, [y]: [{ [B]: "Region" }, "aws-global"] }; var oe = { [be]: [{ [ue]: true, [Y]: "sigv4", [de]: bt, [Ce]: "us-east-1" }] }; var D = { [m]: $e, [y]: [ie] }; var ae = { [m]: J, [y]: [{ [B]: "UseGlobalEndpoint" }, true] }; var li = { [v]: "https://{Bucket}.s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}", [R]: { [be]: [{ [ue]: true, [Y]: "sigv4", [de]: bt, [Ce]: "{Region}" }] }, [k]: {} }; var re = { [be]: [{ [ue]: true, [Y]: "sigv4", [de]: bt, [Ce]: "{Region}" }] }; var ce = { [m]: J, [y]: [{ [B]: "UseGlobalEndpoint" }, false] }; var O = { [m]: J, [y]: [{ [B]: "UseDualStack" }, false] }; var fi = { [v]: "https://{Bucket}.s3-fips.{Region}.{partitionResult#dnsSuffix}", [R]: re, [k]: {} }; var F = { [m]: J, [y]: [{ [B]: "UseFIPS" }, false] }; var hi = { [v]: "https://{Bucket}.s3-accelerate.dualstack.{partitionResult#dnsSuffix}", [R]: re, [k]: {} }; var pi = { [v]: "https://{Bucket}.s3.dualstack.{Region}.{partitionResult#dnsSuffix}", [R]: re, [k]: {} }; var Fn = { [m]: J, [y]: [{ [m]: G, [y]: [Na, "isIp"] }, false] }; var On = { [v]: va, [R]: re, [k]: {} }; var xr = { [v]: rn, [R]: re, [k]: {} }; var gi = { [x]: xr, [d]: x }; var Dn = { [v]: Ra, [R]: re, [k]: {} }; var mi = { [v]: "https://{Bucket}.s3.{Region}.{partitionResult#dnsSuffix}", [R]: re, [k]: {} }; var jt = { [C]: "Invalid region: region was not a valid DNS name.", [d]: C }; var ke = { [B]: Ta }; var Oa = { [B]: Ba }; var Un = { [m]: G, [y]: [ke, "service"] }; var jr = { [B]: zr }; var yi = { [h]: [j], [C]: "S3 Object Lambda does not support Dual-stack", [d]: C }; var wi = { [h]: [_e], [C]: "S3 Object Lambda does not support S3 Accelerate", [d]: C }; var bi = { [h]: [{ [m]: Te, [y]: [{ [B]: "DisableAccessPoints" }] }, { [m]: J, [y]: [{ [B]: "DisableAccessPoints" }, true] }], [C]: "Access points are not supported for this operation", [d]: C }; var $n = { [h]: [{ [m]: Te, [y]: [{ [B]: "UseArnRegion" }] }, { [m]: J, [y]: [{ [B]: "UseArnRegion" }, false] }, { [m]: $e, [y]: [{ [m]: $, [y]: [{ [m]: G, [y]: [ke, "region"] }, "{Region}"] }] }], [C]: "Invalid configuration: region from ARN `{bucketArn#region}` does not match client region `{Region}` and UseArnRegion is `false`", [d]: C }; var Da = { [m]: G, [y]: [{ [B]: "bucketPartition" }, Y] }; var Ua = { [m]: G, [y]: [ke, "accountId"] }; var Ln = { [be]: [{ [ue]: true, [Y]: "sigv4", [de]: Hr, [Ce]: "{bucketArn#region}" }] }; var Ei = { [C]: "Invalid ARN: The access point name may only contain a-z, A-Z, 0-9 and `-`. Found: `{accessPointName}`", [d]: C }; var Hn = { [C]: "Invalid ARN: The account id may only contain a-z, A-Z, 0-9 and `-`. Found: `{bucketArn#accountId}`", [d]: C }; var zn = { [C]: "Invalid region in ARN: `{bucketArn#region}` (invalid DNS name)", [d]: C }; var jn = { [C]: "Client was configured for partition `{partitionResult#name}` but ARN (`{Bucket}`) has `{bucketPartition#name}`", [d]: C }; var xi = { [C]: "Invalid ARN: The ARN may only contain a single resource component after `accesspoint`.", [d]: C }; var Si = { [C]: "Invalid ARN: Expected a resource of the format `accesspoint:` but no name was provided", [d]: C }; var Rt = { [be]: [{ [ue]: true, [Y]: "sigv4", [de]: bt, [Ce]: "{bucketArn#region}" }] }; var Ai = { [be]: [{ [ue]: true, [Y]: Lr, [de]: Dt, [Ur]: ["*"] }, { [ue]: true, [Y]: "sigv4", [de]: Dt, [Ce]: "{bucketArn#region}" }] }; var Ci = { [m]: ka, [y]: [U] }; var vi = { [v]: "https://s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}", [R]: re, [k]: {} }; var Ri = { [v]: "https://s3-fips.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}", [R]: re, [k]: {} }; var ki = { [v]: "https://s3.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}", [R]: re, [k]: {} }; var qn = { [v]: _a, [R]: re, [k]: {} }; var Ti = { [v]: "https://s3.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}", [R]: re, [k]: {} }; var Bi = { [B]: "UseObjectLambdaEndpoint" }; var Vn = { [be]: [{ [ue]: true, [Y]: "sigv4", [de]: Hr, [Ce]: "{Region}" }] }; var Ii = { [v]: "https://s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}", [R]: re, [k]: {} }; var _i = { [v]: "https://s3-fips.{Region}.{partitionResult#dnsSuffix}", [R]: re, [k]: {} }; var Pi = { [v]: "https://s3.dualstack.{Region}.{partitionResult#dnsSuffix}", [R]: re, [k]: {} }; var Wn = { [v]: Vt, [R]: re, [k]: {} }; var Ni = { [v]: "https://s3.{Region}.{partitionResult#dnsSuffix}", [R]: re, [k]: {} }; var Kn = [{ [B]: "Region" }]; var Cp = [{ [B]: "Endpoint" }]; var vp = [U]; var Mi = [j]; var Gn = [_e]; var dt = [X, Se]; var Fi = [{ [m]: Te, [y]: [{ [B]: "DisableS3ExpressSessionAuth" }] }, { [m]: J, [y]: [{ [B]: "DisableS3ExpressSessionAuth" }, true] }]; var Rp = [Ma]; var Oi = [Fa]; var Ie = [Pa]; var lt = [W]; var Di = [{ [m]: q, [y]: [U, 6, 14, true], [M]: "s3expressAvailabilityZoneId" }, { [m]: q, [y]: [U, 14, 16, true], [M]: "s3expressAvailabilityZoneDelim" }, { [m]: $, [y]: [{ [B]: "s3expressAvailabilityZoneDelim" }, "--"] }]; var De = [{ [h]: [W], [x]: { [v]: "https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.{Region}.{partitionResult#dnsSuffix}", [R]: tt, [k]: {} }, [d]: x }, { [x]: { [v]: "https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.{Region}.{partitionResult#dnsSuffix}", [R]: tt, [k]: {} }, [d]: x }]; var Ui = [{ [m]: q, [y]: [U, 6, 15, true], [M]: "s3expressAvailabilityZoneId" }, { [m]: q, [y]: [U, 15, 17, true], [M]: "s3expressAvailabilityZoneDelim" }, { [m]: $, [y]: [{ [B]: "s3expressAvailabilityZoneDelim" }, "--"] }]; var $i = [{ [m]: q, [y]: [U, 6, 19, true], [M]: "s3expressAvailabilityZoneId" }, { [m]: q, [y]: [U, 19, 21, true], [M]: "s3expressAvailabilityZoneDelim" }, { [m]: $, [y]: [{ [B]: "s3expressAvailabilityZoneDelim" }, "--"] }]; var Li = [{ [m]: q, [y]: [U, 6, 20, true], [M]: "s3expressAvailabilityZoneId" }, { [m]: q, [y]: [U, 20, 22, true], [M]: "s3expressAvailabilityZoneDelim" }, { [m]: $, [y]: [{ [B]: "s3expressAvailabilityZoneDelim" }, "--"] }]; var Hi = [{ [m]: q, [y]: [U, 6, 26, true], [M]: "s3expressAvailabilityZoneId" }, { [m]: q, [y]: [U, 26, 28, true], [M]: "s3expressAvailabilityZoneDelim" }, { [m]: $, [y]: [{ [B]: "s3expressAvailabilityZoneDelim" }, "--"] }]; var Ue = [{ [h]: [W], [x]: { [v]: "https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.{Region}.{partitionResult#dnsSuffix}", [R]: { [rt]: "S3Express", [be]: [{ [ue]: true, [Y]: "sigv4-s3express", [de]: "s3express", [Ce]: "{Region}" }] }, [k]: {} }, [d]: x }, { [x]: { [v]: "https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.{Region}.{partitionResult#dnsSuffix}", [R]: { [rt]: "S3Express", [be]: [{ [ue]: true, [Y]: "sigv4-s3express", [de]: "s3express", [Ce]: "{Region}" }] }, [k]: {} }, [d]: x }]; var zi = [U, 0, 7, true]; var ji = [{ [m]: q, [y]: [U, 7, 15, true], [M]: "s3expressAvailabilityZoneId" }, { [m]: q, [y]: [U, 15, 17, true], [M]: "s3expressAvailabilityZoneDelim" }, { [m]: $, [y]: [{ [B]: "s3expressAvailabilityZoneDelim" }, "--"] }]; var qi = [{ [m]: q, [y]: [U, 7, 16, true], [M]: "s3expressAvailabilityZoneId" }, { [m]: q, [y]: [U, 16, 18, true], [M]: "s3expressAvailabilityZoneDelim" }, { [m]: $, [y]: [{ [B]: "s3expressAvailabilityZoneDelim" }, "--"] }]; var Vi = [{ [m]: q, [y]: [U, 7, 20, true], [M]: "s3expressAvailabilityZoneId" }, { [m]: q, [y]: [U, 20, 22, true], [M]: "s3expressAvailabilityZoneDelim" }, { [m]: $, [y]: [{ [B]: "s3expressAvailabilityZoneDelim" }, "--"] }]; var Wi = [{ [m]: q, [y]: [U, 7, 21, true], [M]: "s3expressAvailabilityZoneId" }, { [m]: q, [y]: [U, 21, 23, true], [M]: "s3expressAvailabilityZoneDelim" }, { [m]: $, [y]: [{ [B]: "s3expressAvailabilityZoneDelim" }, "--"] }]; var Ki = [{ [m]: q, [y]: [U, 7, 27, true], [M]: "s3expressAvailabilityZoneId" }, { [m]: q, [y]: [U, 27, 29, true], [M]: "s3expressAvailabilityZoneDelim" }, { [m]: $, [y]: [{ [B]: "s3expressAvailabilityZoneDelim" }, "--"] }]; var kp = [Pt]; var Gi = [{ [m]: at, [y]: [{ [B]: Er }, false] }]; var Zi = [{ [m]: $, [y]: [{ [B]: Ca }, "beta"] }]; var Tp = ["*"]; var Xi = [{ [m]: at, [y]: [{ [B]: "Region" }, false] }]; var He = [{ [m]: $, [y]: [{ [B]: "Region" }, "us-east-1"] }]; var Zn = [{ [m]: $, [y]: [Oa, Ia] }]; var Qi = [{ [m]: G, [y]: [ke, "resourceId[1]"], [M]: zr }, { [m]: $e, [y]: [{ [m]: $, [y]: [jr, sn] }] }]; var Bp = [ke, "resourceId[1]"]; var Xn = [{ [m]: $e, [y]: [{ [m]: $, [y]: [{ [m]: G, [y]: [ke, "region"] }, sn] }] }]; var Yi = [{ [m]: $e, [y]: [{ [m]: Te, [y]: [{ [m]: G, [y]: [ke, "resourceId[2]"] }] }] }]; var Ip = [ke, "resourceId[2]"]; var Qn = [{ [m]: tn, [y]: [{ [m]: G, [y]: [ke, "region"] }], [M]: "bucketPartition" }]; var Ji = [{ [m]: $, [y]: [Da, { [m]: G, [y]: [{ [B]: "partitionResult" }, Y] }] }]; var Yn = [{ [m]: at, [y]: [{ [m]: G, [y]: [ke, "region"] }, true] }]; var Jn = [{ [m]: at, [y]: [Ua, false] }]; var eo = [{ [m]: at, [y]: [jr, false] }]; var to = [{ [m]: at, [y]: [{ [B]: "Region" }, true] }]; var _p = { version: "1.0", parameters: { Bucket: ct, Region: ct, UseFIPS: ut, UseDualStack: ut, Endpoint: ct, ForcePathStyle: ut, Accelerate: ut, UseGlobalEndpoint: ut, UseObjectLambdaEndpoint: vt, Key: ct, Prefix: ct, CopySource: ct, DisableAccessPoints: vt, DisableMultiRegionAccessPoints: ut, UseArnRegion: vt, UseS3ExpressControlEndpoint: vt, DisableS3ExpressSessionAuth: vt }, [w]: [{ [h]: [{ [m]: Te, [y]: Kn }], [w]: [{ [h]: [_e, W], error: "Accelerate cannot be used with FIPS", [d]: C }, { [h]: [j, X], error: "Cannot set dual-stack in combination with a custom endpoint.", [d]: C }, { [h]: [X, W], error: "A custom endpoint cannot be combined with FIPS", [d]: C }, { [h]: [X, _e], error: "A custom endpoint cannot be combined with S3 Accelerate", [d]: C }, { [h]: [W, Pa, ti], error: "Partition does not support FIPS", [d]: C }, { [h]: [Pt, { [m]: q, [y]: [U, 0, xp, Oe], [M]: Vs }, { [m]: $, [y]: [{ [B]: Vs }, "--x-s3"] }], [w]: [ni, ri, si, { [h]: [oi, ai], [w]: [{ [h]: Ie, [w]: [{ [h]: [Ma, N], [w]: [{ [h]: lt, endpoint: { [v]: "https://s3express-control-fips.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}", [R]: tt, [k]: P }, [d]: x }, { endpoint: { [v]: "https://s3express-control.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}", [R]: tt, [k]: P }, [d]: x }], [d]: b }], [d]: b }], [d]: b }, { [h]: Oi, [w]: [{ [h]: Ie, [w]: [{ [h]: Fi, [w]: [{ [h]: Di, [w]: De, [d]: b }, { [h]: Ui, [w]: De, [d]: b }, { [h]: $i, [w]: De, [d]: b }, { [h]: Li, [w]: De, [d]: b }, { [h]: Hi, [w]: De, [d]: b }, Ht], [d]: b }, { [h]: Di, [w]: Ue, [d]: b }, { [h]: Ui, [w]: Ue, [d]: b }, { [h]: $i, [w]: Ue, [d]: b }, { [h]: Li, [w]: Ue, [d]: b }, { [h]: Hi, [w]: Ue, [d]: b }, Ht], [d]: b }], [d]: b }, ii], [d]: b }, { [h]: [Pt, { [m]: q, [y]: zi, [M]: Ws }, { [m]: $, [y]: [{ [B]: Ws }, "--xa-s3"] }], [w]: [ni, ri, si, { [h]: Oi, [w]: [{ [h]: Ie, [w]: [{ [h]: Fi, [w]: [{ [h]: ji, [w]: De, [d]: b }, { [h]: qi, [w]: De, [d]: b }, { [h]: Vi, [w]: De, [d]: b }, { [h]: Wi, [w]: De, [d]: b }, { [h]: Ki, [w]: De, [d]: b }, Ht], [d]: b }, { [h]: ji, [w]: Ue, [d]: b }, { [h]: qi, [w]: Ue, [d]: b }, { [h]: Vi, [w]: Ue, [d]: b }, { [h]: Wi, [w]: Ue, [d]: b }, { [h]: Ki, [w]: Ue, [d]: b }, Ht], [d]: b }], [d]: b }, ii], [d]: b }, { [h]: [ci, oi, ai], [w]: [{ [h]: Ie, [w]: [{ [h]: dt, endpoint: { [v]: Vt, [R]: tt, [k]: P }, [d]: x }, { [h]: lt, endpoint: { [v]: "https://s3express-control-fips.{Region}.{partitionResult#dnsSuffix}", [R]: tt, [k]: P }, [d]: x }, { endpoint: { [v]: "https://s3express-control.{Region}.{partitionResult#dnsSuffix}", [R]: tt, [k]: P }, [d]: x }], [d]: b }], [d]: b }, { [h]: [Pt, { [m]: q, [y]: [U, 49, 50, Oe], [M]: Aa }, { [m]: q, [y]: [U, 8, 12, Oe], [M]: Ca }, { [m]: q, [y]: zi, [M]: Ks }, { [m]: q, [y]: [U, 32, 49, Oe], [M]: Er }, { [m]: tn, [y]: Kn, [M]: "regionPartition" }, { [m]: $, [y]: [{ [B]: Ks }, "--op-s3"] }], [w]: [{ [h]: Gi, [w]: [{ [h]: [{ [m]: $, [y]: [ui, "e"] }], [w]: [{ [h]: Zi, [w]: [di, { [h]: dt, endpoint: { [v]: "https://{Bucket}.ec2.{url#authority}", [R]: zt, [k]: P }, [d]: x }], [d]: b }, { endpoint: { [v]: "https://{Bucket}.ec2.s3-outposts.{Region}.{regionPartition#dnsSuffix}", [R]: zt, [k]: P }, [d]: x }], [d]: b }, { [h]: [{ [m]: $, [y]: [ui, "o"] }], [w]: [{ [h]: Zi, [w]: [di, { [h]: dt, endpoint: { [v]: "https://{Bucket}.op-{outpostId}.{url#authority}", [R]: zt, [k]: P }, [d]: x }], [d]: b }, { endpoint: { [v]: "https://{Bucket}.op-{outpostId}.s3-outposts.{Region}.{regionPartition#dnsSuffix}", [R]: zt, [k]: P }, [d]: x }], [d]: b }, { error: 'Unrecognized hardware type: "Expected hardware type o or e but got {hardwareType}"', [d]: C }], [d]: b }, { error: "Invalid ARN: The outpost Id must only contain a-z, A-Z, 0-9 and `-`.", [d]: C }], [d]: b }, { [h]: kp, [w]: [{ [h]: [X, { [m]: $e, [y]: [{ [m]: Te, [y]: [{ [m]: $r, [y]: Cp }] }] }], error: "Custom endpoint `{Endpoint}` was not a valid URI", [d]: C }, { [h]: [Mn, Fa], [w]: [{ [h]: Ie, [w]: [{ [h]: Xi, [w]: [{ [h]: [_e, ti], error: "S3 Accelerate cannot be used in this region", [d]: C }, { [h]: [j, W, te, N, ie], endpoint: { [v]: "https://{Bucket}.s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}", [R]: oe, [k]: P }, [d]: x }, { [h]: [j, W, te, N, D, ae], [w]: [{ endpoint: li, [d]: x }], [d]: b }, { [h]: [j, W, te, N, D, ce], endpoint: li, [d]: x }, { [h]: [O, W, te, N, ie], endpoint: { [v]: "https://{Bucket}.s3-fips.us-east-1.{partitionResult#dnsSuffix}", [R]: oe, [k]: P }, [d]: x }, { [h]: [O, W, te, N, D, ae], [w]: [{ endpoint: fi, [d]: x }], [d]: b }, { [h]: [O, W, te, N, D, ce], endpoint: fi, [d]: x }, { [h]: [j, F, _e, N, ie], endpoint: { [v]: "https://{Bucket}.s3-accelerate.dualstack.us-east-1.{partitionResult#dnsSuffix}", [R]: oe, [k]: P }, [d]: x }, { [h]: [j, F, _e, N, D, ae], [w]: [{ endpoint: hi, [d]: x }], [d]: b }, { [h]: [j, F, _e, N, D, ce], endpoint: hi, [d]: x }, { [h]: [j, F, te, N, ie], endpoint: { [v]: "https://{Bucket}.s3.dualstack.us-east-1.{partitionResult#dnsSuffix}", [R]: oe, [k]: P }, [d]: x }, { [h]: [j, F, te, N, D, ae], [w]: [{ endpoint: pi, [d]: x }], [d]: b }, { [h]: [j, F, te, N, D, ce], endpoint: pi, [d]: x }, { [h]: [O, F, te, X, Se, Nn, ie], endpoint: { [v]: va, [R]: oe, [k]: P }, [d]: x }, { [h]: [O, F, te, X, Se, Fn, ie], endpoint: { [v]: rn, [R]: oe, [k]: P }, [d]: x }, { [h]: [O, F, te, X, Se, Nn, D, ae], [w]: [{ [h]: He, endpoint: On, [d]: x }, { endpoint: On, [d]: x }], [d]: b }, { [h]: [O, F, te, X, Se, Fn, D, ae], [w]: [{ [h]: He, endpoint: xr, [d]: x }, gi], [d]: b }, { [h]: [O, F, te, X, Se, Nn, D, ce], endpoint: On, [d]: x }, { [h]: [O, F, te, X, Se, Fn, D, ce], endpoint: xr, [d]: x }, { [h]: [O, F, _e, N, ie], endpoint: { [v]: Ra, [R]: oe, [k]: P }, [d]: x }, { [h]: [O, F, _e, N, D, ae], [w]: [{ [h]: He, endpoint: Dn, [d]: x }, { endpoint: Dn, [d]: x }], [d]: b }, { [h]: [O, F, _e, N, D, ce], endpoint: Dn, [d]: x }, { [h]: [O, F, te, N, ie], endpoint: { [v]: Gs, [R]: oe, [k]: P }, [d]: x }, { [h]: [O, F, te, N, D, ae], [w]: [{ [h]: He, endpoint: { [v]: Gs, [R]: re, [k]: P }, [d]: x }, { endpoint: mi, [d]: x }], [d]: b }, { [h]: [O, F, te, N, D, ce], endpoint: mi, [d]: x }], [d]: b }, jt], [d]: b }], [d]: b }, { [h]: [X, Se, { [m]: $, [y]: [{ [m]: G, [y]: [Na, "scheme"] }, "http"] }, { [m]: nn, [y]: [U, Oe] }, Mn, F, O, te], [w]: [{ [h]: Ie, [w]: [{ [h]: Xi, [w]: [gi], [d]: b }, jt], [d]: b }], [d]: b }, { [h]: [Mn, { [m]: ka, [y]: vp, [M]: Ta }], [w]: [{ [h]: [{ [m]: G, [y]: [ke, "resourceId[0]"], [M]: Ba }, { [m]: $e, [y]: [{ [m]: $, [y]: [Oa, sn] }] }], [w]: [{ [h]: [{ [m]: $, [y]: [Un, Hr] }], [w]: [{ [h]: Zn, [w]: [{ [h]: Qi, [w]: [yi, wi, { [h]: Xn, [w]: [bi, { [h]: Yi, [w]: [$n, { [h]: Qn, [w]: [{ [h]: Ie, [w]: [{ [h]: Ji, [w]: [{ [h]: Yn, [w]: [{ [h]: [{ [m]: $, [y]: [Ua, sn] }], error: "Invalid ARN: Missing account id", [d]: C }, { [h]: Jn, [w]: [{ [h]: eo, [w]: [{ [h]: dt, endpoint: { [v]: Zs, [R]: Ln, [k]: P }, [d]: x }, { [h]: lt, endpoint: { [v]: "https://{accessPointName}-{bucketArn#accountId}.s3-object-lambda-fips.{bucketArn#region}.{bucketPartition#dnsSuffix}", [R]: Ln, [k]: P }, [d]: x }, { endpoint: { [v]: "https://{accessPointName}-{bucketArn#accountId}.s3-object-lambda.{bucketArn#region}.{bucketPartition#dnsSuffix}", [R]: Ln, [k]: P }, [d]: x }], [d]: b }, Ei], [d]: b }, Hn], [d]: b }, zn], [d]: b }, jn], [d]: b }], [d]: b }], [d]: b }, xi], [d]: b }, { error: "Invalid ARN: bucket ARN is missing a region", [d]: C }], [d]: b }, Si], [d]: b }, { error: "Invalid ARN: Object Lambda ARNs only support `accesspoint` arn types, but found: `{arnType}`", [d]: C }], [d]: b }, { [h]: Zn, [w]: [{ [h]: Qi, [w]: [{ [h]: Xn, [w]: [{ [h]: Zn, [w]: [{ [h]: Xn, [w]: [bi, { [h]: Yi, [w]: [$n, { [h]: Qn, [w]: [{ [h]: Ie, [w]: [{ [h]: [{ [m]: $, [y]: [Da, "{partitionResult#name}"] }], [w]: [{ [h]: Yn, [w]: [{ [h]: [{ [m]: $, [y]: [Un, bt] }], [w]: [{ [h]: Jn, [w]: [{ [h]: eo, [w]: [{ [h]: Gn, error: "Access Points do not support S3 Accelerate", [d]: C }, { [h]: [W, j], endpoint: { [v]: "https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint-fips.dualstack.{bucketArn#region}.{bucketPartition#dnsSuffix}", [R]: Rt, [k]: P }, [d]: x }, { [h]: [W, O], endpoint: { [v]: "https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint-fips.{bucketArn#region}.{bucketPartition#dnsSuffix}", [R]: Rt, [k]: P }, [d]: x }, { [h]: [F, j], endpoint: { [v]: "https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint.dualstack.{bucketArn#region}.{bucketPartition#dnsSuffix}", [R]: Rt, [k]: P }, [d]: x }, { [h]: [F, O, X, Se], endpoint: { [v]: Zs, [R]: Rt, [k]: P }, [d]: x }, { [h]: [F, O], endpoint: { [v]: "https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint.{bucketArn#region}.{bucketPartition#dnsSuffix}", [R]: Rt, [k]: P }, [d]: x }], [d]: b }, Ei], [d]: b }, Hn], [d]: b }, { error: "Invalid ARN: The ARN was not for the S3 service, found: {bucketArn#service}", [d]: C }], [d]: b }, zn], [d]: b }, jn], [d]: b }], [d]: b }], [d]: b }, xi], [d]: b }], [d]: b }], [d]: b }, { [h]: [{ [m]: at, [y]: [jr, Oe] }], [w]: [{ [h]: Mi, error: "S3 MRAP does not support dual-stack", [d]: C }, { [h]: lt, error: "S3 MRAP does not support FIPS", [d]: C }, { [h]: Gn, error: "S3 MRAP does not support S3 Accelerate", [d]: C }, { [h]: [{ [m]: J, [y]: [{ [B]: "DisableMultiRegionAccessPoints" }, Oe] }], error: "Invalid configuration: Multi-Region Access Point ARNs are disabled.", [d]: C }, { [h]: [{ [m]: tn, [y]: Kn, [M]: Xs }], [w]: [{ [h]: [{ [m]: $, [y]: [{ [m]: G, [y]: [{ [B]: Xs }, Y] }, { [m]: G, [y]: [ke, "partition"] }] }], [w]: [{ endpoint: { [v]: "https://{accessPointName}.accesspoint.s3-global.{mrapPartition#dnsSuffix}", [R]: { [be]: [{ [ue]: Oe, name: Lr, [de]: bt, [Ur]: Tp }] }, [k]: P }, [d]: x }], [d]: b }, { error: "Client was configured for partition `{mrapPartition#name}` but bucket referred to partition `{bucketArn#partition}`", [d]: C }], [d]: b }], [d]: b }, { error: "Invalid Access Point Name", [d]: C }], [d]: b }, Si], [d]: b }, { [h]: [{ [m]: $, [y]: [Un, Dt] }], [w]: [{ [h]: Mi, error: "S3 Outposts does not support Dual-stack", [d]: C }, { [h]: lt, error: "S3 Outposts does not support FIPS", [d]: C }, { [h]: Gn, error: "S3 Outposts does not support S3 Accelerate", [d]: C }, { [h]: [{ [m]: Te, [y]: [{ [m]: G, [y]: [ke, "resourceId[4]"] }] }], error: "Invalid Arn: Outpost Access Point ARN contains sub resources", [d]: C }, { [h]: [{ [m]: G, [y]: Bp, [M]: Er }], [w]: [{ [h]: Gi, [w]: [$n, { [h]: Qn, [w]: [{ [h]: Ie, [w]: [{ [h]: Ji, [w]: [{ [h]: Yn, [w]: [{ [h]: Jn, [w]: [{ [h]: [{ [m]: G, [y]: Ip, [M]: Qs }], [w]: [{ [h]: [{ [m]: G, [y]: [ke, "resourceId[3]"], [M]: zr }], [w]: [{ [h]: [{ [m]: $, [y]: [{ [B]: Qs }, Ia] }], [w]: [{ [h]: dt, endpoint: { [v]: "https://{accessPointName}-{bucketArn#accountId}.{outpostId}.{url#authority}", [R]: Ai, [k]: P }, [d]: x }, { endpoint: { [v]: "https://{accessPointName}-{bucketArn#accountId}.{outpostId}.s3-outposts.{bucketArn#region}.{bucketPartition#dnsSuffix}", [R]: Ai, [k]: P }, [d]: x }], [d]: b }, { error: "Expected an outpost type `accesspoint`, found {outpostType}", [d]: C }], [d]: b }, { error: "Invalid ARN: expected an access point name", [d]: C }], [d]: b }, { error: "Invalid ARN: Expected a 4-component resource", [d]: C }], [d]: b }, Hn], [d]: b }, zn], [d]: b }, jn], [d]: b }], [d]: b }], [d]: b }, { error: "Invalid ARN: The outpost Id may only contain a-z, A-Z, 0-9 and `-`. Found: `{outpostId}`", [d]: C }], [d]: b }, { error: "Invalid ARN: The Outpost Id was not set", [d]: C }], [d]: b }, { error: "Invalid ARN: Unrecognized format: {Bucket} (type: {arnType})", [d]: C }], [d]: b }, { error: "Invalid ARN: No ARN type specified", [d]: C }], [d]: b }, { [h]: [{ [m]: q, [y]: [U, 0, 4, Sp], [M]: Ys }, { [m]: $, [y]: [{ [B]: Ys }, "arn:"] }, { [m]: $e, [y]: [{ [m]: Te, [y]: [Ci] }] }], error: "Invalid ARN: `{Bucket}` was not a valid ARN", [d]: C }, { [h]: [{ [m]: J, [y]: [Ap, Oe] }, Ci], error: "Path-style addressing cannot be used with ARN buckets", [d]: C }, { [h]: Rp, [w]: [{ [h]: Ie, [w]: [{ [h]: [te], [w]: [{ [h]: [j, N, W, ie], endpoint: { [v]: "https://s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}", [R]: oe, [k]: P }, [d]: x }, { [h]: [j, N, W, D, ae], [w]: [{ endpoint: vi, [d]: x }], [d]: b }, { [h]: [j, N, W, D, ce], endpoint: vi, [d]: x }, { [h]: [O, N, W, ie], endpoint: { [v]: "https://s3-fips.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}", [R]: oe, [k]: P }, [d]: x }, { [h]: [O, N, W, D, ae], [w]: [{ endpoint: Ri, [d]: x }], [d]: b }, { [h]: [O, N, W, D, ce], endpoint: Ri, [d]: x }, { [h]: [j, N, F, ie], endpoint: { [v]: "https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}", [R]: oe, [k]: P }, [d]: x }, { [h]: [j, N, F, D, ae], [w]: [{ endpoint: ki, [d]: x }], [d]: b }, { [h]: [j, N, F, D, ce], endpoint: ki, [d]: x }, { [h]: [O, X, Se, F, ie], endpoint: { [v]: _a, [R]: oe, [k]: P }, [d]: x }, { [h]: [O, X, Se, F, D, ae], [w]: [{ [h]: He, endpoint: qn, [d]: x }, { endpoint: qn, [d]: x }], [d]: b }, { [h]: [O, X, Se, F, D, ce], endpoint: qn, [d]: x }, { [h]: [O, N, F, ie], endpoint: { [v]: Js, [R]: oe, [k]: P }, [d]: x }, { [h]: [O, N, F, D, ae], [w]: [{ [h]: He, endpoint: { [v]: Js, [R]: re, [k]: P }, [d]: x }, { endpoint: Ti, [d]: x }], [d]: b }, { [h]: [O, N, F, D, ce], endpoint: Ti, [d]: x }], [d]: b }, { error: "Path-style addressing cannot be used with S3 Accelerate", [d]: C }], [d]: b }], [d]: b }], [d]: b }, { [h]: [{ [m]: Te, [y]: [Bi] }, { [m]: J, [y]: [Bi, Oe] }], [w]: [{ [h]: Ie, [w]: [{ [h]: to, [w]: [yi, wi, { [h]: dt, endpoint: { [v]: Vt, [R]: Vn, [k]: P }, [d]: x }, { [h]: lt, endpoint: { [v]: "https://s3-object-lambda-fips.{Region}.{partitionResult#dnsSuffix}", [R]: Vn, [k]: P }, [d]: x }, { endpoint: { [v]: "https://s3-object-lambda.{Region}.{partitionResult#dnsSuffix}", [R]: Vn, [k]: P }, [d]: x }], [d]: b }, jt], [d]: b }], [d]: b }, { [h]: [ci], [w]: [{ [h]: Ie, [w]: [{ [h]: to, [w]: [{ [h]: [W, j, N, ie], endpoint: { [v]: "https://s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}", [R]: oe, [k]: P }, [d]: x }, { [h]: [W, j, N, D, ae], [w]: [{ endpoint: Ii, [d]: x }], [d]: b }, { [h]: [W, j, N, D, ce], endpoint: Ii, [d]: x }, { [h]: [W, O, N, ie], endpoint: { [v]: "https://s3-fips.us-east-1.{partitionResult#dnsSuffix}", [R]: oe, [k]: P }, [d]: x }, { [h]: [W, O, N, D, ae], [w]: [{ endpoint: _i, [d]: x }], [d]: b }, { [h]: [W, O, N, D, ce], endpoint: _i, [d]: x }, { [h]: [F, j, N, ie], endpoint: { [v]: "https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}", [R]: oe, [k]: P }, [d]: x }, { [h]: [F, j, N, D, ae], [w]: [{ endpoint: Pi, [d]: x }], [d]: b }, { [h]: [F, j, N, D, ce], endpoint: Pi, [d]: x }, { [h]: [F, O, X, Se, ie], endpoint: { [v]: Vt, [R]: oe, [k]: P }, [d]: x }, { [h]: [F, O, X, Se, D, ae], [w]: [{ [h]: He, endpoint: Wn, [d]: x }, { endpoint: Wn, [d]: x }], [d]: b }, { [h]: [F, O, X, Se, D, ce], endpoint: Wn, [d]: x }, { [h]: [F, O, N, ie], endpoint: { [v]: ei, [R]: oe, [k]: P }, [d]: x }, { [h]: [F, O, N, D, ae], [w]: [{ [h]: He, endpoint: { [v]: ei, [R]: re, [k]: P }, [d]: x }, { endpoint: Ni, [d]: x }], [d]: b }, { [h]: [F, O, N, D, ce], endpoint: Ni, [d]: x }], [d]: b }, jt], [d]: b }], [d]: b }], [d]: b }, { error: "A region must be set when sending requests to S3.", [d]: C }] }; var Pp = _p; var Np = new zf({ size: 50, params: [ "Accelerate", "Bucket", "DisableAccessPoints", "DisableMultiRegionAccessPoints", "DisableS3ExpressSessionAuth", "Endpoint", "ForcePathStyle", "Region", "UseArnRegion", "UseDualStack", "UseFIPS", "UseGlobalEndpoint", "UseObjectLambdaEndpoint", "UseS3ExpressControlEndpoint" ] }); var $a = (e, t = {}) => Np.get(e, () => ah(Pp, { endpointParams: e, logger: t.logger })); Jt.aws = ha; var Mp = (e) => async (t, n, r) => { var a, c, u; if (!r) throw new Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`"); const s = await e(t, n, r), i = (u = (c = (a = St(n)) == null ? void 0 : a.commandInstance) == null ? void 0 : c.constructor) == null ? void 0 : u.getEndpointParameterInstructions; if (!i) throw new Error(`getEndpointParameterInstructions() is not defined on \`${n.commandName}\``); const o = await ya(r, { getEndpointParameterInstructions: i }, t); return Object.assign(s, o); }; var Fp = async (e, t, n) => ({ operation: St(t).operation, region: await Ne(e.region)() || (() => { throw new Error("expected `region` to be configured for `aws.auth#sigv4`"); })() }); var Op = Mp(Fp); function La(e) { return { schemeId: "aws.auth#sigv4", signingProperties: { name: "s3", region: e.region }, propertiesExtractor: (t, n) => ({ signingProperties: { config: t, context: n } }) }; } function Ha(e) { return { schemeId: "aws.auth#sigv4a", signingProperties: { name: "s3", region: e.region }, propertiesExtractor: (t, n) => ({ signingProperties: { config: t, context: n } }) }; } var Dp = (e, t, n) => (s) => { var c; const o = (c = e(s).properties) == null ? void 0 : c.authSchemes; if (!o) return t(s); const a = []; for (const u of o) { const { name: l, properties: f = {}, ...p } = u, g = l.toLowerCase(); let S; if (g === "sigv4a") { S = "aws.auth#sigv4a"; const I = o.find((L) => { const H = L.name.toLowerCase(); return H !== "sigv4a" && H.startsWith("sigv4"); }); if (Sa.sigv4aDependency() === "none" && I) continue; } else if (g.startsWith("sigv4")) S = "aws.auth#sigv4"; else throw new Error(`Unknown HttpAuthScheme found in \`@smithy.rules#endpointRuleSet\`: \`${g}\``); const T = n[S]; if (!T) throw new Error(`Could not find HttpAuthOption create function for \`${S}\``); const A = T(s); A.schemeId = S, A.signingProperties = { ...A.signingProperties || {}, ...p, ...f }, a.push(A); } return a; }; var Up = (e) => { const t = []; switch (e.operation) { default: t.push(La(e)), t.push(Ha(e)); } return t; }; var $p = Dp($a, Up, { "aws.auth#sigv4": La, "aws.auth#sigv4a": Ha }); var Lp = (e) => { const t = ad(e), n = Fu(t); return Object.assign(n, { authSchemePreference: Ne(e.authSchemePreference ?? []) }); }; var Hp = (e) => Object.assign(e, { useFipsEndpoint: e.useFipsEndpoint ?? false, useDualstackEndpoint: e.useDualstackEndpoint ?? false, forcePathStyle: e.forcePathStyle ?? false, useAccelerateEndpoint: e.useAccelerateEndpoint ?? false, useGlobalEndpoint: e.useGlobalEndpoint ?? false, disableMultiregionAccessPoints: e.disableMultiregionAccessPoints ?? false, defaultSigningName: "s3" }); var za = { ForcePathStyle: { type: "clientContextParams", name: "forcePathStyle" }, UseArnRegion: { type: "clientContextParams", name: "useArnRegion" }, DisableMultiRegionAccessPoints: { type: "clientContextParams", name: "disableMultiregionAccessPoints" }, Accelerate: { type: "clientContextParams", name: "useAccelerateEndpoint" }, DisableS3ExpressSessionAuth: { type: "clientContextParams", name: "disableS3ExpressSessionAuth" }, UseGlobalEndpoint: { type: "builtInParams", name: "useGlobalEndpoint" }, UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, Endpoint: { type: "builtInParams", name: "endpoint" }, Region: { type: "builtInParams", name: "region" }, UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } }; var fe = class _fe extends ft { constructor(t) { super(t), Object.setPrototypeOf(this, _fe.prototype); } }; var qr = class _qr extends fe { constructor(n) { super({ name: "NoSuchUpload", $fault: "client", ...n }); _(this, "name", "NoSuchUpload"); _(this, "$fault", "client"); Object.setPrototypeOf(this, _qr.prototype); } }; var Vr = class _Vr extends fe { constructor(n) { super({ name: "ObjectNotInActiveTierError", $fault: "client", ...n }); _(this, "name", "ObjectNotInActiveTierError"); _(this, "$fault", "client"); Object.setPrototypeOf(this, _Vr.prototype); } }; var Wr = class _Wr extends fe { constructor(n) { super({ name: "BucketAlreadyExists", $fault: "client", ...n }); _(this, "name", "BucketAlreadyExists"); _(this, "$fault", "client"); Object.setPrototypeOf(this, _Wr.prototype); } }; var Kr = class _Kr extends fe { constructor(n) { super({ name: "BucketAlreadyOwnedByYou", $fault: "client", ...n }); _(this, "name", "BucketAlreadyOwnedByYou"); _(this, "$fault", "client"); Object.setPrototypeOf(this, _Kr.prototype); } }; var Gr = class _Gr extends fe { constructor(n) { super({ name: "NoSuchBucket", $fault: "client", ...n }); _(this, "name", "NoSuchBucket"); _(this, "$fault", "client"); Object.setPrototypeOf(this, _Gr.prototype); } }; var no; (function(e) { e.visit = (t, n) => t.Prefix !== void 0 ? n.Prefix(t.Prefix) : t.Tag !== void 0 ? n.Tag(t.Tag) : t.And !== void 0 ? n.And(t.And) : n._(t.$unknown[0], t.$unknown[1]); })(no || (no = {})); var ro; (function(e) { e.visit = (t, n) => t.Prefix !== void 0 ? n.Prefix(t.Prefix) : t.Tag !== void 0 ? n.Tag(t.Tag) : t.AccessPointArn !== void 0 ? n.AccessPointArn(t.AccessPointArn) : t.And !== void 0 ? n.And(t.And) : n._(t.$unknown[0], t.$unknown[1]); })(ro || (ro = {})); var Zr = class _Zr extends fe { constructor(n) { super({ name: "InvalidObjectState", $fault: "client", ...n }); _(this, "name", "InvalidObjectState"); _(this, "$fault", "client"); _(this, "StorageClass"); _(this, "AccessTier"); Object.setPrototypeOf(this, _Zr.prototype), this.StorageClass = n.StorageClass, this.AccessTier = n.AccessTier; } }; var Xr = class _Xr extends fe { constructor(n) { super({ name: "NoSuchKey", $fault: "client", ...n }); _(this, "name", "NoSuchKey"); _(this, "$fault", "client"); Object.setPrototypeOf(this, _Xr.prototype); } }; var Qr = class _Qr extends fe { constructor(n) { super({ name: "NotFound", $fault: "client", ...n }); _(this, "name", "NotFound"); _(this, "$fault", "client"); Object.setPrototypeOf(this, _Qr.prototype); } }; var zp = (e) => ({ ...e, ...e.SecretAccessKey && { SecretAccessKey: Me }, ...e.SessionToken && { SessionToken: Me } }); var jp = (e) => ({ ...e, ...e.SSEKMSKeyId && { SSEKMSKeyId: Me }, ...e.SSEKMSEncryptionContext && { SSEKMSEncryptionContext: Me }, ...e.Credentials && { Credentials: zp(e.Credentials) } }); var qp = (e) => ({ ...e, ...e.SSEKMSKeyId && { SSEKMSKeyId: Me }, ...e.SSEKMSEncryptionContext && { SSEKMSEncryptionContext: Me } }); var Yr = class _Yr extends fe { constructor(n) { super({ name: "EncryptionTypeMismatch", $fault: "client", ...n }); _(this, "name", "EncryptionTypeMismatch"); _(this, "$fault", "client"); Object.setPrototypeOf(this, _Yr.prototype); } }; var Jr = class _Jr extends fe { constructor(n) { super({ name: "InvalidRequest", $fault: "client", ...n }); _(this, "name", "InvalidRequest"); _(this, "$fault", "client"); Object.setPrototypeOf(this, _Jr.prototype); } }; var es = class _es extends fe { constructor(n) { super({ name: "InvalidWriteOffset", $fault: "client", ...n }); _(this, "name", "InvalidWriteOffset"); _(this, "$fault", "client"); Object.setPrototypeOf(this, _es.prototype); } }; var ts = class _ts extends fe { constructor(n) { super({ name: "TooManyParts", $fault: "client", ...n }); _(this, "name", "TooManyParts"); _(this, "$fault", "client"); Object.setPrototypeOf(this, _ts.prototype); } }; var ns = class _ns extends fe { constructor(n) { super({ name: "IdempotencyParameterMismatch", $fault: "client", ...n }); _(this, "name", "IdempotencyParameterMismatch"); _(this, "$fault", "client"); Object.setPrototypeOf(this, _ns.prototype); } }; var rs = class _rs extends fe { constructor(n) { super({ name: "ObjectAlreadyInActiveTierError", $fault: "client", ...n }); _(this, "name", "ObjectAlreadyInActiveTierError"); _(this, "$fault", "client"); Object.setPrototypeOf(this, _rs.prototype); } }; var so; (function(e) { e.visit = (t, n) => t.Records !== void 0 ? n.Records(t.Records) : t.Stats !== void 0 ? n.Stats(t.Stats) : t.Progress !== void 0 ? n.Progress(t.Progress) : t.Cont !== void 0 ? n.Cont(t.Cont) : t.End !== void 0 ? n.End(t.End) : n._(t.$unknown[0], t.$unknown[1]); })(so || (so = {})); var Vp = (e) => ({ ...e, ...e.SSEKMSKeyId && { SSEKMSKeyId: Me }, ...e.SSEKMSEncryptionContext && { SSEKMSEncryptionContext: Me } }); var Wp = (e) => ({ ...e, ...e.SSECustomerKey && { SSECustomerKey: Me }, ...e.SSEKMSKeyId && { SSEKMSKeyId: Me }, ...e.SSEKMSEncryptionContext && { SSEKMSEncryptionContext: Me } }); var Kp = async (e, t) => { const n = Fo(e, t), r = ee({}, Ve, { [Jg]: e[Mg], [gn]: e[fn], [mn]: e[pn], [yn]: e[hn], [xt]: [() => Ve(e[Et]), () => e[Et].toString()] }); n.bp("/"), n.p("Bucket", () => e.Bucket, "{Bucket}", false); const s = ee({ [Qg]: [, ""] }); let i; return n.m("GET").h(r).q(s).b(i), n.build(); }; var Gp = async (e, t) => { const n = Fo(e, t), r = ee({}, Ve, { ...e.Metadata !== void 0 && Object.keys(e.Metadata).reduce((a, c) => (a[`x-amz-meta-${c.toLowerCase()}`] = e.Metadata[c], a), {}), [Wg]: e[xg] || "application/octet-stream", [Yg]: e[hg], [Lg]: e[gg], [Hg]: e[mg], [zg]: e[yg], [jg]: e[wg], [qg]: [() => Ve(e[io]), () => e[io].toString()], [Vg]: e[bg], [hm]: e[pg], [Qa]: e[qa], [Ya]: e[Va], [Ja]: e[Wa], [ec]: e[Ka], [tc]: e[Ga], [Kg]: [() => Ve(e[oo]), () => yu(e[oo]).toString()], [Zg]: e[Tg], [Xg]: e[Bg], [rm]: e[Cg], [sm]: e[vg], [im]: e[Rg], [om]: e[kg], [ym]: [() => Ve(e[co]), () => e[co].toString()], [gn]: e[fn], [fm]: e[Kt], [wm]: e[$g], [nc]: e[Za], [pm]: e[Fg], [rc]: e[Xa], [mn]: e[pn], [yn]: e[hn], [xt]: [() => Ve(e[Et]), () => e[Et].toString()], [lm]: e[Ng], [gm]: e[Dg], [cm]: e[_g], [um]: [() => Ve(e[ao]), () => kd(e[ao]).toString()], [am]: e[Ig], [nm]: e[Sg] }); n.bp("/{Key+}"), n.p("Bucket", () => e.Bucket, "{Bucket}", false), n.p("Key", () => e.Key, "{Key+}", true); const s = ee({ [bm]: [, "PutObject"] }); let i, o; return e.Body !== void 0 && (o = e.Body, i = o), n.m("PUT").h(r).q(s).b(i), n.build(); }; var Zp = async (e, t) => { if (e.statusCode !== 200 && e.statusCode >= 300) return ja(e, t); const n = ee({ $metadata: Ee(e), [fn]: [, e.headers[gn]], [pn]: [, e.headers[mn]], [hn]: [, e.headers[yn]], [Et]: [() => e.headers[xt] !== void 0, () => To(e.headers[xt])] }), r = Io(du(await Zo(e.body, t)), "body"); return r[nr] != null && (n[nr] = fg(r[nr])), n; }; var Xp = async (e, t) => { if (e.statusCode !== 200 && e.statusCode >= 300) return ja(e, t); const n = ee({ $metadata: Ee(e), [Wt]: [, e.headers[tm]], [Ag]: [, e.headers[Gg]], [qa]: [, e.headers[Qa]], [Va]: [, e.headers[Ya]], [Wa]: [, e.headers[Ja]], [Ka]: [, e.headers[ec]], [Ga]: [, e.headers[tc]], [Eg]: [, e.headers[em]], [fn]: [, e.headers[gn]], [Ug]: [, e.headers[mm]], [Za]: [, e.headers[nc]], [Xa]: [, e.headers[rc]], [pn]: [, e.headers[mn]], [hn]: [, e.headers[yn]], [Et]: [() => e.headers[xt] !== void 0, () => To(e.headers[xt])], [Og]: [() => e.headers[uo] !== void 0, () => hu(e.headers[uo])], [Pg]: [, e.headers[dm]] }); return await ko(e.body, t), n; }; var ja = async (e, t) => { const n = { ...e, body: await Sl(e.body, t) }, r = Al(e, n.body); switch (r) { case "NoSuchUpload": case "com.amazonaws.s3#NoSuchUpload": throw await ag(n); case "ObjectNotInActiveTierError": case "com.amazonaws.s3#ObjectNotInActiveTierError": throw await dg(n); case "BucketAlreadyExists": case "com.amazonaws.s3#BucketAlreadyExists": throw await Yp(n); case "BucketAlreadyOwnedByYou": case "com.amazonaws.s3#BucketAlreadyOwnedByYou": throw await Jp(n); case "NoSuchBucket": case "com.amazonaws.s3#NoSuchBucket": throw await ig(n); case "InvalidObjectState": case "com.amazonaws.s3#InvalidObjectState": throw await ng(n); case "NoSuchKey": case "com.amazonaws.s3#NoSuchKey": throw await og(n); case "NotFound": case "com.amazonaws.s3#NotFound": throw await cg(n); case "EncryptionTypeMismatch": case "com.amazonaws.s3#EncryptionTypeMismatch": throw await eg(n); case "InvalidRequest": case "com.amazonaws.s3#InvalidRequest": throw await rg(n); case "InvalidWriteOffset": case "com.amazonaws.s3#InvalidWriteOffset": throw await sg(n); case "TooManyParts": case "com.amazonaws.s3#TooManyParts": throw await lg(n); case "IdempotencyParameterMismatch": case "com.amazonaws.s3#IdempotencyParameterMismatch": throw await tg(n); case "ObjectAlreadyInActiveTierError": case "com.amazonaws.s3#ObjectAlreadyInActiveTierError": throw await ug(n); default: const s = n.body; return Qp({ output: e, parsedBody: s, errorCode: r }); } }; var Qp = pd(fe); var Yp = async (e, t) => { const n = ee({}); e.body; const r = new Wr({ $metadata: Ee(e), ...n }); return ve(r, e.body); }; var Jp = async (e, t) => { const n = ee({}); e.body; const r = new Kr({ $metadata: Ee(e), ...n }); return ve(r, e.body); }; var eg = async (e, t) => { const n = ee({}); e.body; const r = new Yr({ $metadata: Ee(e), ...n }); return ve(r, e.body); }; var tg = async (e, t) => { const n = ee({}); e.body; const r = new ns({ $metadata: Ee(e), ...n }); return ve(r, e.body); }; var ng = async (e, t) => { const n = ee({}), r = e.body; r[tr] != null && (n[tr] = It(r[tr])), r[Kt] != null && (n[Kt] = It(r[Kt])); const s = new Zr({ $metadata: Ee(e), ...n }); return ve(s, e.body); }; var rg = async (e, t) => { const n = ee({}); e.body; const r = new Jr({ $metadata: Ee(e), ...n }); return ve(r, e.body); }; var sg = async (e, t) => { const n = ee({}); e.body; const r = new es({ $metadata: Ee(e), ...n }); return ve(r, e.body); }; var ig = async (e, t) => { const n = ee({}); e.body; const r = new Gr({ $metadata: Ee(e), ...n }); return ve(r, e.body); }; var og = async (e, t) => { const n = ee({}); e.body; const r = new Xr({ $metadata: Ee(e), ...n }); return ve(r, e.body); }; var ag = async (e, t) => { const n = ee({}); e.body; const r = new qr({ $metadata: Ee(e), ...n }); return ve(r, e.body); }; var cg = async (e, t) => { const n = ee({}); e.body; const r = new Qr({ $metadata: Ee(e), ...n }); return ve(r, e.body); }; var ug = async (e, t) => { const n = ee({}); e.body; const r = new rs({ $metadata: Ee(e), ...n }); return ve(r, e.body); }; var dg = async (e, t) => { const n = ee({}); e.body; const r = new Vr({ $metadata: Ee(e), ...n }); return ve(r, e.body); }; var lg = async (e, t) => { const n = ee({}); e.body; const r = new ts({ $metadata: Ee(e), ...n }); return ve(r, e.body); }; var fg = (e, t) => { const n = {}; return e[er] != null && (n[er] = It(e[er])), e[rr] != null && (n[rr] = It(e[rr])), e[sr] != null && (n[sr] = It(e[sr])), e[Wt] != null && (n[Wt] = Io(bu(e[Wt]))), n; }; var Ee = (e) => ({ httpStatusCode: e.statusCode, requestId: e.headers["x-amzn-requestid"] ?? e.headers["x-amzn-request-id"] ?? e.headers["x-amz-request-id"], extendedRequestId: e.headers["x-amz-id-2"], cfId: e.headers["x-amz-cf-id"] }); var hg = "ACL"; var er = "AccessKeyId"; var tr = "AccessTier"; var Et = "BucketKeyEnabled"; var nr = "Credentials"; var pg = "ChecksumAlgorithm"; var gg = "CacheControl"; var qa = "ChecksumCRC32"; var Va = "ChecksumCRC32C"; var Wa = "ChecksumCRC64NVME"; var mg = "ContentDisposition"; var yg = "ContentEncoding"; var wg = "ContentLanguage"; var io = "ContentLength"; var bg = "ContentMD5"; var Ka = "ChecksumSHA1"; var Ga = "ChecksumSHA256"; var Eg = "ChecksumType"; var xg = "ContentType"; var oo = "Expires"; var Sg = "ExpectedBucketOwner"; var Ag = "ETag"; var Wt = "Expiration"; var Cg = "GrantFullControl"; var vg = "GrantRead"; var Rg = "GrantReadACP"; var kg = "GrantWriteACP"; var Tg = "IfMatch"; var Bg = "IfNoneMatch"; var Ig = "ObjectLockLegalHoldStatus"; var _g = "ObjectLockMode"; var ao = "ObjectLockRetainUntilDate"; var Pg = "RequestCharged"; var Ng = "RequestPayer"; var rr = "SecretAccessKey"; var Kt = "StorageClass"; var Mg = "SessionMode"; var fn = "ServerSideEncryption"; var Za = "SSECustomerAlgorithm"; var Fg = "SSECustomerKey"; var Xa = "SSECustomerKeyMD5"; var hn = "SSEKMSEncryptionContext"; var pn = "SSEKMSKeyId"; var sr = "SessionToken"; var Og = "Size"; var Dg = "Tagging"; var Ug = "VersionId"; var co = "WriteOffsetBytes"; var $g = "WebsiteRedirectLocation"; var Lg = "cache-control"; var Hg = "content-disposition"; var zg = "content-encoding"; var jg = "content-language"; var qg = "content-length"; var Vg = "content-md5"; var Wg = "content-type"; var Kg = "expires"; var Gg = "etag"; var Zg = "if-match"; var Xg = "if-none-match"; var Qg = "session"; var Yg = "x-amz-acl"; var Qa = "x-amz-checksum-crc32"; var Ya = "x-amz-checksum-crc32c"; var Ja = "x-amz-checksum-crc64nvme"; var ec = "x-amz-checksum-sha1"; var tc = "x-amz-checksum-sha256"; var Jg = "x-amz-create-session-mode"; var em = "x-amz-checksum-type"; var tm = "x-amz-expiration"; var nm = "x-amz-expected-bucket-owner"; var rm = "x-amz-grant-full-control"; var sm = "x-amz-grant-read"; var im = "x-amz-grant-read-acp"; var om = "x-amz-grant-write-acp"; var am = "x-amz-object-lock-legal-hold"; var cm = "x-amz-object-lock-mode"; var um = "x-amz-object-lock-retain-until-date"; var uo = "x-amz-object-size"; var dm = "x-amz-request-charged"; var lm = "x-amz-request-payer"; var fm = "x-amz-storage-class"; var hm = "x-amz-sdk-checksum-algorithm"; var gn = "x-amz-server-side-encryption"; var mn = "x-amz-server-side-encryption-aws-kms-key-id"; var xt = "x-amz-server-side-encryption-bucket-key-enabled"; var yn = "x-amz-server-side-encryption-context"; var nc = "x-amz-server-side-encryption-customer-algorithm"; var pm = "x-amz-server-side-encryption-customer-key"; var rc = "x-amz-server-side-encryption-customer-key-md5"; var gm = "x-amz-tagging"; var mm = "x-amz-version-id"; var ym = "x-amz-write-offset-bytes"; var wm = "x-amz-website-redirect-location"; var bm = "x-id"; var Em = class extends Rr.classBuilder().ep({ ...za, DisableS3ExpressSessionAuth: { type: "staticContextParams", value: true }, Bucket: { type: "contextParams", name: "Bucket" } }).m(function(t, n, r, s) { return [ So(r, this.serialize, this.deserialize), wa(r, t.getEndpointParameterInstructions()), sa(r) ]; }).s("AmazonS3", "CreateSession", {}).n("S3Client", "CreateSessionCommand").f(qp, jp).ser(Kp).de(Zp).build() { }; var xm = "@aws-sdk/client-s3"; var Sm = "AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native"; var Am = "3.850.0"; var Cm = { build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", "build:cjs": "node ../../scripts/compilation/inline client-s3", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4", clean: "rimraf ./dist-* && rimraf *.tsbuildinfo", "extract:docs": "api-extractor run --local", "generate:client": "node ../../scripts/generate-clients/single-service --solo s3", test: "yarn g:vitest run", "test:browser": "node ./test/browser-build/esbuild && yarn g:vitest run -c vitest.config.browser.ts", "test:browser:watch": "node ./test/browser-build/esbuild && yarn g:vitest watch -c vitest.config.browser.ts", "test:e2e": "yarn g:vitest run -c vitest.config.e2e.ts && yarn test:browser", "test:e2e:watch": "yarn g:vitest watch -c vitest.config.e2e.ts", "test:integration": "yarn g:vitest run -c vitest.config.integ.ts", "test:integration:watch": "yarn g:vitest watch -c vitest.config.integ.ts", "test:watch": "yarn g:vitest watch" }; var vm = "./dist-cjs/index.js"; var Rm = "./dist-types/index.d.ts"; var km = "./dist-es/index.js"; var Tm = false; var Bm = { "@aws-crypto/sha1-browser": "5.2.0", "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "3.846.0", "@aws-sdk/credential-provider-node": "3.848.0", "@aws-sdk/middleware-bucket-endpoint": "3.840.0", "@aws-sdk/middleware-expect-continue": "3.840.0", "@aws-sdk/middleware-flexible-checksums": "3.846.0", "@aws-sdk/middleware-host-header": "3.840.0", "@aws-sdk/middleware-location-constraint": "3.840.0", "@aws-sdk/middleware-logger": "3.840.0", "@aws-sdk/middleware-recursion-detection": "3.840.0", "@aws-sdk/middleware-sdk-s3": "3.846.0", "@aws-sdk/middleware-ssec": "3.840.0", "@aws-sdk/middleware-user-agent": "3.848.0", "@aws-sdk/region-config-resolver": "3.840.0", "@aws-sdk/signature-v4-multi-region": "3.846.0", "@aws-sdk/types": "3.840.0", "@aws-sdk/util-endpoints": "3.848.0", "@aws-sdk/util-user-agent-browser": "3.840.0", "@aws-sdk/util-user-agent-node": "3.848.0", "@aws-sdk/xml-builder": "3.821.0", "@smithy/config-resolver": "^4.1.4", "@smithy/core": "^3.7.0", "@smithy/eventstream-serde-browser": "^4.0.4", "@smithy/eventstream-serde-config-resolver": "^4.1.2", "@smithy/eventstream-serde-node": "^4.0.4", "@smithy/fetch-http-handler": "^5.1.0", "@smithy/hash-blob-browser": "^4.0.4", "@smithy/hash-node": "^4.0.4", "@smithy/hash-stream-node": "^4.0.4", "@smithy/invalid-dependency": "^4.0.4", "@smithy/md5-js": "^4.0.4", "@smithy/middleware-content-length": "^4.0.4", "@smithy/middleware-endpoint": "^4.1.15", "@smithy/middleware-retry": "^4.1.16", "@smithy/middleware-serde": "^4.0.8", "@smithy/middleware-stack": "^4.0.4", "@smithy/node-config-provider": "^4.1.3", "@smithy/node-http-handler": "^4.1.0", "@smithy/protocol-http": "^5.1.2", "@smithy/smithy-client": "^4.4.7", "@smithy/types": "^4.3.1", "@smithy/url-parser": "^4.0.4", "@smithy/util-base64": "^4.0.0", "@smithy/util-body-length-browser": "^4.0.0", "@smithy/util-body-length-node": "^4.0.0", "@smithy/util-defaults-mode-browser": "^4.0.23", "@smithy/util-defaults-mode-node": "^4.0.23", "@smithy/util-endpoints": "^3.0.6", "@smithy/util-middleware": "^4.0.4", "@smithy/util-retry": "^4.0.6", "@smithy/util-stream": "^4.2.3", "@smithy/util-utf8": "^4.0.0", "@smithy/util-waiter": "^4.0.6", "@types/uuid": "^9.0.1", tslib: "^2.6.2", uuid: "^9.0.1" }; var Im = { "@aws-sdk/signature-v4-crt": "3.848.0", "@tsconfig/node18": "18.2.4", "@types/node": "^18.19.69", concurrently: "7.0.0", "downlevel-dts": "0.10.1", rimraf: "3.0.2", typescript: "~5.8.3" }; var _m = { node: ">=18.0.0" }; var Pm = { "<4.0": { "dist-types/*": [ "dist-types/ts3.4/*" ] } }; var Nm = [ "dist-*/**" ]; var Mm = { name: "AWS SDK for JavaScript Team", url: "https://aws.amazon.com/javascript/" }; var Fm = "Apache-2.0"; var Om = { "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" }; var Dm = "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-s3"; var Um = { type: "git", url: "https://github.com/aws/aws-sdk-js-v3.git", directory: "clients/client-s3" }; var $m = { name: xm, description: Sm, version: Am, scripts: Cm, main: vm, types: Rm, module: km, sideEffects: Tm, dependencies: Bm, devDependencies: Im, engines: _m, typesVersions: Pm, files: Nm, author: Mm, license: Fm, browser: Om, "react-native": { "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" }, homepage: Dm, repository: Um }; function lo(e) { return typeof e == "string" ? e.length === 0 : e.byteLength === 0; } var sc = { name: "SHA-1" }; var fo = { name: "HMAC", hash: sc }; var Lm = new Uint8Array([ 218, 57, 163, 238, 94, 107, 75, 13, 50, 85, 191, 239, 149, 96, 24, 144, 175, 216, 7, 9 ]); var Hm = {}; function Ke() { return typeof window < "u" ? window : typeof self < "u" ? self : Hm; } var zm = ( /** @class */ function() { function e(t) { this.toHash = new Uint8Array(0), t !== void 0 && (this.key = new Promise(function(n, r) { Ke().crypto.subtle.importKey("raw", ho(t), fo, false, ["sign"]).then(n, r); }), this.key.catch(function() { })); } return e.prototype.update = function(t) { if (!lo(t)) { var n = ho(t), r = new Uint8Array(this.toHash.byteLength + n.byteLength); r.set(this.toHash, 0), r.set(n, this.toHash.byteLength), this.toHash = r; } }, e.prototype.digest = function() { var t = this; return this.key ? this.key.then(function(n) { return Ke().crypto.subtle.sign(fo, n, t.toHash).then(function(r) { return new Uint8Array(r); }); }) : lo(this.toHash) ? Promise.resolve(Lm) : Promise.resolve().then(function() { return Ke().crypto.subtle.digest(sc, t.toHash); }).then(function(n) { return Promise.resolve(new Uint8Array(n)); }); }, e.prototype.reset = function() { this.toHash = new Uint8Array(0); }, e; }() ); function ho(e) { return typeof e == "string" ? Yo(e) : ArrayBuffer.isView(e) ? new Uint8Array(e.buffer, e.byteOffset, e.byteLength / Uint8Array.BYTES_PER_ELEMENT) : new Uint8Array(e); } var jm = [ "decrypt", "digest", "encrypt", "exportKey", "generateKey", "importKey", "sign", "verify" ]; function ic(e) { if (qm(e) && typeof e.crypto.subtle == "object") { var t = e.crypto.subtle; return Vm(t); } return false; } function qm(e) { if (typeof e == "object" && typeof e.crypto == "object") { var t = e.crypto.getRandomValues; return typeof t == "function"; } return false; } function Vm(e) { return e && jm.every(function(t) { return typeof e[t] == "function"; }); } var Wm = ( /** @class */ function() { function e(t) { if (ic(Ke())) this.hash = new zm(t); else throw new Error("SHA1 not supported"); } return e.prototype.update = function(t, n) { this.hash.update(Ze(t)); }, e.prototype.digest = function() { return this.hash.digest(); }, e.prototype.reset = function() { this.hash.reset(); }, e; }() ); var oc = { name: "SHA-256" }; var po = { name: "HMAC", hash: oc }; var Km = new Uint8Array([ 227, 176, 196, 66, 152, 252, 28, 20, 154, 251, 244, 200, 153, 111, 185, 36, 39, 174, 65, 228, 100, 155, 147, 76, 164, 149, 153, 27, 120, 82, 184, 85 ]); var Gm = ( /** @class */ function() { function e(t) { this.toHash = new Uint8Array(0), this.secret = t, this.reset(); } return e.prototype.update = function(t) { if (!Ft(t)) { var n = Ze(t), r = new Uint8Array(this.toHash.byteLength + n.byteLength); r.set(this.toHash, 0), r.set(n, this.toHash.byteLength), this.toHash = r; } }, e.prototype.digest = function() { var t = this; return this.key ? this.key.then(function(n) { return Ke().crypto.subtle.sign(po, n, t.toHash).then(function(r) { return new Uint8Array(r); }); }) : Ft(this.toHash) ? Promise.resolve(Km) : Promise.resolve().then(function() { return Ke().crypto.subtle.digest(oc, t.toHash); }).then(function(n) { return Promise.resolve(new Uint8Array(n)); }); }, e.prototype.reset = function() { var t = this; this.toHash = new Uint8Array(0), this.secret && this.secret !== void 0 && (this.key = new Promise(function(n, r) { Ke().crypto.subtle.importKey("raw", Ze(t.secret), po, false, ["sign"]).then(n, r); }), this.key.catch(function() { })); }, e; }() ); var Pe = 64; var Zm = 32; var Xm = new Uint32Array([ 1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298 ]); var Qm = [ 1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225 ]; var Ym = Math.pow(2, 53) - 1; var Gt = ( /** @class */ function() { function e() { this.state = Int32Array.from(Qm), this.temp = new Int32Array(64), this.buffer = new Uint8Array(64), this.bufferLength = 0, this.bytesHashed = 0, this.finished = false; } return e.prototype.update = function(t) { if (this.finished) throw new Error("Attempted to update an already finished hash."); var n = 0, r = t.byteLength; if (this.bytesHashed += r, this.bytesHashed * 8 > Ym) throw new Error("Cannot hash more than 2^53 - 1 bits"); for (; r > 0; ) this.buffer[this.bufferLength++] = t[n++], r--, this.bufferLength === Pe && (this.hashBuffer(), this.bufferLength = 0); }, e.prototype.digest = function() { if (!this.finished) { var t = this.bytesHashed * 8, n = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength), r = this.bufferLength; if (n.setUint8(this.bufferLength++, 128), r % Pe >= Pe - 8) { for (var s = this.bufferLength; s < Pe; s++) n.setUint8(s, 0); this.hashBuffer(), this.bufferLength = 0; } for (var s = this.bufferLength; s < Pe - 8; s++) n.setUint8(s, 0); n.setUint32(Pe - 8, Math.floor(t / 4294967296), true), n.setUint32(Pe - 4, t), this.hashBuffer(), this.finished = true; } for (var i = new Uint8Array(Zm), s = 0; s < 8; s++) i[s * 4] = this.state[s] >>> 24 & 255, i[s * 4 + 1] = this.state[s] >>> 16 & 255, i[s * 4 + 2] = this.state[s] >>> 8 & 255, i[s * 4 + 3] = this.state[s] >>> 0 & 255; return i; }, e.prototype.hashBuffer = function() { for (var t = this, n = t.buffer, r = t.state, s = r[0], i = r[1], o = r[2], a = r[3], c = r[4], u = r[5], l = r[6], f = r[7], p = 0; p < Pe; p++) { if (p < 16) this.temp[p] = (n[p * 4] & 255) << 24 | (n[p * 4 + 1] & 255) << 16 | (n[p * 4 + 2] & 255) << 8 | n[p * 4 + 3] & 255; else { var g = this.temp[p - 2], S = (g >>> 17 | g << 15) ^ (g >>> 19 | g << 13) ^ g >>> 10; g = this.temp[p - 15]; var T = (g >>> 7 | g << 25) ^ (g >>> 18 | g << 14) ^ g >>> 3; this.temp[p] = (S + this.temp[p - 7] | 0) + (T + this.temp[p - 16] | 0); } var A = (((c >>> 6 | c << 26) ^ (c >>> 11 | c << 21) ^ (c >>> 25 | c << 7)) + (c & u ^ ~c & l) | 0) + (f + (Xm[p] + this.temp[p] | 0) | 0) | 0, I = ((s >>> 2 | s << 30) ^ (s >>> 13 | s << 19) ^ (s >>> 22 | s << 10)) + (s & i ^ s & o ^ i & o) | 0; f = l, l = u, u = c, c = a + A | 0, a = o, o = i, i = s, s = A + I | 0; } r[0] += s, r[1] += i, r[2] += o, r[3] += a, r[4] += c, r[5] += u, r[6] += l, r[7] += f; }, e; }() ); var Jm = ( /** @class */ function() { function e(t) { this.secret = t, this.hash = new Gt(), this.reset(); } return e.prototype.update = function(t) { if (!(Ft(t) || this.error)) try { this.hash.update(Ze(t)); } catch (n) { this.error = n; } }, e.prototype.digestSync = function() { if (this.error) throw this.error; return this.outer ? (this.outer.finished || this.outer.update(this.hash.digest()), this.outer.digest()) : this.hash.digest(); }, e.prototype.digest = function() { return _r(this, void 0, void 0, function() { return Pr(this, function(t) { return [2, this.digestSync()]; }); }); }, e.prototype.reset = function() { if (this.hash = new Gt(), this.secret) { this.outer = new Gt(); var t = e0(this.secret), n = new Uint8Array(Pe); n.set(t); for (var r = 0; r < Pe; r++) t[r] ^= 54, n[r] ^= 92; this.hash.update(t), this.outer.update(n); for (var r = 0; r < t.byteLength; r++) t[r] = 0; } }, e; }() ); function e0(e) { var t = Ze(e); if (t.byteLength > Pe) { var n = new Gt(); n.update(t), t = n.digest(); } var r = new Uint8Array(Pe); return r.set(t), r; } var t0 = ( /** @class */ function() { function e(t) { ic(Ke()) ? this.hash = new Gm(t) : this.hash = new Jm(t); } return e.prototype.update = function(t, n) { this.hash.update(Ze(t)); }, e.prototype.digest = function() { return this.hash.digest(); }, e.prototype.reset = function() { this.hash.reset(); }, e; }() ); var n0 = { "Amazon Silk": "amazon_silk", "Android Browser": "android", Bada: "bada", BlackBerry: "blackberry", Chrome: "chrome", Chromium: "chromium", Electron: "electron", Epiphany: "epiphany", Firefox: "firefox", Focus: "focus", Generic: "generic", "Google Search": "google_search", Googlebot: "googlebot", "Internet Explorer": "ie", "K-Meleon": "k_meleon", Maxthon: "maxthon", "Microsoft Edge": "edge", "MZ Browser": "mz", "NAVER Whale Browser": "naver", Opera: "opera", "Opera Coast": "opera_coast", PhantomJS: "phantomjs", Puffin: "puffin", QupZilla: "qupzilla", QQ: "qq", QQLite: "qqlite", Safari: "safari", Sailfish: "sailfish", "Samsung Internet for Android": "samsung_internet", SeaMonkey: "seamonkey", Sleipnir: "sleipnir", Swing: "swing", Tizen: "tizen", "UC Browser": "uc", Vivaldi: "vivaldi", "WebOS Browser": "webos", WeChat: "wechat", "Yandex Browser": "yandex", Roku: "roku" }; var ac = { amazon_silk: "Amazon Silk", android: "Android Browser", bada: "Bada", blackberry: "BlackBerry", chrome: "Chrome", chromium: "Chromium", electron: "Electron", epiphany: "Epiphany", firefox: "Firefox", focus: "Focus", generic: "Generic", googlebot: "Googlebot", google_search: "Google Search", ie: "Internet Explorer", k_meleon: "K-Meleon", maxthon: "Maxthon", edge: "Microsoft Edge", mz: "MZ Browser", naver: "NAVER Whale Browser", opera: "Opera", opera_coast: "Opera Coast", phantomjs: "PhantomJS", puffin: "Puffin", qupzilla: "QupZilla", qq: "QQ Browser", qqlite: "QQ Browser Lite", safari: "Safari", sailfish: "Sailfish", samsung_internet: "Samsung Internet for Android", seamonkey: "SeaMonkey", sleipnir: "Sleipnir", swing: "Swing", tizen: "Tizen", uc: "UC Browser", vivaldi: "Vivaldi", webos: "WebOS Browser", wechat: "WeChat", yandex: "Yandex Browser" }; var Z = { tablet: "tablet", mobile: "mobile", desktop: "desktop", tv: "tv" }; var Ae = { WindowsPhone: "Windows Phone", Windows: "Windows", MacOS: "macOS", iOS: "iOS", Android: "Android", WebOS: "WebOS", BlackBerry: "BlackBerry", Bada: "Bada", Tizen: "Tizen", Linux: "Linux", ChromeOS: "Chrome OS", PlayStation4: "PlayStation 4", Roku: "Roku" }; var je = { EdgeHTML: "EdgeHTML", Blink: "Blink", Trident: "Trident", Presto: "Presto", Gecko: "Gecko", WebKit: "WebKit" }; var E = class _E { /** * Get first matched item for a string * @param {RegExp} regexp * @param {String} ua * @return {Array|{index: number, input: string}|*|boolean|string} */ static getFirstMatch(t, n) { const r = n.match(t); return r && r.length > 0 && r[1] || ""; } /** * Get second matched item for a string * @param regexp * @param {String} ua * @return {Array|{index: number, input: string}|*|boolean|string} */ static getSecondMatch(t, n) { const r = n.match(t); return r && r.length > 1 && r[2] || ""; } /** * Match a regexp and return a constant or undefined * @param {RegExp} regexp * @param {String} ua * @param {*} _const Any const that will be returned if regexp matches the string * @return {*} */ static matchAndReturnConst(t, n, r) { if (t.test(n)) return r; } static getWindowsVersionName(t) { switch (t) { case "NT": return "NT"; case "XP": return "XP"; case "NT 5.0": return "2000"; case "NT 5.1": return "XP"; case "NT 5.2": return "2003"; case "NT 6.0": return "Vista"; case "NT 6.1": return "7"; case "NT 6.2": return "8"; case "NT 6.3": return "8.1"; case "NT 10.0": return "10"; default: return; } } /** * Get macOS version name * 10.5 - Leopard * 10.6 - Snow Leopard * 10.7 - Lion * 10.8 - Mountain Lion * 10.9 - Mavericks * 10.10 - Yosemite * 10.11 - El Capitan * 10.12 - Sierra * 10.13 - High Sierra * 10.14 - Mojave * 10.15 - Catalina * * @example * getMacOSVersionName("10.14") // 'Mojave' * * @param {string} version * @return {string} versionName */ static getMacOSVersionName(t) { const n = t.split(".").splice(0, 2).map((r) => parseInt(r, 10) || 0); if (n.push(0), n[0] === 10) switch (n[1]) { case 5: return "Leopard"; case 6: return "Snow Leopard"; case 7: return "Lion"; case 8: return "Mountain Lion"; case 9: return "Mavericks"; case 10: return "Yosemite"; case 11: return "El Capitan"; case 12: return "Sierra"; case 13: return "High Sierra"; case 14: return "Mojave"; case 15: return "Catalina"; default: return; } } /** * Get Android version name * 1.5 - Cupcake * 1.6 - Donut * 2.0 - Eclair * 2.1 - Eclair * 2.2 - Froyo * 2.x - Gingerbread * 3.x - Honeycomb * 4.0 - Ice Cream Sandwich * 4.1 - Jelly Bean * 4.4 - KitKat * 5.x - Lollipop * 6.x - Marshmallow * 7.x - Nougat * 8.x - Oreo * 9.x - Pie * * @example * getAndroidVersionName("7.0") // 'Nougat' * * @param {string} version * @return {string} versionName */ static getAndroidVersionName(t) { const n = t.split(".").splice(0, 2).map((r) => parseInt(r, 10) || 0); if (n.push(0), !(n[0] === 1 && n[1] < 5)) { if (n[0] === 1 && n[1] < 6) return "Cupcake"; if (n[0] === 1 && n[1] >= 6) return "Donut"; if (n[0] === 2 && n[1] < 2) return "Eclair"; if (n[0] === 2 && n[1] === 2) return "Froyo"; if (n[0] === 2 && n[1] > 2) return "Gingerbread"; if (n[0] === 3) return "Honeycomb"; if (n[0] === 4 && n[1] < 1) return "Ice Cream Sandwich"; if (n[0] === 4 && n[1] < 4) return "Jelly Bean"; if (n[0] === 4 && n[1] >= 4) return "KitKat"; if (n[0] === 5) return "Lollipop"; if (n[0] === 6) return "Marshmallow"; if (n[0] === 7) return "Nougat"; if (n[0] === 8) return "Oreo"; if (n[0] === 9) return "Pie"; } } /** * Get version precisions count * * @example * getVersionPrecision("1.10.3") // 3 * * @param {string} version * @return {number} */ static getVersionPrecision(t) { return t.split(".").length; } /** * Calculate browser version weight * * @example * compareVersions('1.10.2.1', '1.8.2.1.90') // 1 * compareVersions('1.010.2.1', '1.09.2.1.90'); // 1 * compareVersions('1.10.2.1', '1.10.2.1'); // 0 * compareVersions('1.10.2.1', '1.0800.2'); // -1 * compareVersions('1.10.2.1', '1.10', true); // 0 * * @param {String} versionA versions versions to compare * @param {String} versionB versions versions to compare * @param {boolean} [isLoose] enable loose comparison * @return {Number} comparison result: -1 when versionA is lower, * 1 when versionA is bigger, 0 when both equal */ /* eslint consistent-return: 1 */ static compareVersions(t, n, r = false) { const s = _E.getVersionPrecision(t), i = _E.getVersionPrecision(n); let o = Math.max(s, i), a = 0; const c = _E.map([t, n], (u) => { const l = o - _E.getVersionPrecision(u), f = u + new Array(l + 1).join(".0"); return _E.map(f.split("."), (p) => new Array(20 - p.length).join("0") + p).reverse(); }); for (r && (a = o - Math.min(s, i)), o -= 1; o >= a; ) { if (c[0][o] > c[1][o]) return 1; if (c[0][o] === c[1][o]) { if (o === a) return 0; o -= 1; } else if (c[0][o] < c[1][o]) return -1; } } /** * Array::map polyfill * * @param {Array} arr * @param {Function} iterator * @return {Array} */ static map(t, n) { const r = []; let s; if (Array.prototype.map) return Array.prototype.map.call(t, n); for (s = 0; s < t.length; s += 1) r.push(n(t[s])); return r; } /** * Array::find polyfill * * @param {Array} arr * @param {Function} predicate * @return {Array} */ static find(t, n) { let r, s; if (Array.prototype.find) return Array.prototype.find.call(t, n); for (r = 0, s = t.length; r < s; r += 1) { const i = t[r]; if (n(i, r)) return i; } } /** * Object::assign polyfill * * @param {Object} obj * @param {Object} ...objs * @return {Object} */ static assign(t, ...n) { const r = t; let s, i; if (Object.assign) return Object.assign(t, ...n); for (s = 0, i = n.length; s < i; s += 1) { const o = n[s]; typeof o == "object" && o !== null && Object.keys(o).forEach((c) => { r[c] = o[c]; }); } return t; } /** * Get short version/alias for a browser name * * @example * getBrowserAlias('Microsoft Edge') // edge * * @param {string} browserName * @return {string} */ static getBrowserAlias(t) { return n0[t]; } /** * Get short version/alias for a browser name * * @example * getBrowserAlias('edge') // Microsoft Edge * * @param {string} browserAlias * @return {string} */ static getBrowserTypeByAlias(t) { return ac[t] || ""; } }; var z = /version\/(\d+(\.?_?\d+)+)/i; var r0 = [ /* Googlebot */ { test: [/googlebot/i], describe(e) { const t = { name: "Googlebot" }, n = E.getFirstMatch(/googlebot\/(\d+(\.\d+))/i, e) || E.getFirstMatch(z, e); return n && (t.version = n), t; } }, /* Opera < 13.0 */ { test: [/opera/i], describe(e) { const t = { name: "Opera" }, n = E.getFirstMatch(z, e) || E.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, /* Opera > 13.0 */ { test: [/opr\/|opios/i], describe(e) { const t = { name: "Opera" }, n = E.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i, e) || E.getFirstMatch(z, e); return n && (t.version = n), t; } }, { test: [/SamsungBrowser/i], describe(e) { const t = { name: "Samsung Internet for Android" }, n = E.getFirstMatch(z, e) || E.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, { test: [/Whale/i], describe(e) { const t = { name: "NAVER Whale Browser" }, n = E.getFirstMatch(z, e) || E.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i, e); return n && (t.version = n), t; } }, { test: [/MZBrowser/i], describe(e) { const t = { name: "MZ Browser" }, n = E.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i, e) || E.getFirstMatch(z, e); return n && (t.version = n), t; } }, { test: [/focus/i], describe(e) { const t = { name: "Focus" }, n = E.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i, e) || E.getFirstMatch(z, e); return n && (t.version = n), t; } }, { test: [/swing/i], describe(e) { const t = { name: "Swing" }, n = E.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i, e) || E.getFirstMatch(z, e); return n && (t.version = n), t; } }, { test: [/coast/i], describe(e) { const t = { name: "Opera Coast" }, n = E.getFirstMatch(z, e) || E.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, { test: [/opt\/\d+(?:.?_?\d+)+/i], describe(e) { const t = { name: "Opera Touch" }, n = E.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i, e) || E.getFirstMatch(z, e); return n && (t.version = n), t; } }, { test: [/yabrowser/i], describe(e) { const t = { name: "Yandex Browser" }, n = E.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i, e) || E.getFirstMatch(z, e); return n && (t.version = n), t; } }, { test: [/ucbrowser/i], describe(e) { const t = { name: "UC Browser" }, n = E.getFirstMatch(z, e) || E.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, { test: [/Maxthon|mxios/i], describe(e) { const t = { name: "Maxthon" }, n = E.getFirstMatch(z, e) || E.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, { test: [/epiphany/i], describe(e) { const t = { name: "Epiphany" }, n = E.getFirstMatch(z, e) || E.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, { test: [/puffin/i], describe(e) { const t = { name: "Puffin" }, n = E.getFirstMatch(z, e) || E.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, { test: [/sleipnir/i], describe(e) { const t = { name: "Sleipnir" }, n = E.getFirstMatch(z, e) || E.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, { test: [/k-meleon/i], describe(e) { const t = { name: "K-Meleon" }, n = E.getFirstMatch(z, e) || E.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, { test: [/micromessenger/i], describe(e) { const t = { name: "WeChat" }, n = E.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i, e) || E.getFirstMatch(z, e); return n && (t.version = n), t; } }, { test: [/qqbrowser/i], describe(e) { const t = { name: /qqbrowserlite/i.test(e) ? "QQ Browser Lite" : "QQ Browser" }, n = E.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i, e) || E.getFirstMatch(z, e); return n && (t.version = n), t; } }, { test: [/msie|trident/i], describe(e) { const t = { name: "Internet Explorer" }, n = E.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, { test: [/\sedg\//i], describe(e) { const t = { name: "Microsoft Edge" }, n = E.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, { test: [/edg([ea]|ios)/i], describe(e) { const t = { name: "Microsoft Edge" }, n = E.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, { test: [/vivaldi/i], describe(e) { const t = { name: "Vivaldi" }, n = E.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, { test: [/seamonkey/i], describe(e) { const t = { name: "SeaMonkey" }, n = E.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, { test: [/sailfish/i], describe(e) { const t = { name: "Sailfish" }, n = E.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i, e); return n && (t.version = n), t; } }, { test: [/silk/i], describe(e) { const t = { name: "Amazon Silk" }, n = E.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, { test: [/phantom/i], describe(e) { const t = { name: "PhantomJS" }, n = E.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, { test: [/slimerjs/i], describe(e) { const t = { name: "SlimerJS" }, n = E.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, { test: [/blackberry|\bbb\d+/i, /rim\stablet/i], describe(e) { const t = { name: "BlackBerry" }, n = E.getFirstMatch(z, e) || E.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, { test: [/(web|hpw)[o0]s/i], describe(e) { const t = { name: "WebOS Browser" }, n = E.getFirstMatch(z, e) || E.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, { test: [/bada/i], describe(e) { const t = { name: "Bada" }, n = E.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, { test: [/tizen/i], describe(e) { const t = { name: "Tizen" }, n = E.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i, e) || E.getFirstMatch(z, e); return n && (t.version = n), t; } }, { test: [/qupzilla/i], describe(e) { const t = { name: "QupZilla" }, n = E.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i, e) || E.getFirstMatch(z, e); return n && (t.version = n), t; } }, { test: [/firefox|iceweasel|fxios/i], describe(e) { const t = { name: "Firefox" }, n = E.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, { test: [/electron/i], describe(e) { const t = { name: "Electron" }, n = E.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, { test: [/MiuiBrowser/i], describe(e) { const t = { name: "Miui" }, n = E.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, { test: [/chromium/i], describe(e) { const t = { name: "Chromium" }, n = E.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i, e) || E.getFirstMatch(z, e); return n && (t.version = n), t; } }, { test: [/chrome|crios|crmo/i], describe(e) { const t = { name: "Chrome" }, n = E.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, { test: [/GSA/i], describe(e) { const t = { name: "Google Search" }, n = E.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, /* Android Browser */ { test(e) { const t = !e.test(/like android/i), n = e.test(/android/i); return t && n; }, describe(e) { const t = { name: "Android Browser" }, n = E.getFirstMatch(z, e); return n && (t.version = n), t; } }, /* PlayStation 4 */ { test: [/playstation 4/i], describe(e) { const t = { name: "PlayStation 4" }, n = E.getFirstMatch(z, e); return n && (t.version = n), t; } }, /* Safari */ { test: [/safari|applewebkit/i], describe(e) { const t = { name: "Safari" }, n = E.getFirstMatch(z, e); return n && (t.version = n), t; } }, /* Something else */ { test: [/.*/i], describe(e) { const t = /^(.*)\/(.*) /, n = /^(.*)\/(.*)[ \t]\((.*)/, s = e.search("\\(") !== -1 ? n : t; return { name: E.getFirstMatch(s, e), version: E.getSecondMatch(s, e) }; } } ]; var s0 = [ /* Roku */ { test: [/Roku\/DVP/], describe(e) { const t = E.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i, e); return { name: Ae.Roku, version: t }; } }, /* Windows Phone */ { test: [/windows phone/i], describe(e) { const t = E.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i, e); return { name: Ae.WindowsPhone, version: t }; } }, /* Windows */ { test: [/windows /i], describe(e) { const t = E.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i, e), n = E.getWindowsVersionName(t); return { name: Ae.Windows, version: t, versionName: n }; } }, /* Firefox on iPad */ { test: [/Macintosh(.*?) FxiOS(.*?)\//], describe(e) { const t = { name: Ae.iOS }, n = E.getSecondMatch(/(Version\/)(\d[\d.]+)/, e); return n && (t.version = n), t; } }, /* macOS */ { test: [/macintosh/i], describe(e) { const t = E.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i, e).replace(/[_\s]/g, "."), n = E.getMacOSVersionName(t), r = { name: Ae.MacOS, version: t }; return n && (r.versionName = n), r; } }, /* iOS */ { test: [/(ipod|iphone|ipad)/i], describe(e) { const t = E.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i, e).replace(/[_\s]/g, "."); return { name: Ae.iOS, version: t }; } }, /* Android */ { test(e) { const t = !e.test(/like android/i), n = e.test(/android/i); return t && n; }, describe(e) { const t = E.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i, e), n = E.getAndroidVersionName(t), r = { name: Ae.Android, version: t }; return n && (r.versionName = n), r; } }, /* WebOS */ { test: [/(web|hpw)[o0]s/i], describe(e) { const t = E.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i, e), n = { name: Ae.WebOS }; return t && t.length && (n.version = t), n; } }, /* BlackBerry */ { test: [/blackberry|\bbb\d+/i, /rim\stablet/i], describe(e) { const t = E.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i, e) || E.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i, e) || E.getFirstMatch(/\bbb(\d+)/i, e); return { name: Ae.BlackBerry, version: t }; } }, /* Bada */ { test: [/bada/i], describe(e) { const t = E.getFirstMatch(/bada\/(\d+(\.\d+)*)/i, e); return { name: Ae.Bada, version: t }; } }, /* Tizen */ { test: [/tizen/i], describe(e) { const t = E.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i, e); return { name: Ae.Tizen, version: t }; } }, /* Linux */ { test: [/linux/i], describe() { return { name: Ae.Linux }; } }, /* Chrome OS */ { test: [/CrOS/], describe() { return { name: Ae.ChromeOS }; } }, /* Playstation 4 */ { test: [/PlayStation 4/], describe(e) { const t = E.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i, e); return { name: Ae.PlayStation4, version: t }; } } ]; var i0 = [ /* Googlebot */ { test: [/googlebot/i], describe() { return { type: "bot", vendor: "Google" }; } }, /* Huawei */ { test: [/huawei/i], describe(e) { const t = E.getFirstMatch(/(can-l01)/i, e) && "Nova", n = { type: Z.mobile, vendor: "Huawei" }; return t && (n.model = t), n; } }, /* Nexus Tablet */ { test: [/nexus\s*(?:7|8|9|10).*/i], describe() { return { type: Z.tablet, vendor: "Nexus" }; } }, /* iPad */ { test: [/ipad/i], describe() { return { type: Z.tablet, vendor: "Apple", model: "iPad" }; } }, /* Firefox on iPad */ { test: [/Macintosh(.*?) FxiOS(.*?)\//], describe() { return { type: Z.tablet, vendor: "Apple", model: "iPad" }; } }, /* Amazon Kindle Fire */ { test: [/kftt build/i], describe() { return { type: Z.tablet, vendor: "Amazon", model: "Kindle Fire HD 7" }; } }, /* Another Amazon Tablet with Silk */ { test: [/silk/i], describe() { return { type: Z.tablet, vendor: "Amazon" }; } }, /* Tablet */ { test: [/tablet(?! pc)/i], describe() { return { type: Z.tablet }; } }, /* iPod/iPhone */ { test(e) { const t = e.test(/ipod|iphone/i), n = e.test(/like (ipod|iphone)/i); return t && !n; }, describe(e) { const t = E.getFirstMatch(/(ipod|iphone)/i, e); return { type: Z.mobile, vendor: "Apple", model: t }; } }, /* Nexus Mobile */ { test: [/nexus\s*[0-6].*/i, /galaxy nexus/i], describe() { return { type: Z.mobile, vendor: "Nexus" }; } }, /* Mobile */ { test: [/[^-]mobi/i], describe() { return { type: Z.mobile }; } }, /* BlackBerry */ { test(e) { return e.getBrowserName(true) === "blackberry"; }, describe() { return { type: Z.mobile, vendor: "BlackBerry" }; } }, /* Bada */ { test(e) { return e.getBrowserName(true) === "bada"; }, describe() { return { type: Z.mobile }; } }, /* Windows Phone */ { test(e) { return e.getBrowserName() === "windows phone"; }, describe() { return { type: Z.mobile, vendor: "Microsoft" }; } }, /* Android Tablet */ { test(e) { const t = Number(String(e.getOSVersion()).split(".")[0]); return e.getOSName(true) === "android" && t >= 3; }, describe() { return { type: Z.tablet }; } }, /* Android Mobile */ { test(e) { return e.getOSName(true) === "android"; }, describe() { return { type: Z.mobile }; } }, /* desktop */ { test(e) { return e.getOSName(true) === "macos"; }, describe() { return { type: Z.desktop, vendor: "Apple" }; } }, /* Windows */ { test(e) { return e.getOSName(true) === "windows"; }, describe() { return { type: Z.desktop }; } }, /* Linux */ { test(e) { return e.getOSName(true) === "linux"; }, describe() { return { type: Z.desktop }; } }, /* PlayStation 4 */ { test(e) { return e.getOSName(true) === "playstation 4"; }, describe() { return { type: Z.tv }; } }, /* Roku */ { test(e) { return e.getOSName(true) === "roku"; }, describe() { return { type: Z.tv }; } } ]; var o0 = [ /* EdgeHTML */ { test(e) { return e.getBrowserName(true) === "microsoft edge"; }, describe(e) { if (/\sedg\//i.test(e)) return { name: je.Blink }; const n = E.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i, e); return { name: je.EdgeHTML, version: n }; } }, /* Trident */ { test: [/trident/i], describe(e) { const t = { name: je.Trident }, n = E.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, /* Presto */ { test(e) { return e.test(/presto/i); }, describe(e) { const t = { name: je.Presto }, n = E.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, /* Gecko */ { test(e) { const t = e.test(/gecko/i), n = e.test(/like gecko/i); return t && !n; }, describe(e) { const t = { name: je.Gecko }, n = E.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } }, /* Blink */ { test: [/(apple)?webkit\/537\.36/i], describe() { return { name: je.Blink }; } }, /* WebKit */ { test: [/(apple)?webkit/i], describe(e) { const t = { name: je.WebKit }, n = E.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i, e); return n && (t.version = n), t; } } ]; var go = class { /** * Create instance of Parser * * @param {String} UA User-Agent string * @param {Boolean} [skipParsing=false] parser can skip parsing in purpose of performance * improvements if you need to make a more particular parsing * like {@link Parser#parseBrowser} or {@link Parser#parsePlatform} * * @throw {Error} in case of empty UA String * * @constructor */ constructor(t, n = false) { if (t == null || t === "") throw new Error("UserAgent parameter can't be empty"); this._ua = t, this.parsedResult = {}, n !== true && this.parse(); } /** * Get UserAgent string of current Parser instance * @return {String} User-Agent String of the current object * * @public */ getUA() { return this._ua; } /** * Test a UA string for a regexp * @param {RegExp} regex * @return {Boolean} */ test(t) { return t.test(this._ua); } /** * Get parsed browser object * @return {Object} */ parseBrowser() { this.parsedResult.browser = {}; const t = E.find(r0, (n) => { if (typeof n.test == "function") return n.test(this); if (n.test instanceof Array) return n.test.some((r) => this.test(r)); throw new Error("Browser's test function is not valid"); }); return t && (this.parsedResult.browser = t.describe(this.getUA())), this.parsedResult.browser; } /** * Get parsed browser object * @return {Object} * * @public */ getBrowser() { return this.parsedResult.browser ? this.parsedResult.browser : this.parseBrowser(); } /** * Get browser's name * @return {String} Browser's name or an empty string * * @public */ getBrowserName(t) { return t ? String(this.getBrowser().name).toLowerCase() || "" : this.getBrowser().name || ""; } /** * Get browser's version * @return {String} version of browser * * @public */ getBrowserVersion() { return this.getBrowser().version; } /** * Get OS * @return {Object} * * @example * this.getOS(); * { * name: 'macOS', * version: '10.11.12' * } */ getOS() { return this.parsedResult.os ? this.parsedResult.os : this.parseOS(); } /** * Parse OS and save it to this.parsedResult.os * @return {*|{}} */ parseOS() { this.parsedResult.os = {}; const t = E.find(s0, (n) => { if (typeof n.test == "function") return n.test(this); if (n.test instanceof Array) return n.test.some((r) => this.test(r)); throw new Error("Browser's test function is not valid"); }); return t && (this.parsedResult.os = t.describe(this.getUA())), this.parsedResult.os; } /** * Get OS name * @param {Boolean} [toLowerCase] return lower-cased value * @return {String} name of the OS — macOS, Windows, Linux, etc. */ getOSName(t) { const { name: n } = this.getOS(); return t ? String(n).toLowerCase() || "" : n || ""; } /** * Get OS version * @return {String} full version with dots ('10.11.12', '5.6', etc) */ getOSVersion() { return this.getOS().version; } /** * Get parsed platform * @return {{}} */ getPlatform() { return this.parsedResult.platform ? this.parsedResult.platform : this.parsePlatform(); } /** * Get platform name * @param {Boolean} [toLowerCase=false] * @return {*} */ getPlatformType(t = false) { const { type: n } = this.getPlatform(); return t ? String(n).toLowerCase() || "" : n || ""; } /** * Get parsed platform * @return {{}} */ parsePlatform() { this.parsedResult.platform = {}; const t = E.find(i0, (n) => { if (typeof n.test == "function") return n.test(this); if (n.test instanceof Array) return n.test.some((r) => this.test(r)); throw new Error("Browser's test function is not valid"); }); return t && (this.parsedResult.platform = t.describe(this.getUA())), this.parsedResult.platform; } /** * Get parsed engine * @return {{}} */ getEngine() { return this.parsedResult.engine ? this.parsedResult.engine : this.parseEngine(); } /** * Get engines's name * @return {String} Engines's name or an empty string * * @public */ getEngineName(t) { return t ? String(this.getEngine().name).toLowerCase() || "" : this.getEngine().name || ""; } /** * Get parsed platform * @return {{}} */ parseEngine() { this.parsedResult.engine = {}; const t = E.find(o0, (n) => { if (typeof n.test == "function") return n.test(this); if (n.test instanceof Array) return n.test.some((r) => this.test(r)); throw new Error("Browser's test function is not valid"); }); return t && (this.parsedResult.engine = t.describe(this.getUA())), this.parsedResult.engine; } /** * Parse full information about the browser * @returns {Parser} */ parse() { return this.parseBrowser(), this.parseOS(), this.parsePlatform(), this.parseEngine(), this; } /** * Get parsed result * @return {ParsedResult} */ getResult() { return E.assign({}, this.parsedResult); } /** * Check if parsed browser matches certain conditions * * @param {Object} checkTree It's one or two layered object, * which can include a platform or an OS on the first layer * and should have browsers specs on the bottom-laying layer * * @returns {Boolean|undefined} Whether the browser satisfies the set conditions or not. * Returns `undefined` when the browser is no described in the checkTree object. * * @example * const browser = Bowser.getParser(window.navigator.userAgent); * if (browser.satisfies({chrome: '>118.01.1322' })) * // or with os * if (browser.satisfies({windows: { chrome: '>118.01.1322' } })) * // or with platforms * if (browser.satisfies({desktop: { chrome: '>118.01.1322' } })) */ satisfies(t) { const n = {}; let r = 0; const s = {}; let i = 0; if (Object.keys(t).forEach((a) => { const c = t[a]; typeof c == "string" ? (s[a] = c, i += 1) : typeof c == "object" && (n[a] = c, r += 1); }), r > 0) { const a = Object.keys(n), c = E.find(a, (l) => this.isOS(l)); if (c) { const l = this.satisfies(n[c]); if (l !== void 0) return l; } const u = E.find( a, (l) => this.isPlatform(l) ); if (u) { const l = this.satisfies(n[u]); if (l !== void 0) return l; } } if (i > 0) { const a = Object.keys(s), c = E.find(a, (u) => this.isBrowser(u, true)); if (c !== void 0) return this.compareVersion(s[c]); } } /** * Check if the browser name equals the passed string * @param browserName The string to compare with the browser name * @param [includingAlias=false] The flag showing whether alias will be included into comparison * @returns {boolean} */ isBrowser(t, n = false) { const r = this.getBrowserName().toLowerCase(); let s = t.toLowerCase(); const i = E.getBrowserTypeByAlias(s); return n && i && (s = i.toLowerCase()), s === r; } compareVersion(t) { let n = [0], r = t, s = false; const i = this.getBrowserVersion(); if (typeof i == "string") return t[0] === ">" || t[0] === "<" ? (r = t.substr(1), t[1] === "=" ? (s = true, r = t.substr(2)) : n = [], t[0] === ">" ? n.push(1) : n.push(-1)) : t[0] === "=" ? r = t.substr(1) : t[0] === "~" && (s = true, r = t.substr(1)), n.indexOf( E.compareVersions(i, r, s) ) > -1; } isOS(t) { return this.getOSName(true) === String(t).toLowerCase(); } isPlatform(t) { return this.getPlatformType(true) === String(t).toLowerCase(); } isEngine(t) { return this.getEngineName(true) === String(t).toLowerCase(); } /** * Is anything? Check if the browser is called "anything", * the OS called "anything" or the platform called "anything" * @param {String} anything * @param [includingAlias=false] The flag showing whether alias will be included into comparison * @returns {Boolean} */ is(t, n = false) { return this.isBrowser(t, n) || this.isOS(t) || this.isPlatform(t); } /** * Check if any of the given values satisfies this.is(anything) * @param {String[]} anythings * @returns {Boolean} */ some(t = []) { return t.some((n) => this.is(n)); } }; var cc = class { /** * Creates a {@link Parser} instance * * @param {String} UA UserAgent string * @param {Boolean} [skipParsing=false] Will make the Parser postpone parsing until you ask it * explicitly. Same as `skipParsing` for {@link Parser}. * @returns {Parser} * @throws {Error} when UA is not a String * * @example * const parser = Bowser.getParser(window.navigator.userAgent); * const result = parser.getResult(); */ static getParser(t, n = false) { if (typeof t != "string") throw new Error("UserAgent should be a string"); return new go(t, n); } /** * Creates a {@link Parser} instance and runs {@link Parser.getResult} immediately * * @param UA * @return {ParsedResult} * * @example * const result = Bowser.parse(window.navigator.userAgent); */ static parse(t) { return new go(t).getResult(); } static get BROWSER_MAP() { return ac; } static get ENGINE_MAP() { return je; } static get OS_MAP() { return Ae; } static get PLATFORMS_MAP() { return Z; } }; var a0 = ({ serviceId: e, clientVersion: t }) => async (n) => { var o, a, c, u, l, f; const r = typeof window < "u" && ((o = window == null ? void 0 : window.navigator) != null && o.userAgent) ? cc.parse(window.navigator.userAgent) : void 0, s = [ ["aws-sdk-js", t], ["ua", "2.1"], [`os/${((a = r == null ? void 0 : r.os) == null ? void 0 : a.name) || "other"}`, (c = r == null ? void 0 : r.os) == null ? void 0 : c.version], ["lang/js"], ["md/browser", `${((u = r == null ? void 0 : r.browser) == null ? void 0 : u.name) ?? "unknown"}_${((l = r == null ? void 0 : r.browser) == null ? void 0 : l.version) ?? "unknown"}`] ]; e && s.push([`api/${e}`, t]); const i = await ((f = n == null ? void 0 : n.userAgentAppId) == null ? void 0 : f.call(n)); return i && s.push([`app/${i}`]), s; }; var Nt = class _Nt { constructor(t) { if (this.bytes = t, t.byteLength !== 8) throw new Error("Int64 buffers must be exactly 8 bytes"); } static fromNumber(t) { if (t > 9223372036854776e3 || t < -9223372036854776e3) throw new Error(`${t} is too large (or, if negative, too small) to represent as an Int64`); const n = new Uint8Array(8); for (let r = 7, s = Math.abs(Math.round(t)); r > -1 && s > 0; r--, s /= 256) n[r] = s; return t < 0 && mo(n), new _Nt(n); } valueOf() { const t = this.bytes.slice(0), n = t[0] & 128; return n && mo(t), parseInt(Re(t), 16) * (n ? -1 : 1); } toString() { return String(this.valueOf()); } }; function mo(e) { for (let t = 0; t < 8; t++) e[t] ^= 255; for (let t = 7; t > -1 && (e[t]++, e[t] === 0); t--) ; } var c0 = class { constructor(t, n) { this.toUtf8 = t, this.fromUtf8 = n; } format(t) { const n = []; for (const i of Object.keys(t)) { const o = this.fromUtf8(i); n.push(Uint8Array.from([o.byteLength]), o, this.formatHeaderValue(t[i])); } const r = new Uint8Array(n.reduce((i, o) => i + o.byteLength, 0)); let s = 0; for (const i of n) r.set(i, s), s += i.byteLength; return r; } formatHeaderValue(t) { switch (t.type) { case "boolean": return Uint8Array.from([t.value ? 0 : 1]); case "byte": return Uint8Array.from([2, t.value]); case "short": const n = new DataView(new ArrayBuffer(3)); return n.setUint8(0, 3), n.setInt16(1, t.value, false), new Uint8Array(n.buffer); case "integer": const r = new DataView(new ArrayBuffer(5)); return r.setUint8(0, 4), r.setInt32(1, t.value, false), new Uint8Array(r.buffer); case "long": const s = new Uint8Array(9); return s[0] = 5, s.set(t.value.bytes, 1), s; case "binary": const i = new DataView(new ArrayBuffer(3 + t.value.byteLength)); i.setUint8(0, 6), i.setUint16(1, t.value.byteLength, false); const o = new Uint8Array(i.buffer); return o.set(t.value, 3), o; case "string": const a = this.fromUtf8(t.value), c = new DataView(new ArrayBuffer(3 + a.byteLength)); c.setUint8(0, 7), c.setUint16(1, a.byteLength, false); const u = new Uint8Array(c.buffer); return u.set(a, 3), u; case "timestamp": const l = new Uint8Array(9); return l[0] = 8, l.set(Nt.fromNumber(t.value.valueOf()).bytes, 1), l; case "uuid": if (!y0.test(t.value)) throw new Error(`Invalid UUID received: ${t.value}`); const f = new Uint8Array(17); return f[0] = 9, f.set(Ro(t.value.replace(/\-/g, "")), 1), f; } } parse(t) { const n = {}; let r = 0; for (; r < t.byteLength; ) { const s = t.getUint8(r++), i = this.toUtf8(new Uint8Array(t.buffer, t.byteOffset + r, s)); switch (r += s, t.getUint8(r++)) { case 0: n[i] = { type: wo, value: true }; break; case 1: n[i] = { type: wo, value: false }; break; case 2: n[i] = { type: u0, value: t.getInt8(r++) }; break; case 3: n[i] = { type: d0, value: t.getInt16(r, false) }, r += 2; break; case 4: n[i] = { type: l0, value: t.getInt32(r, false) }, r += 4; break; case 5: n[i] = { type: f0, value: new Nt(new Uint8Array(t.buffer, t.byteOffset + r, 8)) }, r += 8; break; case 6: const o = t.getUint16(r, false); r += 2, n[i] = { type: h0, value: new Uint8Array(t.buffer, t.byteOffset + r, o) }, r += o; break; case 7: const a = t.getUint16(r, false); r += 2, n[i] = { type: p0, value: this.toUtf8(new Uint8Array(t.buffer, t.byteOffset + r, a)) }, r += a; break; case 8: n[i] = { type: g0, value: new Date(new Nt(new Uint8Array(t.buffer, t.byteOffset + r, 8)).valueOf()) }, r += 8; break; case 9: const c = new Uint8Array(t.buffer, t.byteOffset + r, 16); r += 16, n[i] = { type: m0, value: `${Re(c.subarray(0, 4))}-${Re(c.subarray(4, 6))}-${Re(c.subarray(6, 8))}-${Re(c.subarray(8, 10))}-${Re(c.subarray(10))}` }; break; default: throw new Error("Unrecognized header type tag"); } } return n; } }; var yo; (function(e) { e[e.boolTrue = 0] = "boolTrue", e[e.boolFalse = 1] = "boolFalse", e[e.byte = 2] = "byte", e[e.short = 3] = "short", e[e.integer = 4] = "integer", e[e.long = 5] = "long", e[e.byteArray = 6] = "byteArray", e[e.string = 7] = "string", e[e.timestamp = 8] = "timestamp", e[e.uuid = 9] = "uuid"; })(yo || (yo = {})); var wo = "boolean"; var u0 = "byte"; var d0 = "short"; var l0 = "integer"; var f0 = "long"; var h0 = "binary"; var p0 = "string"; var g0 = "timestamp"; var m0 = "uuid"; var y0 = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/; var uc = 4; var qe = uc * 2; var Ye = 4; var w0 = qe + Ye * 2; function b0({ byteLength: e, byteOffset: t, buffer: n }) { if (e < w0) throw new Error("Provided message too short to accommodate event stream message overhead"); const r = new DataView(n, t, e), s = r.getUint32(0, false); if (e !== s) throw new Error("Reported message length does not match received message length"); const i = r.getUint32(uc, false), o = r.getUint32(qe, false), a = r.getUint32(e - Ye, false), c = new Yt().update(new Uint8Array(n, t, qe)); if (o !== c.digest()) throw new Error(`The prelude checksum specified in the message (${o}) does not match the calculated CRC32 checksum (${c.digest()})`); if (c.update(new Uint8Array(n, t + qe, e - (qe + Ye))), a !== c.digest()) throw new Error(`The message checksum (${c.digest()}) did not match the expected value of ${a}`); return { headers: new DataView(n, t + qe + Ye, i), body: new Uint8Array(n, t + qe + Ye + i, s - i - (qe + Ye + Ye)) }; } var E0 = class { constructor(t, n) { this.headerMarshaller = new c0(t, n), this.messageBuffer = [], this.isEndOfStream = false; } feed(t) { this.messageBuffer.push(this.decode(t)); } endOfStream() { this.isEndOfStream = true; } getMessage() { const t = this.messageBuffer.pop(), n = this.isEndOfStream; return { getMessage() { return t; }, isEndOfStream() { return n; } }; } getAvailableMessages() { const t = this.messageBuffer; this.messageBuffer = []; const n = this.isEndOfStream; return { getMessages() { return t; }, isEndOfStream() { return n; } }; } encode({ headers: t, body: n }) { const r = this.headerMarshaller.format(t), s = r.byteLength + n.byteLength + 16, i = new Uint8Array(s), o = new DataView(i.buffer, i.byteOffset, i.byteLength), a = new Yt(); return o.setUint32(0, s, false), o.setUint32(4, r.byteLength, false), o.setUint32(8, a.update(i.subarray(0, 8)).digest(), false), i.set(r, 12), i.set(n, r.byteLength + 12), o.setUint32(s - 4, a.update(i.subarray(8, s - 4)).digest(), false), i; } decode(t) { const { headers: n, body: r } = b0(t); return { headers: this.headerMarshaller.parse(n), body: r }; } formatHeaders(t) { return this.headerMarshaller.format(t); } }; var x0 = class { constructor(t) { this.options = t; } [Symbol.asyncIterator]() { return this.asyncIterator(); } async *asyncIterator() { for await (const t of this.options.inputStream) yield this.options.decoder.decode(t); } }; var S0 = class { constructor(t) { this.options = t; } [Symbol.asyncIterator]() { return this.asyncIterator(); } async *asyncIterator() { for await (const t of this.options.messageStream) yield this.options.encoder.encode(t); this.options.includeEndFrame && (yield new Uint8Array(0)); } }; var A0 = class { constructor(t) { this.options = t; } [Symbol.asyncIterator]() { return this.asyncIterator(); } async *asyncIterator() { for await (const t of this.options.messageStream) { const n = await this.options.deserializer(t); n !== void 0 && (yield n); } } }; var C0 = class { constructor(t) { this.options = t; } [Symbol.asyncIterator]() { return this.asyncIterator(); } async *asyncIterator() { for await (const t of this.options.inputStream) yield this.options.serializer(t); } }; function v0(e) { let t = 0, n = 0, r = null, s = null; const i = (a) => { if (typeof a != "number") throw new Error("Attempted to allocate an event message where size was not a number: " + a); t = a, n = 4, r = new Uint8Array(a), new DataView(r.buffer).setUint32(0, a, false); }, o = async function* () { const a = e[Symbol.asyncIterator](); for (; ; ) { const { value: c, done: u } = await a.next(); if (u) { if (t) if (t === n) yield r; else throw new Error("Truncated event message received."); else return; return; } const l = c.length; let f = 0; for (; f < l; ) { if (!r) { const g = l - f; s || (s = new Uint8Array(4)); const S = Math.min(4 - n, g); if (s.set(c.slice(f, f + S), n), n += S, f += S, n < 4) break; i(new DataView(s.buffer).getUint32(0, false)), s = null; } const p = Math.min(t - n, l - f); r.set(c.slice(f, f + p), n), n += p, f += p, t && t === n && (yield r, r = null, t = 0, n = 0); } } }; return { [Symbol.asyncIterator]: o }; } function R0(e, t) { return async function(n) { const { value: r } = n.headers[":message-type"]; if (r === "error") { const s = new Error(n.headers[":error-message"].value || "UnknownError"); throw s.name = n.headers[":error-code"].value, s; } else if (r === "exception") { const s = n.headers[":exception-type"].value, i = { [s]: n }, o = await e(i); if (o.$unknown) { const a = new Error(t(n.body)); throw a.name = s, a; } throw o[s]; } else if (r === "event") { const s = { [n.headers[":event-type"].value]: n }, i = await e(s); return i.$unknown ? void 0 : i; } else throw Error(`Unrecognizable event type: ${n.headers[":event-type"].value}`); }; } var k0 = class { constructor({ utf8Encoder: t, utf8Decoder: n }) { this.eventStreamCodec = new E0(t, n), this.utfEncoder = t; } deserialize(t, n) { const r = v0(t); return new A0({ messageStream: new x0({ inputStream: r, decoder: this.eventStreamCodec }), deserializer: R0(n, this.utfEncoder) }); } serialize(t, n) { return new S0({ messageStream: new C0({ inputStream: t, serializer: n }), encoder: this.eventStreamCodec, includeEndFrame: true }); } }; var T0 = (e) => ({ [Symbol.asyncIterator]: async function* () { const t = e.getReader(); try { for (; ; ) { const { done: n, value: r } = await t.read(); if (n) return; yield r; } } finally { t.releaseLock(); } } }); var B0 = (e) => { const t = e[Symbol.asyncIterator](); return new ReadableStream({ async pull(n) { const { done: r, value: s } = await t.next(); if (r) return n.close(); n.enqueue(s); } }); }; var I0 = class { constructor({ utf8Encoder: t, utf8Decoder: n }) { this.universalMarshaller = new k0({ utf8Decoder: n, utf8Encoder: t }); } deserialize(t, n) { const r = _0(t) ? T0(t) : t; return this.universalMarshaller.deserialize(r, n); } serialize(t, n) { const r = this.universalMarshaller.serialize(t, n); return typeof ReadableStream == "function" ? B0(r) : r; } }; var _0 = (e) => typeof ReadableStream == "function" && e instanceof ReadableStream; var P0 = (e) => new I0(e); async function N0(e, t, n = 1024 * 1024) { const r = e.size; let s = 0; for (; s < r; ) { const i = e.slice(s, Math.min(r, s + n)); t(new Uint8Array(await i.arrayBuffer())), s += i.size; } } var M0 = async function(t, n) { const r = new t(); return await N0(n, (s) => { r.update(s); }), r.digest(); }; var F0 = (e) => () => Promise.reject(e); var ze = 64; var O0 = 16; var D0 = [1732584193, 4023233417, 2562383102, 271733878]; var U0 = class { constructor() { this.reset(); } update(t) { if ($0(t)) return; if (this.finished) throw new Error("Attempted to update an already finished hash."); const n = L0(t); let r = 0, { byteLength: s } = n; for (this.bytesHashed += s; s > 0; ) this.buffer.setUint8(this.bufferLength++, n[r++]), s--, this.bufferLength === ze && (this.hashBuffer(), this.bufferLength = 0); } async digest() { if (!this.finished) { const { buffer: n, bufferLength: r, bytesHashed: s } = this, i = s * 8; if (n.setUint8(this.bufferLength++, 128), r % ze >= ze - 8) { for (let o = this.bufferLength; o < ze; o++) n.setUint8(o, 0); this.hashBuffer(), this.bufferLength = 0; } for (let o = this.bufferLength; o < ze - 8; o++) n.setUint8(o, 0); n.setUint32(ze - 8, i >>> 0, true), n.setUint32(ze - 4, Math.floor(i / 4294967296), true), this.hashBuffer(), this.finished = true; } const t = new DataView(new ArrayBuffer(O0)); for (let n = 0; n < 4; n++) t.setUint32(n * 4, this.state[n], true); return new Uint8Array(t.buffer, t.byteOffset, t.byteLength); } hashBuffer() { const { buffer: t, state: n } = this; let r = n[0], s = n[1], i = n[2], o = n[3]; r = ge(r, s, i, o, t.getUint32(0, true), 7, 3614090360), o = ge(o, r, s, i, t.getUint32(4, true), 12, 3905402710), i = ge(i, o, r, s, t.getUint32(8, true), 17, 606105819), s = ge(s, i, o, r, t.getUint32(12, true), 22, 3250441966), r = ge(r, s, i, o, t.getUint32(16, true), 7, 4118548399), o = ge(o, r, s, i, t.getUint32(20, true), 12, 1200080426), i = ge(i, o, r, s, t.getUint32(24, true), 17, 2821735955), s = ge(s, i, o, r, t.getUint32(28, true), 22, 4249261313), r = ge(r, s, i, o, t.getUint32(32, true), 7, 1770035416), o = ge(o, r, s, i, t.getUint32(36, true), 12, 2336552879), i = ge(i, o, r, s, t.getUint32(40, true), 17, 4294925233), s = ge(s, i, o, r, t.getUint32(44, true), 22, 2304563134), r = ge(r, s, i, o, t.getUint32(48, true), 7, 1804603682), o = ge(o, r, s, i, t.getUint32(52, true), 12, 4254626195), i = ge(i, o, r, s, t.getUint32(56, true), 17, 2792965006), s = ge(s, i, o, r, t.getUint32(60, true), 22, 1236535329), r = me(r, s, i, o, t.getUint32(4, true), 5, 4129170786), o = me(o, r, s, i, t.getUint32(24, true), 9, 3225465664), i = me(i, o, r, s, t.getUint32(44, true), 14, 643717713), s = me(s, i, o, r, t.getUint32(0, true), 20, 3921069994), r = me(r, s, i, o, t.getUint32(20, true), 5, 3593408605), o = me(o, r, s, i, t.getUint32(40, true), 9, 38016083), i = me(i, o, r, s, t.getUint32(60, true), 14, 3634488961), s = me(s, i, o, r, t.getUint32(16, true), 20, 3889429448), r = me(r, s, i, o, t.getUint32(36, true), 5, 568446438), o = me(o, r, s, i, t.getUint32(56, true), 9, 3275163606), i = me(i, o, r, s, t.getUint32(12, true), 14, 4107603335), s = me(s, i, o, r, t.getUint32(32, true), 20, 1163531501), r = me(r, s, i, o, t.getUint32(52, true), 5, 2850285829), o = me(o, r, s, i, t.getUint32(8, true), 9, 4243563512), i = me(i, o, r, s, t.getUint32(28, true), 14, 1735328473), s = me(s, i, o, r, t.getUint32(48, true), 20, 2368359562), r = ye(r, s, i, o, t.getUint32(20, true), 4, 4294588738), o = ye(o, r, s, i, t.getUint32(32, true), 11, 2272392833), i = ye(i, o, r, s, t.getUint32(44, true), 16, 1839030562), s = ye(s, i, o, r, t.getUint32(56, true), 23, 4259657740), r = ye(r, s, i, o, t.getUint32(4, true), 4, 2763975236), o = ye(o, r, s, i, t.getUint32(16, true), 11, 1272893353), i = ye(i, o, r, s, t.getUint32(28, true), 16, 4139469664), s = ye(s, i, o, r, t.getUint32(40, true), 23, 3200236656), r = ye(r, s, i, o, t.getUint32(52, true), 4, 681279174), o = ye(o, r, s, i, t.getUint32(0, true), 11, 3936430074), i = ye(i, o, r, s, t.getUint32(12, true), 16, 3572445317), s = ye(s, i, o, r, t.getUint32(24, true), 23, 76029189), r = ye(r, s, i, o, t.getUint32(36, true), 4, 3654602809), o = ye(o, r, s, i, t.getUint32(48, true), 11, 3873151461), i = ye(i, o, r, s, t.getUint32(60, true), 16, 530742520), s = ye(s, i, o, r, t.getUint32(8, true), 23, 3299628645), r = we(r, s, i, o, t.getUint32(0, true), 6, 4096336452), o = we(o, r, s, i, t.getUint32(28, true), 10, 1126891415), i = we(i, o, r, s, t.getUint32(56, true), 15, 2878612391), s = we(s, i, o, r, t.getUint32(20, true), 21, 4237533241), r = we(r, s, i, o, t.getUint32(48, true), 6, 1700485571), o = we(o, r, s, i, t.getUint32(12, true), 10, 2399980690), i = we(i, o, r, s, t.getUint32(40, true), 15, 4293915773), s = we(s, i, o, r, t.getUint32(4, true), 21, 2240044497), r = we(r, s, i, o, t.getUint32(32, true), 6, 1873313359), o = we(o, r, s, i, t.getUint32(60, true), 10, 4264355552), i = we(i, o, r, s, t.getUint32(24, true), 15, 2734768916), s = we(s, i, o, r, t.getUint32(52, true), 21, 1309151649), r = we(r, s, i, o, t.getUint32(16, true), 6, 4149444226), o = we(o, r, s, i, t.getUint32(44, true), 10, 3174756917), i = we(i, o, r, s, t.getUint32(8, true), 15, 718787259), s = we(s, i, o, r, t.getUint32(36, true), 21, 3951481745), n[0] = r + n[0] & 4294967295, n[1] = s + n[1] & 4294967295, n[2] = i + n[2] & 4294967295, n[3] = o + n[3] & 4294967295; } reset() { this.state = Uint32Array.from(D0), this.buffer = new DataView(new ArrayBuffer(ze)), this.bufferLength = 0, this.bytesHashed = 0, this.finished = false; } }; function wn(e, t, n, r, s, i) { return t = (t + e & 4294967295) + (r + i & 4294967295) & 4294967295, (t << s | t >>> 32 - s) + n & 4294967295; } function ge(e, t, n, r, s, i, o) { return wn(t & n | ~t & r, e, t, s, i, o); } function me(e, t, n, r, s, i, o) { return wn(t & r | n & ~r, e, t, s, i, o); } function ye(e, t, n, r, s, i, o) { return wn(t ^ n ^ r, e, t, s, i, o); } function we(e, t, n, r, s, i, o) { return wn(n ^ (t | ~r), e, t, s, i, o); } function $0(e) { return typeof e == "string" ? e.length === 0 : e.byteLength === 0; } function L0(e) { return typeof e == "string" ? ot(e) : ArrayBuffer.isView(e) ? new Uint8Array(e.buffer, e.byteOffset, e.byteLength / Uint8Array.BYTES_PER_ELEMENT) : new Uint8Array(e); } var H0 = (e) => ({ apiVersion: "2006-03-01", base64Decoder: (e == null ? void 0 : e.base64Decoder) ?? Ar, base64Encoder: (e == null ? void 0 : e.base64Encoder) ?? cn, disableHostPrefix: (e == null ? void 0 : e.disableHostPrefix) ?? false, endpointProvider: (e == null ? void 0 : e.endpointProvider) ?? $a, extensions: (e == null ? void 0 : e.extensions) ?? [], getAwsChunkedEncodingStream: (e == null ? void 0 : e.getAwsChunkedEncodingStream) ?? Qc, httpAuthSchemeProvider: (e == null ? void 0 : e.httpAuthSchemeProvider) ?? $p, httpAuthSchemes: (e == null ? void 0 : e.httpAuthSchemes) ?? [ { schemeId: "aws.auth#sigv4", identityProvider: (t) => t.getIdentityProvider("aws.auth#sigv4"), signer: new Eo() }, { schemeId: "aws.auth#sigv4a", identityProvider: (t) => t.getIdentityProvider("aws.auth#sigv4a"), signer: new kc() } ], logger: (e == null ? void 0 : e.logger) ?? new kr(), sdkStreamMixin: (e == null ? void 0 : e.sdkStreamMixin) ?? iu, serviceId: (e == null ? void 0 : e.serviceId) ?? "S3", signerConstructor: (e == null ? void 0 : e.signerConstructor) ?? Sa, signingEscapePath: (e == null ? void 0 : e.signingEscapePath) ?? false, urlParser: (e == null ? void 0 : e.urlParser) ?? en, useArnRegion: (e == null ? void 0 : e.useArnRegion) ?? void 0, utf8Decoder: (e == null ? void 0 : e.utf8Decoder) ?? ot, utf8Encoder: (e == null ? void 0 : e.utf8Encoder) ?? Cr }); var z0 = ["in-region", "cross-region", "mobile", "standard", "legacy"]; var j0 = ({ defaultsMode: e } = {}) => Mu(async () => { const t = typeof e == "function" ? await e() : e; switch (t == null ? void 0 : t.toLowerCase()) { case "auto": return Promise.resolve(q0() ? "mobile" : "standard"); case "mobile": case "in-region": case "cross-region": case "standard": case "legacy": return Promise.resolve(t == null ? void 0 : t.toLocaleLowerCase()); case void 0: return Promise.resolve("legacy"); default: throw new Error(`Invalid parameter for "defaultsMode", expect ${z0.join(", ")}, got ${t}`); } }); var q0 = () => { var n, r; const e = typeof window < "u" && ((n = window == null ? void 0 : window.navigator) != null && n.userAgent) ? cc.parse(window.navigator.userAgent) : void 0, t = (r = e == null ? void 0 : e.platform) == null ? void 0 : r.type; return t === "tablet" || t === "mobile"; }; var V0 = (e) => { const t = j0(e), n = () => t().then(md), r = H0(e); return { ...r, ...e, runtime: "browser", defaultsMode: t, bodyLengthChecker: (e == null ? void 0 : e.bodyLengthChecker) ?? dd, credentialDefaultProvider: (e == null ? void 0 : e.credentialDefaultProvider) ?? ((s) => () => Promise.reject(new Error("Credential is missing"))), defaultUserAgentProvider: (e == null ? void 0 : e.defaultUserAgentProvider) ?? a0({ serviceId: r.serviceId, clientVersion: $m.version }), eventStreamSerdeProvider: (e == null ? void 0 : e.eventStreamSerdeProvider) ?? P0, maxAttempts: (e == null ? void 0 : e.maxAttempts) ?? Fr, md5: (e == null ? void 0 : e.md5) ?? U0, region: (e == null ? void 0 : e.region) ?? F0("Region is missing"), requestHandler: vr.create((e == null ? void 0 : e.requestHandler) ?? n), retryMode: (e == null ? void 0 : e.retryMode) ?? (async () => (await n()).retryMode || jh), sha1: (e == null ? void 0 : e.sha1) ?? Wm, sha256: (e == null ? void 0 : e.sha256) ?? t0, streamCollector: (e == null ? void 0 : e.streamCollector) ?? Co, streamHasher: (e == null ? void 0 : e.streamHasher) ?? M0, useDualstackEndpoint: (e == null ? void 0 : e.useDualstackEndpoint) ?? (() => Promise.resolve(vh)), useFipsEndpoint: (e == null ? void 0 : e.useFipsEndpoint) ?? (() => Promise.resolve(Rh)) }; }; var W0 = (e) => ({ setRegion(t) { e.region = t; }, region() { return e.region; } }); var K0 = (e) => ({ region: e.region() }); var G0 = (e) => { const t = e.httpAuthSchemes; let n = e.httpAuthSchemeProvider, r = e.credentials; return { setHttpAuthScheme(s) { const i = t.findIndex((o) => o.schemeId === s.schemeId); i === -1 ? t.push(s) : t.splice(i, 1, s); }, httpAuthSchemes() { return t; }, setHttpAuthSchemeProvider(s) { n = s; }, httpAuthSchemeProvider() { return n; }, setCredentials(s) { r = s; }, credentials() { return r; } }; }; var Z0 = (e) => ({ httpAuthSchemes: e.httpAuthSchemes(), httpAuthSchemeProvider: e.httpAuthSchemeProvider(), credentials: e.credentials() }); var X0 = (e, t) => { const n = Object.assign(W0(e), xd(e), yc(e), G0(e)); return t.forEach((r) => r.configure(n)), Object.assign(e, K0(n), Sd(n), wc(n), Z0(n)); }; var Q0 = class extends ld { constructor(...[n]) { const r = V0(n || {}); super(r); _(this, "config"); this.initConfig = r; const s = Hp(r), i = Hf(s), o = Wl(i), a = fp(o), c = kh(a), u = c, l = zh(u), f = Th(l), p = Lp(f), g = kf(p, { session: [() => this, Em] }), S = X0(g, (n == null ? void 0 : n.extensions) || []); this.config = S, this.middlewareStack.use(Ch(this.config)), this.middlewareStack.use(bp(this.config)), this.middlewareStack.use(_h(this.config)), this.middlewareStack.use(Zl(this.config)), this.middlewareStack.use(Yl(this.config)), this.middlewareStack.use(rf(this.config)), this.middlewareStack.use(Pc(this.config, { httpAuthSchemeParametersProvider: Op, identityProviderConfigProvider: async (T) => new Bu({ "aws.auth#sigv4": T.credentials, "aws.auth#sigv4a": T.credentials }) })), this.middlewareStack.use($c(this.config)), this.middlewareStack.use(Uf(this.config)), this.middlewareStack.use(Sc(this.config)), this.middlewareStack.use(pf(this.config)), this.middlewareStack.use(xf(this.config)), this.middlewareStack.use(Rf(this.config)); } destroy() { super.destroy(); } }; function Y0(e) { return (t) => async (n) => { const r = { ...n.input }, s = [ { target: "SSECustomerKey", hash: "SSECustomerKeyMD5" }, { target: "CopySourceSSECustomerKey", hash: "CopySourceSSECustomerKeyMD5" } ]; for (const i of s) { const o = r[i.target]; if (o) { let a; typeof o == "string" ? ty(o, e) ? a = e.base64Decoder(o) : (a = e.utf8Decoder(o), r[i.target] = e.base64Encoder(a)) : (a = ArrayBuffer.isView(o) ? new Uint8Array(o.buffer, o.byteOffset, o.byteLength) : new Uint8Array(o), r[i.target] = e.base64Encoder(a)); const c = new e.md5(); c.update(a), r[i.hash] = e.base64Encoder(await c.digest()); } } return t({ ...n, input: r }); }; } var J0 = { name: "ssecMiddleware", step: "initialize", tags: ["SSE"], override: true }; var ey = (e) => ({ applyToStack: (t) => { t.add(Y0(e), J0); } }); function ty(e, t) { if (!/^(?:[A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)) return false; try { return t.base64Decoder(e).length === 32; } catch { return false; } } var ny = class extends Rr.classBuilder().ep({ ...za, Bucket: { type: "contextParams", name: "Bucket" }, Key: { type: "contextParams", name: "Key" } }).m(function(t, n, r, s) { return [ So(r, this.serialize, this.deserialize), wa(r, t.getEndpointParameterInstructions()), Vl(r, { requestAlgorithmMember: { httpHeader: "x-amz-sdk-checksum-algorithm", name: "ChecksumAlgorithm" }, requestChecksumRequired: false }), uf(), sa(r), ey(r) ]; }).s("AmazonS3", "PutObject", {}).n("S3Client", "PutObjectCommand").f(Wp, Vp).ser(Gp).de(Xp).build() { }; var ry = axios_default.create({}); async function sy(e, t, n) { return e.getSignedUrl || console.error("请先配置uploader.getSignedUrl,该方法应该从后端获取签名url"), await e.getSignedUrl(e.bucket, t, e, n); } async function iy(e, t) { const { file: n, onProgress: r, options: s } = e, o = await sy(s, t, "put"), a = decodeURIComponent(o); return await ry.put(a, n, { onUploadProgress: (c) => { const { loaded: u, total: l } = c; r({ percent: Math.round(u * 100 / l) }); } }); } async function oy(e) { const { file: t, fileName: n, onProgress: r, options: s } = e, i = s, o = new Q0({ ...(i == null ? void 0 : i.sdkOpts) || {} }), a = await yt(t, n, i); async function c() { const u = { url: i.sdkOpts.endpoint + "/" + i.bucket + "/" + a, key: a }; return i.successHandle ? await i.successHandle(u) : u; } if (i.getSignedUrl) await iy(e, a); else { const u = { Bucket: i.bucket, Key: a // The name of the object. For example, 'sample_upload.txt'. }; await o.send(new ny({ Body: t, ...u })); } return await c(); } async function py(e) { const { getConfig: t } = gt(), n = t("s3"), r = e.options, s = merge_default(cloneDeep_default(n), r); return e.options = s, await oy(e); } export { sy as buildSignedUrl, py as upload, iy as uploadUsingSignedUrl }; /*! Bundled license information: @fast-crud/fast-extends/dist/uploader-s3-77927a69.mjs: (*! * Bowser - a browser detector * https://github.com/lancedikson/bowser * MIT License | (c) Dustin Diaz 2012-2015 * MIT License | (c) Denis Demchenko 2015-2019 *) */ //# sourceMappingURL=uploader-s3-77927a69-S7TFTL7S.js.map