convert-buddy-js 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3001 +0,0 @@
1
- import {
2
- __commonJS,
3
- __require
4
- } from "./chunk-VUNV25KB.js";
5
-
6
- // ../../node_modules/@fast-csv/format/build/src/FormatterOptions.js
7
- var require_FormatterOptions = __commonJS({
8
- "../../node_modules/@fast-csv/format/build/src/FormatterOptions.js"(exports) {
9
- "use strict";
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.FormatterOptions = void 0;
12
- var FormatterOptions = class {
13
- objectMode = true;
14
- delimiter = ",";
15
- rowDelimiter = "\n";
16
- quote = '"';
17
- escape = this.quote;
18
- quoteColumns = false;
19
- quoteHeaders = this.quoteColumns;
20
- headers = null;
21
- includeEndRowDelimiter = false;
22
- transform;
23
- shouldWriteHeaders;
24
- writeBOM = false;
25
- escapedQuote;
26
- BOM = "\uFEFF";
27
- alwaysWriteHeaders = false;
28
- constructor(opts = {}) {
29
- Object.assign(this, opts || {});
30
- if (typeof opts?.quoteHeaders === "undefined") {
31
- this.quoteHeaders = this.quoteColumns;
32
- }
33
- if (opts?.quote === true) {
34
- this.quote = '"';
35
- } else if (opts?.quote === false) {
36
- this.quote = "";
37
- }
38
- if (typeof opts?.escape !== "string") {
39
- this.escape = this.quote;
40
- }
41
- this.shouldWriteHeaders = !!this.headers && (opts.writeHeaders ?? true);
42
- this.headers = Array.isArray(this.headers) ? this.headers : null;
43
- this.escapedQuote = `${this.escape}${this.quote}`;
44
- }
45
- };
46
- exports.FormatterOptions = FormatterOptions;
47
- }
48
- });
49
-
50
- // ../../node_modules/lodash.isfunction/index.js
51
- var require_lodash = __commonJS({
52
- "../../node_modules/lodash.isfunction/index.js"(exports, module) {
53
- "use strict";
54
- var asyncTag = "[object AsyncFunction]";
55
- var funcTag = "[object Function]";
56
- var genTag = "[object GeneratorFunction]";
57
- var nullTag = "[object Null]";
58
- var proxyTag = "[object Proxy]";
59
- var undefinedTag = "[object Undefined]";
60
- var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
61
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
62
- var root = freeGlobal || freeSelf || Function("return this")();
63
- var objectProto = Object.prototype;
64
- var hasOwnProperty = objectProto.hasOwnProperty;
65
- var nativeObjectToString = objectProto.toString;
66
- var Symbol = root.Symbol;
67
- var symToStringTag = Symbol ? Symbol.toStringTag : void 0;
68
- function baseGetTag(value) {
69
- if (value == null) {
70
- return value === void 0 ? undefinedTag : nullTag;
71
- }
72
- return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
73
- }
74
- function getRawTag(value) {
75
- var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
76
- try {
77
- value[symToStringTag] = void 0;
78
- var unmasked = true;
79
- } catch (e) {
80
- }
81
- var result = nativeObjectToString.call(value);
82
- if (unmasked) {
83
- if (isOwn) {
84
- value[symToStringTag] = tag;
85
- } else {
86
- delete value[symToStringTag];
87
- }
88
- }
89
- return result;
90
- }
91
- function objectToString(value) {
92
- return nativeObjectToString.call(value);
93
- }
94
- function isFunction(value) {
95
- if (!isObject(value)) {
96
- return false;
97
- }
98
- var tag = baseGetTag(value);
99
- return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
100
- }
101
- function isObject(value) {
102
- var type = typeof value;
103
- return value != null && (type == "object" || type == "function");
104
- }
105
- module.exports = isFunction;
106
- }
107
- });
108
-
109
- // ../../node_modules/lodash.isboolean/index.js
110
- var require_lodash2 = __commonJS({
111
- "../../node_modules/lodash.isboolean/index.js"(exports, module) {
112
- "use strict";
113
- var boolTag = "[object Boolean]";
114
- var objectProto = Object.prototype;
115
- var objectToString = objectProto.toString;
116
- function isBoolean(value) {
117
- return value === true || value === false || isObjectLike(value) && objectToString.call(value) == boolTag;
118
- }
119
- function isObjectLike(value) {
120
- return !!value && typeof value == "object";
121
- }
122
- module.exports = isBoolean;
123
- }
124
- });
125
-
126
- // ../../node_modules/lodash.isnil/index.js
127
- var require_lodash3 = __commonJS({
128
- "../../node_modules/lodash.isnil/index.js"(exports, module) {
129
- "use strict";
130
- function isNil(value) {
131
- return value == null;
132
- }
133
- module.exports = isNil;
134
- }
135
- });
136
-
137
- // ../../node_modules/lodash.escaperegexp/index.js
138
- var require_lodash4 = __commonJS({
139
- "../../node_modules/lodash.escaperegexp/index.js"(exports, module) {
140
- "use strict";
141
- var INFINITY = 1 / 0;
142
- var symbolTag = "[object Symbol]";
143
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
144
- var reHasRegExpChar = RegExp(reRegExpChar.source);
145
- var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
146
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
147
- var root = freeGlobal || freeSelf || Function("return this")();
148
- var objectProto = Object.prototype;
149
- var objectToString = objectProto.toString;
150
- var Symbol = root.Symbol;
151
- var symbolProto = Symbol ? Symbol.prototype : void 0;
152
- var symbolToString = symbolProto ? symbolProto.toString : void 0;
153
- function baseToString(value) {
154
- if (typeof value == "string") {
155
- return value;
156
- }
157
- if (isSymbol(value)) {
158
- return symbolToString ? symbolToString.call(value) : "";
159
- }
160
- var result = value + "";
161
- return result == "0" && 1 / value == -INFINITY ? "-0" : result;
162
- }
163
- function isObjectLike(value) {
164
- return !!value && typeof value == "object";
165
- }
166
- function isSymbol(value) {
167
- return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag;
168
- }
169
- function toString(value) {
170
- return value == null ? "" : baseToString(value);
171
- }
172
- function escapeRegExp(string) {
173
- string = toString(string);
174
- return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string;
175
- }
176
- module.exports = escapeRegExp;
177
- }
178
- });
179
-
180
- // ../../node_modules/@fast-csv/format/build/src/formatter/FieldFormatter.js
181
- var require_FieldFormatter = __commonJS({
182
- "../../node_modules/@fast-csv/format/build/src/formatter/FieldFormatter.js"(exports) {
183
- "use strict";
184
- var __importDefault = exports && exports.__importDefault || function(mod) {
185
- return mod && mod.__esModule ? mod : { "default": mod };
186
- };
187
- Object.defineProperty(exports, "__esModule", { value: true });
188
- exports.FieldFormatter = void 0;
189
- var lodash_isboolean_1 = __importDefault(require_lodash2());
190
- var lodash_isnil_1 = __importDefault(require_lodash3());
191
- var lodash_escaperegexp_1 = __importDefault(require_lodash4());
192
- var FieldFormatter = class {
193
- formatterOptions;
194
- _headers = null;
195
- REPLACE_REGEXP;
196
- ESCAPE_REGEXP;
197
- constructor(formatterOptions) {
198
- this.formatterOptions = formatterOptions;
199
- if (formatterOptions.headers !== null) {
200
- this.headers = formatterOptions.headers;
201
- }
202
- this.REPLACE_REGEXP = new RegExp(formatterOptions.quote, "g");
203
- const escapePattern = `[${formatterOptions.delimiter}${(0, lodash_escaperegexp_1.default)(formatterOptions.rowDelimiter)}|\r|
204
- ]`;
205
- this.ESCAPE_REGEXP = new RegExp(escapePattern);
206
- }
207
- set headers(headers) {
208
- this._headers = headers;
209
- }
210
- shouldQuote(fieldIndex, isHeader) {
211
- const quoteConfig = isHeader ? this.formatterOptions.quoteHeaders : this.formatterOptions.quoteColumns;
212
- if ((0, lodash_isboolean_1.default)(quoteConfig)) {
213
- return quoteConfig;
214
- }
215
- if (Array.isArray(quoteConfig)) {
216
- return quoteConfig[fieldIndex];
217
- }
218
- if (this._headers !== null) {
219
- return quoteConfig[this._headers[fieldIndex]];
220
- }
221
- return false;
222
- }
223
- format(field, fieldIndex, isHeader) {
224
- const preparedField = `${(0, lodash_isnil_1.default)(field) ? "" : field}`.replace(/\0/g, "");
225
- const { formatterOptions } = this;
226
- if (formatterOptions.quote !== "") {
227
- const shouldEscape = preparedField.indexOf(formatterOptions.quote) !== -1;
228
- if (shouldEscape) {
229
- return this.quoteField(preparedField.replace(this.REPLACE_REGEXP, formatterOptions.escapedQuote));
230
- }
231
- }
232
- const hasEscapeCharacters = preparedField.search(this.ESCAPE_REGEXP) !== -1;
233
- if (hasEscapeCharacters || this.shouldQuote(fieldIndex, isHeader)) {
234
- return this.quoteField(preparedField);
235
- }
236
- return preparedField;
237
- }
238
- quoteField(field) {
239
- const { quote } = this.formatterOptions;
240
- return `${quote}${field}${quote}`;
241
- }
242
- };
243
- exports.FieldFormatter = FieldFormatter;
244
- }
245
- });
246
-
247
- // ../../node_modules/@fast-csv/format/build/src/types.js
248
- var require_types = __commonJS({
249
- "../../node_modules/@fast-csv/format/build/src/types.js"(exports) {
250
- "use strict";
251
- Object.defineProperty(exports, "__esModule", { value: true });
252
- exports.isSyncTransform = void 0;
253
- var isSyncTransform = (transform) => {
254
- return transform.length === 1;
255
- };
256
- exports.isSyncTransform = isSyncTransform;
257
- }
258
- });
259
-
260
- // ../../node_modules/@fast-csv/format/build/src/formatter/RowFormatter.js
261
- var require_RowFormatter = __commonJS({
262
- "../../node_modules/@fast-csv/format/build/src/formatter/RowFormatter.js"(exports) {
263
- "use strict";
264
- var __importDefault = exports && exports.__importDefault || function(mod) {
265
- return mod && mod.__esModule ? mod : { "default": mod };
266
- };
267
- Object.defineProperty(exports, "__esModule", { value: true });
268
- exports.RowFormatter = void 0;
269
- var lodash_isfunction_1 = __importDefault(require_lodash());
270
- var FieldFormatter_1 = require_FieldFormatter();
271
- var types_1 = require_types();
272
- var RowFormatter = class _RowFormatter {
273
- static isRowHashArray(row) {
274
- if (Array.isArray(row)) {
275
- return Array.isArray(row[0]) && row[0].length === 2;
276
- }
277
- return false;
278
- }
279
- static isRowArray(row) {
280
- return Array.isArray(row) && !this.isRowHashArray(row);
281
- }
282
- // get headers from a row item
283
- static gatherHeaders(row) {
284
- if (_RowFormatter.isRowHashArray(row)) {
285
- return row.map((it) => {
286
- return it[0];
287
- });
288
- }
289
- if (Array.isArray(row)) {
290
- return row;
291
- }
292
- return Object.keys(row);
293
- }
294
- // eslint-disable-next-line @typescript-eslint/no-shadow
295
- static createTransform(transformFunction) {
296
- if ((0, types_1.isSyncTransform)(transformFunction)) {
297
- return (row, cb) => {
298
- let transformedRow = null;
299
- try {
300
- transformedRow = transformFunction(row);
301
- } catch (e) {
302
- return cb(e);
303
- }
304
- return cb(null, transformedRow);
305
- };
306
- }
307
- return (row, cb) => {
308
- transformFunction(row, cb);
309
- };
310
- }
311
- formatterOptions;
312
- fieldFormatter;
313
- shouldWriteHeaders;
314
- _rowTransform;
315
- headers;
316
- hasWrittenHeaders;
317
- rowCount = 0;
318
- constructor(formatterOptions) {
319
- this.formatterOptions = formatterOptions;
320
- this.fieldFormatter = new FieldFormatter_1.FieldFormatter(formatterOptions);
321
- this.headers = formatterOptions.headers;
322
- this.shouldWriteHeaders = formatterOptions.shouldWriteHeaders;
323
- this.hasWrittenHeaders = false;
324
- if (this.headers !== null) {
325
- this.fieldFormatter.headers = this.headers;
326
- }
327
- if (formatterOptions.transform) {
328
- this.rowTransform = formatterOptions.transform;
329
- }
330
- }
331
- set rowTransform(transformFunction) {
332
- if (!(0, lodash_isfunction_1.default)(transformFunction)) {
333
- throw new TypeError("The transform should be a function");
334
- }
335
- this._rowTransform = _RowFormatter.createTransform(transformFunction);
336
- }
337
- format(row, cb) {
338
- this.callTransformer(row, (err, transformedRow) => {
339
- if (err) {
340
- return cb(err);
341
- }
342
- if (!row) {
343
- return cb(null);
344
- }
345
- const rows = [];
346
- if (transformedRow) {
347
- const { shouldFormatColumns, headers } = this.checkHeaders(transformedRow);
348
- if (this.shouldWriteHeaders && headers && !this.hasWrittenHeaders) {
349
- rows.push(this.formatColumns(headers, true));
350
- this.hasWrittenHeaders = true;
351
- }
352
- if (shouldFormatColumns) {
353
- const columns = this.gatherColumns(transformedRow);
354
- rows.push(this.formatColumns(columns, false));
355
- }
356
- }
357
- return cb(null, rows);
358
- });
359
- }
360
- finish(cb) {
361
- const rows = [];
362
- if (this.formatterOptions.alwaysWriteHeaders && this.rowCount === 0) {
363
- if (!this.headers) {
364
- return cb(new Error("`alwaysWriteHeaders` option is set to true but `headers` option not provided."));
365
- }
366
- rows.push(this.formatColumns(this.headers, true));
367
- }
368
- if (this.formatterOptions.includeEndRowDelimiter) {
369
- rows.push(this.formatterOptions.rowDelimiter);
370
- }
371
- return cb(null, rows);
372
- }
373
- // check if we need to write header return true if we should also write a row
374
- // could be false if headers is true and the header row(first item) is passed in
375
- checkHeaders(row) {
376
- if (this.headers) {
377
- return { shouldFormatColumns: true, headers: this.headers };
378
- }
379
- const headers = _RowFormatter.gatherHeaders(row);
380
- this.headers = headers;
381
- this.fieldFormatter.headers = headers;
382
- if (!this.shouldWriteHeaders) {
383
- return { shouldFormatColumns: true, headers: null };
384
- }
385
- if (Array.isArray(row) && headers.every((header, i) => {
386
- return header === row[i];
387
- })) {
388
- return { shouldFormatColumns: false, headers };
389
- }
390
- return { shouldFormatColumns: true, headers };
391
- }
392
- // todo change this method to unknown[]
393
- gatherColumns(row) {
394
- if (this.headers === null) {
395
- throw new Error("Headers is currently null");
396
- }
397
- if (!Array.isArray(row)) {
398
- return this.headers.map((header) => {
399
- return row[header];
400
- });
401
- }
402
- if (_RowFormatter.isRowHashArray(row)) {
403
- return this.headers.map((header, i) => {
404
- const col = row[i];
405
- if (col) {
406
- return col[1];
407
- }
408
- return "";
409
- });
410
- }
411
- if (_RowFormatter.isRowArray(row) && !this.shouldWriteHeaders) {
412
- return row;
413
- }
414
- return this.headers.map((header, i) => {
415
- return row[i];
416
- });
417
- }
418
- callTransformer(row, cb) {
419
- if (!this._rowTransform) {
420
- return cb(null, row);
421
- }
422
- return this._rowTransform(row, cb);
423
- }
424
- formatColumns(columns, isHeadersRow) {
425
- const formattedCols = columns.map((field, i) => {
426
- return this.fieldFormatter.format(field, i, isHeadersRow);
427
- }).join(this.formatterOptions.delimiter);
428
- const { rowCount } = this;
429
- this.rowCount += 1;
430
- if (rowCount) {
431
- return [this.formatterOptions.rowDelimiter, formattedCols].join("");
432
- }
433
- return formattedCols;
434
- }
435
- };
436
- exports.RowFormatter = RowFormatter;
437
- }
438
- });
439
-
440
- // ../../node_modules/@fast-csv/format/build/src/formatter/index.js
441
- var require_formatter = __commonJS({
442
- "../../node_modules/@fast-csv/format/build/src/formatter/index.js"(exports) {
443
- "use strict";
444
- Object.defineProperty(exports, "__esModule", { value: true });
445
- exports.FieldFormatter = exports.RowFormatter = void 0;
446
- var RowFormatter_1 = require_RowFormatter();
447
- Object.defineProperty(exports, "RowFormatter", { enumerable: true, get: function() {
448
- return RowFormatter_1.RowFormatter;
449
- } });
450
- var FieldFormatter_1 = require_FieldFormatter();
451
- Object.defineProperty(exports, "FieldFormatter", { enumerable: true, get: function() {
452
- return FieldFormatter_1.FieldFormatter;
453
- } });
454
- }
455
- });
456
-
457
- // ../../node_modules/@fast-csv/format/build/src/CsvFormatterStream.js
458
- var require_CsvFormatterStream = __commonJS({
459
- "../../node_modules/@fast-csv/format/build/src/CsvFormatterStream.js"(exports) {
460
- "use strict";
461
- Object.defineProperty(exports, "__esModule", { value: true });
462
- exports.CsvFormatterStream = void 0;
463
- var stream_1 = __require("stream");
464
- var formatter_1 = require_formatter();
465
- var CsvFormatterStream = class extends stream_1.Transform {
466
- formatterOptions;
467
- rowFormatter;
468
- hasWrittenBOM = false;
469
- constructor(formatterOptions) {
470
- super({ writableObjectMode: formatterOptions.objectMode });
471
- this.formatterOptions = formatterOptions;
472
- this.rowFormatter = new formatter_1.RowFormatter(formatterOptions);
473
- this.hasWrittenBOM = !formatterOptions.writeBOM;
474
- }
475
- transform(transformFunction) {
476
- this.rowFormatter.rowTransform = transformFunction;
477
- return this;
478
- }
479
- _transform(row, encoding, cb) {
480
- let cbCalled = false;
481
- try {
482
- if (!this.hasWrittenBOM) {
483
- this.push(this.formatterOptions.BOM);
484
- this.hasWrittenBOM = true;
485
- }
486
- this.rowFormatter.format(row, (err, rows) => {
487
- if (err) {
488
- cbCalled = true;
489
- return cb(err);
490
- }
491
- if (rows) {
492
- rows.forEach((r) => {
493
- this.push(Buffer.from(r, "utf8"));
494
- });
495
- }
496
- cbCalled = true;
497
- return cb();
498
- });
499
- } catch (e) {
500
- if (cbCalled) {
501
- throw e;
502
- }
503
- cb(e);
504
- }
505
- }
506
- _flush(cb) {
507
- this.rowFormatter.finish((err, rows) => {
508
- if (err) {
509
- return cb(err);
510
- }
511
- if (rows) {
512
- rows.forEach((r) => {
513
- this.push(Buffer.from(r, "utf8"));
514
- });
515
- }
516
- return cb();
517
- });
518
- }
519
- };
520
- exports.CsvFormatterStream = CsvFormatterStream;
521
- }
522
- });
523
-
524
- // ../../node_modules/@fast-csv/format/build/src/index.js
525
- var require_src = __commonJS({
526
- "../../node_modules/@fast-csv/format/build/src/index.js"(exports) {
527
- "use strict";
528
- var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
529
- if (k2 === void 0) k2 = k;
530
- var desc = Object.getOwnPropertyDescriptor(m, k);
531
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
532
- desc = { enumerable: true, get: function() {
533
- return m[k];
534
- } };
535
- }
536
- Object.defineProperty(o, k2, desc);
537
- }) : (function(o, m, k, k2) {
538
- if (k2 === void 0) k2 = k;
539
- o[k2] = m[k];
540
- }));
541
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
542
- Object.defineProperty(o, "default", { enumerable: true, value: v });
543
- }) : function(o, v) {
544
- o["default"] = v;
545
- });
546
- var __importStar = exports && exports.__importStar || function(mod) {
547
- if (mod && mod.__esModule) return mod;
548
- var result = {};
549
- if (mod != null) {
550
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
551
- }
552
- __setModuleDefault(result, mod);
553
- return result;
554
- };
555
- var __exportStar = exports && exports.__exportStar || function(m, exports2) {
556
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
557
- };
558
- Object.defineProperty(exports, "__esModule", { value: true });
559
- exports.writeToPath = exports.writeToString = exports.writeToBuffer = exports.writeToStream = exports.write = exports.format = exports.FormatterOptions = exports.CsvFormatterStream = void 0;
560
- var util_1 = __require("util");
561
- var stream_1 = __require("stream");
562
- var fs = __importStar(__require("fs"));
563
- var FormatterOptions_1 = require_FormatterOptions();
564
- var CsvFormatterStream_1 = require_CsvFormatterStream();
565
- __exportStar(require_types(), exports);
566
- var CsvFormatterStream_2 = require_CsvFormatterStream();
567
- Object.defineProperty(exports, "CsvFormatterStream", { enumerable: true, get: function() {
568
- return CsvFormatterStream_2.CsvFormatterStream;
569
- } });
570
- var FormatterOptions_2 = require_FormatterOptions();
571
- Object.defineProperty(exports, "FormatterOptions", { enumerable: true, get: function() {
572
- return FormatterOptions_2.FormatterOptions;
573
- } });
574
- var format = (options) => {
575
- return new CsvFormatterStream_1.CsvFormatterStream(new FormatterOptions_1.FormatterOptions(options));
576
- };
577
- exports.format = format;
578
- var write = (rows, options) => {
579
- const csvStream = (0, exports.format)(options);
580
- const promiseWrite = (0, util_1.promisify)((row, cb) => {
581
- csvStream.write(row, void 0, cb);
582
- });
583
- rows.reduce((prev, row) => {
584
- return prev.then(() => {
585
- return promiseWrite(row);
586
- });
587
- }, Promise.resolve()).then(() => {
588
- csvStream.end();
589
- }).catch((err) => {
590
- csvStream.emit("error", err);
591
- });
592
- return csvStream;
593
- };
594
- exports.write = write;
595
- var writeToStream = (ws, rows, options) => {
596
- return (0, exports.write)(rows, options).pipe(ws);
597
- };
598
- exports.writeToStream = writeToStream;
599
- var writeToBuffer = (rows, opts = {}) => {
600
- const buffers = [];
601
- const ws = new stream_1.Writable({
602
- write(data, enc, writeCb) {
603
- buffers.push(data);
604
- writeCb();
605
- }
606
- });
607
- return new Promise((res, rej) => {
608
- ws.on("error", rej).on("finish", () => {
609
- return res(Buffer.concat(buffers));
610
- });
611
- (0, exports.write)(rows, opts).pipe(ws);
612
- });
613
- };
614
- exports.writeToBuffer = writeToBuffer;
615
- var writeToString = (rows, options) => {
616
- return (0, exports.writeToBuffer)(rows, options).then((buffer) => {
617
- return buffer.toString();
618
- });
619
- };
620
- exports.writeToString = writeToString;
621
- var writeToPath = (path, rows, options) => {
622
- const stream = fs.createWriteStream(path, { encoding: "utf8" });
623
- return (0, exports.write)(rows, options).pipe(stream);
624
- };
625
- exports.writeToPath = writeToPath;
626
- }
627
- });
628
-
629
- // ../../node_modules/@fast-csv/parse/build/src/ParserOptions.js
630
- var require_ParserOptions = __commonJS({
631
- "../../node_modules/@fast-csv/parse/build/src/ParserOptions.js"(exports) {
632
- "use strict";
633
- var __importDefault = exports && exports.__importDefault || function(mod) {
634
- return mod && mod.__esModule ? mod : { "default": mod };
635
- };
636
- Object.defineProperty(exports, "__esModule", { value: true });
637
- exports.ParserOptions = void 0;
638
- var lodash_escaperegexp_1 = __importDefault(require_lodash4());
639
- var lodash_isnil_1 = __importDefault(require_lodash3());
640
- var ParserOptions = class {
641
- escapedDelimiter;
642
- objectMode = true;
643
- delimiter = ",";
644
- ignoreEmpty = false;
645
- quote = '"';
646
- escape = null;
647
- escapeChar = this.quote;
648
- comment = null;
649
- supportsComments = false;
650
- ltrim = false;
651
- rtrim = false;
652
- trim = false;
653
- headers = null;
654
- renameHeaders = false;
655
- strictColumnHandling = false;
656
- discardUnmappedColumns = false;
657
- carriageReturn = "\r";
658
- NEXT_TOKEN_REGEXP;
659
- encoding = "utf8";
660
- limitRows = false;
661
- maxRows = 0;
662
- skipLines = 0;
663
- skipRows = 0;
664
- constructor(opts) {
665
- Object.assign(this, opts || {});
666
- if (this.delimiter.length > 1) {
667
- throw new Error("delimiter option must be one character long");
668
- }
669
- this.escapedDelimiter = (0, lodash_escaperegexp_1.default)(this.delimiter);
670
- this.escapeChar = this.escape ?? this.quote;
671
- this.supportsComments = !(0, lodash_isnil_1.default)(this.comment);
672
- this.NEXT_TOKEN_REGEXP = new RegExp(`([^\\s]|\\r\\n|\\n|\\r|${this.escapedDelimiter})`);
673
- if (this.maxRows > 0) {
674
- this.limitRows = true;
675
- }
676
- }
677
- };
678
- exports.ParserOptions = ParserOptions;
679
- }
680
- });
681
-
682
- // ../../node_modules/@fast-csv/parse/build/src/types.js
683
- var require_types2 = __commonJS({
684
- "../../node_modules/@fast-csv/parse/build/src/types.js"(exports) {
685
- "use strict";
686
- Object.defineProperty(exports, "__esModule", { value: true });
687
- exports.isSyncValidate = exports.isSyncTransform = void 0;
688
- var isSyncTransform = (transform) => {
689
- return transform.length === 1;
690
- };
691
- exports.isSyncTransform = isSyncTransform;
692
- var isSyncValidate = (validate) => {
693
- return validate.length === 1;
694
- };
695
- exports.isSyncValidate = isSyncValidate;
696
- }
697
- });
698
-
699
- // ../../node_modules/@fast-csv/parse/build/src/transforms/RowTransformerValidator.js
700
- var require_RowTransformerValidator = __commonJS({
701
- "../../node_modules/@fast-csv/parse/build/src/transforms/RowTransformerValidator.js"(exports) {
702
- "use strict";
703
- var __importDefault = exports && exports.__importDefault || function(mod) {
704
- return mod && mod.__esModule ? mod : { "default": mod };
705
- };
706
- Object.defineProperty(exports, "__esModule", { value: true });
707
- exports.RowTransformerValidator = void 0;
708
- var lodash_isfunction_1 = __importDefault(require_lodash());
709
- var types_1 = require_types2();
710
- var RowTransformerValidator = class _RowTransformerValidator {
711
- // eslint-disable-next-line @typescript-eslint/no-shadow
712
- static createTransform(transformFunction) {
713
- if ((0, types_1.isSyncTransform)(transformFunction)) {
714
- return (row, cb) => {
715
- let transformed = null;
716
- try {
717
- transformed = transformFunction(row);
718
- } catch (e) {
719
- return cb(e);
720
- }
721
- return cb(null, transformed);
722
- };
723
- }
724
- return transformFunction;
725
- }
726
- static createValidator(validateFunction) {
727
- if ((0, types_1.isSyncValidate)(validateFunction)) {
728
- return (row, cb) => {
729
- cb(null, { row, isValid: validateFunction(row) });
730
- };
731
- }
732
- return (row, cb) => {
733
- validateFunction(row, (err, isValid, reason) => {
734
- if (err) {
735
- return cb(err);
736
- }
737
- if (isValid) {
738
- return cb(null, { row, isValid, reason });
739
- }
740
- return cb(null, { row, isValid: false, reason });
741
- });
742
- };
743
- }
744
- _rowTransform = null;
745
- _rowValidator = null;
746
- set rowTransform(transformFunction) {
747
- if (!(0, lodash_isfunction_1.default)(transformFunction)) {
748
- throw new TypeError("The transform should be a function");
749
- }
750
- this._rowTransform = _RowTransformerValidator.createTransform(transformFunction);
751
- }
752
- set rowValidator(validateFunction) {
753
- if (!(0, lodash_isfunction_1.default)(validateFunction)) {
754
- throw new TypeError("The validate should be a function");
755
- }
756
- this._rowValidator = _RowTransformerValidator.createValidator(validateFunction);
757
- }
758
- transformAndValidate(row, cb) {
759
- return this.callTransformer(row, (transformErr, transformedRow) => {
760
- if (transformErr) {
761
- return cb(transformErr);
762
- }
763
- if (!transformedRow) {
764
- return cb(null, { row: null, isValid: true });
765
- }
766
- return this.callValidator(transformedRow, (validateErr, validationResult) => {
767
- if (validateErr) {
768
- return cb(validateErr);
769
- }
770
- if (validationResult && !validationResult.isValid) {
771
- return cb(null, { row: transformedRow, isValid: false, reason: validationResult.reason });
772
- }
773
- return cb(null, { row: transformedRow, isValid: true });
774
- });
775
- });
776
- }
777
- callTransformer(row, cb) {
778
- if (!this._rowTransform) {
779
- return cb(null, row);
780
- }
781
- return this._rowTransform(row, cb);
782
- }
783
- callValidator(row, cb) {
784
- if (!this._rowValidator) {
785
- return cb(null, { row, isValid: true });
786
- }
787
- return this._rowValidator(row, cb);
788
- }
789
- };
790
- exports.RowTransformerValidator = RowTransformerValidator;
791
- }
792
- });
793
-
794
- // ../../node_modules/lodash.isundefined/index.js
795
- var require_lodash5 = __commonJS({
796
- "../../node_modules/lodash.isundefined/index.js"(exports, module) {
797
- "use strict";
798
- function isUndefined(value) {
799
- return value === void 0;
800
- }
801
- module.exports = isUndefined;
802
- }
803
- });
804
-
805
- // ../../node_modules/lodash.uniq/index.js
806
- var require_lodash6 = __commonJS({
807
- "../../node_modules/lodash.uniq/index.js"(exports, module) {
808
- "use strict";
809
- var LARGE_ARRAY_SIZE = 200;
810
- var HASH_UNDEFINED = "__lodash_hash_undefined__";
811
- var INFINITY = 1 / 0;
812
- var funcTag = "[object Function]";
813
- var genTag = "[object GeneratorFunction]";
814
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
815
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
816
- var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
817
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
818
- var root = freeGlobal || freeSelf || Function("return this")();
819
- function arrayIncludes(array, value) {
820
- var length = array ? array.length : 0;
821
- return !!length && baseIndexOf(array, value, 0) > -1;
822
- }
823
- function arrayIncludesWith(array, value, comparator) {
824
- var index = -1, length = array ? array.length : 0;
825
- while (++index < length) {
826
- if (comparator(value, array[index])) {
827
- return true;
828
- }
829
- }
830
- return false;
831
- }
832
- function baseFindIndex(array, predicate, fromIndex, fromRight) {
833
- var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
834
- while (fromRight ? index-- : ++index < length) {
835
- if (predicate(array[index], index, array)) {
836
- return index;
837
- }
838
- }
839
- return -1;
840
- }
841
- function baseIndexOf(array, value, fromIndex) {
842
- if (value !== value) {
843
- return baseFindIndex(array, baseIsNaN, fromIndex);
844
- }
845
- var index = fromIndex - 1, length = array.length;
846
- while (++index < length) {
847
- if (array[index] === value) {
848
- return index;
849
- }
850
- }
851
- return -1;
852
- }
853
- function baseIsNaN(value) {
854
- return value !== value;
855
- }
856
- function cacheHas(cache, key) {
857
- return cache.has(key);
858
- }
859
- function getValue(object, key) {
860
- return object == null ? void 0 : object[key];
861
- }
862
- function isHostObject(value) {
863
- var result = false;
864
- if (value != null && typeof value.toString != "function") {
865
- try {
866
- result = !!(value + "");
867
- } catch (e) {
868
- }
869
- }
870
- return result;
871
- }
872
- function setToArray(set) {
873
- var index = -1, result = Array(set.size);
874
- set.forEach(function(value) {
875
- result[++index] = value;
876
- });
877
- return result;
878
- }
879
- var arrayProto = Array.prototype;
880
- var funcProto = Function.prototype;
881
- var objectProto = Object.prototype;
882
- var coreJsData = root["__core-js_shared__"];
883
- var maskSrcKey = (function() {
884
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
885
- return uid ? "Symbol(src)_1." + uid : "";
886
- })();
887
- var funcToString = funcProto.toString;
888
- var hasOwnProperty = objectProto.hasOwnProperty;
889
- var objectToString = objectProto.toString;
890
- var reIsNative = RegExp(
891
- "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
892
- );
893
- var splice = arrayProto.splice;
894
- var Map = getNative(root, "Map");
895
- var Set = getNative(root, "Set");
896
- var nativeCreate = getNative(Object, "create");
897
- function Hash(entries) {
898
- var index = -1, length = entries ? entries.length : 0;
899
- this.clear();
900
- while (++index < length) {
901
- var entry = entries[index];
902
- this.set(entry[0], entry[1]);
903
- }
904
- }
905
- function hashClear() {
906
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
907
- }
908
- function hashDelete(key) {
909
- return this.has(key) && delete this.__data__[key];
910
- }
911
- function hashGet(key) {
912
- var data = this.__data__;
913
- if (nativeCreate) {
914
- var result = data[key];
915
- return result === HASH_UNDEFINED ? void 0 : result;
916
- }
917
- return hasOwnProperty.call(data, key) ? data[key] : void 0;
918
- }
919
- function hashHas(key) {
920
- var data = this.__data__;
921
- return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key);
922
- }
923
- function hashSet(key, value) {
924
- var data = this.__data__;
925
- data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
926
- return this;
927
- }
928
- Hash.prototype.clear = hashClear;
929
- Hash.prototype["delete"] = hashDelete;
930
- Hash.prototype.get = hashGet;
931
- Hash.prototype.has = hashHas;
932
- Hash.prototype.set = hashSet;
933
- function ListCache(entries) {
934
- var index = -1, length = entries ? entries.length : 0;
935
- this.clear();
936
- while (++index < length) {
937
- var entry = entries[index];
938
- this.set(entry[0], entry[1]);
939
- }
940
- }
941
- function listCacheClear() {
942
- this.__data__ = [];
943
- }
944
- function listCacheDelete(key) {
945
- var data = this.__data__, index = assocIndexOf(data, key);
946
- if (index < 0) {
947
- return false;
948
- }
949
- var lastIndex = data.length - 1;
950
- if (index == lastIndex) {
951
- data.pop();
952
- } else {
953
- splice.call(data, index, 1);
954
- }
955
- return true;
956
- }
957
- function listCacheGet(key) {
958
- var data = this.__data__, index = assocIndexOf(data, key);
959
- return index < 0 ? void 0 : data[index][1];
960
- }
961
- function listCacheHas(key) {
962
- return assocIndexOf(this.__data__, key) > -1;
963
- }
964
- function listCacheSet(key, value) {
965
- var data = this.__data__, index = assocIndexOf(data, key);
966
- if (index < 0) {
967
- data.push([key, value]);
968
- } else {
969
- data[index][1] = value;
970
- }
971
- return this;
972
- }
973
- ListCache.prototype.clear = listCacheClear;
974
- ListCache.prototype["delete"] = listCacheDelete;
975
- ListCache.prototype.get = listCacheGet;
976
- ListCache.prototype.has = listCacheHas;
977
- ListCache.prototype.set = listCacheSet;
978
- function MapCache(entries) {
979
- var index = -1, length = entries ? entries.length : 0;
980
- this.clear();
981
- while (++index < length) {
982
- var entry = entries[index];
983
- this.set(entry[0], entry[1]);
984
- }
985
- }
986
- function mapCacheClear() {
987
- this.__data__ = {
988
- "hash": new Hash(),
989
- "map": new (Map || ListCache)(),
990
- "string": new Hash()
991
- };
992
- }
993
- function mapCacheDelete(key) {
994
- return getMapData(this, key)["delete"](key);
995
- }
996
- function mapCacheGet(key) {
997
- return getMapData(this, key).get(key);
998
- }
999
- function mapCacheHas(key) {
1000
- return getMapData(this, key).has(key);
1001
- }
1002
- function mapCacheSet(key, value) {
1003
- getMapData(this, key).set(key, value);
1004
- return this;
1005
- }
1006
- MapCache.prototype.clear = mapCacheClear;
1007
- MapCache.prototype["delete"] = mapCacheDelete;
1008
- MapCache.prototype.get = mapCacheGet;
1009
- MapCache.prototype.has = mapCacheHas;
1010
- MapCache.prototype.set = mapCacheSet;
1011
- function SetCache(values) {
1012
- var index = -1, length = values ? values.length : 0;
1013
- this.__data__ = new MapCache();
1014
- while (++index < length) {
1015
- this.add(values[index]);
1016
- }
1017
- }
1018
- function setCacheAdd(value) {
1019
- this.__data__.set(value, HASH_UNDEFINED);
1020
- return this;
1021
- }
1022
- function setCacheHas(value) {
1023
- return this.__data__.has(value);
1024
- }
1025
- SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
1026
- SetCache.prototype.has = setCacheHas;
1027
- function assocIndexOf(array, key) {
1028
- var length = array.length;
1029
- while (length--) {
1030
- if (eq(array[length][0], key)) {
1031
- return length;
1032
- }
1033
- }
1034
- return -1;
1035
- }
1036
- function baseIsNative(value) {
1037
- if (!isObject(value) || isMasked(value)) {
1038
- return false;
1039
- }
1040
- var pattern = isFunction(value) || isHostObject(value) ? reIsNative : reIsHostCtor;
1041
- return pattern.test(toSource(value));
1042
- }
1043
- function baseUniq(array, iteratee, comparator) {
1044
- var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
1045
- if (comparator) {
1046
- isCommon = false;
1047
- includes = arrayIncludesWith;
1048
- } else if (length >= LARGE_ARRAY_SIZE) {
1049
- var set = iteratee ? null : createSet(array);
1050
- if (set) {
1051
- return setToArray(set);
1052
- }
1053
- isCommon = false;
1054
- includes = cacheHas;
1055
- seen = new SetCache();
1056
- } else {
1057
- seen = iteratee ? [] : result;
1058
- }
1059
- outer:
1060
- while (++index < length) {
1061
- var value = array[index], computed = iteratee ? iteratee(value) : value;
1062
- value = comparator || value !== 0 ? value : 0;
1063
- if (isCommon && computed === computed) {
1064
- var seenIndex = seen.length;
1065
- while (seenIndex--) {
1066
- if (seen[seenIndex] === computed) {
1067
- continue outer;
1068
- }
1069
- }
1070
- if (iteratee) {
1071
- seen.push(computed);
1072
- }
1073
- result.push(value);
1074
- } else if (!includes(seen, computed, comparator)) {
1075
- if (seen !== result) {
1076
- seen.push(computed);
1077
- }
1078
- result.push(value);
1079
- }
1080
- }
1081
- return result;
1082
- }
1083
- var createSet = !(Set && 1 / setToArray(new Set([, -0]))[1] == INFINITY) ? noop : function(values) {
1084
- return new Set(values);
1085
- };
1086
- function getMapData(map, key) {
1087
- var data = map.__data__;
1088
- return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
1089
- }
1090
- function getNative(object, key) {
1091
- var value = getValue(object, key);
1092
- return baseIsNative(value) ? value : void 0;
1093
- }
1094
- function isKeyable(value) {
1095
- var type = typeof value;
1096
- return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
1097
- }
1098
- function isMasked(func) {
1099
- return !!maskSrcKey && maskSrcKey in func;
1100
- }
1101
- function toSource(func) {
1102
- if (func != null) {
1103
- try {
1104
- return funcToString.call(func);
1105
- } catch (e) {
1106
- }
1107
- try {
1108
- return func + "";
1109
- } catch (e) {
1110
- }
1111
- }
1112
- return "";
1113
- }
1114
- function uniq(array) {
1115
- return array && array.length ? baseUniq(array) : [];
1116
- }
1117
- function eq(value, other) {
1118
- return value === other || value !== value && other !== other;
1119
- }
1120
- function isFunction(value) {
1121
- var tag = isObject(value) ? objectToString.call(value) : "";
1122
- return tag == funcTag || tag == genTag;
1123
- }
1124
- function isObject(value) {
1125
- var type = typeof value;
1126
- return !!value && (type == "object" || type == "function");
1127
- }
1128
- function noop() {
1129
- }
1130
- module.exports = uniq;
1131
- }
1132
- });
1133
-
1134
- // ../../node_modules/lodash.groupby/index.js
1135
- var require_lodash7 = __commonJS({
1136
- "../../node_modules/lodash.groupby/index.js"(exports, module) {
1137
- "use strict";
1138
- var LARGE_ARRAY_SIZE = 200;
1139
- var FUNC_ERROR_TEXT = "Expected a function";
1140
- var HASH_UNDEFINED = "__lodash_hash_undefined__";
1141
- var UNORDERED_COMPARE_FLAG = 1;
1142
- var PARTIAL_COMPARE_FLAG = 2;
1143
- var INFINITY = 1 / 0;
1144
- var MAX_SAFE_INTEGER = 9007199254740991;
1145
- var argsTag = "[object Arguments]";
1146
- var arrayTag = "[object Array]";
1147
- var boolTag = "[object Boolean]";
1148
- var dateTag = "[object Date]";
1149
- var errorTag = "[object Error]";
1150
- var funcTag = "[object Function]";
1151
- var genTag = "[object GeneratorFunction]";
1152
- var mapTag = "[object Map]";
1153
- var numberTag = "[object Number]";
1154
- var objectTag = "[object Object]";
1155
- var promiseTag = "[object Promise]";
1156
- var regexpTag = "[object RegExp]";
1157
- var setTag = "[object Set]";
1158
- var stringTag = "[object String]";
1159
- var symbolTag = "[object Symbol]";
1160
- var weakMapTag = "[object WeakMap]";
1161
- var arrayBufferTag = "[object ArrayBuffer]";
1162
- var dataViewTag = "[object DataView]";
1163
- var float32Tag = "[object Float32Array]";
1164
- var float64Tag = "[object Float64Array]";
1165
- var int8Tag = "[object Int8Array]";
1166
- var int16Tag = "[object Int16Array]";
1167
- var int32Tag = "[object Int32Array]";
1168
- var uint8Tag = "[object Uint8Array]";
1169
- var uint8ClampedTag = "[object Uint8ClampedArray]";
1170
- var uint16Tag = "[object Uint16Array]";
1171
- var uint32Tag = "[object Uint32Array]";
1172
- var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
1173
- var reIsPlainProp = /^\w*$/;
1174
- var reLeadingDot = /^\./;
1175
- var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
1176
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
1177
- var reEscapeChar = /\\(\\)?/g;
1178
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
1179
- var reIsUint = /^(?:0|[1-9]\d*)$/;
1180
- var typedArrayTags = {};
1181
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
1182
- typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
1183
- var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
1184
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
1185
- var root = freeGlobal || freeSelf || Function("return this")();
1186
- var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
1187
- var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
1188
- var moduleExports = freeModule && freeModule.exports === freeExports;
1189
- var freeProcess = moduleExports && freeGlobal.process;
1190
- var nodeUtil = (function() {
1191
- try {
1192
- return freeProcess && freeProcess.binding("util");
1193
- } catch (e) {
1194
- }
1195
- })();
1196
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
1197
- function arrayAggregator(array, setter, iteratee, accumulator) {
1198
- var index = -1, length = array ? array.length : 0;
1199
- while (++index < length) {
1200
- var value = array[index];
1201
- setter(accumulator, value, iteratee(value), array);
1202
- }
1203
- return accumulator;
1204
- }
1205
- function arraySome(array, predicate) {
1206
- var index = -1, length = array ? array.length : 0;
1207
- while (++index < length) {
1208
- if (predicate(array[index], index, array)) {
1209
- return true;
1210
- }
1211
- }
1212
- return false;
1213
- }
1214
- function baseProperty(key) {
1215
- return function(object) {
1216
- return object == null ? void 0 : object[key];
1217
- };
1218
- }
1219
- function baseTimes(n, iteratee) {
1220
- var index = -1, result = Array(n);
1221
- while (++index < n) {
1222
- result[index] = iteratee(index);
1223
- }
1224
- return result;
1225
- }
1226
- function baseUnary(func) {
1227
- return function(value) {
1228
- return func(value);
1229
- };
1230
- }
1231
- function getValue(object, key) {
1232
- return object == null ? void 0 : object[key];
1233
- }
1234
- function isHostObject(value) {
1235
- var result = false;
1236
- if (value != null && typeof value.toString != "function") {
1237
- try {
1238
- result = !!(value + "");
1239
- } catch (e) {
1240
- }
1241
- }
1242
- return result;
1243
- }
1244
- function mapToArray(map) {
1245
- var index = -1, result = Array(map.size);
1246
- map.forEach(function(value, key) {
1247
- result[++index] = [key, value];
1248
- });
1249
- return result;
1250
- }
1251
- function overArg(func, transform) {
1252
- return function(arg) {
1253
- return func(transform(arg));
1254
- };
1255
- }
1256
- function setToArray(set) {
1257
- var index = -1, result = Array(set.size);
1258
- set.forEach(function(value) {
1259
- result[++index] = value;
1260
- });
1261
- return result;
1262
- }
1263
- var arrayProto = Array.prototype;
1264
- var funcProto = Function.prototype;
1265
- var objectProto = Object.prototype;
1266
- var coreJsData = root["__core-js_shared__"];
1267
- var maskSrcKey = (function() {
1268
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
1269
- return uid ? "Symbol(src)_1." + uid : "";
1270
- })();
1271
- var funcToString = funcProto.toString;
1272
- var hasOwnProperty = objectProto.hasOwnProperty;
1273
- var objectToString = objectProto.toString;
1274
- var reIsNative = RegExp(
1275
- "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
1276
- );
1277
- var Symbol = root.Symbol;
1278
- var Uint8Array = root.Uint8Array;
1279
- var propertyIsEnumerable = objectProto.propertyIsEnumerable;
1280
- var splice = arrayProto.splice;
1281
- var nativeKeys = overArg(Object.keys, Object);
1282
- var DataView = getNative(root, "DataView");
1283
- var Map = getNative(root, "Map");
1284
- var Promise2 = getNative(root, "Promise");
1285
- var Set = getNative(root, "Set");
1286
- var WeakMap = getNative(root, "WeakMap");
1287
- var nativeCreate = getNative(Object, "create");
1288
- var dataViewCtorString = toSource(DataView);
1289
- var mapCtorString = toSource(Map);
1290
- var promiseCtorString = toSource(Promise2);
1291
- var setCtorString = toSource(Set);
1292
- var weakMapCtorString = toSource(WeakMap);
1293
- var symbolProto = Symbol ? Symbol.prototype : void 0;
1294
- var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
1295
- var symbolToString = symbolProto ? symbolProto.toString : void 0;
1296
- function Hash(entries) {
1297
- var index = -1, length = entries ? entries.length : 0;
1298
- this.clear();
1299
- while (++index < length) {
1300
- var entry = entries[index];
1301
- this.set(entry[0], entry[1]);
1302
- }
1303
- }
1304
- function hashClear() {
1305
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
1306
- }
1307
- function hashDelete(key) {
1308
- return this.has(key) && delete this.__data__[key];
1309
- }
1310
- function hashGet(key) {
1311
- var data = this.__data__;
1312
- if (nativeCreate) {
1313
- var result = data[key];
1314
- return result === HASH_UNDEFINED ? void 0 : result;
1315
- }
1316
- return hasOwnProperty.call(data, key) ? data[key] : void 0;
1317
- }
1318
- function hashHas(key) {
1319
- var data = this.__data__;
1320
- return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key);
1321
- }
1322
- function hashSet(key, value) {
1323
- var data = this.__data__;
1324
- data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
1325
- return this;
1326
- }
1327
- Hash.prototype.clear = hashClear;
1328
- Hash.prototype["delete"] = hashDelete;
1329
- Hash.prototype.get = hashGet;
1330
- Hash.prototype.has = hashHas;
1331
- Hash.prototype.set = hashSet;
1332
- function ListCache(entries) {
1333
- var index = -1, length = entries ? entries.length : 0;
1334
- this.clear();
1335
- while (++index < length) {
1336
- var entry = entries[index];
1337
- this.set(entry[0], entry[1]);
1338
- }
1339
- }
1340
- function listCacheClear() {
1341
- this.__data__ = [];
1342
- }
1343
- function listCacheDelete(key) {
1344
- var data = this.__data__, index = assocIndexOf(data, key);
1345
- if (index < 0) {
1346
- return false;
1347
- }
1348
- var lastIndex = data.length - 1;
1349
- if (index == lastIndex) {
1350
- data.pop();
1351
- } else {
1352
- splice.call(data, index, 1);
1353
- }
1354
- return true;
1355
- }
1356
- function listCacheGet(key) {
1357
- var data = this.__data__, index = assocIndexOf(data, key);
1358
- return index < 0 ? void 0 : data[index][1];
1359
- }
1360
- function listCacheHas(key) {
1361
- return assocIndexOf(this.__data__, key) > -1;
1362
- }
1363
- function listCacheSet(key, value) {
1364
- var data = this.__data__, index = assocIndexOf(data, key);
1365
- if (index < 0) {
1366
- data.push([key, value]);
1367
- } else {
1368
- data[index][1] = value;
1369
- }
1370
- return this;
1371
- }
1372
- ListCache.prototype.clear = listCacheClear;
1373
- ListCache.prototype["delete"] = listCacheDelete;
1374
- ListCache.prototype.get = listCacheGet;
1375
- ListCache.prototype.has = listCacheHas;
1376
- ListCache.prototype.set = listCacheSet;
1377
- function MapCache(entries) {
1378
- var index = -1, length = entries ? entries.length : 0;
1379
- this.clear();
1380
- while (++index < length) {
1381
- var entry = entries[index];
1382
- this.set(entry[0], entry[1]);
1383
- }
1384
- }
1385
- function mapCacheClear() {
1386
- this.__data__ = {
1387
- "hash": new Hash(),
1388
- "map": new (Map || ListCache)(),
1389
- "string": new Hash()
1390
- };
1391
- }
1392
- function mapCacheDelete(key) {
1393
- return getMapData(this, key)["delete"](key);
1394
- }
1395
- function mapCacheGet(key) {
1396
- return getMapData(this, key).get(key);
1397
- }
1398
- function mapCacheHas(key) {
1399
- return getMapData(this, key).has(key);
1400
- }
1401
- function mapCacheSet(key, value) {
1402
- getMapData(this, key).set(key, value);
1403
- return this;
1404
- }
1405
- MapCache.prototype.clear = mapCacheClear;
1406
- MapCache.prototype["delete"] = mapCacheDelete;
1407
- MapCache.prototype.get = mapCacheGet;
1408
- MapCache.prototype.has = mapCacheHas;
1409
- MapCache.prototype.set = mapCacheSet;
1410
- function SetCache(values) {
1411
- var index = -1, length = values ? values.length : 0;
1412
- this.__data__ = new MapCache();
1413
- while (++index < length) {
1414
- this.add(values[index]);
1415
- }
1416
- }
1417
- function setCacheAdd(value) {
1418
- this.__data__.set(value, HASH_UNDEFINED);
1419
- return this;
1420
- }
1421
- function setCacheHas(value) {
1422
- return this.__data__.has(value);
1423
- }
1424
- SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
1425
- SetCache.prototype.has = setCacheHas;
1426
- function Stack(entries) {
1427
- this.__data__ = new ListCache(entries);
1428
- }
1429
- function stackClear() {
1430
- this.__data__ = new ListCache();
1431
- }
1432
- function stackDelete(key) {
1433
- return this.__data__["delete"](key);
1434
- }
1435
- function stackGet(key) {
1436
- return this.__data__.get(key);
1437
- }
1438
- function stackHas(key) {
1439
- return this.__data__.has(key);
1440
- }
1441
- function stackSet(key, value) {
1442
- var cache = this.__data__;
1443
- if (cache instanceof ListCache) {
1444
- var pairs = cache.__data__;
1445
- if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
1446
- pairs.push([key, value]);
1447
- return this;
1448
- }
1449
- cache = this.__data__ = new MapCache(pairs);
1450
- }
1451
- cache.set(key, value);
1452
- return this;
1453
- }
1454
- Stack.prototype.clear = stackClear;
1455
- Stack.prototype["delete"] = stackDelete;
1456
- Stack.prototype.get = stackGet;
1457
- Stack.prototype.has = stackHas;
1458
- Stack.prototype.set = stackSet;
1459
- function arrayLikeKeys(value, inherited) {
1460
- var result = isArray(value) || isArguments(value) ? baseTimes(value.length, String) : [];
1461
- var length = result.length, skipIndexes = !!length;
1462
- for (var key in value) {
1463
- if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (key == "length" || isIndex(key, length)))) {
1464
- result.push(key);
1465
- }
1466
- }
1467
- return result;
1468
- }
1469
- function assocIndexOf(array, key) {
1470
- var length = array.length;
1471
- while (length--) {
1472
- if (eq(array[length][0], key)) {
1473
- return length;
1474
- }
1475
- }
1476
- return -1;
1477
- }
1478
- function baseAggregator(collection, setter, iteratee, accumulator) {
1479
- baseEach(collection, function(value, key, collection2) {
1480
- setter(accumulator, value, iteratee(value), collection2);
1481
- });
1482
- return accumulator;
1483
- }
1484
- var baseEach = createBaseEach(baseForOwn);
1485
- var baseFor = createBaseFor();
1486
- function baseForOwn(object, iteratee) {
1487
- return object && baseFor(object, iteratee, keys);
1488
- }
1489
- function baseGet(object, path) {
1490
- path = isKey(path, object) ? [path] : castPath(path);
1491
- var index = 0, length = path.length;
1492
- while (object != null && index < length) {
1493
- object = object[toKey(path[index++])];
1494
- }
1495
- return index && index == length ? object : void 0;
1496
- }
1497
- function baseGetTag(value) {
1498
- return objectToString.call(value);
1499
- }
1500
- function baseHasIn(object, key) {
1501
- return object != null && key in Object(object);
1502
- }
1503
- function baseIsEqual(value, other, customizer, bitmask, stack) {
1504
- if (value === other) {
1505
- return true;
1506
- }
1507
- if (value == null || other == null || !isObject(value) && !isObjectLike(other)) {
1508
- return value !== value && other !== other;
1509
- }
1510
- return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
1511
- }
1512
- function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
1513
- var objIsArr = isArray(object), othIsArr = isArray(other), objTag = arrayTag, othTag = arrayTag;
1514
- if (!objIsArr) {
1515
- objTag = getTag(object);
1516
- objTag = objTag == argsTag ? objectTag : objTag;
1517
- }
1518
- if (!othIsArr) {
1519
- othTag = getTag(other);
1520
- othTag = othTag == argsTag ? objectTag : othTag;
1521
- }
1522
- var objIsObj = objTag == objectTag && !isHostObject(object), othIsObj = othTag == objectTag && !isHostObject(other), isSameTag = objTag == othTag;
1523
- if (isSameTag && !objIsObj) {
1524
- stack || (stack = new Stack());
1525
- return objIsArr || isTypedArray(object) ? equalArrays(object, other, equalFunc, customizer, bitmask, stack) : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
1526
- }
1527
- if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
1528
- var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
1529
- if (objIsWrapped || othIsWrapped) {
1530
- var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
1531
- stack || (stack = new Stack());
1532
- return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
1533
- }
1534
- }
1535
- if (!isSameTag) {
1536
- return false;
1537
- }
1538
- stack || (stack = new Stack());
1539
- return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
1540
- }
1541
- function baseIsMatch(object, source, matchData, customizer) {
1542
- var index = matchData.length, length = index, noCustomizer = !customizer;
1543
- if (object == null) {
1544
- return !length;
1545
- }
1546
- object = Object(object);
1547
- while (index--) {
1548
- var data = matchData[index];
1549
- if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
1550
- return false;
1551
- }
1552
- }
1553
- while (++index < length) {
1554
- data = matchData[index];
1555
- var key = data[0], objValue = object[key], srcValue = data[1];
1556
- if (noCustomizer && data[2]) {
1557
- if (objValue === void 0 && !(key in object)) {
1558
- return false;
1559
- }
1560
- } else {
1561
- var stack = new Stack();
1562
- if (customizer) {
1563
- var result = customizer(objValue, srcValue, key, object, source, stack);
1564
- }
1565
- if (!(result === void 0 ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) : result)) {
1566
- return false;
1567
- }
1568
- }
1569
- }
1570
- return true;
1571
- }
1572
- function baseIsNative(value) {
1573
- if (!isObject(value) || isMasked(value)) {
1574
- return false;
1575
- }
1576
- var pattern = isFunction(value) || isHostObject(value) ? reIsNative : reIsHostCtor;
1577
- return pattern.test(toSource(value));
1578
- }
1579
- function baseIsTypedArray(value) {
1580
- return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
1581
- }
1582
- function baseIteratee(value) {
1583
- if (typeof value == "function") {
1584
- return value;
1585
- }
1586
- if (value == null) {
1587
- return identity;
1588
- }
1589
- if (typeof value == "object") {
1590
- return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
1591
- }
1592
- return property(value);
1593
- }
1594
- function baseKeys(object) {
1595
- if (!isPrototype(object)) {
1596
- return nativeKeys(object);
1597
- }
1598
- var result = [];
1599
- for (var key in Object(object)) {
1600
- if (hasOwnProperty.call(object, key) && key != "constructor") {
1601
- result.push(key);
1602
- }
1603
- }
1604
- return result;
1605
- }
1606
- function baseMatches(source) {
1607
- var matchData = getMatchData(source);
1608
- if (matchData.length == 1 && matchData[0][2]) {
1609
- return matchesStrictComparable(matchData[0][0], matchData[0][1]);
1610
- }
1611
- return function(object) {
1612
- return object === source || baseIsMatch(object, source, matchData);
1613
- };
1614
- }
1615
- function baseMatchesProperty(path, srcValue) {
1616
- if (isKey(path) && isStrictComparable(srcValue)) {
1617
- return matchesStrictComparable(toKey(path), srcValue);
1618
- }
1619
- return function(object) {
1620
- var objValue = get(object, path);
1621
- return objValue === void 0 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, void 0, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG);
1622
- };
1623
- }
1624
- function basePropertyDeep(path) {
1625
- return function(object) {
1626
- return baseGet(object, path);
1627
- };
1628
- }
1629
- function baseToString(value) {
1630
- if (typeof value == "string") {
1631
- return value;
1632
- }
1633
- if (isSymbol(value)) {
1634
- return symbolToString ? symbolToString.call(value) : "";
1635
- }
1636
- var result = value + "";
1637
- return result == "0" && 1 / value == -INFINITY ? "-0" : result;
1638
- }
1639
- function castPath(value) {
1640
- return isArray(value) ? value : stringToPath(value);
1641
- }
1642
- function createAggregator(setter, initializer) {
1643
- return function(collection, iteratee) {
1644
- var func = isArray(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
1645
- return func(collection, setter, baseIteratee(iteratee, 2), accumulator);
1646
- };
1647
- }
1648
- function createBaseEach(eachFunc, fromRight) {
1649
- return function(collection, iteratee) {
1650
- if (collection == null) {
1651
- return collection;
1652
- }
1653
- if (!isArrayLike(collection)) {
1654
- return eachFunc(collection, iteratee);
1655
- }
1656
- var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection);
1657
- while (fromRight ? index-- : ++index < length) {
1658
- if (iteratee(iterable[index], index, iterable) === false) {
1659
- break;
1660
- }
1661
- }
1662
- return collection;
1663
- };
1664
- }
1665
- function createBaseFor(fromRight) {
1666
- return function(object, iteratee, keysFunc) {
1667
- var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length;
1668
- while (length--) {
1669
- var key = props[fromRight ? length : ++index];
1670
- if (iteratee(iterable[key], key, iterable) === false) {
1671
- break;
1672
- }
1673
- }
1674
- return object;
1675
- };
1676
- }
1677
- function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
1678
- var isPartial = bitmask & PARTIAL_COMPARE_FLAG, arrLength = array.length, othLength = other.length;
1679
- if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
1680
- return false;
1681
- }
1682
- var stacked = stack.get(array);
1683
- if (stacked && stack.get(other)) {
1684
- return stacked == other;
1685
- }
1686
- var index = -1, result = true, seen = bitmask & UNORDERED_COMPARE_FLAG ? new SetCache() : void 0;
1687
- stack.set(array, other);
1688
- stack.set(other, array);
1689
- while (++index < arrLength) {
1690
- var arrValue = array[index], othValue = other[index];
1691
- if (customizer) {
1692
- var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
1693
- }
1694
- if (compared !== void 0) {
1695
- if (compared) {
1696
- continue;
1697
- }
1698
- result = false;
1699
- break;
1700
- }
1701
- if (seen) {
1702
- if (!arraySome(other, function(othValue2, othIndex) {
1703
- if (!seen.has(othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, customizer, bitmask, stack))) {
1704
- return seen.add(othIndex);
1705
- }
1706
- })) {
1707
- result = false;
1708
- break;
1709
- }
1710
- } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
1711
- result = false;
1712
- break;
1713
- }
1714
- }
1715
- stack["delete"](array);
1716
- stack["delete"](other);
1717
- return result;
1718
- }
1719
- function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
1720
- switch (tag) {
1721
- case dataViewTag:
1722
- if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
1723
- return false;
1724
- }
1725
- object = object.buffer;
1726
- other = other.buffer;
1727
- case arrayBufferTag:
1728
- if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
1729
- return false;
1730
- }
1731
- return true;
1732
- case boolTag:
1733
- case dateTag:
1734
- case numberTag:
1735
- return eq(+object, +other);
1736
- case errorTag:
1737
- return object.name == other.name && object.message == other.message;
1738
- case regexpTag:
1739
- case stringTag:
1740
- return object == other + "";
1741
- case mapTag:
1742
- var convert = mapToArray;
1743
- case setTag:
1744
- var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
1745
- convert || (convert = setToArray);
1746
- if (object.size != other.size && !isPartial) {
1747
- return false;
1748
- }
1749
- var stacked = stack.get(object);
1750
- if (stacked) {
1751
- return stacked == other;
1752
- }
1753
- bitmask |= UNORDERED_COMPARE_FLAG;
1754
- stack.set(object, other);
1755
- var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
1756
- stack["delete"](object);
1757
- return result;
1758
- case symbolTag:
1759
- if (symbolValueOf) {
1760
- return symbolValueOf.call(object) == symbolValueOf.call(other);
1761
- }
1762
- }
1763
- return false;
1764
- }
1765
- function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
1766
- var isPartial = bitmask & PARTIAL_COMPARE_FLAG, objProps = keys(object), objLength = objProps.length, othProps = keys(other), othLength = othProps.length;
1767
- if (objLength != othLength && !isPartial) {
1768
- return false;
1769
- }
1770
- var index = objLength;
1771
- while (index--) {
1772
- var key = objProps[index];
1773
- if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
1774
- return false;
1775
- }
1776
- }
1777
- var stacked = stack.get(object);
1778
- if (stacked && stack.get(other)) {
1779
- return stacked == other;
1780
- }
1781
- var result = true;
1782
- stack.set(object, other);
1783
- stack.set(other, object);
1784
- var skipCtor = isPartial;
1785
- while (++index < objLength) {
1786
- key = objProps[index];
1787
- var objValue = object[key], othValue = other[key];
1788
- if (customizer) {
1789
- var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
1790
- }
1791
- if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack) : compared)) {
1792
- result = false;
1793
- break;
1794
- }
1795
- skipCtor || (skipCtor = key == "constructor");
1796
- }
1797
- if (result && !skipCtor) {
1798
- var objCtor = object.constructor, othCtor = other.constructor;
1799
- if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
1800
- result = false;
1801
- }
1802
- }
1803
- stack["delete"](object);
1804
- stack["delete"](other);
1805
- return result;
1806
- }
1807
- function getMapData(map, key) {
1808
- var data = map.__data__;
1809
- return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
1810
- }
1811
- function getMatchData(object) {
1812
- var result = keys(object), length = result.length;
1813
- while (length--) {
1814
- var key = result[length], value = object[key];
1815
- result[length] = [key, value, isStrictComparable(value)];
1816
- }
1817
- return result;
1818
- }
1819
- function getNative(object, key) {
1820
- var value = getValue(object, key);
1821
- return baseIsNative(value) ? value : void 0;
1822
- }
1823
- var getTag = baseGetTag;
1824
- if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
1825
- getTag = function(value) {
1826
- var result = objectToString.call(value), Ctor = result == objectTag ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : void 0;
1827
- if (ctorString) {
1828
- switch (ctorString) {
1829
- case dataViewCtorString:
1830
- return dataViewTag;
1831
- case mapCtorString:
1832
- return mapTag;
1833
- case promiseCtorString:
1834
- return promiseTag;
1835
- case setCtorString:
1836
- return setTag;
1837
- case weakMapCtorString:
1838
- return weakMapTag;
1839
- }
1840
- }
1841
- return result;
1842
- };
1843
- }
1844
- function hasPath(object, path, hasFunc) {
1845
- path = isKey(path, object) ? [path] : castPath(path);
1846
- var result, index = -1, length = path.length;
1847
- while (++index < length) {
1848
- var key = toKey(path[index]);
1849
- if (!(result = object != null && hasFunc(object, key))) {
1850
- break;
1851
- }
1852
- object = object[key];
1853
- }
1854
- if (result) {
1855
- return result;
1856
- }
1857
- var length = object ? object.length : 0;
1858
- return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
1859
- }
1860
- function isIndex(value, length) {
1861
- length = length == null ? MAX_SAFE_INTEGER : length;
1862
- return !!length && (typeof value == "number" || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
1863
- }
1864
- function isKey(value, object) {
1865
- if (isArray(value)) {
1866
- return false;
1867
- }
1868
- var type = typeof value;
1869
- if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
1870
- return true;
1871
- }
1872
- return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
1873
- }
1874
- function isKeyable(value) {
1875
- var type = typeof value;
1876
- return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
1877
- }
1878
- function isMasked(func) {
1879
- return !!maskSrcKey && maskSrcKey in func;
1880
- }
1881
- function isPrototype(value) {
1882
- var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
1883
- return value === proto;
1884
- }
1885
- function isStrictComparable(value) {
1886
- return value === value && !isObject(value);
1887
- }
1888
- function matchesStrictComparable(key, srcValue) {
1889
- return function(object) {
1890
- if (object == null) {
1891
- return false;
1892
- }
1893
- return object[key] === srcValue && (srcValue !== void 0 || key in Object(object));
1894
- };
1895
- }
1896
- var stringToPath = memoize(function(string) {
1897
- string = toString(string);
1898
- var result = [];
1899
- if (reLeadingDot.test(string)) {
1900
- result.push("");
1901
- }
1902
- string.replace(rePropName, function(match, number, quote, string2) {
1903
- result.push(quote ? string2.replace(reEscapeChar, "$1") : number || match);
1904
- });
1905
- return result;
1906
- });
1907
- function toKey(value) {
1908
- if (typeof value == "string" || isSymbol(value)) {
1909
- return value;
1910
- }
1911
- var result = value + "";
1912
- return result == "0" && 1 / value == -INFINITY ? "-0" : result;
1913
- }
1914
- function toSource(func) {
1915
- if (func != null) {
1916
- try {
1917
- return funcToString.call(func);
1918
- } catch (e) {
1919
- }
1920
- try {
1921
- return func + "";
1922
- } catch (e) {
1923
- }
1924
- }
1925
- return "";
1926
- }
1927
- var groupBy = createAggregator(function(result, value, key) {
1928
- if (hasOwnProperty.call(result, key)) {
1929
- result[key].push(value);
1930
- } else {
1931
- result[key] = [value];
1932
- }
1933
- });
1934
- function memoize(func, resolver) {
1935
- if (typeof func != "function" || resolver && typeof resolver != "function") {
1936
- throw new TypeError(FUNC_ERROR_TEXT);
1937
- }
1938
- var memoized = function() {
1939
- var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
1940
- if (cache.has(key)) {
1941
- return cache.get(key);
1942
- }
1943
- var result = func.apply(this, args);
1944
- memoized.cache = cache.set(key, result);
1945
- return result;
1946
- };
1947
- memoized.cache = new (memoize.Cache || MapCache)();
1948
- return memoized;
1949
- }
1950
- memoize.Cache = MapCache;
1951
- function eq(value, other) {
1952
- return value === other || value !== value && other !== other;
1953
- }
1954
- function isArguments(value) {
1955
- return isArrayLikeObject(value) && hasOwnProperty.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag);
1956
- }
1957
- var isArray = Array.isArray;
1958
- function isArrayLike(value) {
1959
- return value != null && isLength(value.length) && !isFunction(value);
1960
- }
1961
- function isArrayLikeObject(value) {
1962
- return isObjectLike(value) && isArrayLike(value);
1963
- }
1964
- function isFunction(value) {
1965
- var tag = isObject(value) ? objectToString.call(value) : "";
1966
- return tag == funcTag || tag == genTag;
1967
- }
1968
- function isLength(value) {
1969
- return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
1970
- }
1971
- function isObject(value) {
1972
- var type = typeof value;
1973
- return !!value && (type == "object" || type == "function");
1974
- }
1975
- function isObjectLike(value) {
1976
- return !!value && typeof value == "object";
1977
- }
1978
- function isSymbol(value) {
1979
- return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag;
1980
- }
1981
- var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
1982
- function toString(value) {
1983
- return value == null ? "" : baseToString(value);
1984
- }
1985
- function get(object, path, defaultValue) {
1986
- var result = object == null ? void 0 : baseGet(object, path);
1987
- return result === void 0 ? defaultValue : result;
1988
- }
1989
- function hasIn(object, path) {
1990
- return object != null && hasPath(object, path, baseHasIn);
1991
- }
1992
- function keys(object) {
1993
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
1994
- }
1995
- function identity(value) {
1996
- return value;
1997
- }
1998
- function property(path) {
1999
- return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
2000
- }
2001
- module.exports = groupBy;
2002
- }
2003
- });
2004
-
2005
- // ../../node_modules/@fast-csv/parse/build/src/transforms/HeaderTransformer.js
2006
- var require_HeaderTransformer = __commonJS({
2007
- "../../node_modules/@fast-csv/parse/build/src/transforms/HeaderTransformer.js"(exports) {
2008
- "use strict";
2009
- var __importDefault = exports && exports.__importDefault || function(mod) {
2010
- return mod && mod.__esModule ? mod : { "default": mod };
2011
- };
2012
- Object.defineProperty(exports, "__esModule", { value: true });
2013
- exports.HeaderTransformer = void 0;
2014
- var lodash_isundefined_1 = __importDefault(require_lodash5());
2015
- var lodash_isfunction_1 = __importDefault(require_lodash());
2016
- var lodash_uniq_1 = __importDefault(require_lodash6());
2017
- var lodash_groupby_1 = __importDefault(require_lodash7());
2018
- var HeaderTransformer = class {
2019
- parserOptions;
2020
- headers = null;
2021
- receivedHeaders = false;
2022
- shouldUseFirstRow = false;
2023
- processedFirstRow = false;
2024
- headersLength = 0;
2025
- headersTransform;
2026
- constructor(parserOptions) {
2027
- this.parserOptions = parserOptions;
2028
- if (parserOptions.headers === true) {
2029
- this.shouldUseFirstRow = true;
2030
- } else if (Array.isArray(parserOptions.headers)) {
2031
- this.setHeaders(parserOptions.headers);
2032
- } else if ((0, lodash_isfunction_1.default)(parserOptions.headers)) {
2033
- this.headersTransform = parserOptions.headers;
2034
- }
2035
- }
2036
- transform(row, cb) {
2037
- if (!this.shouldMapRow(row)) {
2038
- return cb(null, { row: null, isValid: true });
2039
- }
2040
- return cb(null, this.processRow(row));
2041
- }
2042
- shouldMapRow(row) {
2043
- const { parserOptions } = this;
2044
- if (!this.headersTransform && parserOptions.renameHeaders && !this.processedFirstRow) {
2045
- if (!this.receivedHeaders) {
2046
- throw new Error("Error renaming headers: new headers must be provided in an array");
2047
- }
2048
- this.processedFirstRow = true;
2049
- return false;
2050
- }
2051
- if (!this.receivedHeaders && Array.isArray(row)) {
2052
- if (this.headersTransform) {
2053
- this.setHeaders(this.headersTransform(row));
2054
- } else if (this.shouldUseFirstRow) {
2055
- this.setHeaders(row);
2056
- } else {
2057
- return true;
2058
- }
2059
- return false;
2060
- }
2061
- return true;
2062
- }
2063
- processRow(row) {
2064
- if (!this.headers) {
2065
- return { row, isValid: true };
2066
- }
2067
- const { parserOptions } = this;
2068
- if (!parserOptions.discardUnmappedColumns && row.length > this.headersLength) {
2069
- if (!parserOptions.strictColumnHandling) {
2070
- throw new Error(`Unexpected Error: column header mismatch expected: ${this.headersLength} columns got: ${row.length}`);
2071
- }
2072
- return {
2073
- row,
2074
- isValid: false,
2075
- reason: `Column header mismatch expected: ${this.headersLength} columns got: ${row.length}`
2076
- };
2077
- }
2078
- if (parserOptions.strictColumnHandling && row.length < this.headersLength) {
2079
- return {
2080
- row,
2081
- isValid: false,
2082
- reason: `Column header mismatch expected: ${this.headersLength} columns got: ${row.length}`
2083
- };
2084
- }
2085
- return { row: this.mapHeaders(row), isValid: true };
2086
- }
2087
- mapHeaders(row) {
2088
- const rowMap = {};
2089
- const { headers, headersLength } = this;
2090
- for (let i = 0; i < headersLength; i += 1) {
2091
- const header = headers[i];
2092
- if (!(0, lodash_isundefined_1.default)(header)) {
2093
- const val = row[i];
2094
- if ((0, lodash_isundefined_1.default)(val)) {
2095
- rowMap[header] = "";
2096
- } else {
2097
- rowMap[header] = val;
2098
- }
2099
- }
2100
- }
2101
- return rowMap;
2102
- }
2103
- setHeaders(headers) {
2104
- const filteredHeaders = headers.filter((h) => {
2105
- return !!h;
2106
- });
2107
- if ((0, lodash_uniq_1.default)(filteredHeaders).length !== filteredHeaders.length) {
2108
- const grouped = (0, lodash_groupby_1.default)(filteredHeaders);
2109
- const duplicates = Object.keys(grouped).filter((dup) => {
2110
- return grouped[dup].length > 1;
2111
- });
2112
- throw new Error(`Duplicate headers found ${JSON.stringify(duplicates)}`);
2113
- }
2114
- this.headers = headers;
2115
- this.receivedHeaders = true;
2116
- this.headersLength = this.headers?.length || 0;
2117
- }
2118
- };
2119
- exports.HeaderTransformer = HeaderTransformer;
2120
- }
2121
- });
2122
-
2123
- // ../../node_modules/@fast-csv/parse/build/src/transforms/index.js
2124
- var require_transforms = __commonJS({
2125
- "../../node_modules/@fast-csv/parse/build/src/transforms/index.js"(exports) {
2126
- "use strict";
2127
- Object.defineProperty(exports, "__esModule", { value: true });
2128
- exports.HeaderTransformer = exports.RowTransformerValidator = void 0;
2129
- var RowTransformerValidator_1 = require_RowTransformerValidator();
2130
- Object.defineProperty(exports, "RowTransformerValidator", { enumerable: true, get: function() {
2131
- return RowTransformerValidator_1.RowTransformerValidator;
2132
- } });
2133
- var HeaderTransformer_1 = require_HeaderTransformer();
2134
- Object.defineProperty(exports, "HeaderTransformer", { enumerable: true, get: function() {
2135
- return HeaderTransformer_1.HeaderTransformer;
2136
- } });
2137
- }
2138
- });
2139
-
2140
- // ../../node_modules/@fast-csv/parse/build/src/parser/Token.js
2141
- var require_Token = __commonJS({
2142
- "../../node_modules/@fast-csv/parse/build/src/parser/Token.js"(exports) {
2143
- "use strict";
2144
- Object.defineProperty(exports, "__esModule", { value: true });
2145
- exports.Token = void 0;
2146
- var Token = class {
2147
- static isTokenRowDelimiter(token) {
2148
- const content = token.token;
2149
- return content === "\r" || content === "\n" || content === "\r\n";
2150
- }
2151
- static isTokenCarriageReturn(token, parserOptions) {
2152
- return token.token === parserOptions.carriageReturn;
2153
- }
2154
- static isTokenComment(token, parserOptions) {
2155
- return parserOptions.supportsComments && !!token && token.token === parserOptions.comment;
2156
- }
2157
- static isTokenEscapeCharacter(token, parserOptions) {
2158
- return token.token === parserOptions.escapeChar;
2159
- }
2160
- static isTokenQuote(token, parserOptions) {
2161
- return token.token === parserOptions.quote;
2162
- }
2163
- static isTokenDelimiter(token, parserOptions) {
2164
- return token.token === parserOptions.delimiter;
2165
- }
2166
- token;
2167
- startCursor;
2168
- endCursor;
2169
- constructor(tokenArgs) {
2170
- this.token = tokenArgs.token;
2171
- this.startCursor = tokenArgs.startCursor;
2172
- this.endCursor = tokenArgs.endCursor;
2173
- }
2174
- };
2175
- exports.Token = Token;
2176
- }
2177
- });
2178
-
2179
- // ../../node_modules/@fast-csv/parse/build/src/parser/Scanner.js
2180
- var require_Scanner = __commonJS({
2181
- "../../node_modules/@fast-csv/parse/build/src/parser/Scanner.js"(exports) {
2182
- "use strict";
2183
- Object.defineProperty(exports, "__esModule", { value: true });
2184
- exports.Scanner = void 0;
2185
- var Token_1 = require_Token();
2186
- var ROW_DELIMITER = /((?:\r\n)|\n|\r)/;
2187
- var Scanner = class {
2188
- line;
2189
- parserOptions;
2190
- lineLength;
2191
- hasMoreData;
2192
- cursor = 0;
2193
- constructor(args) {
2194
- this.line = args.line;
2195
- this.lineLength = this.line.length;
2196
- this.parserOptions = args.parserOptions;
2197
- this.hasMoreData = args.hasMoreData;
2198
- this.cursor = args.cursor || 0;
2199
- }
2200
- get hasMoreCharacters() {
2201
- return this.lineLength > this.cursor;
2202
- }
2203
- get nextNonSpaceToken() {
2204
- const { lineFromCursor } = this;
2205
- const regex = this.parserOptions.NEXT_TOKEN_REGEXP;
2206
- if (lineFromCursor.search(regex) === -1) {
2207
- return null;
2208
- }
2209
- const match = regex.exec(lineFromCursor);
2210
- if (match == null) {
2211
- return null;
2212
- }
2213
- const token = match[1];
2214
- const startCursor = this.cursor + (match.index || 0);
2215
- return new Token_1.Token({
2216
- token,
2217
- startCursor,
2218
- endCursor: startCursor + token.length - 1
2219
- });
2220
- }
2221
- get nextCharacterToken() {
2222
- const { cursor, lineLength } = this;
2223
- if (lineLength <= cursor) {
2224
- return null;
2225
- }
2226
- return new Token_1.Token({
2227
- token: this.line[cursor],
2228
- startCursor: cursor,
2229
- endCursor: cursor
2230
- });
2231
- }
2232
- get lineFromCursor() {
2233
- return this.line.substr(this.cursor);
2234
- }
2235
- advancePastLine() {
2236
- const match = ROW_DELIMITER.exec(this.lineFromCursor);
2237
- if (!match) {
2238
- if (this.hasMoreData) {
2239
- return null;
2240
- }
2241
- this.cursor = this.lineLength;
2242
- return this;
2243
- }
2244
- this.cursor += (match.index || 0) + match[0].length;
2245
- return this;
2246
- }
2247
- advanceTo(cursor) {
2248
- this.cursor = cursor;
2249
- return this;
2250
- }
2251
- advanceToToken(token) {
2252
- this.cursor = token.startCursor;
2253
- return this;
2254
- }
2255
- advancePastToken(token) {
2256
- this.cursor = token.endCursor + 1;
2257
- return this;
2258
- }
2259
- truncateToCursor() {
2260
- this.line = this.lineFromCursor;
2261
- this.lineLength = this.line.length;
2262
- this.cursor = 0;
2263
- return this;
2264
- }
2265
- };
2266
- exports.Scanner = Scanner;
2267
- }
2268
- });
2269
-
2270
- // ../../node_modules/@fast-csv/parse/build/src/parser/column/ColumnFormatter.js
2271
- var require_ColumnFormatter = __commonJS({
2272
- "../../node_modules/@fast-csv/parse/build/src/parser/column/ColumnFormatter.js"(exports) {
2273
- "use strict";
2274
- Object.defineProperty(exports, "__esModule", { value: true });
2275
- exports.ColumnFormatter = void 0;
2276
- var ColumnFormatter = class {
2277
- format;
2278
- constructor(parserOptions) {
2279
- if (parserOptions.trim) {
2280
- this.format = (col) => {
2281
- return col.trim();
2282
- };
2283
- } else if (parserOptions.ltrim) {
2284
- this.format = (col) => {
2285
- return col.trimLeft();
2286
- };
2287
- } else if (parserOptions.rtrim) {
2288
- this.format = (col) => {
2289
- return col.trimRight();
2290
- };
2291
- } else {
2292
- this.format = (col) => {
2293
- return col;
2294
- };
2295
- }
2296
- }
2297
- };
2298
- exports.ColumnFormatter = ColumnFormatter;
2299
- }
2300
- });
2301
-
2302
- // ../../node_modules/@fast-csv/parse/build/src/parser/column/NonQuotedColumnParser.js
2303
- var require_NonQuotedColumnParser = __commonJS({
2304
- "../../node_modules/@fast-csv/parse/build/src/parser/column/NonQuotedColumnParser.js"(exports) {
2305
- "use strict";
2306
- Object.defineProperty(exports, "__esModule", { value: true });
2307
- exports.NonQuotedColumnParser = void 0;
2308
- var ColumnFormatter_1 = require_ColumnFormatter();
2309
- var Token_1 = require_Token();
2310
- var NonQuotedColumnParser = class {
2311
- parserOptions;
2312
- columnFormatter;
2313
- constructor(parserOptions) {
2314
- this.parserOptions = parserOptions;
2315
- this.columnFormatter = new ColumnFormatter_1.ColumnFormatter(parserOptions);
2316
- }
2317
- parse(scanner) {
2318
- if (!scanner.hasMoreCharacters) {
2319
- return null;
2320
- }
2321
- const { parserOptions } = this;
2322
- const characters = [];
2323
- let nextToken = scanner.nextCharacterToken;
2324
- for (; nextToken; nextToken = scanner.nextCharacterToken) {
2325
- if (Token_1.Token.isTokenDelimiter(nextToken, parserOptions) || Token_1.Token.isTokenRowDelimiter(nextToken)) {
2326
- break;
2327
- }
2328
- characters.push(nextToken.token);
2329
- scanner.advancePastToken(nextToken);
2330
- }
2331
- return this.columnFormatter.format(characters.join(""));
2332
- }
2333
- };
2334
- exports.NonQuotedColumnParser = NonQuotedColumnParser;
2335
- }
2336
- });
2337
-
2338
- // ../../node_modules/@fast-csv/parse/build/src/parser/column/QuotedColumnParser.js
2339
- var require_QuotedColumnParser = __commonJS({
2340
- "../../node_modules/@fast-csv/parse/build/src/parser/column/QuotedColumnParser.js"(exports) {
2341
- "use strict";
2342
- Object.defineProperty(exports, "__esModule", { value: true });
2343
- exports.QuotedColumnParser = void 0;
2344
- var ColumnFormatter_1 = require_ColumnFormatter();
2345
- var Token_1 = require_Token();
2346
- var QuotedColumnParser = class {
2347
- parserOptions;
2348
- columnFormatter;
2349
- constructor(parserOptions) {
2350
- this.parserOptions = parserOptions;
2351
- this.columnFormatter = new ColumnFormatter_1.ColumnFormatter(parserOptions);
2352
- }
2353
- parse(scanner) {
2354
- if (!scanner.hasMoreCharacters) {
2355
- return null;
2356
- }
2357
- const originalCursor = scanner.cursor;
2358
- const { foundClosingQuote, col } = this.gatherDataBetweenQuotes(scanner);
2359
- if (!foundClosingQuote) {
2360
- scanner.advanceTo(originalCursor);
2361
- if (!scanner.hasMoreData) {
2362
- throw new Error(`Parse Error: missing closing: '${this.parserOptions.quote || ""}' in line: at '${scanner.lineFromCursor.replace(/[\r\n]/g, "\\n'")}'`);
2363
- }
2364
- return null;
2365
- }
2366
- this.checkForMalformedColumn(scanner);
2367
- return col;
2368
- }
2369
- gatherDataBetweenQuotes(scanner) {
2370
- const { parserOptions } = this;
2371
- let foundStartingQuote = false;
2372
- let foundClosingQuote = false;
2373
- const characters = [];
2374
- let nextToken = scanner.nextCharacterToken;
2375
- for (; !foundClosingQuote && nextToken !== null; nextToken = scanner.nextCharacterToken) {
2376
- const isQuote = Token_1.Token.isTokenQuote(nextToken, parserOptions);
2377
- if (!foundStartingQuote && isQuote) {
2378
- foundStartingQuote = true;
2379
- } else if (foundStartingQuote) {
2380
- if (Token_1.Token.isTokenEscapeCharacter(nextToken, parserOptions)) {
2381
- scanner.advancePastToken(nextToken);
2382
- const tokenFollowingEscape = scanner.nextCharacterToken;
2383
- if (tokenFollowingEscape !== null && (Token_1.Token.isTokenQuote(tokenFollowingEscape, parserOptions) || Token_1.Token.isTokenEscapeCharacter(tokenFollowingEscape, parserOptions))) {
2384
- characters.push(tokenFollowingEscape.token);
2385
- nextToken = tokenFollowingEscape;
2386
- } else if (isQuote) {
2387
- foundClosingQuote = true;
2388
- } else {
2389
- characters.push(nextToken.token);
2390
- }
2391
- } else if (isQuote) {
2392
- foundClosingQuote = true;
2393
- } else {
2394
- characters.push(nextToken.token);
2395
- }
2396
- }
2397
- scanner.advancePastToken(nextToken);
2398
- }
2399
- return { col: this.columnFormatter.format(characters.join("")), foundClosingQuote };
2400
- }
2401
- checkForMalformedColumn(scanner) {
2402
- const { parserOptions } = this;
2403
- const { nextNonSpaceToken } = scanner;
2404
- if (nextNonSpaceToken) {
2405
- const isNextTokenADelimiter = Token_1.Token.isTokenDelimiter(nextNonSpaceToken, parserOptions);
2406
- const isNextTokenARowDelimiter = Token_1.Token.isTokenRowDelimiter(nextNonSpaceToken);
2407
- if (!(isNextTokenADelimiter || isNextTokenARowDelimiter)) {
2408
- const linePreview = scanner.lineFromCursor.substr(0, 10).replace(/[\r\n]/g, "\\n'");
2409
- throw new Error(`Parse Error: expected: '${parserOptions.escapedDelimiter}' OR new line got: '${nextNonSpaceToken.token}'. at '${linePreview}'`);
2410
- }
2411
- scanner.advanceToToken(nextNonSpaceToken);
2412
- } else if (!scanner.hasMoreData) {
2413
- scanner.advancePastLine();
2414
- }
2415
- }
2416
- };
2417
- exports.QuotedColumnParser = QuotedColumnParser;
2418
- }
2419
- });
2420
-
2421
- // ../../node_modules/@fast-csv/parse/build/src/parser/column/ColumnParser.js
2422
- var require_ColumnParser = __commonJS({
2423
- "../../node_modules/@fast-csv/parse/build/src/parser/column/ColumnParser.js"(exports) {
2424
- "use strict";
2425
- Object.defineProperty(exports, "__esModule", { value: true });
2426
- exports.ColumnParser = void 0;
2427
- var NonQuotedColumnParser_1 = require_NonQuotedColumnParser();
2428
- var QuotedColumnParser_1 = require_QuotedColumnParser();
2429
- var Token_1 = require_Token();
2430
- var ColumnParser = class {
2431
- parserOptions;
2432
- nonQuotedColumnParser;
2433
- quotedColumnParser;
2434
- constructor(parserOptions) {
2435
- this.parserOptions = parserOptions;
2436
- this.quotedColumnParser = new QuotedColumnParser_1.QuotedColumnParser(parserOptions);
2437
- this.nonQuotedColumnParser = new NonQuotedColumnParser_1.NonQuotedColumnParser(parserOptions);
2438
- }
2439
- parse(scanner) {
2440
- const { nextNonSpaceToken } = scanner;
2441
- if (nextNonSpaceToken !== null && Token_1.Token.isTokenQuote(nextNonSpaceToken, this.parserOptions)) {
2442
- scanner.advanceToToken(nextNonSpaceToken);
2443
- return this.quotedColumnParser.parse(scanner);
2444
- }
2445
- return this.nonQuotedColumnParser.parse(scanner);
2446
- }
2447
- };
2448
- exports.ColumnParser = ColumnParser;
2449
- }
2450
- });
2451
-
2452
- // ../../node_modules/@fast-csv/parse/build/src/parser/column/index.js
2453
- var require_column = __commonJS({
2454
- "../../node_modules/@fast-csv/parse/build/src/parser/column/index.js"(exports) {
2455
- "use strict";
2456
- Object.defineProperty(exports, "__esModule", { value: true });
2457
- exports.ColumnFormatter = exports.QuotedColumnParser = exports.NonQuotedColumnParser = exports.ColumnParser = void 0;
2458
- var ColumnParser_1 = require_ColumnParser();
2459
- Object.defineProperty(exports, "ColumnParser", { enumerable: true, get: function() {
2460
- return ColumnParser_1.ColumnParser;
2461
- } });
2462
- var NonQuotedColumnParser_1 = require_NonQuotedColumnParser();
2463
- Object.defineProperty(exports, "NonQuotedColumnParser", { enumerable: true, get: function() {
2464
- return NonQuotedColumnParser_1.NonQuotedColumnParser;
2465
- } });
2466
- var QuotedColumnParser_1 = require_QuotedColumnParser();
2467
- Object.defineProperty(exports, "QuotedColumnParser", { enumerable: true, get: function() {
2468
- return QuotedColumnParser_1.QuotedColumnParser;
2469
- } });
2470
- var ColumnFormatter_1 = require_ColumnFormatter();
2471
- Object.defineProperty(exports, "ColumnFormatter", { enumerable: true, get: function() {
2472
- return ColumnFormatter_1.ColumnFormatter;
2473
- } });
2474
- }
2475
- });
2476
-
2477
- // ../../node_modules/@fast-csv/parse/build/src/parser/RowParser.js
2478
- var require_RowParser = __commonJS({
2479
- "../../node_modules/@fast-csv/parse/build/src/parser/RowParser.js"(exports) {
2480
- "use strict";
2481
- Object.defineProperty(exports, "__esModule", { value: true });
2482
- exports.RowParser = void 0;
2483
- var column_1 = require_column();
2484
- var Token_1 = require_Token();
2485
- var EMPTY_STRING = "";
2486
- var RowParser = class {
2487
- static isEmptyRow(row) {
2488
- return row.join(EMPTY_STRING).replace(/\s+/g, EMPTY_STRING) === EMPTY_STRING;
2489
- }
2490
- parserOptions;
2491
- columnParser;
2492
- constructor(parserOptions) {
2493
- this.parserOptions = parserOptions;
2494
- this.columnParser = new column_1.ColumnParser(parserOptions);
2495
- }
2496
- parse(scanner) {
2497
- const { parserOptions } = this;
2498
- const { hasMoreData } = scanner;
2499
- const currentScanner = scanner;
2500
- const columns = [];
2501
- let currentToken = this.getStartToken(currentScanner, columns);
2502
- while (currentToken) {
2503
- if (Token_1.Token.isTokenRowDelimiter(currentToken)) {
2504
- currentScanner.advancePastToken(currentToken);
2505
- if (!currentScanner.hasMoreCharacters && Token_1.Token.isTokenCarriageReturn(currentToken, parserOptions) && hasMoreData) {
2506
- return null;
2507
- }
2508
- currentScanner.truncateToCursor();
2509
- return columns;
2510
- }
2511
- if (!this.shouldSkipColumnParse(currentScanner, currentToken, columns)) {
2512
- const item = this.columnParser.parse(currentScanner);
2513
- if (item === null) {
2514
- return null;
2515
- }
2516
- columns.push(item);
2517
- }
2518
- currentToken = currentScanner.nextNonSpaceToken;
2519
- }
2520
- if (!hasMoreData) {
2521
- currentScanner.truncateToCursor();
2522
- return columns;
2523
- }
2524
- return null;
2525
- }
2526
- getStartToken(scanner, columns) {
2527
- const currentToken = scanner.nextNonSpaceToken;
2528
- if (currentToken !== null && Token_1.Token.isTokenDelimiter(currentToken, this.parserOptions)) {
2529
- columns.push("");
2530
- return scanner.nextNonSpaceToken;
2531
- }
2532
- return currentToken;
2533
- }
2534
- shouldSkipColumnParse(scanner, currentToken, columns) {
2535
- const { parserOptions } = this;
2536
- if (Token_1.Token.isTokenDelimiter(currentToken, parserOptions)) {
2537
- scanner.advancePastToken(currentToken);
2538
- const nextToken = scanner.nextCharacterToken;
2539
- if (!scanner.hasMoreCharacters || nextToken !== null && Token_1.Token.isTokenRowDelimiter(nextToken)) {
2540
- columns.push("");
2541
- return true;
2542
- }
2543
- if (nextToken !== null && Token_1.Token.isTokenDelimiter(nextToken, parserOptions)) {
2544
- columns.push("");
2545
- return true;
2546
- }
2547
- }
2548
- return false;
2549
- }
2550
- };
2551
- exports.RowParser = RowParser;
2552
- }
2553
- });
2554
-
2555
- // ../../node_modules/@fast-csv/parse/build/src/parser/Parser.js
2556
- var require_Parser = __commonJS({
2557
- "../../node_modules/@fast-csv/parse/build/src/parser/Parser.js"(exports) {
2558
- "use strict";
2559
- Object.defineProperty(exports, "__esModule", { value: true });
2560
- exports.Parser = void 0;
2561
- var Scanner_1 = require_Scanner();
2562
- var RowParser_1 = require_RowParser();
2563
- var Token_1 = require_Token();
2564
- var Parser = class _Parser {
2565
- static removeBOM(line) {
2566
- if (line && line.charCodeAt(0) === 65279) {
2567
- return line.slice(1);
2568
- }
2569
- return line;
2570
- }
2571
- parserOptions;
2572
- rowParser;
2573
- constructor(parserOptions) {
2574
- this.parserOptions = parserOptions;
2575
- this.rowParser = new RowParser_1.RowParser(this.parserOptions);
2576
- }
2577
- parse(line, hasMoreData) {
2578
- const scanner = new Scanner_1.Scanner({
2579
- line: _Parser.removeBOM(line),
2580
- parserOptions: this.parserOptions,
2581
- hasMoreData
2582
- });
2583
- if (this.parserOptions.supportsComments) {
2584
- return this.parseWithComments(scanner);
2585
- }
2586
- return this.parseWithoutComments(scanner);
2587
- }
2588
- parseWithoutComments(scanner) {
2589
- const rows = [];
2590
- let shouldContinue = true;
2591
- while (shouldContinue) {
2592
- shouldContinue = this.parseRow(scanner, rows);
2593
- }
2594
- return { line: scanner.line, rows };
2595
- }
2596
- parseWithComments(scanner) {
2597
- const { parserOptions } = this;
2598
- const rows = [];
2599
- for (let nextToken = scanner.nextCharacterToken; nextToken !== null; nextToken = scanner.nextCharacterToken) {
2600
- if (Token_1.Token.isTokenComment(nextToken, parserOptions)) {
2601
- const cursor = scanner.advancePastLine();
2602
- if (cursor === null) {
2603
- return { line: scanner.lineFromCursor, rows };
2604
- }
2605
- if (!scanner.hasMoreCharacters) {
2606
- return { line: scanner.lineFromCursor, rows };
2607
- }
2608
- scanner.truncateToCursor();
2609
- } else if (!this.parseRow(scanner, rows)) {
2610
- break;
2611
- }
2612
- }
2613
- return { line: scanner.line, rows };
2614
- }
2615
- parseRow(scanner, rows) {
2616
- const nextToken = scanner.nextNonSpaceToken;
2617
- if (!nextToken) {
2618
- return false;
2619
- }
2620
- const row = this.rowParser.parse(scanner);
2621
- if (row === null) {
2622
- return false;
2623
- }
2624
- if (this.parserOptions.ignoreEmpty && RowParser_1.RowParser.isEmptyRow(row)) {
2625
- return true;
2626
- }
2627
- rows.push(row);
2628
- return true;
2629
- }
2630
- };
2631
- exports.Parser = Parser;
2632
- }
2633
- });
2634
-
2635
- // ../../node_modules/@fast-csv/parse/build/src/parser/index.js
2636
- var require_parser = __commonJS({
2637
- "../../node_modules/@fast-csv/parse/build/src/parser/index.js"(exports) {
2638
- "use strict";
2639
- Object.defineProperty(exports, "__esModule", { value: true });
2640
- exports.QuotedColumnParser = exports.NonQuotedColumnParser = exports.ColumnParser = exports.Token = exports.Scanner = exports.RowParser = exports.Parser = void 0;
2641
- var Parser_1 = require_Parser();
2642
- Object.defineProperty(exports, "Parser", { enumerable: true, get: function() {
2643
- return Parser_1.Parser;
2644
- } });
2645
- var RowParser_1 = require_RowParser();
2646
- Object.defineProperty(exports, "RowParser", { enumerable: true, get: function() {
2647
- return RowParser_1.RowParser;
2648
- } });
2649
- var Scanner_1 = require_Scanner();
2650
- Object.defineProperty(exports, "Scanner", { enumerable: true, get: function() {
2651
- return Scanner_1.Scanner;
2652
- } });
2653
- var Token_1 = require_Token();
2654
- Object.defineProperty(exports, "Token", { enumerable: true, get: function() {
2655
- return Token_1.Token;
2656
- } });
2657
- var column_1 = require_column();
2658
- Object.defineProperty(exports, "ColumnParser", { enumerable: true, get: function() {
2659
- return column_1.ColumnParser;
2660
- } });
2661
- Object.defineProperty(exports, "NonQuotedColumnParser", { enumerable: true, get: function() {
2662
- return column_1.NonQuotedColumnParser;
2663
- } });
2664
- Object.defineProperty(exports, "QuotedColumnParser", { enumerable: true, get: function() {
2665
- return column_1.QuotedColumnParser;
2666
- } });
2667
- }
2668
- });
2669
-
2670
- // ../../node_modules/@fast-csv/parse/build/src/CsvParserStream.js
2671
- var require_CsvParserStream = __commonJS({
2672
- "../../node_modules/@fast-csv/parse/build/src/CsvParserStream.js"(exports) {
2673
- "use strict";
2674
- Object.defineProperty(exports, "__esModule", { value: true });
2675
- exports.CsvParserStream = void 0;
2676
- var string_decoder_1 = __require("string_decoder");
2677
- var stream_1 = __require("stream");
2678
- var transforms_1 = require_transforms();
2679
- var parser_1 = require_parser();
2680
- var CsvParserStream = class _CsvParserStream extends stream_1.Transform {
2681
- parserOptions;
2682
- decoder;
2683
- parser;
2684
- headerTransformer;
2685
- rowTransformerValidator;
2686
- lines = "";
2687
- rowCount = 0;
2688
- parsedRowCount = 0;
2689
- parsedLineCount = 0;
2690
- endEmitted = false;
2691
- headersEmitted = false;
2692
- constructor(parserOptions) {
2693
- super({ objectMode: parserOptions.objectMode });
2694
- this.parserOptions = parserOptions;
2695
- this.parser = new parser_1.Parser(parserOptions);
2696
- this.headerTransformer = new transforms_1.HeaderTransformer(parserOptions);
2697
- this.decoder = new string_decoder_1.StringDecoder(parserOptions.encoding);
2698
- this.rowTransformerValidator = new transforms_1.RowTransformerValidator();
2699
- }
2700
- get hasHitRowLimit() {
2701
- return this.parserOptions.limitRows && this.rowCount >= this.parserOptions.maxRows;
2702
- }
2703
- get shouldEmitRows() {
2704
- return this.parsedRowCount > this.parserOptions.skipRows;
2705
- }
2706
- get shouldSkipLine() {
2707
- return this.parsedLineCount <= this.parserOptions.skipLines;
2708
- }
2709
- transform(transformFunction) {
2710
- this.rowTransformerValidator.rowTransform = transformFunction;
2711
- return this;
2712
- }
2713
- validate(validateFunction) {
2714
- this.rowTransformerValidator.rowValidator = validateFunction;
2715
- return this;
2716
- }
2717
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2718
- emit(event, ...rest) {
2719
- if (event === "end") {
2720
- if (!this.endEmitted) {
2721
- this.endEmitted = true;
2722
- super.emit("end", this.rowCount);
2723
- }
2724
- return false;
2725
- }
2726
- return super.emit(event, ...rest);
2727
- }
2728
- _transform(data, encoding, done) {
2729
- if (this.hasHitRowLimit) {
2730
- return done();
2731
- }
2732
- const wrappedCallback = _CsvParserStream.wrapDoneCallback(done);
2733
- try {
2734
- const { lines } = this;
2735
- const newLine = lines + this.decoder.write(data);
2736
- const rows = this.parse(newLine, true);
2737
- return this.processRows(rows, wrappedCallback);
2738
- } catch (e) {
2739
- return wrappedCallback(e);
2740
- }
2741
- }
2742
- _flush(done) {
2743
- const wrappedCallback = _CsvParserStream.wrapDoneCallback(done);
2744
- if (this.hasHitRowLimit) {
2745
- return wrappedCallback();
2746
- }
2747
- try {
2748
- const newLine = this.lines + this.decoder.end();
2749
- const rows = this.parse(newLine, false);
2750
- return this.processRows(rows, wrappedCallback);
2751
- } catch (e) {
2752
- return wrappedCallback(e);
2753
- }
2754
- }
2755
- parse(data, hasMoreData) {
2756
- if (!data) {
2757
- return [];
2758
- }
2759
- const { line, rows } = this.parser.parse(data, hasMoreData);
2760
- this.lines = line;
2761
- return rows;
2762
- }
2763
- processRows(rows, cb) {
2764
- const rowsLength = rows.length;
2765
- const iterate = (i) => {
2766
- const callNext = (err) => {
2767
- if (err) {
2768
- return cb(err);
2769
- }
2770
- if (i % 100 === 0) {
2771
- setImmediate(() => {
2772
- return iterate(i + 1);
2773
- });
2774
- return void 0;
2775
- }
2776
- return iterate(i + 1);
2777
- };
2778
- this.checkAndEmitHeaders();
2779
- if (i >= rowsLength || this.hasHitRowLimit) {
2780
- return cb();
2781
- }
2782
- this.parsedLineCount += 1;
2783
- if (this.shouldSkipLine) {
2784
- return callNext();
2785
- }
2786
- const row = rows[i];
2787
- this.rowCount += 1;
2788
- this.parsedRowCount += 1;
2789
- const nextRowCount = this.rowCount;
2790
- return this.transformRow(row, (err, transformResult) => {
2791
- if (err) {
2792
- this.rowCount -= 1;
2793
- return callNext(err);
2794
- }
2795
- if (!transformResult) {
2796
- return callNext(new Error("expected transform result"));
2797
- }
2798
- if (!transformResult.isValid) {
2799
- this.emit("data-invalid", transformResult.row, nextRowCount, transformResult.reason);
2800
- } else if (transformResult.row) {
2801
- return this.pushRow(transformResult.row, callNext);
2802
- }
2803
- return callNext();
2804
- });
2805
- };
2806
- iterate(0);
2807
- }
2808
- transformRow(parsedRow, cb) {
2809
- try {
2810
- this.headerTransformer.transform(parsedRow, (err, withHeaders) => {
2811
- if (err) {
2812
- return cb(err);
2813
- }
2814
- if (!withHeaders) {
2815
- return cb(new Error("Expected result from header transform"));
2816
- }
2817
- if (!withHeaders.isValid) {
2818
- if (this.shouldEmitRows) {
2819
- return cb(null, { isValid: false, row: parsedRow });
2820
- }
2821
- return this.skipRow(cb);
2822
- }
2823
- if (withHeaders.row) {
2824
- if (this.shouldEmitRows) {
2825
- return this.rowTransformerValidator.transformAndValidate(withHeaders.row, cb);
2826
- }
2827
- return this.skipRow(cb);
2828
- }
2829
- this.rowCount -= 1;
2830
- this.parsedRowCount -= 1;
2831
- return cb(null, { row: null, isValid: true });
2832
- });
2833
- } catch (e) {
2834
- cb(e);
2835
- }
2836
- }
2837
- checkAndEmitHeaders() {
2838
- if (!this.headersEmitted && this.headerTransformer.headers) {
2839
- this.headersEmitted = true;
2840
- this.emit("headers", this.headerTransformer.headers);
2841
- }
2842
- }
2843
- skipRow(cb) {
2844
- this.rowCount -= 1;
2845
- return cb(null, { row: null, isValid: true });
2846
- }
2847
- pushRow(row, cb) {
2848
- try {
2849
- if (!this.parserOptions.objectMode) {
2850
- this.push(JSON.stringify(row));
2851
- } else {
2852
- this.push(row);
2853
- }
2854
- cb();
2855
- } catch (e) {
2856
- cb(e);
2857
- }
2858
- }
2859
- static wrapDoneCallback(done) {
2860
- let errorCalled = false;
2861
- return (err, ...args) => {
2862
- if (err) {
2863
- if (errorCalled) {
2864
- throw err;
2865
- }
2866
- errorCalled = true;
2867
- done(err);
2868
- return;
2869
- }
2870
- done(...args);
2871
- };
2872
- }
2873
- };
2874
- exports.CsvParserStream = CsvParserStream;
2875
- }
2876
- });
2877
-
2878
- // ../../node_modules/@fast-csv/parse/build/src/index.js
2879
- var require_src2 = __commonJS({
2880
- "../../node_modules/@fast-csv/parse/build/src/index.js"(exports) {
2881
- "use strict";
2882
- var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
2883
- if (k2 === void 0) k2 = k;
2884
- var desc = Object.getOwnPropertyDescriptor(m, k);
2885
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
2886
- desc = { enumerable: true, get: function() {
2887
- return m[k];
2888
- } };
2889
- }
2890
- Object.defineProperty(o, k2, desc);
2891
- }) : (function(o, m, k, k2) {
2892
- if (k2 === void 0) k2 = k;
2893
- o[k2] = m[k];
2894
- }));
2895
- var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
2896
- Object.defineProperty(o, "default", { enumerable: true, value: v });
2897
- }) : function(o, v) {
2898
- o["default"] = v;
2899
- });
2900
- var __importStar = exports && exports.__importStar || function(mod) {
2901
- if (mod && mod.__esModule) return mod;
2902
- var result = {};
2903
- if (mod != null) {
2904
- for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
2905
- }
2906
- __setModuleDefault(result, mod);
2907
- return result;
2908
- };
2909
- var __exportStar = exports && exports.__exportStar || function(m, exports2) {
2910
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
2911
- };
2912
- Object.defineProperty(exports, "__esModule", { value: true });
2913
- exports.parseString = exports.parseFile = exports.parseStream = exports.parse = exports.ParserOptions = exports.CsvParserStream = void 0;
2914
- var fs = __importStar(__require("fs"));
2915
- var stream_1 = __require("stream");
2916
- var ParserOptions_1 = require_ParserOptions();
2917
- var CsvParserStream_1 = require_CsvParserStream();
2918
- __exportStar(require_types2(), exports);
2919
- var CsvParserStream_2 = require_CsvParserStream();
2920
- Object.defineProperty(exports, "CsvParserStream", { enumerable: true, get: function() {
2921
- return CsvParserStream_2.CsvParserStream;
2922
- } });
2923
- var ParserOptions_2 = require_ParserOptions();
2924
- Object.defineProperty(exports, "ParserOptions", { enumerable: true, get: function() {
2925
- return ParserOptions_2.ParserOptions;
2926
- } });
2927
- var parse = (args) => {
2928
- return new CsvParserStream_1.CsvParserStream(new ParserOptions_1.ParserOptions(args));
2929
- };
2930
- exports.parse = parse;
2931
- var parseStream = (stream, options) => {
2932
- return stream.pipe(new CsvParserStream_1.CsvParserStream(new ParserOptions_1.ParserOptions(options)));
2933
- };
2934
- exports.parseStream = parseStream;
2935
- var parseFile = (location, options = {}) => {
2936
- return fs.createReadStream(location).pipe(new CsvParserStream_1.CsvParserStream(new ParserOptions_1.ParserOptions(options)));
2937
- };
2938
- exports.parseFile = parseFile;
2939
- var parseString = (string, options) => {
2940
- const rs = new stream_1.Readable();
2941
- rs.push(string);
2942
- rs.push(null);
2943
- return rs.pipe(new CsvParserStream_1.CsvParserStream(new ParserOptions_1.ParserOptions(options)));
2944
- };
2945
- exports.parseString = parseString;
2946
- }
2947
- });
2948
-
2949
- // ../../node_modules/fast-csv/build/src/index.js
2950
- var require_src3 = __commonJS({
2951
- "../../node_modules/fast-csv/build/src/index.js"(exports) {
2952
- Object.defineProperty(exports, "__esModule", { value: true });
2953
- exports.CsvParserStream = exports.ParserOptions = exports.parseFile = exports.parseStream = exports.parseString = exports.parse = exports.FormatterOptions = exports.CsvFormatterStream = exports.writeToPath = exports.writeToString = exports.writeToBuffer = exports.writeToStream = exports.write = exports.format = void 0;
2954
- var format_1 = require_src();
2955
- Object.defineProperty(exports, "format", { enumerable: true, get: function() {
2956
- return format_1.format;
2957
- } });
2958
- Object.defineProperty(exports, "write", { enumerable: true, get: function() {
2959
- return format_1.write;
2960
- } });
2961
- Object.defineProperty(exports, "writeToStream", { enumerable: true, get: function() {
2962
- return format_1.writeToStream;
2963
- } });
2964
- Object.defineProperty(exports, "writeToBuffer", { enumerable: true, get: function() {
2965
- return format_1.writeToBuffer;
2966
- } });
2967
- Object.defineProperty(exports, "writeToString", { enumerable: true, get: function() {
2968
- return format_1.writeToString;
2969
- } });
2970
- Object.defineProperty(exports, "writeToPath", { enumerable: true, get: function() {
2971
- return format_1.writeToPath;
2972
- } });
2973
- Object.defineProperty(exports, "CsvFormatterStream", { enumerable: true, get: function() {
2974
- return format_1.CsvFormatterStream;
2975
- } });
2976
- Object.defineProperty(exports, "FormatterOptions", { enumerable: true, get: function() {
2977
- return format_1.FormatterOptions;
2978
- } });
2979
- var parse_1 = require_src2();
2980
- Object.defineProperty(exports, "parse", { enumerable: true, get: function() {
2981
- return parse_1.parse;
2982
- } });
2983
- Object.defineProperty(exports, "parseString", { enumerable: true, get: function() {
2984
- return parse_1.parseString;
2985
- } });
2986
- Object.defineProperty(exports, "parseStream", { enumerable: true, get: function() {
2987
- return parse_1.parseStream;
2988
- } });
2989
- Object.defineProperty(exports, "parseFile", { enumerable: true, get: function() {
2990
- return parse_1.parseFile;
2991
- } });
2992
- Object.defineProperty(exports, "ParserOptions", { enumerable: true, get: function() {
2993
- return parse_1.ParserOptions;
2994
- } });
2995
- Object.defineProperty(exports, "CsvParserStream", { enumerable: true, get: function() {
2996
- return parse_1.CsvParserStream;
2997
- } });
2998
- }
2999
- });
3000
- export default require_src3();
3001
- //# sourceMappingURL=src-YEKAFGYK.js.map