@reearth/core 0.0.7-alpha.63 → 0.0.7-alpha.64
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/dist/core.js +69670 -64445
- package/dist/core.umd.cjs +662 -682
- package/dist/{index-DqGWVPtz.js → index-CUJ6HGQn.js} +1021 -907
- package/dist/index.d.ts +94 -64
- package/package.json +1 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var
|
|
2
|
-
function
|
|
1
|
+
var ie = typeof global < "u" ? global : typeof self < "u" ? self : typeof window < "u" ? window : {}, P = [], F = [], Qt = typeof Uint8Array < "u" ? Uint8Array : Array, je = !1;
|
|
2
|
+
function lt() {
|
|
3
3
|
je = !0;
|
|
4
4
|
for (var t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", e = 0, r = t.length; e < r; ++e)
|
|
5
|
-
P[e] = t[e],
|
|
6
|
-
|
|
5
|
+
P[e] = t[e], F[t.charCodeAt(e)] = e;
|
|
6
|
+
F[45] = 62, F[95] = 63;
|
|
7
7
|
}
|
|
8
8
|
function Ht(t) {
|
|
9
|
-
je ||
|
|
9
|
+
je || lt();
|
|
10
10
|
var e, r, n, i, o, s, f = t.length;
|
|
11
11
|
if (f % 4 > 0)
|
|
12
12
|
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
13
13
|
o = t[f - 2] === "=" ? 2 : t[f - 1] === "=" ? 1 : 0, s = new Qt(f * 3 / 4 - o), n = o > 0 ? f - 4 : f;
|
|
14
14
|
var l = 0;
|
|
15
15
|
for (e = 0, r = 0; e < n; e += 4, r += 3)
|
|
16
|
-
i =
|
|
17
|
-
return o === 2 ? (i =
|
|
16
|
+
i = F[t.charCodeAt(e)] << 18 | F[t.charCodeAt(e + 1)] << 12 | F[t.charCodeAt(e + 2)] << 6 | F[t.charCodeAt(e + 3)], s[l++] = i >> 16 & 255, s[l++] = i >> 8 & 255, s[l++] = i & 255;
|
|
17
|
+
return o === 2 ? (i = F[t.charCodeAt(e)] << 2 | F[t.charCodeAt(e + 1)] >> 4, s[l++] = i & 255) : o === 1 && (i = F[t.charCodeAt(e)] << 10 | F[t.charCodeAt(e + 1)] << 4 | F[t.charCodeAt(e + 2)] >> 2, s[l++] = i >> 8 & 255, s[l++] = i & 255), s;
|
|
18
18
|
}
|
|
19
19
|
function Gt(t) {
|
|
20
20
|
return P[t >> 18 & 63] + P[t >> 12 & 63] + P[t >> 6 & 63] + P[t & 63];
|
|
@@ -24,13 +24,13 @@ function Zt(t, e, r) {
|
|
|
24
24
|
n = (t[o] << 16) + (t[o + 1] << 8) + t[o + 2], i.push(Gt(n));
|
|
25
25
|
return i.join("");
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
je ||
|
|
27
|
+
function He(t) {
|
|
28
|
+
je || lt();
|
|
29
29
|
for (var e, r = t.length, n = r % 3, i = "", o = [], s = 16383, f = 0, l = r - n; f < l; f += s)
|
|
30
30
|
o.push(Zt(t, f, f + s > l ? l : f + s));
|
|
31
31
|
return n === 1 ? (e = t[r - 1], i += P[e >> 2], i += P[e << 4 & 63], i += "==") : n === 2 && (e = (t[r - 2] << 8) + t[r - 1], i += P[e >> 10], i += P[e >> 4 & 63], i += P[e << 2 & 63], i += "="), o.push(i), o.join("");
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function ve(t, e, r, n, i) {
|
|
34
34
|
var o, s, f = i * 8 - n - 1, l = (1 << f) - 1, u = l >> 1, h = -7, c = r ? i - 1 : 0, g = r ? -1 : 1, v = t[e + c];
|
|
35
35
|
for (c += g, o = v & (1 << -h) - 1, v >>= -h, h += f; h > 0; o = o * 256 + t[e + c], c += g, h -= 8)
|
|
36
36
|
;
|
|
@@ -45,7 +45,7 @@ function be(t, e, r, n, i) {
|
|
|
45
45
|
}
|
|
46
46
|
return (v ? -1 : 1) * s * Math.pow(2, o - n);
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function ut(t, e, r, n, i, o) {
|
|
49
49
|
var s, f, l, u = o * 8 - i - 1, h = (1 << u) - 1, c = h >> 1, g = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, v = n ? 0 : o - 1, A = n ? 1 : -1, x = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
|
|
50
50
|
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (f = isNaN(e) ? 1 : 0, s = h) : (s = Math.floor(Math.log(e) / Math.LN2), e * (l = Math.pow(2, -s)) < 1 && (s--, l *= 2), s + c >= 1 ? e += g / l : e += g * Math.pow(2, 1 - c), e * l >= 2 && (s++, l /= 2), s + c >= h ? (f = 0, s = h) : s + c >= 1 ? (f = (e * l - 1) * Math.pow(2, i), s = s + c) : (f = e * Math.pow(2, c - 1) * Math.pow(2, i), s = 0)); i >= 8; t[r + v] = f & 255, v += A, f /= 256, i -= 8)
|
|
51
51
|
;
|
|
@@ -53,16 +53,16 @@ function lt(t, e, r, n, i, o) {
|
|
|
53
53
|
;
|
|
54
54
|
t[r + v - A] |= x * 128;
|
|
55
55
|
}
|
|
56
|
-
var Xt = {}.toString,
|
|
56
|
+
var Xt = {}.toString, ht = Array.isArray || function(t) {
|
|
57
57
|
return Xt.call(t) == "[object Array]";
|
|
58
58
|
}, Kt = 50;
|
|
59
|
-
a.TYPED_ARRAY_SUPPORT =
|
|
60
|
-
|
|
61
|
-
function
|
|
59
|
+
a.TYPED_ARRAY_SUPPORT = ie.TYPED_ARRAY_SUPPORT !== void 0 ? ie.TYPED_ARRAY_SUPPORT : !0;
|
|
60
|
+
_e();
|
|
61
|
+
function _e() {
|
|
62
62
|
return a.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
if (
|
|
64
|
+
function q(t, e) {
|
|
65
|
+
if (_e() < e)
|
|
66
66
|
throw new RangeError("Invalid typed array length");
|
|
67
67
|
return a.TYPED_ARRAY_SUPPORT ? (t = new Uint8Array(e), t.__proto__ = a.prototype) : (t === null && (t = new a(e)), t.length = e), t;
|
|
68
68
|
}
|
|
@@ -76,35 +76,35 @@ function a(t, e, r) {
|
|
|
76
76
|
);
|
|
77
77
|
return $e(this, t);
|
|
78
78
|
}
|
|
79
|
-
return
|
|
79
|
+
return ct(this, t, e, r);
|
|
80
80
|
}
|
|
81
81
|
a.poolSize = 8192;
|
|
82
82
|
a._augment = function(t) {
|
|
83
83
|
return t.__proto__ = a.prototype, t;
|
|
84
84
|
};
|
|
85
|
-
function
|
|
85
|
+
function ct(t, e, r, n) {
|
|
86
86
|
if (typeof e == "number")
|
|
87
87
|
throw new TypeError('"value" argument must not be a number');
|
|
88
88
|
return typeof ArrayBuffer < "u" && e instanceof ArrayBuffer ? rr(t, e, r, n) : typeof e == "string" ? tr(t, e, r) : nr(t, e);
|
|
89
89
|
}
|
|
90
90
|
a.from = function(t, e, r) {
|
|
91
|
-
return
|
|
91
|
+
return ct(null, t, e, r);
|
|
92
92
|
};
|
|
93
93
|
a.TYPED_ARRAY_SUPPORT && (a.prototype.__proto__ = Uint8Array.prototype, a.__proto__ = Uint8Array, typeof Symbol < "u" && Symbol.species && a[Symbol.species]);
|
|
94
|
-
function
|
|
94
|
+
function dt(t) {
|
|
95
95
|
if (typeof t != "number")
|
|
96
96
|
throw new TypeError('"size" argument must be a number');
|
|
97
97
|
if (t < 0)
|
|
98
98
|
throw new RangeError('"size" argument must not be negative');
|
|
99
99
|
}
|
|
100
100
|
function er(t, e, r, n) {
|
|
101
|
-
return
|
|
101
|
+
return dt(e), e <= 0 ? q(t, e) : r !== void 0 ? typeof n == "string" ? q(t, e).fill(r, n) : q(t, e).fill(r) : q(t, e);
|
|
102
102
|
}
|
|
103
103
|
a.alloc = function(t, e, r) {
|
|
104
104
|
return er(null, t, e, r);
|
|
105
105
|
};
|
|
106
106
|
function $e(t, e) {
|
|
107
|
-
if (
|
|
107
|
+
if (dt(e), t = q(t, e < 0 ? 0 : qe(e) | 0), !a.TYPED_ARRAY_SUPPORT)
|
|
108
108
|
for (var r = 0; r < e; ++r)
|
|
109
109
|
t[r] = 0;
|
|
110
110
|
return t;
|
|
@@ -118,14 +118,14 @@ a.allocUnsafeSlow = function(t) {
|
|
|
118
118
|
function tr(t, e, r) {
|
|
119
119
|
if ((typeof r != "string" || r === "") && (r = "utf8"), !a.isEncoding(r))
|
|
120
120
|
throw new TypeError('"encoding" must be a valid string encoding');
|
|
121
|
-
var n =
|
|
122
|
-
t =
|
|
121
|
+
var n = pt(e, r) | 0;
|
|
122
|
+
t = q(t, n);
|
|
123
123
|
var i = t.write(e, r);
|
|
124
124
|
return i !== n && (t = t.slice(0, i)), t;
|
|
125
125
|
}
|
|
126
126
|
function Be(t, e) {
|
|
127
127
|
var r = e.length < 0 ? 0 : qe(e.length) | 0;
|
|
128
|
-
t =
|
|
128
|
+
t = q(t, r);
|
|
129
129
|
for (var n = 0; n < r; n += 1)
|
|
130
130
|
t[n] = e[n] & 255;
|
|
131
131
|
return t;
|
|
@@ -140,30 +140,29 @@ function rr(t, e, r, n) {
|
|
|
140
140
|
function nr(t, e) {
|
|
141
141
|
if (j(e)) {
|
|
142
142
|
var r = qe(e.length) | 0;
|
|
143
|
-
return t =
|
|
143
|
+
return t = q(t, r), t.length === 0 || e.copy(t, 0, 0, r), t;
|
|
144
144
|
}
|
|
145
145
|
if (e) {
|
|
146
146
|
if (typeof ArrayBuffer < "u" && e.buffer instanceof ArrayBuffer || "length" in e)
|
|
147
|
-
return typeof e.length != "number" || xr(e.length) ?
|
|
148
|
-
if (e.type === "Buffer" &&
|
|
147
|
+
return typeof e.length != "number" || xr(e.length) ? q(t, 0) : Be(t, e);
|
|
148
|
+
if (e.type === "Buffer" && ht(e.data))
|
|
149
149
|
return Be(t, e.data);
|
|
150
150
|
}
|
|
151
151
|
throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.");
|
|
152
152
|
}
|
|
153
153
|
function qe(t) {
|
|
154
|
-
if (t >=
|
|
155
|
-
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" +
|
|
154
|
+
if (t >= _e())
|
|
155
|
+
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + _e().toString(16) + " bytes");
|
|
156
156
|
return t | 0;
|
|
157
157
|
}
|
|
158
|
-
a.isBuffer =
|
|
158
|
+
a.isBuffer = L;
|
|
159
159
|
function j(t) {
|
|
160
160
|
return !!(t != null && t._isBuffer);
|
|
161
161
|
}
|
|
162
162
|
a.compare = function(e, r) {
|
|
163
163
|
if (!j(e) || !j(r))
|
|
164
164
|
throw new TypeError("Arguments must be Buffers");
|
|
165
|
-
if (e === r)
|
|
166
|
-
return 0;
|
|
165
|
+
if (e === r) return 0;
|
|
167
166
|
for (var n = e.length, i = r.length, o = 0, s = Math.min(n, i); o < s; ++o)
|
|
168
167
|
if (e[o] !== r[o]) {
|
|
169
168
|
n = e[o], i = r[o];
|
|
@@ -190,7 +189,7 @@ a.isEncoding = function(e) {
|
|
|
190
189
|
}
|
|
191
190
|
};
|
|
192
191
|
a.concat = function(e, r) {
|
|
193
|
-
if (!
|
|
192
|
+
if (!ht(e))
|
|
194
193
|
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
195
194
|
if (e.length === 0)
|
|
196
195
|
return a.alloc(0);
|
|
@@ -207,15 +206,14 @@ a.concat = function(e, r) {
|
|
|
207
206
|
}
|
|
208
207
|
return i;
|
|
209
208
|
};
|
|
210
|
-
function
|
|
209
|
+
function pt(t, e) {
|
|
211
210
|
if (j(t))
|
|
212
211
|
return t.length;
|
|
213
212
|
if (typeof ArrayBuffer < "u" && typeof ArrayBuffer.isView == "function" && (ArrayBuffer.isView(t) || t instanceof ArrayBuffer))
|
|
214
213
|
return t.byteLength;
|
|
215
214
|
typeof t != "string" && (t = "" + t);
|
|
216
215
|
var r = t.length;
|
|
217
|
-
if (r === 0)
|
|
218
|
-
return 0;
|
|
216
|
+
if (r === 0) return 0;
|
|
219
217
|
for (var n = !1; ; )
|
|
220
218
|
switch (e) {
|
|
221
219
|
case "ascii":
|
|
@@ -225,7 +223,7 @@ function dt(t, e) {
|
|
|
225
223
|
case "utf8":
|
|
226
224
|
case "utf-8":
|
|
227
225
|
case void 0:
|
|
228
|
-
return
|
|
226
|
+
return we(t).length;
|
|
229
227
|
case "ucs2":
|
|
230
228
|
case "ucs-2":
|
|
231
229
|
case "utf16le":
|
|
@@ -234,14 +232,13 @@ function dt(t, e) {
|
|
|
234
232
|
case "hex":
|
|
235
233
|
return r >>> 1;
|
|
236
234
|
case "base64":
|
|
237
|
-
return
|
|
235
|
+
return bt(t).length;
|
|
238
236
|
default:
|
|
239
|
-
if (n)
|
|
240
|
-
return ye(t).length;
|
|
237
|
+
if (n) return we(t).length;
|
|
241
238
|
e = ("" + e).toLowerCase(), n = !0;
|
|
242
239
|
}
|
|
243
240
|
}
|
|
244
|
-
a.byteLength =
|
|
241
|
+
a.byteLength = pt;
|
|
245
242
|
function ir(t, e, r) {
|
|
246
243
|
var n = !1;
|
|
247
244
|
if ((e === void 0 || e < 0) && (e = 0), e > this.length || ((r === void 0 || r > this.length) && (r = this.length), r <= 0) || (r >>>= 0, e >>>= 0, r <= e))
|
|
@@ -252,7 +249,7 @@ function ir(t, e, r) {
|
|
|
252
249
|
return pr(this, e, r);
|
|
253
250
|
case "utf8":
|
|
254
251
|
case "utf-8":
|
|
255
|
-
return
|
|
252
|
+
return _t(this, e, r);
|
|
256
253
|
case "ascii":
|
|
257
254
|
return cr(this, e, r);
|
|
258
255
|
case "latin1":
|
|
@@ -266,13 +263,12 @@ function ir(t, e, r) {
|
|
|
266
263
|
case "utf-16le":
|
|
267
264
|
return mr(this, e, r);
|
|
268
265
|
default:
|
|
269
|
-
if (n)
|
|
270
|
-
throw new TypeError("Unknown encoding: " + t);
|
|
266
|
+
if (n) throw new TypeError("Unknown encoding: " + t);
|
|
271
267
|
t = (t + "").toLowerCase(), n = !0;
|
|
272
268
|
}
|
|
273
269
|
}
|
|
274
270
|
a.prototype._isBuffer = !0;
|
|
275
|
-
function
|
|
271
|
+
function K(t, e, r) {
|
|
276
272
|
var n = t[e];
|
|
277
273
|
t[e] = t[r], t[r] = n;
|
|
278
274
|
}
|
|
@@ -281,7 +277,7 @@ a.prototype.swap16 = function() {
|
|
|
281
277
|
if (e % 2 !== 0)
|
|
282
278
|
throw new RangeError("Buffer size must be a multiple of 16-bits");
|
|
283
279
|
for (var r = 0; r < e; r += 2)
|
|
284
|
-
|
|
280
|
+
K(this, r, r + 1);
|
|
285
281
|
return this;
|
|
286
282
|
};
|
|
287
283
|
a.prototype.swap32 = function() {
|
|
@@ -289,7 +285,7 @@ a.prototype.swap32 = function() {
|
|
|
289
285
|
if (e % 4 !== 0)
|
|
290
286
|
throw new RangeError("Buffer size must be a multiple of 32-bits");
|
|
291
287
|
for (var r = 0; r < e; r += 4)
|
|
292
|
-
|
|
288
|
+
K(this, r, r + 3), K(this, r + 1, r + 2);
|
|
293
289
|
return this;
|
|
294
290
|
};
|
|
295
291
|
a.prototype.swap64 = function() {
|
|
@@ -297,16 +293,15 @@ a.prototype.swap64 = function() {
|
|
|
297
293
|
if (e % 8 !== 0)
|
|
298
294
|
throw new RangeError("Buffer size must be a multiple of 64-bits");
|
|
299
295
|
for (var r = 0; r < e; r += 8)
|
|
300
|
-
|
|
296
|
+
K(this, r, r + 7), K(this, r + 1, r + 6), K(this, r + 2, r + 5), K(this, r + 3, r + 4);
|
|
301
297
|
return this;
|
|
302
298
|
};
|
|
303
299
|
a.prototype.toString = function() {
|
|
304
300
|
var e = this.length | 0;
|
|
305
|
-
return e === 0 ? "" : arguments.length === 0 ?
|
|
301
|
+
return e === 0 ? "" : arguments.length === 0 ? _t(this, 0, e) : ir.apply(this, arguments);
|
|
306
302
|
};
|
|
307
303
|
a.prototype.equals = function(e) {
|
|
308
|
-
if (!j(e))
|
|
309
|
-
throw new TypeError("Argument must be a Buffer");
|
|
304
|
+
if (!j(e)) throw new TypeError("Argument must be a Buffer");
|
|
310
305
|
return this === e ? !0 : a.compare(this, e) === 0;
|
|
311
306
|
};
|
|
312
307
|
a.prototype.inspect = function() {
|
|
@@ -324,8 +319,7 @@ a.prototype.compare = function(e, r, n, i, o) {
|
|
|
324
319
|
return -1;
|
|
325
320
|
if (r >= n)
|
|
326
321
|
return 1;
|
|
327
|
-
if (r >>>= 0, n >>>= 0, i >>>= 0, o >>>= 0, this === e)
|
|
328
|
-
return 0;
|
|
322
|
+
if (r >>>= 0, n >>>= 0, i >>>= 0, o >>>= 0, this === e) return 0;
|
|
329
323
|
for (var s = o - i, f = n - r, l = Math.min(s, f), u = this.slice(i, o), h = e.slice(r, n), c = 0; c < l; ++c)
|
|
330
324
|
if (u[c] !== h[c]) {
|
|
331
325
|
s = u[c], f = h[c];
|
|
@@ -333,25 +327,21 @@ a.prototype.compare = function(e, r, n, i, o) {
|
|
|
333
327
|
}
|
|
334
328
|
return s < f ? -1 : f < s ? 1 : 0;
|
|
335
329
|
};
|
|
336
|
-
function
|
|
337
|
-
if (t.length === 0)
|
|
338
|
-
return -1;
|
|
330
|
+
function mt(t, e, r, n, i) {
|
|
331
|
+
if (t.length === 0) return -1;
|
|
339
332
|
if (typeof r == "string" ? (n = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), r = +r, isNaN(r) && (r = i ? 0 : t.length - 1), r < 0 && (r = t.length + r), r >= t.length) {
|
|
340
|
-
if (i)
|
|
341
|
-
return -1;
|
|
333
|
+
if (i) return -1;
|
|
342
334
|
r = t.length - 1;
|
|
343
335
|
} else if (r < 0)
|
|
344
|
-
if (i)
|
|
345
|
-
|
|
346
|
-
else
|
|
347
|
-
return -1;
|
|
336
|
+
if (i) r = 0;
|
|
337
|
+
else return -1;
|
|
348
338
|
if (typeof e == "string" && (e = a.from(e, n)), j(e))
|
|
349
|
-
return e.length === 0 ? -1 :
|
|
339
|
+
return e.length === 0 ? -1 : Ge(t, e, r, n, i);
|
|
350
340
|
if (typeof e == "number")
|
|
351
|
-
return e = e & 255, a.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf == "function" ? i ? Uint8Array.prototype.indexOf.call(t, e, r) : Uint8Array.prototype.lastIndexOf.call(t, e, r) :
|
|
341
|
+
return e = e & 255, a.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf == "function" ? i ? Uint8Array.prototype.indexOf.call(t, e, r) : Uint8Array.prototype.lastIndexOf.call(t, e, r) : Ge(t, [e], r, n, i);
|
|
352
342
|
throw new TypeError("val must be string, number or Buffer");
|
|
353
343
|
}
|
|
354
|
-
function
|
|
344
|
+
function Ge(t, e, r, n, i) {
|
|
355
345
|
var o = 1, s = t.length, f = e.length;
|
|
356
346
|
if (n !== void 0 && (n = String(n).toLowerCase(), n === "ucs2" || n === "ucs-2" || n === "utf16le" || n === "utf-16le")) {
|
|
357
347
|
if (t.length < 2 || e.length < 2)
|
|
@@ -366,8 +356,7 @@ function He(t, e, r, n, i) {
|
|
|
366
356
|
var h = -1;
|
|
367
357
|
for (u = r; u < s; u++)
|
|
368
358
|
if (l(t, u) === l(e, h === -1 ? 0 : u - h)) {
|
|
369
|
-
if (h === -1 && (h = u), u - h + 1 === f)
|
|
370
|
-
return h * o;
|
|
359
|
+
if (h === -1 && (h = u), u - h + 1 === f) return h * o;
|
|
371
360
|
} else
|
|
372
361
|
h !== -1 && (u -= u - h), h = -1;
|
|
373
362
|
} else
|
|
@@ -377,8 +366,7 @@ function He(t, e, r, n, i) {
|
|
|
377
366
|
c = !1;
|
|
378
367
|
break;
|
|
379
368
|
}
|
|
380
|
-
if (c)
|
|
381
|
-
return u;
|
|
369
|
+
if (c) return u;
|
|
382
370
|
}
|
|
383
371
|
return -1;
|
|
384
372
|
}
|
|
@@ -386,41 +374,39 @@ a.prototype.includes = function(e, r, n) {
|
|
|
386
374
|
return this.indexOf(e, r, n) !== -1;
|
|
387
375
|
};
|
|
388
376
|
a.prototype.indexOf = function(e, r, n) {
|
|
389
|
-
return
|
|
377
|
+
return mt(this, e, r, n, !0);
|
|
390
378
|
};
|
|
391
379
|
a.prototype.lastIndexOf = function(e, r, n) {
|
|
392
|
-
return
|
|
380
|
+
return mt(this, e, r, n, !1);
|
|
393
381
|
};
|
|
394
382
|
function or(t, e, r, n) {
|
|
395
383
|
r = Number(r) || 0;
|
|
396
384
|
var i = t.length - r;
|
|
397
385
|
n ? (n = Number(n), n > i && (n = i)) : n = i;
|
|
398
386
|
var o = e.length;
|
|
399
|
-
if (o % 2 !== 0)
|
|
400
|
-
throw new TypeError("Invalid hex string");
|
|
387
|
+
if (o % 2 !== 0) throw new TypeError("Invalid hex string");
|
|
401
388
|
n > o / 2 && (n = o / 2);
|
|
402
389
|
for (var s = 0; s < n; ++s) {
|
|
403
390
|
var f = parseInt(e.substr(s * 2, 2), 16);
|
|
404
|
-
if (isNaN(f))
|
|
405
|
-
return s;
|
|
391
|
+
if (isNaN(f)) return s;
|
|
406
392
|
t[r + s] = f;
|
|
407
393
|
}
|
|
408
394
|
return s;
|
|
409
395
|
}
|
|
410
396
|
function sr(t, e, r, n) {
|
|
411
|
-
return
|
|
397
|
+
return Ee(we(e, t.length - r), t, r, n);
|
|
412
398
|
}
|
|
413
|
-
function
|
|
414
|
-
return
|
|
399
|
+
function gt(t, e, r, n) {
|
|
400
|
+
return Ee(vr(e), t, r, n);
|
|
415
401
|
}
|
|
416
402
|
function fr(t, e, r, n) {
|
|
417
|
-
return
|
|
403
|
+
return gt(t, e, r, n);
|
|
418
404
|
}
|
|
419
405
|
function ar(t, e, r, n) {
|
|
420
|
-
return
|
|
406
|
+
return Ee(bt(e), t, r, n);
|
|
421
407
|
}
|
|
422
408
|
function lr(t, e, r, n) {
|
|
423
|
-
return
|
|
409
|
+
return Ee(br(e, t.length - r), t, r, n);
|
|
424
410
|
}
|
|
425
411
|
a.prototype.write = function(e, r, n, i) {
|
|
426
412
|
if (r === void 0)
|
|
@@ -445,7 +431,7 @@ a.prototype.write = function(e, r, n, i) {
|
|
|
445
431
|
case "utf-8":
|
|
446
432
|
return sr(this, e, r, n);
|
|
447
433
|
case "ascii":
|
|
448
|
-
return
|
|
434
|
+
return gt(this, e, r, n);
|
|
449
435
|
case "latin1":
|
|
450
436
|
case "binary":
|
|
451
437
|
return fr(this, e, r, n);
|
|
@@ -457,8 +443,7 @@ a.prototype.write = function(e, r, n, i) {
|
|
|
457
443
|
case "utf-16le":
|
|
458
444
|
return lr(this, e, r, n);
|
|
459
445
|
default:
|
|
460
|
-
if (s)
|
|
461
|
-
throw new TypeError("Unknown encoding: " + i);
|
|
446
|
+
if (s) throw new TypeError("Unknown encoding: " + i);
|
|
462
447
|
i = ("" + i).toLowerCase(), s = !0;
|
|
463
448
|
}
|
|
464
449
|
};
|
|
@@ -469,9 +454,9 @@ a.prototype.toJSON = function() {
|
|
|
469
454
|
};
|
|
470
455
|
};
|
|
471
456
|
function ur(t, e, r) {
|
|
472
|
-
return e === 0 && r === t.length ?
|
|
457
|
+
return e === 0 && r === t.length ? He(t) : He(t.slice(e, r));
|
|
473
458
|
}
|
|
474
|
-
function
|
|
459
|
+
function _t(t, e, r) {
|
|
475
460
|
r = Math.min(t.length, r);
|
|
476
461
|
for (var n = [], i = e; i < r; ) {
|
|
477
462
|
var o = t[i], s = null, f = o > 239 ? 4 : o > 223 ? 3 : o > 191 ? 2 : 1;
|
|
@@ -495,15 +480,15 @@ function gt(t, e, r) {
|
|
|
495
480
|
}
|
|
496
481
|
return hr(n);
|
|
497
482
|
}
|
|
498
|
-
var
|
|
483
|
+
var Ze = 4096;
|
|
499
484
|
function hr(t) {
|
|
500
485
|
var e = t.length;
|
|
501
|
-
if (e <=
|
|
486
|
+
if (e <= Ze)
|
|
502
487
|
return String.fromCharCode.apply(String, t);
|
|
503
488
|
for (var r = "", n = 0; n < e; )
|
|
504
489
|
r += String.fromCharCode.apply(
|
|
505
490
|
String,
|
|
506
|
-
t.slice(n, n +=
|
|
491
|
+
t.slice(n, n += Ze)
|
|
507
492
|
);
|
|
508
493
|
return r;
|
|
509
494
|
}
|
|
@@ -547,89 +532,84 @@ a.prototype.slice = function(e, r) {
|
|
|
547
532
|
}
|
|
548
533
|
return i;
|
|
549
534
|
};
|
|
550
|
-
function
|
|
551
|
-
if (t % 1 !== 0 || t < 0)
|
|
552
|
-
|
|
553
|
-
if (t + e > r)
|
|
554
|
-
throw new RangeError("Trying to access beyond buffer length");
|
|
535
|
+
function O(t, e, r) {
|
|
536
|
+
if (t % 1 !== 0 || t < 0) throw new RangeError("offset is not uint");
|
|
537
|
+
if (t + e > r) throw new RangeError("Trying to access beyond buffer length");
|
|
555
538
|
}
|
|
556
539
|
a.prototype.readUIntLE = function(e, r, n) {
|
|
557
|
-
e = e | 0, r = r | 0, n ||
|
|
540
|
+
e = e | 0, r = r | 0, n || O(e, r, this.length);
|
|
558
541
|
for (var i = this[e], o = 1, s = 0; ++s < r && (o *= 256); )
|
|
559
542
|
i += this[e + s] * o;
|
|
560
543
|
return i;
|
|
561
544
|
};
|
|
562
545
|
a.prototype.readUIntBE = function(e, r, n) {
|
|
563
|
-
e = e | 0, r = r | 0, n ||
|
|
546
|
+
e = e | 0, r = r | 0, n || O(e, r, this.length);
|
|
564
547
|
for (var i = this[e + --r], o = 1; r > 0 && (o *= 256); )
|
|
565
548
|
i += this[e + --r] * o;
|
|
566
549
|
return i;
|
|
567
550
|
};
|
|
568
551
|
a.prototype.readUInt8 = function(e, r) {
|
|
569
|
-
return r ||
|
|
552
|
+
return r || O(e, 1, this.length), this[e];
|
|
570
553
|
};
|
|
571
554
|
a.prototype.readUInt16LE = function(e, r) {
|
|
572
|
-
return r ||
|
|
555
|
+
return r || O(e, 2, this.length), this[e] | this[e + 1] << 8;
|
|
573
556
|
};
|
|
574
557
|
a.prototype.readUInt16BE = function(e, r) {
|
|
575
|
-
return r ||
|
|
558
|
+
return r || O(e, 2, this.length), this[e] << 8 | this[e + 1];
|
|
576
559
|
};
|
|
577
560
|
a.prototype.readUInt32LE = function(e, r) {
|
|
578
|
-
return r ||
|
|
561
|
+
return r || O(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + this[e + 3] * 16777216;
|
|
579
562
|
};
|
|
580
563
|
a.prototype.readUInt32BE = function(e, r) {
|
|
581
|
-
return r ||
|
|
564
|
+
return r || O(e, 4, this.length), this[e] * 16777216 + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
|
|
582
565
|
};
|
|
583
566
|
a.prototype.readIntLE = function(e, r, n) {
|
|
584
|
-
e = e | 0, r = r | 0, n ||
|
|
567
|
+
e = e | 0, r = r | 0, n || O(e, r, this.length);
|
|
585
568
|
for (var i = this[e], o = 1, s = 0; ++s < r && (o *= 256); )
|
|
586
569
|
i += this[e + s] * o;
|
|
587
570
|
return o *= 128, i >= o && (i -= Math.pow(2, 8 * r)), i;
|
|
588
571
|
};
|
|
589
572
|
a.prototype.readIntBE = function(e, r, n) {
|
|
590
|
-
e = e | 0, r = r | 0, n ||
|
|
573
|
+
e = e | 0, r = r | 0, n || O(e, r, this.length);
|
|
591
574
|
for (var i = r, o = 1, s = this[e + --i]; i > 0 && (o *= 256); )
|
|
592
575
|
s += this[e + --i] * o;
|
|
593
576
|
return o *= 128, s >= o && (s -= Math.pow(2, 8 * r)), s;
|
|
594
577
|
};
|
|
595
578
|
a.prototype.readInt8 = function(e, r) {
|
|
596
|
-
return r ||
|
|
579
|
+
return r || O(e, 1, this.length), this[e] & 128 ? (255 - this[e] + 1) * -1 : this[e];
|
|
597
580
|
};
|
|
598
581
|
a.prototype.readInt16LE = function(e, r) {
|
|
599
|
-
r ||
|
|
582
|
+
r || O(e, 2, this.length);
|
|
600
583
|
var n = this[e] | this[e + 1] << 8;
|
|
601
584
|
return n & 32768 ? n | 4294901760 : n;
|
|
602
585
|
};
|
|
603
586
|
a.prototype.readInt16BE = function(e, r) {
|
|
604
|
-
r ||
|
|
587
|
+
r || O(e, 2, this.length);
|
|
605
588
|
var n = this[e + 1] | this[e] << 8;
|
|
606
589
|
return n & 32768 ? n | 4294901760 : n;
|
|
607
590
|
};
|
|
608
591
|
a.prototype.readInt32LE = function(e, r) {
|
|
609
|
-
return r ||
|
|
592
|
+
return r || O(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;
|
|
610
593
|
};
|
|
611
594
|
a.prototype.readInt32BE = function(e, r) {
|
|
612
|
-
return r ||
|
|
595
|
+
return r || O(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
|
|
613
596
|
};
|
|
614
597
|
a.prototype.readFloatLE = function(e, r) {
|
|
615
|
-
return r ||
|
|
598
|
+
return r || O(e, 4, this.length), ve(this, e, !0, 23, 4);
|
|
616
599
|
};
|
|
617
600
|
a.prototype.readFloatBE = function(e, r) {
|
|
618
|
-
return r ||
|
|
601
|
+
return r || O(e, 4, this.length), ve(this, e, !1, 23, 4);
|
|
619
602
|
};
|
|
620
603
|
a.prototype.readDoubleLE = function(e, r) {
|
|
621
|
-
return r ||
|
|
604
|
+
return r || O(e, 8, this.length), ve(this, e, !0, 52, 8);
|
|
622
605
|
};
|
|
623
606
|
a.prototype.readDoubleBE = function(e, r) {
|
|
624
|
-
return r ||
|
|
607
|
+
return r || O(e, 8, this.length), ve(this, e, !1, 52, 8);
|
|
625
608
|
};
|
|
626
609
|
function N(t, e, r, n, i, o) {
|
|
627
|
-
if (!j(t))
|
|
628
|
-
|
|
629
|
-
if (
|
|
630
|
-
throw new RangeError('"value" argument is out of bounds');
|
|
631
|
-
if (r + n > t.length)
|
|
632
|
-
throw new RangeError("Index out of range");
|
|
610
|
+
if (!j(t)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
611
|
+
if (e > i || e < o) throw new RangeError('"value" argument is out of bounds');
|
|
612
|
+
if (r + n > t.length) throw new RangeError("Index out of range");
|
|
633
613
|
}
|
|
634
614
|
a.prototype.writeUIntLE = function(e, r, n, i) {
|
|
635
615
|
if (e = +e, r = r | 0, n = n | 0, !i) {
|
|
@@ -654,27 +634,27 @@ a.prototype.writeUIntBE = function(e, r, n, i) {
|
|
|
654
634
|
a.prototype.writeUInt8 = function(e, r, n) {
|
|
655
635
|
return e = +e, r = r | 0, n || N(this, e, r, 1, 255, 0), a.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)), this[r] = e & 255, r + 1;
|
|
656
636
|
};
|
|
657
|
-
function
|
|
637
|
+
function be(t, e, r, n) {
|
|
658
638
|
e < 0 && (e = 65535 + e + 1);
|
|
659
639
|
for (var i = 0, o = Math.min(t.length - r, 2); i < o; ++i)
|
|
660
640
|
t[r + i] = (e & 255 << 8 * (n ? i : 1 - i)) >>> (n ? i : 1 - i) * 8;
|
|
661
641
|
}
|
|
662
642
|
a.prototype.writeUInt16LE = function(e, r, n) {
|
|
663
|
-
return e = +e, r = r | 0, n || N(this, e, r, 2, 65535, 0), a.TYPED_ARRAY_SUPPORT ? (this[r] = e & 255, this[r + 1] = e >>> 8) :
|
|
643
|
+
return e = +e, r = r | 0, n || N(this, e, r, 2, 65535, 0), a.TYPED_ARRAY_SUPPORT ? (this[r] = e & 255, this[r + 1] = e >>> 8) : be(this, e, r, !0), r + 2;
|
|
664
644
|
};
|
|
665
645
|
a.prototype.writeUInt16BE = function(e, r, n) {
|
|
666
|
-
return e = +e, r = r | 0, n || N(this, e, r, 2, 65535, 0), a.TYPED_ARRAY_SUPPORT ? (this[r] = e >>> 8, this[r + 1] = e & 255) :
|
|
646
|
+
return e = +e, r = r | 0, n || N(this, e, r, 2, 65535, 0), a.TYPED_ARRAY_SUPPORT ? (this[r] = e >>> 8, this[r + 1] = e & 255) : be(this, e, r, !1), r + 2;
|
|
667
647
|
};
|
|
668
|
-
function
|
|
648
|
+
function xe(t, e, r, n) {
|
|
669
649
|
e < 0 && (e = 4294967295 + e + 1);
|
|
670
650
|
for (var i = 0, o = Math.min(t.length - r, 4); i < o; ++i)
|
|
671
651
|
t[r + i] = e >>> (n ? i : 3 - i) * 8 & 255;
|
|
672
652
|
}
|
|
673
653
|
a.prototype.writeUInt32LE = function(e, r, n) {
|
|
674
|
-
return e = +e, r = r | 0, n || N(this, e, r, 4, 4294967295, 0), a.TYPED_ARRAY_SUPPORT ? (this[r + 3] = e >>> 24, this[r + 2] = e >>> 16, this[r + 1] = e >>> 8, this[r] = e & 255) :
|
|
654
|
+
return e = +e, r = r | 0, n || N(this, e, r, 4, 4294967295, 0), a.TYPED_ARRAY_SUPPORT ? (this[r + 3] = e >>> 24, this[r + 2] = e >>> 16, this[r + 1] = e >>> 8, this[r] = e & 255) : xe(this, e, r, !0), r + 4;
|
|
675
655
|
};
|
|
676
656
|
a.prototype.writeUInt32BE = function(e, r, n) {
|
|
677
|
-
return e = +e, r = r | 0, n || N(this, e, r, 4, 4294967295, 0), a.TYPED_ARRAY_SUPPORT ? (this[r] = e >>> 24, this[r + 1] = e >>> 16, this[r + 2] = e >>> 8, this[r + 3] = e & 255) :
|
|
657
|
+
return e = +e, r = r | 0, n || N(this, e, r, 4, 4294967295, 0), a.TYPED_ARRAY_SUPPORT ? (this[r] = e >>> 24, this[r + 1] = e >>> 16, this[r + 2] = e >>> 8, this[r + 3] = e & 255) : xe(this, e, r, !1), r + 4;
|
|
678
658
|
};
|
|
679
659
|
a.prototype.writeIntLE = function(e, r, n, i) {
|
|
680
660
|
if (e = +e, r = r | 0, !i) {
|
|
@@ -700,50 +680,45 @@ a.prototype.writeInt8 = function(e, r, n) {
|
|
|
700
680
|
return e = +e, r = r | 0, n || N(this, e, r, 1, 127, -128), a.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)), e < 0 && (e = 255 + e + 1), this[r] = e & 255, r + 1;
|
|
701
681
|
};
|
|
702
682
|
a.prototype.writeInt16LE = function(e, r, n) {
|
|
703
|
-
return e = +e, r = r | 0, n || N(this, e, r, 2, 32767, -32768), a.TYPED_ARRAY_SUPPORT ? (this[r] = e & 255, this[r + 1] = e >>> 8) :
|
|
683
|
+
return e = +e, r = r | 0, n || N(this, e, r, 2, 32767, -32768), a.TYPED_ARRAY_SUPPORT ? (this[r] = e & 255, this[r + 1] = e >>> 8) : be(this, e, r, !0), r + 2;
|
|
704
684
|
};
|
|
705
685
|
a.prototype.writeInt16BE = function(e, r, n) {
|
|
706
|
-
return e = +e, r = r | 0, n || N(this, e, r, 2, 32767, -32768), a.TYPED_ARRAY_SUPPORT ? (this[r] = e >>> 8, this[r + 1] = e & 255) :
|
|
686
|
+
return e = +e, r = r | 0, n || N(this, e, r, 2, 32767, -32768), a.TYPED_ARRAY_SUPPORT ? (this[r] = e >>> 8, this[r + 1] = e & 255) : be(this, e, r, !1), r + 2;
|
|
707
687
|
};
|
|
708
688
|
a.prototype.writeInt32LE = function(e, r, n) {
|
|
709
|
-
return e = +e, r = r | 0, n || N(this, e, r, 4, 2147483647, -2147483648), a.TYPED_ARRAY_SUPPORT ? (this[r] = e & 255, this[r + 1] = e >>> 8, this[r + 2] = e >>> 16, this[r + 3] = e >>> 24) :
|
|
689
|
+
return e = +e, r = r | 0, n || N(this, e, r, 4, 2147483647, -2147483648), a.TYPED_ARRAY_SUPPORT ? (this[r] = e & 255, this[r + 1] = e >>> 8, this[r + 2] = e >>> 16, this[r + 3] = e >>> 24) : xe(this, e, r, !0), r + 4;
|
|
710
690
|
};
|
|
711
691
|
a.prototype.writeInt32BE = function(e, r, n) {
|
|
712
|
-
return e = +e, r = r | 0, n || N(this, e, r, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), a.TYPED_ARRAY_SUPPORT ? (this[r] = e >>> 24, this[r + 1] = e >>> 16, this[r + 2] = e >>> 8, this[r + 3] = e & 255) :
|
|
692
|
+
return e = +e, r = r | 0, n || N(this, e, r, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), a.TYPED_ARRAY_SUPPORT ? (this[r] = e >>> 24, this[r + 1] = e >>> 16, this[r + 2] = e >>> 8, this[r + 3] = e & 255) : xe(this, e, r, !1), r + 4;
|
|
713
693
|
};
|
|
714
|
-
function
|
|
715
|
-
if (r + n > t.length)
|
|
716
|
-
|
|
717
|
-
if (r < 0)
|
|
718
|
-
throw new RangeError("Index out of range");
|
|
694
|
+
function wt(t, e, r, n, i, o) {
|
|
695
|
+
if (r + n > t.length) throw new RangeError("Index out of range");
|
|
696
|
+
if (r < 0) throw new RangeError("Index out of range");
|
|
719
697
|
}
|
|
720
|
-
function
|
|
721
|
-
return i ||
|
|
698
|
+
function yt(t, e, r, n, i) {
|
|
699
|
+
return i || wt(t, e, r, 4), ut(t, e, r, n, 23, 4), r + 4;
|
|
722
700
|
}
|
|
723
701
|
a.prototype.writeFloatLE = function(e, r, n) {
|
|
724
|
-
return
|
|
702
|
+
return yt(this, e, r, !0, n);
|
|
725
703
|
};
|
|
726
704
|
a.prototype.writeFloatBE = function(e, r, n) {
|
|
727
|
-
return
|
|
705
|
+
return yt(this, e, r, !1, n);
|
|
728
706
|
};
|
|
729
|
-
function
|
|
730
|
-
return i ||
|
|
707
|
+
function vt(t, e, r, n, i) {
|
|
708
|
+
return i || wt(t, e, r, 8), ut(t, e, r, n, 52, 8), r + 8;
|
|
731
709
|
}
|
|
732
710
|
a.prototype.writeDoubleLE = function(e, r, n) {
|
|
733
|
-
return
|
|
711
|
+
return vt(this, e, r, !0, n);
|
|
734
712
|
};
|
|
735
713
|
a.prototype.writeDoubleBE = function(e, r, n) {
|
|
736
|
-
return
|
|
714
|
+
return vt(this, e, r, !1, n);
|
|
737
715
|
};
|
|
738
716
|
a.prototype.copy = function(e, r, n, i) {
|
|
739
|
-
if (n || (n = 0), !i && i !== 0 && (i = this.length), r >= e.length && (r = e.length), r || (r = 0), i > 0 && i < n && (i = n), i === n || e.length === 0 || this.length === 0)
|
|
740
|
-
return 0;
|
|
717
|
+
if (n || (n = 0), !i && i !== 0 && (i = this.length), r >= e.length && (r = e.length), r || (r = 0), i > 0 && i < n && (i = n), i === n || e.length === 0 || this.length === 0) return 0;
|
|
741
718
|
if (r < 0)
|
|
742
719
|
throw new RangeError("targetStart out of bounds");
|
|
743
|
-
if (n < 0 || n >= this.length)
|
|
744
|
-
|
|
745
|
-
if (i < 0)
|
|
746
|
-
throw new RangeError("sourceEnd out of bounds");
|
|
720
|
+
if (n < 0 || n >= this.length) throw new RangeError("sourceStart out of bounds");
|
|
721
|
+
if (i < 0) throw new RangeError("sourceEnd out of bounds");
|
|
747
722
|
i > this.length && (i = this.length), e.length - r < i - n && (i = e.length - r + n);
|
|
748
723
|
var o = i - n, s;
|
|
749
724
|
if (this === e && n < r && r < i)
|
|
@@ -770,8 +745,7 @@ a.prototype.fill = function(e, r, n, i) {
|
|
|
770
745
|
throw new TypeError("encoding must be a string");
|
|
771
746
|
if (typeof i == "string" && !a.isEncoding(i))
|
|
772
747
|
throw new TypeError("Unknown encoding: " + i);
|
|
773
|
-
} else
|
|
774
|
-
typeof e == "number" && (e = e & 255);
|
|
748
|
+
} else typeof e == "number" && (e = e & 255);
|
|
775
749
|
if (r < 0 || this.length < r || this.length < n)
|
|
776
750
|
throw new RangeError("Out of range index");
|
|
777
751
|
if (n <= r)
|
|
@@ -782,7 +756,7 @@ a.prototype.fill = function(e, r, n, i) {
|
|
|
782
756
|
for (s = r; s < n; ++s)
|
|
783
757
|
this[s] = e;
|
|
784
758
|
else {
|
|
785
|
-
var f = j(e) ? e :
|
|
759
|
+
var f = j(e) ? e : we(new a(e, i).toString()), l = f.length;
|
|
786
760
|
for (s = 0; s < n - r; ++s)
|
|
787
761
|
this[s + r] = f[s % l];
|
|
788
762
|
}
|
|
@@ -790,8 +764,7 @@ a.prototype.fill = function(e, r, n, i) {
|
|
|
790
764
|
};
|
|
791
765
|
var gr = /[^+\/0-9A-Za-z-_]/g;
|
|
792
766
|
function _r(t) {
|
|
793
|
-
if (t = wr(t).replace(gr, ""), t.length < 2)
|
|
794
|
-
return "";
|
|
767
|
+
if (t = wr(t).replace(gr, ""), t.length < 2) return "";
|
|
795
768
|
for (; t.length % 4 !== 0; )
|
|
796
769
|
t = t + "=";
|
|
797
770
|
return t;
|
|
@@ -802,7 +775,7 @@ function wr(t) {
|
|
|
802
775
|
function yr(t) {
|
|
803
776
|
return t < 16 ? "0" + t.toString(16) : t.toString(16);
|
|
804
777
|
}
|
|
805
|
-
function
|
|
778
|
+
function we(t, e) {
|
|
806
779
|
e = e || 1 / 0;
|
|
807
780
|
for (var r, n = t.length, i = null, o = [], s = 0; s < n; ++s) {
|
|
808
781
|
if (r = t.charCodeAt(s), r > 55295 && r < 57344) {
|
|
@@ -822,30 +795,25 @@ function ye(t, e) {
|
|
|
822
795
|
continue;
|
|
823
796
|
}
|
|
824
797
|
r = (i - 55296 << 10 | r - 56320) + 65536;
|
|
825
|
-
} else
|
|
826
|
-
i && (e -= 3) > -1 && o.push(239, 191, 189);
|
|
798
|
+
} else i && (e -= 3) > -1 && o.push(239, 191, 189);
|
|
827
799
|
if (i = null, r < 128) {
|
|
828
|
-
if ((e -= 1) < 0)
|
|
829
|
-
break;
|
|
800
|
+
if ((e -= 1) < 0) break;
|
|
830
801
|
o.push(r);
|
|
831
802
|
} else if (r < 2048) {
|
|
832
|
-
if ((e -= 2) < 0)
|
|
833
|
-
break;
|
|
803
|
+
if ((e -= 2) < 0) break;
|
|
834
804
|
o.push(
|
|
835
805
|
r >> 6 | 192,
|
|
836
806
|
r & 63 | 128
|
|
837
807
|
);
|
|
838
808
|
} else if (r < 65536) {
|
|
839
|
-
if ((e -= 3) < 0)
|
|
840
|
-
break;
|
|
809
|
+
if ((e -= 3) < 0) break;
|
|
841
810
|
o.push(
|
|
842
811
|
r >> 12 | 224,
|
|
843
812
|
r >> 6 & 63 | 128,
|
|
844
813
|
r & 63 | 128
|
|
845
814
|
);
|
|
846
815
|
} else if (r < 1114112) {
|
|
847
|
-
if ((e -= 4) < 0)
|
|
848
|
-
break;
|
|
816
|
+
if ((e -= 4) < 0) break;
|
|
849
817
|
o.push(
|
|
850
818
|
r >> 18 | 240,
|
|
851
819
|
r >> 12 & 63 | 128,
|
|
@@ -867,10 +835,10 @@ function br(t, e) {
|
|
|
867
835
|
r = t.charCodeAt(s), n = r >> 8, i = r % 256, o.push(i), o.push(n);
|
|
868
836
|
return o;
|
|
869
837
|
}
|
|
870
|
-
function
|
|
838
|
+
function bt(t) {
|
|
871
839
|
return Ht(_r(t));
|
|
872
840
|
}
|
|
873
|
-
function
|
|
841
|
+
function Ee(t, e, r, n) {
|
|
874
842
|
for (var i = 0; i < n && !(i + r >= e.length || i >= t.length); ++i)
|
|
875
843
|
e[i + r] = t[i];
|
|
876
844
|
return i;
|
|
@@ -878,16 +846,16 @@ function Se(t, e, r, n) {
|
|
|
878
846
|
function xr(t) {
|
|
879
847
|
return t !== t;
|
|
880
848
|
}
|
|
881
|
-
function
|
|
882
|
-
return t != null && (!!t._isBuffer ||
|
|
849
|
+
function L(t) {
|
|
850
|
+
return t != null && (!!t._isBuffer || xt(t) || Er(t));
|
|
883
851
|
}
|
|
884
|
-
function
|
|
852
|
+
function xt(t) {
|
|
885
853
|
return !!t.constructor && typeof t.constructor.isBuffer == "function" && t.constructor.isBuffer(t);
|
|
886
854
|
}
|
|
887
855
|
function Er(t) {
|
|
888
|
-
return typeof t.readFloatLE == "function" && typeof t.slice == "function" &&
|
|
856
|
+
return typeof t.readFloatLE == "function" && typeof t.slice == "function" && xt(t.slice(0, 0));
|
|
889
857
|
}
|
|
890
|
-
var
|
|
858
|
+
var Oe;
|
|
891
859
|
function H() {
|
|
892
860
|
}
|
|
893
861
|
H.prototype = /* @__PURE__ */ Object.create(null);
|
|
@@ -901,52 +869,52 @@ p.prototype._events = void 0;
|
|
|
901
869
|
p.prototype._maxListeners = void 0;
|
|
902
870
|
p.defaultMaxListeners = 10;
|
|
903
871
|
p.init = function() {
|
|
904
|
-
this.domain = null, p.usingDomains &&
|
|
872
|
+
this.domain = null, p.usingDomains && Oe.active && !(this instanceof Oe.Domain) && (this.domain = Oe.active), (!this._events || this._events === Object.getPrototypeOf(this)._events) && (this._events = new H(), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
|
|
905
873
|
};
|
|
906
874
|
p.prototype.setMaxListeners = function(e) {
|
|
907
875
|
if (typeof e != "number" || e < 0 || isNaN(e))
|
|
908
876
|
throw new TypeError('"n" argument must be a positive number');
|
|
909
877
|
return this._maxListeners = e, this;
|
|
910
878
|
};
|
|
911
|
-
function
|
|
879
|
+
function Et(t) {
|
|
912
880
|
return t._maxListeners === void 0 ? p.defaultMaxListeners : t._maxListeners;
|
|
913
881
|
}
|
|
914
882
|
p.prototype.getMaxListeners = function() {
|
|
915
|
-
return
|
|
883
|
+
return Et(this);
|
|
916
884
|
};
|
|
917
|
-
function
|
|
885
|
+
function Sr(t, e, r) {
|
|
918
886
|
if (e)
|
|
919
887
|
t.call(r);
|
|
920
888
|
else
|
|
921
|
-
for (var n = t.length, i =
|
|
889
|
+
for (var n = t.length, i = ae(t, n), o = 0; o < n; ++o)
|
|
922
890
|
i[o].call(r);
|
|
923
891
|
}
|
|
924
|
-
function
|
|
892
|
+
function Rr(t, e, r, n) {
|
|
925
893
|
if (e)
|
|
926
894
|
t.call(r, n);
|
|
927
895
|
else
|
|
928
|
-
for (var i = t.length, o =
|
|
896
|
+
for (var i = t.length, o = ae(t, i), s = 0; s < i; ++s)
|
|
929
897
|
o[s].call(r, n);
|
|
930
898
|
}
|
|
931
|
-
function
|
|
899
|
+
function Ir(t, e, r, n, i) {
|
|
932
900
|
if (e)
|
|
933
901
|
t.call(r, n, i);
|
|
934
902
|
else
|
|
935
|
-
for (var o = t.length, s =
|
|
903
|
+
for (var o = t.length, s = ae(t, o), f = 0; f < o; ++f)
|
|
936
904
|
s[f].call(r, n, i);
|
|
937
905
|
}
|
|
938
|
-
function
|
|
906
|
+
function Or(t, e, r, n, i, o) {
|
|
939
907
|
if (e)
|
|
940
908
|
t.call(r, n, i, o);
|
|
941
909
|
else
|
|
942
|
-
for (var s = t.length, f =
|
|
910
|
+
for (var s = t.length, f = ae(t, s), l = 0; l < s; ++l)
|
|
943
911
|
f[l].call(r, n, i, o);
|
|
944
912
|
}
|
|
945
|
-
function
|
|
913
|
+
function Cr(t, e, r, n) {
|
|
946
914
|
if (e)
|
|
947
915
|
t.apply(r, n);
|
|
948
916
|
else
|
|
949
|
-
for (var i = t.length, o =
|
|
917
|
+
for (var i = t.length, o = ae(t, i), s = 0; s < i; ++s)
|
|
950
918
|
o[s].apply(r, n);
|
|
951
919
|
}
|
|
952
920
|
p.prototype.emit = function(e) {
|
|
@@ -970,26 +938,28 @@ p.prototype.emit = function(e) {
|
|
|
970
938
|
return !1;
|
|
971
939
|
var c = typeof n == "function";
|
|
972
940
|
switch (i = arguments.length, i) {
|
|
941
|
+
// fast cases
|
|
973
942
|
case 1:
|
|
974
|
-
|
|
943
|
+
Sr(n, c, this);
|
|
975
944
|
break;
|
|
976
945
|
case 2:
|
|
977
|
-
|
|
946
|
+
Rr(n, c, this, arguments[1]);
|
|
978
947
|
break;
|
|
979
948
|
case 3:
|
|
980
|
-
|
|
949
|
+
Ir(n, c, this, arguments[1], arguments[2]);
|
|
981
950
|
break;
|
|
982
951
|
case 4:
|
|
983
|
-
|
|
952
|
+
Or(n, c, this, arguments[1], arguments[2], arguments[3]);
|
|
984
953
|
break;
|
|
954
|
+
// slower
|
|
985
955
|
default:
|
|
986
956
|
for (o = new Array(i - 1), s = 1; s < i; s++)
|
|
987
957
|
o[s - 1] = arguments[s];
|
|
988
|
-
|
|
958
|
+
Cr(n, c, this, o);
|
|
989
959
|
}
|
|
990
960
|
return !0;
|
|
991
961
|
};
|
|
992
|
-
function
|
|
962
|
+
function St(t, e, r, n) {
|
|
993
963
|
var i, o, s;
|
|
994
964
|
if (typeof r != "function")
|
|
995
965
|
throw new TypeError('"listener" argument must be a function');
|
|
@@ -999,24 +969,24 @@ function Et(t, e, r, n) {
|
|
|
999
969
|
r.listener ? r.listener : r
|
|
1000
970
|
), o = t._events), s = o[e]) : (o = t._events = new H(), t._eventsCount = 0), !s)
|
|
1001
971
|
s = o[e] = r, ++t._eventsCount;
|
|
1002
|
-
else if (typeof s == "function" ? s = o[e] = n ? [r, s] : [s, r] : n ? s.unshift(r) : s.push(r), !s.warned && (i =
|
|
972
|
+
else if (typeof s == "function" ? s = o[e] = n ? [r, s] : [s, r] : n ? s.unshift(r) : s.push(r), !s.warned && (i = Et(t), i && i > 0 && s.length > i)) {
|
|
1003
973
|
s.warned = !0;
|
|
1004
974
|
var f = new Error("Possible EventEmitter memory leak detected. " + s.length + " " + e + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
1005
|
-
f.name = "MaxListenersExceededWarning", f.emitter = t, f.type = e, f.count = s.length,
|
|
975
|
+
f.name = "MaxListenersExceededWarning", f.emitter = t, f.type = e, f.count = s.length, Ar(f);
|
|
1006
976
|
}
|
|
1007
977
|
return t;
|
|
1008
978
|
}
|
|
1009
|
-
function
|
|
979
|
+
function Ar(t) {
|
|
1010
980
|
typeof console.warn == "function" ? console.warn(t) : console.log(t);
|
|
1011
981
|
}
|
|
1012
982
|
p.prototype.addListener = function(e, r) {
|
|
1013
|
-
return
|
|
983
|
+
return St(this, e, r, !1);
|
|
1014
984
|
};
|
|
1015
985
|
p.prototype.on = p.prototype.addListener;
|
|
1016
986
|
p.prototype.prependListener = function(e, r) {
|
|
1017
|
-
return
|
|
987
|
+
return St(this, e, r, !0);
|
|
1018
988
|
};
|
|
1019
|
-
function
|
|
989
|
+
function Rt(t, e, r) {
|
|
1020
990
|
var n = !1;
|
|
1021
991
|
function i() {
|
|
1022
992
|
t.removeListener(e, i), n || (n = !0, r.apply(t, arguments));
|
|
@@ -1026,12 +996,12 @@ function St(t, e, r) {
|
|
|
1026
996
|
p.prototype.once = function(e, r) {
|
|
1027
997
|
if (typeof r != "function")
|
|
1028
998
|
throw new TypeError('"listener" argument must be a function');
|
|
1029
|
-
return this.on(e,
|
|
999
|
+
return this.on(e, Rt(this, e, r)), this;
|
|
1030
1000
|
};
|
|
1031
1001
|
p.prototype.prependOnceListener = function(e, r) {
|
|
1032
1002
|
if (typeof r != "function")
|
|
1033
1003
|
throw new TypeError('"listener" argument must be a function');
|
|
1034
|
-
return this.prependListener(e,
|
|
1004
|
+
return this.prependListener(e, Rt(this, e, r)), this;
|
|
1035
1005
|
};
|
|
1036
1006
|
p.prototype.removeListener = function(e, r) {
|
|
1037
1007
|
var n, i, o, s, f;
|
|
@@ -1082,13 +1052,13 @@ p.prototype.removeAllListeners = function(e) {
|
|
|
1082
1052
|
};
|
|
1083
1053
|
p.prototype.listeners = function(e) {
|
|
1084
1054
|
var r, n, i = this._events;
|
|
1085
|
-
return i ? (r = i[e], r ? typeof r == "function" ? n = [r.listener || r] : n =
|
|
1055
|
+
return i ? (r = i[e], r ? typeof r == "function" ? n = [r.listener || r] : n = Lr(r) : n = []) : n = [], n;
|
|
1086
1056
|
};
|
|
1087
1057
|
p.listenerCount = function(t, e) {
|
|
1088
|
-
return typeof t.listenerCount == "function" ? t.listenerCount(e) :
|
|
1058
|
+
return typeof t.listenerCount == "function" ? t.listenerCount(e) : It.call(t, e);
|
|
1089
1059
|
};
|
|
1090
|
-
p.prototype.listenerCount =
|
|
1091
|
-
function
|
|
1060
|
+
p.prototype.listenerCount = It;
|
|
1061
|
+
function It(t) {
|
|
1092
1062
|
var e = this._events;
|
|
1093
1063
|
if (e) {
|
|
1094
1064
|
var r = e[t];
|
|
@@ -1107,29 +1077,29 @@ function Tr(t, e) {
|
|
|
1107
1077
|
t[r] = t[n];
|
|
1108
1078
|
t.pop();
|
|
1109
1079
|
}
|
|
1110
|
-
function
|
|
1080
|
+
function ae(t, e) {
|
|
1111
1081
|
for (var r = new Array(e); e--; )
|
|
1112
1082
|
r[e] = t[e];
|
|
1113
1083
|
return r;
|
|
1114
1084
|
}
|
|
1115
|
-
function
|
|
1085
|
+
function Lr(t) {
|
|
1116
1086
|
for (var e = new Array(t.length), r = 0; r < e.length; ++r)
|
|
1117
1087
|
e[r] = t[r].listener || t[r];
|
|
1118
1088
|
return e;
|
|
1119
1089
|
}
|
|
1120
|
-
function
|
|
1090
|
+
function Ot() {
|
|
1121
1091
|
throw new Error("setTimeout has not been defined");
|
|
1122
1092
|
}
|
|
1123
|
-
function
|
|
1093
|
+
function Ct() {
|
|
1124
1094
|
throw new Error("clearTimeout has not been defined");
|
|
1125
1095
|
}
|
|
1126
|
-
var Y =
|
|
1127
|
-
typeof
|
|
1128
|
-
typeof
|
|
1129
|
-
function
|
|
1096
|
+
var Y = Ot, W = Ct;
|
|
1097
|
+
typeof ie.setTimeout == "function" && (Y = setTimeout);
|
|
1098
|
+
typeof ie.clearTimeout == "function" && (W = clearTimeout);
|
|
1099
|
+
function At(t) {
|
|
1130
1100
|
if (Y === setTimeout)
|
|
1131
1101
|
return setTimeout(t, 0);
|
|
1132
|
-
if ((Y ===
|
|
1102
|
+
if ((Y === Ot || !Y) && setTimeout)
|
|
1133
1103
|
return Y = setTimeout, setTimeout(t, 0);
|
|
1134
1104
|
try {
|
|
1135
1105
|
return Y(t, 0);
|
|
@@ -1141,10 +1111,10 @@ function Ct(t) {
|
|
|
1141
1111
|
}
|
|
1142
1112
|
}
|
|
1143
1113
|
}
|
|
1144
|
-
function
|
|
1114
|
+
function Nr(t) {
|
|
1145
1115
|
if (W === clearTimeout)
|
|
1146
1116
|
return clearTimeout(t);
|
|
1147
|
-
if ((W ===
|
|
1117
|
+
if ((W === Ct || !W) && clearTimeout)
|
|
1148
1118
|
return W = clearTimeout, clearTimeout(t);
|
|
1149
1119
|
try {
|
|
1150
1120
|
return W(t);
|
|
@@ -1156,28 +1126,28 @@ function Dr(t) {
|
|
|
1156
1126
|
}
|
|
1157
1127
|
}
|
|
1158
1128
|
}
|
|
1159
|
-
var
|
|
1160
|
-
function
|
|
1161
|
-
!
|
|
1129
|
+
var z = [], ne = !1, ee, me = -1;
|
|
1130
|
+
function Dr() {
|
|
1131
|
+
!ne || !ee || (ne = !1, ee.length ? z = ee.concat(z) : me = -1, z.length && Tt());
|
|
1162
1132
|
}
|
|
1163
|
-
function
|
|
1164
|
-
if (!
|
|
1165
|
-
var t =
|
|
1166
|
-
|
|
1167
|
-
for (var e =
|
|
1168
|
-
for (
|
|
1169
|
-
|
|
1170
|
-
|
|
1133
|
+
function Tt() {
|
|
1134
|
+
if (!ne) {
|
|
1135
|
+
var t = At(Dr);
|
|
1136
|
+
ne = !0;
|
|
1137
|
+
for (var e = z.length; e; ) {
|
|
1138
|
+
for (ee = z, z = []; ++me < e; )
|
|
1139
|
+
ee && ee[me].run();
|
|
1140
|
+
me = -1, e = z.length;
|
|
1171
1141
|
}
|
|
1172
|
-
|
|
1142
|
+
ee = null, ne = !1, Nr(t);
|
|
1173
1143
|
}
|
|
1174
1144
|
}
|
|
1175
|
-
function
|
|
1145
|
+
function B(t) {
|
|
1176
1146
|
var e = new Array(arguments.length - 1);
|
|
1177
1147
|
if (arguments.length > 1)
|
|
1178
1148
|
for (var r = 1; r < arguments.length; r++)
|
|
1179
1149
|
e[r - 1] = arguments[r];
|
|
1180
|
-
|
|
1150
|
+
z.push(new Lt(t, e)), z.length === 1 && !ne && At(Tt);
|
|
1181
1151
|
}
|
|
1182
1152
|
function Lt(t, e) {
|
|
1183
1153
|
this.fun = t, this.array = e;
|
|
@@ -1185,58 +1155,10 @@ function Lt(t, e) {
|
|
|
1185
1155
|
Lt.prototype.run = function() {
|
|
1186
1156
|
this.fun.apply(null, this.array);
|
|
1187
1157
|
};
|
|
1188
|
-
var
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
function Zr(t) {
|
|
1193
|
-
throw new Error("process.binding is not supported");
|
|
1194
|
-
}
|
|
1195
|
-
function Xr() {
|
|
1196
|
-
return "/";
|
|
1197
|
-
}
|
|
1198
|
-
function Kr(t) {
|
|
1199
|
-
throw new Error("process.chdir is not supported");
|
|
1200
|
-
}
|
|
1201
|
-
function en() {
|
|
1202
|
-
return 0;
|
|
1203
|
-
}
|
|
1204
|
-
var ne = oe.performance || {}, tn = ne.now || ne.mozNow || ne.msNow || ne.oNow || ne.webkitNow || function() {
|
|
1205
|
-
return (/* @__PURE__ */ new Date()).getTime();
|
|
1206
|
-
};
|
|
1207
|
-
function rn(t) {
|
|
1208
|
-
var e = tn.call(ne) * 1e-3, r = Math.floor(e), n = Math.floor(e % 1 * 1e9);
|
|
1209
|
-
return t && (r = r - t[0], n = n - t[1], n < 0 && (r--, n += 1e9)), [r, n];
|
|
1210
|
-
}
|
|
1211
|
-
var nn = /* @__PURE__ */ new Date();
|
|
1212
|
-
function on() {
|
|
1213
|
-
var t = /* @__PURE__ */ new Date(), e = t - nn;
|
|
1214
|
-
return e / 1e3;
|
|
1215
|
-
}
|
|
1216
|
-
var _e = {
|
|
1217
|
-
nextTick: D,
|
|
1218
|
-
title: Mr,
|
|
1219
|
-
browser: Ur,
|
|
1220
|
-
env: kr,
|
|
1221
|
-
argv: Pr,
|
|
1222
|
-
version: jr,
|
|
1223
|
-
versions: $r,
|
|
1224
|
-
on: Vr,
|
|
1225
|
-
addListener: Jr,
|
|
1226
|
-
once: Yr,
|
|
1227
|
-
off: Wr,
|
|
1228
|
-
removeListener: Qr,
|
|
1229
|
-
removeAllListeners: Hr,
|
|
1230
|
-
emit: Gr,
|
|
1231
|
-
binding: Zr,
|
|
1232
|
-
cwd: Xr,
|
|
1233
|
-
chdir: Kr,
|
|
1234
|
-
umask: en,
|
|
1235
|
-
hrtime: rn,
|
|
1236
|
-
platform: Br,
|
|
1237
|
-
release: qr,
|
|
1238
|
-
config: zr,
|
|
1239
|
-
uptime: on
|
|
1158
|
+
var Fr = {}, se = ie.performance || {};
|
|
1159
|
+
se.now || se.mozNow || se.msNow || se.oNow || se.webkitNow;
|
|
1160
|
+
var ge = {
|
|
1161
|
+
env: Fr
|
|
1240
1162
|
}, Ue;
|
|
1241
1163
|
typeof Object.create == "function" ? Ue = function(e, r) {
|
|
1242
1164
|
e.super_ = r, e.prototype = Object.create(r.prototype, {
|
|
@@ -1253,18 +1175,16 @@ typeof Object.create == "function" ? Ue = function(e, r) {
|
|
|
1253
1175
|
};
|
|
1254
1176
|
n.prototype = r.prototype, e.prototype = new n(), e.prototype.constructor = e;
|
|
1255
1177
|
};
|
|
1256
|
-
var
|
|
1257
|
-
function
|
|
1178
|
+
var oe = Ue, Mr = /%[sdj%]/g;
|
|
1179
|
+
function Br(t) {
|
|
1258
1180
|
if (!Ve(t)) {
|
|
1259
1181
|
for (var e = [], r = 0; r < arguments.length; r++)
|
|
1260
1182
|
e.push(G(arguments[r]));
|
|
1261
1183
|
return e.join(" ");
|
|
1262
1184
|
}
|
|
1263
|
-
for (var r = 1, n = arguments, i = n.length, o = String(t).replace(
|
|
1264
|
-
if (f === "%%")
|
|
1265
|
-
|
|
1266
|
-
if (r >= i)
|
|
1267
|
-
return f;
|
|
1185
|
+
for (var r = 1, n = arguments, i = n.length, o = String(t).replace(Mr, function(f) {
|
|
1186
|
+
if (f === "%%") return "%";
|
|
1187
|
+
if (r >= i) return f;
|
|
1268
1188
|
switch (f) {
|
|
1269
1189
|
case "%s":
|
|
1270
1190
|
return String(n[r++]);
|
|
@@ -1280,47 +1200,47 @@ function fn(t) {
|
|
|
1280
1200
|
return f;
|
|
1281
1201
|
}
|
|
1282
1202
|
}), s = n[r]; r < i; s = n[++r])
|
|
1283
|
-
ze(s) || !
|
|
1203
|
+
ze(s) || !le(s) ? o += " " + s : o += " " + G(s);
|
|
1284
1204
|
return o;
|
|
1285
1205
|
}
|
|
1286
|
-
function
|
|
1287
|
-
if (Q(
|
|
1206
|
+
function Nt(t, e) {
|
|
1207
|
+
if (Q(ie.process))
|
|
1288
1208
|
return function() {
|
|
1289
|
-
return
|
|
1209
|
+
return Nt(t, e).apply(this, arguments);
|
|
1290
1210
|
};
|
|
1291
|
-
if (
|
|
1211
|
+
if (ge.noDeprecation === !0)
|
|
1292
1212
|
return t;
|
|
1293
1213
|
var r = !1;
|
|
1294
1214
|
function n() {
|
|
1295
1215
|
if (!r) {
|
|
1296
|
-
if (
|
|
1216
|
+
if (ge.throwDeprecation)
|
|
1297
1217
|
throw new Error(e);
|
|
1298
|
-
|
|
1218
|
+
ge.traceDeprecation ? console.trace(e) : console.error(e), r = !0;
|
|
1299
1219
|
}
|
|
1300
1220
|
return t.apply(this, arguments);
|
|
1301
1221
|
}
|
|
1302
1222
|
return n;
|
|
1303
1223
|
}
|
|
1304
|
-
var
|
|
1305
|
-
function
|
|
1306
|
-
if (Q(Ce) && (Ce =
|
|
1224
|
+
var pe = {}, Ce;
|
|
1225
|
+
function Ur(t) {
|
|
1226
|
+
if (Q(Ce) && (Ce = ge.env.NODE_DEBUG || ""), t = t.toUpperCase(), !pe[t])
|
|
1307
1227
|
if (new RegExp("\\b" + t + "\\b", "i").test(Ce)) {
|
|
1308
1228
|
var e = 0;
|
|
1309
|
-
|
|
1310
|
-
var r =
|
|
1229
|
+
pe[t] = function() {
|
|
1230
|
+
var r = Br.apply(null, arguments);
|
|
1311
1231
|
console.error("%s %d: %s", t, e, r);
|
|
1312
1232
|
};
|
|
1313
1233
|
} else
|
|
1314
|
-
|
|
1234
|
+
pe[t] = function() {
|
|
1315
1235
|
};
|
|
1316
|
-
return
|
|
1236
|
+
return pe[t];
|
|
1317
1237
|
}
|
|
1318
1238
|
function G(t, e) {
|
|
1319
1239
|
var r = {
|
|
1320
1240
|
seen: [],
|
|
1321
|
-
stylize:
|
|
1241
|
+
stylize: Pr
|
|
1322
1242
|
};
|
|
1323
|
-
return arguments.length >= 3 && (r.depth = arguments[2]), arguments.length >= 4 && (r.colors = arguments[3]),
|
|
1243
|
+
return arguments.length >= 3 && (r.depth = arguments[2]), arguments.length >= 4 && (r.colors = arguments[3]), Dt(e) ? r.showHidden = e : e && Yr(r, e), Q(r.showHidden) && (r.showHidden = !1), Q(r.depth) && (r.depth = 2), Q(r.colors) && (r.colors = !1), Q(r.customInspect) && (r.customInspect = !0), r.colors && (r.stylize = kr), ye(r, t, r.depth);
|
|
1324
1244
|
}
|
|
1325
1245
|
G.colors = {
|
|
1326
1246
|
bold: [1, 22],
|
|
@@ -1348,69 +1268,69 @@ G.styles = {
|
|
|
1348
1268
|
// "name": intentionally not styling
|
|
1349
1269
|
regexp: "red"
|
|
1350
1270
|
};
|
|
1351
|
-
function
|
|
1271
|
+
function kr(t, e) {
|
|
1352
1272
|
var r = G.styles[e];
|
|
1353
1273
|
return r ? "\x1B[" + G.colors[r][0] + "m" + t + "\x1B[" + G.colors[r][1] + "m" : t;
|
|
1354
1274
|
}
|
|
1355
|
-
function
|
|
1275
|
+
function Pr(t, e) {
|
|
1356
1276
|
return t;
|
|
1357
1277
|
}
|
|
1358
|
-
function
|
|
1278
|
+
function jr(t) {
|
|
1359
1279
|
var e = {};
|
|
1360
1280
|
return t.forEach(function(r, n) {
|
|
1361
1281
|
e[r] = !0;
|
|
1362
1282
|
}), e;
|
|
1363
1283
|
}
|
|
1364
|
-
function
|
|
1284
|
+
function ye(t, e, r) {
|
|
1365
1285
|
if (t.customInspect && e && Ne(e.inspect) && // Filter out the util module, it's inspect function is special
|
|
1366
1286
|
e.inspect !== G && // Also filter out any prototype objects using the circular check.
|
|
1367
1287
|
!(e.constructor && e.constructor.prototype === e)) {
|
|
1368
1288
|
var n = e.inspect(r, t);
|
|
1369
|
-
return Ve(n) || (n =
|
|
1289
|
+
return Ve(n) || (n = ye(t, n, r)), n;
|
|
1370
1290
|
}
|
|
1371
|
-
var i =
|
|
1291
|
+
var i = $r(t, e);
|
|
1372
1292
|
if (i)
|
|
1373
1293
|
return i;
|
|
1374
|
-
var o = Object.keys(e), s =
|
|
1375
|
-
if (t.showHidden && (o = Object.getOwnPropertyNames(e)),
|
|
1294
|
+
var o = Object.keys(e), s = jr(o);
|
|
1295
|
+
if (t.showHidden && (o = Object.getOwnPropertyNames(e)), Le(e) && (o.indexOf("message") >= 0 || o.indexOf("description") >= 0))
|
|
1376
1296
|
return Ae(e);
|
|
1377
1297
|
if (o.length === 0) {
|
|
1378
1298
|
if (Ne(e)) {
|
|
1379
1299
|
var f = e.name ? ": " + e.name : "";
|
|
1380
1300
|
return t.stylize("[Function" + f + "]", "special");
|
|
1381
1301
|
}
|
|
1382
|
-
if (
|
|
1302
|
+
if (Te(e))
|
|
1383
1303
|
return t.stylize(RegExp.prototype.toString.call(e), "regexp");
|
|
1384
|
-
if (
|
|
1304
|
+
if (Xe(e))
|
|
1385
1305
|
return t.stylize(Date.prototype.toString.call(e), "date");
|
|
1386
|
-
if (
|
|
1306
|
+
if (Le(e))
|
|
1387
1307
|
return Ae(e);
|
|
1388
1308
|
}
|
|
1389
1309
|
var l = "", u = !1, h = ["{", "}"];
|
|
1390
|
-
if (
|
|
1310
|
+
if (Vr(e) && (u = !0, h = ["[", "]"]), Ne(e)) {
|
|
1391
1311
|
var c = e.name ? ": " + e.name : "";
|
|
1392
1312
|
l = " [Function" + c + "]";
|
|
1393
1313
|
}
|
|
1394
|
-
if (
|
|
1314
|
+
if (Te(e) && (l = " " + RegExp.prototype.toString.call(e)), Xe(e) && (l = " " + Date.prototype.toUTCString.call(e)), Le(e) && (l = " " + Ae(e)), o.length === 0 && (!u || e.length == 0))
|
|
1395
1315
|
return h[0] + l + h[1];
|
|
1396
1316
|
if (r < 0)
|
|
1397
|
-
return
|
|
1317
|
+
return Te(e) ? t.stylize(RegExp.prototype.toString.call(e), "regexp") : t.stylize("[Object]", "special");
|
|
1398
1318
|
t.seen.push(e);
|
|
1399
1319
|
var g;
|
|
1400
|
-
return u ? g =
|
|
1320
|
+
return u ? g = qr(t, e, r, s, o) : g = o.map(function(v) {
|
|
1401
1321
|
return ke(t, e, r, s, v, u);
|
|
1402
|
-
}), t.seen.pop(),
|
|
1322
|
+
}), t.seen.pop(), zr(g, l, h);
|
|
1403
1323
|
}
|
|
1404
|
-
function
|
|
1324
|
+
function $r(t, e) {
|
|
1405
1325
|
if (Q(e))
|
|
1406
1326
|
return t.stylize("undefined", "undefined");
|
|
1407
1327
|
if (Ve(e)) {
|
|
1408
1328
|
var r = "'" + JSON.stringify(e).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'";
|
|
1409
1329
|
return t.stylize(r, "string");
|
|
1410
1330
|
}
|
|
1411
|
-
if (
|
|
1331
|
+
if (Jr(e))
|
|
1412
1332
|
return t.stylize("" + e, "number");
|
|
1413
|
-
if (
|
|
1333
|
+
if (Dt(e))
|
|
1414
1334
|
return t.stylize("" + e, "boolean");
|
|
1415
1335
|
if (ze(e))
|
|
1416
1336
|
return t.stylize("null", "null");
|
|
@@ -1418,9 +1338,9 @@ function cn(t, e) {
|
|
|
1418
1338
|
function Ae(t) {
|
|
1419
1339
|
return "[" + Error.prototype.toString.call(t) + "]";
|
|
1420
1340
|
}
|
|
1421
|
-
function
|
|
1341
|
+
function qr(t, e, r, n, i) {
|
|
1422
1342
|
for (var o = [], s = 0, f = e.length; s < f; ++s)
|
|
1423
|
-
|
|
1343
|
+
Ft(e, String(s)) ? o.push(ke(
|
|
1424
1344
|
t,
|
|
1425
1345
|
e,
|
|
1426
1346
|
r,
|
|
@@ -1441,7 +1361,7 @@ function dn(t, e, r, n, i) {
|
|
|
1441
1361
|
}
|
|
1442
1362
|
function ke(t, e, r, n, i, o) {
|
|
1443
1363
|
var s, f, l;
|
|
1444
|
-
if (l = Object.getOwnPropertyDescriptor(e, i) || { value: e[i] }, l.get ? l.set ? f = t.stylize("[Getter/Setter]", "special") : f = t.stylize("[Getter]", "special") : l.set && (f = t.stylize("[Setter]", "special")),
|
|
1364
|
+
if (l = Object.getOwnPropertyDescriptor(e, i) || { value: e[i] }, l.get ? l.set ? f = t.stylize("[Getter/Setter]", "special") : f = t.stylize("[Getter]", "special") : l.set && (f = t.stylize("[Setter]", "special")), Ft(n, i) || (s = "[" + i + "]"), f || (t.seen.indexOf(l.value) < 0 ? (ze(r) ? f = ye(t, l.value, null) : f = ye(t, l.value, r - 1), f.indexOf(`
|
|
1445
1365
|
`) > -1 && (o ? f = f.split(`
|
|
1446
1366
|
`).map(function(u) {
|
|
1447
1367
|
return " " + u;
|
|
@@ -1458,7 +1378,7 @@ function ke(t, e, r, n, i, o) {
|
|
|
1458
1378
|
}
|
|
1459
1379
|
return s + ": " + f;
|
|
1460
1380
|
}
|
|
1461
|
-
function
|
|
1381
|
+
function zr(t, e, r) {
|
|
1462
1382
|
var n = t.reduce(function(i, o) {
|
|
1463
1383
|
return o.indexOf(`
|
|
1464
1384
|
`) >= 0, i + o.replace(/\u001b\[\d\d?m/g, "").length + 1;
|
|
@@ -1467,16 +1387,16 @@ function pn(t, e, r) {
|
|
|
1467
1387
|
`) + " " + t.join(`,
|
|
1468
1388
|
`) + " " + r[1] : r[0] + e + " " + t.join(", ") + " " + r[1];
|
|
1469
1389
|
}
|
|
1470
|
-
function
|
|
1390
|
+
function Vr(t) {
|
|
1471
1391
|
return Array.isArray(t);
|
|
1472
1392
|
}
|
|
1473
|
-
function
|
|
1393
|
+
function Dt(t) {
|
|
1474
1394
|
return typeof t == "boolean";
|
|
1475
1395
|
}
|
|
1476
1396
|
function ze(t) {
|
|
1477
1397
|
return t === null;
|
|
1478
1398
|
}
|
|
1479
|
-
function
|
|
1399
|
+
function Jr(t) {
|
|
1480
1400
|
return typeof t == "number";
|
|
1481
1401
|
}
|
|
1482
1402
|
function Ve(t) {
|
|
@@ -1485,17 +1405,17 @@ function Ve(t) {
|
|
|
1485
1405
|
function Q(t) {
|
|
1486
1406
|
return t === void 0;
|
|
1487
1407
|
}
|
|
1488
|
-
function
|
|
1489
|
-
return
|
|
1408
|
+
function Te(t) {
|
|
1409
|
+
return le(t) && Je(t) === "[object RegExp]";
|
|
1490
1410
|
}
|
|
1491
|
-
function
|
|
1411
|
+
function le(t) {
|
|
1492
1412
|
return typeof t == "object" && t !== null;
|
|
1493
1413
|
}
|
|
1494
|
-
function
|
|
1495
|
-
return
|
|
1414
|
+
function Xe(t) {
|
|
1415
|
+
return le(t) && Je(t) === "[object Date]";
|
|
1496
1416
|
}
|
|
1497
|
-
function
|
|
1498
|
-
return
|
|
1417
|
+
function Le(t) {
|
|
1418
|
+
return le(t) && (Je(t) === "[object Error]" || t instanceof Error);
|
|
1499
1419
|
}
|
|
1500
1420
|
function Ne(t) {
|
|
1501
1421
|
return typeof t == "function";
|
|
@@ -1503,14 +1423,13 @@ function Ne(t) {
|
|
|
1503
1423
|
function Je(t) {
|
|
1504
1424
|
return Object.prototype.toString.call(t);
|
|
1505
1425
|
}
|
|
1506
|
-
function
|
|
1507
|
-
if (!e || !
|
|
1508
|
-
return t;
|
|
1426
|
+
function Yr(t, e) {
|
|
1427
|
+
if (!e || !le(e)) return t;
|
|
1509
1428
|
for (var r = Object.keys(e), n = r.length; n--; )
|
|
1510
1429
|
t[r[n]] = e[r[n]];
|
|
1511
1430
|
return t;
|
|
1512
1431
|
}
|
|
1513
|
-
function
|
|
1432
|
+
function Ft(t, e) {
|
|
1514
1433
|
return Object.prototype.hasOwnProperty.call(t, e);
|
|
1515
1434
|
}
|
|
1516
1435
|
function te() {
|
|
@@ -1534,22 +1453,19 @@ te.prototype.clear = function() {
|
|
|
1534
1453
|
this.head = this.tail = null, this.length = 0;
|
|
1535
1454
|
};
|
|
1536
1455
|
te.prototype.join = function(t) {
|
|
1537
|
-
if (this.length === 0)
|
|
1538
|
-
return "";
|
|
1456
|
+
if (this.length === 0) return "";
|
|
1539
1457
|
for (var e = this.head, r = "" + e.data; e = e.next; )
|
|
1540
1458
|
r += t + e.data;
|
|
1541
1459
|
return r;
|
|
1542
1460
|
};
|
|
1543
1461
|
te.prototype.concat = function(t) {
|
|
1544
|
-
if (this.length === 0)
|
|
1545
|
-
|
|
1546
|
-
if (this.length === 1)
|
|
1547
|
-
return this.head.data;
|
|
1462
|
+
if (this.length === 0) return a.alloc(0);
|
|
1463
|
+
if (this.length === 1) return this.head.data;
|
|
1548
1464
|
for (var e = a.allocUnsafe(t >>> 0), r = this.head, n = 0; r; )
|
|
1549
1465
|
r.data.copy(e, n), n += r.data.length, r = r.next;
|
|
1550
1466
|
return e;
|
|
1551
1467
|
};
|
|
1552
|
-
var
|
|
1468
|
+
var Wr = a.isEncoding || function(t) {
|
|
1553
1469
|
switch (t && t.toLowerCase()) {
|
|
1554
1470
|
case "hex":
|
|
1555
1471
|
case "utf8":
|
|
@@ -1567,29 +1483,29 @@ var wn = a.isEncoding || function(t) {
|
|
|
1567
1483
|
return !1;
|
|
1568
1484
|
}
|
|
1569
1485
|
};
|
|
1570
|
-
function
|
|
1571
|
-
if (t && !
|
|
1486
|
+
function Qr(t) {
|
|
1487
|
+
if (t && !Wr(t))
|
|
1572
1488
|
throw new Error("Unknown encoding: " + t);
|
|
1573
1489
|
}
|
|
1574
|
-
function
|
|
1575
|
-
switch (this.encoding = (t || "utf8").toLowerCase().replace(/[-_]/, ""),
|
|
1490
|
+
function ue(t) {
|
|
1491
|
+
switch (this.encoding = (t || "utf8").toLowerCase().replace(/[-_]/, ""), Qr(t), this.encoding) {
|
|
1576
1492
|
case "utf8":
|
|
1577
1493
|
this.surrogateSize = 3;
|
|
1578
1494
|
break;
|
|
1579
1495
|
case "ucs2":
|
|
1580
1496
|
case "utf16le":
|
|
1581
|
-
this.surrogateSize = 2, this.detectIncompleteChar =
|
|
1497
|
+
this.surrogateSize = 2, this.detectIncompleteChar = Gr;
|
|
1582
1498
|
break;
|
|
1583
1499
|
case "base64":
|
|
1584
|
-
this.surrogateSize = 3, this.detectIncompleteChar =
|
|
1500
|
+
this.surrogateSize = 3, this.detectIncompleteChar = Zr;
|
|
1585
1501
|
break;
|
|
1586
1502
|
default:
|
|
1587
|
-
this.write =
|
|
1503
|
+
this.write = Hr;
|
|
1588
1504
|
return;
|
|
1589
1505
|
}
|
|
1590
1506
|
this.charBuffer = new a(6), this.charReceived = 0, this.charLength = 0;
|
|
1591
1507
|
}
|
|
1592
|
-
|
|
1508
|
+
ue.prototype.write = function(t) {
|
|
1593
1509
|
for (var e = ""; this.charLength; ) {
|
|
1594
1510
|
var r = t.length >= this.charLength - this.charReceived ? this.charLength - this.charReceived : t.length;
|
|
1595
1511
|
if (t.copy(this.charBuffer, this.charReceived, 0, r), this.charReceived += r, this.charReceived < this.charLength)
|
|
@@ -1614,7 +1530,7 @@ ce.prototype.write = function(t) {
|
|
|
1614
1530
|
}
|
|
1615
1531
|
return e;
|
|
1616
1532
|
};
|
|
1617
|
-
|
|
1533
|
+
ue.prototype.detectIncompleteChar = function(t) {
|
|
1618
1534
|
for (var e = t.length >= 3 ? 3 : t.length; e > 0; e--) {
|
|
1619
1535
|
var r = t[t.length - e];
|
|
1620
1536
|
if (e == 1 && r >> 5 == 6) {
|
|
@@ -1632,7 +1548,7 @@ ce.prototype.detectIncompleteChar = function(t) {
|
|
|
1632
1548
|
}
|
|
1633
1549
|
this.charReceived = e;
|
|
1634
1550
|
};
|
|
1635
|
-
|
|
1551
|
+
ue.prototype.end = function(t) {
|
|
1636
1552
|
var e = "";
|
|
1637
1553
|
if (t && t.length && (e = this.write(t)), this.charReceived) {
|
|
1638
1554
|
var r = this.charReceived, n = this.charBuffer, i = this.encoding;
|
|
@@ -1640,53 +1556,52 @@ ce.prototype.end = function(t) {
|
|
|
1640
1556
|
}
|
|
1641
1557
|
return e;
|
|
1642
1558
|
};
|
|
1643
|
-
function
|
|
1559
|
+
function Hr(t) {
|
|
1644
1560
|
return t.toString(this.encoding);
|
|
1645
1561
|
}
|
|
1646
|
-
function
|
|
1562
|
+
function Gr(t) {
|
|
1647
1563
|
this.charReceived = t.length % 2, this.charLength = this.charReceived ? 2 : 0;
|
|
1648
1564
|
}
|
|
1649
|
-
function
|
|
1565
|
+
function Zr(t) {
|
|
1650
1566
|
this.charReceived = t.length % 3, this.charLength = this.charReceived ? 3 : 0;
|
|
1651
1567
|
}
|
|
1652
|
-
E.ReadableState =
|
|
1653
|
-
var y =
|
|
1654
|
-
|
|
1655
|
-
function
|
|
1568
|
+
E.ReadableState = Mt;
|
|
1569
|
+
var y = Ur("stream");
|
|
1570
|
+
oe(E, p);
|
|
1571
|
+
function Xr(t, e, r) {
|
|
1656
1572
|
if (typeof t.prependListener == "function")
|
|
1657
1573
|
return t.prependListener(e, r);
|
|
1658
1574
|
!t._events || !t._events[e] ? t.on(e, r) : Array.isArray(t._events[e]) ? t._events[e].unshift(r) : t._events[e] = [r, t._events[e]];
|
|
1659
1575
|
}
|
|
1660
|
-
function
|
|
1576
|
+
function Kr(t, e) {
|
|
1661
1577
|
return t.listeners(e).length;
|
|
1662
1578
|
}
|
|
1663
|
-
function
|
|
1664
|
-
t = t || {}, this.objectMode = !!t.objectMode, e instanceof
|
|
1579
|
+
function Mt(t, e) {
|
|
1580
|
+
t = t || {}, this.objectMode = !!t.objectMode, e instanceof M && (this.objectMode = this.objectMode || !!t.readableObjectMode);
|
|
1665
1581
|
var r = t.highWaterMark, n = this.objectMode ? 16 : 16 * 1024;
|
|
1666
|
-
this.highWaterMark = r || r === 0 ? r : n, this.highWaterMark = ~~this.highWaterMark, this.buffer = new te(), this.length = 0, this.pipes = null, this.pipesCount = 0, this.flowing = null, this.ended = !1, this.endEmitted = !1, this.reading = !1, this.sync = !0, this.needReadable = !1, this.emittedReadable = !1, this.readableListening = !1, this.resumeScheduled = !1, this.defaultEncoding = t.defaultEncoding || "utf8", this.ranOut = !1, this.awaitDrain = 0, this.readingMore = !1, this.decoder = null, this.encoding = null, t.encoding && (this.decoder = new
|
|
1582
|
+
this.highWaterMark = r || r === 0 ? r : n, this.highWaterMark = ~~this.highWaterMark, this.buffer = new te(), this.length = 0, this.pipes = null, this.pipesCount = 0, this.flowing = null, this.ended = !1, this.endEmitted = !1, this.reading = !1, this.sync = !0, this.needReadable = !1, this.emittedReadable = !1, this.readableListening = !1, this.resumeScheduled = !1, this.defaultEncoding = t.defaultEncoding || "utf8", this.ranOut = !1, this.awaitDrain = 0, this.readingMore = !1, this.decoder = null, this.encoding = null, t.encoding && (this.decoder = new ue(t.encoding), this.encoding = t.encoding);
|
|
1667
1583
|
}
|
|
1668
1584
|
function E(t) {
|
|
1669
|
-
if (!(this instanceof E))
|
|
1670
|
-
|
|
1671
|
-
this._readableState = new Ft(t, this), this.readable = !0, t && typeof t.read == "function" && (this._read = t.read), p.call(this);
|
|
1585
|
+
if (!(this instanceof E)) return new E(t);
|
|
1586
|
+
this._readableState = new Mt(t, this), this.readable = !0, t && typeof t.read == "function" && (this._read = t.read), p.call(this);
|
|
1672
1587
|
}
|
|
1673
1588
|
E.prototype.push = function(t, e) {
|
|
1674
1589
|
var r = this._readableState;
|
|
1675
|
-
return !r.objectMode && typeof t == "string" && (e = e || r.defaultEncoding, e !== r.encoding && (t = a.from(t, e), e = "")),
|
|
1590
|
+
return !r.objectMode && typeof t == "string" && (e = e || r.defaultEncoding, e !== r.encoding && (t = a.from(t, e), e = "")), Bt(this, r, t, e, !1);
|
|
1676
1591
|
};
|
|
1677
1592
|
E.prototype.unshift = function(t) {
|
|
1678
1593
|
var e = this._readableState;
|
|
1679
|
-
return
|
|
1594
|
+
return Bt(this, e, t, "", !0);
|
|
1680
1595
|
};
|
|
1681
1596
|
E.prototype.isPaused = function() {
|
|
1682
1597
|
return this._readableState.flowing === !1;
|
|
1683
1598
|
};
|
|
1684
|
-
function
|
|
1685
|
-
var o =
|
|
1599
|
+
function Bt(t, e, r, n, i) {
|
|
1600
|
+
var o = rn(e, r);
|
|
1686
1601
|
if (o)
|
|
1687
1602
|
t.emit("error", o);
|
|
1688
1603
|
else if (r === null)
|
|
1689
|
-
e.reading = !1,
|
|
1604
|
+
e.reading = !1, nn(t, e);
|
|
1690
1605
|
else if (e.objectMode || r && r.length > 0)
|
|
1691
1606
|
if (e.ended && !i) {
|
|
1692
1607
|
var s = new Error("stream.push() after EOF");
|
|
@@ -1696,61 +1611,60 @@ function Mt(t, e, r, n, i) {
|
|
|
1696
1611
|
t.emit("error", f);
|
|
1697
1612
|
} else {
|
|
1698
1613
|
var l;
|
|
1699
|
-
e.decoder && !i && !n && (r = e.decoder.write(r), l = !e.objectMode && r.length === 0), i || (e.reading = !1), l || (e.flowing && e.length === 0 && !e.sync ? (t.emit("data", r), t.read(0)) : (e.length += e.objectMode ? 1 : r.length, i ? e.buffer.unshift(r) : e.buffer.push(r), e.needReadable &&
|
|
1614
|
+
e.decoder && !i && !n && (r = e.decoder.write(r), l = !e.objectMode && r.length === 0), i || (e.reading = !1), l || (e.flowing && e.length === 0 && !e.sync ? (t.emit("data", r), t.read(0)) : (e.length += e.objectMode ? 1 : r.length, i ? e.buffer.unshift(r) : e.buffer.push(r), e.needReadable && Se(t))), on(t, e);
|
|
1700
1615
|
}
|
|
1701
|
-
else
|
|
1702
|
-
|
|
1703
|
-
return Rn(e);
|
|
1616
|
+
else i || (e.reading = !1);
|
|
1617
|
+
return en(e);
|
|
1704
1618
|
}
|
|
1705
|
-
function
|
|
1619
|
+
function en(t) {
|
|
1706
1620
|
return !t.ended && (t.needReadable || t.length < t.highWaterMark || t.length === 0);
|
|
1707
1621
|
}
|
|
1708
1622
|
E.prototype.setEncoding = function(t) {
|
|
1709
|
-
return this._readableState.decoder = new
|
|
1623
|
+
return this._readableState.decoder = new ue(t), this._readableState.encoding = t, this;
|
|
1710
1624
|
};
|
|
1711
|
-
var
|
|
1712
|
-
function
|
|
1713
|
-
return t >=
|
|
1625
|
+
var Ke = 8388608;
|
|
1626
|
+
function tn(t) {
|
|
1627
|
+
return t >= Ke ? t = Ke : (t--, t |= t >>> 1, t |= t >>> 2, t |= t >>> 4, t |= t >>> 8, t |= t >>> 16, t++), t;
|
|
1714
1628
|
}
|
|
1715
|
-
function
|
|
1716
|
-
return t <= 0 || e.length === 0 && e.ended ? 0 : e.objectMode ? 1 : t !== t ? e.flowing && e.length ? e.buffer.head.data.length : e.length : (t > e.highWaterMark && (e.highWaterMark =
|
|
1629
|
+
function et(t, e) {
|
|
1630
|
+
return t <= 0 || e.length === 0 && e.ended ? 0 : e.objectMode ? 1 : t !== t ? e.flowing && e.length ? e.buffer.head.data.length : e.length : (t > e.highWaterMark && (e.highWaterMark = tn(t)), t <= e.length ? t : e.ended ? e.length : (e.needReadable = !0, 0));
|
|
1717
1631
|
}
|
|
1718
1632
|
E.prototype.read = function(t) {
|
|
1719
1633
|
y("read", t), t = parseInt(t, 10);
|
|
1720
1634
|
var e = this._readableState, r = t;
|
|
1721
1635
|
if (t !== 0 && (e.emittedReadable = !1), t === 0 && e.needReadable && (e.length >= e.highWaterMark || e.ended))
|
|
1722
|
-
return y("read: emitReadable", e.length, e.ended), e.length === 0 && e.ended ? De(this) :
|
|
1723
|
-
if (t =
|
|
1636
|
+
return y("read: emitReadable", e.length, e.ended), e.length === 0 && e.ended ? De(this) : Se(this), null;
|
|
1637
|
+
if (t = et(t, e), t === 0 && e.ended)
|
|
1724
1638
|
return e.length === 0 && De(this), null;
|
|
1725
1639
|
var n = e.needReadable;
|
|
1726
|
-
y("need readable", n), (e.length === 0 || e.length - t < e.highWaterMark) && (n = !0, y("length less than watermark", n)), e.ended || e.reading ? (n = !1, y("reading or ended", n)) : n && (y("do read"), e.reading = !0, e.sync = !0, e.length === 0 && (e.needReadable = !0), this._read(e.highWaterMark), e.sync = !1, e.reading || (t =
|
|
1640
|
+
y("need readable", n), (e.length === 0 || e.length - t < e.highWaterMark) && (n = !0, y("length less than watermark", n)), e.ended || e.reading ? (n = !1, y("reading or ended", n)) : n && (y("do read"), e.reading = !0, e.sync = !0, e.length === 0 && (e.needReadable = !0), this._read(e.highWaterMark), e.sync = !1, e.reading || (t = et(r, e)));
|
|
1727
1641
|
var i;
|
|
1728
|
-
return t > 0 ? i =
|
|
1642
|
+
return t > 0 ? i = Ut(t, e) : i = null, i === null ? (e.needReadable = !0, t = 0) : e.length -= t, e.length === 0 && (e.ended || (e.needReadable = !0), r !== t && e.ended && De(this)), i !== null && this.emit("data", i), i;
|
|
1729
1643
|
};
|
|
1730
|
-
function
|
|
1644
|
+
function rn(t, e) {
|
|
1731
1645
|
var r = null;
|
|
1732
|
-
return !
|
|
1646
|
+
return !L(e) && typeof e != "string" && e !== null && e !== void 0 && !t.objectMode && (r = new TypeError("Invalid non-string/buffer chunk")), r;
|
|
1733
1647
|
}
|
|
1734
|
-
function
|
|
1648
|
+
function nn(t, e) {
|
|
1735
1649
|
if (!e.ended) {
|
|
1736
1650
|
if (e.decoder) {
|
|
1737
1651
|
var r = e.decoder.end();
|
|
1738
1652
|
r && r.length && (e.buffer.push(r), e.length += e.objectMode ? 1 : r.length);
|
|
1739
1653
|
}
|
|
1740
|
-
e.ended = !0,
|
|
1654
|
+
e.ended = !0, Se(t);
|
|
1741
1655
|
}
|
|
1742
1656
|
}
|
|
1743
|
-
function
|
|
1657
|
+
function Se(t) {
|
|
1744
1658
|
var e = t._readableState;
|
|
1745
|
-
e.needReadable = !1, e.emittedReadable || (y("emitReadable", e.flowing), e.emittedReadable = !0, e.sync ?
|
|
1659
|
+
e.needReadable = !1, e.emittedReadable || (y("emitReadable", e.flowing), e.emittedReadable = !0, e.sync ? B(tt, t) : tt(t));
|
|
1746
1660
|
}
|
|
1747
|
-
function
|
|
1661
|
+
function tt(t) {
|
|
1748
1662
|
y("emit readable"), t.emit("readable"), Ye(t);
|
|
1749
1663
|
}
|
|
1750
|
-
function
|
|
1751
|
-
e.readingMore || (e.readingMore = !0,
|
|
1664
|
+
function on(t, e) {
|
|
1665
|
+
e.readingMore || (e.readingMore = !0, B(sn, t, e));
|
|
1752
1666
|
}
|
|
1753
|
-
function
|
|
1667
|
+
function sn(t, e) {
|
|
1754
1668
|
for (var r = e.length; !e.reading && !e.flowing && !e.ended && e.length < e.highWaterMark && (y("maybeReadMore read 0"), t.read(0), r !== e.length); )
|
|
1755
1669
|
r = e.length;
|
|
1756
1670
|
e.readingMore = !1;
|
|
@@ -1773,14 +1687,14 @@ E.prototype.pipe = function(t, e) {
|
|
|
1773
1687
|
}
|
|
1774
1688
|
n.pipesCount += 1, y("pipe count=%d opts=%j", n.pipesCount, e);
|
|
1775
1689
|
var i = !e || e.end !== !1, o = i ? f : h;
|
|
1776
|
-
n.endEmitted ?
|
|
1690
|
+
n.endEmitted ? B(o) : r.once("end", o), t.on("unpipe", s);
|
|
1777
1691
|
function s(S) {
|
|
1778
1692
|
y("onunpipe"), S === r && h();
|
|
1779
1693
|
}
|
|
1780
1694
|
function f() {
|
|
1781
1695
|
y("onend"), t.end();
|
|
1782
1696
|
}
|
|
1783
|
-
var l =
|
|
1697
|
+
var l = fn(r);
|
|
1784
1698
|
t.on("drain", l);
|
|
1785
1699
|
var u = !1;
|
|
1786
1700
|
function h() {
|
|
@@ -1791,26 +1705,26 @@ E.prototype.pipe = function(t, e) {
|
|
|
1791
1705
|
function g(S) {
|
|
1792
1706
|
y("ondata"), c = !1;
|
|
1793
1707
|
var b = t.write(S);
|
|
1794
|
-
b === !1 && !c && ((n.pipesCount === 1 && n.pipes === t || n.pipesCount > 1 &&
|
|
1708
|
+
b === !1 && !c && ((n.pipesCount === 1 && n.pipes === t || n.pipesCount > 1 && kt(n.pipes, t) !== -1) && !u && (y("false write response, pause", r._readableState.awaitDrain), r._readableState.awaitDrain++, c = !0), r.pause());
|
|
1795
1709
|
}
|
|
1796
1710
|
function v(S) {
|
|
1797
|
-
y("onerror", S),
|
|
1711
|
+
y("onerror", S), D(), t.removeListener("error", v), Kr(t, "error") === 0 && t.emit("error", S);
|
|
1798
1712
|
}
|
|
1799
|
-
|
|
1713
|
+
Xr(t, "error", v);
|
|
1800
1714
|
function A() {
|
|
1801
|
-
t.removeListener("finish", x),
|
|
1715
|
+
t.removeListener("finish", x), D();
|
|
1802
1716
|
}
|
|
1803
1717
|
t.once("close", A);
|
|
1804
1718
|
function x() {
|
|
1805
|
-
y("onfinish"), t.removeListener("close", A),
|
|
1719
|
+
y("onfinish"), t.removeListener("close", A), D();
|
|
1806
1720
|
}
|
|
1807
1721
|
t.once("finish", x);
|
|
1808
|
-
function
|
|
1722
|
+
function D() {
|
|
1809
1723
|
y("unpipe"), r.unpipe(t);
|
|
1810
1724
|
}
|
|
1811
1725
|
return t.emit("pipe", r), n.flowing || (y("pipe resume"), r.resume()), t;
|
|
1812
1726
|
};
|
|
1813
|
-
function
|
|
1727
|
+
function fn(t) {
|
|
1814
1728
|
return function() {
|
|
1815
1729
|
var e = t._readableState;
|
|
1816
1730
|
y("pipeOnDrain", e.awaitDrain), e.awaitDrain && e.awaitDrain--, e.awaitDrain === 0 && t.listeners("data").length && (e.flowing = !0, Ye(t));
|
|
@@ -1818,8 +1732,7 @@ function Tn(t) {
|
|
|
1818
1732
|
}
|
|
1819
1733
|
E.prototype.unpipe = function(t) {
|
|
1820
1734
|
var e = this._readableState;
|
|
1821
|
-
if (e.pipesCount === 0)
|
|
1822
|
-
return this;
|
|
1735
|
+
if (e.pipesCount === 0) return this;
|
|
1823
1736
|
if (e.pipesCount === 1)
|
|
1824
1737
|
return t && t !== e.pipes ? this : (t || (t = e.pipes), e.pipes = null, e.pipesCount = 0, e.flowing = !1, t && t.emit("unpipe", this), this);
|
|
1825
1738
|
if (!t) {
|
|
@@ -1829,7 +1742,7 @@ E.prototype.unpipe = function(t) {
|
|
|
1829
1742
|
r[i].emit("unpipe", this);
|
|
1830
1743
|
return this;
|
|
1831
1744
|
}
|
|
1832
|
-
var o =
|
|
1745
|
+
var o = kt(e.pipes, t);
|
|
1833
1746
|
return o === -1 ? this : (e.pipes.splice(o, 1), e.pipesCount -= 1, e.pipesCount === 1 && (e.pipes = e.pipes[0]), t.emit("unpipe", this), this);
|
|
1834
1747
|
};
|
|
1835
1748
|
E.prototype.on = function(t, e) {
|
|
@@ -1838,22 +1751,22 @@ E.prototype.on = function(t, e) {
|
|
|
1838
1751
|
this._readableState.flowing !== !1 && this.resume();
|
|
1839
1752
|
else if (t === "readable") {
|
|
1840
1753
|
var n = this._readableState;
|
|
1841
|
-
!n.endEmitted && !n.readableListening && (n.readableListening = n.needReadable = !0, n.emittedReadable = !1, n.reading ? n.length &&
|
|
1754
|
+
!n.endEmitted && !n.readableListening && (n.readableListening = n.needReadable = !0, n.emittedReadable = !1, n.reading ? n.length && Se(this) : B(an, this));
|
|
1842
1755
|
}
|
|
1843
1756
|
return r;
|
|
1844
1757
|
};
|
|
1845
1758
|
E.prototype.addListener = E.prototype.on;
|
|
1846
|
-
function
|
|
1759
|
+
function an(t) {
|
|
1847
1760
|
y("readable nexttick read 0"), t.read(0);
|
|
1848
1761
|
}
|
|
1849
1762
|
E.prototype.resume = function() {
|
|
1850
1763
|
var t = this._readableState;
|
|
1851
|
-
return t.flowing || (y("resume"), t.flowing = !0,
|
|
1764
|
+
return t.flowing || (y("resume"), t.flowing = !0, ln(this, t)), this;
|
|
1852
1765
|
};
|
|
1853
|
-
function
|
|
1854
|
-
e.resumeScheduled || (e.resumeScheduled = !0,
|
|
1766
|
+
function ln(t, e) {
|
|
1767
|
+
e.resumeScheduled || (e.resumeScheduled = !0, B(un, t, e));
|
|
1855
1768
|
}
|
|
1856
|
-
function
|
|
1769
|
+
function un(t, e) {
|
|
1857
1770
|
e.reading || (y("resume read 0"), t.read(0)), e.resumeScheduled = !1, e.awaitDrain = 0, t.emit("resume"), Ye(t), e.flowing && !e.reading && t.read(0);
|
|
1858
1771
|
}
|
|
1859
1772
|
E.prototype.pause = function() {
|
|
@@ -1879,30 +1792,29 @@ E.prototype.wrap = function(t) {
|
|
|
1879
1792
|
}
|
|
1880
1793
|
});
|
|
1881
1794
|
for (var i in t)
|
|
1882
|
-
this[i] === void 0 && typeof t[i] == "function" && (this[i] = /* @__PURE__ */ function(s) {
|
|
1795
|
+
this[i] === void 0 && typeof t[i] == "function" && (this[i] = /* @__PURE__ */ (function(s) {
|
|
1883
1796
|
return function() {
|
|
1884
1797
|
return t[s].apply(t, arguments);
|
|
1885
1798
|
};
|
|
1886
|
-
}(i));
|
|
1799
|
+
})(i));
|
|
1887
1800
|
var o = ["error", "close", "destroy", "pause", "resume"];
|
|
1888
|
-
return
|
|
1801
|
+
return mn(o, function(s) {
|
|
1889
1802
|
t.on(s, n.emit.bind(n, s));
|
|
1890
1803
|
}), n._read = function(s) {
|
|
1891
1804
|
y("wrapped _read", s), r && (r = !1, t.resume());
|
|
1892
1805
|
}, n;
|
|
1893
1806
|
};
|
|
1894
|
-
E._fromList =
|
|
1895
|
-
function
|
|
1896
|
-
if (e.length === 0)
|
|
1897
|
-
return null;
|
|
1807
|
+
E._fromList = Ut;
|
|
1808
|
+
function Ut(t, e) {
|
|
1809
|
+
if (e.length === 0) return null;
|
|
1898
1810
|
var r;
|
|
1899
|
-
return e.objectMode ? r = e.buffer.shift() : !t || t >= e.length ? (e.decoder ? r = e.buffer.join("") : e.buffer.length === 1 ? r = e.buffer.head.data : r = e.buffer.concat(e.length), e.buffer.clear()) : r =
|
|
1811
|
+
return e.objectMode ? r = e.buffer.shift() : !t || t >= e.length ? (e.decoder ? r = e.buffer.join("") : e.buffer.length === 1 ? r = e.buffer.head.data : r = e.buffer.concat(e.length), e.buffer.clear()) : r = hn(t, e.buffer, e.decoder), r;
|
|
1900
1812
|
}
|
|
1901
|
-
function
|
|
1813
|
+
function hn(t, e, r) {
|
|
1902
1814
|
var n;
|
|
1903
|
-
return t < e.head.data.length ? (n = e.head.data.slice(0, t), e.head.data = e.head.data.slice(t)) : t === e.head.data.length ? n = e.shift() : n = r ?
|
|
1815
|
+
return t < e.head.data.length ? (n = e.head.data.slice(0, t), e.head.data = e.head.data.slice(t)) : t === e.head.data.length ? n = e.shift() : n = r ? cn(t, e) : dn(t, e), n;
|
|
1904
1816
|
}
|
|
1905
|
-
function
|
|
1817
|
+
function cn(t, e) {
|
|
1906
1818
|
var r = e.head, n = 1, i = r.data;
|
|
1907
1819
|
for (t -= i.length; r = r.next; ) {
|
|
1908
1820
|
var o = r.data, s = t > o.length ? o.length : t;
|
|
@@ -1914,7 +1826,7 @@ function Bn(t, e) {
|
|
|
1914
1826
|
}
|
|
1915
1827
|
return e.length -= n, i;
|
|
1916
1828
|
}
|
|
1917
|
-
function
|
|
1829
|
+
function dn(t, e) {
|
|
1918
1830
|
var r = a.allocUnsafe(t), n = e.head, i = 1;
|
|
1919
1831
|
for (n.data.copy(r), t -= n.data.length; n = n.next; ) {
|
|
1920
1832
|
var o = n.data, s = t > o.length ? o.length : t;
|
|
@@ -1928,42 +1840,40 @@ function Un(t, e) {
|
|
|
1928
1840
|
}
|
|
1929
1841
|
function De(t) {
|
|
1930
1842
|
var e = t._readableState;
|
|
1931
|
-
if (e.length > 0)
|
|
1932
|
-
|
|
1933
|
-
e.endEmitted || (e.ended = !0, D(kn, e, t));
|
|
1843
|
+
if (e.length > 0) throw new Error('"endReadable()" called on non-empty stream');
|
|
1844
|
+
e.endEmitted || (e.ended = !0, B(pn, e, t));
|
|
1934
1845
|
}
|
|
1935
|
-
function
|
|
1846
|
+
function pn(t, e) {
|
|
1936
1847
|
!t.endEmitted && t.length === 0 && (t.endEmitted = !0, e.readable = !1, e.emit("end"));
|
|
1937
1848
|
}
|
|
1938
|
-
function
|
|
1849
|
+
function mn(t, e) {
|
|
1939
1850
|
for (var r = 0, n = t.length; r < n; r++)
|
|
1940
1851
|
e(t[r], r);
|
|
1941
1852
|
}
|
|
1942
|
-
function
|
|
1853
|
+
function kt(t, e) {
|
|
1943
1854
|
for (var r = 0, n = t.length; r < n; r++)
|
|
1944
|
-
if (t[r] === e)
|
|
1945
|
-
return r;
|
|
1855
|
+
if (t[r] === e) return r;
|
|
1946
1856
|
return -1;
|
|
1947
1857
|
}
|
|
1948
1858
|
C.WritableState = We;
|
|
1949
|
-
|
|
1950
|
-
function
|
|
1859
|
+
oe(C, p);
|
|
1860
|
+
function gn() {
|
|
1951
1861
|
}
|
|
1952
|
-
function
|
|
1862
|
+
function _n(t, e, r) {
|
|
1953
1863
|
this.chunk = t, this.encoding = e, this.callback = r, this.next = null;
|
|
1954
1864
|
}
|
|
1955
1865
|
function We(t, e) {
|
|
1956
1866
|
Object.defineProperty(this, "buffer", {
|
|
1957
|
-
get:
|
|
1867
|
+
get: Nt(function() {
|
|
1958
1868
|
return this.getBuffer();
|
|
1959
1869
|
}, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")
|
|
1960
|
-
}), t = t || {}, this.objectMode = !!t.objectMode, e instanceof
|
|
1870
|
+
}), t = t || {}, this.objectMode = !!t.objectMode, e instanceof M && (this.objectMode = this.objectMode || !!t.writableObjectMode);
|
|
1961
1871
|
var r = t.highWaterMark, n = this.objectMode ? 16 : 16 * 1024;
|
|
1962
1872
|
this.highWaterMark = r || r === 0 ? r : n, this.highWaterMark = ~~this.highWaterMark, this.needDrain = !1, this.ending = !1, this.ended = !1, this.finished = !1;
|
|
1963
1873
|
var i = t.decodeStrings === !1;
|
|
1964
1874
|
this.decodeStrings = !i, this.defaultEncoding = t.defaultEncoding || "utf8", this.length = 0, this.writing = !1, this.corked = 0, this.sync = !0, this.bufferProcessing = !1, this.onwrite = function(o) {
|
|
1965
|
-
|
|
1966
|
-
}, this.writecb = null, this.writelen = 0, this.bufferedRequest = null, this.lastBufferedRequest = null, this.pendingcb = 0, this.prefinished = !1, this.errorEmitted = !1, this.bufferedRequestCount = 0, this.corkedRequestsFree = new
|
|
1875
|
+
Sn(e, o);
|
|
1876
|
+
}, this.writecb = null, this.writelen = 0, this.bufferedRequest = null, this.lastBufferedRequest = null, this.pendingcb = 0, this.prefinished = !1, this.errorEmitted = !1, this.bufferedRequestCount = 0, this.corkedRequestsFree = new qt(this);
|
|
1967
1877
|
}
|
|
1968
1878
|
We.prototype.getBuffer = function() {
|
|
1969
1879
|
for (var e = this.bufferedRequest, r = []; e; )
|
|
@@ -1971,24 +1881,23 @@ We.prototype.getBuffer = function() {
|
|
|
1971
1881
|
return r;
|
|
1972
1882
|
};
|
|
1973
1883
|
function C(t) {
|
|
1974
|
-
if (!(this instanceof C) && !(this instanceof
|
|
1975
|
-
return new C(t);
|
|
1884
|
+
if (!(this instanceof C) && !(this instanceof M)) return new C(t);
|
|
1976
1885
|
this._writableState = new We(t, this), this.writable = !0, t && (typeof t.write == "function" && (this._write = t.write), typeof t.writev == "function" && (this._writev = t.writev)), p.call(this);
|
|
1977
1886
|
}
|
|
1978
1887
|
C.prototype.pipe = function() {
|
|
1979
1888
|
this.emit("error", new Error("Cannot pipe, not readable"));
|
|
1980
1889
|
};
|
|
1981
|
-
function
|
|
1890
|
+
function wn(t, e) {
|
|
1982
1891
|
var r = new Error("write after end");
|
|
1983
|
-
t.emit("error", r),
|
|
1892
|
+
t.emit("error", r), B(e, r);
|
|
1984
1893
|
}
|
|
1985
|
-
function
|
|
1894
|
+
function yn(t, e, r, n) {
|
|
1986
1895
|
var i = !0, o = !1;
|
|
1987
|
-
return r === null ? o = new TypeError("May not write null values to stream") : !a.isBuffer(r) && typeof r != "string" && r !== void 0 && !e.objectMode && (o = new TypeError("Invalid non-string/buffer chunk")), o && (t.emit("error", o),
|
|
1896
|
+
return r === null ? o = new TypeError("May not write null values to stream") : !a.isBuffer(r) && typeof r != "string" && r !== void 0 && !e.objectMode && (o = new TypeError("Invalid non-string/buffer chunk")), o && (t.emit("error", o), B(n, o), i = !1), i;
|
|
1988
1897
|
}
|
|
1989
1898
|
C.prototype.write = function(t, e, r) {
|
|
1990
1899
|
var n = this._writableState, i = !1;
|
|
1991
|
-
return typeof e == "function" && (r = e, e = null), a.isBuffer(t) ? e = "buffer" : e || (e = n.defaultEncoding), typeof r != "function" && (r =
|
|
1900
|
+
return typeof e == "function" && (r = e, e = null), a.isBuffer(t) ? e = "buffer" : e || (e = n.defaultEncoding), typeof r != "function" && (r = gn), n.ended ? wn(this, r) : yn(this, n, t, r) && (n.pendingcb++, i = bn(this, n, t, e, r)), i;
|
|
1992
1901
|
};
|
|
1993
1902
|
C.prototype.cork = function() {
|
|
1994
1903
|
var t = this._writableState;
|
|
@@ -1996,24 +1905,23 @@ C.prototype.cork = function() {
|
|
|
1996
1905
|
};
|
|
1997
1906
|
C.prototype.uncork = function() {
|
|
1998
1907
|
var t = this._writableState;
|
|
1999
|
-
t.corked && (t.corked--, !t.writing && !t.corked && !t.finished && !t.bufferProcessing && t.bufferedRequest &&
|
|
1908
|
+
t.corked && (t.corked--, !t.writing && !t.corked && !t.finished && !t.bufferProcessing && t.bufferedRequest && Pt(this, t));
|
|
2000
1909
|
};
|
|
2001
1910
|
C.prototype.setDefaultEncoding = function(e) {
|
|
2002
|
-
if (typeof e == "string" && (e = e.toLowerCase()), !(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((e + "").toLowerCase()) > -1))
|
|
2003
|
-
throw new TypeError("Unknown encoding: " + e);
|
|
1911
|
+
if (typeof e == "string" && (e = e.toLowerCase()), !(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((e + "").toLowerCase()) > -1)) throw new TypeError("Unknown encoding: " + e);
|
|
2004
1912
|
return this._writableState.defaultEncoding = e, this;
|
|
2005
1913
|
};
|
|
2006
|
-
function
|
|
1914
|
+
function vn(t, e, r) {
|
|
2007
1915
|
return !t.objectMode && t.decodeStrings !== !1 && typeof e == "string" && (e = a.from(e, r)), e;
|
|
2008
1916
|
}
|
|
2009
|
-
function
|
|
2010
|
-
r =
|
|
1917
|
+
function bn(t, e, r, n, i) {
|
|
1918
|
+
r = vn(e, r, n), a.isBuffer(r) && (n = "buffer");
|
|
2011
1919
|
var o = e.objectMode ? 1 : r.length;
|
|
2012
1920
|
e.length += o;
|
|
2013
1921
|
var s = e.length < e.highWaterMark;
|
|
2014
1922
|
if (s || (e.needDrain = !0), e.writing || e.corked) {
|
|
2015
1923
|
var f = e.lastBufferedRequest;
|
|
2016
|
-
e.lastBufferedRequest = new
|
|
1924
|
+
e.lastBufferedRequest = new _n(r, n, i), f ? f.next = e.lastBufferedRequest : e.bufferedRequest = e.lastBufferedRequest, e.bufferedRequestCount += 1;
|
|
2017
1925
|
} else
|
|
2018
1926
|
Pe(t, e, !1, o, r, n, i);
|
|
2019
1927
|
return s;
|
|
@@ -2021,28 +1929,27 @@ function Jn(t, e, r, n, i) {
|
|
|
2021
1929
|
function Pe(t, e, r, n, i, o, s) {
|
|
2022
1930
|
e.writelen = n, e.writecb = s, e.writing = !0, e.sync = !0, r ? t._writev(i, e.onwrite) : t._write(i, o, e.onwrite), e.sync = !1;
|
|
2023
1931
|
}
|
|
2024
|
-
function
|
|
2025
|
-
--e.pendingcb, r ?
|
|
1932
|
+
function xn(t, e, r, n, i) {
|
|
1933
|
+
--e.pendingcb, r ? B(i, n) : i(n), t._writableState.errorEmitted = !0, t.emit("error", n);
|
|
2026
1934
|
}
|
|
2027
|
-
function
|
|
1935
|
+
function En(t) {
|
|
2028
1936
|
t.writing = !1, t.writecb = null, t.length -= t.writelen, t.writelen = 0;
|
|
2029
1937
|
}
|
|
2030
|
-
function
|
|
1938
|
+
function Sn(t, e) {
|
|
2031
1939
|
var r = t._writableState, n = r.sync, i = r.writecb;
|
|
2032
|
-
if (
|
|
2033
|
-
Yn(t, r, n, e, i);
|
|
1940
|
+
if (En(r), e) xn(t, r, n, e, i);
|
|
2034
1941
|
else {
|
|
2035
|
-
var o =
|
|
2036
|
-
!o && !r.corked && !r.bufferProcessing && r.bufferedRequest &&
|
|
1942
|
+
var o = jt(r);
|
|
1943
|
+
!o && !r.corked && !r.bufferProcessing && r.bufferedRequest && Pt(t, r), n ? B(rt, t, r, o, i) : rt(t, r, o, i);
|
|
2037
1944
|
}
|
|
2038
1945
|
}
|
|
2039
|
-
function
|
|
2040
|
-
r ||
|
|
1946
|
+
function rt(t, e, r, n) {
|
|
1947
|
+
r || Rn(t, e), e.pendingcb--, n(), $t(t, e);
|
|
2041
1948
|
}
|
|
2042
|
-
function
|
|
1949
|
+
function Rn(t, e) {
|
|
2043
1950
|
e.length === 0 && e.needDrain && (e.needDrain = !1, t.emit("drain"));
|
|
2044
1951
|
}
|
|
2045
|
-
function
|
|
1952
|
+
function Pt(t, e) {
|
|
2046
1953
|
e.bufferProcessing = !0;
|
|
2047
1954
|
var r = e.bufferedRequest;
|
|
2048
1955
|
if (t._writev && r && r.next) {
|
|
@@ -2050,7 +1957,7 @@ function kt(t, e) {
|
|
|
2050
1957
|
o.entry = r;
|
|
2051
1958
|
for (var s = 0; r; )
|
|
2052
1959
|
i[s] = r, r = r.next, s += 1;
|
|
2053
|
-
Pe(t, e, !0, e.length, i, "", o.finish), e.pendingcb++, e.lastBufferedRequest = null, o.next ? (e.corkedRequestsFree = o.next, o.next = null) : e.corkedRequestsFree = new
|
|
1960
|
+
Pe(t, e, !0, e.length, i, "", o.finish), e.pendingcb++, e.lastBufferedRequest = null, o.next ? (e.corkedRequestsFree = o.next, o.next = null) : e.corkedRequestsFree = new qt(e);
|
|
2054
1961
|
} else {
|
|
2055
1962
|
for (; r; ) {
|
|
2056
1963
|
var f = r.chunk, l = r.encoding, u = r.callback, h = e.objectMode ? 1 : f.length;
|
|
@@ -2067,22 +1974,22 @@ C.prototype._write = function(t, e, r) {
|
|
|
2067
1974
|
C.prototype._writev = null;
|
|
2068
1975
|
C.prototype.end = function(t, e, r) {
|
|
2069
1976
|
var n = this._writableState;
|
|
2070
|
-
typeof t == "function" ? (r = t, t = null, e = null) : typeof e == "function" && (r = e, e = null), t != null && this.write(t, e), n.corked && (n.corked = 1, this.uncork()), !n.ending && !n.finished &&
|
|
1977
|
+
typeof t == "function" ? (r = t, t = null, e = null) : typeof e == "function" && (r = e, e = null), t != null && this.write(t, e), n.corked && (n.corked = 1, this.uncork()), !n.ending && !n.finished && In(this, n, r);
|
|
2071
1978
|
};
|
|
2072
|
-
function
|
|
1979
|
+
function jt(t) {
|
|
2073
1980
|
return t.ending && t.length === 0 && t.bufferedRequest === null && !t.finished && !t.writing;
|
|
2074
1981
|
}
|
|
2075
|
-
function
|
|
1982
|
+
function nt(t, e) {
|
|
2076
1983
|
e.prefinished || (e.prefinished = !0, t.emit("prefinish"));
|
|
2077
1984
|
}
|
|
2078
|
-
function
|
|
2079
|
-
var r =
|
|
2080
|
-
return r && (e.pendingcb === 0 ? (
|
|
1985
|
+
function $t(t, e) {
|
|
1986
|
+
var r = jt(e);
|
|
1987
|
+
return r && (e.pendingcb === 0 ? (nt(t, e), e.finished = !0, t.emit("finish")) : nt(t, e)), r;
|
|
2081
1988
|
}
|
|
2082
|
-
function
|
|
2083
|
-
e.ending = !0,
|
|
1989
|
+
function In(t, e, r) {
|
|
1990
|
+
e.ending = !0, $t(t, e), r && (e.finished ? B(r) : t.once("finish", r)), e.ended = !0, t.writable = !1;
|
|
2084
1991
|
}
|
|
2085
|
-
function
|
|
1992
|
+
function qt(t) {
|
|
2086
1993
|
var e = this;
|
|
2087
1994
|
this.next = null, this.entry = null, this.finish = function(r) {
|
|
2088
1995
|
var n = e.entry;
|
|
@@ -2093,52 +2000,49 @@ function $t(t) {
|
|
|
2093
2000
|
t.corkedRequestsFree ? t.corkedRequestsFree.next = e : t.corkedRequestsFree = e;
|
|
2094
2001
|
};
|
|
2095
2002
|
}
|
|
2096
|
-
|
|
2097
|
-
var
|
|
2098
|
-
for (var Fe = 0; Fe <
|
|
2099
|
-
var Me =
|
|
2100
|
-
|
|
2003
|
+
oe(M, E);
|
|
2004
|
+
var it = Object.keys(C.prototype);
|
|
2005
|
+
for (var Fe = 0; Fe < it.length; Fe++) {
|
|
2006
|
+
var Me = it[Fe];
|
|
2007
|
+
M.prototype[Me] || (M.prototype[Me] = C.prototype[Me]);
|
|
2101
2008
|
}
|
|
2102
|
-
function
|
|
2103
|
-
if (!(this instanceof
|
|
2104
|
-
|
|
2105
|
-
E.call(this, t), C.call(this, t), t && t.readable === !1 && (this.readable = !1), t && t.writable === !1 && (this.writable = !1), this.allowHalfOpen = !0, t && t.allowHalfOpen === !1 && (this.allowHalfOpen = !1), this.once("end", Zn);
|
|
2009
|
+
function M(t) {
|
|
2010
|
+
if (!(this instanceof M)) return new M(t);
|
|
2011
|
+
E.call(this, t), C.call(this, t), t && t.readable === !1 && (this.readable = !1), t && t.writable === !1 && (this.writable = !1), this.allowHalfOpen = !0, t && t.allowHalfOpen === !1 && (this.allowHalfOpen = !1), this.once("end", On);
|
|
2106
2012
|
}
|
|
2107
|
-
function
|
|
2108
|
-
this.allowHalfOpen || this._writableState.ended ||
|
|
2013
|
+
function On() {
|
|
2014
|
+
this.allowHalfOpen || this._writableState.ended || B(Cn, this);
|
|
2109
2015
|
}
|
|
2110
|
-
function
|
|
2016
|
+
function Cn(t) {
|
|
2111
2017
|
t.end();
|
|
2112
2018
|
}
|
|
2113
|
-
|
|
2114
|
-
function
|
|
2019
|
+
oe(k, M);
|
|
2020
|
+
function An(t) {
|
|
2115
2021
|
this.afterTransform = function(e, r) {
|
|
2116
|
-
return
|
|
2022
|
+
return Tn(t, e, r);
|
|
2117
2023
|
}, this.needTransform = !1, this.transforming = !1, this.writecb = null, this.writechunk = null, this.writeencoding = null;
|
|
2118
2024
|
}
|
|
2119
|
-
function
|
|
2025
|
+
function Tn(t, e, r) {
|
|
2120
2026
|
var n = t._transformState;
|
|
2121
2027
|
n.transforming = !1;
|
|
2122
2028
|
var i = n.writecb;
|
|
2123
|
-
if (!i)
|
|
2124
|
-
return t.emit("error", new Error("no writecb in Transform class"));
|
|
2029
|
+
if (!i) return t.emit("error", new Error("no writecb in Transform class"));
|
|
2125
2030
|
n.writechunk = null, n.writecb = null, r != null && t.push(r), i(e);
|
|
2126
2031
|
var o = t._readableState;
|
|
2127
2032
|
o.reading = !1, (o.needReadable || o.length < o.highWaterMark) && t._read(o.highWaterMark);
|
|
2128
2033
|
}
|
|
2129
2034
|
function k(t) {
|
|
2130
|
-
if (!(this instanceof k))
|
|
2131
|
-
|
|
2132
|
-
B.call(this, t), this._transformState = new Kn(this);
|
|
2035
|
+
if (!(this instanceof k)) return new k(t);
|
|
2036
|
+
M.call(this, t), this._transformState = new An(this);
|
|
2133
2037
|
var e = this;
|
|
2134
2038
|
this._readableState.needReadable = !0, this._readableState.sync = !1, t && (typeof t.transform == "function" && (this._transform = t.transform), typeof t.flush == "function" && (this._flush = t.flush)), this.once("prefinish", function() {
|
|
2135
2039
|
typeof this._flush == "function" ? this._flush(function(r) {
|
|
2136
|
-
|
|
2137
|
-
}) :
|
|
2040
|
+
ot(e, r);
|
|
2041
|
+
}) : ot(e);
|
|
2138
2042
|
});
|
|
2139
2043
|
}
|
|
2140
2044
|
k.prototype.push = function(t, e) {
|
|
2141
|
-
return this._transformState.needTransform = !1,
|
|
2045
|
+
return this._transformState.needTransform = !1, M.prototype.push.call(this, t, e);
|
|
2142
2046
|
};
|
|
2143
2047
|
k.prototype._transform = function(t, e, r) {
|
|
2144
2048
|
throw new Error("Not implemented");
|
|
@@ -2154,36 +2058,32 @@ k.prototype._read = function(t) {
|
|
|
2154
2058
|
var e = this._transformState;
|
|
2155
2059
|
e.writechunk !== null && e.writecb && !e.transforming ? (e.transforming = !0, this._transform(e.writechunk, e.writeencoding, e.afterTransform)) : e.needTransform = !0;
|
|
2156
2060
|
};
|
|
2157
|
-
function
|
|
2158
|
-
if (e)
|
|
2159
|
-
return t.emit("error", e);
|
|
2061
|
+
function ot(t, e) {
|
|
2062
|
+
if (e) return t.emit("error", e);
|
|
2160
2063
|
var r = t._writableState, n = t._transformState;
|
|
2161
|
-
if (r.length)
|
|
2162
|
-
|
|
2163
|
-
if (n.transforming)
|
|
2164
|
-
throw new Error("Calling transform done when still transforming");
|
|
2064
|
+
if (r.length) throw new Error("Calling transform done when ws.length != 0");
|
|
2065
|
+
if (n.transforming) throw new Error("Calling transform done when still transforming");
|
|
2165
2066
|
return t.push(null);
|
|
2166
2067
|
}
|
|
2167
|
-
|
|
2168
|
-
function
|
|
2169
|
-
if (!(this instanceof
|
|
2170
|
-
return new le(t);
|
|
2068
|
+
oe(fe, k);
|
|
2069
|
+
function fe(t) {
|
|
2070
|
+
if (!(this instanceof fe)) return new fe(t);
|
|
2171
2071
|
k.call(this, t);
|
|
2172
2072
|
}
|
|
2173
|
-
|
|
2073
|
+
fe.prototype._transform = function(t, e, r) {
|
|
2174
2074
|
r(null, t);
|
|
2175
2075
|
};
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
function
|
|
2076
|
+
oe(V, p);
|
|
2077
|
+
V.Readable = E;
|
|
2078
|
+
V.Writable = C;
|
|
2079
|
+
V.Duplex = M;
|
|
2080
|
+
V.Transform = k;
|
|
2081
|
+
V.PassThrough = fe;
|
|
2082
|
+
V.Stream = V;
|
|
2083
|
+
function V() {
|
|
2184
2084
|
p.call(this);
|
|
2185
2085
|
}
|
|
2186
|
-
|
|
2086
|
+
V.prototype.pipe = function(t, e) {
|
|
2187
2087
|
var r = this;
|
|
2188
2088
|
function n(h) {
|
|
2189
2089
|
t.writable && t.write(h) === !1 && r.pause && r.pause();
|
|
@@ -2210,7 +2110,7 @@ z.prototype.pipe = function(t, e) {
|
|
|
2210
2110
|
}
|
|
2211
2111
|
return r.on("end", u), r.on("close", u), t.on("close", u), t.emit("pipe", r), t;
|
|
2212
2112
|
};
|
|
2213
|
-
const
|
|
2113
|
+
const zt = function(t) {
|
|
2214
2114
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
2215
2115
|
};
|
|
2216
2116
|
class m extends Error {
|
|
@@ -2219,11 +2119,11 @@ class m extends Error {
|
|
|
2219
2119
|
for (const o of i)
|
|
2220
2120
|
for (const s in o) {
|
|
2221
2121
|
const f = o[s];
|
|
2222
|
-
this[s] =
|
|
2122
|
+
this[s] = L(f) ? f.toString(n.encoding) : f == null ? f : JSON.parse(JSON.stringify(f));
|
|
2223
2123
|
}
|
|
2224
2124
|
}
|
|
2225
2125
|
}
|
|
2226
|
-
const
|
|
2126
|
+
const Vt = function(t) {
|
|
2227
2127
|
const e = [];
|
|
2228
2128
|
for (let r = 0, n = t.length; r < n; r++) {
|
|
2229
2129
|
const i = t[r];
|
|
@@ -2231,7 +2131,7 @@ const zt = function(t) {
|
|
|
2231
2131
|
e[r] = { disabled: !0 };
|
|
2232
2132
|
else if (typeof i == "string")
|
|
2233
2133
|
e[r] = { name: i };
|
|
2234
|
-
else if (
|
|
2134
|
+
else if (zt(i)) {
|
|
2235
2135
|
if (typeof i.name != "string")
|
|
2236
2136
|
throw new m("CSV_OPTION_COLUMNS_MISSING_NAME", [
|
|
2237
2137
|
"Option columns missing name:",
|
|
@@ -2248,12 +2148,12 @@ const zt = function(t) {
|
|
|
2248
2148
|
}
|
|
2249
2149
|
return e;
|
|
2250
2150
|
};
|
|
2251
|
-
class
|
|
2151
|
+
class st {
|
|
2252
2152
|
constructor(e = 100) {
|
|
2253
2153
|
this.size = e, this.length = 0, this.buf = a.allocUnsafe(e);
|
|
2254
2154
|
}
|
|
2255
2155
|
prepend(e) {
|
|
2256
|
-
if (
|
|
2156
|
+
if (L(e)) {
|
|
2257
2157
|
const r = this.length + e.length;
|
|
2258
2158
|
if (r >= this.size && (this.resize(), r >= this.size))
|
|
2259
2159
|
throw Error("INVALID_BUFFER_STATE");
|
|
@@ -2289,7 +2189,7 @@ class ot {
|
|
|
2289
2189
|
this.length = 0;
|
|
2290
2190
|
}
|
|
2291
2191
|
}
|
|
2292
|
-
const
|
|
2192
|
+
const Ln = 12, Nn = 13, Dn = 10, Fn = 32, Mn = 9, Bn = function(t) {
|
|
2293
2193
|
return {
|
|
2294
2194
|
bomSkipped: !1,
|
|
2295
2195
|
bufBytesStart: 0,
|
|
@@ -2299,10 +2199,10 @@ const ti = 12, ri = 13, ni = 10, ii = 32, oi = 9, si = function(t) {
|
|
|
2299
2199
|
error: void 0,
|
|
2300
2200
|
enabled: t.from_line === 1,
|
|
2301
2201
|
escaping: !1,
|
|
2302
|
-
escapeIsQuote:
|
|
2202
|
+
escapeIsQuote: L(t.escape) && L(t.quote) && a.compare(t.escape, t.quote) === 0,
|
|
2303
2203
|
// columns can be `false`, `true`, `Array`
|
|
2304
2204
|
expectedRecordLength: Array.isArray(t.columns) ? t.columns.length : void 0,
|
|
2305
|
-
field: new
|
|
2205
|
+
field: new st(20),
|
|
2306
2206
|
firstLineToHeaders: t.cast_first_line_to_header,
|
|
2307
2207
|
needMoreDataSize: Math.max(
|
|
2308
2208
|
// Skip if the remaining buffer smaller than comment
|
|
@@ -2314,58 +2214,73 @@ const ti = 12, ri = 13, ni = 10, ii = 32, oi = 9, si = function(t) {
|
|
|
2314
2214
|
previousBuf: void 0,
|
|
2315
2215
|
quoting: !1,
|
|
2316
2216
|
stop: !1,
|
|
2317
|
-
rawBuffer: new
|
|
2217
|
+
rawBuffer: new st(100),
|
|
2318
2218
|
record: [],
|
|
2319
2219
|
recordHasError: !1,
|
|
2320
2220
|
record_length: 0,
|
|
2321
2221
|
recordDelimiterMaxLength: t.record_delimiter.length === 0 ? 0 : Math.max(...t.record_delimiter.map((e) => e.length)),
|
|
2322
|
-
trimChars: [
|
|
2222
|
+
trimChars: [
|
|
2223
|
+
a.from(" ", t.encoding)[0],
|
|
2224
|
+
a.from(" ", t.encoding)[0]
|
|
2225
|
+
],
|
|
2323
2226
|
wasQuoting: !1,
|
|
2324
2227
|
wasRowDelimiter: !1,
|
|
2325
2228
|
timchars: [
|
|
2326
|
-
a.from(a.from([
|
|
2327
|
-
a.from(a.from([
|
|
2328
|
-
a.from(a.from([
|
|
2329
|
-
a.from(a.from([
|
|
2330
|
-
a.from(a.from([
|
|
2229
|
+
a.from(a.from([Nn], "utf8").toString(), t.encoding),
|
|
2230
|
+
a.from(a.from([Dn], "utf8").toString(), t.encoding),
|
|
2231
|
+
a.from(a.from([Ln], "utf8").toString(), t.encoding),
|
|
2232
|
+
a.from(a.from([Fn], "utf8").toString(), t.encoding),
|
|
2233
|
+
a.from(a.from([Mn], "utf8").toString(), t.encoding)
|
|
2331
2234
|
]
|
|
2332
2235
|
};
|
|
2333
|
-
},
|
|
2236
|
+
}, Un = function(t) {
|
|
2334
2237
|
return t.replace(/([A-Z])/g, function(e, r) {
|
|
2335
2238
|
return "_" + r.toLowerCase();
|
|
2336
2239
|
});
|
|
2337
|
-
},
|
|
2240
|
+
}, ft = function(t) {
|
|
2338
2241
|
const e = {};
|
|
2339
2242
|
for (const n in t)
|
|
2340
|
-
e[
|
|
2243
|
+
e[Un(n)] = t[n];
|
|
2341
2244
|
if (e.encoding === void 0 || e.encoding === !0)
|
|
2342
2245
|
e.encoding = "utf8";
|
|
2343
2246
|
else if (e.encoding === null || e.encoding === !1)
|
|
2344
2247
|
e.encoding = null;
|
|
2345
2248
|
else if (typeof e.encoding != "string" && e.encoding !== null)
|
|
2346
|
-
throw new m(
|
|
2347
|
-
"
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2249
|
+
throw new m(
|
|
2250
|
+
"CSV_INVALID_OPTION_ENCODING",
|
|
2251
|
+
[
|
|
2252
|
+
"Invalid option encoding:",
|
|
2253
|
+
"encoding must be a string or null to return a buffer,",
|
|
2254
|
+
`got ${JSON.stringify(e.encoding)}`
|
|
2255
|
+
],
|
|
2256
|
+
e
|
|
2257
|
+
);
|
|
2351
2258
|
if (e.bom === void 0 || e.bom === null || e.bom === !1)
|
|
2352
2259
|
e.bom = !1;
|
|
2353
2260
|
else if (e.bom !== !0)
|
|
2354
|
-
throw new m(
|
|
2355
|
-
"
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2261
|
+
throw new m(
|
|
2262
|
+
"CSV_INVALID_OPTION_BOM",
|
|
2263
|
+
[
|
|
2264
|
+
"Invalid option bom:",
|
|
2265
|
+
"bom must be true,",
|
|
2266
|
+
`got ${JSON.stringify(e.bom)}`
|
|
2267
|
+
],
|
|
2268
|
+
e
|
|
2269
|
+
);
|
|
2359
2270
|
if (e.cast_function = null, e.cast === void 0 || e.cast === null || e.cast === !1 || e.cast === "")
|
|
2360
2271
|
e.cast = void 0;
|
|
2361
2272
|
else if (typeof e.cast == "function")
|
|
2362
2273
|
e.cast_function = e.cast, e.cast = !0;
|
|
2363
2274
|
else if (e.cast !== !0)
|
|
2364
|
-
throw new m(
|
|
2365
|
-
"
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2275
|
+
throw new m(
|
|
2276
|
+
"CSV_INVALID_OPTION_CAST",
|
|
2277
|
+
[
|
|
2278
|
+
"Invalid option cast:",
|
|
2279
|
+
"cast must be true or a function,",
|
|
2280
|
+
`got ${JSON.stringify(e.cast)}`
|
|
2281
|
+
],
|
|
2282
|
+
e
|
|
2283
|
+
);
|
|
2369
2284
|
if (e.cast_date === void 0 || e.cast_date === null || e.cast_date === !1 || e.cast_date === "")
|
|
2370
2285
|
e.cast_date = !1;
|
|
2371
2286
|
else if (e.cast_date === !0)
|
|
@@ -2374,246 +2289,357 @@ const ti = 12, ri = 13, ni = 10, ii = 32, oi = 9, si = function(t) {
|
|
|
2374
2289
|
return isNaN(i) ? n : new Date(i);
|
|
2375
2290
|
};
|
|
2376
2291
|
else if (typeof e.cast_date != "function")
|
|
2377
|
-
throw new m(
|
|
2378
|
-
"
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2292
|
+
throw new m(
|
|
2293
|
+
"CSV_INVALID_OPTION_CAST_DATE",
|
|
2294
|
+
[
|
|
2295
|
+
"Invalid option cast_date:",
|
|
2296
|
+
"cast_date must be true or a function,",
|
|
2297
|
+
`got ${JSON.stringify(e.cast_date)}`
|
|
2298
|
+
],
|
|
2299
|
+
e
|
|
2300
|
+
);
|
|
2301
|
+
if (e.cast_first_line_to_header = void 0, e.columns === !0)
|
|
2383
2302
|
e.cast_first_line_to_header = void 0;
|
|
2384
2303
|
else if (typeof e.columns == "function")
|
|
2385
2304
|
e.cast_first_line_to_header = e.columns, e.columns = !0;
|
|
2386
2305
|
else if (Array.isArray(e.columns))
|
|
2387
|
-
e.columns =
|
|
2306
|
+
e.columns = Vt(e.columns);
|
|
2388
2307
|
else if (e.columns === void 0 || e.columns === null || e.columns === !1)
|
|
2389
2308
|
e.columns = !1;
|
|
2390
2309
|
else
|
|
2391
|
-
throw new m(
|
|
2392
|
-
"
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2310
|
+
throw new m(
|
|
2311
|
+
"CSV_INVALID_OPTION_COLUMNS",
|
|
2312
|
+
[
|
|
2313
|
+
"Invalid option columns:",
|
|
2314
|
+
"expect an array, a function or true,",
|
|
2315
|
+
`got ${JSON.stringify(e.columns)}`
|
|
2316
|
+
],
|
|
2317
|
+
e
|
|
2318
|
+
);
|
|
2396
2319
|
if (e.group_columns_by_name === void 0 || e.group_columns_by_name === null || e.group_columns_by_name === !1)
|
|
2397
2320
|
e.group_columns_by_name = !1;
|
|
2398
2321
|
else {
|
|
2399
2322
|
if (e.group_columns_by_name !== !0)
|
|
2400
|
-
throw new m(
|
|
2401
|
-
"
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2323
|
+
throw new m(
|
|
2324
|
+
"CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME",
|
|
2325
|
+
[
|
|
2326
|
+
"Invalid option group_columns_by_name:",
|
|
2327
|
+
"expect an boolean,",
|
|
2328
|
+
`got ${JSON.stringify(e.group_columns_by_name)}`
|
|
2329
|
+
],
|
|
2330
|
+
e
|
|
2331
|
+
);
|
|
2405
2332
|
if (e.columns === !1)
|
|
2406
|
-
throw new m(
|
|
2407
|
-
"
|
|
2408
|
-
|
|
2409
|
-
|
|
2333
|
+
throw new m(
|
|
2334
|
+
"CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME",
|
|
2335
|
+
[
|
|
2336
|
+
"Invalid option group_columns_by_name:",
|
|
2337
|
+
"the `columns` mode must be activated."
|
|
2338
|
+
],
|
|
2339
|
+
e
|
|
2340
|
+
);
|
|
2410
2341
|
}
|
|
2411
2342
|
if (e.comment === void 0 || e.comment === null || e.comment === !1 || e.comment === "")
|
|
2412
2343
|
e.comment = null;
|
|
2413
|
-
else if (typeof e.comment == "string" && (e.comment = a.from(e.comment, e.encoding)), !
|
|
2414
|
-
throw new m(
|
|
2415
|
-
"
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2344
|
+
else if (typeof e.comment == "string" && (e.comment = a.from(e.comment, e.encoding)), !L(e.comment))
|
|
2345
|
+
throw new m(
|
|
2346
|
+
"CSV_INVALID_OPTION_COMMENT",
|
|
2347
|
+
[
|
|
2348
|
+
"Invalid option comment:",
|
|
2349
|
+
"comment must be a buffer or a string,",
|
|
2350
|
+
`got ${JSON.stringify(e.comment)}`
|
|
2351
|
+
],
|
|
2352
|
+
e
|
|
2353
|
+
);
|
|
2419
2354
|
if (e.comment_no_infix === void 0 || e.comment_no_infix === null || e.comment_no_infix === !1)
|
|
2420
2355
|
e.comment_no_infix = !1;
|
|
2421
2356
|
else if (e.comment_no_infix !== !0)
|
|
2422
|
-
throw new m(
|
|
2423
|
-
"
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2357
|
+
throw new m(
|
|
2358
|
+
"CSV_INVALID_OPTION_COMMENT",
|
|
2359
|
+
[
|
|
2360
|
+
"Invalid option comment_no_infix:",
|
|
2361
|
+
"value must be a boolean,",
|
|
2362
|
+
`got ${JSON.stringify(e.comment_no_infix)}`
|
|
2363
|
+
],
|
|
2364
|
+
e
|
|
2365
|
+
);
|
|
2427
2366
|
const r = JSON.stringify(e.delimiter);
|
|
2428
2367
|
if (Array.isArray(e.delimiter) || (e.delimiter = [e.delimiter]), e.delimiter.length === 0)
|
|
2429
|
-
throw new m(
|
|
2430
|
-
"
|
|
2431
|
-
|
|
2432
|
-
`got ${r}`
|
|
2433
|
-
], e);
|
|
2434
|
-
if (e.delimiter = e.delimiter.map(function(n) {
|
|
2435
|
-
if (n == null || n === !1)
|
|
2436
|
-
return a.from(",", e.encoding);
|
|
2437
|
-
if (typeof n == "string" && (n = a.from(n, e.encoding)), !T(n) || n.length === 0)
|
|
2438
|
-
throw new m("CSV_INVALID_OPTION_DELIMITER", [
|
|
2368
|
+
throw new m(
|
|
2369
|
+
"CSV_INVALID_OPTION_DELIMITER",
|
|
2370
|
+
[
|
|
2439
2371
|
"Invalid option delimiter:",
|
|
2440
2372
|
"delimiter must be a non empty string or buffer or array of string|buffer,",
|
|
2441
2373
|
`got ${r}`
|
|
2442
|
-
],
|
|
2374
|
+
],
|
|
2375
|
+
e
|
|
2376
|
+
);
|
|
2377
|
+
if (e.delimiter = e.delimiter.map(function(n) {
|
|
2378
|
+
if (n == null || n === !1)
|
|
2379
|
+
return a.from(",", e.encoding);
|
|
2380
|
+
if (typeof n == "string" && (n = a.from(n, e.encoding)), !L(n) || n.length === 0)
|
|
2381
|
+
throw new m(
|
|
2382
|
+
"CSV_INVALID_OPTION_DELIMITER",
|
|
2383
|
+
[
|
|
2384
|
+
"Invalid option delimiter:",
|
|
2385
|
+
"delimiter must be a non empty string or buffer or array of string|buffer,",
|
|
2386
|
+
`got ${r}`
|
|
2387
|
+
],
|
|
2388
|
+
e
|
|
2389
|
+
);
|
|
2443
2390
|
return n;
|
|
2444
|
-
}), e.escape === void 0 || e.escape === !0 ? e.escape = a.from('"', e.encoding) : typeof e.escape == "string" ? e.escape = a.from(e.escape, e.encoding) : (e.escape === null || e.escape === !1) && (e.escape = null), e.escape !== null && !
|
|
2445
|
-
throw new Error(
|
|
2391
|
+
}), e.escape === void 0 || e.escape === !0 ? e.escape = a.from('"', e.encoding) : typeof e.escape == "string" ? e.escape = a.from(e.escape, e.encoding) : (e.escape === null || e.escape === !1) && (e.escape = null), e.escape !== null && !L(e.escape))
|
|
2392
|
+
throw new Error(
|
|
2393
|
+
`Invalid Option: escape must be a buffer, a string or a boolean, got ${JSON.stringify(e.escape)}`
|
|
2394
|
+
);
|
|
2446
2395
|
if (e.from === void 0 || e.from === null)
|
|
2447
2396
|
e.from = 1;
|
|
2448
2397
|
else if (typeof e.from == "string" && /\d+/.test(e.from) && (e.from = parseInt(e.from)), Number.isInteger(e.from)) {
|
|
2449
2398
|
if (e.from < 0)
|
|
2450
|
-
throw new Error(
|
|
2399
|
+
throw new Error(
|
|
2400
|
+
`Invalid Option: from must be a positive integer, got ${JSON.stringify(t.from)}`
|
|
2401
|
+
);
|
|
2451
2402
|
} else
|
|
2452
|
-
throw new Error(
|
|
2403
|
+
throw new Error(
|
|
2404
|
+
`Invalid Option: from must be an integer, got ${JSON.stringify(e.from)}`
|
|
2405
|
+
);
|
|
2453
2406
|
if (e.from_line === void 0 || e.from_line === null)
|
|
2454
2407
|
e.from_line = 1;
|
|
2455
2408
|
else if (typeof e.from_line == "string" && /\d+/.test(e.from_line) && (e.from_line = parseInt(e.from_line)), Number.isInteger(e.from_line)) {
|
|
2456
2409
|
if (e.from_line <= 0)
|
|
2457
|
-
throw new Error(
|
|
2410
|
+
throw new Error(
|
|
2411
|
+
`Invalid Option: from_line must be a positive integer greater than 0, got ${JSON.stringify(t.from_line)}`
|
|
2412
|
+
);
|
|
2458
2413
|
} else
|
|
2459
|
-
throw new Error(
|
|
2414
|
+
throw new Error(
|
|
2415
|
+
`Invalid Option: from_line must be an integer, got ${JSON.stringify(t.from_line)}`
|
|
2416
|
+
);
|
|
2460
2417
|
if (e.ignore_last_delimiters === void 0 || e.ignore_last_delimiters === null)
|
|
2461
2418
|
e.ignore_last_delimiters = !1;
|
|
2462
2419
|
else if (typeof e.ignore_last_delimiters == "number")
|
|
2463
2420
|
e.ignore_last_delimiters = Math.floor(e.ignore_last_delimiters), e.ignore_last_delimiters === 0 && (e.ignore_last_delimiters = !1);
|
|
2464
2421
|
else if (typeof e.ignore_last_delimiters != "boolean")
|
|
2465
|
-
throw new m(
|
|
2466
|
-
"
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2422
|
+
throw new m(
|
|
2423
|
+
"CSV_INVALID_OPTION_IGNORE_LAST_DELIMITERS",
|
|
2424
|
+
[
|
|
2425
|
+
"Invalid option `ignore_last_delimiters`:",
|
|
2426
|
+
"the value must be a boolean value or an integer,",
|
|
2427
|
+
`got ${JSON.stringify(e.ignore_last_delimiters)}`
|
|
2428
|
+
],
|
|
2429
|
+
e
|
|
2430
|
+
);
|
|
2470
2431
|
if (e.ignore_last_delimiters === !0 && e.columns === !1)
|
|
2471
|
-
throw new m(
|
|
2472
|
-
"
|
|
2473
|
-
|
|
2474
|
-
|
|
2432
|
+
throw new m(
|
|
2433
|
+
"CSV_IGNORE_LAST_DELIMITERS_REQUIRES_COLUMNS",
|
|
2434
|
+
[
|
|
2435
|
+
"The option `ignore_last_delimiters`",
|
|
2436
|
+
"requires the activation of the `columns` option"
|
|
2437
|
+
],
|
|
2438
|
+
e
|
|
2439
|
+
);
|
|
2475
2440
|
if (e.info === void 0 || e.info === null || e.info === !1)
|
|
2476
2441
|
e.info = !1;
|
|
2477
2442
|
else if (e.info !== !0)
|
|
2478
|
-
throw new Error(
|
|
2443
|
+
throw new Error(
|
|
2444
|
+
`Invalid Option: info must be true, got ${JSON.stringify(e.info)}`
|
|
2445
|
+
);
|
|
2479
2446
|
if (e.max_record_size === void 0 || e.max_record_size === null || e.max_record_size === !1)
|
|
2480
2447
|
e.max_record_size = 0;
|
|
2481
|
-
else if (!(Number.isInteger(e.max_record_size) && e.max_record_size >= 0))
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2448
|
+
else if (!(Number.isInteger(e.max_record_size) && e.max_record_size >= 0)) if (typeof e.max_record_size == "string" && /\d+/.test(e.max_record_size))
|
|
2449
|
+
e.max_record_size = parseInt(e.max_record_size);
|
|
2450
|
+
else
|
|
2451
|
+
throw new Error(
|
|
2452
|
+
`Invalid Option: max_record_size must be a positive integer, got ${JSON.stringify(e.max_record_size)}`
|
|
2453
|
+
);
|
|
2486
2454
|
if (e.objname === void 0 || e.objname === null || e.objname === !1)
|
|
2487
2455
|
e.objname = void 0;
|
|
2488
|
-
else if (
|
|
2456
|
+
else if (L(e.objname)) {
|
|
2489
2457
|
if (e.objname.length === 0)
|
|
2490
2458
|
throw new Error("Invalid Option: objname must be a non empty buffer");
|
|
2491
2459
|
e.encoding === null || (e.objname = e.objname.toString(e.encoding));
|
|
2492
2460
|
} else if (typeof e.objname == "string") {
|
|
2493
2461
|
if (e.objname.length === 0)
|
|
2494
2462
|
throw new Error("Invalid Option: objname must be a non empty string");
|
|
2495
|
-
} else if (typeof e.objname != "number")
|
|
2496
|
-
|
|
2463
|
+
} else if (typeof e.objname != "number") throw new Error(
|
|
2464
|
+
`Invalid Option: objname must be a string or a buffer, got ${e.objname}`
|
|
2465
|
+
);
|
|
2497
2466
|
if (e.objname !== void 0) {
|
|
2498
2467
|
if (typeof e.objname == "number") {
|
|
2499
2468
|
if (e.columns !== !1)
|
|
2500
|
-
throw Error(
|
|
2469
|
+
throw Error(
|
|
2470
|
+
"Invalid Option: objname index cannot be combined with columns or be defined as a field"
|
|
2471
|
+
);
|
|
2501
2472
|
} else if (e.columns === !1)
|
|
2502
|
-
throw Error(
|
|
2473
|
+
throw Error(
|
|
2474
|
+
"Invalid Option: objname field must be combined with columns or be defined as an index"
|
|
2475
|
+
);
|
|
2503
2476
|
}
|
|
2504
2477
|
if (e.on_record === void 0 || e.on_record === null)
|
|
2505
2478
|
e.on_record = void 0;
|
|
2506
2479
|
else if (typeof e.on_record != "function")
|
|
2507
|
-
throw new m(
|
|
2508
|
-
"
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2480
|
+
throw new m(
|
|
2481
|
+
"CSV_INVALID_OPTION_ON_RECORD",
|
|
2482
|
+
[
|
|
2483
|
+
"Invalid option `on_record`:",
|
|
2484
|
+
"expect a function,",
|
|
2485
|
+
`got ${JSON.stringify(e.on_record)}`
|
|
2486
|
+
],
|
|
2487
|
+
e
|
|
2488
|
+
);
|
|
2489
|
+
if (e.on_skip !== void 0 && e.on_skip !== null && typeof e.on_skip != "function")
|
|
2490
|
+
throw new Error(
|
|
2491
|
+
`Invalid Option: on_skip must be a function, got ${JSON.stringify(e.on_skip)}`
|
|
2492
|
+
);
|
|
2512
2493
|
if (e.quote === null || e.quote === !1 || e.quote === "")
|
|
2513
2494
|
e.quote = null;
|
|
2514
|
-
else if (e.quote === void 0 || e.quote === !0 ? e.quote = a.from('"', e.encoding) : typeof e.quote == "string" && (e.quote = a.from(e.quote, e.encoding)), !
|
|
2515
|
-
throw new Error(
|
|
2495
|
+
else if (e.quote === void 0 || e.quote === !0 ? e.quote = a.from('"', e.encoding) : typeof e.quote == "string" && (e.quote = a.from(e.quote, e.encoding)), !L(e.quote))
|
|
2496
|
+
throw new Error(
|
|
2497
|
+
`Invalid Option: quote must be a buffer or a string, got ${JSON.stringify(e.quote)}`
|
|
2498
|
+
);
|
|
2516
2499
|
if (e.raw === void 0 || e.raw === null || e.raw === !1)
|
|
2517
2500
|
e.raw = !1;
|
|
2518
2501
|
else if (e.raw !== !0)
|
|
2519
|
-
throw new Error(
|
|
2502
|
+
throw new Error(
|
|
2503
|
+
`Invalid Option: raw must be true, got ${JSON.stringify(e.raw)}`
|
|
2504
|
+
);
|
|
2520
2505
|
if (e.record_delimiter === void 0)
|
|
2521
2506
|
e.record_delimiter = [];
|
|
2522
|
-
else if (typeof e.record_delimiter == "string" ||
|
|
2507
|
+
else if (typeof e.record_delimiter == "string" || L(e.record_delimiter)) {
|
|
2523
2508
|
if (e.record_delimiter.length === 0)
|
|
2524
|
-
throw new m(
|
|
2525
|
-
"
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2509
|
+
throw new m(
|
|
2510
|
+
"CSV_INVALID_OPTION_RECORD_DELIMITER",
|
|
2511
|
+
[
|
|
2512
|
+
"Invalid option `record_delimiter`:",
|
|
2513
|
+
"value must be a non empty string or buffer,",
|
|
2514
|
+
`got ${JSON.stringify(e.record_delimiter)}`
|
|
2515
|
+
],
|
|
2516
|
+
e
|
|
2517
|
+
);
|
|
2529
2518
|
e.record_delimiter = [e.record_delimiter];
|
|
2530
2519
|
} else if (!Array.isArray(e.record_delimiter))
|
|
2531
|
-
throw new m(
|
|
2532
|
-
"
|
|
2533
|
-
|
|
2534
|
-
`got ${JSON.stringify(e.record_delimiter)}`
|
|
2535
|
-
], e);
|
|
2536
|
-
if (e.record_delimiter = e.record_delimiter.map(function(n, i) {
|
|
2537
|
-
if (typeof n != "string" && !T(n))
|
|
2538
|
-
throw new m("CSV_INVALID_OPTION_RECORD_DELIMITER", [
|
|
2520
|
+
throw new m(
|
|
2521
|
+
"CSV_INVALID_OPTION_RECORD_DELIMITER",
|
|
2522
|
+
[
|
|
2539
2523
|
"Invalid option `record_delimiter`:",
|
|
2540
|
-
"value must be a string, a buffer or array of string|buffer",
|
|
2541
|
-
`
|
|
2542
|
-
|
|
2543
|
-
|
|
2524
|
+
"value must be a string, a buffer or array of string|buffer,",
|
|
2525
|
+
`got ${JSON.stringify(e.record_delimiter)}`
|
|
2526
|
+
],
|
|
2527
|
+
e
|
|
2528
|
+
);
|
|
2529
|
+
if (e.record_delimiter = e.record_delimiter.map(function(n, i) {
|
|
2530
|
+
if (typeof n != "string" && !L(n))
|
|
2531
|
+
throw new m(
|
|
2532
|
+
"CSV_INVALID_OPTION_RECORD_DELIMITER",
|
|
2533
|
+
[
|
|
2534
|
+
"Invalid option `record_delimiter`:",
|
|
2535
|
+
"value must be a string, a buffer or array of string|buffer",
|
|
2536
|
+
`at index ${i},`,
|
|
2537
|
+
`got ${JSON.stringify(n)}`
|
|
2538
|
+
],
|
|
2539
|
+
e
|
|
2540
|
+
);
|
|
2544
2541
|
if (n.length === 0)
|
|
2545
|
-
throw new m(
|
|
2546
|
-
"
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2542
|
+
throw new m(
|
|
2543
|
+
"CSV_INVALID_OPTION_RECORD_DELIMITER",
|
|
2544
|
+
[
|
|
2545
|
+
"Invalid option `record_delimiter`:",
|
|
2546
|
+
"value must be a non empty string or buffer",
|
|
2547
|
+
`at index ${i},`,
|
|
2548
|
+
`got ${JSON.stringify(n)}`
|
|
2549
|
+
],
|
|
2550
|
+
e
|
|
2551
|
+
);
|
|
2551
2552
|
return typeof n == "string" && (n = a.from(n, e.encoding)), n;
|
|
2552
|
-
}), typeof e.relax_column_count != "boolean")
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
e.
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
if (typeof e.
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2553
|
+
}), typeof e.relax_column_count != "boolean") if (e.relax_column_count === void 0 || e.relax_column_count === null)
|
|
2554
|
+
e.relax_column_count = !1;
|
|
2555
|
+
else
|
|
2556
|
+
throw new Error(
|
|
2557
|
+
`Invalid Option: relax_column_count must be a boolean, got ${JSON.stringify(e.relax_column_count)}`
|
|
2558
|
+
);
|
|
2559
|
+
if (typeof e.relax_column_count_less != "boolean") if (e.relax_column_count_less === void 0 || e.relax_column_count_less === null)
|
|
2560
|
+
e.relax_column_count_less = !1;
|
|
2561
|
+
else
|
|
2562
|
+
throw new Error(
|
|
2563
|
+
`Invalid Option: relax_column_count_less must be a boolean, got ${JSON.stringify(e.relax_column_count_less)}`
|
|
2564
|
+
);
|
|
2565
|
+
if (typeof e.relax_column_count_more != "boolean") if (e.relax_column_count_more === void 0 || e.relax_column_count_more === null)
|
|
2566
|
+
e.relax_column_count_more = !1;
|
|
2567
|
+
else
|
|
2568
|
+
throw new Error(
|
|
2569
|
+
`Invalid Option: relax_column_count_more must be a boolean, got ${JSON.stringify(e.relax_column_count_more)}`
|
|
2570
|
+
);
|
|
2571
|
+
if (typeof e.relax_quotes != "boolean") if (e.relax_quotes === void 0 || e.relax_quotes === null)
|
|
2572
|
+
e.relax_quotes = !1;
|
|
2573
|
+
else
|
|
2574
|
+
throw new Error(
|
|
2575
|
+
`Invalid Option: relax_quotes must be a boolean, got ${JSON.stringify(e.relax_quotes)}`
|
|
2576
|
+
);
|
|
2577
|
+
if (typeof e.skip_empty_lines != "boolean") if (e.skip_empty_lines === void 0 || e.skip_empty_lines === null)
|
|
2578
|
+
e.skip_empty_lines = !1;
|
|
2579
|
+
else
|
|
2580
|
+
throw new Error(
|
|
2581
|
+
`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(e.skip_empty_lines)}`
|
|
2582
|
+
);
|
|
2583
|
+
if (typeof e.skip_records_with_empty_values != "boolean") if (e.skip_records_with_empty_values === void 0 || e.skip_records_with_empty_values === null)
|
|
2584
|
+
e.skip_records_with_empty_values = !1;
|
|
2585
|
+
else
|
|
2586
|
+
throw new Error(
|
|
2587
|
+
`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(e.skip_records_with_empty_values)}`
|
|
2588
|
+
);
|
|
2589
|
+
if (typeof e.skip_records_with_error != "boolean") if (e.skip_records_with_error === void 0 || e.skip_records_with_error === null)
|
|
2590
|
+
e.skip_records_with_error = !1;
|
|
2591
|
+
else
|
|
2592
|
+
throw new Error(
|
|
2593
|
+
`Invalid Option: skip_records_with_error must be a boolean, got ${JSON.stringify(e.skip_records_with_error)}`
|
|
2594
|
+
);
|
|
2587
2595
|
if (e.rtrim === void 0 || e.rtrim === null || e.rtrim === !1)
|
|
2588
2596
|
e.rtrim = !1;
|
|
2589
2597
|
else if (e.rtrim !== !0)
|
|
2590
|
-
throw new Error(
|
|
2598
|
+
throw new Error(
|
|
2599
|
+
`Invalid Option: rtrim must be a boolean, got ${JSON.stringify(e.rtrim)}`
|
|
2600
|
+
);
|
|
2591
2601
|
if (e.ltrim === void 0 || e.ltrim === null || e.ltrim === !1)
|
|
2592
2602
|
e.ltrim = !1;
|
|
2593
2603
|
else if (e.ltrim !== !0)
|
|
2594
|
-
throw new Error(
|
|
2604
|
+
throw new Error(
|
|
2605
|
+
`Invalid Option: ltrim must be a boolean, got ${JSON.stringify(e.ltrim)}`
|
|
2606
|
+
);
|
|
2595
2607
|
if (e.trim === void 0 || e.trim === null || e.trim === !1)
|
|
2596
2608
|
e.trim = !1;
|
|
2597
2609
|
else if (e.trim !== !0)
|
|
2598
|
-
throw new Error(
|
|
2610
|
+
throw new Error(
|
|
2611
|
+
`Invalid Option: trim must be a boolean, got ${JSON.stringify(e.trim)}`
|
|
2612
|
+
);
|
|
2599
2613
|
if (e.trim === !0 && t.ltrim !== !1 ? e.ltrim = !0 : e.ltrim !== !0 && (e.ltrim = !1), e.trim === !0 && t.rtrim !== !1 ? e.rtrim = !0 : e.rtrim !== !0 && (e.rtrim = !1), e.to === void 0 || e.to === null)
|
|
2600
2614
|
e.to = -1;
|
|
2601
|
-
else if (
|
|
2602
|
-
if (e.to
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2615
|
+
else if (e.to !== -1)
|
|
2616
|
+
if (typeof e.to == "string" && /\d+/.test(e.to) && (e.to = parseInt(e.to)), Number.isInteger(e.to)) {
|
|
2617
|
+
if (e.to <= 0)
|
|
2618
|
+
throw new Error(
|
|
2619
|
+
`Invalid Option: to must be a positive integer greater than 0, got ${JSON.stringify(t.to)}`
|
|
2620
|
+
);
|
|
2621
|
+
} else
|
|
2622
|
+
throw new Error(
|
|
2623
|
+
`Invalid Option: to must be an integer, got ${JSON.stringify(t.to)}`
|
|
2624
|
+
);
|
|
2606
2625
|
if (e.to_line === void 0 || e.to_line === null)
|
|
2607
2626
|
e.to_line = -1;
|
|
2608
|
-
else if (
|
|
2609
|
-
if (e.to_line
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2627
|
+
else if (e.to_line !== -1)
|
|
2628
|
+
if (typeof e.to_line == "string" && /\d+/.test(e.to_line) && (e.to_line = parseInt(e.to_line)), Number.isInteger(e.to_line)) {
|
|
2629
|
+
if (e.to_line <= 0)
|
|
2630
|
+
throw new Error(
|
|
2631
|
+
`Invalid Option: to_line must be a positive integer greater than 0, got ${JSON.stringify(t.to_line)}`
|
|
2632
|
+
);
|
|
2633
|
+
} else
|
|
2634
|
+
throw new Error(
|
|
2635
|
+
`Invalid Option: to_line must be an integer, got ${JSON.stringify(t.to_line)}`
|
|
2636
|
+
);
|
|
2613
2637
|
return e;
|
|
2614
|
-
},
|
|
2615
|
-
return t.every(
|
|
2616
|
-
|
|
2638
|
+
}, at = function(t) {
|
|
2639
|
+
return t.every(
|
|
2640
|
+
(e) => e == null || e.toString && e.toString().trim() === ""
|
|
2641
|
+
);
|
|
2642
|
+
}, kn = 13, Pn = 10, re = {
|
|
2617
2643
|
// Note, the following are equals:
|
|
2618
2644
|
// Buffer.from("\ufeff")
|
|
2619
2645
|
// Buffer.from([239, 187, 191])
|
|
@@ -2623,7 +2649,7 @@ const ti = 12, ri = 13, ni = 10, ii = 32, oi = 9, si = function(t) {
|
|
|
2623
2649
|
// Buffer.from "\ufeff", 'utf16le
|
|
2624
2650
|
// Buffer.from([255, 254])
|
|
2625
2651
|
utf16le: a.from([255, 254])
|
|
2626
|
-
},
|
|
2652
|
+
}, jn = function(t = {}) {
|
|
2627
2653
|
const e = {
|
|
2628
2654
|
bytes: 0,
|
|
2629
2655
|
comment_lines: 0,
|
|
@@ -2631,15 +2657,14 @@ const ti = 12, ri = 13, ni = 10, ii = 32, oi = 9, si = function(t) {
|
|
|
2631
2657
|
invalid_field_length: 0,
|
|
2632
2658
|
lines: 1,
|
|
2633
2659
|
records: 0
|
|
2634
|
-
}, r =
|
|
2660
|
+
}, r = ft(t);
|
|
2635
2661
|
return {
|
|
2636
2662
|
info: e,
|
|
2637
2663
|
original_options: t,
|
|
2638
2664
|
options: r,
|
|
2639
|
-
state:
|
|
2665
|
+
state: Bn(r),
|
|
2640
2666
|
__needMoreData: function(n, i, o) {
|
|
2641
|
-
if (o)
|
|
2642
|
-
return !1;
|
|
2667
|
+
if (o) return !1;
|
|
2643
2668
|
const { encoding: s, escape: f, quote: l } = this.options, { quoting: u, needMoreDataSize: h, recordDelimiterMaxLength: c } = this.state, g = i - n - 1, v = Math.max(
|
|
2644
2669
|
h,
|
|
2645
2670
|
// Skip if the remaining buffer smaller than record delimiter
|
|
@@ -2659,19 +2684,31 @@ const ti = 12, ri = 13, ni = 10, ii = 32, oi = 9, si = function(t) {
|
|
|
2659
2684
|
},
|
|
2660
2685
|
// Central parser implementation
|
|
2661
2686
|
parse: function(n, i, o, s) {
|
|
2662
|
-
const {
|
|
2663
|
-
|
|
2664
|
-
|
|
2687
|
+
const {
|
|
2688
|
+
bom: f,
|
|
2689
|
+
comment_no_infix: l,
|
|
2690
|
+
encoding: u,
|
|
2691
|
+
from_line: h,
|
|
2692
|
+
ltrim: c,
|
|
2693
|
+
max_record_size: g,
|
|
2694
|
+
raw: v,
|
|
2695
|
+
relax_quotes: A,
|
|
2696
|
+
rtrim: x,
|
|
2697
|
+
skip_empty_lines: D,
|
|
2698
|
+
to: S,
|
|
2699
|
+
to_line: b
|
|
2700
|
+
} = this.options;
|
|
2701
|
+
let { comment: _, escape: T, quote: U, record_delimiter: Re } = this.options;
|
|
2702
|
+
const { bomSkipped: Jt, previousBuf: he, rawBuffer: Yt, escapeIsQuote: Wt } = this.state;
|
|
2665
2703
|
let w;
|
|
2666
|
-
if (
|
|
2704
|
+
if (he === void 0)
|
|
2667
2705
|
if (n === void 0) {
|
|
2668
2706
|
s();
|
|
2669
2707
|
return;
|
|
2670
2708
|
} else
|
|
2671
2709
|
w = n;
|
|
2672
|
-
else
|
|
2673
|
-
|
|
2674
|
-
if (Vt === !1)
|
|
2710
|
+
else he !== void 0 && n === void 0 ? w = he : w = a.concat([he, n]);
|
|
2711
|
+
if (Jt === !1)
|
|
2675
2712
|
if (f === !1)
|
|
2676
2713
|
this.state.bomSkipped = !0;
|
|
2677
2714
|
else if (w.length < 3) {
|
|
@@ -2682,116 +2719,142 @@ const ti = 12, ri = 13, ni = 10, ii = 32, oi = 9, si = function(t) {
|
|
|
2682
2719
|
} else {
|
|
2683
2720
|
for (const R in re)
|
|
2684
2721
|
if (re[R].compare(w, 0, re[R].length) === 0) {
|
|
2685
|
-
const
|
|
2686
|
-
this.state.bufBytesStart +=
|
|
2722
|
+
const J = re[R].length;
|
|
2723
|
+
this.state.bufBytesStart += J, w = w.slice(J);
|
|
2724
|
+
const ce = ft({
|
|
2725
|
+
...this.original_options,
|
|
2726
|
+
encoding: R
|
|
2727
|
+
});
|
|
2728
|
+
for (const I in ce)
|
|
2729
|
+
this.options[I] = ce[I];
|
|
2730
|
+
({ comment: _, escape: T, quote: U } = this.options);
|
|
2687
2731
|
break;
|
|
2688
2732
|
}
|
|
2689
2733
|
this.state.bomSkipped = !0;
|
|
2690
2734
|
}
|
|
2691
|
-
const
|
|
2735
|
+
const Ie = w.length;
|
|
2692
2736
|
let d;
|
|
2693
|
-
for (d = 0; d <
|
|
2737
|
+
for (d = 0; d < Ie && !this.__needMoreData(d, Ie, i); d++) {
|
|
2694
2738
|
if (this.state.wasRowDelimiter === !0 && (this.info.lines++, this.state.wasRowDelimiter = !1), b !== -1 && this.info.lines > b) {
|
|
2695
2739
|
this.state.stop = !0, s();
|
|
2696
2740
|
return;
|
|
2697
2741
|
}
|
|
2698
|
-
this.state.quoting === !1 &&
|
|
2742
|
+
this.state.quoting === !1 && Re.length === 0 && this.__autoDiscoverRecordDelimiter(
|
|
2743
|
+
w,
|
|
2744
|
+
d
|
|
2745
|
+
) && (Re = this.options.record_delimiter);
|
|
2699
2746
|
const R = w[d];
|
|
2700
|
-
if (v === !0 &&
|
|
2747
|
+
if (v === !0 && Yt.append(R), (R === kn || R === Pn) && this.state.wasRowDelimiter === !1 && (this.state.wasRowDelimiter = !0), this.state.escaping === !0)
|
|
2701
2748
|
this.state.escaping = !1;
|
|
2702
2749
|
else {
|
|
2703
|
-
if (
|
|
2704
|
-
if (
|
|
2705
|
-
if (this.__isQuote(w, d +
|
|
2706
|
-
this.state.escaping = !0, d +=
|
|
2750
|
+
if (T !== null && this.state.quoting === !0 && this.__isEscape(w, d, R) && d + T.length < Ie)
|
|
2751
|
+
if (Wt) {
|
|
2752
|
+
if (this.__isQuote(w, d + T.length)) {
|
|
2753
|
+
this.state.escaping = !0, d += T.length - 1;
|
|
2707
2754
|
continue;
|
|
2708
2755
|
}
|
|
2709
2756
|
} else {
|
|
2710
|
-
this.state.escaping = !0, d +=
|
|
2757
|
+
this.state.escaping = !0, d += T.length - 1;
|
|
2711
2758
|
continue;
|
|
2712
2759
|
}
|
|
2713
2760
|
if (this.state.commenting === !1 && this.__isQuote(w, d))
|
|
2714
2761
|
if (this.state.quoting === !0) {
|
|
2715
|
-
const
|
|
2716
|
-
|
|
2717
|
-
d
|
|
2718
|
-
|
|
2762
|
+
const I = w[d + U.length], Z = x && this.__isCharTrimable(w, d + U.length), $ = _ !== null && this.__compareBytes(_, w, d + U.length, I), X = this.__isDelimiter(
|
|
2763
|
+
w,
|
|
2764
|
+
d + U.length,
|
|
2765
|
+
I
|
|
2766
|
+
), de = Re.length === 0 ? this.__autoDiscoverRecordDelimiter(w, d + U.length) : this.__isRecordDelimiter(I, w, d + U.length);
|
|
2767
|
+
if (T !== null && this.__isEscape(w, d, R) && this.__isQuote(w, d + T.length))
|
|
2768
|
+
d += T.length - 1;
|
|
2769
|
+
else if (!I || X || de || $ || Z) {
|
|
2719
2770
|
this.state.quoting = !1, this.state.wasQuoting = !0, d += U.length - 1;
|
|
2720
2771
|
continue;
|
|
2721
2772
|
} else if (A === !1) {
|
|
2722
|
-
const
|
|
2723
|
-
new m(
|
|
2724
|
-
"
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2773
|
+
const Qe = this.__error(
|
|
2774
|
+
new m(
|
|
2775
|
+
"CSV_INVALID_CLOSING_QUOTE",
|
|
2776
|
+
[
|
|
2777
|
+
"Invalid Closing Quote:",
|
|
2778
|
+
`got "${String.fromCharCode(I)}"`,
|
|
2779
|
+
`at line ${this.info.lines}`,
|
|
2780
|
+
"instead of delimiter, record delimiter, trimable character",
|
|
2781
|
+
"(if activated) or comment"
|
|
2782
|
+
],
|
|
2783
|
+
this.options,
|
|
2784
|
+
this.__infoField()
|
|
2785
|
+
)
|
|
2730
2786
|
);
|
|
2731
|
-
if (
|
|
2732
|
-
return ae;
|
|
2787
|
+
if (Qe !== void 0) return Qe;
|
|
2733
2788
|
} else
|
|
2734
2789
|
this.state.quoting = !1, this.state.wasQuoting = !0, this.state.field.prepend(U), d += U.length - 1;
|
|
2735
2790
|
} else if (this.state.field.length !== 0) {
|
|
2736
2791
|
if (A === !1) {
|
|
2737
|
-
const
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2792
|
+
const I = this.__infoField(), Z = Object.keys(re).map(
|
|
2793
|
+
(X) => re[X].equals(this.state.field.toString()) ? X : !1
|
|
2794
|
+
).filter(Boolean)[0], $ = this.__error(
|
|
2795
|
+
new m(
|
|
2796
|
+
"INVALID_OPENING_QUOTE",
|
|
2797
|
+
[
|
|
2798
|
+
"Invalid Opening Quote:",
|
|
2799
|
+
`a quote is found on field ${JSON.stringify(I.column)} at line ${I.lines}, value is ${JSON.stringify(this.state.field.toString(u))}`,
|
|
2800
|
+
Z ? `(${Z} bom)` : void 0
|
|
2801
|
+
],
|
|
2802
|
+
this.options,
|
|
2803
|
+
I,
|
|
2804
|
+
{
|
|
2805
|
+
field: this.state.field
|
|
2806
|
+
}
|
|
2807
|
+
)
|
|
2745
2808
|
);
|
|
2746
|
-
if (
|
|
2747
|
-
return Z;
|
|
2809
|
+
if ($ !== void 0) return $;
|
|
2748
2810
|
}
|
|
2749
2811
|
} else {
|
|
2750
2812
|
this.state.quoting = !0, d += U.length - 1;
|
|
2751
2813
|
continue;
|
|
2752
2814
|
}
|
|
2753
2815
|
if (this.state.quoting === !1) {
|
|
2754
|
-
const
|
|
2755
|
-
|
|
2816
|
+
const I = this.__isRecordDelimiter(
|
|
2817
|
+
R,
|
|
2818
|
+
w,
|
|
2819
|
+
d
|
|
2820
|
+
);
|
|
2821
|
+
if (I !== 0) {
|
|
2756
2822
|
if (this.state.commenting && this.state.wasQuoting === !1 && this.state.record.length === 0 && this.state.field.length === 0)
|
|
2757
2823
|
this.info.comment_lines++;
|
|
2758
2824
|
else {
|
|
2759
2825
|
if (this.state.enabled === !1 && this.info.lines + (this.state.wasRowDelimiter === !0 ? 1 : 0) >= h) {
|
|
2760
|
-
this.state.enabled = !0, this.__resetField(), this.__resetRecord(), d +=
|
|
2826
|
+
this.state.enabled = !0, this.__resetField(), this.__resetRecord(), d += I - 1;
|
|
2761
2827
|
continue;
|
|
2762
2828
|
}
|
|
2763
|
-
if (
|
|
2764
|
-
this.info.empty_lines++, d +=
|
|
2829
|
+
if (D === !0 && this.state.wasQuoting === !1 && this.state.record.length === 0 && this.state.field.length === 0) {
|
|
2830
|
+
this.info.empty_lines++, d += I - 1;
|
|
2765
2831
|
continue;
|
|
2766
2832
|
}
|
|
2767
2833
|
this.info.bytes = this.state.bufBytesStart + d;
|
|
2768
|
-
const
|
|
2769
|
-
if (
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
if (ae !== void 0)
|
|
2774
|
-
return ae;
|
|
2834
|
+
const X = this.__onField();
|
|
2835
|
+
if (X !== void 0) return X;
|
|
2836
|
+
this.info.bytes = this.state.bufBytesStart + d + I;
|
|
2837
|
+
const de = this.__onRecord(o);
|
|
2838
|
+
if (de !== void 0) return de;
|
|
2775
2839
|
if (S !== -1 && this.info.records >= S) {
|
|
2776
2840
|
this.state.stop = !0, s();
|
|
2777
2841
|
return;
|
|
2778
2842
|
}
|
|
2779
2843
|
}
|
|
2780
|
-
this.state.commenting = !1, d +=
|
|
2844
|
+
this.state.commenting = !1, d += I - 1;
|
|
2781
2845
|
continue;
|
|
2782
2846
|
}
|
|
2783
2847
|
if (this.state.commenting)
|
|
2784
2848
|
continue;
|
|
2785
|
-
if (
|
|
2849
|
+
if (_ !== null && (l === !1 || this.state.record.length === 0 && this.state.field.length === 0) && this.__compareBytes(_, w, d, R) !== 0) {
|
|
2786
2850
|
this.state.commenting = !0;
|
|
2787
2851
|
continue;
|
|
2788
2852
|
}
|
|
2789
2853
|
const Z = this.__isDelimiter(w, d, R);
|
|
2790
2854
|
if (Z !== 0) {
|
|
2791
2855
|
this.info.bytes = this.state.bufBytesStart + d;
|
|
2792
|
-
const
|
|
2793
|
-
if (
|
|
2794
|
-
return J;
|
|
2856
|
+
const $ = this.__onField();
|
|
2857
|
+
if ($ !== void 0) return $;
|
|
2795
2858
|
d += Z - 1;
|
|
2796
2859
|
continue;
|
|
2797
2860
|
}
|
|
@@ -2799,89 +2862,122 @@ const ti = 12, ri = 13, ni = 10, ii = 32, oi = 9, si = function(t) {
|
|
|
2799
2862
|
}
|
|
2800
2863
|
if (this.state.commenting === !1 && g !== 0 && this.state.record_length + this.state.field.length > g)
|
|
2801
2864
|
return this.__error(
|
|
2802
|
-
new m(
|
|
2803
|
-
"
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2865
|
+
new m(
|
|
2866
|
+
"CSV_MAX_RECORD_SIZE",
|
|
2867
|
+
[
|
|
2868
|
+
"Max Record Size:",
|
|
2869
|
+
"record exceed the maximum number of tolerated bytes",
|
|
2870
|
+
`of ${g}`,
|
|
2871
|
+
`at line ${this.info.lines}`
|
|
2872
|
+
],
|
|
2873
|
+
this.options,
|
|
2874
|
+
this.__infoField()
|
|
2875
|
+
)
|
|
2808
2876
|
);
|
|
2809
|
-
const
|
|
2810
|
-
if (
|
|
2877
|
+
const J = c === !1 || this.state.quoting === !0 || this.state.field.length !== 0 || !this.__isCharTrimable(w, d), ce = x === !1 || this.state.wasQuoting === !1;
|
|
2878
|
+
if (J === !0 && ce === !0)
|
|
2811
2879
|
this.state.field.append(R);
|
|
2812
2880
|
else {
|
|
2813
2881
|
if (x === !0 && !this.__isCharTrimable(w, d))
|
|
2814
2882
|
return this.__error(
|
|
2815
|
-
new m(
|
|
2816
|
-
"
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2883
|
+
new m(
|
|
2884
|
+
"CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE",
|
|
2885
|
+
[
|
|
2886
|
+
"Invalid Closing Quote:",
|
|
2887
|
+
"found non trimable byte after quote",
|
|
2888
|
+
`at line ${this.info.lines}`
|
|
2889
|
+
],
|
|
2890
|
+
this.options,
|
|
2891
|
+
this.__infoField()
|
|
2892
|
+
)
|
|
2820
2893
|
);
|
|
2821
|
-
|
|
2894
|
+
J === !1 && (d += this.__isCharTrimable(w, d) - 1);
|
|
2822
2895
|
continue;
|
|
2823
2896
|
}
|
|
2824
2897
|
}
|
|
2825
2898
|
if (i === !0)
|
|
2826
2899
|
if (this.state.quoting === !0) {
|
|
2827
2900
|
const R = this.__error(
|
|
2828
|
-
new m(
|
|
2829
|
-
"
|
|
2830
|
-
|
|
2831
|
-
|
|
2901
|
+
new m(
|
|
2902
|
+
"CSV_QUOTE_NOT_CLOSED",
|
|
2903
|
+
[
|
|
2904
|
+
"Quote Not Closed:",
|
|
2905
|
+
`the parsing is finished with an opening quote at line ${this.info.lines}`
|
|
2906
|
+
],
|
|
2907
|
+
this.options,
|
|
2908
|
+
this.__infoField()
|
|
2909
|
+
)
|
|
2832
2910
|
);
|
|
2833
|
-
if (R !== void 0)
|
|
2834
|
-
return R;
|
|
2911
|
+
if (R !== void 0) return R;
|
|
2835
2912
|
} else if (this.state.wasQuoting === !0 || this.state.record.length !== 0 || this.state.field.length !== 0) {
|
|
2836
2913
|
this.info.bytes = this.state.bufBytesStart + d;
|
|
2837
2914
|
const R = this.__onField();
|
|
2838
|
-
if (R !== void 0)
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
return V;
|
|
2843
|
-
} else
|
|
2844
|
-
this.state.wasRowDelimiter === !0 ? this.info.empty_lines++ : this.state.commenting === !0 && this.info.comment_lines++;
|
|
2915
|
+
if (R !== void 0) return R;
|
|
2916
|
+
const J = this.__onRecord(o);
|
|
2917
|
+
if (J !== void 0) return J;
|
|
2918
|
+
} else this.state.wasRowDelimiter === !0 ? this.info.empty_lines++ : this.state.commenting === !0 && this.info.comment_lines++;
|
|
2845
2919
|
else
|
|
2846
2920
|
this.state.bufBytesStart += d, this.state.previousBuf = w.slice(d);
|
|
2847
2921
|
this.state.wasRowDelimiter === !0 && (this.info.lines++, this.state.wasRowDelimiter = !1);
|
|
2848
2922
|
},
|
|
2849
2923
|
__onRecord: function(n) {
|
|
2850
|
-
const {
|
|
2924
|
+
const {
|
|
2925
|
+
columns: i,
|
|
2926
|
+
group_columns_by_name: o,
|
|
2927
|
+
encoding: s,
|
|
2928
|
+
info: f,
|
|
2929
|
+
from: l,
|
|
2930
|
+
relax_column_count: u,
|
|
2931
|
+
relax_column_count_less: h,
|
|
2932
|
+
relax_column_count_more: c,
|
|
2933
|
+
raw: g,
|
|
2934
|
+
skip_records_with_empty_values: v
|
|
2935
|
+
} = this.options, { enabled: A, record: x } = this.state;
|
|
2851
2936
|
if (A === !1)
|
|
2852
2937
|
return this.__resetRecord();
|
|
2853
|
-
const
|
|
2938
|
+
const D = x.length;
|
|
2854
2939
|
if (i === !0) {
|
|
2855
|
-
if (v === !0 &&
|
|
2940
|
+
if (v === !0 && at(x)) {
|
|
2856
2941
|
this.__resetRecord();
|
|
2857
2942
|
return;
|
|
2858
2943
|
}
|
|
2859
2944
|
return this.__firstLineToColumns(x);
|
|
2860
2945
|
}
|
|
2861
|
-
if (i === !1 && this.info.records === 0 && (this.state.expectedRecordLength =
|
|
2862
|
-
const S = i === !1 ? new m(
|
|
2863
|
-
"
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2946
|
+
if (i === !1 && this.info.records === 0 && (this.state.expectedRecordLength = D), D !== this.state.expectedRecordLength) {
|
|
2947
|
+
const S = i === !1 ? new m(
|
|
2948
|
+
"CSV_RECORD_INCONSISTENT_FIELDS_LENGTH",
|
|
2949
|
+
[
|
|
2950
|
+
"Invalid Record Length:",
|
|
2951
|
+
`expect ${this.state.expectedRecordLength},`,
|
|
2952
|
+
`got ${D} on line ${this.info.lines}`
|
|
2953
|
+
],
|
|
2954
|
+
this.options,
|
|
2955
|
+
this.__infoField(),
|
|
2956
|
+
{
|
|
2957
|
+
record: x
|
|
2958
|
+
}
|
|
2959
|
+
) : new m(
|
|
2960
|
+
"CSV_RECORD_INCONSISTENT_COLUMNS",
|
|
2961
|
+
[
|
|
2962
|
+
"Invalid Record Length:",
|
|
2963
|
+
`columns length is ${i.length},`,
|
|
2964
|
+
// rename columns
|
|
2965
|
+
`got ${D} on line ${this.info.lines}`
|
|
2966
|
+
],
|
|
2967
|
+
this.options,
|
|
2968
|
+
this.__infoField(),
|
|
2969
|
+
{
|
|
2970
|
+
record: x
|
|
2971
|
+
}
|
|
2972
|
+
);
|
|
2973
|
+
if (u === !0 || h === !0 && D < this.state.expectedRecordLength || c === !0 && D > this.state.expectedRecordLength)
|
|
2877
2974
|
this.info.invalid_field_length++, this.state.error = S;
|
|
2878
2975
|
else {
|
|
2879
2976
|
const b = this.__error(S);
|
|
2880
|
-
if (b)
|
|
2881
|
-
return b;
|
|
2977
|
+
if (b) return b;
|
|
2882
2978
|
}
|
|
2883
2979
|
}
|
|
2884
|
-
if (v === !0 &&
|
|
2980
|
+
if (v === !0 && at(x)) {
|
|
2885
2981
|
this.__resetRecord();
|
|
2886
2982
|
return;
|
|
2887
2983
|
}
|
|
@@ -2893,19 +2989,19 @@ const ti = 12, ri = 13, ni = 10, ii = 32, oi = 9, si = function(t) {
|
|
|
2893
2989
|
const { objname: S } = this.options;
|
|
2894
2990
|
if (i !== !1) {
|
|
2895
2991
|
const b = {};
|
|
2896
|
-
for (let _ = 0,
|
|
2992
|
+
for (let _ = 0, T = x.length; _ < T; _++)
|
|
2897
2993
|
i[_] === void 0 || i[_].disabled || (o === !0 && b[i[_].name] !== void 0 ? Array.isArray(b[i[_].name]) ? b[i[_].name] = b[i[_].name].concat(x[_]) : b[i[_].name] = [b[i[_].name], x[_]] : b[i[_].name] = x[_]);
|
|
2898
2994
|
if (g === !0 || f === !0) {
|
|
2899
2995
|
const _ = Object.assign(
|
|
2900
2996
|
{ record: b },
|
|
2901
2997
|
g === !0 ? { raw: this.state.rawBuffer.toString(s) } : {},
|
|
2902
2998
|
f === !0 ? { info: this.__infoRecord() } : {}
|
|
2903
|
-
),
|
|
2999
|
+
), T = this.__push(
|
|
2904
3000
|
S === void 0 ? _ : [b[S], _],
|
|
2905
3001
|
n
|
|
2906
3002
|
);
|
|
2907
|
-
if (
|
|
2908
|
-
return
|
|
3003
|
+
if (T)
|
|
3004
|
+
return T;
|
|
2909
3005
|
} else {
|
|
2910
3006
|
const _ = this.__push(
|
|
2911
3007
|
S === void 0 ? b : [b[S], b],
|
|
@@ -2942,15 +3038,21 @@ const ti = 12, ri = 13, ni = 10, ii = 32, oi = 9, si = function(t) {
|
|
|
2942
3038
|
const o = i === void 0 ? n : i.call(null, n);
|
|
2943
3039
|
if (!Array.isArray(o))
|
|
2944
3040
|
return this.__error(
|
|
2945
|
-
new m(
|
|
2946
|
-
"
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
3041
|
+
new m(
|
|
3042
|
+
"CSV_INVALID_COLUMN_MAPPING",
|
|
3043
|
+
[
|
|
3044
|
+
"Invalid Column Mapping:",
|
|
3045
|
+
"expect an array from column function,",
|
|
3046
|
+
`got ${JSON.stringify(o)}`
|
|
3047
|
+
],
|
|
3048
|
+
this.options,
|
|
3049
|
+
this.__infoField(),
|
|
3050
|
+
{
|
|
3051
|
+
headers: o
|
|
3052
|
+
}
|
|
3053
|
+
)
|
|
2952
3054
|
);
|
|
2953
|
-
const s =
|
|
3055
|
+
const s = Vt(o);
|
|
2954
3056
|
this.state.expectedRecordLength = s.length, this.options.columns = s, this.__resetRecord();
|
|
2955
3057
|
return;
|
|
2956
3058
|
} catch (o) {
|
|
@@ -2967,8 +3069,7 @@ const ti = 12, ri = 13, ni = 10, ii = 32, oi = 9, si = function(t) {
|
|
|
2967
3069
|
let u = this.state.field.toString(i);
|
|
2968
3070
|
if (o === !0 && l === !1 && (u = u.trimRight()), n === !0) {
|
|
2969
3071
|
const [h, c] = this.__cast(u);
|
|
2970
|
-
if (h !== void 0)
|
|
2971
|
-
return h;
|
|
3072
|
+
if (h !== void 0) return h;
|
|
2972
3073
|
u = c;
|
|
2973
3074
|
}
|
|
2974
3075
|
this.state.record.push(u), s !== 0 && typeof u == "string" && (this.state.record_length += u.length), this.__resetField();
|
|
@@ -3014,14 +3115,12 @@ const ti = 12, ri = 13, ni = 10, ii = 32, oi = 9, si = function(t) {
|
|
|
3014
3115
|
__isCharTrimable: function(n, i) {
|
|
3015
3116
|
return ((s, f) => {
|
|
3016
3117
|
const { timchars: l } = this.state;
|
|
3017
|
-
e:
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
return h.length;
|
|
3024
|
-
}
|
|
3118
|
+
e: for (let u = 0; u < l.length; u++) {
|
|
3119
|
+
const h = l[u];
|
|
3120
|
+
for (let c = 0; c < h.length; c++)
|
|
3121
|
+
if (h[c] !== s[f + c]) continue e;
|
|
3122
|
+
return h.length;
|
|
3123
|
+
}
|
|
3025
3124
|
return 0;
|
|
3026
3125
|
})(n, i);
|
|
3027
3126
|
},
|
|
@@ -3035,12 +3134,10 @@ const ti = 12, ri = 13, ni = 10, ii = 32, oi = 9, si = function(t) {
|
|
|
3035
3134
|
return n - parseFloat(n) + 1 >= 0;
|
|
3036
3135
|
},
|
|
3037
3136
|
__compareBytes: function(n, i, o, s) {
|
|
3038
|
-
if (n[0] !== s)
|
|
3039
|
-
return 0;
|
|
3137
|
+
if (n[0] !== s) return 0;
|
|
3040
3138
|
const f = n.length;
|
|
3041
3139
|
for (let l = 1; l < f; l++)
|
|
3042
|
-
if (n[l] !== i[o + l])
|
|
3043
|
-
return 0;
|
|
3140
|
+
if (n[l] !== i[o + l]) return 0;
|
|
3044
3141
|
return f;
|
|
3045
3142
|
},
|
|
3046
3143
|
__isDelimiter: function(n, i, o) {
|
|
@@ -3049,36 +3146,32 @@ const ti = 12, ri = 13, ni = 10, ii = 32, oi = 9, si = function(t) {
|
|
|
3049
3146
|
return 0;
|
|
3050
3147
|
if (f !== !1 && typeof f == "number" && this.state.record.length === f - 1)
|
|
3051
3148
|
return 0;
|
|
3052
|
-
e:
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
continue e;
|
|
3059
|
-
return u.length;
|
|
3060
|
-
}
|
|
3149
|
+
e: for (let l = 0; l < s.length; l++) {
|
|
3150
|
+
const u = s[l];
|
|
3151
|
+
if (u[0] === o) {
|
|
3152
|
+
for (let h = 1; h < u.length; h++)
|
|
3153
|
+
if (u[h] !== n[i + h]) continue e;
|
|
3154
|
+
return u.length;
|
|
3061
3155
|
}
|
|
3156
|
+
}
|
|
3062
3157
|
return 0;
|
|
3063
3158
|
},
|
|
3064
3159
|
__isRecordDelimiter: function(n, i, o) {
|
|
3065
3160
|
const { record_delimiter: s } = this.options, f = s.length;
|
|
3066
|
-
e:
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
return u.length;
|
|
3074
|
-
}
|
|
3161
|
+
e: for (let l = 0; l < f; l++) {
|
|
3162
|
+
const u = s[l], h = u.length;
|
|
3163
|
+
if (u[0] === n) {
|
|
3164
|
+
for (let c = 1; c < h; c++)
|
|
3165
|
+
if (u[c] !== i[o + c])
|
|
3166
|
+
continue e;
|
|
3167
|
+
return u.length;
|
|
3075
3168
|
}
|
|
3169
|
+
}
|
|
3076
3170
|
return 0;
|
|
3077
3171
|
},
|
|
3078
3172
|
__isEscape: function(n, i, o) {
|
|
3079
3173
|
const { escape: s } = this.options;
|
|
3080
|
-
if (s === null)
|
|
3081
|
-
return !1;
|
|
3174
|
+
if (s === null) return !1;
|
|
3082
3175
|
const f = s.length;
|
|
3083
3176
|
if (s[0] === o) {
|
|
3084
3177
|
for (let l = 0; l < f; l++)
|
|
@@ -3090,8 +3183,7 @@ const ti = 12, ri = 13, ni = 10, ii = 32, oi = 9, si = function(t) {
|
|
|
3090
3183
|
},
|
|
3091
3184
|
__isQuote: function(n, i) {
|
|
3092
3185
|
const { quote: o } = this.options;
|
|
3093
|
-
if (o === null)
|
|
3094
|
-
return !1;
|
|
3186
|
+
if (o === null) return !1;
|
|
3095
3187
|
const s = o.length;
|
|
3096
3188
|
for (let f = 0; f < s; f++)
|
|
3097
3189
|
if (o[f] !== n[i + f])
|
|
@@ -3107,20 +3199,27 @@ const ti = 12, ri = 13, ni = 10, ii = 32, oi = 9, si = function(t) {
|
|
|
3107
3199
|
`, o),
|
|
3108
3200
|
a.from("\r", o)
|
|
3109
3201
|
];
|
|
3110
|
-
e:
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
}
|
|
3202
|
+
e: for (let f = 0; f < s.length; f++) {
|
|
3203
|
+
const l = s[f].length;
|
|
3204
|
+
for (let u = 0; u < l; u++)
|
|
3205
|
+
if (s[f][u] !== n[i + u])
|
|
3206
|
+
continue e;
|
|
3207
|
+
return this.options.record_delimiter.push(s[f]), this.state.recordDelimiterMaxLength = s[f].length, s[f].length;
|
|
3208
|
+
}
|
|
3118
3209
|
return 0;
|
|
3119
3210
|
},
|
|
3120
3211
|
__error: function(n) {
|
|
3121
3212
|
const { encoding: i, raw: o, skip_records_with_error: s } = this.options, f = typeof n == "string" ? new Error(n) : n;
|
|
3122
3213
|
if (s) {
|
|
3123
|
-
this.state.recordHasError = !0, this.options.on_skip !== void 0
|
|
3214
|
+
if (this.state.recordHasError = !0, this.options.on_skip !== void 0)
|
|
3215
|
+
try {
|
|
3216
|
+
this.options.on_skip(
|
|
3217
|
+
f,
|
|
3218
|
+
o ? this.state.rawBuffer.toString(i) : void 0
|
|
3219
|
+
);
|
|
3220
|
+
} catch (l) {
|
|
3221
|
+
return l;
|
|
3222
|
+
}
|
|
3124
3223
|
return;
|
|
3125
3224
|
} else
|
|
3126
3225
|
return f;
|
|
@@ -3151,52 +3250,66 @@ const ti = 12, ri = 13, ni = 10, ii = 32, oi = 9, si = function(t) {
|
|
|
3151
3250
|
}
|
|
3152
3251
|
};
|
|
3153
3252
|
};
|
|
3154
|
-
class
|
|
3253
|
+
class $n extends k {
|
|
3155
3254
|
constructor(e = {}) {
|
|
3156
|
-
super({ readableObjectMode: !0, ...e, encoding: null }), this.api =
|
|
3157
|
-
|
|
3158
|
-
|
|
3255
|
+
super({ readableObjectMode: !0, ...e, encoding: null }), this.api = jn({
|
|
3256
|
+
on_skip: (r, n) => {
|
|
3257
|
+
this.emit("skip", r, n);
|
|
3258
|
+
},
|
|
3259
|
+
...e
|
|
3260
|
+
}), this.state = this.api.state, this.options = this.api.options, this.info = this.api.info;
|
|
3159
3261
|
}
|
|
3160
3262
|
// Implementation of `Transform._transform`
|
|
3161
3263
|
_transform(e, r, n) {
|
|
3162
3264
|
if (this.state.stop === !0)
|
|
3163
3265
|
return;
|
|
3164
|
-
const i = this.api.parse(
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3266
|
+
const i = this.api.parse(
|
|
3267
|
+
e,
|
|
3268
|
+
!1,
|
|
3269
|
+
(o) => {
|
|
3270
|
+
this.push(o);
|
|
3271
|
+
},
|
|
3272
|
+
() => {
|
|
3273
|
+
this.push(null), this.end(), this.on("end", this.destroy);
|
|
3274
|
+
}
|
|
3275
|
+
);
|
|
3169
3276
|
i !== void 0 && (this.state.stop = !0), n(i);
|
|
3170
3277
|
}
|
|
3171
3278
|
// Implementation of `Transform._flush`
|
|
3172
3279
|
_flush(e) {
|
|
3173
3280
|
if (this.state.stop === !0)
|
|
3174
3281
|
return;
|
|
3175
|
-
const r = this.api.parse(
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3282
|
+
const r = this.api.parse(
|
|
3283
|
+
void 0,
|
|
3284
|
+
!0,
|
|
3285
|
+
(n) => {
|
|
3286
|
+
this.push(n);
|
|
3287
|
+
},
|
|
3288
|
+
() => {
|
|
3289
|
+
this.push(null), this.on("end", this.destroy);
|
|
3290
|
+
}
|
|
3291
|
+
);
|
|
3180
3292
|
e(r);
|
|
3181
3293
|
}
|
|
3182
3294
|
}
|
|
3183
|
-
const
|
|
3295
|
+
const qn = function() {
|
|
3184
3296
|
let t, e, r;
|
|
3185
3297
|
for (const i in arguments) {
|
|
3186
3298
|
const o = arguments[i], s = typeof o;
|
|
3187
|
-
if (t === void 0 && (typeof o == "string" ||
|
|
3299
|
+
if (t === void 0 && (typeof o == "string" || L(o)))
|
|
3188
3300
|
t = o;
|
|
3189
|
-
else if (e === void 0 &&
|
|
3301
|
+
else if (e === void 0 && zt(o))
|
|
3190
3302
|
e = o;
|
|
3191
3303
|
else if (r === void 0 && s === "function")
|
|
3192
3304
|
r = o;
|
|
3193
3305
|
else
|
|
3194
|
-
throw new m(
|
|
3195
|
-
"
|
|
3196
|
-
`got ${JSON.stringify(o)} at index ${i}`
|
|
3197
|
-
|
|
3306
|
+
throw new m(
|
|
3307
|
+
"CSV_INVALID_ARGUMENT",
|
|
3308
|
+
["Invalid argument:", `got ${JSON.stringify(o)} at index ${i}`],
|
|
3309
|
+
e || {}
|
|
3310
|
+
);
|
|
3198
3311
|
}
|
|
3199
|
-
const n = new
|
|
3312
|
+
const n = new $n(e);
|
|
3200
3313
|
if (r) {
|
|
3201
3314
|
const i = e === void 0 || e.objname === void 0 ? [] : {};
|
|
3202
3315
|
n.on("readable", function() {
|
|
@@ -3219,6 +3332,7 @@ const ci = function() {
|
|
|
3219
3332
|
};
|
|
3220
3333
|
export {
|
|
3221
3334
|
m as CsvError,
|
|
3222
|
-
|
|
3223
|
-
|
|
3335
|
+
$n as Parser,
|
|
3336
|
+
ft as normalize_options,
|
|
3337
|
+
qn as parse
|
|
3224
3338
|
};
|