@vrcalphabet/web-fs 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +131 -0
- package/dist/main.d.ts +387 -0
- package/dist/main.js +3801 -0
- package/dist/main.umd.cjs +12 -0
- package/package.json +38 -0
package/dist/main.js
ADDED
|
@@ -0,0 +1,3801 @@
|
|
|
1
|
+
function tr(i) {
|
|
2
|
+
return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
|
|
3
|
+
}
|
|
4
|
+
function rr(i) {
|
|
5
|
+
if (Object.prototype.hasOwnProperty.call(i, "__esModule")) return i;
|
|
6
|
+
var n = i.default;
|
|
7
|
+
if (typeof n == "function") {
|
|
8
|
+
var u = function f() {
|
|
9
|
+
var y = !1;
|
|
10
|
+
try {
|
|
11
|
+
y = this instanceof f;
|
|
12
|
+
} catch {
|
|
13
|
+
}
|
|
14
|
+
return y ? Reflect.construct(n, arguments, this.constructor) : n.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
u.prototype = n.prototype;
|
|
17
|
+
} else u = {};
|
|
18
|
+
return Object.defineProperty(u, "__esModule", { value: !0 }), Object.keys(i).forEach(function(f) {
|
|
19
|
+
var y = Object.getOwnPropertyDescriptor(i, f);
|
|
20
|
+
Object.defineProperty(u, f, y.get ? y : {
|
|
21
|
+
enumerable: !0,
|
|
22
|
+
get: function() {
|
|
23
|
+
return i[f];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}), u;
|
|
27
|
+
}
|
|
28
|
+
var Oe = { exports: {} }, Ne = { exports: {} }, St;
|
|
29
|
+
function xr() {
|
|
30
|
+
return St || (St = 1, (function() {
|
|
31
|
+
var i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", n = {
|
|
32
|
+
// Bit-wise rotation left
|
|
33
|
+
rotl: function(u, f) {
|
|
34
|
+
return u << f | u >>> 32 - f;
|
|
35
|
+
},
|
|
36
|
+
// Bit-wise rotation right
|
|
37
|
+
rotr: function(u, f) {
|
|
38
|
+
return u << 32 - f | u >>> f;
|
|
39
|
+
},
|
|
40
|
+
// Swap big-endian to little-endian and vice versa
|
|
41
|
+
endian: function(u) {
|
|
42
|
+
if (u.constructor == Number)
|
|
43
|
+
return n.rotl(u, 8) & 16711935 | n.rotl(u, 24) & 4278255360;
|
|
44
|
+
for (var f = 0; f < u.length; f++)
|
|
45
|
+
u[f] = n.endian(u[f]);
|
|
46
|
+
return u;
|
|
47
|
+
},
|
|
48
|
+
// Generate an array of any length of random bytes
|
|
49
|
+
randomBytes: function(u) {
|
|
50
|
+
for (var f = []; u > 0; u--)
|
|
51
|
+
f.push(Math.floor(Math.random() * 256));
|
|
52
|
+
return f;
|
|
53
|
+
},
|
|
54
|
+
// Convert a byte array to big-endian 32-bit words
|
|
55
|
+
bytesToWords: function(u) {
|
|
56
|
+
for (var f = [], y = 0, A = 0; y < u.length; y++, A += 8)
|
|
57
|
+
f[A >>> 5] |= u[y] << 24 - A % 32;
|
|
58
|
+
return f;
|
|
59
|
+
},
|
|
60
|
+
// Convert big-endian 32-bit words to a byte array
|
|
61
|
+
wordsToBytes: function(u) {
|
|
62
|
+
for (var f = [], y = 0; y < u.length * 32; y += 8)
|
|
63
|
+
f.push(u[y >>> 5] >>> 24 - y % 32 & 255);
|
|
64
|
+
return f;
|
|
65
|
+
},
|
|
66
|
+
// Convert a byte array to a hex string
|
|
67
|
+
bytesToHex: function(u) {
|
|
68
|
+
for (var f = [], y = 0; y < u.length; y++)
|
|
69
|
+
f.push((u[y] >>> 4).toString(16)), f.push((u[y] & 15).toString(16));
|
|
70
|
+
return f.join("");
|
|
71
|
+
},
|
|
72
|
+
// Convert a hex string to a byte array
|
|
73
|
+
hexToBytes: function(u) {
|
|
74
|
+
for (var f = [], y = 0; y < u.length; y += 2)
|
|
75
|
+
f.push(parseInt(u.substr(y, 2), 16));
|
|
76
|
+
return f;
|
|
77
|
+
},
|
|
78
|
+
// Convert a byte array to a base-64 string
|
|
79
|
+
bytesToBase64: function(u) {
|
|
80
|
+
for (var f = [], y = 0; y < u.length; y += 3)
|
|
81
|
+
for (var A = u[y] << 16 | u[y + 1] << 8 | u[y + 2], s = 0; s < 4; s++)
|
|
82
|
+
y * 8 + s * 6 <= u.length * 8 ? f.push(i.charAt(A >>> 6 * (3 - s) & 63)) : f.push("=");
|
|
83
|
+
return f.join("");
|
|
84
|
+
},
|
|
85
|
+
// Convert a base-64 string to a byte array
|
|
86
|
+
base64ToBytes: function(u) {
|
|
87
|
+
u = u.replace(/[^A-Z0-9+\/]/ig, "");
|
|
88
|
+
for (var f = [], y = 0, A = 0; y < u.length; A = ++y % 4)
|
|
89
|
+
A != 0 && f.push((i.indexOf(u.charAt(y - 1)) & Math.pow(2, -2 * A + 8) - 1) << A * 2 | i.indexOf(u.charAt(y)) >>> 6 - A * 2);
|
|
90
|
+
return f;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
Ne.exports = n;
|
|
94
|
+
})()), Ne.exports;
|
|
95
|
+
}
|
|
96
|
+
var Ue, bt;
|
|
97
|
+
function Ct() {
|
|
98
|
+
if (bt) return Ue;
|
|
99
|
+
bt = 1;
|
|
100
|
+
var i = {
|
|
101
|
+
// UTF-8 encoding
|
|
102
|
+
utf8: {
|
|
103
|
+
// Convert a string to a byte array
|
|
104
|
+
stringToBytes: function(n) {
|
|
105
|
+
return i.bin.stringToBytes(unescape(encodeURIComponent(n)));
|
|
106
|
+
},
|
|
107
|
+
// Convert a byte array to a string
|
|
108
|
+
bytesToString: function(n) {
|
|
109
|
+
return decodeURIComponent(escape(i.bin.bytesToString(n)));
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
// Binary encoding
|
|
113
|
+
bin: {
|
|
114
|
+
// Convert a string to a byte array
|
|
115
|
+
stringToBytes: function(n) {
|
|
116
|
+
for (var u = [], f = 0; f < n.length; f++)
|
|
117
|
+
u.push(n.charCodeAt(f) & 255);
|
|
118
|
+
return u;
|
|
119
|
+
},
|
|
120
|
+
// Convert a byte array to a string
|
|
121
|
+
bytesToString: function(n) {
|
|
122
|
+
for (var u = [], f = 0; f < n.length; f++)
|
|
123
|
+
u.push(String.fromCharCode(n[f]));
|
|
124
|
+
return u.join("");
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
return Ue = i, Ue;
|
|
129
|
+
}
|
|
130
|
+
var Me, Ht;
|
|
131
|
+
function vr() {
|
|
132
|
+
if (Ht) return Me;
|
|
133
|
+
Ht = 1, Me = function(u) {
|
|
134
|
+
return u != null && (i(u) || n(u) || !!u._isBuffer);
|
|
135
|
+
};
|
|
136
|
+
function i(u) {
|
|
137
|
+
return !!u.constructor && typeof u.constructor.isBuffer == "function" && u.constructor.isBuffer(u);
|
|
138
|
+
}
|
|
139
|
+
function n(u) {
|
|
140
|
+
return typeof u.readFloatLE == "function" && typeof u.slice == "function" && i(u.slice(0, 0));
|
|
141
|
+
}
|
|
142
|
+
return Me;
|
|
143
|
+
}
|
|
144
|
+
var Tt;
|
|
145
|
+
function Sr() {
|
|
146
|
+
return Tt || (Tt = 1, (function() {
|
|
147
|
+
var i = xr(), n = Ct().utf8, u = vr(), f = Ct().bin, y = function(A, s) {
|
|
148
|
+
A.constructor == String ? s && s.encoding === "binary" ? A = f.stringToBytes(A) : A = n.stringToBytes(A) : u(A) ? A = Array.prototype.slice.call(A, 0) : !Array.isArray(A) && A.constructor !== Uint8Array && (A = A.toString());
|
|
149
|
+
for (var r = i.bytesToWords(A), g = A.length * 8, l = 1732584193, p = -271733879, h = -1732584194, c = 271733878, E = 0; E < r.length; E++)
|
|
150
|
+
r[E] = (r[E] << 8 | r[E] >>> 24) & 16711935 | (r[E] << 24 | r[E] >>> 8) & 4278255360;
|
|
151
|
+
r[g >>> 5] |= 128 << g % 32, r[(g + 64 >>> 9 << 4) + 14] = g;
|
|
152
|
+
for (var C = y._ff, B = y._gg, S = y._hh, _ = y._ii, E = 0; E < r.length; E += 16) {
|
|
153
|
+
var I = l, R = p, F = h, m = c;
|
|
154
|
+
l = C(l, p, h, c, r[E + 0], 7, -680876936), c = C(c, l, p, h, r[E + 1], 12, -389564586), h = C(h, c, l, p, r[E + 2], 17, 606105819), p = C(p, h, c, l, r[E + 3], 22, -1044525330), l = C(l, p, h, c, r[E + 4], 7, -176418897), c = C(c, l, p, h, r[E + 5], 12, 1200080426), h = C(h, c, l, p, r[E + 6], 17, -1473231341), p = C(p, h, c, l, r[E + 7], 22, -45705983), l = C(l, p, h, c, r[E + 8], 7, 1770035416), c = C(c, l, p, h, r[E + 9], 12, -1958414417), h = C(h, c, l, p, r[E + 10], 17, -42063), p = C(p, h, c, l, r[E + 11], 22, -1990404162), l = C(l, p, h, c, r[E + 12], 7, 1804603682), c = C(c, l, p, h, r[E + 13], 12, -40341101), h = C(h, c, l, p, r[E + 14], 17, -1502002290), p = C(p, h, c, l, r[E + 15], 22, 1236535329), l = B(l, p, h, c, r[E + 1], 5, -165796510), c = B(c, l, p, h, r[E + 6], 9, -1069501632), h = B(h, c, l, p, r[E + 11], 14, 643717713), p = B(p, h, c, l, r[E + 0], 20, -373897302), l = B(l, p, h, c, r[E + 5], 5, -701558691), c = B(c, l, p, h, r[E + 10], 9, 38016083), h = B(h, c, l, p, r[E + 15], 14, -660478335), p = B(p, h, c, l, r[E + 4], 20, -405537848), l = B(l, p, h, c, r[E + 9], 5, 568446438), c = B(c, l, p, h, r[E + 14], 9, -1019803690), h = B(h, c, l, p, r[E + 3], 14, -187363961), p = B(p, h, c, l, r[E + 8], 20, 1163531501), l = B(l, p, h, c, r[E + 13], 5, -1444681467), c = B(c, l, p, h, r[E + 2], 9, -51403784), h = B(h, c, l, p, r[E + 7], 14, 1735328473), p = B(p, h, c, l, r[E + 12], 20, -1926607734), l = S(l, p, h, c, r[E + 5], 4, -378558), c = S(c, l, p, h, r[E + 8], 11, -2022574463), h = S(h, c, l, p, r[E + 11], 16, 1839030562), p = S(p, h, c, l, r[E + 14], 23, -35309556), l = S(l, p, h, c, r[E + 1], 4, -1530992060), c = S(c, l, p, h, r[E + 4], 11, 1272893353), h = S(h, c, l, p, r[E + 7], 16, -155497632), p = S(p, h, c, l, r[E + 10], 23, -1094730640), l = S(l, p, h, c, r[E + 13], 4, 681279174), c = S(c, l, p, h, r[E + 0], 11, -358537222), h = S(h, c, l, p, r[E + 3], 16, -722521979), p = S(p, h, c, l, r[E + 6], 23, 76029189), l = S(l, p, h, c, r[E + 9], 4, -640364487), c = S(c, l, p, h, r[E + 12], 11, -421815835), h = S(h, c, l, p, r[E + 15], 16, 530742520), p = S(p, h, c, l, r[E + 2], 23, -995338651), l = _(l, p, h, c, r[E + 0], 6, -198630844), c = _(c, l, p, h, r[E + 7], 10, 1126891415), h = _(h, c, l, p, r[E + 14], 15, -1416354905), p = _(p, h, c, l, r[E + 5], 21, -57434055), l = _(l, p, h, c, r[E + 12], 6, 1700485571), c = _(c, l, p, h, r[E + 3], 10, -1894986606), h = _(h, c, l, p, r[E + 10], 15, -1051523), p = _(p, h, c, l, r[E + 1], 21, -2054922799), l = _(l, p, h, c, r[E + 8], 6, 1873313359), c = _(c, l, p, h, r[E + 15], 10, -30611744), h = _(h, c, l, p, r[E + 6], 15, -1560198380), p = _(p, h, c, l, r[E + 13], 21, 1309151649), l = _(l, p, h, c, r[E + 4], 6, -145523070), c = _(c, l, p, h, r[E + 11], 10, -1120210379), h = _(h, c, l, p, r[E + 2], 15, 718787259), p = _(p, h, c, l, r[E + 9], 21, -343485551), l = l + I >>> 0, p = p + R >>> 0, h = h + F >>> 0, c = c + m >>> 0;
|
|
155
|
+
}
|
|
156
|
+
return i.endian([l, p, h, c]);
|
|
157
|
+
};
|
|
158
|
+
y._ff = function(A, s, r, g, l, p, h) {
|
|
159
|
+
var c = A + (s & r | ~s & g) + (l >>> 0) + h;
|
|
160
|
+
return (c << p | c >>> 32 - p) + s;
|
|
161
|
+
}, y._gg = function(A, s, r, g, l, p, h) {
|
|
162
|
+
var c = A + (s & g | r & ~g) + (l >>> 0) + h;
|
|
163
|
+
return (c << p | c >>> 32 - p) + s;
|
|
164
|
+
}, y._hh = function(A, s, r, g, l, p, h) {
|
|
165
|
+
var c = A + (s ^ r ^ g) + (l >>> 0) + h;
|
|
166
|
+
return (c << p | c >>> 32 - p) + s;
|
|
167
|
+
}, y._ii = function(A, s, r, g, l, p, h) {
|
|
168
|
+
var c = A + (r ^ (s | ~g)) + (l >>> 0) + h;
|
|
169
|
+
return (c << p | c >>> 32 - p) + s;
|
|
170
|
+
}, y._blocksize = 16, y._digestsize = 16, Oe.exports = function(A, s) {
|
|
171
|
+
if (A == null)
|
|
172
|
+
throw new Error("Illegal argument " + A);
|
|
173
|
+
var r = i.wordsToBytes(y(A, s));
|
|
174
|
+
return s && s.asBytes ? r : s && s.asString ? f.bytesToString(r) : i.bytesToHex(r);
|
|
175
|
+
};
|
|
176
|
+
})()), Oe.exports;
|
|
177
|
+
}
|
|
178
|
+
var br = Sr();
|
|
179
|
+
const Cr = /* @__PURE__ */ tr(br);
|
|
180
|
+
class nr {
|
|
181
|
+
_handle;
|
|
182
|
+
constructor(n) {
|
|
183
|
+
this._handle = n;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* ファイルハンドルの名前。ファイル名やディレクトリ名を表します。
|
|
187
|
+
*/
|
|
188
|
+
get name() {
|
|
189
|
+
return this._handle.name;
|
|
190
|
+
}
|
|
191
|
+
async _verifyPermission(n) {
|
|
192
|
+
return await this._handle.queryPermission({ mode: n }) === "granted" || await this._handle.requestPermission({ mode: n }) === "granted";
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
class ye extends nr {
|
|
196
|
+
/**
|
|
197
|
+
* ファイルハンドルの種類。常に`"file"`を返します。
|
|
198
|
+
*/
|
|
199
|
+
type = "file";
|
|
200
|
+
_handle;
|
|
201
|
+
constructor(n) {
|
|
202
|
+
super(n), this._handle = n;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* ファイルを`WebFsFileHandle`でラップしたものを返します。
|
|
206
|
+
*
|
|
207
|
+
* @param handle すでに取得しているファイルハンドル。
|
|
208
|
+
* @param mode ファイルのオプション。
|
|
209
|
+
* @returns 成功した場合は`WebFsFileHandle`、エラーが出た場合は`undefined`。
|
|
210
|
+
*/
|
|
211
|
+
static async create(n, u = "read") {
|
|
212
|
+
const f = new this(n);
|
|
213
|
+
if (await f._verifyPermission(u))
|
|
214
|
+
return f;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* ファイルの情報を返します。\
|
|
218
|
+
* これには、ファイル名、ファイルサイズ、MIMEの種類、パス、最終更新日時が含まれます。
|
|
219
|
+
*
|
|
220
|
+
* @returns ファイルの情報。
|
|
221
|
+
*/
|
|
222
|
+
async info() {
|
|
223
|
+
const n = await this._handle.getFile();
|
|
224
|
+
return {
|
|
225
|
+
name: n.name,
|
|
226
|
+
size: n.size,
|
|
227
|
+
mimeType: n.type,
|
|
228
|
+
lastModified: n.lastModified
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* ファイルの内容をUTF-8形式の文字列として取得します。
|
|
233
|
+
*
|
|
234
|
+
* @returns ファイルの内容を解釈した文字列を返します。
|
|
235
|
+
*/
|
|
236
|
+
async text() {
|
|
237
|
+
return (await this._handle.getFile()).text();
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* ファイルの内容をUTF-8形式のJSONと解釈したうえで、オブジェクトに変換して返します。
|
|
241
|
+
*
|
|
242
|
+
* @returns 有効なJSON構文である場合は`unknown`、そうでない場合は`undefined`が返ります。
|
|
243
|
+
*/
|
|
244
|
+
async json() {
|
|
245
|
+
try {
|
|
246
|
+
return JSON.parse(await this.text());
|
|
247
|
+
} catch {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* ファイルを`Blob`として取得します。
|
|
253
|
+
*
|
|
254
|
+
* @returns ファイルの`Blob`オブジェクト。
|
|
255
|
+
*/
|
|
256
|
+
async blob() {
|
|
257
|
+
return await this._handle.getFile();
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* ファイルを`arrayBuffer`として取得します。
|
|
261
|
+
*
|
|
262
|
+
* @returns ファイルの`arrayBuffer`オブジェクト。
|
|
263
|
+
*/
|
|
264
|
+
async arrayBuffer() {
|
|
265
|
+
return (await this.blob()).arrayBuffer();
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* ファイルのハッシュ値を取得します。\
|
|
269
|
+
* ハッシュ値のアルゴリズムは、`md5`、`sha256`、`sha512`から選べます。
|
|
270
|
+
*
|
|
271
|
+
* @returns ハッシュ化された16進数の文字列。
|
|
272
|
+
*/
|
|
273
|
+
async hash(n = "sha256") {
|
|
274
|
+
if (n === "md5") {
|
|
275
|
+
const u = await this.text();
|
|
276
|
+
return Cr(u);
|
|
277
|
+
} else {
|
|
278
|
+
const u = await this.arrayBuffer(), f = await crypto.subtle.digest(
|
|
279
|
+
{ sha256: "SHA-256", sha512: "SHA-512" }[n],
|
|
280
|
+
u
|
|
281
|
+
);
|
|
282
|
+
return Array.from(new Uint8Array(f)).map((s) => s.toString(16).padStart(2, "0")).join("");
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* ファイルの内容を`data`の内容で**上書き**します。
|
|
287
|
+
*
|
|
288
|
+
* @returns ファイルの書き込みに成功した場合は`true`、失敗した場合は`false`。
|
|
289
|
+
*/
|
|
290
|
+
async write(n) {
|
|
291
|
+
return this._write({ data: n, append: !1 });
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* ファイルの内容に`data`の内容を追記します。
|
|
295
|
+
*
|
|
296
|
+
* @returns ファイルの書き込みに成功した場合は`true`、失敗した場合は`false`。
|
|
297
|
+
*/
|
|
298
|
+
async append(n) {
|
|
299
|
+
return this._write({ data: n, append: !0 });
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* ファイルの読み込みストリームを取得します。
|
|
303
|
+
*
|
|
304
|
+
* @returns ファイルの読み込みストリーム。
|
|
305
|
+
*/
|
|
306
|
+
async readStream() {
|
|
307
|
+
return (await this._handle.getFile()).stream();
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* ファイルの書き込みストリームを取得します。
|
|
311
|
+
*
|
|
312
|
+
* @returns ファイルの書き込みストリーム。
|
|
313
|
+
*/
|
|
314
|
+
async writeStream(n) {
|
|
315
|
+
return await this._handle.createWritable(n);
|
|
316
|
+
}
|
|
317
|
+
async _write(n) {
|
|
318
|
+
try {
|
|
319
|
+
const u = await this._handle.createWritable({
|
|
320
|
+
keepExistingData: n.append
|
|
321
|
+
});
|
|
322
|
+
if (n.append) {
|
|
323
|
+
const f = await this._handle.getFile();
|
|
324
|
+
u.seek(f.size);
|
|
325
|
+
}
|
|
326
|
+
return u.write(n.data), u.close(), !0;
|
|
327
|
+
} catch {
|
|
328
|
+
return !1;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
const ce = {}, Hr = typeof global < "u" ? global : typeof self < "u" ? self : typeof window < "u" ? window : {};
|
|
333
|
+
var ke = {}, Ae = {}, Ft;
|
|
334
|
+
function Tr() {
|
|
335
|
+
if (Ft) return Ae;
|
|
336
|
+
Ft = 1, Ae.byteLength = r, Ae.toByteArray = l, Ae.fromByteArray = c;
|
|
337
|
+
for (var i = [], n = [], u = typeof Uint8Array < "u" ? Uint8Array : Array, f = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", y = 0, A = f.length; y < A; ++y)
|
|
338
|
+
i[y] = f[y], n[f.charCodeAt(y)] = y;
|
|
339
|
+
n[45] = 62, n[95] = 63;
|
|
340
|
+
function s(E) {
|
|
341
|
+
var C = E.length;
|
|
342
|
+
if (C % 4 > 0)
|
|
343
|
+
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
344
|
+
var B = E.indexOf("=");
|
|
345
|
+
B === -1 && (B = C);
|
|
346
|
+
var S = B === C ? 0 : 4 - B % 4;
|
|
347
|
+
return [B, S];
|
|
348
|
+
}
|
|
349
|
+
function r(E) {
|
|
350
|
+
var C = s(E), B = C[0], S = C[1];
|
|
351
|
+
return (B + S) * 3 / 4 - S;
|
|
352
|
+
}
|
|
353
|
+
function g(E, C, B) {
|
|
354
|
+
return (C + B) * 3 / 4 - B;
|
|
355
|
+
}
|
|
356
|
+
function l(E) {
|
|
357
|
+
var C, B = s(E), S = B[0], _ = B[1], I = new u(g(E, S, _)), R = 0, F = _ > 0 ? S - 4 : S, m;
|
|
358
|
+
for (m = 0; m < F; m += 4)
|
|
359
|
+
C = n[E.charCodeAt(m)] << 18 | n[E.charCodeAt(m + 1)] << 12 | n[E.charCodeAt(m + 2)] << 6 | n[E.charCodeAt(m + 3)], I[R++] = C >> 16 & 255, I[R++] = C >> 8 & 255, I[R++] = C & 255;
|
|
360
|
+
return _ === 2 && (C = n[E.charCodeAt(m)] << 2 | n[E.charCodeAt(m + 1)] >> 4, I[R++] = C & 255), _ === 1 && (C = n[E.charCodeAt(m)] << 10 | n[E.charCodeAt(m + 1)] << 4 | n[E.charCodeAt(m + 2)] >> 2, I[R++] = C >> 8 & 255, I[R++] = C & 255), I;
|
|
361
|
+
}
|
|
362
|
+
function p(E) {
|
|
363
|
+
return i[E >> 18 & 63] + i[E >> 12 & 63] + i[E >> 6 & 63] + i[E & 63];
|
|
364
|
+
}
|
|
365
|
+
function h(E, C, B) {
|
|
366
|
+
for (var S, _ = [], I = C; I < B; I += 3)
|
|
367
|
+
S = (E[I] << 16 & 16711680) + (E[I + 1] << 8 & 65280) + (E[I + 2] & 255), _.push(p(S));
|
|
368
|
+
return _.join("");
|
|
369
|
+
}
|
|
370
|
+
function c(E) {
|
|
371
|
+
for (var C, B = E.length, S = B % 3, _ = [], I = 16383, R = 0, F = B - S; R < F; R += I)
|
|
372
|
+
_.push(h(E, R, R + I > F ? F : R + I));
|
|
373
|
+
return S === 1 ? (C = E[B - 1], _.push(
|
|
374
|
+
i[C >> 2] + i[C << 4 & 63] + "=="
|
|
375
|
+
)) : S === 2 && (C = (E[B - 2] << 8) + E[B - 1], _.push(
|
|
376
|
+
i[C >> 10] + i[C >> 4 & 63] + i[C << 2 & 63] + "="
|
|
377
|
+
)), _.join("");
|
|
378
|
+
}
|
|
379
|
+
return Ae;
|
|
380
|
+
}
|
|
381
|
+
var ve = {};
|
|
382
|
+
var Bt;
|
|
383
|
+
function Fr() {
|
|
384
|
+
return Bt || (Bt = 1, ve.read = function(i, n, u, f, y) {
|
|
385
|
+
var A, s, r = y * 8 - f - 1, g = (1 << r) - 1, l = g >> 1, p = -7, h = u ? y - 1 : 0, c = u ? -1 : 1, E = i[n + h];
|
|
386
|
+
for (h += c, A = E & (1 << -p) - 1, E >>= -p, p += r; p > 0; A = A * 256 + i[n + h], h += c, p -= 8)
|
|
387
|
+
;
|
|
388
|
+
for (s = A & (1 << -p) - 1, A >>= -p, p += f; p > 0; s = s * 256 + i[n + h], h += c, p -= 8)
|
|
389
|
+
;
|
|
390
|
+
if (A === 0)
|
|
391
|
+
A = 1 - l;
|
|
392
|
+
else {
|
|
393
|
+
if (A === g)
|
|
394
|
+
return s ? NaN : (E ? -1 : 1) * (1 / 0);
|
|
395
|
+
s = s + Math.pow(2, f), A = A - l;
|
|
396
|
+
}
|
|
397
|
+
return (E ? -1 : 1) * s * Math.pow(2, A - f);
|
|
398
|
+
}, ve.write = function(i, n, u, f, y, A) {
|
|
399
|
+
var s, r, g, l = A * 8 - y - 1, p = (1 << l) - 1, h = p >> 1, c = y === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, E = f ? 0 : A - 1, C = f ? 1 : -1, B = n < 0 || n === 0 && 1 / n < 0 ? 1 : 0;
|
|
400
|
+
for (n = Math.abs(n), isNaN(n) || n === 1 / 0 ? (r = isNaN(n) ? 1 : 0, s = p) : (s = Math.floor(Math.log(n) / Math.LN2), n * (g = Math.pow(2, -s)) < 1 && (s--, g *= 2), s + h >= 1 ? n += c / g : n += c * Math.pow(2, 1 - h), n * g >= 2 && (s++, g /= 2), s + h >= p ? (r = 0, s = p) : s + h >= 1 ? (r = (n * g - 1) * Math.pow(2, y), s = s + h) : (r = n * Math.pow(2, h - 1) * Math.pow(2, y), s = 0)); y >= 8; i[u + E] = r & 255, E += C, r /= 256, y -= 8)
|
|
401
|
+
;
|
|
402
|
+
for (s = s << y | r, l += y; l > 0; i[u + E] = s & 255, E += C, s /= 256, l -= 8)
|
|
403
|
+
;
|
|
404
|
+
i[u + E - C] |= B * 128;
|
|
405
|
+
}), ve;
|
|
406
|
+
}
|
|
407
|
+
var $t;
|
|
408
|
+
function Br() {
|
|
409
|
+
return $t || ($t = 1, (function(i) {
|
|
410
|
+
var n = Tr(), u = Fr(), f = typeof Symbol == "function" && typeof Symbol.for == "function" ? /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom") : null;
|
|
411
|
+
i.Buffer = r, i.SlowBuffer = I, i.INSPECT_MAX_BYTES = 50;
|
|
412
|
+
var y = 2147483647;
|
|
413
|
+
i.kMaxLength = y, r.TYPED_ARRAY_SUPPORT = A(), !r.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
|
|
414
|
+
"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
|
|
415
|
+
);
|
|
416
|
+
function A() {
|
|
417
|
+
try {
|
|
418
|
+
var a = new Uint8Array(1), e = { foo: function() {
|
|
419
|
+
return 42;
|
|
420
|
+
} };
|
|
421
|
+
return Object.setPrototypeOf(e, Uint8Array.prototype), Object.setPrototypeOf(a, e), a.foo() === 42;
|
|
422
|
+
} catch {
|
|
423
|
+
return !1;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
Object.defineProperty(r.prototype, "parent", {
|
|
427
|
+
enumerable: !0,
|
|
428
|
+
get: function() {
|
|
429
|
+
if (r.isBuffer(this))
|
|
430
|
+
return this.buffer;
|
|
431
|
+
}
|
|
432
|
+
}), Object.defineProperty(r.prototype, "offset", {
|
|
433
|
+
enumerable: !0,
|
|
434
|
+
get: function() {
|
|
435
|
+
if (r.isBuffer(this))
|
|
436
|
+
return this.byteOffset;
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
function s(a) {
|
|
440
|
+
if (a > y)
|
|
441
|
+
throw new RangeError('The value "' + a + '" is invalid for option "size"');
|
|
442
|
+
var e = new Uint8Array(a);
|
|
443
|
+
return Object.setPrototypeOf(e, r.prototype), e;
|
|
444
|
+
}
|
|
445
|
+
function r(a, e, t) {
|
|
446
|
+
if (typeof a == "number") {
|
|
447
|
+
if (typeof e == "string")
|
|
448
|
+
throw new TypeError(
|
|
449
|
+
'The "string" argument must be of type string. Received type number'
|
|
450
|
+
);
|
|
451
|
+
return h(a);
|
|
452
|
+
}
|
|
453
|
+
return g(a, e, t);
|
|
454
|
+
}
|
|
455
|
+
r.poolSize = 8192;
|
|
456
|
+
function g(a, e, t) {
|
|
457
|
+
if (typeof a == "string")
|
|
458
|
+
return c(a, e);
|
|
459
|
+
if (ArrayBuffer.isView(a))
|
|
460
|
+
return C(a);
|
|
461
|
+
if (a == null)
|
|
462
|
+
throw new TypeError(
|
|
463
|
+
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof a
|
|
464
|
+
);
|
|
465
|
+
if (ie(a, ArrayBuffer) || a && ie(a.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (ie(a, SharedArrayBuffer) || a && ie(a.buffer, SharedArrayBuffer)))
|
|
466
|
+
return B(a, e, t);
|
|
467
|
+
if (typeof a == "number")
|
|
468
|
+
throw new TypeError(
|
|
469
|
+
'The "value" argument must not be of type number. Received type number'
|
|
470
|
+
);
|
|
471
|
+
var o = a.valueOf && a.valueOf();
|
|
472
|
+
if (o != null && o !== a)
|
|
473
|
+
return r.from(o, e, t);
|
|
474
|
+
var d = S(a);
|
|
475
|
+
if (d) return d;
|
|
476
|
+
if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof a[Symbol.toPrimitive] == "function")
|
|
477
|
+
return r.from(
|
|
478
|
+
a[Symbol.toPrimitive]("string"),
|
|
479
|
+
e,
|
|
480
|
+
t
|
|
481
|
+
);
|
|
482
|
+
throw new TypeError(
|
|
483
|
+
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof a
|
|
484
|
+
);
|
|
485
|
+
}
|
|
486
|
+
r.from = function(a, e, t) {
|
|
487
|
+
return g(a, e, t);
|
|
488
|
+
}, Object.setPrototypeOf(r.prototype, Uint8Array.prototype), Object.setPrototypeOf(r, Uint8Array);
|
|
489
|
+
function l(a) {
|
|
490
|
+
if (typeof a != "number")
|
|
491
|
+
throw new TypeError('"size" argument must be of type number');
|
|
492
|
+
if (a < 0)
|
|
493
|
+
throw new RangeError('The value "' + a + '" is invalid for option "size"');
|
|
494
|
+
}
|
|
495
|
+
function p(a, e, t) {
|
|
496
|
+
return l(a), a <= 0 ? s(a) : e !== void 0 ? typeof t == "string" ? s(a).fill(e, t) : s(a).fill(e) : s(a);
|
|
497
|
+
}
|
|
498
|
+
r.alloc = function(a, e, t) {
|
|
499
|
+
return p(a, e, t);
|
|
500
|
+
};
|
|
501
|
+
function h(a) {
|
|
502
|
+
return l(a), s(a < 0 ? 0 : _(a) | 0);
|
|
503
|
+
}
|
|
504
|
+
r.allocUnsafe = function(a) {
|
|
505
|
+
return h(a);
|
|
506
|
+
}, r.allocUnsafeSlow = function(a) {
|
|
507
|
+
return h(a);
|
|
508
|
+
};
|
|
509
|
+
function c(a, e) {
|
|
510
|
+
if ((typeof e != "string" || e === "") && (e = "utf8"), !r.isEncoding(e))
|
|
511
|
+
throw new TypeError("Unknown encoding: " + e);
|
|
512
|
+
var t = R(a, e) | 0, o = s(t), d = o.write(a, e);
|
|
513
|
+
return d !== t && (o = o.slice(0, d)), o;
|
|
514
|
+
}
|
|
515
|
+
function E(a) {
|
|
516
|
+
for (var e = a.length < 0 ? 0 : _(a.length) | 0, t = s(e), o = 0; o < e; o += 1)
|
|
517
|
+
t[o] = a[o] & 255;
|
|
518
|
+
return t;
|
|
519
|
+
}
|
|
520
|
+
function C(a) {
|
|
521
|
+
if (ie(a, Uint8Array)) {
|
|
522
|
+
var e = new Uint8Array(a);
|
|
523
|
+
return B(e.buffer, e.byteOffset, e.byteLength);
|
|
524
|
+
}
|
|
525
|
+
return E(a);
|
|
526
|
+
}
|
|
527
|
+
function B(a, e, t) {
|
|
528
|
+
if (e < 0 || a.byteLength < e)
|
|
529
|
+
throw new RangeError('"offset" is outside of buffer bounds');
|
|
530
|
+
if (a.byteLength < e + (t || 0))
|
|
531
|
+
throw new RangeError('"length" is outside of buffer bounds');
|
|
532
|
+
var o;
|
|
533
|
+
return e === void 0 && t === void 0 ? o = new Uint8Array(a) : t === void 0 ? o = new Uint8Array(a, e) : o = new Uint8Array(a, e, t), Object.setPrototypeOf(o, r.prototype), o;
|
|
534
|
+
}
|
|
535
|
+
function S(a) {
|
|
536
|
+
if (r.isBuffer(a)) {
|
|
537
|
+
var e = _(a.length) | 0, t = s(e);
|
|
538
|
+
return t.length === 0 || a.copy(t, 0, 0, e), t;
|
|
539
|
+
}
|
|
540
|
+
if (a.length !== void 0)
|
|
541
|
+
return typeof a.length != "number" || ae(a.length) ? s(0) : E(a);
|
|
542
|
+
if (a.type === "Buffer" && Array.isArray(a.data))
|
|
543
|
+
return E(a.data);
|
|
544
|
+
}
|
|
545
|
+
function _(a) {
|
|
546
|
+
if (a >= y)
|
|
547
|
+
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + y.toString(16) + " bytes");
|
|
548
|
+
return a | 0;
|
|
549
|
+
}
|
|
550
|
+
function I(a) {
|
|
551
|
+
return +a != a && (a = 0), r.alloc(+a);
|
|
552
|
+
}
|
|
553
|
+
r.isBuffer = function(e) {
|
|
554
|
+
return e != null && e._isBuffer === !0 && e !== r.prototype;
|
|
555
|
+
}, r.compare = function(e, t) {
|
|
556
|
+
if (ie(e, Uint8Array) && (e = r.from(e, e.offset, e.byteLength)), ie(t, Uint8Array) && (t = r.from(t, t.offset, t.byteLength)), !r.isBuffer(e) || !r.isBuffer(t))
|
|
557
|
+
throw new TypeError(
|
|
558
|
+
'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
|
|
559
|
+
);
|
|
560
|
+
if (e === t) return 0;
|
|
561
|
+
for (var o = e.length, d = t.length, w = 0, v = Math.min(o, d); w < v; ++w)
|
|
562
|
+
if (e[w] !== t[w]) {
|
|
563
|
+
o = e[w], d = t[w];
|
|
564
|
+
break;
|
|
565
|
+
}
|
|
566
|
+
return o < d ? -1 : d < o ? 1 : 0;
|
|
567
|
+
}, r.isEncoding = function(e) {
|
|
568
|
+
switch (String(e).toLowerCase()) {
|
|
569
|
+
case "hex":
|
|
570
|
+
case "utf8":
|
|
571
|
+
case "utf-8":
|
|
572
|
+
case "ascii":
|
|
573
|
+
case "latin1":
|
|
574
|
+
case "binary":
|
|
575
|
+
case "base64":
|
|
576
|
+
case "ucs2":
|
|
577
|
+
case "ucs-2":
|
|
578
|
+
case "utf16le":
|
|
579
|
+
case "utf-16le":
|
|
580
|
+
return !0;
|
|
581
|
+
default:
|
|
582
|
+
return !1;
|
|
583
|
+
}
|
|
584
|
+
}, r.concat = function(e, t) {
|
|
585
|
+
if (!Array.isArray(e))
|
|
586
|
+
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
587
|
+
if (e.length === 0)
|
|
588
|
+
return r.alloc(0);
|
|
589
|
+
var o;
|
|
590
|
+
if (t === void 0)
|
|
591
|
+
for (t = 0, o = 0; o < e.length; ++o)
|
|
592
|
+
t += e[o].length;
|
|
593
|
+
var d = r.allocUnsafe(t), w = 0;
|
|
594
|
+
for (o = 0; o < e.length; ++o) {
|
|
595
|
+
var v = e[o];
|
|
596
|
+
if (ie(v, Uint8Array))
|
|
597
|
+
w + v.length > d.length ? r.from(v).copy(d, w) : Uint8Array.prototype.set.call(
|
|
598
|
+
d,
|
|
599
|
+
v,
|
|
600
|
+
w
|
|
601
|
+
);
|
|
602
|
+
else if (r.isBuffer(v))
|
|
603
|
+
v.copy(d, w);
|
|
604
|
+
else
|
|
605
|
+
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
606
|
+
w += v.length;
|
|
607
|
+
}
|
|
608
|
+
return d;
|
|
609
|
+
};
|
|
610
|
+
function R(a, e) {
|
|
611
|
+
if (r.isBuffer(a))
|
|
612
|
+
return a.length;
|
|
613
|
+
if (ArrayBuffer.isView(a) || ie(a, ArrayBuffer))
|
|
614
|
+
return a.byteLength;
|
|
615
|
+
if (typeof a != "string")
|
|
616
|
+
throw new TypeError(
|
|
617
|
+
'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof a
|
|
618
|
+
);
|
|
619
|
+
var t = a.length, o = arguments.length > 2 && arguments[2] === !0;
|
|
620
|
+
if (!o && t === 0) return 0;
|
|
621
|
+
for (var d = !1; ; )
|
|
622
|
+
switch (e) {
|
|
623
|
+
case "ascii":
|
|
624
|
+
case "latin1":
|
|
625
|
+
case "binary":
|
|
626
|
+
return t;
|
|
627
|
+
case "utf8":
|
|
628
|
+
case "utf-8":
|
|
629
|
+
return k(a).length;
|
|
630
|
+
case "ucs2":
|
|
631
|
+
case "ucs-2":
|
|
632
|
+
case "utf16le":
|
|
633
|
+
case "utf-16le":
|
|
634
|
+
return t * 2;
|
|
635
|
+
case "hex":
|
|
636
|
+
return t >>> 1;
|
|
637
|
+
case "base64":
|
|
638
|
+
return V(a).length;
|
|
639
|
+
default:
|
|
640
|
+
if (d)
|
|
641
|
+
return o ? -1 : k(a).length;
|
|
642
|
+
e = ("" + e).toLowerCase(), d = !0;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
r.byteLength = R;
|
|
646
|
+
function F(a, e, t) {
|
|
647
|
+
var o = !1;
|
|
648
|
+
if ((e === void 0 || e < 0) && (e = 0), e > this.length || ((t === void 0 || t > this.length) && (t = this.length), t <= 0) || (t >>>= 0, e >>>= 0, t <= e))
|
|
649
|
+
return "";
|
|
650
|
+
for (a || (a = "utf8"); ; )
|
|
651
|
+
switch (a) {
|
|
652
|
+
case "hex":
|
|
653
|
+
return oe(this, e, t);
|
|
654
|
+
case "utf8":
|
|
655
|
+
case "utf-8":
|
|
656
|
+
return X(this, e, t);
|
|
657
|
+
case "ascii":
|
|
658
|
+
return P(this, e, t);
|
|
659
|
+
case "latin1":
|
|
660
|
+
case "binary":
|
|
661
|
+
return Y(this, e, t);
|
|
662
|
+
case "base64":
|
|
663
|
+
return $(this, e, t);
|
|
664
|
+
case "ucs2":
|
|
665
|
+
case "ucs-2":
|
|
666
|
+
case "utf16le":
|
|
667
|
+
case "utf-16le":
|
|
668
|
+
return ee(this, e, t);
|
|
669
|
+
default:
|
|
670
|
+
if (o) throw new TypeError("Unknown encoding: " + a);
|
|
671
|
+
a = (a + "").toLowerCase(), o = !0;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
r.prototype._isBuffer = !0;
|
|
675
|
+
function m(a, e, t) {
|
|
676
|
+
var o = a[e];
|
|
677
|
+
a[e] = a[t], a[t] = o;
|
|
678
|
+
}
|
|
679
|
+
r.prototype.swap16 = function() {
|
|
680
|
+
var e = this.length;
|
|
681
|
+
if (e % 2 !== 0)
|
|
682
|
+
throw new RangeError("Buffer size must be a multiple of 16-bits");
|
|
683
|
+
for (var t = 0; t < e; t += 2)
|
|
684
|
+
m(this, t, t + 1);
|
|
685
|
+
return this;
|
|
686
|
+
}, r.prototype.swap32 = function() {
|
|
687
|
+
var e = this.length;
|
|
688
|
+
if (e % 4 !== 0)
|
|
689
|
+
throw new RangeError("Buffer size must be a multiple of 32-bits");
|
|
690
|
+
for (var t = 0; t < e; t += 4)
|
|
691
|
+
m(this, t, t + 3), m(this, t + 1, t + 2);
|
|
692
|
+
return this;
|
|
693
|
+
}, r.prototype.swap64 = function() {
|
|
694
|
+
var e = this.length;
|
|
695
|
+
if (e % 8 !== 0)
|
|
696
|
+
throw new RangeError("Buffer size must be a multiple of 64-bits");
|
|
697
|
+
for (var t = 0; t < e; t += 8)
|
|
698
|
+
m(this, t, t + 7), m(this, t + 1, t + 6), m(this, t + 2, t + 5), m(this, t + 3, t + 4);
|
|
699
|
+
return this;
|
|
700
|
+
}, r.prototype.toString = function() {
|
|
701
|
+
var e = this.length;
|
|
702
|
+
return e === 0 ? "" : arguments.length === 0 ? X(this, 0, e) : F.apply(this, arguments);
|
|
703
|
+
}, r.prototype.toLocaleString = r.prototype.toString, r.prototype.equals = function(e) {
|
|
704
|
+
if (!r.isBuffer(e)) throw new TypeError("Argument must be a Buffer");
|
|
705
|
+
return this === e ? !0 : r.compare(this, e) === 0;
|
|
706
|
+
}, r.prototype.inspect = function() {
|
|
707
|
+
var e = "", t = i.INSPECT_MAX_BYTES;
|
|
708
|
+
return e = this.toString("hex", 0, t).replace(/(.{2})/g, "$1 ").trim(), this.length > t && (e += " ... "), "<Buffer " + e + ">";
|
|
709
|
+
}, f && (r.prototype[f] = r.prototype.inspect), r.prototype.compare = function(e, t, o, d, w) {
|
|
710
|
+
if (ie(e, Uint8Array) && (e = r.from(e, e.offset, e.byteLength)), !r.isBuffer(e))
|
|
711
|
+
throw new TypeError(
|
|
712
|
+
'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof e
|
|
713
|
+
);
|
|
714
|
+
if (t === void 0 && (t = 0), o === void 0 && (o = e ? e.length : 0), d === void 0 && (d = 0), w === void 0 && (w = this.length), t < 0 || o > e.length || d < 0 || w > this.length)
|
|
715
|
+
throw new RangeError("out of range index");
|
|
716
|
+
if (d >= w && t >= o)
|
|
717
|
+
return 0;
|
|
718
|
+
if (d >= w)
|
|
719
|
+
return -1;
|
|
720
|
+
if (t >= o)
|
|
721
|
+
return 1;
|
|
722
|
+
if (t >>>= 0, o >>>= 0, d >>>= 0, w >>>= 0, this === e) return 0;
|
|
723
|
+
for (var v = w - d, U = o - t, q = Math.min(v, U), G = this.slice(d, w), te = e.slice(t, o), Z = 0; Z < q; ++Z)
|
|
724
|
+
if (G[Z] !== te[Z]) {
|
|
725
|
+
v = G[Z], U = te[Z];
|
|
726
|
+
break;
|
|
727
|
+
}
|
|
728
|
+
return v < U ? -1 : U < v ? 1 : 0;
|
|
729
|
+
};
|
|
730
|
+
function L(a, e, t, o, d) {
|
|
731
|
+
if (a.length === 0) return -1;
|
|
732
|
+
if (typeof t == "string" ? (o = t, t = 0) : t > 2147483647 ? t = 2147483647 : t < -2147483648 && (t = -2147483648), t = +t, ae(t) && (t = d ? 0 : a.length - 1), t < 0 && (t = a.length + t), t >= a.length) {
|
|
733
|
+
if (d) return -1;
|
|
734
|
+
t = a.length - 1;
|
|
735
|
+
} else if (t < 0)
|
|
736
|
+
if (d) t = 0;
|
|
737
|
+
else return -1;
|
|
738
|
+
if (typeof e == "string" && (e = r.from(e, o)), r.isBuffer(e))
|
|
739
|
+
return e.length === 0 ? -1 : T(a, e, t, o, d);
|
|
740
|
+
if (typeof e == "number")
|
|
741
|
+
return e = e & 255, typeof Uint8Array.prototype.indexOf == "function" ? d ? Uint8Array.prototype.indexOf.call(a, e, t) : Uint8Array.prototype.lastIndexOf.call(a, e, t) : T(a, [e], t, o, d);
|
|
742
|
+
throw new TypeError("val must be string, number or Buffer");
|
|
743
|
+
}
|
|
744
|
+
function T(a, e, t, o, d) {
|
|
745
|
+
var w = 1, v = a.length, U = e.length;
|
|
746
|
+
if (o !== void 0 && (o = String(o).toLowerCase(), o === "ucs2" || o === "ucs-2" || o === "utf16le" || o === "utf-16le")) {
|
|
747
|
+
if (a.length < 2 || e.length < 2)
|
|
748
|
+
return -1;
|
|
749
|
+
w = 2, v /= 2, U /= 2, t /= 2;
|
|
750
|
+
}
|
|
751
|
+
function q(xt, vt) {
|
|
752
|
+
return w === 1 ? xt[vt] : xt.readUInt16BE(vt * w);
|
|
753
|
+
}
|
|
754
|
+
var G;
|
|
755
|
+
if (d) {
|
|
756
|
+
var te = -1;
|
|
757
|
+
for (G = t; G < v; G++)
|
|
758
|
+
if (q(a, G) === q(e, te === -1 ? 0 : G - te)) {
|
|
759
|
+
if (te === -1 && (te = G), G - te + 1 === U) return te * w;
|
|
760
|
+
} else
|
|
761
|
+
te !== -1 && (G -= G - te), te = -1;
|
|
762
|
+
} else
|
|
763
|
+
for (t + U > v && (t = v - U), G = t; G >= 0; G--) {
|
|
764
|
+
for (var Z = !0, xe = 0; xe < U; xe++)
|
|
765
|
+
if (q(a, G + xe) !== q(e, xe)) {
|
|
766
|
+
Z = !1;
|
|
767
|
+
break;
|
|
768
|
+
}
|
|
769
|
+
if (Z) return G;
|
|
770
|
+
}
|
|
771
|
+
return -1;
|
|
772
|
+
}
|
|
773
|
+
r.prototype.includes = function(e, t, o) {
|
|
774
|
+
return this.indexOf(e, t, o) !== -1;
|
|
775
|
+
}, r.prototype.indexOf = function(e, t, o) {
|
|
776
|
+
return L(this, e, t, o, !0);
|
|
777
|
+
}, r.prototype.lastIndexOf = function(e, t, o) {
|
|
778
|
+
return L(this, e, t, o, !1);
|
|
779
|
+
};
|
|
780
|
+
function O(a, e, t, o) {
|
|
781
|
+
t = Number(t) || 0;
|
|
782
|
+
var d = a.length - t;
|
|
783
|
+
o ? (o = Number(o), o > d && (o = d)) : o = d;
|
|
784
|
+
var w = e.length;
|
|
785
|
+
o > w / 2 && (o = w / 2);
|
|
786
|
+
for (var v = 0; v < o; ++v) {
|
|
787
|
+
var U = parseInt(e.substr(v * 2, 2), 16);
|
|
788
|
+
if (ae(U)) return v;
|
|
789
|
+
a[t + v] = U;
|
|
790
|
+
}
|
|
791
|
+
return v;
|
|
792
|
+
}
|
|
793
|
+
function N(a, e, t, o) {
|
|
794
|
+
return J(k(e, a.length - t), a, t, o);
|
|
795
|
+
}
|
|
796
|
+
function M(a, e, t, o) {
|
|
797
|
+
return J(ue(e), a, t, o);
|
|
798
|
+
}
|
|
799
|
+
function z(a, e, t, o) {
|
|
800
|
+
return J(V(e), a, t, o);
|
|
801
|
+
}
|
|
802
|
+
function D(a, e, t, o) {
|
|
803
|
+
return J(le(e, a.length - t), a, t, o);
|
|
804
|
+
}
|
|
805
|
+
r.prototype.write = function(e, t, o, d) {
|
|
806
|
+
if (t === void 0)
|
|
807
|
+
d = "utf8", o = this.length, t = 0;
|
|
808
|
+
else if (o === void 0 && typeof t == "string")
|
|
809
|
+
d = t, o = this.length, t = 0;
|
|
810
|
+
else if (isFinite(t))
|
|
811
|
+
t = t >>> 0, isFinite(o) ? (o = o >>> 0, d === void 0 && (d = "utf8")) : (d = o, o = void 0);
|
|
812
|
+
else
|
|
813
|
+
throw new Error(
|
|
814
|
+
"Buffer.write(string, encoding, offset[, length]) is no longer supported"
|
|
815
|
+
);
|
|
816
|
+
var w = this.length - t;
|
|
817
|
+
if ((o === void 0 || o > w) && (o = w), e.length > 0 && (o < 0 || t < 0) || t > this.length)
|
|
818
|
+
throw new RangeError("Attempt to write outside buffer bounds");
|
|
819
|
+
d || (d = "utf8");
|
|
820
|
+
for (var v = !1; ; )
|
|
821
|
+
switch (d) {
|
|
822
|
+
case "hex":
|
|
823
|
+
return O(this, e, t, o);
|
|
824
|
+
case "utf8":
|
|
825
|
+
case "utf-8":
|
|
826
|
+
return N(this, e, t, o);
|
|
827
|
+
case "ascii":
|
|
828
|
+
case "latin1":
|
|
829
|
+
case "binary":
|
|
830
|
+
return M(this, e, t, o);
|
|
831
|
+
case "base64":
|
|
832
|
+
return z(this, e, t, o);
|
|
833
|
+
case "ucs2":
|
|
834
|
+
case "ucs-2":
|
|
835
|
+
case "utf16le":
|
|
836
|
+
case "utf-16le":
|
|
837
|
+
return D(this, e, t, o);
|
|
838
|
+
default:
|
|
839
|
+
if (v) throw new TypeError("Unknown encoding: " + d);
|
|
840
|
+
d = ("" + d).toLowerCase(), v = !0;
|
|
841
|
+
}
|
|
842
|
+
}, r.prototype.toJSON = function() {
|
|
843
|
+
return {
|
|
844
|
+
type: "Buffer",
|
|
845
|
+
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
846
|
+
};
|
|
847
|
+
};
|
|
848
|
+
function $(a, e, t) {
|
|
849
|
+
return e === 0 && t === a.length ? n.fromByteArray(a) : n.fromByteArray(a.slice(e, t));
|
|
850
|
+
}
|
|
851
|
+
function X(a, e, t) {
|
|
852
|
+
t = Math.min(a.length, t);
|
|
853
|
+
for (var o = [], d = e; d < t; ) {
|
|
854
|
+
var w = a[d], v = null, U = w > 239 ? 4 : w > 223 ? 3 : w > 191 ? 2 : 1;
|
|
855
|
+
if (d + U <= t) {
|
|
856
|
+
var q, G, te, Z;
|
|
857
|
+
switch (U) {
|
|
858
|
+
case 1:
|
|
859
|
+
w < 128 && (v = w);
|
|
860
|
+
break;
|
|
861
|
+
case 2:
|
|
862
|
+
q = a[d + 1], (q & 192) === 128 && (Z = (w & 31) << 6 | q & 63, Z > 127 && (v = Z));
|
|
863
|
+
break;
|
|
864
|
+
case 3:
|
|
865
|
+
q = a[d + 1], G = a[d + 2], (q & 192) === 128 && (G & 192) === 128 && (Z = (w & 15) << 12 | (q & 63) << 6 | G & 63, Z > 2047 && (Z < 55296 || Z > 57343) && (v = Z));
|
|
866
|
+
break;
|
|
867
|
+
case 4:
|
|
868
|
+
q = a[d + 1], G = a[d + 2], te = a[d + 3], (q & 192) === 128 && (G & 192) === 128 && (te & 192) === 128 && (Z = (w & 15) << 18 | (q & 63) << 12 | (G & 63) << 6 | te & 63, Z > 65535 && Z < 1114112 && (v = Z));
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
v === null ? (v = 65533, U = 1) : v > 65535 && (v -= 65536, o.push(v >>> 10 & 1023 | 55296), v = 56320 | v & 1023), o.push(v), d += U;
|
|
872
|
+
}
|
|
873
|
+
return W(o);
|
|
874
|
+
}
|
|
875
|
+
var K = 4096;
|
|
876
|
+
function W(a) {
|
|
877
|
+
var e = a.length;
|
|
878
|
+
if (e <= K)
|
|
879
|
+
return String.fromCharCode.apply(String, a);
|
|
880
|
+
for (var t = "", o = 0; o < e; )
|
|
881
|
+
t += String.fromCharCode.apply(
|
|
882
|
+
String,
|
|
883
|
+
a.slice(o, o += K)
|
|
884
|
+
);
|
|
885
|
+
return t;
|
|
886
|
+
}
|
|
887
|
+
function P(a, e, t) {
|
|
888
|
+
var o = "";
|
|
889
|
+
t = Math.min(a.length, t);
|
|
890
|
+
for (var d = e; d < t; ++d)
|
|
891
|
+
o += String.fromCharCode(a[d] & 127);
|
|
892
|
+
return o;
|
|
893
|
+
}
|
|
894
|
+
function Y(a, e, t) {
|
|
895
|
+
var o = "";
|
|
896
|
+
t = Math.min(a.length, t);
|
|
897
|
+
for (var d = e; d < t; ++d)
|
|
898
|
+
o += String.fromCharCode(a[d]);
|
|
899
|
+
return o;
|
|
900
|
+
}
|
|
901
|
+
function oe(a, e, t) {
|
|
902
|
+
var o = a.length;
|
|
903
|
+
(!e || e < 0) && (e = 0), (!t || t < 0 || t > o) && (t = o);
|
|
904
|
+
for (var d = "", w = e; w < t; ++w)
|
|
905
|
+
d += ne[a[w]];
|
|
906
|
+
return d;
|
|
907
|
+
}
|
|
908
|
+
function ee(a, e, t) {
|
|
909
|
+
for (var o = a.slice(e, t), d = "", w = 0; w < o.length - 1; w += 2)
|
|
910
|
+
d += String.fromCharCode(o[w] + o[w + 1] * 256);
|
|
911
|
+
return d;
|
|
912
|
+
}
|
|
913
|
+
r.prototype.slice = function(e, t) {
|
|
914
|
+
var o = this.length;
|
|
915
|
+
e = ~~e, t = t === void 0 ? o : ~~t, e < 0 ? (e += o, e < 0 && (e = 0)) : e > o && (e = o), t < 0 ? (t += o, t < 0 && (t = 0)) : t > o && (t = o), t < e && (t = e);
|
|
916
|
+
var d = this.subarray(e, t);
|
|
917
|
+
return Object.setPrototypeOf(d, r.prototype), d;
|
|
918
|
+
};
|
|
919
|
+
function x(a, e, t) {
|
|
920
|
+
if (a % 1 !== 0 || a < 0) throw new RangeError("offset is not uint");
|
|
921
|
+
if (a + e > t) throw new RangeError("Trying to access beyond buffer length");
|
|
922
|
+
}
|
|
923
|
+
r.prototype.readUintLE = r.prototype.readUIntLE = function(e, t, o) {
|
|
924
|
+
e = e >>> 0, t = t >>> 0, o || x(e, t, this.length);
|
|
925
|
+
for (var d = this[e], w = 1, v = 0; ++v < t && (w *= 256); )
|
|
926
|
+
d += this[e + v] * w;
|
|
927
|
+
return d;
|
|
928
|
+
}, r.prototype.readUintBE = r.prototype.readUIntBE = function(e, t, o) {
|
|
929
|
+
e = e >>> 0, t = t >>> 0, o || x(e, t, this.length);
|
|
930
|
+
for (var d = this[e + --t], w = 1; t > 0 && (w *= 256); )
|
|
931
|
+
d += this[e + --t] * w;
|
|
932
|
+
return d;
|
|
933
|
+
}, r.prototype.readUint8 = r.prototype.readUInt8 = function(e, t) {
|
|
934
|
+
return e = e >>> 0, t || x(e, 1, this.length), this[e];
|
|
935
|
+
}, r.prototype.readUint16LE = r.prototype.readUInt16LE = function(e, t) {
|
|
936
|
+
return e = e >>> 0, t || x(e, 2, this.length), this[e] | this[e + 1] << 8;
|
|
937
|
+
}, r.prototype.readUint16BE = r.prototype.readUInt16BE = function(e, t) {
|
|
938
|
+
return e = e >>> 0, t || x(e, 2, this.length), this[e] << 8 | this[e + 1];
|
|
939
|
+
}, r.prototype.readUint32LE = r.prototype.readUInt32LE = function(e, t) {
|
|
940
|
+
return e = e >>> 0, t || x(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + this[e + 3] * 16777216;
|
|
941
|
+
}, r.prototype.readUint32BE = r.prototype.readUInt32BE = function(e, t) {
|
|
942
|
+
return e = e >>> 0, t || x(e, 4, this.length), this[e] * 16777216 + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
|
|
943
|
+
}, r.prototype.readIntLE = function(e, t, o) {
|
|
944
|
+
e = e >>> 0, t = t >>> 0, o || x(e, t, this.length);
|
|
945
|
+
for (var d = this[e], w = 1, v = 0; ++v < t && (w *= 256); )
|
|
946
|
+
d += this[e + v] * w;
|
|
947
|
+
return w *= 128, d >= w && (d -= Math.pow(2, 8 * t)), d;
|
|
948
|
+
}, r.prototype.readIntBE = function(e, t, o) {
|
|
949
|
+
e = e >>> 0, t = t >>> 0, o || x(e, t, this.length);
|
|
950
|
+
for (var d = t, w = 1, v = this[e + --d]; d > 0 && (w *= 256); )
|
|
951
|
+
v += this[e + --d] * w;
|
|
952
|
+
return w *= 128, v >= w && (v -= Math.pow(2, 8 * t)), v;
|
|
953
|
+
}, r.prototype.readInt8 = function(e, t) {
|
|
954
|
+
return e = e >>> 0, t || x(e, 1, this.length), this[e] & 128 ? (255 - this[e] + 1) * -1 : this[e];
|
|
955
|
+
}, r.prototype.readInt16LE = function(e, t) {
|
|
956
|
+
e = e >>> 0, t || x(e, 2, this.length);
|
|
957
|
+
var o = this[e] | this[e + 1] << 8;
|
|
958
|
+
return o & 32768 ? o | 4294901760 : o;
|
|
959
|
+
}, r.prototype.readInt16BE = function(e, t) {
|
|
960
|
+
e = e >>> 0, t || x(e, 2, this.length);
|
|
961
|
+
var o = this[e + 1] | this[e] << 8;
|
|
962
|
+
return o & 32768 ? o | 4294901760 : o;
|
|
963
|
+
}, r.prototype.readInt32LE = function(e, t) {
|
|
964
|
+
return e = e >>> 0, t || x(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;
|
|
965
|
+
}, r.prototype.readInt32BE = function(e, t) {
|
|
966
|
+
return e = e >>> 0, t || x(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
|
|
967
|
+
}, r.prototype.readFloatLE = function(e, t) {
|
|
968
|
+
return e = e >>> 0, t || x(e, 4, this.length), u.read(this, e, !0, 23, 4);
|
|
969
|
+
}, r.prototype.readFloatBE = function(e, t) {
|
|
970
|
+
return e = e >>> 0, t || x(e, 4, this.length), u.read(this, e, !1, 23, 4);
|
|
971
|
+
}, r.prototype.readDoubleLE = function(e, t) {
|
|
972
|
+
return e = e >>> 0, t || x(e, 8, this.length), u.read(this, e, !0, 52, 8);
|
|
973
|
+
}, r.prototype.readDoubleBE = function(e, t) {
|
|
974
|
+
return e = e >>> 0, t || x(e, 8, this.length), u.read(this, e, !1, 52, 8);
|
|
975
|
+
};
|
|
976
|
+
function Q(a, e, t, o, d, w) {
|
|
977
|
+
if (!r.isBuffer(a)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
978
|
+
if (e > d || e < w) throw new RangeError('"value" argument is out of bounds');
|
|
979
|
+
if (t + o > a.length) throw new RangeError("Index out of range");
|
|
980
|
+
}
|
|
981
|
+
r.prototype.writeUintLE = r.prototype.writeUIntLE = function(e, t, o, d) {
|
|
982
|
+
if (e = +e, t = t >>> 0, o = o >>> 0, !d) {
|
|
983
|
+
var w = Math.pow(2, 8 * o) - 1;
|
|
984
|
+
Q(this, e, t, o, w, 0);
|
|
985
|
+
}
|
|
986
|
+
var v = 1, U = 0;
|
|
987
|
+
for (this[t] = e & 255; ++U < o && (v *= 256); )
|
|
988
|
+
this[t + U] = e / v & 255;
|
|
989
|
+
return t + o;
|
|
990
|
+
}, r.prototype.writeUintBE = r.prototype.writeUIntBE = function(e, t, o, d) {
|
|
991
|
+
if (e = +e, t = t >>> 0, o = o >>> 0, !d) {
|
|
992
|
+
var w = Math.pow(2, 8 * o) - 1;
|
|
993
|
+
Q(this, e, t, o, w, 0);
|
|
994
|
+
}
|
|
995
|
+
var v = o - 1, U = 1;
|
|
996
|
+
for (this[t + v] = e & 255; --v >= 0 && (U *= 256); )
|
|
997
|
+
this[t + v] = e / U & 255;
|
|
998
|
+
return t + o;
|
|
999
|
+
}, r.prototype.writeUint8 = r.prototype.writeUInt8 = function(e, t, o) {
|
|
1000
|
+
return e = +e, t = t >>> 0, o || Q(this, e, t, 1, 255, 0), this[t] = e & 255, t + 1;
|
|
1001
|
+
}, r.prototype.writeUint16LE = r.prototype.writeUInt16LE = function(e, t, o) {
|
|
1002
|
+
return e = +e, t = t >>> 0, o || Q(this, e, t, 2, 65535, 0), this[t] = e & 255, this[t + 1] = e >>> 8, t + 2;
|
|
1003
|
+
}, r.prototype.writeUint16BE = r.prototype.writeUInt16BE = function(e, t, o) {
|
|
1004
|
+
return e = +e, t = t >>> 0, o || Q(this, e, t, 2, 65535, 0), this[t] = e >>> 8, this[t + 1] = e & 255, t + 2;
|
|
1005
|
+
}, r.prototype.writeUint32LE = r.prototype.writeUInt32LE = function(e, t, o) {
|
|
1006
|
+
return e = +e, t = t >>> 0, o || Q(this, e, t, 4, 4294967295, 0), this[t + 3] = e >>> 24, this[t + 2] = e >>> 16, this[t + 1] = e >>> 8, this[t] = e & 255, t + 4;
|
|
1007
|
+
}, r.prototype.writeUint32BE = r.prototype.writeUInt32BE = function(e, t, o) {
|
|
1008
|
+
return e = +e, t = t >>> 0, o || Q(this, e, t, 4, 4294967295, 0), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = e & 255, t + 4;
|
|
1009
|
+
}, r.prototype.writeIntLE = function(e, t, o, d) {
|
|
1010
|
+
if (e = +e, t = t >>> 0, !d) {
|
|
1011
|
+
var w = Math.pow(2, 8 * o - 1);
|
|
1012
|
+
Q(this, e, t, o, w - 1, -w);
|
|
1013
|
+
}
|
|
1014
|
+
var v = 0, U = 1, q = 0;
|
|
1015
|
+
for (this[t] = e & 255; ++v < o && (U *= 256); )
|
|
1016
|
+
e < 0 && q === 0 && this[t + v - 1] !== 0 && (q = 1), this[t + v] = (e / U >> 0) - q & 255;
|
|
1017
|
+
return t + o;
|
|
1018
|
+
}, r.prototype.writeIntBE = function(e, t, o, d) {
|
|
1019
|
+
if (e = +e, t = t >>> 0, !d) {
|
|
1020
|
+
var w = Math.pow(2, 8 * o - 1);
|
|
1021
|
+
Q(this, e, t, o, w - 1, -w);
|
|
1022
|
+
}
|
|
1023
|
+
var v = o - 1, U = 1, q = 0;
|
|
1024
|
+
for (this[t + v] = e & 255; --v >= 0 && (U *= 256); )
|
|
1025
|
+
e < 0 && q === 0 && this[t + v + 1] !== 0 && (q = 1), this[t + v] = (e / U >> 0) - q & 255;
|
|
1026
|
+
return t + o;
|
|
1027
|
+
}, r.prototype.writeInt8 = function(e, t, o) {
|
|
1028
|
+
return e = +e, t = t >>> 0, o || Q(this, e, t, 1, 127, -128), e < 0 && (e = 255 + e + 1), this[t] = e & 255, t + 1;
|
|
1029
|
+
}, r.prototype.writeInt16LE = function(e, t, o) {
|
|
1030
|
+
return e = +e, t = t >>> 0, o || Q(this, e, t, 2, 32767, -32768), this[t] = e & 255, this[t + 1] = e >>> 8, t + 2;
|
|
1031
|
+
}, r.prototype.writeInt16BE = function(e, t, o) {
|
|
1032
|
+
return e = +e, t = t >>> 0, o || Q(this, e, t, 2, 32767, -32768), this[t] = e >>> 8, this[t + 1] = e & 255, t + 2;
|
|
1033
|
+
}, r.prototype.writeInt32LE = function(e, t, o) {
|
|
1034
|
+
return e = +e, t = t >>> 0, o || Q(this, e, t, 4, 2147483647, -2147483648), this[t] = e & 255, this[t + 1] = e >>> 8, this[t + 2] = e >>> 16, this[t + 3] = e >>> 24, t + 4;
|
|
1035
|
+
}, r.prototype.writeInt32BE = function(e, t, o) {
|
|
1036
|
+
return e = +e, t = t >>> 0, o || Q(this, e, t, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = e & 255, t + 4;
|
|
1037
|
+
};
|
|
1038
|
+
function se(a, e, t, o, d, w) {
|
|
1039
|
+
if (t + o > a.length) throw new RangeError("Index out of range");
|
|
1040
|
+
if (t < 0) throw new RangeError("Index out of range");
|
|
1041
|
+
}
|
|
1042
|
+
function re(a, e, t, o, d) {
|
|
1043
|
+
return e = +e, t = t >>> 0, d || se(a, e, t, 4), u.write(a, e, t, o, 23, 4), t + 4;
|
|
1044
|
+
}
|
|
1045
|
+
r.prototype.writeFloatLE = function(e, t, o) {
|
|
1046
|
+
return re(this, e, t, !0, o);
|
|
1047
|
+
}, r.prototype.writeFloatBE = function(e, t, o) {
|
|
1048
|
+
return re(this, e, t, !1, o);
|
|
1049
|
+
};
|
|
1050
|
+
function b(a, e, t, o, d) {
|
|
1051
|
+
return e = +e, t = t >>> 0, d || se(a, e, t, 8), u.write(a, e, t, o, 52, 8), t + 8;
|
|
1052
|
+
}
|
|
1053
|
+
r.prototype.writeDoubleLE = function(e, t, o) {
|
|
1054
|
+
return b(this, e, t, !0, o);
|
|
1055
|
+
}, r.prototype.writeDoubleBE = function(e, t, o) {
|
|
1056
|
+
return b(this, e, t, !1, o);
|
|
1057
|
+
}, r.prototype.copy = function(e, t, o, d) {
|
|
1058
|
+
if (!r.isBuffer(e)) throw new TypeError("argument should be a Buffer");
|
|
1059
|
+
if (o || (o = 0), !d && d !== 0 && (d = this.length), t >= e.length && (t = e.length), t || (t = 0), d > 0 && d < o && (d = o), d === o || e.length === 0 || this.length === 0) return 0;
|
|
1060
|
+
if (t < 0)
|
|
1061
|
+
throw new RangeError("targetStart out of bounds");
|
|
1062
|
+
if (o < 0 || o >= this.length) throw new RangeError("Index out of range");
|
|
1063
|
+
if (d < 0) throw new RangeError("sourceEnd out of bounds");
|
|
1064
|
+
d > this.length && (d = this.length), e.length - t < d - o && (d = e.length - t + o);
|
|
1065
|
+
var w = d - o;
|
|
1066
|
+
return this === e && typeof Uint8Array.prototype.copyWithin == "function" ? this.copyWithin(t, o, d) : Uint8Array.prototype.set.call(
|
|
1067
|
+
e,
|
|
1068
|
+
this.subarray(o, d),
|
|
1069
|
+
t
|
|
1070
|
+
), w;
|
|
1071
|
+
}, r.prototype.fill = function(e, t, o, d) {
|
|
1072
|
+
if (typeof e == "string") {
|
|
1073
|
+
if (typeof t == "string" ? (d = t, t = 0, o = this.length) : typeof o == "string" && (d = o, o = this.length), d !== void 0 && typeof d != "string")
|
|
1074
|
+
throw new TypeError("encoding must be a string");
|
|
1075
|
+
if (typeof d == "string" && !r.isEncoding(d))
|
|
1076
|
+
throw new TypeError("Unknown encoding: " + d);
|
|
1077
|
+
if (e.length === 1) {
|
|
1078
|
+
var w = e.charCodeAt(0);
|
|
1079
|
+
(d === "utf8" && w < 128 || d === "latin1") && (e = w);
|
|
1080
|
+
}
|
|
1081
|
+
} else typeof e == "number" ? e = e & 255 : typeof e == "boolean" && (e = Number(e));
|
|
1082
|
+
if (t < 0 || this.length < t || this.length < o)
|
|
1083
|
+
throw new RangeError("Out of range index");
|
|
1084
|
+
if (o <= t)
|
|
1085
|
+
return this;
|
|
1086
|
+
t = t >>> 0, o = o === void 0 ? this.length : o >>> 0, e || (e = 0);
|
|
1087
|
+
var v;
|
|
1088
|
+
if (typeof e == "number")
|
|
1089
|
+
for (v = t; v < o; ++v)
|
|
1090
|
+
this[v] = e;
|
|
1091
|
+
else {
|
|
1092
|
+
var U = r.isBuffer(e) ? e : r.from(e, d), q = U.length;
|
|
1093
|
+
if (q === 0)
|
|
1094
|
+
throw new TypeError('The value "' + e + '" is invalid for argument "value"');
|
|
1095
|
+
for (v = 0; v < o - t; ++v)
|
|
1096
|
+
this[v + t] = U[v % q];
|
|
1097
|
+
}
|
|
1098
|
+
return this;
|
|
1099
|
+
};
|
|
1100
|
+
var H = /[^+/0-9A-Za-z-_]/g;
|
|
1101
|
+
function j(a) {
|
|
1102
|
+
if (a = a.split("=")[0], a = a.trim().replace(H, ""), a.length < 2) return "";
|
|
1103
|
+
for (; a.length % 4 !== 0; )
|
|
1104
|
+
a = a + "=";
|
|
1105
|
+
return a;
|
|
1106
|
+
}
|
|
1107
|
+
function k(a, e) {
|
|
1108
|
+
e = e || 1 / 0;
|
|
1109
|
+
for (var t, o = a.length, d = null, w = [], v = 0; v < o; ++v) {
|
|
1110
|
+
if (t = a.charCodeAt(v), t > 55295 && t < 57344) {
|
|
1111
|
+
if (!d) {
|
|
1112
|
+
if (t > 56319) {
|
|
1113
|
+
(e -= 3) > -1 && w.push(239, 191, 189);
|
|
1114
|
+
continue;
|
|
1115
|
+
} else if (v + 1 === o) {
|
|
1116
|
+
(e -= 3) > -1 && w.push(239, 191, 189);
|
|
1117
|
+
continue;
|
|
1118
|
+
}
|
|
1119
|
+
d = t;
|
|
1120
|
+
continue;
|
|
1121
|
+
}
|
|
1122
|
+
if (t < 56320) {
|
|
1123
|
+
(e -= 3) > -1 && w.push(239, 191, 189), d = t;
|
|
1124
|
+
continue;
|
|
1125
|
+
}
|
|
1126
|
+
t = (d - 55296 << 10 | t - 56320) + 65536;
|
|
1127
|
+
} else d && (e -= 3) > -1 && w.push(239, 191, 189);
|
|
1128
|
+
if (d = null, t < 128) {
|
|
1129
|
+
if ((e -= 1) < 0) break;
|
|
1130
|
+
w.push(t);
|
|
1131
|
+
} else if (t < 2048) {
|
|
1132
|
+
if ((e -= 2) < 0) break;
|
|
1133
|
+
w.push(
|
|
1134
|
+
t >> 6 | 192,
|
|
1135
|
+
t & 63 | 128
|
|
1136
|
+
);
|
|
1137
|
+
} else if (t < 65536) {
|
|
1138
|
+
if ((e -= 3) < 0) break;
|
|
1139
|
+
w.push(
|
|
1140
|
+
t >> 12 | 224,
|
|
1141
|
+
t >> 6 & 63 | 128,
|
|
1142
|
+
t & 63 | 128
|
|
1143
|
+
);
|
|
1144
|
+
} else if (t < 1114112) {
|
|
1145
|
+
if ((e -= 4) < 0) break;
|
|
1146
|
+
w.push(
|
|
1147
|
+
t >> 18 | 240,
|
|
1148
|
+
t >> 12 & 63 | 128,
|
|
1149
|
+
t >> 6 & 63 | 128,
|
|
1150
|
+
t & 63 | 128
|
|
1151
|
+
);
|
|
1152
|
+
} else
|
|
1153
|
+
throw new Error("Invalid code point");
|
|
1154
|
+
}
|
|
1155
|
+
return w;
|
|
1156
|
+
}
|
|
1157
|
+
function ue(a) {
|
|
1158
|
+
for (var e = [], t = 0; t < a.length; ++t)
|
|
1159
|
+
e.push(a.charCodeAt(t) & 255);
|
|
1160
|
+
return e;
|
|
1161
|
+
}
|
|
1162
|
+
function le(a, e) {
|
|
1163
|
+
for (var t, o, d, w = [], v = 0; v < a.length && !((e -= 2) < 0); ++v)
|
|
1164
|
+
t = a.charCodeAt(v), o = t >> 8, d = t % 256, w.push(d), w.push(o);
|
|
1165
|
+
return w;
|
|
1166
|
+
}
|
|
1167
|
+
function V(a) {
|
|
1168
|
+
return n.toByteArray(j(a));
|
|
1169
|
+
}
|
|
1170
|
+
function J(a, e, t, o) {
|
|
1171
|
+
for (var d = 0; d < o && !(d + t >= e.length || d >= a.length); ++d)
|
|
1172
|
+
e[d + t] = a[d];
|
|
1173
|
+
return d;
|
|
1174
|
+
}
|
|
1175
|
+
function ie(a, e) {
|
|
1176
|
+
return a instanceof e || a != null && a.constructor != null && a.constructor.name != null && a.constructor.name === e.name;
|
|
1177
|
+
}
|
|
1178
|
+
function ae(a) {
|
|
1179
|
+
return a !== a;
|
|
1180
|
+
}
|
|
1181
|
+
var ne = (function() {
|
|
1182
|
+
for (var a = "0123456789abcdef", e = new Array(256), t = 0; t < 16; ++t)
|
|
1183
|
+
for (var o = t * 16, d = 0; d < 16; ++d)
|
|
1184
|
+
e[o + d] = a[t] + a[d];
|
|
1185
|
+
return e;
|
|
1186
|
+
})();
|
|
1187
|
+
})(ke)), ke;
|
|
1188
|
+
}
|
|
1189
|
+
var $r = Br(), ot;
|
|
1190
|
+
typeof Object.create == "function" ? ot = function(n, u) {
|
|
1191
|
+
n.super_ = u, n.prototype = Object.create(u.prototype, {
|
|
1192
|
+
constructor: {
|
|
1193
|
+
value: n,
|
|
1194
|
+
enumerable: !1,
|
|
1195
|
+
writable: !0,
|
|
1196
|
+
configurable: !0
|
|
1197
|
+
}
|
|
1198
|
+
});
|
|
1199
|
+
} : ot = function(n, u) {
|
|
1200
|
+
n.super_ = u;
|
|
1201
|
+
var f = function() {
|
|
1202
|
+
};
|
|
1203
|
+
f.prototype = u.prototype, n.prototype = new f(), n.prototype.constructor = n;
|
|
1204
|
+
};
|
|
1205
|
+
const ir = ot;
|
|
1206
|
+
var Ir = /%[sdj%]/g;
|
|
1207
|
+
function Fe(i) {
|
|
1208
|
+
if (!me(i)) {
|
|
1209
|
+
for (var n = [], u = 0; u < arguments.length; u++)
|
|
1210
|
+
n.push(pe(arguments[u]));
|
|
1211
|
+
return n.join(" ");
|
|
1212
|
+
}
|
|
1213
|
+
for (var u = 1, f = arguments, y = f.length, A = String(i).replace(Ir, function(r) {
|
|
1214
|
+
if (r === "%%") return "%";
|
|
1215
|
+
if (u >= y) return r;
|
|
1216
|
+
switch (r) {
|
|
1217
|
+
case "%s":
|
|
1218
|
+
return String(f[u++]);
|
|
1219
|
+
case "%d":
|
|
1220
|
+
return Number(f[u++]);
|
|
1221
|
+
case "%j":
|
|
1222
|
+
try {
|
|
1223
|
+
return JSON.stringify(f[u++]);
|
|
1224
|
+
} catch {
|
|
1225
|
+
return "[Circular]";
|
|
1226
|
+
}
|
|
1227
|
+
default:
|
|
1228
|
+
return r;
|
|
1229
|
+
}
|
|
1230
|
+
}), s = f[u]; u < y; s = f[++u])
|
|
1231
|
+
_e(s) || !ge(s) ? A += " " + s : A += " " + pe(s);
|
|
1232
|
+
return A;
|
|
1233
|
+
}
|
|
1234
|
+
function lt(i, n) {
|
|
1235
|
+
if (fe(Hr.process))
|
|
1236
|
+
return function() {
|
|
1237
|
+
return lt(i, n).apply(this, arguments);
|
|
1238
|
+
};
|
|
1239
|
+
if (ce.noDeprecation === !0)
|
|
1240
|
+
return i;
|
|
1241
|
+
var u = !1;
|
|
1242
|
+
function f() {
|
|
1243
|
+
if (!u) {
|
|
1244
|
+
if (ce.throwDeprecation)
|
|
1245
|
+
throw new Error(n);
|
|
1246
|
+
ce.traceDeprecation ? console.trace(n) : console.error(n), u = !0;
|
|
1247
|
+
}
|
|
1248
|
+
return i.apply(this, arguments);
|
|
1249
|
+
}
|
|
1250
|
+
return f;
|
|
1251
|
+
}
|
|
1252
|
+
var Se = {}, De;
|
|
1253
|
+
function ur(i) {
|
|
1254
|
+
if (fe(De) && (De = ce.env.NODE_DEBUG || ""), i = i.toUpperCase(), !Se[i])
|
|
1255
|
+
if (new RegExp("\\b" + i + "\\b", "i").test(De)) {
|
|
1256
|
+
var n = 0;
|
|
1257
|
+
Se[i] = function() {
|
|
1258
|
+
var u = Fe.apply(null, arguments);
|
|
1259
|
+
console.error("%s %d: %s", i, n, u);
|
|
1260
|
+
};
|
|
1261
|
+
} else
|
|
1262
|
+
Se[i] = function() {
|
|
1263
|
+
};
|
|
1264
|
+
return Se[i];
|
|
1265
|
+
}
|
|
1266
|
+
function pe(i, n) {
|
|
1267
|
+
var u = {
|
|
1268
|
+
seen: [],
|
|
1269
|
+
stylize: Or
|
|
1270
|
+
};
|
|
1271
|
+
return arguments.length >= 3 && (u.depth = arguments[2]), arguments.length >= 4 && (u.colors = arguments[3]), Be(n) ? u.showHidden = n : n && yt(u, n), fe(u.showHidden) && (u.showHidden = !1), fe(u.depth) && (u.depth = 2), fe(u.colors) && (u.colors = !1), fe(u.customInspect) && (u.customInspect = !0), u.colors && (u.stylize = Lr), Ce(u, i, u.depth);
|
|
1272
|
+
}
|
|
1273
|
+
pe.colors = {
|
|
1274
|
+
bold: [1, 22],
|
|
1275
|
+
italic: [3, 23],
|
|
1276
|
+
underline: [4, 24],
|
|
1277
|
+
inverse: [7, 27],
|
|
1278
|
+
white: [37, 39],
|
|
1279
|
+
grey: [90, 39],
|
|
1280
|
+
black: [30, 39],
|
|
1281
|
+
blue: [34, 39],
|
|
1282
|
+
cyan: [36, 39],
|
|
1283
|
+
green: [32, 39],
|
|
1284
|
+
magenta: [35, 39],
|
|
1285
|
+
red: [31, 39],
|
|
1286
|
+
yellow: [33, 39]
|
|
1287
|
+
};
|
|
1288
|
+
pe.styles = {
|
|
1289
|
+
special: "cyan",
|
|
1290
|
+
number: "yellow",
|
|
1291
|
+
boolean: "yellow",
|
|
1292
|
+
undefined: "grey",
|
|
1293
|
+
null: "bold",
|
|
1294
|
+
string: "green",
|
|
1295
|
+
date: "magenta",
|
|
1296
|
+
// "name": intentionally not styling
|
|
1297
|
+
regexp: "red"
|
|
1298
|
+
};
|
|
1299
|
+
function Lr(i, n) {
|
|
1300
|
+
var u = pe.styles[n];
|
|
1301
|
+
return u ? "\x1B[" + pe.colors[u][0] + "m" + i + "\x1B[" + pe.colors[u][1] + "m" : i;
|
|
1302
|
+
}
|
|
1303
|
+
function Or(i, n) {
|
|
1304
|
+
return i;
|
|
1305
|
+
}
|
|
1306
|
+
function Nr(i) {
|
|
1307
|
+
var n = {};
|
|
1308
|
+
return i.forEach(function(u, f) {
|
|
1309
|
+
n[u] = !0;
|
|
1310
|
+
}), n;
|
|
1311
|
+
}
|
|
1312
|
+
function Ce(i, n, u) {
|
|
1313
|
+
if (i.customInspect && n && Re(n.inspect) && // Filter out the util module, it's inspect function is special
|
|
1314
|
+
n.inspect !== pe && // Also filter out any prototype objects using the circular check.
|
|
1315
|
+
!(n.constructor && n.constructor.prototype === n)) {
|
|
1316
|
+
var f = n.inspect(u, i);
|
|
1317
|
+
return me(f) || (f = Ce(i, f, u)), f;
|
|
1318
|
+
}
|
|
1319
|
+
var y = Ur(i, n);
|
|
1320
|
+
if (y)
|
|
1321
|
+
return y;
|
|
1322
|
+
var A = Object.keys(n), s = Nr(A);
|
|
1323
|
+
if (i.showHidden && (A = Object.getOwnPropertyNames(n)), we(n) && (A.indexOf("message") >= 0 || A.indexOf("description") >= 0))
|
|
1324
|
+
return Pe(n);
|
|
1325
|
+
if (A.length === 0) {
|
|
1326
|
+
if (Re(n)) {
|
|
1327
|
+
var r = n.name ? ": " + n.name : "";
|
|
1328
|
+
return i.stylize("[Function" + r + "]", "special");
|
|
1329
|
+
}
|
|
1330
|
+
if (Ee(n))
|
|
1331
|
+
return i.stylize(RegExp.prototype.toString.call(n), "regexp");
|
|
1332
|
+
if (He(n))
|
|
1333
|
+
return i.stylize(Date.prototype.toString.call(n), "date");
|
|
1334
|
+
if (we(n))
|
|
1335
|
+
return Pe(n);
|
|
1336
|
+
}
|
|
1337
|
+
var g = "", l = !1, p = ["{", "}"];
|
|
1338
|
+
if (ft(n) && (l = !0, p = ["[", "]"]), Re(n)) {
|
|
1339
|
+
var h = n.name ? ": " + n.name : "";
|
|
1340
|
+
g = " [Function" + h + "]";
|
|
1341
|
+
}
|
|
1342
|
+
if (Ee(n) && (g = " " + RegExp.prototype.toString.call(n)), He(n) && (g = " " + Date.prototype.toUTCString.call(n)), we(n) && (g = " " + Pe(n)), A.length === 0 && (!l || n.length == 0))
|
|
1343
|
+
return p[0] + g + p[1];
|
|
1344
|
+
if (u < 0)
|
|
1345
|
+
return Ee(n) ? i.stylize(RegExp.prototype.toString.call(n), "regexp") : i.stylize("[Object]", "special");
|
|
1346
|
+
i.seen.push(n);
|
|
1347
|
+
var c;
|
|
1348
|
+
return l ? c = Mr(i, n, u, s, A) : c = A.map(function(E) {
|
|
1349
|
+
return st(i, n, u, s, E, l);
|
|
1350
|
+
}), i.seen.pop(), kr(c, g, p);
|
|
1351
|
+
}
|
|
1352
|
+
function Ur(i, n) {
|
|
1353
|
+
if (fe(n))
|
|
1354
|
+
return i.stylize("undefined", "undefined");
|
|
1355
|
+
if (me(n)) {
|
|
1356
|
+
var u = "'" + JSON.stringify(n).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'";
|
|
1357
|
+
return i.stylize(u, "string");
|
|
1358
|
+
}
|
|
1359
|
+
if (pt(n))
|
|
1360
|
+
return i.stylize("" + n, "number");
|
|
1361
|
+
if (Be(n))
|
|
1362
|
+
return i.stylize("" + n, "boolean");
|
|
1363
|
+
if (_e(n))
|
|
1364
|
+
return i.stylize("null", "null");
|
|
1365
|
+
}
|
|
1366
|
+
function Pe(i) {
|
|
1367
|
+
return "[" + Error.prototype.toString.call(i) + "]";
|
|
1368
|
+
}
|
|
1369
|
+
function Mr(i, n, u, f, y) {
|
|
1370
|
+
for (var A = [], s = 0, r = n.length; s < r; ++s)
|
|
1371
|
+
fr(n, String(s)) ? A.push(st(
|
|
1372
|
+
i,
|
|
1373
|
+
n,
|
|
1374
|
+
u,
|
|
1375
|
+
f,
|
|
1376
|
+
String(s),
|
|
1377
|
+
!0
|
|
1378
|
+
)) : A.push("");
|
|
1379
|
+
return y.forEach(function(g) {
|
|
1380
|
+
g.match(/^\d+$/) || A.push(st(
|
|
1381
|
+
i,
|
|
1382
|
+
n,
|
|
1383
|
+
u,
|
|
1384
|
+
f,
|
|
1385
|
+
g,
|
|
1386
|
+
!0
|
|
1387
|
+
));
|
|
1388
|
+
}), A;
|
|
1389
|
+
}
|
|
1390
|
+
function st(i, n, u, f, y, A) {
|
|
1391
|
+
var s, r, g;
|
|
1392
|
+
if (g = Object.getOwnPropertyDescriptor(n, y) || { value: n[y] }, g.get ? g.set ? r = i.stylize("[Getter/Setter]", "special") : r = i.stylize("[Getter]", "special") : g.set && (r = i.stylize("[Setter]", "special")), fr(f, y) || (s = "[" + y + "]"), r || (i.seen.indexOf(g.value) < 0 ? (_e(u) ? r = Ce(i, g.value, null) : r = Ce(i, g.value, u - 1), r.indexOf(`
|
|
1393
|
+
`) > -1 && (A ? r = r.split(`
|
|
1394
|
+
`).map(function(l) {
|
|
1395
|
+
return " " + l;
|
|
1396
|
+
}).join(`
|
|
1397
|
+
`).substr(2) : r = `
|
|
1398
|
+
` + r.split(`
|
|
1399
|
+
`).map(function(l) {
|
|
1400
|
+
return " " + l;
|
|
1401
|
+
}).join(`
|
|
1402
|
+
`))) : r = i.stylize("[Circular]", "special")), fe(s)) {
|
|
1403
|
+
if (A && y.match(/^\d+$/))
|
|
1404
|
+
return r;
|
|
1405
|
+
s = JSON.stringify("" + y), s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/) ? (s = s.substr(1, s.length - 2), s = i.stylize(s, "name")) : (s = s.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"), s = i.stylize(s, "string"));
|
|
1406
|
+
}
|
|
1407
|
+
return s + ": " + r;
|
|
1408
|
+
}
|
|
1409
|
+
function kr(i, n, u) {
|
|
1410
|
+
var f = i.reduce(function(y, A) {
|
|
1411
|
+
return A.indexOf(`
|
|
1412
|
+
`) >= 0, y + A.replace(/\u001b\[\d\d?m/g, "").length + 1;
|
|
1413
|
+
}, 0);
|
|
1414
|
+
return f > 60 ? u[0] + (n === "" ? "" : n + `
|
|
1415
|
+
`) + " " + i.join(`,
|
|
1416
|
+
`) + " " + u[1] : u[0] + n + " " + i.join(", ") + " " + u[1];
|
|
1417
|
+
}
|
|
1418
|
+
function ft(i) {
|
|
1419
|
+
return Array.isArray(i);
|
|
1420
|
+
}
|
|
1421
|
+
function Be(i) {
|
|
1422
|
+
return typeof i == "boolean";
|
|
1423
|
+
}
|
|
1424
|
+
function _e(i) {
|
|
1425
|
+
return i === null;
|
|
1426
|
+
}
|
|
1427
|
+
function ar(i) {
|
|
1428
|
+
return i == null;
|
|
1429
|
+
}
|
|
1430
|
+
function pt(i) {
|
|
1431
|
+
return typeof i == "number";
|
|
1432
|
+
}
|
|
1433
|
+
function me(i) {
|
|
1434
|
+
return typeof i == "string";
|
|
1435
|
+
}
|
|
1436
|
+
function or(i) {
|
|
1437
|
+
return typeof i == "symbol";
|
|
1438
|
+
}
|
|
1439
|
+
function fe(i) {
|
|
1440
|
+
return i === void 0;
|
|
1441
|
+
}
|
|
1442
|
+
function Ee(i) {
|
|
1443
|
+
return ge(i) && ht(i) === "[object RegExp]";
|
|
1444
|
+
}
|
|
1445
|
+
function ge(i) {
|
|
1446
|
+
return typeof i == "object" && i !== null;
|
|
1447
|
+
}
|
|
1448
|
+
function He(i) {
|
|
1449
|
+
return ge(i) && ht(i) === "[object Date]";
|
|
1450
|
+
}
|
|
1451
|
+
function we(i) {
|
|
1452
|
+
return ge(i) && (ht(i) === "[object Error]" || i instanceof Error);
|
|
1453
|
+
}
|
|
1454
|
+
function Re(i) {
|
|
1455
|
+
return typeof i == "function";
|
|
1456
|
+
}
|
|
1457
|
+
function sr(i) {
|
|
1458
|
+
return i === null || typeof i == "boolean" || typeof i == "number" || typeof i == "string" || typeof i == "symbol" || // ES6 symbol
|
|
1459
|
+
typeof i > "u";
|
|
1460
|
+
}
|
|
1461
|
+
function cr(i) {
|
|
1462
|
+
return $r.Buffer.isBuffer(i);
|
|
1463
|
+
}
|
|
1464
|
+
function ht(i) {
|
|
1465
|
+
return Object.prototype.toString.call(i);
|
|
1466
|
+
}
|
|
1467
|
+
function Ge(i) {
|
|
1468
|
+
return i < 10 ? "0" + i.toString(10) : i.toString(10);
|
|
1469
|
+
}
|
|
1470
|
+
var Dr = [
|
|
1471
|
+
"Jan",
|
|
1472
|
+
"Feb",
|
|
1473
|
+
"Mar",
|
|
1474
|
+
"Apr",
|
|
1475
|
+
"May",
|
|
1476
|
+
"Jun",
|
|
1477
|
+
"Jul",
|
|
1478
|
+
"Aug",
|
|
1479
|
+
"Sep",
|
|
1480
|
+
"Oct",
|
|
1481
|
+
"Nov",
|
|
1482
|
+
"Dec"
|
|
1483
|
+
];
|
|
1484
|
+
function Pr() {
|
|
1485
|
+
var i = /* @__PURE__ */ new Date(), n = [
|
|
1486
|
+
Ge(i.getHours()),
|
|
1487
|
+
Ge(i.getMinutes()),
|
|
1488
|
+
Ge(i.getSeconds())
|
|
1489
|
+
].join(":");
|
|
1490
|
+
return [i.getDate(), Dr[i.getMonth()], n].join(" ");
|
|
1491
|
+
}
|
|
1492
|
+
function lr() {
|
|
1493
|
+
console.log("%s - %s", Pr(), Fe.apply(null, arguments));
|
|
1494
|
+
}
|
|
1495
|
+
function yt(i, n) {
|
|
1496
|
+
if (!n || !ge(n)) return i;
|
|
1497
|
+
for (var u = Object.keys(n), f = u.length; f--; )
|
|
1498
|
+
i[u[f]] = n[u[f]];
|
|
1499
|
+
return i;
|
|
1500
|
+
}
|
|
1501
|
+
function fr(i, n) {
|
|
1502
|
+
return Object.prototype.hasOwnProperty.call(i, n);
|
|
1503
|
+
}
|
|
1504
|
+
const Gr = {
|
|
1505
|
+
inherits: ir,
|
|
1506
|
+
_extend: yt,
|
|
1507
|
+
log: lr,
|
|
1508
|
+
isBuffer: cr,
|
|
1509
|
+
isPrimitive: sr,
|
|
1510
|
+
isFunction: Re,
|
|
1511
|
+
isError: we,
|
|
1512
|
+
isDate: He,
|
|
1513
|
+
isObject: ge,
|
|
1514
|
+
isRegExp: Ee,
|
|
1515
|
+
isUndefined: fe,
|
|
1516
|
+
isSymbol: or,
|
|
1517
|
+
isString: me,
|
|
1518
|
+
isNumber: pt,
|
|
1519
|
+
isNullOrUndefined: ar,
|
|
1520
|
+
isNull: _e,
|
|
1521
|
+
isBoolean: Be,
|
|
1522
|
+
isArray: ft,
|
|
1523
|
+
inspect: pe,
|
|
1524
|
+
deprecate: lt,
|
|
1525
|
+
format: Fe,
|
|
1526
|
+
debuglog: ur
|
|
1527
|
+
}, qr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1528
|
+
__proto__: null,
|
|
1529
|
+
_extend: yt,
|
|
1530
|
+
debuglog: ur,
|
|
1531
|
+
default: Gr,
|
|
1532
|
+
deprecate: lt,
|
|
1533
|
+
format: Fe,
|
|
1534
|
+
inherits: ir,
|
|
1535
|
+
inspect: pe,
|
|
1536
|
+
isArray: ft,
|
|
1537
|
+
isBoolean: Be,
|
|
1538
|
+
isBuffer: cr,
|
|
1539
|
+
isDate: He,
|
|
1540
|
+
isError: we,
|
|
1541
|
+
isFunction: Re,
|
|
1542
|
+
isNull: _e,
|
|
1543
|
+
isNullOrUndefined: ar,
|
|
1544
|
+
isNumber: pt,
|
|
1545
|
+
isObject: ge,
|
|
1546
|
+
isPrimitive: sr,
|
|
1547
|
+
isRegExp: Ee,
|
|
1548
|
+
isString: me,
|
|
1549
|
+
isSymbol: or,
|
|
1550
|
+
isUndefined: fe,
|
|
1551
|
+
log: lr
|
|
1552
|
+
}, Symbol.toStringTag, { value: "Module" })), pr = /* @__PURE__ */ rr(qr);
|
|
1553
|
+
var qe = {}, It;
|
|
1554
|
+
function gt() {
|
|
1555
|
+
return It || (It = 1, (function(i) {
|
|
1556
|
+
i.isInteger = (n) => typeof n == "number" ? Number.isInteger(n) : typeof n == "string" && n.trim() !== "" ? Number.isInteger(Number(n)) : !1, i.find = (n, u) => n.nodes.find((f) => f.type === u), i.exceedsLimit = (n, u, f = 1, y) => y === !1 || !i.isInteger(n) || !i.isInteger(u) ? !1 : (Number(u) - Number(n)) / Number(f) >= y, i.escapeNode = (n, u = 0, f) => {
|
|
1557
|
+
const y = n.nodes[u];
|
|
1558
|
+
y && (f && y.type === f || y.type === "open" || y.type === "close") && y.escaped !== !0 && (y.value = "\\" + y.value, y.escaped = !0);
|
|
1559
|
+
}, i.encloseBrace = (n) => n.type !== "brace" ? !1 : n.commas >> 0 + n.ranges >> 0 === 0 ? (n.invalid = !0, !0) : !1, i.isInvalidBrace = (n) => n.type !== "brace" ? !1 : n.invalid === !0 || n.dollar ? !0 : n.commas >> 0 + n.ranges >> 0 === 0 || n.open !== !0 || n.close !== !0 ? (n.invalid = !0, !0) : !1, i.isOpenOrClose = (n) => n.type === "open" || n.type === "close" ? !0 : n.open === !0 || n.close === !0, i.reduce = (n) => n.reduce((u, f) => (f.type === "text" && u.push(f.value), f.type === "range" && (f.type = "text"), u), []), i.flatten = (...n) => {
|
|
1560
|
+
const u = [], f = (y) => {
|
|
1561
|
+
for (let A = 0; A < y.length; A++) {
|
|
1562
|
+
const s = y[A];
|
|
1563
|
+
if (Array.isArray(s)) {
|
|
1564
|
+
f(s);
|
|
1565
|
+
continue;
|
|
1566
|
+
}
|
|
1567
|
+
s !== void 0 && u.push(s);
|
|
1568
|
+
}
|
|
1569
|
+
return u;
|
|
1570
|
+
};
|
|
1571
|
+
return f(n), u;
|
|
1572
|
+
};
|
|
1573
|
+
})(qe)), qe;
|
|
1574
|
+
}
|
|
1575
|
+
var Ke, Lt;
|
|
1576
|
+
function dt() {
|
|
1577
|
+
if (Lt) return Ke;
|
|
1578
|
+
Lt = 1;
|
|
1579
|
+
const i = gt();
|
|
1580
|
+
return Ke = (n, u = {}) => {
|
|
1581
|
+
const f = (y, A = {}) => {
|
|
1582
|
+
const s = u.escapeInvalid && i.isInvalidBrace(A), r = y.invalid === !0 && u.escapeInvalid === !0;
|
|
1583
|
+
let g = "";
|
|
1584
|
+
if (y.value)
|
|
1585
|
+
return (s || r) && i.isOpenOrClose(y) ? "\\" + y.value : y.value;
|
|
1586
|
+
if (y.value)
|
|
1587
|
+
return y.value;
|
|
1588
|
+
if (y.nodes)
|
|
1589
|
+
for (const l of y.nodes)
|
|
1590
|
+
g += f(l);
|
|
1591
|
+
return g;
|
|
1592
|
+
};
|
|
1593
|
+
return f(n);
|
|
1594
|
+
}, Ke;
|
|
1595
|
+
}
|
|
1596
|
+
var je, Ot;
|
|
1597
|
+
function Kr() {
|
|
1598
|
+
return Ot || (Ot = 1, je = function(i) {
|
|
1599
|
+
return typeof i == "number" ? i - i === 0 : typeof i == "string" && i.trim() !== "" ? Number.isFinite ? Number.isFinite(+i) : isFinite(+i) : !1;
|
|
1600
|
+
}), je;
|
|
1601
|
+
}
|
|
1602
|
+
var ze, Nt;
|
|
1603
|
+
function jr() {
|
|
1604
|
+
if (Nt) return ze;
|
|
1605
|
+
Nt = 1;
|
|
1606
|
+
const i = Kr(), n = (S, _, I) => {
|
|
1607
|
+
if (i(S) === !1)
|
|
1608
|
+
throw new TypeError("toRegexRange: expected the first argument to be a number");
|
|
1609
|
+
if (_ === void 0 || S === _)
|
|
1610
|
+
return String(S);
|
|
1611
|
+
if (i(_) === !1)
|
|
1612
|
+
throw new TypeError("toRegexRange: expected the second argument to be a number.");
|
|
1613
|
+
let R = { relaxZeros: !0, ...I };
|
|
1614
|
+
typeof R.strictZeros == "boolean" && (R.relaxZeros = R.strictZeros === !1);
|
|
1615
|
+
let F = String(R.relaxZeros), m = String(R.shorthand), L = String(R.capture), T = String(R.wrap), O = S + ":" + _ + "=" + F + m + L + T;
|
|
1616
|
+
if (n.cache.hasOwnProperty(O))
|
|
1617
|
+
return n.cache[O].result;
|
|
1618
|
+
let N = Math.min(S, _), M = Math.max(S, _);
|
|
1619
|
+
if (Math.abs(N - M) === 1) {
|
|
1620
|
+
let K = S + "|" + _;
|
|
1621
|
+
return R.capture ? `(${K})` : R.wrap === !1 ? K : `(?:${K})`;
|
|
1622
|
+
}
|
|
1623
|
+
let z = C(S) || C(_), D = { min: S, max: _, a: N, b: M }, $ = [], X = [];
|
|
1624
|
+
if (z && (D.isPadded = z, D.maxLen = String(D.max).length), N < 0) {
|
|
1625
|
+
let K = M < 0 ? Math.abs(M) : 1;
|
|
1626
|
+
X = A(K, Math.abs(N), D, R), N = D.a = 0;
|
|
1627
|
+
}
|
|
1628
|
+
return M >= 0 && ($ = A(N, M, D, R)), D.negatives = X, D.positives = $, D.result = u(X, $), R.capture === !0 ? D.result = `(${D.result})` : R.wrap !== !1 && $.length + X.length > 1 && (D.result = `(?:${D.result})`), n.cache[O] = D, D.result;
|
|
1629
|
+
};
|
|
1630
|
+
function u(S, _, I) {
|
|
1631
|
+
let R = s(S, _, "-", !1) || [], F = s(_, S, "", !1) || [], m = s(S, _, "-?", !0) || [];
|
|
1632
|
+
return R.concat(m).concat(F).join("|");
|
|
1633
|
+
}
|
|
1634
|
+
function f(S, _) {
|
|
1635
|
+
let I = 1, R = 1, F = p(S, I), m = /* @__PURE__ */ new Set([_]);
|
|
1636
|
+
for (; S <= F && F <= _; )
|
|
1637
|
+
m.add(F), I += 1, F = p(S, I);
|
|
1638
|
+
for (F = h(_ + 1, R) - 1; S < F && F <= _; )
|
|
1639
|
+
m.add(F), R += 1, F = h(_ + 1, R) - 1;
|
|
1640
|
+
return m = [...m], m.sort(g), m;
|
|
1641
|
+
}
|
|
1642
|
+
function y(S, _, I) {
|
|
1643
|
+
if (S === _)
|
|
1644
|
+
return { pattern: S, count: [], digits: 0 };
|
|
1645
|
+
let R = r(S, _), F = R.length, m = "", L = 0;
|
|
1646
|
+
for (let T = 0; T < F; T++) {
|
|
1647
|
+
let [O, N] = R[T];
|
|
1648
|
+
O === N ? m += O : O !== "0" || N !== "9" ? m += E(O, N) : L++;
|
|
1649
|
+
}
|
|
1650
|
+
return L && (m += I.shorthand === !0 ? "\\d" : "[0-9]"), { pattern: m, count: [L], digits: F };
|
|
1651
|
+
}
|
|
1652
|
+
function A(S, _, I, R) {
|
|
1653
|
+
let F = f(S, _), m = [], L = S, T;
|
|
1654
|
+
for (let O = 0; O < F.length; O++) {
|
|
1655
|
+
let N = F[O], M = y(String(L), String(N), R), z = "";
|
|
1656
|
+
if (!I.isPadded && T && T.pattern === M.pattern) {
|
|
1657
|
+
T.count.length > 1 && T.count.pop(), T.count.push(M.count[0]), T.string = T.pattern + c(T.count), L = N + 1;
|
|
1658
|
+
continue;
|
|
1659
|
+
}
|
|
1660
|
+
I.isPadded && (z = B(N, I, R)), M.string = z + M.pattern + c(M.count), m.push(M), L = N + 1, T = M;
|
|
1661
|
+
}
|
|
1662
|
+
return m;
|
|
1663
|
+
}
|
|
1664
|
+
function s(S, _, I, R, F) {
|
|
1665
|
+
let m = [];
|
|
1666
|
+
for (let L of S) {
|
|
1667
|
+
let { string: T } = L;
|
|
1668
|
+
!R && !l(_, "string", T) && m.push(I + T), R && l(_, "string", T) && m.push(I + T);
|
|
1669
|
+
}
|
|
1670
|
+
return m;
|
|
1671
|
+
}
|
|
1672
|
+
function r(S, _) {
|
|
1673
|
+
let I = [];
|
|
1674
|
+
for (let R = 0; R < S.length; R++) I.push([S[R], _[R]]);
|
|
1675
|
+
return I;
|
|
1676
|
+
}
|
|
1677
|
+
function g(S, _) {
|
|
1678
|
+
return S > _ ? 1 : _ > S ? -1 : 0;
|
|
1679
|
+
}
|
|
1680
|
+
function l(S, _, I) {
|
|
1681
|
+
return S.some((R) => R[_] === I);
|
|
1682
|
+
}
|
|
1683
|
+
function p(S, _) {
|
|
1684
|
+
return Number(String(S).slice(0, -_) + "9".repeat(_));
|
|
1685
|
+
}
|
|
1686
|
+
function h(S, _) {
|
|
1687
|
+
return S - S % Math.pow(10, _);
|
|
1688
|
+
}
|
|
1689
|
+
function c(S) {
|
|
1690
|
+
let [_ = 0, I = ""] = S;
|
|
1691
|
+
return I || _ > 1 ? `{${_ + (I ? "," + I : "")}}` : "";
|
|
1692
|
+
}
|
|
1693
|
+
function E(S, _, I) {
|
|
1694
|
+
return `[${S}${_ - S === 1 ? "" : "-"}${_}]`;
|
|
1695
|
+
}
|
|
1696
|
+
function C(S) {
|
|
1697
|
+
return /^-?(0+)\d/.test(S);
|
|
1698
|
+
}
|
|
1699
|
+
function B(S, _, I) {
|
|
1700
|
+
if (!_.isPadded)
|
|
1701
|
+
return S;
|
|
1702
|
+
let R = Math.abs(_.maxLen - String(S).length), F = I.relaxZeros !== !1;
|
|
1703
|
+
switch (R) {
|
|
1704
|
+
case 0:
|
|
1705
|
+
return "";
|
|
1706
|
+
case 1:
|
|
1707
|
+
return F ? "0?" : "0";
|
|
1708
|
+
case 2:
|
|
1709
|
+
return F ? "0{0,2}" : "00";
|
|
1710
|
+
default:
|
|
1711
|
+
return F ? `0{0,${R}}` : `0{${R}}`;
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
return n.cache = {}, n.clearCache = () => n.cache = {}, ze = n, ze;
|
|
1715
|
+
}
|
|
1716
|
+
var We, Ut;
|
|
1717
|
+
function hr() {
|
|
1718
|
+
if (Ut) return We;
|
|
1719
|
+
Ut = 1;
|
|
1720
|
+
const i = pr, n = jr(), u = (R) => R !== null && typeof R == "object" && !Array.isArray(R), f = (R) => (F) => R === !0 ? Number(F) : String(F), y = (R) => typeof R == "number" || typeof R == "string" && R !== "", A = (R) => Number.isInteger(+R), s = (R) => {
|
|
1721
|
+
let F = `${R}`, m = -1;
|
|
1722
|
+
if (F[0] === "-" && (F = F.slice(1)), F === "0") return !1;
|
|
1723
|
+
for (; F[++m] === "0"; ) ;
|
|
1724
|
+
return m > 0;
|
|
1725
|
+
}, r = (R, F, m) => typeof R == "string" || typeof F == "string" ? !0 : m.stringify === !0, g = (R, F, m) => {
|
|
1726
|
+
if (F > 0) {
|
|
1727
|
+
let L = R[0] === "-" ? "-" : "";
|
|
1728
|
+
L && (R = R.slice(1)), R = L + R.padStart(L ? F - 1 : F, "0");
|
|
1729
|
+
}
|
|
1730
|
+
return m === !1 ? String(R) : R;
|
|
1731
|
+
}, l = (R, F) => {
|
|
1732
|
+
let m = R[0] === "-" ? "-" : "";
|
|
1733
|
+
for (m && (R = R.slice(1), F--); R.length < F; ) R = "0" + R;
|
|
1734
|
+
return m ? "-" + R : R;
|
|
1735
|
+
}, p = (R, F, m) => {
|
|
1736
|
+
R.negatives.sort((M, z) => M < z ? -1 : M > z ? 1 : 0), R.positives.sort((M, z) => M < z ? -1 : M > z ? 1 : 0);
|
|
1737
|
+
let L = F.capture ? "" : "?:", T = "", O = "", N;
|
|
1738
|
+
return R.positives.length && (T = R.positives.map((M) => l(String(M), m)).join("|")), R.negatives.length && (O = `-(${L}${R.negatives.map((M) => l(String(M), m)).join("|")})`), T && O ? N = `${T}|${O}` : N = T || O, F.wrap ? `(${L}${N})` : N;
|
|
1739
|
+
}, h = (R, F, m, L) => {
|
|
1740
|
+
if (m)
|
|
1741
|
+
return n(R, F, { wrap: !1, ...L });
|
|
1742
|
+
let T = String.fromCharCode(R);
|
|
1743
|
+
if (R === F) return T;
|
|
1744
|
+
let O = String.fromCharCode(F);
|
|
1745
|
+
return `[${T}-${O}]`;
|
|
1746
|
+
}, c = (R, F, m) => {
|
|
1747
|
+
if (Array.isArray(R)) {
|
|
1748
|
+
let L = m.wrap === !0, T = m.capture ? "" : "?:";
|
|
1749
|
+
return L ? `(${T}${R.join("|")})` : R.join("|");
|
|
1750
|
+
}
|
|
1751
|
+
return n(R, F, m);
|
|
1752
|
+
}, E = (...R) => new RangeError("Invalid range arguments: " + i.inspect(...R)), C = (R, F, m) => {
|
|
1753
|
+
if (m.strictRanges === !0) throw E([R, F]);
|
|
1754
|
+
return [];
|
|
1755
|
+
}, B = (R, F) => {
|
|
1756
|
+
if (F.strictRanges === !0)
|
|
1757
|
+
throw new TypeError(`Expected step "${R}" to be a number`);
|
|
1758
|
+
return [];
|
|
1759
|
+
}, S = (R, F, m = 1, L = {}) => {
|
|
1760
|
+
let T = Number(R), O = Number(F);
|
|
1761
|
+
if (!Number.isInteger(T) || !Number.isInteger(O)) {
|
|
1762
|
+
if (L.strictRanges === !0) throw E([R, F]);
|
|
1763
|
+
return [];
|
|
1764
|
+
}
|
|
1765
|
+
T === 0 && (T = 0), O === 0 && (O = 0);
|
|
1766
|
+
let N = T > O, M = String(R), z = String(F), D = String(m);
|
|
1767
|
+
m = Math.max(Math.abs(m), 1);
|
|
1768
|
+
let $ = s(M) || s(z) || s(D), X = $ ? Math.max(M.length, z.length, D.length) : 0, K = $ === !1 && r(R, F, L) === !1, W = L.transform || f(K);
|
|
1769
|
+
if (L.toRegex && m === 1)
|
|
1770
|
+
return h(l(R, X), l(F, X), !0, L);
|
|
1771
|
+
let P = { negatives: [], positives: [] }, Y = (x) => P[x < 0 ? "negatives" : "positives"].push(Math.abs(x)), oe = [], ee = 0;
|
|
1772
|
+
for (; N ? T >= O : T <= O; )
|
|
1773
|
+
L.toRegex === !0 && m > 1 ? Y(T) : oe.push(g(W(T, ee), X, K)), T = N ? T - m : T + m, ee++;
|
|
1774
|
+
return L.toRegex === !0 ? m > 1 ? p(P, L, X) : c(oe, null, { wrap: !1, ...L }) : oe;
|
|
1775
|
+
}, _ = (R, F, m = 1, L = {}) => {
|
|
1776
|
+
if (!A(R) && R.length > 1 || !A(F) && F.length > 1)
|
|
1777
|
+
return C(R, F, L);
|
|
1778
|
+
let T = L.transform || ((K) => String.fromCharCode(K)), O = `${R}`.charCodeAt(0), N = `${F}`.charCodeAt(0), M = O > N, z = Math.min(O, N), D = Math.max(O, N);
|
|
1779
|
+
if (L.toRegex && m === 1)
|
|
1780
|
+
return h(z, D, !1, L);
|
|
1781
|
+
let $ = [], X = 0;
|
|
1782
|
+
for (; M ? O >= N : O <= N; )
|
|
1783
|
+
$.push(T(O, X)), O = M ? O - m : O + m, X++;
|
|
1784
|
+
return L.toRegex === !0 ? c($, null, { wrap: !1, options: L }) : $;
|
|
1785
|
+
}, I = (R, F, m, L = {}) => {
|
|
1786
|
+
if (F == null && y(R))
|
|
1787
|
+
return [R];
|
|
1788
|
+
if (!y(R) || !y(F))
|
|
1789
|
+
return C(R, F, L);
|
|
1790
|
+
if (typeof m == "function")
|
|
1791
|
+
return I(R, F, 1, { transform: m });
|
|
1792
|
+
if (u(m))
|
|
1793
|
+
return I(R, F, 0, m);
|
|
1794
|
+
let T = { ...L };
|
|
1795
|
+
return T.capture === !0 && (T.wrap = !0), m = m || T.step || 1, A(m) ? A(R) && A(F) ? S(R, F, m, T) : _(R, F, Math.max(Math.abs(m), 1), T) : m != null && !u(m) ? B(m, T) : I(R, F, 1, m);
|
|
1796
|
+
};
|
|
1797
|
+
return We = I, We;
|
|
1798
|
+
}
|
|
1799
|
+
var Xe, Mt;
|
|
1800
|
+
function zr() {
|
|
1801
|
+
if (Mt) return Xe;
|
|
1802
|
+
Mt = 1;
|
|
1803
|
+
const i = hr(), n = gt();
|
|
1804
|
+
return Xe = (f, y = {}) => {
|
|
1805
|
+
const A = (s, r = {}) => {
|
|
1806
|
+
const g = n.isInvalidBrace(r), l = s.invalid === !0 && y.escapeInvalid === !0, p = g === !0 || l === !0, h = y.escapeInvalid === !0 ? "\\" : "";
|
|
1807
|
+
let c = "";
|
|
1808
|
+
if (s.isOpen === !0)
|
|
1809
|
+
return h + s.value;
|
|
1810
|
+
if (s.isClose === !0)
|
|
1811
|
+
return console.log("node.isClose", h, s.value), h + s.value;
|
|
1812
|
+
if (s.type === "open")
|
|
1813
|
+
return p ? h + s.value : "(";
|
|
1814
|
+
if (s.type === "close")
|
|
1815
|
+
return p ? h + s.value : ")";
|
|
1816
|
+
if (s.type === "comma")
|
|
1817
|
+
return s.prev.type === "comma" ? "" : p ? s.value : "|";
|
|
1818
|
+
if (s.value)
|
|
1819
|
+
return s.value;
|
|
1820
|
+
if (s.nodes && s.ranges > 0) {
|
|
1821
|
+
const E = n.reduce(s.nodes), C = i(...E, { ...y, wrap: !1, toRegex: !0, strictZeros: !0 });
|
|
1822
|
+
if (C.length !== 0)
|
|
1823
|
+
return E.length > 1 && C.length > 1 ? `(${C})` : C;
|
|
1824
|
+
}
|
|
1825
|
+
if (s.nodes)
|
|
1826
|
+
for (const E of s.nodes)
|
|
1827
|
+
c += A(E, s);
|
|
1828
|
+
return c;
|
|
1829
|
+
};
|
|
1830
|
+
return A(f);
|
|
1831
|
+
}, Xe;
|
|
1832
|
+
}
|
|
1833
|
+
var Qe, kt;
|
|
1834
|
+
function Wr() {
|
|
1835
|
+
if (kt) return Qe;
|
|
1836
|
+
kt = 1;
|
|
1837
|
+
const i = hr(), n = dt(), u = gt(), f = (A = "", s = "", r = !1) => {
|
|
1838
|
+
const g = [];
|
|
1839
|
+
if (A = [].concat(A), s = [].concat(s), !s.length) return A;
|
|
1840
|
+
if (!A.length)
|
|
1841
|
+
return r ? u.flatten(s).map((l) => `{${l}}`) : s;
|
|
1842
|
+
for (const l of A)
|
|
1843
|
+
if (Array.isArray(l))
|
|
1844
|
+
for (const p of l)
|
|
1845
|
+
g.push(f(p, s, r));
|
|
1846
|
+
else
|
|
1847
|
+
for (let p of s)
|
|
1848
|
+
r === !0 && typeof p == "string" && (p = `{${p}}`), g.push(Array.isArray(p) ? f(l, p, r) : l + p);
|
|
1849
|
+
return u.flatten(g);
|
|
1850
|
+
};
|
|
1851
|
+
return Qe = (A, s = {}) => {
|
|
1852
|
+
const r = s.rangeLimit === void 0 ? 1e3 : s.rangeLimit, g = (l, p = {}) => {
|
|
1853
|
+
l.queue = [];
|
|
1854
|
+
let h = p, c = p.queue;
|
|
1855
|
+
for (; h.type !== "brace" && h.type !== "root" && h.parent; )
|
|
1856
|
+
h = h.parent, c = h.queue;
|
|
1857
|
+
if (l.invalid || l.dollar) {
|
|
1858
|
+
c.push(f(c.pop(), n(l, s)));
|
|
1859
|
+
return;
|
|
1860
|
+
}
|
|
1861
|
+
if (l.type === "brace" && l.invalid !== !0 && l.nodes.length === 2) {
|
|
1862
|
+
c.push(f(c.pop(), ["{}"]));
|
|
1863
|
+
return;
|
|
1864
|
+
}
|
|
1865
|
+
if (l.nodes && l.ranges > 0) {
|
|
1866
|
+
const S = u.reduce(l.nodes);
|
|
1867
|
+
if (u.exceedsLimit(...S, s.step, r))
|
|
1868
|
+
throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");
|
|
1869
|
+
let _ = i(...S, s);
|
|
1870
|
+
_.length === 0 && (_ = n(l, s)), c.push(f(c.pop(), _)), l.nodes = [];
|
|
1871
|
+
return;
|
|
1872
|
+
}
|
|
1873
|
+
const E = u.encloseBrace(l);
|
|
1874
|
+
let C = l.queue, B = l;
|
|
1875
|
+
for (; B.type !== "brace" && B.type !== "root" && B.parent; )
|
|
1876
|
+
B = B.parent, C = B.queue;
|
|
1877
|
+
for (let S = 0; S < l.nodes.length; S++) {
|
|
1878
|
+
const _ = l.nodes[S];
|
|
1879
|
+
if (_.type === "comma" && l.type === "brace") {
|
|
1880
|
+
S === 1 && C.push(""), C.push("");
|
|
1881
|
+
continue;
|
|
1882
|
+
}
|
|
1883
|
+
if (_.type === "close") {
|
|
1884
|
+
c.push(f(c.pop(), C, E));
|
|
1885
|
+
continue;
|
|
1886
|
+
}
|
|
1887
|
+
if (_.value && _.type !== "open") {
|
|
1888
|
+
C.push(f(C.pop(), _.value));
|
|
1889
|
+
continue;
|
|
1890
|
+
}
|
|
1891
|
+
_.nodes && g(_, l);
|
|
1892
|
+
}
|
|
1893
|
+
return C;
|
|
1894
|
+
};
|
|
1895
|
+
return u.flatten(g(A));
|
|
1896
|
+
}, Qe;
|
|
1897
|
+
}
|
|
1898
|
+
var Ze, Dt;
|
|
1899
|
+
function Xr() {
|
|
1900
|
+
return Dt || (Dt = 1, Ze = {
|
|
1901
|
+
MAX_LENGTH: 1e4,
|
|
1902
|
+
// Digits
|
|
1903
|
+
CHAR_0: "0",
|
|
1904
|
+
/* 0 */
|
|
1905
|
+
CHAR_9: "9",
|
|
1906
|
+
/* 9 */
|
|
1907
|
+
// Alphabet chars.
|
|
1908
|
+
CHAR_UPPERCASE_A: "A",
|
|
1909
|
+
/* A */
|
|
1910
|
+
CHAR_LOWERCASE_A: "a",
|
|
1911
|
+
/* a */
|
|
1912
|
+
CHAR_UPPERCASE_Z: "Z",
|
|
1913
|
+
/* Z */
|
|
1914
|
+
CHAR_LOWERCASE_Z: "z",
|
|
1915
|
+
/* z */
|
|
1916
|
+
CHAR_LEFT_PARENTHESES: "(",
|
|
1917
|
+
/* ( */
|
|
1918
|
+
CHAR_RIGHT_PARENTHESES: ")",
|
|
1919
|
+
/* ) */
|
|
1920
|
+
CHAR_ASTERISK: "*",
|
|
1921
|
+
/* * */
|
|
1922
|
+
// Non-alphabetic chars.
|
|
1923
|
+
CHAR_AMPERSAND: "&",
|
|
1924
|
+
/* & */
|
|
1925
|
+
CHAR_AT: "@",
|
|
1926
|
+
/* @ */
|
|
1927
|
+
CHAR_BACKSLASH: "\\",
|
|
1928
|
+
/* \ */
|
|
1929
|
+
CHAR_BACKTICK: "`",
|
|
1930
|
+
/* ` */
|
|
1931
|
+
CHAR_CARRIAGE_RETURN: "\r",
|
|
1932
|
+
/* \r */
|
|
1933
|
+
CHAR_CIRCUMFLEX_ACCENT: "^",
|
|
1934
|
+
/* ^ */
|
|
1935
|
+
CHAR_COLON: ":",
|
|
1936
|
+
/* : */
|
|
1937
|
+
CHAR_COMMA: ",",
|
|
1938
|
+
/* , */
|
|
1939
|
+
CHAR_DOLLAR: "$",
|
|
1940
|
+
/* . */
|
|
1941
|
+
CHAR_DOT: ".",
|
|
1942
|
+
/* . */
|
|
1943
|
+
CHAR_DOUBLE_QUOTE: '"',
|
|
1944
|
+
/* " */
|
|
1945
|
+
CHAR_EQUAL: "=",
|
|
1946
|
+
/* = */
|
|
1947
|
+
CHAR_EXCLAMATION_MARK: "!",
|
|
1948
|
+
/* ! */
|
|
1949
|
+
CHAR_FORM_FEED: "\f",
|
|
1950
|
+
/* \f */
|
|
1951
|
+
CHAR_FORWARD_SLASH: "/",
|
|
1952
|
+
/* / */
|
|
1953
|
+
CHAR_HASH: "#",
|
|
1954
|
+
/* # */
|
|
1955
|
+
CHAR_HYPHEN_MINUS: "-",
|
|
1956
|
+
/* - */
|
|
1957
|
+
CHAR_LEFT_ANGLE_BRACKET: "<",
|
|
1958
|
+
/* < */
|
|
1959
|
+
CHAR_LEFT_CURLY_BRACE: "{",
|
|
1960
|
+
/* { */
|
|
1961
|
+
CHAR_LEFT_SQUARE_BRACKET: "[",
|
|
1962
|
+
/* [ */
|
|
1963
|
+
CHAR_LINE_FEED: `
|
|
1964
|
+
`,
|
|
1965
|
+
/* \n */
|
|
1966
|
+
CHAR_NO_BREAK_SPACE: " ",
|
|
1967
|
+
/* \u00A0 */
|
|
1968
|
+
CHAR_PERCENT: "%",
|
|
1969
|
+
/* % */
|
|
1970
|
+
CHAR_PLUS: "+",
|
|
1971
|
+
/* + */
|
|
1972
|
+
CHAR_QUESTION_MARK: "?",
|
|
1973
|
+
/* ? */
|
|
1974
|
+
CHAR_RIGHT_ANGLE_BRACKET: ">",
|
|
1975
|
+
/* > */
|
|
1976
|
+
CHAR_RIGHT_CURLY_BRACE: "}",
|
|
1977
|
+
/* } */
|
|
1978
|
+
CHAR_RIGHT_SQUARE_BRACKET: "]",
|
|
1979
|
+
/* ] */
|
|
1980
|
+
CHAR_SEMICOLON: ";",
|
|
1981
|
+
/* ; */
|
|
1982
|
+
CHAR_SINGLE_QUOTE: "'",
|
|
1983
|
+
/* ' */
|
|
1984
|
+
CHAR_SPACE: " ",
|
|
1985
|
+
/* */
|
|
1986
|
+
CHAR_TAB: " ",
|
|
1987
|
+
/* \t */
|
|
1988
|
+
CHAR_UNDERSCORE: "_",
|
|
1989
|
+
/* _ */
|
|
1990
|
+
CHAR_VERTICAL_LINE: "|",
|
|
1991
|
+
/* | */
|
|
1992
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: "\uFEFF"
|
|
1993
|
+
/* \uFEFF */
|
|
1994
|
+
}), Ze;
|
|
1995
|
+
}
|
|
1996
|
+
var Ye, Pt;
|
|
1997
|
+
function Qr() {
|
|
1998
|
+
if (Pt) return Ye;
|
|
1999
|
+
Pt = 1;
|
|
2000
|
+
const i = dt(), {
|
|
2001
|
+
MAX_LENGTH: n,
|
|
2002
|
+
CHAR_BACKSLASH: u,
|
|
2003
|
+
/* \ */
|
|
2004
|
+
CHAR_BACKTICK: f,
|
|
2005
|
+
/* ` */
|
|
2006
|
+
CHAR_COMMA: y,
|
|
2007
|
+
/* , */
|
|
2008
|
+
CHAR_DOT: A,
|
|
2009
|
+
/* . */
|
|
2010
|
+
CHAR_LEFT_PARENTHESES: s,
|
|
2011
|
+
/* ( */
|
|
2012
|
+
CHAR_RIGHT_PARENTHESES: r,
|
|
2013
|
+
/* ) */
|
|
2014
|
+
CHAR_LEFT_CURLY_BRACE: g,
|
|
2015
|
+
/* { */
|
|
2016
|
+
CHAR_RIGHT_CURLY_BRACE: l,
|
|
2017
|
+
/* } */
|
|
2018
|
+
CHAR_LEFT_SQUARE_BRACKET: p,
|
|
2019
|
+
/* [ */
|
|
2020
|
+
CHAR_RIGHT_SQUARE_BRACKET: h,
|
|
2021
|
+
/* ] */
|
|
2022
|
+
CHAR_DOUBLE_QUOTE: c,
|
|
2023
|
+
/* " */
|
|
2024
|
+
CHAR_SINGLE_QUOTE: E,
|
|
2025
|
+
/* ' */
|
|
2026
|
+
CHAR_NO_BREAK_SPACE: C,
|
|
2027
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: B
|
|
2028
|
+
} = Xr();
|
|
2029
|
+
return Ye = (_, I = {}) => {
|
|
2030
|
+
if (typeof _ != "string")
|
|
2031
|
+
throw new TypeError("Expected a string");
|
|
2032
|
+
const R = I || {}, F = typeof R.maxLength == "number" ? Math.min(n, R.maxLength) : n;
|
|
2033
|
+
if (_.length > F)
|
|
2034
|
+
throw new SyntaxError(`Input length (${_.length}), exceeds max characters (${F})`);
|
|
2035
|
+
const m = { type: "root", input: _, nodes: [] }, L = [m];
|
|
2036
|
+
let T = m, O = m, N = 0;
|
|
2037
|
+
const M = _.length;
|
|
2038
|
+
let z = 0, D = 0, $;
|
|
2039
|
+
const X = () => _[z++], K = (W) => {
|
|
2040
|
+
if (W.type === "text" && O.type === "dot" && (O.type = "text"), O && O.type === "text" && W.type === "text") {
|
|
2041
|
+
O.value += W.value;
|
|
2042
|
+
return;
|
|
2043
|
+
}
|
|
2044
|
+
return T.nodes.push(W), W.parent = T, W.prev = O, O = W, W;
|
|
2045
|
+
};
|
|
2046
|
+
for (K({ type: "bos" }); z < M; )
|
|
2047
|
+
if (T = L[L.length - 1], $ = X(), !($ === B || $ === C)) {
|
|
2048
|
+
if ($ === u) {
|
|
2049
|
+
K({ type: "text", value: (I.keepEscaping ? $ : "") + X() });
|
|
2050
|
+
continue;
|
|
2051
|
+
}
|
|
2052
|
+
if ($ === h) {
|
|
2053
|
+
K({ type: "text", value: "\\" + $ });
|
|
2054
|
+
continue;
|
|
2055
|
+
}
|
|
2056
|
+
if ($ === p) {
|
|
2057
|
+
N++;
|
|
2058
|
+
let W;
|
|
2059
|
+
for (; z < M && (W = X()); ) {
|
|
2060
|
+
if ($ += W, W === p) {
|
|
2061
|
+
N++;
|
|
2062
|
+
continue;
|
|
2063
|
+
}
|
|
2064
|
+
if (W === u) {
|
|
2065
|
+
$ += X();
|
|
2066
|
+
continue;
|
|
2067
|
+
}
|
|
2068
|
+
if (W === h && (N--, N === 0))
|
|
2069
|
+
break;
|
|
2070
|
+
}
|
|
2071
|
+
K({ type: "text", value: $ });
|
|
2072
|
+
continue;
|
|
2073
|
+
}
|
|
2074
|
+
if ($ === s) {
|
|
2075
|
+
T = K({ type: "paren", nodes: [] }), L.push(T), K({ type: "text", value: $ });
|
|
2076
|
+
continue;
|
|
2077
|
+
}
|
|
2078
|
+
if ($ === r) {
|
|
2079
|
+
if (T.type !== "paren") {
|
|
2080
|
+
K({ type: "text", value: $ });
|
|
2081
|
+
continue;
|
|
2082
|
+
}
|
|
2083
|
+
T = L.pop(), K({ type: "text", value: $ }), T = L[L.length - 1];
|
|
2084
|
+
continue;
|
|
2085
|
+
}
|
|
2086
|
+
if ($ === c || $ === E || $ === f) {
|
|
2087
|
+
const W = $;
|
|
2088
|
+
let P;
|
|
2089
|
+
for (I.keepQuotes !== !0 && ($ = ""); z < M && (P = X()); ) {
|
|
2090
|
+
if (P === u) {
|
|
2091
|
+
$ += P + X();
|
|
2092
|
+
continue;
|
|
2093
|
+
}
|
|
2094
|
+
if (P === W) {
|
|
2095
|
+
I.keepQuotes === !0 && ($ += P);
|
|
2096
|
+
break;
|
|
2097
|
+
}
|
|
2098
|
+
$ += P;
|
|
2099
|
+
}
|
|
2100
|
+
K({ type: "text", value: $ });
|
|
2101
|
+
continue;
|
|
2102
|
+
}
|
|
2103
|
+
if ($ === g) {
|
|
2104
|
+
D++;
|
|
2105
|
+
const P = {
|
|
2106
|
+
type: "brace",
|
|
2107
|
+
open: !0,
|
|
2108
|
+
close: !1,
|
|
2109
|
+
dollar: O.value && O.value.slice(-1) === "$" || T.dollar === !0,
|
|
2110
|
+
depth: D,
|
|
2111
|
+
commas: 0,
|
|
2112
|
+
ranges: 0,
|
|
2113
|
+
nodes: []
|
|
2114
|
+
};
|
|
2115
|
+
T = K(P), L.push(T), K({ type: "open", value: $ });
|
|
2116
|
+
continue;
|
|
2117
|
+
}
|
|
2118
|
+
if ($ === l) {
|
|
2119
|
+
if (T.type !== "brace") {
|
|
2120
|
+
K({ type: "text", value: $ });
|
|
2121
|
+
continue;
|
|
2122
|
+
}
|
|
2123
|
+
const W = "close";
|
|
2124
|
+
T = L.pop(), T.close = !0, K({ type: W, value: $ }), D--, T = L[L.length - 1];
|
|
2125
|
+
continue;
|
|
2126
|
+
}
|
|
2127
|
+
if ($ === y && D > 0) {
|
|
2128
|
+
if (T.ranges > 0) {
|
|
2129
|
+
T.ranges = 0;
|
|
2130
|
+
const W = T.nodes.shift();
|
|
2131
|
+
T.nodes = [W, { type: "text", value: i(T) }];
|
|
2132
|
+
}
|
|
2133
|
+
K({ type: "comma", value: $ }), T.commas++;
|
|
2134
|
+
continue;
|
|
2135
|
+
}
|
|
2136
|
+
if ($ === A && D > 0 && T.commas === 0) {
|
|
2137
|
+
const W = T.nodes;
|
|
2138
|
+
if (D === 0 || W.length === 0) {
|
|
2139
|
+
K({ type: "text", value: $ });
|
|
2140
|
+
continue;
|
|
2141
|
+
}
|
|
2142
|
+
if (O.type === "dot") {
|
|
2143
|
+
if (T.range = [], O.value += $, O.type = "range", T.nodes.length !== 3 && T.nodes.length !== 5) {
|
|
2144
|
+
T.invalid = !0, T.ranges = 0, O.type = "text";
|
|
2145
|
+
continue;
|
|
2146
|
+
}
|
|
2147
|
+
T.ranges++, T.args = [];
|
|
2148
|
+
continue;
|
|
2149
|
+
}
|
|
2150
|
+
if (O.type === "range") {
|
|
2151
|
+
W.pop();
|
|
2152
|
+
const P = W[W.length - 1];
|
|
2153
|
+
P.value += O.value + $, O = P, T.ranges--;
|
|
2154
|
+
continue;
|
|
2155
|
+
}
|
|
2156
|
+
K({ type: "dot", value: $ });
|
|
2157
|
+
continue;
|
|
2158
|
+
}
|
|
2159
|
+
K({ type: "text", value: $ });
|
|
2160
|
+
}
|
|
2161
|
+
do
|
|
2162
|
+
if (T = L.pop(), T.type !== "root") {
|
|
2163
|
+
T.nodes.forEach((Y) => {
|
|
2164
|
+
Y.nodes || (Y.type === "open" && (Y.isOpen = !0), Y.type === "close" && (Y.isClose = !0), Y.nodes || (Y.type = "text"), Y.invalid = !0);
|
|
2165
|
+
});
|
|
2166
|
+
const W = L[L.length - 1], P = W.nodes.indexOf(T);
|
|
2167
|
+
W.nodes.splice(P, 1, ...T.nodes);
|
|
2168
|
+
}
|
|
2169
|
+
while (L.length > 0);
|
|
2170
|
+
return K({ type: "eos" }), m;
|
|
2171
|
+
}, Ye;
|
|
2172
|
+
}
|
|
2173
|
+
var Je, Gt;
|
|
2174
|
+
function Zr() {
|
|
2175
|
+
if (Gt) return Je;
|
|
2176
|
+
Gt = 1;
|
|
2177
|
+
const i = dt(), n = zr(), u = Wr(), f = Qr(), y = (A, s = {}) => {
|
|
2178
|
+
let r = [];
|
|
2179
|
+
if (Array.isArray(A))
|
|
2180
|
+
for (const g of A) {
|
|
2181
|
+
const l = y.create(g, s);
|
|
2182
|
+
Array.isArray(l) ? r.push(...l) : r.push(l);
|
|
2183
|
+
}
|
|
2184
|
+
else
|
|
2185
|
+
r = [].concat(y.create(A, s));
|
|
2186
|
+
return s && s.expand === !0 && s.nodupes === !0 && (r = [...new Set(r)]), r;
|
|
2187
|
+
};
|
|
2188
|
+
return y.parse = (A, s = {}) => f(A, s), y.stringify = (A, s = {}) => i(typeof A == "string" ? y.parse(A, s) : A, s), y.compile = (A, s = {}) => (typeof A == "string" && (A = y.parse(A, s)), n(A, s)), y.expand = (A, s = {}) => {
|
|
2189
|
+
typeof A == "string" && (A = y.parse(A, s));
|
|
2190
|
+
let r = u(A, s);
|
|
2191
|
+
return s.noempty === !0 && (r = r.filter(Boolean)), s.nodupes === !0 && (r = [...new Set(r)]), r;
|
|
2192
|
+
}, y.create = (A, s = {}) => A === "" || A.length < 3 ? [A] : s.expand !== !0 ? y.compile(A, s) : y.expand(A, s), Je = y, Je;
|
|
2193
|
+
}
|
|
2194
|
+
function yr(i, n) {
|
|
2195
|
+
for (var u = 0, f = i.length - 1; f >= 0; f--) {
|
|
2196
|
+
var y = i[f];
|
|
2197
|
+
y === "." ? i.splice(f, 1) : y === ".." ? (i.splice(f, 1), u++) : u && (i.splice(f, 1), u--);
|
|
2198
|
+
}
|
|
2199
|
+
if (n)
|
|
2200
|
+
for (; u--; u)
|
|
2201
|
+
i.unshift("..");
|
|
2202
|
+
return i;
|
|
2203
|
+
}
|
|
2204
|
+
var Yr = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/, At = function(i) {
|
|
2205
|
+
return Yr.exec(i).slice(1);
|
|
2206
|
+
};
|
|
2207
|
+
function Te() {
|
|
2208
|
+
for (var i = "", n = !1, u = arguments.length - 1; u >= -1 && !n; u--) {
|
|
2209
|
+
var f = u >= 0 ? arguments[u] : "/";
|
|
2210
|
+
if (typeof f != "string")
|
|
2211
|
+
throw new TypeError("Arguments to path.resolve must be strings");
|
|
2212
|
+
if (!f)
|
|
2213
|
+
continue;
|
|
2214
|
+
i = f + "/" + i, n = f.charAt(0) === "/";
|
|
2215
|
+
}
|
|
2216
|
+
return i = yr(Rt(i.split("/"), function(y) {
|
|
2217
|
+
return !!y;
|
|
2218
|
+
}), !n).join("/"), (n ? "/" : "") + i || ".";
|
|
2219
|
+
}
|
|
2220
|
+
function Et(i) {
|
|
2221
|
+
var n = wt(i), u = Vr(i, -1) === "/";
|
|
2222
|
+
return i = yr(Rt(i.split("/"), function(f) {
|
|
2223
|
+
return !!f;
|
|
2224
|
+
}), !n).join("/"), !i && !n && (i = "."), i && u && (i += "/"), (n ? "/" : "") + i;
|
|
2225
|
+
}
|
|
2226
|
+
function wt(i) {
|
|
2227
|
+
return i.charAt(0) === "/";
|
|
2228
|
+
}
|
|
2229
|
+
function gr() {
|
|
2230
|
+
var i = Array.prototype.slice.call(arguments, 0);
|
|
2231
|
+
return Et(Rt(i, function(n, u) {
|
|
2232
|
+
if (typeof n != "string")
|
|
2233
|
+
throw new TypeError("Arguments to path.join must be strings");
|
|
2234
|
+
return n;
|
|
2235
|
+
}).join("/"));
|
|
2236
|
+
}
|
|
2237
|
+
function dr(i, n) {
|
|
2238
|
+
i = Te(i).substr(1), n = Te(n).substr(1);
|
|
2239
|
+
function u(l) {
|
|
2240
|
+
for (var p = 0; p < l.length && l[p] === ""; p++)
|
|
2241
|
+
;
|
|
2242
|
+
for (var h = l.length - 1; h >= 0 && l[h] === ""; h--)
|
|
2243
|
+
;
|
|
2244
|
+
return p > h ? [] : l.slice(p, h - p + 1);
|
|
2245
|
+
}
|
|
2246
|
+
for (var f = u(i.split("/")), y = u(n.split("/")), A = Math.min(f.length, y.length), s = A, r = 0; r < A; r++)
|
|
2247
|
+
if (f[r] !== y[r]) {
|
|
2248
|
+
s = r;
|
|
2249
|
+
break;
|
|
2250
|
+
}
|
|
2251
|
+
for (var g = [], r = s; r < f.length; r++)
|
|
2252
|
+
g.push("..");
|
|
2253
|
+
return g = g.concat(y.slice(s)), g.join("/");
|
|
2254
|
+
}
|
|
2255
|
+
var Ar = "/", Er = ":";
|
|
2256
|
+
function wr(i) {
|
|
2257
|
+
var n = At(i), u = n[0], f = n[1];
|
|
2258
|
+
return !u && !f ? "." : (f && (f = f.substr(0, f.length - 1)), u + f);
|
|
2259
|
+
}
|
|
2260
|
+
function Rr(i, n) {
|
|
2261
|
+
var u = At(i)[2];
|
|
2262
|
+
return n && u.substr(-1 * n.length) === n && (u = u.substr(0, u.length - n.length)), u;
|
|
2263
|
+
}
|
|
2264
|
+
function _r(i) {
|
|
2265
|
+
return At(i)[3];
|
|
2266
|
+
}
|
|
2267
|
+
const Jr = {
|
|
2268
|
+
extname: _r,
|
|
2269
|
+
basename: Rr,
|
|
2270
|
+
dirname: wr,
|
|
2271
|
+
sep: Ar,
|
|
2272
|
+
delimiter: Er,
|
|
2273
|
+
relative: dr,
|
|
2274
|
+
join: gr,
|
|
2275
|
+
isAbsolute: wt,
|
|
2276
|
+
normalize: Et,
|
|
2277
|
+
resolve: Te
|
|
2278
|
+
};
|
|
2279
|
+
function Rt(i, n) {
|
|
2280
|
+
if (i.filter) return i.filter(n);
|
|
2281
|
+
for (var u = [], f = 0; f < i.length; f++)
|
|
2282
|
+
n(i[f], f, i) && u.push(i[f]);
|
|
2283
|
+
return u;
|
|
2284
|
+
}
|
|
2285
|
+
var Vr = "ab".substr(-1) === "b" ? function(i, n, u) {
|
|
2286
|
+
return i.substr(n, u);
|
|
2287
|
+
} : function(i, n, u) {
|
|
2288
|
+
return n < 0 && (n = i.length + n), i.substr(n, u);
|
|
2289
|
+
};
|
|
2290
|
+
const en = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2291
|
+
__proto__: null,
|
|
2292
|
+
basename: Rr,
|
|
2293
|
+
default: Jr,
|
|
2294
|
+
delimiter: Er,
|
|
2295
|
+
dirname: wr,
|
|
2296
|
+
extname: _r,
|
|
2297
|
+
isAbsolute: wt,
|
|
2298
|
+
join: gr,
|
|
2299
|
+
normalize: Et,
|
|
2300
|
+
relative: dr,
|
|
2301
|
+
resolve: Te,
|
|
2302
|
+
sep: Ar
|
|
2303
|
+
}, Symbol.toStringTag, { value: "Module" })), _t = /* @__PURE__ */ rr(en);
|
|
2304
|
+
var Ve = {}, et, qt;
|
|
2305
|
+
function $e() {
|
|
2306
|
+
if (qt) return et;
|
|
2307
|
+
qt = 1;
|
|
2308
|
+
const i = _t, n = "\\\\/", u = `[^${n}]`, f = "\\.", y = "\\+", A = "\\?", s = "\\/", r = "(?=.)", g = "[^/]", l = `(?:${s}|$)`, p = `(?:^|${s})`, h = `${f}{1,2}${l}`, c = `(?!${f})`, E = `(?!${p}${h})`, C = `(?!${f}{0,1}${l})`, B = `(?!${h})`, S = `[^.${s}]`, _ = `${g}*?`, I = {
|
|
2309
|
+
DOT_LITERAL: f,
|
|
2310
|
+
PLUS_LITERAL: y,
|
|
2311
|
+
QMARK_LITERAL: A,
|
|
2312
|
+
SLASH_LITERAL: s,
|
|
2313
|
+
ONE_CHAR: r,
|
|
2314
|
+
QMARK: g,
|
|
2315
|
+
END_ANCHOR: l,
|
|
2316
|
+
DOTS_SLASH: h,
|
|
2317
|
+
NO_DOT: c,
|
|
2318
|
+
NO_DOTS: E,
|
|
2319
|
+
NO_DOT_SLASH: C,
|
|
2320
|
+
NO_DOTS_SLASH: B,
|
|
2321
|
+
QMARK_NO_DOT: S,
|
|
2322
|
+
STAR: _,
|
|
2323
|
+
START_ANCHOR: p
|
|
2324
|
+
}, R = {
|
|
2325
|
+
...I,
|
|
2326
|
+
SLASH_LITERAL: `[${n}]`,
|
|
2327
|
+
QMARK: u,
|
|
2328
|
+
STAR: `${u}*?`,
|
|
2329
|
+
DOTS_SLASH: `${f}{1,2}(?:[${n}]|$)`,
|
|
2330
|
+
NO_DOT: `(?!${f})`,
|
|
2331
|
+
NO_DOTS: `(?!(?:^|[${n}])${f}{1,2}(?:[${n}]|$))`,
|
|
2332
|
+
NO_DOT_SLASH: `(?!${f}{0,1}(?:[${n}]|$))`,
|
|
2333
|
+
NO_DOTS_SLASH: `(?!${f}{1,2}(?:[${n}]|$))`,
|
|
2334
|
+
QMARK_NO_DOT: `[^.${n}]`,
|
|
2335
|
+
START_ANCHOR: `(?:^|[${n}])`,
|
|
2336
|
+
END_ANCHOR: `(?:[${n}]|$)`
|
|
2337
|
+
}, F = {
|
|
2338
|
+
alnum: "a-zA-Z0-9",
|
|
2339
|
+
alpha: "a-zA-Z",
|
|
2340
|
+
ascii: "\\x00-\\x7F",
|
|
2341
|
+
blank: " \\t",
|
|
2342
|
+
cntrl: "\\x00-\\x1F\\x7F",
|
|
2343
|
+
digit: "0-9",
|
|
2344
|
+
graph: "\\x21-\\x7E",
|
|
2345
|
+
lower: "a-z",
|
|
2346
|
+
print: "\\x20-\\x7E ",
|
|
2347
|
+
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
|
2348
|
+
space: " \\t\\r\\n\\v\\f",
|
|
2349
|
+
upper: "A-Z",
|
|
2350
|
+
word: "A-Za-z0-9_",
|
|
2351
|
+
xdigit: "A-Fa-f0-9"
|
|
2352
|
+
};
|
|
2353
|
+
return et = {
|
|
2354
|
+
MAX_LENGTH: 1024 * 64,
|
|
2355
|
+
POSIX_REGEX_SOURCE: F,
|
|
2356
|
+
// regular expressions
|
|
2357
|
+
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
2358
|
+
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
2359
|
+
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
2360
|
+
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
2361
|
+
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
2362
|
+
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
2363
|
+
// Replace globs with equivalent patterns to reduce parsing time.
|
|
2364
|
+
REPLACEMENTS: {
|
|
2365
|
+
"***": "*",
|
|
2366
|
+
"**/**": "**",
|
|
2367
|
+
"**/**/**": "**"
|
|
2368
|
+
},
|
|
2369
|
+
// Digits
|
|
2370
|
+
CHAR_0: 48,
|
|
2371
|
+
/* 0 */
|
|
2372
|
+
CHAR_9: 57,
|
|
2373
|
+
/* 9 */
|
|
2374
|
+
// Alphabet chars.
|
|
2375
|
+
CHAR_UPPERCASE_A: 65,
|
|
2376
|
+
/* A */
|
|
2377
|
+
CHAR_LOWERCASE_A: 97,
|
|
2378
|
+
/* a */
|
|
2379
|
+
CHAR_UPPERCASE_Z: 90,
|
|
2380
|
+
/* Z */
|
|
2381
|
+
CHAR_LOWERCASE_Z: 122,
|
|
2382
|
+
/* z */
|
|
2383
|
+
CHAR_LEFT_PARENTHESES: 40,
|
|
2384
|
+
/* ( */
|
|
2385
|
+
CHAR_RIGHT_PARENTHESES: 41,
|
|
2386
|
+
/* ) */
|
|
2387
|
+
CHAR_ASTERISK: 42,
|
|
2388
|
+
/* * */
|
|
2389
|
+
// Non-alphabetic chars.
|
|
2390
|
+
CHAR_AMPERSAND: 38,
|
|
2391
|
+
/* & */
|
|
2392
|
+
CHAR_AT: 64,
|
|
2393
|
+
/* @ */
|
|
2394
|
+
CHAR_BACKWARD_SLASH: 92,
|
|
2395
|
+
/* \ */
|
|
2396
|
+
CHAR_CARRIAGE_RETURN: 13,
|
|
2397
|
+
/* \r */
|
|
2398
|
+
CHAR_CIRCUMFLEX_ACCENT: 94,
|
|
2399
|
+
/* ^ */
|
|
2400
|
+
CHAR_COLON: 58,
|
|
2401
|
+
/* : */
|
|
2402
|
+
CHAR_COMMA: 44,
|
|
2403
|
+
/* , */
|
|
2404
|
+
CHAR_DOT: 46,
|
|
2405
|
+
/* . */
|
|
2406
|
+
CHAR_DOUBLE_QUOTE: 34,
|
|
2407
|
+
/* " */
|
|
2408
|
+
CHAR_EQUAL: 61,
|
|
2409
|
+
/* = */
|
|
2410
|
+
CHAR_EXCLAMATION_MARK: 33,
|
|
2411
|
+
/* ! */
|
|
2412
|
+
CHAR_FORM_FEED: 12,
|
|
2413
|
+
/* \f */
|
|
2414
|
+
CHAR_FORWARD_SLASH: 47,
|
|
2415
|
+
/* / */
|
|
2416
|
+
CHAR_GRAVE_ACCENT: 96,
|
|
2417
|
+
/* ` */
|
|
2418
|
+
CHAR_HASH: 35,
|
|
2419
|
+
/* # */
|
|
2420
|
+
CHAR_HYPHEN_MINUS: 45,
|
|
2421
|
+
/* - */
|
|
2422
|
+
CHAR_LEFT_ANGLE_BRACKET: 60,
|
|
2423
|
+
/* < */
|
|
2424
|
+
CHAR_LEFT_CURLY_BRACE: 123,
|
|
2425
|
+
/* { */
|
|
2426
|
+
CHAR_LEFT_SQUARE_BRACKET: 91,
|
|
2427
|
+
/* [ */
|
|
2428
|
+
CHAR_LINE_FEED: 10,
|
|
2429
|
+
/* \n */
|
|
2430
|
+
CHAR_NO_BREAK_SPACE: 160,
|
|
2431
|
+
/* \u00A0 */
|
|
2432
|
+
CHAR_PERCENT: 37,
|
|
2433
|
+
/* % */
|
|
2434
|
+
CHAR_PLUS: 43,
|
|
2435
|
+
/* + */
|
|
2436
|
+
CHAR_QUESTION_MARK: 63,
|
|
2437
|
+
/* ? */
|
|
2438
|
+
CHAR_RIGHT_ANGLE_BRACKET: 62,
|
|
2439
|
+
/* > */
|
|
2440
|
+
CHAR_RIGHT_CURLY_BRACE: 125,
|
|
2441
|
+
/* } */
|
|
2442
|
+
CHAR_RIGHT_SQUARE_BRACKET: 93,
|
|
2443
|
+
/* ] */
|
|
2444
|
+
CHAR_SEMICOLON: 59,
|
|
2445
|
+
/* ; */
|
|
2446
|
+
CHAR_SINGLE_QUOTE: 39,
|
|
2447
|
+
/* ' */
|
|
2448
|
+
CHAR_SPACE: 32,
|
|
2449
|
+
/* */
|
|
2450
|
+
CHAR_TAB: 9,
|
|
2451
|
+
/* \t */
|
|
2452
|
+
CHAR_UNDERSCORE: 95,
|
|
2453
|
+
/* _ */
|
|
2454
|
+
CHAR_VERTICAL_LINE: 124,
|
|
2455
|
+
/* | */
|
|
2456
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
2457
|
+
/* \uFEFF */
|
|
2458
|
+
SEP: i.sep,
|
|
2459
|
+
/**
|
|
2460
|
+
* Create EXTGLOB_CHARS
|
|
2461
|
+
*/
|
|
2462
|
+
extglobChars(m) {
|
|
2463
|
+
return {
|
|
2464
|
+
"!": { type: "negate", open: "(?:(?!(?:", close: `))${m.STAR})` },
|
|
2465
|
+
"?": { type: "qmark", open: "(?:", close: ")?" },
|
|
2466
|
+
"+": { type: "plus", open: "(?:", close: ")+" },
|
|
2467
|
+
"*": { type: "star", open: "(?:", close: ")*" },
|
|
2468
|
+
"@": { type: "at", open: "(?:", close: ")" }
|
|
2469
|
+
};
|
|
2470
|
+
},
|
|
2471
|
+
/**
|
|
2472
|
+
* Create GLOB_CHARS
|
|
2473
|
+
*/
|
|
2474
|
+
globChars(m) {
|
|
2475
|
+
return m === !0 ? R : I;
|
|
2476
|
+
}
|
|
2477
|
+
}, et;
|
|
2478
|
+
}
|
|
2479
|
+
var Kt;
|
|
2480
|
+
function Ie() {
|
|
2481
|
+
return Kt || (Kt = 1, (function(i) {
|
|
2482
|
+
const n = _t, u = ce.platform === "win32", {
|
|
2483
|
+
REGEX_BACKSLASH: f,
|
|
2484
|
+
REGEX_REMOVE_BACKSLASH: y,
|
|
2485
|
+
REGEX_SPECIAL_CHARS: A,
|
|
2486
|
+
REGEX_SPECIAL_CHARS_GLOBAL: s
|
|
2487
|
+
} = $e();
|
|
2488
|
+
i.isObject = (r) => r !== null && typeof r == "object" && !Array.isArray(r), i.hasRegexChars = (r) => A.test(r), i.isRegexChar = (r) => r.length === 1 && i.hasRegexChars(r), i.escapeRegex = (r) => r.replace(s, "\\$1"), i.toPosixSlashes = (r) => r.replace(f, "/"), i.removeBackslashes = (r) => r.replace(y, (g) => g === "\\" ? "" : g), i.supportsLookbehinds = () => {
|
|
2489
|
+
const r = ce.version.slice(1).split(".").map(Number);
|
|
2490
|
+
return r.length === 3 && r[0] >= 9 || r[0] === 8 && r[1] >= 10;
|
|
2491
|
+
}, i.isWindows = (r) => r && typeof r.windows == "boolean" ? r.windows : u === !0 || n.sep === "\\", i.escapeLast = (r, g, l) => {
|
|
2492
|
+
const p = r.lastIndexOf(g, l);
|
|
2493
|
+
return p === -1 ? r : r[p - 1] === "\\" ? i.escapeLast(r, g, p - 1) : `${r.slice(0, p)}\\${r.slice(p)}`;
|
|
2494
|
+
}, i.removePrefix = (r, g = {}) => {
|
|
2495
|
+
let l = r;
|
|
2496
|
+
return l.startsWith("./") && (l = l.slice(2), g.prefix = "./"), l;
|
|
2497
|
+
}, i.wrapOutput = (r, g = {}, l = {}) => {
|
|
2498
|
+
const p = l.contains ? "" : "^", h = l.contains ? "" : "$";
|
|
2499
|
+
let c = `${p}(?:${r})${h}`;
|
|
2500
|
+
return g.negated === !0 && (c = `(?:^(?!${c}).*$)`), c;
|
|
2501
|
+
};
|
|
2502
|
+
})(Ve)), Ve;
|
|
2503
|
+
}
|
|
2504
|
+
var tt, jt;
|
|
2505
|
+
function tn() {
|
|
2506
|
+
if (jt) return tt;
|
|
2507
|
+
jt = 1;
|
|
2508
|
+
const i = Ie(), {
|
|
2509
|
+
CHAR_ASTERISK: n,
|
|
2510
|
+
/* * */
|
|
2511
|
+
CHAR_AT: u,
|
|
2512
|
+
/* @ */
|
|
2513
|
+
CHAR_BACKWARD_SLASH: f,
|
|
2514
|
+
/* \ */
|
|
2515
|
+
CHAR_COMMA: y,
|
|
2516
|
+
/* , */
|
|
2517
|
+
CHAR_DOT: A,
|
|
2518
|
+
/* . */
|
|
2519
|
+
CHAR_EXCLAMATION_MARK: s,
|
|
2520
|
+
/* ! */
|
|
2521
|
+
CHAR_FORWARD_SLASH: r,
|
|
2522
|
+
/* / */
|
|
2523
|
+
CHAR_LEFT_CURLY_BRACE: g,
|
|
2524
|
+
/* { */
|
|
2525
|
+
CHAR_LEFT_PARENTHESES: l,
|
|
2526
|
+
/* ( */
|
|
2527
|
+
CHAR_LEFT_SQUARE_BRACKET: p,
|
|
2528
|
+
/* [ */
|
|
2529
|
+
CHAR_PLUS: h,
|
|
2530
|
+
/* + */
|
|
2531
|
+
CHAR_QUESTION_MARK: c,
|
|
2532
|
+
/* ? */
|
|
2533
|
+
CHAR_RIGHT_CURLY_BRACE: E,
|
|
2534
|
+
/* } */
|
|
2535
|
+
CHAR_RIGHT_PARENTHESES: C,
|
|
2536
|
+
/* ) */
|
|
2537
|
+
CHAR_RIGHT_SQUARE_BRACKET: B
|
|
2538
|
+
/* ] */
|
|
2539
|
+
} = $e(), S = (R) => R === r || R === f, _ = (R) => {
|
|
2540
|
+
R.isPrefix !== !0 && (R.depth = R.isGlobstar ? 1 / 0 : 1);
|
|
2541
|
+
};
|
|
2542
|
+
return tt = (R, F) => {
|
|
2543
|
+
const m = F || {}, L = R.length - 1, T = m.parts === !0 || m.scanToEnd === !0, O = [], N = [], M = [];
|
|
2544
|
+
let z = R, D = -1, $ = 0, X = 0, K = !1, W = !1, P = !1, Y = !1, oe = !1, ee = !1, x = !1, Q = !1, se = !1, re = !1, b = 0, H, j, k = { value: "", depth: 0, isGlob: !1 };
|
|
2545
|
+
const ue = () => D >= L, le = () => z.charCodeAt(D + 1), V = () => (H = j, z.charCodeAt(++D));
|
|
2546
|
+
for (; D < L; ) {
|
|
2547
|
+
j = V();
|
|
2548
|
+
let a;
|
|
2549
|
+
if (j === f) {
|
|
2550
|
+
x = k.backslashes = !0, j = V(), j === g && (ee = !0);
|
|
2551
|
+
continue;
|
|
2552
|
+
}
|
|
2553
|
+
if (ee === !0 || j === g) {
|
|
2554
|
+
for (b++; ue() !== !0 && (j = V()); ) {
|
|
2555
|
+
if (j === f) {
|
|
2556
|
+
x = k.backslashes = !0, V();
|
|
2557
|
+
continue;
|
|
2558
|
+
}
|
|
2559
|
+
if (j === g) {
|
|
2560
|
+
b++;
|
|
2561
|
+
continue;
|
|
2562
|
+
}
|
|
2563
|
+
if (ee !== !0 && j === A && (j = V()) === A) {
|
|
2564
|
+
if (K = k.isBrace = !0, P = k.isGlob = !0, re = !0, T === !0)
|
|
2565
|
+
continue;
|
|
2566
|
+
break;
|
|
2567
|
+
}
|
|
2568
|
+
if (ee !== !0 && j === y) {
|
|
2569
|
+
if (K = k.isBrace = !0, P = k.isGlob = !0, re = !0, T === !0)
|
|
2570
|
+
continue;
|
|
2571
|
+
break;
|
|
2572
|
+
}
|
|
2573
|
+
if (j === E && (b--, b === 0)) {
|
|
2574
|
+
ee = !1, K = k.isBrace = !0, re = !0;
|
|
2575
|
+
break;
|
|
2576
|
+
}
|
|
2577
|
+
}
|
|
2578
|
+
if (T === !0)
|
|
2579
|
+
continue;
|
|
2580
|
+
break;
|
|
2581
|
+
}
|
|
2582
|
+
if (j === r) {
|
|
2583
|
+
if (O.push(D), N.push(k), k = { value: "", depth: 0, isGlob: !1 }, re === !0) continue;
|
|
2584
|
+
if (H === A && D === $ + 1) {
|
|
2585
|
+
$ += 2;
|
|
2586
|
+
continue;
|
|
2587
|
+
}
|
|
2588
|
+
X = D + 1;
|
|
2589
|
+
continue;
|
|
2590
|
+
}
|
|
2591
|
+
if (m.noext !== !0 && (j === h || j === u || j === n || j === c || j === s) === !0 && le() === l) {
|
|
2592
|
+
if (P = k.isGlob = !0, Y = k.isExtglob = !0, re = !0, j === s && D === $ && (se = !0), T === !0) {
|
|
2593
|
+
for (; ue() !== !0 && (j = V()); ) {
|
|
2594
|
+
if (j === f) {
|
|
2595
|
+
x = k.backslashes = !0, j = V();
|
|
2596
|
+
continue;
|
|
2597
|
+
}
|
|
2598
|
+
if (j === C) {
|
|
2599
|
+
P = k.isGlob = !0, re = !0;
|
|
2600
|
+
break;
|
|
2601
|
+
}
|
|
2602
|
+
}
|
|
2603
|
+
continue;
|
|
2604
|
+
}
|
|
2605
|
+
break;
|
|
2606
|
+
}
|
|
2607
|
+
if (j === n) {
|
|
2608
|
+
if (H === n && (oe = k.isGlobstar = !0), P = k.isGlob = !0, re = !0, T === !0)
|
|
2609
|
+
continue;
|
|
2610
|
+
break;
|
|
2611
|
+
}
|
|
2612
|
+
if (j === c) {
|
|
2613
|
+
if (P = k.isGlob = !0, re = !0, T === !0)
|
|
2614
|
+
continue;
|
|
2615
|
+
break;
|
|
2616
|
+
}
|
|
2617
|
+
if (j === p) {
|
|
2618
|
+
for (; ue() !== !0 && (a = V()); ) {
|
|
2619
|
+
if (a === f) {
|
|
2620
|
+
x = k.backslashes = !0, V();
|
|
2621
|
+
continue;
|
|
2622
|
+
}
|
|
2623
|
+
if (a === B) {
|
|
2624
|
+
W = k.isBracket = !0, P = k.isGlob = !0, re = !0;
|
|
2625
|
+
break;
|
|
2626
|
+
}
|
|
2627
|
+
}
|
|
2628
|
+
if (T === !0)
|
|
2629
|
+
continue;
|
|
2630
|
+
break;
|
|
2631
|
+
}
|
|
2632
|
+
if (m.nonegate !== !0 && j === s && D === $) {
|
|
2633
|
+
Q = k.negated = !0, $++;
|
|
2634
|
+
continue;
|
|
2635
|
+
}
|
|
2636
|
+
if (m.noparen !== !0 && j === l) {
|
|
2637
|
+
if (P = k.isGlob = !0, T === !0) {
|
|
2638
|
+
for (; ue() !== !0 && (j = V()); ) {
|
|
2639
|
+
if (j === l) {
|
|
2640
|
+
x = k.backslashes = !0, j = V();
|
|
2641
|
+
continue;
|
|
2642
|
+
}
|
|
2643
|
+
if (j === C) {
|
|
2644
|
+
re = !0;
|
|
2645
|
+
break;
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2648
|
+
continue;
|
|
2649
|
+
}
|
|
2650
|
+
break;
|
|
2651
|
+
}
|
|
2652
|
+
if (P === !0) {
|
|
2653
|
+
if (re = !0, T === !0)
|
|
2654
|
+
continue;
|
|
2655
|
+
break;
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
m.noext === !0 && (Y = !1, P = !1);
|
|
2659
|
+
let J = z, ie = "", ae = "";
|
|
2660
|
+
$ > 0 && (ie = z.slice(0, $), z = z.slice($), X -= $), J && P === !0 && X > 0 ? (J = z.slice(0, X), ae = z.slice(X)) : P === !0 ? (J = "", ae = z) : J = z, J && J !== "" && J !== "/" && J !== z && S(J.charCodeAt(J.length - 1)) && (J = J.slice(0, -1)), m.unescape === !0 && (ae && (ae = i.removeBackslashes(ae)), J && x === !0 && (J = i.removeBackslashes(J)));
|
|
2661
|
+
const ne = {
|
|
2662
|
+
prefix: ie,
|
|
2663
|
+
input: R,
|
|
2664
|
+
start: $,
|
|
2665
|
+
base: J,
|
|
2666
|
+
glob: ae,
|
|
2667
|
+
isBrace: K,
|
|
2668
|
+
isBracket: W,
|
|
2669
|
+
isGlob: P,
|
|
2670
|
+
isExtglob: Y,
|
|
2671
|
+
isGlobstar: oe,
|
|
2672
|
+
negated: Q,
|
|
2673
|
+
negatedExtglob: se
|
|
2674
|
+
};
|
|
2675
|
+
if (m.tokens === !0 && (ne.maxDepth = 0, S(j) || N.push(k), ne.tokens = N), m.parts === !0 || m.tokens === !0) {
|
|
2676
|
+
let a;
|
|
2677
|
+
for (let e = 0; e < O.length; e++) {
|
|
2678
|
+
const t = a ? a + 1 : $, o = O[e], d = R.slice(t, o);
|
|
2679
|
+
m.tokens && (e === 0 && $ !== 0 ? (N[e].isPrefix = !0, N[e].value = ie) : N[e].value = d, _(N[e]), ne.maxDepth += N[e].depth), (e !== 0 || d !== "") && M.push(d), a = o;
|
|
2680
|
+
}
|
|
2681
|
+
if (a && a + 1 < R.length) {
|
|
2682
|
+
const e = R.slice(a + 1);
|
|
2683
|
+
M.push(e), m.tokens && (N[N.length - 1].value = e, _(N[N.length - 1]), ne.maxDepth += N[N.length - 1].depth);
|
|
2684
|
+
}
|
|
2685
|
+
ne.slashes = O, ne.parts = M;
|
|
2686
|
+
}
|
|
2687
|
+
return ne;
|
|
2688
|
+
}, tt;
|
|
2689
|
+
}
|
|
2690
|
+
var rt, zt;
|
|
2691
|
+
function rn() {
|
|
2692
|
+
if (zt) return rt;
|
|
2693
|
+
zt = 1;
|
|
2694
|
+
const i = $e(), n = Ie(), {
|
|
2695
|
+
MAX_LENGTH: u,
|
|
2696
|
+
POSIX_REGEX_SOURCE: f,
|
|
2697
|
+
REGEX_NON_SPECIAL_CHARS: y,
|
|
2698
|
+
REGEX_SPECIAL_CHARS_BACKREF: A,
|
|
2699
|
+
REPLACEMENTS: s
|
|
2700
|
+
} = i, r = (p, h) => {
|
|
2701
|
+
if (typeof h.expandRange == "function")
|
|
2702
|
+
return h.expandRange(...p, h);
|
|
2703
|
+
p.sort();
|
|
2704
|
+
const c = `[${p.join("-")}]`;
|
|
2705
|
+
try {
|
|
2706
|
+
new RegExp(c);
|
|
2707
|
+
} catch {
|
|
2708
|
+
return p.map((C) => n.escapeRegex(C)).join("..");
|
|
2709
|
+
}
|
|
2710
|
+
return c;
|
|
2711
|
+
}, g = (p, h) => `Missing ${p}: "${h}" - use "\\\\${h}" to match literal characters`, l = (p, h) => {
|
|
2712
|
+
if (typeof p != "string")
|
|
2713
|
+
throw new TypeError("Expected a string");
|
|
2714
|
+
p = s[p] || p;
|
|
2715
|
+
const c = { ...h }, E = typeof c.maxLength == "number" ? Math.min(u, c.maxLength) : u;
|
|
2716
|
+
let C = p.length;
|
|
2717
|
+
if (C > E)
|
|
2718
|
+
throw new SyntaxError(`Input length: ${C}, exceeds maximum allowed length: ${E}`);
|
|
2719
|
+
const B = { type: "bos", value: "", output: c.prepend || "" }, S = [B], _ = c.capture ? "" : "?:", I = n.isWindows(h), R = i.globChars(I), F = i.extglobChars(R), {
|
|
2720
|
+
DOT_LITERAL: m,
|
|
2721
|
+
PLUS_LITERAL: L,
|
|
2722
|
+
SLASH_LITERAL: T,
|
|
2723
|
+
ONE_CHAR: O,
|
|
2724
|
+
DOTS_SLASH: N,
|
|
2725
|
+
NO_DOT: M,
|
|
2726
|
+
NO_DOT_SLASH: z,
|
|
2727
|
+
NO_DOTS_SLASH: D,
|
|
2728
|
+
QMARK: $,
|
|
2729
|
+
QMARK_NO_DOT: X,
|
|
2730
|
+
STAR: K,
|
|
2731
|
+
START_ANCHOR: W
|
|
2732
|
+
} = R, P = (o) => `(${_}(?:(?!${W}${o.dot ? N : m}).)*?)`, Y = c.dot ? "" : M, oe = c.dot ? $ : X;
|
|
2733
|
+
let ee = c.bash === !0 ? P(c) : K;
|
|
2734
|
+
c.capture && (ee = `(${ee})`), typeof c.noext == "boolean" && (c.noextglob = c.noext);
|
|
2735
|
+
const x = {
|
|
2736
|
+
input: p,
|
|
2737
|
+
index: -1,
|
|
2738
|
+
start: 0,
|
|
2739
|
+
dot: c.dot === !0,
|
|
2740
|
+
consumed: "",
|
|
2741
|
+
output: "",
|
|
2742
|
+
prefix: "",
|
|
2743
|
+
backtrack: !1,
|
|
2744
|
+
negated: !1,
|
|
2745
|
+
brackets: 0,
|
|
2746
|
+
braces: 0,
|
|
2747
|
+
parens: 0,
|
|
2748
|
+
quotes: 0,
|
|
2749
|
+
globstar: !1,
|
|
2750
|
+
tokens: S
|
|
2751
|
+
};
|
|
2752
|
+
p = n.removePrefix(p, x), C = p.length;
|
|
2753
|
+
const Q = [], se = [], re = [];
|
|
2754
|
+
let b = B, H;
|
|
2755
|
+
const j = () => x.index === C - 1, k = x.peek = (o = 1) => p[x.index + o], ue = x.advance = () => p[++x.index] || "", le = () => p.slice(x.index + 1), V = (o = "", d = 0) => {
|
|
2756
|
+
x.consumed += o, x.index += d;
|
|
2757
|
+
}, J = (o) => {
|
|
2758
|
+
x.output += o.output != null ? o.output : o.value, V(o.value);
|
|
2759
|
+
}, ie = () => {
|
|
2760
|
+
let o = 1;
|
|
2761
|
+
for (; k() === "!" && (k(2) !== "(" || k(3) === "?"); )
|
|
2762
|
+
ue(), x.start++, o++;
|
|
2763
|
+
return o % 2 === 0 ? !1 : (x.negated = !0, x.start++, !0);
|
|
2764
|
+
}, ae = (o) => {
|
|
2765
|
+
x[o]++, re.push(o);
|
|
2766
|
+
}, ne = (o) => {
|
|
2767
|
+
x[o]--, re.pop();
|
|
2768
|
+
}, a = (o) => {
|
|
2769
|
+
if (b.type === "globstar") {
|
|
2770
|
+
const d = x.braces > 0 && (o.type === "comma" || o.type === "brace"), w = o.extglob === !0 || Q.length && (o.type === "pipe" || o.type === "paren");
|
|
2771
|
+
o.type !== "slash" && o.type !== "paren" && !d && !w && (x.output = x.output.slice(0, -b.output.length), b.type = "star", b.value = "*", b.output = ee, x.output += b.output);
|
|
2772
|
+
}
|
|
2773
|
+
if (Q.length && o.type !== "paren" && (Q[Q.length - 1].inner += o.value), (o.value || o.output) && J(o), b && b.type === "text" && o.type === "text") {
|
|
2774
|
+
b.value += o.value, b.output = (b.output || "") + o.value;
|
|
2775
|
+
return;
|
|
2776
|
+
}
|
|
2777
|
+
o.prev = b, S.push(o), b = o;
|
|
2778
|
+
}, e = (o, d) => {
|
|
2779
|
+
const w = { ...F[d], conditions: 1, inner: "" };
|
|
2780
|
+
w.prev = b, w.parens = x.parens, w.output = x.output;
|
|
2781
|
+
const v = (c.capture ? "(" : "") + w.open;
|
|
2782
|
+
ae("parens"), a({ type: o, value: d, output: x.output ? "" : O }), a({ type: "paren", extglob: !0, value: ue(), output: v }), Q.push(w);
|
|
2783
|
+
}, t = (o) => {
|
|
2784
|
+
let d = o.close + (c.capture ? ")" : ""), w;
|
|
2785
|
+
if (o.type === "negate") {
|
|
2786
|
+
let v = ee;
|
|
2787
|
+
if (o.inner && o.inner.length > 1 && o.inner.includes("/") && (v = P(c)), (v !== ee || j() || /^\)+$/.test(le())) && (d = o.close = `)$))${v}`), o.inner.includes("*") && (w = le()) && /^\.[^\\/.]+$/.test(w)) {
|
|
2788
|
+
const U = l(w, { ...h, fastpaths: !1 }).output;
|
|
2789
|
+
d = o.close = `)${U})${v})`;
|
|
2790
|
+
}
|
|
2791
|
+
o.prev.type === "bos" && (x.negatedExtglob = !0);
|
|
2792
|
+
}
|
|
2793
|
+
a({ type: "paren", extglob: !0, value: H, output: d }), ne("parens");
|
|
2794
|
+
};
|
|
2795
|
+
if (c.fastpaths !== !1 && !/(^[*!]|[/()[\]{}"])/.test(p)) {
|
|
2796
|
+
let o = !1, d = p.replace(A, (w, v, U, q, G, te) => q === "\\" ? (o = !0, w) : q === "?" ? v ? v + q + (G ? $.repeat(G.length) : "") : te === 0 ? oe + (G ? $.repeat(G.length) : "") : $.repeat(U.length) : q === "." ? m.repeat(U.length) : q === "*" ? v ? v + q + (G ? ee : "") : ee : v ? w : `\\${w}`);
|
|
2797
|
+
return o === !0 && (c.unescape === !0 ? d = d.replace(/\\/g, "") : d = d.replace(/\\+/g, (w) => w.length % 2 === 0 ? "\\\\" : w ? "\\" : "")), d === p && c.contains === !0 ? (x.output = p, x) : (x.output = n.wrapOutput(d, x, h), x);
|
|
2798
|
+
}
|
|
2799
|
+
for (; !j(); ) {
|
|
2800
|
+
if (H = ue(), H === "\0")
|
|
2801
|
+
continue;
|
|
2802
|
+
if (H === "\\") {
|
|
2803
|
+
const w = k();
|
|
2804
|
+
if (w === "/" && c.bash !== !0 || w === "." || w === ";")
|
|
2805
|
+
continue;
|
|
2806
|
+
if (!w) {
|
|
2807
|
+
H += "\\", a({ type: "text", value: H });
|
|
2808
|
+
continue;
|
|
2809
|
+
}
|
|
2810
|
+
const v = /^\\+/.exec(le());
|
|
2811
|
+
let U = 0;
|
|
2812
|
+
if (v && v[0].length > 2 && (U = v[0].length, x.index += U, U % 2 !== 0 && (H += "\\")), c.unescape === !0 ? H = ue() : H += ue(), x.brackets === 0) {
|
|
2813
|
+
a({ type: "text", value: H });
|
|
2814
|
+
continue;
|
|
2815
|
+
}
|
|
2816
|
+
}
|
|
2817
|
+
if (x.brackets > 0 && (H !== "]" || b.value === "[" || b.value === "[^")) {
|
|
2818
|
+
if (c.posix !== !1 && H === ":") {
|
|
2819
|
+
const w = b.value.slice(1);
|
|
2820
|
+
if (w.includes("[") && (b.posix = !0, w.includes(":"))) {
|
|
2821
|
+
const v = b.value.lastIndexOf("["), U = b.value.slice(0, v), q = b.value.slice(v + 2), G = f[q];
|
|
2822
|
+
if (G) {
|
|
2823
|
+
b.value = U + G, x.backtrack = !0, ue(), !B.output && S.indexOf(b) === 1 && (B.output = O);
|
|
2824
|
+
continue;
|
|
2825
|
+
}
|
|
2826
|
+
}
|
|
2827
|
+
}
|
|
2828
|
+
(H === "[" && k() !== ":" || H === "-" && k() === "]") && (H = `\\${H}`), H === "]" && (b.value === "[" || b.value === "[^") && (H = `\\${H}`), c.posix === !0 && H === "!" && b.value === "[" && (H = "^"), b.value += H, J({ value: H });
|
|
2829
|
+
continue;
|
|
2830
|
+
}
|
|
2831
|
+
if (x.quotes === 1 && H !== '"') {
|
|
2832
|
+
H = n.escapeRegex(H), b.value += H, J({ value: H });
|
|
2833
|
+
continue;
|
|
2834
|
+
}
|
|
2835
|
+
if (H === '"') {
|
|
2836
|
+
x.quotes = x.quotes === 1 ? 0 : 1, c.keepQuotes === !0 && a({ type: "text", value: H });
|
|
2837
|
+
continue;
|
|
2838
|
+
}
|
|
2839
|
+
if (H === "(") {
|
|
2840
|
+
ae("parens"), a({ type: "paren", value: H });
|
|
2841
|
+
continue;
|
|
2842
|
+
}
|
|
2843
|
+
if (H === ")") {
|
|
2844
|
+
if (x.parens === 0 && c.strictBrackets === !0)
|
|
2845
|
+
throw new SyntaxError(g("opening", "("));
|
|
2846
|
+
const w = Q[Q.length - 1];
|
|
2847
|
+
if (w && x.parens === w.parens + 1) {
|
|
2848
|
+
t(Q.pop());
|
|
2849
|
+
continue;
|
|
2850
|
+
}
|
|
2851
|
+
a({ type: "paren", value: H, output: x.parens ? ")" : "\\)" }), ne("parens");
|
|
2852
|
+
continue;
|
|
2853
|
+
}
|
|
2854
|
+
if (H === "[") {
|
|
2855
|
+
if (c.nobracket === !0 || !le().includes("]")) {
|
|
2856
|
+
if (c.nobracket !== !0 && c.strictBrackets === !0)
|
|
2857
|
+
throw new SyntaxError(g("closing", "]"));
|
|
2858
|
+
H = `\\${H}`;
|
|
2859
|
+
} else
|
|
2860
|
+
ae("brackets");
|
|
2861
|
+
a({ type: "bracket", value: H });
|
|
2862
|
+
continue;
|
|
2863
|
+
}
|
|
2864
|
+
if (H === "]") {
|
|
2865
|
+
if (c.nobracket === !0 || b && b.type === "bracket" && b.value.length === 1) {
|
|
2866
|
+
a({ type: "text", value: H, output: `\\${H}` });
|
|
2867
|
+
continue;
|
|
2868
|
+
}
|
|
2869
|
+
if (x.brackets === 0) {
|
|
2870
|
+
if (c.strictBrackets === !0)
|
|
2871
|
+
throw new SyntaxError(g("opening", "["));
|
|
2872
|
+
a({ type: "text", value: H, output: `\\${H}` });
|
|
2873
|
+
continue;
|
|
2874
|
+
}
|
|
2875
|
+
ne("brackets");
|
|
2876
|
+
const w = b.value.slice(1);
|
|
2877
|
+
if (b.posix !== !0 && w[0] === "^" && !w.includes("/") && (H = `/${H}`), b.value += H, J({ value: H }), c.literalBrackets === !1 || n.hasRegexChars(w))
|
|
2878
|
+
continue;
|
|
2879
|
+
const v = n.escapeRegex(b.value);
|
|
2880
|
+
if (x.output = x.output.slice(0, -b.value.length), c.literalBrackets === !0) {
|
|
2881
|
+
x.output += v, b.value = v;
|
|
2882
|
+
continue;
|
|
2883
|
+
}
|
|
2884
|
+
b.value = `(${_}${v}|${b.value})`, x.output += b.value;
|
|
2885
|
+
continue;
|
|
2886
|
+
}
|
|
2887
|
+
if (H === "{" && c.nobrace !== !0) {
|
|
2888
|
+
ae("braces");
|
|
2889
|
+
const w = {
|
|
2890
|
+
type: "brace",
|
|
2891
|
+
value: H,
|
|
2892
|
+
output: "(",
|
|
2893
|
+
outputIndex: x.output.length,
|
|
2894
|
+
tokensIndex: x.tokens.length
|
|
2895
|
+
};
|
|
2896
|
+
se.push(w), a(w);
|
|
2897
|
+
continue;
|
|
2898
|
+
}
|
|
2899
|
+
if (H === "}") {
|
|
2900
|
+
const w = se[se.length - 1];
|
|
2901
|
+
if (c.nobrace === !0 || !w) {
|
|
2902
|
+
a({ type: "text", value: H, output: H });
|
|
2903
|
+
continue;
|
|
2904
|
+
}
|
|
2905
|
+
let v = ")";
|
|
2906
|
+
if (w.dots === !0) {
|
|
2907
|
+
const U = S.slice(), q = [];
|
|
2908
|
+
for (let G = U.length - 1; G >= 0 && (S.pop(), U[G].type !== "brace"); G--)
|
|
2909
|
+
U[G].type !== "dots" && q.unshift(U[G].value);
|
|
2910
|
+
v = r(q, c), x.backtrack = !0;
|
|
2911
|
+
}
|
|
2912
|
+
if (w.comma !== !0 && w.dots !== !0) {
|
|
2913
|
+
const U = x.output.slice(0, w.outputIndex), q = x.tokens.slice(w.tokensIndex);
|
|
2914
|
+
w.value = w.output = "\\{", H = v = "\\}", x.output = U;
|
|
2915
|
+
for (const G of q)
|
|
2916
|
+
x.output += G.output || G.value;
|
|
2917
|
+
}
|
|
2918
|
+
a({ type: "brace", value: H, output: v }), ne("braces"), se.pop();
|
|
2919
|
+
continue;
|
|
2920
|
+
}
|
|
2921
|
+
if (H === "|") {
|
|
2922
|
+
Q.length > 0 && Q[Q.length - 1].conditions++, a({ type: "text", value: H });
|
|
2923
|
+
continue;
|
|
2924
|
+
}
|
|
2925
|
+
if (H === ",") {
|
|
2926
|
+
let w = H;
|
|
2927
|
+
const v = se[se.length - 1];
|
|
2928
|
+
v && re[re.length - 1] === "braces" && (v.comma = !0, w = "|"), a({ type: "comma", value: H, output: w });
|
|
2929
|
+
continue;
|
|
2930
|
+
}
|
|
2931
|
+
if (H === "/") {
|
|
2932
|
+
if (b.type === "dot" && x.index === x.start + 1) {
|
|
2933
|
+
x.start = x.index + 1, x.consumed = "", x.output = "", S.pop(), b = B;
|
|
2934
|
+
continue;
|
|
2935
|
+
}
|
|
2936
|
+
a({ type: "slash", value: H, output: T });
|
|
2937
|
+
continue;
|
|
2938
|
+
}
|
|
2939
|
+
if (H === ".") {
|
|
2940
|
+
if (x.braces > 0 && b.type === "dot") {
|
|
2941
|
+
b.value === "." && (b.output = m);
|
|
2942
|
+
const w = se[se.length - 1];
|
|
2943
|
+
b.type = "dots", b.output += H, b.value += H, w.dots = !0;
|
|
2944
|
+
continue;
|
|
2945
|
+
}
|
|
2946
|
+
if (x.braces + x.parens === 0 && b.type !== "bos" && b.type !== "slash") {
|
|
2947
|
+
a({ type: "text", value: H, output: m });
|
|
2948
|
+
continue;
|
|
2949
|
+
}
|
|
2950
|
+
a({ type: "dot", value: H, output: m });
|
|
2951
|
+
continue;
|
|
2952
|
+
}
|
|
2953
|
+
if (H === "?") {
|
|
2954
|
+
if (!(b && b.value === "(") && c.noextglob !== !0 && k() === "(" && k(2) !== "?") {
|
|
2955
|
+
e("qmark", H);
|
|
2956
|
+
continue;
|
|
2957
|
+
}
|
|
2958
|
+
if (b && b.type === "paren") {
|
|
2959
|
+
const v = k();
|
|
2960
|
+
let U = H;
|
|
2961
|
+
if (v === "<" && !n.supportsLookbehinds())
|
|
2962
|
+
throw new Error("Node.js v10 or higher is required for regex lookbehinds");
|
|
2963
|
+
(b.value === "(" && !/[!=<:]/.test(v) || v === "<" && !/<([!=]|\w+>)/.test(le())) && (U = `\\${H}`), a({ type: "text", value: H, output: U });
|
|
2964
|
+
continue;
|
|
2965
|
+
}
|
|
2966
|
+
if (c.dot !== !0 && (b.type === "slash" || b.type === "bos")) {
|
|
2967
|
+
a({ type: "qmark", value: H, output: X });
|
|
2968
|
+
continue;
|
|
2969
|
+
}
|
|
2970
|
+
a({ type: "qmark", value: H, output: $ });
|
|
2971
|
+
continue;
|
|
2972
|
+
}
|
|
2973
|
+
if (H === "!") {
|
|
2974
|
+
if (c.noextglob !== !0 && k() === "(" && (k(2) !== "?" || !/[!=<:]/.test(k(3)))) {
|
|
2975
|
+
e("negate", H);
|
|
2976
|
+
continue;
|
|
2977
|
+
}
|
|
2978
|
+
if (c.nonegate !== !0 && x.index === 0) {
|
|
2979
|
+
ie();
|
|
2980
|
+
continue;
|
|
2981
|
+
}
|
|
2982
|
+
}
|
|
2983
|
+
if (H === "+") {
|
|
2984
|
+
if (c.noextglob !== !0 && k() === "(" && k(2) !== "?") {
|
|
2985
|
+
e("plus", H);
|
|
2986
|
+
continue;
|
|
2987
|
+
}
|
|
2988
|
+
if (b && b.value === "(" || c.regex === !1) {
|
|
2989
|
+
a({ type: "plus", value: H, output: L });
|
|
2990
|
+
continue;
|
|
2991
|
+
}
|
|
2992
|
+
if (b && (b.type === "bracket" || b.type === "paren" || b.type === "brace") || x.parens > 0) {
|
|
2993
|
+
a({ type: "plus", value: H });
|
|
2994
|
+
continue;
|
|
2995
|
+
}
|
|
2996
|
+
a({ type: "plus", value: L });
|
|
2997
|
+
continue;
|
|
2998
|
+
}
|
|
2999
|
+
if (H === "@") {
|
|
3000
|
+
if (c.noextglob !== !0 && k() === "(" && k(2) !== "?") {
|
|
3001
|
+
a({ type: "at", extglob: !0, value: H, output: "" });
|
|
3002
|
+
continue;
|
|
3003
|
+
}
|
|
3004
|
+
a({ type: "text", value: H });
|
|
3005
|
+
continue;
|
|
3006
|
+
}
|
|
3007
|
+
if (H !== "*") {
|
|
3008
|
+
(H === "$" || H === "^") && (H = `\\${H}`);
|
|
3009
|
+
const w = y.exec(le());
|
|
3010
|
+
w && (H += w[0], x.index += w[0].length), a({ type: "text", value: H });
|
|
3011
|
+
continue;
|
|
3012
|
+
}
|
|
3013
|
+
if (b && (b.type === "globstar" || b.star === !0)) {
|
|
3014
|
+
b.type = "star", b.star = !0, b.value += H, b.output = ee, x.backtrack = !0, x.globstar = !0, V(H);
|
|
3015
|
+
continue;
|
|
3016
|
+
}
|
|
3017
|
+
let o = le();
|
|
3018
|
+
if (c.noextglob !== !0 && /^\([^?]/.test(o)) {
|
|
3019
|
+
e("star", H);
|
|
3020
|
+
continue;
|
|
3021
|
+
}
|
|
3022
|
+
if (b.type === "star") {
|
|
3023
|
+
if (c.noglobstar === !0) {
|
|
3024
|
+
V(H);
|
|
3025
|
+
continue;
|
|
3026
|
+
}
|
|
3027
|
+
const w = b.prev, v = w.prev, U = w.type === "slash" || w.type === "bos", q = v && (v.type === "star" || v.type === "globstar");
|
|
3028
|
+
if (c.bash === !0 && (!U || o[0] && o[0] !== "/")) {
|
|
3029
|
+
a({ type: "star", value: H, output: "" });
|
|
3030
|
+
continue;
|
|
3031
|
+
}
|
|
3032
|
+
const G = x.braces > 0 && (w.type === "comma" || w.type === "brace"), te = Q.length && (w.type === "pipe" || w.type === "paren");
|
|
3033
|
+
if (!U && w.type !== "paren" && !G && !te) {
|
|
3034
|
+
a({ type: "star", value: H, output: "" });
|
|
3035
|
+
continue;
|
|
3036
|
+
}
|
|
3037
|
+
for (; o.slice(0, 3) === "/**"; ) {
|
|
3038
|
+
const Z = p[x.index + 4];
|
|
3039
|
+
if (Z && Z !== "/")
|
|
3040
|
+
break;
|
|
3041
|
+
o = o.slice(3), V("/**", 3);
|
|
3042
|
+
}
|
|
3043
|
+
if (w.type === "bos" && j()) {
|
|
3044
|
+
b.type = "globstar", b.value += H, b.output = P(c), x.output = b.output, x.globstar = !0, V(H);
|
|
3045
|
+
continue;
|
|
3046
|
+
}
|
|
3047
|
+
if (w.type === "slash" && w.prev.type !== "bos" && !q && j()) {
|
|
3048
|
+
x.output = x.output.slice(0, -(w.output + b.output).length), w.output = `(?:${w.output}`, b.type = "globstar", b.output = P(c) + (c.strictSlashes ? ")" : "|$)"), b.value += H, x.globstar = !0, x.output += w.output + b.output, V(H);
|
|
3049
|
+
continue;
|
|
3050
|
+
}
|
|
3051
|
+
if (w.type === "slash" && w.prev.type !== "bos" && o[0] === "/") {
|
|
3052
|
+
const Z = o[1] !== void 0 ? "|$" : "";
|
|
3053
|
+
x.output = x.output.slice(0, -(w.output + b.output).length), w.output = `(?:${w.output}`, b.type = "globstar", b.output = `${P(c)}${T}|${T}${Z})`, b.value += H, x.output += w.output + b.output, x.globstar = !0, V(H + ue()), a({ type: "slash", value: "/", output: "" });
|
|
3054
|
+
continue;
|
|
3055
|
+
}
|
|
3056
|
+
if (w.type === "bos" && o[0] === "/") {
|
|
3057
|
+
b.type = "globstar", b.value += H, b.output = `(?:^|${T}|${P(c)}${T})`, x.output = b.output, x.globstar = !0, V(H + ue()), a({ type: "slash", value: "/", output: "" });
|
|
3058
|
+
continue;
|
|
3059
|
+
}
|
|
3060
|
+
x.output = x.output.slice(0, -b.output.length), b.type = "globstar", b.output = P(c), b.value += H, x.output += b.output, x.globstar = !0, V(H);
|
|
3061
|
+
continue;
|
|
3062
|
+
}
|
|
3063
|
+
const d = { type: "star", value: H, output: ee };
|
|
3064
|
+
if (c.bash === !0) {
|
|
3065
|
+
d.output = ".*?", (b.type === "bos" || b.type === "slash") && (d.output = Y + d.output), a(d);
|
|
3066
|
+
continue;
|
|
3067
|
+
}
|
|
3068
|
+
if (b && (b.type === "bracket" || b.type === "paren") && c.regex === !0) {
|
|
3069
|
+
d.output = H, a(d);
|
|
3070
|
+
continue;
|
|
3071
|
+
}
|
|
3072
|
+
(x.index === x.start || b.type === "slash" || b.type === "dot") && (b.type === "dot" ? (x.output += z, b.output += z) : c.dot === !0 ? (x.output += D, b.output += D) : (x.output += Y, b.output += Y), k() !== "*" && (x.output += O, b.output += O)), a(d);
|
|
3073
|
+
}
|
|
3074
|
+
for (; x.brackets > 0; ) {
|
|
3075
|
+
if (c.strictBrackets === !0) throw new SyntaxError(g("closing", "]"));
|
|
3076
|
+
x.output = n.escapeLast(x.output, "["), ne("brackets");
|
|
3077
|
+
}
|
|
3078
|
+
for (; x.parens > 0; ) {
|
|
3079
|
+
if (c.strictBrackets === !0) throw new SyntaxError(g("closing", ")"));
|
|
3080
|
+
x.output = n.escapeLast(x.output, "("), ne("parens");
|
|
3081
|
+
}
|
|
3082
|
+
for (; x.braces > 0; ) {
|
|
3083
|
+
if (c.strictBrackets === !0) throw new SyntaxError(g("closing", "}"));
|
|
3084
|
+
x.output = n.escapeLast(x.output, "{"), ne("braces");
|
|
3085
|
+
}
|
|
3086
|
+
if (c.strictSlashes !== !0 && (b.type === "star" || b.type === "bracket") && a({ type: "maybe_slash", value: "", output: `${T}?` }), x.backtrack === !0) {
|
|
3087
|
+
x.output = "";
|
|
3088
|
+
for (const o of x.tokens)
|
|
3089
|
+
x.output += o.output != null ? o.output : o.value, o.suffix && (x.output += o.suffix);
|
|
3090
|
+
}
|
|
3091
|
+
return x;
|
|
3092
|
+
};
|
|
3093
|
+
return l.fastpaths = (p, h) => {
|
|
3094
|
+
const c = { ...h }, E = typeof c.maxLength == "number" ? Math.min(u, c.maxLength) : u, C = p.length;
|
|
3095
|
+
if (C > E)
|
|
3096
|
+
throw new SyntaxError(`Input length: ${C}, exceeds maximum allowed length: ${E}`);
|
|
3097
|
+
p = s[p] || p;
|
|
3098
|
+
const B = n.isWindows(h), {
|
|
3099
|
+
DOT_LITERAL: S,
|
|
3100
|
+
SLASH_LITERAL: _,
|
|
3101
|
+
ONE_CHAR: I,
|
|
3102
|
+
DOTS_SLASH: R,
|
|
3103
|
+
NO_DOT: F,
|
|
3104
|
+
NO_DOTS: m,
|
|
3105
|
+
NO_DOTS_SLASH: L,
|
|
3106
|
+
STAR: T,
|
|
3107
|
+
START_ANCHOR: O
|
|
3108
|
+
} = i.globChars(B), N = c.dot ? m : F, M = c.dot ? L : F, z = c.capture ? "" : "?:", D = { negated: !1, prefix: "" };
|
|
3109
|
+
let $ = c.bash === !0 ? ".*?" : T;
|
|
3110
|
+
c.capture && ($ = `(${$})`);
|
|
3111
|
+
const X = (Y) => Y.noglobstar === !0 ? $ : `(${z}(?:(?!${O}${Y.dot ? R : S}).)*?)`, K = (Y) => {
|
|
3112
|
+
switch (Y) {
|
|
3113
|
+
case "*":
|
|
3114
|
+
return `${N}${I}${$}`;
|
|
3115
|
+
case ".*":
|
|
3116
|
+
return `${S}${I}${$}`;
|
|
3117
|
+
case "*.*":
|
|
3118
|
+
return `${N}${$}${S}${I}${$}`;
|
|
3119
|
+
case "*/*":
|
|
3120
|
+
return `${N}${$}${_}${I}${M}${$}`;
|
|
3121
|
+
case "**":
|
|
3122
|
+
return N + X(c);
|
|
3123
|
+
case "**/*":
|
|
3124
|
+
return `(?:${N}${X(c)}${_})?${M}${I}${$}`;
|
|
3125
|
+
case "**/*.*":
|
|
3126
|
+
return `(?:${N}${X(c)}${_})?${M}${$}${S}${I}${$}`;
|
|
3127
|
+
case "**/.*":
|
|
3128
|
+
return `(?:${N}${X(c)}${_})?${S}${I}${$}`;
|
|
3129
|
+
default: {
|
|
3130
|
+
const oe = /^(.*?)\.(\w+)$/.exec(Y);
|
|
3131
|
+
if (!oe) return;
|
|
3132
|
+
const ee = K(oe[1]);
|
|
3133
|
+
return ee ? ee + S + oe[2] : void 0;
|
|
3134
|
+
}
|
|
3135
|
+
}
|
|
3136
|
+
}, W = n.removePrefix(p, D);
|
|
3137
|
+
let P = K(W);
|
|
3138
|
+
return P && c.strictSlashes !== !0 && (P += `${_}?`), P;
|
|
3139
|
+
}, rt = l, rt;
|
|
3140
|
+
}
|
|
3141
|
+
var nt, Wt;
|
|
3142
|
+
function nn() {
|
|
3143
|
+
if (Wt) return nt;
|
|
3144
|
+
Wt = 1;
|
|
3145
|
+
const i = _t, n = tn(), u = rn(), f = Ie(), y = $e(), A = (r) => r && typeof r == "object" && !Array.isArray(r), s = (r, g, l = !1) => {
|
|
3146
|
+
if (Array.isArray(r)) {
|
|
3147
|
+
const _ = r.map((R) => s(R, g, l));
|
|
3148
|
+
return (R) => {
|
|
3149
|
+
for (const F of _) {
|
|
3150
|
+
const m = F(R);
|
|
3151
|
+
if (m) return m;
|
|
3152
|
+
}
|
|
3153
|
+
return !1;
|
|
3154
|
+
};
|
|
3155
|
+
}
|
|
3156
|
+
const p = A(r) && r.tokens && r.input;
|
|
3157
|
+
if (r === "" || typeof r != "string" && !p)
|
|
3158
|
+
throw new TypeError("Expected pattern to be a non-empty string");
|
|
3159
|
+
const h = g || {}, c = f.isWindows(g), E = p ? s.compileRe(r, g) : s.makeRe(r, g, !1, !0), C = E.state;
|
|
3160
|
+
delete E.state;
|
|
3161
|
+
let B = () => !1;
|
|
3162
|
+
if (h.ignore) {
|
|
3163
|
+
const _ = { ...g, ignore: null, onMatch: null, onResult: null };
|
|
3164
|
+
B = s(h.ignore, _, l);
|
|
3165
|
+
}
|
|
3166
|
+
const S = (_, I = !1) => {
|
|
3167
|
+
const { isMatch: R, match: F, output: m } = s.test(_, E, g, { glob: r, posix: c }), L = { glob: r, state: C, regex: E, posix: c, input: _, output: m, match: F, isMatch: R };
|
|
3168
|
+
return typeof h.onResult == "function" && h.onResult(L), R === !1 ? (L.isMatch = !1, I ? L : !1) : B(_) ? (typeof h.onIgnore == "function" && h.onIgnore(L), L.isMatch = !1, I ? L : !1) : (typeof h.onMatch == "function" && h.onMatch(L), I ? L : !0);
|
|
3169
|
+
};
|
|
3170
|
+
return l && (S.state = C), S;
|
|
3171
|
+
};
|
|
3172
|
+
return s.test = (r, g, l, { glob: p, posix: h } = {}) => {
|
|
3173
|
+
if (typeof r != "string")
|
|
3174
|
+
throw new TypeError("Expected input to be a string");
|
|
3175
|
+
if (r === "")
|
|
3176
|
+
return { isMatch: !1, output: "" };
|
|
3177
|
+
const c = l || {}, E = c.format || (h ? f.toPosixSlashes : null);
|
|
3178
|
+
let C = r === p, B = C && E ? E(r) : r;
|
|
3179
|
+
return C === !1 && (B = E ? E(r) : r, C = B === p), (C === !1 || c.capture === !0) && (c.matchBase === !0 || c.basename === !0 ? C = s.matchBase(r, g, l, h) : C = g.exec(B)), { isMatch: !!C, match: C, output: B };
|
|
3180
|
+
}, s.matchBase = (r, g, l, p = f.isWindows(l)) => (g instanceof RegExp ? g : s.makeRe(g, l)).test(i.basename(r)), s.isMatch = (r, g, l) => s(g, l)(r), s.parse = (r, g) => Array.isArray(r) ? r.map((l) => s.parse(l, g)) : u(r, { ...g, fastpaths: !1 }), s.scan = (r, g) => n(r, g), s.compileRe = (r, g, l = !1, p = !1) => {
|
|
3181
|
+
if (l === !0)
|
|
3182
|
+
return r.output;
|
|
3183
|
+
const h = g || {}, c = h.contains ? "" : "^", E = h.contains ? "" : "$";
|
|
3184
|
+
let C = `${c}(?:${r.output})${E}`;
|
|
3185
|
+
r && r.negated === !0 && (C = `^(?!${C}).*$`);
|
|
3186
|
+
const B = s.toRegex(C, g);
|
|
3187
|
+
return p === !0 && (B.state = r), B;
|
|
3188
|
+
}, s.makeRe = (r, g = {}, l = !1, p = !1) => {
|
|
3189
|
+
if (!r || typeof r != "string")
|
|
3190
|
+
throw new TypeError("Expected a non-empty string");
|
|
3191
|
+
let h = { negated: !1, fastpaths: !0 };
|
|
3192
|
+
return g.fastpaths !== !1 && (r[0] === "." || r[0] === "*") && (h.output = u.fastpaths(r, g)), h.output || (h = u(r, g)), s.compileRe(h, g, l, p);
|
|
3193
|
+
}, s.toRegex = (r, g) => {
|
|
3194
|
+
try {
|
|
3195
|
+
const l = g || {};
|
|
3196
|
+
return new RegExp(r, l.flags || (l.nocase ? "i" : ""));
|
|
3197
|
+
} catch (l) {
|
|
3198
|
+
if (g && g.debug === !0) throw l;
|
|
3199
|
+
return /$^/;
|
|
3200
|
+
}
|
|
3201
|
+
}, s.constants = y, nt = s, nt;
|
|
3202
|
+
}
|
|
3203
|
+
var it, Xt;
|
|
3204
|
+
function un() {
|
|
3205
|
+
return Xt || (Xt = 1, it = nn()), it;
|
|
3206
|
+
}
|
|
3207
|
+
var ut, Qt;
|
|
3208
|
+
function an() {
|
|
3209
|
+
if (Qt) return ut;
|
|
3210
|
+
Qt = 1;
|
|
3211
|
+
const i = pr, n = Zr(), u = un(), f = Ie(), y = (r) => r === "" || r === "./", A = (r) => {
|
|
3212
|
+
const g = r.indexOf("{");
|
|
3213
|
+
return g > -1 && r.indexOf("}", g) > -1;
|
|
3214
|
+
}, s = (r, g, l) => {
|
|
3215
|
+
g = [].concat(g), r = [].concat(r);
|
|
3216
|
+
let p = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), E = 0, C = (_) => {
|
|
3217
|
+
c.add(_.output), l && l.onResult && l.onResult(_);
|
|
3218
|
+
};
|
|
3219
|
+
for (let _ = 0; _ < g.length; _++) {
|
|
3220
|
+
let I = u(String(g[_]), { ...l, onResult: C }, !0), R = I.state.negated || I.state.negatedExtglob;
|
|
3221
|
+
R && E++;
|
|
3222
|
+
for (let F of r) {
|
|
3223
|
+
let m = I(F, !0);
|
|
3224
|
+
(R ? !m.isMatch : m.isMatch) && (R ? p.add(m.output) : (p.delete(m.output), h.add(m.output)));
|
|
3225
|
+
}
|
|
3226
|
+
}
|
|
3227
|
+
let S = (E === g.length ? [...c] : [...h]).filter((_) => !p.has(_));
|
|
3228
|
+
if (l && S.length === 0) {
|
|
3229
|
+
if (l.failglob === !0)
|
|
3230
|
+
throw new Error(`No matches found for "${g.join(", ")}"`);
|
|
3231
|
+
if (l.nonull === !0 || l.nullglob === !0)
|
|
3232
|
+
return l.unescape ? g.map((_) => _.replace(/\\/g, "")) : g;
|
|
3233
|
+
}
|
|
3234
|
+
return S;
|
|
3235
|
+
};
|
|
3236
|
+
return s.match = s, s.matcher = (r, g) => u(r, g), s.isMatch = (r, g, l) => u(g, l)(r), s.any = s.isMatch, s.not = (r, g, l = {}) => {
|
|
3237
|
+
g = [].concat(g).map(String);
|
|
3238
|
+
let p = /* @__PURE__ */ new Set(), h = [], c = (C) => {
|
|
3239
|
+
l.onResult && l.onResult(C), h.push(C.output);
|
|
3240
|
+
}, E = new Set(s(r, g, { ...l, onResult: c }));
|
|
3241
|
+
for (let C of h)
|
|
3242
|
+
E.has(C) || p.add(C);
|
|
3243
|
+
return [...p];
|
|
3244
|
+
}, s.contains = (r, g, l) => {
|
|
3245
|
+
if (typeof r != "string")
|
|
3246
|
+
throw new TypeError(`Expected a string: "${i.inspect(r)}"`);
|
|
3247
|
+
if (Array.isArray(g))
|
|
3248
|
+
return g.some((p) => s.contains(r, p, l));
|
|
3249
|
+
if (typeof g == "string") {
|
|
3250
|
+
if (y(r) || y(g))
|
|
3251
|
+
return !1;
|
|
3252
|
+
if (r.includes(g) || r.startsWith("./") && r.slice(2).includes(g))
|
|
3253
|
+
return !0;
|
|
3254
|
+
}
|
|
3255
|
+
return s.isMatch(r, g, { ...l, contains: !0 });
|
|
3256
|
+
}, s.matchKeys = (r, g, l) => {
|
|
3257
|
+
if (!f.isObject(r))
|
|
3258
|
+
throw new TypeError("Expected the first argument to be an object");
|
|
3259
|
+
let p = s(Object.keys(r), g, l), h = {};
|
|
3260
|
+
for (let c of p) h[c] = r[c];
|
|
3261
|
+
return h;
|
|
3262
|
+
}, s.some = (r, g, l) => {
|
|
3263
|
+
let p = [].concat(r);
|
|
3264
|
+
for (let h of [].concat(g)) {
|
|
3265
|
+
let c = u(String(h), l);
|
|
3266
|
+
if (p.some((E) => c(E)))
|
|
3267
|
+
return !0;
|
|
3268
|
+
}
|
|
3269
|
+
return !1;
|
|
3270
|
+
}, s.every = (r, g, l) => {
|
|
3271
|
+
let p = [].concat(r);
|
|
3272
|
+
for (let h of [].concat(g)) {
|
|
3273
|
+
let c = u(String(h), l);
|
|
3274
|
+
if (!p.every((E) => c(E)))
|
|
3275
|
+
return !1;
|
|
3276
|
+
}
|
|
3277
|
+
return !0;
|
|
3278
|
+
}, s.all = (r, g, l) => {
|
|
3279
|
+
if (typeof r != "string")
|
|
3280
|
+
throw new TypeError(`Expected a string: "${i.inspect(r)}"`);
|
|
3281
|
+
return [].concat(g).every((p) => u(p, l)(r));
|
|
3282
|
+
}, s.capture = (r, g, l) => {
|
|
3283
|
+
let p = f.isWindows(l), c = u.makeRe(String(r), { ...l, capture: !0 }).exec(p ? f.toPosixSlashes(g) : g);
|
|
3284
|
+
if (c)
|
|
3285
|
+
return c.slice(1).map((E) => E === void 0 ? "" : E);
|
|
3286
|
+
}, s.makeRe = (...r) => u.makeRe(...r), s.scan = (...r) => u.scan(...r), s.parse = (r, g) => {
|
|
3287
|
+
let l = [];
|
|
3288
|
+
for (let p of [].concat(r || []))
|
|
3289
|
+
for (let h of n(String(p), g))
|
|
3290
|
+
l.push(u.parse(h, g));
|
|
3291
|
+
return l;
|
|
3292
|
+
}, s.braces = (r, g) => {
|
|
3293
|
+
if (typeof r != "string") throw new TypeError("Expected a string");
|
|
3294
|
+
return g && g.nobrace === !0 || !A(r) ? [r] : n(r, g);
|
|
3295
|
+
}, s.braceExpand = (r, g) => {
|
|
3296
|
+
if (typeof r != "string") throw new TypeError("Expected a string");
|
|
3297
|
+
return s.braces(r, { ...g, expand: !0 });
|
|
3298
|
+
}, s.hasBraces = A, ut = s, ut;
|
|
3299
|
+
}
|
|
3300
|
+
var on = an();
|
|
3301
|
+
const Zt = /* @__PURE__ */ tr(on);
|
|
3302
|
+
function be(i, n) {
|
|
3303
|
+
return i && n ? "all" : !i && !n ? "none" : i ? "file" : "dir";
|
|
3304
|
+
}
|
|
3305
|
+
class de extends nr {
|
|
3306
|
+
/**
|
|
3307
|
+
* ディレクトリハンドルの種類。常に`"directory"`を返します。
|
|
3308
|
+
*/
|
|
3309
|
+
type = "directory";
|
|
3310
|
+
_handle;
|
|
3311
|
+
constructor(n) {
|
|
3312
|
+
super(n), this._handle = n;
|
|
3313
|
+
}
|
|
3314
|
+
/**
|
|
3315
|
+
* ファイルを`WebFsFileHandle`でラップしたものを返します。
|
|
3316
|
+
*
|
|
3317
|
+
* @param handle すでに取得しているファイルハンドル。
|
|
3318
|
+
* @param mode ファイルのオプション。
|
|
3319
|
+
* @returns 成功した場合は`WebFsFileHandle`、エラーが出た場合は`undefined`。
|
|
3320
|
+
*/
|
|
3321
|
+
static async create(n, u = "read") {
|
|
3322
|
+
const f = new this(n);
|
|
3323
|
+
if (await f._verifyPermission(u))
|
|
3324
|
+
return f;
|
|
3325
|
+
}
|
|
3326
|
+
/**
|
|
3327
|
+
* ファイルを取得します。ファイル名またはファイルの相対パスを指定します。
|
|
3328
|
+
*
|
|
3329
|
+
* @param filePath 取得するファイルのファイルパス。
|
|
3330
|
+
* @param options ファイルのオプション。
|
|
3331
|
+
* @returns ファイルが取得できた場合は`WebFsFileHandle`、`options.create`が`false`かつファイルが存在しない場合、またはエラーが出た場合は`undefined`。
|
|
3332
|
+
*/
|
|
3333
|
+
async file(n, u) {
|
|
3334
|
+
try {
|
|
3335
|
+
const f = ce.resolve(n).split(ce.sep).slice(1), y = f.pop();
|
|
3336
|
+
if (y === "")
|
|
3337
|
+
return;
|
|
3338
|
+
const s = await (await this._dirByPath(f, u?.create)).getFileHandle(y, {
|
|
3339
|
+
create: u?.create
|
|
3340
|
+
});
|
|
3341
|
+
return await ye.create(
|
|
3342
|
+
s,
|
|
3343
|
+
u?.mode
|
|
3344
|
+
);
|
|
3345
|
+
} catch {
|
|
3346
|
+
return;
|
|
3347
|
+
}
|
|
3348
|
+
}
|
|
3349
|
+
/**
|
|
3350
|
+
* ディレクトリを取得します。ディレクトリ名またはディレクトリの相対パスで指定します。
|
|
3351
|
+
*
|
|
3352
|
+
* @param dirPath 取得するディレクトリのファイルパス。
|
|
3353
|
+
* @param options ディレクトリのオプション。
|
|
3354
|
+
* @returns ディレクトリが取得できた場合は`WebFsDirectoryHandle`、`options.create`が`false`かつディレクトリが存在しない場合、またはエラーが出た場合は`undefined`。
|
|
3355
|
+
*/
|
|
3356
|
+
async dir(n, u) {
|
|
3357
|
+
try {
|
|
3358
|
+
const f = ce.resolve(n).split(ce.sep).slice(1);
|
|
3359
|
+
if (f.length === 1 && f[0] === "")
|
|
3360
|
+
return;
|
|
3361
|
+
const y = await this._dirByPath(f, u?.create);
|
|
3362
|
+
return await de.create(
|
|
3363
|
+
y,
|
|
3364
|
+
u?.mode
|
|
3365
|
+
);
|
|
3366
|
+
} catch {
|
|
3367
|
+
return;
|
|
3368
|
+
}
|
|
3369
|
+
}
|
|
3370
|
+
/**
|
|
3371
|
+
* ファイルを簡易的なglobパターンから取得します。
|
|
3372
|
+
*
|
|
3373
|
+
* @returns globパターンにマッチしたファイルの`WebFsFileHandle`の配列。
|
|
3374
|
+
*/
|
|
3375
|
+
async glob(n) {
|
|
3376
|
+
if (n === "")
|
|
3377
|
+
return [];
|
|
3378
|
+
const u = n.split("/"), y = (await this._glob(u)).map(
|
|
3379
|
+
(A) => ye.create(A)
|
|
3380
|
+
);
|
|
3381
|
+
return (await Promise.all(y)).filter((A) => A !== void 0);
|
|
3382
|
+
}
|
|
3383
|
+
async _glob(n, u = 0, f = this._handle, y = "") {
|
|
3384
|
+
const A = [], s = await Array.fromAsync(f.values()), r = n[u], g = u === n.length - 1, l = this._filterEntry("dir", s), p = this._filterEntry("file", s);
|
|
3385
|
+
if (g)
|
|
3386
|
+
return p.filter(
|
|
3387
|
+
(c) => Zt.isMatch(y + c.name, n.join("/"))
|
|
3388
|
+
);
|
|
3389
|
+
if (r === "**") {
|
|
3390
|
+
const h = await this._glob(n, n.length - 1, f, y);
|
|
3391
|
+
A.push(...h);
|
|
3392
|
+
for (const c of l) {
|
|
3393
|
+
const E = await this._glob(
|
|
3394
|
+
n,
|
|
3395
|
+
u,
|
|
3396
|
+
c,
|
|
3397
|
+
`${y}${c.name}/`
|
|
3398
|
+
);
|
|
3399
|
+
A.push(...E);
|
|
3400
|
+
}
|
|
3401
|
+
} else {
|
|
3402
|
+
const h = l.filter(
|
|
3403
|
+
(c) => Zt.isMatch(c.name, n[u])
|
|
3404
|
+
);
|
|
3405
|
+
for (const c of h) {
|
|
3406
|
+
const E = await this._glob(
|
|
3407
|
+
n,
|
|
3408
|
+
u + 1,
|
|
3409
|
+
c,
|
|
3410
|
+
`${y}${c.name}/`
|
|
3411
|
+
);
|
|
3412
|
+
A.push(...E);
|
|
3413
|
+
}
|
|
3414
|
+
}
|
|
3415
|
+
return A;
|
|
3416
|
+
}
|
|
3417
|
+
/**
|
|
3418
|
+
* ファイルを作成します。ファイル名またはファイルの相対パスで指定します。
|
|
3419
|
+
*
|
|
3420
|
+
* @returns ファイルが作成できた場合はそのファイルの`WebFsFileHandle`、エラーが出た場合は`undefined`。
|
|
3421
|
+
*/
|
|
3422
|
+
async createFile(n, u) {
|
|
3423
|
+
return await this.file(n, { ...u, create: !0 });
|
|
3424
|
+
}
|
|
3425
|
+
/**
|
|
3426
|
+
* ディレクトリを作成します。ディレクトリ名またはディレクトリの相対パスで指定します。
|
|
3427
|
+
*
|
|
3428
|
+
* @returns ディレクトリが作成できた場合はそのディレクトリの`WebFsDirectoryHandle`、エラーが出た場合は`undefined`。
|
|
3429
|
+
*/
|
|
3430
|
+
async createDir(n, u) {
|
|
3431
|
+
return await this.dir(n, { ...u, create: !0 });
|
|
3432
|
+
}
|
|
3433
|
+
/**
|
|
3434
|
+
* ファイルまたはディレクトリを削除します。削除するエントリーがディレクトリであった場合は、その子孫を再帰的に削除します。
|
|
3435
|
+
*
|
|
3436
|
+
* @param entryPath 削除するファイルまたはディレクトリの名前。
|
|
3437
|
+
* @returns 削除に成功した場合は`true`、エントリーが存在しないまたはエラーの場合は`false`。
|
|
3438
|
+
*/
|
|
3439
|
+
async remove(n) {
|
|
3440
|
+
try {
|
|
3441
|
+
const u = ce.resolve(n).split(ce.sep).slice(1);
|
|
3442
|
+
return u.pop() === "" ? !1 : (await (await this._dirByPath(u)).removeEntry(n, { recursive: !0 }), !0);
|
|
3443
|
+
} catch {
|
|
3444
|
+
return !1;
|
|
3445
|
+
}
|
|
3446
|
+
}
|
|
3447
|
+
/**
|
|
3448
|
+
* 現在の階層にあるファイル名またはディレクトリ名の一覧を取得します。
|
|
3449
|
+
*
|
|
3450
|
+
* @param [options={}] 一覧のオプション。
|
|
3451
|
+
* @returns ファイル名またはディレクトリ名からなる配列を返します。
|
|
3452
|
+
*/
|
|
3453
|
+
async names({
|
|
3454
|
+
file: n = !0,
|
|
3455
|
+
dir: u = !0,
|
|
3456
|
+
depth: f = 1
|
|
3457
|
+
} = {}) {
|
|
3458
|
+
if (!n && !u)
|
|
3459
|
+
return [];
|
|
3460
|
+
const y = await this._tree(be(n, u), f);
|
|
3461
|
+
return this._flat(y).map((A) => A.name);
|
|
3462
|
+
}
|
|
3463
|
+
/**
|
|
3464
|
+
* 現在の階層にあるファイルまたはディレクトリのハンドルの一覧を取得します。
|
|
3465
|
+
*
|
|
3466
|
+
* @param [options={}] 一覧のオプション。
|
|
3467
|
+
* @returns ファイルハンドルまたはディレクトリハンドルからなる配列を返します。
|
|
3468
|
+
*/
|
|
3469
|
+
async list({
|
|
3470
|
+
file: n = !0,
|
|
3471
|
+
dir: u = !0,
|
|
3472
|
+
depth: f = 1
|
|
3473
|
+
} = {}) {
|
|
3474
|
+
if (!n && !u)
|
|
3475
|
+
return [];
|
|
3476
|
+
const y = await this._tree(be(n, u), f), A = this._flat(y).map(
|
|
3477
|
+
(s) => s.kind === "file" ? ye.create(s) : de.create(s)
|
|
3478
|
+
);
|
|
3479
|
+
return (await Promise.all(A)).filter((s) => !!s);
|
|
3480
|
+
}
|
|
3481
|
+
/**
|
|
3482
|
+
* ファイル構造をツリー形式として取得します。
|
|
3483
|
+
*
|
|
3484
|
+
* @returns ツリー形式のオブジェクト。
|
|
3485
|
+
*/
|
|
3486
|
+
async tree({
|
|
3487
|
+
file: n = !0,
|
|
3488
|
+
dir: u = !0,
|
|
3489
|
+
depth: f = 1
|
|
3490
|
+
} = {}) {
|
|
3491
|
+
const y = await this._tree(be(n, u), f);
|
|
3492
|
+
return {
|
|
3493
|
+
handle: this._handle,
|
|
3494
|
+
children: y
|
|
3495
|
+
};
|
|
3496
|
+
}
|
|
3497
|
+
/**
|
|
3498
|
+
* ファイル構造を文字列のツリー形式として取得します。
|
|
3499
|
+
*
|
|
3500
|
+
* 返り値の例:
|
|
3501
|
+
* ```text
|
|
3502
|
+
* babel/
|
|
3503
|
+
* ├─ code-frame/
|
|
3504
|
+
* │ ├─ lib/
|
|
3505
|
+
* │ ├─ LICENSE
|
|
3506
|
+
* │ ├─ package.json
|
|
3507
|
+
* │ └─ README.md
|
|
3508
|
+
* ├─ compat-data/
|
|
3509
|
+
* │ ├─ data/
|
|
3510
|
+
* │ ├─ corejs3-shipped-proposals.js
|
|
3511
|
+
* │ ├─ plugin-bugfixes.js
|
|
3512
|
+
* │ ├─ corejs2-built-ins.js
|
|
3513
|
+
* ...
|
|
3514
|
+
* ```
|
|
3515
|
+
*
|
|
3516
|
+
* @returns ツリー形式の文字列。
|
|
3517
|
+
*/
|
|
3518
|
+
async treeString({
|
|
3519
|
+
file: n = !0,
|
|
3520
|
+
dir: u = !0,
|
|
3521
|
+
depth: f = 1
|
|
3522
|
+
} = {}) {
|
|
3523
|
+
return (await this._toString(be(n, u), f)).join(`
|
|
3524
|
+
`);
|
|
3525
|
+
}
|
|
3526
|
+
async _tree(n, u, f = 1, y = this._handle) {
|
|
3527
|
+
if (n === "none")
|
|
3528
|
+
return [];
|
|
3529
|
+
const A = await Array.fromAsync(y.values()), s = this._filterEntry(n, A), r = [];
|
|
3530
|
+
for (const g of s)
|
|
3531
|
+
if (g.kind === "file" || f === u)
|
|
3532
|
+
r.push({
|
|
3533
|
+
handle: g,
|
|
3534
|
+
children: void 0
|
|
3535
|
+
});
|
|
3536
|
+
else {
|
|
3537
|
+
const l = await this._tree(
|
|
3538
|
+
n,
|
|
3539
|
+
u,
|
|
3540
|
+
f + 1,
|
|
3541
|
+
g
|
|
3542
|
+
);
|
|
3543
|
+
r.push({
|
|
3544
|
+
handle: g,
|
|
3545
|
+
children: l
|
|
3546
|
+
});
|
|
3547
|
+
}
|
|
3548
|
+
return r;
|
|
3549
|
+
}
|
|
3550
|
+
_flat(n) {
|
|
3551
|
+
const u = [];
|
|
3552
|
+
for (const { handle: f, children: y } of n)
|
|
3553
|
+
u.push(f), y && u.push(...this._flat(y));
|
|
3554
|
+
return u;
|
|
3555
|
+
}
|
|
3556
|
+
async _toString(n, u, f = 1, y = this._handle) {
|
|
3557
|
+
if (n === "none")
|
|
3558
|
+
return [`${y.name}/`];
|
|
3559
|
+
const A = await Array.fromAsync(y.values()), s = this._filterEntry(n, A), r = s.length - 1, g = [];
|
|
3560
|
+
g.push(`${y.name}/`);
|
|
3561
|
+
for (const [l, p] of s.entries()) {
|
|
3562
|
+
let h = l < r ? "├─" : "└─";
|
|
3563
|
+
if (p.kind === "file")
|
|
3564
|
+
g.push(`${h} ${p.name}`);
|
|
3565
|
+
else if (f === u)
|
|
3566
|
+
g.push(`${h} ${p.name}/`);
|
|
3567
|
+
else {
|
|
3568
|
+
const c = await this._toString(
|
|
3569
|
+
n,
|
|
3570
|
+
u,
|
|
3571
|
+
f + 1,
|
|
3572
|
+
p
|
|
3573
|
+
);
|
|
3574
|
+
g.push(
|
|
3575
|
+
...c.map((E, C) => {
|
|
3576
|
+
let B;
|
|
3577
|
+
return l === r ? B = C === 0 ? "└─" : " " : B = C === 0 ? "├─" : "│ ", `${B} ${E}`;
|
|
3578
|
+
})
|
|
3579
|
+
);
|
|
3580
|
+
}
|
|
3581
|
+
}
|
|
3582
|
+
return g;
|
|
3583
|
+
}
|
|
3584
|
+
_filterEntry(n, u) {
|
|
3585
|
+
return n === "none" ? [] : u.filter((y) => n === "all" ? !0 : n === "file" ? y.kind === "file" : y.kind === "directory");
|
|
3586
|
+
}
|
|
3587
|
+
async _dirByPath(n, u = !1) {
|
|
3588
|
+
let f = this._handle;
|
|
3589
|
+
for (const y of n)
|
|
3590
|
+
f = await f.getDirectoryHandle(y, {
|
|
3591
|
+
create: u
|
|
3592
|
+
});
|
|
3593
|
+
return f;
|
|
3594
|
+
}
|
|
3595
|
+
}
|
|
3596
|
+
function Le(i) {
|
|
3597
|
+
return new Promise((n, u) => {
|
|
3598
|
+
i.oncomplete = i.onsuccess = () => n(i.result), i.onabort = i.onerror = () => u(i.error);
|
|
3599
|
+
});
|
|
3600
|
+
}
|
|
3601
|
+
function ct(i, n) {
|
|
3602
|
+
let u;
|
|
3603
|
+
const f = () => {
|
|
3604
|
+
if (u)
|
|
3605
|
+
return u;
|
|
3606
|
+
const y = indexedDB.open(i);
|
|
3607
|
+
return y.onupgradeneeded = () => y.result.createObjectStore(n), u = Le(y), u.then((A) => {
|
|
3608
|
+
A.onclose = () => u = void 0;
|
|
3609
|
+
}, () => {
|
|
3610
|
+
}), u;
|
|
3611
|
+
};
|
|
3612
|
+
return (y, A) => f().then((s) => A(s.transaction(n, y).objectStore(n)));
|
|
3613
|
+
}
|
|
3614
|
+
let at;
|
|
3615
|
+
function mt() {
|
|
3616
|
+
return at || (at = ct("keyval-store", "keyval")), at;
|
|
3617
|
+
}
|
|
3618
|
+
function Yt(i, n = mt()) {
|
|
3619
|
+
return n("readonly", (u) => Le(u.get(i)));
|
|
3620
|
+
}
|
|
3621
|
+
function Jt(i, n, u = mt()) {
|
|
3622
|
+
return u("readwrite", (f) => (f.put(n, i), Le(f.transaction)));
|
|
3623
|
+
}
|
|
3624
|
+
function Vt(i, n = mt()) {
|
|
3625
|
+
return n("readwrite", (u) => (u.delete(i), Le(u.transaction)));
|
|
3626
|
+
}
|
|
3627
|
+
class he {
|
|
3628
|
+
static fileStore = ct("web-fs-file", "keyval");
|
|
3629
|
+
static directoryStore = ct("web-fs-directory", "keyval");
|
|
3630
|
+
constructor() {
|
|
3631
|
+
}
|
|
3632
|
+
static getFile(n) {
|
|
3633
|
+
return Yt(n, this.fileStore);
|
|
3634
|
+
}
|
|
3635
|
+
static async setFile(n, u) {
|
|
3636
|
+
await Jt(n, u, this.fileStore);
|
|
3637
|
+
}
|
|
3638
|
+
static async delFile(n) {
|
|
3639
|
+
await Vt(n, this.fileStore);
|
|
3640
|
+
}
|
|
3641
|
+
static getDirectory(n) {
|
|
3642
|
+
return Yt(n, this.directoryStore);
|
|
3643
|
+
}
|
|
3644
|
+
static async setDirectory(n, u) {
|
|
3645
|
+
await Jt(n, u, this.directoryStore);
|
|
3646
|
+
}
|
|
3647
|
+
static async delDirectory(n) {
|
|
3648
|
+
await Vt(n, this.directoryStore);
|
|
3649
|
+
}
|
|
3650
|
+
}
|
|
3651
|
+
class er {
|
|
3652
|
+
_handles;
|
|
3653
|
+
constructor(n) {
|
|
3654
|
+
this._handles = n;
|
|
3655
|
+
}
|
|
3656
|
+
/**
|
|
3657
|
+
* ファイルを`WebFsFileHandleList`(`WebFsFileHandle`の配列)でラップしたものを返します。
|
|
3658
|
+
*
|
|
3659
|
+
* @param handles すでに取得しているファイルハンドルの配列。
|
|
3660
|
+
* @param mode ファイルのオプション。
|
|
3661
|
+
* @returns 成功した場合は`WebFsFileHandleList`、エラーが出た場合は`undefined`。
|
|
3662
|
+
*/
|
|
3663
|
+
static async create(n, u = "read") {
|
|
3664
|
+
const f = await Promise.all(
|
|
3665
|
+
n.map((A) => ye.create(A, u))
|
|
3666
|
+
);
|
|
3667
|
+
return f.includes(void 0) ? void 0 : new this(f);
|
|
3668
|
+
}
|
|
3669
|
+
/**
|
|
3670
|
+
* ファイルを取得します。
|
|
3671
|
+
*
|
|
3672
|
+
* @param fileName 取得するファイルのファイル名。
|
|
3673
|
+
* @returns ファイルが取得できた場合は`WebFsFileHandle`、存在しない場合は`undefined`。
|
|
3674
|
+
*/
|
|
3675
|
+
file(n) {
|
|
3676
|
+
return this._handles.find((u) => u.name === n);
|
|
3677
|
+
}
|
|
3678
|
+
/**
|
|
3679
|
+
* ファイル名の一覧を取得します。
|
|
3680
|
+
*
|
|
3681
|
+
* @returns ファイル名の配列を返します。
|
|
3682
|
+
*/
|
|
3683
|
+
names() {
|
|
3684
|
+
return this._handles.map((n) => n.name);
|
|
3685
|
+
}
|
|
3686
|
+
/**
|
|
3687
|
+
* ファイルハンドルの一覧を取得します。
|
|
3688
|
+
*
|
|
3689
|
+
* @returns ファイルハンドルの配列を返します。
|
|
3690
|
+
*/
|
|
3691
|
+
list() {
|
|
3692
|
+
return this._handles;
|
|
3693
|
+
}
|
|
3694
|
+
/**
|
|
3695
|
+
* 現在の`WebFsFileHandleList`インスタンスが管理しているファイルハンドルの数を取得します。
|
|
3696
|
+
*/
|
|
3697
|
+
get length() {
|
|
3698
|
+
return this._handles.length;
|
|
3699
|
+
}
|
|
3700
|
+
*[Symbol.iterator]() {
|
|
3701
|
+
yield* this._handles;
|
|
3702
|
+
}
|
|
3703
|
+
}
|
|
3704
|
+
function sn() {
|
|
3705
|
+
return globalThis.isSecureContext && "showOpenFilePicker" in globalThis && "showDirectoryPicker" in globalThis;
|
|
3706
|
+
}
|
|
3707
|
+
async function cn(i = {}) {
|
|
3708
|
+
try {
|
|
3709
|
+
if (i.persistence === !0) {
|
|
3710
|
+
const u = await he.getFile(i.id);
|
|
3711
|
+
if (u)
|
|
3712
|
+
return await ye.create(u[0], i.mode);
|
|
3713
|
+
}
|
|
3714
|
+
const n = await mr(i, !1);
|
|
3715
|
+
return i.persistence === !0 && he.setFile(i.id, n), await ye.create(n[0], i.mode);
|
|
3716
|
+
} catch {
|
|
3717
|
+
return;
|
|
3718
|
+
}
|
|
3719
|
+
}
|
|
3720
|
+
async function ln(i = {}) {
|
|
3721
|
+
try {
|
|
3722
|
+
if (i.persistence === !0) {
|
|
3723
|
+
const u = await he.getFile(i.id);
|
|
3724
|
+
if (u)
|
|
3725
|
+
return await er.create(u, i.mode);
|
|
3726
|
+
}
|
|
3727
|
+
const n = await mr(i, !0);
|
|
3728
|
+
return i.persistence === !0 && he.setFile(i.id, n), await er.create(n, i.mode);
|
|
3729
|
+
} catch {
|
|
3730
|
+
return;
|
|
3731
|
+
}
|
|
3732
|
+
}
|
|
3733
|
+
async function fn(i = {}) {
|
|
3734
|
+
try {
|
|
3735
|
+
if (i.persistence === !0) {
|
|
3736
|
+
const u = await he.getDirectory(i.id);
|
|
3737
|
+
if (u)
|
|
3738
|
+
return await de.create(u, i.mode);
|
|
3739
|
+
}
|
|
3740
|
+
const n = await globalThis.showDirectoryPicker({
|
|
3741
|
+
id: `web-fs_${i.id}`,
|
|
3742
|
+
startIn: i.startIn
|
|
3743
|
+
});
|
|
3744
|
+
return i.persistence === !0 && he.setDirectory(i.id, n), await de.create(n, i.mode);
|
|
3745
|
+
} catch {
|
|
3746
|
+
return;
|
|
3747
|
+
}
|
|
3748
|
+
}
|
|
3749
|
+
async function pn(i, n = {}) {
|
|
3750
|
+
try {
|
|
3751
|
+
return await ye.create(
|
|
3752
|
+
i,
|
|
3753
|
+
n.mode
|
|
3754
|
+
);
|
|
3755
|
+
} catch {
|
|
3756
|
+
return;
|
|
3757
|
+
}
|
|
3758
|
+
}
|
|
3759
|
+
async function hn(i, n = {}) {
|
|
3760
|
+
try {
|
|
3761
|
+
return await de.create(
|
|
3762
|
+
i,
|
|
3763
|
+
n.mode
|
|
3764
|
+
);
|
|
3765
|
+
} catch {
|
|
3766
|
+
return;
|
|
3767
|
+
}
|
|
3768
|
+
}
|
|
3769
|
+
async function yn(i) {
|
|
3770
|
+
await he.delFile(i);
|
|
3771
|
+
}
|
|
3772
|
+
async function gn(i) {
|
|
3773
|
+
await he.delDirectory(i);
|
|
3774
|
+
}
|
|
3775
|
+
function mr(i, n) {
|
|
3776
|
+
return globalThis.showOpenFilePicker({
|
|
3777
|
+
id: `web-fs_${i.id}`,
|
|
3778
|
+
excludeAcceptAllOption: !i.acceptAllExtensions,
|
|
3779
|
+
startIn: i.startIn,
|
|
3780
|
+
multiple: n,
|
|
3781
|
+
types: i.types?.map(({ description: u, accept: f }) => ({
|
|
3782
|
+
description: u,
|
|
3783
|
+
accept: {
|
|
3784
|
+
"*/*": f
|
|
3785
|
+
}
|
|
3786
|
+
}))
|
|
3787
|
+
});
|
|
3788
|
+
}
|
|
3789
|
+
export {
|
|
3790
|
+
de as WebFsDirectoryHandle,
|
|
3791
|
+
ye as WebFsFileHandle,
|
|
3792
|
+
nr as WebFsHandle,
|
|
3793
|
+
hn as mountDirectory,
|
|
3794
|
+
pn as mountFile,
|
|
3795
|
+
fn as pickDirectory,
|
|
3796
|
+
cn as pickFile,
|
|
3797
|
+
ln as pickFiles,
|
|
3798
|
+
sn as supportsWebFs,
|
|
3799
|
+
gn as unmountDirectory,
|
|
3800
|
+
yn as unmountFile
|
|
3801
|
+
};
|