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