@datapos/datapos-tool-csv-parse 0.0.13 → 0.0.14
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/datapos-tool-csv-parse.es.js +533 -524
- package/dist/types/src/index.d.ts +1 -12
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var ae = typeof global < "u" ? global : typeof self < "u" ? self : typeof window < "u" ? window : {},
|
|
1
|
+
var ae = typeof global < "u" ? global : typeof self < "u" ? self : typeof window < "u" ? window : {}, j = [], M = [], sr = typeof Uint8Array < "u" ? Uint8Array : Array, Ye = !1;
|
|
2
2
|
function _t() {
|
|
3
3
|
Ye = !0;
|
|
4
4
|
for (var t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", e = 0, r = t.length; e < r; ++e)
|
|
5
|
-
|
|
5
|
+
j[e] = t[e], M[t.charCodeAt(e)] = e;
|
|
6
6
|
M[45] = 62, M[95] = 63;
|
|
7
7
|
}
|
|
8
8
|
function ar(t) {
|
|
@@ -11,13 +11,13 @@ function ar(t) {
|
|
|
11
11
|
if (a % 4 > 0)
|
|
12
12
|
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
13
13
|
o = t[a - 2] === "=" ? 2 : t[a - 1] === "=" ? 1 : 0, s = new sr(a * 3 / 4 - o), n = o > 0 ? a - 4 : a;
|
|
14
|
-
var
|
|
14
|
+
var f = 0;
|
|
15
15
|
for (e = 0, r = 0; e < n; e += 4, r += 3)
|
|
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[
|
|
17
|
-
return o === 2 ? (i = M[t.charCodeAt(e)] << 2 | M[t.charCodeAt(e + 1)] >> 4, s[
|
|
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[f++] = i >> 16 & 255, s[f++] = i >> 8 & 255, s[f++] = i & 255;
|
|
17
|
+
return o === 2 ? (i = M[t.charCodeAt(e)] << 2 | M[t.charCodeAt(e + 1)] >> 4, s[f++] = i & 255) : o === 1 && (i = M[t.charCodeAt(e)] << 10 | M[t.charCodeAt(e + 1)] << 4 | M[t.charCodeAt(e + 2)] >> 2, s[f++] = i >> 8 & 255, s[f++] = i & 255), s;
|
|
18
18
|
}
|
|
19
19
|
function fr(t) {
|
|
20
|
-
return
|
|
20
|
+
return j[t >> 18 & 63] + j[t >> 12 & 63] + j[t >> 6 & 63] + j[t & 63];
|
|
21
21
|
}
|
|
22
22
|
function lr(t, e, r) {
|
|
23
23
|
for (var n, i = [], o = e; o < r; o += 3)
|
|
@@ -26,49 +26,49 @@ function lr(t, e, r) {
|
|
|
26
26
|
}
|
|
27
27
|
function tt(t) {
|
|
28
28
|
Ye || _t();
|
|
29
|
-
for (var e, r = t.length, n = r % 3, i = "", o = [], s = 16383, a = 0,
|
|
30
|
-
o.push(lr(t, a, a + s >
|
|
31
|
-
return n === 1 ? (e = t[r - 1], i +=
|
|
29
|
+
for (var e, r = t.length, n = r % 3, i = "", o = [], s = 16383, a = 0, f = r - n; a < f; a += s)
|
|
30
|
+
o.push(lr(t, a, a + s > f ? f : a + s));
|
|
31
|
+
return n === 1 ? (e = t[r - 1], i += j[e >> 2], i += j[e << 4 & 63], i += "==") : n === 2 && (e = (t[r - 2] << 8) + t[r - 1], i += j[e >> 10], i += j[e >> 4 & 63], i += j[e << 2 & 63], i += "="), o.push(i), o.join("");
|
|
32
32
|
}
|
|
33
33
|
function Se(t, e, r, n, i) {
|
|
34
|
-
var o, s, a = i * 8 - n - 1,
|
|
35
|
-
for (h +=
|
|
34
|
+
var o, s, a = i * 8 - n - 1, f = (1 << a) - 1, u = f >> 1, c = -7, h = r ? i - 1 : 0, p = r ? -1 : 1, m = t[e + h];
|
|
35
|
+
for (h += p, o = m & (1 << -c) - 1, m >>= -c, c += a; c > 0; o = o * 256 + t[e + h], h += p, c -= 8)
|
|
36
36
|
;
|
|
37
|
-
for (s = o & (1 << -c) - 1, o >>= -c, c += n; c > 0; s = s * 256 + t[e + h], h +=
|
|
37
|
+
for (s = o & (1 << -c) - 1, o >>= -c, c += n; c > 0; s = s * 256 + t[e + h], h += p, c -= 8)
|
|
38
38
|
;
|
|
39
39
|
if (o === 0)
|
|
40
40
|
o = 1 - u;
|
|
41
41
|
else {
|
|
42
|
-
if (o ===
|
|
43
|
-
return s ? NaN : (
|
|
42
|
+
if (o === f)
|
|
43
|
+
return s ? NaN : (m ? -1 : 1) * (1 / 0);
|
|
44
44
|
s = s + Math.pow(2, n), o = o - u;
|
|
45
45
|
}
|
|
46
|
-
return (
|
|
46
|
+
return (m ? -1 : 1) * s * Math.pow(2, o - n);
|
|
47
47
|
}
|
|
48
48
|
function wt(t, e, r, n, i, o) {
|
|
49
|
-
var s, a,
|
|
50
|
-
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (a = isNaN(e) ? 1 : 0, s = c) : (s = Math.floor(Math.log(e) / Math.LN2), e * (
|
|
49
|
+
var s, a, f, u = o * 8 - i - 1, c = (1 << u) - 1, h = c >> 1, p = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, m = n ? 0 : o - 1, E = n ? 1 : -1, x = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
|
|
50
|
+
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (a = isNaN(e) ? 1 : 0, s = c) : (s = Math.floor(Math.log(e) / Math.LN2), e * (f = Math.pow(2, -s)) < 1 && (s--, f *= 2), s + h >= 1 ? e += p / f : e += p * Math.pow(2, 1 - h), e * f >= 2 && (s++, f /= 2), s + h >= c ? (a = 0, s = c) : s + h >= 1 ? (a = (e * f - 1) * Math.pow(2, i), s = s + h) : (a = e * Math.pow(2, h - 1) * Math.pow(2, i), s = 0)); i >= 8; t[r + m] = a & 255, m += E, a /= 256, i -= 8)
|
|
51
51
|
;
|
|
52
|
-
for (s = s << i | a, u += i; u > 0; t[r +
|
|
52
|
+
for (s = s << i | a, u += i; u > 0; t[r + m] = s & 255, m += E, s /= 256, u -= 8)
|
|
53
53
|
;
|
|
54
|
-
t[r +
|
|
54
|
+
t[r + m - E] |= x * 128;
|
|
55
55
|
}
|
|
56
56
|
var ur = {}.toString, yt = Array.isArray || function(t) {
|
|
57
57
|
return ur.call(t) == "[object Array]";
|
|
58
58
|
}, cr = 50;
|
|
59
|
-
|
|
59
|
+
l.TYPED_ARRAY_SUPPORT = ae.TYPED_ARRAY_SUPPORT !== void 0 ? ae.TYPED_ARRAY_SUPPORT : !0;
|
|
60
60
|
ve();
|
|
61
61
|
function ve() {
|
|
62
|
-
return
|
|
62
|
+
return l.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823;
|
|
63
63
|
}
|
|
64
64
|
function J(t, e) {
|
|
65
65
|
if (ve() < e)
|
|
66
66
|
throw new RangeError("Invalid typed array length");
|
|
67
|
-
return
|
|
67
|
+
return l.TYPED_ARRAY_SUPPORT ? (t = new Uint8Array(e), t.__proto__ = l.prototype) : (t === null && (t = new l(e)), t.length = e), t;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
if (!
|
|
71
|
-
return new
|
|
69
|
+
function l(t, e, r) {
|
|
70
|
+
if (!l.TYPED_ARRAY_SUPPORT && !(this instanceof l))
|
|
71
|
+
return new l(t, e, r);
|
|
72
72
|
if (typeof t == "number") {
|
|
73
73
|
if (typeof e == "string")
|
|
74
74
|
throw new Error(
|
|
@@ -78,19 +78,19 @@ function f(t, e, r) {
|
|
|
78
78
|
}
|
|
79
79
|
return bt(this, t, e, r);
|
|
80
80
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return t.__proto__ =
|
|
81
|
+
l.poolSize = 8192;
|
|
82
|
+
l._augment = function(t) {
|
|
83
|
+
return t.__proto__ = l.prototype, t;
|
|
84
84
|
};
|
|
85
85
|
function bt(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 ? pr(t, e, r, n) : typeof e == "string" ? dr(t, e, r) : gr(t, e);
|
|
89
89
|
}
|
|
90
|
-
|
|
90
|
+
l.from = function(t, e, r) {
|
|
91
91
|
return bt(null, t, e, r);
|
|
92
92
|
};
|
|
93
|
-
|
|
93
|
+
l.TYPED_ARRAY_SUPPORT && (l.prototype.__proto__ = Uint8Array.prototype, l.__proto__ = Uint8Array, typeof Symbol < "u" && Symbol.species && l[Symbol.species]);
|
|
94
94
|
function vt(t) {
|
|
95
95
|
if (typeof t != "number")
|
|
96
96
|
throw new TypeError('"size" argument must be a number');
|
|
@@ -100,30 +100,30 @@ function vt(t) {
|
|
|
100
100
|
function hr(t, e, r, n) {
|
|
101
101
|
return vt(e), e <= 0 ? J(t, e) : r !== void 0 ? typeof n == "string" ? J(t, e).fill(r, n) : J(t, e).fill(r) : J(t, e);
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
l.alloc = function(t, e, r) {
|
|
104
104
|
return hr(null, t, e, r);
|
|
105
105
|
};
|
|
106
106
|
function We(t, e) {
|
|
107
|
-
if (vt(e), t = J(t, e < 0 ? 0 : He(e) | 0), !
|
|
107
|
+
if (vt(e), t = J(t, e < 0 ? 0 : He(e) | 0), !l.TYPED_ARRAY_SUPPORT)
|
|
108
108
|
for (var r = 0; r < e; ++r)
|
|
109
109
|
t[r] = 0;
|
|
110
110
|
return t;
|
|
111
111
|
}
|
|
112
|
-
|
|
112
|
+
l.allocUnsafe = function(t) {
|
|
113
113
|
return We(null, t);
|
|
114
114
|
};
|
|
115
|
-
|
|
115
|
+
l.allocUnsafeSlow = function(t) {
|
|
116
116
|
return We(null, t);
|
|
117
117
|
};
|
|
118
118
|
function dr(t, e, r) {
|
|
119
|
-
if ((typeof r != "string" || r === "") && (r = "utf8"), !
|
|
119
|
+
if ((typeof r != "string" || r === "") && (r = "utf8"), !l.isEncoding(r))
|
|
120
120
|
throw new TypeError('"encoding" must be a valid string encoding');
|
|
121
121
|
var n = xt(e, r) | 0;
|
|
122
122
|
t = J(t, n);
|
|
123
123
|
var i = t.write(e, r);
|
|
124
124
|
return i !== n && (t = t.slice(0, i)), t;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function $e(t, e) {
|
|
127
127
|
var r = e.length < 0 ? 0 : He(e.length) | 0;
|
|
128
128
|
t = J(t, r);
|
|
129
129
|
for (var n = 0; n < r; n += 1)
|
|
@@ -135,18 +135,18 @@ function pr(t, e, r, n) {
|
|
|
135
135
|
throw new RangeError("'offset' is out of bounds");
|
|
136
136
|
if (e.byteLength < r + (n || 0))
|
|
137
137
|
throw new RangeError("'length' is out of bounds");
|
|
138
|
-
return r === void 0 && n === void 0 ? e = new Uint8Array(e) : n === void 0 ? e = new Uint8Array(e, r) : e = new Uint8Array(e, r, n),
|
|
138
|
+
return r === void 0 && n === void 0 ? e = new Uint8Array(e) : n === void 0 ? e = new Uint8Array(e, r) : e = new Uint8Array(e, r, n), l.TYPED_ARRAY_SUPPORT ? (t = e, t.__proto__ = l.prototype) : t = $e(t, e), t;
|
|
139
139
|
}
|
|
140
140
|
function gr(t, e) {
|
|
141
|
-
if (
|
|
141
|
+
if ($(e)) {
|
|
142
142
|
var r = He(e.length) | 0;
|
|
143
143
|
return t = J(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" || Fr(e.length) ? J(t, 0) :
|
|
147
|
+
return typeof e.length != "number" || Fr(e.length) ? J(t, 0) : $e(t, e);
|
|
148
148
|
if (e.type === "Buffer" && yt(e.data))
|
|
149
|
-
return
|
|
149
|
+
return $e(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
|
}
|
|
@@ -155,12 +155,12 @@ function He(t) {
|
|
|
155
155
|
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + ve().toString(16) + " bytes");
|
|
156
156
|
return t | 0;
|
|
157
157
|
}
|
|
158
|
-
|
|
159
|
-
function
|
|
158
|
+
l.isBuffer = D;
|
|
159
|
+
function $(t) {
|
|
160
160
|
return !!(t != null && t._isBuffer);
|
|
161
161
|
}
|
|
162
|
-
|
|
163
|
-
if (
|
|
162
|
+
l.compare = function(e, r) {
|
|
163
|
+
if (!$(e) || !$(r))
|
|
164
164
|
throw new TypeError("Arguments must be Buffers");
|
|
165
165
|
if (e === r) return 0;
|
|
166
166
|
for (var n = e.length, i = r.length, o = 0, s = Math.min(n, i); o < s; ++o)
|
|
@@ -170,7 +170,7 @@ f.compare = function(e, r) {
|
|
|
170
170
|
}
|
|
171
171
|
return n < i ? -1 : i < n ? 1 : 0;
|
|
172
172
|
};
|
|
173
|
-
|
|
173
|
+
l.isEncoding = function(e) {
|
|
174
174
|
switch (String(e).toLowerCase()) {
|
|
175
175
|
case "hex":
|
|
176
176
|
case "utf8":
|
|
@@ -188,26 +188,26 @@ f.isEncoding = function(e) {
|
|
|
188
188
|
return !1;
|
|
189
189
|
}
|
|
190
190
|
};
|
|
191
|
-
|
|
191
|
+
l.concat = function(e, r) {
|
|
192
192
|
if (!yt(e))
|
|
193
193
|
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
194
194
|
if (e.length === 0)
|
|
195
|
-
return
|
|
195
|
+
return l.alloc(0);
|
|
196
196
|
var n;
|
|
197
197
|
if (r === void 0)
|
|
198
198
|
for (r = 0, n = 0; n < e.length; ++n)
|
|
199
199
|
r += e[n].length;
|
|
200
|
-
var i =
|
|
200
|
+
var i = l.allocUnsafe(r), o = 0;
|
|
201
201
|
for (n = 0; n < e.length; ++n) {
|
|
202
202
|
var s = e[n];
|
|
203
|
-
if (
|
|
203
|
+
if (!$(s))
|
|
204
204
|
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
205
205
|
s.copy(i, o), o += s.length;
|
|
206
206
|
}
|
|
207
207
|
return i;
|
|
208
208
|
};
|
|
209
209
|
function xt(t, e) {
|
|
210
|
-
if (
|
|
210
|
+
if ($(t))
|
|
211
211
|
return t.length;
|
|
212
212
|
if (typeof ArrayBuffer < "u" && typeof ArrayBuffer.isView == "function" && (ArrayBuffer.isView(t) || t instanceof ArrayBuffer))
|
|
213
213
|
return t.byteLength;
|
|
@@ -238,7 +238,7 @@ function xt(t, e) {
|
|
|
238
238
|
e = ("" + e).toLowerCase(), n = !0;
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
-
|
|
241
|
+
l.byteLength = xt;
|
|
242
242
|
function mr(t, e, r) {
|
|
243
243
|
var n = !1;
|
|
244
244
|
if ((e === void 0 || e < 0) && (e = 0), e > this.length || ((r === void 0 || r > this.length) && (r = this.length), r <= 0) || (r >>>= 0, e >>>= 0, r <= e))
|
|
@@ -267,12 +267,12 @@ function mr(t, e, r) {
|
|
|
267
267
|
t = (t + "").toLowerCase(), n = !0;
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
|
-
|
|
270
|
+
l.prototype._isBuffer = !0;
|
|
271
271
|
function re(t, e, r) {
|
|
272
272
|
var n = t[e];
|
|
273
273
|
t[e] = t[r], t[r] = n;
|
|
274
274
|
}
|
|
275
|
-
|
|
275
|
+
l.prototype.swap16 = function() {
|
|
276
276
|
var e = this.length;
|
|
277
277
|
if (e % 2 !== 0)
|
|
278
278
|
throw new RangeError("Buffer size must be a multiple of 16-bits");
|
|
@@ -280,7 +280,7 @@ f.prototype.swap16 = function() {
|
|
|
280
280
|
re(this, r, r + 1);
|
|
281
281
|
return this;
|
|
282
282
|
};
|
|
283
|
-
|
|
283
|
+
l.prototype.swap32 = function() {
|
|
284
284
|
var e = this.length;
|
|
285
285
|
if (e % 4 !== 0)
|
|
286
286
|
throw new RangeError("Buffer size must be a multiple of 32-bits");
|
|
@@ -288,7 +288,7 @@ f.prototype.swap32 = function() {
|
|
|
288
288
|
re(this, r, r + 3), re(this, r + 1, r + 2);
|
|
289
289
|
return this;
|
|
290
290
|
};
|
|
291
|
-
|
|
291
|
+
l.prototype.swap64 = function() {
|
|
292
292
|
var e = this.length;
|
|
293
293
|
if (e % 8 !== 0)
|
|
294
294
|
throw new RangeError("Buffer size must be a multiple of 64-bits");
|
|
@@ -296,20 +296,20 @@ f.prototype.swap64 = function() {
|
|
|
296
296
|
re(this, r, r + 7), re(this, r + 1, r + 6), re(this, r + 2, r + 5), re(this, r + 3, r + 4);
|
|
297
297
|
return this;
|
|
298
298
|
};
|
|
299
|
-
|
|
299
|
+
l.prototype.toString = function() {
|
|
300
300
|
var e = this.length | 0;
|
|
301
301
|
return e === 0 ? "" : arguments.length === 0 ? Rt(this, 0, e) : mr.apply(this, arguments);
|
|
302
302
|
};
|
|
303
|
-
|
|
304
|
-
if (
|
|
305
|
-
return this === e ? !0 :
|
|
303
|
+
l.prototype.equals = function(e) {
|
|
304
|
+
if (!$(e)) throw new TypeError("Argument must be a Buffer");
|
|
305
|
+
return this === e ? !0 : l.compare(this, e) === 0;
|
|
306
306
|
};
|
|
307
|
-
|
|
307
|
+
l.prototype.inspect = function() {
|
|
308
308
|
var e = "", r = cr;
|
|
309
309
|
return this.length > 0 && (e = this.toString("hex", 0, r).match(/.{2}/g).join(" "), this.length > r && (e += " ... ")), "<Buffer " + e + ">";
|
|
310
310
|
};
|
|
311
|
-
|
|
312
|
-
if (
|
|
311
|
+
l.prototype.compare = function(e, r, n, i, o) {
|
|
312
|
+
if (!$(e))
|
|
313
313
|
throw new TypeError("Argument must be a Buffer");
|
|
314
314
|
if (r === void 0 && (r = 0), n === void 0 && (n = e ? e.length : 0), i === void 0 && (i = 0), o === void 0 && (o = this.length), r < 0 || n > e.length || i < 0 || o > this.length)
|
|
315
315
|
throw new RangeError("out of range index");
|
|
@@ -320,7 +320,7 @@ f.prototype.compare = function(e, r, n, i, o) {
|
|
|
320
320
|
if (r >= n)
|
|
321
321
|
return 1;
|
|
322
322
|
if (r >>>= 0, n >>>= 0, i >>>= 0, o >>>= 0, this === e) return 0;
|
|
323
|
-
for (var s = o - i, a = n - r,
|
|
323
|
+
for (var s = o - i, a = n - r, f = Math.min(s, a), u = this.slice(i, o), c = e.slice(r, n), h = 0; h < f; ++h)
|
|
324
324
|
if (u[h] !== c[h]) {
|
|
325
325
|
s = u[h], a = c[h];
|
|
326
326
|
break;
|
|
@@ -335,10 +335,10 @@ function Et(t, e, r, n, i) {
|
|
|
335
335
|
} else if (r < 0)
|
|
336
336
|
if (i) r = 0;
|
|
337
337
|
else return -1;
|
|
338
|
-
if (typeof e == "string" && (e =
|
|
338
|
+
if (typeof e == "string" && (e = l.from(e, n)), $(e))
|
|
339
339
|
return e.length === 0 ? -1 : rt(t, e, r, n, i);
|
|
340
340
|
if (typeof e == "number")
|
|
341
|
-
return e = e & 255,
|
|
341
|
+
return e = e & 255, l.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf == "function" ? i ? Uint8Array.prototype.indexOf.call(t, e, r) : Uint8Array.prototype.lastIndexOf.call(t, e, r) : rt(t, [e], r, n, i);
|
|
342
342
|
throw new TypeError("val must be string, number or Buffer");
|
|
343
343
|
}
|
|
344
344
|
function rt(t, e, r, n, i) {
|
|
@@ -348,21 +348,21 @@ function rt(t, e, r, n, i) {
|
|
|
348
348
|
return -1;
|
|
349
349
|
o = 2, s /= 2, a /= 2, r /= 2;
|
|
350
350
|
}
|
|
351
|
-
function
|
|
352
|
-
return o === 1 ?
|
|
351
|
+
function f(m, E) {
|
|
352
|
+
return o === 1 ? m[E] : m.readUInt16BE(E * o);
|
|
353
353
|
}
|
|
354
354
|
var u;
|
|
355
355
|
if (i) {
|
|
356
356
|
var c = -1;
|
|
357
357
|
for (u = r; u < s; u++)
|
|
358
|
-
if (
|
|
358
|
+
if (f(t, u) === f(e, c === -1 ? 0 : u - c)) {
|
|
359
359
|
if (c === -1 && (c = u), u - c + 1 === a) return c * o;
|
|
360
360
|
} else
|
|
361
361
|
c !== -1 && (u -= u - c), c = -1;
|
|
362
362
|
} else
|
|
363
363
|
for (r + a > s && (r = s - a), u = r; u >= 0; u--) {
|
|
364
|
-
for (var h = !0,
|
|
365
|
-
if (
|
|
364
|
+
for (var h = !0, p = 0; p < a; p++)
|
|
365
|
+
if (f(t, u + p) !== f(e, p)) {
|
|
366
366
|
h = !1;
|
|
367
367
|
break;
|
|
368
368
|
}
|
|
@@ -370,13 +370,13 @@ function rt(t, e, r, n, i) {
|
|
|
370
370
|
}
|
|
371
371
|
return -1;
|
|
372
372
|
}
|
|
373
|
-
|
|
373
|
+
l.prototype.includes = function(e, r, n) {
|
|
374
374
|
return this.indexOf(e, r, n) !== -1;
|
|
375
375
|
};
|
|
376
|
-
|
|
376
|
+
l.prototype.indexOf = function(e, r, n) {
|
|
377
377
|
return Et(this, e, r, n, !0);
|
|
378
378
|
};
|
|
379
|
-
|
|
379
|
+
l.prototype.lastIndexOf = function(e, r, n) {
|
|
380
380
|
return Et(this, e, r, n, !1);
|
|
381
381
|
};
|
|
382
382
|
function _r(t, e, r, n) {
|
|
@@ -408,7 +408,7 @@ function br(t, e, r, n) {
|
|
|
408
408
|
function vr(t, e, r, n) {
|
|
409
409
|
return Ce(Nr(e, t.length - r), t, r, n);
|
|
410
410
|
}
|
|
411
|
-
|
|
411
|
+
l.prototype.write = function(e, r, n, i) {
|
|
412
412
|
if (r === void 0)
|
|
413
413
|
i = "utf8", n = this.length, r = 0;
|
|
414
414
|
else if (n === void 0 && typeof r == "string")
|
|
@@ -447,7 +447,7 @@ f.prototype.write = function(e, r, n, i) {
|
|
|
447
447
|
i = ("" + i).toLowerCase(), s = !0;
|
|
448
448
|
}
|
|
449
449
|
};
|
|
450
|
-
|
|
450
|
+
l.prototype.toJSON = function() {
|
|
451
451
|
return {
|
|
452
452
|
type: "Buffer",
|
|
453
453
|
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
@@ -461,19 +461,19 @@ function Rt(t, e, r) {
|
|
|
461
461
|
for (var n = [], i = e; i < r; ) {
|
|
462
462
|
var o = t[i], s = null, a = o > 239 ? 4 : o > 223 ? 3 : o > 191 ? 2 : 1;
|
|
463
463
|
if (i + a <= r) {
|
|
464
|
-
var
|
|
464
|
+
var f, u, c, h;
|
|
465
465
|
switch (a) {
|
|
466
466
|
case 1:
|
|
467
467
|
o < 128 && (s = o);
|
|
468
468
|
break;
|
|
469
469
|
case 2:
|
|
470
|
-
|
|
470
|
+
f = t[i + 1], (f & 192) === 128 && (h = (o & 31) << 6 | f & 63, h > 127 && (s = h));
|
|
471
471
|
break;
|
|
472
472
|
case 3:
|
|
473
|
-
|
|
473
|
+
f = t[i + 1], u = t[i + 2], (f & 192) === 128 && (u & 192) === 128 && (h = (o & 15) << 12 | (f & 63) << 6 | u & 63, h > 2047 && (h < 55296 || h > 57343) && (s = h));
|
|
474
474
|
break;
|
|
475
475
|
case 4:
|
|
476
|
-
|
|
476
|
+
f = t[i + 1], u = t[i + 2], c = t[i + 3], (f & 192) === 128 && (u & 192) === 128 && (c & 192) === 128 && (h = (o & 15) << 18 | (f & 63) << 12 | (u & 63) << 6 | c & 63, h > 65535 && h < 1114112 && (s = h));
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
479
|
s === null ? (s = 65533, a = 1) : s > 65535 && (s -= 65536, n.push(s >>> 10 & 1023 | 55296), s = 56320 | s & 1023), n.push(s), i += a;
|
|
@@ -518,100 +518,100 @@ function Cr(t, e, r) {
|
|
|
518
518
|
i += String.fromCharCode(n[o] + n[o + 1] * 256);
|
|
519
519
|
return i;
|
|
520
520
|
}
|
|
521
|
-
|
|
521
|
+
l.prototype.slice = function(e, r) {
|
|
522
522
|
var n = this.length;
|
|
523
523
|
e = ~~e, r = r === void 0 ? n : ~~r, e < 0 ? (e += n, e < 0 && (e = 0)) : e > n && (e = n), r < 0 ? (r += n, r < 0 && (r = 0)) : r > n && (r = n), r < e && (r = e);
|
|
524
524
|
var i;
|
|
525
|
-
if (
|
|
526
|
-
i = this.subarray(e, r), i.__proto__ =
|
|
525
|
+
if (l.TYPED_ARRAY_SUPPORT)
|
|
526
|
+
i = this.subarray(e, r), i.__proto__ = l.prototype;
|
|
527
527
|
else {
|
|
528
528
|
var o = r - e;
|
|
529
|
-
i = new
|
|
529
|
+
i = new l(o, void 0);
|
|
530
530
|
for (var s = 0; s < o; ++s)
|
|
531
531
|
i[s] = this[s + e];
|
|
532
532
|
}
|
|
533
533
|
return i;
|
|
534
534
|
};
|
|
535
|
-
function
|
|
535
|
+
function A(t, e, r) {
|
|
536
536
|
if (t % 1 !== 0 || t < 0) throw new RangeError("offset is not uint");
|
|
537
537
|
if (t + e > r) throw new RangeError("Trying to access beyond buffer length");
|
|
538
538
|
}
|
|
539
|
-
|
|
540
|
-
e = e | 0, r = r | 0, n ||
|
|
539
|
+
l.prototype.readUIntLE = function(e, r, n) {
|
|
540
|
+
e = e | 0, r = r | 0, n || A(e, r, this.length);
|
|
541
541
|
for (var i = this[e], o = 1, s = 0; ++s < r && (o *= 256); )
|
|
542
542
|
i += this[e + s] * o;
|
|
543
543
|
return i;
|
|
544
544
|
};
|
|
545
|
-
|
|
546
|
-
e = e | 0, r = r | 0, n ||
|
|
545
|
+
l.prototype.readUIntBE = function(e, r, n) {
|
|
546
|
+
e = e | 0, r = r | 0, n || A(e, r, this.length);
|
|
547
547
|
for (var i = this[e + --r], o = 1; r > 0 && (o *= 256); )
|
|
548
548
|
i += this[e + --r] * o;
|
|
549
549
|
return i;
|
|
550
550
|
};
|
|
551
|
-
|
|
552
|
-
return r ||
|
|
551
|
+
l.prototype.readUInt8 = function(e, r) {
|
|
552
|
+
return r || A(e, 1, this.length), this[e];
|
|
553
553
|
};
|
|
554
|
-
|
|
555
|
-
return r ||
|
|
554
|
+
l.prototype.readUInt16LE = function(e, r) {
|
|
555
|
+
return r || A(e, 2, this.length), this[e] | this[e + 1] << 8;
|
|
556
556
|
};
|
|
557
|
-
|
|
558
|
-
return r ||
|
|
557
|
+
l.prototype.readUInt16BE = function(e, r) {
|
|
558
|
+
return r || A(e, 2, this.length), this[e] << 8 | this[e + 1];
|
|
559
559
|
};
|
|
560
|
-
|
|
561
|
-
return r ||
|
|
560
|
+
l.prototype.readUInt32LE = function(e, r) {
|
|
561
|
+
return r || A(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + this[e + 3] * 16777216;
|
|
562
562
|
};
|
|
563
|
-
|
|
564
|
-
return r ||
|
|
563
|
+
l.prototype.readUInt32BE = function(e, r) {
|
|
564
|
+
return r || A(e, 4, this.length), this[e] * 16777216 + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
|
|
565
565
|
};
|
|
566
|
-
|
|
567
|
-
e = e | 0, r = r | 0, n ||
|
|
566
|
+
l.prototype.readIntLE = function(e, r, n) {
|
|
567
|
+
e = e | 0, r = r | 0, n || A(e, r, this.length);
|
|
568
568
|
for (var i = this[e], o = 1, s = 0; ++s < r && (o *= 256); )
|
|
569
569
|
i += this[e + s] * o;
|
|
570
570
|
return o *= 128, i >= o && (i -= Math.pow(2, 8 * r)), i;
|
|
571
571
|
};
|
|
572
|
-
|
|
573
|
-
e = e | 0, r = r | 0, n ||
|
|
572
|
+
l.prototype.readIntBE = function(e, r, n) {
|
|
573
|
+
e = e | 0, r = r | 0, n || A(e, r, this.length);
|
|
574
574
|
for (var i = r, o = 1, s = this[e + --i]; i > 0 && (o *= 256); )
|
|
575
575
|
s += this[e + --i] * o;
|
|
576
576
|
return o *= 128, s >= o && (s -= Math.pow(2, 8 * r)), s;
|
|
577
577
|
};
|
|
578
|
-
|
|
579
|
-
return r ||
|
|
578
|
+
l.prototype.readInt8 = function(e, r) {
|
|
579
|
+
return r || A(e, 1, this.length), this[e] & 128 ? (255 - this[e] + 1) * -1 : this[e];
|
|
580
580
|
};
|
|
581
|
-
|
|
582
|
-
r ||
|
|
581
|
+
l.prototype.readInt16LE = function(e, r) {
|
|
582
|
+
r || A(e, 2, this.length);
|
|
583
583
|
var n = this[e] | this[e + 1] << 8;
|
|
584
584
|
return n & 32768 ? n | 4294901760 : n;
|
|
585
585
|
};
|
|
586
|
-
|
|
587
|
-
r ||
|
|
586
|
+
l.prototype.readInt16BE = function(e, r) {
|
|
587
|
+
r || A(e, 2, this.length);
|
|
588
588
|
var n = this[e + 1] | this[e] << 8;
|
|
589
589
|
return n & 32768 ? n | 4294901760 : n;
|
|
590
590
|
};
|
|
591
|
-
|
|
592
|
-
return r ||
|
|
591
|
+
l.prototype.readInt32LE = function(e, r) {
|
|
592
|
+
return r || A(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;
|
|
593
593
|
};
|
|
594
|
-
|
|
595
|
-
return r ||
|
|
594
|
+
l.prototype.readInt32BE = function(e, r) {
|
|
595
|
+
return r || A(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
|
|
596
596
|
};
|
|
597
|
-
|
|
598
|
-
return r ||
|
|
597
|
+
l.prototype.readFloatLE = function(e, r) {
|
|
598
|
+
return r || A(e, 4, this.length), Se(this, e, !0, 23, 4);
|
|
599
599
|
};
|
|
600
|
-
|
|
601
|
-
return r ||
|
|
600
|
+
l.prototype.readFloatBE = function(e, r) {
|
|
601
|
+
return r || A(e, 4, this.length), Se(this, e, !1, 23, 4);
|
|
602
602
|
};
|
|
603
|
-
|
|
604
|
-
return r ||
|
|
603
|
+
l.prototype.readDoubleLE = function(e, r) {
|
|
604
|
+
return r || A(e, 8, this.length), Se(this, e, !0, 52, 8);
|
|
605
605
|
};
|
|
606
|
-
|
|
607
|
-
return r ||
|
|
606
|
+
l.prototype.readDoubleBE = function(e, r) {
|
|
607
|
+
return r || A(e, 8, this.length), Se(this, e, !1, 52, 8);
|
|
608
608
|
};
|
|
609
609
|
function N(t, e, r, n, i, o) {
|
|
610
|
-
if (
|
|
610
|
+
if (!$(t)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
611
611
|
if (e > i || e < o) throw new RangeError('"value" argument is out of bounds');
|
|
612
612
|
if (r + n > t.length) throw new RangeError("Index out of range");
|
|
613
613
|
}
|
|
614
|
-
|
|
614
|
+
l.prototype.writeUIntLE = function(e, r, n, i) {
|
|
615
615
|
if (e = +e, r = r | 0, n = n | 0, !i) {
|
|
616
616
|
var o = Math.pow(2, 8 * n) - 1;
|
|
617
617
|
N(this, e, r, n, o, 0);
|
|
@@ -621,7 +621,7 @@ f.prototype.writeUIntLE = function(e, r, n, i) {
|
|
|
621
621
|
this[r + a] = e / s & 255;
|
|
622
622
|
return r + n;
|
|
623
623
|
};
|
|
624
|
-
|
|
624
|
+
l.prototype.writeUIntBE = function(e, r, n, i) {
|
|
625
625
|
if (e = +e, r = r | 0, n = n | 0, !i) {
|
|
626
626
|
var o = Math.pow(2, 8 * n) - 1;
|
|
627
627
|
N(this, e, r, n, o, 0);
|
|
@@ -631,65 +631,65 @@ f.prototype.writeUIntBE = function(e, r, n, i) {
|
|
|
631
631
|
this[r + s] = e / a & 255;
|
|
632
632
|
return r + n;
|
|
633
633
|
};
|
|
634
|
-
|
|
635
|
-
return e = +e, r = r | 0, n || N(this, e, r, 1, 255, 0),
|
|
634
|
+
l.prototype.writeUInt8 = function(e, r, n) {
|
|
635
|
+
return e = +e, r = r | 0, n || N(this, e, r, 1, 255, 0), l.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)), this[r] = e & 255, r + 1;
|
|
636
636
|
};
|
|
637
637
|
function Re(t, e, r, n) {
|
|
638
638
|
e < 0 && (e = 65535 + e + 1);
|
|
639
639
|
for (var i = 0, o = Math.min(t.length - r, 2); i < o; ++i)
|
|
640
640
|
t[r + i] = (e & 255 << 8 * (n ? i : 1 - i)) >>> (n ? i : 1 - i) * 8;
|
|
641
641
|
}
|
|
642
|
-
|
|
643
|
-
return e = +e, r = r | 0, n || N(this, e, r, 2, 65535, 0),
|
|
642
|
+
l.prototype.writeUInt16LE = function(e, r, n) {
|
|
643
|
+
return e = +e, r = r | 0, n || N(this, e, r, 2, 65535, 0), l.TYPED_ARRAY_SUPPORT ? (this[r] = e & 255, this[r + 1] = e >>> 8) : Re(this, e, r, !0), r + 2;
|
|
644
644
|
};
|
|
645
|
-
|
|
646
|
-
return e = +e, r = r | 0, n || N(this, e, r, 2, 65535, 0),
|
|
645
|
+
l.prototype.writeUInt16BE = function(e, r, n) {
|
|
646
|
+
return e = +e, r = r | 0, n || N(this, e, r, 2, 65535, 0), l.TYPED_ARRAY_SUPPORT ? (this[r] = e >>> 8, this[r + 1] = e & 255) : Re(this, e, r, !1), r + 2;
|
|
647
647
|
};
|
|
648
648
|
function Ie(t, e, r, n) {
|
|
649
649
|
e < 0 && (e = 4294967295 + e + 1);
|
|
650
650
|
for (var i = 0, o = Math.min(t.length - r, 4); i < o; ++i)
|
|
651
651
|
t[r + i] = e >>> (n ? i : 3 - i) * 8 & 255;
|
|
652
652
|
}
|
|
653
|
-
|
|
654
|
-
return e = +e, r = r | 0, n || N(this, e, r, 4, 4294967295, 0),
|
|
653
|
+
l.prototype.writeUInt32LE = function(e, r, n) {
|
|
654
|
+
return e = +e, r = r | 0, n || N(this, e, r, 4, 4294967295, 0), l.TYPED_ARRAY_SUPPORT ? (this[r + 3] = e >>> 24, this[r + 2] = e >>> 16, this[r + 1] = e >>> 8, this[r] = e & 255) : Ie(this, e, r, !0), r + 4;
|
|
655
655
|
};
|
|
656
|
-
|
|
657
|
-
return e = +e, r = r | 0, n || N(this, e, r, 4, 4294967295, 0),
|
|
656
|
+
l.prototype.writeUInt32BE = function(e, r, n) {
|
|
657
|
+
return e = +e, r = r | 0, n || N(this, e, r, 4, 4294967295, 0), l.TYPED_ARRAY_SUPPORT ? (this[r] = e >>> 24, this[r + 1] = e >>> 16, this[r + 2] = e >>> 8, this[r + 3] = e & 255) : Ie(this, e, r, !1), r + 4;
|
|
658
658
|
};
|
|
659
|
-
|
|
659
|
+
l.prototype.writeIntLE = function(e, r, n, i) {
|
|
660
660
|
if (e = +e, r = r | 0, !i) {
|
|
661
661
|
var o = Math.pow(2, 8 * n - 1);
|
|
662
662
|
N(this, e, r, n, o - 1, -o);
|
|
663
663
|
}
|
|
664
|
-
var s = 0, a = 1,
|
|
664
|
+
var s = 0, a = 1, f = 0;
|
|
665
665
|
for (this[r] = e & 255; ++s < n && (a *= 256); )
|
|
666
|
-
e < 0 &&
|
|
666
|
+
e < 0 && f === 0 && this[r + s - 1] !== 0 && (f = 1), this[r + s] = (e / a >> 0) - f & 255;
|
|
667
667
|
return r + n;
|
|
668
668
|
};
|
|
669
|
-
|
|
669
|
+
l.prototype.writeIntBE = function(e, r, n, i) {
|
|
670
670
|
if (e = +e, r = r | 0, !i) {
|
|
671
671
|
var o = Math.pow(2, 8 * n - 1);
|
|
672
672
|
N(this, e, r, n, o - 1, -o);
|
|
673
673
|
}
|
|
674
|
-
var s = n - 1, a = 1,
|
|
674
|
+
var s = n - 1, a = 1, f = 0;
|
|
675
675
|
for (this[r + s] = e & 255; --s >= 0 && (a *= 256); )
|
|
676
|
-
e < 0 &&
|
|
676
|
+
e < 0 && f === 0 && this[r + s + 1] !== 0 && (f = 1), this[r + s] = (e / a >> 0) - f & 255;
|
|
677
677
|
return r + n;
|
|
678
678
|
};
|
|
679
|
-
|
|
680
|
-
return e = +e, r = r | 0, n || N(this, e, r, 1, 127, -128),
|
|
679
|
+
l.prototype.writeInt8 = function(e, r, n) {
|
|
680
|
+
return e = +e, r = r | 0, n || N(this, e, r, 1, 127, -128), l.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)), e < 0 && (e = 255 + e + 1), this[r] = e & 255, r + 1;
|
|
681
681
|
};
|
|
682
|
-
|
|
683
|
-
return e = +e, r = r | 0, n || N(this, e, r, 2, 32767, -32768),
|
|
682
|
+
l.prototype.writeInt16LE = function(e, r, n) {
|
|
683
|
+
return e = +e, r = r | 0, n || N(this, e, r, 2, 32767, -32768), l.TYPED_ARRAY_SUPPORT ? (this[r] = e & 255, this[r + 1] = e >>> 8) : Re(this, e, r, !0), r + 2;
|
|
684
684
|
};
|
|
685
|
-
|
|
686
|
-
return e = +e, r = r | 0, n || N(this, e, r, 2, 32767, -32768),
|
|
685
|
+
l.prototype.writeInt16BE = function(e, r, n) {
|
|
686
|
+
return e = +e, r = r | 0, n || N(this, e, r, 2, 32767, -32768), l.TYPED_ARRAY_SUPPORT ? (this[r] = e >>> 8, this[r + 1] = e & 255) : Re(this, e, r, !1), r + 2;
|
|
687
687
|
};
|
|
688
|
-
|
|
689
|
-
return e = +e, r = r | 0, n || N(this, e, r, 4, 2147483647, -2147483648),
|
|
688
|
+
l.prototype.writeInt32LE = function(e, r, n) {
|
|
689
|
+
return e = +e, r = r | 0, n || N(this, e, r, 4, 2147483647, -2147483648), l.TYPED_ARRAY_SUPPORT ? (this[r] = e & 255, this[r + 1] = e >>> 8, this[r + 2] = e >>> 16, this[r + 3] = e >>> 24) : Ie(this, e, r, !0), r + 4;
|
|
690
690
|
};
|
|
691
|
-
|
|
692
|
-
return e = +e, r = r | 0, n || N(this, e, r, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1),
|
|
691
|
+
l.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), l.TYPED_ARRAY_SUPPORT ? (this[r] = e >>> 24, this[r + 1] = e >>> 16, this[r + 2] = e >>> 8, this[r + 3] = e & 255) : Ie(this, e, r, !1), r + 4;
|
|
693
693
|
};
|
|
694
694
|
function It(t, e, r, n, i, o) {
|
|
695
695
|
if (r + n > t.length) throw new RangeError("Index out of range");
|
|
@@ -698,22 +698,22 @@ function It(t, e, r, n, i, o) {
|
|
|
698
698
|
function Ct(t, e, r, n, i) {
|
|
699
699
|
return i || It(t, e, r, 4), wt(t, e, r, n, 23, 4), r + 4;
|
|
700
700
|
}
|
|
701
|
-
|
|
701
|
+
l.prototype.writeFloatLE = function(e, r, n) {
|
|
702
702
|
return Ct(this, e, r, !0, n);
|
|
703
703
|
};
|
|
704
|
-
|
|
704
|
+
l.prototype.writeFloatBE = function(e, r, n) {
|
|
705
705
|
return Ct(this, e, r, !1, n);
|
|
706
706
|
};
|
|
707
707
|
function Ot(t, e, r, n, i) {
|
|
708
708
|
return i || It(t, e, r, 8), wt(t, e, r, n, 52, 8), r + 8;
|
|
709
709
|
}
|
|
710
|
-
|
|
710
|
+
l.prototype.writeDoubleLE = function(e, r, n) {
|
|
711
711
|
return Ot(this, e, r, !0, n);
|
|
712
712
|
};
|
|
713
|
-
|
|
713
|
+
l.prototype.writeDoubleBE = function(e, r, n) {
|
|
714
714
|
return Ot(this, e, r, !1, n);
|
|
715
715
|
};
|
|
716
|
-
|
|
716
|
+
l.prototype.copy = function(e, r, n, i) {
|
|
717
717
|
if (n || (n = 0), !i && i !== 0 && (i = this.length), r >= e.length && (r = e.length), r || (r = 0), i > 0 && i < n && (i = n), i === n || e.length === 0 || this.length === 0) return 0;
|
|
718
718
|
if (r < 0)
|
|
719
719
|
throw new RangeError("targetStart out of bounds");
|
|
@@ -724,7 +724,7 @@ f.prototype.copy = function(e, r, n, i) {
|
|
|
724
724
|
if (this === e && n < r && r < i)
|
|
725
725
|
for (s = o - 1; s >= 0; --s)
|
|
726
726
|
e[s + r] = this[s + n];
|
|
727
|
-
else if (o < 1e3 || !
|
|
727
|
+
else if (o < 1e3 || !l.TYPED_ARRAY_SUPPORT)
|
|
728
728
|
for (s = 0; s < o; ++s)
|
|
729
729
|
e[s + r] = this[s + n];
|
|
730
730
|
else
|
|
@@ -735,7 +735,7 @@ f.prototype.copy = function(e, r, n, i) {
|
|
|
735
735
|
);
|
|
736
736
|
return o;
|
|
737
737
|
};
|
|
738
|
-
|
|
738
|
+
l.prototype.fill = function(e, r, n, i) {
|
|
739
739
|
if (typeof e == "string") {
|
|
740
740
|
if (typeof r == "string" ? (i = r, r = 0, n = this.length) : typeof n == "string" && (i = n, n = this.length), e.length === 1) {
|
|
741
741
|
var o = e.charCodeAt(0);
|
|
@@ -743,7 +743,7 @@ f.prototype.fill = function(e, r, n, i) {
|
|
|
743
743
|
}
|
|
744
744
|
if (i !== void 0 && typeof i != "string")
|
|
745
745
|
throw new TypeError("encoding must be a string");
|
|
746
|
-
if (typeof i == "string" && !
|
|
746
|
+
if (typeof i == "string" && !l.isEncoding(i))
|
|
747
747
|
throw new TypeError("Unknown encoding: " + i);
|
|
748
748
|
} else typeof e == "number" && (e = e & 255);
|
|
749
749
|
if (r < 0 || this.length < r || this.length < n)
|
|
@@ -756,9 +756,9 @@ f.prototype.fill = function(e, r, n, i) {
|
|
|
756
756
|
for (s = r; s < n; ++s)
|
|
757
757
|
this[s] = e;
|
|
758
758
|
else {
|
|
759
|
-
var a =
|
|
759
|
+
var a = $(e) ? e : xe(new l(e, i).toString()), f = a.length;
|
|
760
760
|
for (s = 0; s < n - r; ++s)
|
|
761
|
-
this[s + r] = a[s %
|
|
761
|
+
this[s + r] = a[s % f];
|
|
762
762
|
}
|
|
763
763
|
return this;
|
|
764
764
|
};
|
|
@@ -859,27 +859,27 @@ var Le;
|
|
|
859
859
|
function Z() {
|
|
860
860
|
}
|
|
861
861
|
Z.prototype = /* @__PURE__ */ Object.create(null);
|
|
862
|
-
function
|
|
863
|
-
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
this.domain = null,
|
|
873
|
-
};
|
|
874
|
-
|
|
862
|
+
function g() {
|
|
863
|
+
g.init.call(this);
|
|
864
|
+
}
|
|
865
|
+
g.EventEmitter = g;
|
|
866
|
+
g.usingDomains = !1;
|
|
867
|
+
g.prototype.domain = void 0;
|
|
868
|
+
g.prototype._events = void 0;
|
|
869
|
+
g.prototype._maxListeners = void 0;
|
|
870
|
+
g.defaultMaxListeners = 10;
|
|
871
|
+
g.init = function() {
|
|
872
|
+
this.domain = null, g.usingDomains && Le.active && !(this instanceof Le.Domain) && (this.domain = Le.active), (!this._events || this._events === Object.getPrototypeOf(this)._events) && (this._events = new Z(), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
|
|
873
|
+
};
|
|
874
|
+
g.prototype.setMaxListeners = function(e) {
|
|
875
875
|
if (typeof e != "number" || e < 0 || isNaN(e))
|
|
876
876
|
throw new TypeError('"n" argument must be a positive number');
|
|
877
877
|
return this._maxListeners = e, this;
|
|
878
878
|
};
|
|
879
879
|
function Lt(t) {
|
|
880
|
-
return t._maxListeners === void 0 ?
|
|
880
|
+
return t._maxListeners === void 0 ? g.defaultMaxListeners : t._maxListeners;
|
|
881
881
|
}
|
|
882
|
-
|
|
882
|
+
g.prototype.getMaxListeners = function() {
|
|
883
883
|
return Lt(this);
|
|
884
884
|
};
|
|
885
885
|
function Br(t, e, r) {
|
|
@@ -907,25 +907,25 @@ function Pr(t, e, r, n, i, o) {
|
|
|
907
907
|
if (e)
|
|
908
908
|
t.call(r, n, i, o);
|
|
909
909
|
else
|
|
910
|
-
for (var s = t.length, a = ce(t, s),
|
|
911
|
-
a[
|
|
910
|
+
for (var s = t.length, a = ce(t, s), f = 0; f < s; ++f)
|
|
911
|
+
a[f].call(r, n, i, o);
|
|
912
912
|
}
|
|
913
|
-
function
|
|
913
|
+
function jr(t, e, r, n) {
|
|
914
914
|
if (e)
|
|
915
915
|
t.apply(r, n);
|
|
916
916
|
else
|
|
917
917
|
for (var i = t.length, o = ce(t, i), s = 0; s < i; ++s)
|
|
918
918
|
o[s].apply(r, n);
|
|
919
919
|
}
|
|
920
|
-
|
|
921
|
-
var r, n, i, o, s, a,
|
|
920
|
+
g.prototype.emit = function(e) {
|
|
921
|
+
var r, n, i, o, s, a, f, u = e === "error";
|
|
922
922
|
if (a = this._events, a)
|
|
923
923
|
u = u && a.error == null;
|
|
924
924
|
else if (!u)
|
|
925
925
|
return !1;
|
|
926
|
-
if (
|
|
927
|
-
if (r = arguments[1],
|
|
928
|
-
r || (r = new Error('Uncaught, unspecified "error" event')), r.domainEmitter = this, r.domain =
|
|
926
|
+
if (f = this.domain, u) {
|
|
927
|
+
if (r = arguments[1], f)
|
|
928
|
+
r || (r = new Error('Uncaught, unspecified "error" event')), r.domainEmitter = this, r.domain = f, r.domainThrown = !1, f.emit("error", r);
|
|
929
929
|
else {
|
|
930
930
|
if (r instanceof Error)
|
|
931
931
|
throw r;
|
|
@@ -955,7 +955,7 @@ p.prototype.emit = function(e) {
|
|
|
955
955
|
default:
|
|
956
956
|
for (o = new Array(i - 1), s = 1; s < i; s++)
|
|
957
957
|
o[s - 1] = arguments[s];
|
|
958
|
-
|
|
958
|
+
jr(n, h, this, o);
|
|
959
959
|
}
|
|
960
960
|
return !0;
|
|
961
961
|
};
|
|
@@ -972,18 +972,18 @@ function Dt(t, e, r, n) {
|
|
|
972
972
|
else if (typeof s == "function" ? s = o[e] = n ? [r, s] : [s, r] : n ? s.unshift(r) : s.push(r), !s.warned && (i = Lt(t), i && i > 0 && s.length > i)) {
|
|
973
973
|
s.warned = !0;
|
|
974
974
|
var a = new Error("Possible EventEmitter memory leak detected. " + s.length + " " + e + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
975
|
-
a.name = "MaxListenersExceededWarning", a.emitter = t, a.type = e, a.count = s.length,
|
|
975
|
+
a.name = "MaxListenersExceededWarning", a.emitter = t, a.type = e, a.count = s.length, $r(a);
|
|
976
976
|
}
|
|
977
977
|
return t;
|
|
978
978
|
}
|
|
979
|
-
function
|
|
979
|
+
function $r(t) {
|
|
980
980
|
typeof console.warn == "function" ? console.warn(t) : console.log(t);
|
|
981
981
|
}
|
|
982
|
-
|
|
982
|
+
g.prototype.addListener = function(e, r) {
|
|
983
983
|
return Dt(this, e, r, !1);
|
|
984
984
|
};
|
|
985
|
-
|
|
986
|
-
|
|
985
|
+
g.prototype.on = g.prototype.addListener;
|
|
986
|
+
g.prototype.prependListener = function(e, r) {
|
|
987
987
|
return Dt(this, e, r, !0);
|
|
988
988
|
};
|
|
989
989
|
function Nt(t, e, r) {
|
|
@@ -993,17 +993,17 @@ function Nt(t, e, r) {
|
|
|
993
993
|
}
|
|
994
994
|
return i.listener = r, i;
|
|
995
995
|
}
|
|
996
|
-
|
|
996
|
+
g.prototype.once = function(e, r) {
|
|
997
997
|
if (typeof r != "function")
|
|
998
998
|
throw new TypeError('"listener" argument must be a function');
|
|
999
999
|
return this.on(e, Nt(this, e, r)), this;
|
|
1000
1000
|
};
|
|
1001
|
-
|
|
1001
|
+
g.prototype.prependOnceListener = function(e, r) {
|
|
1002
1002
|
if (typeof r != "function")
|
|
1003
1003
|
throw new TypeError('"listener" argument must be a function');
|
|
1004
1004
|
return this.prependListener(e, Nt(this, e, r)), this;
|
|
1005
1005
|
};
|
|
1006
|
-
|
|
1006
|
+
g.prototype.removeListener = function(e, r) {
|
|
1007
1007
|
var n, i, o, s, a;
|
|
1008
1008
|
if (typeof r != "function")
|
|
1009
1009
|
throw new TypeError('"listener" argument must be a function');
|
|
@@ -1031,7 +1031,7 @@ p.prototype.removeListener = function(e, r) {
|
|
|
1031
1031
|
}
|
|
1032
1032
|
return this;
|
|
1033
1033
|
};
|
|
1034
|
-
|
|
1034
|
+
g.prototype.removeAllListeners = function(e) {
|
|
1035
1035
|
var r, n;
|
|
1036
1036
|
if (n = this._events, !n)
|
|
1037
1037
|
return this;
|
|
@@ -1050,14 +1050,14 @@ p.prototype.removeAllListeners = function(e) {
|
|
|
1050
1050
|
while (r[0]);
|
|
1051
1051
|
return this;
|
|
1052
1052
|
};
|
|
1053
|
-
|
|
1053
|
+
g.prototype.listeners = function(e) {
|
|
1054
1054
|
var r, n, i = this._events;
|
|
1055
1055
|
return i ? (r = i[e], r ? typeof r == "function" ? n = [r.listener || r] : n = zr(r) : n = []) : n = [], n;
|
|
1056
1056
|
};
|
|
1057
|
-
|
|
1057
|
+
g.listenerCount = function(t, e) {
|
|
1058
1058
|
return typeof t.listenerCount == "function" ? t.listenerCount(e) : Ft.call(t, e);
|
|
1059
1059
|
};
|
|
1060
|
-
|
|
1060
|
+
g.prototype.listenerCount = Ft;
|
|
1061
1061
|
function Ft(t) {
|
|
1062
1062
|
var e = this._events;
|
|
1063
1063
|
if (e) {
|
|
@@ -1069,7 +1069,7 @@ function Ft(t) {
|
|
|
1069
1069
|
}
|
|
1070
1070
|
return 0;
|
|
1071
1071
|
}
|
|
1072
|
-
|
|
1072
|
+
g.prototype.eventNames = function() {
|
|
1073
1073
|
return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
|
|
1074
1074
|
};
|
|
1075
1075
|
function qr(t, e) {
|
|
@@ -1203,10 +1203,10 @@ function Hr(t) {
|
|
|
1203
1203
|
Qe(s) || !he(s) ? o += " " + s : o += " " + K(s);
|
|
1204
1204
|
return o;
|
|
1205
1205
|
}
|
|
1206
|
-
function
|
|
1206
|
+
function jt(t, e) {
|
|
1207
1207
|
if (X(ae.process))
|
|
1208
1208
|
return function() {
|
|
1209
|
-
return
|
|
1209
|
+
return jt(t, e).apply(this, arguments);
|
|
1210
1210
|
};
|
|
1211
1211
|
if (be.noDeprecation === !0)
|
|
1212
1212
|
return t;
|
|
@@ -1240,7 +1240,7 @@ function K(t, e) {
|
|
|
1240
1240
|
seen: [],
|
|
1241
1241
|
stylize: Xr
|
|
1242
1242
|
};
|
|
1243
|
-
return arguments.length >= 3 && (r.depth = arguments[2]), arguments.length >= 4 && (r.colors = arguments[3]),
|
|
1243
|
+
return arguments.length >= 3 && (r.depth = arguments[2]), arguments.length >= 4 && (r.colors = arguments[3]), $t(e) ? r.showHidden = e : e && on(r, e), X(r.showHidden) && (r.showHidden = !1), X(r.depth) && (r.depth = 2), X(r.colors) && (r.colors = !1), X(r.customInspect) && (r.customInspect = !0), r.colors && (r.stylize = Gr), Ee(r, t, r.depth);
|
|
1244
1244
|
}
|
|
1245
1245
|
K.colors = {
|
|
1246
1246
|
bold: [1, 22],
|
|
@@ -1306,20 +1306,20 @@ function Ee(t, e, r) {
|
|
|
1306
1306
|
if (Me(e))
|
|
1307
1307
|
return Ne(e);
|
|
1308
1308
|
}
|
|
1309
|
-
var
|
|
1309
|
+
var f = "", u = !1, c = ["{", "}"];
|
|
1310
1310
|
if (rn(e) && (u = !0, c = ["[", "]"]), Be(e)) {
|
|
1311
1311
|
var h = e.name ? ": " + e.name : "";
|
|
1312
|
-
|
|
1312
|
+
f = " [Function" + h + "]";
|
|
1313
1313
|
}
|
|
1314
|
-
if (Fe(e) && (
|
|
1315
|
-
return c[0] +
|
|
1314
|
+
if (Fe(e) && (f = " " + RegExp.prototype.toString.call(e)), it(e) && (f = " " + Date.prototype.toUTCString.call(e)), Me(e) && (f = " " + Ne(e)), o.length === 0 && (!u || e.length == 0))
|
|
1315
|
+
return c[0] + f + c[1];
|
|
1316
1316
|
if (r < 0)
|
|
1317
1317
|
return Fe(e) ? t.stylize(RegExp.prototype.toString.call(e), "regexp") : t.stylize("[Object]", "special");
|
|
1318
1318
|
t.seen.push(e);
|
|
1319
|
-
var
|
|
1320
|
-
return u ?
|
|
1321
|
-
return ze(t, e, r, s,
|
|
1322
|
-
}), t.seen.pop(), tn(
|
|
1319
|
+
var p;
|
|
1320
|
+
return u ? p = en(t, e, r, s, o) : p = o.map(function(m) {
|
|
1321
|
+
return ze(t, e, r, s, m, u);
|
|
1322
|
+
}), t.seen.pop(), tn(p, f, c);
|
|
1323
1323
|
}
|
|
1324
1324
|
function Kr(t, e) {
|
|
1325
1325
|
if (X(e))
|
|
@@ -1330,7 +1330,7 @@ function Kr(t, e) {
|
|
|
1330
1330
|
}
|
|
1331
1331
|
if (nn(e))
|
|
1332
1332
|
return t.stylize("" + e, "number");
|
|
1333
|
-
if (
|
|
1333
|
+
if ($t(e))
|
|
1334
1334
|
return t.stylize("" + e, "boolean");
|
|
1335
1335
|
if (Qe(e))
|
|
1336
1336
|
return t.stylize("null", "null");
|
|
@@ -1348,20 +1348,20 @@ function en(t, e, r, n, i) {
|
|
|
1348
1348
|
String(s),
|
|
1349
1349
|
!0
|
|
1350
1350
|
)) : o.push("");
|
|
1351
|
-
return i.forEach(function(
|
|
1352
|
-
|
|
1351
|
+
return i.forEach(function(f) {
|
|
1352
|
+
f.match(/^\d+$/) || o.push(ze(
|
|
1353
1353
|
t,
|
|
1354
1354
|
e,
|
|
1355
1355
|
r,
|
|
1356
1356
|
n,
|
|
1357
|
-
|
|
1357
|
+
f,
|
|
1358
1358
|
!0
|
|
1359
1359
|
));
|
|
1360
1360
|
}), o;
|
|
1361
1361
|
}
|
|
1362
1362
|
function ze(t, e, r, n, i, o) {
|
|
1363
|
-
var s, a,
|
|
1364
|
-
if (
|
|
1363
|
+
var s, a, f;
|
|
1364
|
+
if (f = Object.getOwnPropertyDescriptor(e, i) || { value: e[i] }, f.get ? f.set ? a = t.stylize("[Getter/Setter]", "special") : a = t.stylize("[Getter]", "special") : f.set && (a = t.stylize("[Setter]", "special")), qt(n, i) || (s = "[" + i + "]"), a || (t.seen.indexOf(f.value) < 0 ? (Qe(r) ? a = Ee(t, f.value, null) : a = Ee(t, f.value, r - 1), a.indexOf(`
|
|
1365
1365
|
`) > -1 && (o ? a = a.split(`
|
|
1366
1366
|
`).map(function(u) {
|
|
1367
1367
|
return " " + u;
|
|
@@ -1390,7 +1390,7 @@ function tn(t, e, r) {
|
|
|
1390
1390
|
function rn(t) {
|
|
1391
1391
|
return Array.isArray(t);
|
|
1392
1392
|
}
|
|
1393
|
-
function
|
|
1393
|
+
function $t(t) {
|
|
1394
1394
|
return typeof t == "boolean";
|
|
1395
1395
|
}
|
|
1396
1396
|
function Qe(t) {
|
|
@@ -1459,13 +1459,13 @@ ie.prototype.join = function(t) {
|
|
|
1459
1459
|
return r;
|
|
1460
1460
|
};
|
|
1461
1461
|
ie.prototype.concat = function(t) {
|
|
1462
|
-
if (this.length === 0) return
|
|
1462
|
+
if (this.length === 0) return l.alloc(0);
|
|
1463
1463
|
if (this.length === 1) return this.head.data;
|
|
1464
|
-
for (var e =
|
|
1464
|
+
for (var e = l.allocUnsafe(t >>> 0), r = this.head, n = 0; r; )
|
|
1465
1465
|
r.data.copy(e, n), n += r.data.length, r = r.next;
|
|
1466
1466
|
return e;
|
|
1467
1467
|
};
|
|
1468
|
-
var sn =
|
|
1468
|
+
var sn = l.isEncoding || function(t) {
|
|
1469
1469
|
switch (t && t.toLowerCase()) {
|
|
1470
1470
|
case "hex":
|
|
1471
1471
|
case "utf8":
|
|
@@ -1503,7 +1503,7 @@ function de(t) {
|
|
|
1503
1503
|
this.write = fn;
|
|
1504
1504
|
return;
|
|
1505
1505
|
}
|
|
1506
|
-
this.charBuffer = new
|
|
1506
|
+
this.charBuffer = new l(6), this.charReceived = 0, this.charLength = 0;
|
|
1507
1507
|
}
|
|
1508
1508
|
de.prototype.write = function(t) {
|
|
1509
1509
|
for (var e = ""; this.charLength; ) {
|
|
@@ -1565,9 +1565,9 @@ function ln(t) {
|
|
|
1565
1565
|
function un(t) {
|
|
1566
1566
|
this.charReceived = t.length % 3, this.charLength = this.charReceived ? 3 : 0;
|
|
1567
1567
|
}
|
|
1568
|
-
|
|
1569
|
-
var
|
|
1570
|
-
fe(
|
|
1568
|
+
S.ReadableState = zt;
|
|
1569
|
+
var b = Qr("stream");
|
|
1570
|
+
fe(S, g);
|
|
1571
1571
|
function cn(t, e, r) {
|
|
1572
1572
|
if (typeof t.prependListener == "function")
|
|
1573
1573
|
return t.prependListener(e, r);
|
|
@@ -1581,19 +1581,19 @@ function zt(t, e) {
|
|
|
1581
1581
|
var r = t.highWaterMark, n = this.objectMode ? 16 : 16 * 1024;
|
|
1582
1582
|
this.highWaterMark = r || r === 0 ? r : n, this.highWaterMark = ~~this.highWaterMark, this.buffer = new ie(), 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 de(t.encoding), this.encoding = t.encoding);
|
|
1583
1583
|
}
|
|
1584
|
-
function
|
|
1585
|
-
if (!(this instanceof
|
|
1586
|
-
this._readableState = new zt(t, this), this.readable = !0, t && typeof t.read == "function" && (this._read = t.read),
|
|
1584
|
+
function S(t) {
|
|
1585
|
+
if (!(this instanceof S)) return new S(t);
|
|
1586
|
+
this._readableState = new zt(t, this), this.readable = !0, t && typeof t.read == "function" && (this._read = t.read), g.call(this);
|
|
1587
1587
|
}
|
|
1588
|
-
|
|
1588
|
+
S.prototype.push = function(t, e) {
|
|
1589
1589
|
var r = this._readableState;
|
|
1590
|
-
return !r.objectMode && typeof t == "string" && (e = e || r.defaultEncoding, e !== r.encoding && (t =
|
|
1590
|
+
return !r.objectMode && typeof t == "string" && (e = e || r.defaultEncoding, e !== r.encoding && (t = l.from(t, e), e = "")), Vt(this, r, t, e, !1);
|
|
1591
1591
|
};
|
|
1592
|
-
|
|
1592
|
+
S.prototype.unshift = function(t) {
|
|
1593
1593
|
var e = this._readableState;
|
|
1594
1594
|
return Vt(this, e, t, "", !0);
|
|
1595
1595
|
};
|
|
1596
|
-
|
|
1596
|
+
S.prototype.isPaused = function() {
|
|
1597
1597
|
return this._readableState.flowing === !1;
|
|
1598
1598
|
};
|
|
1599
1599
|
function Vt(t, e, r, n, i) {
|
|
@@ -1610,8 +1610,8 @@ function Vt(t, e, r, n, i) {
|
|
|
1610
1610
|
var a = new Error("stream.unshift() after end event");
|
|
1611
1611
|
t.emit("error", a);
|
|
1612
1612
|
} else {
|
|
1613
|
-
var
|
|
1614
|
-
e.decoder && !i && !n && (r = e.decoder.write(r),
|
|
1613
|
+
var f;
|
|
1614
|
+
e.decoder && !i && !n && (r = e.decoder.write(r), f = !e.objectMode && r.length === 0), i || (e.reading = !1), f || (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 && Oe(t))), _n(t, e);
|
|
1615
1615
|
}
|
|
1616
1616
|
else i || (e.reading = !1);
|
|
1617
1617
|
return dn(e);
|
|
@@ -1619,7 +1619,7 @@ function Vt(t, e, r, n, i) {
|
|
|
1619
1619
|
function dn(t) {
|
|
1620
1620
|
return !t.ended && (t.needReadable || t.length < t.highWaterMark || t.length === 0);
|
|
1621
1621
|
}
|
|
1622
|
-
|
|
1622
|
+
S.prototype.setEncoding = function(t) {
|
|
1623
1623
|
return this._readableState.decoder = new de(t), this._readableState.encoding = t, this;
|
|
1624
1624
|
};
|
|
1625
1625
|
var ot = 8388608;
|
|
@@ -1629,15 +1629,15 @@ function pn(t) {
|
|
|
1629
1629
|
function st(t, e) {
|
|
1630
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 = pn(t)), t <= e.length ? t : e.ended ? e.length : (e.needReadable = !0, 0));
|
|
1631
1631
|
}
|
|
1632
|
-
|
|
1633
|
-
|
|
1632
|
+
S.prototype.read = function(t) {
|
|
1633
|
+
b("read", t), t = parseInt(t, 10);
|
|
1634
1634
|
var e = this._readableState, r = t;
|
|
1635
1635
|
if (t !== 0 && (e.emittedReadable = !1), t === 0 && e.needReadable && (e.length >= e.highWaterMark || e.ended))
|
|
1636
|
-
return
|
|
1636
|
+
return b("read: emitReadable", e.length, e.ended), e.length === 0 && e.ended ? ke(this) : Oe(this), null;
|
|
1637
1637
|
if (t = st(t, e), t === 0 && e.ended)
|
|
1638
1638
|
return e.length === 0 && ke(this), null;
|
|
1639
1639
|
var n = e.needReadable;
|
|
1640
|
-
|
|
1640
|
+
b("need readable", n), (e.length === 0 || e.length - t < e.highWaterMark) && (n = !0, b("length less than watermark", n)), e.ended || e.reading ? (n = !1, b("reading or ended", n)) : n && (b("do read"), e.reading = !0, e.sync = !0, e.length === 0 && (e.needReadable = !0), this._read(e.highWaterMark), e.sync = !1, e.reading || (t = st(r, e)));
|
|
1641
1641
|
var i;
|
|
1642
1642
|
return t > 0 ? i = Jt(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 && ke(this)), i !== null && this.emit("data", i), i;
|
|
1643
1643
|
};
|
|
@@ -1656,23 +1656,23 @@ function mn(t, e) {
|
|
|
1656
1656
|
}
|
|
1657
1657
|
function Oe(t) {
|
|
1658
1658
|
var e = t._readableState;
|
|
1659
|
-
e.needReadable = !1, e.emittedReadable || (
|
|
1659
|
+
e.needReadable = !1, e.emittedReadable || (b("emitReadable", e.flowing), e.emittedReadable = !0, e.sync ? k(at, t) : at(t));
|
|
1660
1660
|
}
|
|
1661
1661
|
function at(t) {
|
|
1662
|
-
|
|
1662
|
+
b("emit readable"), t.emit("readable"), Ze(t);
|
|
1663
1663
|
}
|
|
1664
1664
|
function _n(t, e) {
|
|
1665
1665
|
e.readingMore || (e.readingMore = !0, k(wn, t, e));
|
|
1666
1666
|
}
|
|
1667
1667
|
function wn(t, e) {
|
|
1668
|
-
for (var r = e.length; !e.reading && !e.flowing && !e.ended && e.length < e.highWaterMark && (
|
|
1668
|
+
for (var r = e.length; !e.reading && !e.flowing && !e.ended && e.length < e.highWaterMark && (b("maybeReadMore read 0"), t.read(0), r !== e.length); )
|
|
1669
1669
|
r = e.length;
|
|
1670
1670
|
e.readingMore = !1;
|
|
1671
1671
|
}
|
|
1672
|
-
|
|
1672
|
+
S.prototype._read = function(t) {
|
|
1673
1673
|
this.emit("error", new Error("not implemented"));
|
|
1674
1674
|
};
|
|
1675
|
-
|
|
1675
|
+
S.prototype.pipe = function(t, e) {
|
|
1676
1676
|
var r = this, n = this._readableState;
|
|
1677
1677
|
switch (n.pipesCount) {
|
|
1678
1678
|
case 0:
|
|
@@ -1685,52 +1685,52 @@ E.prototype.pipe = function(t, e) {
|
|
|
1685
1685
|
n.pipes.push(t);
|
|
1686
1686
|
break;
|
|
1687
1687
|
}
|
|
1688
|
-
n.pipesCount += 1,
|
|
1688
|
+
n.pipesCount += 1, b("pipe count=%d opts=%j", n.pipesCount, e);
|
|
1689
1689
|
var i = !e || e.end !== !1, o = i ? a : c;
|
|
1690
1690
|
n.endEmitted ? k(o) : r.once("end", o), t.on("unpipe", s);
|
|
1691
|
-
function s(
|
|
1692
|
-
|
|
1691
|
+
function s(R) {
|
|
1692
|
+
b("onunpipe"), R === r && c();
|
|
1693
1693
|
}
|
|
1694
1694
|
function a() {
|
|
1695
|
-
|
|
1695
|
+
b("onend"), t.end();
|
|
1696
1696
|
}
|
|
1697
|
-
var
|
|
1698
|
-
t.on("drain",
|
|
1697
|
+
var f = yn(r);
|
|
1698
|
+
t.on("drain", f);
|
|
1699
1699
|
var u = !1;
|
|
1700
1700
|
function c() {
|
|
1701
|
-
|
|
1701
|
+
b("cleanup"), t.removeListener("close", E), t.removeListener("finish", x), t.removeListener("drain", f), t.removeListener("error", m), t.removeListener("unpipe", s), r.removeListener("end", a), r.removeListener("end", c), r.removeListener("data", p), u = !0, n.awaitDrain && (!t._writableState || t._writableState.needDrain) && f();
|
|
1702
1702
|
}
|
|
1703
1703
|
var h = !1;
|
|
1704
|
-
r.on("data",
|
|
1705
|
-
function
|
|
1706
|
-
|
|
1707
|
-
var v = t.write(
|
|
1708
|
-
v === !1 && !h && ((n.pipesCount === 1 && n.pipes === t || n.pipesCount > 1 && Yt(n.pipes, t) !== -1) && !u && (
|
|
1704
|
+
r.on("data", p);
|
|
1705
|
+
function p(R) {
|
|
1706
|
+
b("ondata"), h = !1;
|
|
1707
|
+
var v = t.write(R);
|
|
1708
|
+
v === !1 && !h && ((n.pipesCount === 1 && n.pipes === t || n.pipesCount > 1 && Yt(n.pipes, t) !== -1) && !u && (b("false write response, pause", r._readableState.awaitDrain), r._readableState.awaitDrain++, h = !0), r.pause());
|
|
1709
1709
|
}
|
|
1710
|
-
function
|
|
1711
|
-
|
|
1710
|
+
function m(R) {
|
|
1711
|
+
b("onerror", R), F(), t.removeListener("error", m), hn(t, "error") === 0 && t.emit("error", R);
|
|
1712
1712
|
}
|
|
1713
|
-
cn(t, "error",
|
|
1714
|
-
function
|
|
1713
|
+
cn(t, "error", m);
|
|
1714
|
+
function E() {
|
|
1715
1715
|
t.removeListener("finish", x), F();
|
|
1716
1716
|
}
|
|
1717
|
-
t.once("close",
|
|
1717
|
+
t.once("close", E);
|
|
1718
1718
|
function x() {
|
|
1719
|
-
|
|
1719
|
+
b("onfinish"), t.removeListener("close", E), F();
|
|
1720
1720
|
}
|
|
1721
1721
|
t.once("finish", x);
|
|
1722
1722
|
function F() {
|
|
1723
|
-
|
|
1723
|
+
b("unpipe"), r.unpipe(t);
|
|
1724
1724
|
}
|
|
1725
|
-
return t.emit("pipe", r), n.flowing || (
|
|
1725
|
+
return t.emit("pipe", r), n.flowing || (b("pipe resume"), r.resume()), t;
|
|
1726
1726
|
};
|
|
1727
1727
|
function yn(t) {
|
|
1728
1728
|
return function() {
|
|
1729
1729
|
var e = t._readableState;
|
|
1730
|
-
|
|
1730
|
+
b("pipeOnDrain", e.awaitDrain), e.awaitDrain && e.awaitDrain--, e.awaitDrain === 0 && t.listeners("data").length && (e.flowing = !0, Ze(t));
|
|
1731
1731
|
};
|
|
1732
1732
|
}
|
|
1733
|
-
|
|
1733
|
+
S.prototype.unpipe = function(t) {
|
|
1734
1734
|
var e = this._readableState;
|
|
1735
1735
|
if (e.pipesCount === 0) return this;
|
|
1736
1736
|
if (e.pipesCount === 1)
|
|
@@ -1745,8 +1745,8 @@ E.prototype.unpipe = function(t) {
|
|
|
1745
1745
|
var o = Yt(e.pipes, t);
|
|
1746
1746
|
return o === -1 ? this : (e.pipes.splice(o, 1), e.pipesCount -= 1, e.pipesCount === 1 && (e.pipes = e.pipes[0]), t.emit("unpipe", this), this);
|
|
1747
1747
|
};
|
|
1748
|
-
|
|
1749
|
-
var r =
|
|
1748
|
+
S.prototype.on = function(t, e) {
|
|
1749
|
+
var r = g.prototype.on.call(this, t, e);
|
|
1750
1750
|
if (t === "data")
|
|
1751
1751
|
this._readableState.flowing !== !1 && this.resume();
|
|
1752
1752
|
else if (t === "readable") {
|
|
@@ -1755,38 +1755,38 @@ E.prototype.on = function(t, e) {
|
|
|
1755
1755
|
}
|
|
1756
1756
|
return r;
|
|
1757
1757
|
};
|
|
1758
|
-
|
|
1758
|
+
S.prototype.addListener = S.prototype.on;
|
|
1759
1759
|
function bn(t) {
|
|
1760
|
-
|
|
1760
|
+
b("readable nexttick read 0"), t.read(0);
|
|
1761
1761
|
}
|
|
1762
|
-
|
|
1762
|
+
S.prototype.resume = function() {
|
|
1763
1763
|
var t = this._readableState;
|
|
1764
|
-
return t.flowing || (
|
|
1764
|
+
return t.flowing || (b("resume"), t.flowing = !0, vn(this, t)), this;
|
|
1765
1765
|
};
|
|
1766
1766
|
function vn(t, e) {
|
|
1767
1767
|
e.resumeScheduled || (e.resumeScheduled = !0, k(xn, t, e));
|
|
1768
1768
|
}
|
|
1769
1769
|
function xn(t, e) {
|
|
1770
|
-
e.reading || (
|
|
1770
|
+
e.reading || (b("resume read 0"), t.read(0)), e.resumeScheduled = !1, e.awaitDrain = 0, t.emit("resume"), Ze(t), e.flowing && !e.reading && t.read(0);
|
|
1771
1771
|
}
|
|
1772
|
-
|
|
1773
|
-
return
|
|
1772
|
+
S.prototype.pause = function() {
|
|
1773
|
+
return b("call pause flowing=%j", this._readableState.flowing), this._readableState.flowing !== !1 && (b("pause"), this._readableState.flowing = !1, this.emit("pause")), this;
|
|
1774
1774
|
};
|
|
1775
1775
|
function Ze(t) {
|
|
1776
1776
|
var e = t._readableState;
|
|
1777
|
-
for (
|
|
1777
|
+
for (b("flow", e.flowing); e.flowing && t.read() !== null; )
|
|
1778
1778
|
;
|
|
1779
1779
|
}
|
|
1780
|
-
|
|
1780
|
+
S.prototype.wrap = function(t) {
|
|
1781
1781
|
var e = this._readableState, r = !1, n = this;
|
|
1782
1782
|
t.on("end", function() {
|
|
1783
|
-
if (
|
|
1783
|
+
if (b("wrapped end"), e.decoder && !e.ended) {
|
|
1784
1784
|
var s = e.decoder.end();
|
|
1785
1785
|
s && s.length && n.push(s);
|
|
1786
1786
|
}
|
|
1787
1787
|
n.push(null);
|
|
1788
1788
|
}), t.on("data", function(s) {
|
|
1789
|
-
if (
|
|
1789
|
+
if (b("wrapped data"), e.decoder && (s = e.decoder.write(s)), !(e.objectMode && s == null) && !(!e.objectMode && (!s || !s.length))) {
|
|
1790
1790
|
var a = n.push(s);
|
|
1791
1791
|
a || (r = !0, t.pause());
|
|
1792
1792
|
}
|
|
@@ -1801,10 +1801,10 @@ E.prototype.wrap = function(t) {
|
|
|
1801
1801
|
return Cn(o, function(s) {
|
|
1802
1802
|
t.on(s, n.emit.bind(n, s));
|
|
1803
1803
|
}), n._read = function(s) {
|
|
1804
|
-
|
|
1804
|
+
b("wrapped _read", s), r && (r = !1, t.resume());
|
|
1805
1805
|
}, n;
|
|
1806
1806
|
};
|
|
1807
|
-
|
|
1807
|
+
S._fromList = Jt;
|
|
1808
1808
|
function Jt(t, e) {
|
|
1809
1809
|
if (e.length === 0) return null;
|
|
1810
1810
|
var r;
|
|
@@ -1827,7 +1827,7 @@ function Sn(t, e) {
|
|
|
1827
1827
|
return e.length -= n, i;
|
|
1828
1828
|
}
|
|
1829
1829
|
function Rn(t, e) {
|
|
1830
|
-
var r =
|
|
1830
|
+
var r = l.allocUnsafe(t), n = e.head, i = 1;
|
|
1831
1831
|
for (n.data.copy(r), t -= n.data.length; n = n.next; ) {
|
|
1832
1832
|
var o = n.data, s = t > o.length ? o.length : t;
|
|
1833
1833
|
if (o.copy(r, r.length - t, 0, s), t -= s, t === 0) {
|
|
@@ -1855,8 +1855,8 @@ function Yt(t, e) {
|
|
|
1855
1855
|
if (t[r] === e) return r;
|
|
1856
1856
|
return -1;
|
|
1857
1857
|
}
|
|
1858
|
-
|
|
1859
|
-
fe(
|
|
1858
|
+
T.WritableState = Ke;
|
|
1859
|
+
fe(T, g);
|
|
1860
1860
|
function On() {
|
|
1861
1861
|
}
|
|
1862
1862
|
function An(t, e, r) {
|
|
@@ -1864,7 +1864,7 @@ function An(t, e, r) {
|
|
|
1864
1864
|
}
|
|
1865
1865
|
function Ke(t, e) {
|
|
1866
1866
|
Object.defineProperty(this, "buffer", {
|
|
1867
|
-
get:
|
|
1867
|
+
get: jt(function() {
|
|
1868
1868
|
return this.getBuffer();
|
|
1869
1869
|
}, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")
|
|
1870
1870
|
}), t = t || {}, this.objectMode = !!t.objectMode, e instanceof B && (this.objectMode = this.objectMode || !!t.writableObjectMode);
|
|
@@ -1880,11 +1880,11 @@ Ke.prototype.getBuffer = function() {
|
|
|
1880
1880
|
r.push(e), e = e.next;
|
|
1881
1881
|
return r;
|
|
1882
1882
|
};
|
|
1883
|
-
function
|
|
1884
|
-
if (!(this instanceof
|
|
1885
|
-
this._writableState = new Ke(t, this), this.writable = !0, t && (typeof t.write == "function" && (this._write = t.write), typeof t.writev == "function" && (this._writev = t.writev)),
|
|
1883
|
+
function T(t) {
|
|
1884
|
+
if (!(this instanceof T) && !(this instanceof B)) return new T(t);
|
|
1885
|
+
this._writableState = new Ke(t, this), this.writable = !0, t && (typeof t.write == "function" && (this._write = t.write), typeof t.writev == "function" && (this._writev = t.writev)), g.call(this);
|
|
1886
1886
|
}
|
|
1887
|
-
|
|
1887
|
+
T.prototype.pipe = function() {
|
|
1888
1888
|
this.emit("error", new Error("Cannot pipe, not readable"));
|
|
1889
1889
|
};
|
|
1890
1890
|
function Tn(t, e) {
|
|
@@ -1893,29 +1893,29 @@ function Tn(t, e) {
|
|
|
1893
1893
|
}
|
|
1894
1894
|
function Ln(t, e, r, n) {
|
|
1895
1895
|
var i = !0, o = !1;
|
|
1896
|
-
return r === null ? o = new TypeError("May not write null values to stream") : !
|
|
1896
|
+
return r === null ? o = new TypeError("May not write null values to stream") : !l.isBuffer(r) && typeof r != "string" && r !== void 0 && !e.objectMode && (o = new TypeError("Invalid non-string/buffer chunk")), o && (t.emit("error", o), k(n, o), i = !1), i;
|
|
1897
1897
|
}
|
|
1898
|
-
|
|
1898
|
+
T.prototype.write = function(t, e, r) {
|
|
1899
1899
|
var n = this._writableState, i = !1;
|
|
1900
|
-
return typeof e == "function" && (r = e, e = null),
|
|
1900
|
+
return typeof e == "function" && (r = e, e = null), l.isBuffer(t) ? e = "buffer" : e || (e = n.defaultEncoding), typeof r != "function" && (r = On), n.ended ? Tn(this, r) : Ln(this, n, t, r) && (n.pendingcb++, i = Nn(this, n, t, e, r)), i;
|
|
1901
1901
|
};
|
|
1902
|
-
|
|
1902
|
+
T.prototype.cork = function() {
|
|
1903
1903
|
var t = this._writableState;
|
|
1904
1904
|
t.corked++;
|
|
1905
1905
|
};
|
|
1906
|
-
|
|
1906
|
+
T.prototype.uncork = function() {
|
|
1907
1907
|
var t = this._writableState;
|
|
1908
1908
|
t.corked && (t.corked--, !t.writing && !t.corked && !t.finished && !t.bufferProcessing && t.bufferedRequest && Wt(this, t));
|
|
1909
1909
|
};
|
|
1910
|
-
|
|
1910
|
+
T.prototype.setDefaultEncoding = function(e) {
|
|
1911
1911
|
if (typeof e == "string" && (e = e.toLowerCase()), !(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((e + "").toLowerCase()) > -1)) throw new TypeError("Unknown encoding: " + e);
|
|
1912
1912
|
return this._writableState.defaultEncoding = e, this;
|
|
1913
1913
|
};
|
|
1914
1914
|
function Dn(t, e, r) {
|
|
1915
|
-
return !t.objectMode && t.decodeStrings !== !1 && typeof e == "string" && (e =
|
|
1915
|
+
return !t.objectMode && t.decodeStrings !== !1 && typeof e == "string" && (e = l.from(e, r)), e;
|
|
1916
1916
|
}
|
|
1917
1917
|
function Nn(t, e, r, n, i) {
|
|
1918
|
-
r = Dn(e, r, n),
|
|
1918
|
+
r = Dn(e, r, n), l.isBuffer(r) && (n = "buffer");
|
|
1919
1919
|
var o = e.objectMode ? 1 : r.length;
|
|
1920
1920
|
e.length += o;
|
|
1921
1921
|
var s = e.length < e.highWaterMark;
|
|
@@ -1960,19 +1960,19 @@ function Wt(t, e) {
|
|
|
1960
1960
|
Ve(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 Gt(e);
|
|
1961
1961
|
} else {
|
|
1962
1962
|
for (; r; ) {
|
|
1963
|
-
var a = r.chunk,
|
|
1964
|
-
if (Ve(t, e, !1, c, a,
|
|
1963
|
+
var a = r.chunk, f = r.encoding, u = r.callback, c = e.objectMode ? 1 : a.length;
|
|
1964
|
+
if (Ve(t, e, !1, c, a, f, u), r = r.next, e.writing)
|
|
1965
1965
|
break;
|
|
1966
1966
|
}
|
|
1967
1967
|
r === null && (e.lastBufferedRequest = null);
|
|
1968
1968
|
}
|
|
1969
1969
|
e.bufferedRequestCount = 0, e.bufferedRequest = r, e.bufferProcessing = !1;
|
|
1970
1970
|
}
|
|
1971
|
-
|
|
1971
|
+
T.prototype._write = function(t, e, r) {
|
|
1972
1972
|
r(new Error("not implemented"));
|
|
1973
1973
|
};
|
|
1974
|
-
|
|
1975
|
-
|
|
1974
|
+
T.prototype._writev = null;
|
|
1975
|
+
T.prototype.end = function(t, e, r) {
|
|
1976
1976
|
var n = this._writableState;
|
|
1977
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 && Un(this, n, r);
|
|
1978
1978
|
};
|
|
@@ -2000,24 +2000,24 @@ function Gt(t) {
|
|
|
2000
2000
|
t.corkedRequestsFree ? t.corkedRequestsFree.next = e : t.corkedRequestsFree = e;
|
|
2001
2001
|
};
|
|
2002
2002
|
}
|
|
2003
|
-
fe(B,
|
|
2004
|
-
var ut = Object.keys(
|
|
2003
|
+
fe(B, S);
|
|
2004
|
+
var ut = Object.keys(T.prototype);
|
|
2005
2005
|
for (var Ue = 0; Ue < ut.length; Ue++) {
|
|
2006
2006
|
var Pe = ut[Ue];
|
|
2007
|
-
B.prototype[Pe] || (B.prototype[Pe] =
|
|
2007
|
+
B.prototype[Pe] || (B.prototype[Pe] = T.prototype[Pe]);
|
|
2008
2008
|
}
|
|
2009
2009
|
function B(t) {
|
|
2010
2010
|
if (!(this instanceof B)) return new B(t);
|
|
2011
|
-
|
|
2011
|
+
S.call(this, t), T.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", Pn);
|
|
2012
2012
|
}
|
|
2013
2013
|
function Pn() {
|
|
2014
|
-
this.allowHalfOpen || this._writableState.ended || k(
|
|
2014
|
+
this.allowHalfOpen || this._writableState.ended || k(jn, this);
|
|
2015
2015
|
}
|
|
2016
|
-
function
|
|
2016
|
+
function jn(t) {
|
|
2017
2017
|
t.end();
|
|
2018
2018
|
}
|
|
2019
2019
|
fe(P, B);
|
|
2020
|
-
function
|
|
2020
|
+
function $n(t) {
|
|
2021
2021
|
this.afterTransform = function(e, r) {
|
|
2022
2022
|
return qn(t, e, r);
|
|
2023
2023
|
}, this.needTransform = !1, this.transforming = !1, this.writecb = null, this.writechunk = null, this.writeencoding = null;
|
|
@@ -2033,7 +2033,7 @@ function qn(t, e, r) {
|
|
|
2033
2033
|
}
|
|
2034
2034
|
function P(t) {
|
|
2035
2035
|
if (!(this instanceof P)) return new P(t);
|
|
2036
|
-
B.call(this, t), this._transformState = new
|
|
2036
|
+
B.call(this, t), this._transformState = new $n(this);
|
|
2037
2037
|
var e = this;
|
|
2038
2038
|
this._readableState.needReadable = !0, this._readableState.sync = !1, t && (typeof t.transform == "function" && (this._transform = t.transform), typeof t.flush == "function" && (this._flush = t.flush)), this.once("prefinish", function() {
|
|
2039
2039
|
typeof this._flush == "function" ? this._flush(function(r) {
|
|
@@ -2073,15 +2073,15 @@ function ue(t) {
|
|
|
2073
2073
|
ue.prototype._transform = function(t, e, r) {
|
|
2074
2074
|
r(null, t);
|
|
2075
2075
|
};
|
|
2076
|
-
fe(W,
|
|
2077
|
-
W.Readable =
|
|
2078
|
-
W.Writable =
|
|
2076
|
+
fe(W, g);
|
|
2077
|
+
W.Readable = S;
|
|
2078
|
+
W.Writable = T;
|
|
2079
2079
|
W.Duplex = B;
|
|
2080
2080
|
W.Transform = P;
|
|
2081
2081
|
W.PassThrough = ue;
|
|
2082
2082
|
W.Stream = W;
|
|
2083
2083
|
function W() {
|
|
2084
|
-
|
|
2084
|
+
g.call(this);
|
|
2085
2085
|
}
|
|
2086
2086
|
W.prototype.pipe = function(t, e) {
|
|
2087
2087
|
var r = this;
|
|
@@ -2100,22 +2100,22 @@ W.prototype.pipe = function(t, e) {
|
|
|
2100
2100
|
function a() {
|
|
2101
2101
|
o || (o = !0, typeof t.destroy == "function" && t.destroy());
|
|
2102
2102
|
}
|
|
2103
|
-
function
|
|
2104
|
-
if (u(),
|
|
2103
|
+
function f(c) {
|
|
2104
|
+
if (u(), g.listenerCount(this, "error") === 0)
|
|
2105
2105
|
throw c;
|
|
2106
2106
|
}
|
|
2107
|
-
r.on("error",
|
|
2107
|
+
r.on("error", f), t.on("error", f);
|
|
2108
2108
|
function u() {
|
|
2109
|
-
r.removeListener("data", n), t.removeListener("drain", i), r.removeListener("end", s), r.removeListener("close", a), r.removeListener("error",
|
|
2109
|
+
r.removeListener("data", n), t.removeListener("drain", i), r.removeListener("end", s), r.removeListener("close", a), r.removeListener("error", f), t.removeListener("error", f), r.removeListener("end", u), r.removeListener("close", u), t.removeListener("close", u);
|
|
2110
2110
|
}
|
|
2111
2111
|
return r.on("end", u), r.on("close", u), t.on("close", u), t.emit("pipe", r), t;
|
|
2112
2112
|
};
|
|
2113
2113
|
const Xt = function(t) {
|
|
2114
2114
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
2115
2115
|
};
|
|
2116
|
-
class
|
|
2116
|
+
class _ extends Error {
|
|
2117
2117
|
constructor(e, r, n, ...i) {
|
|
2118
|
-
Array.isArray(r) && (r = r.join(" ").trim()), super(r), Error.captureStackTrace !== void 0 && Error.captureStackTrace(this,
|
|
2118
|
+
Array.isArray(r) && (r = r.join(" ").trim()), super(r), Error.captureStackTrace !== void 0 && Error.captureStackTrace(this, _), this.code = e;
|
|
2119
2119
|
for (const o of i)
|
|
2120
2120
|
for (const s in o) {
|
|
2121
2121
|
const a = o[s];
|
|
@@ -2133,14 +2133,14 @@ const Zt = function(t) {
|
|
|
2133
2133
|
e[r] = { name: i };
|
|
2134
2134
|
else if (Xt(i)) {
|
|
2135
2135
|
if (typeof i.name != "string")
|
|
2136
|
-
throw new
|
|
2136
|
+
throw new _("CSV_OPTION_COLUMNS_MISSING_NAME", [
|
|
2137
2137
|
"Option columns missing name:",
|
|
2138
2138
|
`property "name" is required at position ${r}`,
|
|
2139
2139
|
"when column is an object literal"
|
|
2140
2140
|
]);
|
|
2141
2141
|
e[r] = i;
|
|
2142
2142
|
} else
|
|
2143
|
-
throw new
|
|
2143
|
+
throw new _("CSV_INVALID_COLUMN_DEFINITION", [
|
|
2144
2144
|
"Invalid column definition:",
|
|
2145
2145
|
"expect a string or a literal object,",
|
|
2146
2146
|
`got ${JSON.stringify(i)} at position ${r}`
|
|
@@ -2150,7 +2150,7 @@ const Zt = function(t) {
|
|
|
2150
2150
|
};
|
|
2151
2151
|
class ht {
|
|
2152
2152
|
constructor(e = 100) {
|
|
2153
|
-
this.size = e, this.length = 0, this.buf =
|
|
2153
|
+
this.size = e, this.length = 0, this.buf = l.allocUnsafe(e);
|
|
2154
2154
|
}
|
|
2155
2155
|
prepend(e) {
|
|
2156
2156
|
if (D(e)) {
|
|
@@ -2158,7 +2158,7 @@ class ht {
|
|
|
2158
2158
|
if (r >= this.size && (this.resize(), r >= this.size))
|
|
2159
2159
|
throw Error("INVALID_BUFFER_STATE");
|
|
2160
2160
|
const n = this.buf;
|
|
2161
|
-
this.buf =
|
|
2161
|
+
this.buf = l.allocUnsafe(this.size), e.copy(this.buf, 0), n.copy(this.buf, e.length), this.length += e.length;
|
|
2162
2162
|
} else {
|
|
2163
2163
|
const r = this.length++;
|
|
2164
2164
|
r === this.size && this.resize();
|
|
@@ -2171,12 +2171,12 @@ class ht {
|
|
|
2171
2171
|
r === this.size && this.resize(), this.buf[r] = e;
|
|
2172
2172
|
}
|
|
2173
2173
|
clone() {
|
|
2174
|
-
return
|
|
2174
|
+
return l.from(this.buf.slice(0, this.length));
|
|
2175
2175
|
}
|
|
2176
2176
|
resize() {
|
|
2177
2177
|
const e = this.length;
|
|
2178
2178
|
this.size = this.size * 2;
|
|
2179
|
-
const r =
|
|
2179
|
+
const r = l.allocUnsafe(this.size);
|
|
2180
2180
|
this.buf.copy(r, 0, 0, e), this.buf = r;
|
|
2181
2181
|
}
|
|
2182
2182
|
toString(e) {
|
|
@@ -2199,7 +2199,7 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2199
2199
|
error: void 0,
|
|
2200
2200
|
enabled: t.from_line === 1,
|
|
2201
2201
|
escaping: !1,
|
|
2202
|
-
escapeIsQuote: D(t.escape) && D(t.quote) &&
|
|
2202
|
+
escapeIsQuote: D(t.escape) && D(t.quote) && l.compare(t.escape, t.quote) === 0,
|
|
2203
2203
|
// columns can be `false`, `true`, `Array`
|
|
2204
2204
|
expectedRecordLength: Array.isArray(t.columns) ? t.columns.length : void 0,
|
|
2205
2205
|
field: new ht(20),
|
|
@@ -2220,17 +2220,17 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2220
2220
|
record_length: 0,
|
|
2221
2221
|
recordDelimiterMaxLength: t.record_delimiter.length === 0 ? 0 : Math.max(...t.record_delimiter.map((e) => e.length)),
|
|
2222
2222
|
trimChars: [
|
|
2223
|
-
|
|
2224
|
-
|
|
2223
|
+
l.from(" ", t.encoding)[0],
|
|
2224
|
+
l.from(" ", t.encoding)[0]
|
|
2225
2225
|
],
|
|
2226
2226
|
wasQuoting: !1,
|
|
2227
2227
|
wasRowDelimiter: !1,
|
|
2228
2228
|
timchars: [
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2229
|
+
l.from(l.from([Vn], "utf8").toString(), t.encoding),
|
|
2230
|
+
l.from(l.from([Jn], "utf8").toString(), t.encoding),
|
|
2231
|
+
l.from(l.from([zn], "utf8").toString(), t.encoding),
|
|
2232
|
+
l.from(l.from([Yn], "utf8").toString(), t.encoding),
|
|
2233
|
+
l.from(l.from([Wn], "utf8").toString(), t.encoding)
|
|
2234
2234
|
]
|
|
2235
2235
|
};
|
|
2236
2236
|
}, Qn = function(t) {
|
|
@@ -2246,7 +2246,7 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2246
2246
|
else if (e.encoding === null || e.encoding === !1)
|
|
2247
2247
|
e.encoding = null;
|
|
2248
2248
|
else if (typeof e.encoding != "string" && e.encoding !== null)
|
|
2249
|
-
throw new
|
|
2249
|
+
throw new _(
|
|
2250
2250
|
"CSV_INVALID_OPTION_ENCODING",
|
|
2251
2251
|
[
|
|
2252
2252
|
"Invalid option encoding:",
|
|
@@ -2258,7 +2258,7 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2258
2258
|
if (e.bom === void 0 || e.bom === null || e.bom === !1)
|
|
2259
2259
|
e.bom = !1;
|
|
2260
2260
|
else if (e.bom !== !0)
|
|
2261
|
-
throw new
|
|
2261
|
+
throw new _(
|
|
2262
2262
|
"CSV_INVALID_OPTION_BOM",
|
|
2263
2263
|
[
|
|
2264
2264
|
"Invalid option bom:",
|
|
@@ -2272,7 +2272,7 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2272
2272
|
else if (typeof e.cast == "function")
|
|
2273
2273
|
e.cast_function = e.cast, e.cast = !0;
|
|
2274
2274
|
else if (e.cast !== !0)
|
|
2275
|
-
throw new
|
|
2275
|
+
throw new _(
|
|
2276
2276
|
"CSV_INVALID_OPTION_CAST",
|
|
2277
2277
|
[
|
|
2278
2278
|
"Invalid option cast:",
|
|
@@ -2289,7 +2289,7 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2289
2289
|
return isNaN(i) ? n : new Date(i);
|
|
2290
2290
|
};
|
|
2291
2291
|
else if (typeof e.cast_date != "function")
|
|
2292
|
-
throw new
|
|
2292
|
+
throw new _(
|
|
2293
2293
|
"CSV_INVALID_OPTION_CAST_DATE",
|
|
2294
2294
|
[
|
|
2295
2295
|
"Invalid option cast_date:",
|
|
@@ -2307,7 +2307,7 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2307
2307
|
else if (e.columns === void 0 || e.columns === null || e.columns === !1)
|
|
2308
2308
|
e.columns = !1;
|
|
2309
2309
|
else
|
|
2310
|
-
throw new
|
|
2310
|
+
throw new _(
|
|
2311
2311
|
"CSV_INVALID_OPTION_COLUMNS",
|
|
2312
2312
|
[
|
|
2313
2313
|
"Invalid option columns:",
|
|
@@ -2320,7 +2320,7 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2320
2320
|
e.group_columns_by_name = !1;
|
|
2321
2321
|
else {
|
|
2322
2322
|
if (e.group_columns_by_name !== !0)
|
|
2323
|
-
throw new
|
|
2323
|
+
throw new _(
|
|
2324
2324
|
"CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME",
|
|
2325
2325
|
[
|
|
2326
2326
|
"Invalid option group_columns_by_name:",
|
|
@@ -2330,7 +2330,7 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2330
2330
|
e
|
|
2331
2331
|
);
|
|
2332
2332
|
if (e.columns === !1)
|
|
2333
|
-
throw new
|
|
2333
|
+
throw new _(
|
|
2334
2334
|
"CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME",
|
|
2335
2335
|
[
|
|
2336
2336
|
"Invalid option group_columns_by_name:",
|
|
@@ -2341,8 +2341,8 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2341
2341
|
}
|
|
2342
2342
|
if (e.comment === void 0 || e.comment === null || e.comment === !1 || e.comment === "")
|
|
2343
2343
|
e.comment = null;
|
|
2344
|
-
else if (typeof e.comment == "string" && (e.comment =
|
|
2345
|
-
throw new
|
|
2344
|
+
else if (typeof e.comment == "string" && (e.comment = l.from(e.comment, e.encoding)), !D(e.comment))
|
|
2345
|
+
throw new _(
|
|
2346
2346
|
"CSV_INVALID_OPTION_COMMENT",
|
|
2347
2347
|
[
|
|
2348
2348
|
"Invalid option comment:",
|
|
@@ -2354,7 +2354,7 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2354
2354
|
if (e.comment_no_infix === void 0 || e.comment_no_infix === null || e.comment_no_infix === !1)
|
|
2355
2355
|
e.comment_no_infix = !1;
|
|
2356
2356
|
else if (e.comment_no_infix !== !0)
|
|
2357
|
-
throw new
|
|
2357
|
+
throw new _(
|
|
2358
2358
|
"CSV_INVALID_OPTION_COMMENT",
|
|
2359
2359
|
[
|
|
2360
2360
|
"Invalid option comment_no_infix:",
|
|
@@ -2365,7 +2365,7 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2365
2365
|
);
|
|
2366
2366
|
const r = JSON.stringify(e.delimiter);
|
|
2367
2367
|
if (Array.isArray(e.delimiter) || (e.delimiter = [e.delimiter]), e.delimiter.length === 0)
|
|
2368
|
-
throw new
|
|
2368
|
+
throw new _(
|
|
2369
2369
|
"CSV_INVALID_OPTION_DELIMITER",
|
|
2370
2370
|
[
|
|
2371
2371
|
"Invalid option delimiter:",
|
|
@@ -2376,9 +2376,9 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2376
2376
|
);
|
|
2377
2377
|
if (e.delimiter = e.delimiter.map(function(n) {
|
|
2378
2378
|
if (n == null || n === !1)
|
|
2379
|
-
return
|
|
2380
|
-
if (typeof n == "string" && (n =
|
|
2381
|
-
throw new
|
|
2379
|
+
return l.from(",", e.encoding);
|
|
2380
|
+
if (typeof n == "string" && (n = l.from(n, e.encoding)), !D(n) || n.length === 0)
|
|
2381
|
+
throw new _(
|
|
2382
2382
|
"CSV_INVALID_OPTION_DELIMITER",
|
|
2383
2383
|
[
|
|
2384
2384
|
"Invalid option delimiter:",
|
|
@@ -2388,7 +2388,7 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2388
2388
|
e
|
|
2389
2389
|
);
|
|
2390
2390
|
return n;
|
|
2391
|
-
}), e.escape === void 0 || e.escape === !0 ? e.escape =
|
|
2391
|
+
}), e.escape === void 0 || e.escape === !0 ? e.escape = l.from('"', e.encoding) : typeof e.escape == "string" ? e.escape = l.from(e.escape, e.encoding) : (e.escape === null || e.escape === !1) && (e.escape = null), e.escape !== null && !D(e.escape))
|
|
2392
2392
|
throw new Error(
|
|
2393
2393
|
`Invalid Option: escape must be a buffer, a string or a boolean, got ${JSON.stringify(e.escape)}`
|
|
2394
2394
|
);
|
|
@@ -2419,7 +2419,7 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2419
2419
|
else if (typeof e.ignore_last_delimiters == "number")
|
|
2420
2420
|
e.ignore_last_delimiters = Math.floor(e.ignore_last_delimiters), e.ignore_last_delimiters === 0 && (e.ignore_last_delimiters = !1);
|
|
2421
2421
|
else if (typeof e.ignore_last_delimiters != "boolean")
|
|
2422
|
-
throw new
|
|
2422
|
+
throw new _(
|
|
2423
2423
|
"CSV_INVALID_OPTION_IGNORE_LAST_DELIMITERS",
|
|
2424
2424
|
[
|
|
2425
2425
|
"Invalid option `ignore_last_delimiters`:",
|
|
@@ -2429,7 +2429,7 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2429
2429
|
e
|
|
2430
2430
|
);
|
|
2431
2431
|
if (e.ignore_last_delimiters === !0 && e.columns === !1)
|
|
2432
|
-
throw new
|
|
2432
|
+
throw new _(
|
|
2433
2433
|
"CSV_IGNORE_LAST_DELIMITERS_REQUIRES_COLUMNS",
|
|
2434
2434
|
[
|
|
2435
2435
|
"The option `ignore_last_delimiters`",
|
|
@@ -2477,7 +2477,7 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2477
2477
|
if (e.on_record === void 0 || e.on_record === null)
|
|
2478
2478
|
e.on_record = void 0;
|
|
2479
2479
|
else if (typeof e.on_record != "function")
|
|
2480
|
-
throw new
|
|
2480
|
+
throw new _(
|
|
2481
2481
|
"CSV_INVALID_OPTION_ON_RECORD",
|
|
2482
2482
|
[
|
|
2483
2483
|
"Invalid option `on_record`:",
|
|
@@ -2492,7 +2492,7 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2492
2492
|
);
|
|
2493
2493
|
if (e.quote === null || e.quote === !1 || e.quote === "")
|
|
2494
2494
|
e.quote = null;
|
|
2495
|
-
else if (e.quote === void 0 || e.quote === !0 ? e.quote =
|
|
2495
|
+
else if (e.quote === void 0 || e.quote === !0 ? e.quote = l.from('"', e.encoding) : typeof e.quote == "string" && (e.quote = l.from(e.quote, e.encoding)), !D(e.quote))
|
|
2496
2496
|
throw new Error(
|
|
2497
2497
|
`Invalid Option: quote must be a buffer or a string, got ${JSON.stringify(e.quote)}`
|
|
2498
2498
|
);
|
|
@@ -2506,7 +2506,7 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2506
2506
|
e.record_delimiter = [];
|
|
2507
2507
|
else if (typeof e.record_delimiter == "string" || D(e.record_delimiter)) {
|
|
2508
2508
|
if (e.record_delimiter.length === 0)
|
|
2509
|
-
throw new
|
|
2509
|
+
throw new _(
|
|
2510
2510
|
"CSV_INVALID_OPTION_RECORD_DELIMITER",
|
|
2511
2511
|
[
|
|
2512
2512
|
"Invalid option `record_delimiter`:",
|
|
@@ -2517,7 +2517,7 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2517
2517
|
);
|
|
2518
2518
|
e.record_delimiter = [e.record_delimiter];
|
|
2519
2519
|
} else if (!Array.isArray(e.record_delimiter))
|
|
2520
|
-
throw new
|
|
2520
|
+
throw new _(
|
|
2521
2521
|
"CSV_INVALID_OPTION_RECORD_DELIMITER",
|
|
2522
2522
|
[
|
|
2523
2523
|
"Invalid option `record_delimiter`:",
|
|
@@ -2528,7 +2528,7 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2528
2528
|
);
|
|
2529
2529
|
if (e.record_delimiter = e.record_delimiter.map(function(n, i) {
|
|
2530
2530
|
if (typeof n != "string" && !D(n))
|
|
2531
|
-
throw new
|
|
2531
|
+
throw new _(
|
|
2532
2532
|
"CSV_INVALID_OPTION_RECORD_DELIMITER",
|
|
2533
2533
|
[
|
|
2534
2534
|
"Invalid option `record_delimiter`:",
|
|
@@ -2539,7 +2539,7 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2539
2539
|
e
|
|
2540
2540
|
);
|
|
2541
2541
|
if (n.length === 0)
|
|
2542
|
-
throw new
|
|
2542
|
+
throw new _(
|
|
2543
2543
|
"CSV_INVALID_OPTION_RECORD_DELIMITER",
|
|
2544
2544
|
[
|
|
2545
2545
|
"Invalid option `record_delimiter`:",
|
|
@@ -2549,7 +2549,7 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2549
2549
|
],
|
|
2550
2550
|
e
|
|
2551
2551
|
);
|
|
2552
|
-
return typeof n == "string" && (n =
|
|
2552
|
+
return typeof n == "string" && (n = l.from(n, e.encoding)), n;
|
|
2553
2553
|
}), typeof e.relax_column_count != "boolean") if (e.relax_column_count === void 0 || e.relax_column_count === null)
|
|
2554
2554
|
e.relax_column_count = !1;
|
|
2555
2555
|
else
|
|
@@ -2644,11 +2644,11 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2644
2644
|
// Buffer.from("\ufeff")
|
|
2645
2645
|
// Buffer.from([239, 187, 191])
|
|
2646
2646
|
// Buffer.from('EFBBBF', 'hex')
|
|
2647
|
-
utf8:
|
|
2647
|
+
utf8: l.from([239, 187, 191]),
|
|
2648
2648
|
// Note, the following are equals:
|
|
2649
2649
|
// Buffer.from "\ufeff", 'utf16le
|
|
2650
2650
|
// Buffer.from([255, 254])
|
|
2651
|
-
utf16le:
|
|
2651
|
+
utf16le: l.from([255, 254])
|
|
2652
2652
|
}, Zn = function(t = {}) {
|
|
2653
2653
|
const e = {
|
|
2654
2654
|
bytes: 0,
|
|
@@ -2665,7 +2665,7 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2665
2665
|
state: Hn(r),
|
|
2666
2666
|
__needMoreData: function(n, i, o) {
|
|
2667
2667
|
if (o) return !1;
|
|
2668
|
-
const { encoding: s, escape: a, quote:
|
|
2668
|
+
const { encoding: s, escape: a, quote: f } = this.options, { quoting: u, needMoreDataSize: c, recordDelimiterMaxLength: h } = this.state, p = i - n - 1, m = Math.max(
|
|
2669
2669
|
c,
|
|
2670
2670
|
// Skip if the remaining buffer smaller than record delimiter
|
|
2671
2671
|
// If "record_delimiter" is yet to be discovered:
|
|
@@ -2673,66 +2673,66 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2673
2673
|
// 2. We set the length to windows line ending in the current encoding
|
|
2674
2674
|
// Note, that encoding is known from user or bom discovery at that point
|
|
2675
2675
|
// recordDelimiterMaxLength,
|
|
2676
|
-
h === 0 ?
|
|
2676
|
+
h === 0 ? l.from(`\r
|
|
2677
2677
|
`, s).length : h,
|
|
2678
2678
|
// Skip if remaining buffer can be an escaped quote
|
|
2679
|
-
u ? (a === null ? 0 : a.length) +
|
|
2679
|
+
u ? (a === null ? 0 : a.length) + f.length : 0,
|
|
2680
2680
|
// Skip if remaining buffer can be record delimiter following the closing quote
|
|
2681
|
-
u ?
|
|
2681
|
+
u ? f.length + h : 0
|
|
2682
2682
|
);
|
|
2683
|
-
return
|
|
2683
|
+
return p < m;
|
|
2684
2684
|
},
|
|
2685
2685
|
// Central parser implementation
|
|
2686
2686
|
parse: function(n, i, o, s) {
|
|
2687
2687
|
const {
|
|
2688
2688
|
bom: a,
|
|
2689
|
-
comment_no_infix:
|
|
2689
|
+
comment_no_infix: f,
|
|
2690
2690
|
encoding: u,
|
|
2691
2691
|
from_line: c,
|
|
2692
2692
|
ltrim: h,
|
|
2693
|
-
max_record_size:
|
|
2694
|
-
raw:
|
|
2695
|
-
relax_quotes:
|
|
2693
|
+
max_record_size: p,
|
|
2694
|
+
raw: m,
|
|
2695
|
+
relax_quotes: E,
|
|
2696
2696
|
rtrim: x,
|
|
2697
2697
|
skip_empty_lines: F,
|
|
2698
|
-
to:
|
|
2698
|
+
to: R,
|
|
2699
2699
|
to_line: v
|
|
2700
2700
|
} = this.options;
|
|
2701
|
-
let { comment:
|
|
2701
|
+
let { comment: w, escape: L, quote: U, record_delimiter: Ae } = this.options;
|
|
2702
2702
|
const { bomSkipped: nr, previousBuf: pe, rawBuffer: ir, escapeIsQuote: or } = this.state;
|
|
2703
|
-
let
|
|
2703
|
+
let y;
|
|
2704
2704
|
if (pe === void 0)
|
|
2705
2705
|
if (n === void 0) {
|
|
2706
2706
|
s();
|
|
2707
2707
|
return;
|
|
2708
2708
|
} else
|
|
2709
|
-
|
|
2710
|
-
else pe !== void 0 && n === void 0 ?
|
|
2709
|
+
y = n;
|
|
2710
|
+
else pe !== void 0 && n === void 0 ? y = pe : y = l.concat([pe, n]);
|
|
2711
2711
|
if (nr === !1)
|
|
2712
2712
|
if (a === !1)
|
|
2713
2713
|
this.state.bomSkipped = !0;
|
|
2714
|
-
else if (
|
|
2714
|
+
else if (y.length < 3) {
|
|
2715
2715
|
if (i === !1) {
|
|
2716
|
-
this.state.previousBuf =
|
|
2716
|
+
this.state.previousBuf = y;
|
|
2717
2717
|
return;
|
|
2718
2718
|
}
|
|
2719
2719
|
} else {
|
|
2720
|
-
for (const
|
|
2721
|
-
if (oe[
|
|
2722
|
-
const H = oe[
|
|
2723
|
-
this.state.bufBytesStart += H,
|
|
2720
|
+
for (const I in oe)
|
|
2721
|
+
if (oe[I].compare(y, 0, oe[I].length) === 0) {
|
|
2722
|
+
const H = oe[I].length;
|
|
2723
|
+
this.state.bufBytesStart += H, y = y.slice(H);
|
|
2724
2724
|
const ge = dt({
|
|
2725
2725
|
...this.original_options,
|
|
2726
|
-
encoding:
|
|
2726
|
+
encoding: I
|
|
2727
2727
|
});
|
|
2728
|
-
for (const
|
|
2729
|
-
this.options[
|
|
2730
|
-
({ comment:
|
|
2728
|
+
for (const O in ge)
|
|
2729
|
+
this.options[O] = ge[O];
|
|
2730
|
+
({ comment: w, escape: L, quote: U } = this.options);
|
|
2731
2731
|
break;
|
|
2732
2732
|
}
|
|
2733
2733
|
this.state.bomSkipped = !0;
|
|
2734
2734
|
}
|
|
2735
|
-
const Te =
|
|
2735
|
+
const Te = y.length;
|
|
2736
2736
|
let d;
|
|
2737
2737
|
for (d = 0; d < Te && !this.__needMoreData(d, Te, i); d++) {
|
|
2738
2738
|
if (this.state.wasRowDelimiter === !0 && (this.info.lines++, this.state.wasRowDelimiter = !1), v !== -1 && this.info.lines > v) {
|
|
@@ -2740,16 +2740,16 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2740
2740
|
return;
|
|
2741
2741
|
}
|
|
2742
2742
|
this.state.quoting === !1 && Ae.length === 0 && this.__autoDiscoverRecordDelimiter(
|
|
2743
|
-
|
|
2743
|
+
y,
|
|
2744
2744
|
d
|
|
2745
2745
|
) && (Ae = this.options.record_delimiter);
|
|
2746
|
-
const
|
|
2747
|
-
if (
|
|
2746
|
+
const I = y[d];
|
|
2747
|
+
if (m === !0 && ir.append(I), (I === Gn || I === Xn) && this.state.wasRowDelimiter === !1 && (this.state.wasRowDelimiter = !0), this.state.escaping === !0)
|
|
2748
2748
|
this.state.escaping = !1;
|
|
2749
2749
|
else {
|
|
2750
|
-
if (L !== null && this.state.quoting === !0 && this.__isEscape(
|
|
2750
|
+
if (L !== null && this.state.quoting === !0 && this.__isEscape(y, d, I) && d + L.length < Te)
|
|
2751
2751
|
if (or) {
|
|
2752
|
-
if (this.__isQuote(
|
|
2752
|
+
if (this.__isQuote(y, d + L.length)) {
|
|
2753
2753
|
this.state.escaping = !0, d += L.length - 1;
|
|
2754
2754
|
continue;
|
|
2755
2755
|
}
|
|
@@ -2757,25 +2757,25 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2757
2757
|
this.state.escaping = !0, d += L.length - 1;
|
|
2758
2758
|
continue;
|
|
2759
2759
|
}
|
|
2760
|
-
if (this.state.commenting === !1 && this.__isQuote(
|
|
2760
|
+
if (this.state.commenting === !1 && this.__isQuote(y, d))
|
|
2761
2761
|
if (this.state.quoting === !0) {
|
|
2762
|
-
const
|
|
2763
|
-
|
|
2762
|
+
const O = y[d + U.length], ee = x && this.__isCharTrimable(y, d + U.length), z = w !== null && this.__compareBytes(w, y, d + U.length, O), te = this.__isDelimiter(
|
|
2763
|
+
y,
|
|
2764
2764
|
d + U.length,
|
|
2765
|
-
|
|
2766
|
-
), me = Ae.length === 0 ? this.__autoDiscoverRecordDelimiter(
|
|
2767
|
-
if (L !== null && this.__isEscape(
|
|
2765
|
+
O
|
|
2766
|
+
), me = Ae.length === 0 ? this.__autoDiscoverRecordDelimiter(y, d + U.length) : this.__isRecordDelimiter(O, y, d + U.length);
|
|
2767
|
+
if (L !== null && this.__isEscape(y, d, I) && this.__isQuote(y, d + L.length))
|
|
2768
2768
|
d += L.length - 1;
|
|
2769
|
-
else if (!
|
|
2769
|
+
else if (!O || te || me || z || ee) {
|
|
2770
2770
|
this.state.quoting = !1, this.state.wasQuoting = !0, d += U.length - 1;
|
|
2771
2771
|
continue;
|
|
2772
|
-
} else if (
|
|
2772
|
+
} else if (E === !1) {
|
|
2773
2773
|
const et = this.__error(
|
|
2774
|
-
new
|
|
2774
|
+
new _(
|
|
2775
2775
|
"CSV_INVALID_CLOSING_QUOTE",
|
|
2776
2776
|
[
|
|
2777
2777
|
"Invalid Closing Quote:",
|
|
2778
|
-
`got "${String.fromCharCode(
|
|
2778
|
+
`got "${String.fromCharCode(O)}"`,
|
|
2779
2779
|
`at line ${this.info.lines}`,
|
|
2780
2780
|
"instead of delimiter, record delimiter, trimable character",
|
|
2781
2781
|
"(if activated) or comment"
|
|
@@ -2788,19 +2788,19 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2788
2788
|
} else
|
|
2789
2789
|
this.state.quoting = !1, this.state.wasQuoting = !0, this.state.field.prepend(U), d += U.length - 1;
|
|
2790
2790
|
} else if (this.state.field.length !== 0) {
|
|
2791
|
-
if (
|
|
2792
|
-
const
|
|
2791
|
+
if (E === !1) {
|
|
2792
|
+
const O = this.__infoField(), ee = Object.keys(oe).map(
|
|
2793
2793
|
(te) => oe[te].equals(this.state.field.toString()) ? te : !1
|
|
2794
2794
|
).filter(Boolean)[0], z = this.__error(
|
|
2795
|
-
new
|
|
2795
|
+
new _(
|
|
2796
2796
|
"INVALID_OPENING_QUOTE",
|
|
2797
2797
|
[
|
|
2798
2798
|
"Invalid Opening Quote:",
|
|
2799
|
-
`a quote is found on field ${JSON.stringify(
|
|
2799
|
+
`a quote is found on field ${JSON.stringify(O.column)} at line ${O.lines}, value is ${JSON.stringify(this.state.field.toString(u))}`,
|
|
2800
2800
|
ee ? `(${ee} bom)` : void 0
|
|
2801
2801
|
],
|
|
2802
2802
|
this.options,
|
|
2803
|
-
|
|
2803
|
+
O,
|
|
2804
2804
|
{
|
|
2805
2805
|
field: this.state.field
|
|
2806
2806
|
}
|
|
@@ -2813,44 +2813,44 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2813
2813
|
continue;
|
|
2814
2814
|
}
|
|
2815
2815
|
if (this.state.quoting === !1) {
|
|
2816
|
-
const
|
|
2817
|
-
|
|
2818
|
-
|
|
2816
|
+
const O = this.__isRecordDelimiter(
|
|
2817
|
+
I,
|
|
2818
|
+
y,
|
|
2819
2819
|
d
|
|
2820
2820
|
);
|
|
2821
|
-
if (
|
|
2821
|
+
if (O !== 0) {
|
|
2822
2822
|
if (this.state.commenting && this.state.wasQuoting === !1 && this.state.record.length === 0 && this.state.field.length === 0)
|
|
2823
2823
|
this.info.comment_lines++;
|
|
2824
2824
|
else {
|
|
2825
2825
|
if (this.state.enabled === !1 && this.info.lines + (this.state.wasRowDelimiter === !0 ? 1 : 0) >= c) {
|
|
2826
|
-
this.state.enabled = !0, this.__resetField(), this.__resetRecord(), d +=
|
|
2826
|
+
this.state.enabled = !0, this.__resetField(), this.__resetRecord(), d += O - 1;
|
|
2827
2827
|
continue;
|
|
2828
2828
|
}
|
|
2829
2829
|
if (F === !0 && this.state.wasQuoting === !1 && this.state.record.length === 0 && this.state.field.length === 0) {
|
|
2830
|
-
this.info.empty_lines++, d +=
|
|
2830
|
+
this.info.empty_lines++, d += O - 1;
|
|
2831
2831
|
continue;
|
|
2832
2832
|
}
|
|
2833
2833
|
this.info.bytes = this.state.bufBytesStart + d;
|
|
2834
2834
|
const te = this.__onField();
|
|
2835
2835
|
if (te !== void 0) return te;
|
|
2836
|
-
this.info.bytes = this.state.bufBytesStart + d +
|
|
2836
|
+
this.info.bytes = this.state.bufBytesStart + d + O;
|
|
2837
2837
|
const me = this.__onRecord(o);
|
|
2838
2838
|
if (me !== void 0) return me;
|
|
2839
|
-
if (
|
|
2839
|
+
if (R !== -1 && this.info.records >= R) {
|
|
2840
2840
|
this.state.stop = !0, s();
|
|
2841
2841
|
return;
|
|
2842
2842
|
}
|
|
2843
2843
|
}
|
|
2844
|
-
this.state.commenting = !1, d +=
|
|
2844
|
+
this.state.commenting = !1, d += O - 1;
|
|
2845
2845
|
continue;
|
|
2846
2846
|
}
|
|
2847
2847
|
if (this.state.commenting)
|
|
2848
2848
|
continue;
|
|
2849
|
-
if (
|
|
2849
|
+
if (w !== null && (f === !1 || this.state.record.length === 0 && this.state.field.length === 0) && this.__compareBytes(w, y, d, I) !== 0) {
|
|
2850
2850
|
this.state.commenting = !0;
|
|
2851
2851
|
continue;
|
|
2852
2852
|
}
|
|
2853
|
-
const ee = this.__isDelimiter(
|
|
2853
|
+
const ee = this.__isDelimiter(y, d, I);
|
|
2854
2854
|
if (ee !== 0) {
|
|
2855
2855
|
this.info.bytes = this.state.bufBytesStart + d;
|
|
2856
2856
|
const z = this.__onField();
|
|
@@ -2860,27 +2860,27 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2860
2860
|
}
|
|
2861
2861
|
}
|
|
2862
2862
|
}
|
|
2863
|
-
if (this.state.commenting === !1 &&
|
|
2863
|
+
if (this.state.commenting === !1 && p !== 0 && this.state.record_length + this.state.field.length > p)
|
|
2864
2864
|
return this.__error(
|
|
2865
|
-
new
|
|
2865
|
+
new _(
|
|
2866
2866
|
"CSV_MAX_RECORD_SIZE",
|
|
2867
2867
|
[
|
|
2868
2868
|
"Max Record Size:",
|
|
2869
2869
|
"record exceed the maximum number of tolerated bytes",
|
|
2870
|
-
`of ${
|
|
2870
|
+
`of ${p}`,
|
|
2871
2871
|
`at line ${this.info.lines}`
|
|
2872
2872
|
],
|
|
2873
2873
|
this.options,
|
|
2874
2874
|
this.__infoField()
|
|
2875
2875
|
)
|
|
2876
2876
|
);
|
|
2877
|
-
const H = h === !1 || this.state.quoting === !0 || this.state.field.length !== 0 || !this.__isCharTrimable(
|
|
2877
|
+
const H = h === !1 || this.state.quoting === !0 || this.state.field.length !== 0 || !this.__isCharTrimable(y, d), ge = x === !1 || this.state.wasQuoting === !1;
|
|
2878
2878
|
if (H === !0 && ge === !0)
|
|
2879
|
-
this.state.field.append(
|
|
2879
|
+
this.state.field.append(I);
|
|
2880
2880
|
else {
|
|
2881
|
-
if (x === !0 && !this.__isCharTrimable(
|
|
2881
|
+
if (x === !0 && !this.__isCharTrimable(y, d))
|
|
2882
2882
|
return this.__error(
|
|
2883
|
-
new
|
|
2883
|
+
new _(
|
|
2884
2884
|
"CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE",
|
|
2885
2885
|
[
|
|
2886
2886
|
"Invalid Closing Quote:",
|
|
@@ -2891,14 +2891,14 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2891
2891
|
this.__infoField()
|
|
2892
2892
|
)
|
|
2893
2893
|
);
|
|
2894
|
-
H === !1 && (d += this.__isCharTrimable(
|
|
2894
|
+
H === !1 && (d += this.__isCharTrimable(y, d) - 1);
|
|
2895
2895
|
continue;
|
|
2896
2896
|
}
|
|
2897
2897
|
}
|
|
2898
2898
|
if (i === !0)
|
|
2899
2899
|
if (this.state.quoting === !0) {
|
|
2900
|
-
const
|
|
2901
|
-
new
|
|
2900
|
+
const I = this.__error(
|
|
2901
|
+
new _(
|
|
2902
2902
|
"CSV_QUOTE_NOT_CLOSED",
|
|
2903
2903
|
[
|
|
2904
2904
|
"Quote Not Closed:",
|
|
@@ -2908,16 +2908,16 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2908
2908
|
this.__infoField()
|
|
2909
2909
|
)
|
|
2910
2910
|
);
|
|
2911
|
-
if (
|
|
2911
|
+
if (I !== void 0) return I;
|
|
2912
2912
|
} else if (this.state.wasQuoting === !0 || this.state.record.length !== 0 || this.state.field.length !== 0) {
|
|
2913
2913
|
this.info.bytes = this.state.bufBytesStart + d;
|
|
2914
|
-
const
|
|
2915
|
-
if (
|
|
2914
|
+
const I = this.__onField();
|
|
2915
|
+
if (I !== void 0) return I;
|
|
2916
2916
|
const H = this.__onRecord(o);
|
|
2917
2917
|
if (H !== void 0) return H;
|
|
2918
2918
|
} else this.state.wasRowDelimiter === !0 ? this.info.empty_lines++ : this.state.commenting === !0 && this.info.comment_lines++;
|
|
2919
2919
|
else
|
|
2920
|
-
this.state.bufBytesStart += d, this.state.previousBuf =
|
|
2920
|
+
this.state.bufBytesStart += d, this.state.previousBuf = y.slice(d);
|
|
2921
2921
|
this.state.wasRowDelimiter === !0 && (this.info.lines++, this.state.wasRowDelimiter = !1);
|
|
2922
2922
|
},
|
|
2923
2923
|
__onRecord: function(n) {
|
|
@@ -2926,25 +2926,25 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2926
2926
|
group_columns_by_name: o,
|
|
2927
2927
|
encoding: s,
|
|
2928
2928
|
info: a,
|
|
2929
|
-
from:
|
|
2929
|
+
from: f,
|
|
2930
2930
|
relax_column_count: u,
|
|
2931
2931
|
relax_column_count_less: c,
|
|
2932
2932
|
relax_column_count_more: h,
|
|
2933
|
-
raw:
|
|
2934
|
-
skip_records_with_empty_values:
|
|
2935
|
-
} = this.options, { enabled:
|
|
2936
|
-
if (
|
|
2933
|
+
raw: p,
|
|
2934
|
+
skip_records_with_empty_values: m
|
|
2935
|
+
} = this.options, { enabled: E, record: x } = this.state;
|
|
2936
|
+
if (E === !1)
|
|
2937
2937
|
return this.__resetRecord();
|
|
2938
2938
|
const F = x.length;
|
|
2939
2939
|
if (i === !0) {
|
|
2940
|
-
if (
|
|
2940
|
+
if (m === !0 && pt(x)) {
|
|
2941
2941
|
this.__resetRecord();
|
|
2942
2942
|
return;
|
|
2943
2943
|
}
|
|
2944
2944
|
return this.__firstLineToColumns(x);
|
|
2945
2945
|
}
|
|
2946
2946
|
if (i === !1 && this.info.records === 0 && (this.state.expectedRecordLength = F), F !== this.state.expectedRecordLength) {
|
|
2947
|
-
const
|
|
2947
|
+
const R = i === !1 ? new _(
|
|
2948
2948
|
"CSV_RECORD_INCONSISTENT_FIELDS_LENGTH",
|
|
2949
2949
|
[
|
|
2950
2950
|
"Invalid Record Length:",
|
|
@@ -2956,7 +2956,7 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2956
2956
|
{
|
|
2957
2957
|
record: x
|
|
2958
2958
|
}
|
|
2959
|
-
) : new
|
|
2959
|
+
) : new _(
|
|
2960
2960
|
"CSV_RECORD_INCONSISTENT_COLUMNS",
|
|
2961
2961
|
[
|
|
2962
2962
|
"Invalid Record Length:",
|
|
@@ -2971,13 +2971,13 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2971
2971
|
}
|
|
2972
2972
|
);
|
|
2973
2973
|
if (u === !0 || c === !0 && F < this.state.expectedRecordLength || h === !0 && F > this.state.expectedRecordLength)
|
|
2974
|
-
this.info.invalid_field_length++, this.state.error =
|
|
2974
|
+
this.info.invalid_field_length++, this.state.error = R;
|
|
2975
2975
|
else {
|
|
2976
|
-
const v = this.__error(
|
|
2976
|
+
const v = this.__error(R);
|
|
2977
2977
|
if (v) return v;
|
|
2978
2978
|
}
|
|
2979
2979
|
}
|
|
2980
|
-
if (
|
|
2980
|
+
if (m === !0 && pt(x)) {
|
|
2981
2981
|
this.__resetRecord();
|
|
2982
2982
|
return;
|
|
2983
2983
|
}
|
|
@@ -2985,45 +2985,45 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
2985
2985
|
this.__resetRecord(), this.state.recordHasError = !1;
|
|
2986
2986
|
return;
|
|
2987
2987
|
}
|
|
2988
|
-
if (this.info.records++,
|
|
2989
|
-
const { objname:
|
|
2988
|
+
if (this.info.records++, f === 1 || this.info.records >= f) {
|
|
2989
|
+
const { objname: R } = this.options;
|
|
2990
2990
|
if (i !== !1) {
|
|
2991
2991
|
const v = {};
|
|
2992
|
-
for (let
|
|
2993
|
-
i[
|
|
2994
|
-
if (
|
|
2995
|
-
const
|
|
2992
|
+
for (let w = 0, L = x.length; w < L; w++)
|
|
2993
|
+
i[w] === void 0 || i[w].disabled || (o === !0 && v[i[w].name] !== void 0 ? Array.isArray(v[i[w].name]) ? v[i[w].name] = v[i[w].name].concat(x[w]) : v[i[w].name] = [v[i[w].name], x[w]] : v[i[w].name] = x[w]);
|
|
2994
|
+
if (p === !0 || a === !0) {
|
|
2995
|
+
const w = Object.assign(
|
|
2996
2996
|
{ record: v },
|
|
2997
|
-
|
|
2997
|
+
p === !0 ? { raw: this.state.rawBuffer.toString(s) } : {},
|
|
2998
2998
|
a === !0 ? { info: this.__infoRecord() } : {}
|
|
2999
2999
|
), L = this.__push(
|
|
3000
|
-
|
|
3000
|
+
R === void 0 ? w : [v[R], w],
|
|
3001
3001
|
n
|
|
3002
3002
|
);
|
|
3003
3003
|
if (L)
|
|
3004
3004
|
return L;
|
|
3005
3005
|
} else {
|
|
3006
|
-
const
|
|
3007
|
-
|
|
3006
|
+
const w = this.__push(
|
|
3007
|
+
R === void 0 ? v : [v[R], v],
|
|
3008
3008
|
n
|
|
3009
3009
|
);
|
|
3010
|
-
if (
|
|
3011
|
-
return
|
|
3010
|
+
if (w)
|
|
3011
|
+
return w;
|
|
3012
3012
|
}
|
|
3013
|
-
} else if (
|
|
3013
|
+
} else if (p === !0 || a === !0) {
|
|
3014
3014
|
const v = Object.assign(
|
|
3015
3015
|
{ record: x },
|
|
3016
|
-
|
|
3016
|
+
p === !0 ? { raw: this.state.rawBuffer.toString(s) } : {},
|
|
3017
3017
|
a === !0 ? { info: this.__infoRecord() } : {}
|
|
3018
|
-
),
|
|
3019
|
-
|
|
3018
|
+
), w = this.__push(
|
|
3019
|
+
R === void 0 ? v : [x[R], v],
|
|
3020
3020
|
n
|
|
3021
3021
|
);
|
|
3022
|
-
if (
|
|
3023
|
-
return
|
|
3022
|
+
if (w)
|
|
3023
|
+
return w;
|
|
3024
3024
|
} else {
|
|
3025
3025
|
const v = this.__push(
|
|
3026
|
-
|
|
3026
|
+
R === void 0 ? x : [x[R], x],
|
|
3027
3027
|
n
|
|
3028
3028
|
);
|
|
3029
3029
|
if (v)
|
|
@@ -3038,7 +3038,7 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
3038
3038
|
const o = i === void 0 ? n : i.call(null, n);
|
|
3039
3039
|
if (!Array.isArray(o))
|
|
3040
3040
|
return this.__error(
|
|
3041
|
-
new
|
|
3041
|
+
new _(
|
|
3042
3042
|
"CSV_INVALID_COLUMN_MAPPING",
|
|
3043
3043
|
[
|
|
3044
3044
|
"Invalid Column Mapping:",
|
|
@@ -3063,11 +3063,11 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
3063
3063
|
this.options.raw === !0 && this.state.rawBuffer.reset(), this.state.error = void 0, this.state.record = [], this.state.record_length = 0;
|
|
3064
3064
|
},
|
|
3065
3065
|
__onField: function() {
|
|
3066
|
-
const { cast: n, encoding: i, rtrim: o, max_record_size: s } = this.options, { enabled: a, wasQuoting:
|
|
3066
|
+
const { cast: n, encoding: i, rtrim: o, max_record_size: s } = this.options, { enabled: a, wasQuoting: f } = this.state;
|
|
3067
3067
|
if (a === !1)
|
|
3068
3068
|
return this.__resetField();
|
|
3069
3069
|
let u = this.state.field.toString(i);
|
|
3070
|
-
if (o === !0 &&
|
|
3070
|
+
if (o === !0 && f === !1 && (u = u.trimRight()), n === !0) {
|
|
3071
3071
|
const [c, h] = this.__cast(u);
|
|
3072
3072
|
if (c !== void 0) return c;
|
|
3073
3073
|
u = h;
|
|
@@ -3114,9 +3114,9 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
3114
3114
|
// Helper to test if a character is a space or a line delimiter
|
|
3115
3115
|
__isCharTrimable: function(n, i) {
|
|
3116
3116
|
return ((s, a) => {
|
|
3117
|
-
const { timchars:
|
|
3118
|
-
e: for (let u = 0; u <
|
|
3119
|
-
const c =
|
|
3117
|
+
const { timchars: f } = this.state;
|
|
3118
|
+
e: for (let u = 0; u < f.length; u++) {
|
|
3119
|
+
const c = f[u];
|
|
3120
3120
|
for (let h = 0; h < c.length; h++)
|
|
3121
3121
|
if (c[h] !== s[a + h]) continue e;
|
|
3122
3122
|
return c.length;
|
|
@@ -3136,8 +3136,8 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
3136
3136
|
__compareBytes: function(n, i, o, s) {
|
|
3137
3137
|
if (n[0] !== s) return 0;
|
|
3138
3138
|
const a = n.length;
|
|
3139
|
-
for (let
|
|
3140
|
-
if (n[
|
|
3139
|
+
for (let f = 1; f < a; f++)
|
|
3140
|
+
if (n[f] !== i[o + f]) return 0;
|
|
3141
3141
|
return a;
|
|
3142
3142
|
},
|
|
3143
3143
|
__isDelimiter: function(n, i, o) {
|
|
@@ -3146,8 +3146,8 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
3146
3146
|
return 0;
|
|
3147
3147
|
if (a !== !1 && typeof a == "number" && this.state.record.length === a - 1)
|
|
3148
3148
|
return 0;
|
|
3149
|
-
e: for (let
|
|
3150
|
-
const u = s[
|
|
3149
|
+
e: for (let f = 0; f < s.length; f++) {
|
|
3150
|
+
const u = s[f];
|
|
3151
3151
|
if (u[0] === o) {
|
|
3152
3152
|
for (let c = 1; c < u.length; c++)
|
|
3153
3153
|
if (u[c] !== n[i + c]) continue e;
|
|
@@ -3158,8 +3158,8 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
3158
3158
|
},
|
|
3159
3159
|
__isRecordDelimiter: function(n, i, o) {
|
|
3160
3160
|
const { record_delimiter: s } = this.options, a = s.length;
|
|
3161
|
-
e: for (let
|
|
3162
|
-
const u = s[
|
|
3161
|
+
e: for (let f = 0; f < a; f++) {
|
|
3162
|
+
const u = s[f], c = u.length;
|
|
3163
3163
|
if (u[0] === n) {
|
|
3164
3164
|
for (let h = 1; h < c; h++)
|
|
3165
3165
|
if (u[h] !== i[o + h])
|
|
@@ -3174,8 +3174,8 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
3174
3174
|
if (s === null) return !1;
|
|
3175
3175
|
const a = s.length;
|
|
3176
3176
|
if (s[0] === o) {
|
|
3177
|
-
for (let
|
|
3178
|
-
if (s[
|
|
3177
|
+
for (let f = 0; f < a; f++)
|
|
3178
|
+
if (s[f] !== n[i + f])
|
|
3179
3179
|
return !1;
|
|
3180
3180
|
return !0;
|
|
3181
3181
|
}
|
|
@@ -3193,15 +3193,15 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
3193
3193
|
__autoDiscoverRecordDelimiter: function(n, i) {
|
|
3194
3194
|
const { encoding: o } = this.options, s = [
|
|
3195
3195
|
// Important, the windows line ending must be before mac os 9
|
|
3196
|
-
|
|
3196
|
+
l.from(`\r
|
|
3197
3197
|
`, o),
|
|
3198
|
-
|
|
3198
|
+
l.from(`
|
|
3199
3199
|
`, o),
|
|
3200
|
-
|
|
3200
|
+
l.from("\r", o)
|
|
3201
3201
|
];
|
|
3202
3202
|
e: for (let a = 0; a < s.length; a++) {
|
|
3203
|
-
const
|
|
3204
|
-
for (let u = 0; u <
|
|
3203
|
+
const f = s[a].length;
|
|
3204
|
+
for (let u = 0; u < f; u++)
|
|
3205
3205
|
if (s[a][u] !== n[i + u])
|
|
3206
3206
|
continue e;
|
|
3207
3207
|
return this.options.record_delimiter.push(s[a]), this.state.recordDelimiterMaxLength = s[a].length, s[a].length;
|
|
@@ -3217,8 +3217,8 @@ const zn = 12, Vn = 13, Jn = 10, Yn = 32, Wn = 9, Hn = function(t) {
|
|
|
3217
3217
|
a,
|
|
3218
3218
|
o ? this.state.rawBuffer.toString(i) : void 0
|
|
3219
3219
|
);
|
|
3220
|
-
} catch (
|
|
3221
|
-
return
|
|
3220
|
+
} catch (f) {
|
|
3221
|
+
return f;
|
|
3222
3222
|
}
|
|
3223
3223
|
return;
|
|
3224
3224
|
} else
|
|
@@ -3303,7 +3303,7 @@ const gt = function() {
|
|
|
3303
3303
|
else if (r === void 0 && s === "function")
|
|
3304
3304
|
r = o;
|
|
3305
3305
|
else
|
|
3306
|
-
throw new
|
|
3306
|
+
throw new _(
|
|
3307
3307
|
"CSV_INVALID_ARGUMENT",
|
|
3308
3308
|
["Invalid argument:", `got ${JSON.stringify(o)} at index ${i}`],
|
|
3309
3309
|
e || {}
|
|
@@ -3330,14 +3330,14 @@ const gt = function() {
|
|
|
3330
3330
|
}
|
|
3331
3331
|
return n;
|
|
3332
3332
|
};
|
|
3333
|
-
let
|
|
3333
|
+
let je;
|
|
3334
3334
|
// @__NO_SIDE_EFFECTS__
|
|
3335
3335
|
function ei(t) {
|
|
3336
3336
|
return {
|
|
3337
|
-
lang: t?.lang ??
|
|
3337
|
+
lang: t?.lang ?? je?.lang,
|
|
3338
3338
|
message: t?.message,
|
|
3339
|
-
abortEarly: t?.abortEarly ??
|
|
3340
|
-
abortPipeEarly: t?.abortPipeEarly ??
|
|
3339
|
+
abortEarly: t?.abortEarly ?? je?.abortEarly,
|
|
3340
|
+
abortPipeEarly: t?.abortPipeEarly ?? je?.abortPipeEarly
|
|
3341
3341
|
};
|
|
3342
3342
|
}
|
|
3343
3343
|
let ti;
|
|
@@ -3361,7 +3361,7 @@ function Kt(t) {
|
|
|
3361
3361
|
return e === "string" ? `"${t}"` : e === "number" || e === "bigint" || e === "boolean" ? `${t}` : e === "object" || e === "function" ? (t && Object.getPrototypeOf(t)?.constructor?.name) ?? "null" : e;
|
|
3362
3362
|
}
|
|
3363
3363
|
function Je(t, e, r, n, i) {
|
|
3364
|
-
const o = i && "input" in i ? i.input : r.value, s = i?.expected ?? t.expects ?? null, a = i?.received ?? /* @__PURE__ */ Kt(o),
|
|
3364
|
+
const o = i && "input" in i ? i.input : r.value, s = i?.expected ?? t.expects ?? null, a = i?.received ?? /* @__PURE__ */ Kt(o), f = {
|
|
3365
3365
|
kind: t.kind,
|
|
3366
3366
|
type: t.type,
|
|
3367
3367
|
input: o,
|
|
@@ -3374,8 +3374,8 @@ function Je(t, e, r, n, i) {
|
|
|
3374
3374
|
lang: n.lang,
|
|
3375
3375
|
abortEarly: n.abortEarly,
|
|
3376
3376
|
abortPipeEarly: n.abortPipeEarly
|
|
3377
|
-
}, u = t.kind === "schema", c = i?.message ?? t.message ?? /* @__PURE__ */ si(t.reference,
|
|
3378
|
-
c !== void 0 && (
|
|
3377
|
+
}, u = t.kind === "schema", c = i?.message ?? t.message ?? /* @__PURE__ */ si(t.reference, f.lang) ?? (u ? /* @__PURE__ */ ii(f.lang) : null) ?? n.message ?? /* @__PURE__ */ ri(f.lang);
|
|
3378
|
+
c !== void 0 && (f.message = typeof c == "function" ? c(f) : c), u && (r.typed = !1), r.issues ? r.issues.push(f) : r.issues = [f];
|
|
3379
3379
|
}
|
|
3380
3380
|
// @__NO_SIDE_EFFECTS__
|
|
3381
3381
|
function er(t) {
|
|
@@ -3432,13 +3432,13 @@ function rr(t, e) {
|
|
|
3432
3432
|
"~run"(r, n) {
|
|
3433
3433
|
let i, o, s;
|
|
3434
3434
|
for (const a of this.options) {
|
|
3435
|
-
const
|
|
3436
|
-
if (
|
|
3435
|
+
const f = a["~run"]({ value: r.value }, n);
|
|
3436
|
+
if (f.typed) if (f.issues) o ? o.push(f) : o = [f];
|
|
3437
3437
|
else {
|
|
3438
|
-
i =
|
|
3438
|
+
i = f;
|
|
3439
3439
|
break;
|
|
3440
3440
|
}
|
|
3441
|
-
else s ? s.push(
|
|
3441
|
+
else s ? s.push(f) : s = [f];
|
|
3442
3442
|
}
|
|
3443
3443
|
if (i) return i;
|
|
3444
3444
|
if (o) {
|
|
@@ -3543,38 +3543,47 @@ async function ci(t, e, r) {
|
|
|
3543
3543
|
return new ui(i, r, o);
|
|
3544
3544
|
}
|
|
3545
3545
|
q(["list", "render", "setColorMode"]);
|
|
3546
|
-
const
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3546
|
+
const C = (t) => new Map(Object.entries(t));
|
|
3547
|
+
C({ "en-gb": "Delimited Text" }), C({ "en-gb": "Entity/Event" }), C({ "en-gb": "JSON Array" }), C({ "en-gb": "SPSS" }), C({ "en-gb": "XLS" }), C({ "en-gb": "XLSX" }), C({ "en-gb": "XML" });
|
|
3548
|
+
C({ "en-gb": "Newline" }), C({ "en-gb": "Carriage Return" }), C({ "en-gb": "Carriage Return/Newline" });
|
|
3549
|
+
C({ "en-gb": "Colon" }), C({ "en-gb": "Comma" }), C({ "en-gb": "Exclamation Mark" }), C({ "en-gb": "Record Separator" }), C({ "en-gb": "Semicolon" }), C({ "en-gb": "Space" }), C({ "en-gb": "Tab" }), C({ "en-gb": "Underscore" }), C({ "en-gb": "Unit Separator" }), C({ "en-gb": "Vertical Bar" });
|
|
3550
3550
|
const hi = 4096;
|
|
3551
3551
|
class di {
|
|
3552
|
-
parser = void 0;
|
|
3553
|
-
rowBuffer = void 0;
|
|
3554
3552
|
/** Build parser. */
|
|
3555
3553
|
buildParser(e) {
|
|
3556
3554
|
return gt(e);
|
|
3557
3555
|
}
|
|
3558
3556
|
/** Parse stream. */
|
|
3559
3557
|
async parseStream(e, r, n, i, o, s) {
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
}
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3558
|
+
let a, f, u, c = !1;
|
|
3559
|
+
const h = (p, m = !1) => {
|
|
3560
|
+
c || (c = !0, f?.cancel(), u?.flush(), m && a?.destroy(p), o(p));
|
|
3561
|
+
};
|
|
3562
|
+
try {
|
|
3563
|
+
a = gt(e), u = this.constructRowBuffer({ chunk: () => {
|
|
3564
|
+
}, chunkSize: r.chunkSize ?? hi }), a.on("readable", () => {
|
|
3565
|
+
try {
|
|
3566
|
+
if (a == null || u == null) return;
|
|
3567
|
+
let E;
|
|
3568
|
+
for (; (E = a.read()) != null; )
|
|
3569
|
+
i.throwIfAborted(), u.push(E);
|
|
3570
|
+
} catch (E) {
|
|
3571
|
+
h(E, !0);
|
|
3572
|
+
}
|
|
3573
|
+
}), a.on("error", (E) => h(E)), a.on("end", () => {
|
|
3574
|
+
c || (u?.flush(), s(this.constructSummary(a)));
|
|
3575
|
+
});
|
|
3576
|
+
const p = await fetch(encodeURI(n), { signal: i });
|
|
3577
|
+
if (!p.ok || p.body == null)
|
|
3578
|
+
throw await ci(p, `Failed to fetch '${n}' file.`, "datapos-connector-file-store-emulator|Connector|retrieve");
|
|
3579
|
+
f = p.body.pipeThrough(new TextDecoderStream(r.encodingId)).getReader();
|
|
3580
|
+
let m = await f.read();
|
|
3581
|
+
for (; !m.done; )
|
|
3582
|
+
i.throwIfAborted(), await this.writeToParser(a, m.value), m = await f.read();
|
|
3583
|
+
a.end();
|
|
3584
|
+
} catch (p) {
|
|
3585
|
+
h(p, !0);
|
|
3586
|
+
}
|
|
3578
3587
|
}
|
|
3579
3588
|
/** Parse string. */
|
|
3580
3589
|
parseString() {
|
|
@@ -3590,21 +3599,21 @@ class di {
|
|
|
3590
3599
|
} };
|
|
3591
3600
|
}
|
|
3592
3601
|
/** Construct summary. */
|
|
3593
|
-
constructSummary() {
|
|
3602
|
+
constructSummary(e) {
|
|
3594
3603
|
return {
|
|
3595
|
-
byteCount:
|
|
3596
|
-
commentLineCount:
|
|
3597
|
-
emptyLineCount:
|
|
3598
|
-
invalidFieldLengthCount:
|
|
3599
|
-
lineCount:
|
|
3600
|
-
recordCount:
|
|
3604
|
+
byteCount: e?.info.bytes ?? -1,
|
|
3605
|
+
commentLineCount: e?.info.comment_lines ?? -1,
|
|
3606
|
+
emptyLineCount: e?.info.empty_lines ?? -1,
|
|
3607
|
+
invalidFieldLengthCount: e?.info.invalid_field_length ?? -1,
|
|
3608
|
+
lineCount: e?.info.lines ?? -1,
|
|
3609
|
+
recordCount: e?.info.records ?? -1
|
|
3601
3610
|
};
|
|
3602
3611
|
}
|
|
3603
3612
|
/** Write to parser. */
|
|
3604
|
-
writeToParser(e) {
|
|
3605
|
-
return new Promise((
|
|
3606
|
-
|
|
3607
|
-
|
|
3613
|
+
writeToParser(e, r) {
|
|
3614
|
+
return new Promise((n, i) => {
|
|
3615
|
+
e.write(r, (o) => {
|
|
3616
|
+
o ? i(o) : n();
|
|
3608
3617
|
});
|
|
3609
3618
|
});
|
|
3610
3619
|
}
|