ndjjd-vite-plugin-federation 0.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.
- package/README.md +5 -0
- package/dist/global.d.ts +14 -0
- package/dist/index.iife.js +7 -0
- package/dist/index.js +3912 -0
- package/dist/index.umd.cjs +7 -0
- package/dist/types/global.d.ts +14 -0
- package/package.json +46 -0
- package/src/types/global.d.ts +14 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,3912 @@
|
|
|
1
|
+
function rn(t) {
|
|
2
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
3
|
+
}
|
|
4
|
+
function on(t) {
|
|
5
|
+
if (Object.prototype.hasOwnProperty.call(t, "__esModule")) return t;
|
|
6
|
+
var e = t.default;
|
|
7
|
+
if (typeof e == "function") {
|
|
8
|
+
var n = function r() {
|
|
9
|
+
var o = !1;
|
|
10
|
+
try {
|
|
11
|
+
o = this instanceof r;
|
|
12
|
+
} catch {
|
|
13
|
+
}
|
|
14
|
+
return o ? Reflect.construct(e, arguments, this.constructor) : e.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
n.prototype = e.prototype;
|
|
17
|
+
} else n = {};
|
|
18
|
+
return Object.defineProperty(n, "__esModule", { value: !0 }), Object.keys(t).forEach(function(r) {
|
|
19
|
+
var o = Object.getOwnPropertyDescriptor(t, r);
|
|
20
|
+
Object.defineProperty(n, r, o.get ? o : {
|
|
21
|
+
enumerable: !0,
|
|
22
|
+
get: function() {
|
|
23
|
+
return t[r];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}), n;
|
|
27
|
+
}
|
|
28
|
+
var $ = { exports: {} };
|
|
29
|
+
const H = {}, sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
30
|
+
__proto__: null,
|
|
31
|
+
default: H
|
|
32
|
+
}, Symbol.toStringTag, { value: "Module" })), J = /* @__PURE__ */ on(sn);
|
|
33
|
+
var Ie, Je;
|
|
34
|
+
function _t() {
|
|
35
|
+
return Je || (Je = 1, Ie = {
|
|
36
|
+
/* The local file header */
|
|
37
|
+
LOCHDR: 30,
|
|
38
|
+
// LOC header size
|
|
39
|
+
LOCSIG: 67324752,
|
|
40
|
+
// "PK\003\004"
|
|
41
|
+
LOCVER: 4,
|
|
42
|
+
// version needed to extract
|
|
43
|
+
LOCFLG: 6,
|
|
44
|
+
// general purpose bit flag
|
|
45
|
+
LOCHOW: 8,
|
|
46
|
+
// compression method
|
|
47
|
+
LOCTIM: 10,
|
|
48
|
+
// modification time (2 bytes time, 2 bytes date)
|
|
49
|
+
LOCCRC: 14,
|
|
50
|
+
// uncompressed file crc-32 value
|
|
51
|
+
LOCSIZ: 18,
|
|
52
|
+
// compressed size
|
|
53
|
+
LOCLEN: 22,
|
|
54
|
+
// uncompressed size
|
|
55
|
+
LOCNAM: 26,
|
|
56
|
+
// filename length
|
|
57
|
+
LOCEXT: 28,
|
|
58
|
+
// extra field length
|
|
59
|
+
/* The Data descriptor */
|
|
60
|
+
EXTSIG: 134695760,
|
|
61
|
+
// "PK\007\008"
|
|
62
|
+
EXTHDR: 16,
|
|
63
|
+
// EXT header size
|
|
64
|
+
EXTCRC: 4,
|
|
65
|
+
// uncompressed file crc-32 value
|
|
66
|
+
EXTSIZ: 8,
|
|
67
|
+
// compressed size
|
|
68
|
+
EXTLEN: 12,
|
|
69
|
+
// uncompressed size
|
|
70
|
+
/* The central directory file header */
|
|
71
|
+
CENHDR: 46,
|
|
72
|
+
// CEN header size
|
|
73
|
+
CENSIG: 33639248,
|
|
74
|
+
// "PK\001\002"
|
|
75
|
+
CENVEM: 4,
|
|
76
|
+
// version made by
|
|
77
|
+
CENVER: 6,
|
|
78
|
+
// version needed to extract
|
|
79
|
+
CENFLG: 8,
|
|
80
|
+
// encrypt, decrypt flags
|
|
81
|
+
CENHOW: 10,
|
|
82
|
+
// compression method
|
|
83
|
+
CENTIM: 12,
|
|
84
|
+
// modification time (2 bytes time, 2 bytes date)
|
|
85
|
+
CENCRC: 16,
|
|
86
|
+
// uncompressed file crc-32 value
|
|
87
|
+
CENSIZ: 20,
|
|
88
|
+
// compressed size
|
|
89
|
+
CENLEN: 24,
|
|
90
|
+
// uncompressed size
|
|
91
|
+
CENNAM: 28,
|
|
92
|
+
// filename length
|
|
93
|
+
CENEXT: 30,
|
|
94
|
+
// extra field length
|
|
95
|
+
CENCOM: 32,
|
|
96
|
+
// file comment length
|
|
97
|
+
CENDSK: 34,
|
|
98
|
+
// volume number start
|
|
99
|
+
CENATT: 36,
|
|
100
|
+
// internal file attributes
|
|
101
|
+
CENATX: 38,
|
|
102
|
+
// external file attributes (host system dependent)
|
|
103
|
+
CENOFF: 42,
|
|
104
|
+
// LOC header offset
|
|
105
|
+
/* The entries in the end of central directory */
|
|
106
|
+
ENDHDR: 22,
|
|
107
|
+
// END header size
|
|
108
|
+
ENDSIG: 101010256,
|
|
109
|
+
// "PK\005\006"
|
|
110
|
+
ENDSUB: 8,
|
|
111
|
+
// number of entries on this disk
|
|
112
|
+
ENDTOT: 10,
|
|
113
|
+
// total number of entries
|
|
114
|
+
ENDSIZ: 12,
|
|
115
|
+
// central directory size in bytes
|
|
116
|
+
ENDOFF: 16,
|
|
117
|
+
// offset of first CEN header
|
|
118
|
+
ENDCOM: 20,
|
|
119
|
+
// zip file comment length
|
|
120
|
+
END64HDR: 20,
|
|
121
|
+
// zip64 END header size
|
|
122
|
+
END64SIG: 117853008,
|
|
123
|
+
// zip64 Locator signature, "PK\006\007"
|
|
124
|
+
END64START: 4,
|
|
125
|
+
// number of the disk with the start of the zip64
|
|
126
|
+
END64OFF: 8,
|
|
127
|
+
// relative offset of the zip64 end of central directory
|
|
128
|
+
END64NUMDISKS: 16,
|
|
129
|
+
// total number of disks
|
|
130
|
+
ZIP64SIG: 101075792,
|
|
131
|
+
// zip64 signature, "PK\006\006"
|
|
132
|
+
ZIP64HDR: 56,
|
|
133
|
+
// zip64 record minimum size
|
|
134
|
+
ZIP64LEAD: 12,
|
|
135
|
+
// leading bytes at the start of the record, not counted by the value stored in ZIP64SIZE
|
|
136
|
+
ZIP64SIZE: 4,
|
|
137
|
+
// zip64 size of the central directory record
|
|
138
|
+
ZIP64VEM: 12,
|
|
139
|
+
// zip64 version made by
|
|
140
|
+
ZIP64VER: 14,
|
|
141
|
+
// zip64 version needed to extract
|
|
142
|
+
ZIP64DSK: 16,
|
|
143
|
+
// zip64 number of this disk
|
|
144
|
+
ZIP64DSKDIR: 20,
|
|
145
|
+
// number of the disk with the start of the record directory
|
|
146
|
+
ZIP64SUB: 24,
|
|
147
|
+
// number of entries on this disk
|
|
148
|
+
ZIP64TOT: 32,
|
|
149
|
+
// total number of entries
|
|
150
|
+
ZIP64SIZB: 40,
|
|
151
|
+
// zip64 central directory size in bytes
|
|
152
|
+
ZIP64OFF: 48,
|
|
153
|
+
// offset of start of central directory with respect to the starting disk number
|
|
154
|
+
ZIP64EXTRA: 56,
|
|
155
|
+
// extensible data sector
|
|
156
|
+
/* Compression methods */
|
|
157
|
+
STORED: 0,
|
|
158
|
+
// no compression
|
|
159
|
+
SHRUNK: 1,
|
|
160
|
+
// shrunk
|
|
161
|
+
REDUCED1: 2,
|
|
162
|
+
// reduced with compression factor 1
|
|
163
|
+
REDUCED2: 3,
|
|
164
|
+
// reduced with compression factor 2
|
|
165
|
+
REDUCED3: 4,
|
|
166
|
+
// reduced with compression factor 3
|
|
167
|
+
REDUCED4: 5,
|
|
168
|
+
// reduced with compression factor 4
|
|
169
|
+
IMPLODED: 6,
|
|
170
|
+
// imploded
|
|
171
|
+
// 7 reserved for Tokenizing compression algorithm
|
|
172
|
+
DEFLATED: 8,
|
|
173
|
+
// deflated
|
|
174
|
+
ENHANCED_DEFLATED: 9,
|
|
175
|
+
// enhanced deflated
|
|
176
|
+
PKWARE: 10,
|
|
177
|
+
// PKWare DCL imploded
|
|
178
|
+
// 11 reserved by PKWARE
|
|
179
|
+
BZIP2: 12,
|
|
180
|
+
// compressed using BZIP2
|
|
181
|
+
// 13 reserved by PKWARE
|
|
182
|
+
LZMA: 14,
|
|
183
|
+
// LZMA
|
|
184
|
+
// 15-17 reserved by PKWARE
|
|
185
|
+
IBM_TERSE: 18,
|
|
186
|
+
// compressed using IBM TERSE
|
|
187
|
+
IBM_LZ77: 19,
|
|
188
|
+
// IBM LZ77 z
|
|
189
|
+
AES_ENCRYPT: 99,
|
|
190
|
+
// WinZIP AES encryption method
|
|
191
|
+
/* General purpose bit flag */
|
|
192
|
+
// values can obtained with expression 2**bitnr
|
|
193
|
+
FLG_ENC: 1,
|
|
194
|
+
// Bit 0: encrypted file
|
|
195
|
+
FLG_COMP1: 2,
|
|
196
|
+
// Bit 1, compression option
|
|
197
|
+
FLG_COMP2: 4,
|
|
198
|
+
// Bit 2, compression option
|
|
199
|
+
FLG_DESC: 8,
|
|
200
|
+
// Bit 3, data descriptor
|
|
201
|
+
FLG_ENH: 16,
|
|
202
|
+
// Bit 4, enhanced deflating
|
|
203
|
+
FLG_PATCH: 32,
|
|
204
|
+
// Bit 5, indicates that the file is compressed patched data.
|
|
205
|
+
FLG_STR: 64,
|
|
206
|
+
// Bit 6, strong encryption (patented)
|
|
207
|
+
// Bits 7-10: Currently unused.
|
|
208
|
+
FLG_EFS: 2048,
|
|
209
|
+
// Bit 11: Language encoding flag (EFS)
|
|
210
|
+
// Bit 12: Reserved by PKWARE for enhanced compression.
|
|
211
|
+
// Bit 13: encrypted the Central Directory (patented).
|
|
212
|
+
// Bits 14-15: Reserved by PKWARE.
|
|
213
|
+
FLG_MSK: 4096,
|
|
214
|
+
// mask header values
|
|
215
|
+
/* Load type */
|
|
216
|
+
FILE: 2,
|
|
217
|
+
BUFFER: 1,
|
|
218
|
+
NONE: 0,
|
|
219
|
+
/* 4.5 Extensible data fields */
|
|
220
|
+
EF_ID: 0,
|
|
221
|
+
EF_SIZE: 2,
|
|
222
|
+
/* Header IDs */
|
|
223
|
+
ID_ZIP64: 1,
|
|
224
|
+
ID_AVINFO: 7,
|
|
225
|
+
ID_PFS: 8,
|
|
226
|
+
ID_OS2: 9,
|
|
227
|
+
ID_NTFS: 10,
|
|
228
|
+
ID_OPENVMS: 12,
|
|
229
|
+
ID_UNIX: 13,
|
|
230
|
+
ID_FORK: 14,
|
|
231
|
+
ID_PATCH: 15,
|
|
232
|
+
ID_X509_PKCS7: 20,
|
|
233
|
+
ID_X509_CERTID_F: 21,
|
|
234
|
+
ID_X509_CERTID_C: 22,
|
|
235
|
+
ID_STRONGENC: 23,
|
|
236
|
+
ID_RECORD_MGT: 24,
|
|
237
|
+
ID_X509_PKCS7_RL: 25,
|
|
238
|
+
ID_IBM1: 101,
|
|
239
|
+
ID_IBM2: 102,
|
|
240
|
+
ID_POSZIP: 18064,
|
|
241
|
+
EF_ZIP64_OR_32: 4294967295,
|
|
242
|
+
EF_ZIP64_OR_16: 65535,
|
|
243
|
+
EF_ZIP64_SUNCOMP: 0,
|
|
244
|
+
EF_ZIP64_SCOMP: 8,
|
|
245
|
+
EF_ZIP64_RHO: 16,
|
|
246
|
+
EF_ZIP64_DSN: 24
|
|
247
|
+
}), Ie;
|
|
248
|
+
}
|
|
249
|
+
var Oe = {}, Ke;
|
|
250
|
+
function ke() {
|
|
251
|
+
return Ke || (Ke = 1, (function(t) {
|
|
252
|
+
const e = {
|
|
253
|
+
/* Header error messages */
|
|
254
|
+
INVALID_LOC: "Invalid LOC header (bad signature)",
|
|
255
|
+
INVALID_CEN: "Invalid CEN header (bad signature)",
|
|
256
|
+
INVALID_END: "Invalid END header (bad signature)",
|
|
257
|
+
/* Descriptor */
|
|
258
|
+
DESCRIPTOR_NOT_EXIST: "No descriptor present",
|
|
259
|
+
DESCRIPTOR_UNKNOWN: "Unknown descriptor format",
|
|
260
|
+
DESCRIPTOR_FAULTY: "Descriptor data is malformed",
|
|
261
|
+
/* ZipEntry error messages*/
|
|
262
|
+
NO_DATA: "Nothing to decompress",
|
|
263
|
+
BAD_CRC: "CRC32 checksum failed {0}",
|
|
264
|
+
FILE_IN_THE_WAY: "There is a file in the way: {0}",
|
|
265
|
+
UNKNOWN_METHOD: "Invalid/unsupported compression method",
|
|
266
|
+
/* Inflater error messages */
|
|
267
|
+
AVAIL_DATA: "inflate::Available inflate data did not terminate",
|
|
268
|
+
INVALID_DISTANCE: "inflate::Invalid literal/length or distance code in fixed or dynamic block",
|
|
269
|
+
TO_MANY_CODES: "inflate::Dynamic block code description: too many length or distance codes",
|
|
270
|
+
INVALID_REPEAT_LEN: "inflate::Dynamic block code description: repeat more than specified lengths",
|
|
271
|
+
INVALID_REPEAT_FIRST: "inflate::Dynamic block code description: repeat lengths with no first length",
|
|
272
|
+
INCOMPLETE_CODES: "inflate::Dynamic block code description: code lengths codes incomplete",
|
|
273
|
+
INVALID_DYN_DISTANCE: "inflate::Dynamic block code description: invalid distance code lengths",
|
|
274
|
+
INVALID_CODES_LEN: "inflate::Dynamic block code description: invalid literal/length code lengths",
|
|
275
|
+
INVALID_STORE_BLOCK: "inflate::Stored block length did not match one's complement",
|
|
276
|
+
INVALID_BLOCK_TYPE: "inflate::Invalid block type (type == 3)",
|
|
277
|
+
/* ADM-ZIP error messages */
|
|
278
|
+
CANT_EXTRACT_FILE: "Could not extract the file",
|
|
279
|
+
CANT_OVERRIDE: "Target file already exists",
|
|
280
|
+
DISK_ENTRY_TOO_LARGE: "Number of disk entries is too large",
|
|
281
|
+
NO_ZIP: "No zip file was loaded",
|
|
282
|
+
NO_ENTRY: "Entry doesn't exist",
|
|
283
|
+
DIRECTORY_CONTENT_ERROR: "A directory cannot have content",
|
|
284
|
+
FILE_NOT_FOUND: 'File not found: "{0}"',
|
|
285
|
+
NOT_IMPLEMENTED: "Not implemented",
|
|
286
|
+
INVALID_FILENAME: "Invalid filename",
|
|
287
|
+
INVALID_FORMAT: "Invalid or unsupported zip format. No END header found",
|
|
288
|
+
INVALID_PASS_PARAM: "Incompatible password parameter",
|
|
289
|
+
WRONG_PASSWORD: "Wrong Password",
|
|
290
|
+
/* ADM-ZIP */
|
|
291
|
+
COMMENT_TOO_LONG: "Comment is too long",
|
|
292
|
+
// Comment can be max 65535 bytes long (NOTE: some non-US characters may take more space)
|
|
293
|
+
EXTRA_FIELD_PARSE_ERROR: "Extra field parsing error"
|
|
294
|
+
};
|
|
295
|
+
function n(r) {
|
|
296
|
+
return function(...o) {
|
|
297
|
+
return o.length && (r = r.replace(/\{(\d)\}/g, (i, s) => o[s] || "")), new Error("ADM-ZIP: " + r);
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
for (const r of Object.keys(e))
|
|
301
|
+
t[r] = n(e[r]);
|
|
302
|
+
})(Oe)), Oe;
|
|
303
|
+
}
|
|
304
|
+
var De, Ye;
|
|
305
|
+
function an() {
|
|
306
|
+
if (Ye) return De;
|
|
307
|
+
Ye = 1;
|
|
308
|
+
const t = J, e = J, n = _t(), r = ke(), o = typeof process == "object" && process.platform === "win32", i = (a) => typeof a == "object" && a !== null, s = new Uint32Array(256).map((a, f) => {
|
|
309
|
+
for (let d = 0; d < 8; d++)
|
|
310
|
+
(f & 1) !== 0 ? f = 3988292384 ^ f >>> 1 : f >>>= 1;
|
|
311
|
+
return f >>> 0;
|
|
312
|
+
});
|
|
313
|
+
function c(a) {
|
|
314
|
+
this.sep = e.sep, this.fs = t, i(a) && i(a.fs) && typeof a.fs.statSync == "function" && (this.fs = a.fs);
|
|
315
|
+
}
|
|
316
|
+
return De = c, c.prototype.makeDir = function(a) {
|
|
317
|
+
const f = this;
|
|
318
|
+
function d(g) {
|
|
319
|
+
let N = g.split(f.sep)[0];
|
|
320
|
+
g.split(f.sep).forEach(function(y) {
|
|
321
|
+
if (!(!y || y.substr(-1, 1) === ":")) {
|
|
322
|
+
N += f.sep + y;
|
|
323
|
+
var E;
|
|
324
|
+
try {
|
|
325
|
+
E = f.fs.statSync(N);
|
|
326
|
+
} catch {
|
|
327
|
+
f.fs.mkdirSync(N);
|
|
328
|
+
}
|
|
329
|
+
if (E && E.isFile()) throw r.FILE_IN_THE_WAY(`"${N}"`);
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
d(a);
|
|
334
|
+
}, c.prototype.writeFileTo = function(a, f, d, g) {
|
|
335
|
+
const N = this;
|
|
336
|
+
if (N.fs.existsSync(a)) {
|
|
337
|
+
if (!d) return !1;
|
|
338
|
+
var y = N.fs.statSync(a);
|
|
339
|
+
if (y.isDirectory())
|
|
340
|
+
return !1;
|
|
341
|
+
}
|
|
342
|
+
var E = e.dirname(a);
|
|
343
|
+
N.fs.existsSync(E) || N.makeDir(E);
|
|
344
|
+
var C;
|
|
345
|
+
try {
|
|
346
|
+
C = N.fs.openSync(a, "w", 438);
|
|
347
|
+
} catch {
|
|
348
|
+
N.fs.chmodSync(a, 438), C = N.fs.openSync(a, "w", 438);
|
|
349
|
+
}
|
|
350
|
+
if (C)
|
|
351
|
+
try {
|
|
352
|
+
N.fs.writeSync(C, f, 0, f.length, 0);
|
|
353
|
+
} finally {
|
|
354
|
+
N.fs.closeSync(C);
|
|
355
|
+
}
|
|
356
|
+
return N.fs.chmodSync(a, g || 438), !0;
|
|
357
|
+
}, c.prototype.writeFileToAsync = function(a, f, d, g, N) {
|
|
358
|
+
typeof g == "function" && (N = g, g = void 0);
|
|
359
|
+
const y = this;
|
|
360
|
+
y.fs.exists(a, function(E) {
|
|
361
|
+
if (E && !d) return N(!1);
|
|
362
|
+
y.fs.stat(a, function(C, L) {
|
|
363
|
+
if (E && L.isDirectory())
|
|
364
|
+
return N(!1);
|
|
365
|
+
var D = e.dirname(a);
|
|
366
|
+
y.fs.exists(D, function(I) {
|
|
367
|
+
I || y.makeDir(D), y.fs.open(a, "w", 438, function(R, h) {
|
|
368
|
+
R ? y.fs.chmod(a, 438, function() {
|
|
369
|
+
y.fs.open(a, "w", 438, function(u, S) {
|
|
370
|
+
y.fs.write(S, f, 0, f.length, 0, function() {
|
|
371
|
+
y.fs.close(S, function() {
|
|
372
|
+
y.fs.chmod(a, g || 438, function() {
|
|
373
|
+
N(!0);
|
|
374
|
+
});
|
|
375
|
+
});
|
|
376
|
+
});
|
|
377
|
+
});
|
|
378
|
+
}) : h ? y.fs.write(h, f, 0, f.length, 0, function() {
|
|
379
|
+
y.fs.close(h, function() {
|
|
380
|
+
y.fs.chmod(a, g || 438, function() {
|
|
381
|
+
N(!0);
|
|
382
|
+
});
|
|
383
|
+
});
|
|
384
|
+
}) : y.fs.chmod(a, g || 438, function() {
|
|
385
|
+
N(!0);
|
|
386
|
+
});
|
|
387
|
+
});
|
|
388
|
+
});
|
|
389
|
+
});
|
|
390
|
+
});
|
|
391
|
+
}, c.prototype.findFiles = function(a) {
|
|
392
|
+
const f = this;
|
|
393
|
+
function d(g, N, y) {
|
|
394
|
+
let E = [];
|
|
395
|
+
return f.fs.readdirSync(g).forEach(function(C) {
|
|
396
|
+
const L = e.join(g, C), D = f.fs.statSync(L);
|
|
397
|
+
E.push(e.normalize(L) + (D.isDirectory() ? f.sep : "")), D.isDirectory() && y && (E = E.concat(d(L, N, y)));
|
|
398
|
+
}), E;
|
|
399
|
+
}
|
|
400
|
+
return d(a, void 0, !0);
|
|
401
|
+
}, c.prototype.findFilesAsync = function(a, f) {
|
|
402
|
+
const d = this;
|
|
403
|
+
let g = [];
|
|
404
|
+
d.fs.readdir(a, function(N, y) {
|
|
405
|
+
if (N) return f(N);
|
|
406
|
+
let E = y.length;
|
|
407
|
+
if (!E) return f(null, g);
|
|
408
|
+
y.forEach(function(C) {
|
|
409
|
+
C = e.join(a, C), d.fs.stat(C, function(L, D) {
|
|
410
|
+
if (L) return f(L);
|
|
411
|
+
D && (g.push(e.normalize(C) + (D.isDirectory() ? d.sep : "")), D.isDirectory() ? d.findFilesAsync(C, function(I, R) {
|
|
412
|
+
if (I) return f(I);
|
|
413
|
+
g = g.concat(R), --E || f(null, g);
|
|
414
|
+
}) : --E || f(null, g));
|
|
415
|
+
});
|
|
416
|
+
});
|
|
417
|
+
});
|
|
418
|
+
}, c.prototype.getAttributes = function() {
|
|
419
|
+
}, c.prototype.setAttributes = function() {
|
|
420
|
+
}, c.crc32update = function(a, f) {
|
|
421
|
+
return s[(a ^ f) & 255] ^ a >>> 8;
|
|
422
|
+
}, c.crc32 = function(a) {
|
|
423
|
+
typeof a == "string" && (a = Buffer.from(a, "utf8"));
|
|
424
|
+
let f = a.length, d = -1;
|
|
425
|
+
for (let g = 0; g < f; ) d = c.crc32update(d, a[g++]);
|
|
426
|
+
return ~d >>> 0;
|
|
427
|
+
}, c.methodToString = function(a) {
|
|
428
|
+
switch (a) {
|
|
429
|
+
case n.STORED:
|
|
430
|
+
return "STORED (" + a + ")";
|
|
431
|
+
case n.DEFLATED:
|
|
432
|
+
return "DEFLATED (" + a + ")";
|
|
433
|
+
default:
|
|
434
|
+
return "UNSUPPORTED (" + a + ")";
|
|
435
|
+
}
|
|
436
|
+
}, c.canonical = function(a) {
|
|
437
|
+
if (!a) return "";
|
|
438
|
+
const f = e.posix.normalize("/" + a.split("\\").join("/"));
|
|
439
|
+
return e.join(".", f);
|
|
440
|
+
}, c.zipnamefix = function(a) {
|
|
441
|
+
if (!a) return "";
|
|
442
|
+
const f = e.posix.normalize("/" + a.split("\\").join("/"));
|
|
443
|
+
return e.posix.join(".", f);
|
|
444
|
+
}, c.findLast = function(a, f) {
|
|
445
|
+
if (!Array.isArray(a)) throw new TypeError("arr is not array");
|
|
446
|
+
const d = a.length >>> 0;
|
|
447
|
+
for (let g = d - 1; g >= 0; g--)
|
|
448
|
+
if (f(a[g], g, a))
|
|
449
|
+
return a[g];
|
|
450
|
+
}, c.sanitize = function(a, f) {
|
|
451
|
+
a = e.resolve(e.normalize(a));
|
|
452
|
+
for (var d = f.split("/"), g = 0, N = d.length; g < N; g++) {
|
|
453
|
+
var y = e.normalize(e.join(a, d.slice(g, N).join(e.sep)));
|
|
454
|
+
if (y.indexOf(a) === 0)
|
|
455
|
+
return y;
|
|
456
|
+
}
|
|
457
|
+
return e.normalize(e.join(a, e.basename(f)));
|
|
458
|
+
}, c.toBuffer = function(f, d) {
|
|
459
|
+
return Buffer.isBuffer(f) ? f : f instanceof Uint8Array ? Buffer.from(f) : typeof f == "string" ? d(f) : Buffer.alloc(0);
|
|
460
|
+
}, c.readBigUInt64LE = function(a, f) {
|
|
461
|
+
var d = Buffer.from(a.slice(f, f + 8));
|
|
462
|
+
return d.swap64(), parseInt(`0x${d.toString("hex")}`);
|
|
463
|
+
}, c.fromDOS2Date = function(a) {
|
|
464
|
+
return new Date((a >> 25 & 127) + 1980, Math.max((a >> 21 & 15) - 1, 0), Math.max(a >> 16 & 31, 1), a >> 11 & 31, a >> 5 & 63, (a & 31) << 1);
|
|
465
|
+
}, c.fromDate2DOS = function(a) {
|
|
466
|
+
let f = 0, d = 0;
|
|
467
|
+
return a.getFullYear() > 1979 && (f = (a.getFullYear() - 1980 & 127) << 9 | a.getMonth() + 1 << 5 | a.getDate(), d = a.getHours() << 11 | a.getMinutes() << 5 | a.getSeconds() >> 1), f << 16 | d;
|
|
468
|
+
}, c.isWin = o, c.crcTable = s, De;
|
|
469
|
+
}
|
|
470
|
+
var Re, Qe;
|
|
471
|
+
function cn() {
|
|
472
|
+
if (Qe) return Re;
|
|
473
|
+
Qe = 1;
|
|
474
|
+
const t = J;
|
|
475
|
+
return Re = function(e, { fs: n }) {
|
|
476
|
+
var r = e || "", o = s(), i = null;
|
|
477
|
+
function s() {
|
|
478
|
+
return {
|
|
479
|
+
directory: !1,
|
|
480
|
+
readonly: !1,
|
|
481
|
+
hidden: !1,
|
|
482
|
+
executable: !1,
|
|
483
|
+
mtime: 0,
|
|
484
|
+
atime: 0
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
return r && n.existsSync(r) ? (i = n.statSync(r), o.directory = i.isDirectory(), o.mtime = i.mtime, o.atime = i.atime, o.executable = (73 & i.mode) !== 0, o.readonly = (128 & i.mode) === 0, o.hidden = t.basename(r)[0] === ".") : console.warn("Invalid path: " + r), {
|
|
488
|
+
get directory() {
|
|
489
|
+
return o.directory;
|
|
490
|
+
},
|
|
491
|
+
get readOnly() {
|
|
492
|
+
return o.readonly;
|
|
493
|
+
},
|
|
494
|
+
get hidden() {
|
|
495
|
+
return o.hidden;
|
|
496
|
+
},
|
|
497
|
+
get mtime() {
|
|
498
|
+
return o.mtime;
|
|
499
|
+
},
|
|
500
|
+
get atime() {
|
|
501
|
+
return o.atime;
|
|
502
|
+
},
|
|
503
|
+
get executable() {
|
|
504
|
+
return o.executable;
|
|
505
|
+
},
|
|
506
|
+
decodeAttributes: function() {
|
|
507
|
+
},
|
|
508
|
+
encodeAttributes: function() {
|
|
509
|
+
},
|
|
510
|
+
toJSON: function() {
|
|
511
|
+
return {
|
|
512
|
+
path: r,
|
|
513
|
+
isDirectory: o.directory,
|
|
514
|
+
isReadOnly: o.readonly,
|
|
515
|
+
isHidden: o.hidden,
|
|
516
|
+
isExecutable: o.executable,
|
|
517
|
+
mTime: o.mtime,
|
|
518
|
+
aTime: o.atime
|
|
519
|
+
};
|
|
520
|
+
},
|
|
521
|
+
toString: function() {
|
|
522
|
+
return JSON.stringify(this.toJSON(), null, " ");
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
}, Re;
|
|
526
|
+
}
|
|
527
|
+
var _e, et;
|
|
528
|
+
function fn() {
|
|
529
|
+
return et || (et = 1, _e = {
|
|
530
|
+
efs: !0,
|
|
531
|
+
encode: (t) => Buffer.from(t, "utf8"),
|
|
532
|
+
decode: (t) => t.toString("utf8")
|
|
533
|
+
}), _e;
|
|
534
|
+
}
|
|
535
|
+
var tt;
|
|
536
|
+
function ie() {
|
|
537
|
+
return tt || (tt = 1, $.exports = an(), $.exports.Constants = _t(), $.exports.Errors = ke(), $.exports.FileAttr = cn(), $.exports.decoder = fn()), $.exports;
|
|
538
|
+
}
|
|
539
|
+
var de = {}, Te, nt;
|
|
540
|
+
function un() {
|
|
541
|
+
if (nt) return Te;
|
|
542
|
+
nt = 1;
|
|
543
|
+
var t = ie(), e = t.Constants;
|
|
544
|
+
return Te = function() {
|
|
545
|
+
var n = 20, r = 10, o = 0, i = 0, s = 0, c = 0, a = 0, f = 0, d = 0, g = 0, N = 0, y = 0, E = 0, C = 0, L = 0;
|
|
546
|
+
n |= t.isWin ? 2560 : 768, o |= e.FLG_EFS;
|
|
547
|
+
const D = {
|
|
548
|
+
extraLen: 0
|
|
549
|
+
}, I = (h) => Math.max(0, h) >>> 0, R = (h) => Math.max(0, h) & 255;
|
|
550
|
+
return s = t.fromDate2DOS(/* @__PURE__ */ new Date()), {
|
|
551
|
+
get made() {
|
|
552
|
+
return n;
|
|
553
|
+
},
|
|
554
|
+
set made(h) {
|
|
555
|
+
n = h;
|
|
556
|
+
},
|
|
557
|
+
get version() {
|
|
558
|
+
return r;
|
|
559
|
+
},
|
|
560
|
+
set version(h) {
|
|
561
|
+
r = h;
|
|
562
|
+
},
|
|
563
|
+
get flags() {
|
|
564
|
+
return o;
|
|
565
|
+
},
|
|
566
|
+
set flags(h) {
|
|
567
|
+
o = h;
|
|
568
|
+
},
|
|
569
|
+
get flags_efs() {
|
|
570
|
+
return (o & e.FLG_EFS) > 0;
|
|
571
|
+
},
|
|
572
|
+
set flags_efs(h) {
|
|
573
|
+
h ? o |= e.FLG_EFS : o &= ~e.FLG_EFS;
|
|
574
|
+
},
|
|
575
|
+
get flags_desc() {
|
|
576
|
+
return (o & e.FLG_DESC) > 0;
|
|
577
|
+
},
|
|
578
|
+
set flags_desc(h) {
|
|
579
|
+
h ? o |= e.FLG_DESC : o &= ~e.FLG_DESC;
|
|
580
|
+
},
|
|
581
|
+
get method() {
|
|
582
|
+
return i;
|
|
583
|
+
},
|
|
584
|
+
set method(h) {
|
|
585
|
+
switch (h) {
|
|
586
|
+
case e.STORED:
|
|
587
|
+
this.version = 10;
|
|
588
|
+
case e.DEFLATED:
|
|
589
|
+
default:
|
|
590
|
+
this.version = 20;
|
|
591
|
+
}
|
|
592
|
+
i = h;
|
|
593
|
+
},
|
|
594
|
+
get time() {
|
|
595
|
+
return t.fromDOS2Date(this.timeval);
|
|
596
|
+
},
|
|
597
|
+
set time(h) {
|
|
598
|
+
this.timeval = t.fromDate2DOS(h);
|
|
599
|
+
},
|
|
600
|
+
get timeval() {
|
|
601
|
+
return s;
|
|
602
|
+
},
|
|
603
|
+
set timeval(h) {
|
|
604
|
+
s = I(h);
|
|
605
|
+
},
|
|
606
|
+
get timeHighByte() {
|
|
607
|
+
return R(s >>> 8);
|
|
608
|
+
},
|
|
609
|
+
get crc() {
|
|
610
|
+
return c;
|
|
611
|
+
},
|
|
612
|
+
set crc(h) {
|
|
613
|
+
c = I(h);
|
|
614
|
+
},
|
|
615
|
+
get compressedSize() {
|
|
616
|
+
return a;
|
|
617
|
+
},
|
|
618
|
+
set compressedSize(h) {
|
|
619
|
+
a = I(h);
|
|
620
|
+
},
|
|
621
|
+
get size() {
|
|
622
|
+
return f;
|
|
623
|
+
},
|
|
624
|
+
set size(h) {
|
|
625
|
+
f = I(h);
|
|
626
|
+
},
|
|
627
|
+
get fileNameLength() {
|
|
628
|
+
return d;
|
|
629
|
+
},
|
|
630
|
+
set fileNameLength(h) {
|
|
631
|
+
d = h;
|
|
632
|
+
},
|
|
633
|
+
get extraLength() {
|
|
634
|
+
return g;
|
|
635
|
+
},
|
|
636
|
+
set extraLength(h) {
|
|
637
|
+
g = h;
|
|
638
|
+
},
|
|
639
|
+
get extraLocalLength() {
|
|
640
|
+
return D.extraLen;
|
|
641
|
+
},
|
|
642
|
+
set extraLocalLength(h) {
|
|
643
|
+
D.extraLen = h;
|
|
644
|
+
},
|
|
645
|
+
get commentLength() {
|
|
646
|
+
return N;
|
|
647
|
+
},
|
|
648
|
+
set commentLength(h) {
|
|
649
|
+
N = h;
|
|
650
|
+
},
|
|
651
|
+
get diskNumStart() {
|
|
652
|
+
return y;
|
|
653
|
+
},
|
|
654
|
+
set diskNumStart(h) {
|
|
655
|
+
y = I(h);
|
|
656
|
+
},
|
|
657
|
+
get inAttr() {
|
|
658
|
+
return E;
|
|
659
|
+
},
|
|
660
|
+
set inAttr(h) {
|
|
661
|
+
E = I(h);
|
|
662
|
+
},
|
|
663
|
+
get attr() {
|
|
664
|
+
return C;
|
|
665
|
+
},
|
|
666
|
+
set attr(h) {
|
|
667
|
+
C = I(h);
|
|
668
|
+
},
|
|
669
|
+
// get Unix file permissions
|
|
670
|
+
get fileAttr() {
|
|
671
|
+
return (C || 0) >> 16 & 4095;
|
|
672
|
+
},
|
|
673
|
+
get offset() {
|
|
674
|
+
return L;
|
|
675
|
+
},
|
|
676
|
+
set offset(h) {
|
|
677
|
+
L = I(h);
|
|
678
|
+
},
|
|
679
|
+
get encrypted() {
|
|
680
|
+
return (o & e.FLG_ENC) === e.FLG_ENC;
|
|
681
|
+
},
|
|
682
|
+
get centralHeaderSize() {
|
|
683
|
+
return e.CENHDR + d + g + N;
|
|
684
|
+
},
|
|
685
|
+
get realDataOffset() {
|
|
686
|
+
return L + e.LOCHDR + D.fnameLen + D.extraLen;
|
|
687
|
+
},
|
|
688
|
+
get localHeader() {
|
|
689
|
+
return D;
|
|
690
|
+
},
|
|
691
|
+
loadLocalHeaderFromBinary: function(h) {
|
|
692
|
+
var u = h.slice(L, L + e.LOCHDR);
|
|
693
|
+
if (u.readUInt32LE(0) !== e.LOCSIG)
|
|
694
|
+
throw t.Errors.INVALID_LOC();
|
|
695
|
+
D.version = u.readUInt16LE(e.LOCVER), D.flags = u.readUInt16LE(e.LOCFLG), D.method = u.readUInt16LE(e.LOCHOW), D.time = u.readUInt32LE(e.LOCTIM), D.crc = u.readUInt32LE(e.LOCCRC), D.compressedSize = u.readUInt32LE(e.LOCSIZ), D.size = u.readUInt32LE(e.LOCLEN), D.fnameLen = u.readUInt16LE(e.LOCNAM), D.extraLen = u.readUInt16LE(e.LOCEXT);
|
|
696
|
+
const S = L + e.LOCHDR + D.fnameLen, l = S + D.extraLen;
|
|
697
|
+
return h.slice(S, l);
|
|
698
|
+
},
|
|
699
|
+
loadFromBinary: function(h) {
|
|
700
|
+
if (h.length !== e.CENHDR || h.readUInt32LE(0) !== e.CENSIG)
|
|
701
|
+
throw t.Errors.INVALID_CEN();
|
|
702
|
+
n = h.readUInt16LE(e.CENVEM), r = h.readUInt16LE(e.CENVER), o = h.readUInt16LE(e.CENFLG), i = h.readUInt16LE(e.CENHOW), s = h.readUInt32LE(e.CENTIM), c = h.readUInt32LE(e.CENCRC), a = h.readUInt32LE(e.CENSIZ), f = h.readUInt32LE(e.CENLEN), d = h.readUInt16LE(e.CENNAM), g = h.readUInt16LE(e.CENEXT), N = h.readUInt16LE(e.CENCOM), y = h.readUInt16LE(e.CENDSK), E = h.readUInt16LE(e.CENATT), C = h.readUInt32LE(e.CENATX), L = h.readUInt32LE(e.CENOFF);
|
|
703
|
+
},
|
|
704
|
+
localHeaderToBinary: function() {
|
|
705
|
+
var h = Buffer.alloc(e.LOCHDR);
|
|
706
|
+
return h.writeUInt32LE(e.LOCSIG, 0), h.writeUInt16LE(r, e.LOCVER), h.writeUInt16LE(o, e.LOCFLG), h.writeUInt16LE(i, e.LOCHOW), h.writeUInt32LE(s, e.LOCTIM), h.writeUInt32LE(c, e.LOCCRC), h.writeUInt32LE(a, e.LOCSIZ), h.writeUInt32LE(f, e.LOCLEN), h.writeUInt16LE(d, e.LOCNAM), h.writeUInt16LE(D.extraLen, e.LOCEXT), h;
|
|
707
|
+
},
|
|
708
|
+
centralHeaderToBinary: function() {
|
|
709
|
+
var h = Buffer.alloc(e.CENHDR + d + g + N);
|
|
710
|
+
return h.writeUInt32LE(e.CENSIG, 0), h.writeUInt16LE(n, e.CENVEM), h.writeUInt16LE(r, e.CENVER), h.writeUInt16LE(o, e.CENFLG), h.writeUInt16LE(i, e.CENHOW), h.writeUInt32LE(s, e.CENTIM), h.writeUInt32LE(c, e.CENCRC), h.writeUInt32LE(a, e.CENSIZ), h.writeUInt32LE(f, e.CENLEN), h.writeUInt16LE(d, e.CENNAM), h.writeUInt16LE(g, e.CENEXT), h.writeUInt16LE(N, e.CENCOM), h.writeUInt16LE(y, e.CENDSK), h.writeUInt16LE(E, e.CENATT), h.writeUInt32LE(C, e.CENATX), h.writeUInt32LE(L, e.CENOFF), h;
|
|
711
|
+
},
|
|
712
|
+
toJSON: function() {
|
|
713
|
+
const h = function(u) {
|
|
714
|
+
return u + " bytes";
|
|
715
|
+
};
|
|
716
|
+
return {
|
|
717
|
+
made: n,
|
|
718
|
+
version: r,
|
|
719
|
+
flags: o,
|
|
720
|
+
method: t.methodToString(i),
|
|
721
|
+
time: this.time,
|
|
722
|
+
crc: "0x" + c.toString(16).toUpperCase(),
|
|
723
|
+
compressedSize: h(a),
|
|
724
|
+
size: h(f),
|
|
725
|
+
fileNameLength: h(d),
|
|
726
|
+
extraLength: h(g),
|
|
727
|
+
commentLength: h(N),
|
|
728
|
+
diskNumStart: y,
|
|
729
|
+
inAttr: E,
|
|
730
|
+
attr: C,
|
|
731
|
+
offset: L,
|
|
732
|
+
centralHeaderSize: h(e.CENHDR + d + g + N)
|
|
733
|
+
};
|
|
734
|
+
},
|
|
735
|
+
toString: function() {
|
|
736
|
+
return JSON.stringify(this.toJSON(), null, " ");
|
|
737
|
+
}
|
|
738
|
+
};
|
|
739
|
+
}, Te;
|
|
740
|
+
}
|
|
741
|
+
var Ae, rt;
|
|
742
|
+
function ln() {
|
|
743
|
+
if (rt) return Ae;
|
|
744
|
+
rt = 1;
|
|
745
|
+
var t = ie(), e = t.Constants;
|
|
746
|
+
return Ae = function() {
|
|
747
|
+
var n = 0, r = 0, o = 0, i = 0, s = 0;
|
|
748
|
+
return {
|
|
749
|
+
get diskEntries() {
|
|
750
|
+
return n;
|
|
751
|
+
},
|
|
752
|
+
set diskEntries(c) {
|
|
753
|
+
n = r = c;
|
|
754
|
+
},
|
|
755
|
+
get totalEntries() {
|
|
756
|
+
return r;
|
|
757
|
+
},
|
|
758
|
+
set totalEntries(c) {
|
|
759
|
+
r = n = c;
|
|
760
|
+
},
|
|
761
|
+
get size() {
|
|
762
|
+
return o;
|
|
763
|
+
},
|
|
764
|
+
set size(c) {
|
|
765
|
+
o = c;
|
|
766
|
+
},
|
|
767
|
+
get offset() {
|
|
768
|
+
return i;
|
|
769
|
+
},
|
|
770
|
+
set offset(c) {
|
|
771
|
+
i = c;
|
|
772
|
+
},
|
|
773
|
+
get commentLength() {
|
|
774
|
+
return s;
|
|
775
|
+
},
|
|
776
|
+
set commentLength(c) {
|
|
777
|
+
s = c;
|
|
778
|
+
},
|
|
779
|
+
get mainHeaderSize() {
|
|
780
|
+
return e.ENDHDR + s;
|
|
781
|
+
},
|
|
782
|
+
loadFromBinary: function(c) {
|
|
783
|
+
if ((c.length !== e.ENDHDR || c.readUInt32LE(0) !== e.ENDSIG) && (c.length < e.ZIP64HDR || c.readUInt32LE(0) !== e.ZIP64SIG))
|
|
784
|
+
throw t.Errors.INVALID_END();
|
|
785
|
+
c.readUInt32LE(0) === e.ENDSIG ? (n = c.readUInt16LE(e.ENDSUB), r = c.readUInt16LE(e.ENDTOT), o = c.readUInt32LE(e.ENDSIZ), i = c.readUInt32LE(e.ENDOFF), s = c.readUInt16LE(e.ENDCOM)) : (n = t.readBigUInt64LE(c, e.ZIP64SUB), r = t.readBigUInt64LE(c, e.ZIP64TOT), o = t.readBigUInt64LE(c, e.ZIP64SIZE), i = t.readBigUInt64LE(c, e.ZIP64OFF), s = 0);
|
|
786
|
+
},
|
|
787
|
+
toBinary: function() {
|
|
788
|
+
var c = Buffer.alloc(e.ENDHDR + s);
|
|
789
|
+
return c.writeUInt32LE(e.ENDSIG, 0), c.writeUInt32LE(0, 4), c.writeUInt16LE(n, e.ENDSUB), c.writeUInt16LE(r, e.ENDTOT), c.writeUInt32LE(o, e.ENDSIZ), c.writeUInt32LE(i, e.ENDOFF), c.writeUInt16LE(s, e.ENDCOM), c.fill(" ", e.ENDHDR), c;
|
|
790
|
+
},
|
|
791
|
+
toJSON: function() {
|
|
792
|
+
const c = function(a, f) {
|
|
793
|
+
let d = a.toString(16).toUpperCase();
|
|
794
|
+
for (; d.length < f; ) d = "0" + d;
|
|
795
|
+
return "0x" + d;
|
|
796
|
+
};
|
|
797
|
+
return {
|
|
798
|
+
diskEntries: n,
|
|
799
|
+
totalEntries: r,
|
|
800
|
+
size: o + " bytes",
|
|
801
|
+
offset: c(i, 4),
|
|
802
|
+
commentLength: s
|
|
803
|
+
};
|
|
804
|
+
},
|
|
805
|
+
toString: function() {
|
|
806
|
+
return JSON.stringify(this.toJSON(), null, " ");
|
|
807
|
+
}
|
|
808
|
+
};
|
|
809
|
+
}, Ae;
|
|
810
|
+
}
|
|
811
|
+
var ot;
|
|
812
|
+
function Tt() {
|
|
813
|
+
return ot || (ot = 1, de.EntryHeader = un(), de.MainHeader = ln()), de;
|
|
814
|
+
}
|
|
815
|
+
var re = {}, Fe, st;
|
|
816
|
+
function dn() {
|
|
817
|
+
return st || (st = 1, Fe = function(t) {
|
|
818
|
+
var e = J, n = { chunkSize: (parseInt(t.length / 1024) + 1) * 1024 };
|
|
819
|
+
return {
|
|
820
|
+
deflate: function() {
|
|
821
|
+
return e.deflateRawSync(t, n);
|
|
822
|
+
},
|
|
823
|
+
deflateAsync: function(r) {
|
|
824
|
+
var o = e.createDeflateRaw(n), i = [], s = 0;
|
|
825
|
+
o.on("data", function(c) {
|
|
826
|
+
i.push(c), s += c.length;
|
|
827
|
+
}), o.on("end", function() {
|
|
828
|
+
var c = Buffer.alloc(s), a = 0;
|
|
829
|
+
c.fill(0);
|
|
830
|
+
for (var f = 0; f < i.length; f++) {
|
|
831
|
+
var d = i[f];
|
|
832
|
+
d.copy(c, a), a += d.length;
|
|
833
|
+
}
|
|
834
|
+
r && r(c);
|
|
835
|
+
}), o.end(t);
|
|
836
|
+
}
|
|
837
|
+
};
|
|
838
|
+
}), Fe;
|
|
839
|
+
}
|
|
840
|
+
var xe, it;
|
|
841
|
+
function hn() {
|
|
842
|
+
if (it) return xe;
|
|
843
|
+
it = 1;
|
|
844
|
+
const t = +(process.versions ? process.versions.node : "").split(".")[0] || 0;
|
|
845
|
+
return xe = function(e, n) {
|
|
846
|
+
var r = J;
|
|
847
|
+
const o = t >= 15 && n > 0 ? { maxOutputLength: n } : {};
|
|
848
|
+
return {
|
|
849
|
+
inflate: function() {
|
|
850
|
+
return r.inflateRawSync(e, o);
|
|
851
|
+
},
|
|
852
|
+
inflateAsync: function(i) {
|
|
853
|
+
var s = r.createInflateRaw(o), c = [], a = 0;
|
|
854
|
+
s.on("data", function(f) {
|
|
855
|
+
c.push(f), a += f.length;
|
|
856
|
+
}), s.on("end", function() {
|
|
857
|
+
var f = Buffer.alloc(a), d = 0;
|
|
858
|
+
f.fill(0);
|
|
859
|
+
for (var g = 0; g < c.length; g++) {
|
|
860
|
+
var N = c[g];
|
|
861
|
+
N.copy(f, d), d += N.length;
|
|
862
|
+
}
|
|
863
|
+
i && i(f);
|
|
864
|
+
}), s.end(e);
|
|
865
|
+
}
|
|
866
|
+
};
|
|
867
|
+
}, xe;
|
|
868
|
+
}
|
|
869
|
+
var be, at;
|
|
870
|
+
function En() {
|
|
871
|
+
if (at) return be;
|
|
872
|
+
at = 1;
|
|
873
|
+
const { randomFillSync: t } = J, e = ke(), n = new Uint32Array(256).map((y, E) => {
|
|
874
|
+
for (let C = 0; C < 8; C++)
|
|
875
|
+
(E & 1) !== 0 ? E = E >>> 1 ^ 3988292384 : E >>>= 1;
|
|
876
|
+
return E >>> 0;
|
|
877
|
+
}), r = (y, E) => Math.imul(y, E) >>> 0, o = (y, E) => n[(y ^ E) & 255] ^ y >>> 8, i = () => typeof t == "function" ? t(Buffer.alloc(12)) : i.node();
|
|
878
|
+
i.node = () => {
|
|
879
|
+
const y = Buffer.alloc(12), E = y.length;
|
|
880
|
+
for (let C = 0; C < E; C++) y[C] = Math.random() * 256 & 255;
|
|
881
|
+
return y;
|
|
882
|
+
};
|
|
883
|
+
const s = {
|
|
884
|
+
genSalt: i
|
|
885
|
+
};
|
|
886
|
+
function c(y) {
|
|
887
|
+
const E = Buffer.isBuffer(y) ? y : Buffer.from(y);
|
|
888
|
+
this.keys = new Uint32Array([305419896, 591751049, 878082192]);
|
|
889
|
+
for (let C = 0; C < E.length; C++)
|
|
890
|
+
this.updateKeys(E[C]);
|
|
891
|
+
}
|
|
892
|
+
c.prototype.updateKeys = function(y) {
|
|
893
|
+
const E = this.keys;
|
|
894
|
+
return E[0] = o(E[0], y), E[1] += E[0] & 255, E[1] = r(E[1], 134775813) + 1, E[2] = o(E[2], E[1] >>> 24), y;
|
|
895
|
+
}, c.prototype.next = function() {
|
|
896
|
+
const y = (this.keys[2] | 2) >>> 0;
|
|
897
|
+
return r(y, y ^ 1) >> 8 & 255;
|
|
898
|
+
};
|
|
899
|
+
function a(y) {
|
|
900
|
+
const E = new c(y);
|
|
901
|
+
return function(C) {
|
|
902
|
+
const L = Buffer.alloc(C.length);
|
|
903
|
+
let D = 0;
|
|
904
|
+
for (let I of C)
|
|
905
|
+
L[D++] = E.updateKeys(I ^ E.next());
|
|
906
|
+
return L;
|
|
907
|
+
};
|
|
908
|
+
}
|
|
909
|
+
function f(y) {
|
|
910
|
+
const E = new c(y);
|
|
911
|
+
return function(C, L, D = 0) {
|
|
912
|
+
L || (L = Buffer.alloc(C.length));
|
|
913
|
+
for (let I of C) {
|
|
914
|
+
const R = E.next();
|
|
915
|
+
L[D++] = I ^ R, E.updateKeys(I);
|
|
916
|
+
}
|
|
917
|
+
return L;
|
|
918
|
+
};
|
|
919
|
+
}
|
|
920
|
+
function d(y, E, C) {
|
|
921
|
+
if (!y || !Buffer.isBuffer(y) || y.length < 12)
|
|
922
|
+
return Buffer.alloc(0);
|
|
923
|
+
const L = a(C), D = L(y.slice(0, 12)), I = (E.flags & 8) === 8 ? E.timeHighByte : E.crc >>> 24;
|
|
924
|
+
if (D[11] !== I)
|
|
925
|
+
throw e.WRONG_PASSWORD();
|
|
926
|
+
return L(y.slice(12));
|
|
927
|
+
}
|
|
928
|
+
function g(y) {
|
|
929
|
+
Buffer.isBuffer(y) && y.length >= 12 ? s.genSalt = function() {
|
|
930
|
+
return y.slice(0, 12);
|
|
931
|
+
} : y === "node" ? s.genSalt = i.node : s.genSalt = i;
|
|
932
|
+
}
|
|
933
|
+
function N(y, E, C, L = !1) {
|
|
934
|
+
y == null && (y = Buffer.alloc(0)), Buffer.isBuffer(y) || (y = Buffer.from(y.toString()));
|
|
935
|
+
const D = f(C), I = s.genSalt();
|
|
936
|
+
I[11] = E.crc >>> 24 & 255, L && (I[10] = E.crc >>> 16 & 255);
|
|
937
|
+
const R = Buffer.alloc(y.length + 12);
|
|
938
|
+
return D(I, R), D(y, R, 12);
|
|
939
|
+
}
|
|
940
|
+
return be = { decrypt: d, encrypt: N, _salter: g }, be;
|
|
941
|
+
}
|
|
942
|
+
var ct;
|
|
943
|
+
function mn() {
|
|
944
|
+
return ct || (ct = 1, re.Deflater = dn(), re.Inflater = hn(), re.ZipCrypto = En()), re;
|
|
945
|
+
}
|
|
946
|
+
var Ue, ft;
|
|
947
|
+
function At() {
|
|
948
|
+
if (ft) return Ue;
|
|
949
|
+
ft = 1;
|
|
950
|
+
var t = ie(), e = Tt(), n = t.Constants, r = mn();
|
|
951
|
+
return Ue = function(o, i) {
|
|
952
|
+
var s = new e.EntryHeader(), c = Buffer.alloc(0), a = Buffer.alloc(0), f = !1, d = null, g = Buffer.alloc(0), N = Buffer.alloc(0), y = !0;
|
|
953
|
+
const E = o, C = typeof E.decoder == "object" ? E.decoder : t.decoder;
|
|
954
|
+
y = C.hasOwnProperty("efs") ? C.efs : !1;
|
|
955
|
+
function L() {
|
|
956
|
+
return !i || !(i instanceof Uint8Array) ? Buffer.alloc(0) : (N = s.loadLocalHeaderFromBinary(i), i.slice(s.realDataOffset, s.realDataOffset + s.compressedSize));
|
|
957
|
+
}
|
|
958
|
+
function D(l) {
|
|
959
|
+
if (s.flags_desc) {
|
|
960
|
+
const p = {}, w = s.realDataOffset + s.compressedSize;
|
|
961
|
+
if (i.readUInt32LE(w) == n.LOCSIG || i.readUInt32LE(w) == n.CENSIG)
|
|
962
|
+
throw t.Errors.DESCRIPTOR_NOT_EXIST();
|
|
963
|
+
if (i.readUInt32LE(w) == n.EXTSIG)
|
|
964
|
+
p.crc = i.readUInt32LE(w + n.EXTCRC), p.compressedSize = i.readUInt32LE(w + n.EXTSIZ), p.size = i.readUInt32LE(w + n.EXTLEN);
|
|
965
|
+
else if (i.readUInt16LE(w + 12) === 19280)
|
|
966
|
+
p.crc = i.readUInt32LE(w + n.EXTCRC - 4), p.compressedSize = i.readUInt32LE(w + n.EXTSIZ - 4), p.size = i.readUInt32LE(w + n.EXTLEN - 4);
|
|
967
|
+
else
|
|
968
|
+
throw t.Errors.DESCRIPTOR_UNKNOWN();
|
|
969
|
+
if (p.compressedSize !== s.compressedSize || p.size !== s.size || p.crc !== s.crc)
|
|
970
|
+
throw t.Errors.DESCRIPTOR_FAULTY();
|
|
971
|
+
if (t.crc32(l) !== p.crc)
|
|
972
|
+
return !1;
|
|
973
|
+
} else if (t.crc32(l) !== s.localHeader.crc)
|
|
974
|
+
return !1;
|
|
975
|
+
return !0;
|
|
976
|
+
}
|
|
977
|
+
function I(l, p, w) {
|
|
978
|
+
if (typeof p > "u" && typeof l == "string" && (w = l, l = void 0), f)
|
|
979
|
+
return l && p && p(Buffer.alloc(0), t.Errors.DIRECTORY_CONTENT_ERROR()), Buffer.alloc(0);
|
|
980
|
+
var _ = L();
|
|
981
|
+
if (_.length === 0)
|
|
982
|
+
return l && p && p(_), _;
|
|
983
|
+
if (s.encrypted) {
|
|
984
|
+
if (typeof w != "string" && !Buffer.isBuffer(w))
|
|
985
|
+
throw t.Errors.INVALID_PASS_PARAM();
|
|
986
|
+
_ = r.ZipCrypto.decrypt(_, s, w);
|
|
987
|
+
}
|
|
988
|
+
var T = Buffer.alloc(s.size);
|
|
989
|
+
switch (s.method) {
|
|
990
|
+
case t.Constants.STORED:
|
|
991
|
+
if (_.copy(T), D(T))
|
|
992
|
+
return l && p && p(T), T;
|
|
993
|
+
throw l && p && p(T, t.Errors.BAD_CRC()), t.Errors.BAD_CRC();
|
|
994
|
+
case t.Constants.DEFLATED:
|
|
995
|
+
var A = new r.Inflater(_, s.size);
|
|
996
|
+
if (l)
|
|
997
|
+
A.inflateAsync(function(O) {
|
|
998
|
+
O.copy(O, 0), p && (D(O) ? p(O) : p(O, t.Errors.BAD_CRC()));
|
|
999
|
+
});
|
|
1000
|
+
else {
|
|
1001
|
+
if (A.inflate(T).copy(T, 0), !D(T))
|
|
1002
|
+
throw t.Errors.BAD_CRC(`"${C.decode(c)}"`);
|
|
1003
|
+
return T;
|
|
1004
|
+
}
|
|
1005
|
+
break;
|
|
1006
|
+
default:
|
|
1007
|
+
throw l && p && p(Buffer.alloc(0), t.Errors.UNKNOWN_METHOD()), t.Errors.UNKNOWN_METHOD();
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
function R(l, p) {
|
|
1011
|
+
if ((!d || !d.length) && Buffer.isBuffer(i))
|
|
1012
|
+
return l && p && p(L()), L();
|
|
1013
|
+
if (d.length && !f) {
|
|
1014
|
+
var w;
|
|
1015
|
+
switch (s.method) {
|
|
1016
|
+
case t.Constants.STORED:
|
|
1017
|
+
return s.compressedSize = s.size, w = Buffer.alloc(d.length), d.copy(w), l && p && p(w), w;
|
|
1018
|
+
default:
|
|
1019
|
+
case t.Constants.DEFLATED:
|
|
1020
|
+
var _ = new r.Deflater(d);
|
|
1021
|
+
if (l)
|
|
1022
|
+
_.deflateAsync(function(A) {
|
|
1023
|
+
w = Buffer.alloc(A.length), s.compressedSize = A.length, A.copy(w), p && p(w);
|
|
1024
|
+
});
|
|
1025
|
+
else {
|
|
1026
|
+
var T = _.deflate();
|
|
1027
|
+
return s.compressedSize = T.length, T;
|
|
1028
|
+
}
|
|
1029
|
+
_ = null;
|
|
1030
|
+
break;
|
|
1031
|
+
}
|
|
1032
|
+
} else if (l && p)
|
|
1033
|
+
p(Buffer.alloc(0));
|
|
1034
|
+
else
|
|
1035
|
+
return Buffer.alloc(0);
|
|
1036
|
+
}
|
|
1037
|
+
function h(l, p) {
|
|
1038
|
+
return (l.readUInt32LE(p + 4) << 4) + l.readUInt32LE(p);
|
|
1039
|
+
}
|
|
1040
|
+
function u(l) {
|
|
1041
|
+
try {
|
|
1042
|
+
for (var p = 0, w, _, T; p + 4 < l.length; )
|
|
1043
|
+
w = l.readUInt16LE(p), p += 2, _ = l.readUInt16LE(p), p += 2, T = l.slice(p, p + _), p += _, n.ID_ZIP64 === w && S(T);
|
|
1044
|
+
} catch {
|
|
1045
|
+
throw t.Errors.EXTRA_FIELD_PARSE_ERROR();
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
function S(l) {
|
|
1049
|
+
var p, w, _, T;
|
|
1050
|
+
l.length >= n.EF_ZIP64_SCOMP && (p = h(l, n.EF_ZIP64_SUNCOMP), s.size === n.EF_ZIP64_OR_32 && (s.size = p)), l.length >= n.EF_ZIP64_RHO && (w = h(l, n.EF_ZIP64_SCOMP), s.compressedSize === n.EF_ZIP64_OR_32 && (s.compressedSize = w)), l.length >= n.EF_ZIP64_DSN && (_ = h(l, n.EF_ZIP64_RHO), s.offset === n.EF_ZIP64_OR_32 && (s.offset = _)), l.length >= n.EF_ZIP64_DSN + 4 && (T = l.readUInt32LE(n.EF_ZIP64_DSN), s.diskNumStart === n.EF_ZIP64_OR_16 && (s.diskNumStart = T));
|
|
1051
|
+
}
|
|
1052
|
+
return {
|
|
1053
|
+
get entryName() {
|
|
1054
|
+
return C.decode(c);
|
|
1055
|
+
},
|
|
1056
|
+
get rawEntryName() {
|
|
1057
|
+
return c;
|
|
1058
|
+
},
|
|
1059
|
+
set entryName(l) {
|
|
1060
|
+
c = t.toBuffer(l, C.encode);
|
|
1061
|
+
var p = c[c.length - 1];
|
|
1062
|
+
f = p === 47 || p === 92, s.fileNameLength = c.length;
|
|
1063
|
+
},
|
|
1064
|
+
get efs() {
|
|
1065
|
+
return typeof y == "function" ? y(this.entryName) : y;
|
|
1066
|
+
},
|
|
1067
|
+
get extra() {
|
|
1068
|
+
return g;
|
|
1069
|
+
},
|
|
1070
|
+
set extra(l) {
|
|
1071
|
+
g = l, s.extraLength = l.length, u(l);
|
|
1072
|
+
},
|
|
1073
|
+
get comment() {
|
|
1074
|
+
return C.decode(a);
|
|
1075
|
+
},
|
|
1076
|
+
set comment(l) {
|
|
1077
|
+
if (a = t.toBuffer(l, C.encode), s.commentLength = a.length, a.length > 65535) throw t.Errors.COMMENT_TOO_LONG();
|
|
1078
|
+
},
|
|
1079
|
+
get name() {
|
|
1080
|
+
var l = C.decode(c);
|
|
1081
|
+
return f ? l.substr(l.length - 1).split("/").pop() : l.split("/").pop();
|
|
1082
|
+
},
|
|
1083
|
+
get isDirectory() {
|
|
1084
|
+
return f;
|
|
1085
|
+
},
|
|
1086
|
+
getCompressedData: function() {
|
|
1087
|
+
return R(!1, null);
|
|
1088
|
+
},
|
|
1089
|
+
getCompressedDataAsync: function(l) {
|
|
1090
|
+
R(!0, l);
|
|
1091
|
+
},
|
|
1092
|
+
setData: function(l) {
|
|
1093
|
+
d = t.toBuffer(l, t.decoder.encode), !f && d.length ? (s.size = d.length, s.method = t.Constants.DEFLATED, s.crc = t.crc32(l), s.changed = !0) : s.method = t.Constants.STORED;
|
|
1094
|
+
},
|
|
1095
|
+
getData: function(l) {
|
|
1096
|
+
return s.changed ? d : I(!1, null, l);
|
|
1097
|
+
},
|
|
1098
|
+
getDataAsync: function(l, p) {
|
|
1099
|
+
s.changed ? l(d) : I(!0, l, p);
|
|
1100
|
+
},
|
|
1101
|
+
set attr(l) {
|
|
1102
|
+
s.attr = l;
|
|
1103
|
+
},
|
|
1104
|
+
get attr() {
|
|
1105
|
+
return s.attr;
|
|
1106
|
+
},
|
|
1107
|
+
set header(l) {
|
|
1108
|
+
s.loadFromBinary(l);
|
|
1109
|
+
},
|
|
1110
|
+
get header() {
|
|
1111
|
+
return s;
|
|
1112
|
+
},
|
|
1113
|
+
packCentralHeader: function() {
|
|
1114
|
+
s.flags_efs = this.efs, s.extraLength = g.length;
|
|
1115
|
+
var l = s.centralHeaderToBinary(), p = t.Constants.CENHDR;
|
|
1116
|
+
return c.copy(l, p), p += c.length, g.copy(l, p), p += s.extraLength, a.copy(l, p), l;
|
|
1117
|
+
},
|
|
1118
|
+
packLocalHeader: function() {
|
|
1119
|
+
let l = 0;
|
|
1120
|
+
s.flags_efs = this.efs, s.extraLocalLength = N.length;
|
|
1121
|
+
const p = s.localHeaderToBinary(), w = Buffer.alloc(p.length + c.length + s.extraLocalLength);
|
|
1122
|
+
return p.copy(w, l), l += p.length, c.copy(w, l), l += c.length, N.copy(w, l), l += N.length, w;
|
|
1123
|
+
},
|
|
1124
|
+
toJSON: function() {
|
|
1125
|
+
const l = function(p) {
|
|
1126
|
+
return "<" + (p && p.length + " bytes buffer" || "null") + ">";
|
|
1127
|
+
};
|
|
1128
|
+
return {
|
|
1129
|
+
entryName: this.entryName,
|
|
1130
|
+
name: this.name,
|
|
1131
|
+
comment: this.comment,
|
|
1132
|
+
isDirectory: this.isDirectory,
|
|
1133
|
+
header: s.toJSON(),
|
|
1134
|
+
compressedData: l(i),
|
|
1135
|
+
data: l(d)
|
|
1136
|
+
};
|
|
1137
|
+
},
|
|
1138
|
+
toString: function() {
|
|
1139
|
+
return JSON.stringify(this.toJSON(), null, " ");
|
|
1140
|
+
}
|
|
1141
|
+
};
|
|
1142
|
+
}, Ue;
|
|
1143
|
+
}
|
|
1144
|
+
var Pe, ut;
|
|
1145
|
+
function pn() {
|
|
1146
|
+
if (ut) return Pe;
|
|
1147
|
+
ut = 1;
|
|
1148
|
+
const t = At(), e = Tt(), n = ie();
|
|
1149
|
+
return Pe = function(r, o) {
|
|
1150
|
+
var i = [], s = {}, c = Buffer.alloc(0), a = new e.MainHeader(), f = !1;
|
|
1151
|
+
const d = /* @__PURE__ */ new Set(), g = o, { noSort: N, decoder: y } = g;
|
|
1152
|
+
r ? L(g.readEntries) : f = !0;
|
|
1153
|
+
function E() {
|
|
1154
|
+
const I = /* @__PURE__ */ new Set();
|
|
1155
|
+
for (const R of Object.keys(s)) {
|
|
1156
|
+
const h = R.split("/");
|
|
1157
|
+
if (h.pop(), !!h.length)
|
|
1158
|
+
for (let u = 0; u < h.length; u++) {
|
|
1159
|
+
const S = h.slice(0, u + 1).join("/") + "/";
|
|
1160
|
+
I.add(S);
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
for (const R of I)
|
|
1164
|
+
if (!(R in s)) {
|
|
1165
|
+
const h = new t(g);
|
|
1166
|
+
h.entryName = R, h.attr = 16, h.temporary = !0, i.push(h), s[h.entryName] = h, d.add(h);
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
function C() {
|
|
1170
|
+
if (f = !0, s = {}, a.diskEntries > (r.length - a.offset) / n.Constants.CENHDR)
|
|
1171
|
+
throw n.Errors.DISK_ENTRY_TOO_LARGE();
|
|
1172
|
+
i = new Array(a.diskEntries);
|
|
1173
|
+
for (var I = a.offset, R = 0; R < i.length; R++) {
|
|
1174
|
+
var h = I, u = new t(g, r);
|
|
1175
|
+
u.header = r.slice(h, h += n.Constants.CENHDR), u.entryName = r.slice(h, h += u.header.fileNameLength), u.header.extraLength && (u.extra = r.slice(h, h += u.header.extraLength)), u.header.commentLength && (u.comment = r.slice(h, h + u.header.commentLength)), I += u.header.centralHeaderSize, i[R] = u, s[u.entryName] = u;
|
|
1176
|
+
}
|
|
1177
|
+
d.clear(), E();
|
|
1178
|
+
}
|
|
1179
|
+
function L(I) {
|
|
1180
|
+
var R = r.length - n.Constants.ENDHDR, h = Math.max(0, R - 65535), u = h, S = r.length, l = -1, p = 0;
|
|
1181
|
+
for (typeof g.trailingSpace == "boolean" && g.trailingSpace && (h = 0), R; R >= u; R--)
|
|
1182
|
+
if (r[R] === 80) {
|
|
1183
|
+
if (r.readUInt32LE(R) === n.Constants.ENDSIG) {
|
|
1184
|
+
l = R, p = R, S = R + n.Constants.ENDHDR, u = R - n.Constants.END64HDR;
|
|
1185
|
+
continue;
|
|
1186
|
+
}
|
|
1187
|
+
if (r.readUInt32LE(R) === n.Constants.END64SIG) {
|
|
1188
|
+
u = h;
|
|
1189
|
+
continue;
|
|
1190
|
+
}
|
|
1191
|
+
if (r.readUInt32LE(R) === n.Constants.ZIP64SIG) {
|
|
1192
|
+
l = R, S = R + n.readBigUInt64LE(r, R + n.Constants.ZIP64SIZE) + n.Constants.ZIP64LEAD;
|
|
1193
|
+
break;
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
if (l == -1) throw n.Errors.INVALID_FORMAT();
|
|
1197
|
+
a.loadFromBinary(r.slice(l, S)), a.commentLength && (c = r.slice(p + n.Constants.ENDHDR)), I && C();
|
|
1198
|
+
}
|
|
1199
|
+
function D() {
|
|
1200
|
+
i.length > 1 && !N && i.sort((I, R) => I.entryName.toLowerCase().localeCompare(R.entryName.toLowerCase()));
|
|
1201
|
+
}
|
|
1202
|
+
return {
|
|
1203
|
+
/**
|
|
1204
|
+
* Returns an array of ZipEntry objects existent in the current opened archive
|
|
1205
|
+
* @return Array
|
|
1206
|
+
*/
|
|
1207
|
+
get entries() {
|
|
1208
|
+
return f || C(), i.filter((I) => !d.has(I));
|
|
1209
|
+
},
|
|
1210
|
+
/**
|
|
1211
|
+
* Archive comment
|
|
1212
|
+
* @return {String}
|
|
1213
|
+
*/
|
|
1214
|
+
get comment() {
|
|
1215
|
+
return y.decode(c);
|
|
1216
|
+
},
|
|
1217
|
+
set comment(I) {
|
|
1218
|
+
c = n.toBuffer(I, y.encode), a.commentLength = c.length;
|
|
1219
|
+
},
|
|
1220
|
+
getEntryCount: function() {
|
|
1221
|
+
return f ? i.length : a.diskEntries;
|
|
1222
|
+
},
|
|
1223
|
+
forEach: function(I) {
|
|
1224
|
+
this.entries.forEach(I);
|
|
1225
|
+
},
|
|
1226
|
+
/**
|
|
1227
|
+
* Returns a reference to the entry with the given name or null if entry is inexistent
|
|
1228
|
+
*
|
|
1229
|
+
* @param entryName
|
|
1230
|
+
* @return ZipEntry
|
|
1231
|
+
*/
|
|
1232
|
+
getEntry: function(I) {
|
|
1233
|
+
return f || C(), s[I] || null;
|
|
1234
|
+
},
|
|
1235
|
+
/**
|
|
1236
|
+
* Adds the given entry to the entry list
|
|
1237
|
+
*
|
|
1238
|
+
* @param entry
|
|
1239
|
+
*/
|
|
1240
|
+
setEntry: function(I) {
|
|
1241
|
+
f || C(), i.push(I), s[I.entryName] = I, a.totalEntries = i.length;
|
|
1242
|
+
},
|
|
1243
|
+
/**
|
|
1244
|
+
* Removes the file with the given name from the entry list.
|
|
1245
|
+
*
|
|
1246
|
+
* If the entry is a directory, then all nested files and directories will be removed
|
|
1247
|
+
* @param entryName
|
|
1248
|
+
* @returns {void}
|
|
1249
|
+
*/
|
|
1250
|
+
deleteFile: function(I, R = !0) {
|
|
1251
|
+
f || C();
|
|
1252
|
+
const h = s[I];
|
|
1253
|
+
this.getEntryChildren(h, R).map((S) => S.entryName).forEach(this.deleteEntry);
|
|
1254
|
+
},
|
|
1255
|
+
/**
|
|
1256
|
+
* Removes the entry with the given name from the entry list.
|
|
1257
|
+
*
|
|
1258
|
+
* @param {string} entryName
|
|
1259
|
+
* @returns {void}
|
|
1260
|
+
*/
|
|
1261
|
+
deleteEntry: function(I) {
|
|
1262
|
+
f || C();
|
|
1263
|
+
const R = s[I], h = i.indexOf(R);
|
|
1264
|
+
h >= 0 && (i.splice(h, 1), delete s[I], a.totalEntries = i.length);
|
|
1265
|
+
},
|
|
1266
|
+
/**
|
|
1267
|
+
* Iterates and returns all nested files and directories of the given entry
|
|
1268
|
+
*
|
|
1269
|
+
* @param entry
|
|
1270
|
+
* @return Array
|
|
1271
|
+
*/
|
|
1272
|
+
getEntryChildren: function(I, R = !0) {
|
|
1273
|
+
if (f || C(), typeof I == "object")
|
|
1274
|
+
if (I.isDirectory && R) {
|
|
1275
|
+
const h = [], u = I.entryName;
|
|
1276
|
+
for (const S of i)
|
|
1277
|
+
S.entryName.startsWith(u) && h.push(S);
|
|
1278
|
+
return h;
|
|
1279
|
+
} else
|
|
1280
|
+
return [I];
|
|
1281
|
+
return [];
|
|
1282
|
+
},
|
|
1283
|
+
/**
|
|
1284
|
+
* How many child elements entry has
|
|
1285
|
+
*
|
|
1286
|
+
* @param {ZipEntry} entry
|
|
1287
|
+
* @return {integer}
|
|
1288
|
+
*/
|
|
1289
|
+
getChildCount: function(I) {
|
|
1290
|
+
if (I && I.isDirectory) {
|
|
1291
|
+
const R = this.getEntryChildren(I);
|
|
1292
|
+
return R.includes(I) ? R.length - 1 : R.length;
|
|
1293
|
+
}
|
|
1294
|
+
return 0;
|
|
1295
|
+
},
|
|
1296
|
+
/**
|
|
1297
|
+
* Returns the zip file
|
|
1298
|
+
*
|
|
1299
|
+
* @return Buffer
|
|
1300
|
+
*/
|
|
1301
|
+
compressToBuffer: function() {
|
|
1302
|
+
f || C(), D();
|
|
1303
|
+
const I = [], R = [];
|
|
1304
|
+
let h = 0, u = 0;
|
|
1305
|
+
a.size = 0, a.offset = 0;
|
|
1306
|
+
let S = 0;
|
|
1307
|
+
for (const w of this.entries) {
|
|
1308
|
+
const _ = w.getCompressedData();
|
|
1309
|
+
w.header.offset = u;
|
|
1310
|
+
const T = w.packLocalHeader(), A = T.length + _.length;
|
|
1311
|
+
u += A, I.push(T), I.push(_);
|
|
1312
|
+
const O = w.packCentralHeader();
|
|
1313
|
+
R.push(O), a.size += O.length, h += A + O.length, S++;
|
|
1314
|
+
}
|
|
1315
|
+
h += a.mainHeaderSize, a.offset = u, a.totalEntries = S, u = 0;
|
|
1316
|
+
const l = Buffer.alloc(h);
|
|
1317
|
+
for (const w of I)
|
|
1318
|
+
w.copy(l, u), u += w.length;
|
|
1319
|
+
for (const w of R)
|
|
1320
|
+
w.copy(l, u), u += w.length;
|
|
1321
|
+
const p = a.toBinary();
|
|
1322
|
+
return c && c.copy(p, n.Constants.ENDHDR), p.copy(l, u), r = l, f = !1, l;
|
|
1323
|
+
},
|
|
1324
|
+
toAsyncBuffer: function(I, R, h, u) {
|
|
1325
|
+
try {
|
|
1326
|
+
f || C(), D();
|
|
1327
|
+
const S = [], l = [];
|
|
1328
|
+
let p = 0, w = 0, _ = 0;
|
|
1329
|
+
a.size = 0, a.offset = 0;
|
|
1330
|
+
const T = function(A) {
|
|
1331
|
+
if (A.length > 0) {
|
|
1332
|
+
const O = A.shift(), x = O.entryName + O.extra.toString();
|
|
1333
|
+
h && h(x), O.getCompressedDataAsync(function(b) {
|
|
1334
|
+
u && u(x), O.header.offset = w;
|
|
1335
|
+
const U = O.packLocalHeader(), B = U.length + b.length;
|
|
1336
|
+
w += B, S.push(U), S.push(b);
|
|
1337
|
+
const P = O.packCentralHeader();
|
|
1338
|
+
l.push(P), a.size += P.length, p += B + P.length, _++, T(A);
|
|
1339
|
+
});
|
|
1340
|
+
} else {
|
|
1341
|
+
p += a.mainHeaderSize, a.offset = w, a.totalEntries = _, w = 0;
|
|
1342
|
+
const O = Buffer.alloc(p);
|
|
1343
|
+
S.forEach(function(b) {
|
|
1344
|
+
b.copy(O, w), w += b.length;
|
|
1345
|
+
}), l.forEach(function(b) {
|
|
1346
|
+
b.copy(O, w), w += b.length;
|
|
1347
|
+
});
|
|
1348
|
+
const x = a.toBinary();
|
|
1349
|
+
c && c.copy(x, n.Constants.ENDHDR), x.copy(O, w), r = O, f = !1, I(O);
|
|
1350
|
+
}
|
|
1351
|
+
};
|
|
1352
|
+
T(Array.from(this.entries));
|
|
1353
|
+
} catch (S) {
|
|
1354
|
+
R(S);
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
};
|
|
1358
|
+
}, Pe;
|
|
1359
|
+
}
|
|
1360
|
+
var Be, lt;
|
|
1361
|
+
function yn() {
|
|
1362
|
+
if (lt) return Be;
|
|
1363
|
+
lt = 1;
|
|
1364
|
+
const t = ie(), e = J, n = At(), r = pn(), o = (...a) => t.findLast(a, (f) => typeof f == "boolean"), i = (...a) => t.findLast(a, (f) => typeof f == "string"), s = (...a) => t.findLast(a, (f) => typeof f == "function"), c = {
|
|
1365
|
+
// option "noSort" : if true it disables files sorting
|
|
1366
|
+
noSort: !1,
|
|
1367
|
+
// read entries during load (initial loading may be slower)
|
|
1368
|
+
readEntries: !1,
|
|
1369
|
+
// default method is none
|
|
1370
|
+
method: t.Constants.NONE,
|
|
1371
|
+
// file system
|
|
1372
|
+
fs: null
|
|
1373
|
+
};
|
|
1374
|
+
return Be = function(a, f) {
|
|
1375
|
+
let d = null;
|
|
1376
|
+
const g = Object.assign(/* @__PURE__ */ Object.create(null), c);
|
|
1377
|
+
a && typeof a == "object" && (a instanceof Uint8Array || (Object.assign(g, a), a = g.input ? g.input : void 0, g.input && delete g.input), Buffer.isBuffer(a) && (d = a, g.method = t.Constants.BUFFER, a = void 0)), Object.assign(g, f);
|
|
1378
|
+
const N = new t(g);
|
|
1379
|
+
if ((typeof g.decoder != "object" || typeof g.decoder.encode != "function" || typeof g.decoder.decode != "function") && (g.decoder = t.decoder), a && typeof a == "string")
|
|
1380
|
+
if (N.fs.existsSync(a))
|
|
1381
|
+
g.method = t.Constants.FILE, g.filename = a, d = N.fs.readFileSync(a);
|
|
1382
|
+
else
|
|
1383
|
+
throw t.Errors.INVALID_FILENAME();
|
|
1384
|
+
const y = new r(d, g), { canonical: E, sanitize: C, zipnamefix: L } = t;
|
|
1385
|
+
function D(u) {
|
|
1386
|
+
if (u && y) {
|
|
1387
|
+
var S;
|
|
1388
|
+
if (typeof u == "string" && (S = y.getEntry(e.posix.normalize(u))), typeof u == "object" && typeof u.entryName < "u" && typeof u.header < "u" && (S = y.getEntry(u.entryName)), S)
|
|
1389
|
+
return S;
|
|
1390
|
+
}
|
|
1391
|
+
return null;
|
|
1392
|
+
}
|
|
1393
|
+
function I(u) {
|
|
1394
|
+
const { join: S, normalize: l, sep: p } = e.posix;
|
|
1395
|
+
return S(".", l(p + u.split("\\").join(p) + p));
|
|
1396
|
+
}
|
|
1397
|
+
function R(u) {
|
|
1398
|
+
return u instanceof RegExp ? /* @__PURE__ */ (function(S) {
|
|
1399
|
+
return function(l) {
|
|
1400
|
+
return S.test(l);
|
|
1401
|
+
};
|
|
1402
|
+
})(u) : typeof u != "function" ? () => !0 : u;
|
|
1403
|
+
}
|
|
1404
|
+
const h = (u, S) => {
|
|
1405
|
+
let l = S.slice(-1);
|
|
1406
|
+
return l = l === N.sep ? N.sep : "", e.relative(u, S) + l;
|
|
1407
|
+
};
|
|
1408
|
+
return {
|
|
1409
|
+
/**
|
|
1410
|
+
* Extracts the given entry from the archive and returns the content as a Buffer object
|
|
1411
|
+
* @param {ZipEntry|string} entry ZipEntry object or String with the full path of the entry
|
|
1412
|
+
* @param {Buffer|string} [pass] - password
|
|
1413
|
+
* @return Buffer or Null in case of error
|
|
1414
|
+
*/
|
|
1415
|
+
readFile: function(u, S) {
|
|
1416
|
+
var l = D(u);
|
|
1417
|
+
return l && l.getData(S) || null;
|
|
1418
|
+
},
|
|
1419
|
+
/**
|
|
1420
|
+
* Returns how many child elements has on entry (directories) on files it is always 0
|
|
1421
|
+
* @param {ZipEntry|string} entry ZipEntry object or String with the full path of the entry
|
|
1422
|
+
* @returns {integer}
|
|
1423
|
+
*/
|
|
1424
|
+
childCount: function(u) {
|
|
1425
|
+
const S = D(u);
|
|
1426
|
+
if (S)
|
|
1427
|
+
return y.getChildCount(S);
|
|
1428
|
+
},
|
|
1429
|
+
/**
|
|
1430
|
+
* Asynchronous readFile
|
|
1431
|
+
* @param {ZipEntry|string} entry ZipEntry object or String with the full path of the entry
|
|
1432
|
+
* @param {callback} callback
|
|
1433
|
+
*
|
|
1434
|
+
* @return Buffer or Null in case of error
|
|
1435
|
+
*/
|
|
1436
|
+
readFileAsync: function(u, S) {
|
|
1437
|
+
var l = D(u);
|
|
1438
|
+
l ? l.getDataAsync(S) : S(null, "getEntry failed for:" + u);
|
|
1439
|
+
},
|
|
1440
|
+
/**
|
|
1441
|
+
* Extracts the given entry from the archive and returns the content as plain text in the given encoding
|
|
1442
|
+
* @param {ZipEntry|string} entry - ZipEntry object or String with the full path of the entry
|
|
1443
|
+
* @param {string} encoding - Optional. If no encoding is specified utf8 is used
|
|
1444
|
+
*
|
|
1445
|
+
* @return String
|
|
1446
|
+
*/
|
|
1447
|
+
readAsText: function(u, S) {
|
|
1448
|
+
var l = D(u);
|
|
1449
|
+
if (l) {
|
|
1450
|
+
var p = l.getData();
|
|
1451
|
+
if (p && p.length)
|
|
1452
|
+
return p.toString(S || "utf8");
|
|
1453
|
+
}
|
|
1454
|
+
return "";
|
|
1455
|
+
},
|
|
1456
|
+
/**
|
|
1457
|
+
* Asynchronous readAsText
|
|
1458
|
+
* @param {ZipEntry|string} entry ZipEntry object or String with the full path of the entry
|
|
1459
|
+
* @param {callback} callback
|
|
1460
|
+
* @param {string} [encoding] - Optional. If no encoding is specified utf8 is used
|
|
1461
|
+
*
|
|
1462
|
+
* @return String
|
|
1463
|
+
*/
|
|
1464
|
+
readAsTextAsync: function(u, S, l) {
|
|
1465
|
+
var p = D(u);
|
|
1466
|
+
p ? p.getDataAsync(function(w, _) {
|
|
1467
|
+
if (_) {
|
|
1468
|
+
S(w, _);
|
|
1469
|
+
return;
|
|
1470
|
+
}
|
|
1471
|
+
w && w.length ? S(w.toString(l || "utf8")) : S("");
|
|
1472
|
+
}) : S("");
|
|
1473
|
+
},
|
|
1474
|
+
/**
|
|
1475
|
+
* Remove the entry from the file or the entry and all it's nested directories and files if the given entry is a directory
|
|
1476
|
+
*
|
|
1477
|
+
* @param {ZipEntry|string} entry
|
|
1478
|
+
* @returns {void}
|
|
1479
|
+
*/
|
|
1480
|
+
deleteFile: function(u, S = !0) {
|
|
1481
|
+
var l = D(u);
|
|
1482
|
+
l && y.deleteFile(l.entryName, S);
|
|
1483
|
+
},
|
|
1484
|
+
/**
|
|
1485
|
+
* Remove the entry from the file or directory without affecting any nested entries
|
|
1486
|
+
*
|
|
1487
|
+
* @param {ZipEntry|string} entry
|
|
1488
|
+
* @returns {void}
|
|
1489
|
+
*/
|
|
1490
|
+
deleteEntry: function(u) {
|
|
1491
|
+
var S = D(u);
|
|
1492
|
+
S && y.deleteEntry(S.entryName);
|
|
1493
|
+
},
|
|
1494
|
+
/**
|
|
1495
|
+
* Adds a comment to the zip. The zip must be rewritten after adding the comment.
|
|
1496
|
+
*
|
|
1497
|
+
* @param {string} comment
|
|
1498
|
+
*/
|
|
1499
|
+
addZipComment: function(u) {
|
|
1500
|
+
y.comment = u;
|
|
1501
|
+
},
|
|
1502
|
+
/**
|
|
1503
|
+
* Returns the zip comment
|
|
1504
|
+
*
|
|
1505
|
+
* @return String
|
|
1506
|
+
*/
|
|
1507
|
+
getZipComment: function() {
|
|
1508
|
+
return y.comment || "";
|
|
1509
|
+
},
|
|
1510
|
+
/**
|
|
1511
|
+
* Adds a comment to a specified zipEntry. The zip must be rewritten after adding the comment
|
|
1512
|
+
* The comment cannot exceed 65535 characters in length
|
|
1513
|
+
*
|
|
1514
|
+
* @param {ZipEntry} entry
|
|
1515
|
+
* @param {string} comment
|
|
1516
|
+
*/
|
|
1517
|
+
addZipEntryComment: function(u, S) {
|
|
1518
|
+
var l = D(u);
|
|
1519
|
+
l && (l.comment = S);
|
|
1520
|
+
},
|
|
1521
|
+
/**
|
|
1522
|
+
* Returns the comment of the specified entry
|
|
1523
|
+
*
|
|
1524
|
+
* @param {ZipEntry} entry
|
|
1525
|
+
* @return String
|
|
1526
|
+
*/
|
|
1527
|
+
getZipEntryComment: function(u) {
|
|
1528
|
+
var S = D(u);
|
|
1529
|
+
return S && S.comment || "";
|
|
1530
|
+
},
|
|
1531
|
+
/**
|
|
1532
|
+
* Updates the content of an existing entry inside the archive. The zip must be rewritten after updating the content
|
|
1533
|
+
*
|
|
1534
|
+
* @param {ZipEntry} entry
|
|
1535
|
+
* @param {Buffer} content
|
|
1536
|
+
*/
|
|
1537
|
+
updateFile: function(u, S) {
|
|
1538
|
+
var l = D(u);
|
|
1539
|
+
l && l.setData(S);
|
|
1540
|
+
},
|
|
1541
|
+
/**
|
|
1542
|
+
* Adds a file from the disk to the archive
|
|
1543
|
+
*
|
|
1544
|
+
* @param {string} localPath File to add to zip
|
|
1545
|
+
* @param {string} [zipPath] Optional path inside the zip
|
|
1546
|
+
* @param {string} [zipName] Optional name for the file
|
|
1547
|
+
* @param {string} [comment] Optional file comment
|
|
1548
|
+
*/
|
|
1549
|
+
addLocalFile: function(u, S, l, p) {
|
|
1550
|
+
if (N.fs.existsSync(u)) {
|
|
1551
|
+
S = S ? I(S) : "";
|
|
1552
|
+
const w = e.win32.basename(e.win32.normalize(u));
|
|
1553
|
+
S += l || w;
|
|
1554
|
+
const _ = N.fs.statSync(u), T = _.isFile() ? N.fs.readFileSync(u) : Buffer.alloc(0);
|
|
1555
|
+
_.isDirectory() && (S += N.sep), this.addFile(S, T, p, _);
|
|
1556
|
+
} else
|
|
1557
|
+
throw t.Errors.FILE_NOT_FOUND(u);
|
|
1558
|
+
},
|
|
1559
|
+
/**
|
|
1560
|
+
* Callback for showing if everything was done.
|
|
1561
|
+
*
|
|
1562
|
+
* @callback doneCallback
|
|
1563
|
+
* @param {Error} err - Error object
|
|
1564
|
+
* @param {boolean} done - was request fully completed
|
|
1565
|
+
*/
|
|
1566
|
+
/**
|
|
1567
|
+
* Adds a file from the disk to the archive
|
|
1568
|
+
*
|
|
1569
|
+
* @param {(object|string)} options - options object, if it is string it us used as localPath.
|
|
1570
|
+
* @param {string} options.localPath - Local path to the file.
|
|
1571
|
+
* @param {string} [options.comment] - Optional file comment.
|
|
1572
|
+
* @param {string} [options.zipPath] - Optional path inside the zip
|
|
1573
|
+
* @param {string} [options.zipName] - Optional name for the file
|
|
1574
|
+
* @param {doneCallback} callback - The callback that handles the response.
|
|
1575
|
+
*/
|
|
1576
|
+
addLocalFileAsync: function(u, S) {
|
|
1577
|
+
u = typeof u == "object" ? u : { localPath: u };
|
|
1578
|
+
const l = e.resolve(u.localPath), { comment: p } = u;
|
|
1579
|
+
let { zipPath: w, zipName: _ } = u;
|
|
1580
|
+
const T = this;
|
|
1581
|
+
N.fs.stat(l, function(A, O) {
|
|
1582
|
+
if (A) return S(A, !1);
|
|
1583
|
+
w = w ? I(w) : "";
|
|
1584
|
+
const x = e.win32.basename(e.win32.normalize(l));
|
|
1585
|
+
if (w += _ || x, O.isFile())
|
|
1586
|
+
N.fs.readFile(l, function(b, U) {
|
|
1587
|
+
return b ? S(b, !1) : (T.addFile(w, U, p, O), setImmediate(S, void 0, !0));
|
|
1588
|
+
});
|
|
1589
|
+
else if (O.isDirectory())
|
|
1590
|
+
return w += N.sep, T.addFile(w, Buffer.alloc(0), p, O), setImmediate(S, void 0, !0);
|
|
1591
|
+
});
|
|
1592
|
+
},
|
|
1593
|
+
/**
|
|
1594
|
+
* Adds a local directory and all its nested files and directories to the archive
|
|
1595
|
+
*
|
|
1596
|
+
* @param {string} localPath - local path to the folder
|
|
1597
|
+
* @param {string} [zipPath] - optional path inside zip
|
|
1598
|
+
* @param {(RegExp|function)} [filter] - optional RegExp or Function if files match will be included.
|
|
1599
|
+
*/
|
|
1600
|
+
addLocalFolder: function(u, S, l) {
|
|
1601
|
+
if (l = R(l), S = S ? I(S) : "", u = e.normalize(u), N.fs.existsSync(u)) {
|
|
1602
|
+
const p = N.findFiles(u), w = this;
|
|
1603
|
+
if (p.length)
|
|
1604
|
+
for (const _ of p) {
|
|
1605
|
+
const T = e.join(S, h(u, _));
|
|
1606
|
+
l(T) && w.addLocalFile(_, e.dirname(T));
|
|
1607
|
+
}
|
|
1608
|
+
} else
|
|
1609
|
+
throw t.Errors.FILE_NOT_FOUND(u);
|
|
1610
|
+
},
|
|
1611
|
+
/**
|
|
1612
|
+
* Asynchronous addLocalFolder
|
|
1613
|
+
* @param {string} localPath
|
|
1614
|
+
* @param {callback} callback
|
|
1615
|
+
* @param {string} [zipPath] optional path inside zip
|
|
1616
|
+
* @param {RegExp|function} [filter] optional RegExp or Function if files match will
|
|
1617
|
+
* be included.
|
|
1618
|
+
*/
|
|
1619
|
+
addLocalFolderAsync: function(u, S, l, p) {
|
|
1620
|
+
p = R(p), l = l ? I(l) : "", u = e.normalize(u);
|
|
1621
|
+
var w = this;
|
|
1622
|
+
N.fs.open(u, "r", function(_) {
|
|
1623
|
+
if (_ && _.code === "ENOENT")
|
|
1624
|
+
S(void 0, t.Errors.FILE_NOT_FOUND(u));
|
|
1625
|
+
else if (_)
|
|
1626
|
+
S(void 0, _);
|
|
1627
|
+
else {
|
|
1628
|
+
var T = N.findFiles(u), A = -1, O = function() {
|
|
1629
|
+
if (A += 1, A < T.length) {
|
|
1630
|
+
var x = T[A], b = h(u, x).split("\\").join("/");
|
|
1631
|
+
b = b.normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^\x20-\x7E]/g, ""), p(b) ? N.fs.stat(x, function(U, B) {
|
|
1632
|
+
U && S(void 0, U), B.isFile() ? N.fs.readFile(x, function(P, Z) {
|
|
1633
|
+
P ? S(void 0, P) : (w.addFile(l + b, Z, "", B), O());
|
|
1634
|
+
}) : (w.addFile(l + b + "/", Buffer.alloc(0), "", B), O());
|
|
1635
|
+
}) : process.nextTick(() => {
|
|
1636
|
+
O();
|
|
1637
|
+
});
|
|
1638
|
+
} else
|
|
1639
|
+
S(!0, void 0);
|
|
1640
|
+
};
|
|
1641
|
+
O();
|
|
1642
|
+
}
|
|
1643
|
+
});
|
|
1644
|
+
},
|
|
1645
|
+
/**
|
|
1646
|
+
* Adds a local directory and all its nested files and directories to the archive
|
|
1647
|
+
*
|
|
1648
|
+
* @param {object | string} options - options object, if it is string it us used as localPath.
|
|
1649
|
+
* @param {string} options.localPath - Local path to the folder.
|
|
1650
|
+
* @param {string} [options.zipPath] - optional path inside zip.
|
|
1651
|
+
* @param {RegExp|function} [options.filter] - optional RegExp or Function if files match will be included.
|
|
1652
|
+
* @param {function|string} [options.namefix] - optional function to help fix filename
|
|
1653
|
+
* @param {doneCallback} callback - The callback that handles the response.
|
|
1654
|
+
*
|
|
1655
|
+
*/
|
|
1656
|
+
addLocalFolderAsync2: function(u, S) {
|
|
1657
|
+
const l = this;
|
|
1658
|
+
u = typeof u == "object" ? u : { localPath: u }, localPath = e.resolve(I(u.localPath));
|
|
1659
|
+
let { zipPath: p, filter: w, namefix: _ } = u;
|
|
1660
|
+
w instanceof RegExp ? w = /* @__PURE__ */ (function(O) {
|
|
1661
|
+
return function(x) {
|
|
1662
|
+
return O.test(x);
|
|
1663
|
+
};
|
|
1664
|
+
})(w) : typeof w != "function" && (w = function() {
|
|
1665
|
+
return !0;
|
|
1666
|
+
}), p = p ? I(p) : "", _ == "latin1" && (_ = (O) => O.normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^\x20-\x7E]/g, "")), typeof _ != "function" && (_ = (O) => O);
|
|
1667
|
+
const T = (O) => e.join(p, _(h(localPath, O))), A = (O) => e.win32.basename(e.win32.normalize(_(O)));
|
|
1668
|
+
N.fs.open(localPath, "r", function(O) {
|
|
1669
|
+
O && O.code === "ENOENT" ? S(void 0, t.Errors.FILE_NOT_FOUND(localPath)) : O ? S(void 0, O) : N.findFilesAsync(localPath, function(x, b) {
|
|
1670
|
+
if (x) return S(x);
|
|
1671
|
+
b = b.filter((U) => w(T(U))), b.length || S(void 0, !1), setImmediate(
|
|
1672
|
+
b.reverse().reduce(function(U, B) {
|
|
1673
|
+
return function(P, Z) {
|
|
1674
|
+
if (P || Z === !1) return setImmediate(U, P, !1);
|
|
1675
|
+
l.addLocalFileAsync(
|
|
1676
|
+
{
|
|
1677
|
+
localPath: B,
|
|
1678
|
+
zipPath: e.dirname(T(B)),
|
|
1679
|
+
zipName: A(B)
|
|
1680
|
+
},
|
|
1681
|
+
U
|
|
1682
|
+
);
|
|
1683
|
+
};
|
|
1684
|
+
}, S)
|
|
1685
|
+
);
|
|
1686
|
+
});
|
|
1687
|
+
});
|
|
1688
|
+
},
|
|
1689
|
+
/**
|
|
1690
|
+
* Adds a local directory and all its nested files and directories to the archive
|
|
1691
|
+
*
|
|
1692
|
+
* @param {string} localPath - path where files will be extracted
|
|
1693
|
+
* @param {object} props - optional properties
|
|
1694
|
+
* @param {string} [props.zipPath] - optional path inside zip
|
|
1695
|
+
* @param {RegExp|function} [props.filter] - optional RegExp or Function if files match will be included.
|
|
1696
|
+
* @param {function|string} [props.namefix] - optional function to help fix filename
|
|
1697
|
+
*/
|
|
1698
|
+
addLocalFolderPromise: function(u, S) {
|
|
1699
|
+
return new Promise((l, p) => {
|
|
1700
|
+
this.addLocalFolderAsync2(Object.assign({ localPath: u }, S), (w, _) => {
|
|
1701
|
+
w && p(w), _ && l(this);
|
|
1702
|
+
});
|
|
1703
|
+
});
|
|
1704
|
+
},
|
|
1705
|
+
/**
|
|
1706
|
+
* Allows you to create a entry (file or directory) in the zip file.
|
|
1707
|
+
* If you want to create a directory the entryName must end in / and a null buffer should be provided.
|
|
1708
|
+
* Comment and attributes are optional
|
|
1709
|
+
*
|
|
1710
|
+
* @param {string} entryName
|
|
1711
|
+
* @param {Buffer | string} content - file content as buffer or utf8 coded string
|
|
1712
|
+
* @param {string} [comment] - file comment
|
|
1713
|
+
* @param {number | object} [attr] - number as unix file permissions, object as filesystem Stats object
|
|
1714
|
+
*/
|
|
1715
|
+
addFile: function(u, S, l, p) {
|
|
1716
|
+
u = L(u);
|
|
1717
|
+
let w = D(u);
|
|
1718
|
+
const _ = w != null;
|
|
1719
|
+
_ || (w = new n(g), w.entryName = u), w.comment = l || "";
|
|
1720
|
+
const T = typeof p == "object" && p instanceof N.fs.Stats;
|
|
1721
|
+
T && (w.header.time = p.mtime);
|
|
1722
|
+
var A = w.isDirectory ? 16 : 0;
|
|
1723
|
+
let O = w.isDirectory ? 16384 : 32768;
|
|
1724
|
+
return T ? O |= 4095 & p.mode : typeof p == "number" ? O |= 4095 & p : O |= w.isDirectory ? 493 : 420, A = (A | O << 16) >>> 0, w.attr = A, w.setData(S), _ || y.setEntry(w), w;
|
|
1725
|
+
},
|
|
1726
|
+
/**
|
|
1727
|
+
* Returns an array of ZipEntry objects representing the files and folders inside the archive
|
|
1728
|
+
*
|
|
1729
|
+
* @param {string} [password]
|
|
1730
|
+
* @returns Array
|
|
1731
|
+
*/
|
|
1732
|
+
getEntries: function(u) {
|
|
1733
|
+
return y.password = u, y ? y.entries : [];
|
|
1734
|
+
},
|
|
1735
|
+
/**
|
|
1736
|
+
* Returns a ZipEntry object representing the file or folder specified by ``name``.
|
|
1737
|
+
*
|
|
1738
|
+
* @param {string} name
|
|
1739
|
+
* @return ZipEntry
|
|
1740
|
+
*/
|
|
1741
|
+
getEntry: function(u) {
|
|
1742
|
+
return D(u);
|
|
1743
|
+
},
|
|
1744
|
+
getEntryCount: function() {
|
|
1745
|
+
return y.getEntryCount();
|
|
1746
|
+
},
|
|
1747
|
+
forEach: function(u) {
|
|
1748
|
+
return y.forEach(u);
|
|
1749
|
+
},
|
|
1750
|
+
/**
|
|
1751
|
+
* Extracts the given entry to the given targetPath
|
|
1752
|
+
* If the entry is a directory inside the archive, the entire directory and it's subdirectories will be extracted
|
|
1753
|
+
*
|
|
1754
|
+
* @param {string|ZipEntry} entry - ZipEntry object or String with the full path of the entry
|
|
1755
|
+
* @param {string} targetPath - Target folder where to write the file
|
|
1756
|
+
* @param {boolean} [maintainEntryPath=true] - If maintainEntryPath is true and the entry is inside a folder, the entry folder will be created in targetPath as well. Default is TRUE
|
|
1757
|
+
* @param {boolean} [overwrite=false] - If the file already exists at the target path, the file will be overwriten if this is true.
|
|
1758
|
+
* @param {boolean} [keepOriginalPermission=false] - The file will be set as the permission from the entry if this is true.
|
|
1759
|
+
* @param {string} [outFileName] - String If set will override the filename of the extracted file (Only works if the entry is a file)
|
|
1760
|
+
*
|
|
1761
|
+
* @return Boolean
|
|
1762
|
+
*/
|
|
1763
|
+
extractEntryTo: function(u, S, l, p, w, _) {
|
|
1764
|
+
p = o(!1, p), w = o(!1, w), l = o(!0, l), _ = i(w, _);
|
|
1765
|
+
var T = D(u);
|
|
1766
|
+
if (!T)
|
|
1767
|
+
throw t.Errors.NO_ENTRY();
|
|
1768
|
+
var A = E(T.entryName), O = C(S, _ && !T.isDirectory ? _ : l ? A : e.basename(A));
|
|
1769
|
+
if (T.isDirectory) {
|
|
1770
|
+
var x = y.getEntryChildren(T);
|
|
1771
|
+
return x.forEach(function(B) {
|
|
1772
|
+
if (B.isDirectory) return;
|
|
1773
|
+
var P = B.getData();
|
|
1774
|
+
if (!P)
|
|
1775
|
+
throw t.Errors.CANT_EXTRACT_FILE();
|
|
1776
|
+
var Z = E(B.entryName), ne = C(S, l ? Z : e.basename(Z));
|
|
1777
|
+
const q = w ? B.header.fileAttr : void 0;
|
|
1778
|
+
N.writeFileTo(ne, P, p, q);
|
|
1779
|
+
}), !0;
|
|
1780
|
+
}
|
|
1781
|
+
var b = T.getData(y.password);
|
|
1782
|
+
if (!b) throw t.Errors.CANT_EXTRACT_FILE();
|
|
1783
|
+
if (N.fs.existsSync(O) && !p)
|
|
1784
|
+
throw t.Errors.CANT_OVERRIDE();
|
|
1785
|
+
const U = w ? u.header.fileAttr : void 0;
|
|
1786
|
+
return N.writeFileTo(O, b, p, U), !0;
|
|
1787
|
+
},
|
|
1788
|
+
/**
|
|
1789
|
+
* Test the archive
|
|
1790
|
+
* @param {string} [pass]
|
|
1791
|
+
*/
|
|
1792
|
+
test: function(u) {
|
|
1793
|
+
if (!y)
|
|
1794
|
+
return !1;
|
|
1795
|
+
for (var S in y.entries)
|
|
1796
|
+
try {
|
|
1797
|
+
if (S.isDirectory)
|
|
1798
|
+
continue;
|
|
1799
|
+
var l = y.entries[S].getData(u);
|
|
1800
|
+
if (!l)
|
|
1801
|
+
return !1;
|
|
1802
|
+
} catch {
|
|
1803
|
+
return !1;
|
|
1804
|
+
}
|
|
1805
|
+
return !0;
|
|
1806
|
+
},
|
|
1807
|
+
/**
|
|
1808
|
+
* Extracts the entire archive to the given location
|
|
1809
|
+
*
|
|
1810
|
+
* @param {string} targetPath Target location
|
|
1811
|
+
* @param {boolean} [overwrite=false] If the file already exists at the target path, the file will be overwriten if this is true.
|
|
1812
|
+
* Default is FALSE
|
|
1813
|
+
* @param {boolean} [keepOriginalPermission=false] The file will be set as the permission from the entry if this is true.
|
|
1814
|
+
* Default is FALSE
|
|
1815
|
+
* @param {string|Buffer} [pass] password
|
|
1816
|
+
*/
|
|
1817
|
+
extractAllTo: function(u, S, l, p) {
|
|
1818
|
+
if (l = o(!1, l), p = i(l, p), S = o(!1, S), !y) throw t.Errors.NO_ZIP();
|
|
1819
|
+
y.entries.forEach(function(w) {
|
|
1820
|
+
var _ = C(u, E(w.entryName));
|
|
1821
|
+
if (w.isDirectory) {
|
|
1822
|
+
N.makeDir(_);
|
|
1823
|
+
return;
|
|
1824
|
+
}
|
|
1825
|
+
var T = w.getData(p);
|
|
1826
|
+
if (!T)
|
|
1827
|
+
throw t.Errors.CANT_EXTRACT_FILE();
|
|
1828
|
+
const A = l ? w.header.fileAttr : void 0;
|
|
1829
|
+
N.writeFileTo(_, T, S, A);
|
|
1830
|
+
try {
|
|
1831
|
+
N.fs.utimesSync(_, w.header.time, w.header.time);
|
|
1832
|
+
} catch {
|
|
1833
|
+
throw t.Errors.CANT_EXTRACT_FILE();
|
|
1834
|
+
}
|
|
1835
|
+
});
|
|
1836
|
+
},
|
|
1837
|
+
/**
|
|
1838
|
+
* Asynchronous extractAllTo
|
|
1839
|
+
*
|
|
1840
|
+
* @param {string} targetPath Target location
|
|
1841
|
+
* @param {boolean} [overwrite=false] If the file already exists at the target path, the file will be overwriten if this is true.
|
|
1842
|
+
* Default is FALSE
|
|
1843
|
+
* @param {boolean} [keepOriginalPermission=false] The file will be set as the permission from the entry if this is true.
|
|
1844
|
+
* Default is FALSE
|
|
1845
|
+
* @param {function} callback The callback will be executed when all entries are extracted successfully or any error is thrown.
|
|
1846
|
+
*/
|
|
1847
|
+
extractAllToAsync: function(u, S, l, p) {
|
|
1848
|
+
if (p = s(S, l, p), l = o(!1, l), S = o(!1, S), !p)
|
|
1849
|
+
return new Promise((O, x) => {
|
|
1850
|
+
this.extractAllToAsync(u, S, l, function(b) {
|
|
1851
|
+
b ? x(b) : O(this);
|
|
1852
|
+
});
|
|
1853
|
+
});
|
|
1854
|
+
if (!y) {
|
|
1855
|
+
p(t.Errors.NO_ZIP());
|
|
1856
|
+
return;
|
|
1857
|
+
}
|
|
1858
|
+
u = e.resolve(u);
|
|
1859
|
+
const w = (O) => C(u, e.normalize(E(O.entryName))), _ = (O, x) => new Error(O + ': "' + x + '"'), T = [], A = [];
|
|
1860
|
+
y.entries.forEach((O) => {
|
|
1861
|
+
O.isDirectory ? T.push(O) : A.push(O);
|
|
1862
|
+
});
|
|
1863
|
+
for (const O of T) {
|
|
1864
|
+
const x = w(O), b = l ? O.header.fileAttr : void 0;
|
|
1865
|
+
try {
|
|
1866
|
+
N.makeDir(x), b && N.fs.chmodSync(x, b), N.fs.utimesSync(x, O.header.time, O.header.time);
|
|
1867
|
+
} catch {
|
|
1868
|
+
p(_("Unable to create folder", x));
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
A.reverse().reduce(function(O, x) {
|
|
1872
|
+
return function(b) {
|
|
1873
|
+
if (b)
|
|
1874
|
+
O(b);
|
|
1875
|
+
else {
|
|
1876
|
+
const U = e.normalize(E(x.entryName)), B = C(u, U);
|
|
1877
|
+
x.getDataAsync(function(P, Z) {
|
|
1878
|
+
if (Z)
|
|
1879
|
+
O(Z);
|
|
1880
|
+
else if (!P)
|
|
1881
|
+
O(t.Errors.CANT_EXTRACT_FILE());
|
|
1882
|
+
else {
|
|
1883
|
+
const ne = l ? x.header.fileAttr : void 0;
|
|
1884
|
+
N.writeFileToAsync(B, P, S, ne, function(q) {
|
|
1885
|
+
q || O(_("Unable to write file", B)), N.fs.utimes(B, x.header.time, x.header.time, function(V) {
|
|
1886
|
+
V ? O(_("Unable to set times", B)) : O();
|
|
1887
|
+
});
|
|
1888
|
+
});
|
|
1889
|
+
}
|
|
1890
|
+
});
|
|
1891
|
+
}
|
|
1892
|
+
};
|
|
1893
|
+
}, p)();
|
|
1894
|
+
},
|
|
1895
|
+
/**
|
|
1896
|
+
* Writes the newly created zip file to disk at the specified location or if a zip was opened and no ``targetFileName`` is provided, it will overwrite the opened zip
|
|
1897
|
+
*
|
|
1898
|
+
* @param {string} targetFileName
|
|
1899
|
+
* @param {function} callback
|
|
1900
|
+
*/
|
|
1901
|
+
writeZip: function(u, S) {
|
|
1902
|
+
if (arguments.length === 1 && typeof u == "function" && (S = u, u = ""), !u && g.filename && (u = g.filename), !!u) {
|
|
1903
|
+
var l = y.compressToBuffer();
|
|
1904
|
+
if (l) {
|
|
1905
|
+
var p = N.writeFileTo(u, l, !0);
|
|
1906
|
+
typeof S == "function" && S(p ? null : new Error("failed"), "");
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
},
|
|
1910
|
+
/**
|
|
1911
|
+
*
|
|
1912
|
+
* @param {string} targetFileName
|
|
1913
|
+
* @param {object} [props]
|
|
1914
|
+
* @param {boolean} [props.overwrite=true] If the file already exists at the target path, the file will be overwriten if this is true.
|
|
1915
|
+
* @param {boolean} [props.perm] The file will be set as the permission from the entry if this is true.
|
|
1916
|
+
|
|
1917
|
+
* @returns {Promise<void>}
|
|
1918
|
+
*/
|
|
1919
|
+
writeZipPromise: function(u, S) {
|
|
1920
|
+
const { overwrite: l, perm: p } = Object.assign({ overwrite: !0 }, S);
|
|
1921
|
+
return new Promise((w, _) => {
|
|
1922
|
+
!u && g.filename && (u = g.filename), u || _("ADM-ZIP: ZIP File Name Missing"), this.toBufferPromise().then((T) => {
|
|
1923
|
+
const A = (O) => O ? w(O) : _("ADM-ZIP: Wasn't able to write zip file");
|
|
1924
|
+
N.writeFileToAsync(u, T, l, p, A);
|
|
1925
|
+
}, _);
|
|
1926
|
+
});
|
|
1927
|
+
},
|
|
1928
|
+
/**
|
|
1929
|
+
* @returns {Promise<Buffer>} A promise to the Buffer.
|
|
1930
|
+
*/
|
|
1931
|
+
toBufferPromise: function() {
|
|
1932
|
+
return new Promise((u, S) => {
|
|
1933
|
+
y.toAsyncBuffer(u, S);
|
|
1934
|
+
});
|
|
1935
|
+
},
|
|
1936
|
+
/**
|
|
1937
|
+
* Returns the content of the entire zip file as a Buffer object
|
|
1938
|
+
*
|
|
1939
|
+
* @prop {function} [onSuccess]
|
|
1940
|
+
* @prop {function} [onFail]
|
|
1941
|
+
* @prop {function} [onItemStart]
|
|
1942
|
+
* @prop {function} [onItemEnd]
|
|
1943
|
+
* @returns {Buffer}
|
|
1944
|
+
*/
|
|
1945
|
+
toBuffer: function(u, S, l, p) {
|
|
1946
|
+
return typeof u == "function" ? (y.toAsyncBuffer(u, S, l, p), null) : y.compressToBuffer();
|
|
1947
|
+
}
|
|
1948
|
+
};
|
|
1949
|
+
}, Be;
|
|
1950
|
+
}
|
|
1951
|
+
var gn = yn();
|
|
1952
|
+
const Sn = /* @__PURE__ */ rn(gn);
|
|
1953
|
+
function Ft(t, e) {
|
|
1954
|
+
return function() {
|
|
1955
|
+
return t.apply(e, arguments);
|
|
1956
|
+
};
|
|
1957
|
+
}
|
|
1958
|
+
const { toString: wn } = Object.prototype, { getPrototypeOf: Ge } = Object, { iterator: ge, toStringTag: xt } = Symbol, Se = /* @__PURE__ */ ((t) => (e) => {
|
|
1959
|
+
const n = wn.call(e);
|
|
1960
|
+
return t[n] || (t[n] = n.slice(8, -1).toLowerCase());
|
|
1961
|
+
})(/* @__PURE__ */ Object.create(null)), k = (t) => (t = t.toLowerCase(), (e) => Se(e) === t), we = (t) => (e) => typeof e === t, { isArray: ee } = Array, Q = we("undefined");
|
|
1962
|
+
function ae(t) {
|
|
1963
|
+
return t !== null && !Q(t) && t.constructor !== null && !Q(t.constructor) && j(t.constructor.isBuffer) && t.constructor.isBuffer(t);
|
|
1964
|
+
}
|
|
1965
|
+
const bt = k("ArrayBuffer");
|
|
1966
|
+
function Cn(t) {
|
|
1967
|
+
let e;
|
|
1968
|
+
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && bt(t.buffer), e;
|
|
1969
|
+
}
|
|
1970
|
+
const Nn = we("string"), j = we("function"), Ut = we("number"), ce = (t) => t !== null && typeof t == "object", Ln = (t) => t === !0 || t === !1, Ee = (t) => {
|
|
1971
|
+
if (Se(t) !== "object")
|
|
1972
|
+
return !1;
|
|
1973
|
+
const e = Ge(t);
|
|
1974
|
+
return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(xt in t) && !(ge in t);
|
|
1975
|
+
}, In = (t) => {
|
|
1976
|
+
if (!ce(t) || ae(t))
|
|
1977
|
+
return !1;
|
|
1978
|
+
try {
|
|
1979
|
+
return Object.keys(t).length === 0 && Object.getPrototypeOf(t) === Object.prototype;
|
|
1980
|
+
} catch {
|
|
1981
|
+
return !1;
|
|
1982
|
+
}
|
|
1983
|
+
}, On = k("Date"), Dn = k("File"), Rn = k("Blob"), _n = k("FileList"), Tn = (t) => ce(t) && j(t.pipe), An = (t) => {
|
|
1984
|
+
let e;
|
|
1985
|
+
return t && (typeof FormData == "function" && t instanceof FormData || j(t.append) && ((e = Se(t)) === "formdata" || // detect form-data instance
|
|
1986
|
+
e === "object" && j(t.toString) && t.toString() === "[object FormData]"));
|
|
1987
|
+
}, Fn = k("URLSearchParams"), [xn, bn, Un, Pn] = ["ReadableStream", "Request", "Response", "Headers"].map(k), Bn = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
1988
|
+
function fe(t, e, { allOwnKeys: n = !1 } = {}) {
|
|
1989
|
+
if (t === null || typeof t > "u")
|
|
1990
|
+
return;
|
|
1991
|
+
let r, o;
|
|
1992
|
+
if (typeof t != "object" && (t = [t]), ee(t))
|
|
1993
|
+
for (r = 0, o = t.length; r < o; r++)
|
|
1994
|
+
e.call(null, t[r], r, t);
|
|
1995
|
+
else {
|
|
1996
|
+
if (ae(t))
|
|
1997
|
+
return;
|
|
1998
|
+
const i = n ? Object.getOwnPropertyNames(t) : Object.keys(t), s = i.length;
|
|
1999
|
+
let c;
|
|
2000
|
+
for (r = 0; r < s; r++)
|
|
2001
|
+
c = i[r], e.call(null, t[c], c, t);
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
function Pt(t, e) {
|
|
2005
|
+
if (ae(t))
|
|
2006
|
+
return null;
|
|
2007
|
+
e = e.toLowerCase();
|
|
2008
|
+
const n = Object.keys(t);
|
|
2009
|
+
let r = n.length, o;
|
|
2010
|
+
for (; r-- > 0; )
|
|
2011
|
+
if (o = n[r], e === o.toLowerCase())
|
|
2012
|
+
return o;
|
|
2013
|
+
return null;
|
|
2014
|
+
}
|
|
2015
|
+
const X = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, Bt = (t) => !Q(t) && t !== X;
|
|
2016
|
+
function je() {
|
|
2017
|
+
const { caseless: t, skipUndefined: e } = Bt(this) && this || {}, n = {}, r = (o, i) => {
|
|
2018
|
+
const s = t && Pt(n, i) || i;
|
|
2019
|
+
Ee(n[s]) && Ee(o) ? n[s] = je(n[s], o) : Ee(o) ? n[s] = je({}, o) : ee(o) ? n[s] = o.slice() : (!e || !Q(o)) && (n[s] = o);
|
|
2020
|
+
};
|
|
2021
|
+
for (let o = 0, i = arguments.length; o < i; o++)
|
|
2022
|
+
arguments[o] && fe(arguments[o], r);
|
|
2023
|
+
return n;
|
|
2024
|
+
}
|
|
2025
|
+
const vn = (t, e, n, { allOwnKeys: r } = {}) => (fe(e, (o, i) => {
|
|
2026
|
+
n && j(o) ? t[i] = Ft(o, n) : t[i] = o;
|
|
2027
|
+
}, { allOwnKeys: r }), t), Hn = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), Mn = (t, e, n, r) => {
|
|
2028
|
+
t.prototype = Object.create(e.prototype, r), t.prototype.constructor = t, Object.defineProperty(t, "super", {
|
|
2029
|
+
value: e.prototype
|
|
2030
|
+
}), n && Object.assign(t.prototype, n);
|
|
2031
|
+
}, jn = (t, e, n, r) => {
|
|
2032
|
+
let o, i, s;
|
|
2033
|
+
const c = {};
|
|
2034
|
+
if (e = e || {}, t == null) return e;
|
|
2035
|
+
do {
|
|
2036
|
+
for (o = Object.getOwnPropertyNames(t), i = o.length; i-- > 0; )
|
|
2037
|
+
s = o[i], (!r || r(s, t, e)) && !c[s] && (e[s] = t[s], c[s] = !0);
|
|
2038
|
+
t = n !== !1 && Ge(t);
|
|
2039
|
+
} while (t && (!n || n(t, e)) && t !== Object.prototype);
|
|
2040
|
+
return e;
|
|
2041
|
+
}, zn = (t, e, n) => {
|
|
2042
|
+
t = String(t), (n === void 0 || n > t.length) && (n = t.length), n -= e.length;
|
|
2043
|
+
const r = t.indexOf(e, n);
|
|
2044
|
+
return r !== -1 && r === n;
|
|
2045
|
+
}, Zn = (t) => {
|
|
2046
|
+
if (!t) return null;
|
|
2047
|
+
if (ee(t)) return t;
|
|
2048
|
+
let e = t.length;
|
|
2049
|
+
if (!Ut(e)) return null;
|
|
2050
|
+
const n = new Array(e);
|
|
2051
|
+
for (; e-- > 0; )
|
|
2052
|
+
n[e] = t[e];
|
|
2053
|
+
return n;
|
|
2054
|
+
}, qn = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && Ge(Uint8Array)), kn = (t, e) => {
|
|
2055
|
+
const r = (t && t[ge]).call(t);
|
|
2056
|
+
let o;
|
|
2057
|
+
for (; (o = r.next()) && !o.done; ) {
|
|
2058
|
+
const i = o.value;
|
|
2059
|
+
e.call(t, i[0], i[1]);
|
|
2060
|
+
}
|
|
2061
|
+
}, Gn = (t, e) => {
|
|
2062
|
+
let n;
|
|
2063
|
+
const r = [];
|
|
2064
|
+
for (; (n = t.exec(e)) !== null; )
|
|
2065
|
+
r.push(n);
|
|
2066
|
+
return r;
|
|
2067
|
+
}, Vn = k("HTMLFormElement"), $n = (t) => t.toLowerCase().replace(
|
|
2068
|
+
/[-_\s]([a-z\d])(\w*)/g,
|
|
2069
|
+
function(n, r, o) {
|
|
2070
|
+
return r.toUpperCase() + o;
|
|
2071
|
+
}
|
|
2072
|
+
), dt = (({ hasOwnProperty: t }) => (e, n) => t.call(e, n))(Object.prototype), Xn = k("RegExp"), vt = (t, e) => {
|
|
2073
|
+
const n = Object.getOwnPropertyDescriptors(t), r = {};
|
|
2074
|
+
fe(n, (o, i) => {
|
|
2075
|
+
let s;
|
|
2076
|
+
(s = e(o, i, t)) !== !1 && (r[i] = s || o);
|
|
2077
|
+
}), Object.defineProperties(t, r);
|
|
2078
|
+
}, Wn = (t) => {
|
|
2079
|
+
vt(t, (e, n) => {
|
|
2080
|
+
if (j(t) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
|
|
2081
|
+
return !1;
|
|
2082
|
+
const r = t[n];
|
|
2083
|
+
if (j(r)) {
|
|
2084
|
+
if (e.enumerable = !1, "writable" in e) {
|
|
2085
|
+
e.writable = !1;
|
|
2086
|
+
return;
|
|
2087
|
+
}
|
|
2088
|
+
e.set || (e.set = () => {
|
|
2089
|
+
throw Error("Can not rewrite read-only method '" + n + "'");
|
|
2090
|
+
});
|
|
2091
|
+
}
|
|
2092
|
+
});
|
|
2093
|
+
}, Jn = (t, e) => {
|
|
2094
|
+
const n = {}, r = (o) => {
|
|
2095
|
+
o.forEach((i) => {
|
|
2096
|
+
n[i] = !0;
|
|
2097
|
+
});
|
|
2098
|
+
};
|
|
2099
|
+
return ee(t) ? r(t) : r(String(t).split(e)), n;
|
|
2100
|
+
}, Kn = () => {
|
|
2101
|
+
}, Yn = (t, e) => t != null && Number.isFinite(t = +t) ? t : e;
|
|
2102
|
+
function Qn(t) {
|
|
2103
|
+
return !!(t && j(t.append) && t[xt] === "FormData" && t[ge]);
|
|
2104
|
+
}
|
|
2105
|
+
const er = (t) => {
|
|
2106
|
+
const e = new Array(10), n = (r, o) => {
|
|
2107
|
+
if (ce(r)) {
|
|
2108
|
+
if (e.indexOf(r) >= 0)
|
|
2109
|
+
return;
|
|
2110
|
+
if (ae(r))
|
|
2111
|
+
return r;
|
|
2112
|
+
if (!("toJSON" in r)) {
|
|
2113
|
+
e[o] = r;
|
|
2114
|
+
const i = ee(r) ? [] : {};
|
|
2115
|
+
return fe(r, (s, c) => {
|
|
2116
|
+
const a = n(s, o + 1);
|
|
2117
|
+
!Q(a) && (i[c] = a);
|
|
2118
|
+
}), e[o] = void 0, i;
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
return r;
|
|
2122
|
+
};
|
|
2123
|
+
return n(t, 0);
|
|
2124
|
+
}, tr = k("AsyncFunction"), nr = (t) => t && (ce(t) || j(t)) && j(t.then) && j(t.catch), Ht = ((t, e) => t ? setImmediate : e ? ((n, r) => (X.addEventListener("message", ({ source: o, data: i }) => {
|
|
2125
|
+
o === X && i === n && r.length && r.shift()();
|
|
2126
|
+
}, !1), (o) => {
|
|
2127
|
+
r.push(o), X.postMessage(n, "*");
|
|
2128
|
+
}))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))(
|
|
2129
|
+
typeof setImmediate == "function",
|
|
2130
|
+
j(X.postMessage)
|
|
2131
|
+
), rr = typeof queueMicrotask < "u" ? queueMicrotask.bind(X) : typeof process < "u" && process.nextTick || Ht, or = (t) => t != null && j(t[ge]), m = {
|
|
2132
|
+
isArray: ee,
|
|
2133
|
+
isArrayBuffer: bt,
|
|
2134
|
+
isBuffer: ae,
|
|
2135
|
+
isFormData: An,
|
|
2136
|
+
isArrayBufferView: Cn,
|
|
2137
|
+
isString: Nn,
|
|
2138
|
+
isNumber: Ut,
|
|
2139
|
+
isBoolean: Ln,
|
|
2140
|
+
isObject: ce,
|
|
2141
|
+
isPlainObject: Ee,
|
|
2142
|
+
isEmptyObject: In,
|
|
2143
|
+
isReadableStream: xn,
|
|
2144
|
+
isRequest: bn,
|
|
2145
|
+
isResponse: Un,
|
|
2146
|
+
isHeaders: Pn,
|
|
2147
|
+
isUndefined: Q,
|
|
2148
|
+
isDate: On,
|
|
2149
|
+
isFile: Dn,
|
|
2150
|
+
isBlob: Rn,
|
|
2151
|
+
isRegExp: Xn,
|
|
2152
|
+
isFunction: j,
|
|
2153
|
+
isStream: Tn,
|
|
2154
|
+
isURLSearchParams: Fn,
|
|
2155
|
+
isTypedArray: qn,
|
|
2156
|
+
isFileList: _n,
|
|
2157
|
+
forEach: fe,
|
|
2158
|
+
merge: je,
|
|
2159
|
+
extend: vn,
|
|
2160
|
+
trim: Bn,
|
|
2161
|
+
stripBOM: Hn,
|
|
2162
|
+
inherits: Mn,
|
|
2163
|
+
toFlatObject: jn,
|
|
2164
|
+
kindOf: Se,
|
|
2165
|
+
kindOfTest: k,
|
|
2166
|
+
endsWith: zn,
|
|
2167
|
+
toArray: Zn,
|
|
2168
|
+
forEachEntry: kn,
|
|
2169
|
+
matchAll: Gn,
|
|
2170
|
+
isHTMLForm: Vn,
|
|
2171
|
+
hasOwnProperty: dt,
|
|
2172
|
+
hasOwnProp: dt,
|
|
2173
|
+
// an alias to avoid ESLint no-prototype-builtins detection
|
|
2174
|
+
reduceDescriptors: vt,
|
|
2175
|
+
freezeMethods: Wn,
|
|
2176
|
+
toObjectSet: Jn,
|
|
2177
|
+
toCamelCase: $n,
|
|
2178
|
+
noop: Kn,
|
|
2179
|
+
toFiniteNumber: Yn,
|
|
2180
|
+
findKey: Pt,
|
|
2181
|
+
global: X,
|
|
2182
|
+
isContextDefined: Bt,
|
|
2183
|
+
isSpecCompliantForm: Qn,
|
|
2184
|
+
toJSONObject: er,
|
|
2185
|
+
isAsyncFn: tr,
|
|
2186
|
+
isThenable: nr,
|
|
2187
|
+
setImmediate: Ht,
|
|
2188
|
+
asap: rr,
|
|
2189
|
+
isIterable: or
|
|
2190
|
+
};
|
|
2191
|
+
function F(t, e, n, r, o) {
|
|
2192
|
+
Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = t, this.name = "AxiosError", e && (this.code = e), n && (this.config = n), r && (this.request = r), o && (this.response = o, this.status = o.status ? o.status : null);
|
|
2193
|
+
}
|
|
2194
|
+
m.inherits(F, Error, {
|
|
2195
|
+
toJSON: function() {
|
|
2196
|
+
return {
|
|
2197
|
+
// Standard
|
|
2198
|
+
message: this.message,
|
|
2199
|
+
name: this.name,
|
|
2200
|
+
// Microsoft
|
|
2201
|
+
description: this.description,
|
|
2202
|
+
number: this.number,
|
|
2203
|
+
// Mozilla
|
|
2204
|
+
fileName: this.fileName,
|
|
2205
|
+
lineNumber: this.lineNumber,
|
|
2206
|
+
columnNumber: this.columnNumber,
|
|
2207
|
+
stack: this.stack,
|
|
2208
|
+
// Axios
|
|
2209
|
+
config: m.toJSONObject(this.config),
|
|
2210
|
+
code: this.code,
|
|
2211
|
+
status: this.status
|
|
2212
|
+
};
|
|
2213
|
+
}
|
|
2214
|
+
});
|
|
2215
|
+
const Mt = F.prototype, jt = {};
|
|
2216
|
+
[
|
|
2217
|
+
"ERR_BAD_OPTION_VALUE",
|
|
2218
|
+
"ERR_BAD_OPTION",
|
|
2219
|
+
"ECONNABORTED",
|
|
2220
|
+
"ETIMEDOUT",
|
|
2221
|
+
"ERR_NETWORK",
|
|
2222
|
+
"ERR_FR_TOO_MANY_REDIRECTS",
|
|
2223
|
+
"ERR_DEPRECATED",
|
|
2224
|
+
"ERR_BAD_RESPONSE",
|
|
2225
|
+
"ERR_BAD_REQUEST",
|
|
2226
|
+
"ERR_CANCELED",
|
|
2227
|
+
"ERR_NOT_SUPPORT",
|
|
2228
|
+
"ERR_INVALID_URL"
|
|
2229
|
+
// eslint-disable-next-line func-names
|
|
2230
|
+
].forEach((t) => {
|
|
2231
|
+
jt[t] = { value: t };
|
|
2232
|
+
});
|
|
2233
|
+
Object.defineProperties(F, jt);
|
|
2234
|
+
Object.defineProperty(Mt, "isAxiosError", { value: !0 });
|
|
2235
|
+
F.from = (t, e, n, r, o, i) => {
|
|
2236
|
+
const s = Object.create(Mt);
|
|
2237
|
+
m.toFlatObject(t, s, function(d) {
|
|
2238
|
+
return d !== Error.prototype;
|
|
2239
|
+
}, (f) => f !== "isAxiosError");
|
|
2240
|
+
const c = t && t.message ? t.message : "Error", a = e == null && t ? t.code : e;
|
|
2241
|
+
return F.call(s, c, a, n, r, o), t && s.cause == null && Object.defineProperty(s, "cause", { value: t, configurable: !0 }), s.name = t && t.name || "Error", i && Object.assign(s, i), s;
|
|
2242
|
+
};
|
|
2243
|
+
const sr = null;
|
|
2244
|
+
function ze(t) {
|
|
2245
|
+
return m.isPlainObject(t) || m.isArray(t);
|
|
2246
|
+
}
|
|
2247
|
+
function zt(t) {
|
|
2248
|
+
return m.endsWith(t, "[]") ? t.slice(0, -2) : t;
|
|
2249
|
+
}
|
|
2250
|
+
function ht(t, e, n) {
|
|
2251
|
+
return t ? t.concat(e).map(function(o, i) {
|
|
2252
|
+
return o = zt(o), !n && i ? "[" + o + "]" : o;
|
|
2253
|
+
}).join(n ? "." : "") : e;
|
|
2254
|
+
}
|
|
2255
|
+
function ir(t) {
|
|
2256
|
+
return m.isArray(t) && !t.some(ze);
|
|
2257
|
+
}
|
|
2258
|
+
const ar = m.toFlatObject(m, {}, null, function(e) {
|
|
2259
|
+
return /^is[A-Z]/.test(e);
|
|
2260
|
+
});
|
|
2261
|
+
function Ce(t, e, n) {
|
|
2262
|
+
if (!m.isObject(t))
|
|
2263
|
+
throw new TypeError("target must be an object");
|
|
2264
|
+
e = e || new FormData(), n = m.toFlatObject(n, {
|
|
2265
|
+
metaTokens: !0,
|
|
2266
|
+
dots: !1,
|
|
2267
|
+
indexes: !1
|
|
2268
|
+
}, !1, function(C, L) {
|
|
2269
|
+
return !m.isUndefined(L[C]);
|
|
2270
|
+
});
|
|
2271
|
+
const r = n.metaTokens, o = n.visitor || d, i = n.dots, s = n.indexes, a = (n.Blob || typeof Blob < "u" && Blob) && m.isSpecCompliantForm(e);
|
|
2272
|
+
if (!m.isFunction(o))
|
|
2273
|
+
throw new TypeError("visitor must be a function");
|
|
2274
|
+
function f(E) {
|
|
2275
|
+
if (E === null) return "";
|
|
2276
|
+
if (m.isDate(E))
|
|
2277
|
+
return E.toISOString();
|
|
2278
|
+
if (m.isBoolean(E))
|
|
2279
|
+
return E.toString();
|
|
2280
|
+
if (!a && m.isBlob(E))
|
|
2281
|
+
throw new F("Blob is not supported. Use a Buffer instead.");
|
|
2282
|
+
return m.isArrayBuffer(E) || m.isTypedArray(E) ? a && typeof Blob == "function" ? new Blob([E]) : Buffer.from(E) : E;
|
|
2283
|
+
}
|
|
2284
|
+
function d(E, C, L) {
|
|
2285
|
+
let D = E;
|
|
2286
|
+
if (E && !L && typeof E == "object") {
|
|
2287
|
+
if (m.endsWith(C, "{}"))
|
|
2288
|
+
C = r ? C : C.slice(0, -2), E = JSON.stringify(E);
|
|
2289
|
+
else if (m.isArray(E) && ir(E) || (m.isFileList(E) || m.endsWith(C, "[]")) && (D = m.toArray(E)))
|
|
2290
|
+
return C = zt(C), D.forEach(function(R, h) {
|
|
2291
|
+
!(m.isUndefined(R) || R === null) && e.append(
|
|
2292
|
+
// eslint-disable-next-line no-nested-ternary
|
|
2293
|
+
s === !0 ? ht([C], h, i) : s === null ? C : C + "[]",
|
|
2294
|
+
f(R)
|
|
2295
|
+
);
|
|
2296
|
+
}), !1;
|
|
2297
|
+
}
|
|
2298
|
+
return ze(E) ? !0 : (e.append(ht(L, C, i), f(E)), !1);
|
|
2299
|
+
}
|
|
2300
|
+
const g = [], N = Object.assign(ar, {
|
|
2301
|
+
defaultVisitor: d,
|
|
2302
|
+
convertValue: f,
|
|
2303
|
+
isVisitable: ze
|
|
2304
|
+
});
|
|
2305
|
+
function y(E, C) {
|
|
2306
|
+
if (!m.isUndefined(E)) {
|
|
2307
|
+
if (g.indexOf(E) !== -1)
|
|
2308
|
+
throw Error("Circular reference detected in " + C.join("."));
|
|
2309
|
+
g.push(E), m.forEach(E, function(D, I) {
|
|
2310
|
+
(!(m.isUndefined(D) || D === null) && o.call(
|
|
2311
|
+
e,
|
|
2312
|
+
D,
|
|
2313
|
+
m.isString(I) ? I.trim() : I,
|
|
2314
|
+
C,
|
|
2315
|
+
N
|
|
2316
|
+
)) === !0 && y(D, C ? C.concat(I) : [I]);
|
|
2317
|
+
}), g.pop();
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
if (!m.isObject(t))
|
|
2321
|
+
throw new TypeError("data must be an object");
|
|
2322
|
+
return y(t), e;
|
|
2323
|
+
}
|
|
2324
|
+
function Et(t) {
|
|
2325
|
+
const e = {
|
|
2326
|
+
"!": "%21",
|
|
2327
|
+
"'": "%27",
|
|
2328
|
+
"(": "%28",
|
|
2329
|
+
")": "%29",
|
|
2330
|
+
"~": "%7E",
|
|
2331
|
+
"%20": "+",
|
|
2332
|
+
"%00": "\0"
|
|
2333
|
+
};
|
|
2334
|
+
return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g, function(r) {
|
|
2335
|
+
return e[r];
|
|
2336
|
+
});
|
|
2337
|
+
}
|
|
2338
|
+
function Ve(t, e) {
|
|
2339
|
+
this._pairs = [], t && Ce(t, this, e);
|
|
2340
|
+
}
|
|
2341
|
+
const Zt = Ve.prototype;
|
|
2342
|
+
Zt.append = function(e, n) {
|
|
2343
|
+
this._pairs.push([e, n]);
|
|
2344
|
+
};
|
|
2345
|
+
Zt.toString = function(e) {
|
|
2346
|
+
const n = e ? function(r) {
|
|
2347
|
+
return e.call(this, r, Et);
|
|
2348
|
+
} : Et;
|
|
2349
|
+
return this._pairs.map(function(o) {
|
|
2350
|
+
return n(o[0]) + "=" + n(o[1]);
|
|
2351
|
+
}, "").join("&");
|
|
2352
|
+
};
|
|
2353
|
+
function cr(t) {
|
|
2354
|
+
return encodeURIComponent(t).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
|
|
2355
|
+
}
|
|
2356
|
+
function qt(t, e, n) {
|
|
2357
|
+
if (!e)
|
|
2358
|
+
return t;
|
|
2359
|
+
const r = n && n.encode || cr;
|
|
2360
|
+
m.isFunction(n) && (n = {
|
|
2361
|
+
serialize: n
|
|
2362
|
+
});
|
|
2363
|
+
const o = n && n.serialize;
|
|
2364
|
+
let i;
|
|
2365
|
+
if (o ? i = o(e, n) : i = m.isURLSearchParams(e) ? e.toString() : new Ve(e, n).toString(r), i) {
|
|
2366
|
+
const s = t.indexOf("#");
|
|
2367
|
+
s !== -1 && (t = t.slice(0, s)), t += (t.indexOf("?") === -1 ? "?" : "&") + i;
|
|
2368
|
+
}
|
|
2369
|
+
return t;
|
|
2370
|
+
}
|
|
2371
|
+
class mt {
|
|
2372
|
+
constructor() {
|
|
2373
|
+
this.handlers = [];
|
|
2374
|
+
}
|
|
2375
|
+
/**
|
|
2376
|
+
* Add a new interceptor to the stack
|
|
2377
|
+
*
|
|
2378
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
2379
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
2380
|
+
*
|
|
2381
|
+
* @return {Number} An ID used to remove interceptor later
|
|
2382
|
+
*/
|
|
2383
|
+
use(e, n, r) {
|
|
2384
|
+
return this.handlers.push({
|
|
2385
|
+
fulfilled: e,
|
|
2386
|
+
rejected: n,
|
|
2387
|
+
synchronous: r ? r.synchronous : !1,
|
|
2388
|
+
runWhen: r ? r.runWhen : null
|
|
2389
|
+
}), this.handlers.length - 1;
|
|
2390
|
+
}
|
|
2391
|
+
/**
|
|
2392
|
+
* Remove an interceptor from the stack
|
|
2393
|
+
*
|
|
2394
|
+
* @param {Number} id The ID that was returned by `use`
|
|
2395
|
+
*
|
|
2396
|
+
* @returns {void}
|
|
2397
|
+
*/
|
|
2398
|
+
eject(e) {
|
|
2399
|
+
this.handlers[e] && (this.handlers[e] = null);
|
|
2400
|
+
}
|
|
2401
|
+
/**
|
|
2402
|
+
* Clear all interceptors from the stack
|
|
2403
|
+
*
|
|
2404
|
+
* @returns {void}
|
|
2405
|
+
*/
|
|
2406
|
+
clear() {
|
|
2407
|
+
this.handlers && (this.handlers = []);
|
|
2408
|
+
}
|
|
2409
|
+
/**
|
|
2410
|
+
* Iterate over all the registered interceptors
|
|
2411
|
+
*
|
|
2412
|
+
* This method is particularly useful for skipping over any
|
|
2413
|
+
* interceptors that may have become `null` calling `eject`.
|
|
2414
|
+
*
|
|
2415
|
+
* @param {Function} fn The function to call for each interceptor
|
|
2416
|
+
*
|
|
2417
|
+
* @returns {void}
|
|
2418
|
+
*/
|
|
2419
|
+
forEach(e) {
|
|
2420
|
+
m.forEach(this.handlers, function(r) {
|
|
2421
|
+
r !== null && e(r);
|
|
2422
|
+
});
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
const kt = {
|
|
2426
|
+
silentJSONParsing: !0,
|
|
2427
|
+
forcedJSONParsing: !0,
|
|
2428
|
+
clarifyTimeoutError: !1
|
|
2429
|
+
}, fr = typeof URLSearchParams < "u" ? URLSearchParams : Ve, ur = typeof FormData < "u" ? FormData : null, lr = typeof Blob < "u" ? Blob : null, dr = {
|
|
2430
|
+
isBrowser: !0,
|
|
2431
|
+
classes: {
|
|
2432
|
+
URLSearchParams: fr,
|
|
2433
|
+
FormData: ur,
|
|
2434
|
+
Blob: lr
|
|
2435
|
+
},
|
|
2436
|
+
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
2437
|
+
}, $e = typeof window < "u" && typeof document < "u", Ze = typeof navigator == "object" && navigator || void 0, hr = $e && (!Ze || ["ReactNative", "NativeScript", "NS"].indexOf(Ze.product) < 0), Er = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
|
|
2438
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", mr = $e && window.location.href || "http://localhost", pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2439
|
+
__proto__: null,
|
|
2440
|
+
hasBrowserEnv: $e,
|
|
2441
|
+
hasStandardBrowserEnv: hr,
|
|
2442
|
+
hasStandardBrowserWebWorkerEnv: Er,
|
|
2443
|
+
navigator: Ze,
|
|
2444
|
+
origin: mr
|
|
2445
|
+
}, Symbol.toStringTag, { value: "Module" })), M = {
|
|
2446
|
+
...pr,
|
|
2447
|
+
...dr
|
|
2448
|
+
};
|
|
2449
|
+
function yr(t, e) {
|
|
2450
|
+
return Ce(t, new M.classes.URLSearchParams(), {
|
|
2451
|
+
visitor: function(n, r, o, i) {
|
|
2452
|
+
return M.isNode && m.isBuffer(n) ? (this.append(r, n.toString("base64")), !1) : i.defaultVisitor.apply(this, arguments);
|
|
2453
|
+
},
|
|
2454
|
+
...e
|
|
2455
|
+
});
|
|
2456
|
+
}
|
|
2457
|
+
function gr(t) {
|
|
2458
|
+
return m.matchAll(/\w+|\[(\w*)]/g, t).map((e) => e[0] === "[]" ? "" : e[1] || e[0]);
|
|
2459
|
+
}
|
|
2460
|
+
function Sr(t) {
|
|
2461
|
+
const e = {}, n = Object.keys(t);
|
|
2462
|
+
let r;
|
|
2463
|
+
const o = n.length;
|
|
2464
|
+
let i;
|
|
2465
|
+
for (r = 0; r < o; r++)
|
|
2466
|
+
i = n[r], e[i] = t[i];
|
|
2467
|
+
return e;
|
|
2468
|
+
}
|
|
2469
|
+
function Gt(t) {
|
|
2470
|
+
function e(n, r, o, i) {
|
|
2471
|
+
let s = n[i++];
|
|
2472
|
+
if (s === "__proto__") return !0;
|
|
2473
|
+
const c = Number.isFinite(+s), a = i >= n.length;
|
|
2474
|
+
return s = !s && m.isArray(o) ? o.length : s, a ? (m.hasOwnProp(o, s) ? o[s] = [o[s], r] : o[s] = r, !c) : ((!o[s] || !m.isObject(o[s])) && (o[s] = []), e(n, r, o[s], i) && m.isArray(o[s]) && (o[s] = Sr(o[s])), !c);
|
|
2475
|
+
}
|
|
2476
|
+
if (m.isFormData(t) && m.isFunction(t.entries)) {
|
|
2477
|
+
const n = {};
|
|
2478
|
+
return m.forEachEntry(t, (r, o) => {
|
|
2479
|
+
e(gr(r), o, n, 0);
|
|
2480
|
+
}), n;
|
|
2481
|
+
}
|
|
2482
|
+
return null;
|
|
2483
|
+
}
|
|
2484
|
+
function wr(t, e, n) {
|
|
2485
|
+
if (m.isString(t))
|
|
2486
|
+
try {
|
|
2487
|
+
return (e || JSON.parse)(t), m.trim(t);
|
|
2488
|
+
} catch (r) {
|
|
2489
|
+
if (r.name !== "SyntaxError")
|
|
2490
|
+
throw r;
|
|
2491
|
+
}
|
|
2492
|
+
return (n || JSON.stringify)(t);
|
|
2493
|
+
}
|
|
2494
|
+
const ue = {
|
|
2495
|
+
transitional: kt,
|
|
2496
|
+
adapter: ["xhr", "http", "fetch"],
|
|
2497
|
+
transformRequest: [function(e, n) {
|
|
2498
|
+
const r = n.getContentType() || "", o = r.indexOf("application/json") > -1, i = m.isObject(e);
|
|
2499
|
+
if (i && m.isHTMLForm(e) && (e = new FormData(e)), m.isFormData(e))
|
|
2500
|
+
return o ? JSON.stringify(Gt(e)) : e;
|
|
2501
|
+
if (m.isArrayBuffer(e) || m.isBuffer(e) || m.isStream(e) || m.isFile(e) || m.isBlob(e) || m.isReadableStream(e))
|
|
2502
|
+
return e;
|
|
2503
|
+
if (m.isArrayBufferView(e))
|
|
2504
|
+
return e.buffer;
|
|
2505
|
+
if (m.isURLSearchParams(e))
|
|
2506
|
+
return n.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), e.toString();
|
|
2507
|
+
let c;
|
|
2508
|
+
if (i) {
|
|
2509
|
+
if (r.indexOf("application/x-www-form-urlencoded") > -1)
|
|
2510
|
+
return yr(e, this.formSerializer).toString();
|
|
2511
|
+
if ((c = m.isFileList(e)) || r.indexOf("multipart/form-data") > -1) {
|
|
2512
|
+
const a = this.env && this.env.FormData;
|
|
2513
|
+
return Ce(
|
|
2514
|
+
c ? { "files[]": e } : e,
|
|
2515
|
+
a && new a(),
|
|
2516
|
+
this.formSerializer
|
|
2517
|
+
);
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
return i || o ? (n.setContentType("application/json", !1), wr(e)) : e;
|
|
2521
|
+
}],
|
|
2522
|
+
transformResponse: [function(e) {
|
|
2523
|
+
const n = this.transitional || ue.transitional, r = n && n.forcedJSONParsing, o = this.responseType === "json";
|
|
2524
|
+
if (m.isResponse(e) || m.isReadableStream(e))
|
|
2525
|
+
return e;
|
|
2526
|
+
if (e && m.isString(e) && (r && !this.responseType || o)) {
|
|
2527
|
+
const s = !(n && n.silentJSONParsing) && o;
|
|
2528
|
+
try {
|
|
2529
|
+
return JSON.parse(e, this.parseReviver);
|
|
2530
|
+
} catch (c) {
|
|
2531
|
+
if (s)
|
|
2532
|
+
throw c.name === "SyntaxError" ? F.from(c, F.ERR_BAD_RESPONSE, this, null, this.response) : c;
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2535
|
+
return e;
|
|
2536
|
+
}],
|
|
2537
|
+
/**
|
|
2538
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
2539
|
+
* timeout is not created.
|
|
2540
|
+
*/
|
|
2541
|
+
timeout: 0,
|
|
2542
|
+
xsrfCookieName: "XSRF-TOKEN",
|
|
2543
|
+
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
2544
|
+
maxContentLength: -1,
|
|
2545
|
+
maxBodyLength: -1,
|
|
2546
|
+
env: {
|
|
2547
|
+
FormData: M.classes.FormData,
|
|
2548
|
+
Blob: M.classes.Blob
|
|
2549
|
+
},
|
|
2550
|
+
validateStatus: function(e) {
|
|
2551
|
+
return e >= 200 && e < 300;
|
|
2552
|
+
},
|
|
2553
|
+
headers: {
|
|
2554
|
+
common: {
|
|
2555
|
+
Accept: "application/json, text/plain, */*",
|
|
2556
|
+
"Content-Type": void 0
|
|
2557
|
+
}
|
|
2558
|
+
}
|
|
2559
|
+
};
|
|
2560
|
+
m.forEach(["delete", "get", "head", "post", "put", "patch"], (t) => {
|
|
2561
|
+
ue.headers[t] = {};
|
|
2562
|
+
});
|
|
2563
|
+
const Cr = m.toObjectSet([
|
|
2564
|
+
"age",
|
|
2565
|
+
"authorization",
|
|
2566
|
+
"content-length",
|
|
2567
|
+
"content-type",
|
|
2568
|
+
"etag",
|
|
2569
|
+
"expires",
|
|
2570
|
+
"from",
|
|
2571
|
+
"host",
|
|
2572
|
+
"if-modified-since",
|
|
2573
|
+
"if-unmodified-since",
|
|
2574
|
+
"last-modified",
|
|
2575
|
+
"location",
|
|
2576
|
+
"max-forwards",
|
|
2577
|
+
"proxy-authorization",
|
|
2578
|
+
"referer",
|
|
2579
|
+
"retry-after",
|
|
2580
|
+
"user-agent"
|
|
2581
|
+
]), Nr = (t) => {
|
|
2582
|
+
const e = {};
|
|
2583
|
+
let n, r, o;
|
|
2584
|
+
return t && t.split(`
|
|
2585
|
+
`).forEach(function(s) {
|
|
2586
|
+
o = s.indexOf(":"), n = s.substring(0, o).trim().toLowerCase(), r = s.substring(o + 1).trim(), !(!n || e[n] && Cr[n]) && (n === "set-cookie" ? e[n] ? e[n].push(r) : e[n] = [r] : e[n] = e[n] ? e[n] + ", " + r : r);
|
|
2587
|
+
}), e;
|
|
2588
|
+
}, pt = /* @__PURE__ */ Symbol("internals");
|
|
2589
|
+
function oe(t) {
|
|
2590
|
+
return t && String(t).trim().toLowerCase();
|
|
2591
|
+
}
|
|
2592
|
+
function me(t) {
|
|
2593
|
+
return t === !1 || t == null ? t : m.isArray(t) ? t.map(me) : String(t);
|
|
2594
|
+
}
|
|
2595
|
+
function Lr(t) {
|
|
2596
|
+
const e = /* @__PURE__ */ Object.create(null), n = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
2597
|
+
let r;
|
|
2598
|
+
for (; r = n.exec(t); )
|
|
2599
|
+
e[r[1]] = r[2];
|
|
2600
|
+
return e;
|
|
2601
|
+
}
|
|
2602
|
+
const Ir = (t) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());
|
|
2603
|
+
function ve(t, e, n, r, o) {
|
|
2604
|
+
if (m.isFunction(r))
|
|
2605
|
+
return r.call(this, e, n);
|
|
2606
|
+
if (o && (e = n), !!m.isString(e)) {
|
|
2607
|
+
if (m.isString(r))
|
|
2608
|
+
return e.indexOf(r) !== -1;
|
|
2609
|
+
if (m.isRegExp(r))
|
|
2610
|
+
return r.test(e);
|
|
2611
|
+
}
|
|
2612
|
+
}
|
|
2613
|
+
function Or(t) {
|
|
2614
|
+
return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, n, r) => n.toUpperCase() + r);
|
|
2615
|
+
}
|
|
2616
|
+
function Dr(t, e) {
|
|
2617
|
+
const n = m.toCamelCase(" " + e);
|
|
2618
|
+
["get", "set", "has"].forEach((r) => {
|
|
2619
|
+
Object.defineProperty(t, r + n, {
|
|
2620
|
+
value: function(o, i, s) {
|
|
2621
|
+
return this[r].call(this, e, o, i, s);
|
|
2622
|
+
},
|
|
2623
|
+
configurable: !0
|
|
2624
|
+
});
|
|
2625
|
+
});
|
|
2626
|
+
}
|
|
2627
|
+
let z = class {
|
|
2628
|
+
constructor(e) {
|
|
2629
|
+
e && this.set(e);
|
|
2630
|
+
}
|
|
2631
|
+
set(e, n, r) {
|
|
2632
|
+
const o = this;
|
|
2633
|
+
function i(c, a, f) {
|
|
2634
|
+
const d = oe(a);
|
|
2635
|
+
if (!d)
|
|
2636
|
+
throw new Error("header name must be a non-empty string");
|
|
2637
|
+
const g = m.findKey(o, d);
|
|
2638
|
+
(!g || o[g] === void 0 || f === !0 || f === void 0 && o[g] !== !1) && (o[g || a] = me(c));
|
|
2639
|
+
}
|
|
2640
|
+
const s = (c, a) => m.forEach(c, (f, d) => i(f, d, a));
|
|
2641
|
+
if (m.isPlainObject(e) || e instanceof this.constructor)
|
|
2642
|
+
s(e, n);
|
|
2643
|
+
else if (m.isString(e) && (e = e.trim()) && !Ir(e))
|
|
2644
|
+
s(Nr(e), n);
|
|
2645
|
+
else if (m.isObject(e) && m.isIterable(e)) {
|
|
2646
|
+
let c = {}, a, f;
|
|
2647
|
+
for (const d of e) {
|
|
2648
|
+
if (!m.isArray(d))
|
|
2649
|
+
throw TypeError("Object iterator must return a key-value pair");
|
|
2650
|
+
c[f = d[0]] = (a = c[f]) ? m.isArray(a) ? [...a, d[1]] : [a, d[1]] : d[1];
|
|
2651
|
+
}
|
|
2652
|
+
s(c, n);
|
|
2653
|
+
} else
|
|
2654
|
+
e != null && i(n, e, r);
|
|
2655
|
+
return this;
|
|
2656
|
+
}
|
|
2657
|
+
get(e, n) {
|
|
2658
|
+
if (e = oe(e), e) {
|
|
2659
|
+
const r = m.findKey(this, e);
|
|
2660
|
+
if (r) {
|
|
2661
|
+
const o = this[r];
|
|
2662
|
+
if (!n)
|
|
2663
|
+
return o;
|
|
2664
|
+
if (n === !0)
|
|
2665
|
+
return Lr(o);
|
|
2666
|
+
if (m.isFunction(n))
|
|
2667
|
+
return n.call(this, o, r);
|
|
2668
|
+
if (m.isRegExp(n))
|
|
2669
|
+
return n.exec(o);
|
|
2670
|
+
throw new TypeError("parser must be boolean|regexp|function");
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
}
|
|
2674
|
+
has(e, n) {
|
|
2675
|
+
if (e = oe(e), e) {
|
|
2676
|
+
const r = m.findKey(this, e);
|
|
2677
|
+
return !!(r && this[r] !== void 0 && (!n || ve(this, this[r], r, n)));
|
|
2678
|
+
}
|
|
2679
|
+
return !1;
|
|
2680
|
+
}
|
|
2681
|
+
delete(e, n) {
|
|
2682
|
+
const r = this;
|
|
2683
|
+
let o = !1;
|
|
2684
|
+
function i(s) {
|
|
2685
|
+
if (s = oe(s), s) {
|
|
2686
|
+
const c = m.findKey(r, s);
|
|
2687
|
+
c && (!n || ve(r, r[c], c, n)) && (delete r[c], o = !0);
|
|
2688
|
+
}
|
|
2689
|
+
}
|
|
2690
|
+
return m.isArray(e) ? e.forEach(i) : i(e), o;
|
|
2691
|
+
}
|
|
2692
|
+
clear(e) {
|
|
2693
|
+
const n = Object.keys(this);
|
|
2694
|
+
let r = n.length, o = !1;
|
|
2695
|
+
for (; r--; ) {
|
|
2696
|
+
const i = n[r];
|
|
2697
|
+
(!e || ve(this, this[i], i, e, !0)) && (delete this[i], o = !0);
|
|
2698
|
+
}
|
|
2699
|
+
return o;
|
|
2700
|
+
}
|
|
2701
|
+
normalize(e) {
|
|
2702
|
+
const n = this, r = {};
|
|
2703
|
+
return m.forEach(this, (o, i) => {
|
|
2704
|
+
const s = m.findKey(r, i);
|
|
2705
|
+
if (s) {
|
|
2706
|
+
n[s] = me(o), delete n[i];
|
|
2707
|
+
return;
|
|
2708
|
+
}
|
|
2709
|
+
const c = e ? Or(i) : String(i).trim();
|
|
2710
|
+
c !== i && delete n[i], n[c] = me(o), r[c] = !0;
|
|
2711
|
+
}), this;
|
|
2712
|
+
}
|
|
2713
|
+
concat(...e) {
|
|
2714
|
+
return this.constructor.concat(this, ...e);
|
|
2715
|
+
}
|
|
2716
|
+
toJSON(e) {
|
|
2717
|
+
const n = /* @__PURE__ */ Object.create(null);
|
|
2718
|
+
return m.forEach(this, (r, o) => {
|
|
2719
|
+
r != null && r !== !1 && (n[o] = e && m.isArray(r) ? r.join(", ") : r);
|
|
2720
|
+
}), n;
|
|
2721
|
+
}
|
|
2722
|
+
[Symbol.iterator]() {
|
|
2723
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
2724
|
+
}
|
|
2725
|
+
toString() {
|
|
2726
|
+
return Object.entries(this.toJSON()).map(([e, n]) => e + ": " + n).join(`
|
|
2727
|
+
`);
|
|
2728
|
+
}
|
|
2729
|
+
getSetCookie() {
|
|
2730
|
+
return this.get("set-cookie") || [];
|
|
2731
|
+
}
|
|
2732
|
+
get [Symbol.toStringTag]() {
|
|
2733
|
+
return "AxiosHeaders";
|
|
2734
|
+
}
|
|
2735
|
+
static from(e) {
|
|
2736
|
+
return e instanceof this ? e : new this(e);
|
|
2737
|
+
}
|
|
2738
|
+
static concat(e, ...n) {
|
|
2739
|
+
const r = new this(e);
|
|
2740
|
+
return n.forEach((o) => r.set(o)), r;
|
|
2741
|
+
}
|
|
2742
|
+
static accessor(e) {
|
|
2743
|
+
const r = (this[pt] = this[pt] = {
|
|
2744
|
+
accessors: {}
|
|
2745
|
+
}).accessors, o = this.prototype;
|
|
2746
|
+
function i(s) {
|
|
2747
|
+
const c = oe(s);
|
|
2748
|
+
r[c] || (Dr(o, s), r[c] = !0);
|
|
2749
|
+
}
|
|
2750
|
+
return m.isArray(e) ? e.forEach(i) : i(e), this;
|
|
2751
|
+
}
|
|
2752
|
+
};
|
|
2753
|
+
z.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
2754
|
+
m.reduceDescriptors(z.prototype, ({ value: t }, e) => {
|
|
2755
|
+
let n = e[0].toUpperCase() + e.slice(1);
|
|
2756
|
+
return {
|
|
2757
|
+
get: () => t,
|
|
2758
|
+
set(r) {
|
|
2759
|
+
this[n] = r;
|
|
2760
|
+
}
|
|
2761
|
+
};
|
|
2762
|
+
});
|
|
2763
|
+
m.freezeMethods(z);
|
|
2764
|
+
function He(t, e) {
|
|
2765
|
+
const n = this || ue, r = e || n, o = z.from(r.headers);
|
|
2766
|
+
let i = r.data;
|
|
2767
|
+
return m.forEach(t, function(c) {
|
|
2768
|
+
i = c.call(n, i, o.normalize(), e ? e.status : void 0);
|
|
2769
|
+
}), o.normalize(), i;
|
|
2770
|
+
}
|
|
2771
|
+
function Vt(t) {
|
|
2772
|
+
return !!(t && t.__CANCEL__);
|
|
2773
|
+
}
|
|
2774
|
+
function te(t, e, n) {
|
|
2775
|
+
F.call(this, t ?? "canceled", F.ERR_CANCELED, e, n), this.name = "CanceledError";
|
|
2776
|
+
}
|
|
2777
|
+
m.inherits(te, F, {
|
|
2778
|
+
__CANCEL__: !0
|
|
2779
|
+
});
|
|
2780
|
+
function $t(t, e, n) {
|
|
2781
|
+
const r = n.config.validateStatus;
|
|
2782
|
+
!n.status || !r || r(n.status) ? t(n) : e(new F(
|
|
2783
|
+
"Request failed with status code " + n.status,
|
|
2784
|
+
[F.ERR_BAD_REQUEST, F.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
|
|
2785
|
+
n.config,
|
|
2786
|
+
n.request,
|
|
2787
|
+
n
|
|
2788
|
+
));
|
|
2789
|
+
}
|
|
2790
|
+
function Rr(t) {
|
|
2791
|
+
const e = /^([-+\w]{1,25})(:?\/\/|:)/.exec(t);
|
|
2792
|
+
return e && e[1] || "";
|
|
2793
|
+
}
|
|
2794
|
+
function _r(t, e) {
|
|
2795
|
+
t = t || 10;
|
|
2796
|
+
const n = new Array(t), r = new Array(t);
|
|
2797
|
+
let o = 0, i = 0, s;
|
|
2798
|
+
return e = e !== void 0 ? e : 1e3, function(a) {
|
|
2799
|
+
const f = Date.now(), d = r[i];
|
|
2800
|
+
s || (s = f), n[o] = a, r[o] = f;
|
|
2801
|
+
let g = i, N = 0;
|
|
2802
|
+
for (; g !== o; )
|
|
2803
|
+
N += n[g++], g = g % t;
|
|
2804
|
+
if (o = (o + 1) % t, o === i && (i = (i + 1) % t), f - s < e)
|
|
2805
|
+
return;
|
|
2806
|
+
const y = d && f - d;
|
|
2807
|
+
return y ? Math.round(N * 1e3 / y) : void 0;
|
|
2808
|
+
};
|
|
2809
|
+
}
|
|
2810
|
+
function Tr(t, e) {
|
|
2811
|
+
let n = 0, r = 1e3 / e, o, i;
|
|
2812
|
+
const s = (f, d = Date.now()) => {
|
|
2813
|
+
n = d, o = null, i && (clearTimeout(i), i = null), t(...f);
|
|
2814
|
+
};
|
|
2815
|
+
return [(...f) => {
|
|
2816
|
+
const d = Date.now(), g = d - n;
|
|
2817
|
+
g >= r ? s(f, d) : (o = f, i || (i = setTimeout(() => {
|
|
2818
|
+
i = null, s(o);
|
|
2819
|
+
}, r - g)));
|
|
2820
|
+
}, () => o && s(o)];
|
|
2821
|
+
}
|
|
2822
|
+
const ye = (t, e, n = 3) => {
|
|
2823
|
+
let r = 0;
|
|
2824
|
+
const o = _r(50, 250);
|
|
2825
|
+
return Tr((i) => {
|
|
2826
|
+
const s = i.loaded, c = i.lengthComputable ? i.total : void 0, a = s - r, f = o(a), d = s <= c;
|
|
2827
|
+
r = s;
|
|
2828
|
+
const g = {
|
|
2829
|
+
loaded: s,
|
|
2830
|
+
total: c,
|
|
2831
|
+
progress: c ? s / c : void 0,
|
|
2832
|
+
bytes: a,
|
|
2833
|
+
rate: f || void 0,
|
|
2834
|
+
estimated: f && c && d ? (c - s) / f : void 0,
|
|
2835
|
+
event: i,
|
|
2836
|
+
lengthComputable: c != null,
|
|
2837
|
+
[e ? "download" : "upload"]: !0
|
|
2838
|
+
};
|
|
2839
|
+
t(g);
|
|
2840
|
+
}, n);
|
|
2841
|
+
}, yt = (t, e) => {
|
|
2842
|
+
const n = t != null;
|
|
2843
|
+
return [(r) => e[0]({
|
|
2844
|
+
lengthComputable: n,
|
|
2845
|
+
total: t,
|
|
2846
|
+
loaded: r
|
|
2847
|
+
}), e[1]];
|
|
2848
|
+
}, gt = (t) => (...e) => m.asap(() => t(...e)), Ar = M.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (n) => (n = new URL(n, M.origin), t.protocol === n.protocol && t.host === n.host && (e || t.port === n.port)))(
|
|
2849
|
+
new URL(M.origin),
|
|
2850
|
+
M.navigator && /(msie|trident)/i.test(M.navigator.userAgent)
|
|
2851
|
+
) : () => !0, Fr = M.hasStandardBrowserEnv ? (
|
|
2852
|
+
// Standard browser envs support document.cookie
|
|
2853
|
+
{
|
|
2854
|
+
write(t, e, n, r, o, i, s) {
|
|
2855
|
+
if (typeof document > "u") return;
|
|
2856
|
+
const c = [`${t}=${encodeURIComponent(e)}`];
|
|
2857
|
+
m.isNumber(n) && c.push(`expires=${new Date(n).toUTCString()}`), m.isString(r) && c.push(`path=${r}`), m.isString(o) && c.push(`domain=${o}`), i === !0 && c.push("secure"), m.isString(s) && c.push(`SameSite=${s}`), document.cookie = c.join("; ");
|
|
2858
|
+
},
|
|
2859
|
+
read(t) {
|
|
2860
|
+
if (typeof document > "u") return null;
|
|
2861
|
+
const e = document.cookie.match(new RegExp("(?:^|; )" + t + "=([^;]*)"));
|
|
2862
|
+
return e ? decodeURIComponent(e[1]) : null;
|
|
2863
|
+
},
|
|
2864
|
+
remove(t) {
|
|
2865
|
+
this.write(t, "", Date.now() - 864e5, "/");
|
|
2866
|
+
}
|
|
2867
|
+
}
|
|
2868
|
+
) : (
|
|
2869
|
+
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
2870
|
+
{
|
|
2871
|
+
write() {
|
|
2872
|
+
},
|
|
2873
|
+
read() {
|
|
2874
|
+
return null;
|
|
2875
|
+
},
|
|
2876
|
+
remove() {
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2879
|
+
);
|
|
2880
|
+
function xr(t) {
|
|
2881
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);
|
|
2882
|
+
}
|
|
2883
|
+
function br(t, e) {
|
|
2884
|
+
return e ? t.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : t;
|
|
2885
|
+
}
|
|
2886
|
+
function Xt(t, e, n) {
|
|
2887
|
+
let r = !xr(e);
|
|
2888
|
+
return t && (r || n == !1) ? br(t, e) : e;
|
|
2889
|
+
}
|
|
2890
|
+
const St = (t) => t instanceof z ? { ...t } : t;
|
|
2891
|
+
function K(t, e) {
|
|
2892
|
+
e = e || {};
|
|
2893
|
+
const n = {};
|
|
2894
|
+
function r(f, d, g, N) {
|
|
2895
|
+
return m.isPlainObject(f) && m.isPlainObject(d) ? m.merge.call({ caseless: N }, f, d) : m.isPlainObject(d) ? m.merge({}, d) : m.isArray(d) ? d.slice() : d;
|
|
2896
|
+
}
|
|
2897
|
+
function o(f, d, g, N) {
|
|
2898
|
+
if (m.isUndefined(d)) {
|
|
2899
|
+
if (!m.isUndefined(f))
|
|
2900
|
+
return r(void 0, f, g, N);
|
|
2901
|
+
} else return r(f, d, g, N);
|
|
2902
|
+
}
|
|
2903
|
+
function i(f, d) {
|
|
2904
|
+
if (!m.isUndefined(d))
|
|
2905
|
+
return r(void 0, d);
|
|
2906
|
+
}
|
|
2907
|
+
function s(f, d) {
|
|
2908
|
+
if (m.isUndefined(d)) {
|
|
2909
|
+
if (!m.isUndefined(f))
|
|
2910
|
+
return r(void 0, f);
|
|
2911
|
+
} else return r(void 0, d);
|
|
2912
|
+
}
|
|
2913
|
+
function c(f, d, g) {
|
|
2914
|
+
if (g in e)
|
|
2915
|
+
return r(f, d);
|
|
2916
|
+
if (g in t)
|
|
2917
|
+
return r(void 0, f);
|
|
2918
|
+
}
|
|
2919
|
+
const a = {
|
|
2920
|
+
url: i,
|
|
2921
|
+
method: i,
|
|
2922
|
+
data: i,
|
|
2923
|
+
baseURL: s,
|
|
2924
|
+
transformRequest: s,
|
|
2925
|
+
transformResponse: s,
|
|
2926
|
+
paramsSerializer: s,
|
|
2927
|
+
timeout: s,
|
|
2928
|
+
timeoutMessage: s,
|
|
2929
|
+
withCredentials: s,
|
|
2930
|
+
withXSRFToken: s,
|
|
2931
|
+
adapter: s,
|
|
2932
|
+
responseType: s,
|
|
2933
|
+
xsrfCookieName: s,
|
|
2934
|
+
xsrfHeaderName: s,
|
|
2935
|
+
onUploadProgress: s,
|
|
2936
|
+
onDownloadProgress: s,
|
|
2937
|
+
decompress: s,
|
|
2938
|
+
maxContentLength: s,
|
|
2939
|
+
maxBodyLength: s,
|
|
2940
|
+
beforeRedirect: s,
|
|
2941
|
+
transport: s,
|
|
2942
|
+
httpAgent: s,
|
|
2943
|
+
httpsAgent: s,
|
|
2944
|
+
cancelToken: s,
|
|
2945
|
+
socketPath: s,
|
|
2946
|
+
responseEncoding: s,
|
|
2947
|
+
validateStatus: c,
|
|
2948
|
+
headers: (f, d, g) => o(St(f), St(d), g, !0)
|
|
2949
|
+
};
|
|
2950
|
+
return m.forEach(Object.keys({ ...t, ...e }), function(d) {
|
|
2951
|
+
const g = a[d] || o, N = g(t[d], e[d], d);
|
|
2952
|
+
m.isUndefined(N) && g !== c || (n[d] = N);
|
|
2953
|
+
}), n;
|
|
2954
|
+
}
|
|
2955
|
+
const Wt = (t) => {
|
|
2956
|
+
const e = K({}, t);
|
|
2957
|
+
let { data: n, withXSRFToken: r, xsrfHeaderName: o, xsrfCookieName: i, headers: s, auth: c } = e;
|
|
2958
|
+
if (e.headers = s = z.from(s), e.url = qt(Xt(e.baseURL, e.url, e.allowAbsoluteUrls), t.params, t.paramsSerializer), c && s.set(
|
|
2959
|
+
"Authorization",
|
|
2960
|
+
"Basic " + btoa((c.username || "") + ":" + (c.password ? unescape(encodeURIComponent(c.password)) : ""))
|
|
2961
|
+
), m.isFormData(n)) {
|
|
2962
|
+
if (M.hasStandardBrowserEnv || M.hasStandardBrowserWebWorkerEnv)
|
|
2963
|
+
s.setContentType(void 0);
|
|
2964
|
+
else if (m.isFunction(n.getHeaders)) {
|
|
2965
|
+
const a = n.getHeaders(), f = ["content-type", "content-length"];
|
|
2966
|
+
Object.entries(a).forEach(([d, g]) => {
|
|
2967
|
+
f.includes(d.toLowerCase()) && s.set(d, g);
|
|
2968
|
+
});
|
|
2969
|
+
}
|
|
2970
|
+
}
|
|
2971
|
+
if (M.hasStandardBrowserEnv && (r && m.isFunction(r) && (r = r(e)), r || r !== !1 && Ar(e.url))) {
|
|
2972
|
+
const a = o && i && Fr.read(i);
|
|
2973
|
+
a && s.set(o, a);
|
|
2974
|
+
}
|
|
2975
|
+
return e;
|
|
2976
|
+
}, Ur = typeof XMLHttpRequest < "u", Pr = Ur && function(t) {
|
|
2977
|
+
return new Promise(function(n, r) {
|
|
2978
|
+
const o = Wt(t);
|
|
2979
|
+
let i = o.data;
|
|
2980
|
+
const s = z.from(o.headers).normalize();
|
|
2981
|
+
let { responseType: c, onUploadProgress: a, onDownloadProgress: f } = o, d, g, N, y, E;
|
|
2982
|
+
function C() {
|
|
2983
|
+
y && y(), E && E(), o.cancelToken && o.cancelToken.unsubscribe(d), o.signal && o.signal.removeEventListener("abort", d);
|
|
2984
|
+
}
|
|
2985
|
+
let L = new XMLHttpRequest();
|
|
2986
|
+
L.open(o.method.toUpperCase(), o.url, !0), L.timeout = o.timeout;
|
|
2987
|
+
function D() {
|
|
2988
|
+
if (!L)
|
|
2989
|
+
return;
|
|
2990
|
+
const R = z.from(
|
|
2991
|
+
"getAllResponseHeaders" in L && L.getAllResponseHeaders()
|
|
2992
|
+
), u = {
|
|
2993
|
+
data: !c || c === "text" || c === "json" ? L.responseText : L.response,
|
|
2994
|
+
status: L.status,
|
|
2995
|
+
statusText: L.statusText,
|
|
2996
|
+
headers: R,
|
|
2997
|
+
config: t,
|
|
2998
|
+
request: L
|
|
2999
|
+
};
|
|
3000
|
+
$t(function(l) {
|
|
3001
|
+
n(l), C();
|
|
3002
|
+
}, function(l) {
|
|
3003
|
+
r(l), C();
|
|
3004
|
+
}, u), L = null;
|
|
3005
|
+
}
|
|
3006
|
+
"onloadend" in L ? L.onloadend = D : L.onreadystatechange = function() {
|
|
3007
|
+
!L || L.readyState !== 4 || L.status === 0 && !(L.responseURL && L.responseURL.indexOf("file:") === 0) || setTimeout(D);
|
|
3008
|
+
}, L.onabort = function() {
|
|
3009
|
+
L && (r(new F("Request aborted", F.ECONNABORTED, t, L)), L = null);
|
|
3010
|
+
}, L.onerror = function(h) {
|
|
3011
|
+
const u = h && h.message ? h.message : "Network Error", S = new F(u, F.ERR_NETWORK, t, L);
|
|
3012
|
+
S.event = h || null, r(S), L = null;
|
|
3013
|
+
}, L.ontimeout = function() {
|
|
3014
|
+
let h = o.timeout ? "timeout of " + o.timeout + "ms exceeded" : "timeout exceeded";
|
|
3015
|
+
const u = o.transitional || kt;
|
|
3016
|
+
o.timeoutErrorMessage && (h = o.timeoutErrorMessage), r(new F(
|
|
3017
|
+
h,
|
|
3018
|
+
u.clarifyTimeoutError ? F.ETIMEDOUT : F.ECONNABORTED,
|
|
3019
|
+
t,
|
|
3020
|
+
L
|
|
3021
|
+
)), L = null;
|
|
3022
|
+
}, i === void 0 && s.setContentType(null), "setRequestHeader" in L && m.forEach(s.toJSON(), function(h, u) {
|
|
3023
|
+
L.setRequestHeader(u, h);
|
|
3024
|
+
}), m.isUndefined(o.withCredentials) || (L.withCredentials = !!o.withCredentials), c && c !== "json" && (L.responseType = o.responseType), f && ([N, E] = ye(f, !0), L.addEventListener("progress", N)), a && L.upload && ([g, y] = ye(a), L.upload.addEventListener("progress", g), L.upload.addEventListener("loadend", y)), (o.cancelToken || o.signal) && (d = (R) => {
|
|
3025
|
+
L && (r(!R || R.type ? new te(null, t, L) : R), L.abort(), L = null);
|
|
3026
|
+
}, o.cancelToken && o.cancelToken.subscribe(d), o.signal && (o.signal.aborted ? d() : o.signal.addEventListener("abort", d)));
|
|
3027
|
+
const I = Rr(o.url);
|
|
3028
|
+
if (I && M.protocols.indexOf(I) === -1) {
|
|
3029
|
+
r(new F("Unsupported protocol " + I + ":", F.ERR_BAD_REQUEST, t));
|
|
3030
|
+
return;
|
|
3031
|
+
}
|
|
3032
|
+
L.send(i || null);
|
|
3033
|
+
});
|
|
3034
|
+
}, Br = (t, e) => {
|
|
3035
|
+
const { length: n } = t = t ? t.filter(Boolean) : [];
|
|
3036
|
+
if (e || n) {
|
|
3037
|
+
let r = new AbortController(), o;
|
|
3038
|
+
const i = function(f) {
|
|
3039
|
+
if (!o) {
|
|
3040
|
+
o = !0, c();
|
|
3041
|
+
const d = f instanceof Error ? f : this.reason;
|
|
3042
|
+
r.abort(d instanceof F ? d : new te(d instanceof Error ? d.message : d));
|
|
3043
|
+
}
|
|
3044
|
+
};
|
|
3045
|
+
let s = e && setTimeout(() => {
|
|
3046
|
+
s = null, i(new F(`timeout ${e} of ms exceeded`, F.ETIMEDOUT));
|
|
3047
|
+
}, e);
|
|
3048
|
+
const c = () => {
|
|
3049
|
+
t && (s && clearTimeout(s), s = null, t.forEach((f) => {
|
|
3050
|
+
f.unsubscribe ? f.unsubscribe(i) : f.removeEventListener("abort", i);
|
|
3051
|
+
}), t = null);
|
|
3052
|
+
};
|
|
3053
|
+
t.forEach((f) => f.addEventListener("abort", i));
|
|
3054
|
+
const { signal: a } = r;
|
|
3055
|
+
return a.unsubscribe = () => m.asap(c), a;
|
|
3056
|
+
}
|
|
3057
|
+
}, vr = function* (t, e) {
|
|
3058
|
+
let n = t.byteLength;
|
|
3059
|
+
if (n < e) {
|
|
3060
|
+
yield t;
|
|
3061
|
+
return;
|
|
3062
|
+
}
|
|
3063
|
+
let r = 0, o;
|
|
3064
|
+
for (; r < n; )
|
|
3065
|
+
o = r + e, yield t.slice(r, o), r = o;
|
|
3066
|
+
}, Hr = async function* (t, e) {
|
|
3067
|
+
for await (const n of Mr(t))
|
|
3068
|
+
yield* vr(n, e);
|
|
3069
|
+
}, Mr = async function* (t) {
|
|
3070
|
+
if (t[Symbol.asyncIterator]) {
|
|
3071
|
+
yield* t;
|
|
3072
|
+
return;
|
|
3073
|
+
}
|
|
3074
|
+
const e = t.getReader();
|
|
3075
|
+
try {
|
|
3076
|
+
for (; ; ) {
|
|
3077
|
+
const { done: n, value: r } = await e.read();
|
|
3078
|
+
if (n)
|
|
3079
|
+
break;
|
|
3080
|
+
yield r;
|
|
3081
|
+
}
|
|
3082
|
+
} finally {
|
|
3083
|
+
await e.cancel();
|
|
3084
|
+
}
|
|
3085
|
+
}, wt = (t, e, n, r) => {
|
|
3086
|
+
const o = Hr(t, e);
|
|
3087
|
+
let i = 0, s, c = (a) => {
|
|
3088
|
+
s || (s = !0, r && r(a));
|
|
3089
|
+
};
|
|
3090
|
+
return new ReadableStream({
|
|
3091
|
+
async pull(a) {
|
|
3092
|
+
try {
|
|
3093
|
+
const { done: f, value: d } = await o.next();
|
|
3094
|
+
if (f) {
|
|
3095
|
+
c(), a.close();
|
|
3096
|
+
return;
|
|
3097
|
+
}
|
|
3098
|
+
let g = d.byteLength;
|
|
3099
|
+
if (n) {
|
|
3100
|
+
let N = i += g;
|
|
3101
|
+
n(N);
|
|
3102
|
+
}
|
|
3103
|
+
a.enqueue(new Uint8Array(d));
|
|
3104
|
+
} catch (f) {
|
|
3105
|
+
throw c(f), f;
|
|
3106
|
+
}
|
|
3107
|
+
},
|
|
3108
|
+
cancel(a) {
|
|
3109
|
+
return c(a), o.return();
|
|
3110
|
+
}
|
|
3111
|
+
}, {
|
|
3112
|
+
highWaterMark: 2
|
|
3113
|
+
});
|
|
3114
|
+
}, Ct = 64 * 1024, { isFunction: he } = m, jr = (({ Request: t, Response: e }) => ({
|
|
3115
|
+
Request: t,
|
|
3116
|
+
Response: e
|
|
3117
|
+
}))(m.global), {
|
|
3118
|
+
ReadableStream: Nt,
|
|
3119
|
+
TextEncoder: Lt
|
|
3120
|
+
} = m.global, It = (t, ...e) => {
|
|
3121
|
+
try {
|
|
3122
|
+
return !!t(...e);
|
|
3123
|
+
} catch {
|
|
3124
|
+
return !1;
|
|
3125
|
+
}
|
|
3126
|
+
}, zr = (t) => {
|
|
3127
|
+
t = m.merge.call({
|
|
3128
|
+
skipUndefined: !0
|
|
3129
|
+
}, jr, t);
|
|
3130
|
+
const { fetch: e, Request: n, Response: r } = t, o = e ? he(e) : typeof fetch == "function", i = he(n), s = he(r);
|
|
3131
|
+
if (!o)
|
|
3132
|
+
return !1;
|
|
3133
|
+
const c = o && he(Nt), a = o && (typeof Lt == "function" ? /* @__PURE__ */ ((E) => (C) => E.encode(C))(new Lt()) : async (E) => new Uint8Array(await new n(E).arrayBuffer())), f = i && c && It(() => {
|
|
3134
|
+
let E = !1;
|
|
3135
|
+
const C = new n(M.origin, {
|
|
3136
|
+
body: new Nt(),
|
|
3137
|
+
method: "POST",
|
|
3138
|
+
get duplex() {
|
|
3139
|
+
return E = !0, "half";
|
|
3140
|
+
}
|
|
3141
|
+
}).headers.has("Content-Type");
|
|
3142
|
+
return E && !C;
|
|
3143
|
+
}), d = s && c && It(() => m.isReadableStream(new r("").body)), g = {
|
|
3144
|
+
stream: d && ((E) => E.body)
|
|
3145
|
+
};
|
|
3146
|
+
o && ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((E) => {
|
|
3147
|
+
!g[E] && (g[E] = (C, L) => {
|
|
3148
|
+
let D = C && C[E];
|
|
3149
|
+
if (D)
|
|
3150
|
+
return D.call(C);
|
|
3151
|
+
throw new F(`Response type '${E}' is not supported`, F.ERR_NOT_SUPPORT, L);
|
|
3152
|
+
});
|
|
3153
|
+
});
|
|
3154
|
+
const N = async (E) => {
|
|
3155
|
+
if (E == null)
|
|
3156
|
+
return 0;
|
|
3157
|
+
if (m.isBlob(E))
|
|
3158
|
+
return E.size;
|
|
3159
|
+
if (m.isSpecCompliantForm(E))
|
|
3160
|
+
return (await new n(M.origin, {
|
|
3161
|
+
method: "POST",
|
|
3162
|
+
body: E
|
|
3163
|
+
}).arrayBuffer()).byteLength;
|
|
3164
|
+
if (m.isArrayBufferView(E) || m.isArrayBuffer(E))
|
|
3165
|
+
return E.byteLength;
|
|
3166
|
+
if (m.isURLSearchParams(E) && (E = E + ""), m.isString(E))
|
|
3167
|
+
return (await a(E)).byteLength;
|
|
3168
|
+
}, y = async (E, C) => {
|
|
3169
|
+
const L = m.toFiniteNumber(E.getContentLength());
|
|
3170
|
+
return L ?? N(C);
|
|
3171
|
+
};
|
|
3172
|
+
return async (E) => {
|
|
3173
|
+
let {
|
|
3174
|
+
url: C,
|
|
3175
|
+
method: L,
|
|
3176
|
+
data: D,
|
|
3177
|
+
signal: I,
|
|
3178
|
+
cancelToken: R,
|
|
3179
|
+
timeout: h,
|
|
3180
|
+
onDownloadProgress: u,
|
|
3181
|
+
onUploadProgress: S,
|
|
3182
|
+
responseType: l,
|
|
3183
|
+
headers: p,
|
|
3184
|
+
withCredentials: w = "same-origin",
|
|
3185
|
+
fetchOptions: _
|
|
3186
|
+
} = Wt(E), T = e || fetch;
|
|
3187
|
+
l = l ? (l + "").toLowerCase() : "text";
|
|
3188
|
+
let A = Br([I, R && R.toAbortSignal()], h), O = null;
|
|
3189
|
+
const x = A && A.unsubscribe && (() => {
|
|
3190
|
+
A.unsubscribe();
|
|
3191
|
+
});
|
|
3192
|
+
let b;
|
|
3193
|
+
try {
|
|
3194
|
+
if (S && f && L !== "get" && L !== "head" && (b = await y(p, D)) !== 0) {
|
|
3195
|
+
let q = new n(C, {
|
|
3196
|
+
method: "POST",
|
|
3197
|
+
body: D,
|
|
3198
|
+
duplex: "half"
|
|
3199
|
+
}), V;
|
|
3200
|
+
if (m.isFormData(D) && (V = q.headers.get("content-type")) && p.setContentType(V), q.body) {
|
|
3201
|
+
const [Le, le] = yt(
|
|
3202
|
+
b,
|
|
3203
|
+
ye(gt(S))
|
|
3204
|
+
);
|
|
3205
|
+
D = wt(q.body, Ct, Le, le);
|
|
3206
|
+
}
|
|
3207
|
+
}
|
|
3208
|
+
m.isString(w) || (w = w ? "include" : "omit");
|
|
3209
|
+
const U = i && "credentials" in n.prototype, B = {
|
|
3210
|
+
..._,
|
|
3211
|
+
signal: A,
|
|
3212
|
+
method: L.toUpperCase(),
|
|
3213
|
+
headers: p.normalize().toJSON(),
|
|
3214
|
+
body: D,
|
|
3215
|
+
duplex: "half",
|
|
3216
|
+
credentials: U ? w : void 0
|
|
3217
|
+
};
|
|
3218
|
+
O = i && new n(C, B);
|
|
3219
|
+
let P = await (i ? T(O, _) : T(C, B));
|
|
3220
|
+
const Z = d && (l === "stream" || l === "response");
|
|
3221
|
+
if (d && (u || Z && x)) {
|
|
3222
|
+
const q = {};
|
|
3223
|
+
["status", "statusText", "headers"].forEach((We) => {
|
|
3224
|
+
q[We] = P[We];
|
|
3225
|
+
});
|
|
3226
|
+
const V = m.toFiniteNumber(P.headers.get("content-length")), [Le, le] = u && yt(
|
|
3227
|
+
V,
|
|
3228
|
+
ye(gt(u), !0)
|
|
3229
|
+
) || [];
|
|
3230
|
+
P = new r(
|
|
3231
|
+
wt(P.body, Ct, Le, () => {
|
|
3232
|
+
le && le(), x && x();
|
|
3233
|
+
}),
|
|
3234
|
+
q
|
|
3235
|
+
);
|
|
3236
|
+
}
|
|
3237
|
+
l = l || "text";
|
|
3238
|
+
let ne = await g[m.findKey(g, l) || "text"](P, E);
|
|
3239
|
+
return !Z && x && x(), await new Promise((q, V) => {
|
|
3240
|
+
$t(q, V, {
|
|
3241
|
+
data: ne,
|
|
3242
|
+
headers: z.from(P.headers),
|
|
3243
|
+
status: P.status,
|
|
3244
|
+
statusText: P.statusText,
|
|
3245
|
+
config: E,
|
|
3246
|
+
request: O
|
|
3247
|
+
});
|
|
3248
|
+
});
|
|
3249
|
+
} catch (U) {
|
|
3250
|
+
throw x && x(), U && U.name === "TypeError" && /Load failed|fetch/i.test(U.message) ? Object.assign(
|
|
3251
|
+
new F("Network Error", F.ERR_NETWORK, E, O),
|
|
3252
|
+
{
|
|
3253
|
+
cause: U.cause || U
|
|
3254
|
+
}
|
|
3255
|
+
) : F.from(U, U && U.code, E, O);
|
|
3256
|
+
}
|
|
3257
|
+
};
|
|
3258
|
+
}, Zr = /* @__PURE__ */ new Map(), Jt = (t) => {
|
|
3259
|
+
let e = t && t.env || {};
|
|
3260
|
+
const { fetch: n, Request: r, Response: o } = e, i = [
|
|
3261
|
+
r,
|
|
3262
|
+
o,
|
|
3263
|
+
n
|
|
3264
|
+
];
|
|
3265
|
+
let s = i.length, c = s, a, f, d = Zr;
|
|
3266
|
+
for (; c--; )
|
|
3267
|
+
a = i[c], f = d.get(a), f === void 0 && d.set(a, f = c ? /* @__PURE__ */ new Map() : zr(e)), d = f;
|
|
3268
|
+
return f;
|
|
3269
|
+
};
|
|
3270
|
+
Jt();
|
|
3271
|
+
const Xe = {
|
|
3272
|
+
http: sr,
|
|
3273
|
+
xhr: Pr,
|
|
3274
|
+
fetch: {
|
|
3275
|
+
get: Jt
|
|
3276
|
+
}
|
|
3277
|
+
};
|
|
3278
|
+
m.forEach(Xe, (t, e) => {
|
|
3279
|
+
if (t) {
|
|
3280
|
+
try {
|
|
3281
|
+
Object.defineProperty(t, "name", { value: e });
|
|
3282
|
+
} catch {
|
|
3283
|
+
}
|
|
3284
|
+
Object.defineProperty(t, "adapterName", { value: e });
|
|
3285
|
+
}
|
|
3286
|
+
});
|
|
3287
|
+
const Ot = (t) => `- ${t}`, qr = (t) => m.isFunction(t) || t === null || t === !1;
|
|
3288
|
+
function kr(t, e) {
|
|
3289
|
+
t = m.isArray(t) ? t : [t];
|
|
3290
|
+
const { length: n } = t;
|
|
3291
|
+
let r, o;
|
|
3292
|
+
const i = {};
|
|
3293
|
+
for (let s = 0; s < n; s++) {
|
|
3294
|
+
r = t[s];
|
|
3295
|
+
let c;
|
|
3296
|
+
if (o = r, !qr(r) && (o = Xe[(c = String(r)).toLowerCase()], o === void 0))
|
|
3297
|
+
throw new F(`Unknown adapter '${c}'`);
|
|
3298
|
+
if (o && (m.isFunction(o) || (o = o.get(e))))
|
|
3299
|
+
break;
|
|
3300
|
+
i[c || "#" + s] = o;
|
|
3301
|
+
}
|
|
3302
|
+
if (!o) {
|
|
3303
|
+
const s = Object.entries(i).map(
|
|
3304
|
+
([a, f]) => `adapter ${a} ` + (f === !1 ? "is not supported by the environment" : "is not available in the build")
|
|
3305
|
+
);
|
|
3306
|
+
let c = n ? s.length > 1 ? `since :
|
|
3307
|
+
` + s.map(Ot).join(`
|
|
3308
|
+
`) : " " + Ot(s[0]) : "as no adapter specified";
|
|
3309
|
+
throw new F(
|
|
3310
|
+
"There is no suitable adapter to dispatch the request " + c,
|
|
3311
|
+
"ERR_NOT_SUPPORT"
|
|
3312
|
+
);
|
|
3313
|
+
}
|
|
3314
|
+
return o;
|
|
3315
|
+
}
|
|
3316
|
+
const Kt = {
|
|
3317
|
+
/**
|
|
3318
|
+
* Resolve an adapter from a list of adapter names or functions.
|
|
3319
|
+
* @type {Function}
|
|
3320
|
+
*/
|
|
3321
|
+
getAdapter: kr,
|
|
3322
|
+
/**
|
|
3323
|
+
* Exposes all known adapters
|
|
3324
|
+
* @type {Object<string, Function|Object>}
|
|
3325
|
+
*/
|
|
3326
|
+
adapters: Xe
|
|
3327
|
+
};
|
|
3328
|
+
function Me(t) {
|
|
3329
|
+
if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted)
|
|
3330
|
+
throw new te(null, t);
|
|
3331
|
+
}
|
|
3332
|
+
function Dt(t) {
|
|
3333
|
+
return Me(t), t.headers = z.from(t.headers), t.data = He.call(
|
|
3334
|
+
t,
|
|
3335
|
+
t.transformRequest
|
|
3336
|
+
), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), Kt.getAdapter(t.adapter || ue.adapter, t)(t).then(function(r) {
|
|
3337
|
+
return Me(t), r.data = He.call(
|
|
3338
|
+
t,
|
|
3339
|
+
t.transformResponse,
|
|
3340
|
+
r
|
|
3341
|
+
), r.headers = z.from(r.headers), r;
|
|
3342
|
+
}, function(r) {
|
|
3343
|
+
return Vt(r) || (Me(t), r && r.response && (r.response.data = He.call(
|
|
3344
|
+
t,
|
|
3345
|
+
t.transformResponse,
|
|
3346
|
+
r.response
|
|
3347
|
+
), r.response.headers = z.from(r.response.headers))), Promise.reject(r);
|
|
3348
|
+
});
|
|
3349
|
+
}
|
|
3350
|
+
const Yt = "1.13.2", Ne = {};
|
|
3351
|
+
["object", "boolean", "number", "function", "string", "symbol"].forEach((t, e) => {
|
|
3352
|
+
Ne[t] = function(r) {
|
|
3353
|
+
return typeof r === t || "a" + (e < 1 ? "n " : " ") + t;
|
|
3354
|
+
};
|
|
3355
|
+
});
|
|
3356
|
+
const Rt = {};
|
|
3357
|
+
Ne.transitional = function(e, n, r) {
|
|
3358
|
+
function o(i, s) {
|
|
3359
|
+
return "[Axios v" + Yt + "] Transitional option '" + i + "'" + s + (r ? ". " + r : "");
|
|
3360
|
+
}
|
|
3361
|
+
return (i, s, c) => {
|
|
3362
|
+
if (e === !1)
|
|
3363
|
+
throw new F(
|
|
3364
|
+
o(s, " has been removed" + (n ? " in " + n : "")),
|
|
3365
|
+
F.ERR_DEPRECATED
|
|
3366
|
+
);
|
|
3367
|
+
return n && !Rt[s] && (Rt[s] = !0, console.warn(
|
|
3368
|
+
o(
|
|
3369
|
+
s,
|
|
3370
|
+
" has been deprecated since v" + n + " and will be removed in the near future"
|
|
3371
|
+
)
|
|
3372
|
+
)), e ? e(i, s, c) : !0;
|
|
3373
|
+
};
|
|
3374
|
+
};
|
|
3375
|
+
Ne.spelling = function(e) {
|
|
3376
|
+
return (n, r) => (console.warn(`${r} is likely a misspelling of ${e}`), !0);
|
|
3377
|
+
};
|
|
3378
|
+
function Gr(t, e, n) {
|
|
3379
|
+
if (typeof t != "object")
|
|
3380
|
+
throw new F("options must be an object", F.ERR_BAD_OPTION_VALUE);
|
|
3381
|
+
const r = Object.keys(t);
|
|
3382
|
+
let o = r.length;
|
|
3383
|
+
for (; o-- > 0; ) {
|
|
3384
|
+
const i = r[o], s = e[i];
|
|
3385
|
+
if (s) {
|
|
3386
|
+
const c = t[i], a = c === void 0 || s(c, i, t);
|
|
3387
|
+
if (a !== !0)
|
|
3388
|
+
throw new F("option " + i + " must be " + a, F.ERR_BAD_OPTION_VALUE);
|
|
3389
|
+
continue;
|
|
3390
|
+
}
|
|
3391
|
+
if (n !== !0)
|
|
3392
|
+
throw new F("Unknown option " + i, F.ERR_BAD_OPTION);
|
|
3393
|
+
}
|
|
3394
|
+
}
|
|
3395
|
+
const pe = {
|
|
3396
|
+
assertOptions: Gr,
|
|
3397
|
+
validators: Ne
|
|
3398
|
+
}, G = pe.validators;
|
|
3399
|
+
let W = class {
|
|
3400
|
+
constructor(e) {
|
|
3401
|
+
this.defaults = e || {}, this.interceptors = {
|
|
3402
|
+
request: new mt(),
|
|
3403
|
+
response: new mt()
|
|
3404
|
+
};
|
|
3405
|
+
}
|
|
3406
|
+
/**
|
|
3407
|
+
* Dispatch a request
|
|
3408
|
+
*
|
|
3409
|
+
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
|
3410
|
+
* @param {?Object} config
|
|
3411
|
+
*
|
|
3412
|
+
* @returns {Promise} The Promise to be fulfilled
|
|
3413
|
+
*/
|
|
3414
|
+
async request(e, n) {
|
|
3415
|
+
try {
|
|
3416
|
+
return await this._request(e, n);
|
|
3417
|
+
} catch (r) {
|
|
3418
|
+
if (r instanceof Error) {
|
|
3419
|
+
let o = {};
|
|
3420
|
+
Error.captureStackTrace ? Error.captureStackTrace(o) : o = new Error();
|
|
3421
|
+
const i = o.stack ? o.stack.replace(/^.+\n/, "") : "";
|
|
3422
|
+
try {
|
|
3423
|
+
r.stack ? i && !String(r.stack).endsWith(i.replace(/^.+\n.+\n/, "")) && (r.stack += `
|
|
3424
|
+
` + i) : r.stack = i;
|
|
3425
|
+
} catch {
|
|
3426
|
+
}
|
|
3427
|
+
}
|
|
3428
|
+
throw r;
|
|
3429
|
+
}
|
|
3430
|
+
}
|
|
3431
|
+
_request(e, n) {
|
|
3432
|
+
typeof e == "string" ? (n = n || {}, n.url = e) : n = e || {}, n = K(this.defaults, n);
|
|
3433
|
+
const { transitional: r, paramsSerializer: o, headers: i } = n;
|
|
3434
|
+
r !== void 0 && pe.assertOptions(r, {
|
|
3435
|
+
silentJSONParsing: G.transitional(G.boolean),
|
|
3436
|
+
forcedJSONParsing: G.transitional(G.boolean),
|
|
3437
|
+
clarifyTimeoutError: G.transitional(G.boolean)
|
|
3438
|
+
}, !1), o != null && (m.isFunction(o) ? n.paramsSerializer = {
|
|
3439
|
+
serialize: o
|
|
3440
|
+
} : pe.assertOptions(o, {
|
|
3441
|
+
encode: G.function,
|
|
3442
|
+
serialize: G.function
|
|
3443
|
+
}, !0)), n.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? n.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : n.allowAbsoluteUrls = !0), pe.assertOptions(n, {
|
|
3444
|
+
baseUrl: G.spelling("baseURL"),
|
|
3445
|
+
withXsrfToken: G.spelling("withXSRFToken")
|
|
3446
|
+
}, !0), n.method = (n.method || this.defaults.method || "get").toLowerCase();
|
|
3447
|
+
let s = i && m.merge(
|
|
3448
|
+
i.common,
|
|
3449
|
+
i[n.method]
|
|
3450
|
+
);
|
|
3451
|
+
i && m.forEach(
|
|
3452
|
+
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
3453
|
+
(E) => {
|
|
3454
|
+
delete i[E];
|
|
3455
|
+
}
|
|
3456
|
+
), n.headers = z.concat(s, i);
|
|
3457
|
+
const c = [];
|
|
3458
|
+
let a = !0;
|
|
3459
|
+
this.interceptors.request.forEach(function(C) {
|
|
3460
|
+
typeof C.runWhen == "function" && C.runWhen(n) === !1 || (a = a && C.synchronous, c.unshift(C.fulfilled, C.rejected));
|
|
3461
|
+
});
|
|
3462
|
+
const f = [];
|
|
3463
|
+
this.interceptors.response.forEach(function(C) {
|
|
3464
|
+
f.push(C.fulfilled, C.rejected);
|
|
3465
|
+
});
|
|
3466
|
+
let d, g = 0, N;
|
|
3467
|
+
if (!a) {
|
|
3468
|
+
const E = [Dt.bind(this), void 0];
|
|
3469
|
+
for (E.unshift(...c), E.push(...f), N = E.length, d = Promise.resolve(n); g < N; )
|
|
3470
|
+
d = d.then(E[g++], E[g++]);
|
|
3471
|
+
return d;
|
|
3472
|
+
}
|
|
3473
|
+
N = c.length;
|
|
3474
|
+
let y = n;
|
|
3475
|
+
for (; g < N; ) {
|
|
3476
|
+
const E = c[g++], C = c[g++];
|
|
3477
|
+
try {
|
|
3478
|
+
y = E(y);
|
|
3479
|
+
} catch (L) {
|
|
3480
|
+
C.call(this, L);
|
|
3481
|
+
break;
|
|
3482
|
+
}
|
|
3483
|
+
}
|
|
3484
|
+
try {
|
|
3485
|
+
d = Dt.call(this, y);
|
|
3486
|
+
} catch (E) {
|
|
3487
|
+
return Promise.reject(E);
|
|
3488
|
+
}
|
|
3489
|
+
for (g = 0, N = f.length; g < N; )
|
|
3490
|
+
d = d.then(f[g++], f[g++]);
|
|
3491
|
+
return d;
|
|
3492
|
+
}
|
|
3493
|
+
getUri(e) {
|
|
3494
|
+
e = K(this.defaults, e);
|
|
3495
|
+
const n = Xt(e.baseURL, e.url, e.allowAbsoluteUrls);
|
|
3496
|
+
return qt(n, e.params, e.paramsSerializer);
|
|
3497
|
+
}
|
|
3498
|
+
};
|
|
3499
|
+
m.forEach(["delete", "get", "head", "options"], function(e) {
|
|
3500
|
+
W.prototype[e] = function(n, r) {
|
|
3501
|
+
return this.request(K(r || {}, {
|
|
3502
|
+
method: e,
|
|
3503
|
+
url: n,
|
|
3504
|
+
data: (r || {}).data
|
|
3505
|
+
}));
|
|
3506
|
+
};
|
|
3507
|
+
});
|
|
3508
|
+
m.forEach(["post", "put", "patch"], function(e) {
|
|
3509
|
+
function n(r) {
|
|
3510
|
+
return function(i, s, c) {
|
|
3511
|
+
return this.request(K(c || {}, {
|
|
3512
|
+
method: e,
|
|
3513
|
+
headers: r ? {
|
|
3514
|
+
"Content-Type": "multipart/form-data"
|
|
3515
|
+
} : {},
|
|
3516
|
+
url: i,
|
|
3517
|
+
data: s
|
|
3518
|
+
}));
|
|
3519
|
+
};
|
|
3520
|
+
}
|
|
3521
|
+
W.prototype[e] = n(), W.prototype[e + "Form"] = n(!0);
|
|
3522
|
+
});
|
|
3523
|
+
let Vr = class Qt {
|
|
3524
|
+
constructor(e) {
|
|
3525
|
+
if (typeof e != "function")
|
|
3526
|
+
throw new TypeError("executor must be a function.");
|
|
3527
|
+
let n;
|
|
3528
|
+
this.promise = new Promise(function(i) {
|
|
3529
|
+
n = i;
|
|
3530
|
+
});
|
|
3531
|
+
const r = this;
|
|
3532
|
+
this.promise.then((o) => {
|
|
3533
|
+
if (!r._listeners) return;
|
|
3534
|
+
let i = r._listeners.length;
|
|
3535
|
+
for (; i-- > 0; )
|
|
3536
|
+
r._listeners[i](o);
|
|
3537
|
+
r._listeners = null;
|
|
3538
|
+
}), this.promise.then = (o) => {
|
|
3539
|
+
let i;
|
|
3540
|
+
const s = new Promise((c) => {
|
|
3541
|
+
r.subscribe(c), i = c;
|
|
3542
|
+
}).then(o);
|
|
3543
|
+
return s.cancel = function() {
|
|
3544
|
+
r.unsubscribe(i);
|
|
3545
|
+
}, s;
|
|
3546
|
+
}, e(function(i, s, c) {
|
|
3547
|
+
r.reason || (r.reason = new te(i, s, c), n(r.reason));
|
|
3548
|
+
});
|
|
3549
|
+
}
|
|
3550
|
+
/**
|
|
3551
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
3552
|
+
*/
|
|
3553
|
+
throwIfRequested() {
|
|
3554
|
+
if (this.reason)
|
|
3555
|
+
throw this.reason;
|
|
3556
|
+
}
|
|
3557
|
+
/**
|
|
3558
|
+
* Subscribe to the cancel signal
|
|
3559
|
+
*/
|
|
3560
|
+
subscribe(e) {
|
|
3561
|
+
if (this.reason) {
|
|
3562
|
+
e(this.reason);
|
|
3563
|
+
return;
|
|
3564
|
+
}
|
|
3565
|
+
this._listeners ? this._listeners.push(e) : this._listeners = [e];
|
|
3566
|
+
}
|
|
3567
|
+
/**
|
|
3568
|
+
* Unsubscribe from the cancel signal
|
|
3569
|
+
*/
|
|
3570
|
+
unsubscribe(e) {
|
|
3571
|
+
if (!this._listeners)
|
|
3572
|
+
return;
|
|
3573
|
+
const n = this._listeners.indexOf(e);
|
|
3574
|
+
n !== -1 && this._listeners.splice(n, 1);
|
|
3575
|
+
}
|
|
3576
|
+
toAbortSignal() {
|
|
3577
|
+
const e = new AbortController(), n = (r) => {
|
|
3578
|
+
e.abort(r);
|
|
3579
|
+
};
|
|
3580
|
+
return this.subscribe(n), e.signal.unsubscribe = () => this.unsubscribe(n), e.signal;
|
|
3581
|
+
}
|
|
3582
|
+
/**
|
|
3583
|
+
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
3584
|
+
* cancels the `CancelToken`.
|
|
3585
|
+
*/
|
|
3586
|
+
static source() {
|
|
3587
|
+
let e;
|
|
3588
|
+
return {
|
|
3589
|
+
token: new Qt(function(o) {
|
|
3590
|
+
e = o;
|
|
3591
|
+
}),
|
|
3592
|
+
cancel: e
|
|
3593
|
+
};
|
|
3594
|
+
}
|
|
3595
|
+
};
|
|
3596
|
+
function $r(t) {
|
|
3597
|
+
return function(n) {
|
|
3598
|
+
return t.apply(null, n);
|
|
3599
|
+
};
|
|
3600
|
+
}
|
|
3601
|
+
function Xr(t) {
|
|
3602
|
+
return m.isObject(t) && t.isAxiosError === !0;
|
|
3603
|
+
}
|
|
3604
|
+
const qe = {
|
|
3605
|
+
Continue: 100,
|
|
3606
|
+
SwitchingProtocols: 101,
|
|
3607
|
+
Processing: 102,
|
|
3608
|
+
EarlyHints: 103,
|
|
3609
|
+
Ok: 200,
|
|
3610
|
+
Created: 201,
|
|
3611
|
+
Accepted: 202,
|
|
3612
|
+
NonAuthoritativeInformation: 203,
|
|
3613
|
+
NoContent: 204,
|
|
3614
|
+
ResetContent: 205,
|
|
3615
|
+
PartialContent: 206,
|
|
3616
|
+
MultiStatus: 207,
|
|
3617
|
+
AlreadyReported: 208,
|
|
3618
|
+
ImUsed: 226,
|
|
3619
|
+
MultipleChoices: 300,
|
|
3620
|
+
MovedPermanently: 301,
|
|
3621
|
+
Found: 302,
|
|
3622
|
+
SeeOther: 303,
|
|
3623
|
+
NotModified: 304,
|
|
3624
|
+
UseProxy: 305,
|
|
3625
|
+
Unused: 306,
|
|
3626
|
+
TemporaryRedirect: 307,
|
|
3627
|
+
PermanentRedirect: 308,
|
|
3628
|
+
BadRequest: 400,
|
|
3629
|
+
Unauthorized: 401,
|
|
3630
|
+
PaymentRequired: 402,
|
|
3631
|
+
Forbidden: 403,
|
|
3632
|
+
NotFound: 404,
|
|
3633
|
+
MethodNotAllowed: 405,
|
|
3634
|
+
NotAcceptable: 406,
|
|
3635
|
+
ProxyAuthenticationRequired: 407,
|
|
3636
|
+
RequestTimeout: 408,
|
|
3637
|
+
Conflict: 409,
|
|
3638
|
+
Gone: 410,
|
|
3639
|
+
LengthRequired: 411,
|
|
3640
|
+
PreconditionFailed: 412,
|
|
3641
|
+
PayloadTooLarge: 413,
|
|
3642
|
+
UriTooLong: 414,
|
|
3643
|
+
UnsupportedMediaType: 415,
|
|
3644
|
+
RangeNotSatisfiable: 416,
|
|
3645
|
+
ExpectationFailed: 417,
|
|
3646
|
+
ImATeapot: 418,
|
|
3647
|
+
MisdirectedRequest: 421,
|
|
3648
|
+
UnprocessableEntity: 422,
|
|
3649
|
+
Locked: 423,
|
|
3650
|
+
FailedDependency: 424,
|
|
3651
|
+
TooEarly: 425,
|
|
3652
|
+
UpgradeRequired: 426,
|
|
3653
|
+
PreconditionRequired: 428,
|
|
3654
|
+
TooManyRequests: 429,
|
|
3655
|
+
RequestHeaderFieldsTooLarge: 431,
|
|
3656
|
+
UnavailableForLegalReasons: 451,
|
|
3657
|
+
InternalServerError: 500,
|
|
3658
|
+
NotImplemented: 501,
|
|
3659
|
+
BadGateway: 502,
|
|
3660
|
+
ServiceUnavailable: 503,
|
|
3661
|
+
GatewayTimeout: 504,
|
|
3662
|
+
HttpVersionNotSupported: 505,
|
|
3663
|
+
VariantAlsoNegotiates: 506,
|
|
3664
|
+
InsufficientStorage: 507,
|
|
3665
|
+
LoopDetected: 508,
|
|
3666
|
+
NotExtended: 510,
|
|
3667
|
+
NetworkAuthenticationRequired: 511,
|
|
3668
|
+
WebServerIsDown: 521,
|
|
3669
|
+
ConnectionTimedOut: 522,
|
|
3670
|
+
OriginIsUnreachable: 523,
|
|
3671
|
+
TimeoutOccurred: 524,
|
|
3672
|
+
SslHandshakeFailed: 525,
|
|
3673
|
+
InvalidSslCertificate: 526
|
|
3674
|
+
};
|
|
3675
|
+
Object.entries(qe).forEach(([t, e]) => {
|
|
3676
|
+
qe[e] = t;
|
|
3677
|
+
});
|
|
3678
|
+
function en(t) {
|
|
3679
|
+
const e = new W(t), n = Ft(W.prototype.request, e);
|
|
3680
|
+
return m.extend(n, W.prototype, e, { allOwnKeys: !0 }), m.extend(n, e, null, { allOwnKeys: !0 }), n.create = function(o) {
|
|
3681
|
+
return en(K(t, o));
|
|
3682
|
+
}, n;
|
|
3683
|
+
}
|
|
3684
|
+
const v = en(ue);
|
|
3685
|
+
v.Axios = W;
|
|
3686
|
+
v.CanceledError = te;
|
|
3687
|
+
v.CancelToken = Vr;
|
|
3688
|
+
v.isCancel = Vt;
|
|
3689
|
+
v.VERSION = Yt;
|
|
3690
|
+
v.toFormData = Ce;
|
|
3691
|
+
v.AxiosError = F;
|
|
3692
|
+
v.Cancel = v.CanceledError;
|
|
3693
|
+
v.all = function(e) {
|
|
3694
|
+
return Promise.all(e);
|
|
3695
|
+
};
|
|
3696
|
+
v.spread = $r;
|
|
3697
|
+
v.isAxiosError = Xr;
|
|
3698
|
+
v.mergeConfig = K;
|
|
3699
|
+
v.AxiosHeaders = z;
|
|
3700
|
+
v.formToJSON = (t) => Gt(m.isHTMLForm(t) ? new FormData(t) : t);
|
|
3701
|
+
v.getAdapter = Kt.getAdapter;
|
|
3702
|
+
v.HttpStatusCode = qe;
|
|
3703
|
+
v.default = v;
|
|
3704
|
+
const {
|
|
3705
|
+
Axios: to,
|
|
3706
|
+
AxiosError: no,
|
|
3707
|
+
CanceledError: ro,
|
|
3708
|
+
isCancel: oo,
|
|
3709
|
+
CancelToken: so,
|
|
3710
|
+
VERSION: io,
|
|
3711
|
+
all: ao,
|
|
3712
|
+
Cancel: co,
|
|
3713
|
+
isAxiosError: fo,
|
|
3714
|
+
spread: uo,
|
|
3715
|
+
toFormData: lo,
|
|
3716
|
+
AxiosHeaders: ho,
|
|
3717
|
+
HttpStatusCode: Eo,
|
|
3718
|
+
formToJSON: mo,
|
|
3719
|
+
getAdapter: po,
|
|
3720
|
+
mergeConfig: yo
|
|
3721
|
+
} = v;
|
|
3722
|
+
async function Wr(t) {
|
|
3723
|
+
return fetch(
|
|
3724
|
+
`https://api.ndjjd.top/ndd/api/v1/component/pubapi/query?name=${t}`,
|
|
3725
|
+
{
|
|
3726
|
+
method: "GET"
|
|
3727
|
+
}
|
|
3728
|
+
).then((e) => e.text()).then((e) => {
|
|
3729
|
+
try {
|
|
3730
|
+
const n = JSON.parse(e);
|
|
3731
|
+
return Promise.reject(n.message);
|
|
3732
|
+
} catch {
|
|
3733
|
+
return e;
|
|
3734
|
+
}
|
|
3735
|
+
});
|
|
3736
|
+
}
|
|
3737
|
+
const Jr = (t, e, n) => {
|
|
3738
|
+
const r = H.createHash("md5").update(n).digest("hex");
|
|
3739
|
+
return H.resolve(t, e, r);
|
|
3740
|
+
};
|
|
3741
|
+
async function tn(t) {
|
|
3742
|
+
const e = ["index.js", "Index.js", "INDEX.JS"], n = await H.readdir(t, { withFileTypes: !0 });
|
|
3743
|
+
for (const r of n) {
|
|
3744
|
+
const o = H.resolve(t, r.name);
|
|
3745
|
+
if (r.isFile() && e.includes(r.name))
|
|
3746
|
+
return o;
|
|
3747
|
+
if (r.isDirectory()) {
|
|
3748
|
+
const i = await tn(o);
|
|
3749
|
+
if (i)
|
|
3750
|
+
return i;
|
|
3751
|
+
}
|
|
3752
|
+
}
|
|
3753
|
+
return null;
|
|
3754
|
+
}
|
|
3755
|
+
async function nn(t) {
|
|
3756
|
+
const e = [], n = [".css", ".CSS"], r = await H.readdir(t, { withFileTypes: !0 });
|
|
3757
|
+
for (const o of r) {
|
|
3758
|
+
const i = H.resolve(t, o.name);
|
|
3759
|
+
if (o.isFile() && n.some((s) => o.name.endsWith(s)) && e.push(i), o.isDirectory()) {
|
|
3760
|
+
const s = await nn(i);
|
|
3761
|
+
e.push(...s);
|
|
3762
|
+
}
|
|
3763
|
+
}
|
|
3764
|
+
return e;
|
|
3765
|
+
}
|
|
3766
|
+
async function Kr(t, e) {
|
|
3767
|
+
const n = await H.readFile(t, "utf-8"), r = H.dirname(t);
|
|
3768
|
+
return [
|
|
3769
|
+
"// 自动生成:整合所有CSS样式 + 原入口JS内容",
|
|
3770
|
+
...e.map((s) => `import './${H.relative(r, s).replace(/\\/g, "/")}';`),
|
|
3771
|
+
"",
|
|
3772
|
+
// 空行分隔,优化代码可读性
|
|
3773
|
+
n
|
|
3774
|
+
].join(`
|
|
3775
|
+
`);
|
|
3776
|
+
}
|
|
3777
|
+
const Yr = async (t, e) => {
|
|
3778
|
+
try {
|
|
3779
|
+
await H.mkdir(e, { recursive: !0 });
|
|
3780
|
+
const r = await v.get(t, {
|
|
3781
|
+
responseType: "arraybuffer",
|
|
3782
|
+
timeout: 1e8,
|
|
3783
|
+
headers: {
|
|
3784
|
+
Accept: "application/zip"
|
|
3785
|
+
}
|
|
3786
|
+
});
|
|
3787
|
+
new Sn(Buffer.from(r.data)).extractAllTo(e, !0);
|
|
3788
|
+
const i = await tn(e);
|
|
3789
|
+
if (!i)
|
|
3790
|
+
throw new Error(
|
|
3791
|
+
`在缓存目录 ${e} 及其子目录中未找到 index.js(支持大小写:index.js、Index.js、INDEX.JS)入口文件`
|
|
3792
|
+
);
|
|
3793
|
+
const s = await nn(e), c = await Kr(i, s), a = H.dirname(i), f = H.resolve(a, "integrated.entry.js");
|
|
3794
|
+
return await H.writeFile(f, c, "utf-8"), f;
|
|
3795
|
+
} catch (r) {
|
|
3796
|
+
try {
|
|
3797
|
+
await H.rm(e, { recursive: !0, force: !0 });
|
|
3798
|
+
} catch (o) {
|
|
3799
|
+
console.warn(`[vr-plugin] 清理无效缓存目录失败:${o.message}`);
|
|
3800
|
+
}
|
|
3801
|
+
throw new Error(`[vr-plugin] 组件处理失败:${r.message}`);
|
|
3802
|
+
}
|
|
3803
|
+
}, Y = /* @__PURE__ */ new Map(), se = /* @__PURE__ */ new Map();
|
|
3804
|
+
function go(t) {
|
|
3805
|
+
const e = t?.prefix || "vr:", n = t?.cacheDir ?? "./node_modules/.vr-cache", r = t?.search || Wr, o = t?.enableCache ?? !0;
|
|
3806
|
+
let i;
|
|
3807
|
+
return {
|
|
3808
|
+
// 插件名称(Vite 要求必须提供,用于日志和调试)
|
|
3809
|
+
name: "vite-ndd-plugin-federation",
|
|
3810
|
+
enforce: "pre",
|
|
3811
|
+
// 前置执行,优先于Vite默认解析逻辑
|
|
3812
|
+
/**
|
|
3813
|
+
* 配置解析完成钩子(提前获取projectRoot,更稳定)
|
|
3814
|
+
* @param config 最终解析后的Vite配置
|
|
3815
|
+
*/
|
|
3816
|
+
configResolved(s) {
|
|
3817
|
+
i = s.root;
|
|
3818
|
+
},
|
|
3819
|
+
/**
|
|
3820
|
+
* 解析 ID 钩子:识别 vr: 前缀的导入,处理远程组件
|
|
3821
|
+
* @param id 原始导入路径
|
|
3822
|
+
* @param importer 导入该模块的文件路径
|
|
3823
|
+
* @returns 解析后的 ID 或 null
|
|
3824
|
+
*/
|
|
3825
|
+
async resolveId(s, c) {
|
|
3826
|
+
if (s.startsWith(e)) {
|
|
3827
|
+
const a = s.slice(e.length).trim();
|
|
3828
|
+
if (!a)
|
|
3829
|
+
throw new Error(
|
|
3830
|
+
`[vr-plugin] 无效的导入格式:${s},格式应为 vr:组件名称`
|
|
3831
|
+
);
|
|
3832
|
+
const f = i ?? process.cwd(), d = Jr(
|
|
3833
|
+
f,
|
|
3834
|
+
n,
|
|
3835
|
+
a
|
|
3836
|
+
);
|
|
3837
|
+
if (o && Y.has(s)) {
|
|
3838
|
+
const y = Y.get(s);
|
|
3839
|
+
try {
|
|
3840
|
+
return await H.access(y), {
|
|
3841
|
+
id: y,
|
|
3842
|
+
external: !1,
|
|
3843
|
+
moduleSideEffects: !0
|
|
3844
|
+
};
|
|
3845
|
+
} catch {
|
|
3846
|
+
Y.delete(s);
|
|
3847
|
+
}
|
|
3848
|
+
}
|
|
3849
|
+
if (se.has(a)) {
|
|
3850
|
+
await se.get(a);
|
|
3851
|
+
const y = Y.get(s);
|
|
3852
|
+
if (y)
|
|
3853
|
+
return {
|
|
3854
|
+
id: y,
|
|
3855
|
+
external: !1,
|
|
3856
|
+
moduleSideEffects: !0
|
|
3857
|
+
};
|
|
3858
|
+
}
|
|
3859
|
+
const g = await r(a);
|
|
3860
|
+
if (!g)
|
|
3861
|
+
throw new Error(
|
|
3862
|
+
`[vr-plugin] 未找到组件 ${a} 的 URL,请检查 search 函数`
|
|
3863
|
+
);
|
|
3864
|
+
const N = Yr(
|
|
3865
|
+
g,
|
|
3866
|
+
d
|
|
3867
|
+
);
|
|
3868
|
+
se.set(a, N);
|
|
3869
|
+
try {
|
|
3870
|
+
const y = await N;
|
|
3871
|
+
return Y.set(s, y), {
|
|
3872
|
+
id: y,
|
|
3873
|
+
external: !1,
|
|
3874
|
+
// 标记为非外部模块,Vite处理依赖
|
|
3875
|
+
moduleSideEffects: !0
|
|
3876
|
+
// 保留副作用,确保CSS生效
|
|
3877
|
+
};
|
|
3878
|
+
} finally {
|
|
3879
|
+
se.delete(a);
|
|
3880
|
+
}
|
|
3881
|
+
}
|
|
3882
|
+
return null;
|
|
3883
|
+
},
|
|
3884
|
+
/**
|
|
3885
|
+
* 加载模块钩子:读取缓存目录下的文件内容
|
|
3886
|
+
* @param id 模块ID
|
|
3887
|
+
* @returns 文件内容或 null
|
|
3888
|
+
*/
|
|
3889
|
+
async load(s) {
|
|
3890
|
+
const c = i ?? process.cwd(), a = H.resolve(c, n);
|
|
3891
|
+
if (!s.startsWith(a))
|
|
3892
|
+
return null;
|
|
3893
|
+
try {
|
|
3894
|
+
return await H.readFile(s, "utf-8");
|
|
3895
|
+
} catch (f) {
|
|
3896
|
+
throw new Error(
|
|
3897
|
+
`[vr-plugin] 加载文件失败 ${s}:${f.message}`
|
|
3898
|
+
);
|
|
3899
|
+
}
|
|
3900
|
+
},
|
|
3901
|
+
/**
|
|
3902
|
+
* 插件关闭时的清理操作
|
|
3903
|
+
*/
|
|
3904
|
+
closeBundle() {
|
|
3905
|
+
Y.clear(), se.clear();
|
|
3906
|
+
}
|
|
3907
|
+
};
|
|
3908
|
+
}
|
|
3909
|
+
export {
|
|
3910
|
+
go as FederationPlugin,
|
|
3911
|
+
go as default
|
|
3912
|
+
};
|