@datapos/datapos-tool-csv-parse 0.0.80 → 0.0.82
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 +250 -246
- package/dist/types/src/index.d.ts +4 -3
- package/package.json +3 -3
|
@@ -30,11 +30,11 @@ function Ze(t) {
|
|
|
30
30
|
o.push(Kt(t, f, f + s > a ? a : f + s));
|
|
31
31
|
return n === 1 ? (e = t[r - 1], i += P[e >> 2], i += P[e << 4 & 63], i += "==") : n === 2 && (e = (t[r - 2] << 8) + t[r - 1], i += P[e >> 10], i += P[e >> 4 & 63], i += P[e << 2 & 63], i += "="), o.push(i), o.join("");
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
var o, s, f = i * 8 - n - 1, a = (1 << f) - 1, l = a >> 1,
|
|
35
|
-
for (
|
|
33
|
+
function be(t, e, r, n, i) {
|
|
34
|
+
var o, s, f = i * 8 - n - 1, a = (1 << f) - 1, l = a >> 1, h = -7, c = r ? i - 1 : 0, p = r ? -1 : 1, m = t[e + c];
|
|
35
|
+
for (c += p, o = m & (1 << -h) - 1, m >>= -h, h += f; h > 0; o = o * 256 + t[e + c], c += p, h -= 8)
|
|
36
36
|
;
|
|
37
|
-
for (s = o & (1 << -
|
|
37
|
+
for (s = o & (1 << -h) - 1, o >>= -h, h += n; h > 0; s = s * 256 + t[e + c], c += p, h -= 8)
|
|
38
38
|
;
|
|
39
39
|
if (o === 0)
|
|
40
40
|
o = 1 - l;
|
|
@@ -46,8 +46,8 @@ function ve(t, e, r, n, i) {
|
|
|
46
46
|
return (m ? -1 : 1) * s * Math.pow(2, o - n);
|
|
47
47
|
}
|
|
48
48
|
function ht(t, e, r, n, i, o) {
|
|
49
|
-
var s, f, a, l = o * 8 - i - 1,
|
|
50
|
-
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (f = isNaN(e) ? 1 : 0, s =
|
|
49
|
+
var s, f, a, l = o * 8 - i - 1, h = (1 << l) - 1, c = h >> 1, p = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, m = n ? 0 : o - 1, x = n ? 1 : -1, y = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
|
|
50
|
+
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (f = isNaN(e) ? 1 : 0, s = h) : (s = Math.floor(Math.log(e) / Math.LN2), e * (a = Math.pow(2, -s)) < 1 && (s--, a *= 2), s + c >= 1 ? e += p / a : e += p * Math.pow(2, 1 - c), e * a >= 2 && (s++, a /= 2), s + c >= h ? (f = 0, s = h) : s + c >= 1 ? (f = (e * a - 1) * Math.pow(2, i), s = s + c) : (f = e * Math.pow(2, c - 1) * Math.pow(2, i), s = 0)); i >= 8; t[r + m] = f & 255, m += x, f /= 256, i -= 8)
|
|
51
51
|
;
|
|
52
52
|
for (s = s << i | f, l += i; l > 0; t[r + m] = s & 255, m += x, s /= 256, l -= 8)
|
|
53
53
|
;
|
|
@@ -74,7 +74,7 @@ function u(t, e, r) {
|
|
|
74
74
|
throw new Error(
|
|
75
75
|
"If encoding is specified then the first argument must be a string"
|
|
76
76
|
);
|
|
77
|
-
return
|
|
77
|
+
return Ve(this, t);
|
|
78
78
|
}
|
|
79
79
|
return pt(this, t, e, r);
|
|
80
80
|
}
|
|
@@ -103,17 +103,17 @@ function rr(t, e, r, n) {
|
|
|
103
103
|
u.alloc = function(t, e, r) {
|
|
104
104
|
return rr(null, t, e, r);
|
|
105
105
|
};
|
|
106
|
-
function
|
|
107
|
-
if (mt(e), t = q(t, e < 0 ? 0 :
|
|
106
|
+
function Ve(t, e) {
|
|
107
|
+
if (mt(e), t = q(t, e < 0 ? 0 : ze(e) | 0), !u.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
|
u.allocUnsafe = function(t) {
|
|
113
|
-
return
|
|
113
|
+
return Ve(null, t);
|
|
114
114
|
};
|
|
115
115
|
u.allocUnsafeSlow = function(t) {
|
|
116
|
-
return
|
|
116
|
+
return Ve(null, t);
|
|
117
117
|
};
|
|
118
118
|
function nr(t, e, r) {
|
|
119
119
|
if ((typeof r != "string" || r === "") && (r = "utf8"), !u.isEncoding(r))
|
|
@@ -124,7 +124,7 @@ function nr(t, e, r) {
|
|
|
124
124
|
return i !== n && (t = t.slice(0, i)), t;
|
|
125
125
|
}
|
|
126
126
|
function Ue(t, e) {
|
|
127
|
-
var r = e.length < 0 ? 0 :
|
|
127
|
+
var r = e.length < 0 ? 0 : ze(e.length) | 0;
|
|
128
128
|
t = q(t, r);
|
|
129
129
|
for (var n = 0; n < r; n += 1)
|
|
130
130
|
t[n] = e[n] & 255;
|
|
@@ -139,7 +139,7 @@ function ir(t, e, r, n) {
|
|
|
139
139
|
}
|
|
140
140
|
function or(t, e) {
|
|
141
141
|
if ($(e)) {
|
|
142
|
-
var r =
|
|
142
|
+
var r = ze(e.length) | 0;
|
|
143
143
|
return t = q(t, r), t.length === 0 || e.copy(t, 0, 0, r), t;
|
|
144
144
|
}
|
|
145
145
|
if (e) {
|
|
@@ -150,7 +150,7 @@ function or(t, e) {
|
|
|
150
150
|
}
|
|
151
151
|
throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.");
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function ze(t) {
|
|
154
154
|
if (t >= _e())
|
|
155
155
|
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + _e().toString(16) + " bytes");
|
|
156
156
|
return t | 0;
|
|
@@ -320,9 +320,9 @@ u.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, f = n - r, a = Math.min(s, f), l = this.slice(i, o),
|
|
324
|
-
if (l[
|
|
325
|
-
s = l[
|
|
323
|
+
for (var s = o - i, f = n - r, a = Math.min(s, f), l = this.slice(i, o), h = e.slice(r, n), c = 0; c < a; ++c)
|
|
324
|
+
if (l[c] !== h[c]) {
|
|
325
|
+
s = l[c], f = h[c];
|
|
326
326
|
break;
|
|
327
327
|
}
|
|
328
328
|
return s < f ? -1 : f < s ? 1 : 0;
|
|
@@ -353,20 +353,20 @@ function Xe(t, e, r, n, i) {
|
|
|
353
353
|
}
|
|
354
354
|
var l;
|
|
355
355
|
if (i) {
|
|
356
|
-
var
|
|
356
|
+
var h = -1;
|
|
357
357
|
for (l = r; l < s; l++)
|
|
358
|
-
if (a(t, l) === a(e,
|
|
359
|
-
if (
|
|
358
|
+
if (a(t, l) === a(e, h === -1 ? 0 : l - h)) {
|
|
359
|
+
if (h === -1 && (h = l), l - h + 1 === f) return h * o;
|
|
360
360
|
} else
|
|
361
|
-
|
|
361
|
+
h !== -1 && (l -= l - h), h = -1;
|
|
362
362
|
} else
|
|
363
363
|
for (r + f > s && (r = s - f), l = r; l >= 0; l--) {
|
|
364
|
-
for (var
|
|
364
|
+
for (var c = !0, p = 0; p < f; p++)
|
|
365
365
|
if (a(t, l + p) !== a(e, p)) {
|
|
366
|
-
|
|
366
|
+
c = !1;
|
|
367
367
|
break;
|
|
368
368
|
}
|
|
369
|
-
if (
|
|
369
|
+
if (c) return l;
|
|
370
370
|
}
|
|
371
371
|
return -1;
|
|
372
372
|
}
|
|
@@ -461,19 +461,19 @@ function yt(t, e, r) {
|
|
|
461
461
|
for (var n = [], i = e; i < r; ) {
|
|
462
462
|
var o = t[i], s = null, f = o > 239 ? 4 : o > 223 ? 3 : o > 191 ? 2 : 1;
|
|
463
463
|
if (i + f <= r) {
|
|
464
|
-
var a, l,
|
|
464
|
+
var a, l, h, c;
|
|
465
465
|
switch (f) {
|
|
466
466
|
case 1:
|
|
467
467
|
o < 128 && (s = o);
|
|
468
468
|
break;
|
|
469
469
|
case 2:
|
|
470
|
-
a = t[i + 1], (a & 192) === 128 && (
|
|
470
|
+
a = t[i + 1], (a & 192) === 128 && (c = (o & 31) << 6 | a & 63, c > 127 && (s = c));
|
|
471
471
|
break;
|
|
472
472
|
case 3:
|
|
473
|
-
a = t[i + 1], l = t[i + 2], (a & 192) === 128 && (l & 192) === 128 && (
|
|
473
|
+
a = t[i + 1], l = t[i + 2], (a & 192) === 128 && (l & 192) === 128 && (c = (o & 15) << 12 | (a & 63) << 6 | l & 63, c > 2047 && (c < 55296 || c > 57343) && (s = c));
|
|
474
474
|
break;
|
|
475
475
|
case 4:
|
|
476
|
-
a = t[i + 1], l = t[i + 2],
|
|
476
|
+
a = t[i + 1], l = t[i + 2], h = t[i + 3], (a & 192) === 128 && (l & 192) === 128 && (h & 192) === 128 && (c = (o & 15) << 18 | (a & 63) << 12 | (l & 63) << 6 | h & 63, c > 65535 && c < 1114112 && (s = c));
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
479
|
s === null ? (s = 65533, f = 1) : s > 65535 && (s -= 65536, n.push(s >>> 10 & 1023 | 55296), s = 56320 | s & 1023), n.push(s), i += f;
|
|
@@ -510,7 +510,7 @@ function gr(t, e, r) {
|
|
|
510
510
|
var n = t.length;
|
|
511
511
|
(!e || e < 0) && (e = 0), (!r || r < 0 || r > n) && (r = n);
|
|
512
512
|
for (var i = "", o = e; o < r; ++o)
|
|
513
|
-
i +=
|
|
513
|
+
i += vr(t[o]);
|
|
514
514
|
return i;
|
|
515
515
|
}
|
|
516
516
|
function _r(t, e, r) {
|
|
@@ -532,79 +532,79 @@ u.prototype.slice = function(e, r) {
|
|
|
532
532
|
}
|
|
533
533
|
return i;
|
|
534
534
|
};
|
|
535
|
-
function
|
|
535
|
+
function L(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
539
|
u.prototype.readUIntLE = function(e, r, n) {
|
|
540
|
-
e = e | 0, r = r | 0, n ||
|
|
540
|
+
e = e | 0, r = r | 0, n || L(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
545
|
u.prototype.readUIntBE = function(e, r, n) {
|
|
546
|
-
e = e | 0, r = r | 0, n ||
|
|
546
|
+
e = e | 0, r = r | 0, n || L(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
551
|
u.prototype.readUInt8 = function(e, r) {
|
|
552
|
-
return r ||
|
|
552
|
+
return r || L(e, 1, this.length), this[e];
|
|
553
553
|
};
|
|
554
554
|
u.prototype.readUInt16LE = function(e, r) {
|
|
555
|
-
return r ||
|
|
555
|
+
return r || L(e, 2, this.length), this[e] | this[e + 1] << 8;
|
|
556
556
|
};
|
|
557
557
|
u.prototype.readUInt16BE = function(e, r) {
|
|
558
|
-
return r ||
|
|
558
|
+
return r || L(e, 2, this.length), this[e] << 8 | this[e + 1];
|
|
559
559
|
};
|
|
560
560
|
u.prototype.readUInt32LE = function(e, r) {
|
|
561
|
-
return r ||
|
|
561
|
+
return r || L(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + this[e + 3] * 16777216;
|
|
562
562
|
};
|
|
563
563
|
u.prototype.readUInt32BE = function(e, r) {
|
|
564
|
-
return r ||
|
|
564
|
+
return r || L(e, 4, this.length), this[e] * 16777216 + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
|
|
565
565
|
};
|
|
566
566
|
u.prototype.readIntLE = function(e, r, n) {
|
|
567
|
-
e = e | 0, r = r | 0, n ||
|
|
567
|
+
e = e | 0, r = r | 0, n || L(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
572
|
u.prototype.readIntBE = function(e, r, n) {
|
|
573
|
-
e = e | 0, r = r | 0, n ||
|
|
573
|
+
e = e | 0, r = r | 0, n || L(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
578
|
u.prototype.readInt8 = function(e, r) {
|
|
579
|
-
return r ||
|
|
579
|
+
return r || L(e, 1, this.length), this[e] & 128 ? (255 - this[e] + 1) * -1 : this[e];
|
|
580
580
|
};
|
|
581
581
|
u.prototype.readInt16LE = function(e, r) {
|
|
582
|
-
r ||
|
|
582
|
+
r || L(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
586
|
u.prototype.readInt16BE = function(e, r) {
|
|
587
|
-
r ||
|
|
587
|
+
r || L(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
591
|
u.prototype.readInt32LE = function(e, r) {
|
|
592
|
-
return r ||
|
|
592
|
+
return r || L(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;
|
|
593
593
|
};
|
|
594
594
|
u.prototype.readInt32BE = function(e, r) {
|
|
595
|
-
return r ||
|
|
595
|
+
return r || L(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
|
|
596
596
|
};
|
|
597
597
|
u.prototype.readFloatLE = function(e, r) {
|
|
598
|
-
return r ||
|
|
598
|
+
return r || L(e, 4, this.length), be(this, e, !0, 23, 4);
|
|
599
599
|
};
|
|
600
600
|
u.prototype.readFloatBE = function(e, r) {
|
|
601
|
-
return r ||
|
|
601
|
+
return r || L(e, 4, this.length), be(this, e, !1, 23, 4);
|
|
602
602
|
};
|
|
603
603
|
u.prototype.readDoubleLE = function(e, r) {
|
|
604
|
-
return r ||
|
|
604
|
+
return r || L(e, 8, this.length), be(this, e, !0, 52, 8);
|
|
605
605
|
};
|
|
606
606
|
u.prototype.readDoubleBE = function(e, r) {
|
|
607
|
-
return r ||
|
|
607
|
+
return r || L(e, 8, this.length), be(this, e, !1, 52, 8);
|
|
608
608
|
};
|
|
609
609
|
function N(t, e, r, n, i, o) {
|
|
610
610
|
if (!$(t)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
@@ -634,16 +634,16 @@ u.prototype.writeUIntBE = function(e, r, n, i) {
|
|
|
634
634
|
u.prototype.writeUInt8 = function(e, r, n) {
|
|
635
635
|
return e = +e, r = r | 0, n || N(this, e, r, 1, 255, 0), u.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)), this[r] = e & 255, r + 1;
|
|
636
636
|
};
|
|
637
|
-
function
|
|
637
|
+
function ve(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
642
|
u.prototype.writeUInt16LE = function(e, r, n) {
|
|
643
|
-
return e = +e, r = r | 0, n || N(this, e, r, 2, 65535, 0), u.TYPED_ARRAY_SUPPORT ? (this[r] = e & 255, this[r + 1] = e >>> 8) :
|
|
643
|
+
return e = +e, r = r | 0, n || N(this, e, r, 2, 65535, 0), u.TYPED_ARRAY_SUPPORT ? (this[r] = e & 255, this[r + 1] = e >>> 8) : ve(this, e, r, !0), r + 2;
|
|
644
644
|
};
|
|
645
645
|
u.prototype.writeUInt16BE = function(e, r, n) {
|
|
646
|
-
return e = +e, r = r | 0, n || N(this, e, r, 2, 65535, 0), u.TYPED_ARRAY_SUPPORT ? (this[r] = e >>> 8, this[r + 1] = e & 255) :
|
|
646
|
+
return e = +e, r = r | 0, n || N(this, e, r, 2, 65535, 0), u.TYPED_ARRAY_SUPPORT ? (this[r] = e >>> 8, this[r + 1] = e & 255) : ve(this, e, r, !1), r + 2;
|
|
647
647
|
};
|
|
648
648
|
function Ee(t, e, r, n) {
|
|
649
649
|
e < 0 && (e = 4294967295 + e + 1);
|
|
@@ -680,10 +680,10 @@ u.prototype.writeInt8 = function(e, r, n) {
|
|
|
680
680
|
return e = +e, r = r | 0, n || N(this, e, r, 1, 127, -128), u.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)), e < 0 && (e = 255 + e + 1), this[r] = e & 255, r + 1;
|
|
681
681
|
};
|
|
682
682
|
u.prototype.writeInt16LE = function(e, r, n) {
|
|
683
|
-
return e = +e, r = r | 0, n || N(this, e, r, 2, 32767, -32768), u.TYPED_ARRAY_SUPPORT ? (this[r] = e & 255, this[r + 1] = e >>> 8) :
|
|
683
|
+
return e = +e, r = r | 0, n || N(this, e, r, 2, 32767, -32768), u.TYPED_ARRAY_SUPPORT ? (this[r] = e & 255, this[r + 1] = e >>> 8) : ve(this, e, r, !0), r + 2;
|
|
684
684
|
};
|
|
685
685
|
u.prototype.writeInt16BE = function(e, r, n) {
|
|
686
|
-
return e = +e, r = r | 0, n || N(this, e, r, 2, 32767, -32768), u.TYPED_ARRAY_SUPPORT ? (this[r] = e >>> 8, this[r + 1] = e & 255) :
|
|
686
|
+
return e = +e, r = r | 0, n || N(this, e, r, 2, 32767, -32768), u.TYPED_ARRAY_SUPPORT ? (this[r] = e >>> 8, this[r + 1] = e & 255) : ve(this, e, r, !1), r + 2;
|
|
687
687
|
};
|
|
688
688
|
u.prototype.writeInt32LE = function(e, r, n) {
|
|
689
689
|
return e = +e, r = r | 0, n || N(this, e, r, 4, 2147483647, -2147483648), u.TYPED_ARRAY_SUPPORT ? (this[r] = e & 255, this[r + 1] = e >>> 8, this[r + 2] = e >>> 16, this[r + 3] = e >>> 24) : Ee(this, e, r, !0), r + 4;
|
|
@@ -691,21 +691,21 @@ u.prototype.writeInt32LE = function(e, r, n) {
|
|
|
691
691
|
u.prototype.writeInt32BE = function(e, r, n) {
|
|
692
692
|
return e = +e, r = r | 0, n || N(this, e, r, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), u.TYPED_ARRAY_SUPPORT ? (this[r] = e >>> 24, this[r + 1] = e >>> 16, this[r + 2] = e >>> 8, this[r + 3] = e & 255) : Ee(this, e, r, !1), r + 4;
|
|
693
693
|
};
|
|
694
|
-
function
|
|
694
|
+
function bt(t, e, r, n, i, o) {
|
|
695
695
|
if (r + n > t.length) throw new RangeError("Index out of range");
|
|
696
696
|
if (r < 0) throw new RangeError("Index out of range");
|
|
697
697
|
}
|
|
698
|
-
function
|
|
699
|
-
return i ||
|
|
698
|
+
function vt(t, e, r, n, i) {
|
|
699
|
+
return i || bt(t, e, r, 4), ht(t, e, r, n, 23, 4), r + 4;
|
|
700
700
|
}
|
|
701
701
|
u.prototype.writeFloatLE = function(e, r, n) {
|
|
702
|
-
return
|
|
702
|
+
return vt(this, e, r, !0, n);
|
|
703
703
|
};
|
|
704
704
|
u.prototype.writeFloatBE = function(e, r, n) {
|
|
705
|
-
return
|
|
705
|
+
return vt(this, e, r, !1, n);
|
|
706
706
|
};
|
|
707
707
|
function Et(t, e, r, n, i) {
|
|
708
|
-
return i ||
|
|
708
|
+
return i || bt(t, e, r, 8), ht(t, e, r, n, 52, 8), r + 8;
|
|
709
709
|
}
|
|
710
710
|
u.prototype.writeDoubleLE = function(e, r, n) {
|
|
711
711
|
return Et(this, e, r, !0, n);
|
|
@@ -764,15 +764,15 @@ u.prototype.fill = function(e, r, n, i) {
|
|
|
764
764
|
};
|
|
765
765
|
var wr = /[^+\/0-9A-Za-z-_]/g;
|
|
766
766
|
function yr(t) {
|
|
767
|
-
if (t =
|
|
767
|
+
if (t = br(t).replace(wr, ""), t.length < 2) return "";
|
|
768
768
|
for (; t.length % 4 !== 0; )
|
|
769
769
|
t = t + "=";
|
|
770
770
|
return t;
|
|
771
771
|
}
|
|
772
|
-
function
|
|
772
|
+
function br(t) {
|
|
773
773
|
return t.trim ? t.trim() : t.replace(/^\s+|\s+$/g, "");
|
|
774
774
|
}
|
|
775
|
-
function
|
|
775
|
+
function vr(t) {
|
|
776
776
|
return t < 16 ? "0" + t.toString(16) : t.toString(16);
|
|
777
777
|
}
|
|
778
778
|
function we(t, e) {
|
|
@@ -910,7 +910,7 @@ function Ar(t, e, r, n, i, o) {
|
|
|
910
910
|
for (var s = t.length, f = ae(t, s), a = 0; a < s; ++a)
|
|
911
911
|
f[a].call(r, n, i, o);
|
|
912
912
|
}
|
|
913
|
-
function
|
|
913
|
+
function Lr(t, e, r, n) {
|
|
914
914
|
if (e)
|
|
915
915
|
t.apply(r, n);
|
|
916
916
|
else
|
|
@@ -929,33 +929,33 @@ g.prototype.emit = function(e) {
|
|
|
929
929
|
else {
|
|
930
930
|
if (r instanceof Error)
|
|
931
931
|
throw r;
|
|
932
|
-
var
|
|
933
|
-
throw
|
|
932
|
+
var h = new Error('Uncaught, unspecified "error" event. (' + r + ")");
|
|
933
|
+
throw h.context = r, h;
|
|
934
934
|
}
|
|
935
935
|
return !1;
|
|
936
936
|
}
|
|
937
937
|
if (n = f[e], !n)
|
|
938
938
|
return !1;
|
|
939
|
-
var
|
|
939
|
+
var c = typeof n == "function";
|
|
940
940
|
switch (i = arguments.length, i) {
|
|
941
941
|
// fast cases
|
|
942
942
|
case 1:
|
|
943
|
-
Ir(n,
|
|
943
|
+
Ir(n, c, this);
|
|
944
944
|
break;
|
|
945
945
|
case 2:
|
|
946
|
-
Cr(n,
|
|
946
|
+
Cr(n, c, this, arguments[1]);
|
|
947
947
|
break;
|
|
948
948
|
case 3:
|
|
949
|
-
Or(n,
|
|
949
|
+
Or(n, c, this, arguments[1], arguments[2]);
|
|
950
950
|
break;
|
|
951
951
|
case 4:
|
|
952
|
-
Ar(n,
|
|
952
|
+
Ar(n, c, this, arguments[1], arguments[2], arguments[3]);
|
|
953
953
|
break;
|
|
954
954
|
// slower
|
|
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
|
+
Lr(n, c, this, o);
|
|
959
959
|
}
|
|
960
960
|
return !0;
|
|
961
961
|
};
|
|
@@ -972,11 +972,11 @@ function It(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 = Rt(t), i && i > 0 && s.length > i)) {
|
|
973
973
|
s.warned = !0;
|
|
974
974
|
var f = new Error("Possible EventEmitter memory leak detected. " + s.length + " " + e + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
975
|
-
f.name = "MaxListenersExceededWarning", f.emitter = t, f.type = e, f.count = s.length,
|
|
975
|
+
f.name = "MaxListenersExceededWarning", f.emitter = t, f.type = e, f.count = s.length, Tr(f);
|
|
976
976
|
}
|
|
977
977
|
return t;
|
|
978
978
|
}
|
|
979
|
-
function
|
|
979
|
+
function Tr(t) {
|
|
980
980
|
typeof console.warn == "function" ? console.warn(t) : console.log(t);
|
|
981
981
|
}
|
|
982
982
|
g.prototype.addListener = function(e, r) {
|
|
@@ -1090,13 +1090,13 @@ function Nr(t) {
|
|
|
1090
1090
|
function At() {
|
|
1091
1091
|
throw new Error("setTimeout has not been defined");
|
|
1092
1092
|
}
|
|
1093
|
-
function
|
|
1093
|
+
function Lt() {
|
|
1094
1094
|
throw new Error("clearTimeout has not been defined");
|
|
1095
1095
|
}
|
|
1096
|
-
var Y = At, W =
|
|
1096
|
+
var Y = At, W = Lt;
|
|
1097
1097
|
typeof ie.setTimeout == "function" && (Y = setTimeout);
|
|
1098
1098
|
typeof ie.clearTimeout == "function" && (W = clearTimeout);
|
|
1099
|
-
function
|
|
1099
|
+
function Tt(t) {
|
|
1100
1100
|
if (Y === setTimeout)
|
|
1101
1101
|
return setTimeout(t, 0);
|
|
1102
1102
|
if ((Y === At || !Y) && setTimeout)
|
|
@@ -1114,7 +1114,7 @@ function Lt(t) {
|
|
|
1114
1114
|
function Fr(t) {
|
|
1115
1115
|
if (W === clearTimeout)
|
|
1116
1116
|
return clearTimeout(t);
|
|
1117
|
-
if ((W ===
|
|
1117
|
+
if ((W === Lt || !W) && clearTimeout)
|
|
1118
1118
|
return W = clearTimeout, clearTimeout(t);
|
|
1119
1119
|
try {
|
|
1120
1120
|
return W(t);
|
|
@@ -1126,18 +1126,18 @@ function Fr(t) {
|
|
|
1126
1126
|
}
|
|
1127
1127
|
}
|
|
1128
1128
|
}
|
|
1129
|
-
var
|
|
1129
|
+
var V = [], ne = !1, ee, me = -1;
|
|
1130
1130
|
function Mr() {
|
|
1131
|
-
!ne || !ee || (ne = !1, ee.length ?
|
|
1131
|
+
!ne || !ee || (ne = !1, ee.length ? V = ee.concat(V) : me = -1, V.length && Dt());
|
|
1132
1132
|
}
|
|
1133
1133
|
function Dt() {
|
|
1134
1134
|
if (!ne) {
|
|
1135
|
-
var t =
|
|
1135
|
+
var t = Tt(Mr);
|
|
1136
1136
|
ne = !0;
|
|
1137
|
-
for (var e =
|
|
1138
|
-
for (ee =
|
|
1137
|
+
for (var e = V.length; e; ) {
|
|
1138
|
+
for (ee = V, V = []; ++me < e; )
|
|
1139
1139
|
ee && ee[me].run();
|
|
1140
|
-
me = -1, e =
|
|
1140
|
+
me = -1, e = V.length;
|
|
1141
1141
|
}
|
|
1142
1142
|
ee = null, ne = !1, Fr(t);
|
|
1143
1143
|
}
|
|
@@ -1147,7 +1147,7 @@ function B(t) {
|
|
|
1147
1147
|
if (arguments.length > 1)
|
|
1148
1148
|
for (var r = 1; r < arguments.length; r++)
|
|
1149
1149
|
e[r - 1] = arguments[r];
|
|
1150
|
-
|
|
1150
|
+
V.push(new Nt(t, e)), V.length === 1 && !ne && Tt(Dt);
|
|
1151
1151
|
}
|
|
1152
1152
|
function Nt(t, e) {
|
|
1153
1153
|
this.fun = t, this.array = e;
|
|
@@ -1288,40 +1288,40 @@ function ye(t, e, r) {
|
|
|
1288
1288
|
var n = e.inspect(r, t);
|
|
1289
1289
|
return Ye(n) || (n = ye(t, n, r)), n;
|
|
1290
1290
|
}
|
|
1291
|
-
var i =
|
|
1291
|
+
var i = Vr(t, e);
|
|
1292
1292
|
if (i)
|
|
1293
1293
|
return i;
|
|
1294
1294
|
var o = Object.keys(e), s = qr(o);
|
|
1295
|
-
if (t.showHidden && (o = Object.getOwnPropertyNames(e)),
|
|
1295
|
+
if (t.showHidden && (o = Object.getOwnPropertyNames(e)), Te(e) && (o.indexOf("message") >= 0 || o.indexOf("description") >= 0))
|
|
1296
1296
|
return Ae(e);
|
|
1297
1297
|
if (o.length === 0) {
|
|
1298
1298
|
if (De(e)) {
|
|
1299
1299
|
var f = e.name ? ": " + e.name : "";
|
|
1300
1300
|
return t.stylize("[Function" + f + "]", "special");
|
|
1301
1301
|
}
|
|
1302
|
-
if (
|
|
1302
|
+
if (Le(e))
|
|
1303
1303
|
return t.stylize(RegExp.prototype.toString.call(e), "regexp");
|
|
1304
1304
|
if (et(e))
|
|
1305
1305
|
return t.stylize(Date.prototype.toString.call(e), "date");
|
|
1306
|
-
if (
|
|
1306
|
+
if (Te(e))
|
|
1307
1307
|
return Ae(e);
|
|
1308
1308
|
}
|
|
1309
|
-
var a = "", l = !1,
|
|
1310
|
-
if (Yr(e) && (l = !0,
|
|
1311
|
-
var
|
|
1312
|
-
a = " [Function" +
|
|
1309
|
+
var a = "", l = !1, h = ["{", "}"];
|
|
1310
|
+
if (Yr(e) && (l = !0, h = ["[", "]"]), De(e)) {
|
|
1311
|
+
var c = e.name ? ": " + e.name : "";
|
|
1312
|
+
a = " [Function" + c + "]";
|
|
1313
1313
|
}
|
|
1314
|
-
if (
|
|
1315
|
-
return
|
|
1314
|
+
if (Le(e) && (a = " " + RegExp.prototype.toString.call(e)), et(e) && (a = " " + Date.prototype.toUTCString.call(e)), Te(e) && (a = " " + Ae(e)), o.length === 0 && (!l || e.length == 0))
|
|
1315
|
+
return h[0] + a + h[1];
|
|
1316
1316
|
if (r < 0)
|
|
1317
|
-
return
|
|
1317
|
+
return Le(e) ? t.stylize(RegExp.prototype.toString.call(e), "regexp") : t.stylize("[Object]", "special");
|
|
1318
1318
|
t.seen.push(e);
|
|
1319
1319
|
var p;
|
|
1320
|
-
return l ? p =
|
|
1320
|
+
return l ? p = zr(t, e, r, s, o) : p = o.map(function(m) {
|
|
1321
1321
|
return Pe(t, e, r, s, m, l);
|
|
1322
|
-
}), t.seen.pop(), Jr(p, a,
|
|
1322
|
+
}), t.seen.pop(), Jr(p, a, h);
|
|
1323
1323
|
}
|
|
1324
|
-
function
|
|
1324
|
+
function Vr(t, e) {
|
|
1325
1325
|
if (Q(e))
|
|
1326
1326
|
return t.stylize("undefined", "undefined");
|
|
1327
1327
|
if (Ye(e)) {
|
|
@@ -1338,7 +1338,7 @@ function zr(t, e) {
|
|
|
1338
1338
|
function Ae(t) {
|
|
1339
1339
|
return "[" + Error.prototype.toString.call(t) + "]";
|
|
1340
1340
|
}
|
|
1341
|
-
function
|
|
1341
|
+
function zr(t, e, r, n, i) {
|
|
1342
1342
|
for (var o = [], s = 0, f = e.length; s < f; ++s)
|
|
1343
1343
|
Bt(e, String(s)) ? o.push(Pe(
|
|
1344
1344
|
t,
|
|
@@ -1405,7 +1405,7 @@ function Ye(t) {
|
|
|
1405
1405
|
function Q(t) {
|
|
1406
1406
|
return t === void 0;
|
|
1407
1407
|
}
|
|
1408
|
-
function
|
|
1408
|
+
function Le(t) {
|
|
1409
1409
|
return ue(t) && We(t) === "[object RegExp]";
|
|
1410
1410
|
}
|
|
1411
1411
|
function ue(t) {
|
|
@@ -1414,7 +1414,7 @@ function ue(t) {
|
|
|
1414
1414
|
function et(t) {
|
|
1415
1415
|
return ue(t) && We(t) === "[object Date]";
|
|
1416
1416
|
}
|
|
1417
|
-
function
|
|
1417
|
+
function Te(t) {
|
|
1418
1418
|
return ue(t) && (We(t) === "[object Error]" || t instanceof Error);
|
|
1419
1419
|
}
|
|
1420
1420
|
function De(t) {
|
|
@@ -1686,10 +1686,10 @@ C.prototype.pipe = function(t, e) {
|
|
|
1686
1686
|
break;
|
|
1687
1687
|
}
|
|
1688
1688
|
n.pipesCount += 1, E("pipe count=%d opts=%j", n.pipesCount, e);
|
|
1689
|
-
var i = !e || e.end !== !1, o = i ? f :
|
|
1689
|
+
var i = !e || e.end !== !1, o = i ? f : h;
|
|
1690
1690
|
n.endEmitted ? B(o) : r.once("end", o), t.on("unpipe", s);
|
|
1691
1691
|
function s(R) {
|
|
1692
|
-
E("onunpipe"), R === r &&
|
|
1692
|
+
E("onunpipe"), R === r && h();
|
|
1693
1693
|
}
|
|
1694
1694
|
function f() {
|
|
1695
1695
|
E("onend"), t.end();
|
|
@@ -1697,15 +1697,15 @@ C.prototype.pipe = function(t, e) {
|
|
|
1697
1697
|
var a = un(r);
|
|
1698
1698
|
t.on("drain", a);
|
|
1699
1699
|
var l = !1;
|
|
1700
|
-
function
|
|
1701
|
-
E("cleanup"), t.removeListener("close", x), t.removeListener("finish", y), t.removeListener("drain", a), t.removeListener("error", m), t.removeListener("unpipe", s), r.removeListener("end", f), r.removeListener("end",
|
|
1700
|
+
function h() {
|
|
1701
|
+
E("cleanup"), t.removeListener("close", x), t.removeListener("finish", y), t.removeListener("drain", a), t.removeListener("error", m), t.removeListener("unpipe", s), r.removeListener("end", f), r.removeListener("end", h), r.removeListener("data", p), l = !0, n.awaitDrain && (!t._writableState || t._writableState.needDrain) && a();
|
|
1702
1702
|
}
|
|
1703
|
-
var
|
|
1703
|
+
var c = !1;
|
|
1704
1704
|
r.on("data", p);
|
|
1705
1705
|
function p(R) {
|
|
1706
|
-
E("ondata"),
|
|
1707
|
-
var
|
|
1708
|
-
|
|
1706
|
+
E("ondata"), c = !1;
|
|
1707
|
+
var b = t.write(R);
|
|
1708
|
+
b === !1 && !c && ((n.pipesCount === 1 && n.pipes === t || n.pipesCount > 1 && $t(n.pipes, t) !== -1) && !l && (E("false write response, pause", r._readableState.awaitDrain), r._readableState.awaitDrain++, c = !0), r.pause());
|
|
1709
1709
|
}
|
|
1710
1710
|
function m(R) {
|
|
1711
1711
|
E("onerror", R), S(), t.removeListener("error", m), tn(t, "error") === 0 && t.emit("error", R);
|
|
@@ -1855,8 +1855,8 @@ function $t(t, e) {
|
|
|
1855
1855
|
if (t[r] === e) return r;
|
|
1856
1856
|
return -1;
|
|
1857
1857
|
}
|
|
1858
|
-
|
|
1859
|
-
oe(
|
|
1858
|
+
T.WritableState = He;
|
|
1859
|
+
oe(T, g);
|
|
1860
1860
|
function wn() {
|
|
1861
1861
|
}
|
|
1862
1862
|
function yn(t, e, r) {
|
|
@@ -1873,41 +1873,41 @@ function He(t, e) {
|
|
|
1873
1873
|
var i = t.decodeStrings === !1;
|
|
1874
1874
|
this.decodeStrings = !i, this.defaultEncoding = t.defaultEncoding || "utf8", this.length = 0, this.writing = !1, this.corked = 0, this.sync = !0, this.bufferProcessing = !1, this.onwrite = function(o) {
|
|
1875
1875
|
In(e, o);
|
|
1876
|
-
}, this.writecb = null, this.writelen = 0, this.bufferedRequest = null, this.lastBufferedRequest = null, this.pendingcb = 0, this.prefinished = !1, this.errorEmitted = !1, this.bufferedRequestCount = 0, this.corkedRequestsFree = new
|
|
1876
|
+
}, this.writecb = null, this.writelen = 0, this.bufferedRequest = null, this.lastBufferedRequest = null, this.pendingcb = 0, this.prefinished = !1, this.errorEmitted = !1, this.bufferedRequestCount = 0, this.corkedRequestsFree = new zt(this);
|
|
1877
1877
|
}
|
|
1878
1878
|
He.prototype.getBuffer = function() {
|
|
1879
1879
|
for (var e = this.bufferedRequest, r = []; e; )
|
|
1880
1880
|
r.push(e), e = e.next;
|
|
1881
1881
|
return r;
|
|
1882
1882
|
};
|
|
1883
|
-
function
|
|
1884
|
-
if (!(this instanceof
|
|
1883
|
+
function T(t) {
|
|
1884
|
+
if (!(this instanceof T) && !(this instanceof M)) return new T(t);
|
|
1885
1885
|
this._writableState = new He(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
|
-
function
|
|
1890
|
+
function bn(t, e) {
|
|
1891
1891
|
var r = new Error("write after end");
|
|
1892
1892
|
t.emit("error", r), B(e, r);
|
|
1893
1893
|
}
|
|
1894
|
-
function
|
|
1894
|
+
function vn(t, e, r, n) {
|
|
1895
1895
|
var i = !0, o = !1;
|
|
1896
1896
|
return r === null ? o = new TypeError("May not write null values to stream") : !u.isBuffer(r) && typeof r != "string" && r !== void 0 && !e.objectMode && (o = new TypeError("Invalid non-string/buffer chunk")), o && (t.emit("error", o), B(n, o), i = !1), i;
|
|
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), u.isBuffer(t) ? e = "buffer" : e || (e = n.defaultEncoding), typeof r != "function" && (r = wn), n.ended ?
|
|
1900
|
+
return typeof e == "function" && (r = e, e = null), u.isBuffer(t) ? e = "buffer" : e || (e = n.defaultEncoding), typeof r != "function" && (r = wn), n.ended ? bn(this, r) : vn(this, n, t, r) && (n.pendingcb++, i = xn(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 && jt(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
|
};
|
|
@@ -1944,7 +1944,7 @@ function In(t, e) {
|
|
|
1944
1944
|
}
|
|
1945
1945
|
}
|
|
1946
1946
|
function it(t, e, r, n) {
|
|
1947
|
-
r || Cn(t, e), e.pendingcb--, n(),
|
|
1947
|
+
r || Cn(t, e), e.pendingcb--, n(), Vt(t, e);
|
|
1948
1948
|
}
|
|
1949
1949
|
function Cn(t, e) {
|
|
1950
1950
|
e.length === 0 && e.needDrain && (e.needDrain = !1, t.emit("drain"));
|
|
@@ -1957,22 +1957,22 @@ function jt(t, e) {
|
|
|
1957
1957
|
o.entry = r;
|
|
1958
1958
|
for (var s = 0; r; )
|
|
1959
1959
|
i[s] = r, r = r.next, s += 1;
|
|
1960
|
-
$e(t, e, !0, e.length, i, "", o.finish), e.pendingcb++, e.lastBufferedRequest = null, o.next ? (e.corkedRequestsFree = o.next, o.next = null) : e.corkedRequestsFree = new
|
|
1960
|
+
$e(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 zt(e);
|
|
1961
1961
|
} else {
|
|
1962
1962
|
for (; r; ) {
|
|
1963
|
-
var f = r.chunk, a = r.encoding, l = r.callback,
|
|
1964
|
-
if ($e(t, e, !1,
|
|
1963
|
+
var f = r.chunk, a = r.encoding, l = r.callback, h = e.objectMode ? 1 : f.length;
|
|
1964
|
+
if ($e(t, e, !1, h, f, a, l), 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 && On(this, n, r);
|
|
1978
1978
|
};
|
|
@@ -1982,14 +1982,14 @@ function qt(t) {
|
|
|
1982
1982
|
function ot(t, e) {
|
|
1983
1983
|
e.prefinished || (e.prefinished = !0, t.emit("prefinish"));
|
|
1984
1984
|
}
|
|
1985
|
-
function
|
|
1985
|
+
function Vt(t, e) {
|
|
1986
1986
|
var r = qt(e);
|
|
1987
1987
|
return r && (e.pendingcb === 0 ? (ot(t, e), e.finished = !0, t.emit("finish")) : ot(t, e)), r;
|
|
1988
1988
|
}
|
|
1989
1989
|
function On(t, e, r) {
|
|
1990
|
-
e.ending = !0,
|
|
1990
|
+
e.ending = !0, Vt(t, e), r && (e.finished ? B(r) : t.once("finish", r)), e.ended = !0, t.writable = !1;
|
|
1991
1991
|
}
|
|
1992
|
-
function
|
|
1992
|
+
function zt(t) {
|
|
1993
1993
|
var e = this;
|
|
1994
1994
|
this.next = null, this.entry = null, this.finish = function(r) {
|
|
1995
1995
|
var n = e.entry;
|
|
@@ -2001,23 +2001,23 @@ function Vt(t) {
|
|
|
2001
2001
|
};
|
|
2002
2002
|
}
|
|
2003
2003
|
oe(M, C);
|
|
2004
|
-
var st = Object.keys(
|
|
2004
|
+
var st = Object.keys(T.prototype);
|
|
2005
2005
|
for (var Fe = 0; Fe < st.length; Fe++) {
|
|
2006
2006
|
var Me = st[Fe];
|
|
2007
|
-
M.prototype[Me] || (M.prototype[Me] =
|
|
2007
|
+
M.prototype[Me] || (M.prototype[Me] = T.prototype[Me]);
|
|
2008
2008
|
}
|
|
2009
2009
|
function M(t) {
|
|
2010
2010
|
if (!(this instanceof M)) return new M(t);
|
|
2011
|
-
C.call(this, t),
|
|
2011
|
+
C.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", An);
|
|
2012
2012
|
}
|
|
2013
2013
|
function An() {
|
|
2014
|
-
this.allowHalfOpen || this._writableState.ended || B(
|
|
2014
|
+
this.allowHalfOpen || this._writableState.ended || B(Ln, this);
|
|
2015
2015
|
}
|
|
2016
|
-
function
|
|
2016
|
+
function Ln(t) {
|
|
2017
2017
|
t.end();
|
|
2018
2018
|
}
|
|
2019
2019
|
oe(k, M);
|
|
2020
|
-
function
|
|
2020
|
+
function Tn(t) {
|
|
2021
2021
|
this.afterTransform = function(e, r) {
|
|
2022
2022
|
return Dn(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 Dn(t, e, r) {
|
|
|
2033
2033
|
}
|
|
2034
2034
|
function k(t) {
|
|
2035
2035
|
if (!(this instanceof k)) return new k(t);
|
|
2036
|
-
M.call(this, t), this._transformState = new
|
|
2036
|
+
M.call(this, t), this._transformState = new Tn(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,20 +2073,20 @@ function fe(t) {
|
|
|
2073
2073
|
fe.prototype._transform = function(t, e, r) {
|
|
2074
2074
|
r(null, t);
|
|
2075
2075
|
};
|
|
2076
|
-
oe(
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
function
|
|
2076
|
+
oe(z, g);
|
|
2077
|
+
z.Readable = C;
|
|
2078
|
+
z.Writable = T;
|
|
2079
|
+
z.Duplex = M;
|
|
2080
|
+
z.Transform = k;
|
|
2081
|
+
z.PassThrough = fe;
|
|
2082
|
+
z.Stream = z;
|
|
2083
|
+
function z() {
|
|
2084
2084
|
g.call(this);
|
|
2085
2085
|
}
|
|
2086
|
-
|
|
2086
|
+
z.prototype.pipe = function(t, e) {
|
|
2087
2087
|
var r = this;
|
|
2088
|
-
function n(
|
|
2089
|
-
t.writable && t.write(
|
|
2088
|
+
function n(h) {
|
|
2089
|
+
t.writable && t.write(h) === !1 && r.pause && r.pause();
|
|
2090
2090
|
}
|
|
2091
2091
|
r.on("data", n);
|
|
2092
2092
|
function i() {
|
|
@@ -2100,9 +2100,9 @@ V.prototype.pipe = function(t, e) {
|
|
|
2100
2100
|
function f() {
|
|
2101
2101
|
o || (o = !0, typeof t.destroy == "function" && t.destroy());
|
|
2102
2102
|
}
|
|
2103
|
-
function a(
|
|
2103
|
+
function a(h) {
|
|
2104
2104
|
if (l(), g.listenerCount(this, "error") === 0)
|
|
2105
|
-
throw
|
|
2105
|
+
throw h;
|
|
2106
2106
|
}
|
|
2107
2107
|
r.on("error", a), t.on("error", a);
|
|
2108
2108
|
function l() {
|
|
@@ -2665,20 +2665,20 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2665
2665
|
state: kn(r),
|
|
2666
2666
|
__needMoreData: function(n, i, o) {
|
|
2667
2667
|
if (o) return !1;
|
|
2668
|
-
const { encoding: s, escape: f, quote: a } = this.options, { quoting: l, needMoreDataSize:
|
|
2669
|
-
|
|
2668
|
+
const { encoding: s, escape: f, quote: a } = this.options, { quoting: l, needMoreDataSize: h, recordDelimiterMaxLength: c } = this.state, p = i - n - 1, m = Math.max(
|
|
2669
|
+
h,
|
|
2670
2670
|
// Skip if the remaining buffer smaller than record delimiter
|
|
2671
2671
|
// If "record_delimiter" is yet to be discovered:
|
|
2672
2672
|
// 1. It is equals to `[]` and "recordDelimiterMaxLength" equals `0`
|
|
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
|
-
|
|
2677
|
-
`, s).length :
|
|
2676
|
+
c === 0 ? u.from(`\r
|
|
2677
|
+
`, s).length : c,
|
|
2678
2678
|
// Skip if remaining buffer can be an escaped quote
|
|
2679
2679
|
l ? (f === null ? 0 : f.length) + a.length : 0,
|
|
2680
2680
|
// Skip if remaining buffer can be record delimiter following the closing quote
|
|
2681
|
-
l ? a.length +
|
|
2681
|
+
l ? a.length + c : 0
|
|
2682
2682
|
);
|
|
2683
2683
|
return p < m;
|
|
2684
2684
|
},
|
|
@@ -2688,39 +2688,39 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2688
2688
|
bom: f,
|
|
2689
2689
|
comment_no_infix: a,
|
|
2690
2690
|
encoding: l,
|
|
2691
|
-
from_line:
|
|
2692
|
-
ltrim:
|
|
2691
|
+
from_line: h,
|
|
2692
|
+
ltrim: c,
|
|
2693
2693
|
max_record_size: p,
|
|
2694
2694
|
raw: m,
|
|
2695
2695
|
relax_quotes: x,
|
|
2696
2696
|
rtrim: y,
|
|
2697
2697
|
skip_empty_lines: S,
|
|
2698
2698
|
to: R,
|
|
2699
|
-
to_line:
|
|
2699
|
+
to_line: b
|
|
2700
2700
|
} = this.options;
|
|
2701
2701
|
let { comment: _, escape: I, quote: U, record_delimiter: Re } = this.options;
|
|
2702
2702
|
const { bomSkipped: Wt, previousBuf: ce, rawBuffer: Qt, escapeIsQuote: Ht } = this.state;
|
|
2703
|
-
let
|
|
2703
|
+
let v;
|
|
2704
2704
|
if (ce === void 0)
|
|
2705
2705
|
if (n === void 0) {
|
|
2706
2706
|
s();
|
|
2707
2707
|
return;
|
|
2708
2708
|
} else
|
|
2709
|
-
|
|
2710
|
-
else ce !== void 0 && n === void 0 ?
|
|
2709
|
+
v = n;
|
|
2710
|
+
else ce !== void 0 && n === void 0 ? v = ce : v = u.concat([ce, n]);
|
|
2711
2711
|
if (Wt === !1)
|
|
2712
2712
|
if (f === !1)
|
|
2713
2713
|
this.state.bomSkipped = !0;
|
|
2714
|
-
else if (
|
|
2714
|
+
else if (v.length < 3) {
|
|
2715
2715
|
if (i === !1) {
|
|
2716
|
-
this.state.previousBuf =
|
|
2716
|
+
this.state.previousBuf = v;
|
|
2717
2717
|
return;
|
|
2718
2718
|
}
|
|
2719
2719
|
} else {
|
|
2720
2720
|
for (const O in re)
|
|
2721
|
-
if (re[O].compare(
|
|
2721
|
+
if (re[O].compare(v, 0, re[O].length) === 0) {
|
|
2722
2722
|
const J = re[O].length;
|
|
2723
|
-
this.state.bufBytesStart += J,
|
|
2723
|
+
this.state.bufBytesStart += J, v = v.slice(J);
|
|
2724
2724
|
const he = ut({
|
|
2725
2725
|
...this.original_options,
|
|
2726
2726
|
encoding: O
|
|
@@ -2732,24 +2732,24 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2732
2732
|
}
|
|
2733
2733
|
this.state.bomSkipped = !0;
|
|
2734
2734
|
}
|
|
2735
|
-
const Ie =
|
|
2735
|
+
const Ie = v.length;
|
|
2736
2736
|
let d;
|
|
2737
2737
|
for (d = 0; d < Ie && !this.__needMoreData(d, Ie, i); d++) {
|
|
2738
|
-
if (this.state.wasRowDelimiter === !0 && (this.info.lines++, this.state.wasRowDelimiter = !1),
|
|
2738
|
+
if (this.state.wasRowDelimiter === !0 && (this.info.lines++, this.state.wasRowDelimiter = !1), b !== -1 && this.info.lines > b) {
|
|
2739
2739
|
this.state.stop = !0, s();
|
|
2740
2740
|
return;
|
|
2741
2741
|
}
|
|
2742
2742
|
this.state.quoting === !1 && Re.length === 0 && this.__autoDiscoverRecordDelimiter(
|
|
2743
|
-
|
|
2743
|
+
v,
|
|
2744
2744
|
d
|
|
2745
2745
|
) && (Re = this.options.record_delimiter);
|
|
2746
|
-
const O =
|
|
2746
|
+
const O = v[d];
|
|
2747
2747
|
if (m === !0 && Qt.append(O), (O === $n || O === jn) && this.state.wasRowDelimiter === !1 && (this.state.wasRowDelimiter = !0), this.state.escaping === !0)
|
|
2748
2748
|
this.state.escaping = !1;
|
|
2749
2749
|
else {
|
|
2750
|
-
if (I !== null && this.state.quoting === !0 && this.__isEscape(
|
|
2750
|
+
if (I !== null && this.state.quoting === !0 && this.__isEscape(v, d, O) && d + I.length < Ie)
|
|
2751
2751
|
if (Ht) {
|
|
2752
|
-
if (this.__isQuote(
|
|
2752
|
+
if (this.__isQuote(v, d + I.length)) {
|
|
2753
2753
|
this.state.escaping = !0, d += I.length - 1;
|
|
2754
2754
|
continue;
|
|
2755
2755
|
}
|
|
@@ -2757,14 +2757,14 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2757
2757
|
this.state.escaping = !0, d += I.length - 1;
|
|
2758
2758
|
continue;
|
|
2759
2759
|
}
|
|
2760
|
-
if (this.state.commenting === !1 && this.__isQuote(
|
|
2760
|
+
if (this.state.commenting === !1 && this.__isQuote(v, d))
|
|
2761
2761
|
if (this.state.quoting === !0) {
|
|
2762
|
-
const A =
|
|
2763
|
-
|
|
2762
|
+
const A = v[d + U.length], Z = y && this.__isCharTrimable(v, d + U.length), j = _ !== null && this.__compareBytes(_, v, d + U.length, A), X = this.__isDelimiter(
|
|
2763
|
+
v,
|
|
2764
2764
|
d + U.length,
|
|
2765
2765
|
A
|
|
2766
|
-
), de = Re.length === 0 ? this.__autoDiscoverRecordDelimiter(
|
|
2767
|
-
if (I !== null && this.__isEscape(
|
|
2766
|
+
), de = Re.length === 0 ? this.__autoDiscoverRecordDelimiter(v, d + U.length) : this.__isRecordDelimiter(A, v, d + U.length);
|
|
2767
|
+
if (I !== null && this.__isEscape(v, d, O) && this.__isQuote(v, d + I.length))
|
|
2768
2768
|
d += I.length - 1;
|
|
2769
2769
|
else if (!A || X || de || j || Z) {
|
|
2770
2770
|
this.state.quoting = !1, this.state.wasQuoting = !0, d += U.length - 1;
|
|
@@ -2815,14 +2815,14 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2815
2815
|
if (this.state.quoting === !1) {
|
|
2816
2816
|
const A = this.__isRecordDelimiter(
|
|
2817
2817
|
O,
|
|
2818
|
-
|
|
2818
|
+
v,
|
|
2819
2819
|
d
|
|
2820
2820
|
);
|
|
2821
2821
|
if (A !== 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
|
-
if (this.state.enabled === !1 && this.info.lines + (this.state.wasRowDelimiter === !0 ? 1 : 0) >=
|
|
2825
|
+
if (this.state.enabled === !1 && this.info.lines + (this.state.wasRowDelimiter === !0 ? 1 : 0) >= h) {
|
|
2826
2826
|
this.state.enabled = !0, this.__resetField(), this.__resetRecord(), d += A - 1;
|
|
2827
2827
|
continue;
|
|
2828
2828
|
}
|
|
@@ -2846,11 +2846,11 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2846
2846
|
}
|
|
2847
2847
|
if (this.state.commenting)
|
|
2848
2848
|
continue;
|
|
2849
|
-
if (_ !== null && (a === !1 || this.state.record.length === 0 && this.state.field.length === 0) && this.__compareBytes(_,
|
|
2849
|
+
if (_ !== null && (a === !1 || this.state.record.length === 0 && this.state.field.length === 0) && this.__compareBytes(_, v, d, O) !== 0) {
|
|
2850
2850
|
this.state.commenting = !0;
|
|
2851
2851
|
continue;
|
|
2852
2852
|
}
|
|
2853
|
-
const Z = this.__isDelimiter(
|
|
2853
|
+
const Z = this.__isDelimiter(v, d, O);
|
|
2854
2854
|
if (Z !== 0) {
|
|
2855
2855
|
this.info.bytes = this.state.bufBytesStart + d;
|
|
2856
2856
|
const j = this.__onField();
|
|
@@ -2874,11 +2874,11 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2874
2874
|
this.__infoField()
|
|
2875
2875
|
)
|
|
2876
2876
|
);
|
|
2877
|
-
const J =
|
|
2877
|
+
const J = c === !1 || this.state.quoting === !0 || this.state.field.length !== 0 || !this.__isCharTrimable(v, d), he = y === !1 || this.state.wasQuoting === !1;
|
|
2878
2878
|
if (J === !0 && he === !0)
|
|
2879
2879
|
this.state.field.append(O);
|
|
2880
2880
|
else {
|
|
2881
|
-
if (y === !0 && !this.__isCharTrimable(
|
|
2881
|
+
if (y === !0 && !this.__isCharTrimable(v, d))
|
|
2882
2882
|
return this.__error(
|
|
2883
2883
|
new w(
|
|
2884
2884
|
"CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE",
|
|
@@ -2891,7 +2891,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2891
2891
|
this.__infoField()
|
|
2892
2892
|
)
|
|
2893
2893
|
);
|
|
2894
|
-
J === !1 && (d += this.__isCharTrimable(
|
|
2894
|
+
J === !1 && (d += this.__isCharTrimable(v, d) - 1);
|
|
2895
2895
|
continue;
|
|
2896
2896
|
}
|
|
2897
2897
|
}
|
|
@@ -2917,7 +2917,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2917
2917
|
if (J !== void 0) return J;
|
|
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 = v.slice(d);
|
|
2921
2921
|
this.state.wasRowDelimiter === !0 && (this.info.lines++, this.state.wasRowDelimiter = !1);
|
|
2922
2922
|
},
|
|
2923
2923
|
__onRecord: function(n) {
|
|
@@ -2928,8 +2928,8 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2928
2928
|
info: f,
|
|
2929
2929
|
from: a,
|
|
2930
2930
|
relax_column_count: l,
|
|
2931
|
-
relax_column_count_less:
|
|
2932
|
-
relax_column_count_more:
|
|
2931
|
+
relax_column_count_less: h,
|
|
2932
|
+
relax_column_count_more: c,
|
|
2933
2933
|
raw: p,
|
|
2934
2934
|
skip_records_with_empty_values: m
|
|
2935
2935
|
} = this.options, { enabled: x, record: y } = this.state;
|
|
@@ -2970,11 +2970,11 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2970
2970
|
record: y
|
|
2971
2971
|
}
|
|
2972
2972
|
);
|
|
2973
|
-
if (l === !0 ||
|
|
2973
|
+
if (l === !0 || h === !0 && S < this.state.expectedRecordLength || c === !0 && S > this.state.expectedRecordLength)
|
|
2974
2974
|
this.info.invalid_field_length++, this.state.error = R;
|
|
2975
2975
|
else {
|
|
2976
|
-
const
|
|
2977
|
-
if (
|
|
2976
|
+
const b = this.__error(R);
|
|
2977
|
+
if (b) return b;
|
|
2978
2978
|
}
|
|
2979
2979
|
}
|
|
2980
2980
|
if (m === !0 && lt(y)) {
|
|
@@ -2988,46 +2988,46 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
2988
2988
|
if (this.info.records++, a === 1 || this.info.records >= a) {
|
|
2989
2989
|
const { objname: R } = this.options;
|
|
2990
2990
|
if (i !== !1) {
|
|
2991
|
-
const
|
|
2991
|
+
const b = {};
|
|
2992
2992
|
for (let _ = 0, I = y.length; _ < I; _++)
|
|
2993
|
-
i[_] === void 0 || i[_].disabled || (o === !0 &&
|
|
2993
|
+
i[_] === void 0 || i[_].disabled || (o === !0 && b[i[_].name] !== void 0 ? Array.isArray(b[i[_].name]) ? b[i[_].name] = b[i[_].name].concat(y[_]) : b[i[_].name] = [b[i[_].name], y[_]] : b[i[_].name] = y[_]);
|
|
2994
2994
|
if (p === !0 || f === !0) {
|
|
2995
2995
|
const _ = Object.assign(
|
|
2996
|
-
{ record:
|
|
2996
|
+
{ record: b },
|
|
2997
2997
|
p === !0 ? { raw: this.state.rawBuffer.toString(s) } : {},
|
|
2998
2998
|
f === !0 ? { info: this.__infoRecord() } : {}
|
|
2999
2999
|
), I = this.__push(
|
|
3000
|
-
R === void 0 ? _ : [
|
|
3000
|
+
R === void 0 ? _ : [b[R], _],
|
|
3001
3001
|
n
|
|
3002
3002
|
);
|
|
3003
3003
|
if (I)
|
|
3004
3004
|
return I;
|
|
3005
3005
|
} else {
|
|
3006
3006
|
const _ = this.__push(
|
|
3007
|
-
R === void 0 ?
|
|
3007
|
+
R === void 0 ? b : [b[R], b],
|
|
3008
3008
|
n
|
|
3009
3009
|
);
|
|
3010
3010
|
if (_)
|
|
3011
3011
|
return _;
|
|
3012
3012
|
}
|
|
3013
3013
|
} else if (p === !0 || f === !0) {
|
|
3014
|
-
const
|
|
3014
|
+
const b = Object.assign(
|
|
3015
3015
|
{ record: y },
|
|
3016
3016
|
p === !0 ? { raw: this.state.rawBuffer.toString(s) } : {},
|
|
3017
3017
|
f === !0 ? { info: this.__infoRecord() } : {}
|
|
3018
3018
|
), _ = this.__push(
|
|
3019
|
-
R === void 0 ?
|
|
3019
|
+
R === void 0 ? b : [y[R], b],
|
|
3020
3020
|
n
|
|
3021
3021
|
);
|
|
3022
3022
|
if (_)
|
|
3023
3023
|
return _;
|
|
3024
3024
|
} else {
|
|
3025
|
-
const
|
|
3025
|
+
const b = this.__push(
|
|
3026
3026
|
R === void 0 ? y : [y[R], y],
|
|
3027
3027
|
n
|
|
3028
3028
|
);
|
|
3029
|
-
if (
|
|
3030
|
-
return
|
|
3029
|
+
if (b)
|
|
3030
|
+
return b;
|
|
3031
3031
|
}
|
|
3032
3032
|
}
|
|
3033
3033
|
this.__resetRecord();
|
|
@@ -3068,9 +3068,9 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
3068
3068
|
return this.__resetField();
|
|
3069
3069
|
let l = this.state.field.toString(i);
|
|
3070
3070
|
if (o === !0 && a === !1 && (l = l.trimRight()), n === !0) {
|
|
3071
|
-
const [
|
|
3072
|
-
if (
|
|
3073
|
-
l =
|
|
3071
|
+
const [h, c] = this.__cast(l);
|
|
3072
|
+
if (h !== void 0) return h;
|
|
3073
|
+
l = c;
|
|
3074
3074
|
}
|
|
3075
3075
|
this.state.record.push(l), s !== 0 && typeof l == "string" && (this.state.record_length += l.length), this.__resetField();
|
|
3076
3076
|
},
|
|
@@ -3116,10 +3116,10 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
3116
3116
|
return ((s, f) => {
|
|
3117
3117
|
const { timchars: a } = this.state;
|
|
3118
3118
|
e: for (let l = 0; l < a.length; l++) {
|
|
3119
|
-
const
|
|
3120
|
-
for (let
|
|
3121
|
-
if (c
|
|
3122
|
-
return
|
|
3119
|
+
const h = a[l];
|
|
3120
|
+
for (let c = 0; c < h.length; c++)
|
|
3121
|
+
if (h[c] !== s[f + c]) continue e;
|
|
3122
|
+
return h.length;
|
|
3123
3123
|
}
|
|
3124
3124
|
return 0;
|
|
3125
3125
|
})(n, i);
|
|
@@ -3149,8 +3149,8 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
3149
3149
|
e: for (let a = 0; a < s.length; a++) {
|
|
3150
3150
|
const l = s[a];
|
|
3151
3151
|
if (l[0] === o) {
|
|
3152
|
-
for (let
|
|
3153
|
-
if (l[
|
|
3152
|
+
for (let h = 1; h < l.length; h++)
|
|
3153
|
+
if (l[h] !== n[i + h]) continue e;
|
|
3154
3154
|
return l.length;
|
|
3155
3155
|
}
|
|
3156
3156
|
}
|
|
@@ -3159,10 +3159,10 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
3159
3159
|
__isRecordDelimiter: function(n, i, o) {
|
|
3160
3160
|
const { record_delimiter: s } = this.options, f = s.length;
|
|
3161
3161
|
e: for (let a = 0; a < f; a++) {
|
|
3162
|
-
const l = s[a],
|
|
3162
|
+
const l = s[a], h = l.length;
|
|
3163
3163
|
if (l[0] === n) {
|
|
3164
|
-
for (let
|
|
3165
|
-
if (l[
|
|
3164
|
+
for (let c = 1; c < h; c++)
|
|
3165
|
+
if (l[c] !== i[o + c])
|
|
3166
3166
|
continue e;
|
|
3167
3167
|
return l.length;
|
|
3168
3168
|
}
|
|
@@ -3250,7 +3250,7 @@ const Nn = 12, Fn = 13, Mn = 10, Bn = 32, Un = 9, kn = function(t) {
|
|
|
3250
3250
|
}
|
|
3251
3251
|
};
|
|
3252
3252
|
};
|
|
3253
|
-
class
|
|
3253
|
+
class Vn extends k {
|
|
3254
3254
|
constructor(e = {}) {
|
|
3255
3255
|
super({ readableObjectMode: !0, ...e, encoding: null }), this.api = qn({
|
|
3256
3256
|
on_skip: (r, n) => {
|
|
@@ -3309,7 +3309,7 @@ const je = function() {
|
|
|
3309
3309
|
e || {}
|
|
3310
3310
|
);
|
|
3311
3311
|
}
|
|
3312
|
-
const n = new
|
|
3312
|
+
const n = new Vn(e);
|
|
3313
3313
|
if (r) {
|
|
3314
3314
|
const i = e === void 0 || e.objname === void 0 ? [] : {};
|
|
3315
3315
|
n.on("readable", function() {
|
|
@@ -3330,14 +3330,14 @@ const je = function() {
|
|
|
3330
3330
|
}
|
|
3331
3331
|
return n;
|
|
3332
3332
|
};
|
|
3333
|
-
class
|
|
3333
|
+
class zn extends Error {
|
|
3334
3334
|
locator;
|
|
3335
3335
|
/** Logical source of the error. */
|
|
3336
3336
|
constructor(e, r, n) {
|
|
3337
3337
|
super(e, n), this.name = new.target.name, this.locator = r;
|
|
3338
3338
|
}
|
|
3339
3339
|
}
|
|
3340
|
-
class Jn extends
|
|
3340
|
+
class Jn extends zn {
|
|
3341
3341
|
}
|
|
3342
3342
|
class Yn extends Jn {
|
|
3343
3343
|
body;
|
|
@@ -3390,62 +3390,66 @@ class ri {
|
|
|
3390
3390
|
*/
|
|
3391
3391
|
async determineSchemaConfig(e, r, n) {
|
|
3392
3392
|
const i = Xn(r), { records: o, valueDelimiterId: s } = await Kn(r, n), f = [], a = [];
|
|
3393
|
-
for (const
|
|
3394
|
-
const c = e.parseRecord(a,
|
|
3393
|
+
for (const h of o) {
|
|
3394
|
+
const c = e.parseRecord(a, h, !0);
|
|
3395
3395
|
f.push(c);
|
|
3396
3396
|
}
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3397
|
+
const l = f[0];
|
|
3398
|
+
if (l) {
|
|
3399
|
+
const h = f.length;
|
|
3400
|
+
for (let c = 0; c < h; c++) {
|
|
3401
|
+
const p = l[c]?.originalValue ?? `Column ${c}`, m = a[c];
|
|
3402
|
+
m != null && (m.label = { en: p });
|
|
3403
|
+
}
|
|
3404
|
+
}
|
|
3405
|
+
return { columnConfigs: a, recordDelimiterId: i, records: f, valueDelimiterId: s };
|
|
3402
3406
|
}
|
|
3403
3407
|
/**
|
|
3404
3408
|
* Parse stream.
|
|
3405
3409
|
*/
|
|
3406
3410
|
async parseStream(e, r, n, i, o) {
|
|
3407
3411
|
return new Promise((s, f) => {
|
|
3408
|
-
let a, l,
|
|
3412
|
+
let a, l, h, c = !1, p = !1;
|
|
3409
3413
|
const m = () => {
|
|
3410
3414
|
if (p) return;
|
|
3411
3415
|
p = !0;
|
|
3412
3416
|
const S = a;
|
|
3413
|
-
a = void 0,
|
|
3417
|
+
a = void 0, h = void 0, S != null && (Be(() => S.removeAllListeners()), Be(() => S.end())), Be(() => {
|
|
3414
3418
|
l?.cancel();
|
|
3415
3419
|
}), l = void 0;
|
|
3416
3420
|
};
|
|
3417
3421
|
i.signal.addEventListener("abort", m, { once: !0 });
|
|
3418
3422
|
const x = (S) => {
|
|
3419
|
-
|
|
3423
|
+
c || (c = !0, m(), i.signal.aborted || i.abort(S), f(S));
|
|
3420
3424
|
};
|
|
3421
3425
|
(async () => {
|
|
3422
|
-
a = je(r),
|
|
3426
|
+
a = je(r), h = ei({ chunk: o, chunkSize: e.chunkSize ?? Gn }), a.on("readable", () => {
|
|
3423
3427
|
try {
|
|
3424
|
-
if (a == null ||
|
|
3428
|
+
if (a == null || h == null) return;
|
|
3425
3429
|
let I;
|
|
3426
3430
|
for (; (I = a.read()) != null; ) {
|
|
3427
|
-
if (
|
|
3428
|
-
i.signal.throwIfAborted(),
|
|
3431
|
+
if (c) return;
|
|
3432
|
+
i.signal.throwIfAborted(), h.push(I);
|
|
3429
3433
|
}
|
|
3430
3434
|
} catch (I) {
|
|
3431
3435
|
x(I);
|
|
3432
3436
|
}
|
|
3433
3437
|
}), a.on("error", (I) => x(I)), a.on("end", () => {
|
|
3434
|
-
|
|
3438
|
+
c || (h?.flush(), s(ti(a)));
|
|
3435
3439
|
});
|
|
3436
3440
|
const S = await fetch(encodeURI(n), { signal: i.signal });
|
|
3437
3441
|
if (!S.ok || S.body == null)
|
|
3438
3442
|
throw await Wn(S, `Failed to fetch '${n}' file.`, "datapos-connector-file-store-emulator|Connector|retrieve");
|
|
3439
3443
|
l = S.body.getReader();
|
|
3440
3444
|
const R = new TextDecoder(e.encodingId);
|
|
3441
|
-
let
|
|
3442
|
-
for (; !
|
|
3443
|
-
if (
|
|
3445
|
+
let b = await l.read();
|
|
3446
|
+
for (; !b.done; ) {
|
|
3447
|
+
if (c) return;
|
|
3444
3448
|
i.signal.throwIfAborted();
|
|
3445
|
-
const I = R.decode(
|
|
3446
|
-
I.length > 0 && a.write(I),
|
|
3449
|
+
const I = R.decode(b.value, { stream: !0 });
|
|
3450
|
+
I.length > 0 && a.write(I), b = await l.read();
|
|
3447
3451
|
}
|
|
3448
|
-
if (
|
|
3452
|
+
if (c) return;
|
|
3449
3453
|
const _ = R.decode();
|
|
3450
3454
|
_.length > 0 && a.write(_), a.end();
|
|
3451
3455
|
})().catch((S) => x(S));
|
|
@@ -3463,8 +3467,8 @@ async function Kn(t, e) {
|
|
|
3463
3467
|
let r, n, i, o = [];
|
|
3464
3468
|
for (const s of e)
|
|
3465
3469
|
try {
|
|
3466
|
-
let f = 0, a, l = 0,
|
|
3467
|
-
const
|
|
3470
|
+
let f = 0, a, l = 0, h = 0;
|
|
3471
|
+
const c = je({
|
|
3468
3472
|
cast: (p, m) => ({ value: p, isQuoted: m.quoting }),
|
|
3469
3473
|
delimiter: s,
|
|
3470
3474
|
relax_column_count: !0
|
|
@@ -3472,17 +3476,17 @@ async function Kn(t, e) {
|
|
|
3472
3476
|
await new Promise((p) => {
|
|
3473
3477
|
try {
|
|
3474
3478
|
const m = [];
|
|
3475
|
-
|
|
3479
|
+
c.on("readable", () => {
|
|
3476
3480
|
let x;
|
|
3477
|
-
for (; (x =
|
|
3481
|
+
for (; (x = c.read()) != null; ) {
|
|
3478
3482
|
l++;
|
|
3479
3483
|
const y = x.length;
|
|
3480
|
-
a != null && (
|
|
3484
|
+
a != null && (h += Math.abs(y - a)), a = y, f += y, m.push(x);
|
|
3481
3485
|
}
|
|
3482
|
-
}),
|
|
3486
|
+
}), c.on("error", () => p()), c.on("end", () => {
|
|
3483
3487
|
const x = f / l;
|
|
3484
|
-
console.log(1111, f, l, x), (!i ||
|
|
3485
|
-
}),
|
|
3488
|
+
console.log(1111, f, l, x), (!i || h <= i) && (!n || x > n) && (r = s, n = x, i = h, o = [...m]), p();
|
|
3489
|
+
}), c.write(t), c.end();
|
|
3486
3490
|
} catch {
|
|
3487
3491
|
p();
|
|
3488
3492
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Options as ParseOptions, Parser } from 'csv-parse/browser/esm';
|
|
2
2
|
import { EngineUtilities } from '@datapos/datapos-shared/engine';
|
|
3
|
-
import { RetrieveRecordsOptions, RetrieveRecordsSummary } from '@datapos/datapos-shared/component/connector';
|
|
4
|
-
import { ParseResult, RecordDelimiterId, ValueDelimiterId } from '@datapos/datapos-shared/component/dataView';
|
|
3
|
+
import { ConnectionColumnConfig, RetrieveRecordsOptions, RetrieveRecordsSummary } from '@datapos/datapos-shared/component/connector';
|
|
4
|
+
import { ObjectRecord, ParseResult, RecordDelimiterId, ValueDelimiterId } from '@datapos/datapos-shared/component/dataView';
|
|
5
5
|
type StreamParsedRecord = string[];
|
|
6
6
|
/**
|
|
7
7
|
* Schema configuration.
|
|
8
8
|
*/
|
|
9
9
|
interface SchemaConfig {
|
|
10
|
+
columnConfigs: ConnectionColumnConfig[];
|
|
10
11
|
recordDelimiterId: RecordDelimiterId;
|
|
11
12
|
records: ParseResult[][];
|
|
12
13
|
valueDelimiterId: ValueDelimiterId;
|
|
@@ -22,7 +23,7 @@ declare class Tool {
|
|
|
22
23
|
/**
|
|
23
24
|
* Parse stream.
|
|
24
25
|
*/
|
|
25
|
-
parseStream(retrieveRecordsOptions: RetrieveRecordsOptions, parseOptions: ParseOptions, url: string, abortController: AbortController, chunk: (records:
|
|
26
|
+
parseStream(retrieveRecordsOptions: RetrieveRecordsOptions, parseOptions: ParseOptions, url: string, abortController: AbortController, chunk: (records: ObjectRecord[]) => void): Promise<RetrieveRecordsSummary>;
|
|
26
27
|
}
|
|
27
28
|
export type { Options as ParseOptions, Parser } from 'csv-parse/browser/esm';
|
|
28
29
|
export { type StreamParsedRecord, type SchemaConfig, Tool };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datapos/datapos-tool-csv-parse",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.82",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"prettier": "@datapos/datapos-development/prettierrc",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@datapos/datapos-shared": "^0.3.
|
|
29
|
+
"@datapos/datapos-shared": "^0.3.458",
|
|
30
30
|
"csv-parse": "^6.1.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"license-report": "^6.8.1",
|
|
47
47
|
"license-report-check": "^0.1.2",
|
|
48
48
|
"license-report-recursive": "^6.8.2",
|
|
49
|
-
"npm-check-updates": "^19.
|
|
49
|
+
"npm-check-updates": "^19.3.0",
|
|
50
50
|
"owasp-dependency-check": "^1.0.0",
|
|
51
51
|
"prettier": "^3.7.4",
|
|
52
52
|
"rollup-plugin-visualizer": "^6.0.5",
|