tiny-oss 0.5.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1048 @@
1
+ var he = Object.defineProperty;
2
+ var G = Object.getOwnPropertySymbols;
3
+ var pe = Object.prototype.hasOwnProperty, ge = Object.prototype.propertyIsEnumerable;
4
+ var V = (r, e, t) => e in r ? he(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, B = (r, e) => {
5
+ for (var t in e || (e = {}))
6
+ pe.call(e, t) && V(r, t, e[t]);
7
+ if (G)
8
+ for (var t of G(e))
9
+ ge.call(e, t) && V(r, t, e[t]);
10
+ return r;
11
+ };
12
+ var P = (r, e, t) => new Promise((o, s) => {
13
+ var u = (p) => {
14
+ try {
15
+ a(t.next(p));
16
+ } catch (n) {
17
+ s(n);
18
+ }
19
+ }, d = (p) => {
20
+ try {
21
+ a(t.throw(p));
22
+ } catch (n) {
23
+ s(n);
24
+ }
25
+ }, a = (p) => p.done ? o(p.value) : Promise.resolve(p.value).then(u, d);
26
+ a((t = t.apply(r, e)).next());
27
+ });
28
+ function ye(r, e) {
29
+ return new Promise((t, o) => {
30
+ const {
31
+ method: s = "get",
32
+ data: u = null,
33
+ headers: d = {},
34
+ timeout: a = 0,
35
+ onprogress: p
36
+ } = e, n = new XMLHttpRequest();
37
+ let c;
38
+ a && (c = setTimeout(() => {
39
+ o(new Error(`the request timeout ${a}ms`));
40
+ }, a)), n.onerror = () => {
41
+ o(new Error("unknown error"));
42
+ }, n.upload && p && (n.upload.onprogress = (l) => {
43
+ p({ loaded: l.loaded, total: l.total, lengthComputable: l.lengthComputable });
44
+ }), n.onreadystatechange = () => {
45
+ if (n.readyState === 4)
46
+ if (a && clearTimeout(c), n.status >= 200 && n.status < 300) {
47
+ const l = {}, f = n.getAllResponseHeaders();
48
+ f && f.trim().split(/[\r\n]+/).forEach((h) => {
49
+ const g = h.split(": "), y = g.shift(), m = g.join(": ");
50
+ y && (l[y.toLowerCase()] = m);
51
+ }), t({
52
+ data: n.responseText,
53
+ headers: l,
54
+ status: n.status,
55
+ statusText: n.statusText
56
+ });
57
+ } else {
58
+ const l = new Error(`the request is error: ${n.status} ${n.statusText} ${n.responseText || ""}`);
59
+ o(l);
60
+ }
61
+ }, n.open(s, r, !0), Object.keys(d).forEach((l) => {
62
+ n.setRequestHeader(l, d[l]);
63
+ });
64
+ try {
65
+ n.send(u);
66
+ } catch (l) {
67
+ o(l);
68
+ }
69
+ });
70
+ }
71
+ let oe = ye;
72
+ function rt(r) {
73
+ oe = r;
74
+ }
75
+ function me() {
76
+ return oe;
77
+ }
78
+ function se(r) {
79
+ return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
80
+ }
81
+ var H = { exports: {} }, K = { exports: {} }, W;
82
+ function xe() {
83
+ return W || (W = 1, (function() {
84
+ var r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", e = {
85
+ // Bit-wise rotation left
86
+ rotl: function(t, o) {
87
+ return t << o | t >>> 32 - o;
88
+ },
89
+ // Bit-wise rotation right
90
+ rotr: function(t, o) {
91
+ return t << 32 - o | t >>> o;
92
+ },
93
+ // Swap big-endian to little-endian and vice versa
94
+ endian: function(t) {
95
+ if (t.constructor == Number)
96
+ return e.rotl(t, 8) & 16711935 | e.rotl(t, 24) & 4278255360;
97
+ for (var o = 0; o < t.length; o++)
98
+ t[o] = e.endian(t[o]);
99
+ return t;
100
+ },
101
+ // Generate an array of any length of random bytes
102
+ randomBytes: function(t) {
103
+ for (var o = []; t > 0; t--)
104
+ o.push(Math.floor(Math.random() * 256));
105
+ return o;
106
+ },
107
+ // Convert a byte array to big-endian 32-bit words
108
+ bytesToWords: function(t) {
109
+ for (var o = [], s = 0, u = 0; s < t.length; s++, u += 8)
110
+ o[u >>> 5] |= t[s] << 24 - u % 32;
111
+ return o;
112
+ },
113
+ // Convert big-endian 32-bit words to a byte array
114
+ wordsToBytes: function(t) {
115
+ for (var o = [], s = 0; s < t.length * 32; s += 8)
116
+ o.push(t[s >>> 5] >>> 24 - s % 32 & 255);
117
+ return o;
118
+ },
119
+ // Convert a byte array to a hex string
120
+ bytesToHex: function(t) {
121
+ for (var o = [], s = 0; s < t.length; s++)
122
+ o.push((t[s] >>> 4).toString(16)), o.push((t[s] & 15).toString(16));
123
+ return o.join("");
124
+ },
125
+ // Convert a hex string to a byte array
126
+ hexToBytes: function(t) {
127
+ for (var o = [], s = 0; s < t.length; s += 2)
128
+ o.push(parseInt(t.substr(s, 2), 16));
129
+ return o;
130
+ },
131
+ // Convert a byte array to a base-64 string
132
+ bytesToBase64: function(t) {
133
+ for (var o = [], s = 0; s < t.length; s += 3)
134
+ for (var u = t[s] << 16 | t[s + 1] << 8 | t[s + 2], d = 0; d < 4; d++)
135
+ s * 8 + d * 6 <= t.length * 8 ? o.push(r.charAt(u >>> 6 * (3 - d) & 63)) : o.push("=");
136
+ return o.join("");
137
+ },
138
+ // Convert a base-64 string to a byte array
139
+ base64ToBytes: function(t) {
140
+ t = t.replace(/[^A-Z0-9+\/]/ig, "");
141
+ for (var o = [], s = 0, u = 0; s < t.length; u = ++s % 4)
142
+ u != 0 && o.push((r.indexOf(t.charAt(s - 1)) & Math.pow(2, -2 * u + 8) - 1) << u * 2 | r.indexOf(t.charAt(s)) >>> 6 - u * 2);
143
+ return o;
144
+ }
145
+ };
146
+ K.exports = e;
147
+ })()), K.exports;
148
+ }
149
+ var D, J;
150
+ function Q() {
151
+ if (J) return D;
152
+ J = 1;
153
+ var r = {
154
+ // UTF-8 encoding
155
+ utf8: {
156
+ // Convert a string to a byte array
157
+ stringToBytes: function(e) {
158
+ return r.bin.stringToBytes(unescape(encodeURIComponent(e)));
159
+ },
160
+ // Convert a byte array to a string
161
+ bytesToString: function(e) {
162
+ return decodeURIComponent(escape(r.bin.bytesToString(e)));
163
+ }
164
+ },
165
+ // Binary encoding
166
+ bin: {
167
+ // Convert a string to a byte array
168
+ stringToBytes: function(e) {
169
+ for (var t = [], o = 0; o < e.length; o++)
170
+ t.push(e.charCodeAt(o) & 255);
171
+ return t;
172
+ },
173
+ // Convert a byte array to a string
174
+ bytesToString: function(e) {
175
+ for (var t = [], o = 0; o < e.length; o++)
176
+ t.push(String.fromCharCode(e[o]));
177
+ return t.join("");
178
+ }
179
+ }
180
+ };
181
+ return D = r, D;
182
+ }
183
+ var j, Z;
184
+ function we() {
185
+ if (Z) return j;
186
+ Z = 1, j = function(t) {
187
+ return t != null && (r(t) || e(t) || !!t._isBuffer);
188
+ };
189
+ function r(t) {
190
+ return !!t.constructor && typeof t.constructor.isBuffer == "function" && t.constructor.isBuffer(t);
191
+ }
192
+ function e(t) {
193
+ return typeof t.readFloatLE == "function" && typeof t.slice == "function" && r(t.slice(0, 0));
194
+ }
195
+ return j;
196
+ }
197
+ var Y;
198
+ function be() {
199
+ return Y || (Y = 1, (function() {
200
+ var r = xe(), e = Q().utf8, t = we(), o = Q().bin, s = function(u, d) {
201
+ u.constructor == String ? d && d.encoding === "binary" ? u = o.stringToBytes(u) : u = e.stringToBytes(u) : t(u) ? u = Array.prototype.slice.call(u, 0) : !Array.isArray(u) && u.constructor !== Uint8Array && (u = u.toString());
202
+ for (var a = r.bytesToWords(u), p = u.length * 8, n = 1732584193, c = -271733879, l = -1732584194, f = 271733878, i = 0; i < a.length; i++)
203
+ a[i] = (a[i] << 8 | a[i] >>> 24) & 16711935 | (a[i] << 24 | a[i] >>> 8) & 4278255360;
204
+ a[p >>> 5] |= 128 << p % 32, a[(p + 64 >>> 9 << 4) + 14] = p;
205
+ for (var h = s._ff, g = s._gg, y = s._hh, m = s._ii, i = 0; i < a.length; i += 16) {
206
+ var x = n, w = c, A = l, b = f;
207
+ n = h(n, c, l, f, a[i + 0], 7, -680876936), f = h(f, n, c, l, a[i + 1], 12, -389564586), l = h(l, f, n, c, a[i + 2], 17, 606105819), c = h(c, l, f, n, a[i + 3], 22, -1044525330), n = h(n, c, l, f, a[i + 4], 7, -176418897), f = h(f, n, c, l, a[i + 5], 12, 1200080426), l = h(l, f, n, c, a[i + 6], 17, -1473231341), c = h(c, l, f, n, a[i + 7], 22, -45705983), n = h(n, c, l, f, a[i + 8], 7, 1770035416), f = h(f, n, c, l, a[i + 9], 12, -1958414417), l = h(l, f, n, c, a[i + 10], 17, -42063), c = h(c, l, f, n, a[i + 11], 22, -1990404162), n = h(n, c, l, f, a[i + 12], 7, 1804603682), f = h(f, n, c, l, a[i + 13], 12, -40341101), l = h(l, f, n, c, a[i + 14], 17, -1502002290), c = h(c, l, f, n, a[i + 15], 22, 1236535329), n = g(n, c, l, f, a[i + 1], 5, -165796510), f = g(f, n, c, l, a[i + 6], 9, -1069501632), l = g(l, f, n, c, a[i + 11], 14, 643717713), c = g(c, l, f, n, a[i + 0], 20, -373897302), n = g(n, c, l, f, a[i + 5], 5, -701558691), f = g(f, n, c, l, a[i + 10], 9, 38016083), l = g(l, f, n, c, a[i + 15], 14, -660478335), c = g(c, l, f, n, a[i + 4], 20, -405537848), n = g(n, c, l, f, a[i + 9], 5, 568446438), f = g(f, n, c, l, a[i + 14], 9, -1019803690), l = g(l, f, n, c, a[i + 3], 14, -187363961), c = g(c, l, f, n, a[i + 8], 20, 1163531501), n = g(n, c, l, f, a[i + 13], 5, -1444681467), f = g(f, n, c, l, a[i + 2], 9, -51403784), l = g(l, f, n, c, a[i + 7], 14, 1735328473), c = g(c, l, f, n, a[i + 12], 20, -1926607734), n = y(n, c, l, f, a[i + 5], 4, -378558), f = y(f, n, c, l, a[i + 8], 11, -2022574463), l = y(l, f, n, c, a[i + 11], 16, 1839030562), c = y(c, l, f, n, a[i + 14], 23, -35309556), n = y(n, c, l, f, a[i + 1], 4, -1530992060), f = y(f, n, c, l, a[i + 4], 11, 1272893353), l = y(l, f, n, c, a[i + 7], 16, -155497632), c = y(c, l, f, n, a[i + 10], 23, -1094730640), n = y(n, c, l, f, a[i + 13], 4, 681279174), f = y(f, n, c, l, a[i + 0], 11, -358537222), l = y(l, f, n, c, a[i + 3], 16, -722521979), c = y(c, l, f, n, a[i + 6], 23, 76029189), n = y(n, c, l, f, a[i + 9], 4, -640364487), f = y(f, n, c, l, a[i + 12], 11, -421815835), l = y(l, f, n, c, a[i + 15], 16, 530742520), c = y(c, l, f, n, a[i + 2], 23, -995338651), n = m(n, c, l, f, a[i + 0], 6, -198630844), f = m(f, n, c, l, a[i + 7], 10, 1126891415), l = m(l, f, n, c, a[i + 14], 15, -1416354905), c = m(c, l, f, n, a[i + 5], 21, -57434055), n = m(n, c, l, f, a[i + 12], 6, 1700485571), f = m(f, n, c, l, a[i + 3], 10, -1894986606), l = m(l, f, n, c, a[i + 10], 15, -1051523), c = m(c, l, f, n, a[i + 1], 21, -2054922799), n = m(n, c, l, f, a[i + 8], 6, 1873313359), f = m(f, n, c, l, a[i + 15], 10, -30611744), l = m(l, f, n, c, a[i + 6], 15, -1560198380), c = m(c, l, f, n, a[i + 13], 21, 1309151649), n = m(n, c, l, f, a[i + 4], 6, -145523070), f = m(f, n, c, l, a[i + 11], 10, -1120210379), l = m(l, f, n, c, a[i + 2], 15, 718787259), c = m(c, l, f, n, a[i + 9], 21, -343485551), n = n + x >>> 0, c = c + w >>> 0, l = l + A >>> 0, f = f + b >>> 0;
208
+ }
209
+ return r.endian([n, c, l, f]);
210
+ };
211
+ s._ff = function(u, d, a, p, n, c, l) {
212
+ var f = u + (d & a | ~d & p) + (n >>> 0) + l;
213
+ return (f << c | f >>> 32 - c) + d;
214
+ }, s._gg = function(u, d, a, p, n, c, l) {
215
+ var f = u + (d & p | a & ~p) + (n >>> 0) + l;
216
+ return (f << c | f >>> 32 - c) + d;
217
+ }, s._hh = function(u, d, a, p, n, c, l) {
218
+ var f = u + (d ^ a ^ p) + (n >>> 0) + l;
219
+ return (f << c | f >>> 32 - c) + d;
220
+ }, s._ii = function(u, d, a, p, n, c, l) {
221
+ var f = u + (a ^ (d | ~p)) + (n >>> 0) + l;
222
+ return (f << c | f >>> 32 - c) + d;
223
+ }, s._blocksize = 16, s._digestsize = 16, H.exports = function(u, d) {
224
+ if (u == null)
225
+ throw new Error("Illegal argument " + u);
226
+ var a = r.wordsToBytes(s(u, d));
227
+ return d && d.asBytes ? a : d && d.asString ? o.bytesToString(a) : r.bytesToHex(a);
228
+ };
229
+ })()), H.exports;
230
+ }
231
+ var ve = be();
232
+ const Ae = /* @__PURE__ */ se(ve);
233
+ var _ = {}, X;
234
+ function Te() {
235
+ if (X) return _;
236
+ X = 1, _.byteLength = a, _.toByteArray = n, _.fromByteArray = f;
237
+ for (var r = [], e = [], t = typeof Uint8Array != "undefined" ? Uint8Array : Array, o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", s = 0, u = o.length; s < u; ++s)
238
+ r[s] = o[s], e[o.charCodeAt(s)] = s;
239
+ e[45] = 62, e[95] = 63;
240
+ function d(i) {
241
+ var h = i.length;
242
+ if (h % 4 > 0)
243
+ throw new Error("Invalid string. Length must be a multiple of 4");
244
+ var g = i.indexOf("=");
245
+ g === -1 && (g = h);
246
+ var y = g === h ? 0 : 4 - g % 4;
247
+ return [g, y];
248
+ }
249
+ function a(i) {
250
+ var h = d(i), g = h[0], y = h[1];
251
+ return (g + y) * 3 / 4 - y;
252
+ }
253
+ function p(i, h, g) {
254
+ return (h + g) * 3 / 4 - g;
255
+ }
256
+ function n(i) {
257
+ var h, g = d(i), y = g[0], m = g[1], x = new t(p(i, y, m)), w = 0, A = m > 0 ? y - 4 : y, b;
258
+ for (b = 0; b < A; b += 4)
259
+ h = e[i.charCodeAt(b)] << 18 | e[i.charCodeAt(b + 1)] << 12 | e[i.charCodeAt(b + 2)] << 6 | e[i.charCodeAt(b + 3)], x[w++] = h >> 16 & 255, x[w++] = h >> 8 & 255, x[w++] = h & 255;
260
+ return m === 2 && (h = e[i.charCodeAt(b)] << 2 | e[i.charCodeAt(b + 1)] >> 4, x[w++] = h & 255), m === 1 && (h = e[i.charCodeAt(b)] << 10 | e[i.charCodeAt(b + 1)] << 4 | e[i.charCodeAt(b + 2)] >> 2, x[w++] = h >> 8 & 255, x[w++] = h & 255), x;
261
+ }
262
+ function c(i) {
263
+ return r[i >> 18 & 63] + r[i >> 12 & 63] + r[i >> 6 & 63] + r[i & 63];
264
+ }
265
+ function l(i, h, g) {
266
+ for (var y, m = [], x = h; x < g; x += 3)
267
+ y = (i[x] << 16 & 16711680) + (i[x + 1] << 8 & 65280) + (i[x + 2] & 255), m.push(c(y));
268
+ return m.join("");
269
+ }
270
+ function f(i) {
271
+ for (var h, g = i.length, y = g % 3, m = [], x = 16383, w = 0, A = g - y; w < A; w += x)
272
+ m.push(l(i, w, w + x > A ? A : w + x));
273
+ return y === 1 ? (h = i[g - 1], m.push(
274
+ r[h >> 2] + r[h << 4 & 63] + "=="
275
+ )) : y === 2 && (h = (i[g - 2] << 8) + i[g - 1], m.push(
276
+ r[h >> 10] + r[h >> 4 & 63] + r[h << 2 & 63] + "="
277
+ )), m.join("");
278
+ }
279
+ return _;
280
+ }
281
+ var ke = Te();
282
+ const ae = /* @__PURE__ */ se(ke);
283
+ ArrayBuffer.prototype.slice || (ArrayBuffer.prototype.slice = function(r, e) {
284
+ const t = new Uint8Array(this), o = e === void 0 ? t.length : e, s = new ArrayBuffer(o - r), u = new Uint8Array(s);
285
+ for (let d = 0; d < u.length; d++)
286
+ u[d] = t[d + r];
287
+ return s;
288
+ });
289
+ class ee {
290
+ constructor() {
291
+ this.current = new Uint32Array(new ArrayBuffer(20)), this.currentLen = 0, this.inLen = 0, this.inbuf = new Uint8Array(new ArrayBuffer(64)), this.blockLen = 64, this.digestLen = 20, this.reset();
292
+ }
293
+ processBlock(e) {
294
+ let t = this.current[0], o = this.current[1], s = this.current[2], u = this.current[3], d = this.current[4];
295
+ const a = [
296
+ e[0] << 24 | e[1] << 16 | e[2] << 8 | e[3],
297
+ e[4] << 24 | e[5] << 16 | e[6] << 8 | e[7],
298
+ e[8] << 24 | e[9] << 16 | e[10] << 8 | e[11],
299
+ e[12] << 24 | e[13] << 16 | e[14] << 8 | e[15],
300
+ e[16] << 24 | e[17] << 16 | e[18] << 8 | e[19],
301
+ e[20] << 24 | e[21] << 16 | e[22] << 8 | e[23],
302
+ e[24] << 24 | e[25] << 16 | e[26] << 8 | e[27],
303
+ e[28] << 24 | e[29] << 16 | e[30] << 8 | e[31],
304
+ e[32] << 24 | e[33] << 16 | e[34] << 8 | e[35],
305
+ e[36] << 24 | e[37] << 16 | e[38] << 8 | e[39],
306
+ e[40] << 24 | e[41] << 16 | e[42] << 8 | e[43],
307
+ e[44] << 24 | e[45] << 16 | e[46] << 8 | e[47],
308
+ e[48] << 24 | e[49] << 16 | e[50] << 8 | e[51],
309
+ e[52] << 24 | e[53] << 16 | e[54] << 8 | e[55],
310
+ e[56] << 24 | e[57] << 16 | e[58] << 8 | e[59],
311
+ e[60] << 24 | e[61] << 16 | e[62] << 8 | e[63]
312
+ ];
313
+ let p;
314
+ for (let n = 16; n < 80; n++)
315
+ a.push((a[n - 3] ^ a[n - 8] ^ a[n - 14] ^ a[n - 16]) << 1 | (a[n - 3] ^ a[n - 8] ^ a[n - 14] ^ a[n - 16]) >>> 31);
316
+ for (let n = 0; n < 80; n++)
317
+ p = (t << 5 | t >>> 27) + d + a[n], n < 20 ? p += (o & s | ~o & u) + 1518500249 | 0 : n < 40 ? p += (o ^ s ^ u) + 1859775393 | 0 : n < 60 ? p += (o & s | o & u | s & u) + 2400959708 | 0 : p += (o ^ s ^ u) + 3395469782 | 0, d = u, u = s, s = o << 30 | o >>> 2, o = t, t = p;
318
+ this.current[0] += t, this.current[1] += o, this.current[2] += s, this.current[3] += u, this.current[4] += d, this.currentLen += 64;
319
+ }
320
+ doPadding() {
321
+ const e = (this.inLen + this.currentLen) * 8, t = 0, o = e & 4294967295, s = this.inLen <= 55 ? 55 - this.inLen : 119 - this.inLen, u = new Uint8Array(new ArrayBuffer(s + 1 + 8));
322
+ return u[0] = 128, u[u.length - 1] = o & 255, u[u.length - 2] = o >>> 8 & 255, u[u.length - 3] = o >>> 16 & 255, u[u.length - 4] = o >>> 24 & 255, u[u.length - 5] = t & 255, u[u.length - 6] = t >>> 8 & 255, u[u.length - 7] = t >>> 16 & 255, u[u.length - 8] = t >>> 24 & 255, u;
323
+ }
324
+ getDigest() {
325
+ const e = new Uint8Array(new ArrayBuffer(20));
326
+ return e[3] = this.current[0] & 255, e[2] = this.current[0] >>> 8 & 255, e[1] = this.current[0] >>> 16 & 255, e[0] = this.current[0] >>> 24 & 255, e[7] = this.current[1] & 255, e[6] = this.current[1] >>> 8 & 255, e[5] = this.current[1] >>> 16 & 255, e[4] = this.current[1] >>> 24 & 255, e[11] = this.current[2] & 255, e[10] = this.current[2] >>> 8 & 255, e[9] = this.current[2] >>> 16 & 255, e[8] = this.current[2] >>> 24 & 255, e[15] = this.current[3] & 255, e[14] = this.current[3] >>> 8 & 255, e[13] = this.current[3] >>> 16 & 255, e[12] = this.current[3] >>> 24 & 255, e[19] = this.current[4] & 255, e[18] = this.current[4] >>> 8 & 255, e[17] = this.current[4] >>> 16 & 255, e[16] = this.current[4] >>> 24 & 255, e.buffer;
327
+ }
328
+ reset() {
329
+ this.currentLen = 0, this.inLen = 0, this.current[0] = 1732584193, this.current[1] = 4023233417, this.current[2] = 2562383102, this.current[3] = 271733878, this.current[4] = 3285377520;
330
+ }
331
+ }
332
+ function Ue(r) {
333
+ const e = new ArrayBuffer(r.length), t = new Uint8Array(e);
334
+ for (let o = 0; o < r.length; o++)
335
+ t[o] = r.charCodeAt(o);
336
+ return t;
337
+ }
338
+ function Ce(r) {
339
+ const e = new ArrayBuffer(1), t = new Uint8Array(e);
340
+ return t[0] = r, t;
341
+ }
342
+ function q(r) {
343
+ if (r instanceof Uint8Array)
344
+ return r;
345
+ if (r instanceof ArrayBuffer)
346
+ return new Uint8Array(r);
347
+ if (typeof r == "string")
348
+ return Ue(r);
349
+ if (typeof r == "number") {
350
+ if (r > 255)
351
+ throw new Error("For more than one byte, use an array buffer");
352
+ if (r < 0)
353
+ throw new Error("Input value must be positive");
354
+ return Ce(r);
355
+ } else
356
+ throw new Error("Unsupported type");
357
+ }
358
+ function te(r) {
359
+ const e = function(s) {
360
+ let u = s.length, d = 0;
361
+ for (; u > 0; ) {
362
+ let a = this.blockLen - this.inLen;
363
+ a > u && (a = u);
364
+ const p = s.subarray(d, d + a);
365
+ this.inbuf.set(p, this.inLen), d += a, u -= a, this.inLen += a, this.inLen === this.blockLen && (this.processBlock(this.inbuf), this.inLen = 0);
366
+ }
367
+ }, t = function() {
368
+ const s = this.doPadding();
369
+ this.update(s);
370
+ const u = this.getDigest();
371
+ return this.reset(), u;
372
+ }, o = new r();
373
+ return o.inbuf = new Uint8Array(new ArrayBuffer(o.blockLen)), o.reset(), o.update = e, o.finalize = t, {
374
+ update(s) {
375
+ o.update(q(s));
376
+ },
377
+ finalize() {
378
+ return o.finalize();
379
+ },
380
+ digest(s) {
381
+ return o.update(q(s)), o.finalize();
382
+ },
383
+ reset() {
384
+ o.reset();
385
+ },
386
+ digestLength() {
387
+ return o.digestLen;
388
+ }
389
+ };
390
+ }
391
+ function Se(r) {
392
+ let e = !1, t, o, s;
393
+ const u = function() {
394
+ if (e)
395
+ return;
396
+ if (t === void 0)
397
+ throw new Error("MAC key is not defined");
398
+ let n;
399
+ t.byteLength > 64 ? n = new Uint8Array(r.digest(t)) : n = new Uint8Array(t), o = new Uint8Array(new ArrayBuffer(64));
400
+ for (let c = 0; c < n.length; c++)
401
+ o[c] = 54 ^ n[c];
402
+ for (let c = n.length; c < 64; c++)
403
+ o[c] = 54;
404
+ s = new Uint8Array(new ArrayBuffer(64));
405
+ for (let c = 0; c < n.length; c++)
406
+ s[c] = 92 ^ n[c];
407
+ for (let c = n.length; c < 64; c++)
408
+ s[c] = 92;
409
+ e = !0, r.update(o.buffer);
410
+ }, d = function() {
411
+ e = !1, t = void 0, o = void 0, s = void 0, r.reset();
412
+ }, a = function() {
413
+ const n = r.finalize();
414
+ r.reset(), r.update(s.buffer), r.update(new Uint8Array(n));
415
+ const c = r.finalize();
416
+ return d(), c;
417
+ }, p = function(n) {
418
+ t = n;
419
+ };
420
+ return {
421
+ setKey(n) {
422
+ p(q(n)), u();
423
+ },
424
+ update(n) {
425
+ r.update(q(n));
426
+ },
427
+ finalize() {
428
+ return a();
429
+ },
430
+ mac(n) {
431
+ return this.update(n), this.finalize();
432
+ },
433
+ reset() {
434
+ d();
435
+ },
436
+ hmacLength() {
437
+ return r.digestLength();
438
+ }
439
+ };
440
+ }
441
+ const Be = {
442
+ SHA1: function() {
443
+ return te(ee);
444
+ },
445
+ HMAC_SHA1: function() {
446
+ return Se(te(ee));
447
+ }
448
+ };
449
+ function Me(r) {
450
+ const e = new Uint8Array(r.length * 4);
451
+ let t = 0;
452
+ for (let o = 0; o < r.length; o++) {
453
+ let s = r.charCodeAt(o);
454
+ if (s >= 55296 && s <= 56319 && o + 1 < r.length) {
455
+ const u = r.charCodeAt(o + 1);
456
+ u >= 56320 && u <= 57343 && (s = (s - 55296) * 1024 + (u - 56320) + 65536, o += 1);
457
+ }
458
+ s < 128 ? e[t++] = s : s < 2048 ? (e[t++] = 192 | s >> 6, e[t++] = 128 | s & 63) : s < 65536 ? (e[t++] = 224 | s >> 12, e[t++] = 128 | s >> 6 & 63, e[t++] = 128 | s & 63) : (e[t++] = 240 | s >> 18, e[t++] = 128 | s >> 12 & 63, e[t++] = 128 | s >> 6 & 63, e[t++] = 128 | s & 63);
459
+ }
460
+ return e.subarray(0, t);
461
+ }
462
+ const re = typeof TextEncoder != "undefined" ? new TextEncoder() : null;
463
+ function R(r) {
464
+ return re ? re.encode(r) : Me(r);
465
+ }
466
+ function Le(r) {
467
+ const e = Date.now(), t = e, o = isNaN(t) ? e : t;
468
+ return Math.floor(o / 1e3);
469
+ }
470
+ function ce(r) {
471
+ return typeof r == "string" ? Promise.resolve(R(r)) : r instanceof ArrayBuffer ? Promise.resolve(new Uint8Array(r)) : ArrayBuffer.isView(r) ? Promise.resolve(new Uint8Array(r.buffer, r.byteOffset, r.byteLength)) : r.arrayBuffer().then((e) => new Uint8Array(e));
472
+ }
473
+ function Ee(r) {
474
+ const { accessKeyId: e, accessKeySecret: t, bucket: o, endpoint: s } = r;
475
+ if (!e) throw new Error("need accessKeyId");
476
+ if (!t) throw new Error("need accessKeySecret");
477
+ if (!o && !s) throw new Error("need bucket or endpoint");
478
+ }
479
+ function Fe(r) {
480
+ const e = [];
481
+ for (let t = 0; t < r.length; t += 2)
482
+ e.push(parseInt(r[t] + r[t + 1], 16));
483
+ return Uint8Array.from(e);
484
+ }
485
+ function N(r) {
486
+ const e = Array.prototype.slice.call(r, 0), t = Fe(Ae(e));
487
+ return ae.fromByteArray(t);
488
+ }
489
+ const Pe = {
490
+ region: "oss-cn-hangzhou",
491
+ internal: !1,
492
+ cname: !1,
493
+ secure: !1,
494
+ timeout: 6e4
495
+ };
496
+ function ie(r = {}, e = Pe) {
497
+ return Ee(r), Object.assign({}, e, r);
498
+ }
499
+ function Ie(r, e) {
500
+ const t = e || r.timeout;
501
+ return typeof t == "string" ? parseInt(t, 10) : t;
502
+ }
503
+ function $e(r) {
504
+ if (r != null) {
505
+ if (typeof r == "string") return R(r).length;
506
+ if (r instanceof Blob) return r.size;
507
+ if (r instanceof ArrayBuffer || ArrayBuffer.isView(r)) return r.byteLength;
508
+ }
509
+ }
510
+ const Re = [
511
+ "inventory",
512
+ "acl",
513
+ "backtosource",
514
+ "policy",
515
+ "torrent",
516
+ "logging",
517
+ "location",
518
+ "storageinfo",
519
+ "quota",
520
+ "storageclass",
521
+ "storagepolicy",
522
+ "mirrorbacktosource",
523
+ "requestpayment",
524
+ "versions",
525
+ "versioning",
526
+ "versionid",
527
+ "uploads",
528
+ "uploadid",
529
+ "partnumber",
530
+ "website",
531
+ "notification",
532
+ "replication",
533
+ "lifecycle",
534
+ "deletebucket",
535
+ "delete",
536
+ "cors",
537
+ "restore",
538
+ "tagging",
539
+ "append",
540
+ "position",
541
+ "response-content-type",
542
+ "response-content-language",
543
+ "response-expires",
544
+ "response-cache-control",
545
+ "response-content-disposition",
546
+ "response-content-encoding",
547
+ "x-image-process",
548
+ "x-image-save-object",
549
+ "x-image-save-bucket",
550
+ "x-oss-process",
551
+ "encryption",
552
+ "obsworkflowtriggerpolicy",
553
+ "x-workflow-limit",
554
+ "x-workflow-prefix",
555
+ "x-workflow-start",
556
+ "x-workflow-template-name",
557
+ "x-workflow-graph-name",
558
+ "x-workflow-execution-state",
559
+ "x-workflow-category",
560
+ "x-workflow-prefix",
561
+ "x-workflow-create",
562
+ "directcoldaccess",
563
+ "customdomain",
564
+ "cdnnotifyconfiguration",
565
+ "metadata",
566
+ "dispolicy",
567
+ "obscompresspolicy",
568
+ "template_name",
569
+ "template_name_prefix",
570
+ "x-workflow-status",
571
+ "x-workflow-type",
572
+ "x-workflow-forbid",
573
+ "sfsacl",
574
+ "obsbucketalias",
575
+ "obsalias",
576
+ "rename",
577
+ "name",
578
+ "modify",
579
+ "attname",
580
+ "inventory",
581
+ "truncate",
582
+ "object-lock",
583
+ "x-obs-security-token",
584
+ "publicaccessblock",
585
+ "x-obs-trash",
586
+ "bucketstatus",
587
+ "policystatus",
588
+ "x-obs-callback"
589
+ ];
590
+ function I(r, e = !0) {
591
+ let t = "";
592
+ for (let o = 0; o < r.length; o++) {
593
+ const s = r.charAt(o);
594
+ t += e && s === "/" ? "/" : encodeURIComponent(s);
595
+ }
596
+ return t.replace(/!/g, "%21").replace(/\*/g, "%2A").replace(/'/g, "%27").replace(/\(/g, "%28").replace(/\)/g, "%29");
597
+ }
598
+ function Oe(r) {
599
+ if (!r) return "";
600
+ const e = [];
601
+ Object.keys(r).forEach((o) => {
602
+ const s = r[o];
603
+ e.push(s === "" || s == null ? o : `${o}=${s}`);
604
+ }), e.sort();
605
+ const t = [];
606
+ for (const o of e) {
607
+ const s = o.split("="), u = decodeURIComponent(s[0]);
608
+ Re.indexOf(u.toLowerCase()) > -1 && t.push(s.length === 2 && s[1] ? `${u}=${decodeURIComponent(s[1])}` : u);
609
+ }
610
+ return t.length ? `?${t.join("&")}` : "";
611
+ }
612
+ function ze(r) {
613
+ const e = Object.keys(r).map((o) => o.toLowerCase()).filter((o) => o.indexOf("x-obs-") === 0).sort();
614
+ let t = "";
615
+ for (const o of e) {
616
+ const s = o.indexOf("x-obs-meta-") === 0 ? String(r[o]).trim() : String(r[o]);
617
+ t += `${o}:${s}
618
+ `;
619
+ }
620
+ return t;
621
+ }
622
+ function ue(r) {
623
+ const e = r.headers || {}, t = e["Content-Type"] != null ? String(e["Content-Type"]) : e["content-type"] != null ? String(e["content-type"]) : "", o = r.contentMd5 != null ? String(r.contentMd5) : e["Content-MD5"] != null ? String(e["Content-MD5"]) : e["Content-Md5"] != null ? String(e["Content-Md5"]) : "", s = r.expires != null ? String(r.expires) : "", u = [r.verb, o, t, s];
624
+ let d = r.bucket ? `/${r.bucket}` : "";
625
+ r.objectName && (d += `/${I(r.objectName, !0)}`), d += Oe(r.subResource), u.push(ze(e) + d);
626
+ const a = u.join(`
627
+ `), p = Be.HMAC_SHA1();
628
+ return p.setKey(R(r.accessKeySecret)), p.update(R(a)), ae.fromByteArray(new Uint8Array(p.finalize()));
629
+ }
630
+ function fe(r) {
631
+ const { bucket: e, region: t, endpoint: o } = r;
632
+ return o || `${e}.obs.${t}.myhuaweicloud.com`;
633
+ }
634
+ const _e = {
635
+ region: "cn-north-4",
636
+ secure: !1,
637
+ timeout: 6e4
638
+ };
639
+ function qe(r, e) {
640
+ const t = ie(r, _e), { accessKeyId: o, accessKeySecret: s, stsToken: u, bucket: d, secure: a } = t, p = B({
641
+ "x-obs-date": (/* @__PURE__ */ new Date()).toUTCString()
642
+ }, e.headers);
643
+ u && (p["x-obs-security-token"] = u);
644
+ const n = ue({
645
+ verb: e.verb,
646
+ contentMd5: e.contentMd5,
647
+ headers: p,
648
+ bucket: d,
649
+ objectName: e.objectName,
650
+ accessKeySecret: s,
651
+ subResource: e.subResource
652
+ });
653
+ p.Authorization = `OBS ${o}:${n}`;
654
+ let l = `${a ? "https" : "http"}://${fe(t)}/${I(e.objectName, !0)}`;
655
+ if (e.subResource) {
656
+ const f = Object.keys(e.subResource).map((i) => {
657
+ const h = e.subResource[i];
658
+ return h === "" || h == null ? i : `${i}=${encodeURIComponent(h)}`;
659
+ }).join("&");
660
+ f && (l += `?${f}`);
661
+ }
662
+ return me()(l, {
663
+ method: e.verb,
664
+ headers: p,
665
+ data: e.data,
666
+ timeout: e.timeout == null ? Ie(t) : e.timeout,
667
+ onprogress: e.onprogress,
668
+ total: $e(e.data)
669
+ });
670
+ }
671
+ const He = {
672
+ region: "cn-north-4",
673
+ secure: !1,
674
+ timeout: 6e4
675
+ };
676
+ function Ke(r, e, t = {}) {
677
+ const { expires: o = 1800, method: s, process: u, response: d } = t, a = ie(r, He), { accessKeyId: p, accessKeySecret: n, stsToken: c, bucket: l, secure: f } = a, i = {};
678
+ u && (i["x-image-process"] = u), d && Object.keys(d).forEach((U) => {
679
+ const T = `response-${U.toLowerCase()}`;
680
+ i[T] = d[U];
681
+ });
682
+ const h = {};
683
+ Object.keys(t).forEach((U) => {
684
+ const T = U.toLowerCase(), $ = t[U];
685
+ T.indexOf("x-obs-") === 0 || T === "content-md5" || T === "content-type" ? h[T] = $ : T !== "expires" && T !== "response" && T !== "process" && T !== "method" && (i[T] = $);
686
+ });
687
+ const g = t["security-token"] || c;
688
+ g && (i["x-obs-security-token"] = g);
689
+ const y = Le() + o, m = ue({
690
+ verb: s || "GET",
691
+ contentMd5: h["content-md5"],
692
+ headers: h,
693
+ bucket: l,
694
+ objectName: e,
695
+ accessKeySecret: n,
696
+ subResource: i,
697
+ expires: y
698
+ });
699
+ let w = `${f ? "https" : "http"}://${fe(a)}/${I(e, !0)}`;
700
+ const A = {
701
+ AccessKeyId: p,
702
+ Expires: String(y)
703
+ };
704
+ Object.keys(i).forEach((U) => {
705
+ A[U] = String(i[U]);
706
+ });
707
+ const C = Object.keys(A).sort().map((U) => {
708
+ const T = A[U];
709
+ return T === "" ? I(U, !0) : `${I(U, !0)}=${I(T, !0)}`;
710
+ }).join("&");
711
+ return w += `?${C}&Signature=${I(m, !0)}`, w;
712
+ }
713
+ function De(r) {
714
+ return function(t, o, s, u = {}) {
715
+ return ce(s).then((d) => {
716
+ const a = N(d), p = typeof s == "string" ? "text/plain; charset=utf-8" : s instanceof Blob ? s.type : "application/octet-stream", n = {
717
+ "Content-Md5": a,
718
+ "Content-Type": p
719
+ };
720
+ return r.request(t, {
721
+ verb: "PUT",
722
+ objectName: o,
723
+ contentMd5: a,
724
+ headers: n,
725
+ // Strings are already encoded to bytes for the MD5; send those
726
+ // bytes to avoid encoding twice and to give the transport a size.
727
+ data: typeof s == "string" ? d : s,
728
+ onprogress: u.onprogress
729
+ });
730
+ });
731
+ };
732
+ }
733
+ function k(r, e) {
734
+ const t = new RegExp(`<${e}>([\\s\\S]*?)</${e}>`).exec(r);
735
+ return t ? t[1] : "";
736
+ }
737
+ function le(r, e) {
738
+ const t = new RegExp(`<${e}>[\\s\\S]*?</${e}>`, "g"), o = [];
739
+ let s;
740
+ for (; (s = t.exec(r)) !== null; )
741
+ o.push(s[0]);
742
+ return o;
743
+ }
744
+ function je(r) {
745
+ return function(t, o, s = {}) {
746
+ const u = B({}, s.headers);
747
+ return r.request(t, {
748
+ verb: "POST",
749
+ objectName: o,
750
+ headers: u,
751
+ subResource: { uploads: "" },
752
+ timeout: s.timeout
753
+ }).then((d) => {
754
+ const a = k(d.data, "UploadId");
755
+ return {
756
+ name: o,
757
+ uploadId: a,
758
+ res: d.data
759
+ };
760
+ });
761
+ };
762
+ }
763
+ function Ne(r) {
764
+ return function(c, l, f, i, h, g, y) {
765
+ return P(this, arguments, function* (t, o, s, u, d, a, p, n = {}) {
766
+ const m = ArrayBuffer.isView(d) && !(d instanceof DataView) ? d.subarray(a, p) : d.slice(a, p), x = yield ce(m), w = N(x), A = m instanceof Blob && m.type || "application/octet-stream", b = B({
767
+ "Content-Md5": w,
768
+ "Content-Type": A
769
+ }, n.headers);
770
+ return r.request(t, {
771
+ verb: "PUT",
772
+ objectName: o,
773
+ contentMd5: w,
774
+ headers: b,
775
+ subResource: { uploadId: s, partNumber: u.toString() },
776
+ data: m,
777
+ timeout: n.timeout
778
+ }).then((C) => ({
779
+ name: o,
780
+ etag: C.headers.etag || "",
781
+ res: C.data
782
+ }));
783
+ });
784
+ };
785
+ }
786
+ function Ge(r) {
787
+ return function(a, p, n, c) {
788
+ return P(this, arguments, function* (t, o, s, u, d = {}) {
789
+ const f = `<?xml version="1.0" encoding="UTF-8"?>
790
+ <CompleteMultipartUpload>
791
+ ${u.sort((y, m) => y.number - m.number).map((y) => ` <Part><PartNumber>${y.number}</PartNumber><ETag>${y.etag}</ETag></Part>`).join(`
792
+ `)}
793
+ </CompleteMultipartUpload>`, i = R(f), h = N(i), g = B({
794
+ "Content-Md5": h,
795
+ "Content-Type": "application/xml"
796
+ }, d.headers);
797
+ return r.request(t, {
798
+ verb: "POST",
799
+ objectName: o,
800
+ contentMd5: h,
801
+ headers: g,
802
+ subResource: { uploadId: s },
803
+ data: i,
804
+ timeout: d.timeout
805
+ }).then((y) => {
806
+ const m = k(y.data, "ETag");
807
+ return {
808
+ name: o,
809
+ etag: m,
810
+ bucket: t.bucket,
811
+ res: y.data
812
+ };
813
+ });
814
+ });
815
+ };
816
+ }
817
+ function Ve(r) {
818
+ return function(t, o, s, u = {}) {
819
+ return r.request(t, {
820
+ verb: "DELETE",
821
+ objectName: o,
822
+ headers: B({}, u.headers),
823
+ subResource: { uploadId: s },
824
+ timeout: u.timeout
825
+ }).then(() => {
826
+ });
827
+ };
828
+ }
829
+ function We(r) {
830
+ return function(t, o, s, u = {}, d = {}) {
831
+ const a = { uploadId: s };
832
+ return u["max-parts"] && (a["max-parts"] = u["max-parts"].toString()), u["part-number-marker"] && (a["part-number-marker"] = u["part-number-marker"].toString()), r.request(t, {
833
+ verb: "GET",
834
+ objectName: o,
835
+ headers: B({}, d.headers),
836
+ subResource: a,
837
+ timeout: d.timeout
838
+ }).then((p) => {
839
+ const n = p.data, c = k(n, "IsTruncated") === "true", l = parseInt(k(n, "NextPartNumberMarker") || "0", 10), f = le(n, "Part").map((i) => ({
840
+ PartNumber: parseInt(k(i, "PartNumber") || "0", 10),
841
+ LastModified: k(i, "LastModified"),
842
+ ETag: k(i, "ETag"),
843
+ Size: parseInt(k(i, "Size") || "0", 10)
844
+ }));
845
+ return {
846
+ isTruncated: c,
847
+ nextPartNumberMarker: l,
848
+ parts: f,
849
+ res: p.data
850
+ };
851
+ });
852
+ };
853
+ }
854
+ function Je(r) {
855
+ return function(t, o = {}, s = {}) {
856
+ const u = { uploads: "" };
857
+ return o.prefix && (u.prefix = o.prefix), o.marker && (u[r.listUploadsMarkerKey] = o.marker), o["max-uploads"] && (u["max-uploads"] = o["max-uploads"].toString()), o["upload-id-marker"] && (u["upload-id-marker"] = o["upload-id-marker"]), r.request(t, {
858
+ verb: "GET",
859
+ objectName: "",
860
+ headers: B({}, s.headers),
861
+ subResource: u,
862
+ timeout: s.timeout
863
+ }).then((d) => {
864
+ const a = d.data, p = k(a, "IsTruncated") === "true", n = k(a, "NextKeyMarker") || void 0, c = k(a, "NextUploadIdMarker") || void 0;
865
+ return {
866
+ uploads: le(a, "Upload").map((f) => ({
867
+ uploadId: k(f, "UploadId"),
868
+ name: k(f, "Key"),
869
+ initiated: k(f, "Initiated")
870
+ })),
871
+ isTruncated: p,
872
+ nextKeyMarker: n,
873
+ nextUploadIdMarker: c,
874
+ res: d.data
875
+ };
876
+ });
877
+ };
878
+ }
879
+ function Qe(r) {
880
+ return function(t, o, s, u, d, a, p = {}) {
881
+ const n = t.bucket, l = `/${a.sourceBucket || n}/${encodeURIComponent(a.sourceKey)}`, f = B({
882
+ [r.copySourceHeader]: l,
883
+ [r.copySourceRangeHeader]: d
884
+ }, p.headers);
885
+ return r.request(t, {
886
+ verb: "PUT",
887
+ objectName: o,
888
+ headers: f,
889
+ subResource: { uploadId: s, partNumber: u.toString() },
890
+ timeout: p.timeout
891
+ }).then((i) => {
892
+ const h = k(i.data, "ETag"), g = k(i.data, "LastModified");
893
+ return {
894
+ etag: h,
895
+ lastModified: g,
896
+ res: i.data
897
+ };
898
+ });
899
+ };
900
+ }
901
+ function ne(r) {
902
+ return typeof r == "string" ? R(r).length : r instanceof Blob ? r.size : r.byteLength;
903
+ }
904
+ function Ze(r, e) {
905
+ return function(a, p, n) {
906
+ return P(this, arguments, function* (o, s, u, d = {}) {
907
+ const {
908
+ parallel: c = 5,
909
+ partSize: l = 1024 * 1024,
910
+ // default 1MB
911
+ checkpoint: f,
912
+ progress: i,
913
+ meta: h,
914
+ mime: g,
915
+ headers: y = {}
916
+ } = d;
917
+ let m, x = [], w = Math.max(l, 100 * 1024);
918
+ const A = ne(u);
919
+ if (A === 0)
920
+ throw new Error("multipart upload requires a non-empty file");
921
+ if (f && f.uploadId && ne(f.file) === A)
922
+ m = f.uploadId, x = f.doneParts || [], f.partSize && (w = f.partSize);
923
+ else {
924
+ const v = B({}, y);
925
+ g && (v["Content-Type"] = g), h && Object.keys(h).forEach((S) => {
926
+ v[`${r.metaPrefix}${S}`] = h[S];
927
+ }), m = (yield e.initMultipartUpload(o, s, { headers: v })).uploadId;
928
+ }
929
+ const b = Math.ceil(A / w), C = {
930
+ file: u,
931
+ name: s,
932
+ uploadId: m,
933
+ partSize: w,
934
+ parts: [],
935
+ doneParts: [...x]
936
+ };
937
+ for (let v = 1; v <= b; v++)
938
+ x.some((S) => S.number === v) || C.parts.push({ number: v, etag: "" });
939
+ const U = (v, L, S) => P(null, null, function* () {
940
+ const E = () => P(null, null, function* () {
941
+ const z = yield e.uploadPart(o, s, m, v, u, L, S);
942
+ if (!z.etag)
943
+ throw new Error("cannot read the ETag of the uploaded part; make sure the bucket CORS rule exposes the ETag response header");
944
+ return z;
945
+ });
946
+ let F;
947
+ try {
948
+ F = yield E();
949
+ } catch (z) {
950
+ F = yield E();
951
+ }
952
+ if (C.doneParts.push({ number: v, etag: F.etag }), i) {
953
+ const z = C.doneParts.length / b;
954
+ i(z, C, F);
955
+ }
956
+ return { number: v, etag: F.etag };
957
+ }), T = C.parts.filter((v) => !x.some((L) => L.number === v.number)), $ = [], O = [];
958
+ for (const v of T) {
959
+ const L = (v.number - 1) * w, S = Math.min(v.number * w, A), E = U(v.number, L, S);
960
+ $.push(E), O.push(E), E.finally(() => {
961
+ const F = O.indexOf(E);
962
+ F > -1 && O.splice(F, 1);
963
+ }), O.length >= c && (yield Promise.race(O));
964
+ }
965
+ yield Promise.all($);
966
+ const de = [...x, ...C.doneParts].filter((v, L, S) => S.findIndex((E) => E.number === v.number) === L);
967
+ return e.completeMultipartUpload(o, s, m, de);
968
+ });
969
+ };
970
+ }
971
+ function nt(r, e) {
972
+ const { method: t, headers: o, data: s, timeout: u, onprogress: d, total: a } = e, p = new AbortController();
973
+ let n;
974
+ return u && (n = setTimeout(() => p.abort(), u)), d && a && d({ loaded: 0, total: a, lengthComputable: !1 }), fetch(r, {
975
+ method: t,
976
+ headers: o,
977
+ body: s,
978
+ signal: p.signal
979
+ }).then((c) => P(null, null, function* () {
980
+ const l = yield c.text();
981
+ if (c.status < 200 || c.status >= 300)
982
+ throw new Error(`the request is error: ${c.status} ${c.statusText} ${l}`);
983
+ d && a && d({ loaded: a, total: a, lengthComputable: !1 });
984
+ const f = {};
985
+ return c.headers.forEach((i, h) => {
986
+ f[h] = i;
987
+ }), {
988
+ data: l,
989
+ headers: f,
990
+ status: c.status,
991
+ statusText: c.statusText
992
+ };
993
+ })).finally(() => {
994
+ n && clearTimeout(n);
995
+ });
996
+ }
997
+ function ot(r, e) {
998
+ const { method: t, headers: o, data: s, timeout: u, onprogress: d, total: a } = e;
999
+ return typeof wx == "undefined" ? Promise.reject(new Error("wxRequestTransport requires the WeChat mini program runtime")) : (d && a && d({ loaded: 0, total: a, lengthComputable: !1 }), new Promise((p, n) => {
1000
+ wx.request({
1001
+ url: r,
1002
+ method: t,
1003
+ header: o,
1004
+ data: s instanceof Uint8Array ? s.buffer : s,
1005
+ timeout: u,
1006
+ success: (c) => {
1007
+ d && a && d({ loaded: a, total: a, lengthComputable: !1 }), p({ data: c.data, headers: c.header, status: c.statusCode, statusText: "" });
1008
+ },
1009
+ fail: (c) => {
1010
+ n(c instanceof Error ? c : new Error(String(c)));
1011
+ }
1012
+ });
1013
+ }));
1014
+ }
1015
+ function st(r, e) {
1016
+ return (...t) => r(e, ...t);
1017
+ }
1018
+ const M = {
1019
+ request: qe,
1020
+ metaPrefix: "x-obs-meta-",
1021
+ copySourceHeader: "x-obs-copy-source",
1022
+ copySourceRangeHeader: "x-obs-copy-source-range",
1023
+ listUploadsMarkerKey: "key-marker",
1024
+ supportsSymlink: !1,
1025
+ signUrl: Ke
1026
+ }, at = De(M), Ye = je(M), Xe = Ne(M), et = Ge(M), ct = Ze(M, {
1027
+ initMultipartUpload: Ye,
1028
+ uploadPart: Xe,
1029
+ completeMultipartUpload: et
1030
+ }), it = Ve(M), ut = We(M), ft = Je(M), lt = Qe(M), dt = M.signUrl;
1031
+ export {
1032
+ it as abortMultipartUpload,
1033
+ st as bindOptions,
1034
+ et as completeMultipartUpload,
1035
+ nt as fetchTransport,
1036
+ me as getTransport,
1037
+ Ye as initMultipartUpload,
1038
+ ut as listParts,
1039
+ ft as listUploads,
1040
+ ct as multipartUpload,
1041
+ at as put,
1042
+ rt as setTransport,
1043
+ dt as signatureUrl,
1044
+ Xe as uploadPart,
1045
+ lt as uploadPartCopy,
1046
+ ot as wxRequestTransport
1047
+ };
1048
+ //# sourceMappingURL=tiny-oss.obs.es.js.map